Fixed formatting issues on init during editing
authorAlexander Ebert <ebert@woltlab.com>
Wed, 9 Jul 2014 10:02:03 +0000 (12:02 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 9 Jul 2014 10:02:03 +0000 (12:02 +0200)
com.woltlab.wcf/templates/wysiwyg.tpl
wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js

index 94ec2e67fb9e8f86bbfd1cd24c34e448f5efa48b..ded918779b637a4627f616106419e3f84494421a 100644 (file)
@@ -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'}
index 3d235e736ea9af376dbef20553d51054d5b2f2e7..c22207976da188a48c726ce22910f5bcf1f3342e 100644 (file)
@@ -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);