封装 simditor 为 web 组建
This commit is contained in:
16
static/src/js/components/editorComponent.js
Normal file
16
static/src/js/components/editorComponent.js
Normal 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);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
@@ -26,6 +26,7 @@ var require = {
|
|||||||
|
|
||||||
// ------ admin web 组件 ----------
|
// ------ admin web 组件 ----------
|
||||||
pager: "components/pager",
|
pager: "components/pager",
|
||||||
|
editorComponent: "components/editorComponent",
|
||||||
|
|
||||||
|
|
||||||
// ------ 下面写的都不要直接用,而是使用上面的封装版本 ------
|
// ------ 下面写的都不要直接用,而是使用上面的封装版本 ------
|
||||||
|
|||||||
Reference in New Issue
Block a user