我正在使用自定义构建
@ckeditor/[email protected]
heading : {
options: [
{
model : 'inlineParagraph',
view : 'span',
title : 'Inline Paragraph',
class : 'ck-heading_paragraph_inline',
converterPriority: 'highest'
},
{ model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
{ model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' },
{ model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' },
{ model: 'heading3', view: 'h3', title: 'Heading 3', class: 'ck-heading_heading3' },
{ model: 'heading4', view: 'h4', title: 'Heading 4', class: 'ck-heading_heading4' },
]
}
我希望当编辑器中没有文本时,
inlineParagraph
成为默认类型,默认情况下编辑器选择paragraph
。
我也尝试过这个:
heading : {
options: [
{
model : 'inlineParagraph',
view : 'span',
title : 'Inline Paragraph',
class : 'ck-heading_paragraph_inline',
converterPriority: 'highest'
},
{ model: 'paragraph', view: 'span', title: 'Paragraph', class: 'ck-heading_paragraph' },
{ model: 'div', title: 'Div', class: 'ck-heading_div' },
{ model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' },
{ model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' },
{ model: 'heading3', view: 'h3', title: 'Heading 3', class: 'ck-heading_heading3' },
{ model: 'heading4', view: 'h4', title: 'Heading 4', class: 'ck-heading_heading4' },
]
}
但随后它选择
div
作为默认值...我认为它默认为块级元素...但我想将其更改为像 span
这样的内联元素...
通过执行以下操作,我最终能够使其正常工作。这是 YAML 格式,因为我在 TYPO3 版本 12(内容管理系统)中配置 CKEditor 5,但您明白了。
editor:
config:
heading:
options:
- { model: 'heading1', view: { name: 'h1', classes: 'my-class' }, title: 'Heading 1' }