diff options
Diffstat (limited to 'ext/js/data/options-util.js')
-rw-r--r-- | ext/js/data/options-util.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/ext/js/data/options-util.js b/ext/js/data/options-util.js index 740afa76..89d50903 100644 --- a/ext/js/data/options-util.js +++ b/ext/js/data/options-util.js @@ -817,11 +817,25 @@ class OptionsUtil { // Version 12 changes: // Changed sentenceParsing.enableTerminationCharacters to sentenceParsing.terminationCharacterMode. // Added {search-query} field marker. + // Updated audio.sources[] to change 'custom' into 'custom-json'. + // Removed audio.customSourceType. await this._applyAnkiFieldTemplatesPatch(options, '/data/templates/anki-field-templates-upgrade-v12.handlebars'); for (const profile of options.profiles) { - const {sentenceParsing} = profile.options; + const {sentenceParsing, audio} = profile.options; + sentenceParsing.terminationCharacterMode = sentenceParsing.enableTerminationCharacters ? 'custom' : 'newlines'; delete sentenceParsing.enableTerminationCharacters; + + const {sources, customSourceType} = audio; + audio.sources = sources.map((type) => { + switch (type) { + case 'custom': + return (customSourceType === 'json' ? 'custom-json' : 'custom'); + default: + return type; + } + }); + delete audio.customSourceType; } return options; } |