mirror of
https://github.com/discourse/discourse.git
synced 2025-04-14 12:51:40 +08:00
DEV: Add default on encoding to dir-span (#14183)
This commit is contained in:
parent
ed688bec8c
commit
e50a5c0c73
@ -1,6 +1,7 @@
|
||||
import { helperContext, registerUnbound } from "discourse-common/lib/helpers";
|
||||
import { htmlSafe } from "@ember/template";
|
||||
import { isRTL } from "discourse/lib/text-direction";
|
||||
import { escapeExpression } from "discourse/lib/utilities";
|
||||
|
||||
function setDir(text) {
|
||||
let content = text ? text : "";
|
||||
@ -12,6 +13,7 @@ function setDir(text) {
|
||||
return content;
|
||||
}
|
||||
|
||||
export default registerUnbound("dir-span", function (str) {
|
||||
return htmlSafe(setDir(str));
|
||||
export default registerUnbound("dir-span", function (str, escapeText = true) {
|
||||
let text = escapeText ? escapeExpression(str) : str;
|
||||
return htmlSafe(setDir(text));
|
||||
});
|
||||
|
@ -8,7 +8,6 @@ import { ajax } from "discourse/lib/ajax";
|
||||
import { get } from "@ember/object";
|
||||
import { getOwner } from "discourse-common/lib/get-owner";
|
||||
import getURL from "discourse-common/lib/get-url";
|
||||
import { escapeExpression } from "discourse/lib/utilities";
|
||||
|
||||
const STAFF_GROUP_NAME = "staff";
|
||||
|
||||
@ -57,11 +56,6 @@ const Category = RestModel.extend({
|
||||
return { type: "category", id, category: this };
|
||||
},
|
||||
|
||||
@discourseComputed("name")
|
||||
escapeName(name) {
|
||||
return escapeExpression(name);
|
||||
},
|
||||
|
||||
@discourseComputed("parentCategory.ancestors")
|
||||
ancestors(parentAncestors) {
|
||||
return [...(parentAncestors || []), this];
|
||||
|
@ -4,7 +4,7 @@
|
||||
{{#if category.read_restricted}}
|
||||
{{d-icon lockIcon}}
|
||||
{{/if}}
|
||||
<span class="category-name">{{dir-span category.escapeName}}</span>
|
||||
<span class="category-name">{{dir-span category.name}}</span>
|
||||
</div>
|
||||
{{#if category.uploaded_logo.url}}
|
||||
{{cdn-img
|
||||
|
@ -5,7 +5,7 @@
|
||||
{{category-title-link category=category}}
|
||||
{{#if category.description_excerpt}}
|
||||
<div class="category-description">
|
||||
{{dir-span category.description_excerpt}}
|
||||
{{dir-span category.description_excerpt false}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if category.isGrandParent}}
|
||||
|
@ -4,7 +4,7 @@
|
||||
{{category-title-link tagName="h4" category=category}}
|
||||
{{#if category.description_excerpt}}
|
||||
<div class="category-description subcategory-description">
|
||||
{{dir-span category.description_excerpt}}
|
||||
{{dir-span category.description_excerpt false}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if category.subcategories}}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{{#if topic.hasExcerpt}}
|
||||
<a href="{{topic.url}}" class="topic-excerpt">
|
||||
{{dir-span topic.escapedExcerpt}}
|
||||
{{dir-span topic.escapedExcerpt false}}
|
||||
{{#if topic.excerptTruncated}}
|
||||
<span class="topic-excerpt-more">{{i18n 'read_more'}}</span>
|
||||
{{/if}}
|
||||
|
@ -11,7 +11,7 @@
|
||||
}}
|
||||
|
||||
{{#if category.description}}
|
||||
<p>{{dir-span category.description}}</p>
|
||||
<p>{{dir-span category.description false}}</p>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
</div>
|
||||
|
||||
{{#if shouldDisplayDescription}}
|
||||
<div class="category-desc" aria-hidden="true">{{dir-span description}}</div>
|
||||
<div class="category-desc" aria-hidden="true">{{dir-span description false}}</div>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{html-safe label}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user