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

user text-change event fired after calling updateContents(delta) #760

Closed
benbro opened this issue Jun 21, 2016 · 0 comments
Closed

user text-change event fired after calling updateContents(delta) #760

benbro opened this issue Jun 21, 2016 · 0 comments

Comments

@benbro
Copy link
Contributor

benbro commented Jun 21, 2016

[Describe the issue]
quill.updateContents(delta) should fire one text-change event with 'api' source but a text-change event with 'user' source is also fired.
It might be related to this commit:
e5651c6

Steps for Reproduction

  1. Visit http://beta.quilljs.com/
  2. Paste this in the console:
quill.on('text-change', function(delta, oldDelta, source) {
  console.log(source + ': ', JSON.stringify(delta.ops));
});
var ops = [{"insert":"a"},{"insert":"\n","attributes":{"list":"ordered"}}];
quill.setContents(ops);
var delta = [{"retain":2},{"insert":"\n","attributes":{"list":"ordered"}}];
quill.updateContents(delta);
JSON.stringify(quill.getContents().ops);

Expected behavior: [expected]
Only 'api' text-change event with insert in the delta.
Actual behavior: [actual]
We are getting a 'user' text-change event with insert in the delta.
The 'api' text-change event has a delta with retain and no insert:

// user source
[{"retain":2},{"insert":"\n"}]
// api source
[{"retain":2},{"retain":1,"attributes":{"list":"ordered"}}]

Platforms:
Firefox 47 on Windows 7

Version:
1.0.0-beta.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants