Merge pull request #414 from ueokande/pattern-not-found-null
Show error if not previous keywords
This commit is contained in:
commit
cf7d482446
1 changed files with 13 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
import * as findActions from 'content/actions/find';
|
import * as findActions from 'content/actions/find';
|
||||||
import messages from 'shared/messages';
|
import messages from 'shared/messages';
|
||||||
|
import * as consoleFrames from '../../console-frames';
|
||||||
|
|
||||||
export default class FindComponent {
|
export default class FindComponent {
|
||||||
constructor(win, store) {
|
constructor(win, store) {
|
||||||
|
@ -31,11 +32,23 @@ export default class FindComponent {
|
||||||
|
|
||||||
next() {
|
next() {
|
||||||
let state = this.store.getState().find;
|
let state = this.store.getState().find;
|
||||||
|
if (!state.keyword) {
|
||||||
|
return this.postNoPrevious();
|
||||||
|
}
|
||||||
return this.store.dispatch(findActions.next(state.keyword, false));
|
return this.store.dispatch(findActions.next(state.keyword, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
prev() {
|
prev() {
|
||||||
let state = this.store.getState().find;
|
let state = this.store.getState().find;
|
||||||
|
if (!state.keyword) {
|
||||||
|
return this.postNoPrevious();
|
||||||
|
}
|
||||||
return this.store.dispatch(findActions.prev(state.keyword, false));
|
return this.store.dispatch(findActions.prev(state.keyword, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
postNoPrevious() {
|
||||||
|
return consoleFrames.postError(
|
||||||
|
window.document,
|
||||||
|
'No previous search keypards');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue