aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-07-07 20:00:30 -0400
committerGitHub <noreply@github.com>2021-07-07 20:00:30 -0400
commit315dc425e489dc96c2f2d4e13b500105d724ec52 (patch)
tree380f1f793b158d5a7652dd08fa0cd10d7378679f
parent9935e154f1d2d9881c636b9a93f9d31b04621287 (diff)
Anki card selected text (#1809)
* Add support for injecting the text selection into Anki cards * Add selection-text * Upgrade to add {selection-text} * Update descriptions * Update test data
-rw-r--r--README.md2
-rw-r--r--ext/data/templates/anki-field-templates-upgrade-v13.handlebars4
-rw-r--r--ext/data/templates/default-anki-field-templates.handlebars4
-rw-r--r--ext/js/data/anki-note-builder.js11
-rw-r--r--ext/js/data/options-util.js1
-rw-r--r--ext/js/pages/settings/anki-controller.js2
-rw-r--r--ext/js/templates/template-renderer-media-provider.js1
-rw-r--r--ext/settings.html4
-rw-r--r--test/data/anki-note-builder-test-results.json81
-rw-r--r--test/test-anki-note-builder.js2
-rw-r--r--test/test-options-util.js2
11 files changed, 113 insertions, 1 deletions
diff --git a/README.md b/README.md
index 12c76eff..de6d248d 100644
--- a/README.md
+++ b/README.md
@@ -177,6 +177,7 @@ Flashcard fields can be configured with the following steps:
`{reading}` | Kana reading for the term (empty for terms where the expression is the reading).
`{screenshot}` | Screenshot of the web page taken at the time the term was added.
`{search-query}` | The full search query shown on the search page.
+ `{selection-text}` | The selected text on the search page or popup.
`{sentence}` | Sentence, quote, or phrase that the term appears in from the source content.
`{tags}` | Grammar and usage tags providing information about the term (unavailable in *grouped* mode).
`{url}` | Address of the web page in which the term appeared in.
@@ -199,6 +200,7 @@ Flashcard fields can be configured with the following steps:
`{onyomi}` | Onyomi (Chinese reading) for the kanji expressed as hiragana.
`{screenshot}` | Screenshot of the web page taken at the time the kanji was added.
`{search-query}` | The full search query shown on the search page.
+ `{selection-text}` | The selected text on the search page or popup.
`{sentence}` | Sentence, quote, or phrase that the character appears in from the source content.
`{stroke-count}` | Number of strokes that the kanji character has.
`{url}` | Address of the web page in which the kanji appeared in.
diff --git a/ext/data/templates/anki-field-templates-upgrade-v13.handlebars b/ext/data/templates/anki-field-templates-upgrade-v13.handlebars
index ebf9069e..78820b95 100644
--- a/ext/data/templates/anki-field-templates-upgrade-v13.handlebars
+++ b/ext/data/templates/anki-field-templates-upgrade-v13.handlebars
@@ -1,3 +1,7 @@
+{{#*inline "selection-text"}}
+ {{~#if (hasMedia "selectionText")}}{{#getMedia "selectionText" format="text"}}{{/getMedia}}{{/if~}}
+{{/inline}}
+
{{<<<<<<<}}
{{#each glossary}}{{#multiLine}}{{.}}{{/multiLine}}{{/each}}
{{=======}}
diff --git a/ext/data/templates/default-anki-field-templates.handlebars b/ext/data/templates/default-anki-field-templates.handlebars
index 62da796d..c9ee2833 100644
--- a/ext/data/templates/default-anki-field-templates.handlebars
+++ b/ext/data/templates/default-anki-field-templates.handlebars
@@ -378,4 +378,8 @@
{{~#multiLine}}{{context.fullQuery}}{{/multiLine~}}
{{/inline}}
+{{#*inline "selection-text"}}
+ {{~#if (hasMedia "selectionText")}}{{#getMedia "selectionText" format="text"}}{{/getMedia}}{{/if~}}
+{{/inline}}
+
{{~> (lookup . "marker") ~}}
diff --git a/ext/js/data/anki-note-builder.js b/ext/js/data/anki-note-builder.js
index 65740254..23dd648b 100644
--- a/ext/js/data/anki-note-builder.js
+++ b/ext/js/data/anki-note-builder.js
@@ -283,6 +283,7 @@ class AnkiNoteBuilder {
let injectScreenshot = false;
let injectClipboardImage = false;
let injectClipboardText = false;
+ let injectSelectionText = false;
const dictionaryMediaDetails = [];
for (const requirement of requirements) {
const {type} = requirement;
@@ -291,6 +292,7 @@ class AnkiNoteBuilder {
case 'screenshot': injectScreenshot = true; break;
case 'clipboardImage': injectClipboardImage = true; break;
case 'clipboardText': injectClipboardText = true; break;
+ case 'selectionText': injectSelectionText = true; break;
case 'dictionaryMedia':
{
const {dictionary, path} = requirement;
@@ -323,7 +325,8 @@ class AnkiNoteBuilder {
}
// Inject media
- const {audioFileName, screenshotFileName, clipboardImageFileName, clipboardText, dictionaryMedia: dictionaryMediaArray, errors} = await yomichan.api.injectAnkiNoteMedia(
+ const selectionText = injectSelectionText ? this._getSelectionText() : null;
+ const injectedMedia = await yomichan.api.injectAnkiNoteMedia(
timestamp,
dictionaryEntryDetails,
audioDetails,
@@ -331,6 +334,7 @@ class AnkiNoteBuilder {
clipboardDetails,
dictionaryMediaDetails
);
+ const {audioFileName, screenshotFileName, clipboardImageFileName, clipboardText, dictionaryMedia: dictionaryMediaArray, errors} = injectedMedia;
// Format results
const dictionaryMedia = {};
@@ -348,8 +352,13 @@ class AnkiNoteBuilder {
screenshot: (typeof screenshotFileName === 'string' ? {fileName: screenshotFileName} : null),
clipboardImage: (typeof clipboardImageFileName === 'string' ? {fileName: clipboardImageFileName} : null),
clipboardText: (typeof clipboardText === 'string' ? {text: clipboardText} : null),
+ selectionText: (typeof selectionText === 'string' ? {text: selectionText} : null),
dictionaryMedia
};
return {media, errors};
}
+
+ _getSelectionText() {
+ return document.getSelection().toString();
+ }
}
diff --git a/ext/js/data/options-util.js b/ext/js/data/options-util.js
index baa727d2..3d36fc2e 100644
--- a/ext/js/data/options-util.js
+++ b/ext/js/data/options-util.js
@@ -854,6 +854,7 @@ class OptionsUtil {
// Version 13 changes:
// Handlebars templates updated to use formatGlossary.
// Handlebars templates updated to use new media format.
+ // Added {selection-text} field marker.
await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v13.handlebars');
return options;
}
diff --git a/ext/js/pages/settings/anki-controller.js b/ext/js/pages/settings/anki-controller.js
index 28bb21a3..b98de1b6 100644
--- a/ext/js/pages/settings/anki-controller.js
+++ b/ext/js/pages/settings/anki-controller.js
@@ -102,6 +102,7 @@ class AnkiController {
'reading',
'screenshot',
'search-query',
+ 'selection-text',
'sentence',
'tags',
'url'
@@ -121,6 +122,7 @@ class AnkiController {
'onyomi',
'screenshot',
'search-query',
+ 'selection-text',
'sentence',
'stroke-count',
'tags',
diff --git a/ext/js/templates/template-renderer-media-provider.js b/ext/js/templates/template-renderer-media-provider.js
index db4a6d18..4fd40c67 100644
--- a/ext/js/templates/template-renderer-media-provider.js
+++ b/ext/js/templates/template-renderer-media-provider.js
@@ -78,6 +78,7 @@ class TemplateRendererMediaProvider {
case 'screenshot': return this._getSimpleMediaData(media, 'screenshot');
case 'clipboardImage': return this._getSimpleMediaData(media, 'clipboardImage');
case 'clipboardText': return this._getSimpleMediaData(media, 'clipboardText');
+ case 'selectionText': return this._getSimpleMediaData(media, 'selectionText');
case 'dictionaryMedia': return this._getDictionaryMedia(media, args[1], namedArgs);
default: return null;
}
diff --git a/ext/settings.html b/ext/settings.html
index d8d31039..49bcd722 100644
--- a/ext/settings.html
+++ b/ext/settings.html
@@ -2859,6 +2859,10 @@
<td>The full search query shown on the search page.</td>
</tr>
<tr>
+ <td><code class="anki-field-marker">{selection-text}</code></td>
+ <td>The selected text on the search page or popup.</td>
+ </tr>
+ <tr>
<td><code class="anki-field-marker">{sentence}</code></td>
<td>Sentence, quote, or phrase that the term or kanji appears in from the source content.</td>
</tr>
diff --git a/test/data/anki-note-builder-test-results.json b/test/data/anki-note-builder-test-results.json
index 7a895dcb..a8a7b08a 100644
--- a/test/data/anki-note-builder-test-results.json
+++ b/test/data/anki-note-builder-test-results.json
@@ -16,6 +16,7 @@
"onyomi": "ダ, ダアス",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打cloze-suffix",
"stroke-count": "Stroke count: Unknown",
"tags": "",
@@ -40,6 +41,7 @@
"onyomi": "",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix込cloze-suffix",
"stroke-count": "Stroke count: Unknown",
"tags": "",
@@ -78,6 +80,7 @@
"reading": "だ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打cloze-suffix",
"tags": "n",
"url": "<a href=\"url:\">url:</a>"
@@ -106,6 +109,7 @@
"reading": "ダース",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打cloze-suffix",
"tags": "abbr, n",
"url": "<a href=\"url:\">url:</a>"
@@ -139,6 +143,7 @@
"reading": "うつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打つcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -167,6 +172,7 @@
"reading": "ぶつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打つcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -195,6 +201,7 @@
"reading": "うつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打つcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -223,6 +230,7 @@
"reading": "ぶつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打つcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -251,6 +259,7 @@
"reading": "だ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打cloze-suffix",
"tags": "n",
"url": "<a href=\"url:\">url:</a>"
@@ -279,6 +288,7 @@
"reading": "ダース",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打cloze-suffix",
"tags": "abbr, n",
"url": "<a href=\"url:\">url:</a>"
@@ -312,6 +322,7 @@
"reading": "うちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打ち込むcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -340,6 +351,7 @@
"reading": "ぶちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打ち込むcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -368,6 +380,7 @@
"reading": "うちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打ち込むcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -396,6 +409,7 @@
"reading": "ぶちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打ち込むcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -424,6 +438,7 @@
"reading": "うつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打ちcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -452,6 +467,7 @@
"reading": "ぶつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打ちcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -480,6 +496,7 @@
"reading": "うつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打ちcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -508,6 +525,7 @@
"reading": "ぶつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打ちcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -536,6 +554,7 @@
"reading": "だ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打cloze-suffix",
"tags": "n",
"url": "<a href=\"url:\">url:</a>"
@@ -564,6 +583,7 @@
"reading": "ダース",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打cloze-suffix",
"tags": "abbr, n",
"url": "<a href=\"url:\">url:</a>"
@@ -597,6 +617,7 @@
"reading": "がぞう",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix画像cloze-suffix",
"tags": "n",
"url": "<a href=\"url:\">url:</a>"
@@ -630,6 +651,7 @@
"reading": "だ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefixだcloze-suffix",
"tags": "n",
"url": "<a href=\"url:\">url:</a>"
@@ -663,6 +685,7 @@
"reading": "ダース",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefixダースcloze-suffix",
"tags": "abbr, n",
"url": "<a href=\"url:\">url:</a>"
@@ -696,6 +719,7 @@
"reading": "うつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefixうつcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -724,6 +748,7 @@
"reading": "うつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefixうつcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -757,6 +782,7 @@
"reading": "ぶつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefixぶつcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -785,6 +811,7 @@
"reading": "ぶつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefixぶつcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -818,6 +845,7 @@
"reading": "うちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefixうちこむcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -846,6 +874,7 @@
"reading": "うちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefixうちこむcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -874,6 +903,7 @@
"reading": "うつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefixうちcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -902,6 +932,7 @@
"reading": "うつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefixうちcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -935,6 +966,7 @@
"reading": "ぶちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefixぶちこむcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -963,6 +995,7 @@
"reading": "ぶちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefixぶちこむcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -991,6 +1024,7 @@
"reading": "ぶつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefixぶちcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1019,6 +1053,7 @@
"reading": "ぶつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefixぶちcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1052,6 +1087,7 @@
"reading": "がぞう",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefixがぞうcloze-suffix",
"tags": "n",
"url": "<a href=\"url:\">url:</a>"
@@ -1097,6 +1133,7 @@
"reading": "うちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打ち込むcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1125,6 +1162,7 @@
"reading": "ぶちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打ち込むcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1153,6 +1191,7 @@
"reading": "うつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打ちcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1181,6 +1220,7 @@
"reading": "ぶつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打ちcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1209,6 +1249,7 @@
"reading": "だ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打cloze-suffix",
"tags": "n",
"url": "<a href=\"url:\">url:</a>"
@@ -1237,6 +1278,7 @@
"reading": "ダース",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打cloze-suffix",
"tags": "abbr, n",
"url": "<a href=\"url:\">url:</a>"
@@ -1270,6 +1312,7 @@
"reading": "うちこむ、ぶちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打ち込むcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1298,6 +1341,7 @@
"reading": "うつ、ぶつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打ちcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1326,6 +1370,7 @@
"reading": "だ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打cloze-suffix",
"tags": "n",
"url": "<a href=\"url:\">url:</a>"
@@ -1354,6 +1399,7 @@
"reading": "ダース",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打cloze-suffix",
"tags": "abbr, n",
"url": "<a href=\"url:\">url:</a>"
@@ -1387,6 +1433,7 @@
"reading": "うちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打ち込んでいませんでしたcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1415,6 +1462,7 @@
"reading": "ぶちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打ち込んでいませんでしたcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1443,6 +1491,7 @@
"reading": "うちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打ち込んでいませんでしたcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1471,6 +1520,7 @@
"reading": "ぶちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打ち込んでいませんでしたcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1499,6 +1549,7 @@
"reading": "うつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打ちcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1527,6 +1578,7 @@
"reading": "ぶつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打ちcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1555,6 +1607,7 @@
"reading": "うつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打ちcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1583,6 +1636,7 @@
"reading": "ぶつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打ちcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1611,6 +1665,7 @@
"reading": "だ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打cloze-suffix",
"tags": "n",
"url": "<a href=\"url:\">url:</a>"
@@ -1639,6 +1694,7 @@
"reading": "ダース",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打cloze-suffix",
"tags": "abbr, n",
"url": "<a href=\"url:\">url:</a>"
@@ -1672,6 +1728,7 @@
"reading": "うちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打(う)ち込(こ)むcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1700,6 +1757,7 @@
"reading": "ぶちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打(う)ち込(こ)むcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1728,6 +1786,7 @@
"reading": "うちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打(う)ち込(こ)むcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1756,6 +1815,7 @@
"reading": "ぶちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打(う)ち込(こ)むcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1784,6 +1844,7 @@
"reading": "うつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打(う)ちcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1812,6 +1873,7 @@
"reading": "ぶつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打(う)ちcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1840,6 +1902,7 @@
"reading": "うつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打(う)ちcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1868,6 +1931,7 @@
"reading": "ぶつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打(う)ちcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1896,6 +1960,7 @@
"reading": "だ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打cloze-suffix",
"tags": "n",
"url": "<a href=\"url:\">url:</a>"
@@ -1924,6 +1989,7 @@
"reading": "ダース",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix打cloze-suffix",
"tags": "abbr, n",
"url": "<a href=\"url:\">url:</a>"
@@ -1957,6 +2023,7 @@
"reading": "うちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix(打)(ち)(込)(む)cloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -1985,6 +2052,7 @@
"reading": "ぶちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix(打)(ち)(込)(む)cloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -2013,6 +2081,7 @@
"reading": "うちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix(打)(ち)(込)(む)cloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -2041,6 +2110,7 @@
"reading": "ぶちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix(打)(ち)(込)(む)cloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -2069,6 +2139,7 @@
"reading": "うつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix(打)(ち)cloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -2097,6 +2168,7 @@
"reading": "ぶつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix(打)(ち)cloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -2125,6 +2197,7 @@
"reading": "うつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix(打)(ち)cloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -2153,6 +2226,7 @@
"reading": "ぶつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix(打)(ち)cloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -2181,6 +2255,7 @@
"reading": "だ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix(打)cloze-suffix",
"tags": "n",
"url": "<a href=\"url:\">url:</a>"
@@ -2209,6 +2284,7 @@
"reading": "ダース",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefix(打)cloze-suffix",
"tags": "abbr, n",
"url": "<a href=\"url:\">url:</a>"
@@ -2242,6 +2318,7 @@
"reading": "よむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefixtestcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -2275,6 +2352,7 @@
"reading": "つよみ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefixつtestcloze-suffix",
"tags": "n",
"url": "<a href=\"url:\">url:</a>"
@@ -2308,6 +2386,7 @@
"reading": "よむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefixtestましたcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -2341,6 +2420,7 @@
"reading": "うちこむ、ぶちこむ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefixうちこむcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
@@ -2369,6 +2449,7 @@
"reading": "うつ、ぶつ",
"screenshot": "",
"search-query": "fullQuery",
+ "selection-text": "",
"sentence": "cloze-prefixうちcloze-suffix",
"tags": "vt",
"url": "<a href=\"url:\">url:</a>"
diff --git a/test/test-anki-note-builder.js b/test/test-anki-note-builder.js
index 607388fc..af9cd061 100644
--- a/test/test-anki-note-builder.js
+++ b/test/test-anki-note-builder.js
@@ -158,6 +158,7 @@ function getFieldMarkers(type) {
'reading',
'screenshot',
'search-query',
+ 'selection-text',
'sentence',
'tags',
'url'
@@ -177,6 +178,7 @@ function getFieldMarkers(type) {
'onyomi',
'screenshot',
'search-query',
+ 'selection-text',
'sentence',
'stroke-count',
'tags',
diff --git a/test/test-options-util.js b/test/test-options-util.js
index 15a11265..d4a3bf9a 100644
--- a/test/test-options-util.js
+++ b/test/test-options-util.js
@@ -959,6 +959,7 @@ async function testFieldTemplatesUpdate(extDir) {
{{~/if~}}
{{/inline}}
+<<<UPDATE-ADDITIONS>>>
{{~> (lookup . "marker") ~}}`.trimStart()
},
// hasMedia/getMedia update
@@ -1011,6 +1012,7 @@ async function testFieldTemplatesUpdate(extDir) {
{{~#if (hasMedia "clipboardText")}}{{#getMedia "clipboardText" format="text"}}{{/getMedia}}{{/if~}}
{{/inline}}
+<<<UPDATE-ADDITIONS>>>
{{~> (lookup . "marker") ~}}`.trimStart()
}
];