Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new quill-delta from SHA #2311

Merged
merged 2 commits into from
Sep 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions core/editor.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions modules/history.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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 {
Expand Down
9 changes: 4 additions & 5 deletions modules/keyboard.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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) || {};
}
}
}
Expand Down Expand Up @@ -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();
}
}
Expand All @@ -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) {
Expand Down
12 changes: 2 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down