+//transformations['detach2'] = Detach2NodeTransformation;
+
+//2a. generyczna transformacja
+
+var createTransformation = function(desc) {
+
+ var NodeTransformation = function(args) {
+ this.nodePath = args.node.getPath();
+ this.document = args.node.document;
+ this.args = args;
+ };
+ $.extend(NodeTransformation.prototype, {
+ run: function() {
+ var node = this.document.getNodeByPath(this.nodePath),
+ root;
+
+ if(desc.getRoot) {
+ root = desc.getRoot(node);
+ } else {
+ root = this.document.root;
+ }
+
+ this.rootPath = root.getPath();
+ this.oldRoot = (root).clone();
+ desc.impl.call(node, this.args);
+ },
+ undo: function() {
+ this.document.getNodeByPath(this.rootPath).replaceWith(this.oldRoot);
+ }
+ });
+
+ return NodeTransformation;
+}
+
+transformations['detach2'] = createTransformation({
+ // impl: function() {
+ // //this.setAttr('class', 'cite'); //
+ // },
+ impl: ElementNode.prototype.detach,
+ getRoot: function(node) {
+ return node.parent();
+ }
+
+});
+
+transformations['setText'] = createTransformation({
+ impl: function(args) {
+ this.setText(args.text)
+ },
+ getRoot: function(node) {
+ return node;
+ }
+
+});