zoukankan      html  css  js  c++  java
  • 无法进入KindEditor.ready(function(){})的解决办法

    最近尝试用 nodeJS + angularJS + express 开发一个简单的文章管理系统项目。

    发布文章采用的是KindEditor编辑器,一直用这个编辑器感觉还不错,官方文档的使用说明也很详细。然而,今天遇到了个奇葩问题,kindeditor-min.js以及css文件明明已经加载进来了,却进入不了KindEditor.ready(function(K){})里面。用以下代码测试了一下:

     console.log(KindEditor);
     console.log(KindEditor.ready());
    

    控制台输出:

    function (a,b){function c(a){a[0]||(a=[]);return new D(a)}if(!(a===i||a===null)){if(typeof a==="string"){b&&(b=f(b)[0]);var d=a.length;a.charAt(0)==="@"&&(a=a.substr(1));if(a.length!==d||/<.+>/.test(a)){var d=(b?b.ownerDocument||b:document).createElement("div"),e=[];d.innerHTML='<img id="__kindeditor_temp_tag__" width="0" height="0" style="display:none;" />'+a;for(var g=0,h=d.childNodes.length;g<h;g++){var j=d.childNodes[g];
    j.id!="__kindeditor_temp_tag__"&&e.push(j)}return c(e)}return c(Ca(a,b))}if(a&&a.constructor===D)return a;a.toArray&&(a=a.toArray());if(Z(a))return c(a);return c(Ja(arguments))}}
    undefined
    

    说明KindEditor确实是已经定义了的。  

    后来换了一种方式来初始化创建编辑器,突然就好了。。不知道为什么会这样。。

    原来的代码:

        KindEditor.ready(function(K) {
            alert("aa");
            window.editor = K.create('textarea[name="content"]', {
                 '1000px',
                height: '1500px',
                resizeMode: 0,
                allowPreviewEmoticons: false,
                items: [
                    'bold', 'italic', 'underline',
                    '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
                    'insertunorderedlist', '|', 'emoticons', 'link']
            });
        });
    

    不能弹出“aa”

    修改后的代码:

        function kedit(kedit){
            var editor = KindEditor.create(kedit,{
                 '780px',
                height: '700px',
                resizeMode: 0,
                allowPreviewEmoticons: false,
                items: [
                    'bold', 'italic', 'underline',
                    '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
                    'insertunorderedlist', '|', 'emoticons', 'link']
            });
        }
    
        $(function(){
            kedit('textarea[name="content"]');
        })
    

      

  • 相关阅读:
    手机端局部滚动问题 overflow-y:auto|scroll无效,使用iscroll解决
    h5 js 图片预览并判断 ajax上传
    安装一些包管理的记录 win10
    nginx php rewrite配置
    记一次u盘 无法格式化、0字节、写保护的解决过程
    erlang,elixir安装
    Redis详解:lists数据类型及操作
    redis类型[string 、list 、 set 、sorted set 、hash]
    java 生成Word文档
    mysql 获取当前月最后一天和第一天
  • 原文地址:https://www.cnblogs.com/mxxim/p/4565613.html
Copyright © 2011-2022 走看看