封装 simditor 为 web 组建

This commit is contained in:
virusdefender
2015-10-18 11:12:22 +08:00
parent 4342c91985
commit bd61b54048
2 changed files with 17 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
define("editorComponent", ["jquery", "avalon", "editor"], function ($, avalon, editor) {
avalon.component("ms:editor", {
$template: "<textarea ms-attr-id='{{ editorId }}' ms-duplex='content' ms-attr-placeholder='placeholder'></textarea>",
editorId: "editorId",
content: "",
placeholder: "",
$editor: {},
$ready: function (vm, el) {
el.msRetain = true;
vm.$editor = editor($("#" + vm.editorId));
vm.$watch("content", function (oldValue, newValue) {
vm.$editor.setValue(oldValue);
})
}
})
});

View File

@@ -26,6 +26,7 @@ var require = {
// ------ admin web 组件 ----------
pager: "components/pager",
editorComponent: "components/editorComponent",
// ------ 下面写的都不要直接用,而是使用上面的封装版本 ------