-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Undo after API change is not correct #768
Comments
Thank you for the detailed report. The issue is Quill tries to use the minimal number of changes, as measured by number of characters, and Google and https://www.google.com/ actually share a common "oogle" substring. The fix was to try to use the specified API change instead of always diffing. Also the final correct state should actually be "Google The lazy fox!" since the linked Google text was added by source = api, the history module when set to userOnly should only undo changes made by source = user. This is most often used in a collaborative environment, for example when two users are working two different paragraphs. If I'm typing away on my paragraph and you are typing away on your paragraph, when I undo a bunch of times, only my paragraph should be affected. So if you inserted Google in your paragraph, me undoing should not remove it. |
The undo manager has the ability to not record API-initiated changes on the undo stack. So when an API change comes in, it adjusts all existing entries on the undo and redo stacks to account for the API change. But in the scenario below, it seems to get it wrong.
Steps for Reproduction
Here is what the following test is doing:
The actual steps:
Add the following test to
test/unit/modules/history.js
:Run
npm test
Expected behavior: It should pass. The final
undo()
should leave the document as just 'The lazy fox'Actual behavior: After the final
undo()
, the document is: G The lazy foxPlatforms: Chrome 50.0.2661.102 (64-bit) on Mac 10.11.5
Version: tag v1.0.0-beta.6
The text was updated successfully, but these errors were encountered: