Comparing version 2.0.2 to 2.0.3
14
index.js
@@ -87,19 +87,19 @@ /** | ||
else range.setStart(start, length) | ||
if(!end) range.collapse(true) | ||
else range.setEnd(end, length) | ||
}catch(e) { | ||
} | ||
try { | ||
if(!end) range.collapse(true) | ||
else range.setEnd(end, length) | ||
if(!start) range.collapse(false) | ||
else range.setStart(start, length) | ||
}catch(e) { | ||
} | ||
return range | ||
@@ -193,2 +193,2 @@ } | ||
exports.ManipulateText = require('./lib/index').ManipulateText | ||
exports.adapters = require('./lib/index').adapters | ||
exports.adapters = require('./lib/index').adapters |
@@ -84,3 +84,3 @@ /** | ||
if (Array.isArray(summary.removed)) { | ||
@@ -97,3 +97,3 @@ summary.removed.forEach(function(node) { | ||
} | ||
if (Array.isArray(summary.reparented)) { | ||
@@ -103,3 +103,3 @@ summary.reparented.forEach(function(node) { | ||
, oldPath = node.domOT_path | ||
if(oldParent && !rootNode.contains(oldParent)) { | ||
@@ -132,3 +132,3 @@ // my parent doesn't exist anymore, so it has prolly been removed | ||
} | ||
// Convergence over intention preservation | ||
@@ -152,30 +152,25 @@ // e.g. <div>hello <i>world</i></div> -> <div>hello <b><i>world</i></b></div> | ||
}) | ||
oplist.sort(sortOps) | ||
// transform non-inserts against Inserts/Moves in the order of operations | ||
// transfrom moves and manipulates against (re)moves | ||
oplist.forEach(function(op) { | ||
if(op.from || op.path) { | ||
for(var i=0; i<oplist.length; i++) { | ||
var op2 = oplist[i] | ||
, path = (op.from || op.path) && (op.from || op.path).join('') | ||
, path2 = op2.to && op2.to.join('') | ||
if(path && path2 && path > path2) { | ||
oplist.forEach(function(op2) { | ||
if(op === op2) return | ||
var path = (op.from || op.path) && (op.from || op.path).map(strPad.bind(null, '00000')).join('') | ||
, from2 = op2.from && op2.from.map(strPad.bind(null, '00000')).join('') | ||
, to2 = op2.to && op2.to.map(strPad.bind(null, '00000')).join('') | ||
, to | ||
if(path && from2 && path > from2 && path.length == from2.length) { | ||
to = op.to | ||
op.transformAgainst(op2) | ||
op.to = to | ||
} | ||
} | ||
} | ||
}) | ||
// transfrom moves and manipulates against (re)moves | ||
oplist.forEach(function(op) { | ||
if(op.from || op.path) { | ||
for(var i=0; i<oplist.length; i++) { | ||
var op2 = oplist[i] | ||
, path = (op.from || op.path) && (op.from || op.path).join('') | ||
, path2 = op2.from && op2.from.join('') | ||
if(path && path2 && path > path2) { | ||
if(path && to2 && path > to2 && path.length == to2.length) { | ||
to = op.to | ||
op.transformAgainst(op2) | ||
op.to = to | ||
} | ||
} | ||
}) | ||
} | ||
@@ -201,5 +196,5 @@ }) | ||
oplist.sort(sortOps) | ||
return oplist | ||
@@ -206,0 +201,0 @@ } |
@@ -51,2 +51,2 @@ /** | ||
return false | ||
} | ||
} |
@@ -126,3 +126,3 @@ /** | ||
} | ||
if(index) this.applyDry(rootNode) | ||
@@ -155,2 +155,2 @@ } | ||
} | ||
} | ||
} |
{ | ||
"name": "dom-ot", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "Operational transform library for DOM operations (conforms to shareJS' spec)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67574
901