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..faed27c255 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#c3da3922b5f2c238423c3422ca3428d64c016463", + "from": "github:quilljs/delta#c3da3922b5f2c238423c3422ca3428d64c016463", "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..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": "^3.6.3" + "quill-delta": "quilljs/delta#c3da3922b5f2c238423c3422ca3428d64c016463" }, "devDependencies": { "babel-core": "^6.26.3",