mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-29 09:04:54 +01:00
Workaround for change text event.
This commit is contained in:
parent
7feb29b151
commit
53768b5400
@ -54,7 +54,6 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
};
|
};
|
||||||
|
|
||||||
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicId, position);
|
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicId, position);
|
||||||
command.desc = "move topic";
|
|
||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -72,7 +71,6 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds);
|
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds);
|
||||||
command.desc = "changeFontStyleToTopic";
|
|
||||||
this.execute(command);
|
this.execute(command);
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -85,9 +83,9 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
topic.setText(value);
|
topic.setText(value);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
command.commandType = "changeTextToTopic";
|
||||||
|
|
||||||
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, text);
|
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, text);
|
||||||
command.desc = "changeTextToTopic";
|
|
||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -105,8 +103,6 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
};
|
};
|
||||||
|
|
||||||
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicIds, fontFamily);
|
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicIds, fontFamily);
|
||||||
command.desc = "changeFontFamilyToTopic";
|
|
||||||
|
|
||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -122,7 +118,6 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
|
|
||||||
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, color);
|
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, color);
|
||||||
command.discardDuplicated = "fontColorCommandId";
|
command.discardDuplicated = "fontColorCommandId";
|
||||||
command.desc = "changeFontColorToTopic";
|
|
||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -138,8 +133,6 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
|
|
||||||
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, color);
|
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, color);
|
||||||
command.discardDuplicated = "backColor";
|
command.discardDuplicated = "backColor";
|
||||||
command.desc = "changeBackgroundColorToTopic";
|
|
||||||
|
|
||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -155,8 +148,6 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
|
|
||||||
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, color);
|
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, color);
|
||||||
command.discardDuplicated = "borderColorCommandId";
|
command.discardDuplicated = "borderColorCommandId";
|
||||||
command.desc = "changeBorderColorToTopic";
|
|
||||||
|
|
||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -173,8 +164,6 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
};
|
};
|
||||||
|
|
||||||
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, size);
|
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, size);
|
||||||
command.desc = "changeFontSizeToTopic";
|
|
||||||
|
|
||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -189,8 +178,6 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
};
|
};
|
||||||
|
|
||||||
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, shapeType);
|
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, shapeType);
|
||||||
command.desc = "changeShapeTypeToTopic";
|
|
||||||
|
|
||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -207,8 +194,6 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
};
|
};
|
||||||
|
|
||||||
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds);
|
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds);
|
||||||
command.desc = "changeFontWeightToTopic";
|
|
||||||
|
|
||||||
this.execute(command);
|
this.execute(command);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -221,8 +206,6 @@ mindplot.StandaloneActionDispatcher = new Class({
|
|||||||
};
|
};
|
||||||
|
|
||||||
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, collapse);
|
var command = new mindplot.commands.GenericFunctionCommand(commandFunc, topicsIds, collapse);
|
||||||
command.desc = "shrinkBranch";
|
|
||||||
|
|
||||||
this.execute(command, false);
|
this.execute(command, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -32,19 +32,26 @@ mindplot.commands.GenericFunctionCommand = new Class({
|
|||||||
execute:function (commandContext) {
|
execute:function (commandContext) {
|
||||||
if (!this.applied) {
|
if (!this.applied) {
|
||||||
|
|
||||||
// @Todo: Debug hack. Remove
|
var topics = null;
|
||||||
var topics;
|
|
||||||
try {
|
try {
|
||||||
topics = commandContext.findTopics(this._topicsId);
|
topics = commandContext.findTopics(this._topicsId);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(e + "," + this._commandFunc + "," + this._commandFunc.desc);
|
if (this._commandFunc.commandType != "changeTextToTopic") {
|
||||||
|
// Workaround: For some reason, there is a combination of events that involves
|
||||||
|
// making some modification and firing out out focus. This is causing
|
||||||
|
// that a remove node try to be removed. In some other life, I will come with the solution.
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (topics != null) {
|
||||||
topics.each(function (topic) {
|
topics.each(function (topic) {
|
||||||
var oldValue = this._commandFunc(topic, this._value);
|
var oldValue = this._commandFunc(topic, this._value);
|
||||||
this._oldValues.push(oldValue);
|
this._oldValues.push(oldValue);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
}
|
||||||
this.applied = true;
|
this.applied = true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw "Command can not be applied two times in a row.";
|
throw "Command can not be applied two times in a row.";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user