Skip to content

Commit

Permalink
Update: From ckeditor4 4.17.0 to ckeditor5 42.0.0 (fixes #2772)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverfoster committed Jul 9, 2024
1 parent 6e2e738 commit 9e6b69f
Show file tree
Hide file tree
Showing 2 changed files with 193 additions and 18 deletions.
55 changes: 38 additions & 17 deletions frontend/src/modules/scaffold/backboneFormsOverrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ define([
}

until(isAttached(this.$el)).then(function() {
this.editor = CKEDITOR.replace(this.$el[0], {
this.editor = CKEDITOR.create(this.$el[0], {
dataIndentationChars: '',
disableNativeSpellChecker: false,
enterMode: CKEDITOR[Origin.constants.ckEditorEnterMode],
Expand All @@ -112,24 +112,45 @@ define([
elements.forEach(function(element) { writer.setRules(element, rules); });
}
},
toolbar: [
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ], items: [ 'Source', '-', 'ShowBlocks' ] },
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ], items: [ 'Find', 'Replace', '-', 'SelectAll' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv' ] },
{ name: 'direction', items: [ 'BidiLtr', 'BidiRtl' ] },
'/',
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'] },
{ name: 'styles', items: [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ] },
{ name: 'links', items: [ 'Link', 'Unlink' ] },
{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },
{ name: 'insert', items: [ 'SpecialChar', 'Table' ] },
{ name: 'tools', items: [] },
{ name: 'others', items: [ '-' ] }
]
plugins: window.CKEDITOR.pluginsConfig,
toolbar: {
items: [
'sourceEditing',
'showBlocks',
'undo',
'redo',
'|',
'findAndReplace',
'selectAll',
'|',
'numberedList',
'bulletedList',
'blockQuote',
'indent',
'outdent',
'|',
'heading',
'|',
'bold',
'italic',
'underline',
'strikethrough',
'subscript',
'superscript',
'alignment',
'removeFormat',
'|',
'link',
'fontColor',
'fontBackgroundColor',
'|',
'specialCharacters',
'insertTable'
],
shouldNotGroupWhenFull: true
}
});
}.bind(this));

return this;
};

Expand Down
156 changes: 155 additions & 1 deletion routes/index/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<link rel="stylesheet" href="css/adapt.css" />
<link rel="stylesheet" href="font-awesome-4.5.0/css/font-awesome.min.css">
<script type="text/javascript" src="modernizr.js"></script>
<script src="//cdn.ckeditor.com/4.17.0/full-all/ckeditor.js"></script>
<link rel="stylesheet" href="https://cdn.ckeditor.com/ckeditor5/42.0.0/ckeditor5.css">
{{#if isProduction}}
<script type="text/javascript" src="require.js" data-main="js/origin.js{{#if dateStampAsString}}?{{dateStampAsString}}{{/if}}"></script>
{{else}}
Expand Down Expand Up @@ -47,5 +47,159 @@
</div>
</div>
</div>
<script type="importmap">
{
"imports": {
"ckeditor5": "https://cdn.ckeditor.com/ckeditor5/42.0.0/ckeditor5.js",
"ckeditor5/": "https://cdn.ckeditor.com/ckeditor5/42.0.0/"
}
}
</script>
<script type="module">
import {
ClassicEditor,
AccessibilityHelp,
Alignment,
Autoformat,
AutoImage,
AutoLink,
Autosave,
BalloonToolbar,
BlockQuote,
BlockToolbar,
Bold,
CKBox,
CKBoxImageEdit,
Clipboard,
CloudServices,
Code,
CodeBlock,
Essentials,
FindAndReplace,
Font,
Heading,
Highlight,
HorizontalLine,
HtmlEmbed,
ImageBlock,
ImageCaption,
ImageInline,
ImageInsert,
ImageInsertViaUrl,
ImageResize,
ImageStyle,
ImageTextAlternative,
ImageToolbar,
ImageUpload,
Indent,
IndentBlock,
Italic,
Link,
LinkImage,
List,
ListProperties,
MediaEmbed,
Mention,
Paragraph,
PasteFromOffice,
PictureEditing,
RemoveFormat,
SelectAll,
ShowBlocks,
SourceEditing,
SpecialCharacters,
SpecialCharactersArrows,
SpecialCharactersCurrency,
SpecialCharactersEssentials,
SpecialCharactersLatin,
SpecialCharactersMathematical,
SpecialCharactersText,
Strikethrough,
Subscript,
Superscript,
Table,
TableCellProperties,
TableProperties,
TableToolbar,
TextTransformation,
TodoList,
Underline,
Undo
} from 'ckeditor5';
window.CKEDITOR = ClassicEditor
window.CKEDITOR.pluginsConfig = [
AccessibilityHelp,
Alignment,
Autoformat,
AutoImage,
AutoLink,
Autosave,
BalloonToolbar,
BlockQuote,
BlockToolbar,
Bold,
CKBox,
CKBoxImageEdit,
Clipboard,
CloudServices,
Code,
CodeBlock,
Essentials,
FindAndReplace,
Font,
Heading,
Highlight,
HorizontalLine,
HtmlEmbed,
ImageBlock,
ImageCaption,
ImageInline,
ImageInsert,
ImageInsertViaUrl,
ImageResize,
ImageStyle,
ImageTextAlternative,
ImageToolbar,
ImageUpload,
Indent,
IndentBlock,
Italic,
Link,
LinkImage,
List,
ListProperties,
MediaEmbed,
Mention,
Paragraph,
PasteFromOffice,
PictureEditing,
RemoveFormat,
SelectAll,
ShowBlocks,
SourceEditing,
SpecialCharacters,
SpecialCharactersArrows,
SpecialCharactersCurrency,
SpecialCharactersEssentials,
SpecialCharactersLatin,
SpecialCharactersMathematical,
SpecialCharactersText,
Strikethrough,
Subscript,
Superscript,
Table,
TableCellProperties,
TableProperties,
TableToolbar,
TextTransformation,
TodoList,
Underline,
Undo
];
</script>
<script>
</script>
</body>
</html>

0 comments on commit 9e6b69f

Please sign in to comment.