From a27c64b62ec8e3a6e68d1b75743f831ea62638a4 Mon Sep 17 00:00:00 2001 From: David Greenspan Date: Fri, 14 Sep 2018 13:50:08 -0700 Subject: [PATCH 1/2] Use new quill-delta from SHA --- core/editor.js | 5 ++--- modules/history.js | 5 ++--- modules/keyboard.js | 9 ++++----- package-lock.json | 12 ++---------- package.json | 2 +- 5 files changed, 11 insertions(+), 22 deletions(-) diff --git a/core/editor.js b/core/editor.js index fd433b63b9..f70b523413 100644 --- a/core/editor.js +++ b/core/editor.js @@ -1,8 +1,7 @@ import clone from 'clone'; import equal from 'deep-equal'; import extend from 'extend'; -import Delta from 'quill-delta'; -import DeltaOp from 'quill-delta/lib/op'; +import Delta, { AttributeMap } from 'quill-delta'; import { LeafBlot } from 'parchment'; import { Range } from './selection'; import CursorBlot from '../blots/cursor'; @@ -48,7 +47,7 @@ class Editor { const [leaf] = line.descendant(LeafBlot, offset); formats = extend(formats, bubbleFormats(leaf)); } - attributes = DeltaOp.attributes.diff(formats, attributes) || {}; + attributes = AttributeMap.diff(formats, attributes) || {}; } else if (typeof op.insert === 'object') { const key = Object.keys(op.insert)[0]; // There should only be one key if (key == null) return index; diff --git a/modules/history.js b/modules/history.js index f052587b04..4781d5a6c4 100644 --- a/modules/history.js +++ b/modules/history.js @@ -1,6 +1,5 @@ import { Scope } from 'parchment'; -import Delta from 'quill-delta'; -import DeltaOp from 'quill-delta/lib/op'; +import Delta, { Op } from 'quill-delta'; import Quill from '../core/quill'; import Module from '../core/module'; @@ -139,7 +138,7 @@ function guessUndoDelta(delta) { let failed = false; delta.forEach(op => { if (op.insert) { - undoDelta.delete(DeltaOp.length(op)); + undoDelta.delete(Op.length(op)); } else if (op.retain && op.attributes == null) { undoDelta.retain(op.retain); } else { diff --git a/modules/keyboard.js b/modules/keyboard.js index 9b00f563b2..4283f45bc7 100644 --- a/modules/keyboard.js +++ b/modules/keyboard.js @@ -1,8 +1,7 @@ import clone from 'clone'; import equal from 'deep-equal'; import extend from 'extend'; -import Delta from 'quill-delta'; -import DeltaOp from 'quill-delta/lib/op'; +import Delta, { AttributeMap } from 'quill-delta'; import { EmbedBlot, Scope, TextBlot } from 'parchment'; import Quill from '../core/quill'; import logger from '../core/logger'; @@ -458,7 +457,7 @@ function handleBackspace(range, context) { if (prev.length() > 1 || prev.statics.blotName === 'table') { const curFormats = line.formats(); const prevFormats = this.quill.getFormat(range.index - 1, 1); - formats = DeltaOp.attributes.diff(curFormats, prevFormats) || {}; + formats = AttributeMap.diff(curFormats, prevFormats) || {}; } } } @@ -488,7 +487,7 @@ function handleDelete(range, context) { if (next) { const curFormats = line.formats(); const nextFormats = this.quill.getFormat(range.index, 1); - formats = DeltaOp.attributes.diff(curFormats, nextFormats) || {}; + formats = AttributeMap.diff(curFormats, nextFormats) || {}; nextLength = next.length(); } } @@ -509,7 +508,7 @@ function handleDeleteRange(range) { if (lines.length > 1) { const firstFormats = lines[0].formats(); const lastFormats = lines[lines.length - 1].formats(); - formats = DeltaOp.attributes.diff(lastFormats, firstFormats) || {}; + formats = AttributeMap.diff(lastFormats, firstFormats) || {}; } this.quill.deleteText(range, Quill.sources.USER); if (Object.keys(formats).length > 0) { diff --git a/package-lock.json b/package-lock.json index 28c970d9d3..e1f57ed50d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7482,20 +7482,12 @@ "dev": true }, "quill-delta": { - "version": "3.6.3", - "resolved": "https://registry.npmjs.org/quill-delta/-/quill-delta-3.6.3.tgz", - "integrity": "sha512-wdIGBlcX13tCHOXGMVnnTVFtGRLoP0imqxM696fIPwIf5ODIYUHIvHbZcyvGlZFiFhK5XzDC2lpjbxRhnM05Tg==", + "version": "github:quilljs/delta#a69ff1264791d361231e9b3ad28055681534025a", + "from": "github:quilljs/delta#a69ff1264791d361231e9b3ad28055681534025a", "requires": { "deep-equal": "^1.0.1", "extend": "^3.0.2", "fast-diff": "1.1.2" - }, - "dependencies": { - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - } } }, "randombytes": { diff --git a/package.json b/package.json index ffeff526da..0be3bbf11b 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "eventemitter3": "^3.1.0", "extend": "^3.0.2", "parchment": "quilljs/parchment#e517d08719e19138651ea230c0a5daf8facfe8b8", - "quill-delta": "^3.6.3" + "quill-delta": "quilljs/delta#d7ca00f2fd8a257a2b66dfb3cfde76986ae4d22d" }, "devDependencies": { "babel-core": "^6.26.3", From 229ec13181d619a85b14577707b2c7fb211a7f43 Mon Sep 17 00:00:00 2001 From: David Greenspan Date: Fri, 14 Sep 2018 15:07:38 -0700 Subject: [PATCH 2/2] update quill-delta SHA --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index e1f57ed50d..faed27c255 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7482,8 +7482,8 @@ "dev": true }, "quill-delta": { - "version": "github:quilljs/delta#a69ff1264791d361231e9b3ad28055681534025a", - "from": "github:quilljs/delta#a69ff1264791d361231e9b3ad28055681534025a", + "version": "github:quilljs/delta#c3da3922b5f2c238423c3422ca3428d64c016463", + "from": "github:quilljs/delta#c3da3922b5f2c238423c3422ca3428d64c016463", "requires": { "deep-equal": "^1.0.1", "extend": "^3.0.2", diff --git a/package.json b/package.json index 0be3bbf11b..7f2714ecc2 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "eventemitter3": "^3.1.0", "extend": "^3.0.2", "parchment": "quilljs/parchment#e517d08719e19138651ea230c0a5daf8facfe8b8", - "quill-delta": "quilljs/delta#d7ca00f2fd8a257a2b66dfb3cfde76986ae4d22d" + "quill-delta": "quilljs/delta#c3da3922b5f2c238423c3422ca3428d64c016463" }, "devDependencies": { "babel-core": "^6.26.3",