Remove the deprecated PDFFindController.executeCommand method

This *partially* reverts commit fa8c0ef6164c7abfd5236e97823102a89517f8a4, since it's now been included in two official releases.
This commit is contained in:
Jonas Jenwald 2022-03-02 11:21:47 +01:00
parent f2c9a6bc24
commit 38d30f3be5
3 changed files with 6 additions and 31 deletions

View File

@ -77,11 +77,7 @@ eventBus.on("pagesinit", function () {
// We can try searching for things. // We can try searching for things.
if (SEARCH_FOR) { if (SEARCH_FOR) {
if (!pdfFindController._onFind) { eventBus.dispatch("find", { type: "", query: SEARCH_FOR });
pdfFindController.executeCommand("find", { query: SEARCH_FOR });
} else {
eventBus.dispatch("find", { type: "", query: SEARCH_FOR });
}
} }
}); });

View File

@ -77,11 +77,7 @@ eventBus.on("pagesinit", function () {
// We can try searching for things. // We can try searching for things.
if (SEARCH_FOR) { if (SEARCH_FOR) {
if (!pdfFindController._onFind) { eventBus.dispatch("find", { type: "", query: SEARCH_FOR });
pdfFindController.executeCommand("find", { query: SEARCH_FOR });
} else {
eventBus.dispatch("find", { type: "", query: SEARCH_FOR });
}
} }
}); });

View File

@ -261,22 +261,8 @@ class PDFFindController {
this._eventBus = eventBus; this._eventBus = eventBus;
this._reset(); this._reset();
eventBus._on("find", this._onFind.bind(this)); eventBus._on("find", this.#onFind.bind(this));
eventBus._on("findbarclose", this._onFindBarClose.bind(this)); eventBus._on("findbarclose", this.#onFindBarClose.bind(this));
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
this.executeCommand = (cmd, state) => {
console.error(
"Deprecated method `PDFFindController.executeCommand` called, " +
'please dispatch a "find"-event using the EventBus instead.'
);
const eventState = Object.assign(Object.create(null), state, {
type: cmd.substring("find".length),
});
this._onFind(eventState);
};
}
} }
get highlightMatches() { get highlightMatches() {
@ -316,10 +302,7 @@ class PDFFindController {
this._firstPageCapability.resolve(); this._firstPageCapability.resolve();
} }
/** #onFind(state) {
* @private
*/
_onFind(state) {
if (!state) { if (!state) {
return; return;
} }
@ -895,7 +878,7 @@ class PDFFindController {
} }
} }
_onFindBarClose(evt) { #onFindBarClose(evt) {
const pdfDocument = this._pdfDocument; const pdfDocument = this._pdfDocument;
// Since searching is asynchronous, ensure that the removal of highlighted // Since searching is asynchronous, ensure that the removal of highlighted
// matches (from the UI) is async too such that the 'updatetextlayermatches' // matches (from the UI) is async too such that the 'updatetextlayermatches'