aboutsummaryrefslogtreecommitdiff
path: root/ext/js/display
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/display')
-rw-r--r--ext/js/display/display.js33
1 files changed, 30 insertions, 3 deletions
diff --git a/ext/js/display/display.js b/ext/js/display/display.js
index 7ded1e09..3f56e081 100644
--- a/ext/js/display/display.js
+++ b/ext/js/display/display.js
@@ -757,9 +757,7 @@ class Display extends EventDispatcher {
_onDebugLogClick(e) {
const link = e.currentTarget;
const index = this._getClosestDefinitionIndex(link);
- if (index < 0 || index >= this._definitions.length) { return; }
- const definition = this._definitions[index];
- console.log(definition);
+ this._logDefinitionData(index);
}
_onDocumentElementMouseUp(e) {
@@ -1375,6 +1373,7 @@ class Display extends EventDispatcher {
}
_replaceHistoryStateNoNavigate(state, content) {
+ console.trace('_replaceHistoryStateNoNavigate', state);
const historyChangeIgnorePre = this._historyChangeIgnore;
try {
this._historyChangeIgnore = true;
@@ -1866,4 +1865,32 @@ class Display extends EventDispatcher {
const queryPostProcessor = this._queryPostProcessor;
return typeof queryPostProcessor === 'function' ? queryPostProcessor(query) : query;
}
+
+ async _logDefinitionData(index) {
+ if (index < 0 || index >= this._definitions.length) { return; }
+ const definition = this._definitions[index];
+ let ankiNoteData;
+ let ankiNoteDataException;
+ try {
+ const context = this._getNoteContext();
+ const {general: {resultOutputMode, glossaryLayoutMode, compactTags}} = this._options;
+ ankiNoteData = await this._ankiNoteBuilder.getRenderingData({
+ definition,
+ mode: 'test',
+ context,
+ resultOutputMode,
+ glossaryLayoutMode,
+ compactTags,
+ injectedMedia: null,
+ marker: 'test'
+ });
+ } catch (e) {
+ ankiNoteDataException = e;
+ }
+ const result = {definition, ankiNoteData};
+ if (typeof ankiNoteDataException !== 'undefined') {
+ result.ankiNoteDataException = ankiNoteDataException;
+ }
+ console.log(result);
+ }
}