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);
}
});
});
}