KindEditor 这个 东西 研究的不多,JS在通过调用getElementById 获取文本id的内容时候,KindEditor 尚未将内容同步,官方给的解决方法是afterBlur: function () { this.sync(); }

在编辑器失去焦点时(比如你点击提交时即会失去焦点),使用sync()去同步HTML,不知怎么的,这个函数总是调用失败,通过查阅该博客解决。

解决方法:整体替换

将以下脚本内容

    <script>
      var editor;
      KindEditor.ready(function(K) {
        editor = K.create('textarea[name="blogbody"]', {
          allowFileManager : true
        });
    </script>

 

替换为

    <script type="text/javascript">
        KindEditor.ready(function (K) {
            window.editor = K.create('#AContent', {
                afterBlur: function () { this.sync(); }
            });
        });
    </script>

完美解决

相关文章:

  • 2021-06-20
  • 2022-12-23
  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2022-02-08
猜你喜欢
  • 2022-12-23
  • 2021-12-09
  • 2021-07-25
  • 2022-01-02
  • 2022-12-23
  • 2021-10-01
  • 2021-11-20
相关资源
相似解决方案