Comparing version 1.1.2 to 1.1.3
@@ -263,6 +263,12 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
var match = Registry.query(node, Registry.Scope.BLOT & (this.scope | Registry.Scope.TYPE)); | ||
if (match != null && (this.whitelist == null || this.whitelist.indexOf(value) > -1)) { | ||
if (match == null) | ||
return false; | ||
if (this.whitelist == null) | ||
return true; | ||
if (typeof value === 'string') { | ||
return this.whitelist.indexOf(value.replace(/["']/g, '')) > -1; | ||
} | ||
return false; | ||
else { | ||
return this.whitelist.indexOf(value) > -1; | ||
} | ||
}; | ||
@@ -305,6 +311,20 @@ Attributor.prototype.remove = function (node) { | ||
var _this = _super.call(this, domNode) || this; | ||
_this.children = new linked_list_1.default(); | ||
_this.build(); | ||
return _this; | ||
} | ||
ContainerBlot.prototype.appendChild = function (other) { | ||
this.insertBefore(other); | ||
}; | ||
ContainerBlot.prototype.attach = function () { | ||
_super.prototype.attach.call(this); | ||
this.children.forEach(function (child) { | ||
child.attach(); | ||
}); | ||
}; | ||
ContainerBlot.prototype.build = function () { | ||
var _this = this; | ||
this.children = new linked_list_1.default(); | ||
// Need to be reversed for if DOM nodes already in order | ||
[].slice | ||
.call(_this.domNode.childNodes) | ||
.call(this.domNode.childNodes) | ||
.reverse() | ||
@@ -323,13 +343,3 @@ .forEach(function (node) { | ||
}); | ||
return _this; | ||
} | ||
ContainerBlot.prototype.appendChild = function (other) { | ||
this.insertBefore(other); | ||
}; | ||
ContainerBlot.prototype.attach = function () { | ||
_super.prototype.attach.call(this); | ||
this.children.forEach(function (child) { | ||
child.attach(); | ||
}); | ||
}; | ||
ContainerBlot.prototype.deleteAt = function (index, length) { | ||
@@ -1533,3 +1543,3 @@ if (index === 0 && length === this.length()) { | ||
if (navigator.userAgent.match(/Trident/)) { | ||
this.attach(); | ||
this.build(); | ||
} | ||
@@ -1536,0 +1546,0 @@ else { |
@@ -14,5 +14,5 @@ import * as Registry from '../registry'; | ||
add(node: HTMLElement, value: string): boolean; | ||
canAdd(node: HTMLElement, value: string): boolean; | ||
canAdd(node: HTMLElement, value: any): boolean; | ||
remove(node: HTMLElement): void; | ||
value(node: HTMLElement): string; | ||
} |
@@ -12,2 +12,3 @@ import { Blot, Parent } from './blot'; | ||
attach(): void; | ||
build(): void; | ||
deleteAt(index: number, length: number): void; | ||
@@ -14,0 +15,0 @@ descendant<T>(criteria: { |
{ | ||
"name": "parchment", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "A document model for rich text editors", | ||
@@ -5,0 +5,0 @@ "author": "Jason Chen <jhchen7@gmail.com>", |
@@ -39,8 +39,11 @@ import * as Registry from '../registry'; | ||
canAdd(node: HTMLElement, value: string): boolean { | ||
canAdd(node: HTMLElement, value: any): boolean { | ||
let match = Registry.query(node, Registry.Scope.BLOT & (this.scope | Registry.Scope.TYPE)); | ||
if (match != null && (this.whitelist == null || this.whitelist.indexOf(value) > -1)) { | ||
return true; | ||
if (match == null) return false; | ||
if (this.whitelist == null) return true; | ||
if (typeof value === 'string') { | ||
return this.whitelist.indexOf(value.replace(/["']/g, '')) > -1; | ||
} else { | ||
return this.whitelist.indexOf(value) > -1; | ||
} | ||
return false; | ||
} | ||
@@ -47,0 +50,0 @@ |
@@ -15,2 +15,17 @@ import { Blot, Parent, Leaf } from './blot'; | ||
super(domNode); | ||
this.build(); | ||
} | ||
appendChild(other: Blot): void { | ||
this.insertBefore(other); | ||
} | ||
attach(): void { | ||
super.attach(); | ||
this.children.forEach(child => { | ||
child.attach(); | ||
}); | ||
} | ||
build(): void { | ||
this.children = new LinkedList<Blot>(); | ||
@@ -32,13 +47,2 @@ // Need to be reversed for if DOM nodes already in order | ||
appendChild(other: Blot): void { | ||
this.insertBefore(other); | ||
} | ||
attach(): void { | ||
super.attach(); | ||
this.children.forEach(child => { | ||
child.attach(); | ||
}); | ||
} | ||
deleteAt(index: number, length: number): void { | ||
@@ -45,0 +49,0 @@ if (index === 0 && length === this.length()) { |
@@ -46,3 +46,3 @@ import FormatBlot from './abstract/format'; | ||
if (navigator.userAgent.match(/Trident/)) { | ||
this.attach(); | ||
this.build(); | ||
} else { | ||
@@ -49,0 +49,0 @@ super.update(mutations, context); |
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
203451
3376