diff --git a/app/assets/javascripts/discourse/dialects/bbcode_dialect.js b/app/assets/javascripts/discourse/dialects/bbcode_dialect.js index a29b9c99eae..9cdb9de55be 100644 --- a/app/assets/javascripts/discourse/dialects/bbcode_dialect.js +++ b/app/assets/javascripts/discourse/dialects/bbcode_dialect.js @@ -78,23 +78,16 @@ Discourse.Dialect.inlineBetween({ emitter: function(contents) { return ['a', {href: contents, 'data-bbcode': true}, contents]; } }); - Discourse.Dialect.inlineBetween({ start: '[spoiler]', stop: '[/spoiler]', rawContents: true, emitter: function(contents) { - return ["__spoiler", this.processInline(contents)]; - } -}); - -Discourse.Dialect.replaceElement('__spoiler', function(node, processInside) { - // Surround images with a `
`, any other tags - // end up in a `span` - if (node.nodeType === 1 && node.nodeName === "IMG") { - return ['div', {class: 'spoiler'}, processInside(node)]; - } else { - return ['span', {class: 'spoiler'}, processInside(node)]; + if (/ 0) { - for (var i=0; i" + expected.replace(/'/g, "\"") + "

", text); + var cooked = Discourse.Markdown.cook(input, {lookupAvatar: false}); + equal(cooked, "

" + expected + "

", text); }; test('basic bbcode', function() { @@ -30,15 +30,8 @@ test('code', function() { }); test('spoiler', function() { - format("[spoiler][/spoiler]", "", "it can spoil nothing"); format("[spoiler]it's a sled[/spoiler]", "it's a sled", "supports spoiler tags on text"); - format("[spoiler][/spoiler]", "
", "supports spoiler tags on images"); - format("foo bar[spoiler]aaa bbb[/spoiler]", - "foo baraaa
bbb", - "It wraps images and text differently in the same block"); - format("[spoiler]hello[/spoiler]", - "hello", - "It surrounds other HTML"); + format("[spoiler][/spoiler]", "
", "supports spoiler tags on images"); }); test('lists', function() {