diff options
Diffstat (limited to 'src/content/presenters')
-rw-r--r-- | src/content/presenters/FindPresenter.ts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/content/presenters/FindPresenter.ts b/src/content/presenters/FindPresenter.ts new file mode 100644 index 0000000..569f161 --- /dev/null +++ b/src/content/presenters/FindPresenter.ts @@ -0,0 +1,23 @@ +export default interface FindPresenter { + find(keyword: string, backwards: boolean): boolean; + + clearSelection(): void; +} + +export class FindPresenterImpl implements FindPresenter { + find(keyword: string, backwards: boolean): boolean { + const caseSensitive = false; + const wrapScan = false; + + // NOTE: aWholeWord dows not implemented, and aSearchInFrames does not work + // because of same origin policy + return window.find(keyword, caseSensitive, backwards, wrapScan); + } + + clearSelection(): void { + const sel = window.getSelection(); + if (sel) { + sel.removeAllRanges(); + } + } +} |