aboutsummaryrefslogtreecommitdiff
path: root/src/content/components/top-content/find.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-06-17 10:44:41 +0900
committerGitHub <noreply@github.com>2018-06-17 10:44:41 +0900
commitcf7d482446727cd7b8a9a0bf2cd3038cc85fb225 (patch)
tree3b9bebdc219af5d8039099ebfa6d0ae4cc35eabb /src/content/components/top-content/find.js
parent9b27e4cd4f483d84baef370fdfddc696d202fe19 (diff)
parent0496d7e2691d9349294fdf0ef78a31fd23c4bc42 (diff)
Merge pull request #414 from ueokande/pattern-not-found-null
Show error if not previous keywords
Diffstat (limited to 'src/content/components/top-content/find.js')
-rw-r--r--src/content/components/top-content/find.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/content/components/top-content/find.js b/src/content/components/top-content/find.js
index 4d46d79..c765292 100644
--- a/src/content/components/top-content/find.js
+++ b/src/content/components/top-content/find.js
@@ -1,5 +1,6 @@
import * as findActions from 'content/actions/find';
import messages from 'shared/messages';
+import * as consoleFrames from '../../console-frames';
export default class FindComponent {
constructor(win, store) {
@@ -31,11 +32,23 @@ export default class FindComponent {
next() {
let state = this.store.getState().find;
+ if (!state.keyword) {
+ return this.postNoPrevious();
+ }
return this.store.dispatch(findActions.next(state.keyword, false));
}
prev() {
let state = this.store.getState().find;
+ if (!state.keyword) {
+ return this.postNoPrevious();
+ }
return this.store.dispatch(findActions.prev(state.keyword, false));
}
+
+ postNoPrevious() {
+ return consoleFrames.postError(
+ window.document,
+ 'No previous search keypards');
+ }
}