在帝国CMS7.5中为默认编辑器添加代码高亮功能
帝国CMS7.5默认编辑器添加代码高亮,可以通过以下步骤实现: 1. 下载并安装Emmet插件。 2. 在Emmet插件设置中启用语法高亮。 3. 在编辑器中使用Emmet语法编写代码。 4. 保存文件后,代码将自动格式化并高亮显示。 此外,您还可以使用其他第三方插件来实现代码高亮功能,例如CodeMirror、Highlight.js等。这些插件通常提供了更多的功能和选项,可以满足不同的需求。
ck编辑器官方插件集下载地址
https://ckeditor.com/cke4/addon/
需要下载的插件及依赖工具
1、Code Snippet
2、widget
3、lineutils
4、widgetselection
安装步骤
将下载的插件解压,并复制到帝国的ckeditor目录下,注意是后台的那个
默认后台目录:eadminecmseditorinfoeditorplugins
修改配置文件
配置文件路径:eadminecmseditorinfoeditORConfig.js
配置文件中共有两个工具条,一个是全功能的,一个是精简的
在两个工具条中添加代码工具CodeSnippet
然后在工具条下方添加代码工具的配置
这里我把我的发上来供大家参考
CKEDITOR.editorConfig=function(config){//Definechangestodefaultconfigurationhere.Forexample://config.language='fr';//config.uiColor='#AADC6E';config.filebrowserImageUploadUrl='';config.filebrowserFlashUploadUrl=arraycs[0];config.filebrowserImageBrowseUrl=arraycs[1];config.filebrowserFlashBrowseUrl=arraycs[1];config.enterMode=CKEDITOR.ENTER_BR;config.shiftEnterMode=CKEDITOR.ENTER_P;config.allowedContent=true;config.font_names='宋体/宋体;黑体/黑体;仿宋/仿宋_GB2312;楷体/楷体_GB2312;隶书/隶书;幼圆/幼圆;微软雅黑/微软雅黑;'+config.font_names;//Toolbarconfig.toolbar_full=[{name:'document',groups:['mode','document','doctools'],items:['Source','-','Preview','Print']},{name:'clipboard',groups:['clipboard','undo'],items:['Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo']},{name:'paragraph',groups:['list','indent','blocks','align','bidi'],items:['NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl']},'/',{name:'basicstyles',groups:['basicstyles','cleanup'],items:['Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat','ecleanalltext','autoformat']},{name:'links',items:['Link','Unlink','Anchor']},{name:'insert',items:['Image','etranmore','Flash','etranmedia','etranfile','-','Table','HorizontalRule','SpecialChar','CodeSnippet','equotetext','einserttime','einsertpage','einsertbr']},'/',{name:'styles',items:['Styles','Format','Font','FontSize']},{name:'colors',items:['TextColor','BGColor']},{name:'tools',items:['ShowBlocks','NewPage','Templates']},{name:'others',items:['-']},{name:'editing',groups:['find','selection','spellchecker'],items:['Find','Replace','-','SelectAll','Maximize']}];//Toolbarconfig.toolbar_basic=[{name:'document',groups:['mode','document','doctools'],items:['Source']},{name:'clipboard',groups:['clipboard','undo'],items:['Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo']},{name:'links',items:['Link','Unlink','Anchor']},{name:'insert',items:['Image','Table','HorizontalRule','SpecialChar','CodeSnippet']},{name:'tools',items:['Maximize']},{name:'others',items:['-']},'/',{name:'basicstyles',groups:['basicstyles','cleanup'],items:['Bold','Italic','Strike','-','RemoveFormat']},{name:'paragraph',groups:['list','indent','blocks','align','bidi'],items:['NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote']},{name:'styles',items:['Styles','Format']},];config.extraPlugins='etranfile,etranmedia,etranmore,autoformat,ecleanalltext,einsertbr,einsertpage,einserttime,equotetext';config.extraPlugins='codesnippet';config.codeSnippet_theme='monokai_sublime';config.toolbar='full';};相关专题