Files
OnlineJudge/static/src/js/components/editorComponent.js
2015-10-18 11:12:22 +08:00

17 lines
619 B
JavaScript

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);
})
}
})
});