Repository navigation
Conversation
…22270) When a page is rendered again, AnnotationEditorLayer.render() adds the page's editors back, which calls onceAdded(). Highlight, ink and signature editors recorded their creation every time, so each render pushed another undo step that removes an editor created earlier, and undo no longer reverted the last change. Record the creation only the first time, like StampEditor already does.
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.
Fixes #22270.
When a page is rendered again,
AnnotationEditorLayer.render()adds the page's editors back withadd(), which callsonceAdded().HighlightEditorandDrawingEditor(and so ink and signature editors) calledaddUndoableEditor()fromonceAdded()every time, so each render pushed another undo step whose undo removes an editor created earlier. After scrolling a page out of the rendering buffer and back, undo removed an older annotation instead of reverting the last change.This adds
DrawingEditor._addToUndoStack(), which records the creation only the first time, asStampEditoralready does with#hasBeenAddedInUndoStack. It's used by the highlight and drawingonceAdded()and bySignatureEditor.addSignature(), so a signature added through the dialog isn't recorded a second time when its page is rendered again.The new integration test highlights a word on page 1 and another on page 14 (the last change), scrolls back so that page 1 is rendered again, and checks that undo removes the highlight on page 14. It follows the existing "Delete a highlight, scroll and undo it" test. I couldn't run the integration tests locally, so I'd appreciate a botio run; eslint and prettier pass on the changed files.