width
編輯器的寬度,可以設置px或%,比textarea輸入框樣式表寬度優先度高。
- 數據類型: String
- 默認值: textarea輸入框的寬度
示例:
K . create ( '#id' , { width : '700px' });
items
配置編輯器的工具欄,其中”/”表示換行,”|”表示分隔符。
- 數據類型: Array
- 默認值:
[ 'source' , '|' , 'undo' , 'redo' , '|' , 'preview' , 'print' , 'template' , 'code' , 'cut' , 'copy' , 'paste' , ' plainpaste' , 'wordpaste' , '|' , 'justifyleft' , 'justifycenter' , 'justifyright' , 'justifyfull' , 'insertorderedlist' , 'insertunorderedlist' , 'indent' , 'outdent' , 'subscript' , 'superscript' , 'clearhtml' , 'quickformat' , 'selectall' , '|' , 'fullscreen' , '/' , 'formatblock' , 'fontname' , 'fontsize' , '|' , 'forecolor' , 'hilitecolor' , ' bold' , 'italic' , 'underline' , 'strikethrough' , 'lineheight' , 'removeformat' , '|' , 'image' , 'multiimage' , 'flash' , 'media' , 'insertfile' , 'table' , 'hr' , 'emoticons' , 'baidumap' , 'pagebreak' , 'anchor' , 'link' , 'unlink' , '|' , 'about' ]
| source | HTML代碼 |
| preview | 預覽 |
| undo | 後退 |
| redo | 前進 |
| cut | 剪切 |
| copy | 複製 |
| paste | 粘貼 |
| plainpaste | 粘貼為無格式文本 |
| wordpaste | 從Word粘貼 |
| selectall | 全選 |
| justifyleft | 左對齊 |
| justifycenter | 居中 |
| justifyright | 右對齊 |
| justifyfull | 兩端對齊 |
| insertorderedlist | 編號 |
| insertunorderedlist | 項目符號 |
| indent | 增加縮進 |
| outdent | 減少縮進 |
| subscript | 下標 |
| superscript | 上標 |
| formatblock | 段落 |
| fontname | 字體 |
| fontsize | 文字大小 |
| forecolor | 文字顏色 |
| hilitecolor | 文字背景 |
| bold | 粗體 |
| italic | 斜體 |
| underline | 下劃線 |
| strikethrough | 刪除線 |
| removeformat | 刪除格式 |
| image | 圖片 |
| flash | Flash |
| media | 視音頻 |
| table | 表格 |
| hr | 插入橫線 |
| emoticons | 插入表情 |
| link | 超級鏈接 |
| unlink | 取消超級鏈接 |
| fullscreen | 全屏顯示 |
| about | 關於 |
| 打印 | |
| code | 插入程序代碼 |
| map | Google地圖 |
| baidumap | 百度地圖 |
| lineheight | 行距 |
| clearhtml | 清理HTML代碼 |
| pagebreak | 插入分頁符 |
| quickformat | 一鍵排版 |
| insertfile | 插入文件 |
| template | 插入模板 |
| anchor | 插入錨點 |
htmlTags
指定要保留的HTML標記和屬性。Object的key為HTML標籤名,value為HTML屬性數組,”.”開始的屬性表示style屬性。
- 數據類型: Object
- 默認值:
{ font : [ 'color' , 'size' , 'face' , '.background-color' ], span : [ '.color' , '.background-color' , '.font-size' , '.font- family' , '.background' , '.font-weight' , '.font-style' , '.text-decoration' , '.vertical-align' , '.line-height' ], div : [ 'align' , '.border' , '.margin' , '.padding' , '.text-align' , '.color' , '.background-color' , '.font-size' , '.font-family' , ' .font-weight' , '.background' , '.font-style' , '.text-decoration' , '.vertical-align' , '.margin-left' ], table : [ 'border' , 'cellspacing' , 'cellpadding' , 'width' , 'height' , 'align' , 'bordercolor' , '.padding' , '.margin' , '.border' , 'bgcolor' , '.text-align' , '.color ' , '.background-color' , '.font-size' , '.font-family' , '.font-weight' , '.font-style' , '.text-decoration' , '.background' , ' .width' , '.height' , '.border-collapse' ], 'td,th' : [ 'align' , 'valign' , 'width' , 'height' , 'colspan' , 'rowspan' , 'bgcolor ' , '.text-align' , '.color' , '.background-color' , '.font-size' , '.font-family' , '.font-weight' , '.font-style' , ' .text-decoration' , '.vertical-align' , '.background' , '.border' ], a : [ 'href' , 'target' , 'name' ], embed : [ 'src' , 'width' , 'height' , 'type' , 'loop' , 'autostart' , 'quality' , '.width' , '.height' , 'align' , 'allowscriptaccess' ], img : [ 'src' , 'width' , 'height' , 'border' , 'alt' , 'title' , 'align' , '.width' , '.height' , '.border' ], 'p,ol,ul,li,blockquote,h1, h2,h3,h4,h5,h6' : [ 'align' , '.text-align' , '.color' , '.background-color' , '.font-size' , '.font-family' , ' .background' , '.font-weight' , '.font-style' , '.text-decoration' , '.vertical-align' , '.text-indent' , '.margin-left' ], pre : [ 'class' ], hr : [ 'class' , '.page-break-after' ], 'br,tbody,tr,strong,b,sub,sup,em,i,u,strike,s,del' : [] }
themeType
指定主題風格,可設置”default”、”simple”,指定simple時需要引入simple.css。
- 數據類型: String
- 默認值: “default”
示例:
<link rel= "stylesheet" href= "../themes/default/default.css" /> <link rel= "stylesheet" href= "../themes/simple/simple.css" /> <script charset= "utf-8" src= "../kindeditor.js" ></script> <script charset= "utf-8" src= "../lang/zh_CN.js" ></script> <script> var editor ; KindEditor . ready ( function ( K ) { editor = K . create ( '#editor_id' , { themeType : 'simple' }); }); </script>
langType
指定語言,可設置”en”、”zh_CN”,需要引入lang/[langType].js。
- 數據類型: String
- 默認值: “zh_CN”
示例:
<link rel= "stylesheet" href= "../themes/default/default.css" /> <script charset= "utf-8" src= "../kindeditor.js" ></script> <script charset = "utf-8" src= "../lang/en.js" ></script> <script> var editor ; KindEditor . ready ( function ( K ) { editor = K . create ( '#editor_id' , { langType : 'en' }); }); </script>
urlType
改變站內本地URL,可設置”“、”relative”、”absolute”、”domain”。空為不修改URL,relative為相對路徑,absolute為絕對路徑,domain為帶域名的絕對路徑。
- 數據類型: String
- 默認值: “”
colorTable
指定取色器裡的顏色。
- 數據類型: Array
- 默認值:
[ [ '#E53333' , '#E56600' , '#FF9900' , '#64451D' , '#DFC5A4' , '#FFE500' ], [ '#009900' , '#006600' , '#99BB00' , ' #B8D100' , '#60D978' , '#00D5FF' ], [ '#337FE5' , '#003399' , '#4C33E5' , '#9933E5' , '#CC33E5' , '#EE33EE' ], [ '# FFFFFF' , '#CCCCCC' , '#999999' , '#666666' , '#333333' , '#000000' ] ]
afterUpload
上傳文件後執行的回調函數。
- 數據類型: Function
- 默認值: 無
KindEditor . ready ( function ( K ) { K . create ( '#id' , { afterUpload : function ( url ) { alert ( url ); } }); });
fontSizeTable
指定文字大小。
- 數據類型: Array
- 默認值:
[ '9px' , '10px' , '12px' , '14px' , '16px' , '18px' , '24px' , '32px' ]
extraFileUploadParams
上傳圖片、Flash、視音頻、文件時,支持添加別的參數一併傳到服務器。
- 數據類型: Array
- 默認值: {}
KindEditor . ready ( function ( K ) { K . create ( '#id' , { extraFileUploadParams : { item_id : 1000 , category_id : 1 } }); });
Note
4.1.1版本開始支持。
fillDescAfterUploadImage
true時圖片上傳成功後切換到圖片編輯標籤,false時插入圖片後關閉彈出框。
- 數據類型: Boolean
- 默認值: false
Note
4.1.2版本開始支持。
pagebreakHtml
可指定分頁符HTML。
- 數據類型: String
- 默認值: <hr style=”page-break-after: always;” class=”ke-pagebreak” />
Note
4.1.3版本開始支持。
文章標籤
全站熱搜
