Visitar URL original
Fix editor selection state after listeners resume by Huang-404-Q · Pull Request #22291 · mozilla/pdf.js · GitHub
Skip to content

Fix editor selection state after listeners resume - #22291

Open
Huang-404-Q wants to merge 1 commit into
mozilla:masterfrom
Huang-404-Q:fix/editor-selection-after-listener-resume
Open

Huang-404-Q wants to merge 1 commit into
mozilla:masterfrom
Huang-404-Q:fix/editor-selection-after-listener-resume

Conversation

@Huang-404-Q

Copy link
Copy Markdown
Contributor

Summary

AnnotationEditorUIManager.setEditingState(true) always dispatched hasSelectedEditor: false, even when an editor remained selected across removeEditListeners() / addEditListeners(). Embeddings that use editingstateschanged to update their toolbar therefore disabled selection-dependent actions while the annotation was still selected.

Report the actual selection state with this.hasSelection.

Fixes #22209.

Test

Added a regression in test/unit/editor_spec.js that selects an editor, pauses and resumes editing listeners, and asserts the manager and emitted state still report a selection.

  • Main: 1 failure (Expected false to be true)
  • Fix: 1 pass
  • Command: Jasmine filtered run against test/unit/clitests.json

AI assistance

Tool(s) used: Claude Code

How you used it: the assistant read the source and issue, wrote the minimal fix and regression test, and ran the filtered unit test. A human reviewed the diff and takes responsibility for the change.

setEditingState(true) reported hasSelectedEditor as false even when an
editor remained selected across removeEditListeners/addEditListeners. The
vnode state event therefore disabled selection-dependent toolbar actions.

Report the actual selection state and add a regression test.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: addEditListeners reports no selected editor although the annotation is still selected

2 participants