diff options
Diffstat (limited to 'src/content/components/top-content')
| -rw-r--r-- | src/content/components/top-content/find.js | 13 | ||||
| -rw-r--r-- | src/content/components/top-content/follow-controller.js | 20 | 
2 files changed, 14 insertions, 19 deletions
diff --git a/src/content/components/top-content/find.js b/src/content/components/top-content/find.js index bccf040..4d46d79 100644 --- a/src/content/components/top-content/find.js +++ b/src/content/components/top-content/find.js @@ -1,6 +1,5 @@  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) { @@ -32,23 +31,11 @@ export default class FindComponent {    next() {      let state = this.store.getState().find; - -    if (!state.found) { -      return consoleFrames.postError( -        window.document, -        'Pattern not found: ' + state.keyword); -    }      return this.store.dispatch(findActions.next(state.keyword, false));    }    prev() {      let state = this.store.getState().find; - -    if (!state.found) { -      return consoleFrames.postError( -        window.document, -        'Pattern not found: ' + state.keyword); -    }      return this.store.dispatch(findActions.prev(state.keyword, false));    }  } diff --git a/src/content/components/top-content/follow-controller.js b/src/content/components/top-content/follow-controller.js index f759c8c..7f36604 100644 --- a/src/content/components/top-content/follow-controller.js +++ b/src/content/components/top-content/follow-controller.js @@ -1,8 +1,7 @@  import * as followControllerActions from 'content/actions/follow-controller';  import messages from 'shared/messages';  import HintKeyProducer from 'content/hint-key-producer'; - -const DEFAULT_HINT_CHARSET = 'abcdefghijklmnopqrstuvwxyz'; +import * as properties from 'shared/settings/properties';  const broadcastMessage = (win, message) => {    let json = JSON.stringify(message); @@ -33,7 +32,7 @@ export default class FollowController {      case messages.FOLLOW_RESPONSE_COUNT_TARGETS:        return this.create(message.count, sender);      case messages.FOLLOW_KEY_PRESS: -      return this.keyPress(message.key); +      return this.keyPress(message.key, message.ctrlKey);      }    } @@ -70,7 +69,11 @@ export default class FollowController {      });    } -  keyPress(key) { +  keyPress(key, ctrlKey) { +    if (key === '[' && ctrlKey) { +      this.store.dispatch(followControllerActions.disable()); +      return true; +    }      switch (key) {      case 'Enter':        this.activate(); @@ -84,7 +87,7 @@ export default class FollowController {        this.store.dispatch(followControllerActions.backspace());        break;      default: -      if (DEFAULT_HINT_CHARSET.includes(key)) { +      if (this.hintchars().includes(key)) {          this.store.dispatch(followControllerActions.keyPress(key));        }        break; @@ -93,7 +96,7 @@ export default class FollowController {    }    count() { -    this.producer = new HintKeyProducer(DEFAULT_HINT_CHARSET); +    this.producer = new HintKeyProducer(this.hintchars());      let doc = this.win.document;      let viewWidth = this.win.innerWidth || doc.documentElement.clientWidth;      let viewHeight = this.win.innerHeight || doc.documentElement.clientHeight; @@ -136,4 +139,9 @@ export default class FollowController {        type: messages.FOLLOW_REMOVE_HINTS,      });    } + +  hintchars() { +    return this.store.getState().setting.properties.hintchars || +      properties.defaults.hintchars; +  }  }  | 
