Fix no previous search keywords

This commit is contained in:
Shin'ya Ueoka 2018-06-17 11:35:18 +09:00
parent 0496d7e269
commit 45a65b38db
2 changed files with 9 additions and 13 deletions

View file

@ -22,6 +22,12 @@ const postPatternFound = (pattern) => {
);
};
const postNoPrevious = () => {
return consoleFrames.postError(
window.document,
'No previous search keywords');
};
const find = (string, backwards) => {
let caseSensitive = false;
let wrapScan = true;
@ -50,6 +56,9 @@ const findNext = (currentKeyword, reset, backwards) => {
}
return promise.then((keyword) => {
if (!keyword) {
return postNoPrevious();
}
let found = find(keyword, backwards);
if (!found) {
window.getSelection().removeAllRanges();