From 66f8f81493c71eb283bdda0924020a9c95c2f4ef Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 13 Dec 2014 00:09:17 +0100 Subject: [PATCH] Fixed a few issues related to multi-line list items --- .../js/3rdParty/redactor/plugins/wbbcode.js | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js index 69f92204c6..1022034ec0 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js @@ -80,6 +80,14 @@ RedactorPlugins.wbbcode = function() { // fix button label for source toggling var $tooltip = $('.redactor-toolbar-tooltip-html:not(.jsWbbcode)').addClass('jsWbbcode').text(WCF.Language.get('wcf.bbcode.button.toggleBBCode')); + var $fixBR = function(editor) { + editor.find('br').each(function(index, br) { + if (br.children.length) { + $(br).empty(); + } + }); + }; + this.code.toggle = (function() { if (this.opts.visual) { this.code.startSync(); @@ -100,6 +108,7 @@ RedactorPlugins.wbbcode = function() { this.button.get('html').children('i').removeClass('fa-square').addClass('fa-square-o'); $tooltip.text(WCF.Language.get('wcf.bbcode.button.toggleBBCode')); + $fixBR(this.$editor); this.wutil.saveSelection(); } @@ -695,7 +704,7 @@ RedactorPlugins.wbbcode = function() { data = data.replace(/\[align=(left|right|center|justify)\]([\s\S]*?)\[\/align\]/gi,'
$2
'); // [*] - data = data.replace(/\[\*\](.*?)(?=\[\*\]|\[\/list\])/gi,'
  • $1
  • '); + data = data.replace(/\[\*\]([\s\S]*?)(?=\[\*\]|\[\/list\])/gi,'
  • $1
  • '); // [list] data = data.replace(/\[list\]/gi, '