Skip to content

Commit

Permalink
Fix issue with ctrl+s allowing for saving, and ctrl+p allowing for pr…
Browse files Browse the repository at this point in the history
…inting the PDFs. Remove buttons that allow for variously editing the PDF.
  • Loading branch information
Fyorl committed Mar 22, 2024
1 parent e417eae commit 418a72e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 80 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@foundryvtt/pdfjs",
"version": "4.0.379",
"version": "4.0.379-1",
"description": "",
"repository": {
"type": "git",
Expand Down
9 changes: 0 additions & 9 deletions web/viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,6 @@
<button id="editorHighlight" class="toolbarButton" hidden="true" disabled="disabled" title="Highlight" role="radio" aria-checked="false" aria-controls="editorHighlightParamsToolbar" tabindex="31" data-l10n-id="pdfjs-editor-highlight-button">
<span data-l10n-id="pdfjs-editor-highlight-button-label">Highlight</span>
</button>
<button id="editorFreeText" class="toolbarButton" disabled="disabled" title="Text" role="radio" aria-checked="false" aria-controls="editorFreeTextParamsToolbar" tabindex="32" data-l10n-id="pdfjs-editor-free-text-button">
<span data-l10n-id="pdfjs-editor-free-text-button-label">Text</span>
</button>
<button id="editorInk" class="toolbarButton" disabled="disabled" title="Draw" role="radio" aria-checked="false" aria-controls="editorInkParamsToolbar" tabindex="33" data-l10n-id="pdfjs-editor-ink-button">
<span data-l10n-id="pdfjs-editor-ink-button-label">Draw</span>
</button>
<button id="editorStamp" class="toolbarButton" disabled="disabled" title="Add or edit images" role="radio" aria-checked="false" aria-controls="editorStampParamsToolbar" tabindex="34" data-l10n-id="pdfjs-editor-stamp-button">
<span data-l10n-id="pdfjs-editor-stamp-button-label">Add or edit images</span>
</button>
</div>

<div class="verticalToolbarSeparator hiddenMediumView"></div>
Expand Down
70 changes: 0 additions & 70 deletions web/viewer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4053,24 +4053,6 @@ function webViewerKeyDown(evt) {
break;
}
}
if (cmd === 1 || cmd === 8) {
switch (evt.keyCode) {
case 83:
eventBus.dispatch("download", {
source: window
});
handled = true;
break;
case 79:
{
eventBus.dispatch("openfile", {
source: window
});
handled = true;
}
break;
}
}
if (cmd === 3 || cmd === 10) {
switch (evt.keyCode) {
case 80:
Expand Down Expand Up @@ -9654,13 +9636,6 @@ function renderProgress(index, total) {
progress
}));
}
window.addEventListener("keydown", function (event) {
if (event.keyCode === 80 && (event.ctrlKey || event.metaKey) && !event.altKey && (!event.shiftKey || window.chrome || window.opera)) {
window.print();
event.preventDefault();
event.stopImmediatePropagation();
}
}, true);
if ("onbeforeprint" in window) {
const stopPropagationIfNeeded = function (event) {
if (event.detail !== "custom") {
Expand Down Expand Up @@ -13837,17 +13812,6 @@ class Toolbar {
}, {
element: options.zoomOut,
eventName: "zoomout"
}, {
element: options.editorFreeTextButton,
eventName: "switchannotationeditormode",
eventDetails: {
get mode() {
const {
classList
} = options.editorFreeTextButton;
return classList.contains("toggled") ? pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.NONE : pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.FREETEXT;
}
}
}, {
element: options.editorHighlightButton,
eventName: "switchannotationeditormode",
Expand All @@ -13859,28 +13823,6 @@ class Toolbar {
return classList.contains("toggled") ? pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.NONE : pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.HIGHLIGHT;
}
}
}, {
element: options.editorInkButton,
eventName: "switchannotationeditormode",
eventDetails: {
get mode() {
const {
classList
} = options.editorInkButton;
return classList.contains("toggled") ? pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.NONE : pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.INK;
}
}
}, {
element: options.editorStampButton,
eventName: "switchannotationeditormode",
eventDetails: {
get mode() {
const {
classList
} = options.editorStampButton;
return classList.contains("toggled") ? pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.NONE : pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.STAMP;
}
}
}];
this.#bindListeners(buttons);
if (options.editorHighlightColorPicker) {
Expand Down Expand Up @@ -13985,24 +13927,12 @@ class Toolbar {
mode
}) {
const {
editorFreeTextButton,
editorFreeTextParamsToolbar,
editorHighlightButton,
editorHighlightParamsToolbar,
editorInkButton,
editorInkParamsToolbar,
editorStampButton,
editorStampParamsToolbar
} = this.#opts;
(0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.toggleCheckedBtn)(editorFreeTextButton, mode === pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.FREETEXT, editorFreeTextParamsToolbar);
(0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.toggleCheckedBtn)(editorHighlightButton, mode === pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.HIGHLIGHT, editorHighlightParamsToolbar);
(0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.toggleCheckedBtn)(editorInkButton, mode === pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.INK, editorInkParamsToolbar);
(0,_ui_utils_js__WEBPACK_IMPORTED_MODULE_1__.toggleCheckedBtn)(editorStampButton, mode === pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.STAMP, editorStampParamsToolbar);
const isDisable = mode === pdfjs_lib__WEBPACK_IMPORTED_MODULE_0__.AnnotationEditorType.DISABLE;
editorFreeTextButton.disabled = isDisable;
editorHighlightButton.disabled = isDisable;
editorInkButton.disabled = isDisable;
editorStampButton.disabled = isDisable;
}
#updateUIState(resetNumPages = false) {
const {
Expand Down

0 comments on commit 418a72e

Please sign in to comment.