[editor] Remove the editorNone toolbar button (bug 1787295)

This commit is contained in:
Jonas Jenwald 2022-08-25 23:18:02 +02:00
parent 76f665d57f
commit 19182d5f25
6 changed files with 19 additions and 35 deletions

View File

@ -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

View File

@ -1,4 +0,0 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path d="M12.407 8.217l-8.083-6.7A.2.2 0 0 0 4 1.672V12.3a.2.2 0 0 0 .333.146l2.56-2.372 1.857 3.9A1.125 1.125 0 1 0 10.782 13L8.913 9.075l3.4-.51a.2.2 0 0 0 .095-.348z"></path></svg>

Before

Width:  |  Height:  |  Size: 478 B

View File

@ -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);

View File

@ -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);
}

View File

@ -318,13 +318,10 @@ See https://github.com/adobe-type-tools/cmap-resources
<div class="verticalToolbarSeparator hiddenSmallView"></div>
<div id="editorModeButtons" class="splitToolbarButton toggled hidden" role="radiogroup">
<button id="editorNone" class="toolbarButton toggled" disabled="disabled" title="Disable Annotation Editing" role="radio" aria-checked="true" tabindex="36" data-l10n-id="editor_none">
<span data-l10n-id="editor_none_label">Disable Editing</span>
</button>
<button id="editorFreeText" class="toolbarButton" disabled="disabled" title="Add FreeText Annotation" role="radio" aria-checked="false" tabindex="37" data-l10n-id="editor_free_text">
<button id="editorFreeText" class="toolbarButton" disabled="disabled" title="Add FreeText Annotation" role="radio" aria-checked="false" tabindex="36" data-l10n-id="editor_free_text">
<span data-l10n-id="editor_free_text_label">FreeText Annotation</span>
</button>
<button id="editorInk" class="toolbarButton" disabled="disabled" title="Add Ink Annotation" role="radio" aria-checked="false" tabindex="38" data-l10n-id="editor_ink">
<button id="editorInk" class="toolbarButton" disabled="disabled" title="Add Ink Annotation" role="radio" aria-checked="false" tabindex="37" data-l10n-id="editor_ink">
<span data-l10n-id="editor_ink_label">Ink Annotation</span>
</button>
</div>

View File

@ -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"