Commit fd2dc360 authored by
fix: sticky toolbar disappears whenever it’s used. refs #597
as the toolbar is not directly a part of the codemirror editor editor.codemirror.hasFocus() returns false when one of the toolbar buttons is clicked. the new check checks both the editor itself and if the container element contains the currently focused element in the page. setTimeout is necessary to avoid false results for the contains call because at the time when our callback is executed activeElement might refer to the body element as the browser is in-between states. reschedulung our handler code in the event code will ensure that document.activeElement get’s the correct element.
Showing with 4 additions and 1 deletion