Skip to content

Commit

Permalink
accept JSON in setContents
Browse files Browse the repository at this point in the history
  • Loading branch information
jhchen committed Oct 23, 2016
1 parent e384521 commit d928be5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions core/quill.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ class Quill {

setContents(delta, source = Emitter.sources.API) {
return modify.call(this, () => {
delta = new Delta(delta);
let length = this.getLength();
let deleted = this.editor.deleteText(0, length);
let applied = this.editor.applyDelta(delta);
Expand Down Expand Up @@ -295,9 +296,7 @@ class Quill {

updateContents(delta, source = Emitter.sources.API) {
return modify.call(this, () => {
if (Array.isArray(delta)) {
delta = new Delta(delta.slice());
}
delta = new Delta(delta);
return this.editor.applyDelta(delta, source);
}, source, true);
}
Expand Down

0 comments on commit d928be5

Please sign in to comment.