summaryrefslogtreecommitdiff
path: root/ext/js/pages/settings/anki-controller.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-02-24 21:54:58 -0500
committerGitHub <noreply@github.com>2021-02-24 21:54:58 -0500
commitae92e0b3781e27d54cbac2570ba2a1b8a6b11999 (patch)
treeb7d7a7171a6cbc25d5f1fc4b4996024c4f73033e /ext/js/pages/settings/anki-controller.js
parent0a76de1b44443cc668882125d73d83d5f7ba8a63 (diff)
AnkiUtil (#1439)
* Add AnkiUtil * Update AnkiConnect to use AnkiUtil * Use AnkiUtil in AnkiNoteBuilder * Replace containsAnyMarker with AnkiUtil.stringContainsAnyFieldMarker * Add AnkiUtil.getFieldMarkers * Add fieldsObjectContainsMarker to AnkiUtil * Remove unused global * Remove unused parameter: enabled * Add cloneFieldMarkerPattern
Diffstat (limited to 'ext/js/pages/settings/anki-controller.js')
-rw-r--r--ext/js/pages/settings/anki-controller.js9
1 files changed, 2 insertions, 7 deletions
diff --git a/ext/js/pages/settings/anki-controller.js b/ext/js/pages/settings/anki-controller.js
index 26cab68f..509e263c 100644
--- a/ext/js/pages/settings/anki-controller.js
+++ b/ext/js/pages/settings/anki-controller.js
@@ -17,7 +17,7 @@
/* global
* AnkiConnect
- * AnkiNoteBuilder
+ * AnkiUtil
* ObjectPropertyAccessor
* SelectorObserver
*/
@@ -26,7 +26,6 @@ class AnkiController {
constructor(settingsController) {
this._settingsController = settingsController;
this._ankiConnect = new AnkiConnect();
- this._ankiNoteBuilder = new AnkiNoteBuilder(false);
this._selectorObserver = new SelectorObserver({
selector: '.anki-card',
ignoreSelector: null,
@@ -156,10 +155,6 @@ class AnkiController {
return this._settingsController.permissionsUtil.getRequiredPermissionsForAnkiFieldValue(fieldValue);
}
- containsAnyMarker(field) {
- return this._ankiNoteBuilder.containsAnyMarker(field);
- }
-
// Private
async _onOptionsChanged({options: {anki}}) {
@@ -439,7 +434,7 @@ class AnkiCardController {
_validateField(node, index) {
let valid = (node.dataset.hasPermissions !== 'false');
- if (valid && index === 0 && !this._ankiController.containsAnyMarker(node.value)) {
+ if (valid && index === 0 && !AnkiUtil.stringContainsAnyFieldMarker(node.value)) {
valid = false;
}
node.dataset.invalid = `${!valid}`;