KindEditor.ready/初始化参数

来源:互联网 发布:网络教育属于函授吗 编辑:程序博客网 时间:2024/06/04 17:51
  • width

编辑器的宽度,可以设置px或%,比textarea输入框样式表宽度优先度高。

数据类型: String;默认值: textarea输入框的宽度

示例:

K.create('#id', {        width : '700px'});
  • height

编辑器的高度,只能设置px,比textarea输入框样式表高度优先度高。

数据类型: String;默认值: textarea输入框的高度

  • minWidth

指定编辑器最小宽度,单位为px。

数据类型: Int;默认值: 650

  • items

配置编辑器的工具栏,其中”/”表示换行,”|”表示分隔符。

数据类型: Array;

默认值:

[        'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', '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',        'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'map', 'code', 'pagebreak',        'link', 'unlink', '|', 'about'] 
sourceHTML代码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图片flashFlashmedia视音频table表格hr插入横线emoticons插入表情link超级链接unlink取消超级链接fullscreen全屏显示about关于print打印code插入程序代码mapGoogle地图baidumap百度地图lineheight行距clearhtml清理HTML代码pagebreak插入分页符quickformat一键排版insertfile插入文件template插入模板anchor插入锚点
  • noDisableItems

designMode 为false时,要保留的工具栏图标。

数据类型: Array;默认值: [‘source’, ‘fullscreen’]

  • filterMode

true时过滤HTML代码,false时允许输入任何代码。

数据类型: Boolean; 默认值: false

  • 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'        ],        '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'        ],        a : ['href', 'target', 'name'],        embed : ['src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess'],        img : ['src', 'width', 'height', 'border', 'alt', 'title', '.width', '.height'],        '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,br,tbody,tr,strong,b,sub,sup,em,i,u,strike' : []}
  • wellFormatMode

true时美化HTML数据。

数据类型: Boolean;默认值: true

  • resizeType

2或1或0,2时可以拖动改变宽度和高度,1时只能改变高度,0时不能拖动。

数据类型: Int;默认值: 2

  • 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>
  • designMode

可视化模式或代码模式

数据类型: Boolean;默认值: true

  • fullscreenMode

true时加载编辑器后变成全屏模式。

数据类型: Boolean;默认值: false

  • basePath

指定编辑器的根目录路径。

数据类型: String;默认值: 根据kindeditor.js文件名自动获取

  • themesPath

指定编辑器的themes目录路径。

数据类型: String;默认值: basePath + ‘themes/’

  • pluginsPath

指定编辑器的plugins目录路径。

数据类型: String;默认值: basePath + ‘plugins/’

  • langPath

指定编辑器的lang目录路径。

数据类型: String;默认值: basePath + ‘lang/’

  • minChangeSize

undo/redo文字输入最小变化长度,当输入的文字变化小于这个长度时不会添加到undo记录里。

数据类型: String;默认值: 5

  • urlType

改变站内本地URL,可设置”“、”relative”、”absolute”、”domain”。空为不修改URL,relative为相对路径,absolute为绝对路径,domain为带域名的绝对路径。

数据类型: String;默认值: “”

  • newlineTag

设置回车换行标签,可设置”p”、”br”。

数据类型: String;默认值: “p”

  • pasteType

设置粘贴类型,0:禁止粘贴, 1:纯文本粘贴, 2:HTML粘贴

数据类型: Int;默认值: 2

  • dialogAlignType

设置弹出框(dialog)的对齐类型,可设置”“、”page”,指定page时按当前页面居中,指定空时按编辑器居中。

数据类型: String;默认值: “page”

  • shadowMode

true时弹出层(dialog)显示阴影。

数据类型: Boolean;默认值: true

  • useContextmenu

true时使用右键菜单,false时屏蔽右键菜单。

数据类型: Boolean;默认值: true

  • syncType

同步数据的方式,可设置”“、”form”,值为form时提交form时自动同步,空时不会自动同步。

数据类型: String;默认值: “form”

  • indentChar

wellFormatMode 为true时,HTML代码缩进字符。

数据类型: String;默认值: “\t”

  • cssPath

指定编辑器iframe document的CSS文件,用于设置可视化区域的样式。

数据类型: String或Array;默认值: 空

  • cssData

指定编辑器iframe document的CSS数据,用于设置可视化区域的样式。

数据类型: String;默认值: 空

  • bodyClass

指定编辑器iframe document body的className。

数据类型: String;默认值: “ke-content”

  • 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']]
  • afterCreate

设置编辑器创建后执行的回调函数。

数据类型: Function;默认值: 无

  • afterChange

编辑器内容发生变化后执行的回调函数。

数据类型: Function;默认值: 无

  • afterTab

按下TAB键后执行的的回调函数。

数据类型: Function;默认值: 插入4个空格的函数

  • afterFocus

编辑器聚焦(focus)时执行的回调函数。

数据类型: Function;默认值: 无

  • afterBlur

编辑器失去焦点(blur)时执行的回调函数。

数据类型: Function;默认值: 无

  • afterUpload

上传文件后执行的回调函数。

数据类型: Function;默认值: 无

KindEditor.ready(function(K) {        K.create('#id', {                afterUpload : function(url) {                        alert(url);                }        });});
  • uploadJson

指定上传文件的服务器端程序。

数据类型: String;默认值: basePath + ‘php/upload_json.php’

  • fileManagerJson

指定浏览远程图片的服务器端程序。

数据类型: String;默认值: basePath + ‘php/file_manager_json.php’

  • allowPreviewEmoticons

true时鼠标放在表情上可以预览表情。

数据类型: Boolean;默认值: true

  • allowImageUpload

true时显示图片上传按钮。

数据类型: Boolean;默认值: true

  • allowFlashUpload

true时显示Flash上传按钮。

数据类型: Boolean;默认值: true

  • allowMediaUpload

true时显示视音频上传按钮。

数据类型: Boolean;默认值: true

  • allowFileManager

true时显示浏览远程服务器按钮。

数据类型: Boolean;默认值: false

  • fontSizeTable

指定文字大小。

数据类型: Array;默认值:

['9px', '10px', '12px', '14px', '16px', '18px', '24px', '32px']


原创粉丝点击