Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
luolonghao committed Jul 21, 2012
1 parent b92aae6 commit 424d8c3
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 12 deletions.
2 changes: 1 addition & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
#######################################################################

ver 4.1.2
ver 4.1.2 (2012-07-21)
* 新增: K.remove(expr)函数,可移除多个编辑器,expr为选择器或DOM对象。
* 新增: K.sync(expr)函数,可同步多个编辑器,expr为选择器或DOM对象。
* 新增: K.create(expr)、K(expr)等函数可以直接传入jQuery对象。
Expand Down
59 changes: 58 additions & 1 deletion docs/editor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ K.create(expr [, options])

* 参数:
* mixed expr: element或选择器
* object options: :doc:`option`
* 返回: KEditor

示例:
Expand All @@ -33,6 +34,62 @@ K.create(expr [, options])
langType : 'en'
});

.. note ::
4.1.2版本开始expr可以直接传入jQuery对象。
.. index:: remove

.. _K.remove:

K.remove(expr)
--------------------------------------------------------
移除多个编辑器。

* 参数:
* mixed expr: element或选择器
* 返回: undefined

示例:

.. sourcecode:: js

// 移除ID为editor_id的编辑器
K.remove('#editor_id');

// 移除class为editor-class的编辑器
K.remove('.editor-class');

.. note ::
4.1.2版本开始支持。
.. index:: sync

.. _K.sync:

K.sync(expr)
--------------------------------------------------------
同步多个编辑器。

* 参数:
* mixed expr: element或选择器
* 返回: undefined

示例:

.. sourcecode:: js

// 同步ID为editor_id的编辑器
K.remove('#editor_id');

// 同步class为editor的编辑器
K.remove('.editor');

.. note ::
4.1.2版本开始支持。
.. index:: remove

.. _KEditor.remove:
Expand Down Expand Up @@ -270,7 +327,7 @@ sync()
.. sourcecode:: js

editor.sync();

.. index:: exec

.. _KEditor.exec:
Expand Down
55 changes: 53 additions & 2 deletions docs/option.rst
Original file line number Diff line number Diff line change
Expand Up @@ -724,11 +724,13 @@ fullscreenShortcut
false时禁用ESC全屏快捷键。

* 数据类型: Boolean
* 默认值: true
* 默认值: false

.. note::

4.1版本开始支持。
4.1版本开始支持,从4.1.2版本开始默认值为false。

.. index:: extraFileUploadParams

.. _extraFileUploadParams:

Expand All @@ -749,3 +751,52 @@ extraFileUploadParams
}
});
});

.. note::

4.1.1版本开始支持。

.. index:: filePostName

.. _filePostName:

filePostName
--------------------------------------------------------
指定上传文件form名称。

* 数据类型: String
* 默认值: imgFile

.. note::

4.1.2版本开始支持。

.. index:: fillDescAfterUploadImage

.. _fillDescAfterUploadImage:

fillDescAfterUploadImage
--------------------------------------------------------
true时图片上传成功后切换到图片编辑标签,false时插入图片后关闭弹出框。

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

.. note::

4.1.2版本开始支持。

.. index:: afterSelectFile

.. _afterSelectFile:

afterSelectFile
--------------------------------------------------------
从图片空间选择文件后执行的回调函数。

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

.. note::

4.1.2版本开始支持。
16 changes: 13 additions & 3 deletions docs/qna.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

编辑器好像是UTF-8编码的,可以在GB2312页面上使用吗?
--------------------------------------------------------

可以使用。有两种方法,一种方法是引入kindeditor.js文件时将script的charset属性设置成utf-8。

还有一种方法是直接将html/js/css文件编码都转换成GB2312编码(用Notepad++、editPlus等文本编辑器就可以转换编码),不过转换格式后升级比较困难,建议使用第一种方法。
Expand All @@ -17,8 +16,7 @@

我取不到编辑器数据,直接取得textarea的value也没用。
--------------------------------------------------------

KindEditor的可视化操作在新创建的iframe上执行,代码模式下的textarea框也是新创建的,所以最后提交前需要将HTML数据设置到原来的textarea,editor.sync()函数会完成这个动作。
KindEditor的可视化操作在新创建的iframe上执行,代码模式下的textarea框也是新创建的,所以最后提交前需要执行 :ref:`KEditor.sync` 将HTML数据设置到原来的textarea。

KindEditor在默认情况下自动寻找textarea所属的form元素,找到form后onsubmit事件里添加editor.sync()函数,所以用form方式提交数据,不需要手动执行editor.sync()函数。

Expand All @@ -27,3 +25,15 @@ KindEditor在默认情况下自动寻找textarea所属的form元素,找到form
// 将编辑器的HTML数据同步到textarea
editor.sync();

为什么有些标签被过滤?
--------------------------------------------------------
KindEditor默认采用白名单过滤方式,可用 :ref:`htmlTags` 参数定义要保留的标签和属性。当然也可以用 :ref:`filterMode` 参数关闭过滤模式,保留所有标签。

.. sourcecode:: js

// 关闭过滤模式,保留所有标签
KindEditor.options.filterMode = false;

KindEditor.ready(function(K)) {
K.create('#editor_id');
}
2 changes: 1 addition & 1 deletion docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@

.. note ::
* KindEditor的可视化操作在新创建的iframe上执行,代码模式下的textarea框也是新创建的,所以最后提交前需要将HTML数据同步到原来的textarea,editor.sync()函数会完成这个动作
* KindEditor的可视化操作在新创建的iframe上执行,代码模式下的textarea框也是新创建的,所以最后提交前需要执行 :ref:`KEditor.sync` 将HTML数据设置到原来的textarea
* KindEditor在默认情况下自动寻找textarea所属的form元素,找到form后onsubmit事件里添加sync函数,所以用form方式提交数据,不需要手动执行sync()函数。
Expand Down
4 changes: 2 additions & 2 deletions kindeditor-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions kindeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @author Roddy <[email protected]>
* @website http://www.kindsoft.net/
* @licence http://www.kindsoft.net/license.php
* @version 4.1.1 (2012-07-20)
* @version 4.1.1 (2012-07-21)
*******************************************************************************/
(function (window, undefined) {
if (window.KindEditor) {
Expand All @@ -17,7 +17,7 @@ if (!window.console) {
if (!console.log) {
console.log = function () {};
}
var _VERSION = '4.1.1 (2012-07-20)',
var _VERSION = '4.1.1 (2012-07-21)',
_ua = navigator.userAgent.toLowerCase(),
_IE = _ua.indexOf('msie') > -1 && _ua.indexOf('opera') == -1,
_GECKO = _ua.indexOf('gecko') > -1 && _ua.indexOf('khtml') == -1,
Expand Down

0 comments on commit 424d8c3

Please sign in to comment.