From 8fc092855a2e138fd75b881729d7874604dea490 Mon Sep 17 00:00:00 2001 From: Khai Truong <56820749+khaitruong922@users.noreply.github.com> Date: Sat, 13 Jul 2024 01:02:52 +0700 Subject: [PATCH] Rename `{selection-text}` to `{popup-selection-text}` (#1207) * Add popup-selection-text + Deprecate & backward compatibility for selection-text * Lint * Update test * Test backward compatibility * Refactor to handle field migration * Update test * Add test update marker * Fix lint * Rename variables * Update changes from code review --- docs/anki-integration.md | 4 +- docs/templates.md | 4 +- ...nki-field-templates-upgrade-v45.handlebars | 9 + .../default-anki-field-templates.handlebars | 4 +- ext/js/app/frontend.js | 6 +- ext/js/data/anki-note-builder.js | 10 +- ext/js/data/anki-note-data-creator.js | 2 +- ext/js/data/anki-template-util.js | 4 +- ext/js/data/options-util.js | 21 ++ ext/js/display/display.js | 2 +- .../template-renderer-media-provider.js | 2 +- ext/settings.html | 2 +- test/data/anki-note-builder-test-results.json | 210 +++++++++--------- test/options-util.test.js | 49 +++- types/ext/anki-note-builder.d.ts | 2 +- types/ext/anki-templates.d.ts | 4 +- types/ext/cross-frame-api.d.ts | 2 +- 17 files changed, 203 insertions(+), 134 deletions(-) create mode 100644 ext/data/templates/anki-field-templates-upgrade-v45.handlebars diff --git a/docs/anki-integration.md b/docs/anki-integration.md index 5aa9e10c64..9582025149 100644 --- a/docs/anki-integration.md +++ b/docs/anki-integration.md @@ -60,7 +60,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. | + | `{popup-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. | | `{sentence-furigana}` | Sentence, quote, or phrase that the term appears in from the source content, with furigana added. | | `{single-glossary-DICT-NAME}` | Same as `{glossary}`, but with entries from only a single dictionary. The dictionary name will likely be modified, use the options from the ▼ dropdown. | @@ -92,7 +92,7 @@ Flashcard fields can be configured with the following steps: | `{onyomi-hiragana}` | 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. | + | `{popup-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. | | `{sentence-furigana}` | Sentence, quote, or phrase that the character appears in from the source content, with furigana added. | | `{stroke-count}` | Number of strokes that the kanji character has. | diff --git a/docs/templates.md b/docs/templates.md index cb848b851c..e912ace3a6 100644 --- a/docs/templates.md +++ b/docs/templates.md @@ -773,7 +773,7 @@ These functions are used together in order to request media and other types of o - "screenshot" - "clipboardImage" - "clipboardText" -- "selectionText" +- "popupSelectionText" - "textFurigana" japaneseText readingMode="default|hiragana|katakana" - "dictionaryMedia" fileName dictionary="Dictionary Name" @@ -790,7 +790,7 @@ These functions are used together in order to request media and other types of o {{#if (hasMedia "clipboardText")}}The clipboard text is: {{getMedia "clipboardText"}}{{/if}} - {{#if (hasMedia "selectionText")}}The selection text is: {{getMedia "selectionText"}}{{/if}} + {{#if (hasMedia "popupSelectionText")}}The popup selection text is: {{getMedia "popupSelectionText"}}{{/if}} {{#if (hasMedia "textFurigana" "日本語")}}This is an example of text with generated furigana: {{getMedia "textFurigana" "日本語" escape=false}}{{/if}} diff --git a/ext/data/templates/anki-field-templates-upgrade-v45.handlebars b/ext/data/templates/anki-field-templates-upgrade-v45.handlebars new file mode 100644 index 0000000000..14da7ce74d --- /dev/null +++ b/ext/data/templates/anki-field-templates-upgrade-v45.handlebars @@ -0,0 +1,9 @@ +{{<<<<<<<}} +{{#*inline "selection-text"}} + {{~#if (hasMedia "selectionText")}}{{{getMedia "selectionText"}}}{{/if~}} +{{/inline}} +{{=======}} +{{#*inline "popup-selection-text"}} + {{~#if (hasMedia "popupSelectionText")}}{{{getMedia "popupSelectionText"}}}{{/if~}} +{{/inline}} +{{>>>>>>>}} \ No newline at end of file diff --git a/ext/data/templates/default-anki-field-templates.handlebars b/ext/data/templates/default-anki-field-templates.handlebars index 2ac129347e..2ccea7ba09 100644 --- a/ext/data/templates/default-anki-field-templates.handlebars +++ b/ext/data/templates/default-anki-field-templates.handlebars @@ -454,8 +454,8 @@ {{~#multiLine}}{{context.fullQuery}}{{/multiLine~}} {{/inline}} -{{#*inline "selection-text"}} - {{~#if (hasMedia "selectionText")}}{{{getMedia "selectionText"}}}{{/if~}} +{{#*inline "popup-selection-text"}} + {{~#if (hasMedia "popupSelectionText")}}{{{getMedia "popupSelectionText"}}}{{/if~}} {{/inline}} {{#*inline "sentence-furigana"}} diff --git a/ext/js/app/frontend.js b/ext/js/app/frontend.js index c3022908d1..55f0de2600 100644 --- a/ext/js/app/frontend.js +++ b/ext/js/app/frontend.js @@ -190,7 +190,7 @@ export class Frontend { this._application.crossFrame.registerHandlers([ ['frontendClosePopup', this._onApiClosePopup.bind(this)], ['frontendCopySelection', this._onApiCopySelection.bind(this)], - ['frontendGetSelectionText', this._onApiGetSelectionText.bind(this)], + ['frontendGetPopupSelectionText', this._onApiGetPopupSelectionText.bind(this)], ['frontendGetPopupInfo', this._onApiGetPopupInfo.bind(this)], ['frontendGetPageInfo', this._onApiGetPageInfo.bind(this)], ]); @@ -298,8 +298,8 @@ export class Frontend { document.execCommand('copy'); } - /** @type {import('cross-frame-api').ApiHandler<'frontendGetSelectionText'>} */ - _onApiGetSelectionText() { + /** @type {import('cross-frame-api').ApiHandler<'frontendGetPopupSelectionText'>} */ + _onApiGetPopupSelectionText() { const selection = document.getSelection(); return selection !== null ? selection.toString() : ''; } diff --git a/ext/js/data/anki-note-builder.js b/ext/js/data/anki-note-builder.js index 7f7fe3a746..ccf7c225ed 100644 --- a/ext/js/data/anki-note-builder.js +++ b/ext/js/data/anki-note-builder.js @@ -389,7 +389,7 @@ export class AnkiNoteBuilder { let injectScreenshot = false; let injectClipboardImage = false; let injectClipboardText = false; - let injectSelectionText = false; + let injectPopupSelectionText = false; /** @type {import('anki-note-builder').TextFuriganaDetails[]} */ const textFuriganaDetails = []; /** @type {import('api').InjectAnkiNoteMediaDictionaryMediaDetails[]} */ @@ -401,7 +401,7 @@ export class AnkiNoteBuilder { case 'screenshot': injectScreenshot = true; break; case 'clipboardImage': injectClipboardImage = true; break; case 'clipboardText': injectClipboardText = true; break; - case 'selectionText': injectSelectionText = true; break; + case 'popupSelectionText': injectPopupSelectionText = true; break; case 'textFurigana': { const {text, readingMode} = requirement; @@ -451,7 +451,7 @@ export class AnkiNoteBuilder { } // Inject media - const selectionText = injectSelectionText ? this._getSelectionText() : null; + const popupSelectionText = injectPopupSelectionText ? this._getPopupSelectionText() : null; const injectedMedia = await this._api.injectAnkiNoteMedia( timestamp, dictionaryEntryDetails, @@ -480,7 +480,7 @@ export class AnkiNoteBuilder { screenshot: (typeof screenshotFileName === 'string' ? {value: screenshotFileName} : void 0), clipboardImage: (typeof clipboardImageFileName === 'string' ? {value: clipboardImageFileName} : void 0), clipboardText: (typeof clipboardText === 'string' ? {value: clipboardText} : void 0), - selectionText: (typeof selectionText === 'string' ? {value: selectionText} : void 0), + popupSelectionText: (typeof popupSelectionText === 'string' ? {value: popupSelectionText} : void 0), textFurigana, dictionaryMedia, }; @@ -490,7 +490,7 @@ export class AnkiNoteBuilder { /** * @returns {string} */ - _getSelectionText() { + _getPopupSelectionText() { const selection = document.getSelection(); return selection !== null ? selection.toString() : ''; } diff --git a/ext/js/data/anki-note-data-creator.js b/ext/js/data/anki-note-data-creator.js index 0bfd76cbe9..4c92926a32 100644 --- a/ext/js/data/anki-note-data-creator.js +++ b/ext/js/data/anki-note-data-creator.js @@ -49,7 +49,7 @@ export function createAnkiNoteData(marker, { screenshot: void 0, clipboardImage: void 0, clipboardText: void 0, - selectionText: void 0, + popupSelectionText: void 0, textFurigana: [], dictionaryMedia: {}, }; diff --git a/ext/js/data/anki-template-util.js b/ext/js/data/anki-template-util.js index 68369fc997..74589c5bcf 100644 --- a/ext/js/data/anki-template-util.js +++ b/ext/js/data/anki-template-util.js @@ -59,7 +59,7 @@ export function getStandardFieldMarkers(type) { 'reading', 'screenshot', 'search-query', - 'selection-text', + 'popup-selection-text', 'sentence', 'sentence-furigana', 'tags', @@ -86,7 +86,7 @@ export function getStandardFieldMarkers(type) { 'onyomi-hiragana', 'screenshot', 'search-query', - 'selection-text', + 'popup-selection-text', 'sentence', 'sentence-furigana', 'stroke-count', diff --git a/ext/js/data/options-util.js b/ext/js/data/options-util.js index a60b665b64..4be913d536 100644 --- a/ext/js/data/options-util.js +++ b/ext/js/data/options-util.js @@ -556,6 +556,7 @@ export class OptionsUtil { this._updateVersion42, this._updateVersion43, this._updateVersion44, + this._updateVersion45, ]; /* eslint-enable @typescript-eslint/unbound-method */ if (typeof targetVersion === 'number' && targetVersion < result.length) { @@ -1389,6 +1390,26 @@ export class OptionsUtil { } } + /** + * - Renamed `selection-text` to `popup-selection-text` + * @type {import('options-util').UpdateFunction} + */ + async _updateVersion45(options) { + await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v45.handlebars'); + const oldMarkerRegex = new RegExp('{selection-text}', 'g'); + const newMarker = '{popup-selection-text}'; + for (const profile of options.profiles) { + const termsFields = profile.options.anki.terms.fields; + for (const key of Object.keys(termsFields)) { + termsFields[key] = termsFields[key].replace(oldMarkerRegex, newMarker); + } + const kanjiFields = profile.options.anki.kanji.fields; + for (const key of Object.keys(kanjiFields)) { + kanjiFields[key] = kanjiFields[key].replace(oldMarkerRegex, newMarker); + } + } + } + /** * @param {string} url * @returns {Promise} diff --git a/ext/js/display/display.js b/ext/js/display/display.js index e1080d766b..97b29bbd78 100644 --- a/ext/js/display/display.js +++ b/ext/js/display/display.js @@ -1889,7 +1889,7 @@ export class Display extends EventDispatcher { /** @type {string} */ let text; try { - text = await this.invokeContentOrigin('frontendGetSelectionText', void 0); + text = await this.invokeContentOrigin('frontendGetPopupSelectionText', void 0); } catch (e) { break; } diff --git a/ext/js/templates/template-renderer-media-provider.js b/ext/js/templates/template-renderer-media-provider.js index 28b9c7f35b..6abfae87bd 100644 --- a/ext/js/templates/template-renderer-media-provider.js +++ b/ext/js/templates/template-renderer-media-provider.js @@ -101,7 +101,7 @@ export 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 'popupSelectionText': return this._getSimpleMediaData(media, 'popupSelectionText'); case 'textFurigana': return this._getTextFurigana(media, args[1], namedArgs); case 'dictionaryMedia': return this._getDictionaryMedia(media, args[1], namedArgs); default: return null; diff --git a/ext/settings.html b/ext/settings.html index 1bca52f925..dd6321e9ae 100644 --- a/ext/settings.html +++ b/ext/settings.html @@ -3300,7 +3300,7 @@
or click here to upload
The full search query shown on the search page. - {selection-text} + {popup-selection-text} The selected text on the search page or popup. diff --git a/test/data/anki-note-builder-test-results.json b/test/data/anki-note-builder-test-results.json index 3516276a9a..212cf2c2ca 100644 --- a/test/data/anki-note-builder-test-results.json +++ b/test/data/anki-note-builder-test-results.json @@ -22,7 +22,7 @@ "onyomi-hiragana": "だ, だあす", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打cloze-suffix", "sentence-furigana": "cloze-prefix打cloze-suffix", "stroke-count": "Stroke count: Unknown", @@ -54,7 +54,7 @@ "onyomi-hiragana": "", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix込cloze-suffix", "sentence-furigana": "cloze-prefix込cloze-suffix", "stroke-count": "Stroke count: Unknown", @@ -105,7 +105,7 @@ "reading": "だ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打cloze-suffix", "sentence-furigana": "cloze-prefix打cloze-suffix", "tags": "n", @@ -146,7 +146,7 @@ "reading": "ダース", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打cloze-suffix", "sentence-furigana": "cloze-prefix打cloze-suffix", "tags": "abbr, n", @@ -192,7 +192,7 @@ "reading": "うつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打つcloze-suffix", "sentence-furigana": "cloze-prefix打つcloze-suffix", "tags": "vt", @@ -233,7 +233,7 @@ "reading": "ぶつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打つcloze-suffix", "sentence-furigana": "cloze-prefix打つcloze-suffix", "tags": "vt", @@ -274,7 +274,7 @@ "reading": "うつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打つcloze-suffix", "sentence-furigana": "cloze-prefix打つcloze-suffix", "tags": "vt", @@ -315,7 +315,7 @@ "reading": "ぶつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打つcloze-suffix", "sentence-furigana": "cloze-prefix打つcloze-suffix", "tags": "vt", @@ -356,7 +356,7 @@ "reading": "だ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打cloze-suffix", "sentence-furigana": "cloze-prefix打cloze-suffix", "tags": "n", @@ -397,7 +397,7 @@ "reading": "ダース", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打cloze-suffix", "sentence-furigana": "cloze-prefix打cloze-suffix", "tags": "abbr, n", @@ -443,7 +443,7 @@ "reading": "うちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打ち込むcloze-suffix", "sentence-furigana": "cloze-prefix打ち込むcloze-suffix", "tags": "vt", @@ -484,7 +484,7 @@ "reading": "ぶちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打ち込むcloze-suffix", "sentence-furigana": "cloze-prefix打ち込むcloze-suffix", "tags": "vt", @@ -525,7 +525,7 @@ "reading": "うちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打ち込むcloze-suffix", "sentence-furigana": "cloze-prefix打ち込むcloze-suffix", "tags": "vt", @@ -566,7 +566,7 @@ "reading": "ぶちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打ち込むcloze-suffix", "sentence-furigana": "cloze-prefix打ち込むcloze-suffix", "tags": "vt", @@ -607,7 +607,7 @@ "reading": "うつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打ちcloze-suffix", "sentence-furigana": "cloze-prefix打ちcloze-suffix", "tags": "vt", @@ -648,7 +648,7 @@ "reading": "ぶつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打ちcloze-suffix", "sentence-furigana": "cloze-prefix打ちcloze-suffix", "tags": "vt", @@ -689,7 +689,7 @@ "reading": "うつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打ちcloze-suffix", "sentence-furigana": "cloze-prefix打ちcloze-suffix", "tags": "vt", @@ -730,7 +730,7 @@ "reading": "ぶつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打ちcloze-suffix", "sentence-furigana": "cloze-prefix打ちcloze-suffix", "tags": "vt", @@ -771,7 +771,7 @@ "reading": "だ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打cloze-suffix", "sentence-furigana": "cloze-prefix打cloze-suffix", "tags": "n", @@ -812,7 +812,7 @@ "reading": "ダース", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打cloze-suffix", "sentence-furigana": "cloze-prefix打cloze-suffix", "tags": "abbr, n", @@ -858,7 +858,7 @@ "reading": "がぞう", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix画像cloze-suffix", "sentence-furigana": "cloze-prefix画像cloze-suffix", "tags": "n", @@ -904,7 +904,7 @@ "reading": "だ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixだcloze-suffix", "sentence-furigana": "cloze-prefixだcloze-suffix", "tags": "n", @@ -950,7 +950,7 @@ "reading": "ダース", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixダースcloze-suffix", "sentence-furigana": "cloze-prefixダースcloze-suffix", "tags": "abbr, n", @@ -991,7 +991,7 @@ "reading": "だ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixダcloze-suffix", "sentence-furigana": "cloze-prefixダcloze-suffix", "tags": "n", @@ -1037,7 +1037,7 @@ "reading": "うつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixうつcloze-suffix", "sentence-furigana": "cloze-prefixうつcloze-suffix", "tags": "vt", @@ -1078,7 +1078,7 @@ "reading": "うつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixうつcloze-suffix", "sentence-furigana": "cloze-prefixうつcloze-suffix", "tags": "vt", @@ -1124,7 +1124,7 @@ "reading": "ぶつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixぶつcloze-suffix", "sentence-furigana": "cloze-prefixぶつcloze-suffix", "tags": "vt", @@ -1165,7 +1165,7 @@ "reading": "ぶつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixぶつcloze-suffix", "sentence-furigana": "cloze-prefixぶつcloze-suffix", "tags": "vt", @@ -1211,7 +1211,7 @@ "reading": "うちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixうちこむcloze-suffix", "sentence-furigana": "cloze-prefixうちこむcloze-suffix", "tags": "vt", @@ -1252,7 +1252,7 @@ "reading": "うちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixうちこむcloze-suffix", "sentence-furigana": "cloze-prefixうちこむcloze-suffix", "tags": "vt", @@ -1293,7 +1293,7 @@ "reading": "うつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixうちcloze-suffix", "sentence-furigana": "cloze-prefixうちcloze-suffix", "tags": "vt", @@ -1334,7 +1334,7 @@ "reading": "うつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixうちcloze-suffix", "sentence-furigana": "cloze-prefixうちcloze-suffix", "tags": "vt", @@ -1380,7 +1380,7 @@ "reading": "ぶちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixぶちこむcloze-suffix", "sentence-furigana": "cloze-prefixぶちこむcloze-suffix", "tags": "vt", @@ -1421,7 +1421,7 @@ "reading": "ぶちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixぶちこむcloze-suffix", "sentence-furigana": "cloze-prefixぶちこむcloze-suffix", "tags": "vt", @@ -1462,7 +1462,7 @@ "reading": "ぶつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixぶちcloze-suffix", "sentence-furigana": "cloze-prefixぶちcloze-suffix", "tags": "vt", @@ -1503,7 +1503,7 @@ "reading": "ぶつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixぶちcloze-suffix", "sentence-furigana": "cloze-prefixぶちcloze-suffix", "tags": "vt", @@ -1549,7 +1549,7 @@ "reading": "がぞう", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixがぞうcloze-suffix", "sentence-furigana": "cloze-prefixがぞうcloze-suffix", "tags": "n", @@ -1607,7 +1607,7 @@ "reading": "うちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打ち込むcloze-suffix", "sentence-furigana": "cloze-prefix打ち込むcloze-suffix", "tags": "vt", @@ -1648,7 +1648,7 @@ "reading": "ぶちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打ち込むcloze-suffix", "sentence-furigana": "cloze-prefix打ち込むcloze-suffix", "tags": "vt", @@ -1689,7 +1689,7 @@ "reading": "うつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打ちcloze-suffix", "sentence-furigana": "cloze-prefix打ちcloze-suffix", "tags": "vt", @@ -1730,7 +1730,7 @@ "reading": "ぶつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打ちcloze-suffix", "sentence-furigana": "cloze-prefix打ちcloze-suffix", "tags": "vt", @@ -1771,7 +1771,7 @@ "reading": "だ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打cloze-suffix", "sentence-furigana": "cloze-prefix打cloze-suffix", "tags": "n", @@ -1812,7 +1812,7 @@ "reading": "ダース", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打cloze-suffix", "sentence-furigana": "cloze-prefix打cloze-suffix", "tags": "abbr, n", @@ -1858,7 +1858,7 @@ "reading": "うちこむ、ぶちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打ち込むcloze-suffix", "sentence-furigana": "cloze-prefix打ち込むcloze-suffix", "tags": "vt", @@ -1899,7 +1899,7 @@ "reading": "うつ、ぶつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打ちcloze-suffix", "sentence-furigana": "cloze-prefix打ちcloze-suffix", "tags": "vt", @@ -1940,7 +1940,7 @@ "reading": "だ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打cloze-suffix", "sentence-furigana": "cloze-prefix打cloze-suffix", "tags": "n", @@ -1981,7 +1981,7 @@ "reading": "ダース", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打cloze-suffix", "sentence-furigana": "cloze-prefix打cloze-suffix", "tags": "abbr, n", @@ -2027,7 +2027,7 @@ "reading": "うちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打ち込んでいませんでしたcloze-suffix", "sentence-furigana": "cloze-prefix打ち込んでいませんでしたcloze-suffix", "tags": "vt", @@ -2068,7 +2068,7 @@ "reading": "ぶちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打ち込んでいませんでしたcloze-suffix", "sentence-furigana": "cloze-prefix打ち込んでいませんでしたcloze-suffix", "tags": "vt", @@ -2109,7 +2109,7 @@ "reading": "うちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打ち込んでいませんでしたcloze-suffix", "sentence-furigana": "cloze-prefix打ち込んでいませんでしたcloze-suffix", "tags": "vt", @@ -2150,7 +2150,7 @@ "reading": "ぶちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打ち込んでいませんでしたcloze-suffix", "sentence-furigana": "cloze-prefix打ち込んでいませんでしたcloze-suffix", "tags": "vt", @@ -2191,7 +2191,7 @@ "reading": "うつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打ちcloze-suffix", "sentence-furigana": "cloze-prefix打ちcloze-suffix", "tags": "vt", @@ -2232,7 +2232,7 @@ "reading": "ぶつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打ちcloze-suffix", "sentence-furigana": "cloze-prefix打ちcloze-suffix", "tags": "vt", @@ -2273,7 +2273,7 @@ "reading": "うつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打ちcloze-suffix", "sentence-furigana": "cloze-prefix打ちcloze-suffix", "tags": "vt", @@ -2314,7 +2314,7 @@ "reading": "ぶつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打ちcloze-suffix", "sentence-furigana": "cloze-prefix打ちcloze-suffix", "tags": "vt", @@ -2355,7 +2355,7 @@ "reading": "だ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打cloze-suffix", "sentence-furigana": "cloze-prefix打cloze-suffix", "tags": "n", @@ -2396,7 +2396,7 @@ "reading": "ダース", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打cloze-suffix", "sentence-furigana": "cloze-prefix打cloze-suffix", "tags": "abbr, n", @@ -2442,7 +2442,7 @@ "reading": "うちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打(う)ち込(こ)むcloze-suffix", "sentence-furigana": "cloze-prefix打(う)ち込(こ)むcloze-suffix", "tags": "vt", @@ -2483,7 +2483,7 @@ "reading": "ぶちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打(う)ち込(こ)むcloze-suffix", "sentence-furigana": "cloze-prefix打(う)ち込(こ)むcloze-suffix", "tags": "vt", @@ -2524,7 +2524,7 @@ "reading": "うちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打(う)ち込(こ)むcloze-suffix", "sentence-furigana": "cloze-prefix打(う)ち込(こ)むcloze-suffix", "tags": "vt", @@ -2565,7 +2565,7 @@ "reading": "ぶちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打(う)ち込(こ)むcloze-suffix", "sentence-furigana": "cloze-prefix打(う)ち込(こ)むcloze-suffix", "tags": "vt", @@ -2606,7 +2606,7 @@ "reading": "うつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打(う)ちcloze-suffix", "sentence-furigana": "cloze-prefix打(う)ちcloze-suffix", "tags": "vt", @@ -2647,7 +2647,7 @@ "reading": "ぶつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打(う)ちcloze-suffix", "sentence-furigana": "cloze-prefix打(う)ちcloze-suffix", "tags": "vt", @@ -2688,7 +2688,7 @@ "reading": "うつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打(う)ちcloze-suffix", "sentence-furigana": "cloze-prefix打(う)ちcloze-suffix", "tags": "vt", @@ -2729,7 +2729,7 @@ "reading": "ぶつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打(う)ちcloze-suffix", "sentence-furigana": "cloze-prefix打(う)ちcloze-suffix", "tags": "vt", @@ -2770,7 +2770,7 @@ "reading": "だ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打(う)cloze-suffix", "sentence-furigana": "cloze-prefix打(う)cloze-suffix", "tags": "n", @@ -2811,7 +2811,7 @@ "reading": "ダース", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix打(う)cloze-suffix", "sentence-furigana": "cloze-prefix打(う)cloze-suffix", "tags": "abbr, n", @@ -2857,7 +2857,7 @@ "reading": "うちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix(打)(ち)(込)(む)cloze-suffix", "sentence-furigana": "cloze-prefix(打)(ち)(込)(む)cloze-suffix", "tags": "vt", @@ -2898,7 +2898,7 @@ "reading": "ぶちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix(打)(ち)(込)(む)cloze-suffix", "sentence-furigana": "cloze-prefix(打)(ち)(込)(む)cloze-suffix", "tags": "vt", @@ -2939,7 +2939,7 @@ "reading": "うちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix(打)(ち)(込)(む)cloze-suffix", "sentence-furigana": "cloze-prefix(打)(ち)(込)(む)cloze-suffix", "tags": "vt", @@ -2980,7 +2980,7 @@ "reading": "ぶちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix(打)(ち)(込)(む)cloze-suffix", "sentence-furigana": "cloze-prefix(打)(ち)(込)(む)cloze-suffix", "tags": "vt", @@ -3021,7 +3021,7 @@ "reading": "うつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix(打)(ち)cloze-suffix", "sentence-furigana": "cloze-prefix(打)(ち)cloze-suffix", "tags": "vt", @@ -3062,7 +3062,7 @@ "reading": "ぶつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix(打)(ち)cloze-suffix", "sentence-furigana": "cloze-prefix(打)(ち)cloze-suffix", "tags": "vt", @@ -3103,7 +3103,7 @@ "reading": "うつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix(打)(ち)cloze-suffix", "sentence-furigana": "cloze-prefix(打)(ち)cloze-suffix", "tags": "vt", @@ -3144,7 +3144,7 @@ "reading": "ぶつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix(打)(ち)cloze-suffix", "sentence-furigana": "cloze-prefix(打)(ち)cloze-suffix", "tags": "vt", @@ -3185,7 +3185,7 @@ "reading": "だ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix(打)cloze-suffix", "sentence-furigana": "cloze-prefix(打)cloze-suffix", "tags": "n", @@ -3226,7 +3226,7 @@ "reading": "ダース", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix(打)cloze-suffix", "sentence-furigana": "cloze-prefix(打)cloze-suffix", "tags": "abbr, n", @@ -3272,7 +3272,7 @@ "reading": "よむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixtestcloze-suffix", "sentence-furigana": "cloze-prefixtestcloze-suffix", "tags": "vt", @@ -3318,7 +3318,7 @@ "reading": "つよみ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixつtestcloze-suffix", "sentence-furigana": "cloze-prefixつtestcloze-suffix", "tags": "n", @@ -3364,7 +3364,7 @@ "reading": "よむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixtestましたcloze-suffix", "sentence-furigana": "cloze-prefixtestましたcloze-suffix", "tags": "vt", @@ -3410,7 +3410,7 @@ "reading": "うちこむ、ぶちこむ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixうちこむcloze-suffix", "sentence-furigana": "cloze-prefixうちこむcloze-suffix", "tags": "vt", @@ -3451,7 +3451,7 @@ "reading": "うつ、ぶつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixうちcloze-suffix", "sentence-furigana": "cloze-prefixうちcloze-suffix", "tags": "vt", @@ -3497,7 +3497,7 @@ "reading": "おてまえ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixお手前cloze-suffix", "sentence-furigana": "cloze-prefixお手前cloze-suffix", "tags": "n", @@ -3543,7 +3543,7 @@ "reading": "ばんごう", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix番号cloze-suffix", "sentence-furigana": "cloze-prefix番号cloze-suffix", "tags": "n", @@ -3589,7 +3589,7 @@ "reading": "ちゅうごし", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix中腰cloze-suffix", "sentence-furigana": "cloze-prefix中腰cloze-suffix", "tags": "n", @@ -3635,7 +3635,7 @@ "reading": "しょぎょう", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix所業cloze-suffix", "sentence-furigana": "cloze-prefix所業cloze-suffix", "tags": "n", @@ -3681,7 +3681,7 @@ "reading": "どぼくこうじ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix土木工事cloze-suffix", "sentence-furigana": "cloze-prefix土木工事cloze-suffix", "tags": "n", @@ -3727,7 +3727,7 @@ "reading": "すき", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix好きcloze-suffix", "sentence-furigana": "cloze-prefix好きcloze-suffix", "tags": "adj-na, n", @@ -3773,7 +3773,7 @@ "reading": "こうぞう", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix構造cloze-suffix", "sentence-furigana": "cloze-prefix構造cloze-suffix", "tags": "n", @@ -3819,7 +3819,7 @@ "reading": "のたまう", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixのたもうたcloze-suffix", "sentence-furigana": "cloze-prefixのたもうたcloze-suffix", "tags": "v5", @@ -3865,7 +3865,7 @@ "reading": "さんきゅう", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix39cloze-suffix", "sentence-furigana": "cloze-prefix39cloze-suffix", "tags": "", @@ -3911,7 +3911,7 @@ "reading": "English", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixEnglishcloze-suffix", "sentence-furigana": "cloze-prefixEnglishcloze-suffix", "tags": "n", @@ -3957,7 +3957,7 @@ "reading": "ユーエスビー", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixUSBcloze-suffix", "sentence-furigana": "cloze-prefixUSBcloze-suffix", "tags": "n", @@ -4003,7 +4003,7 @@ "reading": "うつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixutsucloze-suffix", "sentence-furigana": "cloze-prefixutsucloze-suffix", "tags": "vt", @@ -4044,7 +4044,7 @@ "reading": "うつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixutsucloze-suffix", "sentence-furigana": "cloze-prefixutsucloze-suffix", "tags": "vt", @@ -4090,7 +4090,7 @@ "reading": "うつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixウツcloze-suffix", "sentence-furigana": "cloze-prefixウツcloze-suffix", "tags": "vt", @@ -4131,7 +4131,7 @@ "reading": "うつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixウツcloze-suffix", "sentence-furigana": "cloze-prefixウツcloze-suffix", "tags": "vt", @@ -4177,7 +4177,7 @@ "reading": "テキスト", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixてきすとcloze-suffix", "sentence-furigana": "cloze-prefixてきすとcloze-suffix", "tags": "n", @@ -4223,7 +4223,7 @@ "reading": "うつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixウツcloze-suffix", "sentence-furigana": "cloze-prefixウツcloze-suffix", "tags": "vt", @@ -4264,7 +4264,7 @@ "reading": "うつ", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixウツcloze-suffix", "sentence-furigana": "cloze-prefixウツcloze-suffix", "tags": "vt", @@ -4310,7 +4310,7 @@ "reading": "すごい", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixすっっごーーいcloze-suffix", "sentence-furigana": "cloze-prefixすっっごーーいcloze-suffix", "tags": "adj-i", @@ -4356,7 +4356,7 @@ "reading": "English", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixenglishcloze-suffix", "sentence-furigana": "cloze-prefixenglishcloze-suffix", "tags": "n", @@ -4402,7 +4402,7 @@ "reading": "language", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixLANGUAGEcloze-suffix", "sentence-furigana": "cloze-prefixLANGUAGEcloze-suffix", "tags": "n", @@ -4448,7 +4448,7 @@ "reading": "마시다", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefix마시거나cloze-suffix", "sentence-furigana": "cloze-prefix마시거나cloze-suffix", "tags": "v", @@ -4494,7 +4494,7 @@ "reading": "English", "screenshot": "", "search-query": "fullQuery", - "selection-text": "", + "popup-selection-text": "", "sentence": "cloze-prefixenglishcloze-suffix", "sentence-furigana": "cloze-prefixenglishcloze-suffix", "tags": "n", diff --git a/test/options-util.test.js b/test/options-util.test.js index 0e9176070b..c6abc1ac4d 100644 --- a/test/options-util.test.js +++ b/test/options-util.test.js @@ -125,8 +125,20 @@ function createProfileOptionsTestData1() { tags: ['yomitan'], sentenceExt: 200, screenshot: {format: 'png', quality: 92}, - terms: {deck: '', model: '', fields: {}}, - kanji: {deck: '', model: '', fields: {}}, + terms: { + deck: '', + model: '', + fields: { + expression: '{selection-text}', + }, + }, + kanji: { + deck: '', + model: '', + fields: { + expression: '{selection-text}', + }, + }, duplicateScope: 'collection', fieldTemplates: null, }, @@ -445,8 +457,20 @@ function createProfileOptionsUpdatedTestData1() { server: 'http://127.0.0.1:8765', tags: ['yomitan'], screenshot: {format: 'png', quality: 92}, - terms: {deck: '', model: '', fields: {}}, - kanji: {deck: '', model: '', fields: {}}, + terms: { + deck: '', + model: '', + fields: { + expression: '{popup-selection-text}', + }, + }, + kanji: { + deck: '', + model: '', + fields: { + expression: '{popup-selection-text}', + }, + }, duplicateBehavior: 'new', duplicateScope: 'collection', duplicateScopeCheckAllModels: false, @@ -612,7 +636,7 @@ function createOptionsUpdatedTestData1() { }, ], profileCurrent: 0, - version: 44, + version: 45, global: { database: { prefixWildcardsSupported: false, @@ -1792,6 +1816,21 @@ describe('OptionsUtil', () => { {{#*inline "selection-text"}} {{~#if (hasMedia "selectionText")}}{{{getMedia "selectionText"}}}{{/if~}} {{/inline}} +`.trimStart(), + }, + { + oldVersion: 44, + newVersion: 45, + old: ` +{{#*inline "selection-text"}} + {{~#if (hasMedia "selectionText")}}{{{getMedia "selectionText"}}}{{/if~}} +{{/inline}} +`.trimStart(), + + expected: ` +{{#*inline "popup-selection-text"}} + {{~#if (hasMedia "popupSelectionText")}}{{{getMedia "popupSelectionText"}}}{{/if~}} +{{/inline}} `.trimStart(), }, ]; diff --git a/types/ext/anki-note-builder.d.ts b/types/ext/anki-note-builder.d.ts index 9174c56312..f80901685d 100644 --- a/types/ext/anki-note-builder.d.ts +++ b/types/ext/anki-note-builder.d.ts @@ -70,7 +70,7 @@ export type GetRenderingDataDetails = { export type CommonData = AnkiTemplatesInternal.CreateDetails; export type RequirementGeneric = { - type: 'audio' | 'screenshot' | 'clipboardImage' | 'clipboardText' | 'selectionText'; + type: 'audio' | 'screenshot' | 'clipboardImage' | 'clipboardText' | 'popupSelectionText'; }; export type RequirementTextFurigana = { diff --git a/types/ext/anki-templates.d.ts b/types/ext/anki-templates.d.ts index 44a087ebfd..8780be8941 100644 --- a/types/ext/anki-templates.d.ts +++ b/types/ext/anki-templates.d.ts @@ -32,7 +32,7 @@ export type Media = { screenshot?: MediaObject; clipboardImage?: MediaObject; clipboardText?: MediaObject; - selectionText?: MediaObject; + popupSelectionText?: MediaObject; textFurigana?: TextFuriganaSegment[]; dictionaryMedia?: DictionaryMedia; }; @@ -44,7 +44,7 @@ export type MediaSimpleType = ( 'screenshot' | 'clipboardImage' | 'clipboardText' | - 'selectionText' + 'popupSelectionText' ); export type TextFuriganaSegment = { diff --git a/types/ext/cross-frame-api.d.ts b/types/ext/cross-frame-api.d.ts index a7291ce4b5..625eaebb46 100644 --- a/types/ext/cross-frame-api.d.ts +++ b/types/ext/cross-frame-api.d.ts @@ -97,7 +97,7 @@ type ApiSurface = { params: void; return: void; }; - frontendGetSelectionText: { + frontendGetPopupSelectionText: { params: void; return: string; };