mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 02:05:37 +02:00
[Editor] Allow to change a preference from the editor UI manager
We want to be able to update a global pref (i.e. enableAltText) in using a toggle button in the new alt-text dialog.
This commit is contained in:
parent
5be66580e6
commit
5946d20dc9
2 changed files with 13 additions and 0 deletions
|
@ -928,6 +928,14 @@ class AnnotationEditorUIManager {
|
|||
});
|
||||
}
|
||||
|
||||
setPreference(name, value) {
|
||||
this._eventBus.dispatch("setpreference", {
|
||||
source: this,
|
||||
name,
|
||||
value,
|
||||
});
|
||||
}
|
||||
|
||||
onPageChanging({ pageNumber }) {
|
||||
this.#currentPageIndex = pageNumber - 1;
|
||||
}
|
||||
|
|
|
@ -1942,6 +1942,7 @@ const PDFViewerApplication = {
|
|||
{ signal }
|
||||
);
|
||||
eventBus._on("reporttelemetry", webViewerReportTelemetry, { signal });
|
||||
eventBus._on("setpreference", webViewerSetPreference, { signal });
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -3166,4 +3167,8 @@ function webViewerReportTelemetry({ details }) {
|
|||
PDFViewerApplication.externalServices.reportTelemetry(details);
|
||||
}
|
||||
|
||||
function webViewerSetPreference({ name, value }) {
|
||||
PDFViewerApplication.preferences.set(name, value);
|
||||
}
|
||||
|
||||
export { PDFViewerApplication };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue