封装 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);
|
||||
})
|
||||
}
|
||||
})
|
||||
});
|
||||
Reference in New Issue
Block a user