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

[editor] Disable editing while PresentationMode is active #15123

Merged
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: 3 additions & 1 deletion web/base_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2156,7 +2156,9 @@ class BaseViewer {
* @type {number}
*/
get annotationEditorMode() {
return this.#annotationEditorMode;
return this.#annotationEditorUIManager
? this.#annotationEditorMode
: AnnotationEditorType.DISABLE;
}

/**
Expand Down
13 changes: 13 additions & 0 deletions web/pdf_presentation_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
ScrollMode,
SpreadMode,
} from "./ui_utils.js";
import { AnnotationEditorType } from "pdfjs-lib";

const DELAY_BEFORE_HIDING_CONTROLS = 3000; // in ms
const ACTIVE_SELECTOR = "pdfPresentationMode";
Expand Down Expand Up @@ -79,6 +80,7 @@ class PDFPresentationMode {
scaleValue: pdfViewer.currentScaleValue,
scrollMode: pdfViewer.scrollMode,
spreadMode: null,
annotationEditorMode: null,
};

if (
Expand All @@ -91,6 +93,9 @@ class PDFPresentationMode {
);
this.#args.spreadMode = pdfViewer.spreadMode;
}
if (pdfViewer.annotationEditorMode !== AnnotationEditorType.DISABLE) {
this.#args.annotationEditorMode = pdfViewer.annotationEditorMode;
}

try {
await promise;
Expand Down Expand Up @@ -167,6 +172,10 @@ class PDFPresentationMode {
}
this.pdfViewer.currentPageNumber = this.#args.pageNumber;
this.pdfViewer.currentScaleValue = "page-fit";

if (this.#args.annotationEditorMode !== null) {
this.pdfViewer.annotationEditorMode = AnnotationEditorType.NONE;
}
}, 0);

this.#addWindowListeners();
Expand Down Expand Up @@ -195,6 +204,10 @@ class PDFPresentationMode {
}
this.pdfViewer.currentScaleValue = this.#args.scaleValue;
this.pdfViewer.currentPageNumber = pageNumber;

if (this.#args.annotationEditorMode !== null) {
this.pdfViewer.annotationEditorMode = this.#args.annotationEditorMode;
}
this.#args = null;
}, 0);

Expand Down