Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Documentation issue #10

Open
po5i opened this issue Oct 16, 2017 · 1 comment
Open

Documentation issue #10

po5i opened this issue Oct 16, 2017 · 1 comment

Comments

@po5i
Copy link

po5i commented Oct 16, 2017

I found that moving the menu initialization to the timeout function worked instead of the documented version. Otherwise it does not show any suggestions.

My suggestion to be changed on the docs:

window.addEventListener('contextmenu', function(e) {
  // Only show the context menu in text editors.
  if (!e.target.closest('textarea, input, [contenteditable="true"]')) return;

  // The 'contextmenu' event is emitted after 'selectionchange' has fired but possibly before the
  // visible selection has changed. Try to wait to show the menu until after that, otherwise the
  // visible selection will update after the menu dismisses and look weird.
  setTimeout(function() {
    var menu = buildEditorContextMenu();
    menu.popup(remote.getCurrentWindow());
  }, 30);
});
@wearhere
Copy link
Contributor

Hm can you determine why? That seems like a bug, which I'd rather not mask with a timeout.

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

No branches or pull requests

2 participants