adding new editor

This commit is contained in:
Pablo Luna 2011-04-17 19:04:02 +01:00
parent 5d911efa70
commit c804b3715e
12 changed files with 2020 additions and 415 deletions

View File

@ -74,6 +74,8 @@
<filelist dir="${basedir}/src/main/javascript/" files="DragTopicPositioner.js"/> <filelist dir="${basedir}/src/main/javascript/" files="DragTopicPositioner.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="Board.js"/> <filelist dir="${basedir}/src/main/javascript/" files="Board.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="TextEditor.js"/> <filelist dir="${basedir}/src/main/javascript/" files="TextEditor.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="RichTextEditor.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="TextEditorFactory.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="VariableDistanceBoard.js"/> <filelist dir="${basedir}/src/main/javascript/" files="VariableDistanceBoard.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="util/Shape.js"/> <filelist dir="${basedir}/src/main/javascript/" files="util/Shape.js"/>
<filelist dir="${basedir}/src/main/javascript/" files="FixedDistanceBoard.js"/> <filelist dir="${basedir}/src/main/javascript/" files="FixedDistanceBoard.js"/>
@ -207,6 +209,8 @@
<include>DragTopicPositioner-min.js</include> <include>DragTopicPositioner-min.js</include>
<include>Board-min.js</include> <include>Board-min.js</include>
<include>TextEditor-min.js</include> <include>TextEditor-min.js</include>
<include>RichTextEditor-min.js</include>
<include>TextEditorFactory-min.js</include>
<include>VariableDistanceBoard-min.js</include> <include>VariableDistanceBoard-min.js</include>
<include>util/Shape-min.js</include> <include>util/Shape-min.js</include>
<include>FixedDistanceBoard-min.js</include> <include>FixedDistanceBoard-min.js</include>

View File

@ -1,5 +1,8 @@
mindplot.EditorOptions = mindplot.EditorOptions =
{ {
// LayoutManager:"OriginalLayout" // LayoutManager:"OriginalLayout"
LayoutManager:"FreeMindLayout" LayoutManager:"FreeMindLayout",
// textEditor:"TextEditor"
textEditor:"RichTextEditor"
}; };

View File

@ -31,12 +31,13 @@ mindplot.MindmapDesigner = function(profile, divElement)
// Init Screen manager.. // Init Screen manager..
var screenManager = new mindplot.ScreenManager(profile.width, profile.height, divElement); var screenManager = new mindplot.ScreenManager(profile.width, profile.height, divElement);
//create editor
this._editor = new mindplot.TextEditor(screenManager, this._actionRunner);
var workspace = new mindplot.Workspace(profile, screenManager, this._zoom); var workspace = new mindplot.Workspace(profile, screenManager, this._zoom);
this._workspace = workspace; this._workspace = workspace;
//create editor
var editorClass = mindplot.TextEditorFactory.getTextEditorFromName(mindplot.EditorOptions.textEditor);
this._editor = new editorClass(this, this._actionRunner);
// Init layout managers ... // Init layout managers ...
this._topics = []; this._topics = [];
@ -91,14 +92,17 @@ mindplot.MindmapDesigner.prototype._registerEvents = function()
// Create nodes on double click... // Create nodes on double click...
screenManager.addEventListener('click', function(event) screenManager.addEventListener('click', function(event)
{ {
var t = mindmapDesigner.getEditor()._isVisible(); if(workspace.isWorkspaceEventsEnabled()){
var t = mindmapDesigner.getEditor().isVisible();
mindmapDesigner.getEditor().lostFocus(); mindmapDesigner.getEditor().lostFocus();
// @todo: Puaj hack... // @todo: Puaj hack...
mindmapDesigner._cleanScreen(); mindmapDesigner._cleanScreen();
}
}); });
screenManager.addEventListener('dblclick', function(event) screenManager.addEventListener('dblclick', function(event)
{ {
if(workspace.isWorkspaceEventsEnabled()){
mindmapDesigner.getEditor().lostFocus(); mindmapDesigner.getEditor().lostFocus();
// Get mouse position // Get mouse position
var pos = screenManager.getWorkspaceMousePosition(event); var pos = screenManager.getWorkspaceMousePosition(event);
@ -115,6 +119,7 @@ mindplot.MindmapDesigner.prototype._registerEvents = function()
// Execute action ... // Execute action ...
var command = new mindplot.commands.AddTopicCommand(model, centralTopicId, true); var command = new mindplot.commands.AddTopicCommand(model, centralTopicId, true);
this._actionRunner.execute(command); this._actionRunner.execute(command);
}
}.bind(this)); }.bind(this));
} }
; ;
@ -1036,6 +1041,7 @@ mindplot.MindmapDesigner.prototype.getSelectedObjects = function()
mindplot.MindmapDesigner.prototype.keyEventHandler = function(event) mindplot.MindmapDesigner.prototype.keyEventHandler = function(event)
{ {
if(this._workspace.isWorkspaceEventsEnabled()){
var evt = (event) ? event : window.event; var evt = (event) ? event : window.event;
if (evt.keyCode == 8) if (evt.keyCode == 8)
@ -1056,7 +1062,7 @@ mindplot.MindmapDesigner.prototype.keyEventHandler = function(event)
{ {
evt = new Event(event); evt = new Event(event);
var key = evt.key; var key = evt.key;
if (!this._editor._isVisible()) if (!this._editor.isVisible())
{ {
if (((evt.code >= 65 && evt.code <= 90) || (evt.code >= 48 && evt.code <= 57)) && !(evt.control || evt.meta)) if (((evt.code >= 65 && evt.code <= 90) || (evt.code >= 48 && evt.code <= 57)) && !(evt.control || evt.meta))
{ {
@ -1193,6 +1199,7 @@ mindplot.MindmapDesigner.prototype.keyEventHandler = function(event)
evt.stop(); evt.stop();
} }
} }
}
}; };
mindplot.MindmapDesigner.prototype._showEditor = function(key) mindplot.MindmapDesigner.prototype._showEditor = function(key)

View File

@ -0,0 +1,162 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
mindplot.RichTextEditor = mindplot.TextEditor.extend({
initialize:function(screenManager,actionRunner){
this.parent(screenManager, actionRunner);
},
_createUI:function(){
//Create editor ui
this._size = {width:440, height:200};
this._myOverlay = new Element('div').setStyles({position:"absolute", display: "none", zIndex: "8", top: "50%", left:"50%", marginLeft:"-200px", marginTop:"-90px", width:"400px", height:"180px"});
var inputContainer = new Element('div').setStyles({border:"none", overflow:"auto"}).injectInside(this._myOverlay);
this.inputText = new Element('textarea').setProperties({tabindex:'-1', id:"inputText2", value:""}).setStyles({width:"398px", height:"175px", border:"none", background:"transparent"}).injectInside(inputContainer);
/*var spanContainer = new Element('div').setStyle('visibility', "hidden").injectInside(this._myOverlay);
this._spanText = new Element('span').setProperties({id: "spanText2", tabindex:"-1"}).setStyle('white-space', "nowrap").setStyle('nowrap', 'nowrap').injectInside(spanContainer);
*/this._myOverlay.injectInside(this._screenManager.getContainer());
this._editorNode = new web2d.Rect(0.3,mindplot.Topic.OUTER_SHAPE_ATTRIBUTES);
this._editorNode.setSize(50,20);
this._editorNode.setVisibility(false);
this._designer.getWorkSpace().appendChild(this._editorNode);
// $(this.inputText).setStyle('display','block');
this._addListeners();
},
_addListeners:function(){
$(this._myOverlay).addEvent('click', function(event){
event.preventDefault();
event.stop();
}.bindWithEvent(this));
$(this._myOverlay).addEvent('dblclick', function(event){
event.preventDefault();
event.stop();
}.bindWithEvent(this));
},
getFocusEvent:function(node){
var screenSize = this._designer.getWorkSpace().getSize();
var coordOrigin = this._designer.getWorkSpace()._workspace.getCoordOrigin();
var middlePosition = {x:parseInt(screenSize.width)/2 + parseInt(coordOrigin.x), y:parseInt(screenSize.height)/2 + parseInt(coordOrigin.y)};
this._designer.getWorkSpace().enableWorkspaceEvents(false);
var position = node.getPosition().clone();
var size = node.getSize();
this._editorNode.setPosition(position.x-(size.width/2), position.y-(size.height/2));
position = this._editorNode.getPosition();
this._editorNode.setSize(size.width, size.height);
this._editorNode.moveToFront();
this._editorNode.setVisibility(true);
var scale = web2d.peer.utils.TransformUtil.workoutScale(node.getOuterShape());
// scale.width=1;
// scale.height = 1;
var steps = 10;
this._delta = {width:((this._size.width/scale.width)-size.width)/steps, height:((this._size.height/scale.height)-size.height)/steps};
var finx = (middlePosition.x-(((this._size.width)/2)/scale.width));
var finy = (middlePosition.y-((this._size.height/2)/scale.height));
var step = 10;
var d = {x:(position.x - finx)/step, y:(position.y - finy)/step};
var _animEffect = null;
var effect = function(){
if(step>=0){
var xStep= (position.x -finx)/step;
var yStep= (position.y -finy)/step;
var pos = {x:position.x - d.x*(10-step), y: position.y -d.y *(10-step)};
var size = this._editorNode.getSize();
this._editorNode.setSize(size.width + this._delta.width, size.height + this._delta.height);
this._editorNode.setPosition(pos.x, pos.y);
if(step>0)
this._editorNode.setOpacity(1-step/10);
step--;
}else{
$clear(_animEffect);
this._editorNode.setSize((this._size.width/scale.width), (this._size.height/scale.height));
this.init(node);
}
}.bind(this);
_animEffect = effect.periodical(10);
$(this.inputText).value = core.Utils.isDefined(this.initialText)&& this.initialText!=""? this.initialText: node.getText();
this._editor = new nicEditor({iconsPath: '../images/nicEditorIcons.gif', buttonList : ['bold','italic','underline','removeformat','forecolor', 'fontSize', 'fontFamily', 'xhtml']}).panelInstance("inputText2");
},
init:function(node){
this._currentNode = node;
this.applyChanges = false;
$(this._myOverlay.setStyle('display','block'));
inst = this._editor.instanceById("inputText2");
inst.elm.focus();
//becarefull this._editor is not mootools!!
this._editor.addEvent('blur',function(event){
this._myOverlay.setStyle('display','none');
var text = this._text;
this._text = this._editor.instanceById("inputText2").getContent();
if(text!=this._text){
this.applyChanges = true;
}
console.log('bye');
this.lostFocusListener();
this._editor.removeInstance("inputText2");
this._editor.destruct();
this._editor = null;
}.bind(this));
this._editor.fireEvent();
$(this.inputText).focus();
},
getText:function(){
return this._text;
},
lostFocusListener:function(){
this._hideNode();
if (this._currentNode != null)
{
if(this.applyChanges)
{
this._updateNode();
}
this.applyChanges=true;
this._currentNode = null;
}
},
_hideNode:function(){
var _animEffect = null;
var step = 10;
var position = this._editorNode.getPosition();
var finx = this._currentNode.getPosition().x - this._currentNode.getSize().width/2;
var finy = this._currentNode.getPosition().y - this._currentNode.getSize().height/2;
var d = {x:(position.x - finx)/step, y:(position.y - finy)/step};
var effect = function(){
if(step>=0){
var pos = {x:position.x - d.x*(10-step), y: position.y - d.y*(10-step)};
var size = this._editorNode.getSize();
this._editorNode.setSize(size.width - this._delta.width, size.height - this._delta.height);
this._editorNode.setPosition(pos.x, pos.y);
this._editorNode.setOpacity(step/10);
step--;
}else{
$clear(_animEffect);
this._designer.getWorkSpace().enableWorkspaceEvents(true);
this._editorNode.setVisibility(false); }
}.bind(this);
_animEffect = effect.periodical(10);
}
});

View File

@ -1,37 +1,46 @@
/* /*
* Copyright [2011] [wisemapping] * Copyright [2011] [wisemapping]
* *
* Licensed under WiseMapping Public License, Version 1.0 (the "License"). * Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the * It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page; * "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the license at * You may obtain a copy of the license at
* *
* http://www.wisemapping.org/license * http://www.wisemapping.org/license
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
mindplot.TextEditor = function(screenManager,actionRunner) mindplot.TextEditor = new Class({
{ initialize:function(designer,actionRunner)
this._screenManager = screenManager; {
this._container = screenManager.getContainer(); this._designer = designer;
this._screenManager = designer.getWorkSpace().getScreenManager();
this._container = this._screenManager.getContainer();
this._actionRunner = actionRunner; this._actionRunner = actionRunner;
this._isVisible=false;
//Create editor ui //Create editor ui
this._createUI();
this._addListeners();
},
_createUI:function(){
this._size = {width:500, height:100}; this._size = {width:500, height:100};
this._myOverlay = new Element('div').setStyles({position:"absolute", display: "none", zIndex: "8", top: 0, left:0, width:"500px", height:"100px"}); this._myOverlay = new Element('div').setStyles({position:"absolute", display: "none", zIndex: "8", top: 0, left:0, width:"500px", height:"100px"});
var inputContainer = new Element('div').setStyles({border:"none", overflow:"auto"}).injectInside(this._myOverlay); var inputContainer = new Element('div').setStyles({border:"none", overflow:"auto"}).injectInside(this._myOverlay);
this.inputText = new Element('input').setProperties({type:"text", tabindex:'-1', id:"inputText", value:""}).setStyles({border:"none", background:"transparent"}).injectInside(inputContainer); this.inputText = new Element('input').setProperties({type:"text", tabindex:'-1', id:"inputText", value:""}).setStyles({border:"none", background:"transparent"}).injectInside(inputContainer);
var spanContainer = new Element('div').setStyle('visibility', "hidden").injectInside(this._myOverlay); var spanContainer = new Element('div').setStyle('visibility', "hidden").injectInside(this._myOverlay);
this._spanText = new Element('span').setProperties({id: "spanText", tabindex:"-1"}).setStyle('white-space', "nowrap").setStyle('nowrap', 'nowrap').injectInside(spanContainer); this._spanText = new Element('span').setProperties({id: "spanText", tabindex:"-1"}).setStyle('white-space', "nowrap").setStyle('nowrap', 'nowrap').injectInside(spanContainer);
this._myOverlay.injectInside(this._container); this._myOverlay.injectInside(this._container);
},
_addListeners:function(){
var elem = this; var elem = this;
this.applyChanges=true; this.applyChanges=true;
this.inputText.onkeyup = function (evt) { this.inputText.onkeyup = function (evt) {
@ -75,6 +84,7 @@ mindplot.TextEditor = function(screenManager,actionRunner)
var elem = this; var elem = this;
var onComplete = function() { var onComplete = function() {
this._myOverlay.setStyle('display', "none"); this._myOverlay.setStyle('display', "none");
this._isVisible=false;
this.inputText.setStyle('opacity', 1); this.inputText.setStyle('opacity', 1);
this.setPosition(0, 0); this.setPosition(0, 0);
@ -93,44 +103,22 @@ mindplot.TextEditor = function(screenManager,actionRunner)
}; };
this.fx = new Fx.Style(this.inputText, 'opacity', { duration: 10}); this.fx = new Fx.Style(this.inputText, 'opacity', { duration: 10});
this.fx.addEvent('onComplete', onComplete.bind(this)); this.fx.addEvent('onComplete', onComplete.bind(this));
},
}; lostFocusEvent : function ()
{
mindplot.TextEditor.prototype.lostFocusEvent = function ()
{
this.fx.options.duration = 10; this.fx.options.duration = 10;
this.fx.start(1, 0); this.fx.start(1, 0);
//myAnim.animate(); //myAnim.animate();
}; },
isVisible : function ()
mindplot.TextEditor.prototype._isVisible = function () {
{ return this._isVisible;
},
getFocusEvent: function (node)
{
//console.log('focus event'); //console.log('focus event');
//if(this._myOverlay.cfg.getProperty("visible") == true) if (this.isVisible())
if ($(this._myOverlay).getStyle('display') == "block")
{ {
return true;
}
else
{
return false;
}
};
mindplot.TextEditor.prototype.getFocusEvent = function (node)
{
//console.log('focus event');
if (this._isVisible())
{
// var elem = this;
// var executor = function(editor)
// {
// return function()
// {
// elem.getFocusEvent.attempt(node, elem);
// };
// };
//
// setTimeout(executor(this), 10);
this.getFocusEvent.delay(10, this); this.getFocusEvent.delay(10, this);
} }
else else
@ -139,15 +127,13 @@ mindplot.TextEditor.prototype.getFocusEvent = function (node)
this.init(node); this.init(node);
} }
//console.log('focus event done'); //console.log('focus event done');
}; },
setInitialText : function (text)
mindplot.TextEditor.prototype.setInitialText = function (text) {
{
this.initialText=text; this.initialText=text;
}; },
_updateNode : function ()
mindplot.TextEditor.prototype._updateNode = function () {
{
if (core.Utils.isDefined(this._currentNode) && this._currentNode.getText() != this.getText()) if (core.Utils.isDefined(this._currentNode) && this._currentNode.getText() != this.getText())
{ {
@ -163,12 +149,13 @@ mindplot.TextEditor.prototype._updateNode = function ()
var command = new mindplot.commands.GenericFunctionCommand(commandFunc,text,[topicId]); var command = new mindplot.commands.GenericFunctionCommand(commandFunc,text,[topicId]);
this._actionRunner.execute(command); this._actionRunner.execute(command);
} }
}; },
listenEventOnNode : function(topic, eventName, stopPropagation)
mindplot.TextEditor.prototype.listenEventOnNode = function(topic, eventName, stopPropagation) {
{
var elem = this; var elem = this;
topic.addEventListener(eventName, function (event) { topic.addEventListener(eventName, function (event) {
if(elem._designer.getWorkSpace().isWorkspaceEventsEnabled()){
mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.NodeMouseOutEvent,[topic ]);
elem.lostFocus(); elem.lostFocus();
elem.getFocusEvent.attempt(topic, elem); elem.getFocusEvent.attempt(topic, elem);
@ -182,11 +169,11 @@ mindplot.TextEditor.prototype.listenEventOnNode = function(topic, eventName, sto
event.cancelBubble = true; event.cancelBubble = true;
} }
} }
}
}); });
}; },
init : function (nodeGraph)
mindplot.TextEditor.prototype.init = function (nodeGraph) {
{
//console.log('init method'); //console.log('init method');
nodeGraph.getTextShape().setVisibility(false); nodeGraph.getTextShape().setVisibility(false);
this._currentNode = nodeGraph; this._currentNode = nodeGraph;
@ -252,10 +239,9 @@ mindplot.TextEditor.prototype.init = function (nodeGraph)
setTimeout(executor(this), 10); setTimeout(executor(this), 10);
//console.log('init done'); //console.log('init done');
}; },
setStyle : function (fontStyle)
mindplot.TextEditor.prototype.setStyle = function (fontStyle) {
{
var inputField = $("inputText"); var inputField = $("inputText");
var spanField = $("spanText"); var spanField = $("spanText");
if (!core.Utils.isDefined(fontStyle.font)) if (!core.Utils.isDefined(fontStyle.font))
@ -283,10 +269,9 @@ mindplot.TextEditor.prototype.setStyle = function (fontStyle)
spanField.style.fontStyle = fontStyle.style; spanField.style.fontStyle = fontStyle.style;
spanField.style.fontWeight = fontStyle.weight; spanField.style.fontWeight = fontStyle.weight;
spanField.style.fontSize = fontStyle.size + "px"; spanField.style.fontSize = fontStyle.size + "px";
}; },
setText : function(text)
mindplot.TextEditor.prototype.setText = function(text) {
{
var inputField = $("inputText"); var inputField = $("inputText");
inputField.size = text.length + 1; inputField.size = text.length + 1;
//this._myOverlay.cfg.setProperty("width", (inputField.size * parseInt(inputField.style.fontSize) + 100) + "px"); //this._myOverlay.cfg.setProperty("width", (inputField.size * parseInt(inputField.style.fontSize) + 100) + "px");
@ -294,38 +279,31 @@ mindplot.TextEditor.prototype.setText = function(text)
var spanField = $("spanText"); var spanField = $("spanText");
spanField.innerHTML = text; spanField.innerHTML = text;
inputField.value = text; inputField.value = text;
}; },
getText : function()
mindplot.TextEditor.prototype.getText = function() {
{
return $('inputText').value; return $('inputText').value;
}; },
setEditorSize : function (width, height, scale)
{
mindplot.TextEditor.prototype.setEditorSize = function (width, height, scale)
{
//var scale = web2d.peer.utils.TransformUtil.workoutScale(this._currentNode.getTextShape()._peer); //var scale = web2d.peer.utils.TransformUtil.workoutScale(this._currentNode.getTextShape()._peer);
this._size = {width:width * scale.width, height:height * scale.height}; this._size = {width:width * scale.width, height:height * scale.height};
//this._myOverlay.cfg.setProperty("width",this._size.width*2+"px"); //this._myOverlay.cfg.setProperty("width",this._size.width*2+"px");
this._myOverlay.style.width = this._size.width * 2 + "px"; this._myOverlay.style.width = this._size.width * 2 + "px";
//this._myOverlay.cfg.setProperty("height",this._size.height+"px"); //this._myOverlay.cfg.setProperty("height",this._size.height+"px");
this._myOverlay.style.height = this._size.height + "px"; this._myOverlay.style.height = this._size.height + "px";
}; },
getSize : function ()
mindplot.TextEditor.prototype.getSize = function () {
{
return {width:$("spanText").offsetWidth,height:$("spanText").offsetHeight}; return {width:$("spanText").offsetWidth,height:$("spanText").offsetHeight};
}; },
setPosition : function (x, y, scale)
{
mindplot.TextEditor.prototype.setPosition = function (x, y, scale)
{
$(this._myOverlay).setStyles({top : y + "px", left: x + "px"}); $(this._myOverlay).setStyles({top : y + "px", left: x + "px"});
//this._myOverlay.style.left = x + "px"; //this._myOverlay.style.left = x + "px";
}; },
showTextEditor : function(selectText)
mindplot.TextEditor.prototype.showTextEditor = function(selectText) {
{
//this._myOverlay.show(); //this._myOverlay.show();
//var myAnim = new YAHOO.util.Anim('inputText',{opacity: {to:1}}, 0.10, YAHOO.util.Easing.easeOut); //var myAnim = new YAHOO.util.Anim('inputText',{opacity: {to:1}}, 0.10, YAHOO.util.Easing.easeOut);
//$('inputText').style.opacity='1'; //$('inputText').style.opacity='1';
@ -333,6 +311,7 @@ mindplot.TextEditor.prototype.showTextEditor = function(selectText)
//myAnim.onComplete.subscribe(function(){ //myAnim.onComplete.subscribe(function(){
//elem._myOverlay.show(); //elem._myOverlay.show();
elem._myOverlay.setStyle('display', "block"); elem._myOverlay.setStyle('display', "block");
this._isVisible=true;
//elem.cfg.setProperty("visible", false); //elem.cfg.setProperty("visible", false);
//elem._myOverlay.cfg.setProperty("xy", [0, 0]); //elem._myOverlay.cfg.setProperty("xy", [0, 0]);
//elem._myOverlay.cfg.setProperty("visible", true); //elem._myOverlay.cfg.setProperty("visible", true);
@ -376,20 +355,18 @@ mindplot.TextEditor.prototype.showTextEditor = function(selectText)
//}); //});
//myAnim.animate(); //myAnim.animate();
}; },
lostFocus : function(bothBrowsers)
mindplot.TextEditor.prototype.lostFocus = function(bothBrowsers) {
{ if (this.isVisible())
if (this._isVisible())
{ {
//the editor is opened in another node. lets Finish it. //the editor is opened in another node. lets Finish it.
var fireOnThis = $('inputText'); var fireOnThis = $('inputText');
fireOnThis.fireEvent('blur'); fireOnThis.fireEvent('blur');
} }
}; },
clickEvent : function(event){
mindplot.TextEditor.prototype.clickEvent = function(event){ if(this.isVisible()){
if(this._isVisible()){
if (core.Utils.isDefined(event.stopPropagation)) if (core.Utils.isDefined(event.stopPropagation))
{ {
event.stopPropagation(true); event.stopPropagation(true);
@ -399,10 +376,10 @@ mindplot.TextEditor.prototype.clickEvent = function(event){
} }
event.preventDefault(); event.preventDefault();
} }
};
mindplot.TextEditor.prototype.mouseDownEvent = function(event){ },
if(this._isVisible()){ mouseDownEvent : function(event){
if(this.isVisible()){
if (core.Utils.isDefined(event.stopPropagation)) if (core.Utils.isDefined(event.stopPropagation))
{ {
event.stopPropagation(true); event.stopPropagation(true);
@ -411,5 +388,7 @@ mindplot.TextEditor.prototype.mouseDownEvent = function(event){
event.cancelBubble = true; event.cancelBubble = true;
} }
} }
}; }
});

View File

@ -0,0 +1,28 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
mindplot.TextEditorFactory={};
mindplot.TextEditorFactory.getTextEditorFromName = function(name){
var editorClass = null;
if(name == "RichTextEditor"){
editorClass = mindplot.RichTextEditor;
}else {
editorClass = mindplot.TextEditor;
}
return editorClass;
};

View File

@ -443,6 +443,7 @@
<include>help.js</include> <include>help.js</include>
<include>helpPanel.js</include> <include>helpPanel.js</include>
<include>IconPanel.js</include> <include>IconPanel.js</include>
<!--<include>nicEdit.js</include>-->
</includes> </includes>
</aggregation> </aggregation>
</aggregations> </aggregations>

View File

@ -736,3 +736,7 @@ div#toolbar .topicRelation:hover {
div#toolbar .relationshiplabel{ div#toolbar .relationshiplabel{
width:56px; width:56px;
} }
.nicEdit-main {
outline:none;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,7 @@
<script type='text/javascript' src='../js/wiseLibrary.js'></script> <script type='text/javascript' src='../js/wiseLibrary.js'></script>
<script type='text/javascript' src='../js/wiseEditorLibrary.js'></script> <script type='text/javascript' src='../js/wiseEditorLibrary.js'></script>
<script type='text/javascript' src='../js/nicEdit.js'></script>
<script type='text/javascript' src='../js/core.js'></script> <script type='text/javascript' src='../js/core.js'></script>
<link rel="icon" href="../images/favicon.ico" type="image/x-icon"> <link rel="icon" href="../images/favicon.ico" type="image/x-icon">