如果用 `var editor = new ___E('textarea1');` 生成編輯器,那么 `editor.$txt` 就可以獲取編輯器的編輯區域,它就是一個 `div` 對象(zepto封裝的)。
因此,針對 `editor.$txt` 你可以使用 zepto 的 API 進行各種操作。代碼示例如下:
```
<script type="text/javascript">
$(function () {
// 生成編輯器
var editor = new ___E('textarea1');
// 初始化
editor.init();
// --------------分割線----------------
// 獲取編輯器區域
var $txt = editor.$txt;
// 查看對象
console.log($txt);
// 獲取 html
var html = $txt.html();
// 獲取 text
var text = $txt.text();
// 設置內容
$txt.html('自定義設置內容');
// 追加內容
$txt.append('追加內容...');
// 綁定事件
$txt.on('keydown', function (e) {
});
// ....
});
</script>
```