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

Unsupported format occasionally ends up in Quill delta #1434

Closed
sachinrekhi opened this issue Apr 27, 2017 · 0 comments · Fixed by #3988
Closed

Unsupported format occasionally ends up in Quill delta #1434

sachinrekhi opened this issue Apr 27, 2017 · 0 comments · Fixed by #3988

Comments

@sachinrekhi
Copy link
Contributor

In my instantiation of Quill I only support certain formats. I specifically exclude the 'color' format, for example. Most of the time this works great: when a user pastes colored text into Quill, it is appropriately removed.

However, on occasion, I end up finding a color attribute in the Delta object I ship to my server (coming directly from a TEXT_CHANGE event handler Delta). When I subsequently load the Delta into Quill, Quill appropriately removes it this time. This however results in inconsistent note state between client and server.

The question is, how did the color attribute get into the Delta object in the first place? I'm curious if there is any chance there is some kind of race condition which is causing this? Maybe the removal of the color attribute is happening after its applied to the editor? I couldn't find where in the Quill code the removal of unsupported formats happens.

To prevent this from ever occurring, I'm considering adding custom clipboard matchers for each of my unsupported formats and to remove them in the matcher. Hopefully this prevents it from ever getting into an outputted Quill delta.

But wanted to report this here in case it's possible to address the issue in Quill itself and also in case other people are experiencing it.

Unfortunately it's the worse kind of issue since it's incredibly difficult to reproduce. I've tried to find a reliable repro case but haven't been able to. Though it still occurs in production on occasion.

Steps for Reproduction

  1. Configure Quill to not support color format
  2. Create TEXT_CHANGE event handler to display Quill delta
  3. Paste text with color format into Quill

Expected behavior:
Color attribute never shows up in outputted Quill delta

Actual behavior:
Most of the times this works, but on occasion the Quill delta contains the color attribute

Version:
Quill 1.2.3

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

Successfully merging a pull request may close this issue.

2 participants