Bug 1754585 - Update pdf.js to version 2.13.133 r=pdfjs-reviewers,calixte

Differential Revision: https://phabricator.services.mozilla.com/D138359
This commit is contained in:
Brendan Dahl 2022-02-10 16:28:09 +00:00
Родитель 9fcb7f5716
Коммит bdbd290769
9 изменённых файлов: 5490 добавлений и 5288 удалений

Просмотреть файл

@ -168,9 +168,10 @@ find_previous.title=Find the previous occurrence of the phrase
find_previous_label=Previous
find_next.title=Find the next occurrence of the phrase
find_next_label=Next
find_highlight=Highlight all
find_match_case_label=Match case
find_entire_word_label=Whole words
find_highlight=Highlight All
find_match_case_label=Match Case
find_match_diacritics_label=Match Diacritics
find_entire_word_label=Whole Words
find_reached_top=Reached top of document, continued from bottom
find_reached_bottom=Reached end of document, continued from top
# LOCALIZATION NOTE (find_match_count): The supported plural forms are

Просмотреть файл

@ -1,5 +1,5 @@
This is the PDF.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 2.13.93
Current extension version is: 2.13.133
Taken from upstream commit: 6b9cc24d4
Taken from upstream commit: f8b2a99dd

Просмотреть файл

@ -1344,7 +1344,7 @@ async function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
const workerId = await worker.messageHandler.sendWithPromise("GetDocRequest", {
docId,
apiVersion: '2.13.93',
apiVersion: '2.13.133',
source: {
data: source.data,
url: source.url,
@ -1871,14 +1871,12 @@ class PDFPageProxy {
}
streamTextContent({
normalizeWhitespace = false,
disableCombineTextItems = false,
includeMarkedContent = false
} = {}) {
const TEXT_CONTENT_CHUNK_SIZE = 100;
return this._transport.messageHandler.sendWithStream("GetTextContent", {
pageIndex: this._pageIndex,
normalizeWhitespace: normalizeWhitespace === true,
combineTextItems: disableCombineTextItems !== true,
includeMarkedContent: includeMarkedContent === true
}, {
@ -2736,9 +2734,13 @@ class WorkerTransport {
if (loadingTask.onPassword) {
const updatePassword = password => {
this._passwordCapability.resolve({
password
});
if (password instanceof Error) {
this._passwordCapability.reject(password);
} else {
this._passwordCapability.resolve({
password
});
}
};
try {
@ -3345,9 +3347,9 @@ class InternalRenderTask {
}
const version = '2.13.93';
const version = '2.13.133';
exports.version = version;
const build = '6b9cc24d4';
const build = 'f8b2a99dd';
exports.build = build;
/***/ }),
@ -12382,8 +12384,8 @@ var _svg = __w_pdfjs_require__(22);
var _xfa_layer = __w_pdfjs_require__(20);
const pdfjsVersion = '2.13.93';
const pdfjsBuild = '6b9cc24d4';
const pdfjsVersion = '2.13.133';
const pdfjsBuild = 'f8b2a99dd';
;
})();

Просмотреть файл

@ -4937,8 +4937,8 @@ Object.defineProperty(exports, "initSandbox", ({
var _initialization = __w_pdfjs_require__(1);
const pdfjsVersion = '2.13.93';
const pdfjsBuild = '6b9cc24d4';
const pdfjsVersion = '2.13.133';
const pdfjsBuild = 'f8b2a99dd';
})();
/******/ return __webpack_exports__;

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1260,7 +1260,7 @@ html[dir="rtl"] #outerContainer.sidebarOpen #loadingBar {
.findbar.wrapContainers > div {
clear: both;
}
.findbar.wrapContainers > div#findbarMessageContainer {
.findbar.wrapContainers > div.findbarMessageContainer {
height: auto;
}
html[dir="ltr"] .findbar {
@ -1317,7 +1317,7 @@ html[dir="rtl"] .findbar .splitToolbarButton > .findNext {
}
.findbar label:hover,
.findbar input:focus + label {
.findbar input:focus-visible + label {
color: var(--toggled-btn-color);
background-color: var(--button-hover-color);
}
@ -1445,6 +1445,8 @@ html[dir="ltr"] .doorHangerRight:before {
#findMsg {
color: rgba(251, 0, 0, 1);
}
#findResultsCount:empty,
#findMsg:empty {
display: none;
}
@ -1507,12 +1509,12 @@ html[dir="rtl"] .splitToolbarButton > .toolbarButton {
}
.overlayButton:hover,
.overlayButton:focus {
.overlayButton:focus-visible {
background-color: var(--overlay-button-hover-bg-color);
}
.overlayButton:hover > span,
.overlayButton:focus > span {
.overlayButton:focus-visible > span {
color: var(--overlay-button-hover-color);
}
@ -1534,10 +1536,10 @@ html[dir="rtl"] .splitToolbarButton > .toolbarButton {
}
.splitToolbarButton > .toolbarButton:hover,
.splitToolbarButton > .toolbarButton:focus,
.splitToolbarButton > .toolbarButton:focus-visible,
.dropdownToolbarButton:hover,
.toolbarButton.textButton:hover,
.toolbarButton.textButton:focus {
.toolbarButton.textButton:focus-visible {
background-color: var(--button-hover-color);
z-index: 199;
}
@ -1601,11 +1603,11 @@ html[dir="rtl"] #toolbarViewerLeft > .toolbarButton:first-child {
margin-right: 2px;
}
.toolbarButton:hover,
.toolbarButton:focus {
.toolbarButton:focus-visible {
background-color: var(--button-hover-color);
}
.secondaryToolbarButton:hover,
.secondaryToolbarButton:focus {
.secondaryToolbarButton:focus-visible {
background-color: var(--doorhanger-hover-bg-color);
color: var(--doorhanger-hover-color);
}
@ -1670,7 +1672,7 @@ html[dir="rtl"] .dropdownToolbarButton > select {
padding-right: 4px;
}
.dropdownToolbarButton > select:hover,
.dropdownToolbarButton > select:focus {
.dropdownToolbarButton > select:focus-visible {
background-color: var(--button-hover-color);
color: var(--toggled-btn-color);
}
@ -1711,7 +1713,7 @@ html[dir="rtl"] .dropdownToolbarButton > select {
}
.dropdownToolbarButton:hover::after,
.dropdownToolbarButton:focus::after,
.dropdownToolbarButton:focus-visible::after,
.dropdownToolbarButton:active::after {
background-color: var(--toolbar-icon-hover-bg-color);
}
@ -1723,9 +1725,9 @@ html[dir="rtl"] .dropdownToolbarButton > select {
}
.toolbarButton:hover::before,
.toolbarButton:focus::before,
.toolbarButton:focus-visible::before,
.secondaryToolbarButton:hover::before,
.secondaryToolbarButton:focus::before {
.secondaryToolbarButton:focus-visible::before {
background-color: var(--toolbar-icon-hover-bg-color);
}

Просмотреть файл

@ -101,17 +101,21 @@ See https://github.com/adobe-type-tools/cmap-resources
<div id="findbarOptionsOneContainer">
<input type="checkbox" id="findHighlightAll" class="toolbarField" tabindex="94">
<label for="findHighlightAll" class="toolbarLabel" data-l10n-id="find_highlight">Highlight all</label>
<label for="findHighlightAll" class="toolbarLabel" data-l10n-id="find_highlight">Highlight All</label>
<input type="checkbox" id="findMatchCase" class="toolbarField" tabindex="95">
<label for="findMatchCase" class="toolbarLabel" data-l10n-id="find_match_case_label">Match case</label>
<label for="findMatchCase" class="toolbarLabel" data-l10n-id="find_match_case_label">Match Case</label>
</div>
<div id="findbarOptionsTwoContainer">
<input type="checkbox" id="findEntireWord" class="toolbarField" tabindex="96">
<label for="findEntireWord" class="toolbarLabel" data-l10n-id="find_entire_word_label">Whole words</label>
<span id="findResultsCount" class="toolbarLabel hidden"></span>
<input type="checkbox" id="findMatchDiacritics" class="toolbarField" tabindex="96">
<label for="findMatchDiacritics" class="toolbarLabel" data-l10n-id="find_match_diacritics_label">Match Diacritics</label>
<input type="checkbox" id="findEntireWord" class="toolbarField" tabindex="97">
<label for="findEntireWord" class="toolbarLabel" data-l10n-id="find_entire_word_label">Whole Words</label>
</div>
<div id="findbarMessageContainer">
<div class="findbarMessageContainer">
<span id="findResultsCount" class="toolbarLabel"></span>
</div>
<div class="findbarMessageContainer">
<span id="findMsg" class="toolbarLabel"></span>
</div>
</div> <!-- findbar -->

Просмотреть файл

@ -2448,7 +2448,8 @@ function webViewerFindFromUrlHash(evt) {
caseSensitive: false,
entireWord: false,
highlightAll: true,
findPrevious: false
findPrevious: false,
matchDiacritics: true
});
}
@ -3105,8 +3106,8 @@ function removeNullCharacters(str, replaceInvisible = false) {
return str.replace(NullCharactersRegExp, "");
}
function binarySearchFirstItem(items, condition) {
let minIndex = 0;
function binarySearchFirstItem(items, condition, start = 0) {
let minIndex = start;
let maxIndex = items.length - 1;
if (maxIndex < 0 || !condition(items[maxIndex])) {
@ -4632,14 +4633,14 @@ class PasswordPrompt {
this._isViewerEmbedded = isViewerEmbedded;
this.updateCallback = null;
this.reason = null;
this.submitButton.addEventListener("click", this.verify.bind(this));
this.cancelButton.addEventListener("click", this.close.bind(this));
this.submitButton.addEventListener("click", this.#verify.bind(this));
this.cancelButton.addEventListener("click", this.#cancel.bind(this));
this.input.addEventListener("keydown", e => {
if (e.keyCode === 13) {
this.verify();
this.#verify();
}
});
this.overlayManager.register(this.overlayName, this.container, this.close.bind(this), true);
this.overlayManager.register(this.overlayName, this.container, this.#cancel.bind(this), true);
}
async open() {
@ -4659,7 +4660,7 @@ class PasswordPrompt {
});
}
verify() {
#verify() {
const password = this.input.value;
if (password?.length > 0) {
@ -4668,6 +4669,11 @@ class PasswordPrompt {
}
}
#cancel() {
this.close();
this.updateCallback(new Error("PasswordPrompt cancelled."));
}
setUpdateCallback(updateCallback, reason) {
this.updateCallback = updateCallback;
this.reason = reason;
@ -5261,6 +5267,7 @@ class PDFFindBar {
this.findField = options.findField;
this.highlightAll = options.highlightAllCheckbox;
this.caseSensitive = options.caseSensitiveCheckbox;
this.matchDiacritics = options.matchDiacriticsCheckbox;
this.entireWord = options.entireWordCheckbox;
this.findMsg = options.findMsg;
this.findResultsCount = options.findResultsCount;
@ -5303,6 +5310,9 @@ class PDFFindBar {
this.entireWord.addEventListener("click", () => {
this.dispatchEvent("entirewordchange");
});
this.matchDiacritics.addEventListener("click", () => {
this.dispatchEvent("diacriticmatchingchange");
});
this.eventBus._on("resize", this._adjustWidth.bind(this));
}
@ -5320,7 +5330,8 @@ class PDFFindBar {
caseSensitive: this.caseSensitive.checked,
entireWord: this.entireWord.checked,
highlightAll: this.highlightAll.checked,
findPrevious: findPrev
findPrevious: findPrev,
matchDiacritics: this.matchDiacritics.checked
});
}
@ -5381,7 +5392,6 @@ class PDFFindBar {
matchCountMsg.then(msg => {
this.findResultsCount.textContent = msg;
this.findResultsCount.classList.toggle("hidden", !total);
this._adjustWidth();
});
@ -5452,12 +5462,12 @@ Object.defineProperty(exports, "__esModule", ({
}));
exports.PDFFindController = exports.FindState = void 0;
var _ui_utils = __webpack_require__(3);
var _pdfjsLib = __webpack_require__(5);
var _pdf_find_utils = __webpack_require__(16);
var _ui_utils = __webpack_require__(3);
const FindState = {
FOUND: 0,
NOT_FOUND: 1,
@ -5482,51 +5492,105 @@ const CHARACTERS_TO_NORMALIZE = {
"\u00BD": "1/2",
"\u00BE": "3/4"
};
const DIACRITICS_EXCEPTION = new Set([0x3099, 0x309a, 0x094d, 0x09cd, 0x0a4d, 0x0acd, 0x0b4d, 0x0bcd, 0x0c4d, 0x0ccd, 0x0d3b, 0x0d3c, 0x0d4d, 0x0dca, 0x0e3a, 0x0eba, 0x0f84, 0x1039, 0x103a, 0x1714, 0x1734, 0x17d2, 0x1a60, 0x1b44, 0x1baa, 0x1bab, 0x1bf2, 0x1bf3, 0x2d7f, 0xa806, 0xa82c, 0xa8c4, 0xa953, 0xa9c0, 0xaaf6, 0xabed, 0x0c56, 0x0f71, 0x0f72, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f80, 0x0f74]);
const DIACRITICS_EXCEPTION_STR = [...DIACRITICS_EXCEPTION.values()].map(x => String.fromCharCode(x)).join("");
const DIACRITICS_REG_EXP = /\p{M}+/gu;
const SPECIAL_CHARS_REG_EXP = /([.*+?^${}()|[\]\\])|(\p{P})|(\s+)|(\p{M})|(\p{L})/gu;
const NOT_DIACRITIC_FROM_END_REG_EXP = /([^\p{M}])\p{M}*$/u;
const NOT_DIACRITIC_FROM_START_REG_EXP = /^\p{M}*([^\p{M}])/u;
let normalizationRegex = null;
function normalize(text) {
if (!normalizationRegex) {
const replace = Object.keys(CHARACTERS_TO_NORMALIZE).join("");
normalizationRegex = new RegExp(`[${replace}]`, "g");
normalizationRegex = new RegExp(`([${replace}])|(\\S-\\n)|(\\n)|(\\p{M}+)`, "gum");
}
let diffs = null;
const normalizedText = text.replace(normalizationRegex, function (ch, index) {
const normalizedCh = CHARACTERS_TO_NORMALIZE[ch],
diff = normalizedCh.length - ch.length;
const rawDiacriticsPositions = [];
let m;
if (diff !== 0) {
(diffs ||= []).push([index, diff]);
while ((m = DIACRITICS_REG_EXP.exec(text)) !== null) {
rawDiacriticsPositions.push([m[0].length, m.index]);
}
let normalized = text.normalize("NFD");
const positions = [[0, 0]];
let k = 0;
let shift = 0;
let shiftOrigin = 0;
let eol = 0;
let hasDiacritics = false;
normalized = normalized.replace(normalizationRegex, (match, p1, p2, p3, p4, i) => {
i -= shiftOrigin;
if (p1) {
const replacement = CHARACTERS_TO_NORMALIZE[match];
const jj = replacement.length;
for (let j = 1; j < jj; j++) {
positions.push([i - shift + j, shift - j]);
}
shift -= jj - 1;
return replacement;
}
return normalizedCh;
if (p2) {
positions.push([i - shift, 1 + shift]);
shift += 1;
shiftOrigin += 1;
eol += 1;
return p2.charAt(0);
}
if (p3) {
positions.push([i - shift + 1, shift - 1]);
shift -= 1;
shiftOrigin += 1;
eol += 1;
return " ";
}
hasDiacritics = true;
let jj = p4.length;
if (i + eol === rawDiacriticsPositions[k]?.[1]) {
jj -= rawDiacriticsPositions[k][0];
++k;
}
for (let j = 1; j < jj + 1; j++) {
positions.push([i - 1 - shift + j, shift - j]);
}
shift -= jj;
shiftOrigin += jj;
return p4;
});
return [normalizedText, diffs];
positions.push([normalized.length, shift]);
return [normalized, positions, hasDiacritics];
}
function getOriginalIndex(matchIndex, diffs = null) {
function getOriginalIndex(diffs, pos, len) {
if (!diffs) {
return matchIndex;
return [pos, len];
}
let totalDiff = 0;
const start = pos;
const end = pos + len;
let i = (0, _ui_utils.binarySearchFirstItem)(diffs, x => x[0] >= start);
for (const [index, diff] of diffs) {
const currentIndex = index + totalDiff;
if (currentIndex >= matchIndex) {
break;
}
if (currentIndex + diff > matchIndex) {
totalDiff += matchIndex - currentIndex;
break;
}
totalDiff += diff;
if (diffs[i][0] > start) {
--i;
}
return matchIndex - totalDiff;
let j = (0, _ui_utils.binarySearchFirstItem)(diffs, x => x[0] >= end, i);
if (diffs[j][0] > end) {
--j;
}
return [start + diffs[i][1], len + diffs[j][1] - diffs[i][1]];
}
class PDFFindController {
@ -5682,6 +5746,7 @@ class PDFFindController {
this._extractTextPromises = [];
this._pageContents = [];
this._pageDiffs = [];
this._hasDiacritics = [];
this._matchesCountTotal = 0;
this._pagesToSearch = null;
this._pendingFindMatches = new Set();
@ -5724,65 +5789,23 @@ class PDFFindController {
return true;
}
_prepareMatches(matchesWithLength, matches, matchesLength) {
function isSubTerm(currentIndex) {
const currentElem = matchesWithLength[currentIndex];
const nextElem = matchesWithLength[currentIndex + 1];
if (currentIndex < matchesWithLength.length - 1 && currentElem.match === nextElem.match) {
currentElem.skipped = true;
return true;
}
for (let i = currentIndex - 1; i >= 0; i--) {
const prevElem = matchesWithLength[i];
if (prevElem.skipped) {
continue;
}
if (prevElem.match + prevElem.matchLength < currentElem.match) {
break;
}
if (prevElem.match + prevElem.matchLength >= currentElem.match + currentElem.matchLength) {
currentElem.skipped = true;
return true;
}
}
return false;
}
matchesWithLength.sort(function (a, b) {
return a.match === b.match ? a.matchLength - b.matchLength : a.match - b.match;
});
for (let i = 0, len = matchesWithLength.length; i < len; i++) {
if (isSubTerm(i)) {
continue;
}
matches.push(matchesWithLength[i].match);
matchesLength.push(matchesWithLength[i].matchLength);
}
}
_isEntireWord(content, startIdx, length) {
if (startIdx > 0) {
let match = content.slice(0, startIdx).match(NOT_DIACRITIC_FROM_END_REG_EXP);
if (match) {
const first = content.charCodeAt(startIdx);
const limit = content.charCodeAt(startIdx - 1);
const limit = match[1].charCodeAt(0);
if ((0, _pdf_find_utils.getCharacterType)(first) === (0, _pdf_find_utils.getCharacterType)(limit)) {
return false;
}
}
const endIdx = startIdx + length - 1;
match = content.slice(startIdx + length).match(NOT_DIACRITIC_FROM_START_REG_EXP);
if (endIdx < content.length - 1) {
const last = content.charCodeAt(endIdx);
const limit = content.charCodeAt(endIdx + 1);
if (match) {
const last = content.charCodeAt(startIdx + length - 1);
const limit = match[1].charCodeAt(0);
if ((0, _pdf_find_utils.getCharacterType)(last) === (0, _pdf_find_utils.getCharacterType)(limit)) {
return false;
@ -5792,96 +5815,114 @@ class PDFFindController {
return true;
}
_calculatePhraseMatch(query, pageIndex, pageContent, pageDiffs, entireWord) {
_calculateRegExpMatch(query, entireWord, pageIndex, pageContent) {
const matches = [],
matchesLength = [];
const queryLen = query.length;
let matchIdx = -queryLen;
const diffs = this._pageDiffs[pageIndex];
let match;
while (true) {
matchIdx = pageContent.indexOf(query, matchIdx + queryLen);
if (matchIdx === -1) {
break;
}
if (entireWord && !this._isEntireWord(pageContent, matchIdx, queryLen)) {
while ((match = query.exec(pageContent)) !== null) {
if (entireWord && !this._isEntireWord(pageContent, match.index, match[0].length)) {
continue;
}
const originalMatchIdx = getOriginalIndex(matchIdx, pageDiffs),
matchEnd = matchIdx + queryLen - 1,
originalQueryLen = getOriginalIndex(matchEnd, pageDiffs) - originalMatchIdx + 1;
matches.push(originalMatchIdx);
matchesLength.push(originalQueryLen);
const [matchPos, matchLen] = getOriginalIndex(diffs, match.index, match[0].length);
if (matchLen) {
matches.push(matchPos);
matchesLength.push(matchLen);
}
}
this._pageMatches[pageIndex] = matches;
this._pageMatchesLength[pageIndex] = matchesLength;
}
_calculateWordMatch(query, pageIndex, pageContent, pageDiffs, entireWord) {
const matchesWithLength = [];
const queryArray = query.match(/\S+/g);
_convertToRegExpString(query, hasDiacritics) {
const {
matchDiacritics
} = this._state;
let isUnicode = false;
query = query.replace(SPECIAL_CHARS_REG_EXP, (match, p1, p2, p3, p4, p5) => {
if (p1) {
return `[ ]*\\${p1}[ ]*`;
}
for (let i = 0, len = queryArray.length; i < len; i++) {
const subquery = queryArray[i];
const subqueryLen = subquery.length;
let matchIdx = -subqueryLen;
if (p2) {
return `[ ]*${p2}[ ]*`;
}
while (true) {
matchIdx = pageContent.indexOf(subquery, matchIdx + subqueryLen);
if (p3) {
return "[ ]+";
}
if (matchIdx === -1) {
break;
}
if (matchDiacritics) {
return p4 || p5;
}
if (entireWord && !this._isEntireWord(pageContent, matchIdx, subqueryLen)) {
continue;
}
if (p4) {
return DIACRITICS_EXCEPTION.has(p4.charCodeAt(0)) ? p4 : "";
}
const originalMatchIdx = getOriginalIndex(matchIdx, pageDiffs),
matchEnd = matchIdx + subqueryLen - 1,
originalQueryLen = getOriginalIndex(matchEnd, pageDiffs) - originalMatchIdx + 1;
matchesWithLength.push({
match: originalMatchIdx,
matchLength: originalQueryLen,
skipped: false
});
if (hasDiacritics) {
isUnicode = true;
return `${p5}\\p{M}*`;
}
return p5;
});
const trailingSpaces = "[ ]*";
if (query.endsWith(trailingSpaces)) {
query = query.slice(0, query.length - trailingSpaces.length);
}
if (matchDiacritics) {
if (hasDiacritics) {
isUnicode = true;
query = `${query}(?=[${DIACRITICS_EXCEPTION_STR}]|[^\\p{M}]|$)`;
}
}
this._pageMatchesLength[pageIndex] = [];
this._pageMatches[pageIndex] = [];
this._prepareMatches(matchesWithLength, this._pageMatches[pageIndex], this._pageMatchesLength[pageIndex]);
return [isUnicode, query];
}
_calculateMatch(pageIndex) {
let pageContent = this._pageContents[pageIndex];
const pageDiffs = this._pageDiffs[pageIndex];
let query = this._query;
const {
caseSensitive,
entireWord,
phraseSearch
} = this._state;
if (query.length === 0) {
return;
}
if (!caseSensitive) {
pageContent = pageContent.toLowerCase();
query = query.toLowerCase();
}
const {
caseSensitive,
entireWord,
phraseSearch
} = this._state;
const pageContent = this._pageContents[pageIndex];
const hasDiacritics = this._hasDiacritics[pageIndex];
let isUnicode = false;
if (phraseSearch) {
this._calculatePhraseMatch(query, pageIndex, pageContent, pageDiffs, entireWord);
[isUnicode, query] = this._convertToRegExpString(query, hasDiacritics);
} else {
this._calculateWordMatch(query, pageIndex, pageContent, pageDiffs, entireWord);
const match = query.match(/\S+/g);
if (match) {
query = match.sort().reverse().map(q => {
const [isUnicodePart, queryPart] = this._convertToRegExpString(q, hasDiacritics);
isUnicode ||= isUnicodePart;
return `(${queryPart})`;
}).join("|");
}
}
const flags = `g${isUnicode ? "u" : ""}${caseSensitive ? "" : "i"}`;
query = new RegExp(query, flags);
this._calculateRegExpMatch(query, entireWord, pageIndex, pageContent);
if (this._state.highlightAll) {
this._updatePage(pageIndex);
}
@ -5913,23 +5954,26 @@ class PDFFindController {
this._extractTextPromises[i] = extractTextCapability.promise;
promise = promise.then(() => {
return this._pdfDocument.getPage(i + 1).then(pdfPage => {
return pdfPage.getTextContent({
normalizeWhitespace: true
});
return pdfPage.getTextContent();
}).then(textContent => {
const textItems = textContent.items;
const strBuf = [];
for (let j = 0, jj = textItems.length; j < jj; j++) {
strBuf.push(textItems[j].str);
if (textItems[j].hasEOL) {
strBuf.push("\n");
}
}
[this._pageContents[i], this._pageDiffs[i]] = normalize(strBuf.join(""));
[this._pageContents[i], this._pageDiffs[i], this._hasDiacritics[i]] = normalize(strBuf.join(""));
extractTextCapability.resolve(i);
}, reason => {
console.error(`Unable to get text content for page ${i + 1}`, reason);
this._pageContents[i] = "";
this._pageDiffs[i] = null;
this._hasDiacritics[i] = false;
extractTextCapability.resolve(i);
});
});
@ -9745,7 +9789,7 @@ class BaseViewer {
throw new Error("Cannot initialize BaseViewer.");
}
const viewerVersion = '2.13.93';
const viewerVersion = '2.13.133';
if (_pdfjsLib.version !== viewerVersion) {
throw new Error(`The API version "${_pdfjsLib.version}" does not match the Viewer version "${viewerVersion}".`);
@ -12184,7 +12228,6 @@ class PDFPageView {
return finishPaintTask(null).then(() => {
if (textLayer) {
const readableStream = pdfPage.streamTextContent({
normalizeWhitespace: true,
includeMarkedContent: true
});
textLayer.setTextContentStream(readableStream);
@ -13878,7 +13921,7 @@ class MozL10n {
}
(function listenFindEvents() {
const events = ["find", "findagain", "findhighlightallchange", "findcasesensitivitychange", "findentirewordchange", "findbarclose"];
const events = ["find", "findagain", "findhighlightallchange", "findcasesensitivitychange", "findentirewordchange", "findbarclose", "finddiacriticmatchingchange"];
const findLen = "find".length;
const handleEvent = function ({
@ -13905,7 +13948,8 @@ class MozL10n {
caseSensitive: !!detail.caseSensitive,
entireWord: !!detail.entireWord,
highlightAll: !!detail.highlightAll,
findPrevious: !!detail.findPrevious
findPrevious: !!detail.findPrevious,
matchDiacritics: !!detail.matchDiacritics
});
};
@ -14593,8 +14637,8 @@ var _app_options = __webpack_require__(1);
var _app = __webpack_require__(2);
const pdfjsVersion = '2.13.93';
const pdfjsBuild = '6b9cc24d4';
const pdfjsVersion = '2.13.133';
const pdfjsBuild = 'f8b2a99dd';
window.PDFViewerApplication = _app.PDFViewerApplication;
window.PDFViewerApplicationOptions = _app_options.AppOptions;
;
@ -14679,6 +14723,7 @@ function getViewerConfiguration() {
findField: document.getElementById("findInput"),
highlightAllCheckbox: document.getElementById("findHighlightAll"),
caseSensitiveCheckbox: document.getElementById("findMatchCase"),
matchDiacriticsCheckbox: document.getElementById("findMatchDiacritics"),
entireWordCheckbox: document.getElementById("findEntireWord"),
findMsg: document.getElementById("findMsg"),
findResultsCount: document.getElementById("findResultsCount"),

Просмотреть файл

@ -20,7 +20,7 @@ origin:
# Human-readable identifier for this version/release
# Generally "version NNN", "tag SSS", "bookmark SSS"
release: version 2.13.93
release: version 2.13.133
# The package's license, where possible using the mnemonic from
# https://spdx.org/licenses/