This pr replaces `{{{ }}}` usage by a {{html-safe}} helper. While it doesn't solve the underlying issue, it gives us a path forward without risking breaking too much existing behavior.
Also introduces an htmlSafe computed macro:
```
import { htmlSafe } from "discourse/lib/computed";
htmlDescription: htmlSafe("description")
```
Overtime {{html-safe}} usage should be removed and moved to components properties or specialized components/helpers.
17 lines
518 B
JavaScript
17 lines
518 B
JavaScript
import { registerUnbound } from "discourse-common/lib/helpers";
|
|
import { isRTL } from "discourse/lib/text-direction";
|
|
import { htmlSafe } from "@ember/template";
|
|
|
|
function setDir(text) {
|
|
let content = text ? text : "";
|
|
if (content && Discourse.SiteSettings.support_mixed_text_direction) {
|
|
let textDir = isRTL(content) ? "rtl" : "ltr";
|
|
return `<span dir="${textDir}">${content}</span>`;
|
|
}
|
|
return content;
|
|
}
|
|
|
|
export default registerUnbound("dir-span", function(str) {
|
|
return htmlSafe(setDir(str));
|
|
});
|