Skip to content

Commit 086225b

Browse files
committed
fixed: tinymce v5 bugs
1 parent 22abf3d commit 086225b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/plugin.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
top: 0;
6969
left: 0;
7070
background: black;
71-
opacity: 0.8;
71+
opacity: 0.7;
7272
width: 100%;
7373
height: 100%;
7474
z-index: 1;
@@ -270,7 +270,7 @@
270270
// Detect and set fallback model if its required
271271
if(!Config.fallbackModal){
272272
// case: inline mode, < v5
273-
if(editor.getParam('inline') === true || tinymce.majorVersion < 5){
273+
if(editor.getParam('inline') === true || tinymce.majorVersion <= 5){
274274
Config.fallbackModal = true
275275
}
276276
}
@@ -402,7 +402,10 @@
402402
onSaveHandler();
403403
hideModal();
404404
};
405-
modal.element.querySelector('#supercode-editor').addEventListener('keydown', modalKeydownListener);
405+
406+
if(Config.shortcut){
407+
modal.element.querySelector('#supercode-editor').addEventListener('keydown', modalKeydownListener);
408+
}
406409

407410
/* Update Modal based on editor's theme */
408411
document.querySelector('body').classList.add('disable-scroll');
@@ -425,7 +428,9 @@
425428
}
426429

427430
const hideModal = () => {
428-
removeEventListener('keydown', modalKeydownListener);
431+
if(Config.shortcut){
432+
removeEventListener('keydown', modalKeydownListener);
433+
}
429434
document.querySelector('body').classList.remove('disable-scroll');
430435
modal.element.style.opacity = 0;
431436
editor.focus();
@@ -531,6 +536,7 @@
531536
}
532537
}
533538
};
539+
534540
editor.ui.registry.addView('supercode', CodeView);
535541
}
536542

0 commit comments

Comments
 (0)