diff options
Diffstat (limited to 'ext/js')
-rw-r--r-- | ext/js/data/anki-note-data-creator.js | 4 | ||||
-rw-r--r-- | ext/js/data/options-util.js | 6 | ||||
-rw-r--r-- | ext/js/display/display.js | 4 | ||||
-rw-r--r-- | ext/js/pages/settings/anki-controller.js | 2 | ||||
-rw-r--r-- | ext/js/pages/settings/anki-templates-controller.js | 4 |
5 files changed, 15 insertions, 5 deletions
diff --git a/ext/js/data/anki-note-data-creator.js b/ext/js/data/anki-note-data-creator.js index d1bbec18..4cf62788 100644 --- a/ext/js/data/anki-note-data-creator.js +++ b/ext/js/data/anki-note-data-creator.js @@ -141,9 +141,11 @@ class AnkiNoteDataCreator { } _getPublicContext(context) { - let {documentTitle} = this._asObject(context); + let {documentTitle, query, fullQuery} = this._asObject(context); if (typeof documentTitle !== 'string') { documentTitle = ''; } return { + query, + fullQuery, document: { title: documentTitle } diff --git a/ext/js/data/options-util.js b/ext/js/data/options-util.js index cb58206f..00ad890d 100644 --- a/ext/js/data/options-util.js +++ b/ext/js/data/options-util.js @@ -461,7 +461,7 @@ class OptionsUtil { {async: false, update: this._updateVersion9.bind(this)}, {async: true, update: this._updateVersion10.bind(this)}, {async: false, update: this._updateVersion11.bind(this)}, - {async: false, update: this._updateVersion12.bind(this)} + {async: true, update: this._updateVersion12.bind(this)} ]; } @@ -813,9 +813,11 @@ class OptionsUtil { return options; } - _updateVersion12(options) { + async _updateVersion12(options) { // Version 12 changes: // Changed sentenceParsing.enableTerminationCharacters to sentenceParsing.terminationCharacterMode. + // Added {search-query} field marker. + await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v12.handlebars'); for (const profile of options.profiles) { const {sentenceParsing} = profile.options; sentenceParsing.terminationCharacterMode = sentenceParsing.enableTerminationCharacters ? 'custom' : 'newlines'; diff --git a/ext/js/display/display.js b/ext/js/display/display.js index 7bfe3add..fe5b5c9a 100644 --- a/ext/js/display/display.js +++ b/ext/js/display/display.js @@ -1400,7 +1400,9 @@ class Display extends EventDispatcher { return { url, sentence, - documentTitle + documentTitle, + query: this._query, + fullQuery: this._fullQuery }; } 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; } |