From 03ae19a7946a5b82686811307c2d0a8e41401e45 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 9 Jul 2014 12:02:03 +0200 Subject: [PATCH] Fixed formatting issues on init during editing --- com.woltlab.wcf/templates/wysiwyg.tpl | 3 ++- .../install/files/js/3rdParty/redactor/plugins/wbbcode.js | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/com.woltlab.wcf/templates/wysiwyg.tpl b/com.woltlab.wcf/templates/wysiwyg.tpl index 94ec2e67fb..ded918779b 100644 --- a/com.woltlab.wcf/templates/wysiwyg.tpl +++ b/com.woltlab.wcf/templates/wysiwyg.tpl @@ -30,7 +30,8 @@ $(function() { active: ($autosave) ? true : false, key: ($autosave) ? '{@$__wcf->getAutosavePrefix()}_' + $autosave : '', saveOnInit: {if !$errorField|empty}true{else}false{/if} - } + }, + wOriginalValue: $textarea.val() }; {event name='javascriptInit'} diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js index 3d235e736e..c22207976d 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js @@ -13,10 +13,15 @@ RedactorPlugins.wbbcode = { */ init: function() { this.opts.initCallback = $.proxy(function() { - if (this.$source.val().length) { + // use stored editor contents + var $content = $.trim(this.getOption('wOriginalValue')); + if ($content.length) { this.toggle(); + this.$source.val($content); this.toggle(); } + + delete this.opts.wOriginalValue; }, this); this.opts.pasteBeforeCallback = $.proxy(this._wPasteBeforeCallback, this); -- 2.20.1