diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-03-15 17:13:00 -0400 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-04-06 18:20:04 -0400 |
commit | 059db280bba858a3cab3a542aef13f19737aaf6e (patch) | |
tree | 31f8afe92ea57e63c8435f49114d790afad53b47 /ext/mixed | |
parent | 8b07a23de95ded3e6af93c78ab4f7f70cc449ea0 (diff) |
Add custom context object for note creation
Diffstat (limited to 'ext/mixed')
-rw-r--r-- | ext/mixed/js/api.js | 8 | ||||
-rw-r--r-- | ext/mixed/js/display.js | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/ext/mixed/js/api.js b/ext/mixed/js/api.js index df6a93f5..feec94df 100644 --- a/ext/mixed/js/api.js +++ b/ext/mixed/js/api.js @@ -53,12 +53,12 @@ function apiKanjiFind(text, optionsContext) { return _apiInvoke('kanjiFind', {text, optionsContext}); } -function apiDefinitionAdd(definition, mode, details, optionsContext) { - return _apiInvoke('definitionAdd', {definition, mode, details, optionsContext}); +function apiDefinitionAdd(definition, mode, context, details, optionsContext) { + return _apiInvoke('definitionAdd', {definition, mode, context, details, optionsContext}); } -function apiDefinitionsAddable(definitions, modes, optionsContext) { - return _apiInvoke('definitionsAddable', {definitions, modes, optionsContext}); +function apiDefinitionsAddable(definitions, modes, context, optionsContext) { + return _apiInvoke('definitionsAddable', {definitions, modes, context, optionsContext}); } function apiNoteView(noteId) { diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 8587657f..ecf92013 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -760,7 +760,7 @@ class Display { } } - const noteId = await apiDefinitionAdd(definition, mode, details, this.getOptionsContext()); + const noteId = await apiDefinitionAdd(definition, mode, this._getNoteContext(), details, this.getOptionsContext()); if (noteId) { const index = this.definitions.indexOf(definition); const adderButton = this.adderButtonFind(index, mode); @@ -908,7 +908,7 @@ class Display { async getDefinitionsAddable(definitions, modes) { try { - return await apiDefinitionsAddable(definitions, modes, this.getOptionsContext()); + return await apiDefinitionsAddable(definitions, modes, this._getNoteContext(), this.getOptionsContext()); } catch (e) { return []; } @@ -934,6 +934,10 @@ class Display { return (typeof key === 'string' ? (key.length === 1 ? key.toUpperCase() : key) : ''); } + _getNoteContext() { + return {}; + } + async _getAudioUri(definition, source) { const optionsContext = this.getOptionsContext(); return await apiAudioGetUri(definition, source, optionsContext); |