Fetching text from editor no longer toggles view
authorAlexander Ebert <ebert@woltlab.com>
Mon, 30 Jun 2014 19:41:24 +0000 (21:41 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 30 Jun 2014 19:41:24 +0000 (21:41 +0200)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js

index db311e4fd0d6044479d28882d7ed58c4ec07ec4b..194154397b8863afdd97bc56830c48870544f0bc 100644 (file)
@@ -148,12 +148,7 @@ RedactorPlugins.wutil = {
         */
        getText: function() {
                if (this.inWysiwygMode()) {
-                       this.toggle();
-                       
-                       var $content = this.$source.val();
-                       
-                       this.toggle();
-                       return $content;
+                       this.wSync();
                }
                
                return this.$source.val();
@@ -164,13 +159,7 @@ RedactorPlugins.wutil = {
         */
        submit: function() {
                if (this.inWysiwygMode()) {
-                       this.toggle();
-                       
-                       var $content = this.$source.val();
-                       
-                       this.toggle();
-                       
-                       this.$source.val($content);
+                       this.wSync();
                }
                
                this.autosavePurge();
@@ -308,4 +297,11 @@ RedactorPlugins.wutil = {
                
                return $string;
        },
+       
+       /**
+        * Synchronizes editor's source textarea.
+        */
+       wSync: function() {
+               this.$source.val(this.cleanHtml(this.$source.val()));
+       }
 };