您现在的位置是:首页 > cms教程 > 帝国CMS教程帝国CMS教程

帝国7.5默认编辑器增加代码高亮的方法

凡梅2023-05-20帝国CMS教程已有人查阅

导读需要下载的插件及依赖工具,将下载的插件解压,并复制到帝国的ckeditor目录下,注意是后台的那个默认后台目录:eadminecmseditorinfoeditorplugins

ck编辑器官方插件集下载地址
https://ckeditor.com/cke4/addon/
需要下载的插件及依赖工具
1、Code Snippet
2、widget
3、lineutils
4、widgetselection
安装步骤
将下载的插件解压,并复制到帝国的ckeditor目录下,注意是后台的那个
默认后台目录:eadminecmseditorinfoeditorplugins
修改配置文件
配置文件路径:eadminecmseditorinfoeditORConfig.js
配置文件中共有两个工具条,一个是全功能的,一个是精简的
在两个工具条中添加代码工具CodeSnippet
然后在工具条下方添加代码工具的配置
这里我把我的发上来供大家参考
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here. For example:
// 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;
// Toolbar
config.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' ] }
];
// Toolbar
config.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';
};

本文标签:

很赞哦! ()

相关源码

  • (自适应响应式)蓝色环保机械设备网站pbootcms模板HTML5源码下载基于PbootCMS的生态环境技术展示平台,通过内容调整可应用于新能源设备、污水处理、空气净化等环保相关领域。设备参数采用对比表格展示,技术原理支持图文混排;查看源码
  • (自适应)调节阀门气动球阀控制阀网站模板源码下载为调节阀门、气动球阀等工业设备企业打造的响应式网站模板,基于PbootCMS系统开发。突出产品参数展示与技术文档管理功能,通过专业化的布局设计有效呈现工业设备特性,适配各类终端访问需求。查看源码
  • (响应式)wordpress模板VieuV4.5主题资讯自媒体博客源码Vieu主题专注于个人博客与企业展示场景,采用响应式设计确保在手机、电脑、平板等多设备上的展示。主题集成会员中心、投稿系统、内容保护等实用功能,满足现代博客网站的建设需求。查看源码
  • (自适应响应式)HTML5简繁双语电子元器件设备制造Pbootcms模板下载本模板为电子科技设备制造、电子元件生产等高科技企业设计,采用PbootCMS内核开发,具备简繁双语切换功能。模板设计充分考虑了电子科技行业的技术展示需求,能够专业呈现各类电子元器件、电路板、智能设备的参数规格和应用方案。查看源码
  • 帝国CMS7.5漫画网站模板带手机端源码免费下载本模板为漫画内容平台设计开发,采用帝国CMS7.5内核构建,深度优化漫画作品展示结构与章节管理模式。前端采用响应式布局设计,适配各类漫画阅读场景,提供作品分类、连载追踪、热度排行等垂直领域功能模块。查看源码
  • (自适应响应式)英文外贸汽车零配件五金机械网站模板为汽车零部件制造商与五金机械出口企业打造的响应式网站模板,内置多语言切换功能,支持产品参数表、OEM能力展示等外贸场景需求。通过结构化数据展示帮助海外买家快速理解产品规格。查看源码
分享笔记 (共有 篇笔记)
验证码: