From 78c7caf5e50ddc73518a50ab1107752bfc1e6ba3 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 1 Jul 2015 15:06:18 +0200 Subject: [PATCH] Force sync on unload, otherwise back navigation breaks everything --- .../install/files/js/3rdParty/redactor/plugins/wbbcode.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js index 77219f87f0..2449b85dd1 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js @@ -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) { -- 2.20.1