fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
wider select boxes
[fnpeditor.git]
/
src
/
editor
/
plugins
/
core
/
templates.js
diff --git
a/src/editor/plugins/core/templates.js
b/src/editor/plugins/core/templates.js
index
1114258
..
bca8467
100644
(file)
--- a/
src/editor/plugins/core/templates.js
+++ b/
src/editor/plugins/core/templates.js
@@
-16,6
+16,8
@@
var insertTemplateAction = {
icon: 'core.plus'
},
getState: function(params) {
icon: 'core.plus'
},
getState: function(params) {
+ var description;
+
if(!(params.template && params.template.id)) {
return {
allowed: false,
if(!(params.template && params.template.id)) {
return {
allowed: false,
@@
-31,13
+33,22
@@
var insertTemplateAction = {
description: gettext('Wrong node selected')
};
}
description: gettext('Wrong node selected')
};
}
+
+ description = interpolate(gettext('Insert template %s'), [params.template.name]);
return {
allowed: true,
return {
allowed: true,
- description:
interpolate(gettext('Insert template %s after %s'), [params.template.name, params.fragment.node.getNearestElementNode().getTagName()])
,
- execute: function(params) {
+ description:
description
,
+ execute: function(
callback,
params) {
var node = params.fragment.node.getNearestElementNode();
var node = params.fragment.node.getNearestElementNode();
- var toAdd = node.document.createDocumentNode(params.template.content);
- node.after(toAdd);
+ node.document.transaction(function() {
+ var toAdd = node.document.createDocumentNode(params.template.content);
+ node.after(toAdd);
+ }, {
+ metadata: {
+ description: description
+ },
+ success: callback
+ });
}
};
}
}
};
}