Browse Source

Fix ckeditor toolbar see BT#15641

Julio Montoya 5 years ago
parent
commit
e270269608

+ 4 - 4
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Basic.php

@@ -243,9 +243,9 @@ class Basic extends Toolbar
             ['Link', 'Image', 'Video', 'Oembed', 'Flash', 'Youtube', 'Audio', 'Table', 'Asciimath', 'Asciisvg'],
             ['BulletedList', 'NumberedList', 'HorizontalRule'],
             ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
-            ['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'],
+            ['Styles', 'Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'],
             api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS'] : [''],
-            ['Toolbarswitch'],
+            ['Toolbarswitch', 'Source'],
         ];
     }
 
@@ -282,9 +282,9 @@ class Basic extends Toolbar
             ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'],
             [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
             ['Styles', 'Format', 'Font', 'FontSize'],
-            ['PageBreak', 'ShowBlocks', 'Source'],
+            ['PageBreak', 'ShowBlocks'],
             api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS'] : [''],
-            ['Toolbarswitch'],
+            ['Toolbarswitch', 'Source'],
         ];
     }
 }

+ 51 - 2
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Documents.php

@@ -25,6 +25,7 @@ class Documents extends Basic
             $config['toolbar'] = $this->getNormalToolbar();
         } else {
             $config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
+            $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
         }
 
         $config['extraPlugins'] = $this->getPluginsToString();
@@ -90,6 +91,55 @@ class Documents extends Basic
         ];
     }
 
+    /**
+     * @return array
+     */
+    protected function getMaximizedToolbar()
+    {
+        return [
+            $this->getNewPageBlock(),
+            ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', 'inserthtml'],
+            ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
+            ['Link', 'Unlink', 'Anchor', 'Glossary'],
+            [
+                'Image',
+                'Mapping',
+                'Video',
+                'Oembed',
+                'Flash',
+                'Youtube',
+                'Audio',
+                'leaflet',
+                'Smiley',
+                'SpecialChar',
+                'Asciimath',
+                'Asciisvg',
+            ],
+            '/',
+            ['Table', '-', 'CreateDiv'],
+            ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
+            [
+                'Bold',
+                'Italic',
+                'Underline',
+                'Strike',
+                '-',
+                'Subscript',
+                'Superscript',
+                '-',
+                'TextColor',
+                'BGColor',
+                api_get_configuration_value('translate_html') ? 'Language' : '',
+            ],
+            [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
+            ['Styles', 'Format', 'Font', 'FontSize'],
+            ['PageBreak', 'ShowBlocks'],
+            api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS'] : [''],
+            ['Toolbarswitch', 'Source'],
+        ];
+    }
+
     /**
      * Get the toolbar configuration when CKEditor is minimized.
      *
@@ -128,8 +178,7 @@ class Documents extends Basic
                 'ShowBlocks',
             ],
             api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS'] : [''],
-            ['Toolbarswitch'],
-            ['Source'],
+            ['Toolbarswitch', 'Source'],
         ];
     }
 }

+ 54 - 4
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/IntroductionSection.php

@@ -25,6 +25,7 @@ class IntroductionSection extends Basic
             $config['toolbar'] = $this->getNormalToolbar();
         } else {
             $config['toolbar_minToolbar'] = $this->getMinimizedToolbar();
+            $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar();
         }
 
         $config['extraPlugins'] = $this->getPluginsToString();
@@ -113,7 +114,8 @@ class IntroductionSection extends Basic
             ],
             ['BulletedList', 'NumberedList', 'HorizontalRule'],
             ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'],
-            ['Styles',
+            [
+                'Styles',
                 'Format',
                 'Font',
                 'FontSize',
@@ -122,14 +124,62 @@ class IntroductionSection extends Basic
                 'Underline',
                 'TextColor',
                 'BGColor',
+                api_get_configuration_value('translate_html') ? 'Language' : '',
             ],
             [
-                'Language',
                 'ShowBlocks',
             ],
             api_get_setting('enabled_wiris') === 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS'] : [''],
-            ['Toolbarswitch'],
-            ['Source'],
+            ['Toolbarswitch', 'Source'],
+        ];
+    }
+
+    /**
+     * @return array
+     */
+    protected function getMaximizedToolbar()
+    {
+        return [
+            $this->getNewPageBlock(),
+            ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', 'inserthtml'],
+            ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'],
+            ['Link', 'Unlink', 'Anchor', 'Glossary'],
+            [
+                'Image',
+                'Mapping',
+                'Video',
+                'Oembed',
+                'Flash',
+                'Youtube',
+                'Audio',
+                'leaflet',
+                'Smiley',
+                'SpecialChar',
+                'Asciimath',
+                'Asciisvg',
+            ],
+            '/',
+            ['Table', '-', 'CreateDiv'],
+            ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'],
+            ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
+            [
+                'Bold',
+                'Italic',
+                'Underline',
+                'Strike',
+                '-',
+                'Subscript',
+                'Superscript',
+                '-',
+                'TextColor',
+                'BGColor',
+                api_get_configuration_value('translate_html') ? 'Language' : '',
+            ],
+            [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
+            ['Styles', 'Format', 'Font', 'FontSize'],
+            ['PageBreak', 'ShowBlocks'],
+            api_get_setting('enabled_wiris') == 'true' ? ['ckeditor_wiris_formulaEditor', 'ckeditor_wiris_CAS'] : [''],
+            ['Toolbarswitch', 'Source'],
         ];
     }
 }

+ 2 - 4
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TestQuestionDescription.php

@@ -105,8 +105,7 @@ class TestQuestionDescription extends Basic
             [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''],
             ['Styles', 'Format', 'Font', 'FontSize'],
             ['PageBreak', 'ShowBlocks'],
-            ['Toolbarswitch'],
-            ['Source'],
+            ['Toolbarswitch', 'Source'],
         ];
     }
 
@@ -167,8 +166,7 @@ class TestQuestionDescription extends Basic
                 'BGColor',
                 api_get_configuration_value('translate_html') ? 'Language' : '',
             ],
-            ['Toolbarswitch'],
-            ['Source'],
+            ['Toolbarswitch', 'Source'],
         ];
     }
 }