Merge pull request #13935 from Snuffleupagus/TextHighlighter-tweaks

A couple of small `TextHighlighter`/`TextLayerBuilder` tweaks (PR 13908 follow-up)
This commit is contained in:
Tim van der Meij 2021-08-25 23:06:51 +02:00 committed by GitHub
commit ada283cc35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 4 deletions

View File

@ -167,7 +167,7 @@ class TextHighlighter {
function appendTextToDiv(divIdx, fromOffset, toOffset, className) {
let div = textDivs[divIdx];
if (div.nodeType === 3) {
if (div.nodeType === Node.TEXT_NODE) {
const span = document.createElement("span");
div.parentNode.insertBefore(span, div);
span.appendChild(div);

View File

@ -49,9 +49,7 @@ class TextLayerBuilder {
this.textContentItemsStr = [];
this.textContentStream = null;
this.renderingDone = false;
this.pageIdx = pageIndex;
this.pageNumber = this.pageIdx + 1;
this.matches = [];
this.pageNumber = pageIndex + 1;
this.viewport = viewport;
this.textDivs = [];
this.textLayerRenderTask = null;