[Editor] Don't throw when switching to editing mode before an annotation editor layer is rendered
It can happen with a pdf having a large text layer. Instead of waiting for the first rendered page to enable the buttons we wait for a rendered annotation editor layer.
This commit is contained in:
parent
5b7f9ca8b9
commit
593ceadc93
@ -1072,6 +1072,20 @@ class PDFViewer {
|
||||
this._updateSpreadMode();
|
||||
}
|
||||
|
||||
eventBus._on(
|
||||
"annotationeditorlayerrendered",
|
||||
evt => {
|
||||
if (this.#annotationEditorUIManager) {
|
||||
// Ensure that the Editor buttons, in the toolbar, are updated.
|
||||
eventBus.dispatch("annotationeditormodechanged", {
|
||||
source: this,
|
||||
mode: this.#annotationEditorMode,
|
||||
});
|
||||
}
|
||||
},
|
||||
{ once: true, signal }
|
||||
);
|
||||
|
||||
// Fetch all the pages since the viewport is needed before printing
|
||||
// starts to create the correct size canvas. Wait until one page is
|
||||
// rendered so we don't tie up too many resources early on.
|
||||
@ -1090,14 +1104,6 @@ class PDFViewer {
|
||||
);
|
||||
}
|
||||
|
||||
if (this.#annotationEditorUIManager) {
|
||||
// Ensure that the Editor buttons, in the toolbar, are updated.
|
||||
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 (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user