mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 10:15:37 +02:00
Add a helper method, in PDFFindController
, to determine if matches need to be re-calculated when a new search operation occurs
This commit is contained in:
parent
af99d1dc08
commit
d7941b4ce7
1 changed files with 9 additions and 1 deletions
|
@ -113,7 +113,7 @@ class PDFFindController {
|
|||
executeCommand(cmd, state) {
|
||||
const pdfDocument = this._pdfDocument;
|
||||
|
||||
if (this._state === null || cmd !== 'findagain') {
|
||||
if (this._state === null || this._shouldDirtyMatch(cmd)) {
|
||||
this._dirtyMatch = true;
|
||||
}
|
||||
this._state = state;
|
||||
|
@ -198,6 +198,14 @@ class PDFFindController {
|
|||
return this._normalizedQuery;
|
||||
}
|
||||
|
||||
_shouldDirtyMatch(cmd) {
|
||||
switch (cmd) {
|
||||
case 'findagain':
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for multi-term search that fills the `matchesWithLength` array
|
||||
* and handles cases where one search term includes another search term (for
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue