mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
14 lines
437 B
JavaScript
14 lines
437 B
JavaScript
import { registerUnbound } from "discourse-common/lib/helpers";
|
|
import { isRTL } from 'discourse/lib/text-direction';
|
|
|
|
function setDir(text) {
|
|
if (Discourse.SiteSettings.support_mixed_text_direction) {
|
|
let textDir = isRTL(text) ? 'rtl' : 'ltr';
|
|
return `<span dir="${textDir}">${text}</span>`;
|
|
}
|
|
return text;
|
|
}
|
|
|
|
export default registerUnbound('dir-span', function(str) {
|
|
return new Handlebars.SafeString(setDir(str));
|
|
});
|