From f8fa8b2b37da9bd373c3c2ce7458d22c487755e0 Mon Sep 17 00:00:00 2001 From: Pablo Luna Date: Tue, 29 Mar 2011 17:06:59 +0100 Subject: [PATCH] fixing text edition problems --- mindplot/src/main/javascript/MindmapDesigner.js | 1 + mindplot/src/main/javascript/TextEditor.js | 16 ++++++++++++++++ .../layoutManagers/OriginalLayoutManager.js | 8 ++++---- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/mindplot/src/main/javascript/MindmapDesigner.js b/mindplot/src/main/javascript/MindmapDesigner.js index a20b1f5e..f9d14362 100644 --- a/mindplot/src/main/javascript/MindmapDesigner.js +++ b/mindplot/src/main/javascript/MindmapDesigner.js @@ -91,6 +91,7 @@ mindplot.MindmapDesigner.prototype._registerEvents = function() // Create nodes on double click... screenManager.addEventListener('click', function(event) { + var t = mindmapDesigner.getEditor()._isVisible(); mindmapDesigner.getEditor().lostFocus(); // @todo: Puaj hack... mindmapDesigner._cleanScreen(); diff --git a/mindplot/src/main/javascript/TextEditor.js b/mindplot/src/main/javascript/TextEditor.js index d9549909..abe42c11 100644 --- a/mindplot/src/main/javascript/TextEditor.js +++ b/mindplot/src/main/javascript/TextEditor.js @@ -68,6 +68,7 @@ mindplot.TextEditor = function(screenManager,actionRunner) }; //Register onLostFocus/onBlur event $(this.inputText).addEvent('blur', this.lostFocusEvent.bind(this)); + $(this.inputText).addEvent('click', this.clickEvent.bindWithEvent(this)); var elem = this; @@ -98,6 +99,7 @@ mindplot.TextEditor.prototype.lostFocusEvent = function () { this.fx.options.duration = 10; this.fx.start(1, 0); + designer.getWorkSpace().enableWorkspaceEvents(true); //myAnim.animate(); }; @@ -386,3 +388,17 @@ mindplot.TextEditor.prototype.lostFocus = function(bothBrowsers) } }; +mindplot.TextEditor.prototype.clickEvent = function(event){ + designer.getWorkSpace().enableWorkspaceEvents(false); + if(this._isVisible()){ + if (event.stopPropagation) + { + event.stopPropagation(true); + } else + { + event.cancelBubble = true; + } + } + event.preventDefault(); +}; + diff --git a/mindplot/src/main/javascript/layoutManagers/OriginalLayoutManager.js b/mindplot/src/main/javascript/layoutManagers/OriginalLayoutManager.js index e810013a..18e42d01 100644 --- a/mindplot/src/main/javascript/layoutManagers/OriginalLayoutManager.js +++ b/mindplot/src/main/javascript/layoutManagers/OriginalLayoutManager.js @@ -94,11 +94,11 @@ mindplot.layoutManagers.OriginalLayoutManager = mindplot.layoutManagers.BaseLayo dragger.add(topic); } - /*// Register editor events ... - if (!this._viewMode) + // Register editor events ... + if (!this.getDesigner()._viewMode) { - this._editor.listenEventOnNode(topic, 'dblclick', true); - }*/ + this.getDesigner()._editor.listenEventOnNode(topic, 'dblclick', true); + } }, _createMainTopicBoard:function(node){