Added a few helper methods for Redactor
authorAlexander Ebert <ebert@woltlab.com>
Tue, 25 Mar 2014 16:37:48 +0000 (17:37 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 25 Mar 2014 16:37:48 +0000 (17:37 +0100)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js

index 8ac2ef4fb0faf62982db95406c2105475efa5612..a3aface7a7ee7a08c76262ba3482af205fe60906 100644 (file)
@@ -31,5 +31,30 @@ RedactorPlugins.wutil = {
                this.$source.val($content);
                
                return true;
+       },
+       
+       /**
+        * Sets an option value after initialization.
+        */
+       setOption: function(key, value) {
+               this.opts[key] = value;
+       },
+       
+       /**
+        * Returns true if editor is in source mode.
+        * 
+        * @return      boolean
+        */
+       inPlainMode: function() {
+               return !this.opts.visual;
+       },
+       
+       /**
+        * Returns true if editor is in WYSIWYG mode.
+        * 
+        * @return      boolean
+        */
+       inWysiwygMode: function() {
+               return (this.opts.visual);
        }
 };