Remove the "Open file"-button from the main toolbar

This button is *only* used in the GENERIC viewer, and will currently be visible either in the main or secondary toolbars (depending on the viewer width).
To simplify upcoming changes, and to avoid then having to complicate the relevant CSS rules unnecessarily, let's place the "Open file"-button permanently in the secondary toolbar instead.

(Note that the GENERIC viewer also, since five years, supports drag-and-drop in order to open local files.)
This commit is contained in:
Jonas Jenwald 2023-11-09 07:55:48 +01:00
parent 42f3d57365
commit bf016743fc
4 changed files with 4 additions and 29 deletions

View File

@ -39,7 +39,6 @@ const PAGE_NUMBER_LOADING_INDICATOR = "visiblePageIsLoading";
* @property {HTMLButtonElement} zoomIn - Button to zoom in the pages.
* @property {HTMLButtonElement} zoomOut - Button to zoom out the pages.
* @property {HTMLButtonElement} viewFind - Button to open find bar.
* @property {HTMLButtonElement} openFile - Button to open a new document.
* @property {HTMLButtonElement} editorFreeTextButton - Button to switch to
* FreeText editing.
* @property {HTMLButtonElement} download - Button to download the document.
@ -97,9 +96,6 @@ class Toolbar {
},
},
];
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
this.buttons.push({ element: options.openFile, eventName: "openfile" });
}
this.items = {
numPages: options.numPages,
pageNumber: options.pageNumber,

View File

@ -919,13 +919,12 @@ body {
mask-image: var(--toolbarButton-editorStamp-icon);
}
#print::before,
#secondaryPrint::before {
:is(#print, #secondaryPrint)::before {
mask-image: var(--toolbarButton-print-icon);
}
/*#if GENERIC*/
:is(#openFile, #secondaryOpenFile)::before {
#secondaryOpenFile::before {
mask-image: var(--toolbarButton-openFile-icon);
}
/*#endif*/
@ -1435,7 +1434,6 @@ dialog :link {
}
}
.visibleLargeView,
.visibleMediumView {
display: none;
}
@ -1459,15 +1457,6 @@ dialog :link {
}
}
@media all and (max-width: 820px) {
#outerContainer .hiddenLargeView {
display: none;
}
#outerContainer .visibleLargeView {
display: inherit;
}
}
@media all and (max-width: 750px) {
#outerContainer .hiddenMediumView {
display: none;

View File

@ -210,7 +210,7 @@ See https://github.com/adobe-type-tools/cmap-resources
<div id="secondaryToolbar" class="secondaryToolbar hidden doorHangerRight">
<div id="secondaryToolbarButtonContainer">
<!--#if GENERIC-->
<button id="secondaryOpenFile" class="secondaryToolbarButton visibleLargeView" title="Open File" tabindex="51" data-l10n-id="pdfjs-open-file-button">
<button id="secondaryOpenFile" class="secondaryToolbarButton" title="Open File" tabindex="51" data-l10n-id="pdfjs-open-file-button">
<span data-l10n-id="pdfjs-open-file-button-label">Open</span>
</button>
<!--#endif-->
@ -224,7 +224,7 @@ See https://github.com/adobe-type-tools/cmap-resources
</button>
<!--#if GENERIC-->
<div class="horizontalToolbarSeparator visibleLargeView"></div>
<div class="horizontalToolbarSeparator"></div>
<!--#else-->
<!-- <div class="horizontalToolbarSeparator visibleMediumView"></div>-->
<!--#endif-->
@ -329,12 +329,6 @@ See https://github.com/adobe-type-tools/cmap-resources
<span id="numPages" class="toolbarLabel"></span>
</div>
<div id="toolbarViewerRight">
<!--#if GENERIC-->
<button id="openFile" class="toolbarButton hiddenLargeView" title="Open File" tabindex="31" data-l10n-id="pdfjs-open-file-button">
<span data-l10n-id="pdfjs-open-file-button-label">Open</span>
</button>
<!--#endif-->
<button id="print" class="toolbarButton hiddenMediumView" title="Print" tabindex="32" data-l10n-id="pdfjs-print-button">
<span data-l10n-id="pdfjs-print-button-label">Print</span>
</button>

View File

@ -52,10 +52,6 @@ function getViewerConfiguration() {
zoomIn: document.getElementById("zoomIn"),
zoomOut: document.getElementById("zoomOut"),
viewFind: document.getElementById("viewFind"),
openFile:
typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")
? document.getElementById("openFile")
: null,
print: document.getElementById("print"),
editorFreeTextButton: document.getElementById("editorFreeText"),
editorFreeTextParamsToolbar: document.getElementById(