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

[Editing] Disable buttons until the first page is rendered #15295

Merged
merged 1 commit into from
Aug 9, 2022
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
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