From: Alexander Ebert Date: Wed, 9 Jul 2014 10:02:03 +0000 (+0200) Subject: Fixed formatting issues on init during editing X-Git-Tag: 2.1.0_Alpha_1~568^2~10 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=03ae19a7946a5b82686811307c2d0a8e41401e45;p=GitHub%2FWoltLab%2FWCF.git Fixed formatting issues on init during editing --- 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);