開啟ckeditor的config.js
CKEDITOR.editorConfig = function( config ) {
config.height = "500px";//調整高度
}
/*-----Toolbar-----*/
config.toolbarGroups = [
{ name: "document", groups: [ "mode", "document", "doctools" ] },
{ name: "clipboard", groups: [ "clipboard", "undo" ] },
{ name: "editing", groups: [ "find", "selection", "spellchecker" ] },
{ name: "forms" },
"/",
{ name: "basicstyles", groups: [ "basicstyles", "cleanup" ] },
{ name: "paragraph", groups: [ "list", "indent", "blocks", "align", "bidi" ] },
{ name: "links" },
{ name: "insert" },
"/",
{ name: "styles" },
{ name: "colors" },
{ name: "tools" },
{ name: "others" },
{ name: "about" }
];
開啟config.js
config.removeButtons = "Flash";//移除flash工具
開啟ckeditor.js搜尋CKEDITOR.config.font_names
開啟ckeditor.js搜尋CKEDITOR.config.fontSize_sizes
開啟ckeditor.js搜尋CKEDITOR.config.font_defaultLabel
開啟contents.css
body
{
font-family: sans-serif, Arial, Verdana, "Trebuchet MS";
font-size: 14px;
}
<link rel="stylesheet" href="ckeditor/default.min.css"><!-- ckeditor -->
<script src="ckeditor/highlight.min.js"></script><!-- highlight -->
<script src="ckeditor/ckeditor.js"></script><!-- ckeditor -->
//jquery
CKEDITOR.replace("ck");//設定CKeditor ID為CK
<!-- html -->
<textarea id="ck"></textarea>
CKEDITOR.replace('ck',{
extraPlugins: 'codesnippet',
codeSnippet_theme: 'monokai_sublime'//github,monokai,sunburst
});//設定CKeditor ID
//取得ID為ck的ckeditor內容
CKEDITOR.instances.ck.getData();
//設定ID為ck的ckeditor內容
CKEDITOR.instances.ck.setData("text<br>text");