Last active
June 19, 2018 20:17
-
-
Save sebkln/116041fb6353c55bc29c8294591cab21 to your computer and use it in GitHub Desktop.
Custom CKEditor configuration including linebreak plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load default processing options | |
imports: | |
- { resource: "EXT:rte_ckeditor/Configuration/RTE/Processing.yaml" } | |
- { resource: "EXT:rte_ckeditor/Configuration/RTE/Editor/Base.yaml" } | |
- { resource: "EXT:rte_ckeditor/Configuration/RTE/Editor/Plugins.yaml" } | |
# Add configuration for the editor | |
# For complete documentation see http://docs.ckeditor.com/#!/api/CKEDITOR.config | |
editor: | |
externalPlugins: | |
linebreak: | |
resource: "EXT:basetemplate8/Resources/Public/JavaScript/Plugins/linebreak/plugin.js" | |
config: | |
extraAllowedContent: "*(*)[data-*]; span(shy)" | |
# The default styles for the editor. You can add your custom styles here. | |
contentsCss: ["EXT:rte_ckeditor/Resources/Public/Css/contents.css", "EXT:basetemplate8/Resources/Public/Css/rte_ckeditor.css"] | |
stylesSet: | |
# Alignment styles: | |
- { name: "LLL:EXT:basetemplate8/Resources/Private/Language/rte.xlf:styles.align.left", element: ['h1', 'h2', 'h3', 'h4','h5', 'h6', 'p', 'td', 'th'], attributes: { 'class': 'text-left' }} | |
- { name: "LLL:EXT:basetemplate8/Resources/Private/Language/rte.xlf:styles.align.center", element: ['h1', 'h2', 'h3', 'h4','h5', 'h6', 'p', 'td', 'th'], attributes: { 'class': 'text-center' }} | |
- { name: "LLL:EXT:basetemplate8/Resources/Private/Language/rte.xlf:styles.align.right", element: ['h1', 'h2', 'h3', 'h4','h5', 'h6', 'p', 'td', 'th'], attributes: { 'class': 'text-right' }} | |
- { name: "LLL:EXT:basetemplate8/Resources/Private/Language/rte.xlf:styles.align.justify", element: ['h1', 'h2', 'h3', 'h4','h5', 'h6', 'p', 'td', 'th'], attributes: { 'class': 'text-justify' }} | |
# Block level styles: | |
- { name: "LLL:EXT:basetemplate8/Resources/Private/Language/rte.xlf:styles.p.intro", element: "p", attributes: { 'class': 'intro' }} | |
- { name: 'LLL:EXT:basetemplate8/Resources/Private/Language/rte.xlf:styles.list.checkmark', element: 'ul', attributes: { 'class': 'list--checkmark' } } | |
# Inline styles: | |
- { name: "LLL:EXT:basetemplate8/Resources/Private/Language/rte.xlf:styles.a.btn", element: "a", attributes: { 'class': 'btn' } } | |
# Available block elements: | |
format_tags: "p;h1;h2;h3;h4;pre" | |
# Sort buttons: | |
toolbarGroups: | |
- { name: styles, groups: [ format, styles ] } | |
- { name: colors } | |
- { name: cleanup } | |
- { name: basicstyles } | |
- { name: align } | |
- { name: list } | |
- { name: links } | |
- { name: paragraph, groups: [ indent, blocks ] } | |
- { name: insert } | |
- { name: clipboard, groups: [ clipboard, undo ] } | |
- { name: table } | |
- { name: tabletools } | |
- { name: editing, groups: [ find, selection, spellchecker ] } | |
- { name: tools } | |
- { name: mode } | |
- { name: linebreak } | |
removeButtons: | |
- Anchor | |
- Underline | |
- Strike | |
- BGColor | |
justifyClasses: | |
- text-left | |
- text-center | |
- text-right | |
- text-justify | |
extraPlugins: | |
- justify | |
- specialchar | |
- showblocks | |
- colorbutton | |
- find | |
- linebreak | |
removePlugins: | |
- image | |
# colorbutton config: | |
colorButton_colorsPerRow: 8 | |
colorButton_colors: 'F26C4F,3A89C9,1B325F' | |
# Additional processing of tags inside the RTE: | |
processing: | |
allowTags: | |
- wbr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Allow <wbr> tag rendering in frontend: | |
lib.parseFunc.allowTags := addToList(wbr) | |
lib.parseFunc_RTE.allowTags := addToList(wbr) | |
// Remove any 'shy' classes from <span> elements: | |
lib.parseFunc_RTE.nonTypoTagStdWrap.HTMLparser.tags.span.fixAttrib.class.removeIfEquals = shy | |
// Remove all <span> elements which have no attribute: | |
lib.parseFunc_RTE.nonTypoTagStdWrap.HTMLparser.rmTagIfNoAttrib = span | |
// The same is needed for all occurrences inside lists: | |
lib.parseFunc_RTE.externalBlocks { | |
ul { | |
callRecursive = 1 | |
HTMLparser = 1 | |
HTMLparser.tags.span.fixAttrib.class.removeIfEquals = shy | |
HTMLparser.rmTagIfNoAttrib = span | |
} | |
ol < .ul | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment