Repository navigation
Add drawing editors to the undo stack only once (issue 22270) - #22491
Open
yuyongyan29-dev wants to merge 2 commits into
Open
yuyongyan29-dev wants to merge 2 commits into
yuyongyan29-dev wants to merge 2 commits into
Conversation
onceAdded() runs again when a page is rendered, so a highlight, ink, or signature pushed another undo step. Undo then removed that earlier editor instead of the last edit. Co-authored-by: Yuyongyan <yuyongyan29@gmail.com>
Both follow the existing tests that scroll a page out of the buffer: create an editor on page 1 and another on page 14, render page 1 again, and check that undo removes the later editor. Co-authored-by: soujasK <121026960+soujasK@users.noreply.github.com> Co-authored-by: Yuyongyan <yuyongyan29@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a page is rendered again, its editors are added back and
DrawingEditor.onceAdded()callsaddUndoableEditor()again, so after scrolling a page out and back, Ctrl+Z undoes a stale "add" step and removes that drawing instead of the last edit.Same approach as the closed #22354 by @soujasK: track whether the editor was already added and push the undo step only the first time.
HighlightEditor.onceAdded()makes the same call, andSignatureEditor.addSignature()records the step itself, so both use the new helper too. Integration tests cover ink and highlight.Fixes #22270