aboutsummaryrefslogtreecommitdiff
path: root/ext/js/pages
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-05-17 20:18:37 -0400
committerGitHub <noreply@github.com>2021-05-17 20:18:37 -0400
commit76276e78dac387df66384a10bc1179c90ebd93fe (patch)
treeba11d7bf4375aa76ae45646b45953df9e71f1d78 /ext/js/pages
parent12451eaf61281e588fb8ef5f911d604ba34aca92 (diff)
Expose search query to anki template renderer (#1686)
* Expose query and fullQuery to Anki context * Add {search-query} marker * Update test data * Update tests * Wrap search query in multiLine
Diffstat (limited to 'ext/js/pages')
-rw-r--r--ext/js/pages/settings/anki-controller.js2
-rw-r--r--ext/js/pages/settings/anki-templates-controller.js4
2 files changed, 5 insertions, 1 deletions
diff --git a/ext/js/pages/settings/anki-controller.js b/ext/js/pages/settings/anki-controller.js
index 91cd4641..28bb21a3 100644
--- a/ext/js/pages/settings/anki-controller.js
+++ b/ext/js/pages/settings/anki-controller.js
@@ -101,6 +101,7 @@ class AnkiController {
'pitch-accent-positions',
'reading',
'screenshot',
+ 'search-query',
'sentence',
'tags',
'url'
@@ -119,6 +120,7 @@ class AnkiController {
'kunyomi',
'onyomi',
'screenshot',
+ 'search-query',
'sentence',
'stroke-count',
'tags',
diff --git a/ext/js/pages/settings/anki-templates-controller.js b/ext/js/pages/settings/anki-templates-controller.js
index eab0681f..9502a2fd 100644
--- a/ext/js/pages/settings/anki-templates-controller.js
+++ b/ext/js/pages/settings/anki-templates-controller.js
@@ -161,7 +161,9 @@ class AnkiTemplatesController {
text: sentenceText,
offset: 0
},
- documentTitle: document.title
+ documentTitle: document.title,
+ query: sentenceText,
+ fullQuery: sentenceText
};
let template = options.anki.fieldTemplates;
if (typeof template !== 'string') { template = this._defaultFieldTemplates; }