From bd61b5404810b2b15152ba302940d2c5b913c489 Mon Sep 17 00:00:00 2001 From: virusdefender <1670873886@qq.com> Date: Sun, 18 Oct 2015 11:12:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=81=E8=A3=85=20simditor=20=E4=B8=BA=20web?= =?UTF-8?q?=20=E7=BB=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/src/js/components/editorComponent.js | 16 ++++++++++++++++ static/src/js/config.js | 1 + 2 files changed, 17 insertions(+) create mode 100644 static/src/js/components/editorComponent.js diff --git a/static/src/js/components/editorComponent.js b/static/src/js/components/editorComponent.js new file mode 100644 index 0000000..706f289 --- /dev/null +++ b/static/src/js/components/editorComponent.js @@ -0,0 +1,16 @@ +define("editorComponent", ["jquery", "avalon", "editor"], function ($, avalon, editor) { + avalon.component("ms:editor", { + $template: "", + 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); + }) + } + }) +}); diff --git a/static/src/js/config.js b/static/src/js/config.js index 56b4b8a..2e744a5 100644 --- a/static/src/js/config.js +++ b/static/src/js/config.js @@ -26,6 +26,7 @@ var require = { // ------ admin web 组件 ---------- pager: "components/pager", + editorComponent: "components/editorComponent", // ------ 下面写的都不要直接用,而是使用上面的封装版本 ------