first find implementation

This commit is contained in:
Shin'ya Ueoka 2017-11-09 21:05:02 +09:00
parent 956dd937d3
commit e021504356
8 changed files with 74 additions and 25 deletions

View file

@ -1,6 +1,6 @@
//
// window.find(aString, aCaseSensitive, aBackwards, aWrapAround,
// aWholeWord, aSearchInFrames, aShowDialog);
// aWholeWord, aSearchInFrames);
//
// NOTE: window.find is not standard API
// https://developer.mozilla.org/en-US/docs/Web/API/Window/find
@ -17,7 +17,7 @@ const hide = () => {
const next = (keyword) => {
// TODO Error on no matched
window.find(keyword, false, false, true, false, true, false);
window.find(keyword, false, false, true, false, true);
return {
type: actions.FIND_SET_KEYWORD,
keyword,
@ -26,7 +26,7 @@ const next = (keyword) => {
const prev = (keyword) => {
// TODO Error on no matched
window.find(keyword, false, true, true, false, true, false);
window.find(keyword, false, true, true, false, true);
return {
type: actions.FIND_SET_KEYWORD,
keyword,

View file

@ -6,6 +6,7 @@ import * as urls from 'content/urls';
import * as consoleFrames from 'content/console-frames';
import * as addonActions from './addon';
// eslint-disable-next-line complexity
const exec = (operation) => {
switch (operation.type) {
case operations.ADDON_ENABLE:
@ -14,6 +15,14 @@ const exec = (operation) => {
return addonActions.disable();
case operations.ADDON_TOGGLE_ENABLED:
return addonActions.toggleEnabled();
case operations.FIND_NEXT:
return window.top.postMessage(JSON.stringify({
type: messages.FIND_NEXT,
}), '*');
case operations.FIND_PREV:
return window.top.postMessage(JSON.stringify({
type: messages.FIND_PREV,
}), '*');
case operations.SCROLL_VERTICALLY:
return scrolls.scrollVertically(window, operation.count);
case operations.SCROLL_HORIZONALLY: