Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only Show EditorBubbleMenu on Editor Right Click #101

Closed
jordan-sussman opened this issue Jul 20, 2023 · 0 comments
Closed

Only Show EditorBubbleMenu on Editor Right Click #101

jordan-sussman opened this issue Jul 20, 2023 · 0 comments

Comments

@jordan-sussman
Copy link

jordan-sussman commented Jul 20, 2023

Description

Currently, when right-clicking inside the editor, both the browser's default context menu appear and the EditorBubbleMenu component. This can be a bit jarring at first glance.

Screenshot:
Screenshot 2023-07-20 at 3 45 31 PM

Solution

Prevent the EditorBubbleMenu component or the browser default context menu from appearing when right-clicking inside the editor.

The solution can be as simple as either:

On the editor's main div (here)

<div onContextMenu={preventDefaultContextMenu}>
const preventDefaultContextMenu = (e) => {
  e.preventDefault();
};

or

A listener:

div.addEventListener("contextmenu", (e) => {e.preventDefault()});

Alternative

If the above is not preferred, it could be worth making the EditorBubbleMenu less of a popover and more of a 'footer menu' that appears at the bottom of the editor when the focus is active in the editor (typing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants