0
0
Fork 0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-05-17 22:02:05 +00:00

Added tinymce de-focus toolbar hack for drawing editor load

The tinymce event system would not pick up the focus within the loaded
draw.io instance, after the drawing toolbar button was clicked, hence
the toolbar would hang around.

This adds a hack to dispatch a mousedown event on the body to get the
toolbar to hide.

For 
This commit is contained in:
Dan Brown 2022-07-25 19:56:01 +01:00
parent 050ae01f94
commit fee3022ad8
No known key found for this signature in database
GPG key ID: 46D9F943C24A2EF9
2 changed files with 2 additions and 1 deletions

View file

@ -165,7 +165,6 @@ function register(editor, url) {
showPopup(editor, textContent, '', (newCode, newLang) => {
const pre = doc.createElement('pre');
const code = doc.createElement('code');
console.log(newCode);
code.classList.add(`language-${newLang}`);
code.innerText = newCode;
pre.append(code);

View file

@ -106,6 +106,8 @@ export function getPlugin(providedOptions) {
icon: 'diagram',
onAction() {
editor.execCommand('drawio');
// Hack to de-focus the tinymce editor toolbar
window.document.body.dispatchEvent(new Event('mousedown', {bubbles: true}));
},
fetch(callback) {
callback([