• test


    var params = GetRequest(); //获取url参数
      
      var editor = UE.getEditor('myEditor', {
            //这里可以选择自己需要的工具按钮名称,此处仅选择如下五个
            toolbars: [['source', 'undo', 'redo', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', '|', 'removeformat', 'formatmatch', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
                    'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
            'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
            'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
                'simpleupload', 'insertimage', 'emotion', 'scrawl', 'insertvideo', 'music', 'attachment']],
            //focus时自动清空初始化时的内容
            autoClearinitialContent: true,
            //关闭字数统计
            wordCount: false,
            //关闭elementPath
            elementPathEnabled: false,
            //默认的编辑区域高度
            initialFrameHeight: 300
        })
    
        if (params.id != "" && params.id != undefined) {
            // editor准备好之后才可以使用 ,不然不能使用setContent(),会报错 Cannot set property 'innerHTML' of undefined
            editor.addListener("ready", function () {
                $.get("./Handlers/NewsHandler.ashx", { action: "getnewsbyid", id: params.id }, function (data) {
                    var json = $.parseJSON(data);
                    $("#txtTitle").val(json.Title);
                    $("#selType").val(json.Type);
                    $("#selStyle").val(json.Style);
                    console.log($.parseHTML(json.Content)[0].data);
                    if ($.parseHTML(json.Content)[0].data) {
                        editor.setContent($.parseHTML(json.Content)[0].data);
                    } else {
                        editor.setContent(json.Content);
                    }
                });
    
            });
    
        }
    

      

  • 相关阅读:
    JavaScript 基础第七天(DOM的开始)
    JavaScript 基础第六天
    JavaScript 基础第五天
    JavaScript 基础第四天
    JavaScript 基础第三天
    JavaScript 基础第二天
    观《幸福终点站》有感
    山东移动2014校园招聘笔试
    Genymotion虚拟Android不能联网的一种解决方法
    关于Thinkpad E420双显卡驱动安装和切换的问题
  • 原文地址:https://www.cnblogs.com/saifei1125/p/11362916.html
Copyright © 2020-2023  润新知