From 7a2ab866099edffaba471ad808593f67ee796b21 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Thu, 17 Mar 2022 19:01:59 -0400 Subject: Structured content links (#2089) * Update CSS to JSON converter to generalize the remove-property comment * Fix navigation not being updated when _clearContent is run * Add structured content schema for link tags * Add test links * Add external-link icon * Pass Display instance to DisplayContentManager * Update structured content generation * Update link styles --- .../sandbox/anki-template-renderer-content-manager.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'ext/js/templates/sandbox') diff --git a/ext/js/templates/sandbox/anki-template-renderer-content-manager.js b/ext/js/templates/sandbox/anki-template-renderer-content-manager.js index a2573e09..0dabd86e 100644 --- a/ext/js/templates/sandbox/anki-template-renderer-content-manager.js +++ b/ext/js/templates/sandbox/anki-template-renderer-content-manager.js @@ -69,4 +69,14 @@ class AnkiTemplateRendererContentManager { } this._onUnloadCallbacks = []; } + + /** + * Sets up attributes and events for a link element. + * @param {Element} element The link element. + * @param {string} href The URL. + * @param {boolean} internal Whether or not the URL is an internal or external link. + */ + prepareLink(element, href, internal) { + element.href = internal ? '#' : href; + } } -- cgit v1.2.3