Nonconvergence when selecting Header on demo site
burke opened this issue · 2 comments
Checklist
- Are you reporting a bug? Use github issues for bug reports and feature requests. For general questions, please use https://discuss.yjs.dev/
- Try to report your issue in the correct repository. Yjs consists of many modules. When in doubt, report it to https://github.com/yjs/yjs/issues/
Describe the bug
Selecting "Heading 1" causes divergent states across peers
To Reproduce
Steps to reproduce the behavior:
- Open https://demos.yjs.dev/quill/quill.html in two windows
- Clear document contents
- Refresh both windows
- Click "Normal" and select "Heading 1" in one window
- Type "heading 1" (newline) (newline) "normal"
- Observe different states across windows
- Refresh both windows
- Observe that both documents are now in a third state, different from either state from step 6.
Expected behavior
No divergence
Screenshots
Environment Information
- macOS Catalina 10.15.6
- Brave Version 1.15.75 Chromium: 86.0.4240.99 (Official Build) (x86_64)
Hi @burke , Quill sometimes inserts additional formatting changes without firing the appropriate events. It is hard to detect that this is happening.
Quill has some really weird behavior if the last paragraph receives formatting attributes (e.g. the last paragraph is transformed to a heading, then to a centered text). One solution would be to prevent the user from creating empty documents. Before the user modifies the last paragraph, we could automatically append an additional paragraph. However, this is far from optimal..
The best solution for this would be to always double-check the quill document before applying formatting changes.
To be honest, it could be a while before I have time to look into this.
This was an issue with the text-formatting implementation in Yjs. It should be fixed now.
I followed the steps to reproduce the issue and now end up in the same state on all sites.
You will notice that one window might have a newline more than another window. But that is the expected behavior for now. The text-attributes and block-formats don't diverge anymore.
Please let me know if you can still reproduce the issue.