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 | 11 | ||||
-rw-r--r-- | src/content/components/top-content/index.js | 9 |
3 files changed, 17 insertions, 16 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 1e7f3cd..7f36604 100644 --- a/src/content/components/top-content/follow-controller.js +++ b/src/content/components/top-content/follow-controller.js @@ -28,11 +28,11 @@ export default class FollowController { switch (message.type) { case messages.FOLLOW_START: return this.store.dispatch( - followControllerActions.enable(message.newTab)); + followControllerActions.enable(message.newTab, message.background)); 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); } } @@ -69,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(); @@ -125,6 +129,7 @@ export default class FollowController { type: messages.FOLLOW_CREATE_HINTS, keysArray: produced, newTab: this.state.newTab, + background: this.state.background, }), '*'); } diff --git a/src/content/components/top-content/index.js b/src/content/components/top-content/index.js index cf21ec4..a0d0480 100644 --- a/src/content/components/top-content/index.js +++ b/src/content/components/top-content/index.js @@ -44,15 +44,24 @@ export default class TopContent { .some(regex => regex.test(partial)); if (matched) { this.store.dispatch(addonActions.disable()); + } else { + this.store.dispatch(addonActions.enable()); } } onMessage(message) { + let addonState = this.store.getState().addon; + switch (message.type) { case messages.CONSOLE_UNFOCUS: this.win.focus(); consoleFrames.blur(window.document); return Promise.resolve(); + case messages.ADDON_ENABLED_QUERY: + return Promise.resolve({ + type: messages.ADDON_ENABLED_RESPONSE, + enabled: addonState.enabled, + }); } } } |