CKeditor5 自定义配置Heading

位置:首页>文章>详情   分类: 教程分享 > WEB基础   阅读(1318)   2024-03-11 19:26:20

CKeditor无论那个版本,在我主要以文章编辑的时候,需要去掉默认的H1标签,所以需要自定义配置heading标签。同样CKeditor5 与之前的4版本有所不同。

CKeditor5自定义配置Heading

配置参考:

ClassicEditor
    .create( document.querySelector( '#contentHtml' ), {
        licenseKey: '',
        //heading
        heading: {
            options: [
                { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
                { 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' },
                { model: 'heading5', view: 'h5', title: 'Heading 5', class: 'ck-heading_heading5' },
                { model: 'heading6', view: 'h6', title: 'Heading 6', class: 'ck-heading_heading6' }
            ]
        }
    } )
    .then( editor => {
        editor.setData($('#cocntentScript').html());
        window.editor = editor;
    } )
    .catch( error => {
        console.error( 'Oops, something went wrong!' );
        console.error( 'Please, report the following error on https://github.com/ckeditor/ckeditor5/issues with the build id and the error stack trace:' );
        console.warn( 'Build id: l1txv9x2i4j9-f8u2t0fifydx' );
        console.error( error );
    } );

以上配置完成了ckeditor5 heading自定义配置。

标签: ckeditor5
地址:https://www.leftso.com/article/1126.html

相关阅读

在CKEditor4版本中,对于编辑器高度设置是通过config配置里面的属性height来实现的,如下方所示CKEditor5 版本查文档发现已经没有这个配置了,通过网络资料查询得知,CKEd...
CKeditor无论那个版本,在我主要以文章编辑的时候,需要去掉默认的H1标签,所以需要自定义配置heading标签。同样CKeditor5 与之前的4版本有所不同。CKeditor5自定义配置...
ckeditor5 图片上传地址配置,ckeditor5和4的图片上传配置有点不一样。首先是确定你选的上传支持插件是什么,我这里是下面这个插件ckfinder upload adapter以次控...
在ckeditor4的时候绑定blur事件代码如下:window.editor.on('blur',function(){//这里写你想做的事儿})同样的代码搬到ckeditor5不仅不能用,还...
CKeditor5代码片段是官方自己集成的。可以通过在线构建的时候选择Code blocks 组件。选择后默认支持一下代码语言,是通过pre标签+code标签实现的。[ { langu...
CKEditor 5 不重新构建移除某个plugin控件组件参考代码:ClassicEditor .create( document.querySelector...
CKeditor5 默认情况下的fontsize组件是小号默认大号特大号这种,没有具体的字体大小px单位选择,有些时候需要配置。故而对默认配置进行了修改。配置方式如下: C...
方案一$("#dialog-modal").modal({backdrop:"static",//点击空白处不关闭对话框show:false,//按esc键盘不关闭.})方案二在弹框元素(下面以...
使用方法toFixed.使用案例letwidth=5.556;console.log(width.toFixed(2))输出内容:5.56使用提示,toFixed必须是数字类型,如果是字符串需要...
js 生成二维码引入qrcode.js该框架基于HTML5原生编写,兼容性较好。支持H5 vue uniapp 微信小程序等。基本使用参考<div id="qrcode"&gtl;<...