mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-20 23:16:15 +08:00
Fix editor close when clicking restore notification [SCI-7729]
This commit is contained in:
parent
19b282cba2
commit
edfc1c4e08
12
app/javascript/packs/tiny_mce.js
vendored
12
app/javascript/packs/tiny_mce.js
vendored
|
@ -85,6 +85,14 @@ window.TinyMCE = (() => {
|
|||
$(notificationBar).append(restoreBtn).append(cancelBtn);
|
||||
$(editor.contentAreaContainer).before(notificationBar);
|
||||
|
||||
// Prevents save on blur if clicking draft notification
|
||||
$('.restore-draft-notification').on('mousedown', () => {
|
||||
editor.isBlurTempDisabled = true;
|
||||
setTimeout(() => {
|
||||
editor.isBlurTempDisabled = false;
|
||||
}, 500);
|
||||
});
|
||||
|
||||
$(restoreBtn).click(() => {
|
||||
editor.plugins.autosave.restoreDraft();
|
||||
makeItDirty(editor);
|
||||
|
@ -357,6 +365,8 @@ window.TinyMCE = (() => {
|
|||
if (options.afterInitCallback) { options.afterInitCallback(); }
|
||||
},
|
||||
setup: (editor) => {
|
||||
editor.isBlurTempDisabled = false;
|
||||
|
||||
editor.on('keydown', (e) => {
|
||||
if (e.key === 'Enter' && $(editor.contentDocument.activeElement).atwho('isSelecting')) {
|
||||
return false;
|
||||
|
@ -393,7 +403,7 @@ window.TinyMCE = (() => {
|
|||
});
|
||||
|
||||
editor.on('blur', () => {
|
||||
if (editor.blurDisabled) return false;
|
||||
if (editor.isBlurTempDisabled || editor.blurDisabled) return false;
|
||||
|
||||
if ($('.atwho-view:visible').length || $('#MarvinJsModal:visible').length) return false;
|
||||
setTimeout(() => {
|
||||
|
|
Loading…
Reference in a new issue