diff --git a/packages/client/src/tiptap/wrappers/mind/index.tsx b/packages/client/src/tiptap/wrappers/mind/index.tsx index dfc7a48..478f3b0 100644 --- a/packages/client/src/tiptap/wrappers/mind/index.tsx +++ b/packages/client/src/tiptap/wrappers/mind/index.tsx @@ -134,8 +134,9 @@ export const MindWrapper = ({ editor, node, updateAttributes }) => { minder.execCommand('zoom', parseInt(zoom)); if (!isEditable) { - minder.disable(); + minder.preventEdit = true; } else { + minder.preventEdit = false; minder.enable(); } @@ -172,8 +173,9 @@ export const MindWrapper = ({ editor, node, updateAttributes }) => { if (!minder) return; if (!isEditable) { - minder.disable(); + minder.preventEdit = true; } else { + minder.preventEdit = false; minder.enable(); } }, [isEditable]); diff --git a/packages/client/src/tiptap/wrappers/mind/kityminder/kity-core/core/template.js b/packages/client/src/tiptap/wrappers/mind/kityminder/kity-core/core/template.js index 73a1720..1d56c27 100644 --- a/packages/client/src/tiptap/wrappers/mind/kityminder/kity-core/core/template.js +++ b/packages/client/src/tiptap/wrappers/mind/kityminder/kity-core/core/template.js @@ -26,7 +26,7 @@ define(function (require, exports, module) { return { useTemplate: function (name, duration) { this.setTemplate(name); - this.refresh(duration || 500); + this.refresh(duration || 800); }, getTemplate: function () { @@ -68,7 +68,6 @@ define(function (require, exports, module) { }; })() ); - let timer = null; Module.register('TemplateModule', { /** @@ -86,10 +85,7 @@ define(function (require, exports, module) { execute: function (minder, name) { minder.useTemplate(name); - clearTimeout(timer); - timer = setTimeout(() => { - minder.execCommand('camera'); - }, 550); + minder.execCommand('camera'); }, queryValue: function (minder) { diff --git a/packages/client/src/tiptap/wrappers/mind/kityminder/kity-editor/runtime/hotbox.js b/packages/client/src/tiptap/wrappers/mind/kityminder/kity-editor/runtime/hotbox.js index a9a1e00..568b902 100644 --- a/packages/client/src/tiptap/wrappers/mind/kityminder/kity-editor/runtime/hotbox.js +++ b/packages/client/src/tiptap/wrappers/mind/kityminder/kity-editor/runtime/hotbox.js @@ -14,9 +14,18 @@ define(function (require, exports, module) { var minder = this.minder; var receiver = this.receiver; var container = this.container; + + if (minder.preventEdit) { + return; + } + var hotbox = new Hotbox(container); hotbox.setParentFSM(fsm); fsm.when('normal -> hotbox', function (exit, enter, reason) { + if (minder.preventEdit) { + return; + } + var node = minder.getSelectedNode(); var position; if (node) { diff --git a/packages/client/src/tiptap/wrappers/mind/kityminder/kity-editor/runtime/input.js b/packages/client/src/tiptap/wrappers/mind/kityminder/kity-editor/runtime/input.js index dcd5181..783d985 100644 --- a/packages/client/src/tiptap/wrappers/mind/kityminder/kity-editor/runtime/input.js +++ b/packages/client/src/tiptap/wrappers/mind/kityminder/kity-editor/runtime/input.js @@ -19,6 +19,11 @@ define(function (require, exports, module) { var receiver = this.receiver; var receiverElement = receiver.element; var isGecko = window.kity.Browser.gecko; + + if (minder.disableEdit) { + return; + } + // setup everything to go setupReciverElement(); setupFsm(); @@ -91,6 +96,10 @@ define(function (require, exports, module) { */ // edit for the selected node function editText() { + if (minder.preventEdit) { + return; + } + var node = minder.getSelectedNode(); if (!node) { return; @@ -120,6 +129,10 @@ define(function (require, exports, module) { * @Date 2015-12-2 */ function enterInputMode() { + if (minder.preventEdit) { + return; + } + var node = minder.getSelectedNode(); if (node) { var fontSize = node.getData('font-size') || node.getStyle('font-size');