Skip to content

Commit

Permalink
Move 'presentation mode' and 'bookmarks' buttons in the secondary too…
Browse files Browse the repository at this point in the history
…lbar (bug 1789082)
  • Loading branch information
calixteman committed Sep 8, 2022
1 parent 783c722 commit e56c30e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 46 deletions.
6 changes: 1 addition & 5 deletions web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -811,9 +811,7 @@ const PDFViewerApplication = {
*/
_hideViewBookmark() {
// URL does not reflect proper document location - hiding some buttons.
const { toolbar, secondaryToolbar } = this.appConfig;
toolbar.viewBookmark.hidden = true;
secondaryToolbar.viewBookmarkButton.hidden = true;
this.appConfig.secondaryToolbar.viewBookmarkButton.hidden = true;
},

/**
Expand Down Expand Up @@ -2337,7 +2335,6 @@ function webViewerInitialized() {
}

if (!PDFViewerApplication.supportsFullscreen) {
appConfig.toolbar.presentationModeButton.classList.add("hidden");
appConfig.secondaryToolbar.presentationModeButton.classList.add("hidden");
}

Expand Down Expand Up @@ -2490,7 +2487,6 @@ function webViewerUpdateViewarea({ location }) {
const href = PDFViewerApplication.pdfLinkService.getAnchorUrl(
location.pdfOpenParams
);
PDFViewerApplication.appConfig.toolbar.viewBookmark.href = href;
PDFViewerApplication.appConfig.secondaryToolbar.viewBookmarkButton.href =
href;

Expand Down
9 changes: 0 additions & 9 deletions web/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,9 @@ const PAGE_NUMBER_LOADING_INDICATOR = "visiblePageIsLoading";
* @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} presentationModeButton - Button to switch to
* presentation mode.
* @property {HTMLButtonElement} editorFreeTextButton - Button to switch to
* FreeText editing.
* @property {HTMLButtonElement} download - Button to download the document.
* @property {HTMLAnchorElement} viewBookmark - Button to obtain a bookmark link
* to the current location in the document.
*/

class Toolbar {
Expand All @@ -69,12 +65,7 @@ class Toolbar {
{ element: options.zoomIn, eventName: "zoomin" },
{ element: options.zoomOut, eventName: "zoomout" },
{ element: options.print, eventName: "print" },
{
element: options.presentationModeButton,
eventName: "presentationmode",
},
{ element: options.download, eventName: "download" },
{ element: options.viewBookmark, eventName: null },
{
element: options.editorFreeTextButton,
eventName: "switchannotationeditormode",
Expand Down
6 changes: 2 additions & 4 deletions web/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,7 @@ select {
mask-image: var(--toolbarButton-zoomIn-icon);
}

#presentationMode::before,
#secondaryPresentationMode::before {
#presentationMode::before {
mask-image: var(--toolbarButton-presentationMode-icon);
}

Expand Down Expand Up @@ -922,8 +921,7 @@ a.secondaryToolbarButton[href="#"] {
pointer-events: none;
}

#viewBookmark::before,
#secondaryViewBookmark::before {
#viewBookmark::before {
mask-image: var(--toolbarButton-bookmark-icon);
}

Expand Down
39 changes: 17 additions & 22 deletions web/viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -180,29 +180,31 @@

<div id="secondaryToolbar" class="secondaryToolbar hidden doorHangerRight">
<div id="secondaryToolbarButtonContainer">
<button id="secondaryPresentationMode" class="secondaryToolbarButton visibleLargeView" title="Switch to Presentation Mode" tabindex="51" data-l10n-id="presentation_mode">
<span data-l10n-id="presentation_mode_label">Presentation Mode</span>
</button>

<!--#if GENERIC-->
<button id="secondaryOpenFile" class="secondaryToolbarButton visibleLargeView" title="Open File" tabindex="52" data-l10n-id="open_file">
<button id="secondaryOpenFile" class="secondaryToolbarButton visibleLargeView" title="Open File" tabindex="51" data-l10n-id="open_file">
<span data-l10n-id="open_file_label">Open</span>
</button>
<!--#endif-->

<button id="secondaryPrint" class="secondaryToolbarButton visibleMediumView" title="Print" tabindex="53" data-l10n-id="print">
<button id="secondaryPrint" class="secondaryToolbarButton visibleMediumView" title="Print" tabindex="52" data-l10n-id="print">
<span data-l10n-id="print_label">Print</span>
</button>

<button id="secondaryDownload" class="secondaryToolbarButton visibleMediumView" title="Download" tabindex="54" data-l10n-id="download">
<button id="secondaryDownload" class="secondaryToolbarButton visibleMediumView" title="Download" tabindex="53" data-l10n-id="download">
<span data-l10n-id="download_label">Download</span>
</button>

<a href="#" id="secondaryViewBookmark" class="secondaryToolbarButton visibleSmallView" title="Current view (copy or open in new window)" tabindex="55" data-l10n-id="bookmark">
<div class="horizontalToolbarSeparator visibleLargeView"></div>

<button id="presentationMode" class="secondaryToolbarButton" title="Switch to Presentation Mode" tabindex="54" data-l10n-id="presentation_mode">
<span data-l10n-id="presentation_mode_label">Presentation Mode</span>
</button>

<a href="#" id="viewBookmark" class="secondaryToolbarButton" title="Current view (copy or open in new window)" tabindex="55" data-l10n-id="bookmark">
<span data-l10n-id="bookmark_label">Current View</span>
</a>

<div class="horizontalToolbarSeparator visibleLargeView"></div>
<div class="horizontalToolbarSeparator"></div>

<button id="firstPage" class="secondaryToolbarButton" title="Go to First Page" tabindex="56" data-l10n-id="first_page">
<span data-l10n-id="first_page_label">Go to First Page</span>
Expand Down Expand Up @@ -294,34 +296,27 @@
<span id="numPages" class="toolbarLabel"></span>
</div>
<div id="toolbarViewerRight">
<button id="presentationMode" class="toolbarButton hiddenLargeView" title="Switch to Presentation Mode" tabindex="31" data-l10n-id="presentation_mode">
<span data-l10n-id="presentation_mode_label">Presentation Mode</span>
</button>

<!--#if GENERIC-->
<button id="openFile" class="toolbarButton hiddenLargeView" title="Open File" tabindex="32" data-l10n-id="open_file">
<button id="openFile" class="toolbarButton hiddenLargeView" title="Open File" tabindex="31" data-l10n-id="open_file">
<span data-l10n-id="open_file_label">Open</span>
</button>
<!--#endif-->

<button id="print" class="toolbarButton hiddenMediumView" title="Print" tabindex="33" data-l10n-id="print">
<button id="print" class="toolbarButton hiddenMediumView" title="Print" tabindex="32" data-l10n-id="print">
<span data-l10n-id="print_label">Print</span>
</button>

<button id="download" class="toolbarButton hiddenMediumView" title="Download" tabindex="34" data-l10n-id="download">
<button id="download" class="toolbarButton hiddenMediumView" title="Download" tabindex="33" data-l10n-id="download">
<span data-l10n-id="download_label">Download</span>
</button>
<a href="#" id="viewBookmark" class="toolbarButton hiddenSmallView" title="Current view (copy or open in new window)" tabindex="35" data-l10n-id="bookmark">
<span data-l10n-id="bookmark_label">Current View</span>
</a>

<div class="verticalToolbarSeparator hiddenSmallView"></div>
<div class="verticalToolbarSeparator hiddenMediumView"></div>

<div id="editorModeButtons" class="splitToolbarButton toggled hidden" role="radiogroup">
<button id="editorFreeText" class="toolbarButton" disabled="disabled" title="Text" role="radio" aria-checked="false" tabindex="36" data-l10n-id="editor_free_text2">
<button id="editorFreeText" class="toolbarButton" disabled="disabled" title="Text" role="radio" aria-checked="false" tabindex="34" data-l10n-id="editor_free_text2">
<span data-l10n-id="editor_free_text2_label">Text</span>
</button>
<button id="editorInk" class="toolbarButton" disabled="disabled" title="Draw" role="radio" aria-checked="false" tabindex="37" data-l10n-id="editor_ink2">
<button id="editorInk" class="toolbarButton" disabled="disabled" title="Draw" role="radio" aria-checked="false" tabindex="35" data-l10n-id="editor_ink2">
<span data-l10n-id="editor_ink2_label">Draw</span>
</button>
</div>
Expand Down
8 changes: 2 additions & 6 deletions web/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,23 +107,19 @@ function getViewerConfiguration() {
),
editorInkButton: document.getElementById("editorInk"),
editorInkParamsToolbar: document.getElementById("editorInkParamsToolbar"),
presentationModeButton: document.getElementById("presentationMode"),
download: document.getElementById("download"),
viewBookmark: document.getElementById("viewBookmark"),
},
secondaryToolbar: {
toolbar: document.getElementById("secondaryToolbar"),
toggleButton: document.getElementById("secondaryToolbarToggle"),
presentationModeButton: document.getElementById(
"secondaryPresentationMode"
),
presentationModeButton: document.getElementById("presentationMode"),
openFileButton:
typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")
? document.getElementById("secondaryOpenFile")
: null,
printButton: document.getElementById("secondaryPrint"),
downloadButton: document.getElementById("secondaryDownload"),
viewBookmarkButton: document.getElementById("secondaryViewBookmark"),
viewBookmarkButton: document.getElementById("viewBookmark"),
firstPageButton: document.getElementById("firstPage"),
lastPageButton: document.getElementById("lastPage"),
pageRotateCwButton: document.getElementById("pageRotateCw"),
Expand Down

0 comments on commit e56c30e

Please sign in to comment.