aboutsummaryrefslogtreecommitdiff
path: root/src/content
diff options
context:
space:
mode:
Diffstat (limited to 'src/content')
-rw-r--r--src/content/reducers/setting.ts13
-rw-r--r--src/content/urls.ts5
2 files changed, 10 insertions, 8 deletions
diff --git a/src/content/reducers/setting.ts b/src/content/reducers/setting.ts
index a3dc3aa..9ca1380 100644
--- a/src/content/reducers/setting.ts
+++ b/src/content/reducers/setting.ts
@@ -1,20 +1,20 @@
import * as actions from '../actions';
import * as keyUtils from '../../shared/utils/keys';
import * as operations from '../../shared/operations';
-import { Properties } from '../../shared/Settings';
+import { Search, Properties, DefaultSetting } from '../../shared/Settings';
export interface State {
keymaps: { key: keyUtils.Key[], op: operations.Operation }[];
+ search: Search;
properties: Properties;
}
+// defaultState does not refer due to the state is load from
+// background on load.
const defaultState: State = {
keymaps: [],
- properties: {
- complete: '',
- smoothscroll: false,
- hintchars: '',
- },
+ search: DefaultSetting.search,
+ properties: DefaultSetting.properties,
};
export default function reducer(
@@ -31,6 +31,7 @@ export default function reducer(
};
}),
properties: action.settings.properties,
+ search: action.settings.search,
};
default:
return state;
diff --git a/src/content/urls.ts b/src/content/urls.ts
index 390efde..035b9bb 100644
--- a/src/content/urls.ts
+++ b/src/content/urls.ts
@@ -1,5 +1,6 @@
import * as messages from '../shared/messages';
import * as urls from '../shared/urls';
+import { Search } from '../shared/Settings';
const yank = (win: Window) => {
let input = win.document.createElement('input');
@@ -15,7 +16,7 @@ const yank = (win: Window) => {
input.remove();
};
-const paste = (win: Window, newTab: boolean, searchSettings: any) => {
+const paste = (win: Window, newTab: boolean, search: Search) => {
let textarea = win.document.createElement('textarea');
win.document.body.append(textarea);
@@ -26,7 +27,7 @@ const paste = (win: Window, newTab: boolean, searchSettings: any) => {
if (win.document.execCommand('paste')) {
let value = textarea.textContent as string;
- let url = urls.searchUrl(value, searchSettings);
+ let url = urls.searchUrl(value, search);
browser.runtime.sendMessage({
type: messages.OPEN_URL,
url,