CKEditor 5-帮助保留列表中的样式
我正在将CKEditor 5实现到我正在开发的网站中。我有一些现有的内容,其中包含一些我希望编辑器保留的样式。我已经阅读了不少教程和帖子,但似乎无法让它正常工作。希望有人能把我推向正确的方向 我正在编辑的HTML包含以下内容: 无编号 下面是我正在调用的函数。这是从保留字体大小的版本修改而来的CKEditor 5-帮助保留列表中的样式,ckeditor,ckeditor5,Ckeditor,Ckeditor5,我正在将CKEditor 5实现到我正在开发的网站中。我有一些现有的内容,其中包含一些我希望编辑器保留的样式。我已经阅读了不少教程和帖子,但似乎无法让它正常工作。希望有人能把我推向正确的方向 我正在编辑的HTML包含以下内容: 无编号 下面是我正在调用的函数。这是从保留字体大小的版本修改而来的 function TestListStyle( editor ) { editor.conversion.for( 'upcast' ).elementToAttr
function TestListStyle( editor ) {
editor.conversion.for( 'upcast' ).elementToAttribute( {
view: {
name: 'li',
styles: {
'list-style-type': /[\s\S]+/
}
},
model: {
key: 'listStyleType',
value: viewElement => {
const value = viewElement.getStyle( 'list-style-type' );
return value;
}
},
converterPriority: 'high'
} );
editor.conversion.for( 'downcast' ).attributeToElement( {
model: {
key: 'listStyleType'
},
view: ( modelValue, { writer: viewWriter } ) => {
return viewWriter.createAttributeElement( 'li', {
style: `list-style-type:${ modelValue }`
} );
},
converterPriority: 'high'
} );
}
当我尝试运行此命令时,我得到JavaScript TypeError无法读取null的“start”
我似乎想不出这么简单的事情。
感谢您的帮助