...
|
...
|
@@ -10,7 +10,7 @@ |
|
|
**************************提示********************************/
|
|
|
|
|
|
|
|
|
(function () {
|
|
|
(function() {
|
|
|
/**
|
|
|
* 编辑器资源文件根路径。它所表示的含义是:以编辑器实例化页面为当前路径,指向编辑器资源文件(即dialog等文件夹)的路径。
|
|
|
* 鉴于很多同学在使用编辑器的时候出现的种种路径问题,此处强烈建议大家使用"相对于网站根目录的相对路径"进行配置。
|
...
|
...
|
@@ -19,8 +19,8 @@ |
|
|
* 因此,UEditor提供了针对不同页面的编辑器可单独配置的根路径,具体来说,在需要实例化编辑器的页面最顶部写上如下代码即可。当然,需要令此处的URL等于对应的配置。
|
|
|
* window.UMEDITOR_HOME_URL = "/xxxx/xxxx/";
|
|
|
*/
|
|
|
window.UMEDITOR_HOME_URL="http://"+location.host+"/";
|
|
|
var URL = window.UMEDITOR_HOME_URL || (function(){
|
|
|
window.UMEDITOR_HOME_URL = "http://" + location.host + "/";
|
|
|
var URL = window.UMEDITOR_HOME_URL || (function() {
|
|
|
|
|
|
function PathStack() {
|
|
|
|
...
|
...
|
@@ -34,83 +34,83 @@ |
|
|
this.path = this.documentURL;
|
|
|
this.stack = [];
|
|
|
|
|
|
this.push( this.documentURL );
|
|
|
this.push(this.documentURL);
|
|
|
|
|
|
}
|
|
|
|
|
|
PathStack.isParentPath = function( path ){
|
|
|
PathStack.isParentPath = function(path) {
|
|
|
return path === '..';
|
|
|
};
|
|
|
|
|
|
PathStack.hasProtocol = function( path ){
|
|
|
return !!PathStack.getProtocol( path );
|
|
|
PathStack.hasProtocol = function(path) {
|
|
|
return !!PathStack.getProtocol(path);
|
|
|
};
|
|
|
|
|
|
PathStack.getProtocol = function( path ){
|
|
|
PathStack.getProtocol = function(path) {
|
|
|
|
|
|
var protocol = /^[^:]*:\/*/.exec( path );
|
|
|
var protocol = /^[^:]*:\/*/.exec(path);
|
|
|
|
|
|
return protocol ? protocol[0] : null;
|
|
|
|
|
|
};
|
|
|
|
|
|
PathStack.prototype = {
|
|
|
push: function( path ){
|
|
|
push: function(path) {
|
|
|
|
|
|
this.path = path;
|
|
|
|
|
|
update.call( this );
|
|
|
parse.call( this );
|
|
|
update.call(this);
|
|
|
parse.call(this);
|
|
|
|
|
|
return this;
|
|
|
|
|
|
},
|
|
|
getPath: function(){
|
|
|
getPath: function() {
|
|
|
return this + "";
|
|
|
},
|
|
|
toString: function(){
|
|
|
return this.protocol + ( this.stack.concat( [''] ) ).join( this.separator );
|
|
|
toString: function() {
|
|
|
return this.protocol + (this.stack.concat([''])).join(this.separator);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
function update() {
|
|
|
|
|
|
var protocol = PathStack.getProtocol( this.path || '' );
|
|
|
var protocol = PathStack.getProtocol(this.path || '');
|
|
|
|
|
|
if( protocol ) {
|
|
|
if (protocol) {
|
|
|
|
|
|
//根协议
|
|
|
this.protocol = protocol;
|
|
|
|
|
|
//local
|
|
|
this.localSeparator = /\\|\//.exec( this.path.replace( protocol, '' ) )[0];
|
|
|
this.localSeparator = /\\|\//.exec(this.path.replace(protocol, ''))[0];
|
|
|
|
|
|
this.stack = [];
|
|
|
} else {
|
|
|
protocol = /\\|\//.exec( this.path );
|
|
|
protocol = /\\|\//.exec(this.path);
|
|
|
protocol && (this.localSeparator = protocol[0]);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
function parse(){
|
|
|
function parse() {
|
|
|
|
|
|
var parsedStack = this.path.replace( this.currentDirPattern, '' );
|
|
|
var parsedStack = this.path.replace(this.currentDirPattern, '');
|
|
|
|
|
|
if( PathStack.hasProtocol( this.path ) ) {
|
|
|
parsedStack = parsedStack.replace( this.protocol , '');
|
|
|
if (PathStack.hasProtocol(this.path)) {
|
|
|
parsedStack = parsedStack.replace(this.protocol, '');
|
|
|
}
|
|
|
|
|
|
parsedStack = parsedStack.split( this.localSeparator );
|
|
|
parsedStack = parsedStack.split(this.localSeparator);
|
|
|
parsedStack.length = parsedStack.length - 1;
|
|
|
|
|
|
for(var i= 0,tempPath,l=parsedStack.length,root = this.stack;i<l;i++){
|
|
|
for (var i = 0, tempPath, l = parsedStack.length, root = this.stack; i < l; i++) {
|
|
|
tempPath = parsedStack[i];
|
|
|
if(tempPath){
|
|
|
if( PathStack.isParentPath( tempPath ) ) {
|
|
|
if (tempPath) {
|
|
|
if (PathStack.isParentPath(tempPath)) {
|
|
|
root.pop();
|
|
|
} else {
|
|
|
root.push( tempPath );
|
|
|
root.push(tempPath);
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -121,9 +121,9 @@ |
|
|
|
|
|
var currentPath = document.getElementsByTagName('script');
|
|
|
|
|
|
currentPath = currentPath[ currentPath.length -1 ].src;
|
|
|
currentPath = currentPath[currentPath.length - 1].src;
|
|
|
|
|
|
return new PathStack().push( currentPath ) + "";
|
|
|
return new PathStack().push(currentPath) + "";
|
|
|
|
|
|
|
|
|
})();
|
...
|
...
|
@@ -134,21 +134,24 @@ |
|
|
window.UMEDITOR_CONFIG = {
|
|
|
|
|
|
//为编辑器实例添加一个路径,这个不能被注释
|
|
|
UMEDITOR_HOME_URL : URL
|
|
|
UMEDITOR_HOME_URL: URL
|
|
|
|
|
|
//图片上传配置区
|
|
|
,imageUrl:URL+"ajax/ueditor" //图片上传提交地址
|
|
|
,imagePath:"" //图片修正地址,引用了fixedImagePath,如有特殊需求,可自行配置
|
|
|
,imageFieldName:"upfile" //图片数据的key,若此处修改,需要在后台对应文件修改对应参数
|
|
|
,
|
|
|
imageUrl: URL + "ajax/ueditor" //图片上传提交地址
|
|
|
,
|
|
|
imagePath: "" //图片修正地址,引用了fixedImagePath,如有特殊需求,可自行配置
|
|
|
,
|
|
|
imageFieldName: "upfile" //图片数据的key,若此处修改,需要在后台对应文件修改对应参数
|
|
|
|
|
|
|
|
|
//工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的从新定义
|
|
|
,toolbar:[
|
|
|
,
|
|
|
toolbar: [
|
|
|
'source | undo redo | bold italic underline strikethrough | superscript subscript | forecolor backcolor | removeformat |',
|
|
|
'insertorderedlist insertunorderedlist | selectall cleardoc paragraph | fontfamily fontsize' ,
|
|
|
'insertorderedlist insertunorderedlist | selectall cleardoc paragraph | fontfamily fontsize',
|
|
|
'| justifyleft justifycenter justifyright justifyjustify |',
|
|
|
'link unlink | emotion image video | map',
|
|
|
'| horizontal print preview fullscreen', 'drafts', 'formula'
|
|
|
'link unlink | emotion image video | map', 'drafts', 'formula'
|
|
|
]
|
|
|
|
|
|
//语言配置项,默认是zh-cn。有需要的话也可以使用如下这样的方式来自动多语言切换,当然,前提条件是lang文件夹下存在对应的语言文件:
|
...
|
...
|
@@ -203,9 +206,9 @@ |
|
|
|
|
|
//fontfamily
|
|
|
//字体设置
|
|
|
// ,'fontfamily':[
|
|
|
// { name: 'songti', val: '宋体,SimSun'},
|
|
|
// ]
|
|
|
// ,'fontfamily':[
|
|
|
// { name: 'songti', val: '宋体,SimSun'},
|
|
|
// ]
|
|
|
|
|
|
//fontsize
|
|
|
//字号
|
...
|
...
|
|