Set text to empty string when null is passed as argument (#5560)

This commit is contained in:
Simon Cossar 2018-02-05 12:05:32 -08:00 committed by Sam
parent c48761c628
commit e3de396091
1 changed files with 5 additions and 4 deletions

View File

@ -2,11 +2,12 @@ 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>`;
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 text;
return content;
}
export default registerUnbound('dir-span', function(str) {