X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/21cd91531dd9c6e88d00da03f6b2f3ad88fb0da0..6e641abeaa2fcd8d8f9885db37d127e7d1a34885:/src/wlxml/extensions/list/list.js diff --git a/src/wlxml/extensions/list/list.js b/src/wlxml/extensions/list/list.js index 8cfecc2..99cacb1 100644 --- a/src/wlxml/extensions/list/list.js +++ b/src/wlxml/extensions/list/list.js @@ -3,7 +3,7 @@ define(function(require) { 'use strict'; var _ = require('libs/underscore'), - extension = {document: {transformations: {}}, wlxmlClass: {list: {methods: {}}}}; + extension = {document: {transformations: {}, methods: {}}, wlxmlClass: {list: {methods: {}}}}; extension.wlxmlClass.list.methods = { @@ -22,7 +22,7 @@ extension.wlxmlClass.list.methods = { } }; -extension.documentMethods = { +extension.document.methods = { areItemsOfSameList: function(params) { return params.node1.parent().sameNode(params.node2.parent()) && params.node2.parent().is('list'); } @@ -35,7 +35,7 @@ extension.document.transformations.createList = { /* globals Node */ var parent = params.node1.parent(), parentContents = parent.contents(), - nodeIndexes = [params.node1.getIndex(), params.node2.getIndex()].sort(), + nodeIndexes = [params.node1.getIndex(), params.node2.getIndex()].sort(function(a,b) { return a-b; }), nodesToWrap = [], listNode = params.node1.document.createDocumentNode({tagName: 'div', attrs: {'class': 'list'}}), node, i; @@ -78,7 +78,7 @@ extension.document.transformations.extractItems = { impl: function(params) { params = _.extend({}, {merge: true}, params); var list = params.item1.parent(), - indexes = [params.item1.getIndex(), params.item2.getIndex()].sort(), + indexes = [params.item1.getIndex(), params.item2.getIndex()].sort(function(a,b) { return a-b;}), precedingItems = [], extractedItems = [], succeedingItems = [],