mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
[Editor] Ensure that highlightSelection
waits until we've fully updated the editing-mode (issue 19369)
With the changes in PR 18843 the `AnnotationEditorUIManager.prototype.updateMode` method is now asynchronous, which we need to take into account when dispatching the "annotationeditormodechanged" event.
This commit is contained in:
parent
877f69886c
commit
3b4758a400
2 changed files with 38 additions and 17 deletions
|
@ -2339,11 +2339,22 @@ class PDFViewer {
|
|||
this.#mlManager?.loadModel("altText");
|
||||
}
|
||||
|
||||
const { eventBus } = this;
|
||||
const updater = () => {
|
||||
const { eventBus, pdfDocument } = this;
|
||||
const updater = async () => {
|
||||
this.#cleanupSwitchAnnotationEditorMode();
|
||||
this.#annotationEditorMode = mode;
|
||||
this.#annotationEditorUIManager.updateMode(mode, editId, isFromKeyboard);
|
||||
await this.#annotationEditorUIManager.updateMode(
|
||||
mode,
|
||||
editId,
|
||||
isFromKeyboard
|
||||
);
|
||||
if (
|
||||
mode !== this.#annotationEditorMode ||
|
||||
pdfDocument !== this.pdfDocument
|
||||
) {
|
||||
// Since `updateMode` is async, the active mode could have changed.
|
||||
return;
|
||||
}
|
||||
eventBus.dispatch("annotationeditormodechanged", {
|
||||
source: this,
|
||||
mode,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue