📄 正在查看:twcms/plugin/editor_um/admin_category_index_after.htm
大小:1,254 字节 · 修改:2014-01-08 23:24:34 · 行数:44
1<script type="text/javascript">
2window.editor_init = function(){
3 // 隐藏时表示已经创建编辑器 (保证只创建一次)
4 if($("#page_content:hidden").length > 0) return;
5
6 // 获取后台路径
7 window.admurl = (function() {
8 var url = document.URL || location.href;
9 return url.substr(0, url.lastIndexOf("/"));
10 })();
11
12 // 获取首页路径
13 window.weburl = (function() {
14 return admurl.substr(0, admurl.lastIndexOf("/"));
15 })();
16
17 window.UMEDITOR_HOME_URL = weburl+"/twcms/plugin/editor_um/umeditor/";
18
19 // UM二次加载,需先删除编辑器。否则不会加载
20 if(typeof UM == 'object') UM.delEditor('page_content');
21
22 twLoadCss(UMEDITOR_HOME_URL+"themes/default/css/umeditor.min.css");
23 twLoadJs(UMEDITOR_HOME_URL+"umeditor.config.js", UMEDITOR_HOME_URL+"umeditor.min.js", UMEDITOR_HOME_URL+"lang/zh-cn/zh-cn.js", function(){
24 $("#page_content").removeAttr("class");
25
26 var ue = UM.getEditor('page_content');
27 window.editor_api = {
28 page_content : {
29 obj : ue,
30 get : function() {
31 return this.obj.getContent();
32 },
33 set : function(s) {
34 return this.obj.setContent(s);
35 },
36 focus : function() {
37 return this.obj.focus();
38 }
39 }
40 }
41 });
42}
43</script>
44