Skip to content

Commit 9e6b69f

Browse files
committed
Update: From ckeditor4 4.17.0 to ckeditor5 42.0.0 (fixes #2772)
1 parent 6e2e738 commit 9e6b69f

2 files changed

Lines changed: 193 additions & 18 deletions

File tree

frontend/src/modules/scaffold/backboneFormsOverrides.js

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ define([
8585
}
8686

8787
until(isAttached(this.$el)).then(function() {
88-
this.editor = CKEDITOR.replace(this.$el[0], {
88+
this.editor = CKEDITOR.create(this.$el[0], {
8989
dataIndentationChars: '',
9090
disableNativeSpellChecker: false,
9191
enterMode: CKEDITOR[Origin.constants.ckEditorEnterMode],
@@ -112,24 +112,45 @@ define([
112112
elements.forEach(function(element) { writer.setRules(element, rules); });
113113
}
114114
},
115-
toolbar: [
116-
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ], items: [ 'Source', '-', 'ShowBlocks' ] },
117-
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
118-
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ], items: [ 'Find', 'Replace', '-', 'SelectAll' ] },
119-
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv' ] },
120-
{ name: 'direction', items: [ 'BidiLtr', 'BidiRtl' ] },
121-
'/',
122-
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'] },
123-
{ name: 'styles', items: [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ] },
124-
{ name: 'links', items: [ 'Link', 'Unlink' ] },
125-
{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },
126-
{ name: 'insert', items: [ 'SpecialChar', 'Table' ] },
127-
{ name: 'tools', items: [] },
128-
{ name: 'others', items: [ '-' ] }
129-
]
115+
plugins: window.CKEDITOR.pluginsConfig,
116+
toolbar: {
117+
items: [
118+
'sourceEditing',
119+
'showBlocks',
120+
'undo',
121+
'redo',
122+
'|',
123+
'findAndReplace',
124+
'selectAll',
125+
'|',
126+
'numberedList',
127+
'bulletedList',
128+
'blockQuote',
129+
'indent',
130+
'outdent',
131+
'|',
132+
'heading',
133+
'|',
134+
'bold',
135+
'italic',
136+
'underline',
137+
'strikethrough',
138+
'subscript',
139+
'superscript',
140+
'alignment',
141+
'removeFormat',
142+
'|',
143+
'link',
144+
'fontColor',
145+
'fontBackgroundColor',
146+
'|',
147+
'specialCharacters',
148+
'insertTable'
149+
],
150+
shouldNotGroupWhenFull: true
151+
}
130152
});
131153
}.bind(this));
132-
133154
return this;
134155
};
135156

routes/index/index.hbs

Lines changed: 155 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<link rel="stylesheet" href="css/adapt.css" />
77
<link rel="stylesheet" href="font-awesome-4.5.0/css/font-awesome.min.css">
88
<script type="text/javascript" src="modernizr.js"></script>
9-
<script src="//cdn.ckeditor.com/4.17.0/full-all/ckeditor.js"></script>
9+
<link rel="stylesheet" href="https://cdn.ckeditor.com/ckeditor5/42.0.0/ckeditor5.css">
1010
{{#if isProduction}}
1111
<script type="text/javascript" src="require.js" data-main="js/origin.js{{#if dateStampAsString}}?{{dateStampAsString}}{{/if}}"></script>
1212
{{else}}
@@ -47,5 +47,159 @@
4747
</div>
4848
</div>
4949
</div>
50+
<script type="importmap">
51+
{
52+
"imports": {
53+
"ckeditor5": "https://cdn.ckeditor.com/ckeditor5/42.0.0/ckeditor5.js",
54+
"ckeditor5/": "https://cdn.ckeditor.com/ckeditor5/42.0.0/"
55+
}
56+
}
57+
</script>
58+
<script type="module">
59+
import {
60+
ClassicEditor,
61+
AccessibilityHelp,
62+
Alignment,
63+
Autoformat,
64+
AutoImage,
65+
AutoLink,
66+
Autosave,
67+
BalloonToolbar,
68+
BlockQuote,
69+
BlockToolbar,
70+
Bold,
71+
CKBox,
72+
CKBoxImageEdit,
73+
Clipboard,
74+
CloudServices,
75+
Code,
76+
CodeBlock,
77+
Essentials,
78+
FindAndReplace,
79+
Font,
80+
Heading,
81+
Highlight,
82+
HorizontalLine,
83+
HtmlEmbed,
84+
ImageBlock,
85+
ImageCaption,
86+
ImageInline,
87+
ImageInsert,
88+
ImageInsertViaUrl,
89+
ImageResize,
90+
ImageStyle,
91+
ImageTextAlternative,
92+
ImageToolbar,
93+
ImageUpload,
94+
Indent,
95+
IndentBlock,
96+
Italic,
97+
Link,
98+
LinkImage,
99+
List,
100+
ListProperties,
101+
MediaEmbed,
102+
Mention,
103+
Paragraph,
104+
PasteFromOffice,
105+
PictureEditing,
106+
RemoveFormat,
107+
SelectAll,
108+
ShowBlocks,
109+
SourceEditing,
110+
SpecialCharacters,
111+
SpecialCharactersArrows,
112+
SpecialCharactersCurrency,
113+
SpecialCharactersEssentials,
114+
SpecialCharactersLatin,
115+
SpecialCharactersMathematical,
116+
SpecialCharactersText,
117+
Strikethrough,
118+
Subscript,
119+
Superscript,
120+
Table,
121+
TableCellProperties,
122+
TableProperties,
123+
TableToolbar,
124+
TextTransformation,
125+
TodoList,
126+
Underline,
127+
Undo
128+
} from 'ckeditor5';
129+
130+
window.CKEDITOR = ClassicEditor
131+
window.CKEDITOR.pluginsConfig = [
132+
AccessibilityHelp,
133+
Alignment,
134+
Autoformat,
135+
AutoImage,
136+
AutoLink,
137+
Autosave,
138+
BalloonToolbar,
139+
BlockQuote,
140+
BlockToolbar,
141+
Bold,
142+
CKBox,
143+
CKBoxImageEdit,
144+
Clipboard,
145+
CloudServices,
146+
Code,
147+
CodeBlock,
148+
Essentials,
149+
FindAndReplace,
150+
Font,
151+
Heading,
152+
Highlight,
153+
HorizontalLine,
154+
HtmlEmbed,
155+
ImageBlock,
156+
ImageCaption,
157+
ImageInline,
158+
ImageInsert,
159+
ImageInsertViaUrl,
160+
ImageResize,
161+
ImageStyle,
162+
ImageTextAlternative,
163+
ImageToolbar,
164+
ImageUpload,
165+
Indent,
166+
IndentBlock,
167+
Italic,
168+
Link,
169+
LinkImage,
170+
List,
171+
ListProperties,
172+
MediaEmbed,
173+
Mention,
174+
Paragraph,
175+
PasteFromOffice,
176+
PictureEditing,
177+
RemoveFormat,
178+
SelectAll,
179+
ShowBlocks,
180+
SourceEditing,
181+
SpecialCharacters,
182+
SpecialCharactersArrows,
183+
SpecialCharactersCurrency,
184+
SpecialCharactersEssentials,
185+
SpecialCharactersLatin,
186+
SpecialCharactersMathematical,
187+
SpecialCharactersText,
188+
Strikethrough,
189+
Subscript,
190+
Superscript,
191+
Table,
192+
TableCellProperties,
193+
TableProperties,
194+
TableToolbar,
195+
TextTransformation,
196+
TodoList,
197+
Underline,
198+
Undo
199+
];
200+
</script>
201+
<script>
202+
203+
</script>
50204
</body>
51205
</html>

0 commit comments

Comments
 (0)