fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
editor: actions returns via callback
[fnpeditor.git]
/
src
/
editor
/
plugins
/
core
/
switch.js
diff --git
a/src/editor/plugins/core/switch.js
b/src/editor/plugins/core/switch.js
index
2403c2b
..
57b28b9
100644
(file)
--- a/
src/editor/plugins/core/switch.js
+++ b/
src/editor/plugins/core/switch.js
@@
-16,7
+16,8
@@
var createSwitchAction = function(createParams) {
var state = {
label: this.config.label
},
var state = {
label: this.config.label
},
- f = params.fragment;
+ f = params.fragment,
+ description;
if(
if(
@@
-37,11
+38,12
@@
var createSwitchAction = function(createParams) {
toSwitch = toSwitch.getParent(createParams.from);
}
toSwitch = toSwitch.getParent(createParams.from);
}
+ description = 'Switch to ' + createParams.to.name;
return _.extend(state, {
allowed: !!toSwitch,
toggled: alreadyInTarget,
return _.extend(state, {
allowed: !!toSwitch,
toggled: alreadyInTarget,
- description:
'Switch to ' + createParams.to.name
,
- execute: alreadyInTarget ? function() {} : function() {
+ description:
description
,
+ execute: alreadyInTarget ? function() {} : function(
callback
) {
f.document.transaction(function() {
if(createParams.to.tagName) {
toSwitch = toSwitch.setTag(createParams.to.tagName);
f.document.transaction(function() {
if(createParams.to.tagName) {
toSwitch = toSwitch.setTag(createParams.to.tagName);
@@
-49,6
+51,11
@@
var createSwitchAction = function(createParams) {
if(!_.isUndefined(createParams.to.klass)) {
toSwitch.setClass(createParams.to.klass);
}
if(!_.isUndefined(createParams.to.klass)) {
toSwitch.setClass(createParams.to.klass);
}
+ }, {
+ metadata: {
+ description: description
+ },
+ success: callback
});
}
});
});
}
});