-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
) Ensures that we refocus the editor element after `toggleMarkup`. Clicking a button can cause the button to become focused (e.g. `document.activeElement === buttonElement`) but the window's `getSelection` is still in the editor. When the selection is in the editor but it is not focused, key up/down/press events don't fire on it. Since it has the selection, typing causes the browser to mutate the editor element's dom and bypass the key* event handlers. In addition to being generally unwanted, this has the downside that the mutation will insert text to match its surrounding style, so the `toggleMarkup` ends up having no effect. After this change, it is possible to click e.g. the "bold" button when the selection is collapsed, and the next characters typed will be bold, as expected.
- Loading branch information
Showing
3 changed files
with
71 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters