FIX: handle topic/post creation when the language highlighting is turned off

This commit is contained in:
Arpit Jalan 2015-11-21 00:50:44 +05:30
parent 1bf2b236cb
commit e25ee74209
3 changed files with 2 additions and 6 deletions

View file

@ -12,7 +12,7 @@ function init() {
}
}
if (Discourse.SiteSettings && Discourse.SiteSettings.highlighted_languages) {
if (Discourse.SiteSettings) {
init();
} else {
Discourse.initializer({initialize: init, name: 'load-acceptable-code-classes'});
@ -38,7 +38,7 @@ Discourse.Dialect.replaceBlock({
var klass = Discourse.SiteSettings.default_code_lang;
if (matches[1] && acceptableCodeClasses.indexOf(matches[1]) !== -1) {
if (acceptableCodeClasses && matches[1] && acceptableCodeClasses.indexOf(matches[1]) !== -1) {
klass = matches[1];
}
@ -79,4 +79,3 @@ Discourse.Dialect.on('parseNode', function (event) {
node[node.length-1] = Handlebars.Utils.escapeExpression(contents.replace(regexp,''));
}
});

View file

@ -49,4 +49,3 @@ if (Discourse.SiteSettings) {
} else {
Discourse.initializer({initialize: init, name: 'enable-html-tables'});
}

View file

@ -167,5 +167,3 @@ test("quotes with trailing formatting", function() {
"<div class=\"quote-controls\"></div>EvilTrout:</div><blockquote><p>hello</p></blockquote></aside>\n\n<p><em>Test</em></p>",
"it allows trailing formatting");
});