0
問題,我已經寫了使用mithril.js此代碼+ CKEditor的mithril.js與CKEditor的
<body>
<script>
var frm = {};
frm.vm = (function() {
var vm = {};
vm.afterLoad = function() {
CKEDITOR.replace('editor1');
};
vm.btnClick = function() {
console.log(document.getElementById('editor1').value);
};
return vm;
})();
frm.controller = function() {
};
frm.view = function (controller) {
return m("div", {config: frm.vm.afterLoad}, [
m("textarea", {id: "editor1"}),
m("button", {onclick: frm.vm.btnClick}, "Click here to see the text you've typed")
])
;
};
m.mount(document.body, frm);
</script>
</body>
但是當我按一下按鈕,我看到這個錯誤:
Uncaught The editor instance "editor1" is already attached to the provided element.
和console.log()
打印一個空白行。
我在做什麼錯?