mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Pause translation when appending the textLayer and structTreeLayer to the page
Note that we must append the textLayer to the DOM *before* enabling the `highlighter` and `accessibilityManager`, to avoid breaking e.g. a pending searching operation. The least invasive solution, that I was able to come up with, is to introduce a new `TextLayerBuilder` callback-function for this purpose.
This commit is contained in:
parent
6115a328ea
commit
d293048c5d
2 changed files with 20 additions and 4 deletions
|
@ -436,7 +436,10 @@ class PDFPageView {
|
|||
: null);
|
||||
const treeDom = this.structTreeLayer?.render(tree);
|
||||
if (treeDom) {
|
||||
// Pause translation when inserting the structTree in the DOM.
|
||||
this.l10n.pause();
|
||||
this.canvas?.append(treeDom);
|
||||
this.l10n.resume();
|
||||
}
|
||||
this.structTreeLayer?.show();
|
||||
}
|
||||
|
@ -863,7 +866,12 @@ class PDFPageView {
|
|||
enablePermissions:
|
||||
this.#textLayerMode === TextLayerMode.ENABLE_PERMISSIONS,
|
||||
});
|
||||
div.append(this.textLayer.div);
|
||||
this.textLayer.onAppend = textLayerDiv => {
|
||||
// Pause translation when inserting the textLayer in the DOM.
|
||||
this.l10n.pause();
|
||||
this.div.append(textLayerDiv);
|
||||
this.l10n.resume();
|
||||
};
|
||||
}
|
||||
|
||||
if (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue