mithril.js CKEditor 问题

mithril.js issues with 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() 打印一个空行。

我做错了什么?

我发现了问题。要获取 CKEditor 的值,需要使用

CKEditor.instance.nameoftextarea.getData()