Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the contentmenu usage, from PresentationMode, since it's no longer working #12975

Merged
merged 1 commit into from
Feb 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions l10n/en-US/viewer.properties
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,12 @@ bookmark_label=Current View
tools.title=Tools
tools_label=Tools
first_page.title=Go to First Page
first_page.label=Go to First Page
first_page_label=Go to First Page
last_page.title=Go to Last Page
last_page.label=Go to Last Page
last_page_label=Go to Last Page
page_rotate_cw.title=Rotate Clockwise
page_rotate_cw.label=Rotate Clockwise
page_rotate_cw_label=Rotate Clockwise
page_rotate_ccw.title=Rotate Counterclockwise
page_rotate_ccw.label=Rotate Counterclockwise
page_rotate_ccw_label=Rotate Counterclockwise

cursor_text_select_tool.title=Enable Text Selection Tool
Expand Down
1 change: 0 additions & 1 deletion web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,6 @@ const PDFViewerApplication = {
container,
pdfViewer: this.pdfViewer,
eventBus,
contextMenuItems: appConfig.fullscreen,
});
}

Expand Down
25 changes: 1 addition & 24 deletions web/pdf_presentation_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@ const SWIPE_ANGLE_THRESHOLD = Math.PI / 6;
* @property {HTMLDivElement} container - The container for the viewer element.
* @property {PDFViewer} pdfViewer - The document viewer.
* @property {EventBus} eventBus - The application event bus.
* @property {Array} [contextMenuItems] - The menu items that are added to the
* context menu in Presentation Mode.
*/

class PDFPresentationMode {
/**
* @param {PDFPresentationModeOptions} options
*/
constructor({ container, pdfViewer, eventBus, contextMenuItems = null }) {
constructor({ container, pdfViewer, eventBus }) {
this.container = container;
this.pdfViewer = pdfViewer;
this.eventBus = eventBus;
Expand All @@ -53,25 +51,6 @@ class PDFPresentationMode {
this.mouseScrollTimeStamp = 0;
this.mouseScrollDelta = 0;
this.touchSwipeState = null;

if (contextMenuItems) {
contextMenuItems.contextFirstPage.addEventListener("click", () => {
this.contextMenuOpen = false;
this.eventBus.dispatch("firstpage", { source: this });
});
contextMenuItems.contextLastPage.addEventListener("click", () => {
this.contextMenuOpen = false;
this.eventBus.dispatch("lastpage", { source: this });
});
contextMenuItems.contextPageRotateCw.addEventListener("click", () => {
this.contextMenuOpen = false;
this.eventBus.dispatch("rotatecw", { source: this });
});
contextMenuItems.contextPageRotateCcw.addEventListener("click", () => {
this.contextMenuOpen = false;
this.eventBus.dispatch("rotateccw", { source: this });
});
}
}

/**
Expand Down Expand Up @@ -249,7 +228,6 @@ class PDFPresentationMode {
this._addWindowListeners();
this._showControls();
this.contextMenuOpen = false;
this.container.setAttribute("contextmenu", "viewerContextMenu");

// Text selection is disabled in Presentation Mode, thus it's not possible
// for the user to deselect text that is selected (e.g. with "Select all")
Expand Down Expand Up @@ -279,7 +257,6 @@ class PDFPresentationMode {
this._removeWindowListeners();
this._hideControls();
this._resetMouseScrollState();
this.container.removeAttribute("contextmenu");
this.contextMenuOpen = false;
}

Expand Down
11 changes: 0 additions & 11 deletions web/viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -316,17 +316,6 @@
</div>
</div>

<menu type="context" id="viewerContextMenu">
<menuitem id="contextFirstPage" label="First Page"
data-l10n-id="first_page"></menuitem>
<menuitem id="contextLastPage" label="Last Page"
data-l10n-id="last_page"></menuitem>
<menuitem id="contextPageRotateCw" label="Rotate Clockwise"
data-l10n-id="page_rotate_cw"></menuitem>
<menuitem id="contextPageRotateCcw" label="Rotate Counter-Clockwise"
data-l10n-id="page_rotate_ccw"></menuitem>
</menu>

<div id="viewerContainer" tabindex="0">
<div id="viewer" class="pdfViewer"></div>
</div>
Expand Down
6 changes: 0 additions & 6 deletions web/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,6 @@ function getViewerConfiguration() {
spreadEvenButton: document.getElementById("spreadEven"),
documentPropertiesButton: document.getElementById("documentProperties"),
},
fullscreen: {
contextFirstPage: document.getElementById("contextFirstPage"),
contextLastPage: document.getElementById("contextLastPage"),
contextPageRotateCw: document.getElementById("contextPageRotateCw"),
contextPageRotateCcw: document.getElementById("contextPageRotateCcw"),
},
sidebar: {
// Divs (and sidebar button)
outerContainer: document.getElementById("outerContainer"),
Expand Down