Force sync on unload, otherwise back navigation breaks everything
authorAlexander Ebert <ebert@woltlab.com>
Wed, 1 Jul 2015 13:06:18 +0000 (15:06 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 1 Jul 2015 13:06:18 +0000 (15:06 +0200)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js

index 77219f87f085b5f9f3cc75ee7c344bb78be9e231..2449b85dd150e109c013ab352d63593387637e86 100644 (file)
@@ -20,10 +20,16 @@ RedactorPlugins.wbbcode = function() {
                        var $identifier = this.$textarea.wcfIdentify();
                        
                        this.opts.initCallback = (function() {
+                               window.addEventListener('unload', (function(event) {
+                                       this.code.startSync();
+                                       
+                                       this.$textarea.val(this.wbbcode.convertFromHtml(this.$textarea.val()));
+                               }).bind(this));
+                               
                                if ($.browser.msie) {
                                        this.$editor.addClass('msie');
                                }
-                               
+                               this.$textarea[0].setAttribute('data-is-dirty', true);
                                // use stored editor contents
                                var $content = $.trim(this.wutil.getOption('woltlab.originalValue'));
                                if ($content.length) {