1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

Merge pull request #18217 from Snuffleupagus/inline-finishRendering

Inline the `#finishRendering` helper in `TextLayerBuilder.prototype.render`
This commit is contained in:
Tim van der Meij 2024-06-07 14:16:07 +02:00 committed by GitHub
commit b557fba118
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -68,16 +68,6 @@ class TextLayerBuilder {
this.div.className = "textLayer";
}
#finishRendering() {
this.#renderingDone = true;
const endOfContent = document.createElement("div");
endOfContent.className = "endOfContent";
this.div.append(endOfContent);
this.#bindMouse(endOfContent);
}
/**
* Renders the text layer.
* @param {PageViewport} viewport
@ -110,7 +100,13 @@ class TextLayerBuilder {
this.accessibilityManager?.setTextMapping(textDivs);
await this.#textLayer.render();
this.#finishRendering();
this.#renderingDone = true;
const endOfContent = document.createElement("div");
endOfContent.className = "endOfContent";
this.div.append(endOfContent);
this.#bindMouse(endOfContent);
// Ensure that the textLayer is appended to the DOM *before* handling
// e.g. a pending search operation.
this.#onAppend?.(this.div);