aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-10-08 14:44:21 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-10-08 14:44:21 +0900
commit58123210ab4cdd4a1f2b4720a0abbd88908baa06 (patch)
treeb841120a6347313e34ba4a5ddbfd599e08aa6f16 /src/components
parent541449b1fced9eea15f415b023206b10724f5315 (diff)
separate settings
Diffstat (limited to 'src/components')
-rw-r--r--src/components/background.js2
-rw-r--r--src/components/setting.js45
2 files changed, 1 insertions, 46 deletions
diff --git a/src/components/background.js b/src/components/background.js
index afb90c2..200fedf 100644
--- a/src/components/background.js
+++ b/src/components/background.js
@@ -1,6 +1,6 @@
import messages from 'shared/messages';
import * as operationActions from 'actions/operation';
-import * as settingsActions from 'actions/setting';
+import * as settingsActions from 'settings/actions/setting';
import * as tabActions from 'actions/tab';
import * as commands from 'shared/commands';
diff --git a/src/components/setting.js b/src/components/setting.js
deleted file mode 100644
index c2f99b6..0000000
--- a/src/components/setting.js
+++ /dev/null
@@ -1,45 +0,0 @@
-import * as settingActions from 'actions/setting';
-import { validate } from 'shared/validators/setting';
-
-export default class SettingComponent {
- constructor(wrapper, store) {
- this.wrapper = wrapper;
- this.store = store;
-
- let doc = wrapper.ownerDocument;
- let form = doc.getElementById('vimvixen-settings-form');
- form.addEventListener('submit', this.onSubmit.bind(this));
-
- let plainJson = form.elements['plain-json'];
- plainJson.addEventListener('input', this.onPlainJsonChanged.bind(this));
-
- store.dispatch(settingActions.load());
- }
-
- onSubmit(e) {
- let settings = {
- json: e.target.elements['plain-json'].value,
- };
- this.store.dispatch(settingActions.save(settings));
- e.preventDefault();
- }
-
- onPlainJsonChanged(e) {
- try {
- let settings = JSON.parse(e.target.value);
- validate(settings);
- e.target.setCustomValidity('');
- } catch (err) {
- e.target.setCustomValidity(err.message);
- }
- }
-
- update() {
- let { settings } = this.store.getState();
-
- let doc = this.wrapper.ownerDocument;
- let form = doc.getElementById('vimvixen-settings-form');
- let plainJsonInput = form.elements['plain-json'];
- plainJsonInput.value = settings.json;
- }
-}