mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 02:05:37 +02:00
[Editor] Dispatch an event when some global states are changing
- this way the context menu in Firefox can take into account what we have in the clipboard, if an editor is selected, ... - when the user will click on a context menu item, an action will be triggered, hence this patch adds what is required to handle it; - some tests will be added in the Firefox' patch.
This commit is contained in:
parent
a1ac1a61b7
commit
ec0f9f6dcf
8 changed files with 278 additions and 28 deletions
14
web/app.js
14
web/app.js
|
@ -186,6 +186,10 @@ class DefaultExternalServices {
|
|||
static get isInAutomation() {
|
||||
return shadow(this, "isInAutomation", false);
|
||||
}
|
||||
|
||||
static updateEditorStates(data) {
|
||||
throw new Error("Not implemented: updateEditorStates");
|
||||
}
|
||||
}
|
||||
|
||||
const PDFViewerApplication = {
|
||||
|
@ -1954,6 +1958,12 @@ const PDFViewerApplication = {
|
|||
eventBus._on("fileinputchange", webViewerFileInputChange);
|
||||
eventBus._on("openfile", webViewerOpenFile);
|
||||
}
|
||||
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
||||
eventBus._on(
|
||||
"annotationeditorstateschanged",
|
||||
webViewerAnnotationEditorStatesChanged
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
bindWindowEvents() {
|
||||
|
@ -3076,6 +3086,10 @@ function beforeUnload(evt) {
|
|||
return false;
|
||||
}
|
||||
|
||||
function webViewerAnnotationEditorStatesChanged(data) {
|
||||
PDFViewerApplication.externalServices.updateEditorStates(data);
|
||||
}
|
||||
|
||||
/* Abstract factory for the print service. */
|
||||
const PDFPrintServiceFactory = {
|
||||
instance: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue