From 87524b48491047251512e29aa2a825cae00f6c39 Mon Sep 17 00:00:00 2001
From: Henning Leutz <leutz@pcsg.de>
Date: Mon, 24 Mar 2014 14:15:17 +0100
Subject: [PATCH] toolbar read

---
 bin/Editor.js | 64 +++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 52 insertions(+), 12 deletions(-)

diff --git a/bin/Editor.js b/bin/Editor.js
index eb6f6ce..02915b6 100644
--- a/bin/Editor.js
+++ b/bin/Editor.js
@@ -114,19 +114,59 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
                 ev = self.$linkDialog( ev );
             });
 
+            Editor.getManager().getToolbar(function(buttons)
+            {
+                // parse the buttons for the ckeditor
+                var b, g, i, len, blen, glen, group, items,
+                    buttonEntry, lineEntry, groupEntry;
+
+                var lines   = buttons.lines,
+                    toolbar = [];
+
+                for ( i = 0, len = lines.length; i < len; i++ )
+                {
+                    items     = [];
+                    lineEntry = lines[ i ];
+
+                    // groups
+                    for ( g = 0, glen = lineEntry.length; g < glen; g++ )
+                    {
+                        group      = [];
+                        groupEntry = lineEntry[ g ];
+
+                        // buttons
+                        for ( b = 0, blen = groupEntry.length; b < blen; b++ )
+                        {
+                            buttonEntry = groupEntry[ b ];
+
+                            if ( buttonEntry.type == 'seperator' )
+                            {
+                                group.push( '-' );
+                                continue;
+                            }
 
-            window.CKEDITOR.replace(instance, {
-                language     : Locale.getCurrent(),
-                baseHref     : URL_DIR,
-                basePath     : URL_DIR,
-                height       : Instance.getSize().y - 140,
-                width        : Instance.getSize().x + 20,
-                // toolbar      : CKEDITOR_NEXGAM_TOOLBAR,
-                // contentsCss  : CKEDITOR_NEXGAM_CSS,
-                // bodyClass    : CKEDITOR_NEXGAM_BODY_CLASS,
-                // plugins      : CKEDITOR_NEXGAM_PLUGINS,
-                // templates_files : [URL_OPT_DIR +'base/bin/pcsgEditorPlugins/templates.php'],
-                baseFloatZIndex : 100
+                            group.push( buttonEntry.button );
+                        }
+
+                        toolbar.push( group );
+                    }
+
+                    toolbar.push( '/' );
+                }
+
+                window.CKEDITOR.replace(instance, {
+                    language     : Locale.getCurrent(),
+                    baseHref     : URL_DIR,
+                    basePath     : URL_DIR,
+                    height       : Instance.getSize().y - 140,
+                    width        : Instance.getSize().x + 20,
+                    toolbar      : toolbar,
+                    // contentsCss  : CKEDITOR_NEXGAM_CSS,
+                    // bodyClass    : CKEDITOR_NEXGAM_BODY_CLASS,
+                    // plugins      : CKEDITOR_NEXGAM_PLUGINS,
+                    // templates_files : [URL_OPT_DIR +'base/bin/pcsgEditorPlugins/templates.php'],
+                    baseFloatZIndex : 100
+                });
             });
         },
 
-- 
GitLab