mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-07 17:05:38 +02:00
Handle the "switchannotationeditorparams" event in the editor-code (issue 18196)
The problem seems to be caused by the browser trying to "restore" editing input-elements, in the various toolbars, to their previous values when the tab is re-opened. Hence the simplest solution appears to be to move the event handling into the editor-code, which is also less code overall, since the listener thus won't be registered early enough for the problem to appear.
This commit is contained in:
parent
82735537bf
commit
9e0c6ef476
3 changed files with 5 additions and 13 deletions
|
@ -783,6 +783,11 @@ class AnnotationEditorUIManager {
|
||||||
signal,
|
signal,
|
||||||
});
|
});
|
||||||
eventBus._on("setpreference", this.onSetPreference.bind(this), { signal });
|
eventBus._on("setpreference", this.onSetPreference.bind(this), { signal });
|
||||||
|
eventBus._on(
|
||||||
|
"switchannotationeditorparams",
|
||||||
|
evt => this.updateParams(evt.type, evt.value),
|
||||||
|
{ signal }
|
||||||
|
);
|
||||||
this.#addSelectionListener();
|
this.#addSelectionListener();
|
||||||
this.#addDragAndDropListeners();
|
this.#addDragAndDropListeners();
|
||||||
this.#addKeyboardManager();
|
this.#addKeyboardManager();
|
||||||
|
|
|
@ -1939,11 +1939,6 @@ const PDFViewerApplication = {
|
||||||
evt => (pdfViewer.annotationEditorMode = evt),
|
evt => (pdfViewer.annotationEditorMode = evt),
|
||||||
{ signal }
|
{ signal }
|
||||||
);
|
);
|
||||||
eventBus._on(
|
|
||||||
"switchannotationeditorparams",
|
|
||||||
evt => (pdfViewer.annotationEditorParams = evt),
|
|
||||||
{ signal }
|
|
||||||
);
|
|
||||||
eventBus._on("print", this.triggerPrinting.bind(this), { signal });
|
eventBus._on("print", this.triggerPrinting.bind(this), { signal });
|
||||||
eventBus._on("download", this.downloadOrSave.bind(this), { signal });
|
eventBus._on("download", this.downloadOrSave.bind(this), { signal });
|
||||||
eventBus._on("firstpage", () => (this.page = 1), { signal });
|
eventBus._on("firstpage", () => (this.page = 1), { signal });
|
||||||
|
|
|
@ -2363,14 +2363,6 @@ class PDFViewer {
|
||||||
updater();
|
updater();
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line accessor-pairs
|
|
||||||
set annotationEditorParams({ type, value }) {
|
|
||||||
if (!this.#annotationEditorUIManager) {
|
|
||||||
throw new Error(`The AnnotationEditor is not enabled.`);
|
|
||||||
}
|
|
||||||
this.#annotationEditorUIManager.updateParams(type, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
refresh(noUpdate = false, updateArgs = Object.create(null)) {
|
refresh(noUpdate = false, updateArgs = Object.create(null)) {
|
||||||
if (!this.pdfDocument) {
|
if (!this.pdfDocument) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue