1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
|
/* ckeditor official */
import Alignment from '@ckeditor/ckeditor5-alignment/src/alignment';
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 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';
import FileRepository from '@ckeditor/ckeditor5-upload/src/filerepository';
import FindAndReplace from '@ckeditor/ckeditor5-find-and-replace/src/findandreplace';
import FontBackgroundColor from '@ckeditor/ckeditor5-font/src/fontbackgroundcolor.js';
import FontColor from '@ckeditor/ckeditor5-font/src/fontcolor.js';
import GeneralHtmlSupport from '@ckeditor/ckeditor5-html-support/src/generalhtmlsupport';
import HeadingPlugin from '@ckeditor/ckeditor5-heading/src/heading';
import HorizontalLine from '@ckeditor/ckeditor5-horizontal-line/src/horizontalline';
import HtmlComment from '@ckeditor/ckeditor5-html-support/src/htmlcomment';
import ImagePlugin from '@ckeditor/ckeditor5-image/src/image';
import ImageUploadPlugin from '@ckeditor/ckeditor5-image/src/imageupload';
import ImageCaptionPlugin from '@ckeditor/ckeditor5-image/src/imagecaption';
import ImageResizePlugin from '@ckeditor/ckeditor5-image/src/imageresize';
import ImageStylePlugin from '@ckeditor/ckeditor5-image/src/imagestyle';
import ImageToolbarPlugin from '@ckeditor/ckeditor5-image/src/imagetoolbar';
import Indent from '@ckeditor/ckeditor5-indent/src/indent';
import IndentBlock from '@ckeditor/ckeditor5-indent/src/indentblock';
import ItalicPlugin from '@ckeditor/ckeditor5-basic-styles/src/italic';
import LanguageDe from '@ckeditor/ckeditor5-build-classic/build/translations/de.js';
import LinkPlugin from '@ckeditor/ckeditor5-link/src/link';
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 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';
import SpecialCharactersEssentials from '@ckeditor/ckeditor5-special-characters/src/specialcharactersessentials.js';
import SpecialCharactersLatin from '@ckeditor/ckeditor5-special-characters/src/specialcharacterslatin.js';
import SpecialCharactersMathematical from '@ckeditor/ckeditor5-special-characters/src/specialcharactersmathematical.js';
import SpecialCharactersText from '@ckeditor/ckeditor5-special-characters/src/specialcharacterstext.js';
import Strikethrough from '@ckeditor/ckeditor5-basic-styles/src/strikethrough.js';
import Subscript from '@ckeditor/ckeditor5-basic-styles/src/subscript.js';
import Superscript from '@ckeditor/ckeditor5-basic-styles/src/superscript.js';
import Table from '@ckeditor/ckeditor5-table/src/table.js';
import TableCaption from '@ckeditor/ckeditor5-table/src/tablecaption.js';
import TableCellProperties from '@ckeditor/ckeditor5-table/src/tablecellproperties';
import TableProperties from '@ckeditor/ckeditor5-table/src/tableproperties';
import TableToolbar from '@ckeditor/ckeditor5-table/src/tabletoolbar.js';
import TextTransformation from '@ckeditor/ckeditor5-typing/src/texttransformation';
import Underline from '@ckeditor/ckeditor5-basic-styles/src/underline.js';
/* ckeditor third party */
import Mathematics from 'ckeditor5-math/src/math';
/* ckeditor elan */
import StudipA11YDialog, { updateVoiceLabel } from '../cke/studip-a11y-dialog/a11y-dialog.js';
import StudipBlockQuote from '../cke/studip-quote/StudipBlockQuote.js';
import StudipUpload from '../cke/StudipUpload.js';
import StudipWikiLink from '../cke/wiki-link/wiki-link.js';
import SpecialCharactersSmiley from '../cke/special_characters/SpecialCharactersSmiley.js';
import SpecialCharactersGreek from '../cke/special_characters/SpecialCharactersGreek.js';
import '../../stylesheets/scss/studip-cke-ui.scss';
export default class ClassicEditor extends ClassicEditorBase {}
ClassicEditor.builtinPlugins = [
ImageUploadPlugin,
Alignment,
Autoformat,
BlockQuote,
BoldPlugin,
CodeBlock,
EssentialsPlugin,
FindAndReplace,
FontColor,
FontBackgroundColor,
GeneralHtmlSupport,
HeadingPlugin,
HorizontalLine,
HtmlComment,
ImageCaptionPlugin,
ImagePlugin,
ImageResizePlugin,
ImageStylePlugin,
ImageToolbarPlugin,
Indent,
IndentBlock,
ItalicPlugin,
LinkPlugin,
ListProperties,
Mathematics,
Paragraph,
RemoveFormat,
SourceEditing,
SpecialCharacters,
SpecialCharactersCurrency,
SpecialCharactersSmiley,
SpecialCharactersEssentials,
SpecialCharactersGreek,
SpecialCharactersLatin,
SpecialCharactersMathematical,
SpecialCharactersText,
Strikethrough,
StudipBlockQuote,
StudipUpload,
Subscript,
Superscript,
Table,
TableCaption,
TableCellProperties,
TableProperties,
TableToolbar,
TextTransformation,
Underline,
FileRepository,
StudipA11YDialog,
];
const customColorPalette = [
{ color: '#000000' },
{ color: '#6c737a' }, //75%
{ color: '#a7abaf' }, //45%
{ color: '#c4c7c9' }, //30%
{ color: '#ffffff', hasBorder: true },
{ color: '#cb1800' }, //red
{ color: '#f26e00' }, //pumpkin
{ color: '#ffbd33' }, //yellow
{ color: '#8bbd40' }, // apple green
{ color: '#00962d' }, //green
{ color: '#41afaa' }, //verdigris
{ color: '#a9b6cb' }, // blue 40%
{ color: '#28497c' }, // blue
{ color: '#bf5796' }, // mulberry
{ color: '#8656a2' }, // royal purple
];
ClassicEditor.defaultConfig = {
toolbar: {
items: [
'undo',
'redo',
'findAndReplace',
'|',
'bold',
'italic',
'underline',
'strikethrough',
'subscript',
'superscript',
'|',
'removeFormat',
'|',
'bulletedList',
'numberedList',
'|',
'outdent',
'indent',
'|',
'alignment:left',
'alignment:right',
'alignment:center',
'alignment:justify',
'-',
'heading',
'fontColor',
'fontBackgroundColor',
'|',
'link',
'insertTable',
'uploadImage',
'codeBlock',
'math',
'studip-wiki',
'specialCharacters',
'horizontalLine',
'|',
'insertBlockQuote',
'splitBlockQuote',
'removeBlockQuote',
'|',
'sourceEditing',
],
shouldNotGroupWhenFull: true,
},
fontColor: {
colors: customColorPalette,
},
fontBackgroundColor: {
colors: customColorPalette,
},
image: {
resizeOptions: [
{
name: 'resizeImage:original',
value: null,
icon: 'original'
},
{
name: 'resizeImage:25',
value: '25',
icon: 'small'
},
{
name: 'resizeImage:50',
value: '50',
icon: 'medium'
},
{
name: 'resizeImage:75',
value: '75',
icon: 'large'
}
],
toolbar: [
'resizeImage:25',
'resizeImage:50',
'resizeImage:75',
'resizeImage:original',
'|',
'imageStyle:inline',
'imageStyle:block',
'imageStyle:side',
'|',
'toggleImageCaption',
'imageTextAlternative',
],
},
heading: {
options: [
{ model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
{ model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' },
{ model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' },
{ model: 'heading3', view: 'h3', title: 'Heading 3', class: 'ck-heading_heading3' },
{ model: 'heading4', view: 'h4', title: 'Heading 4', class: 'ck-heading_heading4' },
{ model: 'heading5', view: 'h5', title: 'Heading 5', class: 'ck-heading_heading5' },
{ model: 'heading6', view: 'h6', title: 'Heading 6', class: 'ck-heading_heading6' },
],
},
table: {
contentToolbar: [
'toggleTableCaption',
'tableColumn',
'tableRow',
'mergeTableCells',
'tableCellProperties',
'tableProperties',
],
tableProperties: {
borderColors: customColorPalette,
backgroundColors: customColorPalette,
defaultProperties: {
alignment: 'left',
borderStyle: 'solid',
borderColor: '#666666',
borderWidth: '1px',
},
},
tableCellProperties: {
borderColors: customColorPalette,
backgroundColors: customColorPalette,
defaultProperties: {
borderStyle: 'solid',
borderColor: '#666666',
borderWidth: '1px',
},
},
},
typing: {
transformations: {
remove: ['quotes'],
},
},
list: {
properties: {
styles: true,
startIndex: true,
reversed: true,
},
},
math: {
engine: 'mathjax',
outputType: 'span',
},
link: {
defaultProtocol: 'https://',
},
language: 'de',
htmlSupport: {
allow: [
/* HTML features to allow */
{
name: 'div',
classes: 'author',
},
{
name: 'pre',
classes: 'usercode'
}
],
disallow: [
/* HTML features to disallow */
],
},
};
updateVoiceLabel();
|