diff --git a/l10n/en-US/viewer.properties b/l10n/en-US/viewer.properties index 9a726c6f1..4a95b937d 100644 --- a/l10n/en-US/viewer.properties +++ b/l10n/en-US/viewer.properties @@ -251,8 +251,6 @@ printing_not_ready=Warning: The PDF is not fully loaded for printing. web_fonts_disabled=Web fonts are disabled: unable to use embedded PDF fonts. # Editor -editor_none.title=Disable Annotation Editing -editor_none_label=Disable Editing editor_free_text.title=Add FreeText Annotation editor_free_text_label=FreeText Annotation editor_ink.title=Add Ink Annotation diff --git a/web/images/toolbarButton-editorNone.svg b/web/images/toolbarButton-editorNone.svg deleted file mode 100644 index 7137e05de..000000000 --- a/web/images/toolbarButton-editorNone.svg +++ /dev/null @@ -1,4 +0,0 @@ - - \ No newline at end of file diff --git a/web/toolbar.js b/web/toolbar.js index 866a47d3a..183d072d8 100644 --- a/web/toolbar.js +++ b/web/toolbar.js @@ -44,7 +44,6 @@ const PAGE_NUMBER_LOADING_INDICATOR = "visiblePageIsLoading"; * @property {HTMLButtonElement} openFile - Button to open a new document. * @property {HTMLButtonElement} presentationModeButton - Button to switch to * presentation mode. - * @property {HTMLButtonElement} editorNoneButton - Button to disable editing. * @property {HTMLButtonElement} editorFreeTextButton - Button to switch to * FreeText editing. * @property {HTMLButtonElement} download - Button to download the document. @@ -76,20 +75,29 @@ class Toolbar { }, { element: options.download, eventName: "download" }, { element: options.viewBookmark, eventName: null }, - { - element: options.editorNoneButton, - eventName: "switchannotationeditormode", - eventDetails: { mode: AnnotationEditorType.NONE }, - }, { element: options.editorFreeTextButton, eventName: "switchannotationeditormode", - eventDetails: { mode: AnnotationEditorType.FREETEXT }, + eventDetails: { + get mode() { + const { classList } = options.editorFreeTextButton; + return classList.contains("toggled") + ? AnnotationEditorType.NONE + : AnnotationEditorType.FREETEXT; + }, + }, }, { element: options.editorInkButton, eventName: "switchannotationeditormode", - eventDetails: { mode: AnnotationEditorType.INK }, + eventDetails: { + get mode() { + const { classList } = options.editorInkButton; + return classList.contains("toggled") + ? AnnotationEditorType.NONE + : AnnotationEditorType.INK; + }, + }, }, ]; if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) { @@ -104,11 +112,6 @@ class Toolbar { next: options.next, zoomIn: options.zoomIn, zoomOut: options.zoomOut, - editorNoneButton: options.editorNoneButton, - editorFreeTextButton: options.editorFreeTextButton, - editorFreeTextParamsToolbar: options.editorFreeTextParamsToolbar, - editorInkButton: options.editorInkButton, - editorInkParamsToolbar: options.editorInkParamsToolbar, }; // Bind the event listeners for click and various other actions. @@ -213,7 +216,6 @@ class Toolbar { } #bindEditorToolsListener({ - editorNoneButton, editorFreeTextButton, editorFreeTextParamsToolbar, editorInkButton, @@ -221,7 +223,6 @@ class Toolbar { }) { const editorModeChanged = (evt, disableButtons = false) => { const editorButtons = [ - { mode: AnnotationEditorType.NONE, button: editorNoneButton }, { mode: AnnotationEditorType.FREETEXT, button: editorFreeTextButton, @@ -239,9 +240,7 @@ class Toolbar { button.classList.toggle("toggled", checked); button.setAttribute("aria-checked", checked); button.disabled = disableButtons; - if (toolbar) { - toolbar.classList.toggle("hidden", !checked); - } + toolbar?.classList.toggle("hidden", !checked); } }; this.eventBus._on("annotationeditormodechanged", editorModeChanged); diff --git a/web/viewer.css b/web/viewer.css index 14aaf1773..8fe1e7d80 100644 --- a/web/viewer.css +++ b/web/viewer.css @@ -71,7 +71,6 @@ --loading-icon: url(images/loading.svg); --treeitem-expanded-icon: url(images/treeitem-expanded.svg); --treeitem-collapsed-icon: url(images/treeitem-collapsed.svg); - --toolbarButton-editorNone-icon: url(images/toolbarButton-editorNone.svg); --toolbarButton-editorFreeText-icon: url(images/toolbarButton-editorFreeText.svg); --toolbarButton-editorInk-icon: url(images/toolbarButton-editorInk.svg); --toolbarButton-menuArrow-icon: url(images/toolbarButton-menuArrow.svg); @@ -888,10 +887,6 @@ select { mask-image: var(--toolbarButton-presentationMode-icon); } -#editorNone::before { - mask-image: var(--toolbarButton-editorNone-icon); -} - #editorFreeText::before { mask-image: var(--toolbarButton-editorFreeText-icon); } diff --git a/web/viewer.html b/web/viewer.html index 3d4faef71..0a54dea23 100644 --- a/web/viewer.html +++ b/web/viewer.html @@ -318,13 +318,10 @@ See https://github.com/adobe-type-tools/cmap-resources
diff --git a/web/viewer.js b/web/viewer.js index c08208544..bc55ef3aa 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -101,7 +101,6 @@ function getViewerConfiguration() { ? document.getElementById("openFile") : null, print: document.getElementById("print"), - editorNoneButton: document.getElementById("editorNone"), editorFreeTextButton: document.getElementById("editorFreeText"), editorFreeTextParamsToolbar: document.getElementById( "editorFreeTextParamsToolbar"