From 9597f5b75f8bb6e123ae9f72a1c109881dbd5be9 Mon Sep 17 00:00:00 2001
From: Henning Leutz <leutz@pcsg.de>
Date: Mon, 25 Aug 2014 10:10:07 +0200
Subject: [PATCH] focus method

---
 bin/Editor.js | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 67 insertions(+), 1 deletion(-)

diff --git a/bin/Editor.js b/bin/Editor.js
index 7f26be5..42d18ec 100644
--- a/bin/Editor.js
+++ b/bin/Editor.js
@@ -92,7 +92,7 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
                 ev = self.$linkDialog( ev );
             });
 
-            Editor.getManager().getToolbar(function(buttons)
+            this.getButtons(function(buttons)
             {
                 // parse the buttons for the ckeditor
                 var b, g, i, len, blen, glen, group, items,
@@ -262,6 +262,72 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
             }
         },
 
+        /**
+         * Set the focus to the editor
+         */
+        focus : function()
+        {
+            if ( this.getInstance() ) {
+                this.getInstance().focus();
+            }
+        },
+
+        /**
+         * Switch to source mode
+         */
+        switchToSource : function()
+        {
+            if ( this.getInstance() ) {
+                this.getInstance().setMode( 'source' );
+            }
+        },
+
+        /**
+         * Switch to wysiwyg editor
+         */
+        switchToWYSIWYG : function()
+        {
+            if ( this.getInstance() ) {
+                this.getInstance().setMode( 'wysiwyg' );
+            }
+        },
+
+        /**
+         * Hide the toolbar
+         */
+        hideToolbar : function()
+        {
+            var Toolbar = this.getElm().getElement( '.cke_top' );
+
+            if ( Toolbar ) {
+                Toolbar.setStyle( 'display', 'none' );
+            }
+        },
+
+        /**
+         * show the toolbar
+         */
+        showToolbar : function()
+        {
+            var Toolbar = this.getElm().getElement( '.cke_top' );
+
+            if ( Toolbar ) {
+                Toolbar.setStyle( 'display', null );
+            }
+        },
+
+        /**
+         * Set the height of the instance
+         *
+         * @param {Integer} height
+         */
+        setHeight : function(height)
+        {
+            if ( this.getInstance() ) {
+                this.getInstance().resize( false, height );
+            }
+        },
+
         /**
          *
          * @param {Object} params
-- 
GitLab