Recovering focus/cursor on custom menu button click #1216
-
I am emulating the code from the playground in a svelte app. I created custom buttons and attached the calls to Svelte's The code I am emulating is in react and I have switched away from react quite a few years ago and do not see what is different in the react code that makes the focus return-to/stay-with the editor. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Just call |
Beta Was this translation helpful? Give feedback.
-
Thanks. That does indeed work. It takes one more layer to get access to the context, but not difficult. |
Beta Was this translation helpful? Give feedback.
-
You should use mousedown event with This is a good example to understand these event behaviors. |
Beta Was this translation helpful? Give feedback.
Just call
focus
on editor view, an example is here: https://github.com/Milkdown/milkdown/blob/main/packages/components/src/link-tooltip/edit/edit-view.ts#L45