11/**
22 * @author Alexander Ebert
3- * @copyright 2001-2023 WoltLab GmbH
3+ * @copyright 2001-2026 WoltLab GmbH
44 * @license LGPL-2.1-or-later
5- * @since 6.0
65 */
76
8- import { ImageInsertConfig } from "@ckeditor/ckeditor5-image/src/imageconfig" ;
7+ // These are the core styles of CKEditor5 that must be imported first and in
8+ // this exact order.
9+ import "@ckeditor/ckeditor5-ui/dist/index.css" ;
10+ import "@ckeditor/ckeditor5-clipboard/dist/index.css" ;
11+ import "@ckeditor/ckeditor5-core/dist/index.css" ;
12+ import "@ckeditor/ckeditor5-engine/dist/index.css" ;
13+ import "@ckeditor/ckeditor5-enter/dist/index.css" ;
14+ import "@ckeditor/ckeditor5-paragraph/dist/index.css" ;
15+ import "@ckeditor/ckeditor5-select-all/dist/index.css" ;
16+ import "@ckeditor/ckeditor5-typing/dist/index.css" ;
17+ import "@ckeditor/ckeditor5-undo/dist/index.css" ;
18+ import "@ckeditor/ckeditor5-upload/dist/index.css" ;
19+ import "@ckeditor/ckeditor5-utils/dist/index.css" ;
20+ import "@ckeditor/ckeditor5-watchdog/dist/index.css" ;
21+ import "@ckeditor/ckeditor5-widget/dist/index.css" ;
22+
23+ // CSS of plugins of CKEditor come first to allow us to customize them with out
24+ // own plugins that are imported through the `modules.ts`.
25+ import "@ckeditor/ckeditor5-alignment/dist/index.css" ;
26+ import "@ckeditor/ckeditor5-autosave/dist/index.css" ;
27+ import "@ckeditor/ckeditor5-basic-styles/dist/index.css" ;
28+ import "@ckeditor/ckeditor5-block-quote/dist/index.css" ;
29+ import "@ckeditor/ckeditor5-code-block/dist/index.css" ;
30+ import "@ckeditor/ckeditor5-editor-classic/dist/index.css" ;
31+ import "@ckeditor/ckeditor5-emoji/dist/index.css" ;
32+ import "@ckeditor/ckeditor5-essentials/dist/index.css" ;
33+ import "@ckeditor/ckeditor5-font/dist/index.css" ;
34+ import "@ckeditor/ckeditor5-heading/dist/index.css" ;
35+ import "@ckeditor/ckeditor5-highlight/dist/index.css" ;
36+ import "@ckeditor/ckeditor5-horizontal-line/dist/index.css" ;
37+ import "@ckeditor/ckeditor5-html-embed/dist/index.css" ;
38+ import "@ckeditor/ckeditor5-icons/dist/index.css" ;
39+ import "@ckeditor/ckeditor5-image/dist/index.css" ;
40+ import "@ckeditor/ckeditor5-link/dist/index.css" ;
41+ import "@ckeditor/ckeditor5-list/dist/index.css" ;
42+ import "@ckeditor/ckeditor5-markdown-gfm/dist/index.css" ;
43+ import "@ckeditor/ckeditor5-mention/dist/index.css" ;
44+ import "@ckeditor/ckeditor5-paste-from-office/dist/index.css" ;
45+ import "@ckeditor/ckeditor5-remove-format/dist/index.css" ;
46+ import "@ckeditor/ckeditor5-restricted-editing/dist/index.css" ;
47+ import "@ckeditor/ckeditor5-style/dist/index.css" ;
48+ import "@ckeditor/ckeditor5-table/dist/index.css" ;
49+
950import {
1051 Alignment ,
1152 Autosave ,
12- BasicStyles ,
1353 BlockQuote ,
54+ Bold ,
1455 ClassicEditor ,
56+ Code ,
1557 CodeBlock ,
16- Core ,
58+ EditorConfig ,
1759 Essentials ,
18- Font ,
60+ FontColor ,
61+ FontFamily ,
62+ FontSize ,
1963 Heading ,
2064 Highlight ,
2165 HorizontalLine ,
2266 HtmlEmbed ,
23- Icons ,
67+ IconObjectLeft ,
2468 Image ,
69+ ImageInsertConfig ,
70+ ImageInsertUI ,
71+ ImageInsertViaUrl ,
72+ ImageResizeEditing ,
73+ ImageResizeHandles ,
74+ ImageStyle ,
75+ ImageToolbar ,
76+ ImageUpload ,
77+ ImageUploadUI ,
2578 Indent ,
79+ Italic ,
2680 Link ,
81+ LinkImage ,
2782 List ,
2883 Mention ,
2984 Paragraph ,
3085 PasteFromOffice ,
3186 RemoveFormat ,
87+ Strikethrough ,
88+ Subscript ,
89+ Superscript ,
3290 Table ,
91+ TableToolbar ,
92+ Underline ,
3393 Undo ,
3494 WoltlabAttachment ,
3595 WoltlabAutoLink ,
@@ -52,52 +112,52 @@ import {
52112 WoltlabUpload ,
53113} from "./modules" ;
54114
55- const defaultConfig : Core . EditorConfig = {
115+ const defaultConfig : EditorConfig = {
56116 plugins : [
57117 // Internals
58- Autosave . Autosave ,
59- Essentials . Essentials ,
60- Indent . Indent ,
61- Mention . Mention ,
62- Paragraph . Paragraph ,
63- PasteFromOffice . PasteFromOffice ,
64- Undo . Undo ,
118+ Autosave ,
119+ Essentials ,
120+ Indent ,
121+ Mention ,
122+ Paragraph ,
123+ PasteFromOffice ,
124+ Undo ,
65125
66126 // Formatting
67- Alignment . Alignment ,
68- BasicStyles . Bold ,
69- BasicStyles . Code ,
70- Font . FontColor ,
71- Font . FontFamily ,
72- Font . FontSize ,
73- Heading . Heading ,
74- Highlight . Highlight ,
75- BasicStyles . Italic ,
76- RemoveFormat . RemoveFormat ,
77- BasicStyles . Strikethrough ,
78- BasicStyles . Subscript ,
79- BasicStyles . Superscript ,
80- BasicStyles . Underline ,
127+ Alignment ,
128+ Bold ,
129+ Code ,
130+ FontColor ,
131+ FontFamily ,
132+ FontSize ,
133+ Heading ,
134+ Highlight ,
135+ Italic ,
136+ RemoveFormat ,
137+ Strikethrough ,
138+ Subscript ,
139+ Superscript ,
140+ Underline ,
81141
82142 // Components
83- BlockQuote . BlockQuote ,
84- CodeBlock . CodeBlock ,
85- HtmlEmbed . HtmlEmbed ,
86- HorizontalLine . HorizontalLine ,
87- Image . Image ,
88- Image . ImageInsertUI ,
89- Image . ImageInsertViaUrl ,
90- Image . ImageToolbar ,
91- Image . ImageResizeEditing ,
92- Image . ImageResizeHandles ,
93- Image . ImageStyle ,
94- Image . ImageUpload ,
95- Image . ImageUploadUI ,
96- Link . Link ,
97- Link . LinkImage ,
98- List . List ,
99- Table . Table ,
100- Table . TableToolbar ,
143+ BlockQuote ,
144+ CodeBlock ,
145+ HtmlEmbed ,
146+ HorizontalLine ,
147+ Image ,
148+ ImageInsertUI ,
149+ ImageInsertViaUrl ,
150+ ImageToolbar ,
151+ ImageResizeEditing ,
152+ ImageResizeHandles ,
153+ ImageStyle ,
154+ ImageUpload ,
155+ ImageUploadUI ,
156+ Link ,
157+ LinkImage ,
158+ List ,
159+ Table ,
160+ TableToolbar ,
101161
102162 // WoltLab
103163 WoltlabAttachment . WoltlabAttachment ,
@@ -124,9 +184,10 @@ const defaultConfig: Core.EditorConfig = {
124184
125185export async function create (
126186 element : HTMLElement ,
127- configuration : Core . EditorConfig ,
128- ) : Promise < ClassicEditor . ClassicEditor > {
187+ configuration : EditorConfig ,
188+ ) : Promise < ClassicEditor > {
129189 configuration = Object . assign ( configuration , defaultConfig ) ;
190+ configuration . attachTo = element ;
130191
131192 const removePlugins = configuration . removePlugins || [ ] ;
132193 if ( ! removePlugins . includes ( "Image" ) ) {
@@ -153,7 +214,7 @@ export async function create(
153214 {
154215 name : "sideLeft" ,
155216 title : "Left aligned image" ,
156- icon : Icons . IconObjectLeft ,
217+ icon : IconObjectLeft ,
157218 modelElements : [ "imageBlock" ] ,
158219 className : "image-style-side-left" ,
159220 } ,
@@ -174,10 +235,7 @@ export async function create(
174235 } ;
175236 }
176237
177- const editor = await ClassicEditor . ClassicEditor . create (
178- element ,
179- configuration ,
180- ) ;
238+ const editor = await ClassicEditor . create ( configuration ) ;
181239
182240 return editor ;
183241}
0 commit comments