aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/settings/anki-templates-controller.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-09-19 17:14:51 -0400
committerGitHub <noreply@github.com>2020-09-19 17:14:51 -0400
commit2ff4f830722940d2bfc35328fa913f93d04a330b (patch)
tree19eb865b31eaaa9c69f6bd913985ae5460e7340d /ext/bg/js/settings/anki-templates-controller.js
parent613c7ebf69413723486ab49a7b2f928422de3541 (diff)
Modal refactor (#842)
* Add Modal class * Use Modal class
Diffstat (limited to 'ext/bg/js/settings/anki-templates-controller.js')
-rw-r--r--ext/bg/js/settings/anki-templates-controller.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/bg/js/settings/anki-templates-controller.js b/ext/bg/js/settings/anki-templates-controller.js
index c980bfa2..f2e5be43 100644
--- a/ext/bg/js/settings/anki-templates-controller.js
+++ b/ext/bg/js/settings/anki-templates-controller.js
@@ -17,6 +17,7 @@
/* global
* AnkiNoteBuilder
+ * Modal
* TemplateRendererProxy
* api
*/
@@ -28,12 +29,15 @@ class AnkiTemplatesController {
this._cachedDefinitionValue = null;
this._cachedDefinitionText = null;
this._defaultFieldTemplates = null;
+ this._fieldTemplateResetModal = null;
this._templateRenderer = new TemplateRendererProxy();
}
async prepare() {
this._defaultFieldTemplates = await api.getDefaultAnkiFieldTemplates();
+ this._fieldTemplateResetModal = new Modal(document.querySelector('#field-template-reset-modal'));
+
const markers = new Set([
...this._ankiController.getFieldMarkers('terms'),
...this._ankiController.getFieldMarkers('kanji')
@@ -69,13 +73,13 @@ class AnkiTemplatesController {
_onReset(e) {
e.preventDefault();
- $('#field-template-reset-modal').modal('show');
+ this._fieldTemplateResetModal.setVisible(true);
}
_onResetConfirm(e) {
e.preventDefault();
- $('#field-template-reset-modal').modal('hide');
+ this._fieldTemplateResetModal.setVisible(false);
const value = this._defaultFieldTemplates;