CKEditor 5 不重新构建移除某个plugin控件组件

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

CKEditor 5 不重新构建移除某个plugin控件组件


参考代码:

ClassicEditor
                .create( document.querySelector( '#contentHtml' ), {
                    removePlugins:['Title','Style','Code','MediaEmbed','CodeBlocks'],//移除控件
                    licenseKey: '',
                    placeholder: '输入正文',
                    // autosave: {
                    //     waitingTime: 8000, // in ms
                    //     save( editor ) {
                    //         // editor.getData();
                    //         return autoSave();
                    //     }
                    // },
                    ckfinder: {
                        uploadUrl: "/ajax/form/admin/goodsCkUpload?type=Image"//图片上传路径
                    },
                    // code Block
                    codeBlock:{
                        languages: [
                            { language: 'plaintext', label: 'Plain text' }, // The default language.
                            { language: 'c', label: 'C' },
                            { language: 'cs', label: 'C#' },
                            { language: 'cpp', label: 'C++' },
                            { language: 'css', label: 'CSS' },
                            { language: 'diff', label: 'Diff' },
                            { language: 'dockerfile', label: 'Dockerfile' },
                            { language: 'html', label: 'HTML' },
                            { language: 'java', label: 'Java' },
                            { language: 'javascript', label: 'JavaScript' },
                            { language: 'json', label: 'JSON' },
                            { language: 'php', label: 'PHP' },
                            { language: 'python', label: 'Python' },
                            { language: 'ruby', label: 'Ruby' },
                            { language: 'typescript', label: 'TypeScript' },
                            { language: 'xml', label: 'XML' }
                        ],
                    },
                    //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' }
                        ]
                    },
                    //link
                    link: {
                        decorators: {
                            addTargetToExternalLinks: {
                                mode: 'automatic',
                                callback: url => /^(https?:)?\/\//.test( url ),
                                attributes: {
                                    rel: 'noopener noreferrer nofollow'
                                }
                            },
                            openInNewTab: {
                                mode: 'manual',
                                label: 'Open in a new tab',
                                attributes: {
                                    target: '_blank',
                                }
                            }
                        }
                    },
                    //font-size
                    fontSize: {
                        options: [
                            12,
                            14,
                            'default',
                            18,
                            25,
                            30
                        ]
                    },
                    //设置字体
                    fontFamily: {
                        options: [
                            'default',
                            'Blackoak Std',
                            '宋体,SimSun',
                            '新宋体,NSimSun',
                            '微软雅黑,Microsoft YaHei',
                            '楷体_GB2312,KaiTi_GB2312',
                            '隶书,LiSu',
                            '幼园,YouYuan',
                            '华文细黑,STXihei',
                        ]
                    },
                } )
                .then( editor => {
                    let html=$('#cocntentScript').html();
                    editor.setData(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: ckeditor5-35.4.0-shnfkcb21gfz' );
                    console.error( error );
                } );


画重点

 removePlugins:['Title','Style','Code','MediaEmbed','CodeBlocks'],//移除控件


 

地址:https://www.leftso.com/article/1137.html

相关阅读

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