From e25ee74209d57caaae0e3706a079567769c3bb98 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Sat, 21 Nov 2015 00:50:44 +0530 Subject: [PATCH] FIX: handle topic/post creation when the language highlighting is turned off --- app/assets/javascripts/discourse/dialects/code_dialect.js | 5 ++--- app/assets/javascripts/discourse/dialects/table_dialect.js | 1 - test/javascripts/lib/bbcode-test.js.es6 | 2 -- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/discourse/dialects/code_dialect.js b/app/assets/javascripts/discourse/dialects/code_dialect.js index 2594cd831..9122abf6e 100644 --- a/app/assets/javascripts/discourse/dialects/code_dialect.js +++ b/app/assets/javascripts/discourse/dialects/code_dialect.js @@ -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,'')); } }); - diff --git a/app/assets/javascripts/discourse/dialects/table_dialect.js b/app/assets/javascripts/discourse/dialects/table_dialect.js index da9b2c2fc..4ddfd928b 100644 --- a/app/assets/javascripts/discourse/dialects/table_dialect.js +++ b/app/assets/javascripts/discourse/dialects/table_dialect.js @@ -49,4 +49,3 @@ if (Discourse.SiteSettings) { } else { Discourse.initializer({initialize: init, name: 'enable-html-tables'}); } - diff --git a/test/javascripts/lib/bbcode-test.js.es6 b/test/javascripts/lib/bbcode-test.js.es6 index c9b3ac3b7..ad26cc6c7 100644 --- a/test/javascripts/lib/bbcode-test.js.es6 +++ b/test/javascripts/lib/bbcode-test.js.es6 @@ -167,5 +167,3 @@ test("quotes with trailing formatting", function() { "
EvilTrout:

hello

\n\n

Test

", "it allows trailing formatting"); }); - -