Skip to content

Commit

Permalink
fix #974
Browse files Browse the repository at this point in the history
  • Loading branch information
jhchen committed Sep 15, 2016
1 parent 4f2ad7d commit 9c64c5d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class Clipboard extends Module {
let bodyTop = document.body.scrollTop;
this.container.focus();
setTimeout(() => {
this.quill.selection.update(Quill.sources.SILENT);
delta = delta.concat(this.convert());
this.quill.updateContents(delta, Quill.sources.USER);
// range.length contributes to delta.length()
Expand Down
14 changes: 14 additions & 0 deletions test/unit/modules/clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ describe('Clipboard', function() {
done();
}, 2);
});

it('selection-change', function(done) {
let handler = {
change: function() {}
};
spyOn(handler, 'change')
this.quill.on('selection-change', handler.change);
this.quill.clipboard.container.innerHTML = '0';
this.quill.clipboard.onPaste({});
setTimeout(function() {
expect(handler.change).not.toHaveBeenCalled();
done();
}, 2);
});
});

describe('convert', function() {
Expand Down

0 comments on commit 9c64c5d

Please sign in to comment.