Merge pull request #21368 from Snuffleupagus/more-internal-events

Mark a couple of viewer, and editor, EventBus listeners as "internal"
This commit is contained in:
Tim van der Meij 2026-05-31 14:35:18 +02:00 committed by GitHub
commit 5fbab91f71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 39 additions and 28 deletions

View File

@ -1231,7 +1231,7 @@ class AnnotationEditorUIManager {
resolve();
}
};
this._eventBus.on("editorsrendered", onEditorsRendered);
this._eventBus.on("editorsrendered", onEditorsRendered, internalOpt);
await promise;
}
@ -1248,6 +1248,7 @@ class AnnotationEditorUIManager {
this._eventBus.on("annotationeditormodechanged", callback, {
once: true,
signal: this._signal,
...internalOpt,
});
this._eventBus.dispatch("showannotationeditorui", {
source: this,

View File

@ -884,8 +884,10 @@ const PDFViewerApplication = {
if (!this.supportsPrinting) {
togglePrintingButtons(false);
} else {
eventBus.on("printingallowed", ({ isAllowed }) =>
togglePrintingButtons(isAllowed)
eventBus.on(
"printingallowed",
({ isAllowed }) => togglePrintingButtons(isAllowed),
internalOpt
);
}
@ -1452,7 +1454,7 @@ const PDFViewerApplication = {
}
resolve(isAllowed);
},
{ once: true }
{ once: true, ...internalOpt }
);
});

View File

@ -237,12 +237,12 @@ class PDFThumbnailViewer {
this.#newBadge = newSpan;
}
this.eventBus.on(
eventBus.on(
"pagesloaded",
() => {
menuButton.disabled = false;
},
{ once: true }
{ once: true, ...internalOpt }
);
this._manageMenu = new Menu(menu, menuButton, [
@ -266,27 +266,31 @@ class PDFThumbnailViewer {
this.#toggleMenuEntries(false);
menuButton.disabled = true;
this.eventBus.on("editingaction", ({ name }) => {
switch (name) {
case "copyPage":
this.#copyPages();
break;
case "cutPage":
this.#cutPages();
break;
case "deletePage":
this.#deletePages("delete");
break;
case "savePage":
this.#saveExtractedPages();
break;
}
});
eventBus.on(
"editingaction",
({ name }) => {
switch (name) {
case "copyPage":
this.#copyPages();
break;
case "cutPage":
this.#cutPages();
break;
case "deletePage":
this.#deletePages("delete");
break;
case "savePage":
this.#saveExtractedPages();
break;
}
},
internalOpt
);
this.container.addEventListener(
"contextmenu",
e => {
this.eventBus.dispatch("editingstateschanged", {
eventBus.dispatch("editingstateschanged", {
source: this,
details: {
thumbnailId:
@ -1386,11 +1390,15 @@ class PDFThumbnailViewer {
}
#addEventListeners() {
this.eventBus.on("resize", ({ source }) => {
if (source.thumbnailsView === this.container) {
this.#computeThumbnailsPosition();
}
});
this.eventBus.on(
"resize",
({ source }) => {
if (source.thumbnailsView === this.container) {
this.#computeThumbnailsPosition();
}
},
internalOpt
);
this.container.addEventListener("keydown", e => {
const { target } = e;
const isCheckbox =