diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-09-26 13:45:48 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-26 13:45:48 -0400 |
commit | cab5daa22e986fdf0c71a370ebd459efa0a13a61 (patch) | |
tree | 1c6b4cbeb783e528e3190bcd4d52b5b6b2e9be72 /ext/mixed/js/display.js | |
parent | d27349207dc493e6d1e035c2c5606943c990f02f (diff) |
Add clipboard-text Anki field (#863)
* Add clipboard-text anki field
* Add markers
* Update clipboard injection
Diffstat (limited to 'ext/mixed/js/display.js')
-rw-r--r-- | ext/mixed/js/display.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 689fa7e4..377a491d 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -1389,18 +1389,22 @@ class Display extends EventDispatcher { const {expression, reading} = Array.isArray(definitionExpressions) ? definitionExpressions[0] : definition; const audioDetails = (mode !== 'kanji' && this._ankiNoteBuilder.containsMarker(fields, 'audio') ? {sources, customSourceUrl} : null); const screenshotDetails = (this._ankiNoteBuilder.containsMarker(fields, 'screenshot') ? {ownerFrameId, format, quality} : null); - const clipboardImage = (this._ankiNoteBuilder.containsMarker(fields, 'clipboard-image')); - const {screenshotFileName, clipboardImageFileName, audioFileName} = await api.injectAnkiNoteMedia( + const clipboardDetails = { + image: this._ankiNoteBuilder.containsMarker(fields, 'clipboard-image'), + text: this._ankiNoteBuilder.containsMarker(fields, 'clipboard-text') + }; + const {screenshotFileName, clipboardImageFileName, clipboardText, audioFileName} = await api.injectAnkiNoteMedia( expression, reading, timestamp, audioDetails, screenshotDetails, - clipboardImage + clipboardDetails ); if (screenshotFileName !== null) { definition.screenshotFileName = screenshotFileName; } if (clipboardImageFileName !== null) { definition.clipboardImageFileName = clipboardImageFileName; } if (audioFileName !== null) { definition.audioFileName = audioFileName; } + if (clipboardText !== null) { definition.clipboardText = clipboardText; } } return await this._ankiNoteBuilder.createNote({ |