国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

ckeditor4整合高亮插件syntaxhighlight實例

2024-07-21 02:53:21
字體:
來源:轉載
供稿:網友

第一步:下載ckeditor-syntaxhighlight插件,下載地址:
https://github.com/dbrain/ckeditor-syntaxhighlight,下載完成解壓,將plugins文件夾拷到ckeditor(當前版本是4.1.2)的目錄下,合并同名文件夾!

第二步:打開config.js
增加    config.extraPlugins = "syntaxhighlight";行
并在面板配置中增加syntaxhighlight,如下

CKEDITOR.editorConfig = function( config ){    config.extraPlugins = "syntaxhighlight";	config.toolbar = 'Index';	config.toolbar_Index =	[        ['Source','Preview','Maximize'],        ['Cut','Copy','Paste','PasteText'],        ['SelectAll','RemoveFormat'],        ['Bold','Italic','Underline','Strike'],        ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],        ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],        ['Link','Unlink','Image','Flash','Table','HorizontalRule','SpecialChar','PageBreak'],        ['Font', 'FontSize', 'TextColor', 'BGColor', 'syntaxhighlight']    ];};

第三步:打開ckeditor/plugins/syntaxhighlight/plugin.js,將

var pluginName = 'code';

改成

var pluginName = 'syntaxhighlight';

然后打開ckeditor/plugins/syntaxhighlight/lang/en.js,將

CKEDITOR.plugins.setLang('syntaxhighlight', 'en',{    syntaxhighlight:{        title: 'Add or update a code snippet',        sourceTab: 'Source code',        langLbl: 'Select language',        advancedTab: 'Advanced',        hideGutter: 'Hide gutter',        hideGutterLbl: 'Hide gutter & line numbers.',        hideControls: 'Hide controls',        hideControlsLbl: 'Hide code controls at the top of the code block.',        collapse: 'Collapse',        collapseLbl: 'Collapse the code block by default. (controls need to be turned on)',        showColumns: 'Show columns',        showColumnsLbl: 'Show row columns in the first line.',        lineWrap: 'Disable line wrapping',        lineWrapLbl: 'Switch off line wrapping.',        lineCount: 'Default line count',        highlight: 'Highlight lines',        highlightLbl: 'Enter a comma seperated lines of lines you want to highlight, eg <em>3,10,15</em>.'    }});

改成

CKEDITOR.plugins.setLang('syntaxhighlight', 'en',{    title: 'Add or update a code snippet',    sourceTab: 'Source code',    langLbl: 'Select language',    advancedTab: 'Advanced',    hideGutter: 'Hide gutter',    hideGutterLbl: 'Hide gutter & line numbers.',    hideControls: 'Hide controls',    hideControlsLbl: 'Hide code controls at the top of the code block.',    collapse: 'Collapse',    collapseLbl: 'Collapse the code block by default. (controls need to be turned on)',    showColumns: 'Show columns',    showColumnsLbl: 'Show row columns in the first line.',    lineWrap: 'Disable line wrapping',    lineWrapLbl: 'Switch off line wrapping.',    lineCount: 'Default line count',    highlight: 'Highlight lines',    highlightLbl: 'Enter a comma seperated lines of lines you want to highlight, eg <em>3,10,15</em>.'});

到此,插件配置完畢,已經可以正常使用了,但是前端記得要引用syntaxhighlighter相關的JS與css.


注:相關教程知識閱讀請移步到編輯器頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 道孚县| 和平县| 阳山县| 华亭县| 万盛区| 来宾市| 道孚县| 尼木县| 綦江县| 丰城市| 沂南县| 浦东新区| 德格县| 稻城县| 宝丰县| 栖霞市| 鄱阳县| 金湖县| 大名县| 竹山县| 平阴县| 鹿泉市| 营山县| 历史| 龙游县| 阳东县| 淮阳县| 黄石市| 寿阳县| 靖宇县| 临澧县| 杂多县| 江孜县| 白朗县| 宁国市| 延边| 富锦市| 丰顺县| 庆阳市| 茂名市| 府谷县|