Merge pull request #17177 from Snuffleupagus/xfaLayer-pause-l10n
Pause translation when appending the xfaLayer to the page
This commit is contained in:
commit
fbfacf8828
@ -76,11 +76,11 @@ const NullL10n = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
pause() {
|
pause() {
|
||||||
ConstL10n.instance.pause();
|
return ConstL10n.instance.pause();
|
||||||
},
|
},
|
||||||
|
|
||||||
resume() {
|
resume() {
|
||||||
ConstL10n.instance.resume();
|
return ConstL10n.instance.resume();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -359,12 +359,23 @@ class PDFPageView {
|
|||||||
try {
|
try {
|
||||||
const result = await this.xfaLayer.render(this.viewport, "display");
|
const result = await this.xfaLayer.render(this.viewport, "display");
|
||||||
if (result?.textDivs && this._textHighlighter) {
|
if (result?.textDivs && this._textHighlighter) {
|
||||||
|
// Given that the following method fetches the text asynchronously we
|
||||||
|
// can invoke it *before* appending the xfaLayer to the DOM (below),
|
||||||
|
// since a pending search-highlight/scroll operation thus won't run
|
||||||
|
// until after the xfaLayer is available in the viewer.
|
||||||
this.#buildXfaTextContentItems(result.textDivs);
|
this.#buildXfaTextContentItems(result.textDivs);
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
console.error(`#renderXfaLayer: "${ex}".`);
|
console.error(`#renderXfaLayer: "${ex}".`);
|
||||||
error = ex;
|
error = ex;
|
||||||
} finally {
|
} finally {
|
||||||
|
if (this.xfaLayer?.div) {
|
||||||
|
// Pause translation when inserting the xfaLayer in the DOM.
|
||||||
|
this.l10n.pause();
|
||||||
|
this.div.append(this.xfaLayer.div);
|
||||||
|
this.l10n.resume();
|
||||||
|
}
|
||||||
|
|
||||||
this.eventBus.dispatch("xfalayerrendered", {
|
this.eventBus.dispatch("xfalayerrendered", {
|
||||||
source: this,
|
source: this,
|
||||||
pageNumber: this.id,
|
pageNumber: this.id,
|
||||||
@ -1020,9 +1031,6 @@ class PDFPageView {
|
|||||||
annotationStorage,
|
annotationStorage,
|
||||||
linkService,
|
linkService,
|
||||||
});
|
});
|
||||||
} else if (this.xfaLayer.div) {
|
|
||||||
// The xfa layer needs to stay on top.
|
|
||||||
div.append(this.xfaLayer.div);
|
|
||||||
}
|
}
|
||||||
this.#renderXfaLayer();
|
this.#renderXfaLayer();
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,6 @@ class XfaLayerBuilder {
|
|||||||
}
|
}
|
||||||
// Create an xfa layer div and render the form
|
// Create an xfa layer div and render the form
|
||||||
this.div = document.createElement("div");
|
this.div = document.createElement("div");
|
||||||
this.pageDiv.append(this.div);
|
|
||||||
parameters.div = this.div;
|
parameters.div = this.div;
|
||||||
|
|
||||||
return XfaLayer.render(parameters);
|
return XfaLayer.render(parameters);
|
||||||
|
Loading…
Reference in New Issue
Block a user