Skip to content

Commit

Permalink
Merge pull request #15295 from calixteman/disable_editing
Browse files Browse the repository at this point in the history
[Editing] Disable buttons until the first page is rendered
  • Loading branch information
calixteman authored Aug 9, 2022
2 parents 589f72e + fbce878 commit 0079ce4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
14 changes: 8 additions & 6 deletions web/base_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -727,12 +727,6 @@ class BaseViewer {
if (isPureXfa) {
console.warn("Warning: XFA-editing is not implemented.");
} else if (isValidAnnotationEditorMode(mode)) {
// Ensure that the Editor buttons, in the toolbar, are updated.
this.eventBus.dispatch("annotationeditormodechanged", {
source: this,
mode,
});

this.#annotationEditorUIManager = new AnnotationEditorUIManager(
this.container,
this.eventBus
Expand Down Expand Up @@ -817,6 +811,14 @@ class BaseViewer {
this._scriptingManager.setDocument(pdfDocument); // Enable scripting.
}

if (this.#annotationEditorUIManager) {
// Ensure that the Editor buttons, in the toolbar, are updated.
this.eventBus.dispatch("annotationeditormodechanged", {
source: this,
mode: this.#annotationEditorMode,
});
}

// In addition to 'disableAutoFetch' being set, also attempt to reduce
// resource usage when loading *very* long/large documents.
if (
Expand Down
1 change: 0 additions & 1 deletion web/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ class Toolbar {
}
};
this.eventBus._on("annotationeditormodechanged", editorModeChanged);

this.eventBus._on("toolbarreset", evt => {
if (evt.source === this) {
editorModeChanged(
Expand Down

0 comments on commit 0079ce4

Please sign in to comment.