mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 17:55:37 +02:00
[editor] Disable editing while PresentationMode is active
This commit is contained in:
parent
13c01b6d4a
commit
37b61f2228
2 changed files with 16 additions and 1 deletions
|
@ -2156,7 +2156,9 @@ class BaseViewer {
|
||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
get annotationEditorMode() {
|
get annotationEditorMode() {
|
||||||
return this.#annotationEditorMode;
|
return this.#annotationEditorUIManager
|
||||||
|
? this.#annotationEditorMode
|
||||||
|
: AnnotationEditorType.DISABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -19,6 +19,7 @@ import {
|
||||||
ScrollMode,
|
ScrollMode,
|
||||||
SpreadMode,
|
SpreadMode,
|
||||||
} from "./ui_utils.js";
|
} from "./ui_utils.js";
|
||||||
|
import { AnnotationEditorType } from "pdfjs-lib";
|
||||||
|
|
||||||
const DELAY_BEFORE_HIDING_CONTROLS = 3000; // in ms
|
const DELAY_BEFORE_HIDING_CONTROLS = 3000; // in ms
|
||||||
const ACTIVE_SELECTOR = "pdfPresentationMode";
|
const ACTIVE_SELECTOR = "pdfPresentationMode";
|
||||||
|
@ -79,6 +80,7 @@ class PDFPresentationMode {
|
||||||
scaleValue: pdfViewer.currentScaleValue,
|
scaleValue: pdfViewer.currentScaleValue,
|
||||||
scrollMode: pdfViewer.scrollMode,
|
scrollMode: pdfViewer.scrollMode,
|
||||||
spreadMode: null,
|
spreadMode: null,
|
||||||
|
annotationEditorMode: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -91,6 +93,9 @@ class PDFPresentationMode {
|
||||||
);
|
);
|
||||||
this.#args.spreadMode = pdfViewer.spreadMode;
|
this.#args.spreadMode = pdfViewer.spreadMode;
|
||||||
}
|
}
|
||||||
|
if (pdfViewer.annotationEditorMode !== AnnotationEditorType.DISABLE) {
|
||||||
|
this.#args.annotationEditorMode = pdfViewer.annotationEditorMode;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await promise;
|
await promise;
|
||||||
|
@ -167,6 +172,10 @@ class PDFPresentationMode {
|
||||||
}
|
}
|
||||||
this.pdfViewer.currentPageNumber = this.#args.pageNumber;
|
this.pdfViewer.currentPageNumber = this.#args.pageNumber;
|
||||||
this.pdfViewer.currentScaleValue = "page-fit";
|
this.pdfViewer.currentScaleValue = "page-fit";
|
||||||
|
|
||||||
|
if (this.#args.annotationEditorMode !== null) {
|
||||||
|
this.pdfViewer.annotationEditorMode = AnnotationEditorType.NONE;
|
||||||
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
this.#addWindowListeners();
|
this.#addWindowListeners();
|
||||||
|
@ -195,6 +204,10 @@ class PDFPresentationMode {
|
||||||
}
|
}
|
||||||
this.pdfViewer.currentScaleValue = this.#args.scaleValue;
|
this.pdfViewer.currentScaleValue = this.#args.scaleValue;
|
||||||
this.pdfViewer.currentPageNumber = pageNumber;
|
this.pdfViewer.currentPageNumber = pageNumber;
|
||||||
|
|
||||||
|
if (this.#args.annotationEditorMode !== null) {
|
||||||
|
this.pdfViewer.annotationEditorMode = this.#args.annotationEditorMode;
|
||||||
|
}
|
||||||
this.#args = null;
|
this.#args = null;
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue