From 7a1570885e7310e5b1e15ab798c9eb66694a96fb Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Fri, 9 Jul 2021 20:14:05 -0400 Subject: Simplify get media structure (#1817) * Remove format argument of getMedia * Implement escaping --- ext/js/data/anki-note-builder.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'ext/js/data') diff --git a/ext/js/data/anki-note-builder.js b/ext/js/data/anki-note-builder.js index 02aa7969..621816d4 100644 --- a/ext/js/data/anki-note-builder.js +++ b/ext/js/data/anki-note-builder.js @@ -362,14 +362,14 @@ class AnkiNoteBuilder { (dictionaryMedia[dictionary]) : (dictionaryMedia[dictionary] = {}) ); - dictionaryMedia2[path] = {fileName}; + dictionaryMedia2[path] = {value: fileName}; } const media = { - audio: (typeof audioFileName === 'string' ? {fileName: audioFileName} : null), - 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), + audio: (typeof audioFileName === 'string' ? {value: audioFileName} : null), + screenshot: (typeof screenshotFileName === 'string' ? {value: screenshotFileName} : null), + clipboardImage: (typeof clipboardImageFileName === 'string' ? {value: clipboardImageFileName} : null), + clipboardText: (typeof clipboardText === 'string' ? {value: clipboardText} : null), + selectionText: (typeof selectionText === 'string' ? {value: selectionText} : null), textFurigana, dictionaryMedia }; @@ -391,8 +391,8 @@ class AnkiNoteBuilder { break; } if (data !== null) { - const html = this._createFuriganaHtml(data, readingMode); - results.push({text, readingMode, details: {html}}); + const value = this._createFuriganaHtml(data, readingMode); + results.push({text, readingMode, details: {value}}); } } return results; -- cgit v1.2.3