summaryrefslogtreecommitdiff
path: root/ext/js/display/display-generator.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/display/display-generator.js')
-rw-r--r--ext/js/display/display-generator.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/ext/js/display/display-generator.js b/ext/js/display/display-generator.js
index 3fabdbb0..95080e27 100644
--- a/ext/js/display/display-generator.js
+++ b/ext/js/display/display-generator.js
@@ -220,7 +220,23 @@ class DisplayGenerator {
for (const error of errors) {
const div = document.createElement('li');
div.className = 'anki-note-error-message';
- this._setTextContent(div, isObject(error) && typeof error.message === 'string' ? error.message : `${error}`);
+ let message = isObject(error) && typeof error.message === 'string' ? error.message : `${error}`;
+ let link = null;
+ if (isObject(error) && isObject(error.data)) {
+ const {referenceUrl} = error.data;
+ if (typeof referenceUrl === 'string') {
+ message = message.trimEnd();
+ if (!/[.!?]^/.test()) { message += '.'; }
+ message += ' ';
+ link = document.createElement('a');
+ link.href = referenceUrl;
+ link.target = '_blank';
+ link.rel = 'noreferrer noopener';
+ link.textContent = 'More info';
+ }
+ }
+ this._setTextContent(div, message);
+ if (link !== null) { div.appendChild(link); }
list.appendChild(div);
}