moving wlxml object api transformations directly into .object properties name space
[fnpeditor.git] / src / wlxml / extensions / list / list.js
index 4291957..6cac91b 100644 (file)
@@ -1,13 +1,11 @@
-define(function(require) {
+define(function() {
 
 'use strict';
 
 
 'use strict';
 
+var extension = {document: {transformations: {}}, wlxmlClass: {list: {methods: {}}}};
 
 
-var wlxml = require('wlxml/wlxml'),
-    extension = {documentTransformations: [], classMethods: {}};
 
 
-
-extension.classMethods['list'] = {
+extension.wlxmlClass.list.methods = {
     itemIndex: function(listItem) {
         var toret = -1;
         this.contents('.item').some(function(item, index) {
     itemIndex: function(listItem) {
         var toret = -1;
         this.contents('.item').some(function(item, index) {
@@ -29,8 +27,9 @@ extension.documentMethods = {
     }
 }
 
     }
 }
 
-extension.documentTransformations.push({
-    name: 'createList',
+
+
+extension.document.transformations.createList = {
     impl: function(params) {          
         var parent = params.node1.parent(),
             parentContents = parent.contents(),
     impl: function(params) {          
         var parent = params.node1.parent(),
             parentContents = parent.contents(),
@@ -71,10 +70,9 @@ extension.documentTransformations.push({
     isAllowed: function() {
         return this.args.node1.parent().sameNode(this.args.node2.parent());
     }
     isAllowed: function() {
         return this.args.node1.parent().sameNode(this.args.node2.parent());
     }
-});
+};
 
 
-extension.documentTransformations.push({
-    name: 'extractItems',
+extension.document.transformations.extractItems = {
     impl: function(params) {
         params = _.extend({}, {merge: true}, params);
         var list = params.item1.parent(),
     impl: function(params) {
         params = _.extend({}, {merge: true}, params);
         var list = params.item1.parent(),
@@ -137,7 +135,7 @@ extension.documentTransformations.push({
             reference.after(toAdd);
         }
         if(!params.merge && listIsNested) {
             reference.after(toAdd);
         }
         if(!params.merge && listIsNested) {
-            return this.transform('extractItems', {item1: extractedItems[0], item2: extractedItems[extractedItems.length-1]});
+            return this.extractItems({item1: extractedItems[0], item2: extractedItems[extractedItems.length-1]});
         }
         return true;
     },
         }
         return true;
     },
@@ -145,8 +143,9 @@ extension.documentTransformations.push({
         var parent = this.args.nodel1.parent();
         return parent.is('list') && parent.sameNode(this.args.node2.parent());
     }
         var parent = this.args.nodel1.parent();
         return parent.is('list') && parent.sameNode(this.args.node2.parent());
     }
-});
+};
+
+return extension;
 
 
-wlxml.registerExtension(extension);
 
 });
\ No newline at end of file
 
 });
\ No newline at end of file