From 2e5e4dbf1933d8a74bedd7f5d9217b5fb285d1d5 Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Fri, 27 Nov 2020 12:26:47 +0100 Subject: [PATCH] DEV: Make it easier to customize link attributes in quick access menu (#11365) This allows themes to customize link attributes: ``` api.reopenWidget("quick-access-item", { _linkAttributes(href) { const attributes = this._super(...arguments); // do stuff return attributes; } } ``` --- .../javascripts/discourse/app/widgets/quick-access-item.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/app/widgets/quick-access-item.js b/app/assets/javascripts/discourse/app/widgets/quick-access-item.js index fb2a1db1f5..f21fbf971b 100644 --- a/app/assets/javascripts/discourse/app/widgets/quick-access-item.js +++ b/app/assets/javascripts/discourse/app/widgets/quick-access-item.js @@ -44,7 +44,7 @@ createWidget("quick-access-item", { } } - return h("a", { attributes: { href } }, [ + return h("a", { attributes: this._linkAttributes(href) }, [ iconNode(icon), new RawHtml({ html: `
${this._usernameHtml()}${content}
`, @@ -60,6 +60,10 @@ createWidget("quick-access-item", { } }, + _linkAttributes(href) { + return { href }; + }, + _contentHtml() { const content = this.attrs.escapedContent || escapeExpression(this.attrs.content);