Update Quill editor, 1.3.6 - > 1.3.7

Fixes two medium-severity vulnerabilities: https://snyk.io/vuln/npm:quill
pull/674/head
Paul Beesley 2020-10-21 10:34:56 +01:00
rodzic e8b660b775
commit bec223036d
7 zmienionych plików z 170 dodań i 25 usunięć

Wyświetl plik

@ -1,5 +1,5 @@
/*!
* Quill Editor v1.3.6
* Quill Editor v1.3.7
* https://quilljs.com/
* Copyright (c) 2014, Jason Chen
* Copyright (c) 2013, salesforce.com

Wyświetl plik

@ -1,5 +1,5 @@
/*!
* Quill Editor v1.3.6
* Quill Editor v1.3.7
* https://quilljs.com/
* Copyright (c) 2014, Jason Chen
* Copyright (c) 2013, salesforce.com

Wyświetl plik

@ -1,5 +1,5 @@
/*!
* Quill Editor v1.3.6
* Quill Editor v1.3.7
* https://quilljs.com/
* Copyright (c) 2014, Jason Chen
* Copyright (c) 2013, salesforce.com
@ -439,7 +439,19 @@ Delta.prototype.slice = function (start, end) {
Delta.prototype.compose = function (other) {
var thisIter = op.iterator(this.ops);
var otherIter = op.iterator(other.ops);
var delta = new Delta();
var ops = [];
var firstOther = otherIter.peek();
if (firstOther != null && typeof firstOther.retain === 'number' && firstOther.attributes == null) {
var firstLeft = firstOther.retain;
while (thisIter.peekType() === 'insert' && thisIter.peekLength() <= firstLeft) {
firstLeft -= thisIter.peekLength();
ops.push(thisIter.next());
}
if (firstOther.retain - firstLeft > 0) {
otherIter.next(firstOther.retain - firstLeft);
}
}
var delta = new Delta(ops);
while (thisIter.hasNext() || otherIter.hasNext()) {
if (otherIter.peekType() === 'insert') {
delta.push(otherIter.next());
@ -460,6 +472,13 @@ Delta.prototype.compose = function (other) {
var attributes = op.attributes.compose(thisOp.attributes, otherOp.attributes, typeof thisOp.retain === 'number');
if (attributes) newOp.attributes = attributes;
delta.push(newOp);
// Optimization if rest of other is just retain
if (!otherIter.hasNext() && equal(delta.ops[delta.ops.length - 1], newOp)) {
var rest = new Delta(thisIter.rest());
return delta.concat(rest).chop();
}
// Other op should be delete, we could be an insert or retain
// Insert + delete cancels out
} else if (typeof otherOp['delete'] === 'number' && typeof thisOp.retain === 'number') {
@ -617,6 +636,8 @@ module.exports = Delta;
var hasOwn = Object.prototype.hasOwnProperty;
var toStr = Object.prototype.toString;
var defineProperty = Object.defineProperty;
var gOPD = Object.getOwnPropertyDescriptor;
var isArray = function isArray(arr) {
if (typeof Array.isArray === 'function') {
@ -646,6 +667,35 @@ var isPlainObject = function isPlainObject(obj) {
return typeof key === 'undefined' || hasOwn.call(obj, key);
};
// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target
var setProperty = function setProperty(target, options) {
if (defineProperty && options.name === '__proto__') {
defineProperty(target, options.name, {
enumerable: true,
configurable: true,
value: options.newValue,
writable: true
});
} else {
target[options.name] = options.newValue;
}
};
// Return undefined instead of __proto__ if '__proto__' is not an own property
var getProperty = function getProperty(obj, name) {
if (name === '__proto__') {
if (!hasOwn.call(obj, name)) {
return void 0;
} else if (gOPD) {
// In early versions of node, obj['__proto__'] is buggy when obj has
// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.
return gOPD(obj, name).value;
}
}
return obj[name];
};
module.exports = function extend() {
var options, name, src, copy, copyIsArray, clone;
var target = arguments[0];
@ -670,8 +720,8 @@ module.exports = function extend() {
if (options != null) {
// Extend the base object
for (name in options) {
src = target[name];
copy = options[name];
src = getProperty(target, name);
copy = getProperty(options, name);
// Prevent never-ending loop
if (target !== copy) {
@ -685,11 +735,11 @@ module.exports = function extend() {
}
// Never move original objects, clone them
target[name] = extend(deep, clone, copy);
setProperty(target, { name: name, newValue: extend(deep, clone, copy) });
// Don't bring in undefined values
} else if (typeof copy !== 'undefined') {
target[name] = copy;
setProperty(target, { name: name, newValue: copy });
}
}
}
@ -1533,7 +1583,7 @@ Quill.DEFAULTS = {
Quill.events = _emitter4.default.events;
Quill.sources = _emitter4.default.sources;
// eslint-disable-next-line no-undef
Quill.version = false ? 'dev' : "1.3.6";
Quill.version = false ? 'dev' : "1.3.7";
Quill.imports = {
'delta': _quillDelta2.default,
@ -3682,8 +3732,8 @@ var LeafBlot = /** @class */ (function (_super) {
return [this.parent.domNode, offset];
};
LeafBlot.prototype.value = function () {
return _a = {}, _a[this.statics.blotName] = this.statics.value(this.domNode) || true, _a;
var _a;
return _a = {}, _a[this.statics.blotName] = this.statics.value(this.domNode) || true, _a;
};
LeafBlot.scope = Registry.Scope.INLINE_BLOT;
return LeafBlot;
@ -3832,6 +3882,22 @@ Iterator.prototype.peekType = function () {
return 'retain';
};
Iterator.prototype.rest = function () {
if (!this.hasNext()) {
return [];
} else if (this.offset === 0) {
return this.ops.slice(this.index);
} else {
var offset = this.offset;
var index = this.index;
var next = this.next();
var rest = this.ops.slice(this.index);
this.offset = offset;
this.index = index;
return [next].concat(rest);
}
};
module.exports = lib;
@ -3946,7 +4012,13 @@ function clone(parent, circular, depth, prototype, includeNonEnumerable) {
} else if (clone.__isDate(parent)) {
child = new Date(parent.getTime());
} else if (useBuffer && Buffer.isBuffer(parent)) {
child = new Buffer(parent.length);
if (Buffer.allocUnsafe) {
// Node.js >= 4.5.0
child = Buffer.allocUnsafe(parent.length);
} else {
// Older Node.js versions
child = new Buffer(parent.length);
}
parent.copy(child);
return child;
} else if (_instanceof(parent, Error)) {

Wyświetl plik

@ -1,5 +1,5 @@
/*!
* Quill Editor v1.3.6
* Quill Editor v1.3.7
* https://quilljs.com/
* Copyright (c) 2014, Jason Chen
* Copyright (c) 2013, salesforce.com
@ -439,7 +439,19 @@ Delta.prototype.slice = function (start, end) {
Delta.prototype.compose = function (other) {
var thisIter = op.iterator(this.ops);
var otherIter = op.iterator(other.ops);
var delta = new Delta();
var ops = [];
var firstOther = otherIter.peek();
if (firstOther != null && typeof firstOther.retain === 'number' && firstOther.attributes == null) {
var firstLeft = firstOther.retain;
while (thisIter.peekType() === 'insert' && thisIter.peekLength() <= firstLeft) {
firstLeft -= thisIter.peekLength();
ops.push(thisIter.next());
}
if (firstOther.retain - firstLeft > 0) {
otherIter.next(firstOther.retain - firstLeft);
}
}
var delta = new Delta(ops);
while (thisIter.hasNext() || otherIter.hasNext()) {
if (otherIter.peekType() === 'insert') {
delta.push(otherIter.next());
@ -460,6 +472,13 @@ Delta.prototype.compose = function (other) {
var attributes = op.attributes.compose(thisOp.attributes, otherOp.attributes, typeof thisOp.retain === 'number');
if (attributes) newOp.attributes = attributes;
delta.push(newOp);
// Optimization if rest of other is just retain
if (!otherIter.hasNext() && equal(delta.ops[delta.ops.length - 1], newOp)) {
var rest = new Delta(thisIter.rest());
return delta.concat(rest).chop();
}
// Other op should be delete, we could be an insert or retain
// Insert + delete cancels out
} else if (typeof otherOp['delete'] === 'number' && typeof thisOp.retain === 'number') {
@ -617,6 +636,8 @@ module.exports = Delta;
var hasOwn = Object.prototype.hasOwnProperty;
var toStr = Object.prototype.toString;
var defineProperty = Object.defineProperty;
var gOPD = Object.getOwnPropertyDescriptor;
var isArray = function isArray(arr) {
if (typeof Array.isArray === 'function') {
@ -646,6 +667,35 @@ var isPlainObject = function isPlainObject(obj) {
return typeof key === 'undefined' || hasOwn.call(obj, key);
};
// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target
var setProperty = function setProperty(target, options) {
if (defineProperty && options.name === '__proto__') {
defineProperty(target, options.name, {
enumerable: true,
configurable: true,
value: options.newValue,
writable: true
});
} else {
target[options.name] = options.newValue;
}
};
// Return undefined instead of __proto__ if '__proto__' is not an own property
var getProperty = function getProperty(obj, name) {
if (name === '__proto__') {
if (!hasOwn.call(obj, name)) {
return void 0;
} else if (gOPD) {
// In early versions of node, obj['__proto__'] is buggy when obj has
// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.
return gOPD(obj, name).value;
}
}
return obj[name];
};
module.exports = function extend() {
var options, name, src, copy, copyIsArray, clone;
var target = arguments[0];
@ -670,8 +720,8 @@ module.exports = function extend() {
if (options != null) {
// Extend the base object
for (name in options) {
src = target[name];
copy = options[name];
src = getProperty(target, name);
copy = getProperty(options, name);
// Prevent never-ending loop
if (target !== copy) {
@ -685,11 +735,11 @@ module.exports = function extend() {
}
// Never move original objects, clone them
target[name] = extend(deep, clone, copy);
setProperty(target, { name: name, newValue: extend(deep, clone, copy) });
// Don't bring in undefined values
} else if (typeof copy !== 'undefined') {
target[name] = copy;
setProperty(target, { name: name, newValue: copy });
}
}
}
@ -1533,7 +1583,7 @@ Quill.DEFAULTS = {
Quill.events = _emitter4.default.events;
Quill.sources = _emitter4.default.sources;
// eslint-disable-next-line no-undef
Quill.version = false ? 'dev' : "1.3.6";
Quill.version = false ? 'dev' : "1.3.7";
Quill.imports = {
'delta': _quillDelta2.default,
@ -3682,8 +3732,8 @@ var LeafBlot = /** @class */ (function (_super) {
return [this.parent.domNode, offset];
};
LeafBlot.prototype.value = function () {
return _a = {}, _a[this.statics.blotName] = this.statics.value(this.domNode) || true, _a;
var _a;
return _a = {}, _a[this.statics.blotName] = this.statics.value(this.domNode) || true, _a;
};
LeafBlot.scope = Registry.Scope.INLINE_BLOT;
return LeafBlot;
@ -3832,6 +3882,22 @@ Iterator.prototype.peekType = function () {
return 'retain';
};
Iterator.prototype.rest = function () {
if (!this.hasNext()) {
return [];
} else if (this.offset === 0) {
return this.ops.slice(this.index);
} else {
var offset = this.offset;
var index = this.index;
var next = this.next();
var rest = this.ops.slice(this.index);
this.offset = offset;
this.index = index;
return [next].concat(rest);
}
};
module.exports = lib;
@ -3946,7 +4012,13 @@ function clone(parent, circular, depth, prototype, includeNonEnumerable) {
} else if (clone.__isDate(parent)) {
child = new Date(parent.getTime());
} else if (useBuffer && Buffer.isBuffer(parent)) {
child = new Buffer(parent.length);
if (Buffer.allocUnsafe) {
// Node.js >= 4.5.0
child = Buffer.allocUnsafe(parent.length);
} else {
// Older Node.js versions
child = new Buffer(parent.length);
}
parent.copy(child);
return child;
} else if (_instanceof(parent, Error)) {
@ -5291,6 +5363,7 @@ var Link = function (_Inline) {
var node = _get(Link.__proto__ || Object.getPrototypeOf(Link), 'create', this).call(this, value);
value = this.sanitize(value);
node.setAttribute('href', value);
node.setAttribute('rel', 'noopener noreferrer');
node.setAttribute('target', '_blank');
return node;
}
@ -9954,7 +10027,7 @@ var SnowTooltip = function (_BaseTooltip) {
return SnowTooltip;
}(_base.BaseTooltip);
SnowTooltip.TEMPLATE = ['<a class="ql-preview" target="_blank" href="about:blank"></a>', '<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">', '<a class="ql-action"></a>', '<a class="ql-remove"></a>'].join('');
SnowTooltip.TEMPLATE = ['<a class="ql-preview" rel="noopener noreferrer" target="_blank" href="about:blank"></a>', '<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">', '<a class="ql-action"></a>', '<a class="ql-remove"></a>'].join('');
exports.default = SnowTheme;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Wyświetl plik

@ -1,5 +1,5 @@
/*!
* Quill Editor v1.3.6
* Quill Editor v1.3.7
* https://quilljs.com/
* Copyright (c) 2014, Jason Chen
* Copyright (c) 2013, salesforce.com