/** * ueditor完整配置项 * 可以在这里配置整个编辑器的特性 */ /**************************提示******************************** * 所有被注释的配置项均为UEditor默认值。 * 修改默认配置请首先确保已经完全明确该参数的真实用途。 * 主要有两种修改方案,一种是取消此处注释,然后修改成对应参数;另一种是在实例化编辑器时传入对应参数。 * 当升级编辑器时,可直接使用旧版配置文件替换新版配置文件,不用担心旧版配置文件中因缺少新功能所需的参数而导致脚本报错。 **************************提示********************************/ window.UEDITOR_HOME_URL = config.lib + 'editor/'; (function () { /** * 编辑器资源文件根路径。它所表示的含义是:以编辑器实例化页面为当前路径,指向编辑器资源文件(即dialog等文件夹)的路径。 * 鉴于很多同学在使用编辑器的时候出现的种种路径问题,此处强烈建议大家使用"相对于网站根目录的相对路径"进行配置。 * "相对于网站根目录的相对路径"也就是以斜杠开头的形如"/myProject/ueditor/"这样的路径。 * 如果站点中有多个不在同一层级的页面需要实例化编辑器,且引用了同一UEditor的时候,此处的URL可能不适用于每个页面的编辑器。 * 因此,UEditor提供了针对不同页面的编辑器可单独配置的根路径,具体来说,在需要实例化编辑器的页面最顶部写上如下代码即可。当然,需要令此处的URL等于对应的配置。 * window.UEDITOR_HOME_URL = "/xxxx/xxxx/"; */ var URL = window.UEDITOR_HOME_URL || (function(){ function PathStack() { this.documentURL = self.document.URL || self.location.href; this.separator = '/'; this.separatorPattern = /\\|\//g; this.currentDir = './'; this.currentDirPattern = /^[.]\/]/; this.path = this.documentURL; this.stack = []; this.push( this.documentURL ); } PathStack.isParentPath = function( path ){ return path === '..'; }; PathStack.hasProtocol = function( path ){ return !!PathStack.getProtocol( path ); }; PathStack.getProtocol = function( path ){ var protocol = /^[^:]*:\/*/.exec( path ); return protocol ? protocol[0] : null; }; PathStack.prototype = { push: function( path ){ this.path = path; update.call( this ); parse.call( this ); return this; }, getPath: function(){ return this + ""; }, toString: function(){ return this.protocol + ( this.stack.concat( [''] ) ).join( this.separator ); } }; function update() { var protocol = PathStack.getProtocol( this.path || '' ); if( protocol ) { //根协议 this.protocol = protocol; //local this.localSeparator = /\\|\//.exec( this.path.replace( protocol, '' ) )[0]; this.stack = []; } else { protocol = /\\|\//.exec( this.path ); protocol && (this.localSeparator = protocol[0]); } } function parse(){ var parsedStack = this.path.replace( this.currentDirPattern, '' ); if( PathStack.hasProtocol( this.path ) ) { parsedStack = parsedStack.replace( this.protocol , ''); } parsedStack = parsedStack.split( this.localSeparator ); parsedStack.length = parsedStack.length - 1; for(var i= 0,tempPath,l=parsedStack.length,root = this.stack;i你输入的字符个数已经超出最大允许值,服务器可能会拒绝保存! //highlightcode // 代码高亮时需要加载的第三方插件的路径 // ,highlightJsUrl:URL + "third-party/SyntaxHighlighter/shCore.js" // ,highlightCssUrl:URL + "third-party/SyntaxHighlighter/shCoreDefault.css" //tab //点击tab键时移动的距离,tabSize倍数,tabNode什么字符做为单位 //,tabSize:4 //,tabNode:' ' //elementPathEnabled //是否启用元素路径,默认是显示 ,elementPathEnabled : true ,allowDivTransToP:false //removeFormat //清除格式时可以删除的标签和属性 //removeForamtTags标签 //,removeFormatTags:'b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var' //removeFormatAttributes属性 //,removeFormatAttributes:'class,style,lang,width,height,align,hspace,valign' //undo //可以最多回退的次数,默认20 //,maxUndoCount:20 //当输入的字符数超过该值时,保存一次现场 //,maxInputCount:1 //autoHeightEnabled // 是否自动长高,默认true //,autoHeightEnabled:true //scaleEnabled //是否可以拉伸长高,默认true(当开启时,自动长高失效) ,scaleEnabled:true //,minFrameWidth:800 //编辑器拖动时最小宽度,默认800 //,minFrameHeight:220 //编辑器拖动时最小高度,默认220 //autoFloatEnabled //是否保持toolbar的位置不动,默认true ,autoFloatEnabled:false //浮动时工具栏距离浏览器顶部的高度,用于某些具有固定头部的页面 //,topOffset:30 //编辑器底部距离工具栏高度(如果参数大于等于编辑器高度,则设置无效) //,toolbarTopOffset:400 //indentValue //首行缩进距离,默认是2em //,indentValue:'2em' //pageBreakTag //分页标识符,默认是_ueditor_page_break_tag_ //,pageBreakTag:'_ueditor_page_break_tag_' //sourceEditor //源码的查看方式,codemirror 是代码高亮,textarea是文本框,默认是codemirror //注意默认codemirror只能在ie8+和非ie中使用 //,sourceEditor:"codemirror" //如果sourceEditor是codemirror,还用配置一下两个参数 //codeMirrorJsUrl js加载的路径,默认是 URL + "third-party/codemirror/codemirror.js" //,codeMirrorJsUrl:URL + "third-party/codemirror/codemirror.js" //codeMirrorCssUrl css加载的路径,默认是 URL + "third-party/codemirror/codemirror.css" //,codeMirrorCssUrl:URL + "third-party/codemirror/codemirror.css" //编辑器初始化完成后是否进入源码模式,默认为否。 //,sourceEditorFirst:false //autotypeset // //自动排版参数 // ,autotypeset:{ // mergeEmptyline : true, //合并空行 // removeClass : true, //去掉冗余的class // removeEmptyline : false, //去掉空行 // textAlign : "left" , //段落的排版方式,可以是 left,right,center,justify 去掉这个属性表示不执行排版 // imageBlockLine : 'center', //图片的浮动方式,独占一行剧中,左右浮动,默认: center,left,right,none 去掉这个属性表示不执行排版 // pasteFilter : false, //根据规则过滤没事粘贴进来的内容 // clearFontSize : false, //去掉所有的内嵌字号,使用编辑器默认的字号 // clearFontFamily : false, //去掉所有的内嵌字体,使用编辑器默认的字体 // removeEmptyNode : false , // 去掉空节点 // //可以去掉的标签 // removeTagNames : {标签名字:1}, // indent : false, // 行首缩进 // indentValue : '2em' //行首缩进的大小 // }, //填写过滤规则 //filterRules : {} }; })();