From ce826197d04861e72336028f129e6181f433bf14 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 18 Jan 2015 12:08:07 +0100 Subject: [PATCH] Fixed @@@wcf_empty_line@@@ appearing when wrapping text with a quote --- .../js/3rdParty/redactor/plugins/wbbcode.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) 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 = ''; -- 2.20.1