From: Alexander Ebert Date: Sun, 18 Jan 2015 11:08:07 +0000 (+0100) Subject: Fixed @@@wcf_empty_line@@@ appearing when wrapping text with a quote X-Git-Tag: 2.1.0_Beta_4~70 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ce826197d04861e72336028f129e6181f433bf14;p=GitHub%2FWoltLab%2FWCF.git Fixed @@@wcf_empty_line@@@ appearing when wrapping text with a quote --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js index 5d23b53442..abb0e8b164 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js @@ -10,6 +10,8 @@ if (!RedactorPlugins) var RedactorPlugins = {}; RedactorPlugins.wbbcode = function() { "use strict"; + var $skipOnSyncReplacementOnce = false; + return { /** * Initializes the RedactorPlugins.wbbcode plugin. @@ -41,10 +43,16 @@ RedactorPlugins.wbbcode = function() { this.opts.pasteCallback = $.proxy(this.wbbcode._pasteCallback, this); var $mpCleanOnSync = this.clean.onSync; - this.clean.onSync = function(html) { - html = html.replace(/

]+)?><\/p>/g, '

@@@wcf_empty_line@@@

'); - return $mpCleanOnSync.call(self, html); - }; + this.clean.onSync = (function(html) { + if ($skipOnSyncReplacementOnce === true) { + $skipOnSyncReplacementOnce = false; + } + else { + html = html.replace(/

]+)?><\/p>/g, '

@@@wcf_empty_line@@@

'); + } + + return $mpCleanOnSync.call(this, html); + }).bind(this); if (this.wutil.getOption('woltlab.autosaveOnce')) { this.wutil.saveTextToStorage(); @@ -1696,6 +1704,7 @@ RedactorPlugins.wbbcode = function() { var $link = WCF.String.escapeHTML($('#redactorQuoteLink').val()); this.selection.restore(); + $skipOnSyncReplacementOnce = true; var $html = this.selection.getHtml(); if (this.utils.isEmpty($html)) { $html = '';