1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

[Editor] Wait for 'pagerendered' to switch to editing mode

The focus can potentially be stolen when the DOM is modified when adding
a new canvas element for the page being redrawn.
This commit is contained in:
Calixte Denizet 2024-07-10 11:29:32 +02:00
parent 7ffea2f02a
commit d27efb43cd

View file

@ -2328,9 +2328,9 @@ class PDFViewer {
// We must call #switchToEditAnnotationMode unconditionally to ensure that
// page is rendered if it's useful or not.
const idsToRefresh = this.#switchToEditAnnotationMode();
if (isEditing && editId && idsToRefresh) {
// We're editing an existing annotation so we must switch to editing
// mode when the rendering is done.
if (isEditing && idsToRefresh) {
// We're editing so we must switch to editing mode when the rendering is
// done.
this.#cleanupSwitchAnnotationEditorMode();
this.#onPageRenderedCallback = ({ pageNumber }) => {
idsToRefresh.delete(pageNumber);