我正在为我的Symfony4项目使用FOSCKEditorBundle。安装过程进行顺利。基础配置(例如工具栏等)也不错。但是我正在尝试将自定义样式应用于某些html元素。这似乎行不通。也许我做错了...
这是我的配置:
fos_ck_editor:
input_sync: true
default_config: base_config
auto_inline: false
# Defines the different configs to apply them to the form fields
configs:
minimal_config:
toolbar: 'minimal_toolbar'
stylesSet: 'uikit'
base_config:
toolbar: 'base_toolbar'
stylesSet: 'uikit'
advanced_config:
toolbar: 'advanced_toolbar'
stylesSet: 'uikit'
# Defines the different toolbars to reuse them for the different configs
toolbars:
configs:
minimal_toolbar: ['@styles']
base_toolbar: ['@styles', '@link', '@lists']
advanced_toolbar: ['@styles', '@link', '@lists', '@indention', '@specials']
items:
styles: ['Bold', 'Italic']
link: ['Link', 'Unlink']
lists: ['BulletedList']
indention: ['Indent', 'Outdent']
specials: ['Table', 'Source', 'Format']
# Defines the custom styles for uikit
styles:
uikit:
- { name: "CSS Style", element: "table", attributes: { class: "uk-table" }}
- { name: "CSS Style", element: "table", attributes: { border: "0" }}
也许有人遇到同样的问题,可以为我提供帮助。
您写道:
这似乎不起作用
您确定它不起作用吗?从CKEditor4 official documentation:
注意,您的配置中有两次如果为对象[或图像添加了一些自定义样式定义,则您需要首先选择这些对象,然后才能应用样式。对象样式仅显示在“样式”下拉列表中,并且可以在编辑器中选择元素之后应用对象样式,如下图所示,当选择了表格时。
CSS Style
名称。如果要在CSS Style
条目上应用两个属性,建议您写[]- { name: "CSS Style", element: "table", attributes: { class: "uk-table", border: "0" }}