aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/settings
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-09-08 11:01:08 -0400
committerGitHub <noreply@github.com>2020-09-08 11:01:08 -0400
commitf7093b4c1abf73363e65dba54a098b76d0f2ba50 (patch)
treec54fc65cb559d21450a1c2a3596ec222e40fc9ba /ext/bg/js/settings
parent36fc5abae543840484b3d8f7abff85f57de66ada (diff)
Anki note clipboard marker (#780)
* Update fields reference * Add support for adding clipboard images to anki notes * Add handlebars templates * Add markers * Add markers to readme
Diffstat (limited to 'ext/bg/js/settings')
-rw-r--r--ext/bg/js/settings/anki-templates.js5
-rw-r--r--ext/bg/js/settings/anki.js2
2 files changed, 6 insertions, 1 deletions
diff --git a/ext/bg/js/settings/anki-templates.js b/ext/bg/js/settings/anki-templates.js
index 4e004308..fb03ef14 100644
--- a/ext/bg/js/settings/anki-templates.js
+++ b/ext/bg/js/settings/anki-templates.js
@@ -143,7 +143,10 @@ class AnkiTemplatesController {
};
let templates = options.anki.fieldTemplates;
if (typeof templates !== 'string') { templates = this._defaultFieldTemplates; }
- const ankiNoteBuilder = new AnkiNoteBuilder({renderTemplate: api.templateRender.bind(api)});
+ const ankiNoteBuilder = new AnkiNoteBuilder({
+ renderTemplate: api.templateRender.bind(api),
+ getClipboardImage: api.clipboardGetImage.bind(api)
+ });
const data = ankiNoteBuilder.createNoteData(definition, mode, context, options);
result = await ankiNoteBuilder.formatField(field, data, templates, exceptions);
}
diff --git a/ext/bg/js/settings/anki.js b/ext/bg/js/settings/anki.js
index ac4c5455..0965e633 100644
--- a/ext/bg/js/settings/anki.js
+++ b/ext/bg/js/settings/anki.js
@@ -44,6 +44,7 @@ class AnkiController {
case 'terms':
return [
'audio',
+ 'clipboard-image',
'cloze-body',
'cloze-prefix',
'cloze-suffix',
@@ -66,6 +67,7 @@ class AnkiController {
case 'kanji':
return [
'character',
+ 'clipboard-image',
'cloze-body',
'cloze-prefix',
'cloze-suffix',