From 0a2371708baafa34fc10f6bdacbbc8bb24dd9046 Mon Sep 17 00:00:00 2001
From: Ron Lucke <lucke@elan-ev.de>
Date: Fri, 21 Oct 2022 03:29:05 +0000
Subject: [PATCH] fix #1690

Closes #1690

Merge request studip/studip!1096
---
 package-lock.json                             |  1 -
 package.json                                  |  1 -
 .../assets/javascripts/chunks/wysiwyg.js      | 52 ++++++++-----------
 resources/assets/javascripts/lib/wysiwyg.js   |  5 ++
 .../assets/stylesheets/studip-cke-ui.css      |  7 +++
 5 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index 56161504844..814f67900fb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -32,7 +32,6 @@
                 "@ckeditor/ckeditor5-indent": "34.2.0",
                 "@ckeditor/ckeditor5-paragraph": "34.2.0",
                 "@ckeditor/ckeditor5-remove-format": "34.2.0",
-                "@ckeditor/ckeditor5-select-all": "34.2.0",
                 "@ckeditor/ckeditor5-source-editing": "34.2.0",
                 "@ckeditor/ckeditor5-special-characters": "34.2.0",
                 "@ckeditor/ckeditor5-table": "34.2.0",
diff --git a/package.json b/package.json
index 7d8898bebd5..cbd08e5e6c4 100644
--- a/package.json
+++ b/package.json
@@ -43,7 +43,6 @@
         "@ckeditor/ckeditor5-indent": "34.2.0",
         "@ckeditor/ckeditor5-paragraph": "34.2.0",
         "@ckeditor/ckeditor5-remove-format": "34.2.0",
-        "@ckeditor/ckeditor5-select-all": "34.2.0",
         "@ckeditor/ckeditor5-source-editing": "34.2.0",
         "@ckeditor/ckeditor5-special-characters": "34.2.0",
         "@ckeditor/ckeditor5-table": "34.2.0",
diff --git a/resources/assets/javascripts/chunks/wysiwyg.js b/resources/assets/javascripts/chunks/wysiwyg.js
index 2d1e7539d09..0fae3efc3ff 100644
--- a/resources/assets/javascripts/chunks/wysiwyg.js
+++ b/resources/assets/javascripts/chunks/wysiwyg.js
@@ -4,7 +4,6 @@ import Autoformat from '@ckeditor/ckeditor5-autoformat/src/autoformat';
 import BlockQuote from '@ckeditor/ckeditor5-block-quote/src/blockquote';
 import BoldPlugin from '@ckeditor/ckeditor5-basic-styles/src/bold';
 import ClassicEditorBase from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
-import Code from '@ckeditor/ckeditor5-basic-styles/src/code';
 import CodeBlock from '@ckeditor/ckeditor5-code-block/src/codeblock';
 import EasyImagePlugin from '@ckeditor/ckeditor5-easy-image/src/easyimage';
 import EssentialsPlugin from '@ckeditor/ckeditor5-essentials/src/essentials';
@@ -29,7 +28,6 @@ import List from '@ckeditor/ckeditor5-list/src/list';
 import ListProperties from '@ckeditor/ckeditor5-list/src/listproperties';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import RemoveFormat from '@ckeditor/ckeditor5-remove-format/src/removeformat.js';
-import SelectAll from '@ckeditor/ckeditor5-select-all/src/selectall';
 import SourceEditing from '@ckeditor/ckeditor5-source-editing/src/sourceediting';
 import SpecialCharacters from '@ckeditor/ckeditor5-special-characters/src/specialcharacters.js';
 import SpecialCharactersCurrency from '@ckeditor/ckeditor5-special-characters/src/specialcharacterscurrency.js';
@@ -66,7 +64,6 @@ ClassicEditor.builtinPlugins = [
     Autoformat,
     BlockQuote,
     BoldPlugin,
-    Code,
     CodeBlock,
     EssentialsPlugin,
     FindAndReplace,
@@ -87,7 +84,6 @@ ClassicEditor.builtinPlugins = [
     Mathematics,
     Paragraph,
     RemoveFormat,
-    SelectAll,
     SourceEditing,
     SpecialCharacters,
     SpecialCharactersCurrency,
@@ -138,25 +134,7 @@ ClassicEditor.defaultConfig = {
         items: [
             'undo',
             'redo',
-            '|',
             'findAndReplace',
-            'selectAll',
-            '|',
-            'specialCharacters',
-            'horizontalLine',
-            '|',
-            'insertBlockQuote',
-            'splitBlockQuote',
-            'removeBlockQuote',
-            '|',
-            'link',
-            'insertTable',
-            'uploadImage',
-            'codeBlock',
-            'math',
-            'studip-wiki',
-            '-',
-            'heading',
             '|',
             'bold',
             'italic',
@@ -164,24 +142,36 @@ ClassicEditor.defaultConfig = {
             'strikethrough',
             'subscript',
             'superscript',
-            'code',
+            '|',
             'removeFormat',
             '|',
-            'fontColor',
-            'fontBackgroundColor',
+            'bulletedList',
+            'numberedList',
+            '|',
+            'outdent',
+            'indent',
             '|',
             'alignment:left',
             'alignment:right',
             'alignment:center',
             'alignment:justify',
+            '-',
+            'heading',
+            'fontColor',
+            'fontBackgroundColor',
             '|',
-            'bulletedList',
-            'numberedList',
-            '|',
-            'outdent',
-            'indent',
+            'link',
+            'insertTable',
+            'uploadImage',
+            'codeBlock',
+            'math',
+            'studip-wiki',
+            'specialCharacters',
+            'horizontalLine',
             '|',
-            'open-a11y-dialog',
+            'insertBlockQuote',
+            'splitBlockQuote',
+            'removeBlockQuote',
             '|',
             'sourceEditing',
         ],
diff --git a/resources/assets/javascripts/lib/wysiwyg.js b/resources/assets/javascripts/lib/wysiwyg.js
index c14a0bf58e1..a1cb6bbc605 100644
--- a/resources/assets/javascripts/lib/wysiwyg.js
+++ b/resources/assets/javascripts/lib/wysiwyg.js
@@ -113,6 +113,11 @@ function replaceTextarea(textarea) {
             }
         });
 
+        const button = ckeditor.ui.view.toolbar.items.find( item => item.class === "ck-source-editing-button");
+        if (button) {
+            button.withText = false;
+        }
+
         // TODO: Kein updateSourceElement im SourceEditing-Modus
         //     $(ckeditor.container.$).on('blur', '.CodeMirror', function (event) {
         //         ckeditor.updateElement(); // also update in source mode
diff --git a/resources/assets/stylesheets/studip-cke-ui.css b/resources/assets/stylesheets/studip-cke-ui.css
index 8f27f8aac63..07e0d028e9c 100644
--- a/resources/assets/stylesheets/studip-cke-ui.css
+++ b/resources/assets/stylesheets/studip-cke-ui.css
@@ -74,6 +74,9 @@
 }
 
 /* buttons */
+.ck.ck-button, a.ck.ck-button {
+    font-size: 12px;
+}
 
 .ck.ck-button:hover {
     cursor: pointer;
@@ -212,6 +215,10 @@ a.ck.ck-button.ck-button_with-text.ck-dropdown__button:not(.ck-disabled):hover {
     display: none;
 }
 
+.ck.ck-button.ck-source-editing-button .ck.ck-button__label {
+    display: none;
+}
+
 /* links */
 .ck .ck-fake-link-selection,
 .ck .ck-link_selected {
-- 
GitLab