mirror of
https://github.com/discourse/discourse.git
synced 2025-03-26 17:55:45 +08:00
UX: Standardize tag display in search menu results
This allows theme components (like discourse-tag-icons) to apply to tag results in search menu.
This commit is contained in:
parent
1e9d9d9346
commit
2ab6a68629
@ -6,6 +6,7 @@ import { h } from "virtual-dom";
|
|||||||
import highlightText from "discourse/lib/highlight-text";
|
import highlightText from "discourse/lib/highlight-text";
|
||||||
import { escapeExpression, formatUsername } from "discourse/lib/utilities";
|
import { escapeExpression, formatUsername } from "discourse/lib/utilities";
|
||||||
import { iconNode } from "discourse-common/lib/icon-library";
|
import { iconNode } from "discourse-common/lib/icon-library";
|
||||||
|
import renderTag from "discourse/lib/render-tag";
|
||||||
|
|
||||||
class Highlighted extends RawHtml {
|
class Highlighted extends RawHtml {
|
||||||
constructor(html, term) {
|
constructor(html, term) {
|
||||||
@ -70,13 +71,7 @@ createSearchResult({
|
|||||||
linkField: "url",
|
linkField: "url",
|
||||||
builder(t) {
|
builder(t) {
|
||||||
const tag = escapeExpression(t.id);
|
const tag = escapeExpression(t.id);
|
||||||
return h(
|
return new RawHtml({ html: renderTag(tag, { tagName: "span" }) });
|
||||||
"span",
|
|
||||||
{
|
|
||||||
className: `tag-${tag} discourse-tag ${Discourse.SiteSettings.tag_style}`
|
|
||||||
},
|
|
||||||
tag
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user