Comparing version 1.0.0-beta.7 to 1.0.0-beta.8
@@ -131,3 +131,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
try { | ||
var child = Registry.find(node) || Registry.create(node); | ||
var child = makeBlot(node); | ||
_this.insertBefore(child, _this.children.head); | ||
@@ -285,13 +285,12 @@ } | ||
}); | ||
addedNodes.sort(function (a, b) { | ||
addedNodes.filter(function (node) { | ||
return node.parentNode == _this.domNode; | ||
}).sort(function (a, b) { | ||
if (a === b) | ||
return 0; | ||
if (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING) { | ||
return -1; | ||
return 1; | ||
} | ||
return 1; | ||
}); | ||
addedNodes.reverse().forEach(function (node) { | ||
if (node.parentNode !== _this.domNode) | ||
return; | ||
return -1; | ||
}).forEach(function (node) { | ||
var refBlot = null; | ||
@@ -301,3 +300,3 @@ if (node.nextSibling != null) { | ||
} | ||
var blot = Registry.find(node) || Registry.create(node); | ||
var blot = makeBlot(node); | ||
if (blot.next != refBlot || blot.next == null) { | ||
@@ -313,2 +312,19 @@ if (blot.parent != null) { | ||
}(shadow_1.default)); | ||
function makeBlot(node) { | ||
var blot = Registry.find(node); | ||
if (blot == null) { | ||
try { | ||
blot = Registry.create(node); | ||
} | ||
catch (e) { | ||
blot = Registry.create(Registry.Scope.INLINE); | ||
[].slice.call(node.childNodes).forEach(function (child) { | ||
blot.domNode.appendChild(child); | ||
}); | ||
node.parentNode.replaceChild(blot.domNode, node); | ||
blot.attach(); | ||
} | ||
} | ||
return blot; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -315,0 +331,0 @@ exports.default = ContainerBlot; |
{ | ||
"name": "parchment", | ||
"version": "1.0.0-beta.7", | ||
"version": "1.0.0-beta.8", | ||
"description": "A document model for rich text editors", | ||
@@ -18,3 +18,3 @@ "author": "Jason Chen <jhchen7@gmail.com>", | ||
"jasmine-core": "^2.4.1", | ||
"karma": "~0.13.22", | ||
"karma": "^1.1.1", | ||
"karma-babel-preprocessor": "^6.0.1", | ||
@@ -21,0 +21,0 @@ "karma-chrome-launcher": "^1.0.1", |
@@ -24,3 +24,3 @@ import { Blot, Parent, Leaf } from './blot'; | ||
try { | ||
let child = Registry.find(node) || Registry.create(node); | ||
let child = makeBlot(node); | ||
this.insertBefore(child, this.children.head); | ||
@@ -181,11 +181,11 @@ } catch (err) { | ||
}); | ||
addedNodes.sort(function(a, b) { | ||
addedNodes.filter((node) => { | ||
return node.parentNode == this.domNode; | ||
}).sort(function(a, b) { | ||
if (a === b) return 0; | ||
if (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING) { | ||
return -1; | ||
return 1; | ||
} | ||
return 1; | ||
}); | ||
addedNodes.reverse().forEach((node) => { | ||
if (node.parentNode !== this.domNode) return; | ||
return -1; | ||
}).forEach((node) => { | ||
let refBlot = null; | ||
@@ -195,3 +195,3 @@ if (node.nextSibling != null) { | ||
} | ||
let blot = Registry.find(node) || Registry.create(node); | ||
let blot = makeBlot(node); | ||
if (blot.next != refBlot || blot.next == null) { | ||
@@ -208,2 +208,20 @@ if (blot.parent != null) { | ||
function makeBlot(node): Blot { | ||
let blot = Registry.find(node); | ||
if (blot == null) { | ||
try { | ||
blot = Registry.create(node); | ||
} catch (e) { | ||
blot = Registry.create(Registry.Scope.INLINE); | ||
[].slice.call(node.childNodes).forEach(function(child) { | ||
blot.domNode.appendChild(child); | ||
}); | ||
node.parentNode.replaceChild(blot.domNode, node); | ||
blot.attach(); | ||
} | ||
} | ||
return blot; | ||
} | ||
export default ContainerBlot; |
Sorry, the diff of this file is not supported yet
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
161139
2694