aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/settings/popup-preview.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-05-30 09:33:13 -0400
committerGitHub <noreply@github.com>2020-05-30 09:33:13 -0400
commit63a3e56367b95f7ea64a5701d17179de60ed8718 (patch)
treefc811028b127abf9c1ff1dbdbb4663ba70b60649 /ext/bg/js/settings/popup-preview.js
parent1a5a37c9e47dc4d1f1e1b3ffaf990e792140b912 (diff)
Use SettingsController (#576)
* Use settingsController internally in settings/main.js * Replace modifyingProfileChange with SettingsController.optionsContextChanged * Update ClipboardPopupsController to use SettingsController * Store reference to checkbox * Use this._settingsController for everything * Change where current profile is initially assigned from * Remove some unnecessary async calls * Move setup calls * Update AnkiTemplatesController to use SettingsController * Cache default field templates * Update AnkiController to use SettingsController * Update AudioController to use SettingsController * Update SettingsBackup to use SettingsController * Update DictionaryController to use SettingsController * Update GenericSettingController to use SettingsController * Update ProfileController to use SettingsController * Remove unused * Remove unused * Replace some uses of api.options* functions * Fix missing awaits * Fix invalid function
Diffstat (limited to 'ext/bg/js/settings/popup-preview.js')
-rw-r--r--ext/bg/js/settings/popup-preview.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/ext/bg/js/settings/popup-preview.js b/ext/bg/js/settings/popup-preview.js
index d5519959..d4145b76 100644
--- a/ext/bg/js/settings/popup-preview.js
+++ b/ext/bg/js/settings/popup-preview.js
@@ -16,12 +16,12 @@
*/
/* global
- * getOptionsContext
* wanakana
*/
class PopupPreviewController {
- constructor() {
+ constructor(settingsController) {
+ this._settingsController = settingsController;
this._previewVisible = false;
this._targetOrigin = chrome.runtime.getURL('/').replace(/\/$/, '');
this._frame = null;
@@ -58,7 +58,7 @@ class PopupPreviewController {
text.addEventListener('input', this._onTextChange.bind(this), false);
customCss.addEventListener('input', this._onCustomCssChange.bind(this), false);
customOuterCss.addEventListener('input', this._onCustomOuterCssChange.bind(this), false);
- yomichan.on('modifyingProfileChange', this._onOptionsContextChange.bind(this));
+ this._settingsController.on('optionsContextChanged', this._onOptionsContextChange.bind(this));
frame.src = '/bg/settings-popup-preview.html';
frame.id = 'settings-popup-preview-frame';
@@ -88,7 +88,8 @@ class PopupPreviewController {
}
_onOptionsContextChange() {
- this._invoke('updateOptionsContext', {optionsContext: getOptionsContext()});
+ const optionsContext = this._settingsController.getOptionsContext();
+ this._invoke('updateOptionsContext', {optionsContext});
}
_setText(text) {