From 00ec27f6852f1dd85f4d90bbc3f1dbb84a0d7f8c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Mon, 2 Dec 2013 14:22:40 +0100 Subject: [PATCH] some ideas --- src/editor/plugins/core.js | 2 +- src/smartxml/smartxml.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/editor/plugins/core.js b/src/editor/plugins/core.js index d8b01c8..c4991f8 100644 --- a/src/editor/plugins/core.js +++ b/src/editor/plugins/core.js @@ -23,7 +23,7 @@ var breakContentTransformation = { }; -var breakContentAction = function(document, context) { +var breakContentAction = function(document, context) { //@ editor.getDocument(); editor.getContext('...') var textNode = context.cursor.currentNode; if(textNode) { var result, goto; diff --git a/src/smartxml/smartxml.js b/src/smartxml/smartxml.js index aa9a7c5..6cc3e33 100644 --- a/src/smartxml/smartxml.js +++ b/src/smartxml/smartxml.js @@ -395,6 +395,17 @@ ElementNode.prototype.transformations.register(transformations.createContextTran } })); +ElementNode.prototype.transformations.register(transformations.createContextTransformation({ + name: 'smartxml.setAttr2', + impl: function(args) { + this.prevAttr = this.getAttr(args.name); + this.setAttr(args.name, args.value); + }, + undo: function(args) { + this.setAttr(args.name, this.prevAttr); + } +})); + DocumentNode.prototype.transformations.register(transformations.createContextTransformation({ name: 'smartxml.wrapWith', getChangeRoot: function() { @@ -542,6 +553,10 @@ TextNode.prototype.transformations.register(transformations.createContextTransfo }, getChangeRoot: function() { return this.context.parent().parent(); + }, + isAllowed: function(args) { + var parent = this.parent(); + return !!(parent && parent.parent()); } })); -- 2.20.1