summaryrefslogtreecommitdiff
path: root/ext/mixed/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-09-26 13:45:48 -0400
committerGitHub <noreply@github.com>2020-09-26 13:45:48 -0400
commitcab5daa22e986fdf0c71a370ebd459efa0a13a61 (patch)
tree1c6b4cbeb783e528e3190bcd4d52b5b6b2e9be72 /ext/mixed/js
parentd27349207dc493e6d1e035c2c5606943c990f02f (diff)
Add clipboard-text Anki field (#863)
* Add clipboard-text anki field * Add markers * Update clipboard injection
Diffstat (limited to 'ext/mixed/js')
-rw-r--r--ext/mixed/js/api.js4
-rw-r--r--ext/mixed/js/display.js10
2 files changed, 9 insertions, 5 deletions
diff --git a/ext/mixed/js/api.js b/ext/mixed/js/api.js
index f7711cbd..e826b68b 100644
--- a/ext/mixed/js/api.js
+++ b/ext/mixed/js/api.js
@@ -77,8 +77,8 @@ const api = (() => {
return this._invoke('getAnkiNoteInfo', {notes, duplicateScope});
}
- injectAnkiNoteMedia(expression, reading, timestamp, audioDetails, screenshotDetails, clipboardImage) {
- return this._invoke('injectAnkiNoteMedia', {expression, reading, timestamp, audioDetails, screenshotDetails, clipboardImage});
+ injectAnkiNoteMedia(expression, reading, timestamp, audioDetails, screenshotDetails, clipboardDetails) {
+ return this._invoke('injectAnkiNoteMedia', {expression, reading, timestamp, audioDetails, screenshotDetails, clipboardDetails});
}
noteView(noteId) {
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({