code stringlengths 1 2.01M | repo_name stringlengths 3 62 | path stringlengths 1 267 | language stringclasses 231 values | license stringclasses 13 values | size int64 1 2.01M |
|---|---|---|---|---|---|
///import core
///commands 修复chrome下图片不能点击的问题
///commandsName FixImgClick
///commandsTitle 修复chrome下图片不能点击的问题
//修复chrome下图片不能点击的问题
//todo 可以改大小
UE.plugins['fiximgclick'] = function() {
var me = this;
if ( browser.webkit ) {
me.addListener( 'click', function( type, e ) {
if ( e.target.tagName == 'IMG' ) {
var range = new dom.Range( me.document );
range.selectNode( e.target ).select();
}
} )
}
}; | 10npsite | trunk/guanli/system/ueditor/_src/plugins/fiximgclick.js | JavaScript | asf20 | 566 |
///import core
///import plugins/undo.js
///commands 设置回车标签p或br
///commandsName EnterKey
///commandsTitle 设置回车标签p或br
/**
* @description 处理回车
* @author zhanyi
*/
UE.plugins['enterkey'] = function() {
var hTag,
me = this,
tag = me.options.enterTag;
me.addListener('keyup', function(type, evt) {
var keyCode = evt.keyCode || evt.which;
if (keyCode == 13) {
var range = me.selection.getRange(),
start = range.startContainer,
doSave;
//修正在h1-h6里边回车后不能嵌套p的问题
if (!browser.ie) {
if (/h\d/i.test(hTag)) {
if (browser.gecko) {
var h = domUtils.findParentByTagName(start, [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6','blockquote'], true);
if (!h) {
me.document.execCommand('formatBlock', false, '<p>');
doSave = 1;
}
} else {
//chrome remove div
if (start.nodeType == 1) {
var tmp = me.document.createTextNode(''),div;
range.insertNode(tmp);
div = domUtils.findParentByTagName(tmp, 'div', true);
if (div) {
var p = me.document.createElement('p');
while (div.firstChild) {
p.appendChild(div.firstChild);
}
div.parentNode.insertBefore(p, div);
domUtils.remove(div);
range.setStartBefore(tmp).setCursor();
doSave = 1;
}
domUtils.remove(tmp);
}
}
if (me.undoManger && doSave) {
me.undoManger.save()
}
}
}
setTimeout(function() {
me.selection.getRange().scrollToView(me.autoHeightEnabled, me.autoHeightEnabled ? domUtils.getXY(me.iframe).y : 0);
}, 50)
}
});
me.addListener('keydown', function(type, evt) {
var keyCode = evt.keyCode || evt.which;
if (keyCode == 13) {//回车
if (me.undoManger) {
me.undoManger.save()
}
hTag = '';
var range = me.selection.getRange();
if (!range.collapsed) {
//跨td不能删
var start = range.startContainer,
end = range.endContainer,
startTd = domUtils.findParentByTagName(start, 'td', true),
endTd = domUtils.findParentByTagName(end, 'td', true);
if (startTd && endTd && startTd !== endTd || !startTd && endTd || startTd && !endTd) {
evt.preventDefault ? evt.preventDefault() : ( evt.returnValue = false);
return;
}
}
me.currentSelectedArr && domUtils.clearSelectedArr(me.currentSelectedArr);
if (tag == 'p') {
if (!browser.ie) {
start = domUtils.findParentByTagName(range.startContainer, ['ol','ul','p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6','blockquote'], true);
if (!start) {
me.document.execCommand('formatBlock', false, '<p>');
if (browser.gecko) {
range = me.selection.getRange();
start = domUtils.findParentByTagName(range.startContainer, 'p', true);
start && domUtils.removeDirtyAttr(start);
}
} else {
hTag = start.tagName;
start.tagName.toLowerCase() == 'p' && browser.gecko && domUtils.removeDirtyAttr(start);
}
}
} else {
evt.preventDefault ? evt.preventDefault() : ( evt.returnValue = false);
if (!range.collapsed) {
range.deleteContents();
start = range.startContainer;
if (start.nodeType == 1 && (start = start.childNodes[range.startOffset])) {
while (start.nodeType == 1) {
if (dtd.$empty[start.tagName]) {
range.setStartBefore(start).setCursor();
if (me.undoManger) {
me.undoManger.save()
}
return false;
}
if (!start.firstChild) {
var br = range.document.createElement('br');
start.appendChild(br);
range.setStart(start, 0).setCursor();
if (me.undoManger) {
me.undoManger.save()
}
return false;
}
start = start.firstChild
}
if (start === range.startContainer.childNodes[range.startOffset]) {
br = range.document.createElement('br');
range.insertNode(br).setCursor();
} else {
range.setStart(start, 0).setCursor();
}
} else {
br = range.document.createElement('br');
range.insertNode(br).setStartAfter(br).setCursor();
}
} else {
br = range.document.createElement('br');
range.insertNode(br);
var parent = br.parentNode;
if (parent.lastChild === br) {
br.parentNode.insertBefore(br.cloneNode(true), br);
range.setStartBefore(br)
} else {
range.setStartAfter(br)
}
range.setCursor();
}
}
}
});
};
| 10npsite | trunk/guanli/system/ueditor/_src/plugins/enterkey.js | JavaScript | asf20 | 6,771 |
///import core
///commands 自定义样式
///commandsName CustomStyle
///commandsTitle 自定义样式
UE.plugins['customstyle'] = function() {
var me = this;
me.commands['customstyle'] = {
execCommand : function(cmdName, obj) {
var me = this,
tagName = obj.tag,
node = domUtils.findParent(me.selection.getStart(), function(node) {
return node.getAttribute('label')
}, true),
range,bk,tmpObj = {};
for (var p in obj) {
tmpObj[p] = obj[p]
}
delete tmpObj.tag;
if (node && node.getAttribute('label') == obj.label) {
range = this.selection.getRange();
bk = range.createBookmark();
if (range.collapsed) {
//trace:1732 删掉自定义标签,要有p来回填站位
if(dtd.$block[node.tagName]){
var fillNode = me.document.createElement('p');
domUtils.moveChild(node, fillNode);
node.parentNode.insertBefore(fillNode, node);
domUtils.remove(node)
}else{
domUtils.remove(node,true)
}
} else {
var common = domUtils.getCommonAncestor(bk.start, bk.end),
nodes = domUtils.getElementsByTagName(common, tagName);
if(new RegExp(tagName,'i').test(common.tagName)){
nodes.push(common);
}
for (var i = 0,ni; ni = nodes[i++];) {
if (ni.getAttribute('label') == obj.label) {
var ps = domUtils.getPosition(ni, bk.start),pe = domUtils.getPosition(ni, bk.end);
if ((ps & domUtils.POSITION_FOLLOWING || ps & domUtils.POSITION_CONTAINS)
&&
(pe & domUtils.POSITION_PRECEDING || pe & domUtils.POSITION_CONTAINS)
)
if (dtd.$block[tagName]) {
var fillNode = me.document.createElement('p');
domUtils.moveChild(ni, fillNode);
ni.parentNode.insertBefore(fillNode, ni);
}
domUtils.remove(ni, true)
}
}
node = domUtils.findParent(common, function(node) {
return node.getAttribute('label') == obj.label
}, true);
if (node) {
domUtils.remove(node, true)
}
}
range.moveToBookmark(bk).select();
} else {
if (dtd.$block[tagName]) {
this.execCommand('paragraph', tagName, tmpObj,'customstyle');
range = me.selection.getRange();
if (!range.collapsed) {
range.collapse();
node = domUtils.findParent(me.selection.getStart(), function(node) {
return node.getAttribute('label') == obj.label
}, true);
var pNode = me.document.createElement('p');
domUtils.insertAfter(node, pNode);
domUtils.fillNode(me.document, pNode);
range.setStart(pNode, 0).setCursor()
}
} else {
range = me.selection.getRange();
if (range.collapsed) {
node = me.document.createElement(tagName);
domUtils.setAttributes(node, tmpObj);
range.insertNode(node).setStart(node, 0).setCursor();
return;
}
bk = range.createBookmark();
range.applyInlineStyle(tagName, tmpObj).moveToBookmark(bk).select()
}
}
},
queryCommandValue : function() {
var parent = utils.findNode(this.selection.getStartElementPath(),null,function(node){return node.getAttribute('label')});
return parent ? parent.getAttribute('label') : '';
},
queryCommandState : function() {
return this.highlight ? -1 : 0;
}
};
//当去掉customstyle是,如果是块元素,用p代替
me.addListener('keyup', function(type, evt) {
var keyCode = evt.keyCode || evt.which;
if (keyCode == 32 || keyCode == 13) {
var range = me.selection.getRange();
if (range.collapsed) {
var node = domUtils.findParent(me.selection.getStart(), function(node) {
return node.getAttribute('label')
}, true);
if (node && dtd.$block[node.tagName] && domUtils.isEmptyNode(node)) {
var p = me.document.createElement('p');
domUtils.insertAfter(node, p);
domUtils.fillNode(me.document, p);
domUtils.remove(node);
range.setStart(p, 0).setCursor();
}
}
}
})
}; | 10npsite | trunk/guanli/system/ueditor/_src/plugins/customstyle.js | JavaScript | asf20 | 5,640 |
///import core
///commands 全选
///commandsName SelectAll
///commandsTitle 全选
/**
* 选中所有
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName selectall选中编辑器里的所有内容
* @author zhanyi
*/
UE.plugins['selectall'] = function(){
var me = this;
me.commands['selectall'] = {
execCommand : function(){
//去掉了原生的selectAll,因为会出现报错和当内容为空时,不能出现闭合状态的光标
var range = this.selection.getRange();
range.selectNodeContents(this.body);
if(domUtils.isEmptyBlock(this.body))
range.collapse(true);
range.select(true);
this.selectAll = true;
},
notNeedUndo : 1
};
me.addListener('ready',function(){
domUtils.on(me.document,'click',function(evt){
me.selectAll = false;
})
})
};
| 10npsite | trunk/guanli/system/ueditor/_src/plugins/selectall.js | JavaScript | asf20 | 978 |
///import core
///import plugins\image.js
///commands 插入表情
///commandsName Emotion
///commandsTitle 表情
///commandsDialog dialogs\emotion\emotion.html
UE.commands['emotion'] = {
queryCommandState : function(){
return this.highlight ? -1 :0;
}
};
| 10npsite | trunk/guanli/system/ueditor/_src/plugins/emotion.js | JavaScript | asf20 | 276 |
///import core
///commands 为非ie浏览器自动添加a标签
///commandsName AutoLink
///commandsTitle 自动增加链接
/**
* @description 为非ie浏览器自动添加a标签
* @author zhanyi
*/
UE.plugins['autolink'] = function() {
var cont = 0;
if (browser.ie) {
return;
}
var me = this;
me.addListener('reset',function(){
cont = 0;
});
me.addListener('keydown', function(type, evt) {
var keyCode = evt.keyCode || evt.which;
if (keyCode == 32 || keyCode == 13) {
var sel = me.selection.getNative(),
range = sel.getRangeAt(0).cloneRange(),
offset,
charCode;
var start = range.startContainer;
while (start.nodeType == 1 && range.startOffset > 0) {
start = range.startContainer.childNodes[range.startOffset - 1];
if (!start)
break;
range.setStart(start, start.nodeType == 1 ? start.childNodes.length : start.nodeValue.length);
range.collapse(true);
start = range.startContainer;
}
do{
if (range.startOffset == 0) {
start = range.startContainer.previousSibling;
while (start && start.nodeType == 1) {
start = start.lastChild;
}
if (!start || domUtils.isFillChar(start))
break;
offset = start.nodeValue.length;
} else {
start = range.startContainer;
offset = range.startOffset;
}
range.setStart(start, offset - 1);
charCode = range.toString().charCodeAt(0);
} while (charCode != 160 && charCode != 32);
if (range.toString().replace(new RegExp(domUtils.fillChar, 'g'), '').match(/(?:https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)/i)) {
while(range.toString().length){
if(/^(?:https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)/i.test(range.toString())){
break;
}
try{
range.setStart(range.startContainer,range.startOffset+1)
}catch(e){
range.setStart(range.startContainer.nextSibling,0)
}
}
var a = me.document.createElement('a'),text = me.document.createTextNode(' '),href;
me.undoManger && me.undoManger.save();
a.appendChild(range.extractContents());
a.href = a.innerHTML = a.innerHTML.replace(/<[^>]+>/g,'');
href = a.getAttribute("href").replace(new RegExp(domUtils.fillChar,'g'),'');
href = /^(?:https?:\/\/)/ig.test(href) ? href : "http://"+ href;
a.setAttribute('data_ue_src',href);
a.href = href;
range.insertNode(a);
a.parentNode.insertBefore(text, a.nextSibling);
range.setStart(text, 0);
range.collapse(true);
sel.removeAllRanges();
sel.addRange(range);
me.undoManger && me.undoManger.save();
}
}
})
};
| 10npsite | trunk/guanli/system/ueditor/_src/plugins/autolink.js | JavaScript | asf20 | 3,724 |
///import core
///commands 预览
///commandsName Preview
///commandsTitle 预览
/**
* 预览
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName preview预览编辑器内容
*/
UE.commands['preview'] = {
execCommand : function(){
var me = this,
w = window.open('', '_blank', ""),
d = w.document,
css = me.document.getElementById("syntaxhighlighter_css"),
js = document.getElementById("syntaxhighlighter_js"),
style = "<style type='text/css'>" + me.options.initialStyle + "</style>",
cont = me.getContent();
if(browser.ie){
cont = cont.replace(/<\s*br\s*\/?\s*>/gi,'<br/><br/>')
}
d.open();
d.write('<html><head>'+style+'<link rel="stylesheet" type="text/css" href="'+me.options.UEDITOR_HOME_URL+utils.unhtml( this.options.iframeCssUrl ) + '"/>'+
(css ? '<link rel="stylesheet" type="text/css" href="' + css.href + '"/>' : '')
+ (css ? ' <script type="text/javascript" charset="utf-8" src="'+js.src+'"></script>':'')
+'<title></title></head><body >' +
cont +
(css ? '<script type="text/javascript">'+(baidu.editor.browser.ie ? 'window.onload = function(){SyntaxHighlighter.all()};' : 'SyntaxHighlighter.all();')+
'setTimeout(function(){' +
'for(var i=0,di;di=SyntaxHighlighter.highlightContainers[i++];){' +
'var tds = di.getElementsByTagName("td");' +
'for(var j=0,li,ri;li=tds[0].childNodes[j];j++){' +
'ri = tds[1].firstChild.childNodes[j];' +
'ri.style.height = li.style.height = ri.offsetHeight + "px";' +
'}' +
'}},100)</script>':'') +
'</body></html>');
d.close();
},
notNeedUndo : 1
};
| 10npsite | trunk/guanli/system/ueditor/_src/plugins/preview.js | JavaScript | asf20 | 1,970 |
///import core
///commands 本地图片引导上传
///commandsName WordImage
///commandsTitle 本地图片引导上传
UE.plugins["wordimage"] = function(){
var me = this,
images;
me.commands['wordimage'] = {
execCommand : function() {
images = domUtils.getElementsByTagName(me.document.body,"img");
var urlList = [];
for(var i=0,ci;ci=images[i++];){
var url=ci.getAttribute("word_img");
url && urlList.push(url);
}
if(images.length){
this["word_img"] = urlList;
}
},
queryCommandState: function(){
images = domUtils.getElementsByTagName(me.document.body,"img");
for(var i=0,ci;ci =images[i++];){
if(ci.getAttribute("word_img")){
return 1;
}
}
return -1;
}
};
}; | 10npsite | trunk/guanli/system/ueditor/_src/plugins/wordimage.js | JavaScript | asf20 | 970 |
///import core
///commands 查找替换
///commandsName SearchReplace
///commandsTitle 查询替换
///commandsDialog dialogs\searchreplace\searchreplace.html
/**
* @description 查找替换
* @author zhanyi
*/
UE.plugins['searchreplace'] = function(){
var currentRange,
first,
me = this;
me.addListener('reset',function(){
currentRange = null;
first = null;
});
me.commands['searchreplace'] = {
execCommand : function(cmdName,opt){
var me = this,
sel = me.selection,
range,
nativeRange,
num = 0,
opt = utils.extend(opt,{
all : false,
casesensitive : false,
dir : 1
},true);
if(browser.ie){
while(1){
var tmpRange;
nativeRange = me.document.selection.createRange();
tmpRange = nativeRange.duplicate();
tmpRange.moveToElementText(me.document.body);
if(opt.all){
first = 0;
opt.dir = 1;
if(currentRange){
tmpRange.setEndPoint(opt.dir == -1 ? 'EndToStart' : 'StartToEnd',currentRange)
}
}else{
tmpRange.setEndPoint(opt.dir == -1 ? 'EndToStart' : 'StartToEnd',nativeRange);
if(opt.hasOwnProperty("replaceStr")){
tmpRange.setEndPoint(opt.dir == -1 ? 'StartToEnd' : 'EndToStart',nativeRange);
}
}
nativeRange = tmpRange.duplicate();
if(!tmpRange.findText(opt.searchStr,opt.dir,opt.casesensitive ? 4 : 0)){
currentRange = null;
tmpRange = me.document.selection.createRange();
tmpRange.scrollIntoView();
return num;
}
tmpRange.select();
//替换
if(opt.hasOwnProperty("replaceStr")){
range = sel.getRange();
range.deleteContents().insertNode(range.document.createTextNode(opt.replaceStr)).select();
currentRange = sel.getNative().createRange();
}
num++;
if(!opt.all)break;
}
}else{
var w = me.window,nativeSel = sel.getNative(),tmpRange;
while(1){
if(opt.all){
if(currentRange){
currentRange.collapse(false);
nativeRange = currentRange;
}else{
nativeRange = me.document.createRange();
nativeRange.setStart(me.document.body,0);
}
nativeSel.removeAllRanges();
nativeSel.addRange( nativeRange );
first = 0;
opt.dir = 1;
}else{
nativeRange = w.getSelection().getRangeAt(0);
if(opt.hasOwnProperty("replaceStr")){
nativeRange.collapse(opt.dir == 1 ? true : false);
}
}
//如果是第一次并且海选中了内容那就要清除,为find做准备
if(!first){
nativeRange.collapse( opt.dir <0 ? true : false);
nativeSel.removeAllRanges();
nativeSel.addRange( nativeRange );
}else{
nativeSel.removeAllRanges();
}
if(!w.find(opt.searchStr,opt.casesensitive,opt.dir < 0 ? true : false) ) {
currentRange = null;
nativeSel.removeAllRanges();
return num;
}
first = 0;
range = w.getSelection().getRangeAt(0);
if(!range.collapsed){
if(opt.hasOwnProperty("replaceStr")){
range.deleteContents();
var text = w.document.createTextNode(opt.replaceStr);
range.insertNode(text);
range.selectNode(text);
nativeSel.addRange(range);
currentRange = range.cloneRange();
}
}
num++;
if(!opt.all)break;
}
}
return true;
}
}
}; | 10npsite | trunk/guanli/system/ueditor/_src/plugins/searchreplace.js | JavaScript | asf20 | 5,541 |
///import core
///import plugins\removeformat.js
///commands 字体颜色,背景色,字号,字体,下划线,删除线
///commandsName ForeColor,BackColor,FontSize,FontFamily,Underline,StrikeThrough
///commandsTitle 字体颜色,背景色,字号,字体,下划线,删除线
/**
* @description 字体
* @name baidu.editor.execCommand
* @param {String} cmdName 执行的功能名称
* @param {String} value 传入的值
*/
(function() {
var fonts = {
'forecolor':'color',
'backcolor':'background-color',
'fontsize':'font-size',
'fontfamily':'font-family',
'underline':'text-decoration',
'strikethrough':'text-decoration'
};
for ( var p in fonts ) {
(function( cmd, style ) {
UE.commands[cmd] = {
execCommand : function( cmdName, value ) {
value = value || (this.queryCommandState(cmdName) ? 'none' : cmdName == 'underline' ? 'underline' : 'line-through');
var me = this,
range = this.selection.getRange(),
text;
if ( value == 'default' ) {
if(range.collapsed){
text = me.document.createTextNode('font');
range.insertNode(text).select()
}
me.execCommand( 'removeFormat', 'span,a', style);
if(text){
range.setStartBefore(text).setCursor();
domUtils.remove(text)
}
} else {
if(me.currentSelectedArr && me.currentSelectedArr.length > 0){
for(var i=0,ci;ci=me.currentSelectedArr[i++];){
range.selectNodeContents(ci);
range.applyInlineStyle( 'span', {'style':style + ':' + value} );
}
range.selectNodeContents(this.currentSelectedArr[0]).select();
}else{
if ( !range.collapsed ) {
if((cmd == 'underline'||cmd=='strikethrough') && me.queryCommandValue(cmd)){
me.execCommand( 'removeFormat', 'span,a', style );
}
range = me.selection.getRange();
range.applyInlineStyle( 'span', {'style':style + ':' + value} ).select();
} else {
var span = domUtils.findParentByTagName(range.startContainer,'span',true);
text = me.document.createTextNode('font');
if(span && !span.children.length && !span[browser.ie ? 'innerText':'textContent'].replace(fillCharReg,'').length){
//for ie hack when enter
range.insertNode(text);
if(cmd == 'underline'||cmd=='strikethrough'){
range.selectNode(text).select();
me.execCommand( 'removeFormat','span,a', style, null );
span = domUtils.findParentByTagName(text,'span',true);
range.setStartBefore(text)
}
span.style.cssText = span.style.cssText + ';' + style + ':' + value;
range.collapse(true).select();
}else{
range.insertNode(text);
range.selectNode(text).select();
span = range.document.createElement( 'span' );
if(cmd == 'underline'||cmd=='strikethrough'){
//a标签内的不处理跳过
if(domUtils.findParentByTagName(text,'a',true)){
range.setStartBefore(text).setCursor();
domUtils.remove(text);
return;
}
me.execCommand( 'removeFormat','span,a', style );
}
span.style.cssText = style + ':' + value;
text.parentNode.insertBefore(span,text);
//修复,span套span 但样式不继承的问题
if(!browser.ie || browser.ie && browser.version == 9){
var spanParent = span.parentNode;
while(!domUtils.isBlockElm(spanParent)){
if(spanParent.tagName == 'SPAN'){
span.style.cssText = spanParent.style.cssText + span.style.cssText;
}
spanParent = spanParent.parentNode;
}
}
range.setStart(span,0).setCursor();
//trace:981
//domUtils.mergToParent(span)
}
domUtils.remove(text)
}
}
}
return true;
},
queryCommandValue : function (cmdName) {
var startNode = this.selection.getStart();
//trace:946
if(cmdName == 'underline'||cmdName=='strikethrough' ){
var tmpNode = startNode,value;
while(tmpNode && !domUtils.isBlockElm(tmpNode) && !domUtils.isBody(tmpNode)){
if(tmpNode.nodeType == 1){
value = domUtils.getComputedStyle( tmpNode, style );
if(value != 'none'){
return value;
}
}
tmpNode = tmpNode.parentNode;
}
return 'none'
}
return domUtils.getComputedStyle( startNode, style );
},
queryCommandState : function(cmdName){
if(this.highlight){
return -1;
}
if(!(cmdName == 'underline'||cmdName=='strikethrough'))
return 0;
return this.queryCommandValue(cmdName) == (cmdName == 'underline' ? 'underline' : 'line-through')
}
}
})( p, fonts[p] );
}
})(); | 10npsite | trunk/guanli/system/ueditor/_src/plugins/font.js | JavaScript | asf20 | 7,461 |
///import core
///import plugins/serialize.js
///import plugins/undo.js
///commands 查看源码
///commandsName Source
///commandsTitle 查看源码
(function (){
function SourceFormater(config){
config = config || {};
this.indentChar = config.indentChar || ' ';
this.breakChar = config.breakChar || '\n';
this.selfClosingEnd = config.selfClosingEnd || ' />';
}
var unhtml1 = function (){
var map = { '<': '<', '>': '>', '"': '"', "'": ''' };
function rep( m ){ return map[m]; }
return function ( str ) {
str = str + '';
return str ? str.replace( /[<>"']/g, rep ) : '';
};
}();
var inline = utils.extend({a:1,A:1},dtd.$inline,true);
function printAttrs(attrs){
var buff = [];
for (var k in attrs) {
buff.push(k + '="' + unhtml1(attrs[k]) + '"');
}
return buff.join(' ');
}
SourceFormater.prototype = {
format: function (html){
var node = UE.serialize.parseHTML(html);
this.buff = [];
this.indents = '';
this.indenting = 1;
this.visitNode(node);
return this.buff.join('');
},
visitNode: function (node){
if (node.type == 'fragment') {
this.visitChildren(node.children);
} else if (node.type == 'element') {
var selfClosing = dtd.$empty[node.tag];
this.visitTag(node.tag, node.attributes, selfClosing);
this.visitChildren(node.children);
if (!selfClosing) {
this.visitEndTag(node.tag);
}
} else if (node.type == 'comment') {
this.visitComment(node.data);
} else {
this.visitText(node.data,dtd.$notTransContent[node.parent.tag]);
}
},
visitChildren: function (children){
for (var i=0; i<children.length; i++) {
this.visitNode(children[i]);
}
},
visitTag: function (tag, attrs, selfClosing){
if (this.indenting) {
this.indent();
} else if (!inline[tag]) { // todo: 去掉a, 因为dtd的inline里面没有a
this.newline();
this.indent();
}
this.buff.push('<', tag);
var attrPart = printAttrs(attrs);
if (attrPart) {
this.buff.push(' ', attrPart);
}
if (selfClosing) {
this.buff.push(this.selfClosingEnd);
if (tag == 'br') {
this.newline();
}
} else {
this.buff.push('>');
this.indents += this.indentChar;
}
if (!inline[tag]) {
this.newline();
}
},
indent: function (){
this.buff.push(this.indents);
this.indenting = 0;
},
newline: function (){
this.buff.push(this.breakChar);
this.indenting = 1;
},
visitEndTag: function (tag){
this.indents = this.indents.slice(0, -this.indentChar.length);
if (this.indenting) {
this.indent();
} else if (!inline[tag]) {
this.newline();
this.indent();
}
this.buff.push('</', tag, '>');
},
visitText: function (text,notTrans){
if (this.indenting) {
this.indent();
}
// if(!notTrans){
// text = text.replace(/ /g, ' ').replace(/[ ][ ]+/g, function (m){
// return new Array(m.length + 1).join(' ');
// }).replace(/(?:^ )|(?: $)/g, ' ');
// }
text = text.replace(/ /g, ' ')
this.buff.push(text);
},
visitComment: function (text){
if (this.indenting) {
this.indent();
}
this.buff.push('<!--', text, '-->');
}
};
var sourceEditors = {
textarea: function (editor, holder){
var textarea = holder.ownerDocument.createElement('textarea');
textarea.style.cssText = 'position:absolute;resize:none;width:100%;height:100%;border:0;padding:0;margin:0;overflow-y:auto;';
// todo: IE下只有onresize属性可用... 很纠结
if (browser.ie && browser.version < 8) {
textarea.style.width = holder.offsetWidth + 'px';
textarea.style.height = holder.offsetHeight + 'px';
holder.onresize = function (){
textarea.style.width = holder.offsetWidth + 'px';
textarea.style.height = holder.offsetHeight + 'px';
};
}
holder.appendChild(textarea);
return {
setContent: function (content){
textarea.value = content;
},
getContent: function (){
return textarea.value;
},
select: function (){
var range;
if (browser.ie) {
range = textarea.createTextRange();
range.collapse(true);
range.select();
} else {
//todo: chrome下无法设置焦点
textarea.setSelectionRange(0, 0);
textarea.focus();
}
},
dispose: function (){
holder.removeChild(textarea);
// todo
holder.onresize = null;
textarea = null;
holder = null;
}
};
},
codemirror: function (editor, holder){
var options = {
mode: "text/html",
tabMode: "indent",
lineNumbers: true,
lineWrapping:true
};
var codeEditor = window.CodeMirror(holder, options);
var dom = codeEditor.getWrapperElement();
dom.style.cssText = 'position:absolute;left:0;top:0;width:100%;height:100%;font-family:consolas,"Courier new",monospace;font-size:13px;';
codeEditor.getScrollerElement().style.cssText = 'position:absolute;left:0;top:0;width:100%;height:100%;';
codeEditor.refresh();
return {
setContent: function (content){
codeEditor.setValue(content);
},
getContent: function (){
return codeEditor.getValue();
},
select: function (){
codeEditor.focus();
},
dispose: function (){
holder.removeChild(dom);
dom = null;
codeEditor = null;
}
};
}
};
UE.plugins['source'] = function (){
var me = this;
var opt = this.options;
var formatter = new SourceFormater(opt.source);
var sourceMode = false;
var sourceEditor;
function createSourceEditor(holder){
var useCodeMirror = opt.sourceEditor == 'codemirror' && window.CodeMirror;
return sourceEditors[useCodeMirror ? 'codemirror' : 'textarea'](me, holder);
}
var bakCssText;
me.commands['source'] = {
execCommand: function (){
sourceMode = !sourceMode;
if (sourceMode) {
me.undoManger && me.undoManger.save();
this.currentSelectedArr && domUtils.clearSelectedArr(this.currentSelectedArr);
if(browser.gecko)
me.body.contentEditable = false;
bakCssText = me.iframe.style.cssText;
me.iframe.style.cssText += 'position:absolute;left:-32768px;top:-32768px;';
var content = formatter.format(me.hasContents() ? me.getContent() : '');
sourceEditor = createSourceEditor(me.iframe.parentNode);
sourceEditor.setContent(content);
setTimeout(function (){
sourceEditor.select();
});
} else {
me.iframe.style.cssText = bakCssText;
var cont = sourceEditor.getContent() || '<p>' + (browser.ie ? '' : '<br/>')+'</p>';
cont = cont.replace(/>[\n\r\t]+([ ]{4})+/g,'>').replace(/[\n\r\t]+([ ]{4})+</g,'<').replace(/>[\n\r\t]+</g,'><');
me.setContent(cont);
sourceEditor.dispose();
sourceEditor = null;
setTimeout(function(){
var first = me.body.firstChild;
//trace:1106 都删除空了,下边会报错,所以补充一个p占位
if(!first){
me.body.innerHTML = '<p>'+(browser.ie?'':'<br/>')+'</p>';
first = me.body.firstChild;
}
//要在ifm为显示时ff才能取到selection,否则报错
me.undoManger && me.undoManger.save();
while(first && first.firstChild){
first = first.firstChild;
}
var range = me.selection.getRange();
if(first.nodeType == 3 || dtd.$empty[first.tagName]){
range.setStartBefore(first)
}else{
range.setStart(first,0);
}
if(browser.gecko){
var input = document.createElement('input');
input.style.cssText = 'position:absolute;left:0;top:-32768px';
document.body.appendChild(input);
me.body.contentEditable = false;
setTimeout(function(){
domUtils.setViewportOffset(input, { left: -32768, top: 0 });
input.focus();
setTimeout(function(){
me.body.contentEditable = true;
range.setCursor(false,true);
domUtils.remove(input)
})
})
}else{
range.setCursor(false,true);
}
})
}
this.fireEvent('sourcemodechanged', sourceMode);
},
queryCommandState: function (){
return sourceMode|0;
}
};
var oldQueryCommandState = me.queryCommandState;
me.queryCommandState = function (cmdName){
cmdName = cmdName.toLowerCase();
if (sourceMode) {
return cmdName == 'source' ? 1 : -1;
}
return oldQueryCommandState.apply(this, arguments);
};
//解决在源码模式下getContent不能得到最新的内容问题
var oldGetContent = me.getContent;
me.getContent = function (){
if(sourceMode && sourceEditor ){
var html = sourceEditor.getContent();
if (this.serialize) {
var node = this.serialize.parseHTML(html);
node = this.serialize.filter(node);
html = this.serialize.toHTML(node);
}
return html;
}else{
return oldGetContent.apply(this, arguments)
}
};
me.addListener("ready",function(){
if(opt.sourceEditor == "codemirror"){
utils.loadFile(document,{
src : opt.codeMirrorJsUrl,
tag : "script",
type : "text/javascript",
defer : "defer"
});
utils.loadFile(document,{
tag : "link",
rel : "stylesheet",
type : "text/css",
href : opt.codeMirrorCssUrl
});
}
});
};
})(); | 10npsite | trunk/guanli/system/ueditor/_src/plugins/source.js | JavaScript | asf20 | 13,122 |
///import core
///commands 快捷键
///commandsName ShortCutKeys
///commandsTitle 快捷键
//配置快捷键
UE.plugins['shortcutkeys'] = function(){
var me = this,
shortcutkeys = utils.extend({
"ctrl+66" : "Bold" //^B
,"ctrl+90" : "Undo" //undo
,"ctrl+89" : "Redo" //redo
,"ctrl+73" : "Italic" //^I
,"ctrl+85" : "Underline" //^U
,"ctrl+shift+67" : "removeformat" //清除格式
,"ctrl+shift+76" : "justify:left" //居左
,"ctrl+shift+82" : "justify:right" //居右
,"ctrl+65" : "selectAll"
// ,"9" : "indent" //tab
},me.options.shortcutkeys);
me.addListener('keydown',function(type,e){
var keyCode = e.keyCode || e.which,value;
for ( var i in shortcutkeys ) {
if ( /^(ctrl)(\+shift)?\+(\d+)$/.test( i.toLowerCase() ) || /^(\d+)$/.test( i ) ) {
if ( ( (RegExp.$1 == 'ctrl' ? (e.ctrlKey||e.metaKey) : 0)
&& (RegExp.$2 != "" ? e[RegExp.$2.slice(1) + "Key"] : 1)
&& keyCode == RegExp.$3
) ||
keyCode == RegExp.$1
){
value = shortcutkeys[i].split(':');
me.execCommand( value[0],value[1]);
domUtils.preventDefault(e)
}
}
}
});
}; | 10npsite | trunk/guanli/system/ueditor/_src/plugins/shortcutkeys.js | JavaScript | asf20 | 1,395 |
///import core
///commandsName attachment
///commandsTitle 附件上传
UE.commands["attachment"] = {
queryCommandState:function(){
return this.highlight ? -1 :0;
}
}; | 10npsite | trunk/guanli/system/ueditor/_src/plugins/attachment.js | JavaScript | asf20 | 192 |
///import core
///import plugins\inserthtml.js
///import plugins\catchremoteimage.js
///commands 插入图片,操作图片的对齐方式
///commandsName InsertImage,ImageNone,ImageLeft,ImageRight,ImageCenter
///commandsTitle 图片,默认,居左,居右,居中
///commandsDialog dialogs\image\image.html
/**
* Created by .
* User: zhanyi
* for image
*/
UE.commands['imagefloat'] = {
execCommand : function (cmd, align){
var me = this,
range = me.selection.getRange();
if(!range.collapsed ){
var img = range.getClosedNode();
if(img && img.tagName == 'IMG'){
switch (align){
case 'left':
case 'right':
case 'none':
var pN = img.parentNode,tmpNode,pre,next;
while(dtd.$inline[pN.tagName] || pN.tagName == 'A'){
pN = pN.parentNode;
}
tmpNode = pN;
if(tmpNode.tagName == 'P' && domUtils.getStyle(tmpNode,'text-align') == 'center'){
if(!domUtils.isBody(tmpNode) && domUtils.getChildCount(tmpNode,function(node){return !domUtils.isBr(node) && !domUtils.isWhitespace(node)}) == 1){
pre = tmpNode.previousSibling;
next = tmpNode.nextSibling;
if(pre && next && pre.nodeType == 1 && next.nodeType == 1 && pre.tagName == next.tagName && domUtils.isBlockElm(pre)){
pre.appendChild(tmpNode.firstChild);
while(next.firstChild){
pre.appendChild(next.firstChild)
}
domUtils.remove(tmpNode);
domUtils.remove(next);
}else{
domUtils.setStyle(tmpNode,'text-align','')
}
}
range.selectNode(img).select()
}
domUtils.setStyle(img,'float',align);
break;
case 'center':
if(me.queryCommandValue('imagefloat') != 'center'){
pN = img.parentNode;
domUtils.setStyle(img,'float','none');
tmpNode = img;
while(pN && domUtils.getChildCount(pN,function(node){return !domUtils.isBr(node) && !domUtils.isWhitespace(node)}) == 1
&& (dtd.$inline[pN.tagName] || pN.tagName == 'A')){
tmpNode = pN;
pN = pN.parentNode;
}
range.setStartBefore(tmpNode).setCursor(false);
pN = me.document.createElement('div');
pN.appendChild(tmpNode);
domUtils.setStyle(tmpNode,'float','');
me.execCommand('insertHtml','<p id="_img_parent_tmp" style="text-align:center">'+pN.innerHTML+'</p>');
tmpNode = me.document.getElementById('_img_parent_tmp');
tmpNode.removeAttribute('id');
tmpNode = tmpNode.firstChild;
range.selectNode(tmpNode).select();
//去掉后边多余的元素
next = tmpNode.parentNode.nextSibling;
if(next && domUtils.isEmptyNode(next)){
domUtils.remove(next)
}
}
break;
}
}
}
},
queryCommandValue : function() {
var range = this.selection.getRange(),
startNode,floatStyle;
if(range.collapsed){
return 'none';
}
startNode = range.getClosedNode();
if(startNode && startNode.nodeType == 1 && startNode.tagName == 'IMG'){
floatStyle = domUtils.getComputedStyle(startNode,'float');
if(floatStyle == 'none'){
floatStyle = domUtils.getComputedStyle(startNode.parentNode,'text-align') == 'center' ? 'center' : floatStyle
}
return {
left : 1,
right : 1,
center : 1
}[floatStyle] ? floatStyle : 'none'
}
return 'none'
},
queryCommandState : function(){
if(this.highlight){
return -1;
}
var range = this.selection.getRange(),
startNode;
if(range.collapsed){
return -1;
}
startNode = range.getClosedNode();
if(startNode && startNode.nodeType == 1 && startNode.tagName == 'IMG'){
return 0;
}
return -1;
}
};
UE.commands['insertimage'] = {
execCommand : function (cmd, opt){
opt = utils.isArray(opt) ? opt : [opt];
if(!opt.length) return;
var me = this,
range = me.selection.getRange(),
img = range.getClosedNode();
if(img && /img/i.test( img.tagName ) && img.className != "edui-faked-video" &&!img.getAttribute("word_img") ){
var first = opt.shift();
var floatStyle = first['floatStyle'];
delete first['floatStyle'];
//// img.style.border = (first.border||0) +"px solid #000";
//// img.style.margin = (first.margin||0) +"px";
// img.style.cssText += ';margin:' + (first.margin||0) +"px;" + 'border:' + (first.border||0) +"px solid #000";
domUtils.setAttributes(img,first);
me.execCommand('imagefloat',floatStyle);
if(opt.length > 0){
range.setStartAfter(img).setCursor(false,true);
me.execCommand('insertimage',opt);
}
}else{
var html = [],str = '',ci;
ci = opt[0];
if(opt.length == 1){
str = '<img src="'+ci.src+'" '+ (ci.data_ue_src ? ' data_ue_src="' + ci.data_ue_src +'" ':'') +
(ci.width ? 'width="'+ci.width+'" ':'') +
(ci.height ? ' height="'+ci.height+'" ':'') +
(ci['floatStyle']&&ci['floatStyle']!='center' ? ' style="float:'+ci['floatStyle']+';"':'') +
(ci.title?' title="'+ci.title+'"':'') + ' border="'+ (ci.border||0) + '" hspace = "'+(ci.hspace||0)+'" vspace = "'+(ci.vspace||0)+'" />';
if(ci['floatStyle'] == 'center'){
str = '<p style="text-align: center">'+str+'</p>'
}
html.push(str)
}else{
for(var i=0;ci=opt[i++];){
str = '<p ' + (ci['floatStyle'] == 'center' ? 'style="text-align: center" ' : '') + '><img src="'+ci.src+'" '+
(ci.width ? 'width="'+ci.width+'" ':'') + (ci.data_ue_src ? ' data_ue_src="' + ci.data_ue_src +'" ':'') +
(ci.height ? ' height="'+ci.height+'" ':'') +
' style="' + (ci['floatStyle']&&ci['floatStyle']!='center' ? 'float:'+ci['floatStyle']+';':'') +
(ci.border||'') + '" ' +
(ci.title?' title="'+ci.title+'"':'') + ' /></p>';
// if(ci['floatStyle'] == 'center'){
// str = '<p style="text-align: center">'+str+'</p>'
// }
html.push(str)
}
}
me.execCommand('insertHtml',html.join(''));
}
},
queryCommandState : function(){
return this.highlight ? -1 :0;
}
}; | 10npsite | trunk/guanli/system/ueditor/_src/plugins/image.js | JavaScript | asf20 | 8,043 |
///import core
///commands 格式
///commandsName Paragraph
///commandsTitle 段落格式
/**
* 段落样式
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName paragraph插入段落执行命令
* @param {String} style 标签值为:'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'
* @param {String} attrs 标签的属性
* @author zhanyi
*/
(function() {
var block = domUtils.isBlockElm,
notExchange = ['TD','LI','PRE'],
doParagraph = function(range,style,attrs,sourceCmdName){
var bookmark = range.createBookmark(),
filterFn = function( node ) {
return node.nodeType == 1 ? node.tagName.toLowerCase() != 'br' && !domUtils.isBookmarkNode(node) : !domUtils.isWhitespace( node )
},
para;
range.enlarge( true );
var bookmark2 = range.createBookmark(),
current = domUtils.getNextDomNode( bookmark2.start, false, filterFn ),
tmpRange = range.cloneRange(),
tmpNode;
while ( current && !(domUtils.getPosition( current, bookmark2.end ) & domUtils.POSITION_FOLLOWING) ) {
if ( current.nodeType == 3 || !block( current ) ) {
tmpRange.setStartBefore( current );
while ( current && current !== bookmark2.end && !block( current ) ) {
tmpNode = current;
current = domUtils.getNextDomNode( current, false, null, function( node ) {
return !block( node )
} );
}
tmpRange.setEndAfter( tmpNode );
para = range.document.createElement( style );
if(attrs){
domUtils.setAttributes(para,attrs);
if(sourceCmdName && sourceCmdName == 'customstyle' && attrs.style)
para.style.cssText = attrs.style;
}
para.appendChild( tmpRange.extractContents() );
//需要内容占位
if(domUtils.isEmptyNode(para)){
domUtils.fillChar(range.document,para);
}
tmpRange.insertNode( para );
var parent = para.parentNode;
//如果para上一级是一个block元素且不是body,td就删除它
if ( block( parent ) && !domUtils.isBody( para.parentNode ) && utils.indexOf(notExchange,parent.tagName)==-1) {
//存储dir,style
if(!(sourceCmdName && sourceCmdName == 'customstyle')){
parent.getAttribute('dir') && para.setAttribute('dir',parent.getAttribute('dir'));
//trace:1070
parent.style.cssText && (para.style.cssText = parent.style.cssText + ';' + para.style.cssText);
//trace:1030
parent.style.textAlign && !para.style.textAlign && (para.style.textAlign = parent.style.textAlign);
parent.style.textIndent && !para.style.textIndent && (para.style.textIndent = parent.style.textIndent);
parent.style.padding && !para.style.padding && (para.style.padding = parent.style.padding);
}
//trace:1706 选择的就是h1-6要删除
if(attrs && /h\d/i.test(parent.tagName) && !/h\d/i.test(para.tagName) ){
domUtils.setAttributes(parent,attrs);
if(sourceCmdName && sourceCmdName == 'customstyle' && attrs.style)
parent.style.cssText = attrs.style;
domUtils.remove(para,true);
para = parent;
}else
domUtils.remove( para.parentNode, true );
}
if( utils.indexOf(notExchange,parent.tagName)!=-1){
current = parent;
}else{
current = para;
}
current = domUtils.getNextDomNode( current, false, filterFn );
} else {
current = domUtils.getNextDomNode( current, true, filterFn );
}
}
return range.moveToBookmark( bookmark2 ).moveToBookmark( bookmark );
};
UE.commands['paragraph'] = {
execCommand : function( cmdName, style,attrs,sourceCmdName ) {
var range = new dom.Range(this.document);
if(this.currentSelectedArr && this.currentSelectedArr.length > 0){
for(var i=0,ti;ti=this.currentSelectedArr[i++];){
//trace:1079 不显示的不处理,插入文本,空的td也能加上相应的标签
if(ti.style.display == 'none') continue;
if(domUtils.isEmptyNode(ti)){
var tmpTxt = this.document.createTextNode('paragraph');
ti.innerHTML = '';
ti.appendChild(tmpTxt);
}
doParagraph(range.selectNodeContents(ti),style,attrs,sourceCmdName);
if(tmpTxt){
var pN = tmpTxt.parentNode;
domUtils.remove(tmpTxt);
if(domUtils.isEmptyNode(pN)){
domUtils.fillNode(this.document,pN)
}
}
}
var td = this.currentSelectedArr[0];
if(domUtils.isEmptyBlock(td)){
range.setStart(td,0).setCursor(false,true);
}else{
range.selectNode(td).select()
}
}else{
range = this.selection.getRange();
//闭合时单独处理
if(range.collapsed){
var txt = this.document.createTextNode('p');
range.insertNode(txt);
//去掉冗余的fillchar
if(browser.ie){
var node = txt.previousSibling;
if(node && domUtils.isWhitespace(node)){
domUtils.remove(node)
}
node = txt.nextSibling;
if(node && domUtils.isWhitespace(node)){
domUtils.remove(node)
}
}
}
range = doParagraph(range,style,attrs,sourceCmdName);
if(txt){
range.setStartBefore(txt).collapse(true);
pN = txt.parentNode;
domUtils.remove(txt);
if(domUtils.isBlockElm(pN)&&domUtils.isEmptyNode(pN)){
domUtils.fillNode(this.document,pN)
}
}
if(browser.gecko && range.collapsed && range.startContainer.nodeType == 1){
var child = range.startContainer.childNodes[range.startOffset];
if(child && child.nodeType == 1 && child.tagName.toLowerCase() == style){
range.setStart(child,0).collapse(true)
}
}
//trace:1097 原来有true,原因忘了,但去了就不能清除多余的占位符了
range.select()
}
return true;
},
queryCommandValue : function() {
var node = utils.findNode(this.selection.getStartElementPath(),['p','h1','h2','h3','h4','h5','h6']);
return node ? node.tagName.toLowerCase() : '';
},
queryCommandState : function(){
return this.highlight ? -1 :0;
}
}
})();
| 10npsite | trunk/guanli/system/ueditor/_src/plugins/paragraph.js | JavaScript | asf20 | 8,362 |
///import core
///import plugins\inserthtml.js
///commands 插入框架
///commandsName InsertFrame
///commandsTitle 插入Iframe
///commandsDialog dialogs\insertframe\insertframe.html
UE.commands['insertframe'] = {
queryCommandState : function(){
return this.highlight ? -1 :0;
}
};
| 10npsite | trunk/guanli/system/ueditor/_src/plugins/iframe.js | JavaScript | asf20 | 306 |
///import core
///commands 右键菜单
///commandsName ContextMenu
///commandsTitle 右键菜单
/**
* 右键菜单
* @function
* @name baidu.editor.plugins.contextmenu
* @author zhanyi
*/
UE.plugins['contextmenu'] = function () {
var me = this,
menu,
items = me.options.contextMenu;
if(!items || items.length==0) return;
var uiUtils = UE.ui.uiUtils;
me.addListener('contextmenu',function(type,evt){
var offset = uiUtils.getViewportOffsetByEvent(evt);
me.fireEvent('beforeselectionchange');
if (menu)
menu.destroy();
for (var i = 0,ti,contextItems = []; ti = items[i]; i++) {
var last;
(function(item) {
if (item == '-') {
if ((last = contextItems[contextItems.length - 1 ] ) && last !== '-')
contextItems.push('-');
} else if (item.group) {
for (var j = 0,cj,subMenu = []; cj = item.subMenu[j]; j++) {
(function(subItem) {
if (subItem == '-') {
if ((last = subMenu[subMenu.length - 1 ] ) && last !== '-')
subMenu.push('-');
} else {
if (me.queryCommandState(subItem.cmdName) != -1) {
subMenu.push({
'label':subItem.label,
className: 'edui-for-' + subItem.cmdName + (subItem.value || ''),
onclick : subItem.exec ? function() {
subItem.exec.call(me)
} : function() {
me.execCommand(subItem.cmdName, subItem.value)
}
})
}
}
})(cj)
}
if (subMenu.length) {
contextItems.push({
'label' : item.group,
className: 'edui-for-' + item.icon,
'subMenu' : {
items: subMenu,
editor:me
}
})
}
} else {
if (me.queryCommandState(item.cmdName) != -1) {
//highlight todo
if(item.cmdName == 'highlightcode' && me.queryCommandState(item.cmdName) == 0)
return;
contextItems.push({
'label':item.label,
className: 'edui-for-' + (item.icon ? item.icon : item.cmdName + (item.value || '')),
onclick : item.exec ? function() {
item.exec.call(me)
} : function() {
me.execCommand(item.cmdName, item.value)
}
})
}
}
})(ti)
}
if (contextItems[contextItems.length - 1] == '-')
contextItems.pop();
menu = new UE.ui.Menu({
items: contextItems,
editor:me
});
menu.render();
menu.showAt(offset);
domUtils.preventDefault(evt);
if(browser.ie){
var ieRange;
try{
ieRange = me.selection.getNative().createRange();
}catch(e){
return;
}
if(ieRange.item){
var range = new dom.Range(me.document);
range.selectNode(ieRange.item(0)).select(true,true);
}
}
})
};
| 10npsite | trunk/guanli/system/ueditor/_src/plugins/contextmenu.js | JavaScript | asf20 | 4,228 |
///import core
///commands 超链接,取消链接
///commandsName Link,Unlink
///commandsTitle 超链接,取消链接
///commandsDialog dialogs\link\link.html
/**
* 超链接
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName link插入超链接
* @param {Object} options url地址,title标题,target是否打开新页
* @author zhanyi
*/
/**
* 取消链接
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName unlink取消链接
* @author zhanyi
*/
(function() {
function optimize( range ) {
var start = range.startContainer,end = range.endContainer;
if ( start = domUtils.findParentByTagName( start, 'a', true ) ) {
range.setStartBefore( start )
}
if ( end = domUtils.findParentByTagName( end, 'a', true ) ) {
range.setEndAfter( end )
}
}
UE.commands['unlink'] = {
execCommand : function() {
var as,
range = new dom.Range(this.document),
tds = this.currentSelectedArr,
bookmark;
if(tds && tds.length >0){
for(var i=0,ti;ti=tds[i++];){
as = domUtils.getElementsByTagName(ti,'a');
for(var j=0,aj;aj=as[j++];){
domUtils.remove(aj,true);
}
}
if(domUtils.isEmptyNode(tds[0])){
range.setStart(tds[0],0).setCursor();
}else{
range.selectNodeContents(tds[0]).select()
}
}else{
range = this.selection.getRange();
if(range.collapsed && !domUtils.findParentByTagName( range.startContainer, 'a', true )){
return;
}
bookmark = range.createBookmark();
optimize( range );
range.removeInlineStyle( 'a' ).moveToBookmark( bookmark ).select();
}
},
queryCommandState : function(){
return !this.highlight && this.queryCommandValue('link') ? 0 : -1;
}
};
function doLink(range,opt){
optimize( range = range.adjustmentBoundary() );
var start = range.startContainer;
if(start.nodeType == 1){
start = start.childNodes[range.startOffset];
if(start && start.nodeType == 1 && start.tagName == 'A' && /^(?:https?|ftp|file)\s*:\s*\/\//.test(start[browser.ie?'innerText':'textContent'])){
start.innerHTML = opt.href;
}
}
range.removeInlineStyle( 'a' );
if ( range.collapsed ) {
var a = range.document.createElement( 'a' );
domUtils.setAttributes( a, opt );
a.innerHTML = opt.href;
range.insertNode( a ).selectNode( a );
} else {
range.applyInlineStyle( 'a', opt )
}
}
UE.commands['link'] = {
queryCommandState : function(){
return this.highlight ? -1 :0;
},
execCommand : function( cmdName, opt ) {
var range = new dom.Range(this.document),
tds = this.currentSelectedArr;
if(tds && tds.length){
for(var i=0,ti;ti=tds[i++];){
if(domUtils.isEmptyNode(ti)){
ti.innerHTML = opt.href
}
doLink(range.selectNodeContents(ti),opt)
}
range.selectNodeContents(tds[0]).select()
}else{
doLink(range=this.selection.getRange(),opt);
range.collapse().select(browser.gecko ? true : false);
}
},
queryCommandValue : function() {
var range = new dom.Range(this.document),
tds = this.currentSelectedArr,
as,
node;
if(tds && tds.length){
for(var i=0,ti;ti=tds[i++];){
as = ti.getElementsByTagName('a');
if(as[0])
return as[0]
}
}else{
range = this.selection.getRange();
if ( range.collapsed ) {
node = this.selection.getStart();
if ( node && (node = domUtils.findParentByTagName( node, 'a', true )) ) {
return node;
}
} else {
//trace:1111 如果是<p><a>xx</a></p> startContainer是p就会找不到a
range.shrinkBoundary();
var start = range.startContainer.nodeType == 3 || !range.startContainer.childNodes[range.startOffset] ? range.startContainer : range.startContainer.childNodes[range.startOffset],
end = range.endContainer.nodeType == 3 || range.endOffset == 0 ? range.endContainer : range.endContainer.childNodes[range.endOffset-1],
common = range.getCommonAncestor();
node = domUtils.findParentByTagName( common, 'a', true );
if ( !node && common.nodeType == 1){
var as = common.getElementsByTagName( 'a' ),
ps,pe;
for ( var i = 0,ci; ci = as[i++]; ) {
ps = domUtils.getPosition( ci, start ),pe = domUtils.getPosition( ci,end);
if ( (ps & domUtils.POSITION_FOLLOWING || ps & domUtils.POSITION_CONTAINS)
&&
(pe & domUtils.POSITION_PRECEDING || pe & domUtils.POSITION_CONTAINS)
) {
node = ci;
break;
}
}
}
return node;
}
}
}
};
})();
| 10npsite | trunk/guanli/system/ueditor/_src/plugins/link.js | JavaScript | asf20 | 6,192 |
///import core
/**
* @description 插入内容
* @name baidu.editor.execCommand
* @param {String} cmdName inserthtml插入内容的命令
* @param {String} html 要插入的内容
* @author zhanyi
*/
UE.commands['inserthtml'] = {
execCommand: function (command,html){
var me = this,
range,deletedElms, i,ci,
div,
tds = me.currentSelectedArr;
range = me.selection.getRange();
div = range.document.createElement( 'div' );
div.style.display = 'inline';
div.innerHTML = utils.trim( html );
try{
me.adjustTable && me.adjustTable(div);
}catch(e){}
if(tds && tds.length){
for(var i=0,ti;ti=tds[i++];){
ti.className = ''
}
tds[0].innerHTML = '';
range.setStart(tds[0],0).collapse(true);
me.currentSelectedArr = [];
}
if ( !range.collapsed ) {
range.deleteContents();
if(range.startContainer.nodeType == 1){
var child = range.startContainer.childNodes[range.startOffset],pre;
if(child && domUtils.isBlockElm(child) && (pre = child.previousSibling) && domUtils.isBlockElm(pre)){
range.setEnd(pre,pre.childNodes.length).collapse();
while(child.firstChild){
pre.appendChild(child.firstChild);
}
domUtils.remove(child);
}
}
}
var child,parent,pre,tmp,hadBreak = 0;
while ( child = div.firstChild ) {
range.insertNode( child );
if ( !hadBreak && child.nodeType == domUtils.NODE_ELEMENT && domUtils.isBlockElm( child ) ){
parent = domUtils.findParent( child,function ( node ){ return domUtils.isBlockElm( node ); } );
if ( parent && parent.tagName.toLowerCase() != 'body' && !(dtd[parent.tagName][child.nodeName] && child.parentNode === parent)){
if(!dtd[parent.tagName][child.nodeName]){
pre = parent;
}else{
tmp = child.parentNode;
while (tmp !== parent){
pre = tmp;
tmp = tmp.parentNode;
}
}
domUtils.breakParent( child, pre || tmp );
//去掉break后前一个多余的节点 <p>|<[p> ==> <p></p><div></div><p>|</p>
var pre = child.previousSibling;
domUtils.trimWhiteTextNode(pre);
if(!pre.childNodes.length){
domUtils.remove(pre);
}
hadBreak = 1;
}
}
var next = child.nextSibling;
if(!div.firstChild && next && domUtils.isBlockElm(next)){
range.setStart(next,0).collapse(true);
break;
}
range.setEndAfter( child ).collapse();
}
// if(!range.startContainer.childNodes[range.startOffset] && domUtils.isBlockElm(range.startContainer)){
// next = editor.document.createElement('br');
// range.insertNode(next);
// range.collapse(true);
// }
//block为空无法定位光标
child = range.startContainer;
//用chrome可能有空白展位符
if(domUtils.isBlockElm(child) && domUtils.isEmptyNode(child)){
child.innerHTML = browser.ie ? '' : '<br/>'
}
//加上true因为在删除表情等时会删两次,第一次是删的fillData
range.select(true);
setTimeout(function(){
range = me.selection.getRange();
range.scrollToView(me.autoHeightEnabled,me.autoHeightEnabled ? domUtils.getXY(me.iframe).y:0);
},200)
}
};
| 10npsite | trunk/guanli/system/ueditor/_src/plugins/inserthtml.js | JavaScript | asf20 | 4,509 |
///import core
///import plugins\removeformat.js
///commands 格式刷
///commandsName FormatMatch
///commandsTitle 格式刷
/**
* 格式刷,只格式inline的
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName formatmatch执行格式刷
*/
UE.plugins['formatmatch'] = function(){
var me = this,
list = [],img,
flag = 0;
me.addListener('reset',function(){
list = [];
flag = 0;
});
function addList(type,evt){
if(browser.webkit){
var target = evt.target.tagName == 'IMG' ? evt.target : null;
}
function addFormat(range){
if(text && (!me.currentSelectedArr || !me.currentSelectedArr.length)){
range.selectNode(text);
}
return range.applyInlineStyle(list[list.length-1].tagName,null,list);
}
me.undoManger && me.undoManger.save();
var range = me.selection.getRange(),
imgT = target || range.getClosedNode();
if(img && imgT && imgT.tagName == 'IMG'){
//trace:964
imgT.style.cssText += ';float:' + (img.style.cssFloat || img.style.styleFloat ||'none') + ';display:' + (img.style.display||'inline');
img = null;
}else{
if(!img){
var collapsed = range.collapsed;
if(collapsed){
var text = me.document.createTextNode('match');
range.insertNode(text).select();
}
me.__hasEnterExecCommand = true;
//不能把block上的属性干掉
//trace:1553
var removeFormatAttributes = me.options.removeFormatAttributes;
me.options.removeFormatAttributes = '';
me.execCommand('removeformat');
me.options.removeFormatAttributes = removeFormatAttributes;
me.__hasEnterExecCommand = false;
//trace:969
range = me.selection.getRange();
if(list.length == 0){
if(me.currentSelectedArr && me.currentSelectedArr.length > 0){
range.selectNodeContents(me.currentSelectedArr[0]).select();
}
}else{
if(me.currentSelectedArr && me.currentSelectedArr.length > 0){
for(var i=0,ci;ci=me.currentSelectedArr[i++];){
range.selectNodeContents(ci);
addFormat(range);
}
range.selectNodeContents(me.currentSelectedArr[0]).select();
}else{
addFormat(range)
}
}
if(!me.currentSelectedArr || !me.currentSelectedArr.length){
if(text){
range.setStartBefore(text).collapse(true);
}
range.select()
}
text && domUtils.remove(text);
}
}
me.undoManger && me.undoManger.save();
me.removeListener('mouseup',addList);
flag = 0;
}
me.commands['formatmatch'] = {
execCommand : function( cmdName ) {
if(flag){
flag = 0;
list = [];
me.removeListener('mouseup',addList);
return;
}
var range = me.selection.getRange();
img = range.getClosedNode();
if(!img || img.tagName != 'IMG'){
range.collapse(true).shrinkBoundary();
var start = range.startContainer;
list = domUtils.findParents(start,true,function(node){
return !domUtils.isBlockElm(node) && node.nodeType == 1
});
//a不能加入格式刷, 并且克隆节点
for(var i=0,ci;ci=list[i];i++){
if(ci.tagName == 'A'){
list.splice(i,1);
break;
}
}
}
me.addListener('mouseup',addList);
flag = 1;
},
queryCommandState : function() {
if(this.highlight){
return -1;
}
return flag;
},
notNeedUndo : 1
}
};
| 10npsite | trunk/guanli/system/ueditor/_src/plugins/formatmatch.js | JavaScript | asf20 | 4,622 |
///import core
///commands 打印
///commandsName Print
///commandsTitle 打印
/**
* @description 打印
* @name baidu.editor.execCommand
* @param {String} cmdName print打印编辑器内容
* @author zhanyi
*/
UE.commands['print'] = {
execCommand : function(){
this.window.print();
},
notNeedUndo : 1
};
| 10npsite | trunk/guanli/system/ueditor/_src/plugins/print.js | JavaScript | asf20 | 359 |
///import core
///import plugins\inserthtml.js
///commands 特殊字符
///commandsName Spechars
///commandsTitle 特殊字符
///commandsDialog dialogs\spechars\spechars.html
UE.commands['spechars'] = {
queryCommandState : function(){
return this.highlight ? -1 :0;
}
};
| 10npsite | trunk/guanli/system/ueditor/_src/plugins/spechars.js | JavaScript | asf20 | 302 |
///import core
///commands 清除格式
///commandsName RemoveFormat
///commandsTitle 清除格式
/**
* @description 清除格式
* @name baidu.editor.execCommand
* @param {String} cmdName removeformat清除格式命令
* @param {String} tags 以逗号隔开的标签。如:span,a
* @param {String} style 样式
* @param {String} attrs 属性
* @param {String} notIncluedA 是否把a标签切开
* @author zhanyi
*/
UE.commands['removeformat'] = {
execCommand : function( cmdName, tags, style, attrs,notIncludeA ) {
var tagReg = new RegExp( '^(?:' + (tags || this.options.removeFormatTags).replace( /,/g, '|' ) + ')$', 'i' ) ,
removeFormatAttributes = style ? [] : (attrs || this.options.removeFormatAttributes).split( ',' ),
range = new dom.Range( this.document ),
bookmark,node,parent,
filter = function( node ) {
return node.nodeType == 1;
};
function isRedundantSpan (node) {
if (node.nodeType == 3 || node.tagName.toLowerCase() != 'span')
return 0;
if (browser.ie) {
//ie 下判断实效,所以只能简单用style来判断
//return node.style.cssText == '' ? 1 : 0;
var attrs = node.attributes;
if ( attrs.length ) {
for ( var i = 0,l = attrs.length; i<l; i++ ) {
if ( attrs[i].specified ) {
return 0;
}
}
return 1;
}
}
return !node.attributes.length
}
function doRemove( range ) {
var bookmark1 = range.createBookmark();
if ( range.collapsed ) {
range.enlarge( true );
}
//不能把a标签切了
if(!notIncludeA){
var aNode = domUtils.findParentByTagName(range.startContainer,'a',true);
if(aNode){
range.setStartBefore(aNode)
}
aNode = domUtils.findParentByTagName(range.endContainer,'a',true);
if(aNode){
range.setEndAfter(aNode)
}
}
bookmark = range.createBookmark();
node = bookmark.start;
//切开始
while ( (parent = node.parentNode) && !domUtils.isBlockElm( parent ) ) {
domUtils.breakParent( node, parent );
domUtils.clearEmptySibling( node );
}
if ( bookmark.end ) {
//切结束
node = bookmark.end;
while ( (parent = node.parentNode) && !domUtils.isBlockElm( parent ) ) {
domUtils.breakParent( node, parent );
domUtils.clearEmptySibling( node );
}
//开始去除样式
var current = domUtils.getNextDomNode( bookmark.start, false, filter ),
next;
while ( current ) {
if ( current == bookmark.end ) {
break;
}
next = domUtils.getNextDomNode( current, true, filter );
if ( !dtd.$empty[current.tagName.toLowerCase()] && !domUtils.isBookmarkNode( current ) ) {
if ( tagReg.test( current.tagName ) ) {
if ( style ) {
domUtils.removeStyle( current, style );
if ( isRedundantSpan( current ) && style != 'text-decoration')
domUtils.remove( current, true );
} else {
domUtils.remove( current, true )
}
} else {
//trace:939 不能把list上的样式去掉
if(!dtd.$tableContent[current.tagName] && !dtd.$list[current.tagName]){
domUtils.removeAttributes( current, removeFormatAttributes );
if ( isRedundantSpan( current ) )
domUtils.remove( current, true );
}
}
}
current = next;
}
}
//trace:1035
//trace:1096 不能把td上的样式去掉,比如边框
var pN = bookmark.start.parentNode;
if(domUtils.isBlockElm(pN) && !dtd.$tableContent[pN.tagName] && !dtd.$list[pN.tagName]){
domUtils.removeAttributes( pN,removeFormatAttributes );
}
pN = bookmark.end.parentNode;
if(bookmark.end && domUtils.isBlockElm(pN) && !dtd.$tableContent[pN.tagName]&& !dtd.$list[pN.tagName]){
domUtils.removeAttributes( pN,removeFormatAttributes );
}
range.moveToBookmark( bookmark ).moveToBookmark(bookmark1);
//清除冗余的代码 <b><bookmark></b>
var node = range.startContainer,
tmp,
collapsed = range.collapsed;
while(node.nodeType == 1 && domUtils.isEmptyNode(node) && dtd.$removeEmpty[node.tagName]){
tmp = node.parentNode;
range.setStartBefore(node);
//trace:937
//更新结束边界
if(range.startContainer === range.endContainer){
range.endOffset--;
}
domUtils.remove(node);
node = tmp;
}
if(!collapsed){
node = range.endContainer;
while(node.nodeType == 1 && domUtils.isEmptyNode(node) && dtd.$removeEmpty[node.tagName]){
tmp = node.parentNode;
range.setEndBefore(node);
domUtils.remove(node);
node = tmp;
}
}
}
if ( this.currentSelectedArr && this.currentSelectedArr.length ) {
for ( var i = 0,ci; ci = this.currentSelectedArr[i++]; ) {
range.selectNodeContents( ci );
doRemove( range );
}
range.selectNodeContents( this.currentSelectedArr[0] ).select();
} else {
range = this.selection.getRange();
doRemove( range );
range.select();
}
},
queryCommandState : function(){
return this.highlight ? -1 :0;
}
};
| 10npsite | trunk/guanli/system/ueditor/_src/plugins/removeformat.js | JavaScript | asf20 | 6,893 |
(function(){UEDITOR_CONFIG = window.UEDITOR_CONFIG || {};
var baidu = window.baidu || {};
window.baidu = baidu;
window.UE = baidu.editor = {};
UE.plugins = {};
UE.commands = {};
UE.version = "1.2.0.0";
var dom = UE.dom = {};
///import editor.js
/**
* @class baidu.editor.browser 判断浏览器
*/
var browser = UE.browser = function(){
var agent = navigator.userAgent.toLowerCase(),
opera = window.opera,
browser = {
/**
* 检测浏览器是否为IE
* @name baidu.editor.browser.ie
* @property 检测浏览器是否为IE
* @grammar baidu.editor.browser.ie
* @return {Boolean} 返回是否为ie浏览器
*/
ie : !!window.ActiveXObject,
/**
* 检测浏览器是否为Opera
* @name baidu.editor.browser.opera
* @property 检测浏览器是否为Opera
* @grammar baidu.editor.browser.opera
* @return {Boolean} 返回是否为opera浏览器
*/
opera : ( !!opera && opera.version ),
/**
* 检测浏览器是否为WebKit内核
* @name baidu.editor.browser.webkit
* @property 检测浏览器是否为WebKit内核
* @grammar baidu.editor.browser.webkit
* @return {Boolean} 返回是否为WebKit内核
*/
webkit : ( agent.indexOf( ' applewebkit/' ) > -1 ),
/**
* 检查是否为Macintosh系统
* @name baidu.editor.browser.mac
* @property 检查是否为Macintosh系统
* @grammar baidu.editor.browser.mac
* @return {Boolean} 返回是否为Macintosh系统
*/
mac : ( agent.indexOf( 'macintosh' ) > -1 ),
/**
* 检查浏览器是否为quirks模式
* @name baidu.editor.browser.quirks
* @property 检查浏览器是否为quirks模式
* @grammar baidu.editor.browser.quirks
* @return {Boolean} 返回是否为quirks模式
*/
quirks : ( document.compatMode == 'BackCompat' )
};
/**
* 检测浏览器是否为Gecko内核,如Firefox
* @name baidu.editor.browser.gecko
* @property 检测浏览器是否为Gecko内核
* @grammar baidu.editor.browser.gecko
* @return {Boolean} 返回是否为Gecko内核
*/
browser.gecko = ( navigator.product == 'Gecko' && !browser.webkit && !browser.opera );
var version = 0;
// Internet Explorer 6.0+
if ( browser.ie )
{
version = parseFloat( agent.match( /msie (\d+)/ )[1] );
/**
* 检测浏览器是否为 IE8 浏览器
* @name baidu.editor.browser.IE8
* @property 检测浏览器是否为 IE8 浏览器
* @grammar baidu.editor.browser.IE8
* @return {Boolean} 返回是否为 IE8 浏览器
*/
browser.ie8 = !!document.documentMode;
/**
* 检测浏览器是否为 IE8 模式
* @name baidu.editor.browser.ie8Compat
* @property 检测浏览器是否为 IE8 模式
* @grammar baidu.editor.browser.ie8Compat
* @return {Boolean} 返回是否为 IE8 模式
*/
browser.ie8Compat = document.documentMode == 8;
/**
* 检测浏览器是否运行在 兼容IE7模式
* @name baidu.editor.browser.ie7Compat
* @property 检测浏览器是否为兼容IE7模式
* @grammar baidu.editor.browser.ie7Compat
* @return {Boolean} 返回是否为兼容IE7模式
*/
browser.ie7Compat = ( ( version == 7 && !document.documentMode )
|| document.documentMode == 7 );
/**
* 检测浏览器是否IE6模式或怪异模式
* @name baidu.editor.browser.ie6Compat
* @property 检测浏览器是否IE6 模式或怪异模式
* @grammar baidu.editor.browser.ie6Compat
* @return {Boolean} 返回是否为IE6 模式或怪异模式
*/
browser.ie6Compat = ( version < 7 || browser.quirks );
}
// Gecko.
if ( browser.gecko )
{
var geckoRelease = agent.match( /rv:([\d\.]+)/ );
if ( geckoRelease )
{
geckoRelease = geckoRelease[1].split( '.' );
version = geckoRelease[0] * 10000 + ( geckoRelease[1] || 0 ) * 100 + ( geckoRelease[2] || 0 ) * 1;
}
}
/**
* 检测浏览器是否为chrome
* @name baidu.editor.browser.chrome
* @property 检测浏览器是否为chrome
* @grammar baidu.editor.browser.chrome
* @return {Boolean} 返回是否为chrome浏览器
*/
if (/chrome\/(\d+\.\d)/i.test(agent)) {
browser.chrome = + RegExp['\x241'];
}
/**
* 检测浏览器是否为safari
* @name baidu.editor.browser.safari
* @property 检测浏览器是否为safari
* @grammar baidu.editor.browser.safari
* @return {Boolean} 返回是否为safari浏览器
*/
if(/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(agent) && !/chrome/i.test(agent)){
browser.safari = + (RegExp['\x241'] || RegExp['\x242']);
}
// Opera 9.50+
if ( browser.opera )
version = parseFloat( opera.version() );
// WebKit 522+ (Safari 3+)
if ( browser.webkit )
version = parseFloat( agent.match( / applewebkit\/(\d+)/ )[1] );
/**
* 浏览器版本
*
* gecko内核浏览器的版本会转换成这样(如 1.9.0.2 -> 10900).
*
* webkit内核浏览器版本号使用其build号 (如 522).
* @name baidu.editor.browser.version
* @grammar baidu.editor.browser.version
* @return {Boolean} 返回浏览器版本号
* @example
* if ( baidu.editor.browser.ie && <b>baidu.editor.browser.version</b> <= 6 )
* alert( "Ouch!" );
*/
browser.version = version;
/**
* 是否是兼容模式的浏览器
* @name baidu.editor.browser.isCompatible
* @grammar baidu.editor.browser.isCompatible
* @return {Boolean} 返回是否是兼容模式的浏览器
* @example
* if ( baidu.editor.browser.isCompatible )
* alert( "Your browser is pretty cool!" );
*/
browser.isCompatible =
!browser.mobile && (
( browser.ie && version >= 6 ) ||
( browser.gecko && version >= 10801 ) ||
( browser.opera && version >= 9.5 ) ||
( browser.air && version >= 1 ) ||
( browser.webkit && version >= 522 ) ||
false );
return browser;
}();
//快捷方式
var ie = browser.ie,
webkit = browser.webkit,
gecko = browser.gecko;
///import editor.js
///import core/utils.js
/**
* @class baidu.editor.utils 工具类
*/
var utils = UE.utils =
/**@lends baidu.editor.utils.prototype*/
{
/**
* 以obj为原型创建实例
* @public
* @function
* @param {Object} obj
* @return {Object} 返回新的对象
*/
makeInstance: function(obj) {
var noop = new Function();
noop.prototype = obj;
obj = new noop;
noop.prototype = null;
return obj;
},
/**
* 将s对象中的属性扩展到t对象上
* @public
* @function
* @param {Object} t
* @param {Object} s
* @param {Boolean} b 是否保留已有属性
* @returns {Object} t 返回扩展了s对象属性的t
*/
extend: function(t, s, b) {
if (s) {
for (var k in s) {
if (!b || ! t.hasOwnProperty(k)) {
t[k] = s[k];
}
}
}
return t;
},
/**
* 判断是否为数组
* @public
* @function
* @param {Object} array
* @return {Boolean} true:为数组,false:不为数组
*/
isArray: function(array) {
return Object.prototype.toString.apply(array) === '[object Array]'
},
/**
* 判断是否为字符串
* @public
* @function
* @param {Object} str
* @return {Boolean} true:为字符串。 false:不为字符串
*/
isString: function(str) {
return typeof str == 'string' || str.constructor == String;
},
/**
* subClass继承superClass
* @public
* @function
* @param {Object} subClass 子类
* @param {Object} superClass 超类
* @return {Object} 扩展后的新对象
*/
inherits: function(subClass, superClass) {
var oldP = subClass.prototype,
newP = utils.makeInstance(superClass.prototype);
utils.extend(newP, oldP, true);
subClass.prototype = newP;
return (newP.constructor = subClass);
},
/**
* 为对象绑定函数
* @public
* @function
* @param {Function} fn 函数
* @param {Object} this_ 对象
* @return {Function} 绑定后的函数
*/
bind: function(fn, this_) {
return function() {
return fn.apply(this_, arguments);
};
},
/**
* 创建延迟执行的函数
* @public
* @function
* @param {Function} fn 要执行的函数
* @param {Number} delay 延迟时间,单位为毫秒
* @param {Boolean} exclusion 是否互斥执行,true则执行下一次defer时会先把前一次的延迟函数删除
* @return {Function} 延迟执行的函数
*/
defer: function(fn, delay, exclusion) {
var timerID;
return function() {
if (exclusion) {
clearTimeout(timerID);
}
timerID = setTimeout(fn, delay);
};
},
/**
* 查找元素在数组中的索引, 若找不到返回-1
* @public
* @function
* @param {Array} array 要查找的数组
* @param {*} item 查找的元素
* @param {Number} at 开始查找的位置
* @returns {Number} 返回在数组中的索引
*/
indexOf: function(array, item, at) {
for(var i=at||0,l = array.length;i<l;i++){
if(array[i] === item){
return i;
}
}
return -1;
},
findNode : function(nodes,tagNames,fn){
for(var i=0,ci;ci=nodes[i++];){
if(fn? fn(ci) : this.indexOf(tagNames,ci.tagName.toLowerCase())!=-1){
return ci;
}
}
},
/**
* 移除数组中的元素
* @public
* @function
* @param {Array} array 要删除元素的数组
* @param {*} item 要删除的元素
*/
removeItem: function(array, item) {
for(var i=0,l = array.length;i<l;i++){
if(array[i] === item){
array.splice(i,1);
i--;
}
}
},
/**
* 删除字符串首尾空格
* @public
* @function
* @param {String} str 字符串
* @return {String} str 删除空格后的字符串
*/
trim: function(str) {
return str.replace(/(^[ \t\n\r]+)|([ \t\n\r]+$)/g, '');
},
/**
* 将字符串转换成hashmap
* @public
* @function
* @param {String/Array} list 字符串,以‘,’隔开
* @returns {Object} 转成hashmap的对象
*/
listToMap: function(list) {
if(!list)return {};
list = utils.isArray(list) ? list : list.split(',');
for(var i=0,ci,obj={};ci=list[i++];){
obj[ci.toUpperCase()] = obj[ci] = 1;
}
return obj;
},
/**
* 将str中的html符号转义
* @public
* @function
* @param {String} str 需要转义的字符串
* @returns {String} 转义后的字符串
*/
unhtml: function(str) {
return str ? str.replace(/[&<">]/g, function(m){
return {
'<': '<',
'&': '&',
'"': '"',
'>': '>'
}[m]
}) : '';
},
/**
* 将css样式转换为驼峰的形式。如font-size -> fontSize
* @public
* @function
* @param {String} cssName 需要转换的样式
* @returns {String} 转换后的样式
*/
cssStyleToDomStyle: function() {
var test = document.createElement('div').style,
cache = {
'float': test.cssFloat != undefined ? 'cssFloat' : test.styleFloat != undefined ? 'styleFloat': 'float'
};
return function(cssName) {
return cache[cssName] || (cache[cssName] = cssName.toLowerCase().replace(/-./g, function(match){return match.charAt(1).toUpperCase();}));
};
}(),
/**
* 加载css文件,执行回调函数
* @public
* @function
* @param {document} doc document对象
* @param {String} path 文件路径
* @param {Function} fun 回调函数
* @param {String} id 元素id
*/
loadFile : function(doc,obj,fun){
if (obj.id && doc.getElementById(obj.id)) {
return;
}
var element = doc.createElement(obj.tag);
delete obj.tag;
for(var p in obj){
element.setAttribute(p,obj[p]);
}
element.onload = element.onreadystatechange = function() {
if (!this.readyState || /loaded|complete/.test(this.readyState)) {
fun && fun();
element.onload = element.onreadystatechange = null;
}
};
doc.getElementsByTagName("head")[0].appendChild(element);
},
/**
* 判断对象是否为空
* @param {Object} obj
* @return {Boolean} true 空,false 不空
*/
isEmptyObject : function(obj){
for ( var p in obj ) {
return false;
}
return true;
},
fixColor : function (name, value) {
if (/color/i.test(name) && /rgba?/.test(value)) {
var array = value.split(",");
if (array.length > 3)
return "";
value = "#";
for (var i = 0, color; color = array[i++];) {
color = parseInt(color.replace(/[^\d]/gi, ''), 10).toString(16);
value += color.length == 1 ? "0" + color : color;
}
value = value.toUpperCase();
}
return value;
},
/**
* 只针对border,padding,margin做了处理,因为性能问题
* @public
* @function
* @param {String} val style字符串
*/
optCss : function(val){
var padding,margin,border;
val = val.replace(/(padding|margin|border)\-([^:]+):([^;]+);?/gi,function(str,key,name,val){
if(val.split(' ').length == 1){
switch (key){
case 'padding':
!padding && (padding = {});
padding[name] = val;
return '';
case 'margin':
!margin && (margin = {});
margin[name] = val;
return '';
case 'border':
return val == 'initial' ? '' : str;
}
}
return str
});
function opt(obj,name){
if(!obj)
return ''
var t = obj.top ,b = obj.bottom,l = obj.left,r = obj.right,val = '';
if(!t || !l || !b || !r){
for(var p in obj){
val +=';'+name+'-' + p + ':' + obj[p]+';';
}
}else{
val += ';'+name+':' +
(t == b && b == l && l == r ? t :
t == b && l == r ? (t + ' ' + l) :
l == r ? (t + ' ' + l + ' ' + b) : (t + ' ' + r + ' ' + b + ' ' + l))+';'
}
return val;
}
val += opt(padding,'padding') + opt(margin,'margin');
return val.replace(/^[ \n\r\t;]*|[ \n\r\t]*$/,'').replace(/;([ \n\r\t]+)|\1;/g,';')
.replace(/(&((l|g)t|quot|#39))?;{2,}/g,function(a,b){
return b ? b + ";;" : ';'
})
}
};
///import editor.js
///import core/utils.js
/**
* 事件基础类
* @public
* @class
* @name baidu.editor.EventBase
*/
var EventBase = UE.EventBase = function(){};
EventBase.prototype = /**@lends baidu.editor.EventBase.prototype*/{
/**
* 注册事件监听器
* @public
* @function
* @param {String} type 事件名
* @param {Function} listener 监听器数组
*/
addListener : function ( type, listener ) {
getListener( this, type, true ).push( listener );
},
/**
* 移除事件监听器
* @public
* @function
* @param {String} type 事件名
* @param {Function} listener 监听器数组
*/
removeListener : function ( type, listener ) {
var listeners = getListener( this, type );
listeners && utils.removeItem( listeners, listener );
},
/**
* 触发事件
* @public
* @function
* @param {String} type 事件名
*
*/
fireEvent : function ( type ) {
var listeners = getListener( this, type ),
r, t, k;
if ( listeners ) {
k = listeners.length;
while ( k -- ) {
t = listeners[k].apply( this, arguments );
if ( t !== undefined ) {
r = t;
}
}
}
if ( t = this['on' + type.toLowerCase()] ) {
r = t.apply( this, arguments );
}
return r;
}
};
/**
* 获得对象所拥有监听类型的所有监听器
* @public
* @function
* @param {Object} obj 查询监听器的对象
* @param {String} type 事件类型
* @param {Boolean} force 为true且当前所有type类型的侦听器不存在时,创建一个空监听器数组
* @returns {Array} 监听器数组
*/
function getListener( obj, type, force ) {
var allListeners;
type = type.toLowerCase();
return ( ( allListeners = ( obj.__allListeners || force && ( obj.__allListeners = {} ) ) )
&& ( allListeners[type] || force && ( allListeners[type] = [] ) ) );
}
///import editor.js
///import core/dom/dom.js
/**
* dtd html语义化的体现类
* @constructor
* @namespace dtd
*/
var dtd = dom.dtd = (function() {
function _( s ) {
for (var k in s) {
s[k.toUpperCase()] = s[k];
}
return s;
}
function X( t ) {
var a = arguments;
for ( var i=1; i<a.length; i++ ) {
var x = a[i];
for ( var k in x ) {
if (!t.hasOwnProperty(k)) {
t[k] = x[k];
}
}
}
return t;
}
var A = _({isindex:1,fieldset:1}),
B = _({input:1,button:1,select:1,textarea:1,label:1}),
C = X( _({a:1}), B ),
D = X( {iframe:1}, C ),
E = _({hr:1,ul:1,menu:1,div:1,blockquote:1,noscript:1,table:1,center:1,address:1,dir:1,pre:1,h5:1,dl:1,h4:1,noframes:1,h6:1,ol:1,h1:1,h3:1,h2:1}),
F = _({ins:1,del:1,script:1,style:1}),
G = X( _({b:1,acronym:1,bdo:1,'var':1,'#':1,abbr:1,code:1,br:1,i:1,cite:1,kbd:1,u:1,strike:1,s:1,tt:1,strong:1,q:1,samp:1,em:1,dfn:1,span:1}), F ),
H = X( _({sub:1,img:1,embed:1,object:1,sup:1,basefont:1,map:1,applet:1,font:1,big:1,small:1}), G ),
I = X( _({p:1}), H ),
J = X( _({iframe:1}), H, B ),
K = _({img:1,embed:1,noscript:1,br:1,kbd:1,center:1,button:1,basefont:1,h5:1,h4:1,samp:1,h6:1,ol:1,h1:1,h3:1,h2:1,form:1,font:1,'#':1,select:1,menu:1,ins:1,abbr:1,label:1,code:1,table:1,script:1,cite:1,input:1,iframe:1,strong:1,textarea:1,noframes:1,big:1,small:1,span:1,hr:1,sub:1,bdo:1,'var':1,div:1,object:1,sup:1,strike:1,dir:1,map:1,dl:1,applet:1,del:1,isindex:1,fieldset:1,ul:1,b:1,acronym:1,a:1,blockquote:1,i:1,u:1,s:1,tt:1,address:1,q:1,pre:1,p:1,em:1,dfn:1}),
L = X( _({a:0}), J ),//a不能被切开,所以把他
M = _({tr:1}),
N = _({'#':1}),
O = X( _({param:1}), K ),
P = X( _({form:1}), A, D, E, I ),
Q = _({li:1}),
R = _({style:1,script:1}),
S = _({base:1,link:1,meta:1,title:1}),
T = X( S, R ),
U = _({head:1,body:1}),
V = _({html:1});
var block = _({address:1,blockquote:1,center:1,dir:1,div:1,dl:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,isindex:1,menu:1,noframes:1,ol:1,p:1,pre:1,table:1,ul:1}),
//针对优酷的embed他添加了结束标识,导致粘贴进来会变成两个,暂时去掉 ,embed:1
empty = _({area:1,base:1,br:1,col:1,hr:1,img:1,input:1,link:1,meta:1,param:1,embed:1});
return _({
// $ 表示自定的属性
// body外的元素列表.
$nonBodyContent: X( V, U, S ),
//块结构元素列表
$block : block,
//内联元素列表
$inline : L,
$body : X( _({script:1,style:1}), block ),
$cdata : _({script:1,style:1}),
//自闭和元素
$empty : empty,
//不是自闭合,但不能让range选中里边
$nonChild : _({iframe:1}),
//列表元素列表
$listItem : _({dd:1,dt:1,li:1}),
//列表根元素列表
$list: _({ul:1,ol:1,dl:1}),
//不能认为是空的元素
$isNotEmpty : _({table:1,ul:1,ol:1,dl:1,iframe:1,area:1,base:1,col:1,hr:1,img:1,embed:1,input:1,link:1,meta:1,param:1}),
//如果没有子节点就可以删除的元素列表,像span,a
$removeEmpty : _({a:1,abbr:1,acronym:1,address:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,s:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1}),
$removeEmptyBlock : _({'p':1,'div':1}),
//在table元素里的元素列表
$tableContent : _({caption:1,col:1,colgroup:1,tbody:1,td:1,tfoot:1,th:1,thead:1,tr:1,table:1}),
//不转换的标签
$notTransContent : _({pre:1,script:1,style:1,textarea:1}),
html: U,
head: T,
style: N,
script: N,
body: P,
base: {},
link: {},
meta: {},
title: N,
col : {},
tr : _({td:1,th:1}),
img : {},
embed: {},
colgroup : _({thead:1,col:1,tbody:1,tr:1,tfoot:1}),
noscript : P,
td : P,
br : {},
th : P,
center : P,
kbd : L,
button : X( I, E ),
basefont : {},
h5 : L,
h4 : L,
samp : L,
h6 : L,
ol : Q,
h1 : L,
h3 : L,
option : N,
h2 : L,
form : X( A, D, E, I ),
select : _({optgroup:1,option:1}),
font : L,
ins : L,
menu : Q,
abbr : L,
label : L,
table : _({thead:1,col:1,tbody:1,tr:1,colgroup:1,caption:1,tfoot:1}),
code : L,
tfoot : M,
cite : L,
li : P,
input : {},
iframe : P,
strong : L,
textarea : N,
noframes : P,
big : L,
small : L,
span :_({'#':1,br:1}),
hr : L,
dt : L,
sub : L,
optgroup : _({option:1}),
param : {},
bdo : L,
'var' : L,
div : P,
object : O,
sup : L,
dd : P,
strike : L,
area : {},
dir : Q,
map : X( _({area:1,form:1,p:1}), A, F, E ),
applet : O,
dl : _({dt:1,dd:1}),
del : L,
isindex : {},
fieldset : X( _({legend:1}), K ),
thead : M,
ul : Q,
acronym : L,
b : L,
a : X( _({a:1}), J ),
blockquote :X(_({td:1,tr:1,tbody:1,li:1}),P),
caption : L,
i : L,
u : L,
tbody : M,
s : L,
address : X( D, I ),
tt : L,
legend : L,
q : L,
pre : X( G, C ),
p : X(_({'a':1}),L),
em :L,
dfn : L
});
})();
///import editor.js
///import core/utils.js
///import core/browser.js
///import core/dom/dom.js
///import core/dom/dtd.js
/**
* @class baidu.editor.dom.domUtils dom工具类
*/
//for getNextDomNode getPreviousDomNode
function getDomNode(node, start, ltr, startFromChild, fn, guard) {
var tmpNode = startFromChild && node[start],
parent;
!tmpNode && (tmpNode = node[ltr]);
while (!tmpNode && (parent = (parent || node).parentNode)) {
if (parent.tagName == 'BODY' || guard && !guard(parent))
return null;
tmpNode = parent[ltr];
}
if (tmpNode && fn && !fn(tmpNode)) {
return getDomNode(tmpNode, start, ltr, false, fn)
}
return tmpNode;
}
var attrFix = ie && browser.version < 9 ? {
tabindex: "tabIndex",
readonly: "readOnly",
"for": "htmlFor",
"class": "className",
maxlength: "maxLength",
cellspacing: "cellSpacing",
cellpadding: "cellPadding",
rowspan: "rowSpan",
colspan: "colSpan",
usemap: "useMap",
frameborder: "frameBorder"
} : {
tabindex: "tabIndex",
readonly: "readOnly"
},
styleBlock = utils.listToMap([
'-webkit-box','-moz-box','block' ,
'list-item' ,'table' ,'table-row-group' ,
'table-header-group','table-footer-group' ,
'table-row' ,'table-column-group' ,'table-column' ,
'table-cell' ,'table-caption'
]);
var domUtils = dom.domUtils = {
//节点常量
NODE_ELEMENT : 1,
NODE_DOCUMENT : 9,
NODE_TEXT : 3,
NODE_COMMENT : 8,
NODE_DOCUMENT_FRAGMENT : 11,
//位置关系
POSITION_IDENTICAL : 0,
POSITION_DISCONNECTED : 1,
POSITION_FOLLOWING : 2,
POSITION_PRECEDING : 4,
POSITION_IS_CONTAINED : 8,
POSITION_CONTAINS : 16,
//ie6使用其他的会有一段空白出现
fillChar : ie && browser.version == '6' ? '\ufeff' : '\u200B',
//-------------------------Node部分--------------------------------
keys : {
/*Backspace*/ 8:1, /*Delete*/ 46:1,
/*Shift*/ 16:1, /*Ctrl*/ 17:1, /*Alt*/ 18:1,
37:1, 38:1, 39:1, 40:1,
13:1 /*enter*/
},
/**
* 获取两个节点的位置关系
* @function
* @param {Node} nodeA 节点A
* @param {Node} nodeB 节点B
* @returns {Number} 返回位置关系
*/
getPosition : function (nodeA, nodeB) {
// 如果两个节点是同一个节点
if (nodeA === nodeB) {
// domUtils.POSITION_IDENTICAL
return 0;
}
var node,
parentsA = [nodeA],
parentsB = [nodeB];
node = nodeA;
while (node = node.parentNode) {
// 如果nodeB是nodeA的祖先节点
if (node === nodeB) {
// domUtils.POSITION_IS_CONTAINED + domUtils.POSITION_FOLLOWING
return 10;
}
parentsA.push(node);
}
node = nodeB;
while (node = node.parentNode) {
// 如果nodeA是nodeB的祖先节点
if (node === nodeA) {
// domUtils.POSITION_CONTAINS + domUtils.POSITION_PRECEDING
return 20;
}
parentsB.push(node);
}
parentsA.reverse();
parentsB.reverse();
if (parentsA[0] !== parentsB[0])
// domUtils.POSITION_DISCONNECTED
return 1;
var i = -1;
while (i++,parentsA[i] === parentsB[i]) ;
nodeA = parentsA[i];
nodeB = parentsB[i];
while (nodeA = nodeA.nextSibling) {
if (nodeA === nodeB) {
// domUtils.POSITION_PRECEDING
return 4
}
}
// domUtils.POSITION_FOLLOWING
return 2;
},
/**
* 返回节点索引,zero-based
* @function
* @param {Node} node 节点
* @returns {Number} 节点的索引
*/
getNodeIndex : function (node) {
var child = node.parentNode.firstChild,i = 0;
while(node!==child){
i++;
child = child.nextSibling;
}
return i;
},
/**
* 判断节点是否在树上
* @param node
*/
inDoc: function (node, doc){
while (node = node.parentNode) {
if (node === doc) {
return true;
}
}
return false;
},
/**
* 查找祖先节点
* @function
* @param {Node} node 节点
* @param {Function} tester 以函数为规律
* @param {Boolean} includeSelf 包含自己
* @returns {Node} 返回祖先节点
*/
findParent : function (node, tester, includeSelf) {
if (!domUtils.isBody(node)) {
node = includeSelf ? node : node.parentNode;
while (node) {
if (!tester || tester(node) || this.isBody(node)) {
return tester && !tester(node) && this.isBody(node) ? null : node;
}
node = node.parentNode;
}
}
return null;
},
/**
* 查找祖先节点
* @function
* @param {Node} node 节点
* @param {String} tagName 标签名称
* @param {Boolean} includeSelf 包含自己
* @returns {Node} 返回祖先节点
*/
findParentByTagName : function(node, tagName, includeSelf,excludeFn) {
if (node && node.nodeType && !this.isBody(node) && (node.nodeType == 1 || node.nodeType)) {
tagName = utils.listToMap(utils.isArray(tagName) ? tagName : [tagName]);
node = node.nodeType == 3 || !includeSelf ? node.parentNode : node;
while (node && node.tagName && node.nodeType != 9) {
if(excludeFn && excludeFn(node))
break;
if (tagName[node.tagName])
return node;
node = node.parentNode;
}
}
return null;
},
/**
* 查找祖先节点集合
* @param {Node} node 节点
* @param {Function} tester 函数
* @param {Boolean} includeSelf 是否从自身开始找
* @param {Boolean} closerFirst
* @returns {Array} 祖先节点集合
*/
findParents: function (node, includeSelf, tester, closerFirst) {
var parents = includeSelf && ( tester && tester(node) || !tester ) ? [node] : [];
while (node = domUtils.findParent(node, tester)) {
parents.push(node);
}
return closerFirst ? parents : parents.reverse();
},
/**
* 往后插入节点
* @function
* @param {Node} node 基准节点
* @param {Node} nodeToInsert 要插入的节点
* @return {Node} 返回node
*/
insertAfter : function (node, nodeToInsert) {
return node.parentNode.insertBefore(nodeToInsert, node.nextSibling);
},
/**
* 删除该节点
* @function
* @param {Node} node 要删除的节点
* @param {Boolean} keepChildren 是否保留子节点不删除
* @return {Node} 返回要删除的节点
*/
remove : function (node, keepChildren) {
var parent = node.parentNode,
child;
if (parent) {
if (keepChildren && node.hasChildNodes()) {
while (child = node.firstChild) {
parent.insertBefore(child, node);
}
}
parent.removeChild(node);
}
return node;
},
/**
* 取得node节点在dom树上的下一个节点
* @function
* @param {Node} node 节点
* @param {Boolean} startFromChild 为true从子节点开始找
* @param {Function} fn fn为真的节点
* @return {Node} 返回下一个节点
*/
getNextDomNode : function(node, startFromChild, filter, guard) {
return getDomNode(node, 'firstChild', 'nextSibling', startFromChild, filter, guard);
},
/**
* 是bookmark节点
* @param {Node} node 判断是否为书签节点
* @return {Boolean} 返回是否为书签节点
*/
isBookmarkNode : function(node) {
return node.nodeType == 1 && node.id && /^_baidu_bookmark_/i.test(node.id);
},
/**
* 获取节点所在window对象
* @param {Node} node 节点
* @return {window} 返回window对象
*/
getWindow : function (node) {
var doc = node.ownerDocument || node;
return doc.defaultView || doc.parentWindow;
},
/**
* 得到公共的祖先节点
* @param {Node} nodeA 节点A
* @param {Node} nodeB 节点B
* @return {Node} nodeA和nodeB的公共节点
*/
getCommonAncestor : function(nodeA, nodeB) {
if (nodeA === nodeB)
return nodeA;
var parentsA = [nodeA] ,parentsB = [nodeB], parent = nodeA,
i = -1;
while (parent = parent.parentNode) {
if (parent === nodeB)
return parent;
parentsA.push(parent)
}
parent = nodeB;
while (parent = parent.parentNode) {
if (parent === nodeA)
return parent;
parentsB.push(parent)
}
parentsA.reverse();
parentsB.reverse();
while (i++,parentsA[i] === parentsB[i]);
return i == 0 ? null : parentsA[i - 1];
},
/**
* 清除该节点左右空的inline节点
* @function
* @param {Node} node
* @param {Boolean} ingoreNext 默认为false清除右边为空的inline节点。true为不清除右边为空的inline节点
* @param {Boolean} ingorePre 默认为false清除左边为空的inline节点。true为不清除左边为空的inline节点
* @exmaple <b></b><i></i>xxxx<b>bb</b> --> xxxx<b>bb</b>
*/
clearEmptySibling : function(node, ingoreNext, ingorePre) {
function clear(next, dir) {
var tmpNode;
while(next && !domUtils.isBookmarkNode(next) && (domUtils.isEmptyInlineElement(next) || domUtils.isWhitespace(next) )){
tmpNode = next[dir];
domUtils.remove(next);
next = tmpNode;
}
}
!ingoreNext && clear(node.nextSibling, 'nextSibling');
!ingorePre && clear(node.previousSibling, 'previousSibling');
},
//---------------------------Text----------------------------------
/**
* 将一个文本节点拆分成两个文本节点
* @param {TextNode} node 文本节点
* @param {Integer} offset 拆分的位置
* @return {TextNode} 拆分后的后一个文本节
*/
split: function (node, offset) {
var doc = node.ownerDocument;
if (browser.ie && offset == node.nodeValue.length) {
var next = doc.createTextNode('');
return domUtils.insertAfter(node, next);
}
var retval = node.splitText(offset);
//ie8下splitText不会跟新childNodes,我们手动触发他的更新
if (browser.ie8) {
var tmpNode = doc.createTextNode('');
domUtils.insertAfter(retval, tmpNode);
domUtils.remove(tmpNode);
}
return retval;
},
/**
* 判断是否为空白节点
* @param {TextNode} node 节点
* @return {Boolean} 返回是否为文本节点
*/
isWhitespace : function(node) {
return !new RegExp('[^ \t\n\r' + domUtils.fillChar + ']').test(node.nodeValue);
},
//------------------------------Element-------------------------------------------
/**
* 获取元素相对于viewport的像素坐标
* @param {Element} element 元素
* @returns {Object} 返回坐标对象{x:left,y:top}
*/
getXY : function (element) {
var x = 0,y = 0;
while (element.offsetParent) {
y += element.offsetTop;
x += element.offsetLeft;
element = element.offsetParent;
}
return {
'x': x,
'y': y
};
},
/**
* 绑原生DOM事件
* @param {Element|Window|Document} target 元素
* @param {Array|String} type 事件类型
* @param {Function} handler 执行函数
*/
on : function (obj, type, handler) {
var types = type instanceof Array ? type : [type],
k = types.length;
if (k) while (k --) {
type = types[k];
if (obj.addEventListener) {
obj.addEventListener(type, handler, false);
} else {
if(!handler._d)
handler._d ={};
var key = type+handler.toString();
if(!handler._d[key]){
handler._d[key] = function(evt) {
return handler.call(evt.srcElement, evt || window.event);
};
obj.attachEvent('on' + type,handler._d[key]);
}
}
}
obj = null;
},
/**
* 解除原生DOM事件绑定
* @param {Element|Window|Document} obj 元素
* @param {Array|String} type 事件类型
* @param {Function} handler 执行函数
*/
un : function (obj, type, handler) {
var types = type instanceof Array ? type : [type],
k = types.length;
if (k) while (k --) {
type = types[k];
if (obj.removeEventListener) {
obj.removeEventListener(type, handler, false);
} else {
var key = type+handler.toString();
obj.detachEvent('on' + type, handler._d ? handler._d[key] : handler);
if(handler._d && handler._d[key]){
delete handler._d[key];
}
}
}
},
/**
* 比较两个节点是否tagName相同且有相同的属性和属性值
* @param {Element} nodeA 节点A
* @param {Element} nodeB 节点B
* @return {Boolean} 返回两个节点的标签,属性和属性值是否相同
* @example
* <span style="font-size:12px">ssss</span>和<span style="font-size:12px">bbbbb</span> 相等
* <span style="font-size:13px">ssss</span>和<span style="font-size:12px">bbbbb</span> 不相等
*/
isSameElement : function(nodeA, nodeB) {
if (nodeA.tagName != nodeB.tagName)
return 0;
var thisAttribs = nodeA.attributes,
otherAttribs = nodeB.attributes;
if (!ie && thisAttribs.length != otherAttribs.length)
return 0;
var attrA,attrB,al = 0,bl=0;
for(var i= 0;attrA=thisAttribs[i++];){
if(attrA.nodeName == 'style' ){
if(attrA.specified)al++;
if(domUtils.isSameStyle(nodeA,nodeB)){
continue
}else{
return 0;
}
}
if(ie){
if(attrA.specified){
al++;
attrB = otherAttribs.getNamedItem(attrA.nodeName);
}else{
continue;
}
}else{
attrB = nodeB.attributes[attrA.nodeName];
}
if(!attrB.specified)return 0;
if(attrA.nodeValue != attrB.nodeValue)
return 0;
}
// 有可能attrB的属性包含了attrA的属性之外还有自己的属性
if(ie){
for(i=0;attrB = otherAttribs[i++];){
if(attrB.specified){
bl++;
}
}
if(al!=bl)
return 0;
}
return 1;
},
/**
* 判断两个元素的style属性是不是一致
* @param {Element} elementA 元素A
* @param {Element} elementB 元素B
* @return {boolean} 返回判断结果,true为一致
*/
isSameStyle : function (elementA, elementB) {
var styleA = elementA.style.cssText.replace(/( ?; ?)/g,';').replace(/( ?: ?)/g,':'),
styleB = elementB.style.cssText.replace(/( ?; ?)/g,';').replace(/( ?: ?)/g,':');
if(!styleA || !styleB){
return styleA == styleB ? 1: 0;
}
styleA = styleA.split(';');
styleB = styleB.split(';');
if(styleA.length != styleB.length)
return 0;
for(var i = 0,ci;ci=styleA[i++];){
if(utils.indexOf(styleB,ci) == -1)
return 0
}
return 1;
},
/**
* 检查是否为块元素
* @function
* @param {Element} node 元素
* @param {String} customNodeNames 自定义的块元素的tagName
* @return {Boolean} 是否为块元素
*/
isBlockElm : function (node) {
return node.nodeType == 1 && (dtd.$block[node.tagName]||styleBlock[domUtils.getComputedStyle(node,'display')])&& !dtd.$nonChild[node.tagName];
},
/**
* 判断是否body
* @param {Node} 节点
* @return {Boolean} 是否是body节点
*/
isBody : function(node) {
return node && node.nodeType == 1 && node.tagName.toLowerCase() == 'body';
},
/**
* 以node节点为中心,将该节点的父节点拆分成2块
* @param {Element} node 节点
* @param {Element} parent 要被拆分的父节点
* @example <div>xxxx<b>xxx</b>xxx</div> ==> <div>xxx</div><b>xx</b><div>xxx</div>
*/
breakParent : function(node, parent) {
var tmpNode, parentClone = node, clone = node, leftNodes, rightNodes;
do {
parentClone = parentClone.parentNode;
if (leftNodes) {
tmpNode = parentClone.cloneNode(false);
tmpNode.appendChild(leftNodes);
leftNodes = tmpNode;
tmpNode = parentClone.cloneNode(false);
tmpNode.appendChild(rightNodes);
rightNodes = tmpNode;
} else {
leftNodes = parentClone.cloneNode(false);
rightNodes = leftNodes.cloneNode(false);
}
while (tmpNode = clone.previousSibling) {
leftNodes.insertBefore(tmpNode, leftNodes.firstChild);
}
while (tmpNode = clone.nextSibling) {
rightNodes.appendChild(tmpNode);
}
clone = parentClone;
} while (parent !== parentClone);
tmpNode = parent.parentNode;
tmpNode.insertBefore(leftNodes, parent);
tmpNode.insertBefore(rightNodes, parent);
tmpNode.insertBefore(node, rightNodes);
domUtils.remove(parent);
return node;
},
/**
* 检查是否是空inline节点
* @param {Node} node 节点
* @return {Boolean} 返回1为是,0为否
* @example
* <b><i></i></b> //true
* <b><i></i><u></u></b> true
* <b></b> true <b>xx<i></i></b> //false
*/
isEmptyInlineElement : function(node) {
if (node.nodeType != 1 || !dtd.$removeEmpty[ node.tagName ])
return 0;
node = node.firstChild;
while (node) {
//如果是创建的bookmark就跳过
if (domUtils.isBookmarkNode(node))
return 0;
if (node.nodeType == 1 && !domUtils.isEmptyInlineElement(node) ||
node.nodeType == 3 && !domUtils.isWhitespace(node)
) {
return 0;
}
node = node.nextSibling;
}
return 1;
},
/**
* 删除空白子节点
* @param {Element} node 需要删除空白子节点的元素
*/
trimWhiteTextNode : function(node) {
function remove(dir) {
var child;
while ((child = node[dir]) && child.nodeType == 3 && domUtils.isWhitespace(child))
node.removeChild(child)
}
remove('firstChild');
remove('lastChild');
},
/**
* 合并子节点
* @param {Node} node 节点
* @param {String} tagName 标签
* @param {String} attrs 属性
* @example <span style="font-size:12px;">xx<span style="font-size:12px;">aa</span>xx</span 使用后
* <span style="font-size:12px;">xxaaxx</span
*/
mergChild : function(node, tagName, attrs) {
var list = domUtils.getElementsByTagName(node, node.tagName.toLowerCase());
for (var i = 0,ci; ci = list[i++];) {
if (!ci.parentNode || domUtils.isBookmarkNode(ci)) continue;
//span单独处理
if (ci.tagName.toLowerCase() == 'span') {
if (node === ci.parentNode) {
domUtils.trimWhiteTextNode(node);
if (node.childNodes.length == 1) {
node.style.cssText = ci.style.cssText + ";" + node.style.cssText;
domUtils.remove(ci, true);
continue;
}
}
ci.style.cssText = node.style.cssText + ';' + ci.style.cssText;
if (attrs) {
var style = attrs.style;
if (style) {
style = style.split(';');
for (var j = 0,s; s = style[j++];) {
ci.style[utils.cssStyleToDomStyle(s.split(':')[0])] = s.split(':')[1];
}
}
}
if (domUtils.isSameStyle(ci, node)) {
domUtils.remove(ci, true)
}
continue;
}
if (domUtils.isSameElement(node, ci)) {
domUtils.remove(ci, true);
}
}
if (tagName == 'span') {
var as = domUtils.getElementsByTagName(node, 'a');
for (var i = 0,ai; ai = as[i++];) {
ai.style.cssText = ';' + node.style.cssText;
ai.style.textDecoration = 'underline';
}
}
},
/**
* 封装原生的getElemensByTagName
* @param {Node} node 根节点
* @param {String} name 标签的tagName
* @return {Array} 返回符合条件的元素数组
*/
getElementsByTagName : function(node, name) {
var list = node.getElementsByTagName(name),arr = [];
for (var i = 0,ci; ci = list[i++];) {
arr.push(ci)
}
return arr;
},
/**
* 将子节点合并到父节点上
* @param {Element} node 节点
* @example <span style="color:#ff"><span style="font-size:12px">xxx</span></span> ==> <span style="color:#ff;font-size:12px">xxx</span>
*/
mergToParent : function(node) {
var parent = node.parentNode;
while (parent && dtd.$removeEmpty[parent.tagName]) {
if (parent.tagName == node.tagName || parent.tagName == 'A') {//针对a标签单独处理
domUtils.trimWhiteTextNode(parent);
//span需要特殊处理 不处理这样的情况 <span stlye="color:#fff">xxx<span style="color:#ccc">xxx</span>xxx</span>
if (parent.tagName == 'SPAN' && !domUtils.isSameStyle(parent, node)
|| (parent.tagName == 'A' && node.tagName == 'SPAN')) {
if (parent.childNodes.length > 1 || parent !== node.parentNode) {
node.style.cssText = parent.style.cssText + ";" + node.style.cssText;
parent = parent.parentNode;
continue;
} else {
parent.style.cssText += ";" + node.style.cssText;
//trace:952 a标签要保持下划线
if (parent.tagName == 'A') {
parent.style.textDecoration = 'underline';
}
}
}
if(parent.tagName != 'A' ){
parent === node.parentNode && domUtils.remove(node, true);
break;
}
}
parent = parent.parentNode;
}
},
/**
* 合并左右兄弟节点
* @function
* @param {Node} node
* @param {Boolean} ingoreNext 默认为false合并上一个兄弟节点。true为不合并上一个兄弟节点
* @param {Boolean} ingorePre 默认为false合并下一个兄弟节点。true为不合并下一个兄弟节点
* @example <b>xxxx</b><b>xxx</b><b>xxxx</b> ==> <b>xxxxxxxxxxx</b>
*/
mergSibling : function(node, ingorePre, ingoreNext) {
function merg(rtl, start, node) {
var next;
if ((next = node[rtl]) && !domUtils.isBookmarkNode(next) && next.nodeType == 1 && domUtils.isSameElement(node, next)) {
while (next.firstChild) {
if (start == 'firstChild') {
node.insertBefore(next.lastChild, node.firstChild);
} else {
node.appendChild(next.firstChild)
}
}
domUtils.remove(next);
}
}
!ingorePre && merg('previousSibling', 'firstChild', node);
!ingoreNext && merg('nextSibling', 'lastChild', node);
},
/**
* 使得元素及其子节点不能被选择
* @function
* @param {Node} node 节点
*/
unselectable :
gecko ?
function(node) {
node.style.MozUserSelect = 'none';
}
: webkit ?
function(node) {
node.style.KhtmlUserSelect = 'none';
}
:
function(node) {
//for ie9
node.onselectstart = function () { return false; };
node.onclick = node.onkeyup = node.onkeydown = function(){return false};
node.unselectable = 'on';
node.setAttribute("unselectable","on");
for (var i = 0,ci; ci = node.all[i++];) {
switch (ci.tagName.toLowerCase()) {
case 'iframe' :
case 'textarea' :
case 'input' :
case 'select' :
break;
default :
ci.unselectable = 'on';
node.setAttribute("unselectable","on");
}
}
},
/**
* 删除元素上的属性,可以删除多个
* @function
* @param {Element} element 元素
* @param {Array} attrNames 要删除的属性数组
*/
removeAttributes : function (elm, attrNames) {
for(var i = 0,ci;ci=attrNames[i++];){
ci = attrFix[ci] || ci;
switch (ci){
case 'className':
elm[ci] = '';
break;
case 'style':
elm.style.cssText = '';
!browser.ie && elm.removeAttributeNode(elm.getAttributeNode('style'))
}
elm.removeAttribute(ci);
}
},
/**
* 给节点添加属性
* @function
* @param {Node} node 节点
* @param {Object} attrNames 要添加的属性名称,采用json对象存放
*/
setAttributes : function(node, attrs) {
for (var name in attrs) {
var value = attrs[name];
switch (name) {
case 'class':
//ie下要这样赋值,setAttribute不起作用
node.className = value;
break;
case 'style' :
node.style.cssText = node.style.cssText + ";" + value;
break;
case 'innerHTML':
node[name] = value;
break;
case 'value':
node.value = value;
break;
default:
node.setAttribute(attrFix[name]||name, value);
}
}
return node;
},
/**
* 获取元素的样式
* @function
* @param {Element} element 元素
* @param {String} styleName 样式名称
* @return {String} 样式值
*/
getComputedStyle : function (element, styleName) {
function fixUnit(key, val) {
if (key == 'font-size' && /pt$/.test(val)) {
val = Math.round(parseFloat(val) / 0.75) + 'px';
}
return val;
}
if(element.nodeType == 3){
element = element.parentNode;
}
//ie下font-size若body下定义了font-size,则从currentStyle里会取到这个font-size. 取不到实际值,故此修改.
if (browser.ie && browser.version < 9 && styleName == 'font-size' && !element.style.fontSize &&
!dtd.$empty[element.tagName] && !dtd.$nonChild[element.tagName]) {
var span = element.ownerDocument.createElement('span');
span.style.cssText = 'padding:0;border:0;font-family:simsun;';
span.innerHTML = '.';
element.appendChild(span);
var result = span.offsetHeight;
element.removeChild(span);
span = null;
return result + 'px';
}
try {
var value = domUtils.getStyle(element, styleName) ||
(window.getComputedStyle ? domUtils.getWindow(element).getComputedStyle(element, '').getPropertyValue(styleName) :
( element.currentStyle || element.style )[utils.cssStyleToDomStyle(styleName)]);
} catch(e) {
return null;
}
return fixUnit(styleName, utils.fixColor(styleName, value));
},
/**
* 删除cssClass,可以支持删除多个class,需以空格分隔
* @param {Element} element 元素
* @param {Array} classNames 删除的className
*/
removeClasses : function (element, classNames) {
element.className = (' ' + element.className + ' ').replace(
new RegExp('(?:\\s+(?:' + classNames.join('|') + '))+\\s+', 'g'), ' ');
},
/**
* 删除元素的样式
* @param {Element} element元素
* @param {String} name 删除的样式名称
*/
removeStyle : function(node, name) {
node.style[utils.cssStyleToDomStyle(name)] = '';
if(!node.style.cssText)
domUtils.removeAttributes(node,['style'])
},
/**
* 判断元素属性中是否包含某一个classname
* @param {Element} element 元素
* @param {String} className 样式名
* @returns {Boolean} 是否包含该classname
*/
hasClass : function (element, className) {
return ( ' ' + element.className + ' ' ).indexOf(' ' + className + ' ') > -1;
},
/**
* 阻止事件默认行为
* @param {Event} evt 需要组织的事件对象
*/
preventDefault : function (evt) {
evt.preventDefault ? evt.preventDefault() : (evt.returnValue = false);
},
/**
* 获得元素样式
* @param {Element} element 元素
* @param {String} name 样式名称
* @return {String} 返回元素样式值
*/
getStyle : function(element, name) {
var value = element.style[ utils.cssStyleToDomStyle(name) ];
return utils.fixColor(name, value);
},
setStyle: function (element, name, value) {
element.style[utils.cssStyleToDomStyle(name)] = value;
},
setStyles: function (element, styles) {
for (var name in styles) {
if (styles.hasOwnProperty(name)) {
domUtils.setStyle(element, name, styles[name]);
}
}
},
/**
* 删除_moz_dirty属性
* @function
* @param {Node} node 节点
*/
removeDirtyAttr : function(node) {
for (var i = 0,ci,nodes = node.getElementsByTagName('*'); ci = nodes[i++];) {
ci.removeAttribute('_moz_dirty')
}
node.removeAttribute('_moz_dirty')
},
/**
* 返回子节点的数量
* @function
* @param {Node} node 父节点
* @param {Function} fn 过滤子节点的规则,若为空,则得到所有子节点的数量
* @return {Number} 符合条件子节点的数量
*/
getChildCount : function (node, fn) {
var count = 0,first = node.firstChild;
fn = fn || function() {
return 1
};
while (first) {
if (fn(first))
count++;
first = first.nextSibling;
}
return count;
},
/**
* 判断是否为空节点
* @function
* @param {Node} node 节点
* @return {Boolean} 是否为空节点
*/
isEmptyNode : function(node) {
return !node.firstChild || domUtils.getChildCount(node, function(node) {
return !domUtils.isBr(node) && !domUtils.isBookmarkNode(node) && !domUtils.isWhitespace(node)
}) == 0
},
/**
* 清空节点所有的className
* @function
* @param {Array} nodes 节点数组
*/
clearSelectedArr : function(nodes) {
var node;
while(node = nodes.pop()){
domUtils.removeAttributes(node,['class']);
}
},
/**
* 将显示区域滚动到显示节点的位置
* @function
* @param {Node} node 节点
* @param {window} win window对象
* @param {Number} offsetTop 距离上方的偏移量
*/
scrollToView : function(node, win, offsetTop) {
var
getViewPaneSize = function() {
var doc = win.document,
mode = doc.compatMode == 'CSS1Compat';
return {
width : ( mode ? doc.documentElement.clientWidth : doc.body.clientWidth ) || 0,
height : ( mode ? doc.documentElement.clientHeight : doc.body.clientHeight ) || 0
};
},
getScrollPosition = function(win) {
if ('pageXOffset' in win) {
return {
x : win.pageXOffset || 0,
y : win.pageYOffset || 0
};
}
else {
var doc = win.document;
return {
x : doc.documentElement.scrollLeft || doc.body.scrollLeft || 0,
y : doc.documentElement.scrollTop || doc.body.scrollTop || 0
};
}
};
var winHeight = getViewPaneSize().height,offset = winHeight * -1 + offsetTop;
offset += (node.offsetHeight || 0);
var elementPosition = domUtils.getXY(node);
offset += elementPosition.y;
var currentScroll = getScrollPosition(win).y;
// offset += 50;
if (offset > currentScroll || offset < currentScroll - winHeight)
win.scrollTo(0, offset + (offset < 0 ? -20 : 20));
},
/**
* 判断节点是否为br
* @function
* @param {Node} node 节点
*/
isBr : function(node) {
return node.nodeType == 1 && node.tagName == 'BR';
},
isFillChar : function(node){
return node.nodeType == 3 && !node.nodeValue.replace(new RegExp( domUtils.fillChar ),'').length
},
isStartInblock : function(range){
var tmpRange = range.cloneRange(),
flag = 0,
start = tmpRange.startContainer,
tmp;
while(start && domUtils.isFillChar(start)){
tmp = start;
start = start.previousSibling
}
if(tmp){
tmpRange.setStartBefore(tmp);
start = tmpRange.startContainer;
}
if(start.nodeType == 1 && domUtils.isEmptyNode(start) && tmpRange.startOffset == 1){
tmpRange.setStart(start,0).collapse(true);
}
while(!tmpRange.startOffset){
start = tmpRange.startContainer;
if(domUtils.isBlockElm(start)||domUtils.isBody(start)){
flag = 1;
break;
}
var pre = tmpRange.startContainer.previousSibling,
tmpNode;
if(!pre){
tmpRange.setStartBefore(tmpRange.startContainer);
}else{
while(pre && domUtils.isFillChar(pre)){
tmpNode = pre;
pre = pre.previousSibling;
}
if(tmpNode){
tmpRange.setStartBefore(tmpNode);
}else
tmpRange.setStartBefore(tmpRange.startContainer);
}
}
return flag && !domUtils.isBody(tmpRange.startContainer) ? 1 : 0;
},
isEmptyBlock : function(node){
var reg = new RegExp( '[ \t\r\n' + domUtils.fillChar+']', 'g' );
if(node[browser.ie?'innerText':'textContent'].replace(reg,'').length >0)
return 0;
for(var n in dtd.$isNotEmpty){
if(node.getElementsByTagName(n).length)
return 0;
}
return 1;
},
setViewportOffset: function (element, offset){
var left = parseInt(element.style.left) | 0;
var top = parseInt(element.style.top) | 0;
var rect = element.getBoundingClientRect();
var offsetLeft = offset.left - rect.left;
var offsetTop = offset.top - rect.top;
if (offsetLeft) {
element.style.left = left + offsetLeft + 'px';
}
if (offsetTop) {
element.style.top = top + offsetTop + 'px';
}
},
fillNode : function(doc,node){
var tmpNode = browser.ie ? doc.createTextNode(domUtils.fillChar) : doc.createElement('br');
node.innerHTML = '';
node.appendChild(tmpNode);
},
moveChild : function(src,tag,dir){
while(src.firstChild){
if(dir && tag.firstChild){
tag.insertBefore(src.lastChild,tag.firstChild);
}else{
tag.appendChild(src.firstChild)
}
}
},
//判断是否有额外属性
hasNoAttributes : function(node){
return browser.ie ? /^<\w+\s*?>/.test(node.outerHTML) :node.attributes.length == 0;
}
};
var fillCharReg = new RegExp( domUtils.fillChar, 'g' );
///import editor.js
///import core/utils.js
///import core/browser.js
///import core/dom/dom.js
///import core/dom/dtd.js
///import core/dom/domUtils.js
/**
* @class baidu.editor.dom.Range Range类
*/
/**
* @description Range类实现
* @author zhanyi
*/
(function() {
var guid = 0,
fillChar = domUtils.fillChar,
fillData;
/**
* 更新range的collapse状态
* @param {Range} range range对象
*/
function updateCollapse( range ) {
range.collapsed =
range.startContainer && range.endContainer &&
range.startContainer === range.endContainer &&
range.startOffset == range.endOffset;
}
function setEndPoint( toStart, node, offset, range ) {
//如果node是自闭合标签要处理
if ( node.nodeType == 1 && (dtd.$empty[node.tagName] || dtd.$nonChild[node.tagName])) {
offset = domUtils.getNodeIndex( node ) + (toStart ? 0 : 1);
node = node.parentNode;
}
if ( toStart ) {
range.startContainer = node;
range.startOffset = offset;
if ( !range.endContainer ) {
range.collapse( true );
}
} else {
range.endContainer = node;
range.endOffset = offset;
if ( !range.startContainer ) {
range.collapse( false );
}
}
updateCollapse( range );
return range;
}
function execContentsAction ( range, action ) {
//调整边界
//range.includeBookmark();
var start = range.startContainer,
end = range.endContainer,
startOffset = range.startOffset,
endOffset = range.endOffset,
doc = range.document,
frag = doc.createDocumentFragment(),
tmpStart,tmpEnd;
if ( start.nodeType == 1 ) {
start = start.childNodes[startOffset] || (tmpStart = start.appendChild( doc.createTextNode( '' ) ));
}
if ( end.nodeType == 1 ) {
end = end.childNodes[endOffset] || (tmpEnd = end.appendChild( doc.createTextNode( '' ) ));
}
if ( start === end && start.nodeType == 3 ) {
frag.appendChild( doc.createTextNode( start.substringData( startOffset, endOffset - startOffset ) ) );
//is not clone
if ( action ) {
start.deleteData( startOffset, endOffset - startOffset );
range.collapse( true );
}
return frag;
}
var current,currentLevel,clone = frag,
startParents = domUtils.findParents( start, true ),endParents = domUtils.findParents( end, true );
for ( var i = 0; startParents[i] == endParents[i]; i++ );
for ( var j = i,si; si = startParents[j]; j++ ) {
current = si.nextSibling;
if ( si == start ) {
if ( !tmpStart ) {
if ( range.startContainer.nodeType == 3 ) {
clone.appendChild( doc.createTextNode( start.nodeValue.slice( startOffset ) ) );
//is not clone
if ( action ) {
start.deleteData( startOffset, start.nodeValue.length - startOffset );
}
} else {
clone.appendChild( !action ? start.cloneNode( true ) : start );
}
}
} else {
currentLevel = si.cloneNode( false );
clone.appendChild( currentLevel );
}
while ( current ) {
if ( current === end || current === endParents[j] )break;
si = current.nextSibling;
clone.appendChild( !action ? current.cloneNode( true ) : current );
current = si;
}
clone = currentLevel;
}
clone = frag;
if ( !startParents[i] ) {
clone.appendChild( startParents[i - 1].cloneNode( false ) );
clone = clone.firstChild;
}
for ( var j = i,ei; ei = endParents[j]; j++ ) {
current = ei.previousSibling;
if ( ei == end ) {
if ( !tmpEnd && range.endContainer.nodeType == 3 ) {
clone.appendChild( doc.createTextNode( end.substringData( 0, endOffset ) ) );
//is not clone
if ( action ) {
end.deleteData( 0, endOffset );
}
}
} else {
currentLevel = ei.cloneNode( false );
clone.appendChild( currentLevel );
}
//如果两端同级,右边第一次已经被开始做了
if ( j != i || !startParents[i] ) {
while ( current ) {
if ( current === start )break;
ei = current.previousSibling;
clone.insertBefore( !action ? current.cloneNode( true ) : current, clone.firstChild );
current = ei;
}
}
clone = currentLevel;
}
if ( action ) {
range.setStartBefore( !endParents[i] ? endParents[i - 1] : !startParents[i] ? startParents[i - 1] : endParents[i] ).collapse( true )
}
tmpStart && domUtils.remove( tmpStart );
tmpEnd && domUtils.remove( tmpEnd );
return frag;
}
/**
* Range类
* @param {Document} document 编辑器页面document对象
*/
var Range = dom.Range = function( document ) {
var me = this;
me.startContainer =
me.startOffset =
me.endContainer =
me.endOffset = null;
me.document = document;
me.collapsed = true;
};
function removeFillData(doc,excludeNode){
try{
if ( fillData && domUtils.inDoc(fillData,doc) ) {
if(!fillData.nodeValue.replace( fillCharReg, '' ).length){
var tmpNode = fillData.parentNode;
domUtils.remove(fillData);
while(tmpNode && domUtils.isEmptyInlineElement(tmpNode) && !tmpNode.contains(excludeNode)){
fillData = tmpNode.parentNode;
domUtils.remove(tmpNode);
tmpNode = fillData
}
}else
fillData.nodeValue = fillData.nodeValue.replace( fillCharReg, '' )
}
}catch(e){}
}
function mergSibling(node,dir){
var tmpNode;
node = node[dir];
while(node && domUtils.isFillChar(node)){
tmpNode = node[dir];
domUtils.remove(node);
node = tmpNode;
}
}
Range.prototype = {
/**
* 克隆选中的内容到一个fragment里
* @public
* @function
* @name baidu.editor.dom.Range.cloneContents
* @return {Fragment} frag|null 返回选中内容的文本片段或者空
*/
cloneContents : function() {
return this.collapsed ? null : execContentsAction( this, 0 );
},
/**
* 删除所选内容
* @public
* @function
* @name baidu.editor.dom.Range.deleteContents
* @return {Range} 删除选中内容后的Range
*/
deleteContents : function() {
if ( !this.collapsed )
execContentsAction( this, 1 );
if(browser.webkit){
var txt = this.startContainer;
if(txt.nodeType == 3 && !txt.nodeValue.length){
this.setStartBefore(txt).collapse(true);
domUtils.remove(txt)
}
}
return this;
},
/**
* 取出内容
* @public
* @function
* @name baidu.editor.dom.Range.extractContents
* @return {String} 获得Range选中的内容
*/
extractContents : function() {
return this.collapsed ? null : execContentsAction( this, 2 );
},
/**
* 设置range的开始位置
* @public
* @function
* @name baidu.editor.dom.Range.setStart
* @param {Node} node range开始节点
* @param {Number} offset 偏移量
* @return {Range} 返回Range
*/
setStart : function( node, offset ) {
return setEndPoint( true, node, offset, this );
},
/**
* 设置range结束点的位置
* @public
* @function
* @name baidu.editor.dom.Range.setEnd
* @param {Node} node range结束节点
* @param {Number} offset 偏移量
* @return {Range} 返回Range
*/
setEnd : function( node, offset ) {
return setEndPoint( false, node, offset, this );
},
/**
* 将开始位置设置到node后
* @public
* @function
* @name baidu.editor.dom.Range.setStartAfter
* @param {Node} node 节点
* @return {Range} 返回Range
*/
setStartAfter : function( node ) {
return this.setStart( node.parentNode, domUtils.getNodeIndex( node ) + 1 );
},
/**
* 将开始位置设置到node前
* @public
* @function
* @name baidu.editor.dom.Range.setStartBefore
* @param {Node} node 节点
* @return {Range} 返回Range
*/
setStartBefore : function( node ) {
return this.setStart( node.parentNode, domUtils.getNodeIndex( node ) );
},
/**
* 将结束点位置设置到node后
* @public
* @function
* @name baidu.editor.dom.Range.setEndAfter
* @param {Node} node 节点
* @return {Range} 返回Range
*/
setEndAfter : function( node ) {
return this.setEnd( node.parentNode, domUtils.getNodeIndex( node ) + 1 );
},
/**
* 将结束点位置设置到node前
* @public
* @function
* @name baidu.editor.dom.Range.setEndBefore
* @param {Node} node 节点
* @return {Range} 返回Range
*/
setEndBefore : function( node ) {
return this.setEnd( node.parentNode, domUtils.getNodeIndex( node ) );
},
/**
* 选中指定节点
* @public
* @function
* @name baidu.editor.dom.Range.selectNode
* @param {Node} node 节点
* @return {Range} 返回Range
*/
selectNode : function( node ) {
return this.setStartBefore( node ).setEndAfter( node );
},
/**
* 选中node下的所有节点
* @public
* @function
* @name baidu.editor.dom.Range.selectNodeContents
* @param {Element} node 要设置的节点
* @return {Range} 返回Range
*/
selectNodeContents : function( node ) {
return this.setStart( node, 0 ).setEnd( node, node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length );
},
/**
* 克隆range
* @public
* @function
* @name baidu.editor.dom.Range.cloneRange
* @return {Range} 克隆的range对象
*/
cloneRange : function() {
var me = this,range = new Range( me.document );
return range.setStart( me.startContainer, me.startOffset ).setEnd( me.endContainer, me.endOffset );
},
/**
* 让选区闭合
* @public
* @function
* @name baidu.editor.dom.Range.collapse
* @param {Boolean} toStart 是否在选区开始位置闭合选区,true在开始位置闭合,false反之
* @return {Range} range对象
*/
collapse : function( toStart ) {
var me = this;
if ( toStart ) {
me.endContainer = me.startContainer;
me.endOffset = me.startOffset;
}
else {
me.startContainer = me.endContainer;
me.startOffset = me.endOffset;
}
me.collapsed = true;
return me;
},
/**
* 调整range的边界,“缩”到合适的位置
* @public
* @function
* @name baidu.editor.dom.Range.shrinkBoundary
* @param {Boolean} ignoreEnd 是否考虑前面的元素
*/
shrinkBoundary : function( ignoreEnd ) {
var me = this,child,
collapsed = me.collapsed;
while ( me.startContainer.nodeType == 1 //是element
&& (child = me.startContainer.childNodes[me.startOffset]) //子节点也是element
&& child.nodeType == 1 && !domUtils.isBookmarkNode(child)
&& !dtd.$empty[child.tagName] && !dtd.$nonChild[child.tagName] ) {
me.setStart( child, 0 );
}
if ( collapsed )
return me.collapse( true );
if ( !ignoreEnd ) {
while ( me.endContainer.nodeType == 1//是element
&& me.endOffset > 0 //如果是空元素就退出 endOffset=0那么endOffst-1为负值,childNodes[endOffset]报错
&& (child = me.endContainer.childNodes[me.endOffset - 1]) //子节点也是element
&& child.nodeType == 1 && !domUtils.isBookmarkNode(child)
&& !dtd.$empty[child.tagName] && !dtd.$nonChild[child.tagName]) {
me.setEnd( child, child.childNodes.length );
}
}
return me;
},
/**
* 找到startContainer和endContainer的公共祖先节点
* @public
* @function
* @name baidu.editor.dom.Range.getCommonAncestor
* @param {Boolean} includeSelf 是否包含自身
* @param {Boolean} ignoreTextNode 是否忽略文本节点
* @return {Node} 祖先节点
*/
getCommonAncestor : function( includeSelf, ignoreTextNode ) {
var start = this.startContainer,
end = this.endContainer;
if ( start === end ) {
if ( includeSelf && start.nodeType == 1 && this.startOffset == this.endOffset - 1 ) {
return start.childNodes[this.startOffset];
}
//只有在上来就相等的情况下才会出现是文本的情况
return ignoreTextNode && start.nodeType == 3 ? start.parentNode : start;
}
return domUtils.getCommonAncestor( start, end );
},
/**
* 切割文本节点,将边界扩大到element
* @public
* @function
* @name baidu.editor.dom.Range.trimBoundary
* @param {Boolean} ignoreEnd 为真就不处理结束边界
* @return {Range} range对象
* @example <b>|xxx</b>
* startContainer = xxx; startOffset = 0
* 执行后
* startContainer = <b>; startOffset = 0
* @example <b>xx|x</b>
* startContainer = xxx; startOffset = 2
* 执行后
* startContainer = <b>; startOffset = 1 因为将xxx切割成2个节点了
*/
trimBoundary : function( ignoreEnd ) {
this.txtToElmBoundary();
var start = this.startContainer,
offset = this.startOffset,
collapsed = this.collapsed,
end = this.endContainer;
if ( start.nodeType == 3 ) {
if ( offset == 0 ) {
this.setStartBefore( start )
} else {
if ( offset >= start.nodeValue.length ) {
this.setStartAfter( start );
} else {
var textNode = domUtils.split( start, offset );
//跟新结束边界
if ( start === end )
this.setEnd( textNode, this.endOffset - offset );
else if ( start.parentNode === end )
this.endOffset += 1;
this.setStartBefore( textNode );
}
}
if ( collapsed ) {
return this.collapse( true );
}
}
if ( !ignoreEnd ) {
offset = this.endOffset;
end = this.endContainer;
if ( end.nodeType == 3 ) {
if ( offset == 0 ) {
this.setEndBefore( end );
} else {
if ( offset >= end.nodeValue.length ) {
this.setEndAfter( end );
} else {
domUtils.split( end, offset );
this.setEndAfter( end );
}
}
}
}
return this;
},
/**
* 如果选区在文本的边界上,就扩展选区到文本的父节点上
* @public
* @function
* @name baidu.editor.dom.Range.txtToElmBoundary
* @return {Range} range对象
* @example <b> |xxx</b>
* startContainer = xxx; startOffset = 0
* 执行后
* startContainer = <b>; startOffset = 0
* @example <b> xxx| </b>
* startContainer = xxx; startOffset = 3
* 执行后
* startContainer = <b>; startOffset = 1
*/
txtToElmBoundary : function() {
function adjust( r, c ) {
var container = r[c + 'Container'],
offset = r[c + 'Offset'];
if ( container.nodeType == 3 ) {
if ( !offset ) {
r['set' + c.replace( /(\w)/, function( a ) {
return a.toUpperCase()
} ) + 'Before']( container )
} else if ( offset >= container.nodeValue.length ) {
r['set' + c.replace( /(\w)/, function( a ) {
return a.toUpperCase()
} ) + 'After' ]( container )
}
}
}
if ( !this.collapsed ) {
adjust( this, 'start' );
adjust( this, 'end' );
}
return this;
},
/**
* 在当前选区的开始位置前插入一个节点或者fragment
* @public
* @function
* @name baidu.editor.dom.Range.insertNode
* @param {Node/DocumentFragment} node 要插入的节点或fragment
* @return {Range} 返回range对象
*/
insertNode : function( node ) {
var first = node,length = 1;
if ( node.nodeType == 11 ) {
first = node.firstChild;
length = node.childNodes.length;
}
this.trimBoundary( true );
var start = this.startContainer,
offset = this.startOffset;
var nextNode = start.childNodes[ offset ];
if ( nextNode ) {
start.insertBefore( node, nextNode );
}
else {
start.appendChild( node );
}
if ( first.parentNode === this.endContainer ) {
this.endOffset = this.endOffset + length;
}
return this.setStartBefore( first );
},
/**
* 设置光标位置
* @public
* @function
* @name baidu.editor.dom.Range.setCursor
* @param {Boolean} toEnd true为闭合到选区的结束位置后,false为闭合到选区的开始位置前
* @return {Range} 返回range对象
*/
setCursor : function( toEnd ,notFillData) {
return this.collapse( toEnd ? false : true ).select(notFillData);
},
/**
* 创建书签
* @public
* @function
* @name baidu.editor.dom.Range.createBookmark
* @param {Boolean} serialize true:为true则返回对象中用id来分别表示书签的开始和结束节点
* @param {Boolean} same true:是否采用唯一的id,false将会为每一个标签产生一个唯一的id
* @returns {Object} bookmark对象
*/
createBookmark : function( serialize, same ) {
var endNode,
startNode = this.document.createElement( 'span' );
startNode.style.cssText = 'display:none;line-height:0px;';
startNode.appendChild( this.document.createTextNode( '\uFEFF' ) );
startNode.id = '_baidu_bookmark_start_' + (same ? '' : guid++);
if ( !this.collapsed ) {
endNode = startNode.cloneNode( true );
endNode.id = '_baidu_bookmark_end_' + (same ? '' : guid++);
}
this.insertNode( startNode );
if ( endNode ) {
this.collapse( false ).insertNode( endNode );
this.setEndBefore( endNode )
}
this.setStartAfter( startNode );
return {
start : serialize ? startNode.id : startNode,
end : endNode ? serialize ? endNode.id : endNode : null,
id : serialize
}
},
/**
* 移动边界到书签,并删除书签
* @public
* @function
* @name baidu.editor.dom.Range.moveToBookmark
* @params {Object} bookmark对象
* @returns {Range} Range对象
*/
moveToBookmark : function( bookmark ) {
var start = bookmark.id ? this.document.getElementById( bookmark.start ) : bookmark.start,
end = bookmark.end && bookmark.id ? this.document.getElementById( bookmark.end ) : bookmark.end;
this.setStartBefore( start );
domUtils.remove( start );
if ( end ) {
this.setEndBefore( end );
domUtils.remove( end )
} else {
this.collapse( true );
}
return this;
},
/**
* 调整边界到一个block元素上,或者移动到最大的位置
* @public
* @function
* @name baidu.editor.dom.Range.enlarge
* @params {Boolean} toBlock 扩展到block元素
* @params {Function} stopFn 停止函数,若返回true,则不再扩展
* @return {Range} Range对象
*/
enlarge : function( toBlock, stopFn ) {
var isBody = domUtils.isBody,
pre,node,tmp = this.document.createTextNode( '' );
if ( toBlock ) {
node = this.startContainer;
if ( node.nodeType == 1 ) {
if ( node.childNodes[this.startOffset] ) {
pre = node = node.childNodes[this.startOffset]
} else {
node.appendChild( tmp );
pre = node = tmp;
}
} else {
pre = node;
}
while ( 1 ) {
if ( domUtils.isBlockElm( node ) ) {
node = pre;
while ( (pre = node.previousSibling) && !domUtils.isBlockElm( pre ) ) {
node = pre;
}
this.setStartBefore( node );
break;
}
pre = node;
node = node.parentNode;
}
node = this.endContainer;
if ( node.nodeType == 1 ) {
if(pre = node.childNodes[this.endOffset]) {
node.insertBefore( tmp, pre );
}else{
node.appendChild(tmp)
}
pre = node = tmp;
} else {
pre = node;
}
while ( 1 ) {
if ( domUtils.isBlockElm( node ) ) {
node = pre;
while ( (pre = node.nextSibling) && !domUtils.isBlockElm( pre ) ) {
node = pre;
}
this.setEndAfter( node );
break;
}
pre = node;
node = node.parentNode;
}
if ( tmp.parentNode === this.endContainer ) {
this.endOffset--;
}
domUtils.remove( tmp )
}
// 扩展边界到最大
if ( !this.collapsed ) {
while ( this.startOffset == 0 ) {
if ( stopFn && stopFn( this.startContainer ) )
break;
if ( isBody( this.startContainer ) )break;
this.setStartBefore( this.startContainer );
}
while ( this.endOffset == (this.endContainer.nodeType == 1 ? this.endContainer.childNodes.length : this.endContainer.nodeValue.length) ) {
if ( stopFn && stopFn( this.endContainer ) )
break;
if ( isBody( this.endContainer ) )break;
this.setEndAfter( this.endContainer )
}
}
return this;
},
/**
* 调整边界
* @public
* @function
* @name baidu.editor.dom.Range.adjustmentBoundary
* @return {Range} Range对象
* @example
* <b>xx[</b>xxxxx] ==> <b>xx</b>[xxxxx]
* <b>[xx</b><i>]xxx</i> ==> <b>[xx</b>]<i>xxx</i>
*
*/
adjustmentBoundary : function() {
if(!this.collapsed){
while ( !domUtils.isBody( this.startContainer ) &&
this.startOffset == this.startContainer[this.startContainer.nodeType == 3 ? 'nodeValue' : 'childNodes'].length
) {
this.setStartAfter( this.startContainer );
}
while ( !domUtils.isBody( this.endContainer ) && !this.endOffset ) {
this.setEndBefore( this.endContainer );
}
}
return this;
},
/**
* 给选区中的内容加上inline样式
* @public
* @function
* @name baidu.editor.dom.Range.applyInlineStyle
* @param {String} tagName 标签名称
* @param {Object} attrObj 属性
* @return {Range} Range对象
*/
applyInlineStyle : function( tagName, attrs ,list) {
if(this.collapsed)return this;
this.trimBoundary().enlarge( false,
function( node ) {
return node.nodeType == 1 && domUtils.isBlockElm( node )
} ).adjustmentBoundary();
var bookmark = this.createBookmark(),
end = bookmark.end,
filterFn = function( node ) {
return node.nodeType == 1 ? node.tagName.toLowerCase() != 'br' : !domUtils.isWhitespace( node )
},
current = domUtils.getNextDomNode( bookmark.start, false, filterFn ),
node,
pre,
range = this.cloneRange();
while ( current && (domUtils.getPosition( current, end ) & domUtils.POSITION_PRECEDING) ) {
if ( current.nodeType == 3 || dtd[tagName][current.tagName] ) {
range.setStartBefore( current );
node = current;
while ( node && (node.nodeType == 3 || dtd[tagName][node.tagName]) && node !== end ) {
pre = node;
node = domUtils.getNextDomNode( node, node.nodeType == 1, null, function( parent ) {
return dtd[tagName][parent.tagName]
} )
}
var frag = range.setEndAfter( pre ).extractContents(),elm;
if(list && list.length > 0){
var level,top;
top = level = list[0].cloneNode(false);
for(var i=1,ci;ci=list[i++];){
level.appendChild(ci.cloneNode(false));
level = level.firstChild;
}
elm = level;
}else{
elm = range.document.createElement( tagName )
}
if ( attrs ) {
domUtils.setAttributes( elm, attrs )
}
elm.appendChild( frag );
range.insertNode( list ? top : elm );
//处理下滑线在a上的情况
var aNode;
if(tagName == 'span' && attrs.style && /text\-decoration/.test(attrs.style) && (aNode = domUtils.findParentByTagName(elm,'a',true)) ){
domUtils.setAttributes(aNode,attrs);
domUtils.remove(elm,true);
elm = aNode;
}else{
domUtils.mergSibling( elm );
domUtils.clearEmptySibling( elm );
}
//去除子节点相同的
domUtils.mergChild( elm, tagName,attrs );
current = domUtils.getNextDomNode( elm, false, filterFn );
domUtils.mergToParent( elm );
if ( node === end )break;
} else {
current = domUtils.getNextDomNode( current, true, filterFn )
}
}
return this.moveToBookmark( bookmark );
},
/**
* 去掉inline样式
* @public
* @function
* @name baidu.editor.dom.Range.removeInlineStyle
* @param {String/Array} tagName 要去掉的标签名
* @return {Range} Range对象
*/
removeInlineStyle : function( tagName ) {
if(this.collapsed)return this;
tagName = utils.isArray( tagName ) ? tagName : [tagName];
this.shrinkBoundary().adjustmentBoundary();
var start = this.startContainer,end = this.endContainer;
while ( 1 ) {
if ( start.nodeType == 1 ) {
if ( utils.indexOf( tagName, start.tagName.toLowerCase() ) > -1 ) {
break;
}
if ( start.tagName.toLowerCase() == 'body' ) {
start = null;
break;
}
}
start = start.parentNode;
}
while ( 1 ) {
if ( end.nodeType == 1 ) {
if ( utils.indexOf( tagName, end.tagName.toLowerCase() ) > -1 ) {
break;
}
if ( end.tagName.toLowerCase() == 'body' ) {
end = null;
break;
}
}
end = end.parentNode;
}
var bookmark = this.createBookmark(),
frag,
tmpRange;
if ( start ) {
tmpRange = this.cloneRange().setEndBefore( bookmark.start ).setStartBefore( start );
frag = tmpRange.extractContents();
tmpRange.insertNode( frag );
domUtils.clearEmptySibling( start, true );
start.parentNode.insertBefore( bookmark.start, start );
}
if ( end ) {
tmpRange = this.cloneRange().setStartAfter( bookmark.end ).setEndAfter( end );
frag = tmpRange.extractContents();
tmpRange.insertNode( frag );
domUtils.clearEmptySibling( end, false, true );
end.parentNode.insertBefore( bookmark.end, end.nextSibling );
}
var current = domUtils.getNextDomNode( bookmark.start, false, function( node ) {
return node.nodeType == 1
} ),next;
while ( current && current !== bookmark.end ) {
next = domUtils.getNextDomNode( current, true, function( node ) {
return node.nodeType == 1
} );
if ( utils.indexOf( tagName, current.tagName.toLowerCase() ) > -1 ) {
domUtils.remove( current, true );
}
current = next;
}
return this.moveToBookmark( bookmark );
},
/**
* 得到一个自闭合的节点
* @public
* @function
* @name baidu.editor.dom.Range.getClosedNode
* @return {Node} 闭合节点
* @example
* <img />,<br />
*/
getClosedNode : function() {
var node;
if ( !this.collapsed ) {
var range = this.cloneRange().adjustmentBoundary().shrinkBoundary();
if ( range.startContainer.nodeType == 1 && range.startContainer === range.endContainer && range.endOffset - range.startOffset == 1 ) {
var child = range.startContainer.childNodes[range.startOffset];
if ( child && child.nodeType == 1 && (dtd.$empty[child.tagName] || dtd.$nonChild[child.tagName])) {
node = child;
}
}
}
return node;
},
/**
* 根据range选中元素
* @public
* @function
* @name baidu.editor.dom.Range.select
* @param {Boolean} notInsertFillData true为不加占位符
*/
select : browser.ie ? function( notInsertFillData ,textRange) {
var nativeRange;
if ( !this.collapsed )
this.shrinkBoundary();
var node = this.getClosedNode();
if ( node && !textRange) {
try {
nativeRange = this.document.body.createControlRange();
nativeRange.addElement( node );
nativeRange.select();
} catch( e ) {
}
return this;
}
var bookmark = this.createBookmark(),
start = bookmark.start,
end;
nativeRange = this.document.body.createTextRange();
nativeRange.moveToElementText( start );
nativeRange.moveStart( 'character', 1 );
if ( !this.collapsed ) {
var nativeRangeEnd = this.document.body.createTextRange();
end = bookmark.end;
nativeRangeEnd.moveToElementText( end );
nativeRange.setEndPoint( 'EndToEnd', nativeRangeEnd );
} else {
if ( !notInsertFillData && this.startContainer.nodeType != 3 ) {
//使用<span>|x<span>固定住光标
var tmpText = this.document.createTextNode( fillChar ),
tmp = this.document.createElement( 'span' );
tmp.appendChild( this.document.createTextNode( fillChar) );
start.parentNode.insertBefore( tmp, start );
start.parentNode.insertBefore( tmpText, start );
//当点b,i,u时,不能清除i上边的b
removeFillData(this.document,tmpText);
fillData = tmpText;
mergSibling(tmp,'previousSibling');
mergSibling(start,'nextSibling');
nativeRange.moveStart( 'character', -1 );
nativeRange.collapse( true );
}
}
this.moveToBookmark( bookmark );
tmp && domUtils.remove( tmp );
nativeRange.select();
return this;
} : function( notInsertFillData ) {
var win = domUtils.getWindow( this.document ),
sel = win.getSelection(),
txtNode;
browser.gecko ? this.document.body.focus() : win.focus();
if ( sel ) {
sel.removeAllRanges();
// trace:870 chrome/safari后边是br对于闭合得range不能定位 所以去掉了判断
// this.startContainer.nodeType != 3 &&! ((child = this.startContainer.childNodes[this.startOffset]) && child.nodeType == 1 && child.tagName == 'BR'
if ( this.collapsed && !notInsertFillData ){
txtNode = this.document.createTextNode( fillChar );
//跟着前边走
this.insertNode( txtNode );
removeFillData(this.document,txtNode);
mergSibling(txtNode,'previousSibling');
mergSibling(txtNode,'nextSibling');
fillData = txtNode;
this.setStart( txtNode, browser.webkit ? 1 : 0 ).collapse( true );
}
var nativeRange = this.document.createRange();
nativeRange.setStart( this.startContainer, this.startOffset );
nativeRange.setEnd( this.endContainer, this.endOffset );
sel.addRange( nativeRange );
}
return this;
},
/**
* 滚动到可视范围
* @public
* @function
* @name baidu.editor.dom.Range.scrollToView
* @param {Boolean} win 操作的window对象,若为空,则使用当前的window对象
* @param {Number} offset 滚动的偏移量
* @return {Range} Range对象
*/
scrollToView : function(win,offset){
win = win ? window : domUtils.getWindow(this.document);
var span = this.document.createElement('span');
//trace:717
span.innerHTML = ' ';
var tmpRange = this.cloneRange();
tmpRange.insertNode(span);
domUtils.scrollToView(span,win,offset);
domUtils.remove(span);
return this;
}
};
})();
///import editor.js
///import core/browser.js
///import core/dom/dom.js
///import core/dom/dtd.js
///import core/dom/domUtils.js
///import core/dom/Range.js
/**
* @class baidu.editor.dom.Selection Selection类
*/
(function () {
function getBoundaryInformation( range, start ) {
var getIndex = domUtils.getNodeIndex;
range = range.duplicate();
range.collapse( start );
var parent = range.parentElement();
//如果节点里没有子节点,直接退出
if ( !parent.hasChildNodes() ) {
return {container:parent,offset:0};
}
var siblings = parent.children,
child,
testRange = range.duplicate(),
startIndex = 0,endIndex = siblings.length - 1,index = -1,
distance;
while ( startIndex <= endIndex ) {
index = Math.floor( (startIndex + endIndex) / 2 );
child = siblings[index];
testRange.moveToElementText( child );
var position = testRange.compareEndPoints( 'StartToStart', range );
if ( position > 0 ) {
endIndex = index - 1;
} else if ( position < 0 ) {
startIndex = index + 1;
} else {
//trace:1043
return {container:parent,offset:getIndex( child )};
}
}
if ( index == -1 ) {
testRange.moveToElementText( parent );
testRange.setEndPoint( 'StartToStart', range );
distance = testRange.text.replace( /(\r\n|\r)/g, '\n' ).length;
siblings = parent.childNodes;
if ( !distance ) {
child = siblings[siblings.length - 1];
return {container:child,offset:child.nodeValue.length};
}
var i = siblings.length;
while ( distance > 0 )
distance -= siblings[ --i ].nodeValue.length;
return {container:siblings[i],offset:-distance}
}
testRange.collapse( position > 0 );
testRange.setEndPoint( position > 0 ? 'StartToStart' : 'EndToStart', range );
distance = testRange.text.replace( /(\r\n|\r)/g, '\n' ).length;
if ( !distance ) {
return dtd.$empty[child.tagName] || dtd.$nonChild[child.tagName]?
{container : parent,offset:getIndex( child ) + (position > 0 ? 0 : 1)} :
{container : child,offset: position > 0 ? 0 : child.childNodes.length}
}
while ( distance > 0 ) {
try{
var pre = child;
child = child[position > 0 ? 'previousSibling' : 'nextSibling'];
distance -= child.nodeValue.length;
}catch(e){
return {container:parent,offset:getIndex(pre)};
}
}
return {container:child,offset:position > 0 ? -distance : child.nodeValue.length + distance}
}
/**
* 将ieRange转换为Range对象
* @param {Range} ieRange ieRange对象
* @param {Range} range Range对象
* @return {Range} range 返回转换后的Range对象
*/
function transformIERangeToRange( ieRange, range ) {
if ( ieRange.item ) {
range.selectNode( ieRange.item( 0 ) );
} else {
var bi = getBoundaryInformation( ieRange, true );
range.setStart( bi.container, bi.offset );
if ( ieRange.compareEndPoints( 'StartToEnd',ieRange ) != 0 ) {
bi = getBoundaryInformation( ieRange, false );
range.setEnd( bi.container, bi.offset );
}
}
return range;
}
/**
* 获得ieRange
* @param {Selection} sel Selection对象
* @return {ieRange} 得到ieRange
*/
function _getIERange(sel){
var ieRange;
//ie下有可能报错
try{
ieRange = sel.getNative().createRange();
}catch(e){
return null;
}
var el = ieRange.item ? ieRange.item( 0 ) : ieRange.parentElement();
if ( ( el.ownerDocument || el ) === sel.document ) {
return ieRange;
}
return null;
}
var Selection = dom.Selection = function ( doc ) {
var me = this, iframe;
me.document = doc;
if ( ie ) {
iframe = domUtils.getWindow(doc).frameElement;
domUtils.on( iframe, 'beforedeactivate', function () {
me._bakIERange = me.getIERange();
} );
domUtils.on( iframe, 'activate', function () {
try {
if ( !_getIERange(me) && me._bakIERange ) {
me._bakIERange.select();
}
} catch ( ex ) {
}
me._bakIERange = null;
} );
}
iframe = doc = null;
};
Selection.prototype = {
/**
* 获取原生seleciton对象
* @public
* @function
* @name baidu.editor.dom.Selection.getNative
* @return {Selection} 获得selection对象
*/
getNative : function () {
var doc = this.document;
return !doc ? null : ie ? doc.selection : domUtils.getWindow( doc ).getSelection();
},
/**
* 获得ieRange
* @public
* @function
* @name baidu.editor.dom.Selection.getIERange
* @return {ieRange} 返回ie原生的Range
*/
getIERange : function () {
var ieRange = _getIERange(this);
if ( !ieRange ) {
if ( this._bakIERange ) {
return this._bakIERange;
}
}
return ieRange;
},
/**
* 缓存当前选区的range和选区的开始节点
* @public
* @function
* @name baidu.editor.dom.Selection.cache
*/
cache : function () {
this.clear();
this._cachedRange = this.getRange();
this._cachedStartElement = this.getStart();
this._cachedStartElementPath = this.getStartElementPath();
},
getStartElementPath : function(){
if(this._cachedStartElementPath){
return this._cachedStartElementPath;
}
var start = this.getStart();
if(start){
return domUtils.findParents(start,true,null,true)
}
return [];
},
/**
* 清空缓存
* @public
* @function
* @name baidu.editor.dom.Selection.clear
*/
clear : function () {
this._cachedStartElementPath = this._cachedRange = this._cachedStartElement = null;
},
/**
* 编辑器是否得到了选区
*/
isFocus : function(){
return browser.ie && _getIERange(this) || !browser.ie && this.getNative().rangeCount ? true : false;
},
/**
* 获取选区对应的Range
* @public
* @function
* @name baidu.editor.dom.Selection.getRange
* @returns {baidu.editor.dom.Range} 得到Range对象
*/
getRange : function () {
var me = this;
function optimze(range){
var child = me.document.body.firstChild,
collapsed = range.collapsed;
while(child && child.firstChild){
range.setStart(child,0);
child = child.firstChild;
}
if(!range.startContainer){
range.setStart(me.document.body,0)
}
if(collapsed){
range.collapse(true);
}
}
if ( me._cachedRange != null ) {
return this._cachedRange;
}
var range = new baidu.editor.dom.Range( me.document );
if ( ie ) {
var nativeRange = me.getIERange();
if(nativeRange){
transformIERangeToRange( nativeRange, range );
}else{
optimze(range)
}
} else {
var sel = me.getNative();
if ( sel && sel.rangeCount ) {
var firstRange = sel.getRangeAt( 0 ) ;
var lastRange = sel.getRangeAt( sel.rangeCount - 1 );
range.setStart( firstRange.startContainer, firstRange.startOffset ).setEnd( lastRange.endContainer, lastRange.endOffset );
if(range.collapsed && domUtils.isBody(range.startContainer) && !range.startOffset){
optimze(range)
}
} else {
//trace:1734 有可能已经不在dom树上了,标识的节点
if(this._bakRange && domUtils.inDoc(this._bakRange.startContainer,this.document))
return this._bakRange;
optimze(range)
}
}
return this._bakRange = range;
},
/**
* 获取开始元素,用于状态反射
* @public
* @function
* @name baidu.editor.dom.Selection.getStart
* @return {Element} 获得开始元素
*/
getStart : function () {
if ( this._cachedStartElement ) {
return this._cachedStartElement;
}
var range = ie ? this.getIERange() : this.getRange(),
tmpRange,
start,tmp,parent;
if (ie) {
if(!range){
//todo 给第一个值可能会有问题
return this.document.body.firstChild;
}
//control元素
if (range.item)
return range.item(0);
tmpRange = range.duplicate();
//修正ie下<b>x</b>[xx] 闭合后 <b>x|</b>xx
tmpRange.text.length > 0 && tmpRange.moveStart('character',1);
tmpRange.collapse(1);
start = tmpRange.parentElement();
parent = tmp = range.parentElement();
while (tmp = tmp.parentNode) {
if (tmp == start) {
start = parent;
break;
}
}
} else {
range.shrinkBoundary();
start = range.startContainer;
if (start.nodeType == 1 && start.hasChildNodes())
start = start.childNodes[Math.min(start.childNodes.length - 1, range.startOffset)];
if (start.nodeType == 3)
return start.parentNode;
}
return start;
},
/**
* 得到选区中的文本
* @public
* @function
* @name baidu.editor.dom.Selection.getText
* @return {String} 选区中包含的文本
*/
getText : function(){
if(this.isFocus()){
var nativeSel = this.getNative(),
nativeRange = browser.ie ? nativeSel.createRange() : nativeSel.getRangeAt(0);
return nativeRange.text || nativeRange.toString();
}
return '';
}
};
})();
///import editor.js
///import core/utils.js
///import core/EventBase.js
///import core/browser.js
///import core/dom/dom.js
///import core/dom/domUtils.js
///import core/dom/Selection.js
///import core/dom/dtd.js
(function () {
var uid = 0,
_selectionChangeTimer;
function replaceSrc(div){
var imgs = div.getElementsByTagName("img"),
orgSrc;
for(var i=0,img;img = imgs[i++];){
if(orgSrc = img.getAttribute("orgSrc")){
img.src = orgSrc;
img.removeAttribute("orgSrc");
}
}
var as = div.getElementsByTagName("a");
for(var i=0,ai;ai=as[i++];i++){
if(ai.getAttribute('data_ue_src')){
ai.setAttribute('href',ai.getAttribute('data_ue_src'))
}
}
}
/**
* 编辑器类
* @public
* @class
* @extends baidu.editor.EventBase
* @name baidu.editor.Editor
* @param {Object} options
*/
var Editor = UE.Editor = function( options ) {
var me = this;
me.uid = uid ++;
EventBase.call( me );
me.commands = {};
me.options = utils.extend( options || {}, UEDITOR_CONFIG, true );
//初始化插件
for ( var pi in UE.plugins ) {
UE.plugins[pi].call( me )
}
};
Editor.prototype = /**@lends baidu.editor.Editor.prototype*/{
destroy : function(){
this.fireEvent('destroy');
this.container.innerHTML = '';
domUtils.remove(this.container);
},
/**
* 渲染编辑器的DOM到指定容器,必须且只能调用一次
* @public
* @function
* @param {Element|String} container
*/
render : function ( container ) {
if (container.constructor === String) {
container = document.getElementById(container);
}
if(container){
container.innerHTML = '<iframe id="' + 'baidu_editor_' + this.uid + '"' + 'width="100%" height="100%" frameborder="0"></iframe>';
container.style.overflow = 'hidden';
this._setup( container.firstChild.contentWindow.document );
}
},
_setup: function ( doc ) {
var options = this.options,
me = this;
//防止在chrome下连接后边带# 会跳动的问题
!browser.webkit && doc.open();
var useBodyAsViewport = ie && browser.version < 9;
doc.write( ( ie && browser.version < 9 ? '' : '<!DOCTYPE html>') +
'<html xmlns="http://www.w3.org/1999/xhtml"' + (!useBodyAsViewport ? ' class="view"' : '') + '><head>' +
( options.iframeCssUrl ? '<link rel="stylesheet" type="text/css" href="' + utils.unhtml( /^http/.test(options.iframeCssUrl) ? options.iframeCssUrl : (options.UEDITOR_HOME_URL + options.iframeCssUrl) ) + '"/>' : '' ) +
'<style type="text/css">'
+ ( options.initialStyle ||' ' ) +
'</style></head><body' + (useBodyAsViewport ? ' class="view"' : '') + '></body></html>' );
!browser.webkit && doc.close();
if ( ie ) {
doc.body.disabled = true;
doc.body.contentEditable = true;
doc.body.disabled = false;
} else {
doc.body.contentEditable = true;
doc.body.spellcheck = false;
}
this.document = doc;
this.window = doc.defaultView || doc.parentWindow;
this.iframe = this.window.frameElement;
this.body = doc.body;
if (this.options.minFrameHeight) {
this.setHeight(this.options.minFrameHeight);
this.body.style.height = this.options.minFrameHeight;
}
this.selection = new dom.Selection( doc );
//gecko初始化就能得到range,无法判断isFocus了
if(browser.gecko){
this.selection.getNative().removeAllRanges();
}
this._initEvents();
if(me.options.initialContent){
if(me.options.autoClearinitialContent){
var oldExecCommand = me.execCommand;
me.execCommand = function(){
me.fireEvent('firstBeforeExecCommand');
oldExecCommand.apply(me,arguments)
};
this.setDefaultContent(this.options.initialContent);
}else
this.setContent(this.options.initialContent,true);
}
//为form提交提供一个隐藏的textarea
for(var form = this.iframe.parentNode;!domUtils.isBody(form);form = form.parentNode){
if(form.tagName == 'FORM'){
domUtils.on(form,'submit',function(){
var textarea = document.getElementById('ueditor_textarea_' + me.options.textarea);
if(!textarea){
textarea = document.createElement('textarea');
textarea.setAttribute('name',me.options.textarea);
textarea.id = 'ueditor_textarea_' + me.options.textarea;
textarea.style.display = 'none';
this.appendChild(textarea);
}
textarea.value = me.getContent();
});
break;
}
}
//编辑器不能为空内容
if(domUtils.isEmptyNode(me.body)){
this.body.innerHTML = '<p>'+(browser.ie?'':'<br/>')+'</p>';
}
//如果要求focus, 就把光标定位到内容开始
if(me.options.focus){
setTimeout(function(){
me.focus();
//如果自动清除开着,就不需要做selectionchange;
!me.options.autoClearinitialContent && me._selectionChange()
});
}
if(!this.container){
this.container = this.iframe.parentNode;
}
if(me.options.fullscreen && me.ui){
me.ui.setFullScreen(true)
}
this.fireEvent( 'ready' );
if(!browser.ie){
domUtils.on(me.window,'blur',function(){
me._bakRange = me.selection.getRange();
me.selection.getNative().removeAllRanges();
});
}
//trace:1518 ff3.6body不够寛,会导致点击空白处无法获得焦点
if(browser.gecko && browser.version <= 10902){
//修复ff3.6初始化进来,不能点击获得焦点
me.body.contentEditable = false;
setTimeout(function(){
me.body.contentEditable = true;
},100);
setInterval(function(){
me.body.style.height = me.iframe.offsetHeight - 20 + 'px'
},100)
}
},
/**
* 创建textarea,同步编辑的内容到textarea,为后台获取内容做准备
* @param formId 制定在那个form下添加
* @public
* @function
*/
sync : function(formId){
var me = this,
form;
function setValue(form){
var textarea = document.getElementById('ueditor_textarea_' + me.options.textarea);
if(!textarea){
textarea = document.createElement('textarea');
textarea.setAttribute('name',me.options.textarea);
textarea.id = 'ueditor_textarea_' + me.options.textarea;
textarea.style.display = 'none';
form.appendChild(textarea);
}
textarea.value = me.getContent();
}
if(formId){
form = document.getElementById(formId);
form && setValue(form);
}else{
for(form = me.iframe.parentNode;!domUtils.isBody(form);form = form.parentNode){
if(form.tagName == 'FORM'){
setValue(form);
break;
}
}
}
},
/**
* 设置编辑器高度
* @public
* @function
* @param {Number} height 高度
*/
setHeight: function (height){
if (height !== parseInt(this.iframe.parentNode.style.height)){
this.iframe.parentNode.style.height = height + 'px';
}
//ie9下body 高度100%失效,改为手动设置
if(browser.ie && browser.version == 9){
this.document.body.style.height = height - 20 + 'px'
}
},
/**
* 获取编辑器内容
* @public
* @function
* @returns {String}
*/
getContent : function (cmd) {
this.fireEvent( 'beforegetcontent',cmd );
var reg = new RegExp( domUtils.fillChar, 'g' ),
//ie下取得的html可能会有\n存在,要去掉,在处理replace(/[\t\r\n]*/g,'');代码高量的\n不能去除
html = this.document.body.innerHTML.replace(reg,'').replace(/>[\t\r\n]*?</g,'><');
this.fireEvent( 'aftergetcontent',cmd );
if (this.serialize) {
var node = this.serialize.parseHTML(html);
node = this.serialize.transformOutput(node);
html = this.serialize.toHTML(node);
}
return html;
},
/**
* 获取编辑器中的文本内容
* @public
* @function
* @returns {String}
*/
getContentTxt : function(){
var reg = new RegExp( domUtils.fillChar,'g' );
return this.body[browser.ie ? 'innerText':'textContent'].replace(reg,'')
},
/**
* 设置编辑器内容
* @public
* @function
* @param {String} html
*/
setContent : function ( html,notFireSelectionchange) {
var me = this,
inline = utils.extend({a:1,A:1},dtd.$inline,true),
lastTagName;
html = html
.replace(/^[ \t\r\n]*?</,'<')
.replace(/>[ \t\r\n]*?$/,'>')
.replace(/>[\t\r\n]*?</g,'><')//代码高量的\n不能去除
.replace(/[\s\/]?(\w+)?>[ \t\r\n]*?<\/?(\w+)/gi,function(a,b,c){
if(b){
lastTagName = c;
}else{
b = lastTagName
}
return !inline[b] && !inline[c] ? a.replace(/>[ \t\r\n]*?</,'><') : a;
});
me.fireEvent( 'beforesetcontent' );
var serialize = this.serialize;
if (serialize) {
var node = serialize.parseHTML(html);
node = serialize.transformInput(node);
node = serialize.filter(node);
html = serialize.toHTML(node);
}
//html.replace(new RegExp('[\t\n\r' + domUtils.fillChar + ']*','g'),'');
//去掉了\t\n\r 如果有插入的代码,在源码切换所见即所得模式时,换行都丢掉了
//\r在ie下的不可见字符,在源码切换时会变成多个
//trace:1559
this.document.body.innerHTML = html.replace(new RegExp('[\r' + domUtils.fillChar + ']*','g'),'');
//处理ie6下innerHTML自动将相对路径转化成绝对路径的问题
if(browser.ie && browser.version < 7 && me.options.relativePath){
replaceSrc(this.document.body);
}
//给文本或者inline节点套p标签
if(me.options.enterTag == 'p'){
var child = this.body.firstChild,
p = me.document.createElement('p'),
tmpNode;
if(!child || child.nodeType == 1 && dtd.$cdata[child.tagName]){
this.body.innerHTML = '<p>'+(browser.ie ? '' :'<br/>')+'</p>' + this.body.innerHTML;
}else{
while(child){
if(child.nodeType ==3 || child.nodeType == 1 && dtd.p[child.tagName]){
tmpNode = child.nextSibling;
p.appendChild(child);
child = tmpNode;
if(!child){
me.body.appendChild(p);
}
}else{
if(p.firstChild){
me.body.insertBefore(p,child);
p = me.document.createElement('p')
}
child = child.nextSibling
}
}
}
}
me.adjustTable && me.adjustTable(me.body);
me.fireEvent( 'aftersetcontent' );
me.fireEvent( 'contentchange' );
!notFireSelectionchange && me._selectionChange();
//清除保存的选区
me._bakRange = me._bakIERange = null;
//trace:1742 setContent后gecko能得到焦点问题
if(browser.gecko){
me.selection.getNative().removeAllRanges();
}
},
/**
* 让编辑器获得焦点
* @public
* @function
*/
focus : function () {
this.selection.getRange().select(true);
},
/**
* 初始化事件,绑定selectionchange
* @private
* @function
*/
_initEvents : function () {
var me = this,
doc = me.document,
win = me.window;
me._proxyDomEvent = utils.bind( me._proxyDomEvent, me );
domUtils.on( doc, ['click', 'contextmenu','mousedown','keydown', 'keyup','keypress', 'mouseup', 'mouseover', 'mouseout', 'selectstart'], me._proxyDomEvent );
domUtils.on( win, ['focus', 'blur'], me._proxyDomEvent );
domUtils.on( doc, ['mouseup','keydown'], function(evt){
//特殊键不触发selectionchange
if(evt.type == 'keydown' && (evt.ctrlKey || evt.metaKey || evt.shiftKey || evt.altKey)){
return;
}
if(evt.button == 2)return;
me._selectionChange(250, evt );
});
//处理拖拽
//ie ff不能从外边拖入
//chrome只针对从外边拖入的内容过滤
var innerDrag = 0,source = browser.ie ? me.body : me.document,dragoverHandler;
domUtils.on(source,'dragstart',function(){
innerDrag = 1;
});
domUtils.on(source,browser.webkit ? 'dragover' : 'drop',function(){
return browser.webkit ?
function(){
clearTimeout( dragoverHandler );
dragoverHandler = setTimeout( function(){
if(!innerDrag){
var sel = me.selection,
range = sel.getRange();
if(range){
var common = range.getCommonAncestor();
if(common && me.serialize){
var f = me.serialize,
node =
f.filter(
f.transformInput(
f.parseHTML(
f.word(common.innerHTML)
)
)
);
common.innerHTML = f.toHTML(node)
}
}
}
innerDrag = 0;
}, 200 );
} :
function(e){
if(!innerDrag){
e.preventDefault ? e.preventDefault() :(e.returnValue = false) ;
}
innerDrag = 0;
}
}());
},
_proxyDomEvent: function ( evt ) {
return this.fireEvent( evt.type.replace( /^on/, '' ), evt );
},
_selectionChange : function ( delay, evt ) {
var me = this;
//有光标才做selectionchange
if(!me.selection.isFocus())
return;
var hackForMouseUp = false;
var mouseX, mouseY;
if (browser.ie && browser.version < 9 && evt && evt.type == 'mouseup') {
var range = this.selection.getRange();
if (!range.collapsed) {
hackForMouseUp = true;
mouseX = evt.clientX;
mouseY = evt.clientY;
}
}
clearTimeout(_selectionChangeTimer);
_selectionChangeTimer = setTimeout(function(){
if(!me.selection.getNative()){
return;
}
//修复一个IE下的bug: 鼠标点击一段已选择的文本中间时,可能在mouseup后的一段时间内取到的range是在selection的type为None下的错误值.
//IE下如果用户是拖拽一段已选择文本,则不会触发mouseup事件,所以这里的特殊处理不会对其有影响
var ieRange;
if (hackForMouseUp && me.selection.getNative().type == 'None' ) {
ieRange = me.document.body.createTextRange();
try {
ieRange.moveToPoint( mouseX, mouseY );
} catch(ex){
ieRange = null;
}
}
var bakGetIERange;
if (ieRange) {
bakGetIERange = me.selection.getIERange;
me.selection.getIERange = function (){
return ieRange;
};
}
me.selection.cache();
if (bakGetIERange) {
me.selection.getIERange = bakGetIERange;
}
if ( me.selection._cachedRange && me.selection._cachedStartElement ) {
me.fireEvent( 'beforeselectionchange' );
// 第二个参数causeByUi为true代表由用户交互造成的selectionchange.
me.fireEvent( 'selectionchange', !!evt );
me.fireEvent('afterselectionchange');
me.selection.clear();
}
}, delay || 50);
},
_callCmdFn: function ( fnName, args ) {
var cmdName = args[0].toLowerCase(),
cmd, cmdFn;
cmdFn = ( cmd = this.commands[cmdName] ) && cmd[fnName] ||
( cmd = UE.commands[cmdName]) && cmd[fnName];
if ( cmd && !cmdFn && fnName == 'queryCommandState' ) {
return false;
} else if ( cmdFn ) {
return cmdFn.apply( this, args );
}
},
/**
* 执行命令
* @public
* @function
* @param {String} cmdName 执行的命令名
*
*/
execCommand : function ( cmdName ) {
cmdName = cmdName.toLowerCase();
var me = this,
result,
cmd = me.commands[cmdName] || UE.commands[cmdName];
if ( !cmd || !cmd.execCommand ) {
return;
}
if ( !cmd.notNeedUndo && !me.__hasEnterExecCommand ) {
me.__hasEnterExecCommand = true;
if(me.queryCommandState(cmdName) !=-1){
me.fireEvent( 'beforeexeccommand', cmdName );
result = this._callCmdFn( 'execCommand', arguments );
me.fireEvent( 'afterexeccommand', cmdName );
}
me.__hasEnterExecCommand = false;
} else {
result = this._callCmdFn( 'execCommand', arguments );
}
me._selectionChange();
return result;
},
/**
* 查询命令的状态
* @public
* @function
* @param {String} cmdName 执行的命令名
* @returns {Number|*} -1 : disabled, false : normal, true : enabled.
*
*/
queryCommandState : function ( cmdName ) {
return this._callCmdFn( 'queryCommandState', arguments );
},
/**
* 查询命令的值
* @public
* @function
* @param {String} cmdName 执行的命令名
* @returns {*}
*/
queryCommandValue : function ( cmdName ) {
return this._callCmdFn( 'queryCommandValue', arguments );
},
/**
* 检查编辑区域中是否有内容
* @public
* @params{Array} 自定义的标签
* @function
* @returns {Boolean} true 有,false 没有
*/
hasContents : function(tags){
if(tags){
for(var i=0,ci;ci=tags[i++];){
if(this.document.getElementsByTagName(ci).length > 0)
return true;
}
}
if(!domUtils.isEmptyBlock(this.body)){
return true
}
return false;
},
/**
* 从新设置
* @public
* @function
*/
reset : function(){
this.fireEvent('reset');
},
/**
* 设置默认内容
* @function
* @param {String} cont 要存入的内容
*/
setDefaultContent : function(){
function clear(){
var me = this;
if(me.document.getElementById('initContent')){
me.document.body.innerHTML = '<p>'+(ie ? '' : '<br/>')+'</p>';
var range = me.selection.getRange();
me.removeListener('firstBeforeExecCommand',clear);
me.removeListener('focus',clear);
setTimeout(function(){
range.setStart(me.document.body.firstChild,0).collapse(true).select(true);
me._selectionChange();
})
}
}
return function (cont){
var me = this;
me.document.body.innerHTML = '<p id="initContent">'+cont+'</p>';
if(browser.ie && browser.version < 7 && me.options.relativePath){
replaceSrc(me.document.body);
}
me.addListener('firstBeforeExecCommand',clear);
me.addListener('focus',clear);
}
}()
};
utils.inherits( Editor, EventBase );
})();
/**
* Created by .
* User: taoqili
* Date: 11-8-18
* Time: 下午3:18
* To change this template use File | Settings | File Templates.
*/
/**
* ajax工具类
*/
UE.ajax = function() {
return {
/**
* 向url发送ajax请求
* @param url
* @param ajaxOptions
*/
request:function(url, ajaxOptions) {
var ajaxRequest = creatAjaxRequest(),
//是否超时
timeIsOut = false,
//默认参数
defaultAjaxOptions = {
method:"POST",
timeout:5000,
async:true,
data:{},//需要传递对象的话只能覆盖
onsuccess:function() {
},
onerror:function() {
}
};
if (typeof url === "object") {
ajaxOptions = url;
url = ajaxOptions.url;
}
if (!ajaxRequest || !url) return;
var ajaxOpts = ajaxOptions ? utils.extend(defaultAjaxOptions,ajaxOptions) : defaultAjaxOptions;
var submitStr = json2str(ajaxOpts); // { name:"Jim",city:"Beijing" } --> "name=Jim&city=Beijing"
//如果用户直接通过data参数传递json对象过来,则也要将此json对象转化为字符串
if (!utils.isEmptyObject(ajaxOpts.data)){
submitStr += (submitStr? "&":"") + json2str(ajaxOpts.data);
}
//超时检测
var timerID = setTimeout(function() {
if (ajaxRequest.readyState != 4) {
timeIsOut = true;
ajaxRequest.abort();
clearTimeout(timerID);
}
}, ajaxOpts.timeout);
var method = ajaxOpts.method.toUpperCase();
var str = url + (url.indexOf("?")==-1?"?":"&") + (method=="POST"?"":submitStr) + "&noCache=" + +new Date;
ajaxRequest.open(method, str, ajaxOpts.async);
ajaxRequest.onreadystatechange = function() {
if (ajaxRequest.readyState == 4) {
if (!timeIsOut && ajaxRequest.status == 200) {
ajaxOpts.onsuccess(ajaxRequest);
} else {
ajaxOpts.onerror(ajaxRequest);
}
}
};
if (method == "POST") {
ajaxRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
ajaxRequest.send(submitStr);
} else {
ajaxRequest.send(null);
}
}
};
/**
* 将json参数转化成适合ajax提交的参数列表
* @param json
*/
function json2str(json) {
var strArr = [];
for (var i in json) {
//忽略默认的几个参数
if(i=="method" || i=="timeout" || i=="async") continue;
//传递过来的对象和函数不在提交之列
if (!((typeof json[i]).toLowerCase() == "function" || (typeof json[i]).toLowerCase() == "object")) {
strArr.push( encodeURIComponent(i) + "="+encodeURIComponent(json[i]) );
}
}
return strArr.join("&");
}
/**
* 创建一个ajaxRequest对象
*/
function creatAjaxRequest() {
var xmlHttp = null;
if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
} else {
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
}
}
}
return xmlHttp;
}
}();
///import core
/**
* @description 插入内容
* @name baidu.editor.execCommand
* @param {String} cmdName inserthtml插入内容的命令
* @param {String} html 要插入的内容
* @author zhanyi
*/
UE.commands['inserthtml'] = {
execCommand: function (command,html){
var me = this,
range,deletedElms, i,ci,
div,
tds = me.currentSelectedArr;
range = me.selection.getRange();
div = range.document.createElement( 'div' );
div.style.display = 'inline';
div.innerHTML = utils.trim( html );
try{
me.adjustTable && me.adjustTable(div);
}catch(e){}
if(tds && tds.length){
for(var i=0,ti;ti=tds[i++];){
ti.className = ''
}
tds[0].innerHTML = '';
range.setStart(tds[0],0).collapse(true);
me.currentSelectedArr = [];
}
if ( !range.collapsed ) {
range.deleteContents();
if(range.startContainer.nodeType == 1){
var child = range.startContainer.childNodes[range.startOffset],pre;
if(child && domUtils.isBlockElm(child) && (pre = child.previousSibling) && domUtils.isBlockElm(pre)){
range.setEnd(pre,pre.childNodes.length).collapse();
while(child.firstChild){
pre.appendChild(child.firstChild);
}
domUtils.remove(child);
}
}
}
var child,parent,pre,tmp,hadBreak = 0;
while ( child = div.firstChild ) {
range.insertNode( child );
if ( !hadBreak && child.nodeType == domUtils.NODE_ELEMENT && domUtils.isBlockElm( child ) ){
parent = domUtils.findParent( child,function ( node ){ return domUtils.isBlockElm( node ); } );
if ( parent && parent.tagName.toLowerCase() != 'body' && !(dtd[parent.tagName][child.nodeName] && child.parentNode === parent)){
if(!dtd[parent.tagName][child.nodeName]){
pre = parent;
}else{
tmp = child.parentNode;
while (tmp !== parent){
pre = tmp;
tmp = tmp.parentNode;
}
}
domUtils.breakParent( child, pre || tmp );
//去掉break后前一个多余的节点 <p>|<[p> ==> <p></p><div></div><p>|</p>
var pre = child.previousSibling;
domUtils.trimWhiteTextNode(pre);
if(!pre.childNodes.length){
domUtils.remove(pre);
}
hadBreak = 1;
}
}
var next = child.nextSibling;
if(!div.firstChild && next && domUtils.isBlockElm(next)){
range.setStart(next,0).collapse(true);
break;
}
range.setEndAfter( child ).collapse();
}
// if(!range.startContainer.childNodes[range.startOffset] && domUtils.isBlockElm(range.startContainer)){
// next = editor.document.createElement('br');
// range.insertNode(next);
// range.collapse(true);
// }
//block为空无法定位光标
child = range.startContainer;
//用chrome可能有空白展位符
if(domUtils.isBlockElm(child) && domUtils.isEmptyNode(child)){
child.innerHTML = browser.ie ? '' : '<br/>'
}
//加上true因为在删除表情等时会删两次,第一次是删的fillData
range.select(true);
setTimeout(function(){
range = me.selection.getRange();
range.scrollToView(me.autoHeightEnabled,me.autoHeightEnabled ? domUtils.getXY(me.iframe).y:0);
},200)
}
};
///import core
///commands 自动排版
///commandsName autotypeset
///commandsTitle 自动排版
/**
* 自动排版
* @function
* @name baidu.editor.execCommands
*/
UE.plugins['autotypeset'] = function(){
//升级了版本,但配置项目里没有autotypeset
if(!this.options.autotypeset){
return;
}
var me = this,
opt = me.options.autotypeset,
remainClass = {
'selectTdClass':1,
'pagebreak':1,
'anchorclass':1
},
remainTag = {
'li':1
},
tags = {
div:1,
p:1
},
highlightCont;
function isLine(node,notEmpty){
if(node && node.parentNode && tags[node.tagName.toLowerCase()]){
if(highlightCont && highlightCont.contains(node)
||
node.getAttribute('pagebreak')
){
return 0;
}
return notEmpty ? !domUtils.isEmptyBlock(node) : domUtils.isEmptyBlock(node);
}
}
function removeNotAttributeSpan(node){
if(!node.style.cssText){
domUtils.removeAttributes(node,['style']);
if(node.tagName.toLowerCase() == 'span' && domUtils.hasNoAttributes(node)){
domUtils.remove(node,true)
}
}
}
function autotype(type,html){
var cont;
if(html){
if(!opt.pasteFilter)return;
cont = me.document.createElement('div');
cont.innerHTML = html.html;
}else{
cont = me.document.body;
}
var nodes = domUtils.getElementsByTagName(cont,'*');
// 行首缩进,段落方向,段间距,段内间距
for(var i=0,ci;ci=nodes[i++];){
if(!highlightCont && ci.tagName == 'DIV' && ci.getAttribute('highlighter')){
highlightCont = ci;
}
//font-size
if(opt.clearFontSize && ci.style.fontSize){
ci.style.fontSize = '';
removeNotAttributeSpan(ci)
}
//font-family
if(opt.clearFontFamily && ci.style.fontFamily){
ci.style.fontFamily = '';
removeNotAttributeSpan(ci)
}
if(isLine(ci)){
//合并空行
if(opt.mergeEmptyline ){
var next = ci.nextSibling,tmpNode;
while(isLine(next)){
tmpNode = next;
next = tmpNode.nextSibling;
domUtils.remove(tmpNode);
}
}
//去掉空行,保留占位的空行
if(opt.removeEmptyline && domUtils.inDoc(ci,cont) && !remainTag[ci.parentNode.tagName.toLowerCase()] ){
domUtils.remove(ci);
continue;
}
}
if(isLine(ci,true) ){
if(opt.indent)
ci.style.textIndent = opt.indentValue;
if(opt.textAlign)
ci.style.textAlign = opt.textAlign;
// if(opt.lineHeight)
// ci.style.lineHeight = opt.lineHeight + 'cm';
}
//去掉class,保留的class不去掉
if(opt.removeClass && ci.className && !remainClass[ci.className.toLowerCase()]){
if(highlightCont && highlightCont.contains(ci)){
continue;
}
domUtils.removeAttributes(ci,['class'])
}
//表情不处理
if(opt.imageBlockLine && ci.tagName.toLowerCase() == 'img' && !ci.getAttribute('emotion')){
if(html){
var img = ci;
switch (opt.imageBlockLine){
case 'left':
case 'right':
case 'none':
var pN = img.parentNode,tmpNode,pre,next;
while(dtd.$inline[pN.tagName] || pN.tagName == 'A'){
pN = pN.parentNode;
}
tmpNode = pN;
if(tmpNode.tagName == 'P' && domUtils.getStyle(tmpNode,'text-align') == 'center'){
if(!domUtils.isBody(tmpNode) && domUtils.getChildCount(tmpNode,function(node){return !domUtils.isBr(node) && !domUtils.isWhitespace(node)}) == 1){
pre = tmpNode.previousSibling;
next = tmpNode.nextSibling;
if(pre && next && pre.nodeType == 1 && next.nodeType == 1 && pre.tagName == next.tagName && domUtils.isBlockElm(pre)){
pre.appendChild(tmpNode.firstChild);
while(next.firstChild){
pre.appendChild(next.firstChild)
}
domUtils.remove(tmpNode);
domUtils.remove(next);
}else{
domUtils.setStyle(tmpNode,'text-align','')
}
}
}
domUtils.setStyle(img,'float',opt.imageBlockLine);
break;
case 'center':
if(me.queryCommandValue('imagefloat') != 'center'){
pN = img.parentNode;
domUtils.setStyle(img,'float','none');
tmpNode = img;
while(pN && domUtils.getChildCount(pN,function(node){return !domUtils.isBr(node) && !domUtils.isWhitespace(node)}) == 1
&& (dtd.$inline[pN.tagName] || pN.tagName == 'A')){
tmpNode = pN;
pN = pN.parentNode;
}
var pNode = me.document.createElement('p');
domUtils.setAttributes(pNode,{
style:'text-align:center'
});
tmpNode.parentNode.insertBefore(pNode,tmpNode);
pNode.appendChild(tmpNode);
domUtils.setStyle(tmpNode,'float','');
}
}
}else{
var range = me.selection.getRange();
range.selectNode(ci).select();
me.execCommand('imagefloat',opt.imageBlockLine);
}
}
//去掉冗余的标签
if(opt.removeEmptyNode){
if(opt.removeTagNames[ci.tagName.toLowerCase()] && domUtils.hasNoAttributes(ci) && domUtils.isEmptyBlock(ci)){
domUtils.remove(ci)
}
}
}
if(html)
html.html = cont.innerHTML
}
if(opt.pasteFilter){
me.addListener('beforepaste',autotype);
}
me.commands['autotypeset'] = {
execCommand:function () {
me.removeListener('beforepaste',autotype);
if(opt.pasteFilter){
me.addListener('beforepaste',autotype);
}
autotype();
}
};
};
///import core
///import plugins\inserthtml.js
///import plugins\catchremoteimage.js
///commands 插入图片,操作图片的对齐方式
///commandsName InsertImage,ImageNone,ImageLeft,ImageRight,ImageCenter
///commandsTitle 图片,默认,居左,居右,居中
///commandsDialog dialogs\image\image.html
/**
* Created by .
* User: zhanyi
* for image
*/
UE.commands['imagefloat'] = {
execCommand : function (cmd, align){
var me = this,
range = me.selection.getRange();
if(!range.collapsed ){
var img = range.getClosedNode();
if(img && img.tagName == 'IMG'){
switch (align){
case 'left':
case 'right':
case 'none':
var pN = img.parentNode,tmpNode,pre,next;
while(dtd.$inline[pN.tagName] || pN.tagName == 'A'){
pN = pN.parentNode;
}
tmpNode = pN;
if(tmpNode.tagName == 'P' && domUtils.getStyle(tmpNode,'text-align') == 'center'){
if(!domUtils.isBody(tmpNode) && domUtils.getChildCount(tmpNode,function(node){return !domUtils.isBr(node) && !domUtils.isWhitespace(node)}) == 1){
pre = tmpNode.previousSibling;
next = tmpNode.nextSibling;
if(pre && next && pre.nodeType == 1 && next.nodeType == 1 && pre.tagName == next.tagName && domUtils.isBlockElm(pre)){
pre.appendChild(tmpNode.firstChild);
while(next.firstChild){
pre.appendChild(next.firstChild)
}
domUtils.remove(tmpNode);
domUtils.remove(next);
}else{
domUtils.setStyle(tmpNode,'text-align','')
}
}
range.selectNode(img).select()
}
domUtils.setStyle(img,'float',align);
break;
case 'center':
if(me.queryCommandValue('imagefloat') != 'center'){
pN = img.parentNode;
domUtils.setStyle(img,'float','none');
tmpNode = img;
while(pN && domUtils.getChildCount(pN,function(node){return !domUtils.isBr(node) && !domUtils.isWhitespace(node)}) == 1
&& (dtd.$inline[pN.tagName] || pN.tagName == 'A')){
tmpNode = pN;
pN = pN.parentNode;
}
range.setStartBefore(tmpNode).setCursor(false);
pN = me.document.createElement('div');
pN.appendChild(tmpNode);
domUtils.setStyle(tmpNode,'float','');
me.execCommand('insertHtml','<p id="_img_parent_tmp" style="text-align:center">'+pN.innerHTML+'</p>');
tmpNode = me.document.getElementById('_img_parent_tmp');
tmpNode.removeAttribute('id');
tmpNode = tmpNode.firstChild;
range.selectNode(tmpNode).select();
//去掉后边多余的元素
next = tmpNode.parentNode.nextSibling;
if(next && domUtils.isEmptyNode(next)){
domUtils.remove(next)
}
}
break;
}
}
}
},
queryCommandValue : function() {
var range = this.selection.getRange(),
startNode,floatStyle;
if(range.collapsed){
return 'none';
}
startNode = range.getClosedNode();
if(startNode && startNode.nodeType == 1 && startNode.tagName == 'IMG'){
floatStyle = domUtils.getComputedStyle(startNode,'float');
if(floatStyle == 'none'){
floatStyle = domUtils.getComputedStyle(startNode.parentNode,'text-align') == 'center' ? 'center' : floatStyle
}
return {
left : 1,
right : 1,
center : 1
}[floatStyle] ? floatStyle : 'none'
}
return 'none'
},
queryCommandState : function(){
if(this.highlight){
return -1;
}
var range = this.selection.getRange(),
startNode;
if(range.collapsed){
return -1;
}
startNode = range.getClosedNode();
if(startNode && startNode.nodeType == 1 && startNode.tagName == 'IMG'){
return 0;
}
return -1;
}
};
UE.commands['insertimage'] = {
execCommand : function (cmd, opt){
opt = utils.isArray(opt) ? opt : [opt];
if(!opt.length) return;
var me = this,
range = me.selection.getRange(),
img = range.getClosedNode();
if(img && /img/i.test( img.tagName ) && img.className != "edui-faked-video" &&!img.getAttribute("word_img") ){
var first = opt.shift();
var floatStyle = first['floatStyle'];
delete first['floatStyle'];
//// img.style.border = (first.border||0) +"px solid #000";
//// img.style.margin = (first.margin||0) +"px";
// img.style.cssText += ';margin:' + (first.margin||0) +"px;" + 'border:' + (first.border||0) +"px solid #000";
domUtils.setAttributes(img,first);
me.execCommand('imagefloat',floatStyle);
if(opt.length > 0){
range.setStartAfter(img).setCursor(false,true);
me.execCommand('insertimage',opt);
}
}else{
var html = [],str = '',ci;
ci = opt[0];
if(opt.length == 1){
str = '<img src="'+ci.src+'" '+ (ci.data_ue_src ? ' data_ue_src="' + ci.data_ue_src +'" ':'') +
(ci.width ? 'width="'+ci.width+'" ':'') +
(ci.height ? ' height="'+ci.height+'" ':'') +
(ci['floatStyle']&&ci['floatStyle']!='center' ? ' style="float:'+ci['floatStyle']+';"':'') +
(ci.title?' title="'+ci.title+'"':'') + ' border="'+ (ci.border||0) + '" hspace = "'+(ci.hspace||0)+'" vspace = "'+(ci.vspace||0)+'" />';
if(ci['floatStyle'] == 'center'){
str = '<p style="text-align: center">'+str+'</p>'
}
html.push(str)
}else{
for(var i=0;ci=opt[i++];){
str = '<p ' + (ci['floatStyle'] == 'center' ? 'style="text-align: center" ' : '') + '><img src="'+ci.src+'" '+
(ci.width ? 'width="'+ci.width+'" ':'') + (ci.data_ue_src ? ' data_ue_src="' + ci.data_ue_src +'" ':'') +
(ci.height ? ' height="'+ci.height+'" ':'') +
' style="' + (ci['floatStyle']&&ci['floatStyle']!='center' ? 'float:'+ci['floatStyle']+';':'') +
(ci.border||'') + '" ' +
(ci.title?' title="'+ci.title+'"':'') + ' /></p>';
// if(ci['floatStyle'] == 'center'){
// str = '<p style="text-align: center">'+str+'</p>'
// }
html.push(str)
}
}
me.execCommand('insertHtml',html.join(''));
}
},
queryCommandState : function(){
return this.highlight ? -1 :0;
}
};
///import core
///commands 段落格式,居左,居右,居中,两端对齐
///commandsName JustifyLeft,JustifyCenter,JustifyRight,JustifyJustify
///commandsTitle 居左对齐,居中对齐,居右对齐,两端对齐
/**
* @description 居左右中
* @name baidu.editor.execCommand
* @param {String} cmdName justify执行对齐方式的命令
* @param {String} align 对齐方式:left居左,right居右,center居中,justify两端对齐
* @author zhanyi
*/
(function(){
var block = domUtils.isBlockElm,
defaultValue = {
left : 1,
right : 1,
center : 1,
justify : 1
},
doJustify = function(range,style){
var bookmark = range.createBookmark(),
filterFn = function( node ) {
return node.nodeType == 1 ? node.tagName.toLowerCase() != 'br' && !domUtils.isBookmarkNode(node) : !domUtils.isWhitespace( node )
};
range.enlarge(true);
var bookmark2 = range.createBookmark(),
current = domUtils.getNextDomNode(bookmark2.start,false,filterFn),
tmpRange = range.cloneRange(),
tmpNode;
while(current && !(domUtils.getPosition(current,bookmark2.end)&domUtils.POSITION_FOLLOWING)){
if(current.nodeType == 3 || !block(current)){
tmpRange.setStartBefore(current);
while(current && current!==bookmark2.end && !block(current)){
tmpNode = current;
current = domUtils.getNextDomNode(current,false,null,function(node){
return !block(node)
});
}
tmpRange.setEndAfter(tmpNode);
var common = tmpRange.getCommonAncestor();
if( !domUtils.isBody(common) && block(common)){
domUtils.setStyles(common,utils.isString(style) ? {'text-align':style} : style);
current = common;
}else{
var p = range.document.createElement('p');
domUtils.setStyles(p,utils.isString(style) ? {'text-align':style} : style);
var frag = tmpRange.extractContents();
p.appendChild(frag);
tmpRange.insertNode(p);
current = p;
}
current = domUtils.getNextDomNode(current,false,filterFn);
}else{
current = domUtils.getNextDomNode(current,true,filterFn);
}
}
return range.moveToBookmark(bookmark2).moveToBookmark(bookmark)
};
UE.commands['justify'] = {
execCommand : function( cmdName,align ) {
var range = this.selection.getRange(),
txt;
if(this.currentSelectedArr && this.currentSelectedArr.length > 0){
for(var i=0,ti;ti=this.currentSelectedArr[i++];){
if(domUtils.isEmptyNode(ti)){
txt = this.document.createTextNode('p');
range.setStart(ti,0).collapse(true).insertNode(txt).selectNode(txt);
}else{
range.selectNodeContents(ti)
}
doJustify(range,align);
txt && domUtils.remove(txt);
}
range.selectNode(this.currentSelectedArr[0]).select()
}else{
//闭合时单独处理
if(range.collapsed){
txt = this.document.createTextNode('p');
range.insertNode(txt);
}
doJustify(range,align);
if(txt){
range.setStartBefore(txt).collapse(true);
domUtils.remove(txt);
}
range.select();
}
return true;
},
queryCommandValue : function() {
var startNode = this.selection.getStart(),
value = domUtils.getComputedStyle(startNode,'text-align');
return defaultValue[value] ? value : 'left';
},
queryCommandState : function(){
return this.highlight ? -1 : 0;
}
}
})();
///import core
///import plugins\removeformat.js
///commands 字体颜色,背景色,字号,字体,下划线,删除线
///commandsName ForeColor,BackColor,FontSize,FontFamily,Underline,StrikeThrough
///commandsTitle 字体颜色,背景色,字号,字体,下划线,删除线
/**
* @description 字体
* @name baidu.editor.execCommand
* @param {String} cmdName 执行的功能名称
* @param {String} value 传入的值
*/
(function() {
var fonts = {
'forecolor':'color',
'backcolor':'background-color',
'fontsize':'font-size',
'fontfamily':'font-family',
'underline':'text-decoration',
'strikethrough':'text-decoration'
};
for ( var p in fonts ) {
(function( cmd, style ) {
UE.commands[cmd] = {
execCommand : function( cmdName, value ) {
value = value || (this.queryCommandState(cmdName) ? 'none' : cmdName == 'underline' ? 'underline' : 'line-through');
var me = this,
range = this.selection.getRange(),
text;
if ( value == 'default' ) {
if(range.collapsed){
text = me.document.createTextNode('font');
range.insertNode(text).select()
}
me.execCommand( 'removeFormat', 'span,a', style);
if(text){
range.setStartBefore(text).setCursor();
domUtils.remove(text)
}
} else {
if(me.currentSelectedArr && me.currentSelectedArr.length > 0){
for(var i=0,ci;ci=me.currentSelectedArr[i++];){
range.selectNodeContents(ci);
range.applyInlineStyle( 'span', {'style':style + ':' + value} );
}
range.selectNodeContents(this.currentSelectedArr[0]).select();
}else{
if ( !range.collapsed ) {
if((cmd == 'underline'||cmd=='strikethrough') && me.queryCommandValue(cmd)){
me.execCommand( 'removeFormat', 'span,a', style );
}
range = me.selection.getRange();
range.applyInlineStyle( 'span', {'style':style + ':' + value} ).select();
} else {
var span = domUtils.findParentByTagName(range.startContainer,'span',true);
text = me.document.createTextNode('font');
if(span && !span.children.length && !span[browser.ie ? 'innerText':'textContent'].replace(fillCharReg,'').length){
//for ie hack when enter
range.insertNode(text);
if(cmd == 'underline'||cmd=='strikethrough'){
range.selectNode(text).select();
me.execCommand( 'removeFormat','span,a', style, null );
span = domUtils.findParentByTagName(text,'span',true);
range.setStartBefore(text)
}
span.style.cssText = span.style.cssText + ';' + style + ':' + value;
range.collapse(true).select();
}else{
range.insertNode(text);
range.selectNode(text).select();
span = range.document.createElement( 'span' );
if(cmd == 'underline'||cmd=='strikethrough'){
//a标签内的不处理跳过
if(domUtils.findParentByTagName(text,'a',true)){
range.setStartBefore(text).setCursor();
domUtils.remove(text);
return;
}
me.execCommand( 'removeFormat','span,a', style );
}
span.style.cssText = style + ':' + value;
text.parentNode.insertBefore(span,text);
//修复,span套span 但样式不继承的问题
if(!browser.ie || browser.ie && browser.version == 9){
var spanParent = span.parentNode;
while(!domUtils.isBlockElm(spanParent)){
if(spanParent.tagName == 'SPAN'){
span.style.cssText = spanParent.style.cssText + span.style.cssText;
}
spanParent = spanParent.parentNode;
}
}
range.setStart(span,0).setCursor();
//trace:981
//domUtils.mergToParent(span)
}
domUtils.remove(text)
}
}
}
return true;
},
queryCommandValue : function (cmdName) {
var startNode = this.selection.getStart();
//trace:946
if(cmdName == 'underline'||cmdName=='strikethrough' ){
var tmpNode = startNode,value;
while(tmpNode && !domUtils.isBlockElm(tmpNode) && !domUtils.isBody(tmpNode)){
if(tmpNode.nodeType == 1){
value = domUtils.getComputedStyle( tmpNode, style );
if(value != 'none'){
return value;
}
}
tmpNode = tmpNode.parentNode;
}
return 'none'
}
return domUtils.getComputedStyle( startNode, style );
},
queryCommandState : function(cmdName){
if(this.highlight){
return -1;
}
if(!(cmdName == 'underline'||cmdName=='strikethrough'))
return 0;
return this.queryCommandValue(cmdName) == (cmdName == 'underline' ? 'underline' : 'line-through')
}
}
})( p, fonts[p] );
}
})();
///import core
///commands 超链接,取消链接
///commandsName Link,Unlink
///commandsTitle 超链接,取消链接
///commandsDialog dialogs\link\link.html
/**
* 超链接
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName link插入超链接
* @param {Object} options url地址,title标题,target是否打开新页
* @author zhanyi
*/
/**
* 取消链接
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName unlink取消链接
* @author zhanyi
*/
(function() {
function optimize( range ) {
var start = range.startContainer,end = range.endContainer;
if ( start = domUtils.findParentByTagName( start, 'a', true ) ) {
range.setStartBefore( start )
}
if ( end = domUtils.findParentByTagName( end, 'a', true ) ) {
range.setEndAfter( end )
}
}
UE.commands['unlink'] = {
execCommand : function() {
var as,
range = new dom.Range(this.document),
tds = this.currentSelectedArr,
bookmark;
if(tds && tds.length >0){
for(var i=0,ti;ti=tds[i++];){
as = domUtils.getElementsByTagName(ti,'a');
for(var j=0,aj;aj=as[j++];){
domUtils.remove(aj,true);
}
}
if(domUtils.isEmptyNode(tds[0])){
range.setStart(tds[0],0).setCursor();
}else{
range.selectNodeContents(tds[0]).select()
}
}else{
range = this.selection.getRange();
if(range.collapsed && !domUtils.findParentByTagName( range.startContainer, 'a', true )){
return;
}
bookmark = range.createBookmark();
optimize( range );
range.removeInlineStyle( 'a' ).moveToBookmark( bookmark ).select();
}
},
queryCommandState : function(){
return !this.highlight && this.queryCommandValue('link') ? 0 : -1;
}
};
function doLink(range,opt){
optimize( range = range.adjustmentBoundary() );
var start = range.startContainer;
if(start.nodeType == 1){
start = start.childNodes[range.startOffset];
if(start && start.nodeType == 1 && start.tagName == 'A' && /^(?:https?|ftp|file)\s*:\s*\/\//.test(start[browser.ie?'innerText':'textContent'])){
start.innerHTML = opt.href;
}
}
range.removeInlineStyle( 'a' );
if ( range.collapsed ) {
var a = range.document.createElement( 'a' );
domUtils.setAttributes( a, opt );
a.innerHTML = opt.href;
range.insertNode( a ).selectNode( a );
} else {
range.applyInlineStyle( 'a', opt )
}
}
UE.commands['link'] = {
queryCommandState : function(){
return this.highlight ? -1 :0;
},
execCommand : function( cmdName, opt ) {
var range = new dom.Range(this.document),
tds = this.currentSelectedArr;
if(tds && tds.length){
for(var i=0,ti;ti=tds[i++];){
if(domUtils.isEmptyNode(ti)){
ti.innerHTML = opt.href
}
doLink(range.selectNodeContents(ti),opt)
}
range.selectNodeContents(tds[0]).select()
}else{
doLink(range=this.selection.getRange(),opt);
range.collapse().select(browser.gecko ? true : false);
}
},
queryCommandValue : function() {
var range = new dom.Range(this.document),
tds = this.currentSelectedArr,
as,
node;
if(tds && tds.length){
for(var i=0,ti;ti=tds[i++];){
as = ti.getElementsByTagName('a');
if(as[0])
return as[0]
}
}else{
range = this.selection.getRange();
if ( range.collapsed ) {
node = this.selection.getStart();
if ( node && (node = domUtils.findParentByTagName( node, 'a', true )) ) {
return node;
}
} else {
//trace:1111 如果是<p><a>xx</a></p> startContainer是p就会找不到a
range.shrinkBoundary();
var start = range.startContainer.nodeType == 3 || !range.startContainer.childNodes[range.startOffset] ? range.startContainer : range.startContainer.childNodes[range.startOffset],
end = range.endContainer.nodeType == 3 || range.endOffset == 0 ? range.endContainer : range.endContainer.childNodes[range.endOffset-1],
common = range.getCommonAncestor();
node = domUtils.findParentByTagName( common, 'a', true );
if ( !node && common.nodeType == 1){
var as = common.getElementsByTagName( 'a' ),
ps,pe;
for ( var i = 0,ci; ci = as[i++]; ) {
ps = domUtils.getPosition( ci, start ),pe = domUtils.getPosition( ci,end);
if ( (ps & domUtils.POSITION_FOLLOWING || ps & domUtils.POSITION_CONTAINS)
&&
(pe & domUtils.POSITION_PRECEDING || pe & domUtils.POSITION_CONTAINS)
) {
node = ci;
break;
}
}
}
return node;
}
}
}
};
})();
///import core
///import plugins\inserthtml.js
///commands 地图
///commandsName Map,GMap
///commandsTitle Baidu地图,Google地图
///commandsDialog dialogs\map\map.html,dialogs\gmap\gmap.html
UE.commands['gmap'] =
UE.commands['map'] = {
queryCommandState : function(){
return this.highlight ? -1 :0;
}
};
///import core
///import plugins\inserthtml.js
///commands 插入框架
///commandsName InsertFrame
///commandsTitle 插入Iframe
///commandsDialog dialogs\insertframe\insertframe.html
UE.commands['insertframe'] = {
queryCommandState : function(){
return this.highlight ? -1 :0;
}
};
///import core
///commands 清除格式
///commandsName RemoveFormat
///commandsTitle 清除格式
/**
* @description 清除格式
* @name baidu.editor.execCommand
* @param {String} cmdName removeformat清除格式命令
* @param {String} tags 以逗号隔开的标签。如:span,a
* @param {String} style 样式
* @param {String} attrs 属性
* @param {String} notIncluedA 是否把a标签切开
* @author zhanyi
*/
UE.commands['removeformat'] = {
execCommand : function( cmdName, tags, style, attrs,notIncludeA ) {
var tagReg = new RegExp( '^(?:' + (tags || this.options.removeFormatTags).replace( /,/g, '|' ) + ')$', 'i' ) ,
removeFormatAttributes = style ? [] : (attrs || this.options.removeFormatAttributes).split( ',' ),
range = new dom.Range( this.document ),
bookmark,node,parent,
filter = function( node ) {
return node.nodeType == 1;
};
function isRedundantSpan (node) {
if (node.nodeType == 3 || node.tagName.toLowerCase() != 'span')
return 0;
if (browser.ie) {
//ie 下判断实效,所以只能简单用style来判断
//return node.style.cssText == '' ? 1 : 0;
var attrs = node.attributes;
if ( attrs.length ) {
for ( var i = 0,l = attrs.length; i<l; i++ ) {
if ( attrs[i].specified ) {
return 0;
}
}
return 1;
}
}
return !node.attributes.length
}
function doRemove( range ) {
var bookmark1 = range.createBookmark();
if ( range.collapsed ) {
range.enlarge( true );
}
//不能把a标签切了
if(!notIncludeA){
var aNode = domUtils.findParentByTagName(range.startContainer,'a',true);
if(aNode){
range.setStartBefore(aNode)
}
aNode = domUtils.findParentByTagName(range.endContainer,'a',true);
if(aNode){
range.setEndAfter(aNode)
}
}
bookmark = range.createBookmark();
node = bookmark.start;
//切开始
while ( (parent = node.parentNode) && !domUtils.isBlockElm( parent ) ) {
domUtils.breakParent( node, parent );
domUtils.clearEmptySibling( node );
}
if ( bookmark.end ) {
//切结束
node = bookmark.end;
while ( (parent = node.parentNode) && !domUtils.isBlockElm( parent ) ) {
domUtils.breakParent( node, parent );
domUtils.clearEmptySibling( node );
}
//开始去除样式
var current = domUtils.getNextDomNode( bookmark.start, false, filter ),
next;
while ( current ) {
if ( current == bookmark.end ) {
break;
}
next = domUtils.getNextDomNode( current, true, filter );
if ( !dtd.$empty[current.tagName.toLowerCase()] && !domUtils.isBookmarkNode( current ) ) {
if ( tagReg.test( current.tagName ) ) {
if ( style ) {
domUtils.removeStyle( current, style );
if ( isRedundantSpan( current ) && style != 'text-decoration')
domUtils.remove( current, true );
} else {
domUtils.remove( current, true )
}
} else {
//trace:939 不能把list上的样式去掉
if(!dtd.$tableContent[current.tagName] && !dtd.$list[current.tagName]){
domUtils.removeAttributes( current, removeFormatAttributes );
if ( isRedundantSpan( current ) )
domUtils.remove( current, true );
}
}
}
current = next;
}
}
//trace:1035
//trace:1096 不能把td上的样式去掉,比如边框
var pN = bookmark.start.parentNode;
if(domUtils.isBlockElm(pN) && !dtd.$tableContent[pN.tagName] && !dtd.$list[pN.tagName]){
domUtils.removeAttributes( pN,removeFormatAttributes );
}
pN = bookmark.end.parentNode;
if(bookmark.end && domUtils.isBlockElm(pN) && !dtd.$tableContent[pN.tagName]&& !dtd.$list[pN.tagName]){
domUtils.removeAttributes( pN,removeFormatAttributes );
}
range.moveToBookmark( bookmark ).moveToBookmark(bookmark1);
//清除冗余的代码 <b><bookmark></b>
var node = range.startContainer,
tmp,
collapsed = range.collapsed;
while(node.nodeType == 1 && domUtils.isEmptyNode(node) && dtd.$removeEmpty[node.tagName]){
tmp = node.parentNode;
range.setStartBefore(node);
//trace:937
//更新结束边界
if(range.startContainer === range.endContainer){
range.endOffset--;
}
domUtils.remove(node);
node = tmp;
}
if(!collapsed){
node = range.endContainer;
while(node.nodeType == 1 && domUtils.isEmptyNode(node) && dtd.$removeEmpty[node.tagName]){
tmp = node.parentNode;
range.setEndBefore(node);
domUtils.remove(node);
node = tmp;
}
}
}
if ( this.currentSelectedArr && this.currentSelectedArr.length ) {
for ( var i = 0,ci; ci = this.currentSelectedArr[i++]; ) {
range.selectNodeContents( ci );
doRemove( range );
}
range.selectNodeContents( this.currentSelectedArr[0] ).select();
} else {
range = this.selection.getRange();
doRemove( range );
range.select();
}
},
queryCommandState : function(){
return this.highlight ? -1 :0;
}
};
///import core
///commands 引用
///commandsName BlockQuote
///commandsTitle 引用
/**
*
* 引用模块实现
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName blockquote引用
*/
(function() {
var getObj = function(editor){
// var startNode = editor.selection.getStart();
// return domUtils.findParentByTagName( startNode, 'blockquote', true )
return utils.findNode(editor.selection.getStartElementPath(),['blockquote'])
};
UE.commands['blockquote'] = {
execCommand : function( cmdName, attrs ) {
var range = this.selection.getRange(),
obj = getObj(this),
blockquote = dtd.blockquote,
bookmark = range.createBookmark(),
tds = this.currentSelectedArr;
if ( obj ) {
if(tds && tds.length){
domUtils.remove(obj,true)
}else{
var start = range.startContainer,
startBlock = domUtils.isBlockElm(start) ? start : domUtils.findParent(start,function(node){return domUtils.isBlockElm(node)}),
end = range.endContainer,
endBlock = domUtils.isBlockElm(end) ? end : domUtils.findParent(end,function(node){return domUtils.isBlockElm(node)});
//处理一下li
startBlock = domUtils.findParentByTagName(startBlock,'li',true) || startBlock;
endBlock = domUtils.findParentByTagName(endBlock,'li',true) || endBlock;
if(startBlock.tagName == 'LI' || startBlock.tagName == 'TD' || startBlock === obj){
domUtils.remove(obj,true)
}else{
domUtils.breakParent(startBlock,obj);
}
if(startBlock !== endBlock){
obj = domUtils.findParentByTagName(endBlock,'blockquote');
if(obj){
if(endBlock.tagName == 'LI' || endBlock.tagName == 'TD'){
domUtils.remove(obj,true)
}else{
domUtils.breakParent(endBlock,obj);
}
}
}
var blockquotes = domUtils.getElementsByTagName(this.document,'blockquote');
for(var i=0,bi;bi=blockquotes[i++];){
if(!bi.childNodes.length){
domUtils.remove(bi)
}else if(domUtils.getPosition(bi,startBlock)&domUtils.POSITION_FOLLOWING && domUtils.getPosition(bi,endBlock)&domUtils.POSITION_PRECEDING){
domUtils.remove(bi,true)
}
}
}
} else {
var tmpRange = range.cloneRange(),
node = tmpRange.startContainer.nodeType == 1 ? tmpRange.startContainer : tmpRange.startContainer.parentNode,
preNode = node,
doEnd = 1;
//调整开始
while ( 1 ) {
if ( domUtils.isBody(node) ) {
if ( preNode !== node ) {
if ( range.collapsed ) {
tmpRange.selectNode( preNode );
doEnd = 0;
} else {
tmpRange.setStartBefore( preNode );
}
}else{
tmpRange.setStart(node,0)
}
break;
}
if ( !blockquote[node.tagName] ) {
if ( range.collapsed ) {
tmpRange.selectNode( preNode )
} else
tmpRange.setStartBefore( preNode);
break;
}
preNode = node;
node = node.parentNode;
}
//调整结束
if ( doEnd ) {
preNode = node = node = tmpRange.endContainer.nodeType == 1 ? tmpRange.endContainer : tmpRange.endContainer.parentNode;
while ( 1 ) {
if ( domUtils.isBody( node ) ) {
if ( preNode !== node ) {
tmpRange.setEndAfter( preNode );
} else {
tmpRange.setEnd( node, node.childNodes.length )
}
break;
}
if ( !blockquote[node.tagName] ) {
tmpRange.setEndAfter( preNode );
break;
}
preNode = node;
node = node.parentNode;
}
}
node = range.document.createElement( 'blockquote' );
domUtils.setAttributes( node, attrs );
node.appendChild( tmpRange.extractContents() );
tmpRange.insertNode( node );
//去除重复的
var childs = domUtils.getElementsByTagName(node,'blockquote');
for(var i=0,ci;ci=childs[i++];){
if(ci.parentNode){
domUtils.remove(ci,true)
}
}
}
range.moveToBookmark( bookmark ).select()
},
queryCommandState : function() {
if(this.highlight){
return -1;
}
return getObj(this) ? 1 : 0;
}
};
})();
///import core
///import plugins\paragraph.js
///commands 首行缩进
///commandsName Outdent,Indent
///commandsTitle 取消缩进,首行缩进
/**
* 首行缩进
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName outdent取消缩进,indent缩进
*/
UE.commands['indent'] = {
execCommand : function() {
var me = this,value = me.queryCommandState("indent") ? "0em" : me.options.indentValue || '2em';
me.execCommand('Paragraph','p',{style:'text-indent:'+ value});
},
queryCommandState : function() {
if(this.highlight){return -1;}
var //start = this.selection.getStart(),
// pN = domUtils.findParentByTagName(start,['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'],true),
pN = utils.findNode(this.selection.getStartElementPath(),['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']),
indent = pN && pN.style.textIndent ? parseInt(pN.style.textIndent) : '';
return indent ? 1 : 0;
}
};
///import core
///commands 打印
///commandsName Print
///commandsTitle 打印
/**
* @description 打印
* @name baidu.editor.execCommand
* @param {String} cmdName print打印编辑器内容
* @author zhanyi
*/
UE.commands['print'] = {
execCommand : function(){
this.window.print();
},
notNeedUndo : 1
};
///import core
///commands 预览
///commandsName Preview
///commandsTitle 预览
/**
* 预览
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName preview预览编辑器内容
*/
UE.commands['preview'] = {
execCommand : function(){
var me = this,
w = window.open('', '_blank', ""),
d = w.document,
css = me.document.getElementById("syntaxhighlighter_css"),
js = document.getElementById("syntaxhighlighter_js"),
style = "<style type='text/css'>" + me.options.initialStyle + "</style>",
cont = me.getContent();
if(browser.ie){
cont = cont.replace(/<\s*br\s*\/?\s*>/gi,'<br/><br/>')
}
d.open();
d.write('<html><head>'+style+'<link rel="stylesheet" type="text/css" href="'+me.options.UEDITOR_HOME_URL+utils.unhtml( this.options.iframeCssUrl ) + '"/>'+
(css ? '<link rel="stylesheet" type="text/css" href="' + css.href + '"/>' : '')
+ (css ? ' <script type="text/javascript" charset="utf-8" src="'+js.src+'"></script>':'')
+'<title></title></head><body >' +
cont +
(css ? '<script type="text/javascript">'+(baidu.editor.browser.ie ? 'window.onload = function(){SyntaxHighlighter.all()};' : 'SyntaxHighlighter.all();')+
'setTimeout(function(){' +
'for(var i=0,di;di=SyntaxHighlighter.highlightContainers[i++];){' +
'var tds = di.getElementsByTagName("td");' +
'for(var j=0,li,ri;li=tds[0].childNodes[j];j++){' +
'ri = tds[1].firstChild.childNodes[j];' +
'ri.style.height = li.style.height = ri.offsetHeight + "px";' +
'}' +
'}},100)</script>':'') +
'</body></html>');
d.close();
},
notNeedUndo : 1
};
///import core
///import plugins\inserthtml.js
///commands 特殊字符
///commandsName Spechars
///commandsTitle 特殊字符
///commandsDialog dialogs\spechars\spechars.html
UE.commands['spechars'] = {
queryCommandState : function(){
return this.highlight ? -1 :0;
}
};
///import core
///import plugins\image.js
///commands 插入表情
///commandsName Emotion
///commandsTitle 表情
///commandsDialog dialogs\emotion\emotion.html
UE.commands['emotion'] = {
queryCommandState : function(){
return this.highlight ? -1 :0;
}
};
///import core
///commands 全选
///commandsName SelectAll
///commandsTitle 全选
/**
* 选中所有
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName selectall选中编辑器里的所有内容
* @author zhanyi
*/
UE.plugins['selectall'] = function(){
var me = this;
me.commands['selectall'] = {
execCommand : function(){
//去掉了原生的selectAll,因为会出现报错和当内容为空时,不能出现闭合状态的光标
var range = this.selection.getRange();
range.selectNodeContents(this.body);
if(domUtils.isEmptyBlock(this.body))
range.collapse(true);
range.select(true);
this.selectAll = true;
},
notNeedUndo : 1
};
me.addListener('ready',function(){
domUtils.on(me.document,'click',function(evt){
me.selectAll = false;
})
})
};
///import core
///commands 格式
///commandsName Paragraph
///commandsTitle 段落格式
/**
* 段落样式
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName paragraph插入段落执行命令
* @param {String} style 标签值为:'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'
* @param {String} attrs 标签的属性
* @author zhanyi
*/
(function() {
var block = domUtils.isBlockElm,
notExchange = ['TD','LI','PRE'],
doParagraph = function(range,style,attrs,sourceCmdName){
var bookmark = range.createBookmark(),
filterFn = function( node ) {
return node.nodeType == 1 ? node.tagName.toLowerCase() != 'br' && !domUtils.isBookmarkNode(node) : !domUtils.isWhitespace( node )
},
para;
range.enlarge( true );
var bookmark2 = range.createBookmark(),
current = domUtils.getNextDomNode( bookmark2.start, false, filterFn ),
tmpRange = range.cloneRange(),
tmpNode;
while ( current && !(domUtils.getPosition( current, bookmark2.end ) & domUtils.POSITION_FOLLOWING) ) {
if ( current.nodeType == 3 || !block( current ) ) {
tmpRange.setStartBefore( current );
while ( current && current !== bookmark2.end && !block( current ) ) {
tmpNode = current;
current = domUtils.getNextDomNode( current, false, null, function( node ) {
return !block( node )
} );
}
tmpRange.setEndAfter( tmpNode );
para = range.document.createElement( style );
if(attrs){
domUtils.setAttributes(para,attrs);
if(sourceCmdName && sourceCmdName == 'customstyle' && attrs.style)
para.style.cssText = attrs.style;
}
para.appendChild( tmpRange.extractContents() );
//需要内容占位
if(domUtils.isEmptyNode(para)){
domUtils.fillChar(range.document,para);
}
tmpRange.insertNode( para );
var parent = para.parentNode;
//如果para上一级是一个block元素且不是body,td就删除它
if ( block( parent ) && !domUtils.isBody( para.parentNode ) && utils.indexOf(notExchange,parent.tagName)==-1) {
//存储dir,style
if(!(sourceCmdName && sourceCmdName == 'customstyle')){
parent.getAttribute('dir') && para.setAttribute('dir',parent.getAttribute('dir'));
//trace:1070
parent.style.cssText && (para.style.cssText = parent.style.cssText + ';' + para.style.cssText);
//trace:1030
parent.style.textAlign && !para.style.textAlign && (para.style.textAlign = parent.style.textAlign);
parent.style.textIndent && !para.style.textIndent && (para.style.textIndent = parent.style.textIndent);
parent.style.padding && !para.style.padding && (para.style.padding = parent.style.padding);
}
//trace:1706 选择的就是h1-6要删除
if(attrs && /h\d/i.test(parent.tagName) && !/h\d/i.test(para.tagName) ){
domUtils.setAttributes(parent,attrs);
if(sourceCmdName && sourceCmdName == 'customstyle' && attrs.style)
parent.style.cssText = attrs.style;
domUtils.remove(para,true);
para = parent;
}else
domUtils.remove( para.parentNode, true );
}
if( utils.indexOf(notExchange,parent.tagName)!=-1){
current = parent;
}else{
current = para;
}
current = domUtils.getNextDomNode( current, false, filterFn );
} else {
current = domUtils.getNextDomNode( current, true, filterFn );
}
}
return range.moveToBookmark( bookmark2 ).moveToBookmark( bookmark );
};
UE.commands['paragraph'] = {
execCommand : function( cmdName, style,attrs,sourceCmdName ) {
var range = new dom.Range(this.document);
if(this.currentSelectedArr && this.currentSelectedArr.length > 0){
for(var i=0,ti;ti=this.currentSelectedArr[i++];){
//trace:1079 不显示的不处理,插入文本,空的td也能加上相应的标签
if(ti.style.display == 'none') continue;
if(domUtils.isEmptyNode(ti)){
var tmpTxt = this.document.createTextNode('paragraph');
ti.innerHTML = '';
ti.appendChild(tmpTxt);
}
doParagraph(range.selectNodeContents(ti),style,attrs,sourceCmdName);
if(tmpTxt){
var pN = tmpTxt.parentNode;
domUtils.remove(tmpTxt);
if(domUtils.isEmptyNode(pN)){
domUtils.fillNode(this.document,pN)
}
}
}
var td = this.currentSelectedArr[0];
if(domUtils.isEmptyBlock(td)){
range.setStart(td,0).setCursor(false,true);
}else{
range.selectNode(td).select()
}
}else{
range = this.selection.getRange();
//闭合时单独处理
if(range.collapsed){
var txt = this.document.createTextNode('p');
range.insertNode(txt);
//去掉冗余的fillchar
if(browser.ie){
var node = txt.previousSibling;
if(node && domUtils.isWhitespace(node)){
domUtils.remove(node)
}
node = txt.nextSibling;
if(node && domUtils.isWhitespace(node)){
domUtils.remove(node)
}
}
}
range = doParagraph(range,style,attrs,sourceCmdName);
if(txt){
range.setStartBefore(txt).collapse(true);
pN = txt.parentNode;
domUtils.remove(txt);
if(domUtils.isBlockElm(pN)&&domUtils.isEmptyNode(pN)){
domUtils.fillNode(this.document,pN)
}
}
if(browser.gecko && range.collapsed && range.startContainer.nodeType == 1){
var child = range.startContainer.childNodes[range.startOffset];
if(child && child.nodeType == 1 && child.tagName.toLowerCase() == style){
range.setStart(child,0).collapse(true)
}
}
//trace:1097 原来有true,原因忘了,但去了就不能清除多余的占位符了
range.select()
}
return true;
},
queryCommandValue : function() {
var node = utils.findNode(this.selection.getStartElementPath(),['p','h1','h2','h3','h4','h5','h6']);
return node ? node.tagName.toLowerCase() : '';
},
queryCommandState : function(){
return this.highlight ? -1 :0;
}
}
})();
///import core
///commands 输入的方向
///commandsName DirectionalityLtr,DirectionalityRtl
///commandsTitle 从左向右输入,从右向左输入
/**
* 输入的方向
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName directionality执行函数的参数
* @param {String} forward ltr从左向右输入,rtl从右向左输入
*/
(function() {
var block = domUtils.isBlockElm ,
getObj = function(editor){
// var startNode = editor.selection.getStart(),
// parents;
// if ( startNode ) {
// //查找所有的是block的父亲节点
// parents = domUtils.findParents( startNode, true, block, true );
// for ( var i = 0,ci; ci = parents[i++]; ) {
// if ( ci.getAttribute( 'dir' ) ) {
// return ci;
// }
// }
// }
return utils.findNode(editor.selection.getStartElementPath(),null,function(n){return n.getAttribute('dir')});
},
doDirectionality = function(range,editor,forward){
var bookmark,
filterFn = function( node ) {
return node.nodeType == 1 ? !domUtils.isBookmarkNode(node) : !domUtils.isWhitespace(node)
},
obj = getObj( editor );
if ( obj && range.collapsed ) {
obj.setAttribute( 'dir', forward );
return range;
}
bookmark = range.createBookmark();
range.enlarge( true );
var bookmark2 = range.createBookmark(),
current = domUtils.getNextDomNode( bookmark2.start, false, filterFn ),
tmpRange = range.cloneRange(),
tmpNode;
while ( current && !(domUtils.getPosition( current, bookmark2.end ) & domUtils.POSITION_FOLLOWING) ) {
if ( current.nodeType == 3 || !block( current ) ) {
tmpRange.setStartBefore( current );
while ( current && current !== bookmark2.end && !block( current ) ) {
tmpNode = current;
current = domUtils.getNextDomNode( current, false, null, function( node ) {
return !block( node )
} );
}
tmpRange.setEndAfter( tmpNode );
var common = tmpRange.getCommonAncestor();
if ( !domUtils.isBody( common ) && block( common ) ) {
//遍历到了block节点
common.setAttribute( 'dir', forward );
current = common;
} else {
//没有遍历到,添加一个block节点
var p = range.document.createElement( 'p' );
p.setAttribute( 'dir', forward );
var frag = tmpRange.extractContents();
p.appendChild( frag );
tmpRange.insertNode( p );
current = p;
}
current = domUtils.getNextDomNode( current, false, filterFn );
} else {
current = domUtils.getNextDomNode( current, true, filterFn );
}
}
return range.moveToBookmark( bookmark2 ).moveToBookmark( bookmark );
};
UE.commands['directionality'] = {
execCommand : function( cmdName,forward ) {
var range = new dom.Range(this.document);
if(this.currentSelectedArr && this.currentSelectedArr.length > 0){
for(var i=0,ti;ti=this.currentSelectedArr[i++];){
if(ti.style.display != 'none')
doDirectionality(range.selectNode(ti),this,forward);
}
range.selectNode(this.currentSelectedArr[0]).select()
}else{
range = this.selection.getRange();
//闭合时单独处理
if(range.collapsed){
var txt = this.document.createTextNode('d');
range.insertNode(txt);
}
doDirectionality(range,this,forward);
if(txt){
range.setStartBefore(txt).collapse(true);
domUtils.remove(txt);
}
range.select();
}
return true;
},
queryCommandValue : function() {
var node = getObj(this);
return node ? node.getAttribute('dir') : 'ltr'
},
queryCommandState : function(){
return this.highlight ? -1 :0;
}
}
})();
///import core
///import plugins\inserthtml.js
///commands 分割线
///commandsName Horizontal
///commandsTitle 分隔线
/**
* 分割线
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName horizontal插入分割线
*/
UE.commands['horizontal'] = {
execCommand : function( cmdName ) {
var me = this;
if(me.queryCommandState(cmdName)!==-1){
me.execCommand('insertHtml','<hr>');
var range = me.selection.getRange(),
start = range.startContainer;
if(start.nodeType == 1 && !start.childNodes[range.startOffset] ){
var tmp;
if(tmp = start.childNodes[range.startOffset - 1]){
if(tmp.nodeType == 1 && tmp.tagName == 'HR'){
if(me.options.enterTag == 'p'){
tmp = me.document.createElement('p');
range.insertNode(tmp);
range.setStart(tmp,0).setCursor();
}else{
tmp = me.document.createElement('br');
range.insertNode(tmp);
range.setStartBefore(tmp).setCursor();
}
}
}
}
return true;
}
},
//边界在table里不能加分隔线
queryCommandState : function() {
return this.highlight || utils.findNode(this.selection.getStartElementPath(),['table']) ? -1 : 0;
}
};
///import core
///import plugins\inserthtml.js
///commands 日期,时间
///commandsName Date,Time
///commandsTitle 日期,时间
/**
* 插入日期
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName date插入日期
* @author zhuwenxuan
*/
/**
* 插入时间
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName time插入时间
* @author zhuwenxuan
*/
UE.commands['time'] = UE.commands["date"] = {
execCommand : function(cmd){
var date = new Date;
this.execCommand('insertHtml',cmd == "time" ?
(date.getHours()+":"+ (date.getMinutes()<10 ? "0"+date.getMinutes() : date.getMinutes())+":"+(date.getSeconds()<10 ? "0"+date.getSeconds() : date.getSeconds())) :
(date.getFullYear()+"-"+((date.getMonth()+1)<10 ? "0"+(date.getMonth()+1) : date.getMonth()+1)+"-"+(date.getDate()<10?"0"+date.getDate():date.getDate())));
},
queryCommandState : function(){
return this.highlight ? -1 :0;
}
};
///import core
///import plugins\paragraph.js
///commands 段间距
///commandsName RowSpacingBottom,RowSpacingTop
///commandsTitle 段间距
/**
* @description 设置段前距,段后距
* @name baidu.editor.execCommand
* @param {String} cmdName rowspacing设置段间距
* @param {String} value 值,以px为单位
* @param {String} dir top或bottom段前后段后
* @author zhanyi
*/
UE.commands['rowspacing'] = {
execCommand : function( cmdName,value,dir ) {
this.execCommand('paragraph','p',{style:'margin-'+dir+':'+value + 'px'});
return true;
},
queryCommandValue : function(cmdName,dir) {
var pN = utils.findNode(this.selection.getStartElementPath(),null,function(node){return domUtils.isBlockElm(node) }),
value;
//trace:1026
if(pN){
value = domUtils.getComputedStyle(pN,'margin-'+dir).replace(/[^\d]/g,'');
return !value ? 0 : value;
}
return 0;
},
queryCommandState : function(){
return this.highlight ? -1 :0;
}
};
///import core
///import plugins\paragraph.js
///commands 行间距
///commandsName LineHeight
///commandsTitle 行间距
/**
* @description 设置行内间距
* @name baidu.editor.execCommand
* @param {String} cmdName lineheight设置行内间距
* @param {String} value 值
* @author zhuwenxuan
*/
UE.plugins['lineheight'] = function(){
var me = this;
me.commands['lineheight'] = {
execCommand : function( cmdName,value ) {
this.execCommand('paragraph','p',{style:'line-height:'+ (value == "1" ? "normal" : value + 'em') });
return true;
},
queryCommandValue : function() {
var pN = utils.findNode(this.selection.getStartElementPath(),null,function(node){return domUtils.isBlockElm(node)});
if(pN){
var value = domUtils.getComputedStyle(pN,'line-height');
return value == 'normal' ? 1 : value.replace(/[^\d.]*/ig,"")
}
},
queryCommandState : function(){
return this.highlight ? -1 :0;
}
};
};
///import core
///commands 清空文档
///commandsName ClearDoc
///commandsTitle 清空文档
/**
*
* 清空文档
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName cleardoc清空文档
*/
UE.commands['cleardoc'] = {
execCommand : function( cmdName) {
var me = this,
enterTag = me.options.enterTag,
range = me.selection.getRange();
if(enterTag == "br"){
me.body.innerHTML = "<br/>";
range.setStart(me.body,0).setCursor();
}else{
me.body.innerHTML = "<p>"+(ie ? "" : "<br/>")+"</p>";
range.setStart(me.body.firstChild,0).setCursor(false,true);
}
}
};
///import core
///commands 锚点
///commandsName Anchor
///commandsTitle 锚点
///commandsDialog dialogs\anchor\anchor.html
/**
* 锚点
* @function
* @name baidu.editor.execCommands
* @param {String} cmdName cmdName="anchor"插入锚点
*/
UE.commands['anchor'] = {
execCommand:function (cmd, name) {
var range = this.selection.getRange(),img = range.getClosedNode();
if (img && img.getAttribute('anchorname')) {
if (name) {
img.setAttribute('anchorname', name);
} else {
range.setStartBefore(img).setCursor();
domUtils.remove(img);
}
} else {
if (name) {
//只在选区的开始插入
var anchor = this.document.createElement('img');
range.collapse(true);
domUtils.setAttributes(anchor,{
'anchorname':name,
'class':'anchorclass'
});
range.insertNode(anchor).setStartAfter(anchor).setCursor(false,true);
}
}
},
queryCommandState:function () {
return this.highlight ? -1 : 0;
}
};
///import core
///commands 删除
///commandsName Delete
///commandsTitle 删除
/**
* 删除
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName delete删除
*/
UE.commands['delete'] = {
execCommand : function (){
var range = this.selection.getRange(),
mStart = 0,
mEnd = 0,
me = this;
if(this.selectAll ){
//trace:1633
me.body.innerHTML = '<p>'+(browser.ie ? ' ' : '<br/>')+'</p>';
range.setStart(me.body.firstChild,0).setCursor(false,true);
me.selectAll = false;
return;
}
if(me.currentSelectedArr && me.currentSelectedArr.length > 0){
for(var i=0,ci;ci=me.currentSelectedArr[i++];){
if(ci.style.display != 'none'){
ci.innerHTML = browser.ie ? domUtils.fillChar : '<br/>'
}
}
range.setStart(me.currentSelectedArr[0],0).setCursor();
return;
}
if(range.collapsed)
return;
range.txtToElmBoundary();
//&& !domUtils.isBlockElm(range.startContainer)
while(!range.startOffset && !domUtils.isBody(range.startContainer) && !dtd.$tableContent[range.startContainer.tagName] ){
mStart = 1;
range.setStartBefore(range.startContainer);
}
//&& !domUtils.isBlockElm(range.endContainer)
while(!domUtils.isBody(range.endContainer)&& !dtd.$tableContent[range.endContainer.tagName] ){
var child,endContainer = range.endContainer,endOffset = range.endOffset;
// if(endContainer.nodeType == 3 && endOffset == endContainer.nodeValue.length){
// range.setEndAfter(endContainer);
// continue;
// }
child = endContainer.childNodes[endOffset];
if(!child || domUtils.isBr(child) && endContainer.lastChild === child){
range.setEndAfter(endContainer);
continue;
}
break;
}
if(mStart){
var start = me.document.createElement('span');
start.innerHTML = 'start';
start.id = '_baidu_cut_start';
range.insertNode(start).setStartBefore(start)
}
if(mEnd){
var end = me.document.createElement('span');
end.innerHTML = 'end';
end.id = '_baidu_cut_end';
range.cloneRange().collapse(false).insertNode(end);
range.setEndAfter(end)
}
range.deleteContents();
if(domUtils.isBody(range.startContainer) && domUtils.isEmptyBlock(me.body)){
me.body.innerHTML = '<p>'+(browser.ie?'':'<br/>')+'</p>';
range.setStart(me.body.firstChild,0).collapse(true);
}else if ( !browser.ie && domUtils.isEmptyBlock(range.startContainer)){
range.startContainer.innerHTML = '<br/>'
}
range.select(true)
},
queryCommandState : function(){
if(this.currentSelectedArr && this.currentSelectedArr.length > 0){
return 0;
}
return this.highlight || this.selection.getRange().collapsed ? -1 : 0;
}
};
///import core
///commands 字数统计
///commandsName WordCount,wordCount
///commandsTitle 字数统计
/**
* Created by JetBrains WebStorm.
* User: taoqili
* Date: 11-9-7
* Time: 下午8:18
* To change this template use File | Settings | File Templates.
*/
UE.commands["wordcount"]={
queryCommandValue:function(cmd,onlyCount){
var length,contentText,reg;
if(onlyCount){
reg = new RegExp("[\r\t\n]","g");
contentText = this.getContentTxt().replace(reg,"");
return contentText.length;
}
var open = this.options.wordCount,
max= this.options.maximumWords,
msg = this.options.messages.wordCountMsg,
errMsg=this.options.messages.wordOverFlowMsg;
if(!open) return "";
reg = new RegExp("[\r\t\n]","g");
contentText = this.getContentTxt().replace(reg,"");
length = contentText.length;
if(max-length<0){
return "<span style='color:red;direction: none'>"+errMsg+"</span> "
}
msg = msg.replace("{#leave}",max-length >= 0 ? max-length:0);
msg = msg.replace("{#count}",length);
return msg;
}
};
///import core
///commands 添加分页功能
///commandsName PageBreak
///commandsTitle 分页
/**
* @description 添加分页功能
* @author zhanyi
*/
UE.plugins['pagebreak'] = function () {
var me = this,
notBreakTags = ['td'];
//重写了Editor.hasContents
// var hasContentsOrg = me.hasContents;
// me.hasContents = function (tags) {
// for (var i = 0, di, divs = me.document.getElementsByTagName('div'); di = divs[i++];) {
// if (domUtils.hasClass(di, 'pagebreak')) {
// return true;
// }
// }
// return hasContentsOrg.call(me, tags);
// };
function fillNode(node){
if(domUtils.isEmptyBlock(node)){
var firstChild = node.firstChild,tmpNode;
while(firstChild && firstChild.nodeType == 1 && domUtils.isEmptyBlock(firstChild)){
tmpNode = firstChild;
firstChild = firstChild.firstChild;
}
!tmpNode && (tmpNode = node);
domUtils.fillNode(me.document,tmpNode);
}
}
function isHr(node){
return node && node.nodeType == 1 && node.tagName == 'HR' && node.className == 'pagebreak';
}
me.commands['pagebreak'] = {
execCommand:function () {
var range = me.selection.getRange(),hr = me.document.createElement('hr');
domUtils.setAttributes(hr,{
'class' : 'pagebreak',
noshade:"noshade",
size:"5"
});
domUtils.unselectable(hr);
//table单独处理
var node = domUtils.findParentByTagName(range.startContainer, notBreakTags, true),
parents = [], pN;
if (node) {
switch (node.tagName) {
case 'TD':
pN = node.parentNode;
if (!pN.previousSibling) {
var table = domUtils.findParentByTagName(pN, 'table');
table.parentNode.insertBefore(hr, table);
parents = domUtils.findParents(hr, true);
} else {
pN.parentNode.insertBefore(hr, pN);
parents = domUtils.findParents(hr);
}
pN = parents[1];
if (hr !== pN) {
domUtils.breakParent(hr, pN);
}
domUtils.clearSelectedArr(me.currentSelectedArr);
}
} else {
if (!range.collapsed) {
range.deleteContents();
var start = range.startContainer;
while (domUtils.isBlockElm(start) && domUtils.isEmptyNode(start)) {
range.setStartBefore(start).collapse(true);
domUtils.remove(start);
start = range.startContainer;
}
}
range.insertNode(hr);
var pN = hr.parentNode, nextNode;
while (!domUtils.isBody(pN)) {
domUtils.breakParent(hr, pN);
nextNode = hr.nextSibling;
if (nextNode && domUtils.isEmptyBlock(nextNode)) {
domUtils.remove(nextNode)
}
pN = hr.parentNode;
}
nextNode = hr.nextSibling;
var pre = hr.previousSibling;
if(isHr(pre)){
domUtils.remove(pre)
}else{
fillNode(pre);
}
if(!nextNode){
var p = me.document.createElement('p');
hr.parentNode.appendChild(p);
domUtils.fillNode(me.document,p);
range.setStart(p,0).collapse(true)
}else{
if(isHr(nextNode)){
domUtils.remove(nextNode)
}else{
fillNode(nextNode);
}
range.setEndAfter(hr).collapse(false)
}
range.select(true)
}
},
queryCommandState:function () {
return this.highlight ? -1 : 0;
}
}
};
///import core
///commands 本地图片引导上传
///commandsName WordImage
///commandsTitle 本地图片引导上传
UE.plugins["wordimage"] = function(){
var me = this,
images;
me.commands['wordimage'] = {
execCommand : function() {
images = domUtils.getElementsByTagName(me.document.body,"img");
var urlList = [];
for(var i=0,ci;ci=images[i++];){
var url=ci.getAttribute("word_img");
url && urlList.push(url);
}
if(images.length){
this["word_img"] = urlList;
}
},
queryCommandState: function(){
images = domUtils.getElementsByTagName(me.document.body,"img");
for(var i=0,ci;ci =images[i++];){
if(ci.getAttribute("word_img")){
return 1;
}
}
return -1;
}
};
};
///import core
///commands 撤销和重做
///commandsName Undo,Redo
///commandsTitle 撤销,重做
/**
* @description 回退
* @author zhanyi
*/
UE.plugins['undo'] = function() {
var me = this,
maxUndoCount = me.options.maxUndoCount,
maxInputCount = me.options.maxInputCount,
fillchar = new RegExp(domUtils.fillChar + '|<\/hr>','gi'),// ie会产生多余的</hr>
//在比较时,需要过滤掉这些属性
specialAttr = /\b(?:href|src|name)="[^"]*?"/gi;
function UndoManager() {
this.list = [];
this.index = 0;
this.hasUndo = false;
this.hasRedo = false;
this.undo = function() {
if ( this.hasUndo ) {
var currentScene = this.getScene(),
lastScene = this.list[this.index];
if ( lastScene.content.replace(specialAttr,'') != currentScene.content.replace(specialAttr,'') ) {
this.save();
}
if(!this.list[this.index - 1] && this.list.length == 1){
this.reset();
return;
}
while ( this.list[this.index].content == this.list[this.index - 1].content ) {
this.index--;
if ( this.index == 0 ) {
return this.restore( 0 )
}
}
this.restore( --this.index );
}
};
this.redo = function() {
if ( this.hasRedo ) {
while ( this.list[this.index].content == this.list[this.index + 1].content ) {
this.index++;
if ( this.index == this.list.length - 1 ) {
return this.restore( this.index )
}
}
this.restore( ++this.index );
}
};
this.restore = function() {
var scene = this.list[this.index];
//trace:873
//去掉展位符
me.document.body.innerHTML = scene.bookcontent.replace(fillchar,'');
//处理undo后空格不展位的问题
if(browser.ie){
for(var i=0,pi,ps = me.document.getElementsByTagName('p');pi = ps[i++];){
if(pi.innerHTML == ''){
domUtils.fillNode(me.document,pi);
}
}
}
var range = new dom.Range( me.document );
range.moveToBookmark( {
start : '_baidu_bookmark_start_',
end : '_baidu_bookmark_end_',
id : true
//去掉true 是为了<b>|</b>,回退后还能在b里
//todo safari里输入中文时,会因为改变了dom而导致丢字
} );
//trace:1278 ie9block元素为空,将出现光标定位的问题,必须填充内容
if(browser.ie && browser.version == 9 && range.collapsed && domUtils.isBlockElm(range.startContainer) && domUtils.isEmptyNode(range.startContainer)){
domUtils.fillNode(range.document,range.startContainer);
}
range.select(!browser.gecko);
setTimeout(function(){
range.scrollToView(me.autoHeightEnabled,me.autoHeightEnabled ? domUtils.getXY(me.iframe).y:0);
},200);
this.update();
//table的单独处理
if(me.currentSelectedArr){
me.currentSelectedArr = [];
var tds = me.document.getElementsByTagName('td');
for(var i=0,td;td=tds[i++];){
if(td.className == me.options.selectedTdClass){
me.currentSelectedArr.push(td);
}
}
}
this.clearKey();
//不能把自己reset了
me.fireEvent('reset',true);
me.fireEvent('contentchange')
};
this.getScene = function() {
var range = me.selection.getRange(),
cont = me.body.innerHTML.replace(fillchar,'');
//有可能边界落到了<table>|<tbody>这样的位置,所以缩一下位置
range.shrinkBoundary();
browser.ie && (cont = cont.replace(/> </g,'><').replace(/\s*</g,'').replace(/>\s*/g,'>'));
var bookmark = range.createBookmark( true, true ),
bookCont = me.body.innerHTML.replace(fillchar,'');
range.moveToBookmark( bookmark ).select( true );
return {
bookcontent : bookCont,
content : cont
}
};
this.save = function() {
var currentScene = this.getScene(),
lastScene = this.list[this.index];
//内容相同位置相同不存
if ( lastScene && lastScene.content == currentScene.content &&
lastScene.bookcontent == currentScene.bookcontent
) {
return;
}
this.list = this.list.slice( 0, this.index + 1 );
this.list.push( currentScene );
//如果大于最大数量了,就把最前的剔除
if ( this.list.length > maxUndoCount ) {
this.list.shift();
}
this.index = this.list.length - 1;
this.clearKey();
//跟新undo/redo状态
this.update();
me.fireEvent('contentchange')
};
this.update = function() {
this.hasRedo = this.list[this.index + 1] ? true : false;
this.hasUndo = this.list[this.index - 1] || this.list.length == 1 ? true : false;
};
this.reset = function() {
this.list = [];
this.index = 0;
this.hasUndo = false;
this.hasRedo = false;
this.clearKey();
};
this.clearKey = function(){
keycont = 0;
lastKeyCode = null;
}
}
me.undoManger = new UndoManager();
function saveScene() {
this.undoManger.save()
}
me.addListener( 'beforeexeccommand', saveScene );
me.addListener( 'afterexeccommand', saveScene );
me.addListener('reset',function(type,exclude){
if(!exclude)
me.undoManger.reset();
});
me.commands['redo'] = me.commands['undo'] = {
execCommand : function( cmdName ) {
me.undoManger[cmdName]();
},
queryCommandState : function( cmdName ) {
return me.undoManger['has' + (cmdName.toLowerCase() == 'undo' ? 'Undo' : 'Redo')] ? 0 : -1;
},
notNeedUndo : 1
};
var keys = {
// /*Backspace*/ 8:1, /*Delete*/ 46:1,
/*Shift*/ 16:1, /*Ctrl*/ 17:1, /*Alt*/ 18:1,
37:1, 38:1, 39:1, 40:1,
13:1 /*enter*/
},
keycont = 0,
lastKeyCode;
me.addListener( 'keydown', function( type, evt ) {
var keyCode = evt.keyCode || evt.which;
if ( !keys[keyCode] && !evt.ctrlKey && !evt.metaKey && !evt.shiftKey && !evt.altKey ) {
if ( me.undoManger.list.length == 0 || ((keyCode == 8 ||keyCode == 46) && lastKeyCode != keyCode) ) {
me.undoManger.save();
lastKeyCode = keyCode;
return
}
//trace:856
//修正第一次输入后,回退,再输入要到keycont>maxInputCount才能在回退的问题
if(me.undoManger.list.length == 2 && me.undoManger.index == 0 && keycont == 0){
me.undoManger.list.splice(1,1);
me.undoManger.update();
}
lastKeyCode = keyCode;
keycont++;
if ( keycont > maxInputCount ) {
setTimeout( function() {
me.undoManger.save();
}, 0 );
}
}
} )
};
///import core
///import plugins/inserthtml.js
///import plugins/undo.js
///import plugins/serialize.js
///commands 粘贴
///commandsName PastePlain
///commandsTitle 纯文本粘贴模式
/*
** @description 粘贴
* @author zhanyi
*/
(function() {
function getClipboardData( callback ) {
var doc = this.document;
if ( doc.getElementById( 'baidu_pastebin' ) ) {
return;
}
var range = this.selection.getRange(),
bk = range.createBookmark(),
//创建剪贴的容器div
pastebin = doc.createElement( 'div' );
pastebin.id = 'baidu_pastebin';
// Safari 要求div必须有内容,才能粘贴内容进来
browser.webkit && pastebin.appendChild( doc.createTextNode( domUtils.fillChar + domUtils.fillChar ) );
doc.body.appendChild( pastebin );
//trace:717 隐藏的span不能得到top
//bk.start.innerHTML = ' ';
bk.start.style.display = '';
pastebin.style.cssText = "position:absolute;width:1px;height:1px;overflow:hidden;left:-1000px;white-space:nowrap;top:" +
//要在现在光标平行的位置加入,否则会出现跳动的问题
domUtils.getXY( bk.start ).y + 'px';
range.selectNodeContents( pastebin ).select( true );
setTimeout( function() {
if (browser.webkit) {
for(var i=0,pastebins = doc.querySelectorAll('#baidu_pastebin'),pi;pi=pastebins[i++];){
if(domUtils.isEmptyNode(pi)){
domUtils.remove(pi)
}else{
pastebin = pi;
break;
}
}
}
try{
pastebin.parentNode.removeChild(pastebin);
}catch(e){}
range.moveToBookmark( bk ).select(true);
callback( pastebin );
}, 0 );
}
UE.plugins['paste'] = function() {
var me = this;
var word_img_flag = {flag:""};
var pasteplain = me.options.pasteplain;
var modify_num = {flag:""};
me.commands['pasteplain'] = {
queryCommandState: function (){
return pasteplain;
},
execCommand: function (){
pasteplain = !pasteplain|0;
},
notNeedUndo : 1
};
function filter(div){
var html;
if ( div.firstChild ) {
//去掉cut中添加的边界值
var nodes = domUtils.getElementsByTagName(div,'span');
for(var i=0,ni;ni=nodes[i++];){
if(ni.id == '_baidu_cut_start' || ni.id == '_baidu_cut_end'){
domUtils.remove(ni)
}
}
if(browser.webkit){
var brs = div.querySelectorAll('div br');
for(var i=0,bi;bi=brs[i++];){
var pN = bi.parentNode;
if(pN.tagName == 'DIV' && pN.childNodes.length ==1){
pN.innerHTML = '<p><br/></p>';
domUtils.remove(pN)
}
}
var divs = div.querySelectorAll('#baidu_pastebin');
for(var i=0,di;di=divs[i++];){
var tmpP = me.document.createElement('p');
di.parentNode.insertBefore(tmpP,di);
while(di.firstChild){
tmpP.appendChild(di.firstChild)
}
domUtils.remove(di)
}
var metas = div.querySelectorAll('meta');
for(var i=0,ci;ci=metas[i++];){
domUtils.remove(ci);
}
var brs = div.querySelectorAll('br');
for(i=0;ci=brs[i++];){
if(/^apple-/.test(ci)){
domUtils.remove(ci)
}
}
}
if(browser.gecko){
var dirtyNodes = div.querySelectorAll('[_moz_dirty]')
for(i=0;ci=dirtyNodes[i++];){
ci.removeAttribute( '_moz_dirty' )
}
}
if(!browser.ie ){
var spans = div.querySelectorAll('span.apple-style-span');
for(var i=0,ci;ci=spans[i++];){
domUtils.remove(ci,true);
}
}
html = div.innerHTML;
var f = me.serialize;
if(f){
//如果过滤出现问题,捕获它,直接插入内容,避免出现错误导致粘贴整个失败
try{
var node = f.transformInput(
f.parseHTML(
//todo: 暂时不走dtd的过滤
f.word(html)//, true
),word_img_flag
);
//trace:924
//纯文本模式也要保留段落
node = f.filter(node,pasteplain ? {
whiteList: {
'p': {'br':1,'BR':1},
'br':{'$':{}},
'div':{'br':1,'BR':1,'$':{}},
'li':{'$':{}},
'tr':{'td':1,'$':{}},
'td':{'$':{}}
},
blackList: {
'style':1,
'script':1,
'object':1
}
} : null, !pasteplain ? modify_num : null);
if(browser.webkit){
var length = node.children.length,
child;
while((child = node.children[length-1]) && child.tag == 'br'){
node.children.splice(length-1,1);
length = node.children.length;
}
}
html = f.toHTML(node,pasteplain)
}catch(e){}
}
//自定义的处理
html = {'html':html};
me.fireEvent('beforepaste',html);
me.execCommand( 'insertHtml',html.html);
me.fireEvent("afterpaste");
}
}
me.addListener('ready',function(){
domUtils.on(me.body,'cut',function(){
var range = me.selection.getRange();
if(!range.collapsed && me.undoManger){
me.undoManger.save()
}
});
//ie下beforepaste在点击右键时也会触发,所以用监控键盘才处理
domUtils.on(me.body, browser.ie ? 'keydown' : 'paste',function(e){
if(browser.ie && (!e.ctrlKey || e.keyCode != '86'))
return;
getClipboardData.call( me, function( div ) {
filter(div);
function hideMsg(){
me.ui.hideToolbarMsg();
me.removeListener("selectionchange",hideMsg);
}
if ( modify_num.flag && me.ui){
me.ui.showToolbarMsg( me.options.messages.pasteMsg, word_img_flag.flag );
modify_num.flag = "";
//trance:为了解决fireevent (selectionchange)事件的延时
setTimeout(function(){
me.addListener("selectionchange",hideMsg);
},100);
}
if ( word_img_flag.flag && !me.queryCommandState("pasteplain") && me.ui){
me.ui.showToolbarMsg( me.options.messages.pasteWordImgMsg,true);
word_img_flag.flag = '';
//trance:为了解决fireevent (selectionchange)事件的延时
setTimeout(function(){
me.addListener("selectionchange",hideMsg);
},100);
}
} );
})
});
}
})();
///import core
///commands 有序列表,无序列表
///commandsName InsertOrderedList,InsertUnorderedList
///commandsTitle 有序列表,无序列表
/**
* 有序列表
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName insertorderlist插入有序列表
* @param {String} style 值为:decimal,lower-alpha,lower-roman,upper-alpha,upper-roman
* @author zhanyi
*/
/**
* 无序链接
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName insertunorderlist插入无序列表
* * @param {String} style 值为:circle,disc,square
* @author zhanyi
*/
UE.plugins['list'] = function(){
var me = this,
notExchange = {
'TD':1,
'PRE':1,
'BLOCKQUOTE':1
};
function adjustList(list,tag,style){
var nextList = list.nextSibling;
if(nextList && nextList.nodeType == 1 && nextList.tagName.toLowerCase() == tag && (domUtils.getStyle(nextList,'list-style-type')||(tag == 'ol'?'decimal' : 'disc')) == style){
domUtils.moveChild(nextList,list);
if(nextList.childNodes.length == 0){
domUtils.remove(nextList);
}
}
var preList = list.previousSibling;
if(preList && preList.nodeType == 1 && preList.tagName.toLowerCase() == tag && (domUtils.getStyle(preList,'list-style-type')||(tag == 'ol'?'decimal' : 'disc')) == style){
domUtils.moveChild(list,preList)
}
if(list.childNodes.length == 0){
domUtils.remove(list);
}
}
me.addListener('keydown', function(type, evt) {
function preventAndSave(){
evt.preventDefault ? evt.preventDefault() : (evt.returnValue = false)
me.undoManger && me.undoManger.save()
}
var keyCode = evt.keyCode || evt.which;
if (keyCode == 13) {//回车
var range = me.selection.getRange(),
start = domUtils.findParentByTagName(range.startContainer, ['ol','ul'], true,function(node){return node.tagName == 'TABLE'}),
end = domUtils.findParentByTagName(range.endContainer, ['ol','ul'], true,function(node){return node.tagName == 'TABLE'});
if (start && end && start === end) {
if(!range.collapsed){
start = domUtils.findParentByTagName(range.startContainer, 'li', true);
end = domUtils.findParentByTagName(range.endContainer, 'li', true);
if(start && end && start === end){
range.deleteContents();
li = domUtils.findParentByTagName(range.startContainer, 'li', true);
if(li && domUtils.isEmptyBlock(li)){
pre = li.previousSibling;
next = li.nextSibling;
p = me.document.createElement('p');
domUtils.fillNode(me.document,p);
parentList = li.parentNode;
if(pre && next){
range.setStart(next,0).collapse(true).select(true);
domUtils.remove(li);
}else{
if(!pre && !next || !pre){
parentList.parentNode.insertBefore(p,parentList);
} else{
li.parentNode.parentNode.insertBefore(p,parentList.nextSibling);
}
domUtils.remove(li);
if(!parentList.firstChild){
domUtils.remove(parentList)
}
range.setStart(p,0).setCursor();
}
preventAndSave();
return;
}
}else{
var tmpRange = range.cloneRange(),
bk = tmpRange.collapse(false).createBookmark();
range.deleteContents();
tmpRange.moveToBookmark(bk);
var li = domUtils.findParentByTagName(tmpRange.startContainer, 'li', true),
pre = li.previousSibling,
next = li.nextSibling;
if (pre ) {
li = pre;
if(pre.firstChild && domUtils.isBlockElm(pre.firstChild)){
pre = pre.firstChild;
}
if(domUtils.isEmptyNode(pre))
domUtils.remove(li);
}
if (next ) {
li = next;
if(next.firstChild && domUtils.isBlockElm(next.firstChild)){
next = next.firstChild;
}
if(domUtils.isEmptyNode(next))
domUtils.remove(li);
}
tmpRange.select();
preventAndSave();
return;
}
}
li = domUtils.findParentByTagName(range.startContainer, 'li', true);
if (li) {
if(domUtils.isEmptyBlock(li)){
bk = range.createBookmark();
var parentList = li.parentNode;
if(li!==parentList.lastChild){
domUtils.breakParent(li,parentList);
}else{
parentList.parentNode.insertBefore(li,parentList.nextSibling);
if(domUtils.isEmptyNode(parentList)){
domUtils.remove(parentList);
}
}
//嵌套不处理
if(!dtd.$list[li.parentNode.tagName]){
if(!domUtils.isBlockElm(li.firstChild)){
p = me.document.createElement('p');
li.parentNode.insertBefore(p,li);
while(li.firstChild){
p.appendChild(li.firstChild);
}
domUtils.remove(li);
}else{
domUtils.remove(li,true);
}
}
range.moveToBookmark(bk).select();
}else{
var first = li.firstChild;
if(!first || !domUtils.isBlockElm(first)){
var p = me.document.createElement('p');
!li.firstChild && domUtils.fillNode(me.document,p);
while(li.firstChild){
p.appendChild(li.firstChild);
}
li.appendChild(p);
first = p;
}
var span = me.document.createElement('span');
range.insertNode(span);
domUtils.breakParent(span, li);
var nextLi = span.nextSibling;
first = nextLi.firstChild;
if (!first) {
p = me.document.createElement('p');
domUtils.fillNode(me.document,p);
nextLi.appendChild(p);
first = p;
}
if (domUtils.isEmptyNode(first)) {
first.innerHTML = '';
domUtils.fillNode(me.document,first);
}
range.setStart(first, 0).collapse(true).shrinkBoundary().select();
domUtils.remove(span);
pre = nextLi.previousSibling;
if(pre && domUtils.isEmptyBlock(pre)){
pre.innerHTML = '<p></p>';
domUtils.fillNode(me.document,pre.firstChild);
}
}
// }
preventAndSave();
}
}
}
if(keyCode == 8){
//修中ie中li下的问题
range = me.selection.getRange();
if (range.collapsed && domUtils.isStartInblock(range)) {
tmpRange = range.cloneRange().trimBoundary();
li = domUtils.findParentByTagName(range.startContainer, 'li', true);
//要在li的最左边,才能处理
if (li && domUtils.isStartInblock(tmpRange)) {
if (li && (pre = li.previousSibling)) {
if (keyCode == 46 && li.childNodes.length)
return;
//有可能上边的兄弟节点是个2级菜单,要追加到2级菜单的最后的li
if(dtd.$list[pre.tagName]){
pre = pre.lastChild;
}
me.undoManger && me.undoManger.save();
first = li.firstChild;
if (domUtils.isBlockElm(first)) {
if (domUtils.isEmptyNode(first)) {
// range.setEnd(pre, pre.childNodes.length).shrinkBoundary().collapse().select(true);
pre.appendChild(first);
range.setStart(first,0).setCursor(false,true);
//first不是唯一的节点
while(li.firstChild){
pre.appendChild(li.firstChild)
}
} else {
start = domUtils.findParentByTagName(range.startContainer, 'p', true);
if(start && start !== first){
return;
}
span = me.document.createElement('span');
range.insertNode(span);
// if (domUtils.isBlockElm(pre.firstChild)) {
//
// pre.firstChild.appendChild(span);
// while (first.firstChild) {
// pre.firstChild.appendChild(first.firstChild);
// }
//
// } else {
// while (first.firstChild) {
// pre.appendChild(first.firstChild);
// }
// }
domUtils.moveChild(li,pre);
range.setStartBefore(span).collapse(true).select(true);
domUtils.remove(span)
}
} else {
if (domUtils.isEmptyNode(li)) {
var p = me.document.createElement('p');
pre.appendChild(p);
range.setStart(p,0).setCursor();
// range.setEnd(pre, pre.childNodes.length).shrinkBoundary().collapse().select(true);
} else {
range.setEnd(pre, pre.childNodes.length).collapse().select(true);
while (li.firstChild) {
pre.appendChild(li.firstChild)
}
}
}
domUtils.remove(li);
me.undoManger && me.undoManger.save();
domUtils.preventDefault(evt);
return;
}
//trace:980
if (li && !li.previousSibling) {
first = li.firstChild;
//trace:1648 要判断li下只有一个节点
if (!first || li.lastChild === first && domUtils.isEmptyNode(domUtils.isBlockElm(first) ? first : li)) {
var p = me.document.createElement('p');
li.parentNode.parentNode.insertBefore(p, li.parentNode);
domUtils.fillNode(me.document,p);
range.setStart(p, 0).setCursor();
domUtils.remove(!li.nextSibling ? li.parentNode : li);
me.undoManger && me.undoManger.save();
domUtils.preventDefault(evt);
return;
}
}
}
}
}
});
me.commands['insertorderedlist'] =
me.commands['insertunorderedlist'] = {
execCommand : function( command, style ) {
if(!style){
style = command.toLowerCase() == 'insertorderedlist' ? 'decimal' : 'disc'
}
var me = this,
range = this.selection.getRange(),
filterFn = function( node ) {
return node.nodeType == 1 ? node.tagName.toLowerCase() != 'br' : !domUtils.isWhitespace( node )
},
tag = command.toLowerCase() == 'insertorderedlist' ? 'ol' : 'ul',
frag = me.document.createDocumentFragment();
//去掉是因为会出现选到末尾,导致adjustmentBoundary缩到ol/ul的位置
//range.shrinkBoundary();//.adjustmentBoundary();
range.adjustmentBoundary().shrinkBoundary();
var bko = range.createBookmark(true),
start = domUtils.findParentByTagName(me.document.getElementById(bko.start),'li'),
modifyStart = 0,
end = domUtils.findParentByTagName(me.document.getElementById(bko.end),'li'),
modifyEnd = 0,
startParent,endParent,
list,tmp;
if(start || end){
start && (startParent = start.parentNode);
if(!bko.end){
end = start;
}
end && (endParent = end.parentNode);
if(startParent === endParent){
while(start !== end){
tmp = start;
start = start.nextSibling;
if(!domUtils.isBlockElm(tmp.firstChild)){
var p = me.document.createElement('p');
while(tmp.firstChild){
p.appendChild(tmp.firstChild)
}
tmp.appendChild(p);
}
frag.appendChild(tmp);
}
tmp = me.document.createElement('span');
startParent.insertBefore(tmp,end);
if(!domUtils.isBlockElm(end.firstChild)){
p = me.document.createElement('p');
while(end.firstChild){
p.appendChild(end.firstChild)
}
end.appendChild(p);
}
frag.appendChild(end);
domUtils.breakParent(tmp,startParent);
if(domUtils.isEmptyNode(tmp.previousSibling)){
domUtils.remove(tmp.previousSibling)
}
if(domUtils.isEmptyNode(tmp.nextSibling)){
domUtils.remove(tmp.nextSibling)
}
var nodeStyle = domUtils.getComputedStyle( startParent, 'list-style-type' ) || (command.toLowerCase() == 'insertorderedlist' ? 'decimal' : 'disc');
if(startParent.tagName.toLowerCase() == tag && nodeStyle == style){
for(var i=0,ci,tmpFrag = me.document.createDocumentFragment();ci=frag.childNodes[i++];){
while(ci.firstChild){
tmpFrag.appendChild(ci.firstChild);
}
}
tmp.parentNode.insertBefore(tmpFrag,tmp);
}else{
list = me.document.createElement(tag);
domUtils.setStyle(list,'list-style-type',style);
list.appendChild(frag);
tmp.parentNode.insertBefore(list,tmp);
}
domUtils.remove(tmp);
list && adjustList(list,tag,style);
range.moveToBookmark(bko).select();
return;
}
//开始
if(start){
while(start){
tmp = start.nextSibling;
var tmpfrag = me.document.createDocumentFragment(),
hasBlock = 0;
while(start.firstChild){
if(domUtils.isBlockElm(start.firstChild))
hasBlock = 1;
tmpfrag.appendChild(start.firstChild);
}
if(!hasBlock){
var tmpP = me.document.createElement('p');
tmpP.appendChild(tmpfrag);
frag.appendChild(tmpP)
}else{
frag.appendChild(tmpfrag);
}
domUtils.remove(start);
start = tmp;
}
startParent.parentNode.insertBefore(frag,startParent.nextSibling);
if(domUtils.isEmptyNode(startParent)){
range.setStartBefore(startParent);
domUtils.remove(startParent)
}else{
range.setStartAfter(startParent);
}
modifyStart = 1;
}
if(end){
//结束
start = endParent.firstChild;
while(start !== end){
tmp = start.nextSibling;
tmpfrag = me.document.createDocumentFragment();
hasBlock = 0;
while(start.firstChild){
if(domUtils.isBlockElm(start.firstChild))
hasBlock = 1;
tmpfrag.appendChild(start.firstChild);
}
if(!hasBlock){
tmpP = me.document.createElement('p');
tmpP.appendChild(tmpfrag);
frag.appendChild(tmpP)
}else{
frag.appendChild(tmpfrag);
}
domUtils.remove(start);
start = tmp;
}
frag.appendChild(end.firstChild);
domUtils.remove(end);
endParent.parentNode.insertBefore(frag,endParent);
range.setEndBefore(endParent);
if(domUtils.isEmptyNode(endParent)){
domUtils.remove(endParent)
}
modifyEnd = 1;
}
}
if(!modifyStart){
range.setStartBefore(me.document.getElementById(bko.start))
}
if(bko.end && !modifyEnd){
range.setEndAfter(me.document.getElementById(bko.end))
}
range.enlarge(true,function(node){return notExchange[node.tagName] });
frag = me.document.createDocumentFragment();
var bk = range.createBookmark(),
current = domUtils.getNextDomNode( bk.start, false, filterFn ),
tmpRange = range.cloneRange(),
tmpNode,
block = domUtils.isBlockElm;
while ( current && current !== bk.end && (domUtils.getPosition( current, bk.end ) & domUtils.POSITION_PRECEDING) ) {
if ( current.nodeType == 3 || dtd.li[current.tagName] ) {
if(current.nodeType == 1 && dtd.$list[current.tagName]){
while(current.firstChild){
frag.appendChild(current.firstChild)
}
tmpNode = domUtils.getNextDomNode( current, false, filterFn );
domUtils.remove(current);
current = tmpNode;
continue;
}
tmpNode = current;
tmpRange.setStartBefore( current );
while ( current && current !== bk.end && (!block(current) || domUtils.isBookmarkNode(current) )) {
tmpNode = current;
current = domUtils.getNextDomNode( current, false, null, function( node ) {
return !notExchange[node.tagName]
} );
}
if(current && block(current)){
tmp = domUtils.getNextDomNode( tmpNode, false, filterFn );
if(tmp && domUtils.isBookmarkNode(tmp)){
current = domUtils.getNextDomNode( tmp, false, filterFn );
tmpNode = tmp;
}
}
tmpRange.setEndAfter( tmpNode );
current = domUtils.getNextDomNode( tmpNode, false, filterFn );
var li = range.document.createElement( 'li' );
li.appendChild(tmpRange.extractContents());
frag.appendChild(li);
} else {
current = domUtils.getNextDomNode( current, true, filterFn );
}
}
range.moveToBookmark(bk).collapse(true);
list = me.document.createElement(tag);
domUtils.setStyle(list,'list-style-type',style);
list.appendChild(frag);
range.insertNode(list);
//当前list上下看能否合并
adjustList(list,tag,style);
range.moveToBookmark(bko).select();
},
queryCommandState : function( command ) {
return this.highlight ? -1 :
utils.findNode(this.selection.getStartElementPath(),[command.toLowerCase() == 'insertorderedlist' ? 'ol' : 'ul']) ? 1: 0;
},
queryCommandValue : function( command ) {
var node = utils.findNode(this.selection.getStartElementPath(),[command.toLowerCase() == 'insertorderedlist' ? 'ol' : 'ul']);
return node ? domUtils.getComputedStyle( node, 'list-style-type' ) : null;
}
}
};
///import core
///import plugins/serialize.js
///import plugins/undo.js
///commands 查看源码
///commandsName Source
///commandsTitle 查看源码
(function (){
function SourceFormater(config){
config = config || {};
this.indentChar = config.indentChar || ' ';
this.breakChar = config.breakChar || '\n';
this.selfClosingEnd = config.selfClosingEnd || ' />';
}
var unhtml1 = function (){
var map = { '<': '<', '>': '>', '"': '"', "'": ''' };
function rep( m ){ return map[m]; }
return function ( str ) {
str = str + '';
return str ? str.replace( /[<>"']/g, rep ) : '';
};
}();
var inline = utils.extend({a:1,A:1},dtd.$inline,true);
function printAttrs(attrs){
var buff = [];
for (var k in attrs) {
buff.push(k + '="' + unhtml1(attrs[k]) + '"');
}
return buff.join(' ');
}
SourceFormater.prototype = {
format: function (html){
var node = UE.serialize.parseHTML(html);
this.buff = [];
this.indents = '';
this.indenting = 1;
this.visitNode(node);
return this.buff.join('');
},
visitNode: function (node){
if (node.type == 'fragment') {
this.visitChildren(node.children);
} else if (node.type == 'element') {
var selfClosing = dtd.$empty[node.tag];
this.visitTag(node.tag, node.attributes, selfClosing);
this.visitChildren(node.children);
if (!selfClosing) {
this.visitEndTag(node.tag);
}
} else if (node.type == 'comment') {
this.visitComment(node.data);
} else {
this.visitText(node.data,dtd.$notTransContent[node.parent.tag]);
}
},
visitChildren: function (children){
for (var i=0; i<children.length; i++) {
this.visitNode(children[i]);
}
},
visitTag: function (tag, attrs, selfClosing){
if (this.indenting) {
this.indent();
} else if (!inline[tag]) { // todo: 去掉a, 因为dtd的inline里面没有a
this.newline();
this.indent();
}
this.buff.push('<', tag);
var attrPart = printAttrs(attrs);
if (attrPart) {
this.buff.push(' ', attrPart);
}
if (selfClosing) {
this.buff.push(this.selfClosingEnd);
if (tag == 'br') {
this.newline();
}
} else {
this.buff.push('>');
this.indents += this.indentChar;
}
if (!inline[tag]) {
this.newline();
}
},
indent: function (){
this.buff.push(this.indents);
this.indenting = 0;
},
newline: function (){
this.buff.push(this.breakChar);
this.indenting = 1;
},
visitEndTag: function (tag){
this.indents = this.indents.slice(0, -this.indentChar.length);
if (this.indenting) {
this.indent();
} else if (!inline[tag]) {
this.newline();
this.indent();
}
this.buff.push('</', tag, '>');
},
visitText: function (text,notTrans){
if (this.indenting) {
this.indent();
}
// if(!notTrans){
// text = text.replace(/ /g, ' ').replace(/[ ][ ]+/g, function (m){
// return new Array(m.length + 1).join(' ');
// }).replace(/(?:^ )|(?: $)/g, ' ');
// }
text = text.replace(/ /g, ' ')
this.buff.push(text);
},
visitComment: function (text){
if (this.indenting) {
this.indent();
}
this.buff.push('<!--', text, '-->');
}
};
var sourceEditors = {
textarea: function (editor, holder){
var textarea = holder.ownerDocument.createElement('textarea');
textarea.style.cssText = 'position:absolute;resize:none;width:100%;height:100%;border:0;padding:0;margin:0;overflow-y:auto;';
// todo: IE下只有onresize属性可用... 很纠结
if (browser.ie && browser.version < 8) {
textarea.style.width = holder.offsetWidth + 'px';
textarea.style.height = holder.offsetHeight + 'px';
holder.onresize = function (){
textarea.style.width = holder.offsetWidth + 'px';
textarea.style.height = holder.offsetHeight + 'px';
};
}
holder.appendChild(textarea);
return {
setContent: function (content){
textarea.value = content;
},
getContent: function (){
return textarea.value;
},
select: function (){
var range;
if (browser.ie) {
range = textarea.createTextRange();
range.collapse(true);
range.select();
} else {
//todo: chrome下无法设置焦点
textarea.setSelectionRange(0, 0);
textarea.focus();
}
},
dispose: function (){
holder.removeChild(textarea);
// todo
holder.onresize = null;
textarea = null;
holder = null;
}
};
},
codemirror: function (editor, holder){
var options = {
mode: "text/html",
tabMode: "indent",
lineNumbers: true,
lineWrapping:true
};
var codeEditor = window.CodeMirror(holder, options);
var dom = codeEditor.getWrapperElement();
dom.style.cssText = 'position:absolute;left:0;top:0;width:100%;height:100%;font-family:consolas,"Courier new",monospace;font-size:13px;';
codeEditor.getScrollerElement().style.cssText = 'position:absolute;left:0;top:0;width:100%;height:100%;';
codeEditor.refresh();
return {
setContent: function (content){
codeEditor.setValue(content);
},
getContent: function (){
return codeEditor.getValue();
},
select: function (){
codeEditor.focus();
},
dispose: function (){
holder.removeChild(dom);
dom = null;
codeEditor = null;
}
};
}
};
UE.plugins['source'] = function (){
var me = this;
var opt = this.options;
var formatter = new SourceFormater(opt.source);
var sourceMode = false;
var sourceEditor;
function createSourceEditor(holder){
var useCodeMirror = opt.sourceEditor == 'codemirror' && window.CodeMirror;
return sourceEditors[useCodeMirror ? 'codemirror' : 'textarea'](me, holder);
}
var bakCssText;
me.commands['source'] = {
execCommand: function (){
sourceMode = !sourceMode;
if (sourceMode) {
me.undoManger && me.undoManger.save();
this.currentSelectedArr && domUtils.clearSelectedArr(this.currentSelectedArr);
if(browser.gecko)
me.body.contentEditable = false;
bakCssText = me.iframe.style.cssText;
me.iframe.style.cssText += 'position:absolute;left:-32768px;top:-32768px;';
var content = formatter.format(me.hasContents() ? me.getContent() : '');
sourceEditor = createSourceEditor(me.iframe.parentNode);
sourceEditor.setContent(content);
setTimeout(function (){
sourceEditor.select();
});
} else {
me.iframe.style.cssText = bakCssText;
var cont = sourceEditor.getContent() || '<p>' + (browser.ie ? '' : '<br/>')+'</p>';
cont = cont.replace(/>[\n\r\t]+([ ]{4})+/g,'>').replace(/[\n\r\t]+([ ]{4})+</g,'<').replace(/>[\n\r\t]+</g,'><');
me.setContent(cont);
sourceEditor.dispose();
sourceEditor = null;
setTimeout(function(){
var first = me.body.firstChild;
//trace:1106 都删除空了,下边会报错,所以补充一个p占位
if(!first){
me.body.innerHTML = '<p>'+(browser.ie?'':'<br/>')+'</p>';
first = me.body.firstChild;
}
//要在ifm为显示时ff才能取到selection,否则报错
me.undoManger && me.undoManger.save();
while(first && first.firstChild){
first = first.firstChild;
}
var range = me.selection.getRange();
if(first.nodeType == 3 || dtd.$empty[first.tagName]){
range.setStartBefore(first)
}else{
range.setStart(first,0);
}
if(browser.gecko){
var input = document.createElement('input');
input.style.cssText = 'position:absolute;left:0;top:-32768px';
document.body.appendChild(input);
me.body.contentEditable = false;
setTimeout(function(){
domUtils.setViewportOffset(input, { left: -32768, top: 0 });
input.focus();
setTimeout(function(){
me.body.contentEditable = true;
range.setCursor(false,true);
domUtils.remove(input)
})
})
}else{
range.setCursor(false,true);
}
})
}
this.fireEvent('sourcemodechanged', sourceMode);
},
queryCommandState: function (){
return sourceMode|0;
}
};
var oldQueryCommandState = me.queryCommandState;
me.queryCommandState = function (cmdName){
cmdName = cmdName.toLowerCase();
if (sourceMode) {
return cmdName == 'source' ? 1 : -1;
}
return oldQueryCommandState.apply(this, arguments);
};
//解决在源码模式下getContent不能得到最新的内容问题
var oldGetContent = me.getContent;
me.getContent = function (){
if(sourceMode && sourceEditor ){
var html = sourceEditor.getContent();
if (this.serialize) {
var node = this.serialize.parseHTML(html);
node = this.serialize.filter(node);
html = this.serialize.toHTML(node);
}
return html;
}else{
return oldGetContent.apply(this, arguments)
}
};
me.addListener("ready",function(){
if(opt.sourceEditor == "codemirror"){
utils.loadFile(document,{
src : opt.codeMirrorJsUrl,
tag : "script",
type : "text/javascript",
defer : "defer"
});
utils.loadFile(document,{
tag : "link",
rel : "stylesheet",
type : "text/css",
href : opt.codeMirrorCssUrl
});
}
});
};
})();
///import core
///commands 快捷键
///commandsName ShortCutKeys
///commandsTitle 快捷键
//配置快捷键
UE.plugins['shortcutkeys'] = function(){
var me = this,
shortcutkeys = utils.extend({
"ctrl+66" : "Bold" //^B
,"ctrl+90" : "Undo" //undo
,"ctrl+89" : "Redo" //redo
,"ctrl+73" : "Italic" //^I
,"ctrl+85" : "Underline" //^U
,"ctrl+shift+67" : "removeformat" //清除格式
,"ctrl+shift+76" : "justify:left" //居左
,"ctrl+shift+82" : "justify:right" //居右
,"ctrl+65" : "selectAll"
// ,"9" : "indent" //tab
},me.options.shortcutkeys);
me.addListener('keydown',function(type,e){
var keyCode = e.keyCode || e.which,value;
for ( var i in shortcutkeys ) {
if ( /^(ctrl)(\+shift)?\+(\d+)$/.test( i.toLowerCase() ) || /^(\d+)$/.test( i ) ) {
if ( ( (RegExp.$1 == 'ctrl' ? (e.ctrlKey||e.metaKey) : 0)
&& (RegExp.$2 != "" ? e[RegExp.$2.slice(1) + "Key"] : 1)
&& keyCode == RegExp.$3
) ||
keyCode == RegExp.$1
){
value = shortcutkeys[i].split(':');
me.execCommand( value[0],value[1]);
domUtils.preventDefault(e)
}
}
}
});
};
///import core
///import plugins/undo.js
///commands 设置回车标签p或br
///commandsName EnterKey
///commandsTitle 设置回车标签p或br
/**
* @description 处理回车
* @author zhanyi
*/
UE.plugins['enterkey'] = function() {
var hTag,
me = this,
tag = me.options.enterTag;
me.addListener('keyup', function(type, evt) {
var keyCode = evt.keyCode || evt.which;
if (keyCode == 13) {
var range = me.selection.getRange(),
start = range.startContainer,
doSave;
//修正在h1-h6里边回车后不能嵌套p的问题
if (!browser.ie) {
if (/h\d/i.test(hTag)) {
if (browser.gecko) {
var h = domUtils.findParentByTagName(start, [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6','blockquote'], true);
if (!h) {
me.document.execCommand('formatBlock', false, '<p>');
doSave = 1;
}
} else {
//chrome remove div
if (start.nodeType == 1) {
var tmp = me.document.createTextNode(''),div;
range.insertNode(tmp);
div = domUtils.findParentByTagName(tmp, 'div', true);
if (div) {
var p = me.document.createElement('p');
while (div.firstChild) {
p.appendChild(div.firstChild);
}
div.parentNode.insertBefore(p, div);
domUtils.remove(div);
range.setStartBefore(tmp).setCursor();
doSave = 1;
}
domUtils.remove(tmp);
}
}
if (me.undoManger && doSave) {
me.undoManger.save()
}
}
}
setTimeout(function() {
me.selection.getRange().scrollToView(me.autoHeightEnabled, me.autoHeightEnabled ? domUtils.getXY(me.iframe).y : 0);
}, 50)
}
});
me.addListener('keydown', function(type, evt) {
var keyCode = evt.keyCode || evt.which;
if (keyCode == 13) {//回车
if (me.undoManger) {
me.undoManger.save()
}
hTag = '';
var range = me.selection.getRange();
if (!range.collapsed) {
//跨td不能删
var start = range.startContainer,
end = range.endContainer,
startTd = domUtils.findParentByTagName(start, 'td', true),
endTd = domUtils.findParentByTagName(end, 'td', true);
if (startTd && endTd && startTd !== endTd || !startTd && endTd || startTd && !endTd) {
evt.preventDefault ? evt.preventDefault() : ( evt.returnValue = false);
return;
}
}
me.currentSelectedArr && domUtils.clearSelectedArr(me.currentSelectedArr);
if (tag == 'p') {
if (!browser.ie) {
start = domUtils.findParentByTagName(range.startContainer, ['ol','ul','p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6','blockquote'], true);
if (!start) {
me.document.execCommand('formatBlock', false, '<p>');
if (browser.gecko) {
range = me.selection.getRange();
start = domUtils.findParentByTagName(range.startContainer, 'p', true);
start && domUtils.removeDirtyAttr(start);
}
} else {
hTag = start.tagName;
start.tagName.toLowerCase() == 'p' && browser.gecko && domUtils.removeDirtyAttr(start);
}
}
} else {
evt.preventDefault ? evt.preventDefault() : ( evt.returnValue = false);
if (!range.collapsed) {
range.deleteContents();
start = range.startContainer;
if (start.nodeType == 1 && (start = start.childNodes[range.startOffset])) {
while (start.nodeType == 1) {
if (dtd.$empty[start.tagName]) {
range.setStartBefore(start).setCursor();
if (me.undoManger) {
me.undoManger.save()
}
return false;
}
if (!start.firstChild) {
var br = range.document.createElement('br');
start.appendChild(br);
range.setStart(start, 0).setCursor();
if (me.undoManger) {
me.undoManger.save()
}
return false;
}
start = start.firstChild
}
if (start === range.startContainer.childNodes[range.startOffset]) {
br = range.document.createElement('br');
range.insertNode(br).setCursor();
} else {
range.setStart(start, 0).setCursor();
}
} else {
br = range.document.createElement('br');
range.insertNode(br).setStartAfter(br).setCursor();
}
} else {
br = range.document.createElement('br');
range.insertNode(br);
var parent = br.parentNode;
if (parent.lastChild === br) {
br.parentNode.insertBefore(br.cloneNode(true), br);
range.setStartBefore(br)
} else {
range.setStartAfter(br)
}
range.setCursor();
}
}
}
});
};
/*
* 处理特殊键的兼容性问题
*/
UE.plugins['keystrokes'] = function() {
var me = this,
flag = 0,
keys = domUtils.keys,
trans = {
'B' : 'strong',
'I' : 'em',
'FONT' : 'span'
},
sizeMap = [0, 10, 12, 16, 18, 24, 32, 48],
listStyle = {
'OL':['decimal','lower-alpha','lower-roman','upper-alpha','upper-roman'],
'UL':[ 'circle','disc','square']
};
me.addListener('keydown', function(type, evt) {
var keyCode = evt.keyCode || evt.which;
if(this.selectAll){
this.selectAll = false;
if((keyCode == 8 || keyCode == 46)){
me.undoManger && me.undoManger.save();
//trace:1633
me.body.innerHTML = '<p>'+(browser.ie ? '' : '<br/>')+'</p>';
new dom.Range(me.document).setStart(me.body.firstChild,0).setCursor(false,true);
me.undoManger && me.undoManger.save();
//todo 对性能会有影响
browser.ie && me._selectionChange();
domUtils.preventDefault(evt);
return;
}
}
//处理backspace/del
if (keyCode == 8 ) {//|| keyCode == 46
var range = me.selection.getRange(),
tmpRange,
start,end;
//当删除到body最开始的位置时,会删除到body,阻止这个动作
if(range.collapsed){
start = range.startContainer;
//有可能是展位符号
if(domUtils.isWhitespace(start)){
start = start.parentNode;
}
if(domUtils.isEmptyNode(start) && start === me.body.firstChild){
if(start.tagName != 'P'){
p = me.document.createElement('p');
me.body.insertBefore(p,start);
domUtils.fillNode(me.document,p);
range.setStart(p,0).setCursor(false,true);
//trace:1645
domUtils.remove(start);
}
domUtils.preventDefault(evt);
return;
}
}
if (range.collapsed && range.startContainer.nodeType == 3 && range.startContainer.nodeValue.replace(new RegExp(domUtils.fillChar, 'g'), '').length == 0) {
range.setStartBefore(range.startContainer).collapse(true)
}
//解决选中control元素不能删除的问题
if (start = range.getClosedNode()) {
me.undoManger && me.undoManger.save();
range.setStartBefore(start);
domUtils.remove(start);
range.setCursor();
me.undoManger && me.undoManger.save();
domUtils.preventDefault(evt);
return;
}
//阻止在table上的删除
if (!browser.ie) {
start = domUtils.findParentByTagName(range.startContainer, 'table', true);
end = domUtils.findParentByTagName(range.endContainer, 'table', true);
if (start && !end || !start && end || start !== end) {
evt.preventDefault();
return;
}
if (browser.webkit && range.collapsed && start) {
tmpRange = range.cloneRange().txtToElmBoundary();
start = tmpRange.startContainer;
if (domUtils.isBlockElm(start) && start.nodeType == 1 && !dtd.$tableContent[start.tagName] && !domUtils.getChildCount(start, function(node) {
return node.nodeType == 1 ? node.tagName !== 'BR' : 1;
})) {
tmpRange.setStartBefore(start).setCursor();
domUtils.remove(start, true);
evt.preventDefault();
return;
}
}
}
if (me.undoManger) {
if (!range.collapsed) {
me.undoManger.save();
flag = 1;
}
}
}
//处理tab键的逻辑
if (keyCode == 9) {
range = me.selection.getRange();
me.undoManger && me.undoManger.save();
for (var i = 0,txt = ''; i < me.options.tabSize; i++) {
txt += me.options.tabNode;
}
var span = me.document.createElement('span');
span.innerHTML = txt;
if (range.collapsed) {
var li = domUtils.findParentByTagName(range.startContainer, 'li', true);
if (li && domUtils.isStartInblock(range)) {
bk = range.createBookmark();
var parentLi = li.parentNode,
list = me.document.createElement(parentLi.tagName);
var index = utils.indexOf(listStyle[list.tagName], domUtils.getComputedStyle(parentLi, 'list-style-type'));
index = index + 1 == listStyle[list.tagName].length ? 0 : index + 1;
domUtils.setStyle(list, 'list-style-type', listStyle[list.tagName][index]);
parentLi.insertBefore(list, li);
list.appendChild(li);
range.moveToBookmark(bk).select()
} else
range.insertNode(span.cloneNode(true).firstChild).setCursor(true);
} else {
//处理table
start = domUtils.findParentByTagName(range.startContainer, 'table', true);
end = domUtils.findParentByTagName(range.endContainer, 'table', true);
if (start || end) {
evt.preventDefault ? evt.preventDefault() : (evt.returnValue = false);
return
}
//处理列表 再一个list里处理
start = domUtils.findParentByTagName(range.startContainer, ['ol','ul'], true);
end = domUtils.findParentByTagName(range.endContainer, ['ol','ul'], true);
if (start && end && start === end) {
var bk = range.createBookmark();
start = domUtils.findParentByTagName(range.startContainer, 'li', true);
end = domUtils.findParentByTagName(range.endContainer, 'li', true);
//在开始单独处理
if (start === start.parentNode.firstChild) {
var parentList = me.document.createElement(start.parentNode.tagName);
start.parentNode.parentNode.insertBefore(parentList, start.parentNode);
parentList.appendChild(start.parentNode);
} else {
parentLi = start.parentNode,
list = me.document.createElement(parentLi.tagName);
index = utils.indexOf(listStyle[list.tagName], domUtils.getComputedStyle(parentLi, 'list-style-type'));
index = index + 1 == listStyle[list.tagName].length ? 0 : index + 1;
domUtils.setStyle(list, 'list-style-type', listStyle[list.tagName][index]);
start.parentNode.insertBefore(list, start);
var nextLi;
while (start !== end) {
nextLi = start.nextSibling;
list.appendChild(start);
start = nextLi;
}
list.appendChild(end);
}
range.moveToBookmark(bk).select();
} else {
if (start || end) {
evt.preventDefault ? evt.preventDefault() : (evt.returnValue = false);
return
}
//普通的情况
start = domUtils.findParent(range.startContainer, filterFn);
end = domUtils.findParent(range.endContainer, filterFn);
if (start && end && start === end) {
range.deleteContents();
range.insertNode(span.cloneNode(true).firstChild).setCursor(true);
} else {
var bookmark = range.createBookmark(),
filterFn = function(node) {
return domUtils.isBlockElm(node);
};
range.enlarge(true);
var bookmark2 = range.createBookmark(),
current = domUtils.getNextDomNode(bookmark2.start, false, filterFn);
while (current && !(domUtils.getPosition(current, bookmark2.end) & domUtils.POSITION_FOLLOWING)) {
current.insertBefore(span.cloneNode(true).firstChild, current.firstChild);
current = domUtils.getNextDomNode(current, false, filterFn);
}
range.moveToBookmark(bookmark2).moveToBookmark(bookmark).select();
}
}
}
me.undoManger && me.undoManger.save();
evt.preventDefault ? evt.preventDefault() : (evt.returnValue = false);
}
//trace:1634
//ff的del键在容器空的时候,也会删除
if(browser.gecko && keyCode == 46){
range = me.selection.getRange();
if(range.collapsed){
start = range.startContainer;
if(domUtils.isEmptyBlock(start)){
var parent = start.parentNode;
while(domUtils.getChildCount(parent) == 1 && !domUtils.isBody(parent)){
start = parent;
parent = parent.parentNode;
}
if(start === parent.lastChild)
evt.preventDefault();
return;
}
}
}
});
me.addListener('keyup', function(type, evt) {
var keyCode = evt.keyCode || evt.which;
//修复ie/chrome <strong><em>x|</em></strong> 当点退格后在输入文字后会出现 <b><i>x</i></b>
if (!browser.gecko && !keys[keyCode] && !evt.ctrlKey && !evt.metaKey && !evt.shiftKey && !evt.altKey) {
range = me.selection.getRange();
if (range.collapsed) {
var start = range.startContainer,
isFixed = 0;
while (!domUtils.isBlockElm(start)) {
if (start.nodeType == 1 && utils.indexOf(['FONT','B','I'], start.tagName) != -1) {
var tmpNode = me.document.createElement(trans[start.tagName]);
if (start.tagName == 'FONT') {
//chrome only remember color property
tmpNode.style.cssText = (start.getAttribute('size') ? 'font-size:' + (sizeMap[start.getAttribute('size')] || 12) + 'px' : '')
+ ';' + (start.getAttribute('color') ? 'color:' + start.getAttribute('color') : '')
+ ';' + (start.getAttribute('face') ? 'font-family:' + start.getAttribute('face') : '')
+ ';' + start.style.cssText;
}
while (start.firstChild) {
tmpNode.appendChild(start.firstChild)
}
start.parentNode.insertBefore(tmpNode, start);
domUtils.remove(start);
if (!isFixed) {
range.setEnd(tmpNode, tmpNode.childNodes.length).collapse(true)
}
start = tmpNode;
isFixed = 1;
}
start = start.parentNode;
}
isFixed && range.select()
}
}
if (keyCode == 8 ) {//|| keyCode == 46
//针对ff下在列表首行退格,不能删除空格行的问题
if(browser.gecko){
for(var i=0,li,lis = domUtils.getElementsByTagName(this.body,'li');li=lis[i++];){
if(domUtils.isEmptyNode(li) && !li.previousSibling){
var liOfPn = li.parentNode;
domUtils.remove(li);
if(domUtils.isEmptyNode(liOfPn)){
domUtils.remove(liOfPn)
}
}
}
}
var range,start,parent,
tds = this.currentSelectedArr;
if (tds && tds.length > 0) {
for (var i = 0,ti; ti = tds[i++];) {
ti.innerHTML = browser.ie ? ( browser.version < 9 ? '' : '' ) : '<br/>';
}
range = new dom.Range(this.document);
range.setStart(tds[0], 0).setCursor();
if (flag) {
me.undoManger.save();
flag = 0;
}
//阻止chrome执行默认的动作
if (browser.webkit) {
evt.preventDefault();
}
return;
}
range = me.selection.getRange();
//ctrl+a 后全部删除做处理
//
// if (domUtils.isEmptyBlock(me.body) && !range.startOffset) {
// //trace:1633
// me.body.innerHTML = '<p>'+(browser.ie ? ' ' : '<br/>')+'</p>';
// range.setStart(me.body.firstChild,0).setCursor(false,true);
// me.undoManger && me.undoManger.save();
// //todo 对性能会有影响
// browser.ie && me._selectionChange();
// return;
// }
//处理删除不干净的问题
start = range.startContainer;
if(domUtils.isWhitespace(start)){
start = start.parentNode
}
//标志位防止空的p无法删除
var removeFlag = 0;
while (start.nodeType == 1 && domUtils.isEmptyNode(start) && dtd.$removeEmpty[start.tagName]) {
removeFlag = 1;
parent = start.parentNode;
domUtils.remove(start);
start = parent;
}
if ( removeFlag && start.nodeType == 1 && domUtils.isEmptyNode(start)) {
//ie下的问题,虽然没有了相应的节点但一旦你输入文字还是会自动把删除的节点加上,
if (browser.ie) {
var span = range.document.createElement('span');
start.appendChild(span);
range.setStart(start,0).setCursor();
//for ie
li = domUtils.findParentByTagName(start,'li',true);
if(li){
var next = li.nextSibling;
while(next){
if(domUtils.isEmptyBlock(next)){
li = next;
next = next.nextSibling;
domUtils.remove(li);
continue;
}
break;
}
}
} else {
start.innerHTML = '<br/>';
range.setStart(start, 0).setCursor(false,true);
}
setTimeout(function() {
if (browser.ie) {
domUtils.remove(span);
}
if (flag) {
me.undoManger.save();
flag = 0;
}
}, 0)
} else {
if (flag) {
me.undoManger.save();
flag = 0;
}
}
}
})
};
///import core
///commands 修复chrome下图片不能点击的问题
///commandsName FixImgClick
///commandsTitle 修复chrome下图片不能点击的问题
//修复chrome下图片不能点击的问题
//todo 可以改大小
UE.plugins['fiximgclick'] = function() {
var me = this;
if ( browser.webkit ) {
me.addListener( 'click', function( type, e ) {
if ( e.target.tagName == 'IMG' ) {
var range = new dom.Range( me.document );
range.selectNode( e.target ).select();
}
} )
}
};
///import core
///commands 为非ie浏览器自动添加a标签
///commandsName AutoLink
///commandsTitle 自动增加链接
/**
* @description 为非ie浏览器自动添加a标签
* @author zhanyi
*/
UE.plugins['autolink'] = function() {
var cont = 0;
if (browser.ie) {
return;
}
var me = this;
me.addListener('reset',function(){
cont = 0;
});
me.addListener('keydown', function(type, evt) {
var keyCode = evt.keyCode || evt.which;
if (keyCode == 32 || keyCode == 13) {
var sel = me.selection.getNative(),
range = sel.getRangeAt(0).cloneRange(),
offset,
charCode;
var start = range.startContainer;
while (start.nodeType == 1 && range.startOffset > 0) {
start = range.startContainer.childNodes[range.startOffset - 1];
if (!start)
break;
range.setStart(start, start.nodeType == 1 ? start.childNodes.length : start.nodeValue.length);
range.collapse(true);
start = range.startContainer;
}
do{
if (range.startOffset == 0) {
start = range.startContainer.previousSibling;
while (start && start.nodeType == 1) {
start = start.lastChild;
}
if (!start || domUtils.isFillChar(start))
break;
offset = start.nodeValue.length;
} else {
start = range.startContainer;
offset = range.startOffset;
}
range.setStart(start, offset - 1);
charCode = range.toString().charCodeAt(0);
} while (charCode != 160 && charCode != 32);
if (range.toString().replace(new RegExp(domUtils.fillChar, 'g'), '').match(/(?:https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)/i)) {
while(range.toString().length){
if(/^(?:https?:\/\/|ssh:\/\/|ftp:\/\/|file:\/|www\.)/i.test(range.toString())){
break;
}
try{
range.setStart(range.startContainer,range.startOffset+1)
}catch(e){
range.setStart(range.startContainer.nextSibling,0)
}
}
var a = me.document.createElement('a'),text = me.document.createTextNode(' '),href;
me.undoManger && me.undoManger.save();
a.appendChild(range.extractContents());
a.href = a.innerHTML = a.innerHTML.replace(/<[^>]+>/g,'');
href = a.getAttribute("href").replace(new RegExp(domUtils.fillChar,'g'),'');
href = /^(?:https?:\/\/)/ig.test(href) ? href : "http://"+ href;
a.setAttribute('data_ue_src',href);
a.href = href;
range.insertNode(a);
a.parentNode.insertBefore(text, a.nextSibling);
range.setStart(text, 0);
range.collapse(true);
sel.removeAllRanges();
sel.addRange(range);
me.undoManger && me.undoManger.save();
}
}
})
};
///import core
///commands 当输入内容超过编辑器高度时,编辑器自动增高
///commandsName AutoHeight,autoHeightEnabled
///commandsTitle 自动增高
/**
* @description 自动伸展
* @author zhanyi
*/
UE.plugins['autoheight'] = function () {
var me = this;
//提供开关,就算加载也可以关闭
me.autoHeightEnabled = me.options.autoHeightEnabled;
if (!me.autoHeightEnabled)return;
var bakOverflow,
span, tmpNode,
lastHeight = 0,
currentHeight,
timer;
function adjustHeight() {
clearTimeout(timer);
timer = setTimeout(function () {
if (me.queryCommandState('source') != 1) {
if (!span) {
span = me.document.createElement('span');
//trace:1764
span.style.cssText = 'display:block;width:0;margin:0;padding:0;border:0;clear:both;';
span.innerHTML = '.';
}
tmpNode = span.cloneNode(true);
me.body.appendChild(tmpNode);
currentHeight = Math.max(domUtils.getXY(tmpNode).y + tmpNode.offsetHeight, me.options.minFrameHeight);
if (currentHeight != lastHeight) {
me.setHeight(currentHeight);
lastHeight = currentHeight;
}
domUtils.remove(tmpNode);
}
}, 50)
}
me.addListener('destroy', function () {
me.removeListener('contentchange', adjustHeight);
me.removeListener('keyup', adjustHeight);
me.removeListener('mouseup', adjustHeight);
});
me.enableAutoHeight = function () {
if(!me.autoHeightEnabled)return;
var doc = me.document;
me.autoHeightEnabled = true;
bakOverflow = doc.body.style.overflowY;
doc.body.style.overflowY = 'hidden';
me.addListener('contentchange', adjustHeight);
me.addListener('keyup', adjustHeight);
me.addListener('mouseup', adjustHeight);
//ff不给事件算得不对
setTimeout(function () {
adjustHeight();
}, browser.gecko ? 100 : 0);
me.fireEvent('autoheightchanged', me.autoHeightEnabled);
};
me.disableAutoHeight = function () {
me.body.style.overflowY = bakOverflow || '';
me.removeListener('contentchange', adjustHeight);
me.removeListener('keyup', adjustHeight);
me.removeListener('mouseup', adjustHeight);
me.autoHeightEnabled = false;
me.fireEvent('autoheightchanged', me.autoHeightEnabled);
};
me.addListener('ready', function () {
me.enableAutoHeight();
//trace:1764
var timer;
domUtils.on(browser.ie ? me.body : me.document,browser.webkit ? 'dragover' : 'drop',function(){
clearTimeout(timer);
timer = setTimeout(function(){
adjustHeight()
},100)
});
});
};
///import core
///commands 悬浮工具栏
///commandsName AutoFloat,autoFloatEnabled
///commandsTitle 悬浮工具栏
/*
* modified by chengchao01
*
* 注意: 引入此功能后,在IE6下会将body的背景图片覆盖掉!
*/
UE.plugins['autofloat'] = function() {
var uiUtils,
LteIE6 = browser.ie && browser.version <= 6,
quirks = browser.quirks;
function checkHasUI(editor){
if(!editor.ui){
alert('autofloat插件功能依赖于UEditor UI\nautofloat定义位置: _src/plugins/autofloat.js');
throw({
name: '未包含UI文件',
message: 'autofloat功能依赖于UEditor UI。autofloat定义位置: _src/plugins/autofloat.js'
});
}
uiUtils = UE.ui.uiUtils;
return 1;
}
function fixIE6FixedPos(){
var docStyle = document.body.style;
docStyle.backgroundImage = 'url("about:blank")';
docStyle.backgroundAttachment = 'fixed';
}
var optsAutoFloatEnabled = this.options.autoFloatEnabled;
//如果不固定toolbar的位置,则直接退出
if(!optsAutoFloatEnabled){
return;
}
var me = this,
bakCssText,
placeHolder = document.createElement('div'),
toolbarBox,orgTop,
getPosition,
flag =true; //ie7模式下需要偏移
function setFloating(){
var toobarBoxPos = domUtils.getXY(toolbarBox),
origalFloat = domUtils.getComputedStyle(toolbarBox,'position'),
origalLeft = domUtils.getComputedStyle(toolbarBox,'left');
toolbarBox.style.width = toolbarBox.offsetWidth + 'px';
toolbarBox.style.zIndex = me.options.zIndex * 1 + 1;
toolbarBox.parentNode.insertBefore(placeHolder, toolbarBox);
if (LteIE6 || quirks) {
if(toolbarBox.style.position != 'absolute'){
toolbarBox.style.position = 'absolute';
}
toolbarBox.style.top = (document.body.scrollTop||document.documentElement.scrollTop) - orgTop + 'px';
} else {
if (browser.ie7Compat && flag) {
flag = false;
toolbarBox.style.left = getPosition(toolbarBox).left - document.documentElement.getBoundingClientRect().left+2 + 'px';
}
if(toolbarBox.style.position != 'fixed'){
toolbarBox.style.position = 'fixed';
toolbarBox.style.top = '0';
((origalFloat == 'absolute' || origalFloat == 'relative') && parseFloat(origalLeft)) && (toolbarBox.style.left = toobarBoxPos.x + 'px');
}
}
}
function unsetFloating(){
flag = true;
if(placeHolder.parentNode)
placeHolder.parentNode.removeChild(placeHolder);
toolbarBox.style.cssText = bakCssText;
}
function updateFloating(){
var rect3 = getPosition(me.container);
if (rect3.top < 0 && rect3.bottom - toolbarBox.offsetHeight > 0) {
setFloating();
}else{
unsetFloating();
}
}
var defer_updateFloating = utils.defer(function(){
updateFloating();
},browser.ie ? 200 : 100,true);
me.addListener('destroy',function(){
domUtils.un(window, ['scroll','resize'], updateFloating);
me.removeListener('keydown', defer_updateFloating);
});
me.addListener('ready', function(){
if(checkHasUI(me)){
getPosition = uiUtils.getClientRect;
toolbarBox = me.ui.getDom('toolbarbox');
orgTop = getPosition(toolbarBox).top;
bakCssText = toolbarBox.style.cssText;
placeHolder.style.height = toolbarBox.offsetHeight + 'px';
if(LteIE6){
fixIE6FixedPos();
}
me.addListener('autoheightchanged', function (t, enabled){
if (enabled) {
domUtils.on(window, ['scroll','resize'], updateFloating);
me.addListener('keydown', defer_updateFloating);
} else {
domUtils.un(window, ['scroll','resize'], updateFloating);
me.removeListener('keydown', defer_updateFloating);
}
});
me.addListener('beforefullscreenchange', function (t, enabled){
if (enabled) {
unsetFloating();
}
});
me.addListener('fullscreenchanged', function (t, enabled){
if (!enabled) {
updateFloating();
}
});
me.addListener('sourcemodechanged', function (t, enabled){
setTimeout(function (){
updateFloating();
});
});
}
})
};
///import core
///import plugins/inserthtml.js
///commands 插入代码
///commandsName HighlightCode
///commandsTitle 插入代码
///commandsDialog dialogs\code\code.html
UE.plugins['highlight'] = function() {
var me = this;
me.commands['highlightcode'] = {
execCommand: function (cmdName, code, syntax) {
if(code && syntax){
var pre = document.createElement("pre");
pre.className = "brush: "+syntax+";toolbar:false;";
pre.style.display = "";
pre.appendChild(document.createTextNode(code));
document.body.appendChild(pre);
if(me.queryCommandState("highlightcode")){
me.execCommand("highlightcode");
}
me.execCommand('inserthtml', SyntaxHighlighter.highlight(pre,null,true));
var div = me.document.getElementById(SyntaxHighlighter.getHighlighterDivId());
div.setAttribute('highlighter',pre.className);
domUtils.remove(pre);
adjustHeight()
}else{
var range = this.selection.getRange(),
start = domUtils.findParentByTagName(range.startContainer, 'table', true),
end = domUtils.findParentByTagName(range.endContainer, 'table', true),
codediv;
if(start && end && start === end && start.parentNode.className.indexOf("syntaxhighlighter")>-1){
codediv = start.parentNode;
if(domUtils.isBody(codediv.parentNode)){
var p = me.document.createElement('p');
p.innerHTML = browser.ie ? '' : '<br/>';
me.body.insertBefore(p,codediv);
range.setStart(p,0)
}else{
range.setStartBefore(codediv)
}
range.setCursor();
domUtils.remove(codediv);
}
}
},
queryCommandState: function(){
var range = this.selection.getRange(),start,end;
range.adjustmentBoundary();
start = domUtils.findParent(range.startContainer,function(node){
return node.nodeType == 1 && node.tagName == 'DIV' && domUtils.hasClass(node,'syntaxhighlighter')
},true);
end = domUtils.findParent(range.endContainer,function(node){
return node.nodeType == 1 && node.tagName == 'DIV' && domUtils.hasClass(node,'syntaxhighlighter')
},true);
return start && end && start == end ? 1 : 0;
}
};
me.addListener('beforeselectionchange',function(){
me.highlight = me.queryCommandState('highlightcode');
});
me.addListener('afterselectionchange',function(){
me.highlight = 0;
});
me.addListener("ready",function(){
//避免重复加载高亮文件
if(typeof XRegExp == "undefined"){
var obj = {
id : "syntaxhighlighter_js",
src : me.options.highlightJsUrl,
tag : "script",
type : "text/javascript",
defer : "defer"
};
utils.loadFile(document,obj,function(){
changePre();
});
}
if(!me.document.getElementById("syntaxhighlighter_css")){
var obj = {
id : "syntaxhighlighter_css",
tag : "link",
rel : "stylesheet",
type : "text/css",
href : me.options.highlightCssUrl
};
utils.loadFile(me.document,obj);
}
});
me.addListener("beforegetcontent",function(type,cmd){
for(var i=0,di,divs=domUtils.getElementsByTagName(me.body,'div');di=divs[i++];){
if(di.className == 'container'){
var pN = di.parentNode;
while(pN){
if(pN.tagName == 'DIV' && /highlighter/.test(pN.id)){
break;
}
pN = pN.parentNode;
}
if(!pN)return;
var pre = me.document.createElement('pre');
for(var str=[],c=0,ci;ci=di.childNodes[c++];){
str.push(ci[browser.ie?'innerText':'textContent']);
}
pre.appendChild(me.document.createTextNode(str.join('\n')));
pre.className = pN.getAttribute('highlighter');
pN.parentNode.insertBefore(pre,pN);
domUtils.remove(pN);
}
}
});
me.addListener("aftergetcontent",function(type,cmd){
changePre();
});
function adjustHeight(){
var div = me.document.getElementById(SyntaxHighlighter.getHighlighterDivId());
if(div){
var tds = div.getElementsByTagName('td');
for(var i=0,li,ri;li=tds[0].childNodes[i];i++){
ri = tds[1].firstChild.childNodes[i];
ri.style.height = li.style.height = ri.offsetHeight + 'px';
}
}
}
function changePre(){
for(var i=0,pr,pres = domUtils.getElementsByTagName(me.document,"pre");pr=pres[i++];){
if(pr.className.indexOf("brush")>-1){
var pre = document.createElement("pre"),txt,div;
pre.className = pr.className;
pre.style.display = "none";
pre.appendChild(document.createTextNode(pr[browser.ie?'innerText':'textContent']));
document.body.appendChild(pre);
try{
txt = SyntaxHighlighter.highlight(pre,null,true);
}catch(e){
domUtils.remove(pre);
return ;
}
div = me.document.createElement("div");
div.innerHTML = txt;
div.firstChild.setAttribute('highlighter',pre.className);
pr.parentNode.insertBefore(div.firstChild,pr);
domUtils.remove(pre);
domUtils.remove(pr);
adjustHeight()
}
}
}
me.addListener("aftersetcontent",function(){
changePre();
});
//全屏时,重新算一下宽度
me.addListener('fullscreenchanged',function(){
var div = domUtils.getElementsByTagName(me.document,'div');
for(var j=0,di;di=div[j++];){
if(/^highlighter/.test(di.id)){
var tds = di.getElementsByTagName('td');
for(var i=0,li,ri;li=tds[0].childNodes[i];i++){
ri = tds[1].firstChild.childNodes[i];
ri.style.height = li.style.height = ri.offsetHeight + 'px';
}
}
}
})
};
///import core
///commands 定制过滤规则
///commandsName Serialize
///commandsTitle 定制过滤规则
UE.plugins['serialize'] = function () {
var ie = browser.ie,
version = browser.version;
function ptToPx(value){
return /pt/.test(value) ? value.replace( /([\d.]+)pt/g, function( str ) {
return Math.round(parseFloat(str) * 96 / 72) + "px";
} ) : value;
}
var me = this,
EMPTY_TAG = dtd.$empty,
parseHTML = function () {
//干掉<a> 后便变得空格,保留</a> 这样的空格
var RE_PART = /<(?:(?:\/([^>]+)>)|(?:!--([\S|\s]*?)-->)|(?:([^\s\/>]+)\s*((?:(?:"[^"]*")|(?:'[^']*')|[^"'<>])*)\/?>))/g,
RE_ATTR = /([\w\-:.]+)(?:(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+)))|(?=\s|$))/g,
EMPTY_ATTR = {checked:1,compact:1,declare:1,defer:1,disabled:1,ismap:1,multiple:1,nohref:1,noresize:1,noshade:1,nowrap:1,readonly:1,selected:1},
CDATA_TAG = {script:1,style: 1},
NEED_PARENT_TAG = {
"li": { "$": 'ul', "ul": 1, "ol": 1 },
"dd": { "$": "dl", "dl": 1 },
"dt": { "$": "dl", "dl": 1 },
"option": { "$": "select", "select": 1 },
"td": { "$": "tr", "tr": 1 },
"th": { "$": "tr", "tr": 1 },
"tr": { "$": "tbody", "tbody": 1, "thead": 1, "tfoot": 1, "table": 1 },
"tbody": { "$": "table", 'table':1,"colgroup": 1 },
"thead": { "$": "table", "table": 1 },
"tfoot": { "$": "table", "table": 1 },
"col": { "$": "colgroup","colgroup":1 }
};
var NEED_CHILD_TAG = {
"table": "td", "tbody": "td", "thead": "td", "tfoot": "td", "tr": "td",
"colgroup": "col",
"ul": "li", "ol": "li",
"dl": "dd",
"select": "option"
};
function parse( html, callbacks ) {
var match,
nextIndex = 0,
tagName,
cdata;
RE_PART.exec( "" );
while ( (match = RE_PART.exec( html )) ) {
var tagIndex = match.index;
if ( tagIndex > nextIndex ) {
var text = html.slice( nextIndex, tagIndex );
if ( cdata ) {
cdata.push( text );
} else {
callbacks.onText( text );
}
}
nextIndex = RE_PART.lastIndex;
if ( (tagName = match[1]) ) {
tagName = tagName.toLowerCase();
if ( cdata && tagName == cdata._tag_name ) {
callbacks.onCDATA( cdata.join( '' ) );
cdata = null;
}
if ( !cdata ) {
callbacks.onTagClose( tagName );
continue;
}
}
if ( cdata ) {
cdata.push( match[0] );
continue;
}
if ( (tagName = match[3]) ) {
if ( /="/.test( tagName ) ) {
continue;
}
tagName = tagName.toLowerCase();
var attrPart = match[4],
attrMatch,
attrMap = {},
selfClosing = attrPart && attrPart.slice( -1 ) == '/';
if ( attrPart ) {
RE_ATTR.exec( "" );
while ( (attrMatch = RE_ATTR.exec( attrPart )) ) {
var attrName = attrMatch[1].toLowerCase(),
attrValue = attrMatch[2] || attrMatch[3] || attrMatch[4] || '';
if ( !attrValue && EMPTY_ATTR[attrName] ) {
attrValue = attrName;
}
if ( attrName == 'style' ) {
if ( ie && version <= 6 ) {
attrValue = attrValue.replace( /(?!;)\s*([\w-]+):/g, function ( m, p1 ) {
return p1.toLowerCase() + ':';
} );
}
}
//没有值的属性不添加
if ( attrValue ) {
attrMap[attrName] = attrValue.replace( /:\s*/g, ':' )
}
}
}
callbacks.onTagOpen( tagName, attrMap, selfClosing );
if ( !cdata && CDATA_TAG[tagName] ) {
cdata = [];
cdata._tag_name = tagName;
}
continue;
}
if ( (tagName = match[2]) ) {
callbacks.onComment( tagName );
}
}
if ( html.length > nextIndex ) {
callbacks.onText( html.slice( nextIndex, html.length ) );
}
}
return function ( html, forceDtd ) {
var fragment = {
type: 'fragment',
parent: null,
children: []
};
var currentNode = fragment;
function addChild( node ) {
node.parent = currentNode;
currentNode.children.push( node );
}
function addElement( element, open ) {
var node = element;
// 遇到结构化标签的时候
if ( NEED_PARENT_TAG[node.tag] ) {
// 考虑这种情况的时候, 结束之前的标签
// e.g. <table><tr><td>12312`<tr>`4566
while ( NEED_PARENT_TAG[currentNode.tag] && NEED_PARENT_TAG[currentNode.tag][node.tag] ) {
currentNode = currentNode.parent;
}
// 如果前一个标签和这个标签是同一级, 结束之前的标签
// e.g. <ul><li>123<li>
if ( currentNode.tag == node.tag ) {
currentNode = currentNode.parent;
}
// 向上补齐父标签
while ( NEED_PARENT_TAG[node.tag] ) {
if ( NEED_PARENT_TAG[node.tag][currentNode.tag] ) break;
node = node.parent = {
type: 'element',
tag: NEED_PARENT_TAG[node.tag]['$'],
attributes: {},
children: [node]
};
}
}
if ( forceDtd ) {
// 如果遇到这个标签不能放在前一个标签内部,则结束前一个标签,span单独处理
while ( dtd[node.tag] && !(currentNode.tag == 'span' ? utils.extend( dtd['strong'], {'a':1,'A':1} ) : (dtd[currentNode.tag] || dtd['div']))[node.tag] ) {
if ( tagEnd( currentNode ) ) continue;
if ( !currentNode.parent ) break;
currentNode = currentNode.parent;
}
}
node.parent = currentNode;
currentNode.children.push( node );
if ( open ) {
currentNode = element;
}
if ( element.attributes.style ) {
element.attributes.style = element.attributes.style.toLowerCase();
}
return element;
}
// 结束一个标签的时候,需要判断一下它是否缺少子标签
// e.g. <table></table>
function tagEnd( node ) {
var needTag;
if ( !node.children.length && (needTag = NEED_CHILD_TAG[node.tag]) ) {
addElement( {
type: 'element',
tag: needTag,
attributes: {},
children: []
}, true );
return true;
}
return false;
}
parse( html, {
onText: function ( text ) {
while ( !(dtd[currentNode.tag] || dtd['div'])['#'] ) {
//节点之间的空白不能当作节点处理
// if(/^[ \t\r\n]+$/.test( text )){
// return;
// }
if ( tagEnd( currentNode ) ) continue;
currentNode = currentNode.parent;
}
//if(/^[ \t\n\r]*/.test(text))
addChild( {
type: 'text',
data: text
} );
},
onComment: function ( text ) {
addChild( {
type: 'comment',
data: text
} );
},
onCDATA: function ( text ) {
while ( !(dtd[currentNode.tag] || dtd['div'])['#'] ) {
if ( tagEnd( currentNode ) ) continue;
currentNode = currentNode.parent;
}
addChild( {
type: 'cdata',
data: text
} );
},
onTagOpen: function ( tag, attrs, closed ) {
closed = closed || EMPTY_TAG[tag] ;
addElement( {
type: 'element',
tag: tag,
attributes: attrs,
closed: closed,
children: []
}, !closed );
},
onTagClose: function ( tag ) {
var node = currentNode;
// 向上找匹配的标签, 这里不考虑dtd的情况是因为tagOpen的时候已经处理过了, 这里不会遇到
while ( node && tag != node.tag ) {
node = node.parent;
}
if ( node ) {
// 关闭中间的标签
for ( var tnode = currentNode; tnode !== node.parent; tnode = tnode.parent ) {
tagEnd( tnode );
}
//去掉空白的inline节点
//分页,锚点保留
//|| dtd.$removeEmptyBlock[node.tag])
// if ( !node.children.length && dtd.$removeEmpty[node.tag] && !node.attributes.anchorname && node.attributes['class'] != 'pagebreak' && node.tag != 'a') {
//
// node.parent.children.pop();
// }
currentNode = node.parent;
} else {
// 如果没有找到开始标签, 则创建新标签
// eg. </div> => <div></div>
//针对视屏网站embed会给结束符,这里特殊处理一下
if ( !(dtd.$removeEmpty[tag] || dtd.$removeEmptyBlock[tag] || tag == 'embed') ) {
node = {
type: 'element',
tag: tag,
attributes: {},
children: []
};
addElement( node, true );
tagEnd( node );
currentNode = node.parent;
}
}
}
} );
// 处理这种情况, 只有开始标签没有结束标签的情况, 需要关闭开始标签
// eg. <table>
while ( currentNode !== fragment ) {
tagEnd( currentNode );
currentNode = currentNode.parent;
}
return fragment;
};
}();
var unhtml1 = function () {
var map = { '<': '<', '>': '>', '"': '"', "'": ''' };
function rep( m ) {
return map[m];
}
return function ( str ) {
str = str + '';
return str ? str.replace( /[<>"']/g, rep ) : '';
};
}();
var toHTML = function () {
function printChildren( node, pasteplain ) {
var children = node.children;
var buff = [];
for ( var i = 0,ci; ci = children[i]; i++ ) {
buff.push( toHTML( ci, pasteplain ) );
}
return buff.join( '' );
}
function printAttrs( attrs ) {
var buff = [];
for ( var k in attrs ) {
var value = attrs[k];
if(k == 'style'){
//pt==>px
value = ptToPx(value);
//color rgb ==> hex
if(/rgba?\s*\([^)]*\)/.test(value)){
value = value.replace( /rgba?\s*\(([^)]*)\)/g, function( str ) {
return utils.fixColor('color',str);
} )
}
attrs[k] = utils.optCss(value.replace(/windowtext/g,'#000'));
}
buff.push( k + '="' + unhtml1( attrs[k] ) + '"' );
}
return buff.join( ' ' )
}
function printData( node, notTrans ) {
//trace:1399 输入html代码时空格转换成为
//node.data.replace(/ /g,' ') 针对pre中的空格和出现的 把他们在得到的html代码中都转换成为空格,为了在源码模式下显示为空格而不是
return notTrans ? node.data.replace(/ /g,' ') : unhtml1( node.data ).replace(/ /g,' ');
}
//纯文本模式下标签转换
var transHtml = {
'div':'p',
'li':'p',
'tr':'p',
'br':'br',
'p':'p'//trace:1398 碰到p标签自己要加上p,否则transHtml[tag]是undefined
};
function printElement( node, pasteplain ) {
var tag = node.tag;
if ( pasteplain && tag == 'td' ) {
if ( !html ) html = '';
html += printChildren( node, pasteplain ) + ' ';
} else {
var attrs = printAttrs( node.attributes );
var html = '<' + (pasteplain && transHtml[tag] ? transHtml[tag] : tag) + (attrs ? ' ' + attrs : '') + (EMPTY_TAG[tag] ? ' />' : '>');
if ( !EMPTY_TAG[tag] ) {
//trace:1627
//p标签在ie下为空,将不占位这里占位符不起作用,用
if(browser.ie && tag == 'p' && !node.children.length){
html += ' ';
}
html += printChildren( node, pasteplain );
html += '</' + (pasteplain && transHtml[tag] ? transHtml[tag] : tag) + '>';
}
}
return html;
}
return function ( node, pasteplain ) {
if ( node.type == 'fragment' ) {
return printChildren( node, pasteplain );
} else if ( node.type == 'element' ) {
return printElement( node, pasteplain );
} else if ( node.type == 'text' || node.type == 'cdata' ) {
return printData( node, dtd.$notTransContent[node.parent.tag] );
} else if ( node.type == 'comment' ) {
return '<!--' + node.data + '-->';
}
return '';
};
}();
//过滤word
var transformWordHtml = function () {
function isWordDocument( strValue ) {
var re = new RegExp( /(class="?Mso|style="[^"]*\bmso\-|w:WordDocument|<v:)/ig );
return re.test( strValue );
}
function ensureUnits( v ) {
v = v.replace( /([\d.]+)([\w]+)?/g, function ( m, p1, p2 ) {
return (Math.round( parseFloat( p1 ) ) || 1) + (p2 || 'px');
} );
return v;
}
function filterPasteWord( str ) {
str = str.replace( /<!--\s*EndFragment\s*-->[\s\S]*$/, '' )
//remove link break
.replace( /^(\r\n|\n|\r)|(\r\n|\n|\r)$/ig, "" )
//remove entities at the start of contents
.replace( /^\s*( )+/ig, "" )
//remove entities at the end of contents
.replace( /( |<br[^>]*>)+\s*$/ig, "" )
// Word comments like conditional comments etc
.replace( /<!--[\s\S]*?-->/ig, "" )
//转换图片
.replace(/<v:shape [^>]*>[\s\S]*?.<\/v:shape>/gi,function(str){
var width = str.match(/width:([ \d.]*p[tx])/i)[1],
height = str.match(/height:([ \d.]*p[tx])/i)[1],
src = str.match(/src=\s*"([^"]*)"/i)[1];
return '<img width="'+ptToPx(width)+'" height="'+ptToPx(height)+'" src="' + src + '" />'
})
//去掉多余的属性
.replace( /v:\w+=["']?[^'"]+["']?/g, '' )
// Remove comments, scripts (e.g., msoShowComment), XML tag, VML content, MS Office namespaced tags, and a few other tags
.replace( /<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|xml|meta|link|style|\w+:\w+)(?=[\s\/>]))[^>]*>/gi, "" )
//convert word headers to strong
.replace( /<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi, "<p><strong>$1</strong></p>" )
//remove lang attribute
.replace( /(lang)\s*=\s*([\'\"]?)[\w-]+\2/ig, "" )
//清除多余的font不能匹配 有可能是空格
.replace( /<font[^>]*>\s*<\/font>/gi, '' )
//清除多余的class
.replace( /class\s*=\s*["']?(?:(?:MsoTableGrid)|(?:MsoNormal(Table)?))\s*["']?/gi, '' );
// Examine all styles: delete junk, transform some, and keep the rest
//修复了原有的问题, 比如style='fontsize:"宋体"'原来的匹配失效了
str = str.replace( /(<[a-z][^>]*)\sstyle=(["'])([^\2]*?)\2/gi, function( str, tag, tmp, style ) {
var n = [],
i = 0,
s = style.replace( /^\s+|\s+$/, '' ).replace( /"/gi, "'" ).split( /;\s*/g );
// Examine each style definition within the tag's style attribute
for ( var i = 0; i < s.length; i++ ) {
var v = s[i];
var name, value,
parts = v.split( ":" );
if ( parts.length == 2 ) {
name = parts[0].toLowerCase();
value = parts[1].toLowerCase();
// Translate certain MS Office styles into their CSS equivalents
switch ( name ) {
case "mso-padding-alt":
case "mso-padding-top-alt":
case "mso-padding-right-alt":
case "mso-padding-bottom-alt":
case "mso-padding-left-alt":
case "mso-margin-alt":
case "mso-margin-top-alt":
case "mso-margin-right-alt":
case "mso-margin-bottom-alt":
case "mso-margin-left-alt":
case "mso-table-layout-alt":
case "mso-height":
case "mso-width":
case "mso-vertical-align-alt":
//trace:1819 ff下会解析出padding在table上
if(!/<table/.test(tag))
n[i] = name.replace( /^mso-|-alt$/g, "" ) + ":" + ensureUnits( value );
continue;
case "horiz-align":
n[i] = "text-align:" + value;
continue;
case "vert-align":
n[i] = "vertical-align:" + value;
continue;
case "font-color":
case "mso-foreground":
n[i] = "color:" + value;
continue;
case "mso-background":
case "mso-highlight":
n[i] = "background:" + value;
continue;
case "mso-default-height":
n[i] = "min-height:" + ensureUnits( value );
continue;
case "mso-default-width":
n[i] = "min-width:" + ensureUnits( value );
continue;
case "mso-padding-between-alt":
n[i] = "border-collapse:separate;border-spacing:" + ensureUnits( value );
continue;
case "text-line-through":
if ( (value == "single") || (value == "double") ) {
n[i] = "text-decoration:line-through";
}
continue;
//trace:1870
// //word里边的字体统一干掉
// case 'font-family':
// continue;
case "mso-zero-height":
if ( value == "yes" ) {
n[i] = "display:none";
}
continue;
case 'margin':
if ( !/[1-9]/.test( parts[1] ) ) {
continue;
}
}
if ( /^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?:decor|trans)|top-bar|version|vnd|word-break)/.test( name ) ) {
if ( !/mso\-list/.test( name ) )
continue;
}
n[i] = name + ":" + parts[1]; // Lower-case name, but keep value case
}
}
// If style attribute contained any valid styles the re-write it; otherwise delete style attribute.
if ( i > 0 ) {
return tag + ' style="' + n.join( ';' ) + '"';
} else {
return tag;
}
} );
str = str.replace( /([ ]+)<\/span>/ig, function ( m, p ) {
return new Array( p.length + 1 ).join( ' ' ) + '</span>';
} );
return str;
}
return function ( html ) {
//过了word,才能转p->li
first = null;
parentTag = '',liStyle = '',firstTag = '';
if ( isWordDocument( html ) ) {
html = filterPasteWord( html );
}
return html.replace( />[ \t\r\n]*</g, '><' );
};
}();
var NODE_NAME_MAP = {
'text': '#text',
'comment': '#comment',
'cdata': '#cdata-section',
'fragment': '#document-fragment'
};
function _likeLi( node ) {
var a;
if ( node && node.tag == 'p' ) {
//office 2011下有效
if ( node.attributes['class'] == 'MsoListParagraph' || /mso-list/.test( node.attributes.style ) ) {
a = 1;
} else {
var firstChild = node.children[0];
if ( firstChild && firstChild.tag == 'span' && /Wingdings/i.test( firstChild.attributes.style ) ) {
a = 1;
}
}
}
return a;
}
//为p==>li 做个标志
var first,
orderStyle = {
'decimal' : /\d+/,
'lower-roman': /^m{0,4}(cm|cd|d?c{0,3})(xc|xl|l?x{0,3})(ix|iv|v?i{0,3})$/,
'upper-roman': /^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/,
'lower-alpha' : /^\(?[a-z]+\)?$/,
'upper-alpha': /^\(?[A-Z]+\)?$/
},
unorderStyle = { 'disc' : /^[l\u00B7\u2002]/, 'circle' : /^[\u006F\u00D8]/,'square' : /^[\u006E\u25C6]/},
parentTag = '',liStyle = '',firstTag;
//写入编辑器时,调用,进行转换操作
function transNode( node, word_img_flag ) {
//dtd.$removeEmptyBlock[node.tag]
if ( node.type == 'element' && !node.children.length && (dtd.$removeEmpty[node.tag]) && node.tag != 'a' ) {// 锚点保留
return {
type : 'fragment',
children:[]
}
}
var sizeMap = [0, 10, 12, 16, 18, 24, 32, 48],
attr,
indexOf = utils.indexOf;
switch ( node.tag ) {
case 'img':
//todo base64暂时去掉,后边做远程图片上传后,干掉这个
if(node.attributes.src && /^data:/.test(node.attributes.src)){
return {
type : 'fragment',
children:[]
}
}
if ( node.attributes.src && /^(?:file)/.test( node.attributes.src ) ) {
if ( !/(gif|bmp|png|jpg|jpeg)$/.test( node.attributes.src ) ) {
return {
type : 'fragment',
children:[]
}
}
node.attributes.word_img = node.attributes.src;
node.attributes.src = me.options.UEDITOR_HOME_URL + 'themes/default/images/spacer.gif';
var flag = parseInt(node.attributes.width)<128||parseInt(node.attributes.height)<43;
node.attributes.style="background:url(" + me.options.UEDITOR_HOME_URL +"themes/default/images/"+(flag?"word.gif":"localimage.png")+") no-repeat center center;border:1px solid #ddd";
//node.attributes.style = 'width:395px;height:173px;';
word_img_flag && (word_img_flag.flag = 1);
}
if(browser.ie && browser.version < 7 && me.options.relativePath)
node.attributes.orgSrc = node.attributes.src;
node.attributes.data_ue_src = node.attributes.data_ue_src || node.attributes.src;
break;
case 'li':
var child = node.children[0];
if ( !child || child.type != 'element' || child.tag != 'p' && dtd.p[child.tag] ) {
var tmpPNode = {
type: 'element',
tag: 'p',
attributes: {},
parent : node
};
tmpPNode.children = child ? node.children :[
browser.ie ? {
type:'text',
data:domUtils.fillChar,
parent : tmpPNode
}:
{
type : 'element',
tag : 'br',
attributes:{},
closed: true,
children: [],
parent : tmpPNode
}
];
node.children = [tmpPNode];
}
break;
case 'table':
case 'td':
optStyle( node );
break;
case 'a'://锚点,a==>img
if ( node.attributes['anchorname'] ) {
node.tag = 'img';
node.attributes = {
'class' : 'anchorclass',
'anchorname':node.attributes['name']
};
node.closed = 1;
}
node.attributes.href && (node.attributes.data_ue_src = node.attributes.href);
break;
case 'b':
node.tag = node.name = 'strong';
break;
case 'i':
node.tag = node.name = 'em';
break;
case 'u':
node.tag = node.name = 'span';
node.attributes.style = (node.attributes.style || '') + ';text-decoration:underline;';
break;
case 's':
case 'del':
node.tag = node.name = 'span';
node.attributes.style = (node.attributes.style || '') + ';text-decoration:line-through;';
if ( node.children.length == 1 ) {
child = node.children[0];
if ( child.tag == node.tag ) {
node.attributes.style += ";" + child.attributes.style;
node.children = child.children;
}
}
break;
case 'span':
if ( /mso-list/.test( node.attributes.style ) ) {
//判断了两次就不在判断了
if ( firstTag != 'end' ) {
var ci = node.children[0],p;
while ( ci.type == 'element' ) {
ci = ci.children[0];
}
for ( p in unorderStyle ) {
if ( unorderStyle[p].test( ci.data ) ) {
// ci.data = ci.data.replace(unorderStyle[p],'');
parentTag = 'ul';
liStyle = p;
break;
}
}
if ( !parentTag ) {
for ( p in orderStyle ) {
if ( orderStyle[p].test( ci.data.replace( /\.$/, '' ) ) ) {
// ci.data = ci.data.replace(orderStyle[p],'');
parentTag = 'ol';
liStyle = p;
break;
}
}
}
if ( firstTag ) {
if ( ci.data == firstTag ) {
if ( parentTag != 'ul' ) {
liStyle = '';
}
parentTag = 'ul'
} else {
if ( parentTag != 'ol' ) {
liStyle = '';
}
parentTag = 'ol'
}
firstTag = 'end'
} else {
firstTag = ci.data
}
if ( parentTag ) {
var tmpNode = node;
while ( tmpNode && tmpNode.tag != 'ul' && tmpNode.tag != 'ol' ) {
tmpNode = tmpNode.parent;
}
if(tmpNode ){
tmpNode.tag = parentTag;
tmpNode.attributes.style = 'list-style-type:' + liStyle;
}
}
}
node = {
type : 'fragment',
children : []
};
break;
}
var style = node.attributes.style;
if ( style ) {
//trace:1493
//ff3.6出来的是background: none repeat scroll %0 %0 颜色
style = style.match( /(?:\b(?:color|font-size|background(-color)?|font-family|text-decoration)\b\s*:\s*(&[^;]+;|[^;])+(?=;)?)/gi );
if ( style ) {
node.attributes.style = style.join( ';' );
if ( !node.attributes.style ) {
delete node.attributes.style;
}
}
}
//针对ff3.6span的样式不能正确继承的修复
if(browser.gecko && browser.version <= 10902 && node.parent){
var parent = node.parent;
if(parent.tag == 'span' && parent.attributes && parent.attributes.style){
node.attributes.style = parent.attributes.style + ';' + node.attributes.style;
}
}
if ( utils.isEmptyObject( node.attributes ) ) {
node.type = 'fragment'
}
break;
case 'font':
node.tag = node.name = 'span';
attr = node.attributes;
node.attributes = {
'style': (attr.size ? 'font-size:' + (sizeMap[attr.size] || 12) + 'px' : '')
+ ';' + (attr.color ? 'color:'+ attr.color : '')
+ ';' + (attr.face ? 'font-family:'+ attr.face : '')
+ ';' + (attr.style||'')
};
while(node.parent.tag == node.tag && node.parent.children.length == 1){
node.attributes.style && (node.parent.attributes.style ? (node.parent.attributes.style += ";" + node.attributes.style) : (node.parent.attributes.style = node.attributes.style));
node.parent.children = node.children;
node = node.parent;
}
break;
case 'p':
if ( node.attributes.align ) {
node.attributes.style = (node.attributes.style || '') + ';text-align:' +
node.attributes.align + ';';
delete node.attributes.align;
}
if ( _likeLi( node ) ) {
if ( !first ) {
var ulNode = {
type: 'element',
tag: 'ul',
attributes: {},
children: []
},
index = indexOf( node.parent.children, node );
node.parent.children[index] = ulNode;
ulNode.parent = node.parent;
ulNode.children[0] = node;
node.parent = ulNode;
while ( 1 ) {
node = ulNode.parent.children[index + 1];
if ( _likeLi( node ) ) {
ulNode.children[ulNode.children.length] = node;
node.parent = ulNode;
ulNode.parent.children.splice( index + 1, 1 );
} else {
break;
}
}
return ulNode;
}
node.tag = node.name = 'li';
//为chrome能找到标号做的处理
if ( browser.webkit ) {
var span = node.children[0];
while ( span && span.type == 'element' ) {
span = span.children[0]
}
span && (span.parent.attributes.style = (span.parent.attributes.style || '') + ';mso-list:10');
}
delete node.attributes['class'];
delete node.attributes.style;
}
}
return node;
}
function optStyle( node ) {
if ( ie && node.attributes.style ) {
var style = node.attributes.style;
node.attributes.style = style.replace(/;\s*/g,';');
node.attributes.style = node.attributes.style.replace( /^\s*|\s*$/, '' )
}
}
function transOutNode( node ) {
switch ( node.tag ) {
case 'table':
!node.attributes.style && delete node.attributes.style;
if ( ie && node.attributes.style ) {
optStyle( node );
}
break;
case 'td':
case 'th':
if ( /display\s*:\s*none/i.test( node.attributes.style ) ) {
return {
type: 'fragment',
children: []
};
}
if ( ie && !node.children.length ) {
var txtNode = {
type: 'text',
data:domUtils.fillChar,
parent : node
};
node.children[0] = txtNode;
}
if ( ie && node.attributes.style ) {
optStyle( node );
}
break;
case 'img'://锚点,img==>a
if ( node.attributes.anchorname ) {
node.tag = 'a';
node.attributes = {
name : node.attributes.anchorname,
anchorname : 1
};
node.closed = null;
}else{
if(node.attributes.data_ue_src){
node.attributes.src = node.attributes.data_ue_src;
delete node.attributes.data_ue_src;
}
}
break;
case 'a':
if(node.attributes.data_ue_src){
node.attributes.href = node.attributes.data_ue_src;
delete node.attributes.data_ue_src;
}
}
return node;
}
function childrenAccept( node, visit, ctx ) {
if ( !node.children || !node.children.length ) {
return node;
}
var children = node.children;
for ( var i = 0; i < children.length; i++ ) {
var newNode = visit( children[i], ctx );
if ( newNode.type == 'fragment' ) {
var args = [i, 1];
args.push.apply( args, newNode.children );
children.splice.apply( children, args );
//节点为空的就干掉,不然后边的补全操作会添加多余的节点
if ( !children.length ) {
node = {
type: 'fragment',
children: []
}
}
i --;
} else {
children[i] = newNode;
}
}
return node;
}
function Serialize( rules ) {
this.rules = rules;
}
Serialize.prototype = {
// NOTE: selector目前只支持tagName
rules: null,
// NOTE: node必须是fragment
filter: function ( node, rules, modify ) {
rules = rules || this.rules;
var whiteList = rules && rules.whiteList;
var blackList = rules && rules.blackList;
function visitNode( node, parent ) {
node.name = node.type == 'element' ?
node.tag : NODE_NAME_MAP[node.type];
if ( parent == null ) {
return childrenAccept( node, visitNode, node );
}
if ( blackList && blackList[node.name] ) {
modify && (modify.flag = 1);
return {
type: 'fragment',
children: []
};
}
if ( whiteList ) {
if ( node.type == 'element' ) {
if ( parent.type == 'fragment' ? whiteList[node.name] : whiteList[node.name] && whiteList[parent.name][node.name] ) {
var props;
if ( (props = whiteList[node.name].$) ) {
var oldAttrs = node.attributes;
var newAttrs = {};
for ( var k in props ) {
if ( oldAttrs[k] ) {
newAttrs[k] = oldAttrs[k];
}
}
node.attributes = newAttrs;
}
} else {
modify && (modify.flag = 1);
node.type = 'fragment';
// NOTE: 这里算是一个hack
node.name = parent.name;
}
} else {
// NOTE: 文本默认允许
}
}
if ( blackList || whiteList ) {
childrenAccept( node, visitNode, node );
}
return node;
}
return visitNode( node, null );
},
transformInput: function ( node, word_img_flag ) {
function visitNode( node ) {
node = transNode( node, word_img_flag );
if ( node.tag == 'ol' || node.tag == 'ul' ) {
first = 1;
}
node = childrenAccept( node, visitNode, node );
if ( node.tag == 'ol' || node.tag == 'ul' ) {
first = 0;
parentTag = '',liStyle = '',firstTag = '';
}
if ( node.type == 'text' && node.data.replace( /\s/g, '' ) == me.options.pageBreakTag ) {
node.type = 'element';
node.name = node.tag = 'hr';
delete node.data;
node.attributes = {
'class' : 'pagebreak',
noshade:"noshade",
size:"5",
'unselectable' : 'on',
'style' : 'moz-user-select:none;-khtml-user-select: none;'
};
node.children = [];
}
//去掉多余的空格和换行
if(node.type == 'text' && !dtd.$notTransContent[node.parent.tag]){
node.data = node.data.replace(/[\r\t\n]*/g,'')//.replace(/[ ]*$/g,'')
}
return node;
}
return visitNode( node );
},
transformOutput: function ( node ) {
function visitNode( node ) {
if ( node.tag == 'hr' && node.attributes['class'] == 'pagebreak' ) {
delete node.tag;
node.type = 'text';
node.data = me.options.pageBreakTag;
delete node.children;
}
node = transOutNode( node );
if ( node.tag == 'ol' || node.tag == 'ul' ) {
first = 1;
}
node = childrenAccept( node, visitNode, node );
if ( node.tag == 'ol' || node.tag == 'ul' ) {
first = 0;
}
return node;
}
return visitNode( node );
},
toHTML: toHTML,
parseHTML: parseHTML,
word: transformWordHtml
};
me.serialize = new Serialize( me.options.serialize );
UE.serialize = new Serialize( {} );
};
///import core
///import plugins/inserthtml.js
///commands 视频
///commandsName InsertVideo
///commandsTitle 插入视频
///commandsDialog dialogs\video\video.html
UE.plugins['video'] = function (){
var me =this,
div;
/**
* 创建插入视频字符窜
* @param url 视频地址
* @param width 视频宽度
* @param height 视频高度
* @param align 视频对齐
* @param toEmbed 是否以图片代替显示
* @param addParagraph 是否需要添加P 标签
*/
function creatInsertStr(url,width,height,align,toEmbed,addParagraph){
return !toEmbed ?
(addParagraph? ('<p '+ (align !="none" ? ( align == "center"? ' style="text-align:center;" ':' style="float:"'+ align ) : '') + '>'): '') +
'<img align="'+align+'" width="'+ width +'" height="' + height + '" _url="'+url+'" class="edui-faked-video"' +
' src="'+me.options.UEDITOR_HOME_URL+'themes/default/images/spacer.gif" style="background:url('+me.options.UEDITOR_HOME_URL+'themes/default/images/videologo.gif) no-repeat center center; border:1px solid gray;" />' +
(addParagraph?'</p>':'')
:
'<embed type="application/x-shockwave-flash" class="edui-faked-video" pluginspage="http://www.macromedia.com/go/getflashplayer"' +
' src="' + url + '" width="' + width + '" height="' + height + '" align="' + align + '"' +
( align !="none" ? ' style= "'+ ( align == "center"? "display:block;":" float: "+ align ) + '"' :'' ) +
' wmode="transparent" play="true" loop="false" menu="false" allowscriptaccess="never" allowfullscreen="true" >';
}
function switchImgAndEmbed(img2embed){
var tmpdiv,
nodes =domUtils.getElementsByTagName(me.document, !img2embed ? "embed" : "img");
for(var i=0,node;node = nodes[i++];){
if(node.className!="edui-faked-video")continue;
tmpdiv = me.document.createElement("div");
//先看float在看align,浮动有的是时候是在float上定义的
var align = node.style.cssFloat;
tmpdiv.innerHTML = creatInsertStr(img2embed ? node.getAttribute("_url"):node.getAttribute("src"),node.width,node.height,align || node.getAttribute("align"),img2embed);
node.parentNode.replaceChild(tmpdiv.firstChild,node);
}
}
me.addListener("beforegetcontent",function(){
switchImgAndEmbed(true);
});
me.addListener('aftersetcontent',function(){
switchImgAndEmbed(false);
});
me.addListener('aftergetcontent',function(cmdName){
if(cmdName == 'aftergetcontent' && me.queryCommandState('source'))
return;
switchImgAndEmbed(false);
});
me.commands["insertvideo"] = {
execCommand: function (cmd, videoObjs){
videoObjs = utils.isArray(videoObjs)?videoObjs:[videoObjs];
var html = [];
for(var i=0,vi,len = videoObjs.length;i<len;i++){
vi = videoObjs[i];
html.push(creatInsertStr( vi.url, vi.width || 420, vi.height || 280, vi.align||"none",false,true));
}
me.execCommand("inserthtml",html.join(""));
},
queryCommandState : function(){
var img = me.selection.getRange().getClosedNode(),
flag = img && (img.className == "edui-faked-video");
return this.highlight ? -1 :(flag?1:0);
}
}
};
///import core
///commands 表格
///commandsName InsertTable,DeleteTable,InsertParagraphBeforeTable,InsertRow,DeleteRow,InsertCol,DeleteCol,MergeCells,MergeRight,MergeDown,SplittoCells,SplittoRows,SplittoCols
///commandsTitle 表格,删除表格,表格前插行,前插入行,删除行,前插入列,删除列,合并多个单元格,右合并单元格,下合并单元格,完全拆分单元格,拆分成行,拆分成列
///commandsDialog dialogs\table\table.html
/**
* Created by .
* User: taoqili
* Date: 11-5-5
* Time: 下午2:06
* To change this template use File | Settings | File Templates.
*/
/**
* table操作插件
*/
UE.plugins['table'] = function() {
var me = this,
keys = domUtils.keys,
clearSelectedTd = domUtils.clearSelectedArr;
//框选时用到的几个全局变量
var anchorTd,
tableOpt,
_isEmpty = domUtils.isEmptyNode;
function getIndex(cell) {
var cells = cell.parentNode.cells;
for (var i = 0,ci; ci = cells[i]; i++) {
if (ci === cell) {
return i;
}
}
}
function deleteTable(table,range){
var p = table.ownerDocument.createElement('p');
domUtils.fillNode(me.document,p);
var pN = table.parentNode;
if(pN && pN.getAttribute('dropdrag')){
table = pN;
}
table.parentNode.insertBefore(p, table);
domUtils.remove(table);
range.setStart(p, 0).setCursor();
}
/**
* 判断当前单元格是否处于隐藏状态
* @param cell 待判断的单元格
* @return {Boolean} 隐藏时返回true,否则返回false
*/
function _isHide(cell) {
return cell.style.display == "none";
}
function getCount(arr) {
var count = 0;
for (var i = 0,ti; ti = arr[i++];) {
if (!_isHide(ti)) {
count++
}
}
return count;
}
me.currentSelectedArr = [];
me.addListener('mousedown', _mouseDownEvent);
me.addListener('keydown', function(type, evt) {
var keyCode = evt.keyCode || evt.which;
if (!keys[keyCode] && !evt.ctrlKey && !evt.metaKey && !evt.shiftKey && !evt.altKey) {
clearSelectedTd(me.currentSelectedArr)
}
});
me.addListener('mouseup', function() {
anchorTd = null;
me.removeListener('mouseover', _mouseDownEvent);
var td = me.currentSelectedArr[0];
if (td) {
me.document.body.style.webkitUserSelect = '';
var range = new dom.Range(me.document);
if (_isEmpty(td)) {
range.setStart(me.currentSelectedArr[0], 0).setCursor();
} else {
range.selectNodeContents(me.currentSelectedArr[0]).select();
}
} else {
//浏览器能从table外边选到里边导致currentSelectedArr为空,清掉当前选区回到选区的最开始
var range = me.selection.getRange().shrinkBoundary();
if (!range.collapsed) {
var start = domUtils.findParentByTagName(range.startContainer, 'td', true),
end = domUtils.findParentByTagName(range.endContainer, 'td', true);
//在table里边的不能清除
if (start && !end || !start && end || start && end && start !== end) {
range.collapse(true).select(true)
}
}
}
});
function reset() {
me.currentSelectedArr = [];
anchorTd = null;
}
/**
* 插入表格
* @param numRows 行数
* @param numCols 列数
* @param height 列数
* @param width 列数
* @param heightUnit 列数
* @param widthUnit 列数
* @param bgColor 表格背景
* @param border 边框大小
* @param borderColor 边框颜色
* @param cellSpacing 单元格间距
* @param cellPadding 单元格边距
*/
me.commands['inserttable'] = {
queryCommandState: function () {
if(this.highlight ){
return -1;
}
var range = this.selection.getRange();
return domUtils.findParentByTagName(range.startContainer, 'table', true)
|| domUtils.findParentByTagName(range.endContainer, 'table', true)
|| me.currentSelectedArr.length > 0 ? -1 : 0;
},
execCommand: function (cmdName, opt) {
opt = opt|| {numRows:5,numCols:5};
var html = ['<table _innerCreateTable = "true" '];
if(opt.cellSpacing && opt.cellSpacing != '0' || opt.cellPadding && opt.cellPadding != '0'){
html.push(' style="border-collapse:separate;" ')
}
opt.cellSpacing && opt.cellSpacing != '0' && html.push(' cellSpacing="' + opt.cellSpacing + '" ');
opt.cellPadding && opt.cellPadding != '0' && html.push(' cellPadding="' + opt.cellPadding + '" ');
html.push(' width="' + (opt.width||100) + (typeof opt.widthUnit == "undefined" ? '%' : opt.widthUnit)+'" ');
opt.height && html.push(' height="' + opt.height + (typeof opt.heightUnit == "undefined" ? '%' : opt.heightUnit) +'" ');
opt.align && (html.push(' align="' + opt.align + '" '));
html.push(' border="' + (opt.border||1) +'" borderColor="' + (opt.borderColor||'#000000') +'"');
opt.borderType == "1" && html.push(' borderType="1" ');
opt.bgColor && html.push(' bgColor="' + opt.bgColor + '"');
html.push(' ><tbody>');
opt.width = Math.floor((opt.width||'100')/opt.numCols);
for(var i=0;i<opt.numRows;i++){
html.push('<tr>')
for(var j=0;j<opt.numCols;j++){
html.push('<td '+' style="width:' + opt.width + (typeof opt.widthUnit == "undefined"?'%':opt.widthUnit) +';'
+(opt.borderType == '1'? 'border:'+opt.border+'px solid '+(opt.borderColor||'#000000'):'')
+'">'
+(browser.ie ? domUtils.fillChar : '<br/>')+'</td>')
}
html.push('</tr>')
}
me.execCommand('insertHtml', html.join('') + '</tbody></table>');
reset();
//如果表格的align不是默认,将不占位,给后边的block元素设置clear:both
if(opt.align){
var range = me.selection.getRange(),
bk = range.createBookmark(),
start = range.startContainer;
while(start && !domUtils.isBody(start)){
if(domUtils.isBlockElm(start)){
start.style.clear = 'both';
range.moveToBookmark(bk).select();
break;
}
start = start.parentNode;
}
}
}
};
me.commands['edittable'] = {
queryCommandState: function () {
var range = this.selection.getRange();
if(this.highlight ){return -1;}
return domUtils.findParentByTagName(range.startContainer, 'table', true)
|| me.currentSelectedArr.length > 0 ? 0 : -1;
},
execCommand: function (cmdName, opt) {
var start = me.selection.getStart(),
table = domUtils.findParentByTagName(start,'table',true);
if(table){
table.style.cssText = table.style.cssText.replace(/border[^;]+/gi,'');
table.style.borderCollapse = opt.cellSpacing && opt.cellSpacing != '0' || opt.cellPadding && opt.cellPadding != '0' ? 'separate' : 'collapse';
opt.cellSpacing && opt.cellSpacing != '0' ? table.setAttribute('cellSpacing',opt.cellSpacing) : table.removeAttribute('cellSpacing');
opt.cellPadding && opt.cellPadding != '0' ? table.setAttribute('cellPadding',opt.cellPadding): table.removeAttribute('cellPadding');
opt.height && table.setAttribute('height',opt.height+opt.heightUnit);
opt.align && table.setAttribute('align',opt.align);
opt.width && table.setAttribute('width',opt.width + opt.widthUnit);
opt.bgColor && table.setAttribute('bgColor',opt.bgColor);
opt.borderColor && table.setAttribute('borderColor',opt.borderColor);
opt.border && table.setAttribute('border',opt.border);
if(opt.borderType == "1"){
for(var i=0,ti,tds = table.getElementsByTagName('td');ti=tds[i++];){
ti.style.border = opt.border+'px solid '+(opt.borderColor||'#000000')
}
table.setAttribute('borderType','1')
}else{
for(var i=0,ti,tds = table.getElementsByTagName('td');ti=tds[i++];){
if(browser.ie){
ti.style.cssText = ti.style.cssText.replace(/border[^;]+/gi,'');
}else{
domUtils.removeStyle(ti,'border');
domUtils.removeStyle(ti,'border-image')
}
}
table.removeAttribute('borderType')
}
}
}
};
me.commands['edittd'] ={
queryCommandState:function(){
if(this.highlight ){return -1;}
var range = this.selection.getRange();
return (domUtils.findParentByTagName(range.startContainer, 'table', true)
&& domUtils.findParentByTagName(range.endContainer, 'table', true)) || me.currentSelectedArr.length > 0 ? 0 : -1;
},
/**
* 单元格属性编辑
* @param cmdName
* @param tdItems
*/
execCommand:function(cmdName,tdItems){
var range = this.selection.getRange(),
tds =!me.currentSelectedArr.length?[domUtils.findParentByTagName(range.startContainer, ['td','th'], true)]:me.currentSelectedArr;
for(var i=0,td;td=tds[i++];){
domUtils.setAttributes(td,{
"bgColor":tdItems.bgColor,
"align":tdItems.align,
"vAlign":tdItems.vAlign
});
}
}
};
/**
* 删除表格
*/
me.commands['deletetable'] = {
queryCommandState:function() {
if(this.highlight ){
return -1;
}
var range = this.selection.getRange();
return (domUtils.findParentByTagName(range.startContainer, 'table', true)
&& domUtils.findParentByTagName(range.endContainer, 'table', true)) || me.currentSelectedArr.length > 0 ? 0 : -1;
},
execCommand:function() {
var range = this.selection.getRange(),
table = domUtils.findParentByTagName(me.currentSelectedArr.length > 0 ? me.currentSelectedArr[0] : range.startContainer, 'table', true);
deleteTable(table,range);
reset();
}
};
/**
* 添加表格标题
*/
me.commands['addcaption'] = {
queryCommandState:function() {
if(this.highlight ){
return -1;
}
var range = this.selection.getRange();
return (domUtils.findParentByTagName(range.startContainer, 'table', true)
&& domUtils.findParentByTagName(range.endContainer, 'table', true)) || me.currentSelectedArr.length > 0 ? 0 : -1;
},
execCommand:function(cmdName, opt) {
var range = this.selection.getRange(),
table = domUtils.findParentByTagName(me.currentSelectedArr.length > 0 ? me.currentSelectedArr[0] : range.startContainer, 'table', true);
if (opt == "on") {
var c = table.createCaption();
c.innerHTML = "请在此输入表格标题";
} else {
table.removeChild(table.caption);
}
}
};
/**
* 向右合并单元格
*/
me.commands['mergeright'] = {
queryCommandState : function() {
if(this.highlight ){
return -1;
}
var range = this.selection.getRange(),
start = range.startContainer,
td = domUtils.findParentByTagName(start, ['td','th'], true);
if (!td || this.currentSelectedArr.length > 1)return -1;
var tr = td.parentNode;
//最右边行不能向右合并
var rightCellIndex = getIndex(td) + td.colSpan;
if (rightCellIndex >= tr.cells.length) {
return -1;
}
//单元格不在同一行不能向右合并
var rightCell = tr.cells[rightCellIndex];
if (_isHide(rightCell)) {
return -1;
}
return td.rowSpan == rightCell.rowSpan ? 0 : -1;
},
execCommand : function() {
var range = this.selection.getRange(),
start = range.startContainer,
td = domUtils.findParentByTagName(start, ['td','th'], true) || me.currentSelectedArr[0],
tr = td.parentNode,
rows = tr.parentNode.parentNode.rows;
//找到当前单元格右边的未隐藏单元格
var rightCellRowIndex = tr.rowIndex,
rightCellCellIndex = getIndex(td) + td.colSpan,
rightCell = rows[rightCellRowIndex].cells[rightCellCellIndex];
//在隐藏的原生td对象上增加两个属性,分别表示当前td对应的真实td坐标
for (var i = rightCellRowIndex; i < rightCellRowIndex + rightCell.rowSpan; i++) {
for (var j = rightCellCellIndex; j < rightCellCellIndex + rightCell.colSpan; j++) {
var tmpCell = rows[i].cells[j];
tmpCell.setAttribute('rootRowIndex', tr.rowIndex);
tmpCell.setAttribute('rootCellIndex', getIndex(td));
}
}
//合并单元格
td.colSpan += rightCell.colSpan || 1;
//合并内容
_moveContent(td, rightCell);
//删除被合并的单元格,此处用隐藏方式实现来提升性能
rightCell.style.display = "none";
//重新让单元格获取焦点
//trace:1565
if(domUtils.isEmptyBlock(td)){
range.setStart(td,0).setCursor();
}else{
range.selectNodeContents(td).setCursor(true,true);
}
//处理有寛高,导致ie的文字不能输入占满
browser.ie && domUtils.removeAttributes(td,['width','height']);
}
};
/**
* 向下合并单元格
*/
me.commands['mergedown'] = {
queryCommandState : function() {
if(this.highlight ){
return -1;
}
var range = this.selection.getRange(),
start = range.startContainer,
td = domUtils.findParentByTagName(start, 'td', true);
if (!td || getCount(me.currentSelectedArr) > 1)return -1;
var tr = td.parentNode,
table = tr.parentNode.parentNode,
rows = table.rows;
//已经是最底行,不能向下合并
var downCellRowIndex = tr.rowIndex + td.rowSpan;
if (downCellRowIndex >= rows.length) {
return -1;
}
//如果下一个单元格是隐藏的,表明他是由左边span过来的,不能向下合并
var downCell = rows[downCellRowIndex].cells[getIndex(td)];
if (_isHide(downCell)) {
return -1;
}
//只有列span都相等时才能合并
return td.colSpan == downCell.colSpan ? 0 : -1;
},
execCommand : function() {
var range = this.selection.getRange(),
start = range.startContainer,
td = domUtils.findParentByTagName(start, ['td','th'], true) || me.currentSelectedArr[0];
var tr = td.parentNode,
rows = tr.parentNode.parentNode.rows;
var downCellRowIndex = tr.rowIndex + td.rowSpan,
downCellCellIndex = getIndex(td),
downCell = rows[downCellRowIndex].cells[downCellCellIndex];
//找到当前列的下一个未被隐藏的单元格
for (var i = downCellRowIndex; i < downCellRowIndex + downCell.rowSpan; i++) {
for (var j = downCellCellIndex; j < downCellCellIndex + downCell.colSpan; j++) {
var tmpCell = rows[i].cells[j];
tmpCell.setAttribute('rootRowIndex', tr.rowIndex);
tmpCell.setAttribute('rootCellIndex', getIndex(td));
}
}
//合并单元格
td.rowSpan += downCell.rowSpan || 1;
//合并内容
_moveContent(td, downCell);
//删除被合并的单元格,此处用隐藏方式实现来提升性能
downCell.style.display = "none";
//重新让单元格获取焦点
if(domUtils.isEmptyBlock(td)){
range.setStart(td,0).setCursor();
}else{
range.selectNodeContents(td).setCursor(true,true);
}
//处理有寛高,导致ie的文字不能输入占满
browser.ie && domUtils.removeAttributes(td,['width','height']);
}
};
/**
* 删除行
*/
me.commands['deleterow'] = {
queryCommandState : function() {
if(this.highlight ){
return -1;
}
var range = this.selection.getRange(),
start = range.startContainer,
td = domUtils.findParentByTagName(start, ['td','th'], true);
if (!td && me.currentSelectedArr.length == 0)return -1;
},
execCommand : function() {
var range = this.selection.getRange(),
start = range.startContainer,
td = domUtils.findParentByTagName(start, ['td','th'], true),
tr,
table,
cells,
rows ,
rowIndex ,
cellIndex;
if (td && me.currentSelectedArr.length == 0) {
var count = (td.rowSpan || 1) - 1;
me.currentSelectedArr.push(td);
tr = td.parentNode,
table = tr.parentNode.parentNode;
rows = table.rows,
rowIndex = tr.rowIndex + 1,
cellIndex = getIndex(td);
while (count) {
me.currentSelectedArr.push(rows[rowIndex].cells[cellIndex]);
count--;
rowIndex++
}
}
while (td = me.currentSelectedArr.pop()) {
if (!domUtils.findParentByTagName(td, 'table')) {//|| _isHide(td)
continue;
}
tr = td.parentNode,
table = tr.parentNode.parentNode;
cells = tr.cells,
rows = table.rows,
rowIndex = tr.rowIndex,
cellIndex = getIndex(td);
/*
* 从最左边开始扫描并隐藏当前行的所有单元格
* 若当前单元格的display为none,往上找到它所在的真正单元格,获取colSpan和rowSpan,
* 将rowspan减一,并跳转到cellIndex+colSpan列继续处理
* 若当前单元格的display不为none,分两种情况:
* 1、rowspan == 1 ,直接设置display为none,跳转到cellIndex+colSpan列继续处理
* 2、rowspan > 1 , 修改当前单元格的下一个单元格的display为"",
* 并将当前单元格的rowspan-1赋给下一个单元格的rowspan,当前单元格的colspan赋给下一个单元格的colspan,
* 然后隐藏当前单元格,跳转到cellIndex+colSpan列继续处理
*/
for (var currentCellIndex = 0; currentCellIndex < cells.length;) {
var currentNode = cells[currentCellIndex];
if (_isHide(currentNode)) {
var topNode = rows[currentNode.getAttribute('rootRowIndex')].cells[currentNode.getAttribute('rootCellIndex')];
topNode.rowSpan--;
currentCellIndex += topNode.colSpan;
} else {
if (currentNode.rowSpan == 1) {
currentCellIndex += currentNode.colSpan;
} else {
var downNode = rows[rowIndex + 1].cells[currentCellIndex];
downNode.style.display = "";
downNode.rowSpan = currentNode.rowSpan - 1;
downNode.colSpan = currentNode.colSpan;
currentCellIndex += currentNode.colSpan;
}
}
}
//完成更新后再删除外层包裹的tr
domUtils.remove(tr);
//重新定位焦点
var topRowTd, focusTd, downRowTd;
if (rowIndex == rows.length) { //如果被删除的行是最后一行,这里之所以没有-1是因为已经删除了一行
//如果删除的行也是第一行,那么表格总共只有一行,删除整个表格
if (rowIndex == 0) {
deleteTable(table,range);
return;
}
//如果上一单元格未隐藏,则直接定位,否则定位到最近的上一个非隐藏单元格
var preRowIndex = rowIndex - 1;
topRowTd = rows[preRowIndex].cells[ cellIndex];
focusTd = _isHide(topRowTd) ? rows[topRowTd.getAttribute('rootRowIndex')].cells[topRowTd.getAttribute('rootCellIndex')] : topRowTd;
} else { //如果被删除的不是最后一行,则光标定位到下一行,此处未加1是因为已经删除了一行
downRowTd = rows[rowIndex].cells[cellIndex];
focusTd = _isHide(downRowTd) ? rows[downRowTd.getAttribute('rootRowIndex')].cells[downRowTd.getAttribute('rootCellIndex')] : downRowTd;
}
}
range.setStart(focusTd, 0).setCursor();
update(table)
}
};
/**
* 删除列
*/
me.commands['deletecol'] = {
queryCommandState:function() {
if(this.highlight ){
return -1;
}
var range = this.selection.getRange(),
start = range.startContainer,
td = domUtils.findParentByTagName(start, ['td','th'], true);
if (!td && me.currentSelectedArr.length == 0)return -1;
},
execCommand:function() {
var range = this.selection.getRange(),
start = range.startContainer,
td = domUtils.findParentByTagName(start, ['td','th'], true);
if (td && me.currentSelectedArr.length == 0) {
var count = (td.colSpan || 1) - 1;
me.currentSelectedArr.push(td);
while (count) {
do{
td = td.nextSibling
} while (td.nodeType == 3);
me.currentSelectedArr.push(td);
count--;
}
}
while (td = me.currentSelectedArr.pop()) {
if (!domUtils.findParentByTagName(td, 'table')) { //|| _isHide(td)
continue;
}
var tr = td.parentNode,
table = tr.parentNode.parentNode,
cellIndex = getIndex(td),
rows = table.rows,
cells = tr.cells,
rowIndex = tr.rowIndex;
/*
* 从第一行开始扫描并隐藏当前列的所有单元格
* 若当前单元格的display为none,表明它是由左边Span过来的,
* 将左边第一个非none单元格的colSpan减去1并删去对应的单元格后跳转到rowIndex + rowspan行继续处理;
* 若当前单元格的display不为none,分两种情况,
* 1、当前单元格的colspan == 1 , 则直接删除该节点,跳转到rowIndex + rowspan行继续处理
* 2、当前单元格的colsapn > 1, 修改当前单元格右边单元格的display为"",
* 并将当前单元格的colspan-1赋给它的colspan,当前单元格的rolspan赋给它的rolspan,
* 然后删除当前单元格,跳转到rowIndex+rowSpan行继续处理
*/
var rowSpan;
for (var currentRowIndex = 0; currentRowIndex < rows.length;) {
var currentNode = rows[currentRowIndex].cells[cellIndex];
if (_isHide(currentNode)) {
var leftNode = rows[currentNode.getAttribute('rootRowIndex')].cells[currentNode.getAttribute('rootCellIndex')];
//依次删除对应的单元格
rowSpan = leftNode.rowSpan;
for (var i = 0; i < leftNode.rowSpan; i++) {
var delNode = rows[currentRowIndex + i].cells[cellIndex];
domUtils.remove(delNode);
}
//修正被删后的单元格信息
leftNode.colSpan--;
currentRowIndex += rowSpan;
} else {
if (currentNode.colSpan == 1) {
rowSpan = currentNode.rowSpan;
for (var i = currentRowIndex,l = currentRowIndex + currentNode.rowSpan; i < l; i++) {
domUtils.remove(rows[i].cells[cellIndex]);
}
currentRowIndex += rowSpan;
} else {
var rightNode = rows[currentRowIndex].cells[cellIndex + 1];
rightNode.style.display = "";
rightNode.rowSpan = currentNode.rowSpan;
rightNode.colSpan = currentNode.colSpan - 1;
currentRowIndex += currentNode.rowSpan;
domUtils.remove(currentNode);
}
}
}
//重新定位焦点
var preColTd, focusTd, nextColTd;
if (cellIndex == cells.length) { //如果当前列是最后一列,光标定位到当前列的前一列,同样,这里没有减去1是因为已经被删除了一列
//如果当前列也是第一列,则删除整个表格
if (cellIndex == 0) {
deleteTable(table,range);
return;
}
//找到当前单元格前一列中和本单元格最近的一个未隐藏单元格
var preCellIndex = cellIndex - 1;
preColTd = rows[rowIndex].cells[preCellIndex];
focusTd = _isHide(preColTd) ? rows[preColTd.getAttribute('rootRowIndex')].cells[preColTd.getAttribute('rootCellIndex')] : preColTd;
} else { //如果当前列不是最后一列,则光标定位到当前列的后一列
nextColTd = rows[rowIndex].cells[cellIndex];
focusTd = _isHide(nextColTd) ? rows[nextColTd.getAttribute('rootRowIndex')].cells[nextColTd.getAttribute('rootCellIndex')] : nextColTd;
}
}
range.setStart(focusTd, 0).setCursor();
update(table)
}
};
/**
* 完全拆分单元格
*/
me.commands['splittocells'] = {
queryCommandState:function() {
if(this.highlight ){
return -1;
}
var range = this.selection.getRange(),
start = range.startContainer,
td = domUtils.findParentByTagName(start, ['td','th'], true);
return td && ( td.rowSpan > 1 || td.colSpan > 1 ) && (!me.currentSelectedArr.length || getCount(me.currentSelectedArr) == 1) ? 0 : -1;
},
execCommand:function() {
var range = this.selection.getRange(),
start = range.startContainer,
td = domUtils.findParentByTagName(start, ['td','th'], true),
tr = td.parentNode,
table = tr.parentNode.parentNode;
var rowIndex = tr.rowIndex,
cellIndex = getIndex(td),
rowSpan = td.rowSpan,
colSpan = td.colSpan;
for (var i = 0; i < rowSpan; i++) {
for (var j = 0; j < colSpan; j++) {
var cell = table.rows[rowIndex + i].cells[cellIndex + j];
cell.rowSpan = 1;
cell.colSpan = 1;
if (_isHide(cell)) {
cell.style.display = "";
cell.innerHTML = browser.ie ? '' : "<br/>";
}
}
}
}
};
/**
* 将单元格拆分成行
*/
me.commands['splittorows'] = {
queryCommandState:function() {
if(this.highlight ){
return -1;
}
var range = this.selection.getRange(),
start = range.startContainer,
td = domUtils.findParentByTagName(start, 'td', true) || me.currentSelectedArr[0];
return td && ( td.rowSpan > 1) && (!me.currentSelectedArr.length || getCount(me.currentSelectedArr) == 1) ? 0 : -1;
},
execCommand:function() {
var range = this.selection.getRange(),
start = range.startContainer,
td = domUtils.findParentByTagName(start, 'td', true) || me.currentSelectedArr[0],
tr = td.parentNode,
rows = tr.parentNode.parentNode.rows;
var rowIndex = tr.rowIndex,
cellIndex = getIndex(td),
rowSpan = td.rowSpan,
colSpan = td.colSpan;
for (var i = 0; i < rowSpan; i++) {
var cells = rows[rowIndex + i],
cell = cells.cells[cellIndex];
cell.rowSpan = 1;
cell.colSpan = colSpan;
if (_isHide(cell)) {
cell.style.display = "";
//原有的内容要清除掉
cell.innerHTML = browser.ie ? '' : '<br/>'
}
//修正被隐藏单元格中存储的rootRowIndex和rootCellIndex信息
for (var j = cellIndex + 1; j < cellIndex + colSpan; j++) {
cell = cells.cells[j];
cell.setAttribute('rootRowIndex', rowIndex + i)
}
}
clearSelectedTd(me.currentSelectedArr);
this.selection.getRange().setStart(td, 0).setCursor();
}
};
/**
* 在表格前插入行
*/
me.commands['insertparagraphbeforetable'] = {
queryCommandState:function() {
if(this.highlight ){
return -1;
}
var range = this.selection.getRange(),
start = range.startContainer,
td = domUtils.findParentByTagName(start, 'td', true) || me.currentSelectedArr[0];
return td && domUtils.findParentByTagName(td, 'table') ? 0 : -1;
},
execCommand:function() {
var range = this.selection.getRange(),
start = range.startContainer,
table = domUtils.findParentByTagName(start, 'table', true);
start = me.document.createElement(me.options.enterTag);
table.parentNode.insertBefore(start, table);
clearSelectedTd(me.currentSelectedArr);
if (start.tagName == 'P') {
//trace:868
start.innerHTML = browser.ie ? '' : '<br/>';
range.setStart(start, 0)
} else {
range.setStartBefore(start)
}
range.setCursor();
}
};
/**
* 将单元格拆分成列
*/
me.commands['splittocols'] = {
queryCommandState:function() {
if(this.highlight ){
return -1;
}
var range = this.selection.getRange(),
start = range.startContainer,
td = domUtils.findParentByTagName(start, ['td','th'], true) || me.currentSelectedArr[0];
return td && ( td.colSpan > 1) && (!me.currentSelectedArr.length || getCount(me.currentSelectedArr) == 1) ? 0 : -1;
},
execCommand:function() {
var range = this.selection.getRange(),
start = range.startContainer,
td = domUtils.findParentByTagName(start, ['td','th'], true) || me.currentSelectedArr[0],
tr = td.parentNode,
rows = tr.parentNode.parentNode.rows;
var rowIndex = tr.rowIndex,
cellIndex = getIndex(td),
rowSpan = td.rowSpan,
colSpan = td.colSpan;
for (var i = 0; i < colSpan; i++) {
var cell = rows[rowIndex].cells[cellIndex + i];
cell.rowSpan = rowSpan;
cell.colSpan = 1;
if (_isHide(cell)) {
cell.style.display = "";
cell.innerHTML = browser.ie ? '' : '<br/>'
}
for (var j = rowIndex + 1; j < rowIndex + rowSpan; j++) {
var tmpCell = rows[j].cells[cellIndex + i];
tmpCell.setAttribute('rootCellIndex', cellIndex + i);
}
}
clearSelectedTd(me.currentSelectedArr);
this.selection.getRange().setStart(td, 0).setCursor();
}
};
/**
* 插入行
*/
me.commands['insertrow'] = {
queryCommandState:function() {
if(this.highlight ){
return -1;
}
var range = this.selection.getRange();
return domUtils.findParentByTagName(range.startContainer, 'table', true)
|| domUtils.findParentByTagName(range.endContainer, 'table', true) || me.currentSelectedArr.length != 0 ? 0 : -1;
},
execCommand:function() {
var range = this.selection.getRange(),
start = range.startContainer,
tr = domUtils.findParentByTagName(start, 'tr', true) || me.currentSelectedArr[0].parentNode,
table = tr.parentNode.parentNode,
rows = table.rows;
//记录插入位置原来所有的单元格
var rowIndex = tr.rowIndex,
cells = rows[rowIndex].cells;
//插入新的一行
var newRow = table.insertRow(rowIndex);
var newCell;
//遍历表格中待插入位置中的所有单元格,检查其状态,并据此修正新插入行的单元格状态
for (var cellIndex = 0; cellIndex < cells.length;) {
var tmpCell = cells[cellIndex];
if (_isHide(tmpCell)) { //如果当前单元格是隐藏的,表明当前单元格由其上部span过来,找到其上部单元格
//找到被隐藏单元格真正所属的单元格
var topCell = rows[tmpCell.getAttribute('rootRowIndex')].cells[tmpCell.getAttribute('rootCellIndex')];
//增加一行,并将所有新插入的单元格隐藏起来
topCell.rowSpan++;
for (var i = 0; i < topCell.colSpan; i++) {
newCell = tmpCell.cloneNode(false);
domUtils.removeAttributes(newCell,["bgColor","valign","align"]);
newCell.rowSpan = newCell.colSpan = 1;
newCell.innerHTML = browser.ie ? '' : "<br/>";
newCell.className = '';
if (newRow.children[cellIndex + i]) {
newRow.insertBefore(newCell, newRow.children[cellIndex + i]);
} else {
newRow.appendChild(newCell)
}
newCell.style.display = "none";
}
cellIndex += topCell.colSpan;
} else {//若当前单元格未隐藏,则在其上行插入colspan个单元格
for (var j = 0; j < tmpCell.colSpan; j++) {
newCell = tmpCell.cloneNode(false);
domUtils.removeAttributes(newCell,["bgColor","valign","align"]);
newCell.rowSpan = newCell.colSpan = 1;
newCell.innerHTML = browser.ie ? '' : "<br/>";
newCell.className = '';
if (newRow.children[cellIndex + j]) {
newRow.insertBefore(newCell, newRow.children[cellIndex + j]);
} else {
newRow.appendChild(newCell)
}
}
cellIndex += tmpCell.colSpan;
}
}
update(table);
range.setStart(newRow.cells[0], 0).setCursor();
clearSelectedTd(me.currentSelectedArr);
}
};
/**
* 插入列
*/
me.commands['insertcol'] = {
queryCommandState:function() {
if(this.highlight ){
return -1;
}
var range = this.selection.getRange();
return domUtils.findParentByTagName(range.startContainer, 'table', true)
|| domUtils.findParentByTagName(range.endContainer, 'table', true) || me.currentSelectedArr.length != 0 ? 0 : -1;
},
execCommand:function() {
var range = this.selection.getRange(),
start = range.startContainer,
td = domUtils.findParentByTagName(start, ['td','th'], true) || me.currentSelectedArr[0],
table = domUtils.findParentByTagName(td, 'table'),
rows = table.rows;
var cellIndex = getIndex(td),
newCell;
//遍历当前列中的所有单元格,检查其状态,并据此修正新插入列的单元格状态
for (var rowIndex = 0; rowIndex < rows.length;) {
var tmpCell = rows[rowIndex].cells[cellIndex],tr;
if (_isHide(tmpCell)) {//如果当前单元格是隐藏的,表明当前单元格由其左边span过来,找到其左边单元格
var leftCell = rows[tmpCell.getAttribute('rootRowIndex')].cells[tmpCell.getAttribute('rootCellIndex')];
leftCell.colSpan++;
for (var i = 0; i < leftCell.rowSpan; i++) {
newCell = td.cloneNode(false);
domUtils.removeAttributes(newCell,["bgColor","valign","align"]);
newCell.rowSpan = newCell.colSpan = 1;
newCell.innerHTML = browser.ie ? '' : "<br/>";
newCell.className = '';
tr = rows[rowIndex + i];
if (tr.children[cellIndex]) {
tr.insertBefore(newCell, tr.children[cellIndex]);
} else {
tr.appendChild(newCell)
}
newCell.style.display = "none";
}
rowIndex += leftCell.rowSpan;
} else { //若当前单元格未隐藏,则在其左边插入rowspan个单元格
for (var j = 0; j < tmpCell.rowSpan; j++) {
newCell = td.cloneNode(false);
domUtils.removeAttributes(newCell,["bgColor","valign","align"]);
newCell.rowSpan = newCell.colSpan = 1;
newCell.innerHTML = browser.ie ? '' : "<br/>";
newCell.className = '';
tr = rows[rowIndex + j];
if (tr.children[cellIndex]) {
tr.insertBefore(newCell, tr.children[cellIndex]);
} else {
tr.appendChild(newCell)
}
newCell.innerHTML = browser.ie ? '' : "<br/>";
}
rowIndex += tmpCell.rowSpan;
}
}
update(table);
range.setStart(rows[0].cells[cellIndex], 0).setCursor();
clearSelectedTd(me.currentSelectedArr);
}
};
/**
* 合并多个单元格,通过两个cell将当前包含的所有横纵单元格进行合并
*/
me.commands['mergecells'] = {
queryCommandState:function() {
if(this.highlight ){
return -1;
}
var count = 0;
for (var i = 0,ti; ti = this.currentSelectedArr[i++];) {
if (!_isHide(ti))
count++;
}
return count > 1 ? 0 : -1;
},
execCommand:function() {
var start = me.currentSelectedArr[0],
end = me.currentSelectedArr[me.currentSelectedArr.length - 1],
table = domUtils.findParentByTagName(start, 'table'),
rows = table.rows,
cellsRange = {
beginRowIndex:start.parentNode.rowIndex,
beginCellIndex:getIndex(start),
endRowIndex:end.parentNode.rowIndex,
endCellIndex:getIndex(end)
},
beginRowIndex = cellsRange.beginRowIndex,
beginCellIndex = cellsRange.beginCellIndex,
rowsLength = cellsRange.endRowIndex - cellsRange.beginRowIndex + 1,
cellLength = cellsRange.endCellIndex - cellsRange.beginCellIndex + 1,
tmp = rows[beginRowIndex].cells[beginCellIndex];
for (var i = 0, ri; (ri = rows[beginRowIndex + i++]) && i <= rowsLength;) {
for (var j = 0, ci; (ci = ri.cells[beginCellIndex + j++]) && j <= cellLength;) {
if (i == 1 && j == 1) {
ci.style.display = "";
ci.rowSpan = rowsLength;
ci.colSpan = cellLength;
} else {
ci.style.display = "none";
ci.rowSpan = 1;
ci.colSpan = 1;
ci.setAttribute('rootRowIndex', beginRowIndex);
ci.setAttribute('rootCellIndex', beginCellIndex);
//传递内容
_moveContent(tmp, ci);
}
}
}
this.selection.getRange().setStart(tmp, 0).setCursor();
//处理有寛高,导致ie的文字不能输入占满
browser.ie && domUtils.removeAttributes(tmp,['width','height']);
clearSelectedTd(me.currentSelectedArr);
}
};
/**
* 将cellFrom单元格中的内容移动到cellTo中
* @param cellTo 目标单元格
* @param cellFrom 源单元格
*/
function _moveContent(cellTo, cellFrom) {
if (_isEmpty(cellFrom)) return;
if (_isEmpty(cellTo)) {
cellTo.innerHTML = cellFrom.innerHTML;
return;
}
var child = cellTo.lastChild;
if (child.nodeType != 1 || child.tagName != 'BR') {
cellTo.appendChild(cellTo.ownerDocument.createElement('br'))
}
//依次移动内容
while (child = cellFrom.firstChild) {
cellTo.appendChild(child);
}
}
/**
* 根据两个单元格来获取中间包含的所有单元格集合选区
* @param cellA
* @param cellB
* @return {Object} 选区的左上和右下坐标
*/
function _getCellsRange(cellA, cellB) {
var trA = cellA.parentNode,
trB = cellB.parentNode,
aRowIndex = trA.rowIndex,
bRowIndex = trB.rowIndex,
rows = trA.parentNode.parentNode.rows,
rowsNum = rows.length,
cellsNum = rows[0].cells.length,
cellAIndex = getIndex(cellA),
cellBIndex = getIndex(cellB);
if (cellA == cellB) {
return {
beginRowIndex: aRowIndex,
beginCellIndex: cellAIndex,
endRowIndex: aRowIndex + cellA.rowSpan - 1,
endCellIndex: cellBIndex + cellA.colSpan - 1
}
}
var
beginRowIndex = Math.min(aRowIndex, bRowIndex),
beginCellIndex = Math.min(cellAIndex, cellBIndex),
endRowIndex = Math.max(aRowIndex + cellA.rowSpan - 1, bRowIndex + cellB.rowSpan - 1),
endCellIndex = Math.max(cellAIndex + cellA.colSpan - 1, cellBIndex + cellB.colSpan - 1);
while (1) {
var tmpBeginRowIndex = beginRowIndex,
tmpBeginCellIndex = beginCellIndex,
tmpEndRowIndex = endRowIndex,
tmpEndCellIndex = endCellIndex;
// 检查是否有超出TableRange上边界的情况
if (beginRowIndex > 0) {
for (cellIndex = beginCellIndex; cellIndex <= endCellIndex;) {
var currentTopTd = rows[beginRowIndex].cells[cellIndex];
if (_isHide(currentTopTd)) {
//overflowRowIndex = beginRowIndex == currentTopTd.rootRowIndex ? 1:0;
beginRowIndex = currentTopTd.getAttribute('rootRowIndex');
currentTopTd = rows[currentTopTd.getAttribute('rootRowIndex')].cells[currentTopTd.getAttribute('rootCellIndex')];
}
cellIndex = getIndex(currentTopTd) + (currentTopTd.colSpan || 1);
}
}
//检查是否有超出左边界的情况
if (beginCellIndex > 0) {
for (var rowIndex = beginRowIndex; rowIndex <= endRowIndex;) {
var currentLeftTd = rows[rowIndex].cells[beginCellIndex];
if (_isHide(currentLeftTd)) {
// overflowCellIndex = beginCellIndex== currentLeftTd.rootCellIndex ? 1:0;
beginCellIndex = currentLeftTd.getAttribute('rootCellIndex');
currentLeftTd = rows[currentLeftTd.getAttribute('rootRowIndex')].cells[currentLeftTd.getAttribute('rootCellIndex')];
}
rowIndex = currentLeftTd.parentNode.rowIndex + (currentLeftTd.rowSpan || 1);
}
}
// 检查是否有超出TableRange下边界的情况
if (endRowIndex < rowsNum) {
for (var cellIndex = beginCellIndex; cellIndex <= endCellIndex;) {
var currentDownTd = rows[endRowIndex].cells[cellIndex];
if (_isHide(currentDownTd)) {
currentDownTd = rows[currentDownTd.getAttribute('rootRowIndex')].cells[currentDownTd.getAttribute('rootCellIndex')];
}
endRowIndex = currentDownTd.parentNode.rowIndex + currentDownTd.rowSpan - 1;
cellIndex = getIndex(currentDownTd) + (currentDownTd.colSpan || 1);
}
}
//检查是否有超出右边界的情况
if (endCellIndex < cellsNum) {
for (rowIndex = beginRowIndex; rowIndex <= endRowIndex;) {
var currentRightTd = rows[rowIndex].cells[endCellIndex];
if (_isHide(currentRightTd)) {
currentRightTd = rows[currentRightTd.getAttribute('rootRowIndex')].cells[currentRightTd.getAttribute('rootCellIndex')];
}
endCellIndex = getIndex(currentRightTd) + currentRightTd.colSpan - 1;
rowIndex = currentRightTd.parentNode.rowIndex + (currentRightTd.rowSpan || 1);
}
}
if (tmpBeginCellIndex == beginCellIndex && tmpEndCellIndex == endCellIndex && tmpEndRowIndex == endRowIndex && tmpBeginRowIndex == beginRowIndex) {
break;
}
}
//返回选区的起始和结束坐标
return {
beginRowIndex: beginRowIndex,
beginCellIndex: beginCellIndex,
endRowIndex: endRowIndex,
endCellIndex: endCellIndex
}
}
/**
* 鼠标按下事件
* @param type
* @param evt
*/
function _mouseDownEvent(type, evt) {
anchorTd = evt.target || evt.srcElement;
if(me.queryCommandState('highlightcode')||domUtils.findParent(anchorTd,function(node){
return node.tagName == "DIV"&&/highlighter/.test(node.id);
})){
return;
}
if (evt.button == 2)return;
me.document.body.style.webkitUserSelect = '';
clearSelectedTd(me.currentSelectedArr);
domUtils.clearSelectedArr(me.currentSelectedArr);
//在td里边点击,anchorTd不是td
if (anchorTd.tagName !== 'TD') {
anchorTd = domUtils.findParentByTagName(anchorTd, 'td') || anchorTd;
}
if (anchorTd.tagName == 'TD') {
me.addListener('mouseover', function(type, evt) {
var tmpTd = evt.target || evt.srcElement;
_mouseOverEvent.call(me, tmpTd);
evt.preventDefault ? evt.preventDefault() : (evt.returnValue = false);
});
} else {
reset();
}
}
/**
* 鼠标移动事件
* @param tmpTd
*/
function _mouseOverEvent(tmpTd) {
if (anchorTd && tmpTd.tagName == "TD") {
me.document.body.style.webkitUserSelect = 'none';
var table = tmpTd.parentNode.parentNode.parentNode;
me.selection.getNative()[browser.ie ? 'empty' : 'removeAllRanges']();
var range = _getCellsRange(anchorTd, tmpTd);
_toggleSelect(table, range);
}
}
/**
* 切换选区状态
* @param table
* @param cellsRange
*/
function _toggleSelect(table, cellsRange) {
var rows = table.rows;
clearSelectedTd(me.currentSelectedArr);
for (var i = cellsRange.beginRowIndex; i <= cellsRange.endRowIndex; i++) {
for (var j = cellsRange.beginCellIndex; j <= cellsRange.endCellIndex; j++) {
var td = rows[i].cells[j];
td.className = me.options.selectedTdClass;
me.currentSelectedArr.push(td);
}
}
}
//更新rootRowIndxe,rootCellIndex
function update(table) {
var tds = table.getElementsByTagName('td'),
rowIndex,cellIndex,rows = table.rows;
for (var j = 0,tj; tj = tds[j++];) {
if (!_isHide(tj)) {
rowIndex = tj.parentNode.rowIndex;
cellIndex = getIndex(tj);
for (var r = 0; r < tj.rowSpan; r++) {
var c = r == 0 ? 1 : 0;
for (; c < tj.colSpan; c++) {
var tmp = rows[rowIndex + r].children[cellIndex + c];
tmp.setAttribute('rootRowIndex', rowIndex);
tmp.setAttribute('rootCellIndex', cellIndex);
}
}
}
if(!_isHide(tj)){
domUtils.removeAttributes(tj,['rootRowIndex','rootCellIndex']);
}
if(tj.colSpan && tj.colSpan == 1){
tj.removeAttribute('colSpan')
}
if(tj.rowSpan && tj.rowSpan == 1){
tj.removeAttribute('rowSpan')
}
var width;
if(!_isHide(tj) && (width = tj.style.width) && /%/.test(width)){
tj.style.width = Math.floor(100/tj.parentNode.cells.length) + '%'
}
}
}
me.adjustTable = function(cont) {
var table = cont.getElementsByTagName('table');
for (var i = 0,ti; ti = table[i++];) {
//如果表格的align不是默认,将不占位,给后边的block元素设置clear:both
if (ti.getAttribute('align')) {
var next = ti.nextSibling;
while(next){
if(domUtils.isBlockElm(next)){
break;
}
next = next.nextSibling;
}
if(next){
next.style.clear = 'both';
}
}
ti.removeAttribute('_innerCreateTable')
var tds = domUtils.getElementsByTagName(ti, 'td'),
td,tmpTd;
for (var j = 0,tj; tj = tds[j++];) {
if (domUtils.isEmptyNode(tj)) {
tj.innerHTML = browser.ie ? domUtils.fillChar : '<br/>';
}
var index = getIndex(tj),
rowIndex = tj.parentNode.rowIndex,
rows = domUtils.findParentByTagName(tj, 'table').rows;
for (var r = 0; r < tj.rowSpan; r++) {
var c = r == 0 ? 1 : 0;
for (; c < tj.colSpan; c++) {
if (!td) {
td = tj.cloneNode(false);
td.rowSpan = td.colSpan = 1;
td.style.display = 'none';
td.innerHTML = browser.ie ? '' : '<br/>';
} else {
td = td.cloneNode(true)
}
td.setAttribute('rootRowIndex', tj.parentNode.rowIndex);
td.setAttribute('rootCellIndex', index);
if (r == 0) {
if (tj.nextSibling) {
tj.parentNode.insertBefore(td, tj.nextSibling);
} else {
tj.parentNode.appendChild(td)
}
} else {
tmpTd = rows[rowIndex + r].children[index];
if (tmpTd) {
tmpTd.parentNode.insertBefore(td, tmpTd)
} else {
//trace:1032
rows[rowIndex + r].appendChild(td)
}
}
}
}
}
}
me.fireEvent("afteradjusttable",cont);
};
// me.addListener('beforegetcontent',function(){
// for(var i=0,ti,ts=me.document.getElementsByTagName('table');ti=ts[i++];){
// var pN = ti.parentNode;
// if(pN && pN.getAttribute('dropdrag')){
// domUtils.remove(pN,true)
// }
// }
// });
//
// me.addListener('aftergetcontent',function(){
// if(!me.queryCommandState('source'))
// me.fireEvent('afteradjusttable',me.document)
// });
// //table拖拽
// me.addListener("afteradjusttable",function(type,cont){
// var table = cont.getElementsByTagName("table"),
// dragCont = me.document.createElement("div");
// domUtils.setAttributes(dragCont,{
// style:'margin:0;padding:5px;border:0;',
// dropdrag:true
// });
// for (var i = 0,ti; ti = table[i++];) {
// if(ti.parentNode && ti.parentNode.nodeType == 1){
//
//
// (function(ti){
// var div = dragCont.cloneNode(false);
// ti.parentNode.insertBefore(div,ti);
// div.appendChild(ti);
// var borderStyle;
// domUtils.on(div,'mousemove',function(evt){
// var tag = evt.srcElement || evt.target;
// if(tag.tagName.toLowerCase()=="div"){
// if(ie && me.body.getAttribute("contentEditable") == 'true')
// me.body.setAttribute("contentEditable","false");
// borderStyle = clickPosition(ti,this,evt)
//
// }
// });
// if(ie){
// domUtils.on(div,'mouseleave',function(evt){
//
// if(evt.srcElement.tagName.toLowerCase()=="div" && ie && me.body.getAttribute("contentEditable") == 'false'){
//
// me.body.setAttribute("contentEditable","true");
// }
//
//
// });
// }
//
// domUtils.on(div,"mousedown",function(evt){
// var tag = evt.srcElement || evt.target;
//
// if(tag.tagName.toLowerCase()=="div"){
// if(ie && me.body.getAttribute("contentEditable") == 'true')
// me.body.setAttribute("contentEditable","false");
// var tWidth = ti.offsetWidth,
// tHeight = ti.offsetHeight,
// align = ti.getAttribute('align');
//
//
// try{
// baidu.editor.ui.uiUtils.startDrag(evt, {
// ondragstart:function(){},
// ondragmove: function (x, y){
//
// if(align && align!="left" && /\w?w-/.test(borderStyle)){
// x = -x;
// }
// if(/^s?[we]/.test(borderStyle)){
// ti.setAttribute("width",(tWidth+x)>0?tWidth+x: 0);
// }
// if(/^s/.test(borderStyle)){
// ti.setAttribute("height",(tHeight+y)>0?tHeight+y:0);
// }
// },
// ondragstop: function (){}
// },me.document);
// }catch(e){
// alert("您没有引入uiUtils,无法拖动table");
// }
//
// }
// });
//
// domUtils.on(ti,"mouseover",function(){
// var div = ti.parentNode;
// if(div && div.parentNode && div.getAttribute('dropdrag')){
// domUtils.setStyle(div,"cursor","text");
// if(ie && me.body.getAttribute("contentEditable") == 'false')
// me.body.setAttribute("contentEditable","true");
// }
//
//
// });
// })(ti);
//
// }
// }
// });
// function clickPosition(table,div,evt){
// var pos = domUtils.getXY(table),
// tWidth = table.offsetWidth,
// tHeight = table.offsetHeight,
// evtPos = {
// top : evt.clientY,
// left : evt.clientX
// },
// borderStyle = "";
//
// if(Math.abs(pos.x-evtPos.left)<15){
//
// //左,左下
// borderStyle = Math.abs(evtPos.top-pos.y-tHeight)<15 ? "sw-resize" : "w-resize";
// }else if(Math.abs(evtPos.left-pos.x-tWidth)<15){
// //右,右下
// borderStyle = Math.abs(evtPos.top-pos.y-tHeight)<15 ? "se-resize" : "e-resize";
// }else if(Math.abs(evtPos.top-pos.y-tHeight)<15 && Math.abs(evtPos.left-pos.x)<tWidth){
// //下
// borderStyle = "s-resize";
// }
// domUtils.setStyle(div,"cursor",borderStyle||'text');
// return borderStyle;
// }
};
///import core
///commands 右键菜单
///commandsName ContextMenu
///commandsTitle 右键菜单
/**
* 右键菜单
* @function
* @name baidu.editor.plugins.contextmenu
* @author zhanyi
*/
UE.plugins['contextmenu'] = function () {
var me = this,
menu,
items = me.options.contextMenu;
if(!items || items.length==0) return;
var uiUtils = UE.ui.uiUtils;
me.addListener('contextmenu',function(type,evt){
var offset = uiUtils.getViewportOffsetByEvent(evt);
me.fireEvent('beforeselectionchange');
if (menu)
menu.destroy();
for (var i = 0,ti,contextItems = []; ti = items[i]; i++) {
var last;
(function(item) {
if (item == '-') {
if ((last = contextItems[contextItems.length - 1 ] ) && last !== '-')
contextItems.push('-');
} else if (item.group) {
for (var j = 0,cj,subMenu = []; cj = item.subMenu[j]; j++) {
(function(subItem) {
if (subItem == '-') {
if ((last = subMenu[subMenu.length - 1 ] ) && last !== '-')
subMenu.push('-');
} else {
if (me.queryCommandState(subItem.cmdName) != -1) {
subMenu.push({
'label':subItem.label,
className: 'edui-for-' + subItem.cmdName + (subItem.value || ''),
onclick : subItem.exec ? function() {
subItem.exec.call(me)
} : function() {
me.execCommand(subItem.cmdName, subItem.value)
}
})
}
}
})(cj)
}
if (subMenu.length) {
contextItems.push({
'label' : item.group,
className: 'edui-for-' + item.icon,
'subMenu' : {
items: subMenu,
editor:me
}
})
}
} else {
if (me.queryCommandState(item.cmdName) != -1) {
//highlight todo
if(item.cmdName == 'highlightcode' && me.queryCommandState(item.cmdName) == 0)
return;
contextItems.push({
'label':item.label,
className: 'edui-for-' + (item.icon ? item.icon : item.cmdName + (item.value || '')),
onclick : item.exec ? function() {
item.exec.call(me)
} : function() {
me.execCommand(item.cmdName, item.value)
}
})
}
}
})(ti)
}
if (contextItems[contextItems.length - 1] == '-')
contextItems.pop();
menu = new UE.ui.Menu({
items: contextItems,
editor:me
});
menu.render();
menu.showAt(offset);
domUtils.preventDefault(evt);
if(browser.ie){
var ieRange;
try{
ieRange = me.selection.getNative().createRange();
}catch(e){
return;
}
if(ieRange.item){
var range = new dom.Range(me.document);
range.selectNode(ieRange.item(0)).select(true,true);
}
}
})
};
///import core
///commands 加粗,斜体,上标,下标
///commandsName Bold,Italic,Subscript,Superscript
///commandsTitle 加粗,加斜,下标,上标
/**
* b u i等基础功能实现
* @function
* @name baidu.editor.execCommands
* @param {String} cmdName bold加粗。italic斜体。subscript上标。superscript下标。
*/
UE.plugins['basestyle'] = function(){
var basestyles = {
'bold':['strong','b'],
'italic':['em','i'],
'subscript':['sub'],
'superscript':['sup']
},
getObj = function(editor,tagNames){
//var start = editor.selection.getStart();
var path = editor.selection.getStartElementPath();
// return domUtils.findParentByTagName( start, tagNames, true )
return utils.findNode(path,tagNames);
},
me = this;
for ( var style in basestyles ) {
(function( cmd, tagNames ) {
me.commands[cmd] = {
execCommand : function( cmdName ) {
var range = new dom.Range(me.document),obj = '';
//table的处理
if(me.currentSelectedArr && me.currentSelectedArr.length > 0){
for(var i=0,ci;ci=me.currentSelectedArr[i++];){
if(ci.style.display != 'none'){
range.selectNodeContents(ci).select();
//trace:943
!obj && (obj = getObj(this,tagNames));
if(cmdName == 'superscript' || cmdName == 'subscript'){
if(!obj || obj.tagName.toLowerCase() != cmdName)
range.removeInlineStyle(['sub','sup'])
}
obj ? range.removeInlineStyle( tagNames ) : range.applyInlineStyle( tagNames[0] )
}
}
range.selectNodeContents(me.currentSelectedArr[0]).select();
}else{
range = me.selection.getRange();
obj = getObj(this,tagNames);
if ( range.collapsed ) {
if ( obj ) {
var tmpText = me.document.createTextNode('');
range.insertNode( tmpText ).removeInlineStyle( tagNames );
range.setStartBefore(tmpText);
domUtils.remove(tmpText);
} else {
var tmpNode = range.document.createElement( tagNames[0] );
if(cmdName == 'superscript' || cmdName == 'subscript'){
tmpText = me.document.createTextNode('');
range.insertNode(tmpText)
.removeInlineStyle(['sub','sup'])
.setStartBefore(tmpText)
.collapse(true);
}
range.insertNode( tmpNode ).setStart( tmpNode, 0 );
}
range.collapse( true )
} else {
if(cmdName == 'superscript' || cmdName == 'subscript'){
if(!obj || obj.tagName.toLowerCase() != cmdName)
range.removeInlineStyle(['sub','sup'])
}
obj ? range.removeInlineStyle( tagNames ) : range.applyInlineStyle( tagNames[0] )
}
range.select();
}
return true;
},
queryCommandState : function() {
if(this.highlight){
return -1;
}
return getObj(this,tagNames) ? 1 : 0;
}
}
})( style, basestyles[style] );
}
};
///import core
///commands 选区路径
///commandsName ElementPath,elementPathEnabled
///commandsTitle 选区路径
/**
* 选区路径
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName elementpath选区路径
*/
UE.plugins['elementpath'] = function(){
var currentLevel,
tagNames,
me = this;
me.commands['elementpath'] = {
execCommand : function( cmdName, level ) {
var start = tagNames[level],
range = me.selection.getRange();
me.currentSelectedArr && domUtils.clearSelectedArr(me.currentSelectedArr);
currentLevel = level*1;
if(dtd.$tableContent[start.tagName]){
switch (start.tagName){
case 'TD':me.currentSelectedArr = [start];
start.className = me.options.selectedTdClass;
break;
case 'TR':
var cells = start.cells;
for(var i=0,ti;ti=cells[i++];){
me.currentSelectedArr.push(ti);
ti.className = me.options.selectedTdClass;
}
break;
case 'TABLE':
case 'TBODY':
var rows = start.rows;
for(var i=0,ri;ri=rows[i++];){
cells = ri.cells;
for(var j=0,tj;tj=cells[j++];){
me.currentSelectedArr.push(tj);
tj.className = me.options.selectedTdClass;
}
}
}
start = me.currentSelectedArr[0];
if(domUtils.isEmptyNode(start)){
range.setStart(start,0).setCursor()
}else{
range.selectNodeContents(start).select()
}
}else{
range.selectNode(start).select()
}
},
queryCommandValue : function() {
//产生一个副本,不能修改原来的startElementPath;
var parents = [].concat(this.selection.getStartElementPath()).reverse(),
names = [];
tagNames = parents;
for(var i=0,ci;ci=parents[i];i++){
if(ci.nodeType == 3) continue;
var name = ci.tagName.toLowerCase();
if(name == 'img' && ci.getAttribute('anchorname')){
name = 'anchor'
}
names[i] = name;
if(currentLevel == i){
currentLevel = -1;
break;
}
}
return names;
}
}
};
///import core
///import plugins\removeformat.js
///commands 格式刷
///commandsName FormatMatch
///commandsTitle 格式刷
/**
* 格式刷,只格式inline的
* @function
* @name baidu.editor.execCommand
* @param {String} cmdName formatmatch执行格式刷
*/
UE.plugins['formatmatch'] = function(){
var me = this,
list = [],img,
flag = 0;
me.addListener('reset',function(){
list = [];
flag = 0;
});
function addList(type,evt){
if(browser.webkit){
var target = evt.target.tagName == 'IMG' ? evt.target : null;
}
function addFormat(range){
if(text && (!me.currentSelectedArr || !me.currentSelectedArr.length)){
range.selectNode(text);
}
return range.applyInlineStyle(list[list.length-1].tagName,null,list);
}
me.undoManger && me.undoManger.save();
var range = me.selection.getRange(),
imgT = target || range.getClosedNode();
if(img && imgT && imgT.tagName == 'IMG'){
//trace:964
imgT.style.cssText += ';float:' + (img.style.cssFloat || img.style.styleFloat ||'none') + ';display:' + (img.style.display||'inline');
img = null;
}else{
if(!img){
var collapsed = range.collapsed;
if(collapsed){
var text = me.document.createTextNode('match');
range.insertNode(text).select();
}
me.__hasEnterExecCommand = true;
//不能把block上的属性干掉
//trace:1553
var removeFormatAttributes = me.options.removeFormatAttributes;
me.options.removeFormatAttributes = '';
me.execCommand('removeformat');
me.options.removeFormatAttributes = removeFormatAttributes;
me.__hasEnterExecCommand = false;
//trace:969
range = me.selection.getRange();
if(list.length == 0){
if(me.currentSelectedArr && me.currentSelectedArr.length > 0){
range.selectNodeContents(me.currentSelectedArr[0]).select();
}
}else{
if(me.currentSelectedArr && me.currentSelectedArr.length > 0){
for(var i=0,ci;ci=me.currentSelectedArr[i++];){
range.selectNodeContents(ci);
addFormat(range);
}
range.selectNodeContents(me.currentSelectedArr[0]).select();
}else{
addFormat(range)
}
}
if(!me.currentSelectedArr || !me.currentSelectedArr.length){
if(text){
range.setStartBefore(text).collapse(true);
}
range.select()
}
text && domUtils.remove(text);
}
}
me.undoManger && me.undoManger.save();
me.removeListener('mouseup',addList);
flag = 0;
}
me.commands['formatmatch'] = {
execCommand : function( cmdName ) {
if(flag){
flag = 0;
list = [];
me.removeListener('mouseup',addList);
return;
}
var range = me.selection.getRange();
img = range.getClosedNode();
if(!img || img.tagName != 'IMG'){
range.collapse(true).shrinkBoundary();
var start = range.startContainer;
list = domUtils.findParents(start,true,function(node){
return !domUtils.isBlockElm(node) && node.nodeType == 1
});
//a不能加入格式刷, 并且克隆节点
for(var i=0,ci;ci=list[i];i++){
if(ci.tagName == 'A'){
list.splice(i,1);
break;
}
}
}
me.addListener('mouseup',addList);
flag = 1;
},
queryCommandState : function() {
if(this.highlight){
return -1;
}
return flag;
},
notNeedUndo : 1
}
};
///import core
///commands 查找替换
///commandsName SearchReplace
///commandsTitle 查询替换
///commandsDialog dialogs\searchreplace\searchreplace.html
/**
* @description 查找替换
* @author zhanyi
*/
UE.plugins['searchreplace'] = function(){
var currentRange,
first,
me = this;
me.addListener('reset',function(){
currentRange = null;
first = null;
});
me.commands['searchreplace'] = {
execCommand : function(cmdName,opt){
var me = this,
sel = me.selection,
range,
nativeRange,
num = 0,
opt = utils.extend(opt,{
all : false,
casesensitive : false,
dir : 1
},true);
if(browser.ie){
while(1){
var tmpRange;
nativeRange = me.document.selection.createRange();
tmpRange = nativeRange.duplicate();
tmpRange.moveToElementText(me.document.body);
if(opt.all){
first = 0;
opt.dir = 1;
if(currentRange){
tmpRange.setEndPoint(opt.dir == -1 ? 'EndToStart' : 'StartToEnd',currentRange)
}
}else{
tmpRange.setEndPoint(opt.dir == -1 ? 'EndToStart' : 'StartToEnd',nativeRange);
if(opt.hasOwnProperty("replaceStr")){
tmpRange.setEndPoint(opt.dir == -1 ? 'StartToEnd' : 'EndToStart',nativeRange);
}
}
nativeRange = tmpRange.duplicate();
if(!tmpRange.findText(opt.searchStr,opt.dir,opt.casesensitive ? 4 : 0)){
currentRange = null;
tmpRange = me.document.selection.createRange();
tmpRange.scrollIntoView();
return num;
}
tmpRange.select();
//替换
if(opt.hasOwnProperty("replaceStr")){
range = sel.getRange();
range.deleteContents().insertNode(range.document.createTextNode(opt.replaceStr)).select();
currentRange = sel.getNative().createRange();
}
num++;
if(!opt.all)break;
}
}else{
var w = me.window,nativeSel = sel.getNative(),tmpRange;
while(1){
if(opt.all){
if(currentRange){
currentRange.collapse(false);
nativeRange = currentRange;
}else{
nativeRange = me.document.createRange();
nativeRange.setStart(me.document.body,0);
}
nativeSel.removeAllRanges();
nativeSel.addRange( nativeRange );
first = 0;
opt.dir = 1;
}else{
nativeRange = w.getSelection().getRangeAt(0);
if(opt.hasOwnProperty("replaceStr")){
nativeRange.collapse(opt.dir == 1 ? true : false);
}
}
//如果是第一次并且海选中了内容那就要清除,为find做准备
if(!first){
nativeRange.collapse( opt.dir <0 ? true : false);
nativeSel.removeAllRanges();
nativeSel.addRange( nativeRange );
}else{
nativeSel.removeAllRanges();
}
if(!w.find(opt.searchStr,opt.casesensitive,opt.dir < 0 ? true : false) ) {
currentRange = null;
nativeSel.removeAllRanges();
return num;
}
first = 0;
range = w.getSelection().getRangeAt(0);
if(!range.collapsed){
if(opt.hasOwnProperty("replaceStr")){
range.deleteContents();
var text = w.document.createTextNode(opt.replaceStr);
range.insertNode(text);
range.selectNode(text);
nativeSel.addRange(range);
currentRange = range.cloneRange();
}
}
num++;
if(!opt.all)break;
}
}
return true;
}
}
};
///import core
///commands 自定义样式
///commandsName CustomStyle
///commandsTitle 自定义样式
UE.plugins['customstyle'] = function() {
var me = this;
me.commands['customstyle'] = {
execCommand : function(cmdName, obj) {
var me = this,
tagName = obj.tag,
node = domUtils.findParent(me.selection.getStart(), function(node) {
return node.getAttribute('label')
}, true),
range,bk,tmpObj = {};
for (var p in obj) {
tmpObj[p] = obj[p]
}
delete tmpObj.tag;
if (node && node.getAttribute('label') == obj.label) {
range = this.selection.getRange();
bk = range.createBookmark();
if (range.collapsed) {
//trace:1732 删掉自定义标签,要有p来回填站位
if(dtd.$block[node.tagName]){
var fillNode = me.document.createElement('p');
domUtils.moveChild(node, fillNode);
node.parentNode.insertBefore(fillNode, node);
domUtils.remove(node)
}else{
domUtils.remove(node,true)
}
} else {
var common = domUtils.getCommonAncestor(bk.start, bk.end),
nodes = domUtils.getElementsByTagName(common, tagName);
if(new RegExp(tagName,'i').test(common.tagName)){
nodes.push(common);
}
for (var i = 0,ni; ni = nodes[i++];) {
if (ni.getAttribute('label') == obj.label) {
var ps = domUtils.getPosition(ni, bk.start),pe = domUtils.getPosition(ni, bk.end);
if ((ps & domUtils.POSITION_FOLLOWING || ps & domUtils.POSITION_CONTAINS)
&&
(pe & domUtils.POSITION_PRECEDING || pe & domUtils.POSITION_CONTAINS)
)
if (dtd.$block[tagName]) {
var fillNode = me.document.createElement('p');
domUtils.moveChild(ni, fillNode);
ni.parentNode.insertBefore(fillNode, ni);
}
domUtils.remove(ni, true)
}
}
node = domUtils.findParent(common, function(node) {
return node.getAttribute('label') == obj.label
}, true);
if (node) {
domUtils.remove(node, true)
}
}
range.moveToBookmark(bk).select();
} else {
if (dtd.$block[tagName]) {
this.execCommand('paragraph', tagName, tmpObj,'customstyle');
range = me.selection.getRange();
if (!range.collapsed) {
range.collapse();
node = domUtils.findParent(me.selection.getStart(), function(node) {
return node.getAttribute('label') == obj.label
}, true);
var pNode = me.document.createElement('p');
domUtils.insertAfter(node, pNode);
domUtils.fillNode(me.document, pNode);
range.setStart(pNode, 0).setCursor()
}
} else {
range = me.selection.getRange();
if (range.collapsed) {
node = me.document.createElement(tagName);
domUtils.setAttributes(node, tmpObj);
range.insertNode(node).setStart(node, 0).setCursor();
return;
}
bk = range.createBookmark();
range.applyInlineStyle(tagName, tmpObj).moveToBookmark(bk).select()
}
}
},
queryCommandValue : function() {
var parent = utils.findNode(this.selection.getStartElementPath(),null,function(node){return node.getAttribute('label')});
return parent ? parent.getAttribute('label') : '';
},
queryCommandState : function() {
return this.highlight ? -1 : 0;
}
};
//当去掉customstyle是,如果是块元素,用p代替
me.addListener('keyup', function(type, evt) {
var keyCode = evt.keyCode || evt.which;
if (keyCode == 32 || keyCode == 13) {
var range = me.selection.getRange();
if (range.collapsed) {
var node = domUtils.findParent(me.selection.getStart(), function(node) {
return node.getAttribute('label')
}, true);
if (node && dtd.$block[node.tagName] && domUtils.isEmptyNode(node)) {
var p = me.document.createElement('p');
domUtils.insertAfter(node, p);
domUtils.fillNode(me.document, p);
domUtils.remove(node);
range.setStart(p, 0).setCursor();
}
}
}
})
};
///import core
///commandsName catchRemoteImage
/**
* 远程图片抓取,当开启本插件时所有不符合本地域名的图片都将被抓取成为本地服务器上的图片
*
*/
UE.plugins['catchremoteimage'] = function (){
if(!this.options.catchRemoteImageEnable)return;
var ajax = UE.ajax,
me = this,
localDomain = me.options.localDomain,
catcherUrl = me.options.catcherUrl,
separater="ue_separate_ue";
function catchremoteimage(imgs,callbacks) {
var submitStr = imgs.join(separater);
ajax.request( catcherUrl, {
content:submitStr,
timeout:60000, //单位:毫秒,回调请求超时设置。目标用户如果网速不是很快的话此处建议设置一个较大的数值
onsuccess:callbacks["success"],
onerror:callbacks["error"]
} )
}
me.addListener("afterpaste",function(){
me.fireEvent("catchRemoteImage");
});
me.addListener( "catchRemoteImage", function () {
var remoteImages=[];
var imgs = domUtils.getElementsByTagName(me.document,"img");
for(var i = 0,ci;ci=imgs[i++];){
if(ci.getAttribute("word_img"))continue;
var src = ci.getAttribute("data_ue_src") || ci.src||"";
if(/^(https?|ftp):/i.test(src) && src.indexOf(localDomain)==-1 ) {
remoteImages.push(src);
}
}
if(remoteImages.length){
catchremoteimage(remoteImages,{
//成功抓取
success:function (xhr){
try{
var info = eval("("+xhr.responseText+")");
}catch(e){
return;
}
var srcUrls = info.srcUrl.split(separater),
urls = info.url.split(separater);
for(var i=0,ci;ci=imgs[i++];){
var src = ci.getAttribute("data_ue_src")||ci.src||"";
for(var j=0,cj;cj=srcUrls[j++];){
var url = urls[j-1];
if(src == cj && url!="error"){ //抓取失败时不做替换处理
//地址修正
var newSrc = me.options.UEDITOR_HOME_URL +"server/"+url;
domUtils.setAttributes(ci,{
"src":newSrc,
"data_ue_src":newSrc
});
break;
}
}
}
},
//回调失败,本次请求超时
error:function(){
me.fireEvent("catchremoteerror");
}
})
}
} )
};
///import core
///commandsName snapscreen
///commandsTitle 截屏
/**
* 截屏插件
*/
UE.commands['snapscreen'] = {
execCommand: function(){
var me = this,
editorOptions = me.options;
if(!browser.ie){
alert(editorOptions.messages.snapScreenNotIETip);
return;
}
var onSuccess = function(rs){
try{
rs = eval("("+ rs +")");
}catch(e){
alert('截屏上传有误\n\n请检查editor_config.js中关于截屏的配置项\n\nsnapscreenHost 变量值 应该为屏幕截图的server端文件所在的网站地址或者ip');
return;
}
if(rs.state != 'SUCCESS'){
alert(rs.state);
return;
}
me.execCommand('insertimage', {
src: (editorOptions.snapscreenImgIsUseImagePath ? editorOptions.imagePath : '') + rs.url,
floatStyle: editorOptions.snapscreenImgAlign,
data_ue_src:(editorOptions.snapscreenImgIsUseImagePath ? editorOptions.imagePath : '') + rs.url
});
};
var onStartUpload = function(){
//开始截图上传
};
var onError = function(){
alert(editorOptions.messages.snapScreenMsg);
};
try{
var nativeObj = new ActiveXObject('Snapsie.CoSnapsie');
nativeObj.saveSnapshot(editorOptions.snapscreenHost, editorOptions.snapscreenServerFile, editorOptions.snapscreenServerPort, onStartUpload,onSuccess,onError);
}catch(e){
me.snapscreenInstall.open();
}
},
queryCommandState: function(){
return this.highlight ? -1 :0;
}
};
///import core
///commandsName attachment
///commandsTitle 附件上传
UE.commands["attachment"] = {
queryCommandState:function(){
return this.highlight ? -1 :0;
}
};
var baidu = baidu || {};
baidu.editor = baidu.editor || {};
baidu.editor.ui = {};
(function (){
var browser = baidu.editor.browser,
domUtils = baidu.editor.dom.domUtils;
var magic = '$EDITORUI';
var root = window[magic] = {};
var uidMagic = 'ID' + magic;
var uidCount = 0;
var uiUtils = baidu.editor.ui.uiUtils = {
uid: function (obj){
return (obj ? obj[uidMagic] || (obj[uidMagic] = ++ uidCount) : ++ uidCount);
},
hook: function ( fn, callback ) {
var dg;
if (fn && fn._callbacks) {
dg = fn;
} else {
dg = function (){
var q;
if (fn) {
q = fn.apply(this, arguments);
}
var callbacks = dg._callbacks;
var k = callbacks.length;
while (k --) {
var r = callbacks[k].apply(this, arguments);
if (q === undefined) {
q = r;
}
}
return q;
};
dg._callbacks = [];
}
dg._callbacks.push(callback);
return dg;
},
createElementByHtml: function (html){
var el = document.createElement('div');
el.innerHTML = html;
el = el.firstChild;
el.parentNode.removeChild(el);
return el;
},
getViewportElement: function (){
return (browser.ie && browser.quirks) ?
document.body : document.documentElement;
},
getClientRect: function (element){
var bcr = element.getBoundingClientRect();
var rect = {
left: Math.round(bcr.left),
top: Math.round(bcr.top),
height: Math.round(bcr.bottom - bcr.top),
width: Math.round(bcr.right - bcr.left)
};
var doc;
while ((doc = element.ownerDocument) !== document &&
(element = domUtils.getWindow(doc).frameElement)) {
bcr = element.getBoundingClientRect();
rect.left += bcr.left;
rect.top += bcr.top;
}
rect.bottom = rect.top + rect.height;
rect.right = rect.left + rect.width;
return rect;
},
getViewportRect: function (){
var viewportEl = uiUtils.getViewportElement();
var width = (window.innerWidth || viewportEl.clientWidth) | 0;
var height = (window.innerHeight ||viewportEl.clientHeight) | 0;
return {
left: 0,
top: 0,
height: height,
width: width,
bottom: height,
right: width
};
},
setViewportOffset: function (element, offset){
var rect;
var fixedLayer = uiUtils.getFixedLayer();
if (element.parentNode === fixedLayer) {
element.style.left = offset.left + 'px';
element.style.top = offset.top + 'px';
} else {
domUtils.setViewportOffset(element, offset);
}
},
getEventOffset: function (evt){
var el = evt.target || evt.srcElement;
var rect = uiUtils.getClientRect(el);
var offset = uiUtils.getViewportOffsetByEvent(evt);
return {
left: offset.left - rect.left,
top: offset.top - rect.top
};
},
getViewportOffsetByEvent: function (evt){
var el = evt.target || evt.srcElement;
var frameEl = domUtils.getWindow(el).frameElement;
var offset = {
left: evt.clientX,
top: evt.clientY
};
if (frameEl && el.ownerDocument !== document) {
var rect = uiUtils.getClientRect(frameEl);
offset.left += rect.left;
offset.top += rect.top;
}
return offset;
},
setGlobal: function (id, obj){
root[id] = obj;
return magic + '["' + id + '"]';
},
unsetGlobal: function (id){
delete root[id];
},
copyAttributes: function (tgt, src){
var attributes = src.attributes;
var k = attributes.length;
while (k --) {
var attrNode = attributes[k];
if ( attrNode.nodeName != 'style' && attrNode.nodeName != 'class' && (!browser.ie || attrNode.specified) ) {
tgt.setAttribute(attrNode.nodeName, attrNode.nodeValue);
}
}
if (src.className) {
tgt.className += ' ' + src.className;
}
if (src.style.cssText) {
tgt.style.cssText += ';' + src.style.cssText;
}
},
removeStyle: function (el, styleName){
if (el.style.removeProperty) {
el.style.removeProperty(styleName);
} else if (el.style.removeAttribute) {
el.style.removeAttribute(styleName);
} else throw '';
},
contains: function (elA, elB){
return elA && elB && (elA === elB ? false : (
elA.contains ? elA.contains(elB) :
elA.compareDocumentPosition(elB) & 16
));
},
startDrag: function (evt, callbacks,doc){
var doc = doc || document;
var startX = evt.clientX;
var startY = evt.clientY;
function handleMouseMove(evt){
var x = evt.clientX - startX;
var y = evt.clientY - startY;
callbacks.ondragmove(x, y);
if (evt.stopPropagation) {
evt.stopPropagation();
} else {
evt.cancelBubble = true;
}
}
if (doc.addEventListener) {
function handleMouseUp(evt){
doc.removeEventListener('mousemove', handleMouseMove, true);
doc.removeEventListener('mouseup', handleMouseMove, true);
callbacks.ondragstop();
}
doc.addEventListener('mousemove', handleMouseMove, true);
doc.addEventListener('mouseup', handleMouseUp, true);
evt.preventDefault();
} else {
var elm = evt.srcElement;
elm.setCapture();
function releaseCaptrue(){
elm.releaseCapture();
elm.detachEvent('onmousemove', handleMouseMove);
elm.detachEvent('onmouseup', releaseCaptrue);
elm.detachEvent('onlosecaptrue', releaseCaptrue);
callbacks.ondragstop();
}
elm.attachEvent('onmousemove', handleMouseMove);
elm.attachEvent('onmouseup', releaseCaptrue);
elm.attachEvent('onlosecaptrue', releaseCaptrue);
evt.returnValue = false;
}
callbacks.ondragstart();
},
getFixedLayer: function (){
var layer = document.getElementById('edui_fixedlayer');
if (layer == null) {
layer = document.createElement('div');
layer.id = 'edui_fixedlayer';
document.body.appendChild(layer);
if (browser.ie && browser.version <= 8) {
layer.style.position = 'absolute';
bindFixedLayer();
setTimeout(updateFixedOffset);
} else {
layer.style.position = 'fixed';
}
layer.style.left = '0';
layer.style.top = '0';
layer.style.width = '0';
layer.style.height = '0';
}
return layer;
},
makeUnselectable: function (element){
if (browser.opera || (browser.ie && browser.version < 9)) {
element.unselectable = 'on';
if (element.hasChildNodes()) {
for (var i=0; i<element.childNodes.length; i++) {
if (element.childNodes[i].nodeType == 1) {
uiUtils.makeUnselectable(element.childNodes[i]);
}
}
}
} else {
if (element.style.MozUserSelect !== undefined) {
element.style.MozUserSelect = 'none';
} else if (element.style.WebkitUserSelect !== undefined) {
element.style.WebkitUserSelect = 'none';
} else if (element.style.KhtmlUserSelect !== undefined) {
element.style.KhtmlUserSelect = 'none';
}
}
}
};
function updateFixedOffset(){
var layer = document.getElementById('edui_fixedlayer');
uiUtils.setViewportOffset(layer, {
left: 0,
top: 0
});
// layer.style.display = 'none';
// layer.style.display = 'block';
//#trace: 1354
// setTimeout(updateFixedOffset);
}
function bindFixedLayer(adjOffset){
domUtils.on(window, 'scroll', updateFixedOffset);
domUtils.on(window, 'resize', baidu.editor.utils.defer(updateFixedOffset, 0, true));
}
})();
(function (){
var utils = baidu.editor.utils,
uiUtils = baidu.editor.ui.uiUtils,
EventBase = baidu.editor.EventBase,
UIBase = baidu.editor.ui.UIBase = function (){};
UIBase.prototype = {
className: '',
uiName: '',
initOptions: function (options){
var me = this;
for (var k in options) {
me[k] = options[k];
}
this.id = this.id || 'edui' + uiUtils.uid();
},
initUIBase: function (){
this._globalKey = utils.unhtml( uiUtils.setGlobal(this.id, this) );
},
render: function (holder){
var html = this.renderHtml();
var el = uiUtils.createElementByHtml(html);
var seatEl = this.getDom();
if (seatEl != null) {
seatEl.parentNode.replaceChild(el, seatEl);
uiUtils.copyAttributes(el, seatEl);
} else {
if (typeof holder == 'string') {
holder = document.getElementById(holder);
}
holder = holder || uiUtils.getFixedLayer();
holder.appendChild(el);
}
this.postRender();
},
getDom: function (name){
if (!name) {
return document.getElementById( this.id );
} else {
return document.getElementById( this.id + '_' + name );
}
},
postRender: function (){
this.fireEvent('postrender');
},
getHtmlTpl: function (){
return '';
},
formatHtml: function (tpl){
var prefix = 'edui-' + this.uiName;
return (tpl
.replace(/##/g, this.id)
.replace(/%%-/g, this.uiName ? prefix + '-' : '')
.replace(/%%/g, (this.uiName ? prefix : '') + ' ' + this.className)
.replace(/\$\$/g, this._globalKey));
},
renderHtml: function (){
return this.formatHtml(this.getHtmlTpl());
},
dispose: function (){
var box = this.getDom();
if (box) baidu.editor.dom.domUtils.remove( box );
uiUtils.unsetGlobal(this.id);
}
};
utils.inherits(UIBase, EventBase);
})();
(function (){
var utils = baidu.editor.utils,
UIBase = baidu.editor.ui.UIBase,
Separator = baidu.editor.ui.Separator = function (options){
this.initOptions(options);
this.initSeparator();
};
Separator.prototype = {
uiName: 'separator',
initSeparator: function (){
this.initUIBase();
},
getHtmlTpl: function (){
return '<div id="##" class="edui-box %%"></div>';
}
};
utils.inherits(Separator, UIBase);
})();
///import core
///import uicore
(function (){
var utils = baidu.editor.utils,
domUtils = baidu.editor.dom.domUtils,
UIBase = baidu.editor.ui.UIBase,
uiUtils = baidu.editor.ui.uiUtils;
var Mask = baidu.editor.ui.Mask = function (options){
this.initOptions(options);
this.initUIBase();
};
Mask.prototype = {
getHtmlTpl: function (){
return '<div id="##" class="edui-mask %%" onmousedown="return $$._onMouseDown(event, this);"></div>';
},
postRender: function (){
var me = this;
domUtils.on(window, 'resize', function (){
setTimeout(function (){
if (!me.isHidden()) {
me._fill();
}
});
});
},
show: function (zIndex){
this._fill();
this.getDom().style.display = '';
this.getDom().style.zIndex = zIndex;
},
hide: function (){
this.getDom().style.display = 'none';
this.getDom().style.zIndex = '';
},
isHidden: function (){
return this.getDom().style.display == 'none';
},
_onMouseDown: function (){
return false;
},
_fill: function (){
var el = this.getDom();
var vpRect = uiUtils.getViewportRect();
el.style.width = vpRect.width + 'px';
el.style.height = vpRect.height + 'px';
}
};
utils.inherits(Mask, UIBase);
})();
///import core
///import uicore
(function () {
var utils = baidu.editor.utils,
uiUtils = baidu.editor.ui.uiUtils,
domUtils = baidu.editor.dom.domUtils,
UIBase = baidu.editor.ui.UIBase,
Popup = baidu.editor.ui.Popup = function (options){
this.initOptions(options);
this.initPopup();
};
var allPopups = [];
function closeAllPopup( el ){
var newAll = [];
for ( var i = 0; i < allPopups.length; i++ ) {
var pop = allPopups[i];
if (!pop.isHidden()) {
if (pop.queryAutoHide(el) !== false) {
pop.hide();
}
}
}
}
Popup.postHide = closeAllPopup;
var ANCHOR_CLASSES = ['edui-anchor-topleft','edui-anchor-topright',
'edui-anchor-bottomleft','edui-anchor-bottomright'];
Popup.prototype = {
SHADOW_RADIUS: 5,
content: null,
_hidden: false,
autoRender: true,
canSideLeft: true,
canSideUp: true,
initPopup: function (){
this.initUIBase();
allPopups.push( this );
},
getHtmlTpl: function (){
return '<div id="##" class="edui-popup %%">' +
' <div id="##_body" class="edui-popup-body">' +
' <iframe style="position:absolute;z-index:-1;left:0;top:0;background-color: white;" frameborder="0" width="100%" height="100%" src="javascript:"></iframe>' +
' <div class="edui-shadow"></div>' +
' <div id="##_content" class="edui-popup-content">' +
this.getContentHtmlTpl() +
' </div>' +
' </div>' +
'</div>';
},
getContentHtmlTpl: function (){
if (typeof this.content == 'string') {
return this.content;
}
return this.content.renderHtml();
},
_UIBase_postRender: UIBase.prototype.postRender,
postRender: function (){
if (this.content instanceof UIBase) {
this.content.postRender();
}
this.fireEvent('postRenderAfter');
this.hide(true);
this._UIBase_postRender();
},
_doAutoRender: function (){
if (!this.getDom() && this.autoRender) {
this.render();
}
},
mesureSize: function (){
var box = this.getDom('content');
return uiUtils.getClientRect(box);
},
fitSize: function (){
var popBodyEl = this.getDom('body');
popBodyEl.style.width = '';
popBodyEl.style.height = '';
var size = this.mesureSize();
popBodyEl.style.width = size.width + 'px';
popBodyEl.style.height = size.height + 'px';
return size;
},
showAnchor: function ( element, hoz ){
this.showAnchorRect( uiUtils.getClientRect( element ), hoz );
},
showAnchorRect: function ( rect, hoz, adj ){
this._doAutoRender();
var vpRect = uiUtils.getViewportRect();
this._show();
var popSize = this.fitSize();
var sideLeft, sideUp, left, top;
if (hoz) {
sideLeft = this.canSideLeft && (rect.right + popSize.width > vpRect.right && rect.left > popSize.width);
sideUp = this.canSideUp && (rect.top + popSize.height > vpRect.bottom && rect.bottom > popSize.height);
left = (sideLeft ? rect.left - popSize.width : rect.right);
top = (sideUp ? rect.bottom - popSize.height : rect.top);
} else {
sideLeft = this.canSideLeft && (rect.right + popSize.width > vpRect.right && rect.left > popSize.width);
sideUp = this.canSideUp && (rect.top + popSize.height > vpRect.bottom && rect.bottom > popSize.height);
left = (sideLeft ? rect.right - popSize.width : rect.left);
top = (sideUp ? rect.top - popSize.height : rect.bottom);
}
var popEl = this.getDom();
uiUtils.setViewportOffset(popEl, {
left: left,
top: top
});
domUtils.removeClasses(popEl, ANCHOR_CLASSES);
popEl.className += ' ' + ANCHOR_CLASSES[(sideUp ? 1 : 0) * 2 + (sideLeft ? 1 : 0)];
if(this.editor){
popEl.style.zIndex = this.editor.container.style.zIndex * 1 + 10;
baidu.editor.ui.uiUtils.getFixedLayer().style.zIndex = popEl.style.zIndex - 1;
}
},
showAt: function (offset) {
var left = offset.left;
var top = offset.top;
var rect = {
left: left,
top: top,
right: left,
bottom: top,
height: 0,
width: 0
};
this.showAnchorRect(rect, false, true);
},
_show: function (){
if (this._hidden) {
var box = this.getDom();
box.style.display = '';
this._hidden = false;
// if (box.setActive) {
// box.setActive();
// }
this.fireEvent('show');
}
},
isHidden: function (){
return this._hidden;
},
show: function (){
this._doAutoRender();
this._show();
},
hide: function (notNofity){
if (!this._hidden && this.getDom()) {
// this.getDom().style.visibility = 'hidden';
this.getDom().style.display = 'none';
this._hidden = true;
if (!notNofity) {
this.fireEvent('hide');
}
}
},
queryAutoHide: function (el){
return !el || !uiUtils.contains(this.getDom(), el);
}
};
utils.inherits(Popup, UIBase);
domUtils.on( document, 'mousedown', function ( evt ) {
var el = evt.target || evt.srcElement;
closeAllPopup( el );
} );
domUtils.on( window, 'scroll', function () {
closeAllPopup();
} );
// var lastVpRect = uiUtils.getViewportRect();
// domUtils.on( window, 'resize', function () {
// var vpRect = uiUtils.getViewportRect();
// if (vpRect.width != lastVpRect.width || vpRect.height != lastVpRect.height) {
// closeAllPopup();
// }
// } );
})();
///import core
///import uicore
(function (){
var utils = baidu.editor.utils,
UIBase = baidu.editor.ui.UIBase,
ColorPicker = baidu.editor.ui.ColorPicker = function (options){
this.initOptions(options);
this.noColorText = this.noColorText || '不设置颜色';
this.initUIBase();
};
ColorPicker.prototype = {
getHtmlTpl: function (){
return genColorPicker(
this.noColorText
);
},
_onTableClick: function (evt){
var tgt = evt.target || evt.srcElement;
var color = tgt.getAttribute('data-color');
if (color) {
this.fireEvent('pickcolor', color);
}
},
_onTableOver: function (evt){
var tgt = evt.target || evt.srcElement;
var color = tgt.getAttribute('data-color');
if (color) {
this.getDom('preview').style.backgroundColor = color;
}
},
_onTableOut: function (){
this.getDom('preview').style.backgroundColor = '';
},
_onPickNoColor: function (){
this.fireEvent('picknocolor');
}
};
utils.inherits(ColorPicker, UIBase);
var COLORS = (
'ffffff,000000,eeece1,1f497d,4f81bd,c0504d,9bbb59,8064a2,4bacc6,f79646,' +
'f2f2f2,7f7f7f,ddd9c3,c6d9f0,dbe5f1,f2dcdb,ebf1dd,e5e0ec,dbeef3,fdeada,' +
'd8d8d8,595959,c4bd97,8db3e2,b8cce4,e5b9b7,d7e3bc,ccc1d9,b7dde8,fbd5b5,' +
'bfbfbf,3f3f3f,938953,548dd4,95b3d7,d99694,c3d69b,b2a2c7,92cddc,fac08f,' +
'a5a5a5,262626,494429,17365d,366092,953734,76923c,5f497a,31859b,e36c09,' +
'7f7f7f,0c0c0c,1d1b10,0f243e,244061,632423,4f6128,3f3151,205867,974806,' +
'c00000,ff0000,ffc000,ffff00,92d050,00b050,00b0f0,0070c0,002060,7030a0,').split(',');
function genColorPicker(noColorText){
var html = '<div id="##" class="edui-colorpicker %%">' +
'<div class="edui-colorpicker-topbar edui-clearfix">' +
'<div unselectable="on" id="##_preview" class="edui-colorpicker-preview"></div>' +
'<div unselectable="on" class="edui-colorpicker-nocolor" onclick="$$._onPickNoColor(event, this);">'+ noColorText +'</div>' +
'</div>' +
'<table class="edui-box" style="border-collapse: collapse;" onmouseover="$$._onTableOver(event, this);" onmouseout="$$._onTableOut(event, this);" onclick="return $$._onTableClick(event, this);" cellspacing="0" cellpadding="0">' +
'<tr style="border-bottom: 1px solid #ddd;font-size: 13px;line-height: 25px;color:#366092;padding-top: 2px"><td colspan="10">主题颜色</td> </tr>'+
'<tr class="edui-colorpicker-tablefirstrow" >';
for (var i=0; i<COLORS.length; i++) {
if (i && i%10 === 0) {
html += '</tr>'+(i==60?'<tr style="border-bottom: 1px solid #ddd;font-size: 13px;line-height: 25px;color:#366092;"><td colspan="10">标准颜色</td></tr>':'')+'<tr'+(i==60?' class="edui-colorpicker-tablefirstrow"':'')+'>';
}
html += i<70 ? '<td style="padding: 0 2px;"><a hidefocus title="'+COLORS[i]+'" onclick="return false;" href="javascript:" unselectable="on" class="edui-box edui-colorpicker-colorcell"' +
' data-color="#'+ COLORS[i] +'"'+
' style="background-color:#'+ COLORS[i] +';border:solid #ccc;'+
(i<10 || i>=60?'border-width:1px;':
i>=10&&i<20?'border-width:1px 1px 0 1px;':
'border-width:0 1px 0 1px;')+
'"' +
'></a></td>':'';
}
html += '</tr></table></div>';
return html;
}
})();
///import core
///import uicore
(function (){
var utils = baidu.editor.utils,
uiUtils = baidu.editor.ui.uiUtils,
UIBase = baidu.editor.ui.UIBase;
var TablePicker = baidu.editor.ui.TablePicker = function (options){
this.initOptions(options);
this.initTablePicker();
};
TablePicker.prototype = {
defaultNumRows: 10,
defaultNumCols: 10,
maxNumRows: 20,
maxNumCols: 20,
numRows: 10,
numCols: 10,
lengthOfCellSide: 22,
initTablePicker: function (){
this.initUIBase();
},
getHtmlTpl: function (){
return '<div id="##" class="edui-tablepicker %%">' +
'<div class="edui-tablepicker-body">' +
'<div class="edui-infoarea">' +
'<span id="##_label" class="edui-label"></span>' +
'<span class="edui-clickable" onclick="$$._onMore();">更多</span>' +
'</div>' +
'<div class="edui-pickarea"' +
' onmousemove="$$._onMouseMove(event, this);"' +
' onmouseover="$$._onMouseOver(event, this);"' +
' onmouseout="$$._onMouseOut(event, this);"' +
' onclick="$$._onClick(event, this);"' +
'>' +
'<div id="##_overlay" class="edui-overlay"></div>' +
'</div>' +
'</div>' +
'</div>';
},
_UIBase_render: UIBase.prototype.render,
render: function (holder){
this._UIBase_render(holder);
this.getDom('label').innerHTML = '0列 x 0行';
},
_track: function (numCols, numRows){
var style = this.getDom('overlay').style;
var sideLen = this.lengthOfCellSide;
style.width = numCols * sideLen + 'px';
style.height = numRows * sideLen + 'px';
var label = this.getDom('label');
label.innerHTML = numCols + '列 x ' + numRows + '行';
this.numCols = numCols;
this.numRows = numRows;
},
_onMouseOver: function (evt, el){
var rel = evt.relatedTarget || evt.fromElement;
if (!uiUtils.contains(el, rel) && el !== rel) {
this.getDom('label').innerHTML = '0列 x 0行';
this.getDom('overlay').style.visibility = '';
}
},
_onMouseOut: function (evt, el){
var rel = evt.relatedTarget || evt.toElement;
if (!uiUtils.contains(el, rel) && el !== rel) {
this.getDom('label').innerHTML = '0列 x 0行';
this.getDom('overlay').style.visibility = 'hidden';
}
},
_onMouseMove: function (evt, el){
var style = this.getDom('overlay').style;
var offset = uiUtils.getEventOffset(evt);
var sideLen = this.lengthOfCellSide;
var numCols = Math.ceil(offset.left / sideLen);
var numRows = Math.ceil(offset.top / sideLen);
this._track(numCols, numRows);
},
_onClick: function (){
this.fireEvent('picktable', this.numCols, this.numRows);
},
_onMore: function (){
this.fireEvent('more');
}
};
utils.inherits(TablePicker, UIBase);
})();
(function (){
var browser = baidu.editor.browser,
domUtils = baidu.editor.dom.domUtils,
uiUtils = baidu.editor.ui.uiUtils;
var TPL_STATEFUL = 'onmousedown="$$.Stateful_onMouseDown(event, this);"' +
' onmouseup="$$.Stateful_onMouseUp(event, this);"' +
( browser.ie ? (
' onmouseenter="$$.Stateful_onMouseEnter(event, this);"' +
' onmouseleave="$$.Stateful_onMouseLeave(event, this);"' )
: (
' onmouseover="$$.Stateful_onMouseOver(event, this);"' +
' onmouseout="$$.Stateful_onMouseOut(event, this);"' ));
baidu.editor.ui.Stateful = {
alwalysHoverable: false,
Stateful_init: function (){
this._Stateful_dGetHtmlTpl = this.getHtmlTpl;
this.getHtmlTpl = this.Stateful_getHtmlTpl;
},
Stateful_getHtmlTpl: function (){
var tpl = this._Stateful_dGetHtmlTpl();
// 使用function避免$转义
return tpl.replace(/stateful/g, function (){ return TPL_STATEFUL; });
},
Stateful_onMouseEnter: function (evt, el){
if (!this.isDisabled() || this.alwalysHoverable) {
this.addState('hover');
this.fireEvent('over');
}
},
Stateful_onMouseLeave: function (evt, el){
if (!this.isDisabled() || this.alwalysHoverable) {
this.removeState('hover');
this.removeState('active');
this.fireEvent('out');
}
},
Stateful_onMouseOver: function (evt, el){
var rel = evt.relatedTarget;
if (!uiUtils.contains(el, rel) && el !== rel) {
this.Stateful_onMouseEnter(evt, el);
}
},
Stateful_onMouseOut: function (evt, el){
var rel = evt.relatedTarget;
if (!uiUtils.contains(el, rel) && el !== rel) {
this.Stateful_onMouseLeave(evt, el);
}
},
Stateful_onMouseDown: function (evt, el){
if (!this.isDisabled()) {
this.addState('active');
}
},
Stateful_onMouseUp: function (evt, el){
if (!this.isDisabled()) {
this.removeState('active');
}
},
Stateful_postRender: function (){
if (this.disabled && !this.hasState('disabled')) {
this.addState('disabled');
}
},
hasState: function (state){
return domUtils.hasClass(this.getStateDom(), 'edui-state-' + state);
},
addState: function (state){
if (!this.hasState(state)) {
this.getStateDom().className += ' edui-state-' + state;
}
},
removeState: function (state){
if (this.hasState(state)) {
domUtils.removeClasses(this.getStateDom(), ['edui-state-' + state]);
}
},
getStateDom: function (){
return this.getDom('state');
},
isChecked: function (){
return this.hasState('checked');
},
setChecked: function (checked){
if (!this.isDisabled() && checked) {
this.addState('checked');
} else {
this.removeState('checked');
}
},
isDisabled: function (){
return this.hasState('disabled');
},
setDisabled: function (disabled){
if (disabled) {
this.removeState('hover');
this.removeState('checked');
this.removeState('active');
this.addState('disabled');
} else {
this.removeState('disabled');
}
}
};
})();
///import core
///import uicore
///import ui/stateful.js
(function (){
var utils = baidu.editor.utils,
UIBase = baidu.editor.ui.UIBase,
Stateful = baidu.editor.ui.Stateful,
Button = baidu.editor.ui.Button = function (options){
this.initOptions(options);
this.initButton();
};
Button.prototype = {
uiName: 'button',
label: '',
title: '',
showIcon: true,
showText: true,
initButton: function (){
this.initUIBase();
this.Stateful_init();
},
getHtmlTpl: function (){
return '<div id="##" class="edui-box %%">' +
'<div id="##_state" stateful>' +
'<div class="%%-wrap"><div id="##_body" unselectable="on" ' + (this.title ? 'title="' + this.title + '"' : '') +
' class="%%-body" onmousedown="return false;" onclick="return $$._onClick();">' +
(this.showIcon ? '<div class="edui-box edui-icon"></div>' : '') +
(this.showText ? '<div class="edui-box edui-label">' + this.label + '</div>' : '') +
'</div>' +
'</div>' +
'</div></div>';
},
postRender: function (){
this.Stateful_postRender();
},
_onClick: function (){
if (!this.isDisabled()) {
this.fireEvent('click');
}
}
};
utils.inherits(Button, UIBase);
utils.extend(Button.prototype, Stateful);
})();
///import core
///import uicore
///import ui/stateful.js
(function (){
var utils = baidu.editor.utils,
uiUtils = baidu.editor.ui.uiUtils,
domUtils = baidu.editor.dom.domUtils,
UIBase = baidu.editor.ui.UIBase,
Stateful = baidu.editor.ui.Stateful,
SplitButton = baidu.editor.ui.SplitButton = function (options){
this.initOptions(options);
this.initSplitButton();
};
SplitButton.prototype = {
popup: null,
uiName: 'splitbutton',
title: '',
initSplitButton: function (){
this.initUIBase();
this.Stateful_init();
var me = this;
if (this.popup != null) {
var popup = this.popup;
this.popup = null;
this.setPopup(popup);
}
},
_UIBase_postRender: UIBase.prototype.postRender,
postRender: function (){
this.Stateful_postRender();
this._UIBase_postRender();
},
setPopup: function (popup){
if (this.popup === popup) return;
if (this.popup != null) {
this.popup.dispose();
}
popup.addListener('show', utils.bind(this._onPopupShow, this));
popup.addListener('hide', utils.bind(this._onPopupHide, this));
popup.addListener('postrender', utils.bind(function (){
popup.getDom('body').appendChild(
uiUtils.createElementByHtml('<div id="' +
this.popup.id + '_bordereraser" class="edui-bordereraser edui-background" style="width:' +
(uiUtils.getClientRect(this.getDom()).width - 2) + 'px"></div>')
);
popup.getDom().className += ' ' + this.className;
}, this));
this.popup = popup;
},
_onPopupShow: function (){
this.addState('opened');
},
_onPopupHide: function (){
this.removeState('opened');
},
getHtmlTpl: function (){
return '<div id="##" class="edui-box %%">' +
'<div '+ (this.title ? 'title="' + this.title + '"' : '') +' id="##_state" stateful><div class="%%-body">' +
'<div id="##_button_body" class="edui-box edui-button-body" onclick="$$._onButtonClick(event, this);">' +
'<div class="edui-box edui-icon"></div>' +
'</div>' +
'<div class="edui-box edui-splitborder"></div>' +
'<div class="edui-box edui-arrow" onclick="$$._onArrowClick();"></div>' +
'</div></div></div>';
},
showPopup: function (){
// 当popup往上弹出的时候,做特殊处理
var rect = uiUtils.getClientRect(this.getDom());
rect.top -= this.popup.SHADOW_RADIUS;
rect.height += this.popup.SHADOW_RADIUS;
this.popup.showAnchorRect(rect);
},
_onArrowClick: function (event, el){
if (!this.isDisabled()) {
this.showPopup();
}
},
_onButtonClick: function (){
if (!this.isDisabled()) {
this.fireEvent('buttonclick');
}
}
};
utils.inherits(SplitButton, UIBase);
utils.extend(SplitButton.prototype, Stateful, true);
})();
///import core
///import uicore
///import ui/colorpicker.js
///import ui/popup.js
///import ui/splitbutton.js
(function (){
var utils = baidu.editor.utils,
uiUtils = baidu.editor.ui.uiUtils,
ColorPicker = baidu.editor.ui.ColorPicker,
Popup = baidu.editor.ui.Popup,
SplitButton = baidu.editor.ui.SplitButton,
ColorButton = baidu.editor.ui.ColorButton = function (options){
this.initOptions(options);
this.initColorButton();
};
ColorButton.prototype = {
initColorButton: function (){
var me = this;
this.popup = new Popup({
content: new ColorPicker({
noColorText: '清除颜色',
onpickcolor: function (t, color){
me._onPickColor(color);
},
onpicknocolor: function (t, color){
me._onPickNoColor(color);
}
}),
editor:me.editor
});
this.initSplitButton();
},
_SplitButton_postRender: SplitButton.prototype.postRender,
postRender: function (){
this._SplitButton_postRender();
this.getDom('button_body').appendChild(
uiUtils.createElementByHtml('<div id="' + this.id + '_colorlump" class="edui-colorlump"></div>')
);
this.getDom().className += ' edui-colorbutton';
},
setColor: function (color){
this.getDom('colorlump').style.backgroundColor = color;
this.color = color;
},
_onPickColor: function (color){
if (this.fireEvent('pickcolor', color) !== false) {
this.setColor(color);
this.popup.hide();
}
},
_onPickNoColor: function (color){
if (this.fireEvent('picknocolor') !== false) {
this.popup.hide();
}
}
};
utils.inherits(ColorButton, SplitButton);
})();
///import core
///import uicore
///import ui/popup.js
///import ui/tablepicker.js
///import ui/splitbutton.js
(function (){
var utils = baidu.editor.utils,
Popup = baidu.editor.ui.Popup,
TablePicker = baidu.editor.ui.TablePicker,
SplitButton = baidu.editor.ui.SplitButton,
TableButton = baidu.editor.ui.TableButton = function (options){
this.initOptions(options);
this.initTableButton();
};
TableButton.prototype = {
initTableButton: function (){
var me = this;
this.popup = new Popup({
content: new TablePicker({
onpicktable: function (t, numCols, numRows){
me._onPickTable(numCols, numRows);
},
onmore: function (){
me.popup.hide();
me.fireEvent('more');
}
}),
'editor':me.editor
});
this.initSplitButton();
},
_onPickTable: function (numCols, numRows){
if (this.fireEvent('picktable', numCols, numRows) !== false) {
this.popup.hide();
}
}
};
utils.inherits(TableButton, SplitButton);
})();
///import core
///import uicore
(function (){
var utils = baidu.editor.utils,
UIBase = baidu.editor.ui.UIBase;
var AutoTypeSetPicker = baidu.editor.ui.AutoTypeSetPicker = function (options){
this.initOptions(options);
this.initAutoTypeSetPicker();
};
AutoTypeSetPicker.prototype = {
initAutoTypeSetPicker: function (){
this.initUIBase();
},
getHtmlTpl: function (){
var options = this.editor.options,
opt = options.autotypeset;
for(var i = 0,lineStr = [],li,lis = options.listMap.lineheight;li=lis[i++];){
lineStr.push('<option value="'+li+'" '+(opt["lineHeight"] == li ? 'checked' : '')+'>'+li+'</option>');
}
return '<div id="##" class="edui-autotypesetpicker %%">' +
'<div class="edui-autotypesetpicker-body">' +
'<table >' +
'<tr><td colspan="2"><input type="checkbox" name="mergeEmptyline" '+ (opt["mergeEmptyline"] ? "checked" : "" )+'>合并空行</td><td colspan="2"><input type="checkbox" name="removeEmptyline" '+ (opt["removeEmptyline"] ? "checked" : "" )+'>删除空行</td></tr>'+
'<tr><td colspan="2"><input type="checkbox" name="removeClass" '+ (opt["removeClass"] ? "checked" : "" )+'>清除样式</td><td colspan="2"><input type="checkbox" name="indent" '+ (opt["indent"] ? "checked" : "" )+'>首行缩进2字</td></tr>'+
'<tr><td colspan="2"><input type="checkbox" name="textAlign" '+ (opt["textAlign"] ? "checked" : "" )+'>对齐方式:</td><td colspan="2" id="textAlignValue"><input type="radio" name="textAlignValue" value="left" '+((opt["textAlign"]&&opt["textAlign"]=="left") ? "checked" : "")+'>左对齐<input type="radio" name="textAlignValue" value="center" '+((opt["textAlign"]&&opt["textAlign"]=="center") ? "checked" : "")+'>居中对齐<input type="radio" name="textAlignValue" value="right" '+((opt["textAlign"]&&opt["textAlign"]=="right") ? "checked" : "")+'>右对齐 </tr>'+
'<tr><td colspan="2"><input type="checkbox" name="imageBlockLine" '+ (opt["imageBlockLine"] ? "checked" : "" )+'>图片浮动</td>' +
'<td colspan="2" id="imageBlockLineValue">' +
'<input type="radio" name="imageBlockLineValue" value="none" '+((opt["imageBlockLine"]&&opt["imageBlockLine"]=="none") ? "checked" : "")+'>默认' +
'<input type="radio" name="imageBlockLineValue" value="left" '+((opt["imageBlockLine"]&&opt["imageBlockLine"]=="left") ? "checked" : "")+'>左浮动' +
'<input type="radio" name="imageBlockLineValue" value="center" '+((opt["imageBlockLine"]&&opt["imageBlockLine"]=="center") ? "checked" : "")+'>独占行居中' +
'<input type="radio" name="imageBlockLineValue" value="right" '+((opt["imageBlockLine"]&&opt["imageBlockLine"]=="right") ? "checked" : "")+'>右浮动</tr>'+
'<tr><td colspan="2"><input type="checkbox" name="clearFontSize" '+ (opt["clearFontSize"] ? "checked" : "" )+'>清除字号</td><td colspan="2"><input type="checkbox" name="clearFontFamily" '+ (opt["clearFontFamily"] ? "checked" : "" )+'>清除字体</td></tr>'+
'<tr><td colspan="4"><input type="checkbox" name="removeEmptyNode" '+ (opt["removeEmptyNode"] ? "checked" : "" )+'>去掉冗余的html代码</td></tr>'+
'<tr><td colspan="4"><input type="checkbox" name="pasteFilter" '+ (opt["pasteFilter"] ? "checked" : "" )+'>粘贴过滤 (对每次粘贴的内容应用以上过滤规则)</td></tr>'+
'<tr><td colspan="4" align="right"><button >执行</button></td></tr>'+
'</table>'+
'</div>' +
'</div>';
},
_UIBase_render: UIBase.prototype.render
};
utils.inherits(AutoTypeSetPicker, UIBase);
})();
///import core
///import uicore
///import ui/popup.js
///import ui/autotypesetpicker.js
///import ui/splitbutton.js
(function (){
var utils = baidu.editor.utils,
Popup = baidu.editor.ui.Popup,
AutoTypeSetPicker = baidu.editor.ui.AutoTypeSetPicker,
SplitButton = baidu.editor.ui.SplitButton,
AutoTypeSetButton = baidu.editor.ui.AutoTypeSetButton = function (options){
this.initOptions(options);
this.initAutoTypeSetButton();
};
function getPara(me){
var opt = me.editor.options.autotypeset,
cont = me.getDom(),
ipts = domUtils.getElementsByTagName(cont,"input");
for(var i=ipts.length-1,ipt;ipt=ipts[i--];){
if(ipt.getAttribute("type")=="checkbox"){
var attrName = ipt.getAttribute("name");
opt[attrName] && delete opt[attrName];
if(ipt.checked){
var attrValue = document.getElementById(attrName+"Value");
if(attrValue){
if(/input/ig.test(attrValue.tagName)){
opt[attrName] = attrValue.value;
}else{
var iptChilds = attrValue.getElementsByTagName("input");
for(var j=iptChilds.length-1,iptchild;iptchild=iptChilds[j--];){
if(iptchild.checked){
opt[attrName] = iptchild.value;
break;
}
}
}
}else{
opt[attrName] = true;
}
}
}
}
var selects = domUtils.getElementsByTagName(cont,"select");
for(var i=0,si;si=selects[i++];){
var attr = si.getAttribute('name');
opt[attr] = opt[attr] ? si.value : '';
}
me.editor.options.autotypeset = opt;
}
AutoTypeSetButton.prototype = {
initAutoTypeSetButton: function (){
var me = this;
this.popup = new Popup({
//传入配置参数
content: new AutoTypeSetPicker({editor:me.editor}),
'editor':me.editor,
hide : function(){
if (!this._hidden && this.getDom()) {
getPara(this);
this.getDom().style.display = 'none';
this._hidden = true;
this.fireEvent('hide');
}
}
});
var flag = 0;
this.popup.addListener('postRenderAfter',function(){
var popupUI = this;
if(flag)return;
var cont = this.getDom(),
btn = cont.getElementsByTagName('button')[0];
btn.onclick = function(){
getPara(popupUI);
me.editor.execCommand('autotypeset')
};
flag = 1;
});
this.initSplitButton();
}
};
utils.inherits(AutoTypeSetButton, SplitButton);
})();
(function (){
var utils = baidu.editor.utils,
uiUtils = baidu.editor.ui.uiUtils,
UIBase = baidu.editor.ui.UIBase,
Toolbar = baidu.editor.ui.Toolbar = function (options){
this.initOptions(options);
this.initToolbar();
};
Toolbar.prototype = {
items: null,
initToolbar: function (){
this.items = this.items || [];
this.initUIBase();
},
add: function (item){
this.items.push(item);
},
getHtmlTpl: function (){
var buff = [];
for (var i=0; i<this.items.length; i++) {
buff[i] = this.items[i].renderHtml();
}
return '<div id="##" class="edui-toolbar %%" onselectstart="return false;" onmousedown="return $$._onMouseDown(event, this);">' +
buff.join('') +
'</div>'
},
postRender: function (){
var box = this.getDom();
for (var i=0; i<this.items.length; i++) {
this.items[i].postRender();
}
uiUtils.makeUnselectable(box);
},
_onMouseDown: function (){
return false;
}
};
utils.inherits(Toolbar, UIBase);
})();
///import core
///import uicore
///import ui\popup.js
///import ui\stateful.js
(function (){
var utils = baidu.editor.utils,
domUtils = baidu.editor.dom.domUtils,
uiUtils = baidu.editor.ui.uiUtils,
UIBase = baidu.editor.ui.UIBase,
Popup = baidu.editor.ui.Popup,
Stateful = baidu.editor.ui.Stateful,
Menu = baidu.editor.ui.Menu = function (options){
this.initOptions(options);
this.initMenu();
};
var menuSeparator = {
renderHtml: function (){
return '<div class="edui-menuitem edui-menuseparator"><div class="edui-menuseparator-inner"></div></div>';
},
postRender: function (){},
queryAutoHide: function (){ return true; }
};
Menu.prototype = {
items: null,
uiName: 'menu',
initMenu: function (){
this.items = this.items || [];
this.initPopup();
this.initItems();
},
initItems: function (){
for (var i=0; i<this.items.length; i++) {
var item = this.items[i];
if (item == '-') {
this.items[i] = this.getSeparator();
} else if (!(item instanceof MenuItem)) {
this.items[i] = this.createItem(item);
}
}
},
getSeparator: function (){
return menuSeparator;
},
createItem: function (item){
return new MenuItem(item);
},
_Popup_getContentHtmlTpl: Popup.prototype.getContentHtmlTpl,
getContentHtmlTpl: function (){
if (this.items.length == 0) {
return this._Popup_getContentHtmlTpl();
}
var buff = [];
for (var i=0; i<this.items.length; i++) {
var item = this.items[i];
buff[i] = item.renderHtml();
}
return ('<div class="%%-body">' + buff.join('') + '</div>');
},
_Popup_postRender: Popup.prototype.postRender,
postRender: function (){
var me = this;
for (var i=0; i<this.items.length; i++) {
var item = this.items[i];
item.ownerMenu = this;
item.postRender();
}
domUtils.on(this.getDom(), 'mouseover', function (evt){
evt = evt || event;
var rel = evt.relatedTarget || evt.fromElement;
var el = me.getDom();
if (!uiUtils.contains(el, rel) && el !== rel) {
me.fireEvent('over');
}
});
this._Popup_postRender();
},
queryAutoHide: function (el){
if (el) {
if (uiUtils.contains(this.getDom(), el)) {
return false;
}
for (var i=0; i<this.items.length; i++) {
var item = this.items[i];
if (item.queryAutoHide(el) === false) {
return false;
}
}
}
},
clearItems: function (){
for (var i=0; i<this.items.length; i++) {
var item = this.items[i];
clearTimeout(item._showingTimer);
clearTimeout(item._closingTimer);
if (item.subMenu) {
item.subMenu.destroy();
}
}
this.items = [];
},
destroy: function (){
if (this.getDom()) {
domUtils.remove(this.getDom());
}
this.clearItems();
},
dispose: function (){
this.destroy();
}
};
utils.inherits(Menu, Popup);
var MenuItem = baidu.editor.ui.MenuItem = function (options){
this.initOptions(options);
this.initUIBase();
this.Stateful_init();
if (this.subMenu && !(this.subMenu instanceof Menu)) {
this.subMenu = new Menu(this.subMenu);
}
};
MenuItem.prototype = {
label: '',
subMenu: null,
ownerMenu: null,
uiName: 'menuitem',
alwalysHoverable: true,
getHtmlTpl: function (){
return '<div id="##" class="%%" stateful onclick="$$._onClick(event, this);">' +
'<div class="%%-body">' +
this.renderLabelHtml() +
'</div>' +
'</div>';
},
postRender: function (){
var me = this;
this.addListener('over', function (){
me.ownerMenu.fireEvent('submenuover', me);
if (me.subMenu) {
me.delayShowSubMenu();
}
});
if (this.subMenu) {
this.getDom().className += ' edui-hassubmenu';
this.subMenu.render();
this.addListener('out', function (){
me.delayHideSubMenu();
});
this.subMenu.addListener('over', function (){
clearTimeout(me._closingTimer);
me._closingTimer = null;
me.addState('opened');
});
this.ownerMenu.addListener('hide', function (){
me.hideSubMenu();
});
this.ownerMenu.addListener('submenuover', function (t, subMenu){
if (subMenu !== me) {
me.delayHideSubMenu();
}
});
this.subMenu._bakQueryAutoHide = this.subMenu.queryAutoHide;
this.subMenu.queryAutoHide = function (el){
if (el && uiUtils.contains(me.getDom(), el)) {
return false;
}
return this._bakQueryAutoHide(el);
};
}
this.getDom().style.tabIndex = '-1';
uiUtils.makeUnselectable(this.getDom());
this.Stateful_postRender();
},
delayShowSubMenu: function (){
var me = this;
if (!me.isDisabled()) {
me.addState('opened');
clearTimeout(me._showingTimer);
clearTimeout(me._closingTimer);
me._closingTimer = null;
me._showingTimer = setTimeout(function (){
me.showSubMenu();
}, 250);
}
},
delayHideSubMenu: function (){
var me = this;
if (!me.isDisabled()) {
me.removeState('opened');
clearTimeout(me._showingTimer);
if (!me._closingTimer) {
me._closingTimer = setTimeout(function (){
if (!me.hasState('opened')) {
me.hideSubMenu();
}
me._closingTimer = null;
}, 400);
}
}
},
renderLabelHtml: function (){
return '<div class="edui-arrow"></div>' +
'<div class="edui-box edui-icon"></div>' +
'<div class="edui-box edui-label %%-label">' + (this.label || '') + '</div>';
},
getStateDom: function (){
return this.getDom();
},
queryAutoHide: function (el){
if (this.subMenu && this.hasState('opened')) {
return this.subMenu.queryAutoHide(el);
}
},
_onClick: function (event, this_){
if (this.hasState('disabled')) return;
if (this.fireEvent('click', event, this_) !== false) {
if (this.subMenu) {
this.showSubMenu();
} else {
Popup.postHide();
}
}
},
showSubMenu: function (){
var rect = uiUtils.getClientRect(this.getDom());
rect.right -= 5;
rect.left += 2;
rect.width -= 7;
rect.top -= 4;
rect.bottom += 4;
rect.height += 8;
this.subMenu.showAnchorRect(rect, true, true);
},
hideSubMenu: function (){
this.subMenu.hide();
}
};
utils.inherits(MenuItem, UIBase);
utils.extend(MenuItem.prototype, Stateful, true);
})();
///import core
///import uicore
///import ui/menu.js
///import ui/splitbutton.js
(function (){
// todo: menu和item提成通用list
var utils = baidu.editor.utils,
uiUtils = baidu.editor.ui.uiUtils,
Menu = baidu.editor.ui.Menu,
SplitButton = baidu.editor.ui.SplitButton,
Combox = baidu.editor.ui.Combox = function (options){
this.initOptions(options);
this.initCombox();
};
Combox.prototype = {
uiName: 'combox',
initCombox: function (){
var me = this;
this.items = this.items || [];
for (var i=0; i<this.items.length; i++) {
var item = this.items[i];
item.uiName = 'listitem';
item.index = i;
item.onclick = function (){
me.selectByIndex(this.index);
};
}
this.popup = new Menu({
items: this.items,
uiName: 'list',
editor:this.editor
});
this.initSplitButton();
},
_SplitButton_postRender: SplitButton.prototype.postRender,
postRender: function (){
this._SplitButton_postRender();
this.setLabel(this.label || '');
this.setValue(this.initValue || '');
},
showPopup: function (){
var rect = uiUtils.getClientRect(this.getDom());
rect.top += 1;
rect.bottom -= 1;
rect.height -= 2;
this.popup.showAnchorRect(rect);
},
getValue: function (){
return this.value;
},
setValue: function (value){
var index = this.indexByValue(value);
if (index != -1) {
this.selectedIndex = index;
this.setLabel(this.items[index].label);
this.value = this.items[index].value;
} else {
this.selectedIndex = -1;
this.setLabel(this.getLabelForUnknowValue(value));
this.value = value;
}
},
setLabel: function (label){
this.getDom('button_body').innerHTML = label;
this.label = label;
},
getLabelForUnknowValue: function (value){
return value;
},
indexByValue: function (value){
for (var i=0; i<this.items.length; i++) {
if (value == this.items[i].value) {
return i;
}
}
return -1;
},
getItem: function (index){
return this.items[index];
},
selectByIndex: function (index){
if (index < this.items.length && this.fireEvent('select', index) !== false) {
this.selectedIndex = index;
this.value = this.items[index].value;
this.setLabel(this.items[index].label);
}
}
};
utils.inherits(Combox, SplitButton);
})();
///import core
///import uicore
///import ui/mask.js
///import ui/button.js
(function (){
var utils = baidu.editor.utils,
domUtils = baidu.editor.dom.domUtils,
uiUtils = baidu.editor.ui.uiUtils,
Mask = baidu.editor.ui.Mask,
UIBase = baidu.editor.ui.UIBase,
Button = baidu.editor.ui.Button,
Dialog = baidu.editor.ui.Dialog = function (options){
this.initOptions(options);
this.initDialog();
};
var modalMask;
var dragMask;
Dialog.prototype = {
draggable: false,
uiName: 'dialog',
initDialog: function (){
var me = this;
this.initUIBase();
this.modalMask = (modalMask || (modalMask = new Mask({
className: 'edui-dialog-modalmask'
})));
this.dragMask = (dragMask || (dragMask = new Mask({
className: 'edui-dialog-dragmask'
})));
this.closeButton = new Button({
className: 'edui-dialog-closebutton',
title: '关闭对话框',
onclick: function (){
me.close(false);
}
});
if (this.buttons) {
for (var i=0; i<this.buttons.length; i++) {
if (!(this.buttons[i] instanceof Button)) {
this.buttons[i] = new Button(this.buttons[i]);
}
}
}
},
fitSize: function (){
var popBodyEl = this.getDom('body');
// if (!(baidu.editor.browser.ie && baidu.editor.browser.version == 7)) {
// uiUtils.removeStyle(popBodyEl, 'width');
// uiUtils.removeStyle(popBodyEl, 'height');
// }
var size = this.mesureSize();
popBodyEl.style.width = size.width + 'px';
popBodyEl.style.height = size.height + 'px';
return size;
},
safeSetOffset: function (offset){
var me = this;
var el = me.getDom();
var vpRect = uiUtils.getViewportRect();
var rect = uiUtils.getClientRect(el);
var left = offset.left;
if (left + rect.width > vpRect.right) {
left = vpRect.right - rect.width;
}
var top = offset.top;
if (top + rect.height > vpRect.bottom) {
top = vpRect.bottom - rect.height;
}
el.style.left = Math.max(left, 0) + 'px';
el.style.top = Math.max(top, 0) + 'px';
},
showAtCenter: function (){
this.getDom().style.display = '';
var vpRect = uiUtils.getViewportRect();
var popSize = this.fitSize();
var titleHeight = this.getDom('titlebar').offsetHeight | 0;
var left = vpRect.width / 2 - popSize.width / 2;
var top = vpRect.height / 2 - (popSize.height - titleHeight) / 2 - titleHeight;
var popEl = this.getDom();
this.safeSetOffset({
left: Math.max(left | 0, 0),
top: Math.max(top | 0, 0)
});
if (!domUtils.hasClass(popEl, 'edui-state-centered')) {
popEl.className += ' edui-state-centered';
}
this._show();
},
getContentHtml: function (){
var contentHtml = '';
if (typeof this.content == 'string') {
contentHtml = this.content;
} else if (this.iframeUrl) {
contentHtml = '<iframe id="'+ this.id +
'_iframe" class="%%-iframe" height="100%" width="100%" frameborder="0" src="'+ this.iframeUrl +'"></iframe>';
}
return contentHtml;
},
getHtmlTpl: function (){
var footHtml = '';
if (this.buttons) {
var buff = [];
for (var i=0; i<this.buttons.length; i++) {
buff[i] = this.buttons[i].renderHtml();
}
footHtml = '<div class="%%-foot">' +
'<div id="##_buttons" class="%%-buttons">' + buff.join('') + '</div>' +
'</div>';
}
return '<div id="##" class="%%"><div class="%%-wrap"><div id="##_body" class="%%-body">' +
'<div class="%%-shadow"></div>' +
'<div id="##_titlebar" class="%%-titlebar">' +
'<div class="%%-draghandle" onmousedown="$$._onTitlebarMouseDown(event, this);">' +
'<span class="%%-caption">' + (this.title || '') + '</span>' +
'</div>' +
this.closeButton.renderHtml() +
'</div>' +
'<div id="##_content" class="%%-content">'+ ( this.autoReset ? '' : this.getContentHtml()) +'</div>' +
footHtml +
'</div></div></div>';
},
postRender: function (){
// todo: 保持居中/记住上次关闭位置选项
if (!this.modalMask.getDom()) {
this.modalMask.render();
this.modalMask.hide();
}
if (!this.dragMask.getDom()) {
this.dragMask.render();
this.dragMask.hide();
}
var me = this;
this.addListener('show', function (){
me.modalMask.show(this.getDom().style.zIndex - 2);
});
this.addListener('hide', function (){
me.modalMask.hide();
});
if (this.buttons) {
for (var i=0; i<this.buttons.length; i++) {
this.buttons[i].postRender();
}
}
domUtils.on(window, 'resize', function (){
setTimeout(function (){
if (!me.isHidden()) {
me.safeSetOffset(uiUtils.getClientRect(me.getDom()));
}
});
});
this._hide();
},
mesureSize: function (){
var body = this.getDom('body');
var width = uiUtils.getClientRect(this.getDom('content')).width;
var dialogBodyStyle = body.style;
dialogBodyStyle.width = width;
return uiUtils.getClientRect(body);
},
_onTitlebarMouseDown: function (evt, el){
if (this.draggable) {
var rect;
var vpRect = uiUtils.getViewportRect();
var me = this;
uiUtils.startDrag(evt, {
ondragstart: function (){
rect = uiUtils.getClientRect(me.getDom());
me.dragMask.show(me.getDom().style.zIndex - 1);
},
ondragmove: function (x, y){
var left = rect.left + x;
var top = rect.top + y;
me.safeSetOffset({
left: left,
top: top
});
},
ondragstop: function (){
domUtils.removeClasses(me.getDom(), ['edui-state-centered']);
me.dragMask.hide();
}
});
}
},
reset: function (){
this.getDom('content').innerHTML = this.getContentHtml();
},
_show: function (){
if (this._hidden) {
this.getDom().style.display = '';
//要高过编辑器的zindxe
this.editor.container.style.zIndex && (this.getDom().style.zIndex = this.editor.container.style.zIndex * 1 + 10);
this._hidden = false;
this.fireEvent('show');
baidu.editor.ui.uiUtils.getFixedLayer().style.zIndex = this.getDom().style.zIndex - 4;
}
},
isHidden: function (){
return this._hidden;
},
_hide: function (){
if (!this._hidden) {
this.getDom().style.display = 'none';
this.getDom().style.zIndex = '';
this._hidden = true;
this.fireEvent('hide');
}
},
open: function (){
if (this.autoReset) {
this.reset();
}
this.showAtCenter();
if (this.iframeUrl) {
try {
this.getDom('iframe').focus();
} catch(ex){}
}
},
_onCloseButtonClick: function (evt, el){
this.close(false);
},
close: function (ok){
if (this.fireEvent('close', ok) !== false) {
this._hide();
}
}
};
utils.inherits(Dialog, UIBase);
})();
///import core
///import uicore
///import ui/menu.js
///import ui/splitbutton.js
(function (){
var utils = baidu.editor.utils,
Menu = baidu.editor.ui.Menu,
SplitButton = baidu.editor.ui.SplitButton,
MenuButton = baidu.editor.ui.MenuButton = function (options){
this.initOptions(options);
this.initMenuButton();
};
MenuButton.prototype = {
initMenuButton: function (){
var me = this;
this.uiName = "menubutton";
this.popup = new Menu({
items: me.items,
className: me.className,
editor:me.editor
});
this.popup.addListener('show', function (){
var list = this;
for (var i=0; i<list.items.length; i++) {
list.items[i].removeState('checked');
if (list.items[i].value == me._value) {
list.items[i].addState('checked');
this.value = me._value;
}
}
});
this.initSplitButton();
},
setValue : function(value){
this._value = value;
}
};
utils.inherits(MenuButton, SplitButton);
})();
(function (){
var isIE = baidu.editor.browser.ie;
var utils = baidu.editor.utils;
var editorui = baidu.editor.ui;
var _Dialog = editorui.Dialog;
editorui.Dialog = function (options){
var dialog = new _Dialog(options);
dialog.addListener('hide', function (){
if (dialog.editor) {
var editor = dialog.editor;
try {
editor.focus()
} catch(ex){}
}
});
return dialog;
};
var k, cmd;
var btnCmds = ['Undo', 'Redo','FormatMatch',
'Bold', 'Italic', 'Underline',
'StrikeThrough', 'Subscript', 'Superscript','Source','Indent','Outdent',
'BlockQuote','PastePlain','PageBreak',
'SelectAll', 'Print', 'Preview', 'Horizontal', 'RemoveFormat','Time','Date','Unlink',
'InsertParagraphBeforeTable','InsertRow','InsertCol','MergeRight','MergeDown','DeleteRow',
'DeleteCol','SplittoRows','SplittoCols','SplittoCells','MergeCells','DeleteTable'];
k = btnCmds.length;
while (k --) {
cmd = btnCmds[k];
editorui[cmd] = function (cmd){
return function (editor, title){
title = title || editor.options.labelMap[cmd.toLowerCase()] || '';
var ui = new editorui.Button({
className: 'edui-for-' + cmd.toLowerCase(),
title: title,
onclick: function (){
editor.execCommand(cmd);
},
showText: false
});
editor.addListener('selectionchange', function (type, causeByUi, uiReady){
var state = editor.queryCommandState(cmd.toLowerCase());
if (state == -1) {
ui.setDisabled(true);
ui.setChecked(false);
} else {
if(!uiReady){
ui.setDisabled(false);
ui.setChecked(state);
}
}
});
return ui;
};
}(cmd);
}
editorui.SnapScreen = function(editor, title){
var cmd = "SnapScreen";
title = title || editor.options.labelMap[cmd.toLowerCase()] || '';
var ui = new editorui.Button({
className: 'edui-for-' + cmd.toLowerCase(),
title: title,
onclick: function (){
editor.execCommand(cmd);
}
});
if(isIE){
var iframeUrl = editor.options.iframeUrlMap['snapscreen'];
iframeUrl = editor.ui.mapUrl(iframeUrl);
title = title || editor.options.labelMap['snapscreen'] || '';
var dialog = new editorui.Dialog({
iframeUrl: iframeUrl,
autoReset: true,
draggable: true,
editor: editor,
className: 'edui-for-snapscreen',
title: title,
buttons: [{
className: 'edui-okbutton',
label: '确认',
onclick: function (){
dialog.close(true);
}
}, {
className: 'edui-cancelbutton',
label: '取消',
onclick: function (){
dialog.close(false);
}
}],
onok: function (){},
oncancel: function (){},
onclose: function (t, ok){
if (ok) {
return this.onok();
} else {
return this.oncancel();
}
}
});
dialog.render();
editor.snapscreenInstall = dialog;
}
editor.addListener('selectionchange',function(){
var state = editor.queryCommandState('snapscreen');
ui.setDisabled(state == -1);
});
return ui;
};
editorui.ClearDoc = function(editor, title){
var cmd = "ClearDoc";
title = title || editor.options.labelMap[cmd.toLowerCase()] || '';
var ui = new editorui.Button({
className: 'edui-for-' + cmd.toLowerCase(),
title: title,
onclick: function (){
if(confirm('确定清空文档吗?')){
editor.execCommand('cleardoc');
}
}
});
editor.addListener('selectionchange',function(){
var state = editor.queryCommandState('cleardoc');
ui.setDisabled(state == -1);
});
return ui;
};
editorui.Justify = function (editor, side, title){
side = (side || 'left').toLowerCase();
title = title || editor.options.labelMap['justify'+side.toLowerCase()] || '';
var ui = new editorui.Button({
className: 'edui-for-justify' + side.toLowerCase(),
title: title,
onclick: function (){
editor.execCommand('Justify', side);
}
});
editor.addListener('selectionchange', function (type, causeByUi, uiReady){
var state = editor.queryCommandState('Justify');
ui.setDisabled(state == -1);
var value = editor.queryCommandValue('Justify');
ui.setChecked(value == side && !uiReady);
});
return ui;
};
editorui.JustifyLeft = function (editor, title){
return editorui.Justify(editor, 'left', title);
};
editorui.JustifyCenter = function (editor, title){
return editorui.Justify(editor, 'center', title);
};
editorui.JustifyRight = function (editor, title){
return editorui.Justify(editor, 'right', title);
};
editorui.JustifyJustify = function (editor, title){
return editorui.Justify(editor, 'justify', title);
};
editorui.ImageFloat = function(editor,side,title){
side = (side || 'none').toLowerCase();
title = title || editor.options.labelMap['image'+side.toLowerCase()] || '';
var ui = new editorui.Button({
className: 'edui-for-image' + side.toLowerCase(),
title: title,
onclick: function (){
editor.execCommand('imagefloat', side);
}
});
editor.addListener('selectionchange', function (type){
var state = editor.queryCommandState('imagefloat');
ui.setDisabled(state == -1);
var state = editor.queryCommandValue('imagefloat');
ui.setChecked(state == side);
});
return ui;
};
editorui.ImageNone = function(editor,title){
return editorui.ImageFloat(editor, title);
};
editorui.ImageLeft = function(editor,title){
return editorui.ImageFloat(editor,"left", title);
};
editorui.ImageRight = function(editor,title){
return editorui.ImageFloat(editor,"right", title);
};
editorui.ImageCenter = function(editor,title){
return editorui.ImageFloat(editor,"center", title);
};
editorui.Directionality = function (editor, side, title){
side = (side || 'left').toLowerCase();
title = title || editor.options.labelMap['directionality'+side.toLowerCase()] || '';
var ui = new editorui.Button({
className: 'edui-for-directionality' + side.toLowerCase(),
title: title,
onclick: function (){
editor.execCommand('directionality', side);
},
type : side
});
editor.addListener('selectionchange', function (type, causeByUi, uiReady){
var state = editor.queryCommandState('directionality');
ui.setDisabled(state == -1);
var value = editor.queryCommandValue('directionality');
ui.setChecked(value == ui.type && !uiReady);
});
return ui;
};
editorui.DirectionalityLtr = function (editor, title){
return new editorui.Directionality(editor, 'ltr', title);
};
editorui.DirectionalityRtl = function (editor, title){
return new editorui.Directionality(editor, 'rtl', title);
};
var colorCmds = ['BackColor', 'ForeColor'];
k = colorCmds.length;
while (k --) {
cmd = colorCmds[k];
editorui[cmd] = function (cmd){
return function (editor, title){
title = title || editor.options.labelMap[cmd.toLowerCase()] || '';
var ui = new editorui.ColorButton({
className: 'edui-for-' + cmd.toLowerCase(),
color: 'default',
title: title,
editor:editor,
onpickcolor: function (t, color){
editor.execCommand(cmd, color);
},
onpicknocolor: function (){
editor.execCommand(cmd, 'default');
this.setColor('transparent');
this.color = 'default';
},
onbuttonclick: function (){
editor.execCommand(cmd, this.color);
}
});
editor.addListener('selectionchange', function (){
var state = editor.queryCommandState(cmd);
if (state == -1) {
ui.setDisabled(true);
} else {
ui.setDisabled(false);
}
});
return ui;
};
}(cmd);
}
//不需要确定取消按钮的dialog
var dialogNoButton = ['SearchReplace','Help','Spechars'];
k = dialogNoButton.length;
while(k --){
cmd = dialogNoButton[k];
editorui[cmd] = function (cmd){
cmd = cmd.toLowerCase();
return function (editor, iframeUrl, title){
iframeUrl = iframeUrl || editor.options.iframeUrlMap[cmd.toLowerCase()] || 'about:blank';
iframeUrl = editor.ui.mapUrl(iframeUrl);
title = title || editor.options.labelMap[cmd.toLowerCase()] || '';
var dialog = new editorui.Dialog({
iframeUrl: iframeUrl,
autoReset: true,
draggable: true,
editor: editor,
className: 'edui-for-' + cmd,
title: title,
onok: function (){},
oncancel: function (){},
onclose: function (t, ok){
if (ok) {
return this.onok();
} else {
return this.oncancel();
}
}
});
dialog.render();
var ui = new editorui.Button({
className: 'edui-for-' + cmd,
title: title,
onclick: function (){
dialog.open();
}
});
editor.addListener('selectionchange', function (){
var state = editor.queryCommandState(cmd);
if (state == -1) {
ui.setDisabled(true);
} else {
ui.setDisabled(false);
}
});
return ui;
};
}(cmd);
}
var dialogCmds = ['Attachment','Anchor','Link', 'InsertImage', 'Map', 'GMap', 'InsertVideo','TableSuper','HighlightCode','InsertFrame','EditTd'];
k = dialogCmds.length;
while (k --) {
cmd = dialogCmds[k];
editorui[cmd] = function (cmd){
cmd = cmd.toLowerCase();
return function (editor, iframeUrl, title){
iframeUrl = iframeUrl || editor.options.iframeUrlMap[cmd.toLowerCase()] || 'about:blank';
iframeUrl = editor.ui.mapUrl(iframeUrl);
title = title || editor.options.labelMap[cmd.toLowerCase()] || '';
var dialog = new editorui.Dialog({
iframeUrl: iframeUrl,
autoReset: true,
draggable: true,
editor: editor,
className: 'edui-for-' + cmd,
title: title,
buttons: [{
className: 'edui-okbutton',
label: '确认',
onclick: function (){
dialog.close(true);
}
}, {
className: 'edui-cancelbutton',
label: '取消',
onclick: function (){
dialog.close(false);
}
}],
onok: function (){},
oncancel: function (){},
onclose: function (t, ok){
if (ok) {
return this.onok();
} else {
return this.oncancel();
}
}
});
dialog.render();
var ui = new editorui.Button({
className: 'edui-for-' + cmd,
title: title,
onclick: function (){
dialog.open();
}
});
editor.addListener('selectionchange', function (){
var state = editor.queryCommandState(cmd);
if (state == -1) {
ui.setDisabled(true);
} else {
ui.setChecked(state);
ui.setDisabled(false);
}
});
return ui;
};
}(cmd);
}
editorui.WordImage = function(editor){
var ui = new editorui.Button({
className: 'edui-for-wordimage',
title: "图片转存",
onclick: function (){
editor.execCommand("wordimage","word_img");
editor.ui._dialogs['wordImageDialog'].open();
}
});
editor.addListener('selectionchange', function (){
var state = editor.queryCommandState("wordimage","word_img");
//if(console)console.log(state);
if (state == -1) {
ui.setDisabled(true);
} else {
ui.setDisabled(false);
ui.setChecked(state);
}
});
return ui;
};
editorui.FontFamily = function (editor, list, title){
list = list || editor.options.listMap['fontfamily'] || [];
title = title || editor.options.labelMap['fontfamily'] || '';
var items = [];
for (var i=0; i<list.length; i++) {
var font = list[i];
var fonts = editor.options.fontMap[font];
var value = '"' + font + '"';
var regex = new RegExp(font, 'i');
if (fonts) {
value = '"' + fonts.join('","') + '"';
regex = new RegExp('(?:\\|)' + fonts.join('|') + '(?:\\|)', 'i');
}
items.push({
label: font,
value: value,
regex: regex,
renderLabelHtml: function (){
return '<div class="edui-label %%-label" style="font-family:' +
utils.unhtml(this.value) + '">' + (this.label || '') + '</div>';
}
});
}
var ui = new editorui.Combox({
editor:editor,
items: items,
onselect: function (t,index){
editor.execCommand('FontFamily', this.items[index].value);
},
onbuttonclick: function (){
this.showPopup();
},
title: title,
initValue: editor.options.ComboxInitial.FONT_FAMILY,
className: 'edui-for-fontfamily',
indexByValue: function (value){
if(value){
value = '|' + value.replace(/,/g, '|').replace(/"/g, '') + '|';
value.replace(/\s*|\s*/g, '|');
for (var i=0; i<this.items.length; i++) {
var item = this.items[i];
if (item.regex.test(value)) {
return i;
}
}
}
return -1;
}
});
editor.addListener('selectionchange', function (type, causeByUi, uiReady){
if(!uiReady){
var state = editor.queryCommandState('FontFamily');
if (state == -1) {
ui.setDisabled(true);
} else {
ui.setDisabled(false);
var value = editor.queryCommandValue('FontFamily');
//trace:1871 ie下从源码模式切换回来时,字体会带单引号,而且会有逗号
value && (value = value.replace(/['"]/g,'').split(',')[0]);
ui.setValue( value);
}
}
});
return ui;
};
editorui.FontSize = function (editor, list, title){
list = list || editor.options.listMap['fontsize'] || [];
title = title || editor.options.labelMap['fontsize'] || '';
var items = [];
for (var i=0; i<list.length; i++) {
var size = list[i] + 'px';
items.push({
label: size,
value: size,
renderLabelHtml: function (){
return '<div class="edui-label %%-label" style="font-size:' +
this.value + '">' + (this.label || '') + '</div>';
}
});
}
var ui = new editorui.Combox({
editor:editor,
items: items,
title: title,
initValue: editor.options.ComboxInitial.FONT_SIZE,
onselect: function (t,index){
editor.execCommand('FontSize', this.items[index].value);
},
onbuttonclick: function (){
this.showPopup();
},
className: 'edui-for-fontsize'
});
editor.addListener('selectionchange', function (type, causeByUi, uiReady){
if(!uiReady){
var state = editor.queryCommandState('FontSize');
if (state == -1) {
ui.setDisabled(true);
} else {
ui.setDisabled(false);
ui.setValue(editor.queryCommandValue('FontSize'));
}
}
});
return ui;
};
// editorui.RowSpacing = function (editor, list, title){
// list = list || editor.options.listMap['rowspacing'] || [];
// title = title || editor.options.labelMap['rowspacing'] || '';
// var items = [];
// for (var i=0; i<list.length; i++) {
// var tag = list[i] + 'px';
// var value = list[i];
// items.push({
// label: tag,
// value: value,
// renderLabelHtml: function (){
// return '<div class="edui-label %%-label" style="font-size:12px">' + (this.label || '') + '</div>';
// }
// });
// }
// var ui = new editorui.Combox({
// editor:editor,
// items: items,
// title: title,
// initValue: editor.options.ComboxInitial.ROW_SPACING,
// onselect: function (t,index){
// editor.execCommand('RowSpacing', this.items[index].value);
// },
// onbuttonclick: function (){
// this.showPopup();
// },
// className: 'edui-for-rowspacing'
// });
// editor.addListener('selectionchange', function (type, causeByUi, uiReady){
// if(!uiReady){
// var state = editor.queryCommandState('RowSpacing');
// if (state == -1) {
// ui.setDisabled(true);
// } else {
// ui.setDisabled(false);
// ui.setValue(editor.queryCommandValue('RowSpacing'));
// }
// }
//
// });
// return ui;
// };
editorui.Paragraph = function (editor, list, title){
list = list || editor.options.listMap['paragraph'] || [];
title = title || editor.options.labelMap['paragraph'] || '';
var items = [];
for (var i=0; i<list.length; i++) {
var item = list[i].split(':');
var tag = item[0];
var label = item[1];
items.push({
label: label,
value: tag,
renderLabelHtml: function (){
return '<div class="edui-label %%-label"><span class="edui-for-' + this.value + '">' + (this.label || '') + '</span></div>';
}
});
}
var ui = new editorui.Combox({
editor:editor,
items: items,
title: title,
initValue: editor.options.ComboxInitial.PARAGRAPH,
className: 'edui-for-paragraph',
onselect: function (t,index){
editor.execCommand('Paragraph', this.items[index].value);
},
onbuttonclick: function (){
this.showPopup();
}
});
editor.addListener('selectionchange', function (type, causeByUi, uiReady){
if(!uiReady){
var state = editor.queryCommandState('Paragraph');
if (state == -1) {
ui.setDisabled(true);
} else {
ui.setDisabled(false);
var value = editor.queryCommandValue('Paragraph');
var index = ui.indexByValue(value);
if (index != -1) {
ui.setValue(value);
} else {
ui.setValue(ui.initValue);
}
}
}
});
return ui;
};
//自定义标题
editorui.CustomStyle = function(editor,list,title){
list = list || editor.options.listMap['customstyle'] || [];
title = title || editor.options.labelMap['customstyle'] || '';
for(var i=0,items = [],t;t=list[i++];){
(function(ti){
items.push({
label: ti.label,
value: ti,
renderLabelHtml: function (){
return '<div class="edui-label %%-label">' +'<'+ ti.tag +' ' + (ti.className?' class="'+ti.className+'"':"")
+ (ti.style ? ' style="' + ti.style+'"':"") + '>' + ti.label+"<\/"+ti.tag+">"
+ '</div>';
}
});
})(t)
}
var ui = new editorui.Combox({
editor:editor,
items: items,
title: title,
initValue:editor.options.ComboxInitial.CUSTOMSTYLE,
className: 'edui-for-customstyle',
onselect: function (t,index){
editor.execCommand('customstyle', this.items[index].value);
},
onbuttonclick: function (){
this.showPopup();
},
indexByValue: function (value){
for(var i=0,ti;ti=this.items[i++];){
if(ti.label == value){
return i-1
}
}
return -1;
}
});
editor.addListener('selectionchange', function (type, causeByUi, uiReady){
if(!uiReady){
var state = editor.queryCommandState('customstyle');
if (state == -1) {
ui.setDisabled(true);
} else {
ui.setDisabled(false);
var value = editor.queryCommandValue('customstyle');
var index = ui.indexByValue(value);
if (index != -1) {
ui.setValue(value);
} else {
ui.setValue(ui.initValue);
}
}
}
});
return ui;
};
editorui.InsertTable = function (editor, iframeUrl, title){
iframeUrl = iframeUrl || editor.options.iframeUrlMap['inserttable'] || 'about:blank';
iframeUrl = editor.ui.mapUrl(iframeUrl);
title = title || editor.options.labelMap['inserttable'] || '';
var dialog = new editorui.Dialog({
iframeUrl: iframeUrl,
autoReset: true,
draggable: true,
editor: editor,
className: 'edui-for-inserttable',
title: title,
buttons: [{
className: 'edui-okbutton',
label: '确认',
onclick: function (){
dialog.close(true);
}
}, {
className: 'edui-cancelbutton',
label: '取消',
onclick: function (){
dialog.close(false);
}
}],
onok: function (){},
oncancel: function (){},
onclose: function (t,ok){
if (ok) {
return this.onok();
} else {
return this.oncancel();
}
}
});
dialog.render();
editor.tableDialog = dialog;
var ui = new editorui.TableButton({
editor:editor,
title: title,
className: 'edui-for-inserttable',
onpicktable: function (t,numCols, numRows){
editor.execCommand('InsertTable', {numRows:numRows, numCols:numCols});
},
onmore: function (){
dialog.open();
},
onbuttonclick: function (){
dialog.open();
}
});
editor.addListener('selectionchange', function (){
var state = editor.queryCommandState('inserttable');
if (state == -1) {
ui.setDisabled(true);
} else {
ui.setDisabled(false);
}
});
return ui;
};
editorui.AutoTypeSet = function (editor, iframeUrl, title){
title = title || editor.options.labelMap['autotypeset'] || '';
var ui = new editorui.AutoTypeSetButton({
editor:editor,
title: title,
className: 'edui-for-autotypeset',
onbuttonclick: function (){
editor.execCommand('autotypeset')
}
});
editor.addListener('selectionchange', function (){
ui.setDisabled(editor.queryCommandState('autotypeset') == -1);
});
return ui;
};
editorui.LineHeight = function (editor, title){
for(var i=0,ci,items=[];ci = editor.options.listMap.lineheight[i++];){
items.push({
//todo:写死了
label : ci == '1' ? '默认' : ci,
value: ci,
onclick:function(){
editor.execCommand("lineheight", this.value);
}
})
}
var ui = new editorui.MenuButton({
editor:editor,
className : 'edui-for-lineheight',
title : title || editor.options.labelMap['lineheight'] || '',
items :items,
onbuttonclick: function (){
var value = editor.queryCommandValue('LineHeight') || this.value;
editor.execCommand("LineHeight", value);
}
});
editor.addListener('selectionchange', function (){
var state = editor.queryCommandState('LineHeight');
if (state == -1) {
ui.setDisabled(true);
} else {
ui.setDisabled(false);
var value = editor.queryCommandValue('LineHeight');
value && ui.setValue((value + '').replace(/cm/,''));
ui.setChecked(state)
}
});
return ui;
};
editorui.RowSpacingTop = function (editor, title){
for(var i=0,ci,items=[];ci = editor.options.listMap.rowspacing[i++];){
items.push({
label : ci,
value: ci,
onclick:function(){
editor.execCommand("rowspacing", this.value,'top');
}
})
}
var ui = new editorui.MenuButton({
editor:editor,
className : 'edui-for-rowspacingtop',
title : title || editor.options.labelMap['rowspacingtop'] || '段前间距',
items :items,
onbuttonclick: function (){
var value = editor.queryCommandValue('rowspacing','top') || this.value;
editor.execCommand("rowspacing", value,'top');
}
});
editor.addListener('selectionchange', function (){
var state = editor.queryCommandState('rowspacing','top');
if (state == -1) {
ui.setDisabled(true);
} else {
ui.setDisabled(false);
var value = editor.queryCommandValue('rowspacing','top');
value && ui.setValue((value + '').replace(/%/,''));
ui.setChecked(state)
}
});
return ui;
};
editorui.RowSpacingBottom = function (editor, title){
for(var i=0,ci,items=[];ci = editor.options.listMap.rowspacing[i++];){
items.push({
label : ci,
value: ci,
onclick:function(){
editor.execCommand("rowspacing", this.value,'bottom');
}
})
}
var ui = new editorui.MenuButton({
editor:editor,
className : 'edui-for-rowspacingbottom',
title : title || editor.options.labelMap['rowspacingbottom'] || '段后间距',
items :items,
onbuttonclick: function (){
var value = editor.queryCommandValue('rowspacing','bottom') || this.value;
editor.execCommand("rowspacing", value,'bottom');
}
});
editor.addListener('selectionchange', function (){
var state = editor.queryCommandState('rowspacing','bottom');
if (state == -1) {
ui.setDisabled(true);
} else {
ui.setDisabled(false);
var value = editor.queryCommandValue('rowspacing','bottom');
value && ui.setValue((value + '').replace(/%/,''));
ui.setChecked(state)
}
});
return ui;
};
editorui.InsertOrderedList = function (editor, title){
title = title || editor.options.labelMap['insertorderedlist'] || '';
var _onMenuClick = function(){
editor.execCommand("InsertOrderedList", this.value);
};
var ui = new editorui.MenuButton({
editor:editor,
className : 'edui-for-insertorderedlist',
title : title,
items :
[{
label: '1,2,3...',
value: 'decimal',
onclick : _onMenuClick
},{
label: 'a,b,c ...',
value: 'lower-alpha',
onclick : _onMenuClick
},{
label: 'i,ii,iii...',
value: 'lower-roman',
onclick : _onMenuClick
},{
label: 'A,B,C',
value: 'upper-alpha',
onclick : _onMenuClick
},{
label: 'I,II,III...',
value: 'upper-roman',
onclick : _onMenuClick
}],
onbuttonclick: function (){
var value = editor.queryCommandValue('InsertOrderedList') || this.value;
editor.execCommand("InsertOrderedList", value);
}
});
editor.addListener('selectionchange', function (){
var state = editor.queryCommandState('InsertOrderedList');
if (state == -1) {
ui.setDisabled(true);
} else {
ui.setDisabled(false);
var value = editor.queryCommandValue('InsertOrderedList');
ui.setValue(value);
ui.setChecked(state)
}
});
return ui;
};
editorui.InsertUnorderedList = function (editor, title){
title = title || editor.options.labelMap['insertunorderedlist'] || '';
var _onMenuClick = function(){
editor.execCommand("InsertUnorderedList", this.value);
};
var ui = new editorui.MenuButton({
editor:editor,
className : 'edui-for-insertunorderedlist',
title: title,
items:
[{
label: '○ 小圆圈',
value: 'circle',
onclick : _onMenuClick
},{
label: '● 小圆点',
value: 'disc',
onclick : _onMenuClick
},{
label: '■ 小方块',
value: 'square',
onclick : _onMenuClick
}],
onbuttonclick: function (){
var value = editor.queryCommandValue('InsertUnorderedList') || this.value;
editor.execCommand("InsertUnorderedList", value);
}
});
editor.addListener('selectionchange', function (){
var state = editor.queryCommandState('InsertUnorderedList');
if (state == -1) {
ui.setDisabled(true);
} else {
ui.setDisabled(false);
var value = editor.queryCommandValue('InsertUnorderedList');
ui.setValue(value);
ui.setChecked(state)
}
});
return ui;
};
editorui.FullScreen = function (editor, title){
title = title || editor.options.labelMap['fullscreen'] || '';
var ui = new editorui.Button({
className: 'edui-for-fullscreen',
title: title,
onclick: function (){
if (editor.ui) {
editor.ui.setFullScreen(!editor.ui.isFullScreen());
}
this.setChecked(editor.ui.isFullScreen());
}
});
editor.addListener('selectionchange', function (){
var state = editor.queryCommandState('fullscreen');
ui.setDisabled(state == -1);
ui.setChecked(editor.ui.isFullScreen());
});
return ui;
};
editorui.Emotion = function(editor, iframeUrl, title){
title = title || editor.options.labelMap['emotion'] || '';
iframeUrl = iframeUrl || editor.options.iframeUrlMap['emotion'] || 'about:blank';
iframeUrl = editor.ui.mapUrl(iframeUrl);
var ui = new editorui.MultiMenuPop({
title: title,
editor: editor,
className: 'edui-for-emotion',
iframeUrl: iframeUrl
});
editor.addListener('selectionchange', function (){
var state = editor.queryCommandState('emotion');
if (state == -1) {
ui.setDisabled(true);
} else {
ui.setDisabled(false);
}
});
return ui;
};
})();
///import core
///commands 全屏
///commandsName FullScreen
///commandsTitle 全屏
(function () {
var utils = baidu.editor.utils,
uiUtils = baidu.editor.ui.uiUtils,
UIBase = baidu.editor.ui.UIBase;
function EditorUI( options ) {
this.initOptions( options );
this.initEditorUI();
}
EditorUI.prototype = {
uiName: 'editor',
initEditorUI: function () {
this.editor.ui = this;
this._dialogs = {};
this.initUIBase();
this._initToolbars();
var editor = this.editor,
iframeUrlMap = editor.options.iframeUrlMap;
editor.addListener( 'ready', function () {
baidu.editor.dom.domUtils.on( editor.window, 'scroll', function () {
baidu.editor.ui.Popup.postHide();
} );
//display bottom-bar label based on config
if ( editor.options.elementPathEnabled ) {
editor.ui.getDom( 'elementpath' ).innerHTML = '<div class="edui-editor-breadcrumb">path:</div>';
}
if ( editor.options.wordCount ) {
editor.ui.getDom( 'wordcount' ).innerHTML = '字数统计';
}
if(!editor.selection.isFocus())return;
editor.fireEvent( 'selectionchange', false, true );
} );
editor.addListener( 'mousedown', function ( t, evt ) {
var el = evt.target || evt.srcElement;
baidu.editor.ui.Popup.postHide( el );
} );
editor.addListener( 'contextmenu', function ( t, evt ) {
baidu.editor.ui.Popup.postHide();
} );
var me = this;
editor.addListener( 'selectionchange', function () {
if(!editor.selection.isFocus())return;
me._updateElementPath();
//字数统计
me._wordCount();
} );
editor.addListener( 'sourcemodechanged', function ( t, mode ) {
if ( editor.options.elementPathEnabled ) {
if ( mode ) {
me.disableElementPath();
} else {
me.enableElementPath();
}
}
if ( editor.options.wordCount ) {
if ( mode ) {
me.disableWordCount();
} else {
me.enableWordCount();
}
}
} );
// 超链接的编辑器浮层
var linkDialog = new baidu.editor.ui.Dialog( {
iframeUrl: iframeUrlMap ? editor.ui.mapUrl(iframeUrlMap.link ):"",
autoReset: true,
draggable: true,
editor: editor,
className: 'edui-for-link',
title: '超链接',
buttons: [
{
className: 'edui-okbutton',
label: '确认',
onclick: function () {
linkDialog.close( true );
}
},
{
className: 'edui-cancelbutton',
label: '取消',
onclick: function () {
linkDialog.close( false );
}
}
],
onok: function () {
},
oncancel: function () {
},
onclose: function ( t, ok ) {
if ( ok ) {
return this.onok();
} else {
return this.oncancel();
}
}
} );
linkDialog.render();
// 图片的编辑器浮层
var imgDialog = new baidu.editor.ui.Dialog( {
iframeUrl: iframeUrlMap?editor.ui.mapUrl(iframeUrlMap.insertimage ):"",
autoReset: true,
draggable: true,
editor: editor,
className: 'edui-for-insertimage',
title: '图片',
buttons: [
{
className: 'edui-okbutton',
label: '确认',
onclick: function () {
imgDialog.close( true );
}
},
{
className: 'edui-cancelbutton',
label: '取消',
onclick: function () {
imgDialog.close( false );
}
}
],
onok: function () {
},
oncancel: function () {
},
onclose: function ( t, ok ) {
if ( ok ) {
return this.onok();
} else {
return this.oncancel();
}
}
} );
imgDialog.render();
//锚点
var anchorDialog = new baidu.editor.ui.Dialog( {
iframeUrl: iframeUrlMap?editor.ui.mapUrl( iframeUrlMap.anchor ):"",
autoReset: true,
draggable: true,
editor: editor,
className: 'edui-for-anchor',
title: '锚点',
buttons: [
{
className: 'edui-okbutton',
label: '确认',
onclick: function () {
anchorDialog.close( true );
}
},
{
className: 'edui-cancelbutton',
label: '取消',
onclick: function () {
anchorDialog.close( false );
}
}
],
onok: function () {
},
oncancel: function () {
},
onclose: function ( t, ok ) {
if ( ok ) {
return this.onok();
} else {
return this.oncancel();
}
}
} );
anchorDialog.render();
// video
var videoDialog = new baidu.editor.ui.Dialog( {
iframeUrl: iframeUrlMap?editor.ui.mapUrl( iframeUrlMap.insertvideo ):"",
autoReset: true,
draggable: true,
editor: editor,
className: 'edui-for-insertvideo',
title: '视频',
buttons: [
{
className: 'edui-okbutton',
label: '确认',
onclick: function () {
videoDialog.close( true );
}
},
{
className: 'edui-cancelbutton',
label: '取消',
onclick: function () {
videoDialog.close( false );
}
}
],
onok: function () {
},
oncancel: function () {
},
onclose: function ( t, ok ) {
if ( ok ) {
return this.onok();
} else {
return this.oncancel();
}
}
} );
videoDialog.render();
//本地word图片上传
var wordImageDialog = new baidu.editor.ui.Dialog( {
iframeUrl: iframeUrlMap?editor.ui.mapUrl( iframeUrlMap.wordimage ):"",
autoReset: true,
draggable: true,
editor: editor,
className: 'edui-for-wordimage',
title: '图片转存',
buttons: [
{
className: 'edui-okbutton',
label: '确认',
onclick: function () {
wordImageDialog.close( true );
}
},
{
className: 'edui-cancelbutton',
label: '取消',
onclick: function () {
wordImageDialog.close( false );
}
}
],
onok: function () {
},
oncancel: function () {
},
onclose: function ( t, ok ) {
if ( ok ) {
return this.onok();
} else {
return this.oncancel();
}
}
} );
wordImageDialog.render();
//挂载dialog框到ui实例
me._dialogs['wordImageDialog'] = wordImageDialog;
var tdDialog = new baidu.editor.ui.Dialog({
iframeUrl: iframeUrlMap?me.mapUrl(iframeUrlMap['edittd']):'about:blank',
autoReset: true,
draggable: true,
editor:editor,
className: 'edui-for-edittd',
title: "单元格",
buttons: [{
className: 'edui-okbutton',
label: '确认',
onclick: function (){
tdDialog.close(true);
}
}, {
className: 'edui-cancelbutton',
label: '取消',
onclick: function (){
tdDialog.close(false);
}
}],
onok: function (){},
oncancel: function (){},
onclose: function (t,ok){
if (ok) {
return this.onok();
} else {
return this.oncancel();
}
}
});
tdDialog.render();
me._dialogs['tdDialog'] = tdDialog;
// map
var mapDialog = new baidu.editor.ui.Dialog( {
iframeUrl: iframeUrlMap?editor.ui.mapUrl(iframeUrlMap.map ):"",
autoReset: true,
draggable: true,
editor: editor,
className: 'edui-for-map',
title: '地图',
buttons: [
{
className: 'edui-okbutton',
label: '确认',
onclick: function () {
mapDialog.close( true );
}
},
{
className: 'edui-cancelbutton',
label: '取消',
onclick: function () {
mapDialog.close( false );
}
}
],
onok: function () {
},
oncancel: function () {
},
onclose: function ( t, ok ) {
if ( ok ) {
return this.onok();
} else {
return this.oncancel();
}
}
} );
mapDialog.render();
// map
var gmapDialog = new baidu.editor.ui.Dialog( {
iframeUrl: iframeUrlMap?editor.ui.mapUrl( iframeUrlMap.gmap ):"",
autoReset: true,
draggable: true,
editor: editor,
className: 'edui-for-gmap',
title: 'Google地图',
buttons: [
{
className: 'edui-okbutton',
label: '确认',
onclick: function () {
gmapDialog.close( true );
}
},
{
className: 'edui-cancelbutton',
label: '取消',
onclick: function () {
gmapDialog.close( false );
}
}
],
onok: function () {
},
oncancel: function () {
},
onclose: function ( t, ok ) {
if ( ok ) {
return this.onok();
} else {
return this.oncancel();
}
}
} );
gmapDialog.render();
var popup = new baidu.editor.ui.Popup( {
editor:editor,
content: '',
className: 'edui-bubble',
_onEditButtonClick: function () {
this.hide();
linkDialog.open();
},
_onImgEditButtonClick: function () {
this.hide();
var nodeStart = editor.selection.getRange().getClosedNode();
var img = baidu.editor.dom.domUtils.findParentByTagName( nodeStart, "img", true );
if ( img && img.className.indexOf( "edui-faked-video" ) != -1 ) {
videoDialog.open();
} else if ( img && img.src.indexOf( "http://api.map.baidu.com" ) != -1 ) {
mapDialog.open();
} else if ( img && img.src.indexOf( "http://maps.google.com/maps/api/staticmap" ) != -1 ) {
gmapDialog.open();
} else if ( img && img.getAttribute( "anchorname" ) ) {
anchorDialog.open();
}else if(img && img.getAttribute("word_img")){
editor.word_img = [img.getAttribute("word_img")];
editor.ui._dialogs["wordImageDialog"].open();
} else {
imgDialog.open();
}
},
_getImg: function () {
var img = editor.selection.getRange().getClosedNode();
if ( img && (img.nodeName == 'img' || img.nodeName == 'IMG') ) {
return img;
}
return null;
},
_onImgSetFloat: function( value ) {
if ( this._getImg() ) {
editor.execCommand( "imagefloat", value );
var img = this._getImg();
if ( img ) {
this.showAnchor( img );
}
}
},
_setIframeAlign: function( value ) {
var frame = popup.anchorEl;
var newFrame = frame.cloneNode( true );
switch ( value ) {
case -2:
newFrame.setAttribute( "align", "" );
break;
case -1:
newFrame.setAttribute( "align", "left" );
break;
case 1:
newFrame.setAttribute( "align", "right" );
break;
case 2:
newFrame.setAttribute( "align", "middle" );
break;
}
frame.parentNode.insertBefore( newFrame, frame );
baidu.editor.dom.domUtils.remove( frame );
popup.anchorEl = newFrame;
popup.showAnchor( popup.anchorEl );
},
_updateIframe: function() {
editor._iframe = popup.anchorEl;
insertframe.open();
popup.hide();
},
_onRemoveButtonClick: function () {
var nodeStart = editor.selection.getRange().getClosedNode();
var img = baidu.editor.dom.domUtils.findParentByTagName( nodeStart, "img", true );
if ( img && img.getAttribute( "anchorname" ) ) {
editor.execCommand( "anchor" );
} else {
editor.execCommand( 'unlink' );
}
this.hide();
},
queryAutoHide: function ( el ) {
if ( el && el.ownerDocument == editor.document ) {
if ( el.tagName.toLowerCase() == 'img' || baidu.editor.dom.domUtils.findParentByTagName( el, 'a', true ) ) {
return el !== popup.anchorEl;
}
}
return baidu.editor.ui.Popup.prototype.queryAutoHide.call( this, el );
}
} );
popup.render();
//iframe
var insertframe = new baidu.editor.ui.Dialog( {
iframeUrl: iframeUrlMap?editor.ui.mapUrl( iframeUrlMap.insertframe ):"",
autoReset: true,
draggable: true,
editor: editor,
className: 'edui-for-insertframe',
title: '插入iframe',
buttons: [
{
className: 'edui-okbutton',
label: '确认',
onclick: function () {
insertframe.close( true );
}
},
{
className: 'edui-cancelbutton',
label: '取消',
onclick: function () {
insertframe.close( false );
}
}
],
onok: function () {
},
oncancel: function () {
},
onclose: function ( t, ok ) {
if ( ok ) {
return this.onok();
} else {
return this.oncancel();
}
}
} );
insertframe.render();
editor.addListener( 'mouseover', function( t, evt ) {
evt = evt || window.event;
var el = evt.target || evt.srcElement;
if ( /iframe/ig.test( el.tagName ) && editor.options.imagePopup ) {
var html = popup.formatHtml(
'<nobr>属性: <span onclick=$$._setIframeAlign(-2) class="edui-clickable">默认</span> <span onclick=$$._setIframeAlign(-1) class="edui-clickable">左对齐</span> <span onclick=$$._setIframeAlign(1) class="edui-clickable">右对齐</span> ' +
'<span onclick=$$._setIframeAlign(2) class="edui-clickable">居中</span>' +
' <span onclick="$$._updateIframe( this);" class="edui-clickable">修改</span></nobr>' );
if ( html ) {
popup.getDom( 'content' ).innerHTML = html;
popup.anchorEl = el;
popup.showAnchor( popup.anchorEl );
} else {
popup.hide();
}
}
} );
editor.addListener( 'selectionchange', function ( t, causeByUi ) {
if ( !causeByUi ) return;
var html = '';
var img = editor.selection.getRange().getClosedNode();
if ( img != null && img.tagName.toLowerCase() == 'img' ) {
if ( img.getAttribute( 'anchorname' ) ) {
//锚点处理
html += popup.formatHtml(
'<nobr>属性: <span onclick=$$._onImgEditButtonClick(event) class="edui-clickable">修改</span> <span onclick=$$._onRemoveButtonClick(event) class="edui-clickable">删除</span></nobr>' );
} else if ( editor.options.imagePopup ) {
html += popup.formatHtml(
'<nobr>属性: <span onclick=$$._onImgSetFloat("none") class="edui-clickable">默认</span> <span onclick=$$._onImgSetFloat("left") class="edui-clickable">居左</span> <span onclick=$$._onImgSetFloat("right") class="edui-clickable">居右</span> ' +
'<span onclick=$$._onImgSetFloat("center") class="edui-clickable">居中</span>' +
' <span onclick="$$._onImgEditButtonClick(event, this);" class="edui-clickable">修改</span></nobr>' );
}
}
var link;
if ( editor.selection.getRange().collapsed ) {
link = editor.queryCommandValue( "link" );
} else {
link = editor.selection.getStart();
}
link = baidu.editor.dom.domUtils.findParentByTagName( link, "a", true );
var url;
if ( link != null && (url = (link.getAttribute( 'data_ue_src' ) || link.getAttribute( 'href', 2 ))) != null ) {
var txt = url;
if ( url.length > 30 ) {
txt = url.substring( 0, 20 ) + "...";
}
if ( html ) {
html += '<div style="height:5px;"></div>'
}
html += popup.formatHtml(
'<nobr>链接: <a target="_blank" href="' + url + '" title="' + url + '" >' + txt + '</a>' +
' <span class="edui-clickable" onclick="$$._onEditButtonClick(event, this);">修改</span>' +
' <span class="edui-clickable" onclick="$$._onRemoveButtonClick(event, this);"> 清除</span></nobr>' );
popup.showAnchor( link );
}
if ( html ) {
popup.getDom( 'content' ).innerHTML = html;
popup.anchorEl = img || link;
popup.showAnchor( popup.anchorEl );
} else {
popup.hide();
}
} );
},
_initToolbars: function () {
var editor = this.editor;
var toolbars = this.toolbars || [];
var toolbarUis = [];
for ( var i = 0; i < toolbars.length; i++ ) {
var toolbar = toolbars[i];
var toolbarUi = new baidu.editor.ui.Toolbar();
for ( var j = 0; j < toolbar.length; j++ ) {
var toolbarItem = toolbar[j];
var toolbarItemUi = null;
if ( typeof toolbarItem == 'string' ) {
if ( toolbarItem == '|' ) {
toolbarItem = 'Separator';
}
if ( baidu.editor.ui[toolbarItem] ) {
toolbarItemUi = new baidu.editor.ui[toolbarItem]( editor );
}
//todo fullscreen这里单独处理一下,放到首行去
if ( toolbarItem == 'FullScreen' ) {
if ( toolbarUis && toolbarUis[0] ) {
toolbarUis[0].items.splice( 0, 0, toolbarItemUi );
} else {
toolbarUi.items.splice( 0, 0, toolbarItemUi );
}
continue;
}
} else {
toolbarItemUi = toolbarItem;
}
if ( toolbarItemUi ) {
toolbarUi.add( toolbarItemUi );
}
}
toolbarUis[i] = toolbarUi;
}
this.toolbars = toolbarUis;
},
getHtmlTpl: function () {
return '<div id="##" class="%%">' +
'<div id="##_toolbarbox" class="%%-toolbarbox">' +
'<div id="##_toolbarboxouter" class="%%-toolbarboxouter"><div class="%%-toolbarboxinner">' +
this.renderToolbarBoxHtml() +
'</div></div>' +
'<div id="##_toolbarmsg" class="%%-toolbarmsg" style="display:none;">' +
'<div id = "##_upload_dialog" class="%%-toolbarmsg-upload" onclick="$$.showWordImageDialog();">点此上传</div>' +
'<div class="%%-toolbarmsg-close" onclick="$$.hideToolbarMsg();">x</div>' +
'<div id="##_toolbarmsg_label" class="%%-toolbarmsg-label"></div>' +
'<div style="height:0;overflow:hidden;clear:both;"></div>' +
'</div>' +
'</div>' +
'<div id="##_iframeholder" class="%%-iframeholder"></div>' +
//modify wdcount by matao
'<div id="##_bottombar" class="%%-bottomContainer"><table><tr>' +
'<td id="##_elementpath" class="%%-bottombar"></td>' +
'<td id="##_wordcount" class="%%-wordcount"></td>' +
'</tr></table></div>' +
'</div>';
},
showWordImageDialog:function() {
this.editor.execCommand( "wordimage", "word_img" );
this._dialogs['wordImageDialog'].open();
},
renderToolbarBoxHtml: function () {
var buff = [];
for ( var i = 0; i < this.toolbars.length; i++ ) {
buff.push( this.toolbars[i].renderHtml() );
}
return buff.join( '' );
},
setFullScreen: function ( fullscreen ) {
if ( this._fullscreen != fullscreen ) {
this._fullscreen = fullscreen;
this.editor.fireEvent( 'beforefullscreenchange', fullscreen );
var editor = this.editor;
if ( baidu.editor.browser.gecko ) {
var bk = editor.selection.getRange().createBookmark();
}
if ( fullscreen ) {
this._bakHtmlOverflow = document.documentElement.style.overflow;
this._bakBodyOverflow = document.body.style.overflow;
this._bakAutoHeight = this.editor.autoHeightEnabled;
this._bakScrollTop = Math.max( document.documentElement.scrollTop, document.body.scrollTop );
if ( this._bakAutoHeight ) {
//当全屏时不能执行自动长高
editor.autoHeightEnabled = false;
this.editor.disableAutoHeight();
}
document.documentElement.style.overflow = 'hidden';
document.body.style.overflow = 'hidden';
this._bakCssText = this.getDom().style.cssText;
this._bakCssText1 = this.getDom( 'iframeholder' ).style.cssText;
this._updateFullScreen();
} else {
this.getDom().style.cssText = this._bakCssText;
this.getDom( 'iframeholder' ).style.cssText = this._bakCssText1;
if ( this._bakAutoHeight ) {
editor.autoHeightEnabled = true;
this.editor.enableAutoHeight();
}
document.documentElement.style.overflow = this._bakHtmlOverflow;
document.body.style.overflow = this._bakBodyOverflow;
window.scrollTo( 0, this._bakScrollTop );
}
if ( baidu.editor.browser.gecko ) {
var input = document.createElement( 'input' );
document.body.appendChild( input );
editor.body.contentEditable = false;
setTimeout( function() {
input.focus();
setTimeout( function() {
editor.body.contentEditable = true;
editor.selection.getRange().moveToBookmark( bk ).select( true );
baidu.editor.dom.domUtils.remove( input );
fullscreen && window.scroll( 0, 0 );
} )
} )
}
this.editor.fireEvent( 'fullscreenchanged', fullscreen );
this.triggerLayout();
}
},
_wordCount:function() {
var wdcount = this.getDom( 'wordcount' );
if ( !this.editor.options.wordCount ) {
wdcount.style.display = "none";
return;
}
wdcount.innerHTML = this.editor.queryCommandValue( "wordcount" );
},
disableWordCount: function () {
var w = this.getDom( 'wordcount' );
w.innerHTML = '';
w.style.display = 'none';
this.wordcount = false;
},
enableWordCount: function () {
var w = this.getDom( 'wordcount' );
w.style.display = '';
this.wordcount = true;
this._wordCount();
},
_updateFullScreen: function () {
if ( this._fullscreen ) {
var vpRect = uiUtils.getViewportRect();
this.getDom().style.cssText = 'border:0;position:absolute;left:0;top:0;width:' + vpRect.width + 'px;height:' + vpRect.height + 'px;z-index:' + (this.getDom().style.zIndex * 1 + 100);
uiUtils.setViewportOffset( this.getDom(), { left: 0, top: 0 } );
this.editor.setHeight( vpRect.height - this.getDom( 'toolbarbox' ).offsetHeight - this.getDom( 'bottombar' ).offsetHeight );
}
},
_updateElementPath: function () {
var bottom = this.getDom( 'elementpath' ),list;
if ( this.elementPathEnabled && (list = this.editor.queryCommandValue( 'elementpath' ))) {
var buff = [];
for ( var i = 0,ci; ci = list[i]; i++ ) {
buff[i] = this.formatHtml( '<span unselectable="on" onclick="$$.editor.execCommand("elementpath", "' + i + '");">' + ci + '</span>' );
}
bottom.innerHTML = '<div class="edui-editor-breadcrumb" onmousedown="return false;">path: ' + buff.join( ' > ' ) + '</div>';
} else {
bottom.style.display = 'none'
}
},
disableElementPath: function () {
var bottom = this.getDom( 'elementpath' );
bottom.innerHTML = '';
bottom.style.display = 'none';
this.elementPathEnabled = false;
},
enableElementPath: function () {
var bottom = this.getDom( 'elementpath' );
bottom.style.display = '';
this.elementPathEnabled = true;
this._updateElementPath();
},
isFullScreen: function () {
return this._fullscreen;
},
postRender: function () {
UIBase.prototype.postRender.call( this );
for ( var i = 0; i < this.toolbars.length; i++ ) {
this.toolbars[i].postRender();
}
var me = this;
var timerId,
domUtils = baidu.editor.dom.domUtils,
updateFullScreenTime = function() {
clearTimeout( timerId );
timerId = setTimeout( function () {
me._updateFullScreen();
} );
};
domUtils.on( window, 'resize', updateFullScreenTime );
me.addListener( 'destroy', function() {
domUtils.un( window, 'resize', updateFullScreenTime );
clearTimeout( timerId );
} )
},
showToolbarMsg: function ( msg, flag ) {
this.getDom( 'toolbarmsg_label' ).innerHTML = msg;
this.getDom( 'toolbarmsg' ).style.display = '';
//
if ( !flag ) {
var w = this.getDom( 'upload_dialog' );
w.style.display = 'none';
}
},
hideToolbarMsg: function () {
this.getDom( 'toolbarmsg' ).style.display = 'none';
},
mapUrl: function ( url ) {
return url.replace( '~/', this.editor.options.UEDITOR_HOME_URL || '' );
},
triggerLayout: function () {
var dom = this.getDom();
if ( dom.style.zoom == '1' ) {
dom.style.zoom = '100%';
} else {
dom.style.zoom = '1';
}
}
};
utils.inherits( EditorUI, baidu.editor.ui.UIBase );
baidu.editor.ui.Editor = function ( options ) {
var editor = new baidu.editor.Editor( options );
editor.options.editor = editor;
new EditorUI( editor.options );
var oldRender = editor.render;
editor.render = function ( holder ) {
if ( holder ) {
if ( holder.constructor === String ) {
holder = document.getElementById( holder );
}
holder && holder.getAttribute( 'name' ) && ( editor.options.textarea = holder.getAttribute( 'name' ));
if ( holder && /script|textarea/ig.test( holder.tagName ) ) {
var newDiv = document.createElement( 'div' );
holder.parentNode.insertBefore( newDiv, holder );
editor.options.initialContent = holder.value || holder.innerHTML;
holder.id && (newDiv.id = holder.id);
holder.className && (newDiv.className = holder.className);
holder.style.cssText && (newDiv.style.cssText = holder.style.cssText);
holder.parentNode.removeChild( holder );
holder = newDiv;
holder.innerHTML = '';
}
}
editor.ui.render( holder );
var iframeholder = editor.ui.getDom( 'iframeholder' );
//给实例添加一个编辑器的容器引用
editor.container = editor.ui.getDom();
editor.container.style.zIndex = editor.options.zIndex;
oldRender.call( editor, iframeholder );
};
return editor;
};
})();
///import core
///import uicore
///commands 表情
(function(){
var utils = baidu.editor.utils,
Popup = baidu.editor.ui.Popup,
SplitButton = baidu.editor.ui.SplitButton,
MultiMenuPop = baidu.editor.ui.MultiMenuPop = function(options){
this.initOptions(options);
this.initMultiMenu();
};
MultiMenuPop.prototype = {
initMultiMenu: function (){
var me = this;
this.popup = new Popup({
content: '',
editor : me.editor,
iframe_rendered: false,
onshow: function (){
if (!this.iframe_rendered) {
this.iframe_rendered = true;
this.getDom('content').innerHTML = '<iframe id="'+me.id+'_iframe" src="'+ me.iframeUrl +'" frameborder="0"></iframe>';
me.editor.container.style.zIndex && (this.getDom().style.zIndex = me.editor.container.style.zIndex * 1 + 1);
}
}
// canSideUp:false,
// canSideLeft:false
});
this.onbuttonclick = function(){
this.showPopup();
};
this.initSplitButton();
}
};
utils.inherits(MultiMenuPop, SplitButton);
})();
})(); | 10npsite | trunk/guanli/system/ueditor/editor_all.js | JavaScript | asf20 | 633,901 |
<?php
/**
* Created by JetBrains PhpStorm.
* User: taoqili
* Date: 12-2-8
* Time: 下午1:20
* To change this template use File | Settings | File Templates.
*/
//上传配置
$config = array(
"uploadPath" => "../uploadfiles/" , //保存路径
"fileType" => array( ".rar" , ".doc" , ".docx" , ".zip" , ".pdf" , ".txt" , ".swf", ".wmv" ) , //文件允许格式
"fileSize" => 100 //文件大小限制,单位MB
);
//文件上传状态,当成功时返回SUCCESS,其余值将直接返回对应字符窜
$state = "SUCCESS";
$fileName = "";
$path = $config[ 'uploadPath' ];
if ( !file_exists( $path ) ) {
mkdir( "$path" , 0777 );
}
$clientFile = $_FILES[ "Filedata" ]; //"Filedata是swfupload默认的文件域"
if(!isset($clientFile)){
echo "{'state':'文件大小超出服务器配置!','url':'null','fileType':'null'}";//请修改php.ini中的upload_max_filesize和post_max_size
exit;
}
//格式验证
$current_type = strtolower( strrchr( $clientFile[ "name" ] , '.' ) );
if ( !in_array( $current_type , $config[ 'fileType' ] ) ) {
$state = "不支持的文件类型!";
}
//大小验证
$file_size = 1024 * 1024 * $config[ 'fileSize' ];
if ( $clientFile[ "size" ] > $file_size ) {
$state = "文件大小超出限制!";
}
//保存文件
if ( $state == "SUCCESS" ) {
$tmp_file = $clientFile[ "name" ];
$fileName = $path . rand( 1 , 10000 ) . time() . strrchr( $tmp_file , '.' );
$result = move_uploaded_file( $clientFile[ "tmp_name" ] , $fileName );
if ( !$result ) {
$state = "文件保存失败!";
}
}
//向浏览器返回数据json数据
$fileName = str_replace( '../' , '' , $fileName );
echo "{'state':'" . $state . "','url':'" . $fileName . "','fileType':'" . $current_type . "'}";
?>
| 10npsite | trunk/guanli/system/ueditor/server/upload/php/fileUp.php | PHP | asf20 | 1,817 |
<?php
require "../../../config.php";
//上传配置
$config = array(
"uploadPath"=>$sys_config["uppicload"], //保存路径
"fileType"=>$sys_config["fileType"], //文件允许格式
"fileSize"=>$sys_config["fileSize"], //文件大小限制,单位KB
);
//文件上传状态,当成功时返回SUCCESS,其余值将直接返回对应字符窜并显示在图片预览框,同时可以在前端页面通过回调函数获取对应字符窜
$state = "SUCCESS";
$fileName="";
$path = $config['uploadPath'];
if(!file_exists($path)){
mkdir("$path", 0777);
}
//格式验证
$current_type = strtolower(strrchr($_FILES["upfile"]["name"], '.'));
if(!in_array($current_type, $config['fileType'])){
$state = "不支持的图片类型!";
}
//大小验证
$file_size = 1024 * $config['fileSize'];
if( $_FILES["upfile"]["size"] > $file_size ){
$state = "图片大小超出限制!";
}
//保存图片
if($state == "SUCCESS"){
$resource = fopen("log.txt","a");
fwrite($resource,date("Ymd h:i:s")."UPLOAD - $_SERVER[REMOTE_ADDR]"
.$_FILES['upfile']['name']." "
.$_FILES['upfile']['type']."\n");
fclose($resource);
$tmp_file=$_FILES["upfile"]["name"];
$fileName = $path.rand(1,10000).time().strrchr($tmp_file,'.');
$result = move_uploaded_file($_FILES["upfile"]["tmp_name"],$fileName);
if(!$result){
$state = "图片保存失败!";
}
}
//向浏览器返回数据json数据
$file= str_replace('../','',$fileName); //为方便理解,替换掉所有类似../和./等相对路径标识
echo "{'url':'".$file."','state':'".$state."'}";
?> | 10npsite | trunk/guanli/system/ueditor/server/upload/php/snapImgUp.php | PHP | asf20 | 1,854 |
<?php
require "../../../config.php";
//上传配置
$config = array(
"uploadPath"=>$sys_config["uppicload"], //保存路径
"fileType"=>$sys_config["fileType"], //文件允许格式
"fileSize"=>$sys_config["fileSize"], //文件大小限制,单位KB
);
//文件上传状态,当成功时返回SUCCESS,其余值将直接返回对应字符窜并显示在图片预览框,同时可以在前端页面通过回调函数获取对应字符窜
$state = "SUCCESS";$fileName="";
$title = htmlspecialchars($_POST['pictitle'], ENT_QUOTES);
$path = $config['uploadPath'];
if(!file_exists($path)){
mkdir("$path", 0777);
}
//格式验证
$current_type = strtolower(strrchr($_FILES["picdata"]["name"], '.'));
if(!in_array($current_type, $config['fileType'])){
$state = "不支持的图片类型!";
}
//大小验证
$file_size = 1024 * $config['fileSize'];
if( $_FILES["picdata"]["size"] > $file_size ){
$state = "图片大小超出限制!";
}
//保存图片
if($state == "SUCCESS"){
$tmp_file=$_FILES["picdata"]["name"];
$fileName = $path.rand(1,10000).time().strrchr($tmp_file,'.');
$result = move_uploaded_file($_FILES["picdata"]["tmp_name"],$_SERVER['DOCUMENT_ROOT'].$fileName);
if(!$result){
$state = "图片保存失败!";
}
}
//向浏览器返回数据json数据
$file= str_replace('../','',$fileName); //为方便理解,替换掉所有类似../和./等相对路径标识
echo "{'url':'".$file."','title':'".$title."','state':'".$state."'}";
?>
| 10npsite | trunk/guanli/system/ueditor/server/upload/php/imageUp.php | PHP | asf20 | 1,755 |
<!--#include FILE="upload.inc"-->
<%
dim upload,file,formName,title,state,picSize,picType,uploadPath,fileExt,fileName,prefix
uploadPath = "../uploadimages/" '上传保存路径
picSize = 500 '允许的文件大小,单位KB
picType = ".jpg,.gif,.png,.bmp" '允许的图片格式
'文件上传状态,当成功时返回SUCCESS,其余值将直接返回对应字符窜并显示在图片预览框,同时可以在前端页面通过回调函数获取对应字符窜
state="SUCCESS"
set upload=new upload_5xSoft '建立上传对象
title = htmlspecialchars(upload.form("pictitle"))
for each formName in upload.file
set file=upload.file(formName)
'大小验证
if file.filesize > picSize*1024 then
state="图片大小超出限制"
end if
'格式验证
fileExt = lcase(mid(file.FileName, instrrev(file.FileName,".")))
if instr(picType, fileExt)=0 then
state = "图片类型错误"
end If
'保存图片
prefix = int(900000*Rnd)+1000
if state="SUCCESS" then
fileName = uploadPath & prefix & second(now) & fileExt
file.SaveAs Server.mappath( fileName)
end if
'返回数据
response.Write "{'url':'" & FileName & "','title':'"& title &"','state':'"& state &"'}"
set file=nothing
next
set upload=nothing
function htmlspecialchars(someString)
htmlspecialchars = replace(replace(replace(replace(someString, "&", "&"), ">", ">"), "<", "<"), """", """)
end function
%> | 10npsite | trunk/guanli/system/ueditor/server/upload/asp/imageUp.asp | Classic ASP | asf20 | 1,710 |
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
dim upfile_5xSoft_Stream
Class upload_5xSoft
dim Form,File,Version
Private Sub Class_Initialize
dim iStart,iFileNameStart,iFileNameEnd,iEnd,vbEnter,iFormStart,iFormEnd,theFile
dim strDiv,mFormName,mFormValue,mFileName,mFileSize,mFilePath,iDivLen,mStr
Version=""
if Request.TotalBytes<1 then Exit Sub
set Form=CreateObject("Scripting.Dictionary")
set File=CreateObject("Scripting.Dictionary")
set upfile_5xSoft_Stream=CreateObject("Adodb.Stream")
upfile_5xSoft_Stream.mode=3
upfile_5xSoft_Stream.type=1
upfile_5xSoft_Stream.open
upfile_5xSoft_Stream.write Request.BinaryRead(Request.TotalBytes)
vbEnter=Chr(13)&Chr(10)
iDivLen=inString(1,vbEnter)+1
strDiv=subString(1,iDivLen)
iFormStart=iDivLen
iFormEnd=inString(iformStart,strDiv)-1
while iFormStart < iFormEnd
iStart=inString(iFormStart,"name=""")
iEnd=inString(iStart+6,"""")
mFormName=subString(iStart+6,iEnd-iStart-6)
iFileNameStart=inString(iEnd+1,"filename=""")
if iFileNameStart>0 and iFileNameStart<iFormEnd then
iFileNameEnd=inString(iFileNameStart+10,"""")
mFileName=subString(iFileNameStart+10,iFileNameEnd-iFileNameStart-10)
iStart=inString(iFileNameEnd+1,vbEnter&vbEnter)
iEnd=inString(iStart+4,vbEnter&strDiv)
if iEnd>iStart then
mFileSize=iEnd-iStart-4
else
mFileSize=0
end if
set theFile=new FileInfo
theFile.FileName=getFileName(mFileName)
theFile.FilePath=getFilePath(mFileName)
theFile.FileSize=mFileSize
theFile.FileStart=iStart+4
theFile.FormName=FormName
file.add mFormName,theFile
else
iStart=inString(iEnd+1,vbEnter&vbEnter)
iEnd=inString(iStart+4,vbEnter&strDiv)
if iEnd>iStart then
mFormValue=subString(iStart+4,iEnd-iStart-4)
else
mFormValue=""
end if
form.Add mFormName,mFormValue
end if
iFormStart=iformEnd+iDivLen
iFormEnd=inString(iformStart,strDiv)-1
wend
End Sub
Private Function subString(theStart,theLen)
dim i,c,stemp
upfile_5xSoft_Stream.Position=theStart-1
stemp=""
for i=1 to theLen
if upfile_5xSoft_Stream.EOS then Exit for
c=ascB(upfile_5xSoft_Stream.Read(1))
If c > 127 Then
if upfile_5xSoft_Stream.EOS then Exit for
stemp=stemp&Chr(AscW(ChrB(AscB(upfile_5xSoft_Stream.Read(1)))&ChrB(c)))
i=i+1
else
stemp=stemp&Chr(c)
End If
Next
subString=stemp
End function
Private Function inString(theStart,varStr)
dim i,j,bt,theLen,str
InString=0
Str=toByte(varStr)
theLen=LenB(Str)
for i=theStart to upfile_5xSoft_Stream.Size-theLen
if i>upfile_5xSoft_Stream.size then exit Function
upfile_5xSoft_Stream.Position=i-1
if AscB(upfile_5xSoft_Stream.Read(1))=AscB(midB(Str,1)) then
InString=i
for j=2 to theLen
if upfile_5xSoft_Stream.EOS then
inString=0
Exit for
end if
if AscB(upfile_5xSoft_Stream.Read(1))<>AscB(MidB(Str,j,1)) then
InString=0
Exit For
end if
next
if InString<>0 then Exit Function
end if
next
End Function
Private Sub Class_Terminate
form.RemoveAll
file.RemoveAll
set form=nothing
set file=nothing
upfile_5xSoft_Stream.close
set upfile_5xSoft_Stream=nothing
End Sub
Private function GetFilePath(FullPath)
If FullPath <> "" Then
GetFilePath = left(FullPath,InStrRev(FullPath, "\"))
Else
GetFilePath = ""
End If
End function
Private function GetFileName(FullPath)
If FullPath <> "" Then
GetFileName = mid(FullPath,InStrRev(FullPath, "\")+1)
Else
GetFileName = ""
End If
End function
Private function toByte(Str)
dim i,iCode,c,iLow,iHigh
toByte=""
For i=1 To Len(Str)
c=mid(Str,i,1)
iCode =Asc(c)
If iCode<0 Then iCode = iCode + 65535
If iCode>255 Then
iLow = Left(Hex(Asc(c)),2)
iHigh =Right(Hex(Asc(c)),2)
toByte = toByte & chrB("&H"&iLow) & chrB("&H"&iHigh)
Else
toByte = toByte & chrB(AscB(c))
End If
Next
End function
End Class
Class FileInfo
dim FormName,FileName,FilePath,FileSize,FileStart
Private Sub Class_Initialize
FileName = ""
FilePath = ""
FileSize = 0
FileStart= 0
FormName = ""
End Sub
Public function SaveAs(FullPath)
dim dr,ErrorChar,i
SaveAs=1
if trim(fullpath)="" or FileSize=0 or FileStart=0 or FileName="" then exit function
if FileStart=0 or right(fullpath,1)="/" then exit function
set dr=CreateObject("Adodb.Stream")
dr.Mode=3
dr.Type=1
dr.Open
upfile_5xSoft_Stream.position=FileStart-1
upfile_5xSoft_Stream.copyto dr,FileSize
dr.SaveToFile FullPath,2
dr.Close
set dr=nothing
SaveAs=0
end function
End Class
</SCRIPT> | 10npsite | trunk/guanli/system/ueditor/server/upload/asp/upload.inc | HTML | asf20 | 5,023 |
<%@ WebHandler Language="C#" Class="fileUp" %>
/**
* Created by visual studio 2010
* User: xuheng
* Date: 12-3-9
* Time: 下午13:53
* To change this template use File | Settings | File Templates.
*/
using System;
using System.Web;
using System.IO;
public class fileUp : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
//上传配置
String pathbase = "../uploadfiles/"; //保存路径
string[] filetype = { ".rar", ".doc", ".docx", ".zip", ".pdf", ".txt", ".swf", ".wmv" }; //文件允许格式
int size = 100; //文件大小限制,单位MB,同时在web.config里配置环境默认为100MB
//文件上传状态,当成功时返回SUCCESS,其余值将直接返回对应字符串
String state = "SUCCESS";
String title = String.Empty;
String filename = String.Empty;
String url = String.Empty;
String currentType = String.Empty;
String uploadpath = String.Empty;
uploadpath = context.Server.MapPath(pathbase);
try
{
HttpPostedFile uploadFile = context.Request.Files["Filedata"];
title = uploadFile.FileName;
//目录验证
if (!Directory.Exists(uploadpath))
{
Directory.CreateDirectory(uploadpath);
}
if (uploadFile == null)
{
context.Response.Write("{'state':'文件大小可能超出服务器环境配置!','url':'null','fileType':'null'}");
}
//格式验证
string[] temp = uploadFile.FileName.Split('.');
currentType = "." + temp[temp.Length - 1];
if (Array.IndexOf(filetype, currentType) == -1)
{
state = "不支持的文件类型!";
}
//大小验证
if ((uploadFile.ContentLength / 1024)/1024 > size)
{
state = "文件大小超出限制!";
}
//保存图片
if (state == "SUCCESS")
{
filename = DateTime.Now.ToString("yyyy-MM-dd-ss") + System.Guid.NewGuid() + currentType;
uploadFile.SaveAs(uploadpath + filename);
url = pathbase + filename;
}
}
catch (Exception)
{
state = "文件保存失败";
}
//向浏览器返回数据json数据
context.Response.Write("{'state':'" + state + "','url':'" + title + "','fileType':'" + currentType + "'}");
}
public bool IsReusable {
get {
return false;
}
}
} | 10npsite | trunk/guanli/system/ueditor/server/upload/net/fileUp.ashx | ASP.NET | asf20 | 2,876 |
<%@ WebHandler Language="C#" Class="imageUp" %>
using System;
using System.Web;
using System.IO;
public class imageUp : IHttpHandler{
public void ProcessRequest(HttpContext context){
context.Response.ContentType = "text/plain";
context.Response.Charset = "utf-8";
//上传配置
String pathbase = "../uploadimages/"; //保存路径
string[] filetype = { ".gif", ".png", ".jpg", ".jpeg", ".bmp" }; //文件允许格式
int size = 1024; //文件大小限制,单位KB
//文件上传状态,初始默认成功,可选参数{"SUCCESS","ERROR","SIZE","TYPE"}
String state = "SUCCESS";
String title = String.Empty;
String filename = String.Empty;
String url = String.Empty;
String currentType = String.Empty;
String uploadpath = String.Empty;
uploadpath = context.Server.MapPath(pathbase);
try{
HttpPostedFile uploadFile = context.Request.Files[0];
title = uploadFile.FileName;
//目录验证
if (!Directory.Exists(uploadpath)){
Directory.CreateDirectory(uploadpath);
}
//格式验证
string[] temp=uploadFile.FileName.Split('.');
currentType = "."+ temp[temp.Length - 1];
if (Array.IndexOf(filetype, currentType)==-1){
state = "TYPE";
}
//大小验证
if( uploadFile.ContentLength/1024>size){
state="SIZE";
}
//保存图片
if (state=="SUCCESS"){
filename = DateTime.Now.ToString("yyyy-MM-dd-ss") + System.Guid.NewGuid() + currentType;
uploadFile.SaveAs(uploadpath + filename);
url = pathbase + filename;
}
}catch (Exception){
state = "ERROR";
}
//获取图片描述
if (context.Request.Form["pictitle"] != null){
if (!String.IsNullOrEmpty(context.Request.Form["pictitle"])){
title = context.Request.Form["pictitle"];
}
}
url = url.Replace("../", "");
//向浏览器返回数据json数据
HttpContext.Current.Response.Write("{'url':'" + url + "','title':'" + title + "','state':'" + state + "'}");
}
public bool IsReusable{
get{
return false;
}
}
} | 10npsite | trunk/guanli/system/ueditor/server/upload/net/imageUp.ashx | ASP.NET | asf20 | 2,604 |
<%@ WebHandler Language="C#" Class="snapImgUp" %>
using System;
using System.Web;
using System.IO;
public class snapImgUp : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
context.Response.Charset = "utf-8";
//上传配置
String pathbase = "../uploadimages/"; //保存路径
string[] filetype = { ".gif", ".png", ".jpg", ".jpeg", ".bmp" }; //文件允许格式
int size = 1000; //文件大小限制,单位KB
String pathlog = "log.txt"; //日志路径
//文件上传状态,当成功时返回SUCCESS,其余值将直接返回对应字符窜并显示在图片预览框,同时可以在前端页面通过回调函数获取对应字符窜
String state = "SUCCESS";
String filename = String.Empty;
String url = String.Empty;
String currentType = String.Empty;
String uploadpath = String.Empty;
uploadpath = context.Server.MapPath(pathbase);
try
{
HttpPostedFile uploadFile = context.Request.Files["upfile"];
//目录验证
if (!Directory.Exists(uploadpath))
{
Directory.CreateDirectory(uploadpath);
}
//格式验证
string[] temp = uploadFile.FileName.Split('.');
currentType = "." + temp[temp.Length - 1];
if (Array.IndexOf(filetype, currentType) == -1)
{
state = "不支持的图片类型!";
}
//大小验证
if (uploadFile.ContentLength / 1024 > size)
{
state = "图片大小超出限制!";
}
//保存图片
if (state == "SUCCESS")
{
filename = DateTime.Now.ToString("yyyy-MM-dd-ss") + System.Guid.NewGuid() + currentType;
uploadFile.SaveAs(uploadpath + filename);
string a=context.Server.MapPath(pathlog);
//写日志
using (StreamWriter sw = File.AppendText(a))
{
sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "UPLOAD - " + context.Request.UserHostAddress + uploadFile.FileName + " " + uploadFile.ContentType);
}
url = pathbase + filename;
}
}
catch (Exception)
{
state = "图片保存失败";
}
url = url.Replace("../", "");
//向浏览器返回数据json数据
HttpContext.Current.Response.Write("{'url':'" + url + "','state':'" + state + "'}");
}
public bool IsReusable {
get {
return false;
}
}
} | 10npsite | trunk/guanli/system/ueditor/server/upload/net/snapImgUp.ashx | ASP.NET | asf20 | 3,034 |
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.io.*"%>
<%@ page import="org.apache.commons.fileupload.*" %>
<%@ page import="org.apache.commons.fileupload.util.*" %>
<%@ page import="org.apache.commons.fileupload.servlet.*" %>
<%@ page import="org.apache.commons.fileupload.FileItemIterator" %>
<%@ page import="org.apache.commons.fileupload.disk.DiskFileItemFactory" %>
<%@ page import="java.io.BufferedInputStream" %>
<%@ page import="java.io.BufferedOutputStream" %>
<%@ page import="java.io.File"%>
<%@ page import="java.io.InputStream" %>
<%@ page import="java.io.OutputStream" %>
<%@ page import="java.io.FileOutputStream" %>
<%@ page import="java.util.regex.Matcher" %>
<%@ page import="java.util.regex.Pattern" %>
<%@ page import="java.util.Date" %>
<%
//保存文件路径
String filePath = "uploadimages";
String realPath = request.getRealPath("\\") + filePath;
//判断路径是否存在,不存在则创建
File dir = new File(realPath);
if(!dir.isDirectory())
dir.mkdir();
if(ServletFileUpload.isMultipartContent(request)){
DiskFileItemFactory dff = new DiskFileItemFactory();
dff.setRepository(dir);
dff.setSizeThreshold(1024000);
ServletFileUpload sfu = new ServletFileUpload(dff);
FileItemIterator fii = sfu.getItemIterator(request);
String title = ""; //图片标题
String url = ""; //图片地址
String fileName = "";
String state="SUCCESS";
while(fii.hasNext()){
FileItemStream fis = fii.next();
try{
if(!fis.isFormField() && fis.getName().length()>0){
fileName = fis.getName();
Pattern reg=Pattern.compile("[.]jpg|png|jpeg|gif$");
Matcher matcher=reg.matcher(fileName);
if(!matcher.find()) {
state = "文件类型不允许!";
break;
}
url = realPath+"\\"+new Date().getTime()+fileName.substring(fileName.lastIndexOf("."),fileName.length());
BufferedInputStream in = new BufferedInputStream(fis.openStream());//获得文件输入流
FileOutputStream a = new FileOutputStream(new File(url));
BufferedOutputStream output = new BufferedOutputStream(a);
Streams.copy(in, output, true);//开始把文件写到你指定的上传文件夹
}else{
String fname = fis.getFieldName();
if(fname.indexOf("pictitle")!=-1){
BufferedInputStream in = new BufferedInputStream(fis.openStream());
byte c [] = new byte[10];
int n = 0;
while((n=in.read(c))!=-1){
title = new String(c,0,n);
break;
}
}
}
}catch(Exception e){
e.printStackTrace();
}
}
title = title.replace("&", "&").replace("'", "&qpos;").replace("\"", """).replace("<", "<").replace(">", ">");
response.getWriter().print("{'url':'"+filePath+"/"+fileName+"','title':'"+title+"','state':'"+state+"'}");
}
%>
| 10npsite | trunk/guanli/system/ueditor/server/upload/jsp/imageUp.jsp | Java Server Pages | asf20 | 3,207 |
<?php
/**
* Created by JetBrains PhpStorm.
* User: taoqili
* Date: 12-2-19
* Time: 下午10:44
* To change this template use File | Settings | File Templates.
*/
//include("simple_html_dom.php");
$key =htmlspecialchars($_POST["searchKey"]);
$type = htmlspecialchars($_POST["videoType"]);
$html = file_get_contents('http://api.tudou.com/v3/gw?method=item.search&appKey=myKey&format=json&kw='.$key.'&pageNo=1&pageSize=20&channelId='.$type.'&inDays=7&media=v&sort=s');
echo $html; | 10npsite | trunk/guanli/system/ueditor/server/submit/php/getMovie.php | PHP | asf20 | 495 |
<?php
require "../../../config.php";
/**
* Created by JetBrains PhpStorm.
* User: taoqili
* Date: 11-12-28
* Time: 上午9:54
* To change this template use File | Settings | File Templates.
*/
$uri = htmlspecialchars( $_POST[ 'content' ] );
//Ajax提交的网址内容中如果包含了&符号,上述函数会将其转成&导致地址解析不对,这里要转回来
$uri = str_replace( "&" , "&" , $uri );
getRemoteImage( $uri );
/**
* @param $uri
*/
function getRemoteImage( $uri ){
//忽略抓取时间限制
set_time_limit( 0 );
//远程抓取图片配置
global $sys_config;
$config = array(
"uploadPath"=>$sys_config["uppicload"], //保存路径
"fileType"=>$sys_config["fileType"], //文件允许格式
"fileSize"=>$sys_config["fileSize"], //文件大小限制,单位KB
);
//ue_separate_ue ue用于传递数据分割符号
$imgUrls = explode( "ue_separate_ue" , $uri );
$tmpNames = array();
foreach ( $imgUrls as $imgUrl ) {
//格式验证
$fileType = strtolower( strrchr( $imgUrl , '.' ) );
if ( !in_array( $fileType , $config[ 'fileType' ] ) ) {
array_push($tmpNames,"error" );
continue;
}
//死链检测
if ( !urlTest( $imgUrl ) ) {
array_push($tmpNames, "error" );
continue;
};
//打开输出缓冲区并获取远程图片
ob_start();
//请确保php.ini中的fopen wrappers已经激活
readfile( $imgUrl );
$img = ob_get_contents();
ob_end_clean();
//大小验证
$uriSize = strlen( $img ); //得到图片大小
$allowSize = 1024 * $config[ 'fileSize' ];
if ( $uriSize > $allowSize ) {
array_push($tmpNames,"error" );
continue;
}
//创建保存位置
$savePath = $config[ 'savePath' ];
if ( !file_exists( $savePath ) ) {
mkdir( "$savePath" , 0777 );
}
//写入文件
$tmpName = $savePath . rand( 1 , 10000 ) . time() . strrchr( $imgUrl , '.' );
try {
$fp2 = @fopen( $tmpName , "a" );
fwrite( $fp2 , $img );
fclose( $fp2 );
array_push($tmpNames,str_replace('../../','',$tmpName)); //同图片上传一样,去掉容易引起路径混乱的../
//array_push($tmpNames,$tmpName);
} catch ( Exception $e ) {
array_push($tmpNames, "error" );
}
}
response( "{'url':'" . implode("ue_separate_ue", $tmpNames) . "','tip':'远程图片抓取成功!','srcUrl':'" . $uri . "'}" );
}
/**
* 返回数据
* @param $state
*/
function response( $state ){
echo $state;
exit();
}
/**
* 死链检测
* @param $uri
* @return bool
*/
function urlTest( $uri ){
$headerArr = get_headers( $uri );
return stristr( $headerArr[ 0 ] , "200" ) && stristr( $headerArr[ 0 ] , "OK" );
}
?> | 10npsite | trunk/guanli/system/ueditor/server/submit/php/getRemoteImage.php | PHP | asf20 | 3,121 |
<?php
require "../../../config.php";
/**
* Created by JetBrains PhpStorm.
* User: ueditor
* Date: 12-1-16
* Time: 上午11:44
* To change this template use File | Settings | File Templates.
*/
$path =$sys_config["uppicload"]; //最好使用缩略图地址,否则当网速慢时可能会造成严重的延时
$action = htmlspecialchars($_POST["action"]);
if($action=="get"){
$files = getfiles($path);
if(!$files)return;
$str = "";
foreach ($files as $file) {
$str .= str_replace("../../","server/",$file)."ue_separate_ue";
}
echo $str;
}
function getfiles($path, &$files = array()){
if (!is_dir($path)) return;
$handle = opendir($path);
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..') {
$path2 = $path . '/' . $file;
if (is_dir($path2)) {
getfiles($path2, $files);
} else {
if (preg_match("/\.(gif|jpeg|jpg|png|bmp)$/i", $file)) {
$files[] = $path . '/' . $file;
}
}
}
}
return $files;
}
?>
| 10npsite | trunk/guanli/system/ueditor/server/submit/php/imageManager.php | PHP | asf20 | 1,043 |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<?php
//获取数据
$content = htmlspecialchars(stripslashes($_POST['myEditor']));
$content1 = htmlspecialchars(stripslashes($_POST['myEditor1']));
//存入数据库或者其他操作
//-------------
//显示
echo "第1个编辑器的值";
echo htmlspecialchars_decode($content);
echo "第2个编辑器的值";
echo htmlspecialchars_decode($content1);
echo "<input type='button' value='点击返回' onclick='window.history.go(-1)' /></script>";
?> | 10npsite | trunk/guanli/system/ueditor/server/submit/php/getContent.php | PHP | asf20 | 534 |
<%@ WebHandler Language="C#" Class="getRemoteImage" %>
/**
* Created by visual studio 2010
* User: xuheng
* Date: 12-3-8
* Time: 下午13:33
* To get the Remote image.
*/
using System;
using System.Web;
using System.Collections;
using System.Text.RegularExpressions;
using System.Net;
using System.IO;
public class getRemoteImage : IHttpHandler {
public void ProcessRequest (HttpContext context)
{
string savePath = context.Server.MapPath("../../upload/uploadimages/"); //保存文件地址
string[] filetype = { ".gif", ".png", ".jpg", ".jpeg", ".bmp" }; //文件允许格式
int fileSize = 3000; //文件大小限制,单位kb
string uri = context.Server.HtmlEncode(context.Request["content"]);
uri = uri.Replace("&", "&");
string[] imgUrls = Regex.Split(uri, "ue_separate_ue", RegexOptions.IgnoreCase);
ArrayList tmpNames = new ArrayList();
WebClient wc = new WebClient();
HttpWebResponse res;
String tmpName = String.Empty;
String imgUrl = String.Empty;
String currentType = String.Empty;
try
{
for (int i = 0, len = imgUrls.Length; i < len; i++)
{
imgUrl = imgUrls[i];
if (imgUrl.Substring(0, 7) != "http://")
{
tmpNames.Add("error!");
continue;
}
//格式验证
int temp = imgUrl.LastIndexOf('.');
currentType = imgUrl.Substring(temp);
if (Array.IndexOf(filetype, currentType) == -1)
{
tmpNames.Add("error!");
continue;
}
res = (HttpWebResponse)WebRequest.Create(imgUrl).GetResponse();
//http检测
if (res.ResponseUri.Scheme.ToLower().Trim() != "http")
{
tmpNames.Add("error!");
continue;
}
//大小验证
if (res.ContentLength > fileSize * 1024)
{
tmpNames.Add("error!");
continue;
}
//死链验证
if (res.StatusCode != HttpStatusCode.OK)
{
tmpNames.Add("error!");
continue;
}
//检查mime类型
if (res.ContentType.IndexOf("image")==-1)
{
tmpNames.Add("error!");
continue;
}
res.Close();
//创建保存位置
if (!Directory.Exists(savePath))
{
Directory.CreateDirectory(savePath);
}
//写入文件
tmpName = DateTime.Now.ToString("yyyy-MM-dd-ss") + System.Guid.NewGuid() + currentType;
wc.DownloadFile(imgUrl, savePath + tmpName);
tmpNames.Add("upload/uploadimages/" + tmpName);
}
}
catch (Exception)
{
tmpNames.Add("error!");
}
finally
{
wc.Dispose();
}
context.Response.Write("{url:'" + converToString(tmpNames) + "',tip:'远程图片抓取成功!',srcUrl:'" + uri + "'}");
}
//集合转换字符串
private string converToString(ArrayList tmpNames)
{
String str=String.Empty;
for (int i = 0, len = tmpNames.Count; i < len;i++ )
{
str += tmpNames[i] + "ue_separate_ue";
if(i==tmpNames.Count-1)
str += tmpNames[i];
}
return str;
}
public bool IsReusable {
get {
return false;
}
}
} | 10npsite | trunk/guanli/system/ueditor/server/submit/net/getRemoteImage.ashx | ASP.NET | asf20 | 4,040 |
<%@ WebHandler Language="C#" Class="imageManager" %>
/**
* Created by visual studio2010
* User: xuheng
* Date: 12-3-7
* Time: 下午16:29
* To change this template use File | Settings | File Templates.
*/
using System;
using System.Web;
using System.IO;
public class imageManager : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
string path = context.Server.MapPath("../../upload/uploadimages"); //最好使用缩略图地址,否则当网速慢时可能会造成严重的延时
string[] filetype = { ".gif", ".png", ".jpg", ".jpeg", ".bmp" }; //文件允许格式
string action = context.Server.HtmlEncode(context.Request["action"]);
if(action == "get")
{
String str=String.Empty;
DirectoryInfo info = new DirectoryInfo(path);
//目录验证
if (info.Exists)
{
foreach (FileInfo fi in info.GetFiles())
{
if (Array.IndexOf(filetype, fi.Extension) != -1)
{
str += "server/upload/uploadimages/" + fi.Name + "ue_separate_ue";
}
}
}
context.Response.Write(str);
}
}
public bool IsReusable {
get {
return false;
}
}
} | 10npsite | trunk/guanli/system/ueditor/server/submit/net/imageManager.ashx | ASP.NET | asf20 | 1,528 |
<%@ WebHandler Language="C#" Class="getMovie" %>
/**
* Created by visual studio 2010
* User: xuheng
* Date: 12-3-7
* Time: 下午14:45
* To change this template use File | Settings | File Templates.
*/
using System;
using System.Web;
using System.Net;
using System.Text;
public class getMovie : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/html";
string key = context.Server.HtmlEncode(context.Request.Form["searchKey"]);
string type = context.Server.HtmlEncode(context.Request.Form["videoType"]);
Uri httpURL = new Uri("http://api.tudou.com/v3/gw?method=item.search&appKey=myKey&format=json&kw="+key+"&pageNo=1&pageSize=20&channelId="+type+"&inDays=7&media=v&sort=s");
WebClient MyWebClient = new WebClient();
MyWebClient.Credentials = CredentialCache.DefaultCredentials; //获取或设置用于向Internet资源的请求进行身份验证的网络凭据
Byte[] pageData = MyWebClient.DownloadData(httpURL);
context.Response.Write(Encoding.UTF8.GetString(pageData));
}
public bool IsReusable {
get {
return false;
}
}
} | 10npsite | trunk/guanli/system/ueditor/server/submit/net/getMovie.ashx | ASP.NET | asf20 | 1,253 |
<%@ WebHandler Language="C#" Class="getContent" %>
/**
* Created by visual studio 2010
* User: xuheng
* Date: 12-3-6
* Time: 下午21:23
* To get the value of editor and output the value .
*/
using System;
using System.Web;
public class getContent : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/html";
context.Response.Charset = "utf-8";
//获取数据
string content = context.Server.HtmlEncode(context.Request.Form["myEditor"]);
string content1 = context.Server.HtmlEncode(context.Request.Form["myEditor1"]);
//存入数据库或者其他操作
//-------------
//显示
context.Response.Write("第1个编辑器的值;");
context.Response.Write(context.Server.HtmlDecode(content));
context.Response.Write("第2个编辑器的值;");
context.Response.Write(context.Server.HtmlDecode(content1));
context.Response.Write("<input type='button' value='点击返回' onclick='window.history.go(-1)' />");
}
public bool IsReusable {
get {
return false;
}
}
} | 10npsite | trunk/guanli/system/ueditor/server/submit/net/getContent.ashx | ASP.NET | asf20 | 1,216 |
/**
* ueditor完整配置项
* 可以在这里配置整个编辑器的特性
*/
(function () {
//这里你可以配置成ueditor目录在您网站中与根目录之间的相对路径或者绝对路径(指以http开头的绝对路径)
//window.UEDITOR_HOME_URL可以在外部配置,这里就不用配置了
//场景:如果你有多个页面使用同一目录下的editor,因为路径不同,所以在使用editor的页面上配置这个路径写在这个js外边
//var URL = window.UEDITOR_HOME_URL || '../';
var tmp = window.location.pathname,
URL = window.UEDITOR_HOME_URL||tmp.substr(0,tmp.lastIndexOf("\/")+1).replace("_examples/","").replace("website/","");//这里你可以配置成ueditor目录在您网站的相对路径或者绝对路径(指以http开头的绝对路径)
UEDITOR_CONFIG = {
imagePath:"", //图片文件夹所在的路径,用于显示时修正后台返回的图片url!具体图片保存路径需要在后台设置。!important
compressSide:0, //等比压缩的基准,确定maxImageSideLength参数的参照对象。0为按照最长边,1为按照宽度,2为按照高度
maxImageSideLength:900, //上传图片最大允许的边长,超过会自动等比缩放,不缩放就设置一个比较大的值
relativePath:true, //是否开启相对路径。开启状态下所有本地图片的路径都将以相对路径形式进行保存.强烈建议开启!
filePath:"", //附件文件夹保存路径
catchRemoteImageEnable:true, //是否开启远程图片抓取
catcherUrl:URL +"server/submit/php/getRemoteImage.php", //处理远程图片抓取的地址
localDomain:"baidu.com", //本地顶级域名,当开启远程图片抓取时,除此之外的所有其它域名下的图片都将被抓取到本地
imageManagerPath:URL + "server/submit/php/imageManager.php", //图片在线浏览的处理地址
UEDITOR_HOME_URL:URL, //为editor添加一个全局路径
//工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的从新定义
toolbars:[
['FullScreen', 'Source', '|', 'Undo', 'Redo', '|',
'Bold', 'Italic', 'Underline', 'StrikeThrough', 'Superscript', 'Subscript', 'RemoveFormat', 'FormatMatch','AutoTypeSet', '|',
'BlockQuote', '|', 'PastePlain', '|', 'ForeColor', 'BackColor', 'InsertOrderedList', 'InsertUnorderedList','SelectAll', 'ClearDoc', '|', 'CustomStyle',
'Paragraph', '|','RowSpacingTop', 'RowSpacingBottom','LineHeight', '|','FontFamily', 'FontSize', '|',
'DirectionalityLtr', 'DirectionalityRtl', '|', '', 'Indent', '|',
'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyJustify', '|',
'Link', 'Unlink', 'Anchor', '|', 'ImageNone', 'ImageLeft', 'ImageRight', 'ImageCenter', '|', 'InsertImage', 'Emotion', 'InsertVideo', 'Attachment', 'Map', 'GMap', 'InsertFrame', 'PageBreak', 'HighlightCode', '|',
'Horizontal', 'Date', 'Time', 'Spechars','SnapScreen', 'WordImage', '|',
'InsertTable', 'DeleteTable', 'InsertParagraphBeforeTable', 'InsertRow', 'DeleteRow', 'InsertCol', 'DeleteCol', 'MergeCells', 'MergeRight', 'MergeDown', 'SplittoCells', 'SplittoRows', 'SplittoCols', '|',
'Print', 'Preview', 'SearchReplace','Help']
],
//当鼠标放在工具栏上时显示的tooltip提示
labelMap:{
'anchor':'锚点', 'undo':'撤销', 'redo':'重做', 'bold':'加粗', 'indent':'首行缩进','snapscreen': '截图',
'italic':'斜体', 'underline':'下划线', 'strikethrough':'删除线', 'subscript':'下标',
'superscript':'上标', 'formatmatch':'格式刷', 'source':'源代码', 'blockquote':'引用',
'pasteplain':'纯文本粘贴模式', 'selectall':'全选', 'print':'打印', 'preview':'预览',
'horizontal':'分隔线', 'removeformat':'清除格式', 'time':'时间', 'date':'日期',
'unlink':'取消链接', 'insertrow':'前插入行', 'insertcol':'前插入列', 'mergeright':'右合并单元格', 'mergedown':'下合并单元格',
'deleterow':'删除行', 'deletecol':'删除列', 'splittorows':'拆分成行', 'splittocols':'拆分成列', 'splittocells':'完全拆分单元格',
'mergecells':'合并多个单元格', 'deletetable':'删除表格', 'insertparagraphbeforetable':'表格前插行', 'cleardoc':'清空文档',
'fontfamily':'字体', 'fontsize':'字号', 'paragraph':'段落格式', 'insertimage':'图片', 'inserttable':'表格', 'link':'超链接',
'emotion':'表情', 'spechars':'特殊字符', 'searchreplace':'查询替换', 'map':'Baidu地图', 'gmap':'Google地图',
'insertvideo':'视频', 'help':'帮助', 'justifyleft':'居左对齐', 'justifyright':'居右对齐', 'justifycenter':'居中对齐',
'justifyjustify':'两端对齐', 'forecolor':'字体颜色', 'backcolor':'背景色', 'insertorderedlist':'有序列表',
'insertunorderedlist':'无序列表', 'fullscreen':'全屏', 'directionalityltr':'从左向右输入', 'directionalityrtl':'从右向左输入',
'RowSpacingTop':'段前距', 'RowSpacingBottom':'段后距','highlightcode':'插入代码', 'pagebreak':'分页', 'insertframe':'插入Iframe', 'imagenone':'默认',
'imageleft':'左浮动', 'imageright':'右浮动','attachment':'附件', 'imagecenter':'居中', 'wordimage':'图片转存',
'lineheight':'行间距', 'customstyle':'自定义标题','autotypeset': '自动排版'
},
//dialog内容的路径 ~会被替换成URL
iframeUrlMap:{
'anchor':'~/dialogs/anchor/anchor.html',
'insertimage':'~/dialogs/image/image.html',
'inserttable':'~/dialogs/table/table.html',
'link':'~/dialogs/link/link.html',
'spechars':'~/dialogs/spechars/spechars.html',
'searchreplace':'~/dialogs/searchreplace/searchreplace.html',
'map':'~/dialogs/map/map.html',
'gmap':'~/dialogs/gmap/gmap.html',
'insertvideo':'~/dialogs/video/video.html',
'help':'~/dialogs/help/help.html',
'highlightcode':'~/dialogs/code/code.html',
'emotion':'~/dialogs/emotion/emotion.html',
'wordimage':'~/dialogs/wordimage/wordimage.html',
'attachment':'~/dialogs/attachment/attachment.html',
'insertframe':'~/dialogs/insertframe/insertframe.html',
'edittd':'~/dialogs/table/edittd.html',
'snapscreen': '~/dialogs/snapscreen/snapscreen.html'
},
//所有的的下拉框显示的内容
listMap:{
//字体
'fontfamily':['宋体', '楷体', '隶书', '黑体', 'andale mono', 'arial', 'arial black', 'comic sans ms', 'impact', 'times new roman'],
//字号
'fontsize':[10, 11, 12, 14, 16, 18, 20, 24, 36],
//段落格式 值:显示的名字
'paragraph':['p:段落', 'h1:标题 1', 'h2:标题 2', 'h3:标题 3', 'h4:标题 4', 'h5:标题 5', 'h6:标题 6'],
//段间距 值和显示的名字相同
'rowspacing':['5', '10', '15', '20', '25'],
//行内间距 值和显示的名字相同
'lineheight':['1', '1.5','1.75','2', '3', '4', '5'],
//block的元素是依据设置段落的逻辑设置的,inline的元素依据BIU的逻辑设置
//尽量使用一些常用的标签
//参数说明
//tag 使用的标签名字
//label 显示的名字也是用来标识不同类型的标识符,注意这个值每个要不同,
//style 添加的样式
//每一个对象就是一个自定义的样式
'customstyle':[
{tag:'h1', label:'居中标题', style:'border-bottom:#ccc 2px solid;padding:0 4px 0 0;text-align:center;margin:0 0 20px 0;'},
{tag:'h1', label:'居左标题', style:'border-bottom:#ccc 2px solid;padding:0 4px 0 0;margin:0 0 10px 0;'},
{tag:'span', label:'强调', style:'font-style:italic;font-weight:bold;color:#000'},
{tag:'span', label:'明显强调', style:'font-style:italic;font-weight:bold;color:rgb(51, 153, 204)'}
]
},
//字体对应的style值
fontMap:{
'宋体':['宋体', 'SimSun'],
'楷体':['楷体', '楷体_GB2312', 'SimKai'],
'黑体':['黑体', 'SimHei'],
'隶书':['隶书', 'SimLi'],
'andale mono':['andale mono'],
'arial':['arial', 'helvetica', 'sans-serif'],
'arial black':['arial black', 'avant garde'],
'comic sans ms':['comic sans ms'],
'impact':['impact', 'chicago'],
'times new roman':['times new roman']
},
//定义了右键菜单的内容
contextMenu:[
{
label:'删除',
cmdName:'delete'
},
{
label:'全选',
cmdName:'selectall'
},
{
label:'删除代码',
cmdName:'highlightcode',
icon:'deletehighlightcode'
},
{
label:'清空文档',
cmdName:'cleardoc',
exec:function () {
if ( confirm( '确定清空文档吗?' ) ) {
this.execCommand( 'cleardoc' );
}
}
},
'-',
{
label:'取消链接',
cmdName:'unlink'
},
'-',
{
group:'段落格式',
icon:'justifyjustify',
subMenu:[
{
label:'居左对齐',
cmdName:'justify',
value:'left'
},
{
label:'居右对齐',
cmdName:'justify',
value:'right'
},
{
label:'居中对齐',
cmdName:'justify',
value:'center'
},
{
label:'两端对齐',
cmdName:'justify',
value:'justify'
}
]
},
'-',
{
label:'表格属性',
cmdName:'edittable',
exec:function () {
this.tableDialog.open();
}
},
{
label:'单元格属性',
cmdName:'edittd',
exec:function () {
this.ui._dialogs['tdDialog'].open();
}
},
{
group:'表格',
icon:'table',
subMenu:[
{
label:'删除表格',
cmdName:'deletetable'
},
{
label:'表格前插行',
cmdName:'insertparagraphbeforetable'
},
'-',
{
label:'删除行',
cmdName:'deleterow'
},
{
label:'删除列',
cmdName:'deletecol'
},
'-',
{
label:'前插入行',
cmdName:'insertrow'
},
{
label:'前插入列',
cmdName:'insertcol'
},
'-',
{
label:'右合并单元格',
cmdName:'mergeright'
},
{
label:'下合并单元格',
cmdName:'mergedown'
},
'-',
{
label:'拆分成行',
cmdName:'splittorows'
},
{
label:'拆分成列',
cmdName:'splittocols'
},
{
label:'合并多个单元格',
cmdName:'mergecells'
},
{
label:'完全拆分单元格',
cmdName:'splittocells'
}
]
},
{
label:'复制(ctrl+c)',
cmdName:'copy',
exec:function () {
alert( "请使用ctrl+c进行复制" );
}
},
{
label:'粘贴(ctrl+v)',
cmdName:'paste',
exec:function () {
alert( "请使用ctrl+v进行粘贴" );
}
}
],
initialStyle://编辑器内部样式
//选中的td上的样式
'.selectTdClass{background-color:#3399FF !important}' +
//插入的表格的默认样式
'table{clear:both;margin-bottom:10px;border-collapse:collapse;word-break:break-all;}' +
//分页符的样式
'.pagebreak{display:block;clear:both !important;cursor:default !important;width: 100% !important;margin:0;}' +
//锚点的样式,注意这里背景图的路径
'.anchorclass{background: url("' + URL + 'themes/default/images/anchor.gif") no-repeat scroll left center transparent;border: 1px dotted #0000FF;cursor: auto;display: inline-block;height: 16px;width: 15px;}' +
//设置四周的留边
'.view{padding:0;word-wrap:break-word;word-break:break-all;cursor:text;height:100%;}\n' +
'body{margin:8px;font-family:"宋体";font-size:16px;}' +
//针对li的处理
'li{clear:both}' +
//设置段落间距
'p{margin:5px 0;}',
//初始化编辑器的内容,也可以通过textarea/script给值,看官网例子
initialContent:'',
autoClearinitialContent:false, //是否自动清除编辑器初始内容,注意:如果focus属性设置为true,这个也为真,那么编辑器一上来就会触发导致初始化的内容看不到了
iframeCssUrl:'themes/default/iframe.css', //要引入css的url
removeFormatTags:'b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var', //清除格式删除的标签
removeFormatAttributes:'class,style,lang,width,height,align,hspace,valign', //清除格式删除的属性
enterTag:'p', //编辑器回车标签。p或br
maxUndoCount:20, //最多可以回退的次数
maxInputCount:20, //当输入的字符数超过该值时,保存一次现场
selectedTdClass:'selectTdClass', //设定选中td的样式名称
pasteplain:false, //是否纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
//提交表单时,服务器获取编辑器提交内容的所用的参数,多实例时可以给容器name属性,会将name给定的值最为每个实例的键值,不用每次实例化的时候都设置这个值
textarea:'editorValue',
focus:false, //初始化时,是否让编辑器获得焦点true或false
indentValue:'2em', //初始化时,首行缩进距离
pageBreakTag:'_baidu_page_break_tag_', //分页符
minFrameHeight:320, //最小高度
autoHeightEnabled:true, //是否自动长高
autoFloatEnabled:false, //是否保持toolbar的位置不动 浮动
elementPathEnabled:true, //是否启用elementPath
wordCount:true, //是否开启字数统计
maximumWords:10000, //允许的最大字符数
tabSize:4, //tab的宽度
tabNode:' ', //tab时的单一字符
imagePopup:true, //图片操作的浮层开关,默认打开
emotionLocalization:false, //是否开启表情本地化,默认关闭。若要开启请确保emotion文件夹下包含官网提供的images表情文件夹
sourceEditor:"codemirror", //源码的查看方式,codemirror 是代码高亮,textarea是文本框
tdHeight:'20', //单元格的默认高度
highlightJsUrl:URL + "third-party/SyntaxHighlighter/shCore.js",
highlightCssUrl:URL + "third-party/SyntaxHighlighter/shCoreDefault.css",
codeMirrorJsUrl:URL + "third-party/codemirror2.15/codemirror.js",
codeMirrorCssUrl:URL + "third-party/codemirror2.15/codemirror.css",
zIndex : 999, //编辑器z-index的基数
fullscreen : false, //是否上来就是全屏
snapscreenHost: '127.0.0.1', //屏幕截图的server端文件所在的网站地址或者ip,请不要加http://
snapscreenServerFile: URL +"server/upload/php/snapImgUp.php", //屏幕截图的server端保存程序,UEditor的范例代码为“URL +"server/upload/php/snapImgUp.php"”
snapscreenServerPort: 80,//屏幕截图的server端端口
snapscreenImgAlign: 'center', //截图的图片默认的排版方式
snapscreenImgIsUseImagePath: 1, //是否使用上面定义的imagepath,如果为否,那么server端需要直接返回图片的完整路径
messages:{
pasteMsg:'编辑器已过滤掉您粘贴内容中不支持的格式!', //粘贴提示
wordCountMsg:'当前已输入 {#count} 个字符,您还可以输入{#leave} 个字符 ', //字数统计提示,{#count}代表当前字数,{#leave}代表还可以输入多少字符数。
wordOverFlowMsg:'你输入的字符个数已经超出最大允许值,服务器可能会拒绝保存!', //超出字数限制
pasteWordImgMsg:'您粘贴的内容中包含本地图片,需要转存后才能正确显示!',
snapScreenNotIETip: '截图功能需要在ie浏览器下使用',
snapScreenMsg:'截图上传失败,请检查你的PHP环境。 '
},
serialize:function () { //配置过滤标签
// var X = baidu.editor.utils.extend;
// var inline = {strong:1,em:1,b:1,i:1,u:1,span:1,a:1,img:1};
// var block = X(inline, {p:1,div:1,blockquote:1,$:{style:1,dir:1}});
return {
//编辑器中不能够插入的标签,如果想插入那些标签可以去掉相应的标签名
blackList:{style:1, link:1, object:1, applet:1, input:1, meta:1, base:1, button:1, select:1, textarea:1, '#comment':1, 'map':1, 'area':1}
// whiteList: {
// div: X(block,{$:{style:1,'class':1}}),
// img: {$:{style:1,src:1,title:1,'data-imgref':1, 'data-refid':1, 'class':1}},
// a: X(inline, {$:{href:1}, a:0, sup:0}),
// strong: inline, em: inline, b: inline, i: inline,
// p: block,
// span: X(inline, {br:1,$:{style:1,id:1,highlight:1}}
// }
};
}(),
//下来框默认显示的内容
ComboxInitial:{
FONT_FAMILY:'字体',
FONT_SIZE:'字号',
PARAGRAPH:'段落格式',
CUSTOMSTYLE:'自定义样式'
},
//自动排版参数
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 : {div:1,a:1,abbr:1,acronym:1,address:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,s:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1},
indent : false, // 行首缩进
indentValue : '2em' //行首缩进的大小
}
};
})();
| 10npsite | trunk/guanli/system/ueditor/editor_config.js | JavaScript | asf20 | 21,719 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>视频</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="video.css" />
</head>
<body>
<div class="wrapper">
<div id="videoTab">
<div id="tabHeads">
<span tabSrc="video" class="focus">插入视频</span>
<span tabSrc="videoSearch">视频搜索</span>
</div>
<div id="tabBodys">
<div id="video" class="panel">
<table><tr><td><label for="videoUrl" class="url">视频地址</label></td><td><input id="videoUrl" type="text"></td></tr></table>
<div id="preview"></div>
<div id="videoInfo">
<fieldset>
<legend>视频尺寸</legend>
<table>
<tr><td><label for="videoWidth">宽度</label></td><td><input class="txt" id="videoWidth" type="text"/></td></tr>
<tr><td><label for="videoHeight">高度</label></td><td><input class="txt" id="videoHeight" type="text"/></td></tr>
</table>
</fieldset>
<fieldset>
<legend>对齐方式</legend>
<div id="videoFloat"></div>
</fieldset>
</div>
</div>
<div id="videoSearch" class="panel" style="display: none">
<table style="margin-top: 5px;">
<tr>
<td><input id="videoSearchTxt" value="请输入搜索关键词" type="text" /></td>
<td>
<select id="videoType">
<option value="0">全部</option>
<option value="29">热点</option>
<option value="1">娱乐</option>
<option value="5">搞笑</option>
<option value="15">体育</option>
<option value="21">科技</option>
<option value="31">综艺</option>
</select>
</td>
<td><input id="videoSearchBtn" type="button" value="百度一下" /></td>
<td><input id="videoSearchReset" type="button" value="清空搜索" /></td>
</tr>
</table>
<div id="searchList"></div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="../internal.js"></script>
<script type="text/javascript" src="video.js"></script>
<script type="text/javascript">
window.onload = function(){
video.init();
$focus($G("videoUrl"));
};
</script>
</body>
</html> | 10npsite | trunk/guanli/system/ueditor/dialogs/video/video.html | HTML | asf20 | 3,019 |
/**
* Created by JetBrains PhpStorm.
* User: taoqili
* Date: 12-2-20
* Time: 上午11:19
* To change this template use File | Settings | File Templates.
*/
var video = {};
(function(){
video.init = function(){
switchTab("videoTab");
createAlignButton( ["videoFloat"] );
addUrlChangeListener($G("videoUrl"));
addOkListener();
addSearchListener();
//编辑视频时初始化相关信息
(function(){
var img = editor.selection.getRange().getClosedNode(),url;
if(img && img.className == "edui-faked-video"){
$G("videoUrl").value = url = img.getAttribute("_url");
$G("videoWidth").value = img.width;
$G("videoHeight").value = img.height;
updateAlignButton(img.getAttribute("align"));
}
createPreviewVideo(url);
})();
};
/**
* 监听确认和取消两个按钮事件,用户执行插入或者清空正在播放的视频实例操作
*/
function addOkListener(){
dialog.onok = function(){
$G("preview").innerHTML = "";
var currentTab = findFocus("tabHeads","tabSrc");
switch(currentTab){
case "video":
return insertSingle();
break;
case "videoSearch":
return insertSearch("searchList");
break;
}
};
dialog.oncancel = function(){
$G("preview").innerHTML = "";
};
}
function selectTxt(node){
if(node.select){
node.select();
}else{
var r = node.createTextRange && node.createTextRange();
r.select();
}
}
/**
* 依据传入的align值更新按钮信息
* @param align
*/
function updateAlignButton( align ) {
var aligns = $G( "videoFloat" ).children;
for ( var i = 0, ci; ci = aligns[i++]; ) {
if ( ci.getAttribute( "name" ) == align ) {
if ( ci.className !="focus" ) {
ci.className = "focus";
}
} else {
if ( ci.className =="focus" ) {
ci.className = "";
}
}
}
}
/**
* 将单个视频信息插入编辑器中
*/
function insertSingle(){
var width = $G("videoWidth"),
height = $G("videoHeight"),
url=$G('videoUrl').value,
align = findFocus("videoFloat","name");
if(!url) return false;
if ( !checkNum( [width, height] ) ) return false;
editor.execCommand('insertvideo', {
url: convert_url(url),
width: width.value,
height: height.value,
align: align
});
}
/**
* 将元素id下的所有代表视频的图片插入编辑器中
* @param id
*/
function insertSearch(id){
var imgs = domUtils.getElementsByTagName($G(id),"img"),
videoObjs=[];
for(var i=0,img; img=imgs[i++];){
if(img.getAttribute("selected")){
videoObjs.push({
url:img.getAttribute("ue_video_url"),
width:420,
height:280,
align:"none"
});
}
}
editor.execCommand('insertvideo',videoObjs);
}
/**
* 找到id下具有focus类的节点并返回该节点下的某个属性
* @param id
* @param returnProperty
*/
function findFocus( id, returnProperty ) {
var tabs = $G( id ).children,
property;
for ( var i = 0, ci; ci = tabs[i++]; ) {
if ( ci.className=="focus" ) {
property = ci.getAttribute( returnProperty );
break;
}
}
return property;
}
function convert_url(s){
return s.replace(/http:\/\/www\.tudou\.com\/programs\/view\/([\w\-]+)\/?/i,"http://www.tudou.com/v/$1")
.replace(/http:\/\/www\.youtube\.com\/watch\?v=([\w\-]+)/i,"http://www.youtube.com/v/$1")
.replace(/http:\/\/v\.youku\.com\/v_show\/id_([\w\-=]+)\.html/i,"http://player.youku.com/player.php/sid/$1")
.replace(/http:\/\/www\.56\.com\/u\d+\/v_([\w\-]+)\.html/i, "http://player.56.com/v_$1.swf")
.replace(/http:\/\/www.56.com\/w\d+\/play_album\-aid\-\d+_vid\-([^.]+)\.html/i, "http://player.56.com/v_$1.swf")
.replace(/http:\/\/v\.ku6\.com\/.+\/([^.]+)\.html/i, "http://player.ku6.com/refer/$1/v.swf");
}
/**
* 检测传入的所有input框中输入的长宽是否是正数
* @param nodes input框集合,
*/
function checkNum( nodes ) {
for ( var i = 0, ci; ci = nodes[i++]; ) {
var value = ci.value;
if ( !isNumber( value ) && value) {
alert( "请输入正确的长度或者宽度值!例如:123,400" );
ci.value = "";
ci.focus();
return false;
}
}
return true;
}
/**
* 数字判断
* @param value
*/
function isNumber( value ) {
return /(0|^[1-9]\d*$)/.test( value );
}
/**
* tab切换
* @param tabParentId
* @param keepFocus 当此值为真时,切换按钮上会保留focus的样式
*/
function switchTab( tabParentId,keepFocus ) {
var tabElements = $G( tabParentId ).children,
tabHeads = tabElements[0].children,
tabBodys = tabElements[1].children;
for ( var i = 0, length = tabHeads.length; i < length; i++ ) {
var head = tabHeads[i];
domUtils.on( head, "click", function () {
//head样式更改
for ( var k = 0, len = tabHeads.length; k < len; k++ ) {
if(!keepFocus)tabHeads[k].className = "";
}
this.className = "focus";
//body显隐
var tabSrc = this.getAttribute( "tabSrc" );
for ( var j = 0, length = tabBodys.length; j < length; j++ ) {
var body = tabBodys[j],
id = body.getAttribute( "id" );
if ( id == tabSrc ) {
body.style.display = "";
if(id=="videoSearch"){
selectTxt($G("videoSearchTxt"));
}
if(id=="video"){
selectTxt($G("videoUrl"));
}
} else {
body.style.display = "none";
}
}
} );
}
}
/**
* 创建图片浮动选择按钮
* @param ids
*/
function createAlignButton( ids ) {
for ( var i = 0, ci; ci = ids[i++]; ) {
var floatContainer = $G( ci ),
nameMaps = {"none":"默认", "left":"左浮动", "right":"右浮动", "center":"独占一行"};
for ( var j in nameMaps ) {
var div = document.createElement( "div" );
div.setAttribute( "name", j );
if ( j == "none" ) div.className="focus";
div.style.cssText = "background:url(../../themes/default/images/" + j + "_focus.jpg);";
div.setAttribute( "title", nameMaps[j] );
floatContainer.appendChild( div );
}
switchSelect( ci );
}
}
/**
* 选择切换
* @param selectParentId
*/
function switchSelect( selectParentId ) {
var selects = $G( selectParentId ).children;
for ( var i = 0, ci; ci = selects[i++]; ) {
domUtils.on( ci, "click", function () {
for ( var j = 0, cj; cj = selects[j++]; ) {
cj.className = "";
cj.removeAttribute && cj.removeAttribute( "class" );
}
this.className = "focus";
} )
}
}
/**
* 监听url改变事件
* @param url
*/
function addUrlChangeListener(url){
if (browser.ie) {
url.onpropertychange = function () {
createPreviewVideo( this.value );
}
} else {
url.addEventListener( "input", function () {
createPreviewVideo( this.value );
}, false );
}
}
/**
* 根据url生成视频预览
* @param url
*/
function createPreviewVideo(url){
if ( !url )return;
if(!endWith(url,[".swf",".flv",".wmv"])){
$G("preview").innerHTML = "您输入的视频地址有误,请检查后确认!";
return;
}
$G("preview").innerHTML = '<embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"' +
' src="' + url + '"' +
' width="' + 420 + '"' +
' height="' + 280 + '"' +
' wmode="transparent" play="true" loop="false" menu="false" allowscriptaccess="never" allowfullscreen="true" ></embed>';
}
/**
* 末尾字符检测
* @param str
* @param endStrArr
*/
function endWith(str,endStrArr){
for(var i=0,len = endStrArr.length;i<len;i++){
var tmp = endStrArr[i];
if(str.length - tmp.length<0) return false;
if(str.substring(str.length-tmp.length)==tmp){
return true;
}
}
return false;
}
/**
* ajax获取视频信息
*/
function getMovie(){
var keywordInput = $G("videoSearchTxt");
if(!keywordInput.getAttribute("hasClick") ||!keywordInput.value){
selectTxt(keywordInput);
return;
}
$G( "searchList" ).innerHTML = " 视频加载中,请稍后……";
var keyword = keywordInput.value,
type = $G("videoType").value,
str="";
ajax.request(editor.options.UEDITOR_HOME_URL +"server/submit/php/getMovie.php",{
searchKey:keyword,
videoType:type,
onsuccess:function(xhr){
try{
var info = eval("("+xhr.responseText+")");
}catch(e){
return;
}
var videos = info.multiPageResult.results;
var html=["<table width='530'>"];
for(var i=0,ci;ci = videos[i++];){
html.push(
"<tr>" +
"<td><img title='单击选中视频' ue_video_url='"+ci.outerPlayerUrl+"' alt='"+ci.tags+"' width='106' height='80' src='"+ci.picUrl+"' /> </td>" +
"<td>" +
"<p><a target='_blank' title='访问源视频' href='"+ci.itemUrl+"'>"+ci.title.substr(0,30)+"</a></p>" +
"<p style='height: 62px;line-height: 20px' title='"+ci.description+"'> "+ ci.description.substr(0,95) +" </p>" +
"</td>" +
"</tr>"
);
}
html.push("</table>");
$G("searchList").innerHTML = str = html.length ==2 ?" 抱歉,未搜到任何相关视频!" : html.join("");
var imgs = domUtils.getElementsByTagName($G("searchList"),"img");
if(!imgs)return;
for(var i=0,img;img = imgs[i++];){
domUtils.on(img,"click",function(){
changeSelected(this);
})
}
}
});
}
/**
* 改变对象o的选中状态
* @param o
*/
function changeSelected(o){
if ( o.getAttribute( "selected" ) ) {
o.removeAttribute( "selected" );
o.style.cssText = "filter:alpha(Opacity=100);-moz-opacity:1;opacity: 1;border: 2px solid #fff";
} else {
o.setAttribute( "selected", "true" );
o.style.cssText = "filter:alpha(Opacity=50);-moz-opacity:0.5;opacity: 0.5;border:2px solid blue;";
}
}
/**
* 视频搜索相关注册事件
*/
function addSearchListener(){
domUtils.on($G("videoSearchBtn"),"click",getMovie);
domUtils.on($G( "videoSearchTxt" ),"click",function () {
if ( this.value == "请输入搜索关键词" ) {
this.value = "";
}
this.setAttribute("hasClick","true");
selectTxt(this);
});
$G( "videoSearchTxt" ).onkeyup = function(){
this.setAttribute("hasClick","true");
this.onkeyup = null;
};
domUtils.on($G( "videoSearchReset" ),"click",function () {
var txt = $G( "videoSearchTxt" );
txt.value = "";
selectTxt(txt);
$G( "searchList" ).innerHTML = "";
});
domUtils.on($G( "videoType" ),"change", getMovie);
domUtils.on($G( "videoSearchTxt" ), "keyup", function ( evt ) {
if ( evt.keyCode == 13 ) {
getMovie();
}
} )
}
})(); | 10npsite | trunk/guanli/system/ueditor/dialogs/video/video.js | JavaScript | asf20 | 13,767 |
@charset "utf-8";
*{ padding: 0;margin: 0}
body{font-size: 12px;color: #888}
.wrapper{ width: 590px;margin: 0 auto; overflow: auto; zoom:1;position: relative;padding: 10px 0}
#tabHeads{position: relative; width:560px;padding-left:9px;z-index: 10;}
#tabHeads span{
display:inline-block;
width: 82px;
height:30px;
text-align: center;
cursor: pointer;
line-height: 30px;
border: 1px solid #ccc;
background:url("../../themes/default/images/dialog-title-bg.png") repeat-x;
}
#tabHeads span.focus{ border-bottom: none; height: 31px;background-color: #fff;}
#tabBodys{ border: 1px solid #ccc; width:570px;height:325px;margin: 0 auto;position: relative;top:-1px;}
.panel { position: absolute; width: 570px;height:325px;background: #fff;}
#videoUrl {
width: 490px;
height: 21px;
line-height: 21px;
margin: 8px 5px;
background: #FFF;
border: 1px solid #d7d7d7;
}
#videoSearchTxt{margin-left:15px;background: #FFF;width:200px;height:21px;line-height:21px;border: 1px solid #d7d7d7;}
#searchList{width: 570px;overflow: auto;zoom:1;height: 270px;}
#searchList div{float: left;width: 120px;height: 135px;margin: 5px 15px;}
#searchList img{margin: 2px 8px;cursor: pointer;border: 2px solid #fff} /*不用缩略图*/
#searchList p{margin-left: 10px;}
#videoType{
width: 65px;
height: 23px;
line-height: 22px;
border: 1px solid #d7d7d7;
}
#videoSearchBtn,#videoSearchReset{
width: 80px;
height: 25px;
line-height: 25px;
background: #eee;
border: 1px solid #d7d7d7;
cursor: pointer
}
#preview{width: 420px; margin-left: 10px; _margin-left:5px; height: 280px;background-color: #ddd;float: left}
#videoInfo {width: 120px;float: left;margin-left: 10px;_margin-left:7px;}
fieldset{
border: 1px solid #ddd;
padding-left: 5px;
margin-bottom: 20px;
padding-bottom: 5px;
}
fieldset legend{font-weight: bold;}
fieldset p{line-height: 30px;}
fieldset input.txt{
width: 70px;
height: 21px;
line-height: 21px;
margin: 8px 5px;
background: #FFF;
border: 1px solid #d7d7d7;
}
label.url{font-weight: bold;margin-left: 5px;color: #06c;}
#videoFloat div{cursor:pointer;opacity: 0.5;filter: alpha(opacity = 50);margin:9px;_margin:5px;width:38px;height:36px;float:left;}
#videoFloat .focus{opacity: 1;filter: alpha(opacity = 100)}
span.view{display: inline-block;width: 30px;float: right;cursor: pointer;color: blue} | 10npsite | trunk/guanli/system/ueditor/dialogs/video/video.css | CSS | asf20 | 2,487 |
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>插入地图</title>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.1&services=true"></script>
<script type="text/javascript" src="../internal.js"></script>
<style type="text/css">
*{color: #838383}
body {
font-size: 12px;
width:540px;
height: 350px;
overflow: hidden;
margin:0px;padding:0px;
}
.content{
padding: 9px 0px 0px 15px;
height:100%;
}
.content table{padding:0px;margin:0px;width: 100%}
.content table tr{padding:0px;margin:0px; list-style: none;height: 30px; line-height: 30px;}
#city,
#address
{height:21px;background: #FFF;border:1px solid #d7d7d7;padding: 0px; margin: 0px; line-height: 21px;}
#city{width:90px}
#address{width:220px}
a.doSearch{display:block;text-align:center;line-height:24px; text-decoration: none;height:24px;width:95px;border: 0px;margin:0px;padding:0px;background:url(../../themes/default/images/icons-all.gif) no-repeat;}
a.doSearch:hover{background-position: 0 -30px;}
</style>
</head>
<body>
<div class="content">
<table>
<tr>
<td>城市:</td>
<td><input id="city" type="text" value="北京市" /></td>
<td>地址:</td>
<td><input id="address" type="text" value="" /></td>
<td><a href="javascript:doSearch()" class="doSearch">搜索</a></td>
</tr>
</table>
<div style="width:520px;height:340px;border:1px solid gray" id="container">
</div>
</div>
<script type="text/javascript">
var map = new BMap.Map("container"),marker,point,imgcss;
map.enableScrollWheelZoom();
map.enableContinuousZoom();
function doSearch(){
if (!document.getElementById('city').value) {
alert('请输入城市!');
return;
}
var search = new BMap.LocalSearch(document.getElementById('city').value, {
onSearchComplete: function (results){
if (results && results.getNumPois()) {
var points = [];
for (var i=0; i<results.getCurrentNumPois(); i++) {
points.push(results.getPoi(i).point);
}
if (points.length > 1) {
map.setViewport(points);
} else {
map.centerAndZoom(points[0], 13);
}
point = map.getCenter();
marker.setPoint(point);
} else {
alert('无法定位到该地址!');
}
}
});
search.search(document.getElementById('address').value || document.getElementById('city').value);
}
//获得参数
function getPars(str,par){
var reg = new RegExp(par+"=((\\d+|[.,])*)","g");
return reg.exec(str)[1];
}
function init(){
var img = editor.selection.getRange().getClosedNode();
if(img && /api[.]map[.]baidu[.]com/ig.test(img.getAttribute("src"))){
var url = img.getAttribute("src"),centers;
centers = getPars(url,"center").split(",");
point = new BMap.Point(Number(centers[0]),Number(centers[1]));
map.addControl(new BMap.NavigationControl());
map.centerAndZoom(point, Number(getPars(url,"zoom")));
imgcss = img.style.cssText;
}else{
point = new BMap.Point(116.404, 39.915); // 创建点坐标
map.addControl(new BMap.NavigationControl());
map.centerAndZoom(point, 10); // 初始化地图,设置中心点坐标和地图级别。
}
marker = new BMap.Marker(point);
marker.enableDragging();
map.addOverlay(marker);
}
init();
document.getElementById('address').onkeydown = function (evt){
evt = evt || event;
if (evt.keyCode == 13) {
doSearch();
}
};
dialog.onok = function (){
var center = map.getCenter();
var zoom = map.zoomLevel;
var size = map.getSize();
var point = marker.getPoint();
var url = "http://api.map.baidu.com/staticimage?center=" + center.lng + ',' + center.lat +
"&zoom=" + zoom + "&width=" + size.width + '&height=' + size.height + "&markers=" + point.lng + ',' + point.lat;
editor.execCommand('inserthtml', '<img width="'+ size.width +'"height="'+ size.height +'" src="' + url + '"' + (imgcss ? ' style="' + imgcss + '"' :'') + '/>');
};
document.getElementById("address").focus();
</script>
</body>
</html>
| 10npsite | trunk/guanli/system/ueditor/dialogs/map/map.html | HTML | asf20 | 4,924 |
// Copyright (c) 2009, Baidu Inc. All rights reserved.
//
// Licensed under the BSD License
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http:// tangram.baidu.com/license.html
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @namespace T Tangram七巧板
* @name T
* @version 1.6.0
*/
/**
* 声明baidu包
* @author: allstar, erik, meizz, berg
*/
var T,
baidu = T = baidu || {version: "1.5.0"};
baidu.guid = "$BAIDU$";
baidu.$$ = window[baidu.guid] = window[baidu.guid] || {global:{}};
/**
* 使用flash资源封装的一些功能
* @namespace baidu.flash
*/
baidu.flash = baidu.flash || {};
/**
* 操作dom的方法
* @namespace baidu.dom
*/
baidu.dom = baidu.dom || {};
/**
* 从文档中获取指定的DOM元素
* @name baidu.dom.g
* @function
* @grammar baidu.dom.g(id)
* @param {string|HTMLElement} id 元素的id或DOM元素.
* @shortcut g,T.G
* @meta standard
* @see baidu.dom.q
*
* @return {HTMLElement|null} 获取的元素,查找不到时返回null,如果参数不合法,直接返回参数.
*/
baidu.dom.g = function(id) {
if (!id) return null;
if ('string' == typeof id || id instanceof String) {
return document.getElementById(id);
} else if (id.nodeName && (id.nodeType == 1 || id.nodeType == 9)) {
return id;
}
return null;
};
baidu.g = baidu.G = baidu.dom.g;
/**
* 操作数组的方法
* @namespace baidu.array
*/
baidu.array = baidu.array || {};
/**
* 遍历数组中所有元素
* @name baidu.array.each
* @function
* @grammar baidu.array.each(source, iterator[, thisObject])
* @param {Array} source 需要遍历的数组
* @param {Function} iterator 对每个数组元素进行调用的函数,该函数有两个参数,第一个为数组元素,第二个为数组索引值,function (item, index)。
* @param {Object} [thisObject] 函数调用时的this指针,如果没有此参数,默认是当前遍历的数组
* @remark
* each方法不支持对Object的遍历,对Object的遍历使用baidu.object.each 。
* @shortcut each
* @meta standard
*
* @returns {Array} 遍历的数组
*/
baidu.each = baidu.array.forEach = baidu.array.each = function (source, iterator, thisObject) {
var returnValue, item, i, len = source.length;
if ('function' == typeof iterator) {
for (i = 0; i < len; i++) {
item = source[i];
returnValue = iterator.call(thisObject || source, item, i);
if (returnValue === false) {
break;
}
}
}
return source;
};
/**
* 对语言层面的封装,包括类型判断、模块扩展、继承基类以及对象自定义事件的支持。
* @namespace baidu.lang
*/
baidu.lang = baidu.lang || {};
/**
* 判断目标参数是否为function或Function实例
* @name baidu.lang.isFunction
* @function
* @grammar baidu.lang.isFunction(source)
* @param {Any} source 目标参数
* @version 1.2
* @see baidu.lang.isString,baidu.lang.isObject,baidu.lang.isNumber,baidu.lang.isArray,baidu.lang.isElement,baidu.lang.isBoolean,baidu.lang.isDate
* @meta standard
* @returns {boolean} 类型判断结果
*/
baidu.lang.isFunction = function (source) {
return '[object Function]' == Object.prototype.toString.call(source);
};
/**
* 判断目标参数是否string类型或String对象
* @name baidu.lang.isString
* @function
* @grammar baidu.lang.isString(source)
* @param {Any} source 目标参数
* @shortcut isString
* @meta standard
* @see baidu.lang.isObject,baidu.lang.isNumber,baidu.lang.isArray,baidu.lang.isElement,baidu.lang.isBoolean,baidu.lang.isDate
*
* @returns {boolean} 类型判断结果
*/
baidu.lang.isString = function (source) {
return '[object String]' == Object.prototype.toString.call(source);
};
baidu.isString = baidu.lang.isString;
/**
* 判断浏览器类型和特性的属性
* @namespace baidu.browser
*/
baidu.browser = baidu.browser || {};
/**
* 判断是否为opera浏览器
* @property opera opera版本号
* @grammar baidu.browser.opera
* @meta standard
* @see baidu.browser.ie,baidu.browser.firefox,baidu.browser.safari,baidu.browser.chrome
* @returns {Number} opera版本号
*/
/**
* opera 从10开始不是用opera后面的字符串进行版本的判断
* 在Browser identification最后添加Version + 数字进行版本标识
* opera后面的数字保持在9.80不变
*/
baidu.browser.opera = /opera(\/| )(\d+(\.\d+)?)(.+?(version\/(\d+(\.\d+)?)))?/i.test(navigator.userAgent) ? + ( RegExp["\x246"] || RegExp["\x242"] ) : undefined;
/**
* 在目标元素的指定位置插入HTML代码
* @name baidu.dom.insertHTML
* @function
* @grammar baidu.dom.insertHTML(element, position, html)
* @param {HTMLElement|string} element 目标元素或目标元素的id
* @param {string} position 插入html的位置信息,取值为beforeBegin,afterBegin,beforeEnd,afterEnd
* @param {string} html 要插入的html
* @remark
*
* 对于position参数,大小写不敏感<br>
* 参数的意思:beforeBegin<span>afterBegin this is span! beforeEnd</span> afterEnd <br />
* 此外,如果使用本函数插入带有script标签的HTML字符串,script标签对应的脚本将不会被执行。
*
* @shortcut insertHTML
* @meta standard
*
* @returns {HTMLElement} 目标元素
*/
baidu.dom.insertHTML = function (element, position, html) {
element = baidu.dom.g(element);
var range,begin;
if (element.insertAdjacentHTML && !baidu.browser.opera) {
element.insertAdjacentHTML(position, html);
} else {
range = element.ownerDocument.createRange();
position = position.toUpperCase();
if (position == 'AFTERBEGIN' || position == 'BEFOREEND') {
range.selectNodeContents(element);
range.collapse(position == 'AFTERBEGIN');
} else {
begin = position == 'BEFOREBEGIN';
range[begin ? 'setStartBefore' : 'setEndAfter'](element);
range.collapse(begin);
}
range.insertNode(range.createContextualFragment(html));
}
return element;
};
baidu.insertHTML = baidu.dom.insertHTML;
/**
* 操作flash对象的方法,包括创建flash对象、获取flash对象以及判断flash插件的版本号
* @namespace baidu.swf
*/
baidu.swf = baidu.swf || {};
/**
* 浏览器支持的flash插件版本
* @property version 浏览器支持的flash插件版本
* @grammar baidu.swf.version
* @return {String} 版本号
* @meta standard
*/
baidu.swf.version = (function () {
var n = navigator;
if (n.plugins && n.mimeTypes.length) {
var plugin = n.plugins["Shockwave Flash"];
if (plugin && plugin.description) {
return plugin.description
.replace(/([a-zA-Z]|\s)+/, "")
.replace(/(\s)+r/, ".") + ".0";
}
} else if (window.ActiveXObject && !window.opera) {
for (var i = 12; i >= 2; i--) {
try {
var c = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.' + i);
if (c) {
var version = c.GetVariable("$version");
return version.replace(/WIN/g,'').replace(/,/g,'.');
}
} catch(e) {}
}
}
})();
/**
* 操作字符串的方法
* @namespace baidu.string
*/
baidu.string = baidu.string || {};
/**
* 对目标字符串进行html编码
* @name baidu.string.encodeHTML
* @function
* @grammar baidu.string.encodeHTML(source)
* @param {string} source 目标字符串
* @remark
* 编码字符有5个:&<>"'
* @shortcut encodeHTML
* @meta standard
* @see baidu.string.decodeHTML
*
* @returns {string} html编码后的字符串
*/
baidu.string.encodeHTML = function (source) {
return String(source)
.replace(/&/g,'&')
.replace(/</g,'<')
.replace(/>/g,'>')
.replace(/"/g, """)
.replace(/'/g, "'");
};
baidu.encodeHTML = baidu.string.encodeHTML;
/**
* 创建flash对象的html字符串
* @name baidu.swf.createHTML
* @function
* @grammar baidu.swf.createHTML(options)
*
* @param {Object} options 创建flash的选项参数
* @param {string} options.id 要创建的flash的标识
* @param {string} options.url flash文件的url
* @param {String} options.errorMessage 未安装flash player或flash player版本号过低时的提示
* @param {string} options.ver 最低需要的flash player版本号
* @param {string} options.width flash的宽度
* @param {string} options.height flash的高度
* @param {string} options.align flash的对齐方式,允许值:middle/left/right/top/bottom
* @param {string} options.base 设置用于解析swf文件中的所有相对路径语句的基本目录或URL
* @param {string} options.bgcolor swf文件的背景色
* @param {string} options.salign 设置缩放的swf文件在由width和height设置定义的区域内的位置。允许值:l/r/t/b/tl/tr/bl/br
* @param {boolean} options.menu 是否显示右键菜单,允许值:true/false
* @param {boolean} options.loop 播放到最后一帧时是否重新播放,允许值: true/false
* @param {boolean} options.play flash是否在浏览器加载时就开始播放。允许值:true/false
* @param {string} options.quality 设置flash播放的画质,允许值:low/medium/high/autolow/autohigh/best
* @param {string} options.scale 设置flash内容如何缩放来适应设置的宽高。允许值:showall/noborder/exactfit
* @param {string} options.wmode 设置flash的显示模式。允许值:window/opaque/transparent
* @param {string} options.allowscriptaccess 设置flash与页面的通信权限。允许值:always/never/sameDomain
* @param {string} options.allownetworking 设置swf文件中允许使用的网络API。允许值:all/internal/none
* @param {boolean} options.allowfullscreen 是否允许flash全屏。允许值:true/false
* @param {boolean} options.seamlesstabbing 允许设置执行无缝跳格,从而使用户能跳出flash应用程序。该参数只能在安装Flash7及更高版本的Windows中使用。允许值:true/false
* @param {boolean} options.devicefont 设置静态文本对象是否以设备字体呈现。允许值:true/false
* @param {boolean} options.swliveconnect 第一次加载flash时浏览器是否应启动Java。允许值:true/false
* @param {Object} options.vars 要传递给flash的参数,支持JSON或string类型。
*
* @see baidu.swf.create
* @meta standard
* @returns {string} flash对象的html字符串
*/
baidu.swf.createHTML = function (options) {
options = options || {};
var version = baidu.swf.version,
needVersion = options['ver'] || '6.0.0',
vUnit1, vUnit2, i, k, len, item, tmpOpt = {},
encodeHTML = baidu.string.encodeHTML;
for (k in options) {
tmpOpt[k] = options[k];
}
options = tmpOpt;
if (version) {
version = version.split('.');
needVersion = needVersion.split('.');
for (i = 0; i < 3; i++) {
vUnit1 = parseInt(version[i], 10);
vUnit2 = parseInt(needVersion[i], 10);
if (vUnit2 < vUnit1) {
break;
} else if (vUnit2 > vUnit1) {
return '';
}
}
} else {
return '';
}
var vars = options['vars'],
objProperties = ['classid', 'codebase', 'id', 'width', 'height', 'align'];
options['align'] = options['align'] || 'middle';
options['classid'] = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
options['codebase'] = 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0';
options['movie'] = options['url'] || '';
delete options['vars'];
delete options['url'];
if ('string' == typeof vars) {
options['flashvars'] = vars;
} else {
var fvars = [];
for (k in vars) {
item = vars[k];
fvars.push(k + "=" + encodeURIComponent(item));
}
options['flashvars'] = fvars.join('&');
}
var str = ['<object '];
for (i = 0, len = objProperties.length; i < len; i++) {
item = objProperties[i];
str.push(' ', item, '="', encodeHTML(options[item]), '"');
}
str.push('>');
var params = {
'wmode' : 1,
'scale' : 1,
'quality' : 1,
'play' : 1,
'loop' : 1,
'menu' : 1,
'salign' : 1,
'bgcolor' : 1,
'base' : 1,
'allowscriptaccess' : 1,
'allownetworking' : 1,
'allowfullscreen' : 1,
'seamlesstabbing' : 1,
'devicefont' : 1,
'swliveconnect' : 1,
'flashvars' : 1,
'movie' : 1
};
for (k in options) {
item = options[k];
k = k.toLowerCase();
if (params[k] && (item || item === false || item === 0)) {
str.push('<param name="' + k + '" value="' + encodeHTML(item) + '" />');
}
}
options['src'] = options['movie'];
options['name'] = options['id'];
delete options['id'];
delete options['movie'];
delete options['classid'];
delete options['codebase'];
options['type'] = 'application/x-shockwave-flash';
options['pluginspage'] = 'http://www.macromedia.com/go/getflashplayer';
str.push('<embed');
var salign;
for (k in options) {
item = options[k];
if (item || item === false || item === 0) {
if ((new RegExp("^salign\x24", "i")).test(k)) {
salign = item;
continue;
}
str.push(' ', k, '="', encodeHTML(item), '"');
}
}
if (salign) {
str.push(' salign="', encodeHTML(salign), '"');
}
str.push('></embed></object>');
return str.join('');
};
/**
* 在页面中创建一个flash对象
* @name baidu.swf.create
* @function
* @grammar baidu.swf.create(options[, container])
*
* @param {Object} options 创建flash的选项参数
* @param {string} options.id 要创建的flash的标识
* @param {string} options.url flash文件的url
* @param {String} options.errorMessage 未安装flash player或flash player版本号过低时的提示
* @param {string} options.ver 最低需要的flash player版本号
* @param {string} options.width flash的宽度
* @param {string} options.height flash的高度
* @param {string} options.align flash的对齐方式,允许值:middle/left/right/top/bottom
* @param {string} options.base 设置用于解析swf文件中的所有相对路径语句的基本目录或URL
* @param {string} options.bgcolor swf文件的背景色
* @param {string} options.salign 设置缩放的swf文件在由width和height设置定义的区域内的位置。允许值:l/r/t/b/tl/tr/bl/br
* @param {boolean} options.menu 是否显示右键菜单,允许值:true/false
* @param {boolean} options.loop 播放到最后一帧时是否重新播放,允许值: true/false
* @param {boolean} options.play flash是否在浏览器加载时就开始播放。允许值:true/false
* @param {string} options.quality 设置flash播放的画质,允许值:low/medium/high/autolow/autohigh/best
* @param {string} options.scale 设置flash内容如何缩放来适应设置的宽高。允许值:showall/noborder/exactfit
* @param {string} options.wmode 设置flash的显示模式。允许值:window/opaque/transparent
* @param {string} options.allowscriptaccess 设置flash与页面的通信权限。允许值:always/never/sameDomain
* @param {string} options.allownetworking 设置swf文件中允许使用的网络API。允许值:all/internal/none
* @param {boolean} options.allowfullscreen 是否允许flash全屏。允许值:true/false
* @param {boolean} options.seamlesstabbing 允许设置执行无缝跳格,从而使用户能跳出flash应用程序。该参数只能在安装Flash7及更高版本的Windows中使用。允许值:true/false
* @param {boolean} options.devicefont 设置静态文本对象是否以设备字体呈现。允许值:true/false
* @param {boolean} options.swliveconnect 第一次加载flash时浏览器是否应启动Java。允许值:true/false
* @param {Object} options.vars 要传递给flash的参数,支持JSON或string类型。
*
* @param {HTMLElement|string} [container] flash对象的父容器元素,不传递该参数时在当前代码位置创建flash对象。
* @meta standard
* @see baidu.swf.createHTML,baidu.swf.getMovie
*/
baidu.swf.create = function (options, target) {
options = options || {};
var html = baidu.swf.createHTML(options)
|| options['errorMessage']
|| '';
if (target && 'string' == typeof target) {
target = document.getElementById(target);
}
baidu.dom.insertHTML( target || document.body ,'beforeEnd',html );
};
/**
* 判断是否为ie浏览器
* @name baidu.browser.ie
* @field
* @grammar baidu.browser.ie
* @returns {Number} IE版本号
*/
baidu.browser.ie = baidu.ie = /msie (\d+\.\d+)/i.test(navigator.userAgent) ? (document.documentMode || + RegExp['\x241']) : undefined;
/**
* 移除数组中的项
* @name baidu.array.remove
* @function
* @grammar baidu.array.remove(source, match)
* @param {Array} source 需要移除项的数组
* @param {Any} match 要移除的项
* @meta standard
* @see baidu.array.removeAt
*
* @returns {Array} 移除后的数组
*/
baidu.array.remove = function (source, match) {
var len = source.length;
while (len--) {
if (len in source && source[len] === match) {
source.splice(len, 1);
}
}
return source;
};
/**
* 判断目标参数是否Array对象
* @name baidu.lang.isArray
* @function
* @grammar baidu.lang.isArray(source)
* @param {Any} source 目标参数
* @meta standard
* @see baidu.lang.isString,baidu.lang.isObject,baidu.lang.isNumber,baidu.lang.isElement,baidu.lang.isBoolean,baidu.lang.isDate
*
* @returns {boolean} 类型判断结果
*/
baidu.lang.isArray = function (source) {
return '[object Array]' == Object.prototype.toString.call(source);
};
/**
* 将一个变量转换成array
* @name baidu.lang.toArray
* @function
* @grammar baidu.lang.toArray(source)
* @param {mix} source 需要转换成array的变量
* @version 1.3
* @meta standard
* @returns {array} 转换后的array
*/
baidu.lang.toArray = function (source) {
if (source === null || source === undefined)
return [];
if (baidu.lang.isArray(source))
return source;
if (typeof source.length !== 'number' || typeof source === 'string' || baidu.lang.isFunction(source)) {
return [source];
}
if (source.item) {
var l = source.length, array = new Array(l);
while (l--)
array[l] = source[l];
return array;
}
return [].slice.call(source);
};
/**
* 获得flash对象的实例
* @name baidu.swf.getMovie
* @function
* @grammar baidu.swf.getMovie(name)
* @param {string} name flash对象的名称
* @see baidu.swf.create
* @meta standard
* @returns {HTMLElement} flash对象的实例
*/
baidu.swf.getMovie = function (name) {
var movie = document[name], ret;
return baidu.browser.ie == 9 ?
movie && movie.length ?
(ret = baidu.array.remove(baidu.lang.toArray(movie),function(item){
return item.tagName.toLowerCase() != "embed";
})).length == 1 ? ret[0] : ret
: movie
: movie || window[name];
};
baidu.flash._Base = (function(){
var prefix = 'bd__flash__';
/**
* 创建一个随机的字符串
* @private
* @return {String}
*/
function _createString(){
return prefix + Math.floor(Math.random() * 2147483648).toString(36);
};
/**
* 检查flash状态
* @private
* @param {Object} target flash对象
* @return {Boolean}
*/
function _checkReady(target){
if(typeof target !== 'undefined' && typeof target.flashInit !== 'undefined' && target.flashInit()){
return true;
}else{
return false;
}
};
/**
* 调用之前进行压栈的函数
* @private
* @param {Array} callQueue 调用队列
* @param {Object} target flash对象
* @return {Null}
*/
function _callFn(callQueue, target){
var result = null;
callQueue = callQueue.reverse();
baidu.each(callQueue, function(item){
result = target.call(item.fnName, item.params);
item.callBack(result);
});
};
/**
* 为传入的匿名函数创建函数名
* @private
* @param {String|Function} fun 传入的匿名函数或者函数名
* @return {String}
*/
function _createFunName(fun){
var name = '';
if(baidu.lang.isFunction(fun)){
name = _createString();
window[name] = function(){
fun.apply(window, arguments);
};
return name;
}else if(baidu.lang.isString){
return fun;
}
};
/**
* 绘制flash
* @private
* @param {Object} options 创建参数
* @return {Object}
*/
function _render(options){
if(!options.id){
options.id = _createString();
}
var container = options.container || '';
delete(options.container);
baidu.swf.create(options, container);
return baidu.swf.getMovie(options.id);
};
return function(options, callBack){
var me = this,
autoRender = (typeof options.autoRender !== 'undefined' ? options.autoRender : true),
createOptions = options.createOptions || {},
target = null,
isReady = false,
callQueue = [],
timeHandle = null,
callBack = callBack || [];
/**
* 将flash文件绘制到页面上
* @public
* @return {Null}
*/
me.render = function(){
target = _render(createOptions);
if(callBack.length > 0){
baidu.each(callBack, function(funName, index){
callBack[index] = _createFunName(options[funName] || new Function());
});
}
me.call('setJSFuncName', [callBack]);
};
/**
* 返回flash状态
* @return {Boolean}
*/
me.isReady = function(){
return isReady;
};
/**
* 调用flash接口的统一入口
* @param {String} fnName 调用的函数名
* @param {Array} params 传入的参数组成的数组,若不许要参数,需传入空数组
* @param {Function} [callBack] 异步调用后将返回值作为参数的调用回调函数,如无返回值,可以不传入此参数
* @return {Null}
*/
me.call = function(fnName, params, callBack){
if(!fnName) return null;
callBack = callBack || new Function();
var result = null;
if(isReady){
result = target.call(fnName, params);
callBack(result);
}else{
callQueue.push({
fnName: fnName,
params: params,
callBack: callBack
});
(!timeHandle) && (timeHandle = setInterval(_check, 200));
}
};
/**
* 为传入的匿名函数创建函数名
* @public
* @param {String|Function} fun 传入的匿名函数或者函数名
* @return {String}
*/
me.createFunName = function(fun){
return _createFunName(fun);
};
/**
* 检查flash是否ready, 并进行调用
* @private
* @return {Null}
*/
function _check(){
if(_checkReady(target)){
clearInterval(timeHandle);
timeHandle = null;
_call();
isReady = true;
}
};
/**
* 调用之前进行压栈的函数
* @private
* @return {Null}
*/
function _call(){
_callFn(callQueue, target);
callQueue = [];
}
autoRender && me.render();
};
})();
/**
* 创建flash based imageUploader
* @class
* @grammar baidu.flash.imageUploader(options)
* @param {Object} createOptions 创建flash时需要的参数,请参照baidu.swf.create文档
* @config {Object} vars 创建imageUploader时所需要的参数
* @config {Number} vars.gridWidth 每一个预览图片所占的宽度,应该为flash寛的整除
* @config {Number} vars.gridHeight 每一个预览图片所占的高度,应该为flash高的整除
* @config {Number} vars.picWidth 单张预览图片的宽度
* @config {Number} vars.picHeight 单张预览图片的高度
* @config {String} vars.uploadDataFieldName POST请求中图片数据的key,默认值'picdata'
* @config {String} vars.picDescFieldName POST请求中图片描述的key,默认值'picDesc'
* @config {Number} vars.maxSize 文件的最大体积,单位'MB'
* @config {Number} vars.compressSize 上传前如果图片体积超过该值,会先压缩
* @config {Number} vars.maxNum:32 最大上传多少个文件
* @config {Number} vars.compressLength 能接受的最大边长,超过该值会等比压缩
* @config {String} vars.url 上传的url地址
* @config {Number} vars.mode mode == 0时,是使用滚动条,mode == 1时,拉伸flash, 默认值为0
* @see baidu.swf.createHTML
* @param {String} backgroundUrl 背景图片路径
* @param {String} listBacgroundkUrl 布局控件背景
* @param {String} buttonUrl 按钮图片不背景
* @param {String|Function} selectFileCallback 选择文件的回调
* @param {String|Function} exceedFileCallback文件超出限制的最大体积时的回调
* @param {String|Function} deleteFileCallback 删除文件的回调
* @param {String|Function} startUploadCallback 开始上传某个文件时的回调
* @param {String|Function} uploadCompleteCallback 某个文件上传完成的回调
* @param {String|Function} uploadErrorCallback 某个文件上传失败的回调
* @param {String|Function} allCompleteCallback 全部上传完成时的回调
* @param {String|Function} changeFlashHeight 改变Flash的高度,mode==1的时候才有用
*/
baidu.flash.imageUploader = baidu.flash.imageUploader || function(options){
var me = this,
options = options || {},
_flash = new baidu.flash._Base(options, [
'selectFileCallback',
'exceedFileCallback',
'deleteFileCallback',
'startUploadCallback',
'uploadCompleteCallback',
'uploadErrorCallback',
'allCompleteCallback',
'changeFlashHeight'
]);
/**
* 开始或回复上传图片
* @public
* @return {Null}
*/
me.upload = function(){
_flash.call('upload');
};
/**
* 暂停上传图片
* @public
* @return {Null}
*/
me.pause = function(){
_flash.call('pause');
};
};
/**
* 操作原生对象的方法
* @namespace baidu.object
*/
baidu.object = baidu.object || {};
/**
* 将源对象的所有属性拷贝到目标对象中
* @author erik
* @name baidu.object.extend
* @function
* @grammar baidu.object.extend(target, source)
* @param {Object} target 目标对象
* @param {Object} source 源对象
* @see baidu.array.merge
* @remark
*
1.目标对象中,与源对象key相同的成员将会被覆盖。<br>
2.源对象的prototype成员不会拷贝。
* @shortcut extend
* @meta standard
*
* @returns {Object} 目标对象
*/
baidu.extend =
baidu.object.extend = function (target, source) {
for (var p in source) {
if (source.hasOwnProperty(p)) {
target[p] = source[p];
}
}
return target;
};
/**
* 创建flash based fileUploader
* @class
* @grammar baidu.flash.fileUploader(options)
* @param {Object} options
* @config {Object} createOptions 创建flash时需要的参数,请参照baidu.swf.create文档
* @config {String} createOptions.width
* @config {String} createOptions.height
* @config {Number} maxNum 最大可选文件数
* @config {Function|String} selectFile
* @config {Function|String} exceedMaxSize
* @config {Function|String} deleteFile
* @config {Function|String} uploadStart
* @config {Function|String} uploadComplete
* @config {Function|String} uploadError
* @config {Function|String} uploadProgress
*/
baidu.flash.fileUploader = baidu.flash.fileUploader || function(options){
var me = this,
options = options || {};
options.createOptions = baidu.extend({
wmod: 'transparent'
},options.createOptions || {});
var _flash = new baidu.flash._Base(options, [
'selectFile',
'exceedMaxSize',
'deleteFile',
'uploadStart',
'uploadComplete',
'uploadError',
'uploadProgress'
]);
_flash.call('setMaxNum', options.maxNum ? [options.maxNum] : [1]);
/**
* 设置当鼠标移动到flash上时,是否变成手型
* @public
* @param {Boolean} isCursor
* @return {Null}
*/
me.setHandCursor = function(isCursor){
_flash.call('setHandCursor', [isCursor || false]);
};
/**
* 设置鼠标相应函数名
* @param {String|Function} fun
*/
me.setMSFunName = function(fun){
_flash.call('setMSFunName',[_flash.createFunName(fun)]);
};
/**
* 执行上传操作
* @param {String} url 上传的url
* @param {String} fieldName 上传的表单字段名
* @param {Object} postData 键值对,上传的POST数据
* @param {Number|Array|null|-1} [index]上传的文件序列
* Int值上传该文件
* Array一次串行上传该序列文件
* -1/null上传所有文件
* @return {Null}
*/
me.upload = function(url, fieldName, postData, index){
if(typeof url !== 'string' || typeof fieldName !== 'string') return null;
if(typeof index === 'undefined') index = -1;
_flash.call('upload', [url, fieldName, postData, index]);
};
/**
* 取消上传操作
* @public
* @param {Number|-1} index
*/
me.cancel = function(index){
if(typeof index === 'undefined') index = -1;
_flash.call('cancel', [index]);
};
/**
* 删除文件
* @public
* @param {Number|Array} [index] 要删除的index,不传则全部删除
* @param {Function} callBack
* @param
* */
me.deleteFile = function(index, callBack){
var callBackAll = function(list){
callBack && callBack(list);
};
if(typeof index === 'undefined'){
_flash.call('deleteFilesAll', [], callBackAll);
return;
};
if(typeof index === 'Number') index = [index];
index.sort(function(a,b){
return b-a;
});
baidu.each(index, function(item){
_flash.call('deleteFileBy', item, callBackAll);
});
};
/**
* 添加文件类型,支持macType
* @public
* @param {Object|Array[Object]} type {description:String, extention:String}
* @return {Null};
*/
me.addFileType = function(type){
var type = type || [[]];
if(type instanceof Array) type = [type];
else type = [[type]];
_flash.call('addFileTypes', type);
};
/**
* 设置文件类型,支持macType
* @public
* @param {Object|Array[Object]} type {description:String, extention:String}
* @return {Null};
*/
me.setFileType = function(type){
var type = type || [[]];
if(type instanceof Array) type = [type];
else type = [[type]];
_flash.call('setFileTypes', type);
};
/**
* 设置可选文件的数量限制
* @public
* @param {Number} num
* @return {Null}
*/
me.setMaxNum = function(num){
_flash.call('setMaxNum', [num]);
};
/**
* 设置可选文件大小限制,以兆M为单位
* @public
* @param {Number} num,0为无限制
* @return {Null}
*/
me.setMaxSize = function(num){
_flash.call('setMaxSize', [num]);
};
/**
* @public
*/
me.getFileAll = function(callBack){
_flash.call('getFileAll', [], callBack);
};
/**
* @public
* @param {Number} index
* @param {Function} [callBack]
*/
me.getFileByIndex = function(index, callBack){
_flash.call('getFileByIndex', [], callBack);
};
/**
* @public
* @param {Number} index
* @param {function} [callBack]
*/
me.getStatusByIndex = function(index, callBack){
_flash.call('getStatusByIndex', [], callBack);
};
};
/**
* 使用动态script标签请求服务器资源,包括由服务器端的回调和浏览器端的回调
* @namespace baidu.sio
*/
baidu.sio = baidu.sio || {};
/**
*
* @param {HTMLElement} src script节点
* @param {String} url script节点的地址
* @param {String} [charset] 编码
*/
baidu.sio._createScriptTag = function(scr, url, charset){
scr.setAttribute('type', 'text/javascript');
charset && scr.setAttribute('charset', charset);
scr.setAttribute('src', url);
document.getElementsByTagName('head')[0].appendChild(scr);
};
/**
* 删除script的属性,再删除script标签,以解决修复内存泄漏的问题
*
* @param {HTMLElement} src script节点
*/
baidu.sio._removeScriptTag = function(scr){
if (scr.clearAttributes) {
scr.clearAttributes();
} else {
for (var attr in scr) {
if (scr.hasOwnProperty(attr)) {
delete scr[attr];
}
}
}
if(scr && scr.parentNode){
scr.parentNode.removeChild(scr);
}
scr = null;
};
/**
* 通过script标签加载数据,加载完成由浏览器端触发回调
* @name baidu.sio.callByBrowser
* @function
* @grammar baidu.sio.callByBrowser(url, opt_callback, opt_options)
* @param {string} url 加载数据的url
* @param {Function|string} opt_callback 数据加载结束时调用的函数或函数名
* @param {Object} opt_options 其他可选项
* @config {String} [charset] script的字符集
* @config {Integer} [timeOut] 超时时间,超过这个时间将不再响应本请求,并触发onfailure函数
* @config {Function} [onfailure] timeOut设定后才生效,到达超时时间时触发本函数
* @remark
* 1、与callByServer不同,callback参数只支持Function类型,不支持string。
* 2、如果请求了一个不存在的页面,callback函数在IE/opera下也会被调用,因此使用者需要在onsuccess函数中判断数据是否正确加载。
* @meta standard
* @see baidu.sio.callByServer
*/
baidu.sio.callByBrowser = function (url, opt_callback, opt_options) {
var scr = document.createElement("SCRIPT"),
scriptLoaded = 0,
options = opt_options || {},
charset = options['charset'],
callback = opt_callback || function(){},
timeOut = options['timeOut'] || 0,
timer;
scr.onload = scr.onreadystatechange = function () {
if (scriptLoaded) {
return;
}
var readyState = scr.readyState;
if ('undefined' == typeof readyState
|| readyState == "loaded"
|| readyState == "complete") {
scriptLoaded = 1;
try {
callback();
clearTimeout(timer);
} finally {
scr.onload = scr.onreadystatechange = null;
baidu.sio._removeScriptTag(scr);
}
}
};
if( timeOut ){
timer = setTimeout(function(){
scr.onload = scr.onreadystatechange = null;
baidu.sio._removeScriptTag(scr);
options.onfailure && options.onfailure();
}, timeOut);
}
baidu.sio._createScriptTag(scr, url, charset);
};
/**
* 通过script标签加载数据,加载完成由服务器端触发回调
* @name baidu.sio.callByServer
* @function
* @grammar baidu.sio.callByServer(url, callback[, opt_options])
* @param {string} url 加载数据的url.
* @param {Function|string} callback 服务器端调用的函数或函数名。如果没有指定本参数,将在URL中寻找options['queryField']做为callback的方法名.
* @param {Object} opt_options 加载数据时的选项.
* @config {string} [charset] script的字符集
* @config {string} [queryField] 服务器端callback请求字段名,默认为callback
* @config {Integer} [timeOut] 超时时间(单位:ms),超过这个时间将不再响应本请求,并触发onfailure函数
* @config {Function} [onfailure] timeOut设定后才生效,到达超时时间时触发本函数
* @remark
* 如果url中已经包含key为“options['queryField']”的query项,将会被替换成callback中参数传递或自动生成的函数名。
* @meta standard
* @see baidu.sio.callByBrowser
*/
baidu.sio.callByServer = /**@function*/function(url, callback, opt_options) {
var scr = document.createElement('SCRIPT'),
prefix = 'bd__cbs__',
callbackName,
callbackImpl,
options = opt_options || {},
charset = options['charset'],
queryField = options['queryField'] || 'callback',
timeOut = options['timeOut'] || 0,
timer,
reg = new RegExp('(\\?|&)' + queryField + '=([^&]*)'),
matches;
if (baidu.lang.isFunction(callback)) {
callbackName = prefix + Math.floor(Math.random() * 2147483648).toString(36);
window[callbackName] = getCallBack(0);
} else if(baidu.lang.isString(callback)){
callbackName = callback;
} else {
if (matches = reg.exec(url)) {
callbackName = matches[2];
}
}
if( timeOut ){
timer = setTimeout(getCallBack(1), timeOut);
}
url = url.replace(reg, '\x241' + queryField + '=' + callbackName);
if (url.search(reg) < 0) {
url += (url.indexOf('?') < 0 ? '?' : '&') + queryField + '=' + callbackName;
}
baidu.sio._createScriptTag(scr, url, charset);
/*
* 返回一个函数,用于立即(挂在window上)或者超时(挂在setTimeout中)时执行
*/
function getCallBack(onTimeOut){
/*global callbackName, callback, scr, options;*/
return function(){
try {
if( onTimeOut ){
options.onfailure && options.onfailure();
}else{
callback.apply(window, arguments);
clearTimeout(timer);
}
window[callbackName] = null;
delete window[callbackName];
} catch (exception) {
} finally {
baidu.sio._removeScriptTag(scr);
}
}
}
};
/**
* 通过请求一个图片的方式令服务器存储一条日志
* @function
* @grammar baidu.sio.log(url)
* @param {string} url 要发送的地址.
* @author: int08h,leeight
*/
baidu.sio.log = function(url) {
var img = new Image(),
key = 'tangram_sio_log_' + Math.floor(Math.random() *
2147483648).toString(36);
window[key] = img;
img.onload = img.onerror = img.onabort = function() {
img.onload = img.onerror = img.onabort = null;
window[key] = null;
img = null;
};
img.src = url;
};
| 10npsite | trunk/guanli/system/ueditor/dialogs/tangram.js | JavaScript | asf20 | 40,813 |
/**
* Created by JetBrains PhpStorm.
* User: taoqili
* Date: 12-2-10
* Time: 下午3:50
* To change this template use File | Settings | File Templates.
*/
//文件类型图标索引
var fileTypeMaps = {
".rar":"icon_rar.gif",
".zip":"icon_rar.gif",
".doc":"icon_doc.gif",
".docx":"icon_doc.gif",
".pdf":"icon_pdf.gif",
".mp3":"icon_mp3.gif",
".xls":"icon_xls.gif",
".chm":"icon_chm.gif",
".ppt":"icon_ppt.gif",
".pptx":"icon_ppt.gif",
".avi":"icon_mv.gif",
".rmvb":"icon_mv.gif",
".wmv":"icon_mv.gif",
".flv":"icon_mv.gif",
".swf":"icon_mv.gif",
".rm":"icon_mv.gif",
".exe":"icon_exe.gif",
".psd":"icon_psd.gif",
".txt":"icon_txt.gif"
}; | 10npsite | trunk/guanli/system/ueditor/dialogs/attachment/fileTypeMaps.js | JavaScript | asf20 | 747 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>附件上传</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="attachment.css"/>
</head>
<body>
<div class="wrapper">
<div class="controller">
<span id="divStatus">本次共成功上传 0 个文件</span>
<span id="spanButtonPlaceHolder"></span>
</div>
<div class="fieldset flash" id="fsUploadProgress"></div>
<span id="startUpload" style="display: none;"></span>
</div>
<script type="text/javascript" src="../internal.js"></script>
<script type="text/javascript" src="../../third-party/swfupload/swfupload.js"></script>
<script type="text/javascript" src="../../third-party/swfupload/swfupload.queue.js"></script>
<script type="text/javascript" src="../../third-party/swfupload/fileprogress.js"></script>
<script type="text/javascript" src="callbacks.js"></script>
<script type="text/javascript" src="fileTypeMaps.js"></script>
<script type="text/javascript">
var swfupload,
filesList=[];
window.onload = function () {
var settings = {
flash_url:"../../third-party/swfupload/swfupload.swf",
flash9_url:"../../third-party/swfupload/swfupload_fp9.swf",
upload_url:"../../server/upload/php/fileUp.php", //附件上传服务器地址
post_params:{"PHPSESSID":"<?php echo session_id(); ?>"}, //解决session丢失问题
file_size_limit:"100 MB", //文件大小限制,此处仅是前端flash选择时候的限制,具体还需要和后端结合判断
file_types:"*.*", //允许的扩展名,多个扩展名之间用分号隔开,支持*通配符
file_types_description:"All Files", //扩展名描述
file_upload_limit:100, //单次可同时上传的文件数目
file_queue_limit:10, //队列中可同时上传的文件数目
custom_settings:{ //自定义设置,用户可在此向服务器传递自定义变量
progressTarget:"fsUploadProgress",
startUploadId:"startUpload"
},
debug:false,
// 按钮设置
button_image_url:"../../themes/default/images/fileScan.png",
button_width:"100",
button_height:"25",
button_placeholder_id:"spanButtonPlaceHolder",
button_text:'<span class="theFont">文件浏览…</span>',
button_text_style:".theFont { font-size:14px;}",
button_text_left_padding:10,
button_text_top_padding:4,
// 所有回调函数 in handlers.js
swfupload_preload_handler:preLoad,
swfupload_load_failed_handler:loadFailed,
file_queued_handler:fileQueued,
file_queue_error_handler:fileQueueError,
//选择文件完成回调
file_dialog_complete_handler:function(numFilesSelected, numFilesQueued) {
var me = this; //此处的this是swfupload对象
if (numFilesQueued > 0) {
dialog.buttons[0].setDisabled(true);
var start = $G(this.customSettings.startUploadId);
start.style.display = "";
start.onclick = function(){
me.startUpload();
start.style.display = "none";
}
}
},
upload_start_handler:uploadStart,
upload_progress_handler:uploadProgress,
upload_error_handler:uploadError,
upload_success_handler:function (file, serverData) {
try{
var info = eval("("+serverData+")");
}catch(e){}
var progress = new FileProgress(file, this.customSettings.progressTarget);
if(info.state=="SUCCESS"){
progress.setComplete();
progress.setStatus("<span style='color: #0b0;font-weight: bold'>上传成功!</span>");
filesList.push({url:info.url,type:info.fileType});
progress.toggleCancel(true,this,"从成功队列中移除");
}else{
progress.setError();
progress.setStatus(info.state);
progress.toggleCancel(true,this,"移除保存失败文件");
}
},
//上传完成回调
upload_complete_handler:uploadComplete,
//队列完成回调
queue_complete_handler:function(numFilesUploaded){
dialog.buttons[0].setDisabled(false);
var status = $G("divStatus");
var num = status.innerHTML.match(/\d+/g);
status.innerHTML = "本次共成功上传 "+((num && num[0] ?parseInt(num[0]):0) + numFilesUploaded) +" 个文件" ;
}
};
swfupload = new SWFUpload( settings );
//点击OK按钮
dialog.onok = function(){
var map = fileTypeMaps,
str="";
for(var i=0,ci;ci=filesList[i++];){
var src = editor.options.UEDITOR_HOME_URL + "dialogs/attachment/fileTypeImages/"+(map[ci.type]||"icon_default.png");
str += "<p style='line-height: 16px;'><img src='"+ src + "' data_ue_src='"+src+"' />" +
"<a href='"+editor.options.filePath + ci.url+"'>" + ci.url + "</a></p>";
}
editor.execCommand("insertHTML",str);
swfupload.destroy();
};
dialog.oncancel = function(){
swfupload.destroy();
}
};
</script>
</body>
</html>
| 10npsite | trunk/guanli/system/ueditor/dialogs/attachment/attachment.html | HTML | asf20 | 6,127 |
/* Demo Note: This demo uses a FileProgress class that handles the UI for displaying the file name and percent complete.
The FileProgress class is not part of SWFUpload.
*/
/* **********************
Event Handlers
These are my custom event handlers to make my
web application behave the way I went when SWFUpload
completes different tasks. These aren't part of the SWFUpload
package. They are part of my application. Without these none
of the actions SWFUpload makes will show up in my application.
********************** */
function preLoad() {
if (!this.support.loading) {
alert("当前Flash版本过低,请更新FlashPlayer后重试!");
return false;
}
return true;
}
function loadFailed() {
alert("SWFUpload加载失败!请检查路径或网络状态");
}
function fileQueued(file) {
try {
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.setStatus("等待上传……");
progress.toggleCancel(true, this,"从上传队列中移除");
} catch (ex) {
this.debug(ex);
}
}
function fileQueueError(file, errorCode, message) {
try {
if (errorCode === SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {
alert("单次不能选择超过"+ message + "个文件!请重新选择!");
return;
}
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.setError();
progress.toggleCancel(true, this,"移除失败文件");
switch (errorCode) {
case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
progress.setStatus("文件大小超出限制!");
this.debug("Error Code: File too big, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
break;
case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
progress.setStatus("空文件无法上传!");
this.debug("Error Code: Zero byte file, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
break;
case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
progress.setStatus("文件类型错误!");
this.debug("Error Code: Invalid File Type, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
break;
default:
if (file !== null) {
progress.setStatus("未知错误!");
}
this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
break;
}
} catch (ex) {
this.debug(ex);
}
}
function uploadStart(file) {
try {
/* I don't want to do any file validation or anything, I'll just update the UI and
return true to indicate that the upload should start.
It's important to update the UI here because in Linux no uploadProgress events are called. The best
we can do is say we are uploading.
*/
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.setStatus("上传中,请等待……");
progress.toggleCancel(true, this,"取消上传");
}catch (ex) {}
return true;
}
function uploadProgress(file, bytesLoaded, bytesTotal) {
try {
var percent = Math.ceil((bytesLoaded / bytesTotal) * 100);
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.setProgress(percent);
progress.setStatus("上传中,请等待……");
} catch (ex) {
this.debug(ex);
}
}
function uploadError(file, errorCode, message) {
try {
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.setError();
//progress.toggleCancel(false);
switch (errorCode) {
case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
progress.setStatus("网络错误: " + message);
this.debug("Error Code: HTTP Error, File name: " + file.name + ", Message: " + message);
break;
case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
progress.setStatus("上传失败!");
this.debug("Error Code: Upload Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
break;
case SWFUpload.UPLOAD_ERROR.IO_ERROR:
progress.setStatus("服务器IO错误!");
this.debug("Error Code: IO Error, File name: " + file.name + ", Message: " + message);
break;
case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
progress.setStatus("无权限!");
this.debug("Error Code: Security Error, File name: " + file.name + ", Message: " + message);
break;
case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
progress.setStatus("上传个数限制");
this.debug("Error Code: Upload Limit Exceeded, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
break;
case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
progress.setStatus("验证失败,本次上传被跳过!");
this.debug("Error Code: File Validation Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
break;
case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
// If there aren't any files left (they were all cancelled) disable the cancel button
// if (this.getStats().files_queued === 0) {
// document.getElementById(this.customSettings.cancelButtonId).disabled = true;
// }
progress.setStatus("取消中,请等待……");
progress.setCancelled();
break;
case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
progress.setStatus("上传已停止……");
break;
default:
progress.setStatus("未知错误!" + errorCode);
this.debug("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
break;
}
} catch (ex) {
this.debug(ex);
}
}
function uploadComplete(file) {
//alert(file);
// if (this.getStats().files_queued === 0) {
// document.getElementById(this.customSettings.cancelButtonId).disabled = true;
// }
}
// This event comes from the Queue Plugin
function queueComplete(numFilesUploaded) {
var status = document.getElementById("divStatus");
var num = status.innerHTML.match(/\d+/g);
status.innerHTML = "本次共成功上传 "+((num && num[0] ?parseInt(num[0]):0) + numFilesUploaded) +" 个文件" ;
}
| 10npsite | trunk/guanli/system/ueditor/dialogs/attachment/callbacks.js | JavaScript | asf20 | 6,235 |
* {margin: 0;padding: 0;}
.wrapper { width: 460px;height: 340px; border: 1px solid #ddd;margin: 8px;overflow-y: hidden;}
.controller {
height: 30px;
padding-top: 10px;
padding-left: 6px;
}
#divStatus {display:inline-block; width:336px;color: #aaa;font-size: 12px; }
#startUpload{cursor: pointer;margin-right: 10px; float: right; display: inline-block; background: url(../../themes/default/images/upload.png) no-repeat ; width: 100px;height: 30px}
div.fieldset {
border: 1px solid #afe14c;
padding: 10px 10px;
}
div.fieldset span.legend{position: relative;top:-20px;}
div.flash {
width: 420px;
height: 236px;
margin: 2px 5px 8px 9px;
border-color: #D9E4FF;
overflow-y: auto;
-moz-border-radius-topleft : 5px;
-webkit-border-top-left-radius : 5px;
-moz-border-radius-topright : 5px;
-webkit-border-top-right-radius : 5px;
-moz-border-radius-bottomleft : 5px;
-webkit-border-bottom-left-radius : 5px;
-moz-border-radius-bottomright : 5px;
-webkit-border-bottom-right-radius : 5px;
}
.progressWrapper {
width: 420px;
overflow: hidden;
}
.progressContainer {
margin: 0 0px 5px 0;
/*padding: 3px 0 3px 4px;*/
border: solid 1px #E8E8E8;
background-color: #F7F7F7;
overflow: hidden;
}
/* Message */
.message {
margin: 1em 0;
padding: 10px 20px;
border: solid 1px #FFDD99;
background-color: #FFFFCC;
overflow: hidden;
}
/* Error */
.red {
border: solid 1px #B50000;
background-color: #FFEBEB;
}
/* Current */
.green {
border: solid 1px #DDF0DD;
background-color: #EBFFEB;
}
/* Complete */
.blue {
border: solid 1px #CEE2F2;
background-color: #F0F5FF;
}
.progressName {
font-size: 10px;
color: #555;
width: 360px;
height: 14px;
text-align: left;
white-space: nowrap;
overflow: hidden;
}
.progressBarInProgress,
.progressBarComplete,
.progressBarError {
font-size: 0;
width: 0%;
height: 2px;
background-color: blue;
margin-top: 2px;
}
.progressBarComplete {
width: 100%;
background-color: green;
visibility: hidden;
}
.progressBarError {
width: 100%;
background-color: red;
visibility: hidden;
}
a.progressCancel {
font-size: 0;
display: block;
height: 14px;
width: 14px;
background: url(../../themes/default/images/cancelbutton.gif) -14px 0 no-repeat ;
float: right;
}
a.progressCancel:hover {
background-position: 0 0;
}
.progressBarStatus {
margin-top: 2px;
width: 337px;
font-size: 7pt;
text-align: left;
white-space: nowrap;
}
/* -- SWFUpload Object Styles ------------------------------- */
.swfupload {
vertical-align: top;
}
| 10npsite | trunk/guanli/system/ueditor/dialogs/attachment/attachment.css | CSS | asf20 | 2,670 |
(function(){
var parent = window.parent;
//dialog对象
dialog = parent.$EDITORUI[window.frameElement.id.replace(/_iframe$/, '')];
//当前打开dialog的编辑器实例
editor = dialog.editor;
UE = parent.UE;
domUtils = UE.dom.domUtils;
utils = UE.utils;
browser = UE.browser;
ajax = UE.ajax;
$G = function(id){return document.getElementById(id)};
//focus元素
$focus = function(node){
setTimeout(function(){
if(browser.ie){
var r = node.createTextRange();
r.collapse(false);
r.select();
}else{
node.focus()
}
},0)
}
})();
| 10npsite | trunk/guanli/system/ueditor/dialogs/internal.js | JavaScript | asf20 | 742 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>帮助</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<script type="text/javascript" src="../internal.js"></script>
<style type="text/css">
.head .tab-current{
background-color:#7DEBFF;
}
.hide{
display:none;
}
*{color: #838383}
body {
font-size: 12px;
width:380px;
height: 400px;
overflow: hidden;
margin:0px;padding:0px;
}
.warp{
padding: 39px 0px 0px 15px;
height:90%;position:relative;
}
h1{font-size:26px;}
p{font-size:12px;}
.head{position:absolute;height:31px;top:10px;}
.content{height:360px;border: 1px solid #ddd;clear:both;padding:5px;overflow: auto;}
.head span{width:92px;height:29px;line-height:29px;background:red;display:block;float: left;text-align: center;margin-right: 1px;cursor: pointer; }
.head span.def{background:url("../../themes/default/images/dialog-title-bg.png") repeat-x;border:1px solid #ccc;}
.head span.act{background:#FFF;border:1px solid #ccc;border-bottom: 1px solid #FFF}
.content table{width:90%;line-height: 20px}
.content table thead{font-weight: bold;line-height: 25px;}
</style>
</head>
<body>
<div class="warp">
<div id="head" class="head">
<span class="act" onclick="toggle(0)">关于UEditor</span>
<span class="def" onclick="toggle(1)">快捷键</span>
</div>
<div class="content">
<div id="cont0">
<h1>UEditor</h1>
<p>版本:1.2.0</p>
<p>Ueditor是由百度web前端研发部开发的所见即所得富文本web编辑器,具有轻量,可定制,注重用户体验等特点,开源基于BSD协议,允许自由使用和使用代码</p>
</div>
<div id="cont1" class="hide">
<table>
<thead>
<tr>
<td>快捷键</td>
<td>功能</td>
</tr>
</thead>
<tbody>
<tr>
<td>ctrl+b</td>
<td>给选中字设置为加粗</td>
</tr>
<tr>
<td>ctrl+c</td>
<td>复制选中内容</td>
</tr>
<tr>
<td>ctrl+x</td>
<td>剪切选中内容</td>
</tr>
<tr>
<td>ctrl+v</td>
<td>粘贴</td>
</tr>
<tr>
<td>ctrl+y</td>
<td>重新执行上次操作</td>
</tr>
<tr>
<td>ctrl+z</td>
<td>撤销上一次操作</td>
</tr>
<tr>
<td>ctrl+i</td>
<td>给选中字设置为斜体</td>
</tr>
<tr>
<td>ctrl+u</td>
<td>给选中字加下划线</td>
</tr>
<tr>
<td>ctrl+a</td>
<td>全部选中</td>
</tr>
<tr>
<td>ctrl+shift+c</td>
<td>清除页面文字格式</td>
</tr>
<tr>
<td>ctrl+shift+l</td>
<td>页面文字居左显示</td>
</tr>
<tr>
<td>ctrl+shift+r</td>
<td>页面文字居右显示</td>
</tr>
<tr>
<td>shift+enter</td>
<td>软回车</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<script type="text/javascript">
function jbind(obj,evt,fun){
if(obj.addEventListener){ // firefox,w3c
obj.addEventListener(evt,fun,false);
}else{// ie
obj.attachEvent("on"+evt,function(){fun.apply(obj);});
}
}
function getChildrenByClassName (parentClass,childtag){
var divs = document.getElementsByTagName("div"),i=0,headChilds,j=0,arr = [];
for(;i<divs.length;i++){
if(divs[i].className == parentClass){
headChilds = divs[i].childNodes;
}
}
for(;j<headChilds.length;j++){
if(new RegExp(childtag,"i").test(headChilds[j].tagName)){
arr.push(headChilds[j]);
}
}
return arr;
}
function hideAll (){
var tabs = getChildrenByClassName("head","span"),
contents = getChildrenByClassName("content","div"),i=0;
for(;i<tabs.length;i++){
tabs[i].className = "";
contents[i].className = "hide";
}
}
function toggle (i){
hideAll();
var tabs = getChildrenByClassName("head","span"),
contents = getChildrenByClassName("content","div");
for(var s=0;s<tabs.length;s++){
tabs[s].className = "def";
}
tabs[i].className = "act";
contents[i].className = "";
}
</script>
</body>
</html> | 10npsite | trunk/guanli/system/ueditor/dialogs/help/help.html | HTML | asf20 | 5,592 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>插入链接</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<script type="text/javascript" src="../internal.js"></script>
<style type="text/css">
*{color: #838383}
body {
font-size: 12px;
width:382px;
height: 100px;
overflow: hidden;
margin:0px;padding:0px;
}
span.txt{width: 60px;height:30px;line-height: 30px;display: block;float:left}
.content{
padding: 9px 0px 0px 15px;
height:100%;
}
#link_href,
#title{width:286px;height:21px;background: #FFF;border:1px solid #d7d7d7;padding: 0px; margin: 0px; line-height:21px}
#link_href{width:208px}
.content table{padding:0px;margin:0px}
.content table tr{padding:0px;margin:0px; list-style: none;height: 20px; line-height: 20px;}
.red{color:red;}
</style>
</head>
<body>
<div class="content">
<table>
<tr>
<td><span class="txt">链接地址:</span>
<select id="protocol">
<option value="http://">http://</option>
<option value="https://">https://</option>
</select>
<input id="link_href" type="text" /><br/>
<span id="msg2" class="red"></span></td>
</tr>
<tr>
<td><span class="txt">标题:</span><input id="title" type="text"/></td>
</tr>
<tr>
<td><span>是否在新窗口打开:</span><input id="target" type="checkbox"/></td>
</tr>
</table>
</div>
<script type="text/javascript">
var link = editor.selection.getRange().collapsed ? editor.queryCommandValue( "link" ) : editor.selection.getStart(),url;
link = domUtils.findParentByTagName( link, "a", true );
if(link){
url = link.getAttribute( 'data_ue_src' ) || link.getAttribute( 'href', 2 );
}
$G("title").value = url ? link.title : "";
$G("protocol").value = !url || /^(?:http:\/\/)/ig.test(url) ? "http://" : "https://";
$G("link_href").value = url ? url.replace(/^(?:https?:\/\/)|(?:\/)$/ig,"") : '';
$G("target").checked = url && link.target == "_blank" ? true : false;
var ipt = $G("link_href");
$focus(ipt);
ipt.style.cssText = 'border:1px solid #ccc;background-color:#fafafa;';
ipt.onfocus = function(){
this.style.cssText = 'border:1px solid #ccc;background-color:#fff;';
}
ipt.onblur = function(){
this.style.cssText = 'border:1px solid #ccc;background-color:#fafafa;';
}
function handleDialogOk(){
var href;
if(href = $G('link_href').value.replace(/^\s+|\s+$/g, '')){
editor.execCommand('link', {
'href' : $G("protocol").value + href,
'target' : $G("target").checked ? "_blank" : '_self',
'title' : $G("title").value.replace(/^\s+|\s+$/g, ''),
'data_ue_src':$G("protocol").value + href
});
dialog.close();
}else{
$G("msg2").innerHTML = "请输入链接地址!";
}
}
dialog.onok = handleDialogOk;
$G('link_href').onkeydown = function(evt){
evt = evt || window.event;
if (evt.keyCode == 13) {
handleDialogOk();
return false;
}
};
</script>
</body>
</html>
| 10npsite | trunk/guanli/system/ueditor/dialogs/link/link.html | HTML | asf20 | 3,637 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>安装截屏插件</title>
<script type="text/javascript" src="../internal.js"></script>
<style type="text/css">
*{color: #838383}
html,body {
font-size: 12px;
font-family: arial;
width:100%;
height:100%;
overflow: hidden;
margin:0px;
padding:0px;
}
h2 { font-size: 16px; margin: 20px auto;}
.content{
padding:5px 15px 0 15px;
height:100%;
}
dt,dd { margin-left: 0; padding-left: 0;}
dt a { display: block;
height: 30px;
line-height: 30px;
width: 55px;
background: #EFEFEF;
border: 1px solid #CCC;
padding: 0 10px;
text-decoration: none;
}
dt a:hover{
background: #e0e0e0;
border-color: #999
}
dt a:active{
background: #ccc;
border-color: #999;
color: #666;
}
dd { line-height:20px;margin-top: 10px;}
span{ padding-right:4px;}
input{width:210px;height:21px;background: #FFF;border:1px solid #d7d7d7;padding: 0px; margin: 0px; }
</style>
</head>
<body>
<div class="content">
<h2>使用截屏功能,您需要安装UEditor截屏程序</h2>
<dl>
<dt><a href="../../third-party/snapscreen/UEditorSnapscreen.exe" target="_blank" id="downlink">下载安装</a></dt>
<dd>1. 点击下载安装程序到您的计算机,运行这个程序进行安装</dd>
<dd>2. 安装完成后,您可以点击“确认”关闭此弹出层,然后重新点击截屏按钮,就可以进行截屏了!</dd>
</dl>
</div>
</body>
</html> | 10npsite | trunk/guanli/system/ueditor/dialogs/snapscreen/snapscreen.html | HTML | asf20 | 2,286 |
@charset "utf-8";
*{ padding: 0;margin: 0}
body{font-size: 12px;color: #888;overflow: hidden;}
.wrapper{ width: 640px;margin: 0 auto; overflow: auto; zoom:1;position: relative;padding: 10px 0}
#tabHeads{position: relative; width:610px;padding-left:9px;z-index: 10;}
#tabHeads span{
display:inline-block;
width: 82px;
height:30px;
text-align: center;
cursor: pointer;
line-height: 30px;
border: 1px solid #ccc;
background:url("../../themes/default/images/dialog-title-bg.png") repeat-x;
}
#tabHeads span.focus{ border-bottom: none; height: 31px;background-color: #fff;}
#tabBodys{ border: 1px solid #ccc; width:620px;height:325px;_height:328px;margin: 0 auto;position: relative;top:-1px;}
.panel { position: absolute; width: 620px;height:325px;background: #fff;}
#remote{ z-index: 200;}
#remote table{border-collapse: collapse;width: 620px; height: 300px; margin-top: 5px;}
#remote td.label{text-align: center;width: 80px; }
#remote td{height: 40px;}
td input {
width: 150px;
height: 21px;
line-height: 21px;
background: #FFF;
border: 1px solid #d7d7d7;
}
#url {width: 520px;margin-bottom: 2px;}
#preview{width: 260px; height: 260px; position: absolute;top:50px; left: 341px; z-index: 9999;background-color: #eee}
.lock{
position: absolute;
width: 45px;
height: 40px;
top: 68px;
left: 260px;
background: url("../../themes/default/images/lock.gif") -2px -3px no-repeat;
line-height: 40px;
padding-top:13px;
}
.duiqi{background: url("../../themes/default/images/imgLable.png") -12px 2px no-repeat; width: 62px; height: 38px;float: left}
#remoteFloat div,#localFloat div{cursor:pointer;opacity: 0.5;filter: alpha(opacity = 50);margin-left:1px;width:38px;height:36px;float:left;}
#remoteFloat .focus,#localFloat .focus{opacity: 1;filter: alpha(opacity = 100)}
#maskIframe{ width: 620px; height: 325px; position: absolute;z-index: 100; }
#flashContainer { margin: 6px;}
#upload{width: 100px;height: 30px;float: right; background: url("../../themes/default/images/upload.png");margin:3px 6px 0 0;cursor: pointer;}
#imageList{width: 620px;height: 315px; margin-top: 10px;overflow:hidden;overflow-y: auto;}
#imageList img{cursor: pointer ;border: 2px solid #fff}
#imgManager #imageList div{float: left;width: 100px;height: 100px;margin: 5px 10px;}
#imgSearchTxt{padding-left:2px;margin-left:15px;background: #FFF;width:200px;height:21px;line-height:21px;border: 1px solid #d7d7d7;}
#searchList{width: 620px;overflow: auto;zoom:1;height: 270px;}
#searchList div{float: left;width: 116px;height: 135px;margin: 5px 15px;_margin:5px 10px;}
#searchList img{margin: 2px 8px;cursor: pointer;border: 2px solid #fff} /*不用缩略图*/
#searchList p{margin-left: 10px;_margin-left:8px;}
#imgType{
width: 65px;
height: 23px;
line-height: 22px;
border: 1px solid #d7d7d7;
}
#imgSearchBtn,#imgSearchReset{
width: 80px;
height: 25px;
line-height: 25px;
background: #eee;
border: 1px solid #d7d7d7;
cursor: pointer
}
.msg{margin-left: 5px;} | 10npsite | trunk/guanli/system/ueditor/dialogs/image/image.css | CSS | asf20 | 3,111 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>图片上传</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<link rel="stylesheet" href="image.css" type="text/css" />
</head>
<body>
<div class="wrapper">
<div id="imageTab">
<div id="tabHeads">
<span tabSrc="remote" class="focus">网络图片</span>
<span tabSrc="local">本地上传</span>
<span tabSrc="imgManager">在线管理</span>
<span tabSrc="imgSearch">图片搜索</span>
</div>
<div id="tabBodys">
<div id="remote" class="panel">
<table cellpadding="0" cellspacing="0">
<tr>
<td class="label"><label for="url">地 址:</label></td>
<td><input id="url" type="text"/></td>
</tr>
<tr>
<td class="label"><label for="width">宽 度:</label></td>
<td><input type="text" id="width"/> px</td>
</tr>
<tr>
<td class="label"><label for="height">高 度:</label></td>
<td><input type="text" id="height"/> px</td>
</tr>
<tr>
<td class="label"><label for="border">边 框:</label></td>
<td><input type="text" id="border"/> px</td>
</tr>
<tr>
<td class="label"><label for="vhSpace">边 距:</label></td>
<td><input type="text" id="vhSpace"/> px</td>
</tr>
<tr>
<td class="label"><label for="title">描 述:</label></td>
<td><input type="text" id="title"/></td>
</tr>
<tr>
<td class="label">对 齐:</td>
<td id="remoteFloat"></td>
</tr>
</table>
<div id="preview"></div>
<div class="lock"><input id="lock" type="checkbox" title="锁定宽高比例" checked="checked"></div>
</div>
<div id="local" class="panel">
<div id="flashContainer"></div>
<div><div id="upload" style="display: none" ></div><div class="duiqi"></div><div id="localFloat"></div></div>
</div>
<div id="imgManager" class="panel">
<div id="imageList"> 图片加载中……</div>
<!--<p id="pageControler">分页控制器</p>-->
</div>
<div id="imgSearch" class="panel">
<table style="margin-top: 5px;">
<tr>
<td width="200"><input id="imgSearchTxt" value="请输入搜索关键词" type="text" /></td>
<td width="65">
<select id="imgType">
<!--<option value="&s=0&z=0">全部</option>-->
<option value="&s=4&z=0">新闻</option>
<option value="&s=1&z=19">壁纸</option>
<option value="&s=2&z=0">表情</option>
<option value="&s=3&z=0">头像</option>
</select>
</td>
<td width="80"><input id="imgSearchBtn" type="button" value="百度一下" /></td>
<td width="80"><input id="imgSearchReset" type="button" value="清空搜索" /></td>
</tr>
</table>
<div id="searchList"></div>
</div>
<iframe id="maskIframe" src="about:blank" scrolling="no" frameborder="no"></iframe>
</div>
</div>
</div>
<script type="text/javascript" src="../internal.js"></script>
<script type="text/javascript" src="../tangram.js"></script>
<script type="text/javascript" src="image.js"></script>
<script type="text/javascript">
//全局变量
var imageUrls = [], //用于保存从服务器返回的图片信息数组
selectedImageCount = 0; //当前已选择的但未上传的图片数量
window.onload = function(){
//创建Flash相关的参数集合
var flashOptions = {
container:"flashContainer", //flash容器id
url:'../../server/upload/php/imageUp.php', // 上传处理页面的url地址
ext:'{"param1":"参数值1", "param2":"参数值2"}', //可向服务器提交的自定义参数列表
fileType:'{"description":"图片", "extension":"*.gif;*.jpeg;*.png;*.jpg"}', //上传文件格式限制
flashUrl:'imageUploader.swf', //上传用的flash组件地址
width:608, //flash的宽度
height:272, //flash的高度
gridWidth:121, // 每一个预览图片所占的宽度
gridHeight:120, // 每一个预览图片所占的高度
picWidth:100, // 单张预览图片的宽度
picHeight:100, // 单张预览图片的高度
uploadDataFieldName:'picdata', // POST请求中图片数据的key
picDescFieldName:'pictitle', // POST请求中图片描述的key
maxSize:2, // 文件的最大体积,单位M
compressSize:1, // 上传前如果图片体积超过该值,会先压缩,单位M
maxNum:32, // 单次最大可上传多少个文件
backgroundUrl:'', // flash界面的背景图片,留空默认
listBackgroundUrl:'', // 单个预览框背景,留空默认
buttonUrl:'', // 上传按钮背景,留空默认
compressSide:editor.options.compressSide, //等比压缩的基准,0为按照最长边,1为按照宽度,2为按照高度
compressLength:editor.options.maxImageSideLength //能接受的最大边长,超过该值Flash会自动等比压缩
};
//回调函数集合,支持传递函数名的字符串、函数句柄以及函数本身三种类型
var callbacks={
// 选择文件的回调
selectFileCallback: function(selectFiles){
selectedImageCount += selectFiles.length;
if(selectedImageCount) baidu.g("upload").style.display = "";
dialog.buttons[0].setDisabled(true); //初始化时置灰确定按钮
},
// 删除文件的回调
deleteFileCallback: function(delFiles){
selectedImageCount -= delFiles.length;
if (!selectedImageCount) {
baidu.g("upload").style.display = "none";
dialog.buttons[0].setDisabled(false); //没有选择图片时重新点亮按钮
}
},
// 单个文件上传完成的回调
uploadCompleteCallback: function(data){
try{
var info = eval("(" + data.info + ")");
info && imageUrls.push(info);
selectedImageCount--;
}catch(e){}
},
// 单个文件上传失败的回调,
uploadErrorCallback: function (data){
//console && console.log(data);
},
// 全部上传完成时的回调
allCompleteCallback: function(){
dialog.buttons[0].setDisabled(false); //上传完毕后点亮按钮
}
// 文件超出限制的最大体积时的回调
//exceedFileCallback: 'exceedFileCallback',
// 开始上传某个文件时的回调
//startUploadCallback: startUploadCallback
};
imageUploader.init(flashOptions,callbacks);
};
</script>
</body>
</html> | 10npsite | trunk/guanli/system/ueditor/dialogs/image/image.html | HTML | asf20 | 9,114 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>插入锚点</title>
<script type="text/javascript" src="../internal.js"></script>
<style type="text/css">
*{color: #838383}
html,body {
font-size: 12px;
width:100%;
height:100%;
overflow: hidden;
margin:0px;
padding:0px;
}
.content{
padding:5px 0 0 15px;
height:100%;
}
span{ padding-right:4px;}
input{width:210px;height:21px;background: #FFF;border:1px solid #d7d7d7;padding: 0px; margin: 0px; }
</style>
</head>
<body>
<div class="content">
<span>锚点名字:</span><input id="anchorName" value="" />
</div>
<script type="text/javascript">
var anchorInput = $G('anchorName'),
node = editor.selection.getRange().getClosedNode();
if(node && node.tagName == 'IMG' && (node = node.getAttribute('anchorname'))){
anchorInput.value = node;
}
anchorInput.onkeydown = function(evt){
evt = evt || window.event;
if(evt.keyCode == 13){
editor.execCommand('anchor', anchorInput.value);
dialog.close();
domUtils.preventDefault(evt)
}
};
dialog.onok = function (){
editor.execCommand('anchor', anchorInput.value);
dialog.close();
};
$focus(anchorInput);
</script>
</body>
</html> | 10npsite | trunk/guanli/system/ueditor/dialogs/anchor/anchor.html | HTML | asf20 | 1,913 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>插入代码</title>
<script type="text/javascript" src="../internal.js"></script>
<style type="text/css">
html,body{
_overflow:hidden;
}
*{margin: 0;padding: 0;line-height: 20px;}
.wrapper{width: 520px;height: 300px; margin: 10px 15px;font-size: 12px}
textarea{width:510px ;height: 300px;resize: none;margin:5px;*margin-left:-12px;}
</style>
</head>
<body>
<div class="wrapper">
<p>
<label for="language">选择语言</label>
<select id="language">
<option value="as3">ActionScript3</option>
<option value="bash">Bash/Shell</option>
<option value="cpp">C/C++</option>
<option value="css">Css</option>
<option value="cf">CodeFunction</option>
<option value="c#">C#</option>
<option value="delphi">Delphi</option>
<option value="diff">Diff</option>
<option value="erlang">Erlang</option>
<option value="groovy">Groovy</option>
<option value="html">Html</option>
<option value="java">Java</option>
<option value="jfx">JavaFx</option>
<option value="js">Javascript</option>
<option value="pl">Perl</option>
<option value="php">Php</option>
<option value="plain">Plain Text</option>
<option value="ps">PowerShell</option>
<option value="python">Python</option>
<option value="ruby">Ruby</option>
<option value="scala">Scala</option>
<option value="sql">Sql</option>
<option value="vb">Vb</option>
<option value="xml">Xml</option>
</select>
</p>
<label for="code"></label><textarea id="code" cols="" rows=""></textarea>
</div>
<script type="text/javascript">
var sels = $G("language"),
code = $G('code');
var state = editor.queryCommandState("highlightcode");
if(state){
var pN = domUtils.findParent(editor.selection.getRange().startContainer,function(node){
return /syntaxhighlighter/ig.test(node.className);
});
if(pN){
var divs = pN.getElementsByTagName("div"),di;
for(var i = divs.length-1,container;container = divs[i--];){
if(container.className == "container"){
di = container;
break;
}
}
for(var str=[],c=0,ci;ci=di.childNodes[c++];){
str.push(ci[parent.baidu.editor.browser.ie?'innerText':'textContent']);
}
$G("code").value = str.join("\n");
$G("language").value = pN.className.match(/highlighter[\s]+([a-z\d]*#?)/)[1];
}
}
code.onkeydown= function(evt){
evt = evt || event;
if(evt.keyCode == 9){
if (('selectionStart' in code) && code.selectionStart == code.selectionEnd) {
var offset = code.selectionStart;
code.value = code.value.substring (0, code.selectionStart) +
" " + code.value.substring (code.selectionStart);
code.selectionStart = code.selectionEnd = offset + 4;
$focus(code);
}
else {
var textRange = document.selection.createRange();
textRange.text = " " + textRange.text ;
textRange.collapse(false);
textRange.select();
$focus(code);
}
evt.returnValue = false;
evt.preventDefault();
}
if((evt.ctrlKey||evt.metaKey) && evt.keyCode == 13){
dialog.onok();
}
};
dialog.onok = function(){
var language = sels.value;
if(code.value.replace(/^\s*|\s*$/ig,"")){
editor.execCommand("highlightcode",code.value,language);
dialog.close();
}else{
alert("请输入代码");
}
};
$focus(code);
sels.onchange = function(){
$focus(code);
}
</script>
</body>
</html>
| 10npsite | trunk/guanli/system/ueditor/dialogs/code/code.html | HTML | asf20 | 5,102 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<script type="text/javascript" src="../internal.js"></script>
<script type="text/javascript" src="../tangram.js"></script>
<style type="text/css">
*{padding: 0;margin: 0}
body {font-size: 12px;overflow: hidden;padding: 10px;margin: 0;color: #838383;}
.wrapper{width: 600px;height: 352px;overflow: hidden;position: relative;border-bottom: 1px solid #d7d7d7}
.localPath input{float: left;width: 350px;line-height: 20px;height: 20px;}
#clipboard{float:left;width: 70px;height: 30px; background: url(../../themes/default/images/copy.png) -153px -1px no-repeat;}
.description{ color: #0066cc; margin-top: 2px; width: 450px; height: 45px;float: left;line-height: 22px}
#upload{width: 100px;height: 30px;float: right; background: url("../../themes/default/images/upload.png");margin:10px 2px 0 0;cursor: pointer;}
#msg{ width: 140px; height: 30px; line-height:25px;float: left;color: red}
</style>
</head>
<body>
<div class="wrapper">
<div class="localPath">
<input id="localPath" type="text" readonly />
<div id="clipboard"></div>
<div id="msg"></div>
</div>
<div id="flashContainer"></div>
<div>
<div id="upload" style="display: none" ></div>
<div class="description">
<span style="color: red">图片转存步骤:</span>1、点击顶部复制按钮,将地址复制到剪贴板;2、点击添加照片按钮,在弹出的对话框中使用Ctrl+V粘贴地址;3、点击打开后选择图片上传流程。
</div>
</div>
</div>
<script type="text/javascript" src="wordimage.js"></script>
<script type="text/javascript">
//全局变量
var imageUrls = [], //用于保存从服务器返回的图片信息数组
selectedImageCount = 0; //当前已选择的但未上传的图片数量
window.onload = function(){
//创建Flash相关的参数集合
var flashOptions = {
container:"flashContainer", //flash容器id
url:'../../server/upload/php/imageUp.php', // 上传处理页面的url地址
ext:'{"param1":"参数值1", "param2":"参数值2"}', //可向服务器提交的自定义参数列表
fileType:'{"description":"图片", "extension":"*.gif;*.jpeg;*.png;*.jpg"}', //上传文件格式限制
flashUrl:'../image/imageUploader.swf', //上传用的flash组件地址
width:600, //flash的宽度
height:272, //flash的高度
gridWidth:120, // 每一个预览图片所占的宽度
gridHeight:120, // 每一个预览图片所占的高度
picWidth:100, // 单张预览图片的宽度
picHeight:100, // 单张预览图片的高度
uploadDataFieldName:'picdata', // POST请求中图片数据的key
picDescFieldName:'pictitle', // POST请求中图片描述的key
maxSize:2, // 文件的最大体积,单位M
compressSize:1, // 上传前如果图片体积超过该值,会先压缩,单位M
maxNum:32, // 单次最大可上传多少个文件
backgroundUrl:'', // flash界面的背景图片,留空默认
listBackgroundUrl:'', // 单个预览框背景,留空默认
buttonUrl:'', // 上传按钮背景,留空默认
compressSide:editor.options.compressSide, //等比压缩的基准,0为按照最长边,1为按照宽度,2为按照高度
compressLength:editor.options.maxImageSideLength //能接受的最大边长,超过该值Flash会自动等比压缩
};
//回调函数集合,支持传递函数名的字符串、函数句柄以及函数本身三种类型
var callbacks={
selectFileCallback: function(selectFiles){ // 选择文件的回调
selectedImageCount += selectFiles.length;
if(selectedImageCount) baidu.g("upload").style.display = "";
dialog.buttons[0].setDisabled(true); //初始化时置灰确定按钮
},
deleteFileCallback: function(delFiles){ // 删除文件的回调
selectedImageCount -= delFiles.length;
if (!selectedImageCount) {
baidu.g("upload").style.display = "none";
dialog.buttons[0].setDisabled(false); //没有选择图片时重新点亮按钮
}
},
uploadCompleteCallback: function(data){ // 单个文件上传完成的回调
try{var info = eval("(" + data.info + ")");
info && imageUrls.push(info);
selectedImageCount--;
}catch(e){}
},
uploadErrorCallback: function (data){ // 单个文件上传失败的回调,
console && console.log(data);
},
allCompleteCallback: function(){ // 全部上传完成时的回调
dialog.buttons[0].setDisabled(false); //上传完毕后点亮按钮
}
//exceedFileCallback: 'exceedFileCallback', // 文件超出限制的最大体积时的回调
//startUploadCallback: startUploadCallback // 开始上传某个文件时的回调
};
wordImage.init(flashOptions,callbacks);
}
</script>
</body>
</html> | 10npsite | trunk/guanli/system/ueditor/dialogs/wordimage/wordimage.html | HTML | asf20 | 6,394 |
/**
* Created by JetBrains PhpStorm.
* User: taoqili
* Date: 12-1-30
* Time: 下午12:50
* To change this template use File | Settings | File Templates.
*/
var wordImage = {};
//(function(){
var g = baidu.g,
flashObj;
wordImage.init = function(opt, callbacks) {
showLocalPath("localPath");
//createCopyButton("clipboard","localPath");
createFlashUploader(opt, callbacks);
addUploadListener();
addOkListener();
};
function addOkListener() {
dialog.onok = function() {
if (!imageUrls.length) return;
var images = domUtils.getElementsByTagName(editor.document,"img");
for (var i = 0,img; img = images[i++];) {
var src = img.getAttribute("word_img");
if (!src) continue;
for (var j = 0,url; url = imageUrls[j++];) {
if (src.indexOf(url.title) != -1) {
img.src = editor.options.imagePath + url.url;
img.setAttribute("data_ue_src", editor.options.imagePath + url.url); //同时修改"data_ue_src"属性
parent.baidu.editor.dom.domUtils.removeAttributes(img, ["word_img","style","width","height"]);
editor.fireEvent("selectionchange");
break;
}
}
}
};
}
/**
* 绑定开始上传事件
*/
function addUploadListener() {
g("upload").onclick = function () {
flashObj.upload();
this.style.display = "none";
};
}
function showLocalPath(id) {
//单张编辑
if(editor.word_img.length==1){
g(id).value = editor.word_img[0];
return;
}
var path = editor.word_img[0];
var leftSlashIndex = path.lastIndexOf("/")||0, //不同版本的doc和浏览器都可能影响到这个符号,故直接判断两种
rightSlashIndex = path.lastIndexOf("\\")||0,
separater = leftSlashIndex > rightSlashIndex ? "/":"\\" ;
path = path.substring(0, path.lastIndexOf(separater)+1);
g(id).value = path;
}
function createFlashUploader(opt, callbacks) {
var option = {
createOptions:{
id:'flash',
url:opt.flashUrl,
width:opt.width,
height:opt.height,
errorMessage:'Flash插件初始化失败,请更新您的FlashPlayer版本之后重试!',
wmode:browser.safari ? 'transparent' : 'window',
ver:'10.0.0',
vars:opt,
container:opt.container
}
};
option = extendProperty(callbacks, option);
flashObj = new baidu.flash.imageUploader(option);
}
function extendProperty(fromObj, toObj) {
for (var i in fromObj) {
if (!toObj[i]) {
toObj[i] = fromObj[i];
}
}
return toObj;
}
//})();
function getPasteData(id) {
baidu.g("msg").innerHTML = " 图片地址已复制成功!</br>";
setTimeout(function() {
baidu.g("msg").innerHTML = "";
}, 5000);
return baidu.g(id).value;
}
function createCopyButton(id, dataFrom) {
baidu.swf.create({
id:"copyFlash",
url:"fClipboard_ueditor.swf",
width:"58",
height:"25",
errorMessage:"",
bgColor:"#CBCBCB",
wmode:"transparent",
ver:"10.0.0",
vars:{
tid:dataFrom
}
}, id
);
var clipboard = baidu.swf.getMovie("copyFlash");
var clipinterval = setInterval(function() {
if (clipboard && clipboard.flashInit) {
clearInterval(clipinterval);
clipboard.setHandCursor(true);
clipboard.setContentFuncName("getPasteData");
//clipboard.setMEFuncName("mouseEventHandler");
}
}, 500);
}
createCopyButton("clipboard", "localPath"); | 10npsite | trunk/guanli/system/ueditor/dialogs/wordimage/wordimage.js | JavaScript | asf20 | 3,388 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>插入表情</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex, nofollow" />
<!--外链引用公共参数-->
<script type="text/javascript" src="../internal.js"></script>
<link rel="stylesheet" type="text/css" href="emotion.css">
</head>
<body>
<div id="tabPanel" class="neweditor-tab">
<div id="tabMenu" class="neweditor-tab-h">
<div onClick="switchTab(0)">精选</div>
<div onClick="switchTab(1)">兔斯基</div>
<div onClick="switchTab(2)">绿豆蛙</div>
<div onClick="switchTab(3)">BOBO</div>
<div onClick="switchTab(4)">baby猫</div>
<div onClick="switchTab(5)">泡泡</div>
<div onClick="switchTab(6)">有啊</div>
</div>
<div id="tabContent" class="neweditor-tab-b">
<div id="tab0" ></div>
<div id="tab1" ></div>
<div id="tab2" ></div>
<div id="tab3" ></div>
<div id="tab4" ></div>
<div id="tab5" ></div>
<div id="tab6" ></div>
</div>
</div>
<div id="tabIconReview">
<img id='faceReview' class='review'/>
</div>
<script type="text/javascript" src="emotion.js"></script>
</body>
</html> | 10npsite | trunk/guanli/system/ueditor/dialogs/emotion/emotion.html | HTML | asf20 | 1,452 |
function initImgBox(box, str, len) {
if (box.length)return;
var tmpStr = "",i = 1;
for (; i <= len; i++) {
tmpStr = str;
if (i < 10)tmpStr = tmpStr + '0';
tmpStr = tmpStr + i + '.gif';
box.push(tmpStr);
}
}
function $G(id) {
return document.getElementById(id)
}
function InsertSmiley(url) {
var obj = {
src:editor.options.emotionLocalization ? editor.options.UEDITOR_HOME_URL + "dialogs/emotion/" + url : url
};
obj.data_ue_src = obj.src;
editor.execCommand('insertimage', obj);
dialog.popup.hide();
}
function over(td, srcPath, posFlag) {
td.style.backgroundColor = "#ACCD3C";
$G('faceReview').style.backgroundImage = "url(" + srcPath + ")";
if (posFlag == 1) $G("tabIconReview").className = "show";
$G("tabIconReview").style.display = 'block';
}
function out(td) {
td.style.backgroundColor = "#FFFFFF";
var tabIconRevew = $G("tabIconReview");
tabIconRevew.className = "";
tabIconRevew.style.display = 'none';
}
var emotion = {};
emotion.SmileyPath = editor.options.emotionLocalization ? 'images/' : "http://img.baidu.com/hi/";
emotion.SmileyBox = {tab0:[],tab1:[],tab2:[],tab3:[],tab4:[],tab5:[],tab6:[]};
emotion.SmileyInfor = {tab0:[],tab1:[],tab2:[],tab3:[],tab4:[],tab5:[],tab6:[]};
var faceBox = emotion.SmileyBox;
var inforBox = emotion.SmileyInfor;
var sBasePath = emotion.SmileyPath;
if (editor.options.emotionLocalization) {
initImgBox(faceBox['tab0'], 'j_00', 84);
initImgBox(faceBox['tab1'], 't_00', 40);
initImgBox(faceBox['tab2'], 'l_00', 52);
initImgBox(faceBox['tab3'], 'b_00', 63);
initImgBox(faceBox['tab4'], 'bc_00', 20);
initImgBox(faceBox['tab5'], 'f_00', 50);
initImgBox(faceBox['tab6'], 'y_00', 40);
} else {
initImgBox(faceBox['tab0'], 'j_00', 84);
initImgBox(faceBox['tab1'], 't_00', 40);
initImgBox(faceBox['tab2'], 'w_00', 52);
initImgBox(faceBox['tab3'], 'B_00', 63);
initImgBox(faceBox['tab4'], 'C_00', 20);
initImgBox(faceBox['tab5'], 'i_f', 50);
initImgBox(faceBox['tab6'], 'y_00', 40);
}
inforBox['tab0'] = ['Kiss','Love','Yeah','啊!','背扭','顶','抖胸','88','汗','瞌睡','鲁拉','拍砖','揉脸','生日快乐','大笑','瀑布汗~','惊讶','臭美','傻笑','抛媚眼','发怒','打酱油','俯卧撑','气愤','?','吻','怒','胜利','HI','KISS','不说','不要','扯花','大心','顶','大惊','飞吻','鬼脸','害羞','口水','狂哭','来','发财了', '吃西瓜', '套牢', '害羞', '庆祝', '我来了', '敲打', '晕了', '胜利', '臭美', '被打了', '贪吃', '迎接', '酷', '微笑','亲吻','调皮','惊恐','耍酷','发火','害羞','汗水','大哭','','加油','困','你NB','晕倒','开心','偷笑','大哭','滴汗','叹气','超赞','??','飞吻','天使','撒花','生气','被砸','吓傻','随意吐'];
inforBox['tab1'] = ['Kiss','Love','Yeah','啊!','背扭','顶','抖胸','88','汗','瞌睡','鲁拉','拍砖','揉脸','生日快乐','摊手','睡觉','瘫坐','无聊','星星闪','旋转','也不行','郁闷','正Music','抓墙','撞墙至死','歪头','戳眼','飘过','互相拍砖','砍死你','扔桌子','少林寺','什么?','转头','我爱牛奶','我踢','摇晃','晕厥','在笼子里','震荡'];
inforBox['tab2'] = ['大笑','瀑布汗~','惊讶','臭美','傻笑','抛媚眼','发怒','我错了','money','气愤','挑逗','吻','怒','胜利','委屈','受伤','说啥呢?','闭嘴','不','逗你玩儿','飞吻','眩晕','魔法','我来了','睡了','我打','闭嘴','打','打晕了','刷牙','爆揍','炸弹','倒立','刮胡子','邪恶的笑','不要不要','爱恋中','放大仔细看','偷窥','超高兴','晕','松口气','我跑','享受','修养','哭','汗','啊~','热烈欢迎','打酱油','俯卧撑','?'];
inforBox['tab3'] = ['HI','KISS','不说','不要','扯花','大心','顶','大惊','飞吻','鬼脸','害羞','口水','狂哭','来','泪眼','流泪','生气','吐舌','喜欢','旋转','再见','抓狂','汗','鄙视','拜','吐血','嘘','打人','蹦跳','变脸','扯肉','吃To','吃花','吹泡泡糖','大变身','飞天舞','回眸','可怜','猛抽','泡泡','苹果','亲','','骚舞','烧香','睡','套娃娃','捅捅','舞倒','西红柿','爱慕','摇','摇摆','杂耍','招财','被殴','被球闷','大惊','理想','欧打','呕吐','碎','吐痰'];
inforBox['tab4'] = ['发财了', '吃西瓜', '套牢', '害羞', '庆祝', '我来了', '敲打', '晕了', '胜利', '臭美', '被打了', '贪吃', '迎接', '酷', '顶', '幸运', '爱心', '躲', '送花', '选择'];
inforBox['tab5'] = ['微笑','亲吻','调皮','惊讶','耍酷','发火','害羞','汗水','大哭','得意','鄙视','困','夸奖','晕倒','疑问','媒婆','狂吐','青蛙','发愁','亲吻','','爱心','心碎','玫瑰','礼物','哭','奸笑','可爱','得意','呲牙','暴汗','楚楚可怜','困','哭','生气','惊讶','口水','彩虹','夜空','太阳','钱钱','灯泡','咖啡','蛋糕','音乐','爱','胜利','赞','鄙视','OK'];
inforBox['tab6'] = ['男兜','女兜','开心','乖乖','偷笑','大笑','抽泣','大哭','无奈','滴汗','叹气','狂晕','委屈','超赞','??','疑问','飞吻','天使','撒花','生气','被砸','口水','泪奔','吓傻','吐舌头','点头','随意吐','旋转','困困','鄙视','狂顶','篮球','再见','欢迎光临','恭喜发财','稍等','我在线','恕不议价','库房有货','货在路上'];
//大对象
FaceHandler = {
imageFolders:{ tab0:'jx2/',tab1:'tsj/',tab2:'ldw/',tab3:'bobo/',tab4:'babycat/',tab5:'face/',tab6:'youa/'},
imageWidth:{tab0:35,tab1:35,tab2:35,tab3:35,tab4:35,tab5:35,tab6:35},
imageCols:{tab0:11,tab1:11,tab2:11,tab3:11,tab4:11,tab5:11,tab6:11},
imageColWidth:{tab0:3,tab1:3,tab2:3,tab3:3,tab4:3,tab5:3,tab6:3},
imageCss:{tab0:'jd',tab1:'tsj',tab2:'ldw',tab3:'bb',tab4:'cat',tab5:'pp',tab6:'youa'},
imageCssOffset:{tab0:35,tab1:35,tab2:35,tab3:35,tab4:35,tab5:25,tab6:35},
tabExist:[0,0,0,0,0,0,0]
};
function switchTab(index) {
if (FaceHandler.tabExist[index] == 0) {
FaceHandler.tabExist[index] = 1;
createTab('tab' + index);
}
//获取呈现元素句柄数组
var tabMenu = $G("tabMenu").getElementsByTagName("div"),
tabContent = $G("tabContent").getElementsByTagName("div"),
i = 0,L = tabMenu.length;
//隐藏所有呈现元素
for (; i < L; i++) {
tabMenu[i].className = "";
tabContent[i].style.display = "none";
}
//显示对应呈现元素
tabMenu[index].className = "on";
tabContent[index].style.display = "block";
}
function createTab(tabName) {
var faceVersion = "?v=1.1",//版本号
tab = $G(tabName),//获取将要生成的Div句柄
imagePath = sBasePath + FaceHandler.imageFolders[tabName],//获取显示表情和预览表情的路径
imageColsNum = FaceHandler.imageCols[tabName],//每行显示的表情个数
positionLine = imageColsNum / 2,//中间数
iWidth = iHeight = FaceHandler.imageWidth[tabName],//图片长宽
iColWidth = FaceHandler.imageColWidth[tabName],//表格剩余空间的显示比例
tableCss = FaceHandler.imageCss[tabName],
cssOffset = FaceHandler.imageCssOffset[tabName],
textHTML = ['<table class="smileytable" cellpadding="1" cellspacing="0" align="center" style="border-collapse:collapse;" border="1" bordercolor="#BAC498" width="100%">'],
i = 0,imgNum = faceBox[tabName].length,imgColNum = FaceHandler.imageCols[tabName],faceImage,
sUrl,realUrl,posflag,offset,infor;
for (; i < imgNum;) {
textHTML.push('<tr>');
for (var j = 0; j < imgColNum; j++,i++) {
faceImage = faceBox[tabName][i];
if (faceImage) {
sUrl = imagePath + faceImage + faceVersion;
realUrl = imagePath + faceImage;
posflag = j < positionLine ? 0 : 1;
offset = cssOffset * i * (-1) - 1;
infor = inforBox[tabName][i];
textHTML.push('<td class="' + tableCss + '" border="1" width="' + iColWidth + '%" style="border-collapse:collapse;" align="center" bgcolor="#FFFFFF" onclick="InsertSmiley(\'' + realUrl.replace(/'/g, "\\'") + '\')" onmouseover="over(this,\'' + sUrl + '\',\'' + posflag + '\')" onmouseout="out(this)">');
textHTML.push('<span style="display:block;">');
textHTML.push('<img style="background-position:left ' + offset + 'px;" title="' + infor + '" src="' + sBasePath + (editor.options.emotionLocalization ? '0.gif" width="' : 'default/0.gif" width="') + iWidth + '" height="' + iHeight + '"></img>');
textHTML.push('</span>');
} else {
textHTML.push('<td width="' + iColWidth + '%" bgcolor="#FFFFFF">');
}
textHTML.push('</td>');
}
textHTML.push('</tr>');
}
textHTML.push('</table>');
textHTML = textHTML.join("");
tab.innerHTML = textHTML;
}
var tabIndex = 0;//getDialogInstance()?(getDialogInstance().smileyTabId?getDialogInstance().smileyTabId:0):0;
switchTab(tabIndex);
$G("tabIconReview").style.display = 'none'; | 10npsite | trunk/guanli/system/ueditor/dialogs/emotion/emotion.js | JavaScript | asf20 | 9,365 |
.jd img{
background:transparent url(images/jxface2.gif?v=1.1) no-repeat scroll left top;
cursor:pointer;width:35px;height:35px;display:block;
}
.pp img{
background:transparent url(images/fface.gif?v=1.1) no-repeat scroll left top;
cursor:pointer;width:25px;height:25px;display:block;
}
.ldw img{
background:transparent url(images/wface.gif?v=1.1) no-repeat scroll left top;
cursor:pointer;width:35px;height:35px;display:block;
}
.tsj img{
background:transparent url(images/tface.gif?v=1.1) no-repeat scroll left top;
cursor:pointer;width:35px;height:35px;display:block;
}
.cat img{
background:transparent url(images/cface.gif?v=1.1) no-repeat scroll left top;
cursor:pointer;width:35px;height:35px;display:block;
}
.bb img{
background:transparent url(images/bface.gif?v=1.1) no-repeat scroll left top;
cursor:pointer;width:35px;height:35px;display:block;
}
.youa img{
background:transparent url(images/yface.gif?v=1.1) no-repeat scroll left top;
cursor:pointer;width:35px;height:35px;display:block;
}
.smileytable td {
height: 37px;
}
body{
padding:0;
margin:0;
}
#tabPanel{
float:none;
text-align:left;
}
#tabContent {
float:left;
background:#FFFFFF;<!--EAEAD1-->
}
#tabContent div{
display: none;
width:480px;
height:312px;
overflow:hidden;
}
#tabIconReview.show{
left:17px;
display:block;
}
.menuFocus{
background:#ACCD3C;
}
.menuDefault{
background:#FFFFFF;
}
#tabIconReview{
position:absolute;
left:406px;
left:398px \9;
top:41px;
z-index:65533;
width:90px;
height:76px;
}
img.review{
width:90px;
height:76px;
border:2px solid #9cb945;
background:#FFFFFF;
background-position:center;
background-repeat:no-repeat;
}
.neweditor-tab{
position:relative;
}
.neweditor-tab .neweditor-tab-h{
float:left;
padding-left:5px;
margin-bottom:-1px;
position:relative;
z-index:1000;
}
.neweditor-tab .neweditor-tab-h div{
border-left:1px solid #c1c1c1;
border-top:1px solid #c1c1c1;
border-right:1px solid #c1c1c1;
margin:2px 0 0 3px;
float:left;
font-size:14px;
padding:5px 8px 3px;
line-height:16px;
background:url("images/neweditor-tab-bg.png") repeat-x 0 0;
cursor:pointer;
}
.neweditor-tab .neweditor-tab-h .on{
font-weight:bold;
padding:7px 8px 2px;
margin:0 0 0 3px;
border-bottom:1px solid #fff;
background:none;
}
.neweditor-tab .neweditor-tab-b{
position:relative;
float:left;
border-top:1px solid #c1c1c1;
clear:both;
margin:0;
padding:10px;
}
.neweditor-tab .neweditor-tab-b div{
border:4px solid #F2F2F2;
margin:0px 3px;
} | 10npsite | trunk/guanli/system/ueditor/dialogs/emotion/emotion.css | CSS | asf20 | 2,741 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>插入特殊符号</title>
<style type="text/css">
*{color: #838383}
body {
font-size: 12px;
width:610px;
height: 490px;
overflow: hidden;
margin:0px;padding:0px;
}
.warp{
padding: 39px 0px 0px 15px;
height:90%;position:relative;
}
#tabContainer{ position: absolute;top:10px;height:30px;}
#tabContainer ul{list-style:none;margin:0;padding:0}
#tabContainer li{display:block;float:left;padding:0px 5px;height:28px ;line-height:28px;cursor:pointer;margin-right:1px}
#tabContainer li{background:url("../../themes/default/images/dialog-title-bg.png") repeat-x;border:1px solid #ccc;}
#tabContainer li.selected{background:url("") #FFF;border:1px solid #ccc;border-bottom: 1px solid #FFF}
table{border-collapse:collapse}
td{cursor:pointer;text-align:center;height:20px;}
#contContainer{border:1px solid #ccc;padding:15px 0px 0px 0px}
</style>
<script type="text/javascript" src="../internal.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
function G(id){ return (typeof(id) == "string") ? document.getElementById(id) : id ; }
function S(id){ G(id).style.display = ''; }
function H(id){ G(id).style.display = 'none'; }
function A(sr){ return sr.split(","); }
var character_common = [
["特殊符号", A("、,。,·,ˉ,ˇ,¨,〃,々,—,~,‖,…,‘,’,“,”,〔,〕,〈,〉,《,》,「,」,『,』,〖,〗,【,】,±,×,÷,∶,∧,∨,∑,∏,∪,∩,∈,∷,√,⊥,∥,∠,⌒,⊙,∫,∮,≡,≌,≈,∽,∝,≠,≮,≯,≤,≥,∞,∵,∴,♂,♀,°,′,″,℃,$,¤,¢,£,‰,§,№,☆,★,○,●,◎,◇,◆,□,■,△,▲,※,→,←,↑,↓,〓,〡,〢,〣,〤,〥,〦,〧,〨,〩,㊣,㎎,㎏,㎜,㎝,㎞,㎡,㏄,㏎,㏑,㏒,㏕,︰,¬,¦,,℡,ˊ,ˋ,˙,–,―,‥,‵,℅,℉,↖,↗,↘,↙,∕,∟,∣,≒,≦,≧,⊿,═,║,╒,╓,╔,╕,╖,╗,╘,╙,╚,╛,╜,╝,╞,╟,╠,╡,╢,╣,╤,╥,╦,╧,╨,╩,╪,╫,╬,╭,╮,╯,╰,╱,╲,╳,▁,▂,▃,▄,▅,▆,▇,�,█,▉,▊,▋,▌,▍,▎,▏,▓,▔,▕,▼,▽,◢,◣,◤,◥,☉,⊕,〒,〝,〞")],
["罗马数字", A("ⅰ,ⅱ,ⅲ,ⅳ,ⅴ,ⅵ,ⅶ,ⅷ,ⅸ,ⅹ,Ⅰ,Ⅱ,Ⅲ,Ⅳ,Ⅴ,Ⅵ,Ⅶ,Ⅷ,Ⅸ,Ⅹ,Ⅺ,Ⅻ")],
["数字符号", A("⒈,⒉,⒊,⒋,⒌,⒍,⒎,⒏,⒐,⒑,⒒,⒓,⒔,⒕,⒖,⒗,⒘,⒙,⒚,⒛,⑴,⑵,⑶,⑷,⑸,⑹,⑺,⑻,⑼,⑽,⑾,⑿,⒀,⒁,⒂,⒃,⒄,⒅,⒆,⒇,①,②,③,④,⑤,⑥,⑦,⑧,⑨,⑩,㈠,㈡,㈢,㈣,㈤,㈥,㈦,㈧,㈨,㈩")],
["日文符号", A("ぁ,あ,ぃ,い,ぅ,う,ぇ,え,ぉ,お,か,が,き,ぎ,く,ぐ,け,げ,こ,ご,さ,ざ,し,じ,す,ず,せ,ぜ,そ,ぞ,た,だ,ち,ぢ,っ,つ,づ,て,で,と,ど,な,に,ぬ,ね,の,は,ば,ぱ,ひ,び,ぴ,ふ,ぶ,ぷ,へ,べ,ぺ,ほ,ぼ,ぽ,ま,み,む,め,も,ゃ,や,ゅ,ゆ,ょ,よ,ら,り,る,れ,ろ,ゎ,わ,ゐ,ゑ,を,ん,ァ,ア,ィ,イ,ゥ,ウ,ェ,エ,ォ,オ,カ,ガ,キ,ギ,ク,グ,ケ,ゲ,コ,ゴ,サ,ザ,シ,ジ,ス,ズ,セ,ゼ,ソ,ゾ,タ,ダ,チ,ヂ,ッ,ツ,ヅ,テ,デ,ト,ド,ナ,ニ,ヌ,ネ,ノ,ハ,バ,パ,ヒ,ビ,ピ,フ,ブ,プ,ヘ,ベ,ペ,ホ,ボ,ポ,マ,ミ,ム,メ,モ,ャ,ヤ,ュ,ユ,ョ,ヨ,ラ,リ,ル,レ,ロ,ヮ,ワ,ヰ,ヱ,ヲ,ン,ヴ,ヵ,ヶ")],
["希腊字母", A("Α,Β,Γ,Δ,Ε,Ζ,Η,Θ,Ι,Κ,Λ,Μ,Ν,Ξ,Ο,Π,Ρ,Σ,Τ,Υ,Φ,Χ,Ψ,Ω,α,β,γ,δ,ε,ζ,η,θ,ι,κ,λ,μ,ν,ξ,ο,π,ρ,σ,τ,υ,φ,χ,ψ,ω")],
["俄文字母", A("А,Б,В,Г,Д,Е,Ё,Ж,З,И,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ъ,Ы,Ь,Э,Ю,Я,а,б,в,г,д,е,ё,ж,з,и,й,к,л,м,н,о,п,р,с,т,у,ф,х,ц,ч,ш,щ,ъ,ы,ь,э,ю,я")],
["拼音字母", A("ā,á,ǎ,à,ē,é,ě,è,ī,í,ǐ,ì,ō,ó,ǒ,ò,ū,ú,ǔ,ù,ǖ,ǘ,ǚ,ǜ,ü")],
["注音字符及其他", A("ㄅ,ㄆ,ㄇ,ㄈ,ㄉ,ㄊ,ㄋ,ㄌ,ㄍ,ㄎ,ㄏ,ㄐ,ㄑ,ㄒ,ㄓ,ㄔ,ㄕ,ㄖ,ㄗ,ㄘ,ㄙ,ㄚ,ㄛ,ㄜ,ㄝ,ㄞ,ㄟ,ㄠ,ㄡ,ㄢ,ㄣ,ㄤ,ㄥ,ㄦ,ㄧ,ㄨ")]
];
var character_title = [
["特殊符号", A("、,。,·,ˉ,ˇ,¨,〃,々,—,~,‖,…,‘,’,“,”,〔,〕,〈,〉,《,》,±,×,÷,∶,∧,∨,∑,∏,∪,∩,∈,∷,√,⊥,∥,∠,⌒,≡,≌,≈,∽,∝,≠,≮,≯,≤,≥,∞,°,′,″,℃,$,‰,㎎,㎏,㎜,㎝,㎞,㎡,㏄,㏎,㏑,㏒,㏕,℉")],
["罗马数字", A("ⅰ,ⅱ,ⅲ,ⅳ,ⅴ,ⅵ,ⅶ,ⅷ,ⅸ,ⅹ,Ⅰ,Ⅱ,Ⅲ,Ⅳ,Ⅴ,Ⅵ,Ⅶ,Ⅷ,Ⅸ,Ⅹ,Ⅺ,Ⅻ")],
["日文符号", A("ぁ,あ,ぃ,い,ぅ,う,ぇ,え,ぉ,お,か,が,き,ぎ,く,ぐ,け,げ,こ,ご,さ,ざ,し,じ,す,ず,せ,ぜ,そ,ぞ,た,だ,ち,ぢ,っ,つ,づ,て,で,と,ど,な,に,ぬ,ね,の,は,ば,ぱ,ひ,び,ぴ,ふ,ぶ,ぷ,へ,べ,ぺ,ほ,ぼ,ぽ,ま,み,む,め,も,ゃ,や,ゅ,ゆ,ょ,よ,ら,り,る,れ,ろ,ゎ,わ,ゐ,ゑ,を,ん,ァ,ア,ィ,イ,ゥ,ウ,ェ,エ,ォ,オ,カ,ガ,キ,ギ,ク,グ,ケ,ゲ,コ,ゴ,サ,ザ,シ,ジ,ス,ズ,セ,ゼ,ソ,ゾ,タ,ダ,チ,ヂ,ッ,ツ,ヅ,テ,デ,ト,ド,ナ,ニ,ヌ,ネ,ノ,ハ,バ,パ,ヒ,ビ,ピ,フ,ブ,プ,ヘ,ベ,ペ,ホ,ボ,ポ,マ,ミ,ム,メ,モ,ャ,ヤ,ュ,ユ,ョ,ヨ,ラ,リ,ル,レ,ロ,ヮ,ワ,ヰ,ヱ,ヲ,ン,ヴ,ヵ,ヶ")],
["希腊字母", A("Α,Β,Γ,Δ,Ε,Ζ,Η,Θ,Ι,Κ,Λ,Μ,Ν,Ξ,Ο,Π,Ρ,Σ,Τ,Υ,Φ,Χ,Ψ,Ω,α,β,γ,δ,ε,ζ,η,θ,ι,κ,λ,μ,ν,ξ,ο,π,ρ,σ,τ,υ,φ,χ,ψ,ω")],
["俄文字母", A("А,Б,В,Г,Д,Е,Ё,Ж,З,И,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ъ,Ы,Ь,Э,Ю,Я,а,б,в,г,д,е,ё,ж,з,и,й,к,л,м,н,о,п,р,с,т,у,ф,х,ц,ч,ш,щ,ъ,ы,ь,э,ю,я")],
["拼音字母", A("ā,á,ǎ,à,ē,é,ě,è,ī,í,ǐ,ì,ō,ó,ǒ,ò,ū,ú,ǔ,ù,ǖ,ǘ,ǚ,ǜ,ü")],
["注音字符及其他", A("ㄅ,ㄆ,ㄇ,ㄈ,ㄉ,ㄊ,ㄋ,ㄌ,ㄍ,ㄎ,ㄏ,ㄐ,ㄑ,ㄒ,ㄓ,ㄔ,ㄕ,ㄖ,ㄗ,ㄘ,ㄙ,ㄚ,ㄛ,ㄜ,ㄝ,ㄞ,ㄟ,ㄠ,ㄡ,ㄢ,ㄣ,ㄤ,ㄥ,ㄦ,ㄧ,ㄨ")]
];
//用于区分普通特殊字符与标题特殊字符
var character = character_common,
tab = 0,
which = 0;
var showTabContent = (function(){
var selectedTab = "";
return function(id_or_el){
var el = G(id_or_el);
if (el.id == selectedTab)
return false;
if (selectedTab != "") {
G(selectedTab).className = "lk";
H("C" + selectedTab.substr(1));
}
G(el).className = "lk selected";
S("C" + el.id.substr(1));
selectedTab = el.id;
}
})();
function genTab(id, data){
return ["<li class='lk' id='T", id, "' onclick='showTabContent(this)'>", data, "</li>"].join("");
}
function genTabContent(id, data){
var datalen = data.length;
var max_cell_per_row = 10;
var max_rows = Math.ceil(datalen / 10);
var html = ["<table id='C", id, "' style='display:none;' width='100%' cellpadding='0' cellspacing='0' border='0'>"];
for(var i = 0, j = 0; i < max_rows; i ++){
html.push("<tr>");
for(j = 0; j < max_cell_per_row; j ++){
if(i * max_cell_per_row + j >= datalen){
break;
}
html.push("<td id='n_" + (id + "_" + (i*max_cell_per_row + j)) + "' onclick='insertSC(this);'>" + data[i * max_cell_per_row + j] + "</td>");
}
if(j < max_cell_per_row){
for(var k = 0; k < (max_cell_per_row - j); k ++){
html.push("<td> </td>");
}
}
html.push("</tr>");
}
html.push("</table>");
return html.join("");
}
function insertSC(td){
var id = td.id.split("_");
var _tab = id[1];
var _which = id[2];
editor.execCommand('InsertHTML',td.innerHTML);
dialog.close();
}
function insertDefault(){
var obj = G("n_" + tab + "_" + which);
if(obj){
editor.execCommand('InsertHTML',obj.innerHTML);
}
}
var module = null;
window.onload = function(){
var tabs = [], conts = [];
for(var i = 0; i < character.length; i ++){
tabs.push(genTab(i, character[i][0]));
conts.push(genTabContent(i, character[i][1]));
}
G("tabContainer").innerHTML = "<ul>" + tabs.join("") + "</ul>";
G("contContainer").innerHTML = conts.join("");
setTimeout(function(){
showTabContent("T" + tab); //显示第几个tab
if(G("n_" + tab + "_" + which)){
G("n_" + tab + "_" + which).className = "selected"; //显示那个符号被选中
}
}, 100);
}
/*]]>*/
</script>
</head>
<body>
<div class="warp">
<div id="tabContainer"></div>
<div id="contContainer"></div>
</div>
</body>
</html> | 10npsite | trunk/guanli/system/ueditor/dialogs/spechars/spechars.html | HTML | asf20 | 8,720 |
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>插入框架</title>
<script type="text/javascript" src="../internal.js"></script>
<style type="text/css">
* {
color: #838383
}
body {
font-size: 12px;
width: 320px;
height: 153px;
overflow: hidden;
margin: 0;
padding: 0;
}
.warp {
padding: 20px 0 0 15px;
height: 100%;
position: relative;
}
#url {
width: 290px;
margin-bottom: 2px
}
table td{
padding:5px 0px;
}
</style>
</head>
<body>
<div class="warp">
<table width="300" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2">
<span>地址:</span><input style="width:200px" id="url" type="text" value=""/>
</td>
</tr>
<tr>
<td colspan="2"><span>宽度:</span><input style="width:200px" type="text" id="width"/> px</td>
</tr>
<tr>
<td colspan="2"><span>高度:</span><input style="width:200px" type="text" id="height"/> px</td>
</tr>
<tr>
<td><span>允许滚动条:</span><input type="checkbox" id="scroll"/> </td>
<td><span>显示框架边框:</span><input type="checkbox" id="frameborder"/> </td>
</tr>
<tr>
<td colspan="2"><span>对齐方式:</span>
<select id="align">
<option value="">默认</option>
<option value="left">左对齐</option>
<option value="right">右对齐</option>
<option value="middle">居中</option>
</select>
</td>
</tr>
</table>
</div>
<script type="text/javascript">
var iframe = editor._iframe;
function g(id){
return document.getElementById( id );
}
if(iframe){
g("url").value = iframe.getAttribute("src") ? iframe.getAttribute("src") : "";
g("width").value = iframe.getAttribute("width") ? iframe.getAttribute("width") : "";
g("height").value = iframe.getAttribute("height") ? iframe.getAttribute("height") : "";
g("scroll").checked = (iframe.getAttribute("scrolling") == "yes") ? true : false;
g("frameborder").checked = (iframe.getAttribute("frameborder") == "1") ? true : false;
g("align").value = iframe.align ? iframe.align : "";
}
function queding(){
var url = g("url").value.replace(/^\s*|\s*$/ig,""),
width = g("width").value,
height = g("height").value,
scroll = g("scroll"),
frameborder = g("frameborder"),
float = g("align").value,
newIframe = editor.document.createElement("iframe"),
div;
if(!url){
alert("请输入地址!");
return false;
}
newIframe.setAttribute("src",/http:\/\/|https:\/\//ig.test(url) ? url : "http://"+url);
/^[1-9]+[.]?\d*$/g.test( width ) ? newIframe.setAttribute("width",width) : "";
/^[1-9]+[.]?\d*$/g.test( height ) ? newIframe.setAttribute("height",height) : "";
scroll.checked ? newIframe.setAttribute("scrolling","yes") : newIframe.setAttribute("scrolling","no");
frameborder.checked ? newIframe.setAttribute("frameborder","1",0) : newIframe.setAttribute("frameborder","0",0);
float ? newIframe.setAttribute("align",float) : newIframe.setAttribute("align","");
if(iframe){
iframe.parentNode.insertBefore(newIframe,iframe);
parent.baidu.editor.dom.domUtils.remove(iframe);
}else{
div = editor.document.createElement("div");
div.appendChild(newIframe);
editor.execCommand("inserthtml",div.innerHTML);
}
editor._iframe = null;
dialog.close();
}
dialog.onok = queding;
g("url").onkeydown = function(evt){
evt = evt || event;
if(evt.keyCode == 13){
queding();
}
}
var ipt = g( "url" );
var isIE = !!window.ActiveXObject;
if ( isIE ) {
setTimeout( function () {
var r = ipt.createTextRange();
r.collapse( false );
r.select();
} );
}
ipt.focus();
</script>
</body>
</html> | 10npsite | trunk/guanli/system/ueditor/dialogs/insertframe/insertframe.html | HTML | asf20 | 4,740 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Google地图</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="../internal.js"></script>
<style type="text/css">
*{color: #838383}
body {
font-size: 12px;
width:540px;
height: 350px;
overflow: hidden;
margin:0px;padding:0px;
}
.content{
padding: 9px 0px 0px 15px;
height:100%;
}
.content table{padding:0px;margin:0px;width: 100%}
.content table tr{padding:0px;margin:0px; list-style: none;height: 30px; line-height: 30px;}
#city,
#address
{height:21px;background: #FFF;border:1px solid #d7d7d7;padding: 0px; margin: 0px; line-height: 21px;}
#city{width:90px}
#address{width:220px}
a.doSearch{display:block;text-align:center;line-height:24px; text-decoration: none;height:24px;width:95px;border: 0px;margin:0px;padding:0px;background:url(../../themes/default/images/icons-all.gif) no-repeat;}
a.doSearch:hover{background-position: 0 -30px;}
</style>
</head>
<body>
<div class="content">
<table>
<tr>
<!--<td><label for="city">城市:</label></td>-->
<!--<td><input id="city" type="text" value="北京市" /></td>-->
<td><label for="address">地址:</label></td>
<td><input id="address" type="text" value="北京市" /></td>
<td><a href="javascript:doSearch()" class="doSearch">搜索</a></td>
</tr>
</table>
<div id="container" style="width: 520px; height: 340px; border: 1px solid gray;"></div>
</div>
<script type="text/javascript">
var map = new google.maps.Map(document.getElementById('container'), {
zoom: 3,
streetViewControl: false,
scaleControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var imgcss;
var marker = new google.maps.Marker({
map: map,
draggable: true
});
function doSearch(){
var address = document.getElementById('address').value;
var geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'address': address}, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var bounds = results[0].geometry.viewport;
map.fitBounds(bounds);
marker.setPosition(results[0].geometry.location);
marker.setTitle(address);
} else alert('无法定位到该地址!');
});
}
document.getElementById('address').onkeydown = function (evt){
evt = evt || event;
if (evt.keyCode == 13) {
doSearch();
}
};
dialog.onok = function (){
var center = map.getCenter();
var point = marker.getPosition();
var url = "http://maps.google.com/maps/api/staticmap?center=" + center.lat() + ',' + center.lng() + "&zoom=" + map.zoom + "&size=520x340&maptype=" + map.getMapTypeId() + "&markers=" + point.lat() + ',' + point.lng() + "&sensor=false";
editor.execCommand('inserthtml', '<img width="520" height="340" src="' + url + '"' + (imgcss ? ' style="' + imgcss + '"' :'') + '/>');
};
function getPars(str,par){
var reg = new RegExp(par+"=((\\d+|[.,])*)","g");
return reg.exec(str)[1];
}
var img = editor.selection.getRange().getClosedNode();
if(img && img.src.indexOf("http://maps.google.com/maps/api/staticmap")!=-1){
var url = img.getAttribute("src");
var centers = getPars(url,"center").split(",");
point = new google.maps.LatLng(Number(centers[0]),Number(centers[1]));
map.setCenter(point);
map.setZoom(Number(getPars(url,"zoom")));
centers = getPars(url,"markers").split(",");
marker.setPosition(new google.maps.LatLng(Number(centers[0]),Number(centers[1])));
imgcss = img.style.cssText;
}else{
doSearch();
}
</script>
</body>
</html> | 10npsite | trunk/guanli/system/ueditor/dialogs/gmap/gmap.html | HTML | asf20 | 4,322 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>标题</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<style type="text/css">
*{margin: 0;padding: 0;font-size: 12px;}
.wrapper{margin-left: 2px;}
.base{width: 472px;height: 70px; margin-left: 10px;margin-top:10px;border: 1px solid #ddd;}
legend{margin-left: 5px; font-weight: bold;font-size: 12px;color: #0066cc;}
fieldset table{margin-left: 5px;float: left;}
select{width: 50px}
.base table{margin-left: 10px;}
.base table tr{height: 25px;}
input{ width: 50px;border:1px solid #ccc;}
.extend {width: 300px;height: 160px;margin:10px;;float: left;border: 1px solid #ddd;}
.extend table{height: 135px;}
#preview{width: 160px;height: 155px;float: left;border: 1px solid #ccc;margin: 16px 0;background-color: #eee}
span.bold{font-weight: bold}
#preview table {margin:3px 5px;}
#preview table td{width: 30px;height: 20px;}
#message{float: left;width: 110px;margin-left: 10px;font-size: 10px;color: red;line-height: 15px}
#messageContent{color: green;margin-top: 5px;}
.extend select{width: 90px}
#bgColor{width: 85px;}
</style>
</head>
<body>
<div class="wrapper">
<fieldset class="base">
<legend>基本信息</legend>
<table>
<tr>
<td width="120"><label for="numRows">行数: </label><input id="numRows" type="text" /> 行</td>
<td>
<label for="width">宽度: </label><input id="width" type="text" />
<label for="widthUnit">度量单位: </label>
<select id="widthUnit">
<option value="%">%</option>
<option value="px">px</option>
</select>
</td>
</tr>
<tr>
<td><label for="numCols">列数: </label><input id="numCols" type="text" /> 列</td>
<td>
<label for="height">高度: </label><input id="height" type="text" />
<label for="heightUnit">度量单位: </label>
<select id="heightUnit">
<option value="%">%</option>
<option value="px">px</option>
</select>
</td>
</tr>
</table>
<div id="message" style="display: none">
<p>温馨提示:</p>
<p id="messageContent">边距最大值不能超过13px!</p>
</div>
</fieldset>
<div>
<fieldset class="extend">
<legend>扩展信息<span style="font-weight: normal;">(可预览)</span></legend>
<table>
<tr>
<td width="60"><span class="bold">表格边框</span>:</td>
<td><label for="border">大小: </label><input id="border" type="text" /> px </td>
<td><label for="borderColor">颜色: </label><input id="borderColor" type="text" /></td>
</tr>
<tr style="border-bottom: 1px solid #ddd">
<td><span class="bold">边距间距</span>:</td>
<td><label for="cellPadding">边距: </label><input id="cellPadding" type="text" /> px </td>
<td><label for="cellSpacing">间距: </label><input id="cellSpacing" type="text" /> px </td>
</tr>
<tr>
<td colspan="3"><span class="bold">表格的背景颜色</span>:
<input id="bgColor" type="text" />
</td>
</tr>
<tr>
<td colspan="3"><span class="bold">表格的对齐方式</span>:
<select id="align">
<option value="">默认</option>
<option value="center">居中</option>
<option value="left">居左</option>
<option value="right">居右</option>
</select>
</td>
</tr>
<tr>
<td colspan="3">
<span class="bold">边框设置作用于</span>:
<select id="borderType">
<option value="0">仅表格</option>
<option value="1">所有单元格</option>
</select>
</td>
</tr>
</table>
</fieldset>
<div id="preview">
<table border="1" borderColor="#000" cellpadding="0" cellspacing="0" style="border-collapse: collapse;">
<tr><td>这</td><td>是</td><td>用</td></tr>
<tr><td>来</td><td>预</td><td>览</td></tr>
<tr><td>的</td><td></td><td></td></tr>
</table>
</div>
</div>
</div>
<script type="text/javascript" src="../internal.js"></script>
<script type="text/javascript" src="table.js"></script>
<script type="text/javascript">
var inputs = document.getElementsByTagName('input'),
selects=document.getElementsByTagName('select');
//ie给出默认值
for(var i=0,ci;ci=inputs[i++];){
switch (ci.id){
case 'numRows':
case 'numCols':
ci.value = 5;
break;
case 'bgColor':
ci.value = '#FFFFFF';
break;
case 'borderColor':
ci.value = '#000000';
break;
case 'border':
ci.value = 1;
break;
case 'cellSpacing':
case 'cellPadding':
ci.value = '0';
break;
default:
}
}
for(var i=0,ci;ci=selects[i++];){
ci.options[0].selected = true;
}
var state = editor.queryCommandState("edittable");
if(state == 0){
var range = editor.selection.getRange(),
table = domUtils.findParentByTagName(range.startContainer,'table',true);
if(table){
var numRows = table.rows.length,cellCount=0;
//列取最大数
for(var i=0,ri;ri=table.rows[i++];){
var tmpCellCount = 0;
for(var j=0,cj;cj=ri.cells[j++];){
if(cj.style.display != 'none'){
tmpCellCount++;
}
}
cellCount = Math.max(tmpCellCount,cellCount)
}
domUtils.setAttributes($G('numRows'),{
'value':numRows,
'disabled':true
});
domUtils.setAttributes($G('numCols'),{
'value':cellCount,
'disabled':true
});
$G("cellPadding").value = table.getAttribute("cellPadding") || '0';
$G("cellSpacing").value = table.getAttribute("cellSpacing") || '0';
var value = table.getAttribute('width');
value = !value ? ['',table.offsetWidth]:/%$/.test(value) ? value.match(/(\d+)(%)?/) : ['',value.replace(/px/i,'')];
$G("width").value = value[1];
$G('widthUnit').options[value[2] ? 0:1].selected = true;
value = table.getAttribute('height');
value = !value ? ['','']:/%$/.test(value) ? value.match(/(\d+)(%)?/) : ['',value.replace(/px/i,'')];
$G("height").value = value[1];
$G('heightUnit').options[value[2]?0:1].selected = true;
$G('borderColor').value = (table.getAttribute('borderColor')||"#000000").toUpperCase();
$G("border").value = table.getAttribute("border");
for(var i=0,ip,opts= $G("align").options;ip=opts[i++];){
if(ip.value == table.getAttribute('align')){
ip.selected = true;
break;
}
}
$G("borderType").options[table.getAttribute('borderType') == '1' ? 1: 0].selected = true;
$G("bgColor").value = (table.getAttribute("bgColor")||"#FFFFFF").toUpperCase();
createTable();
}
}else{
$focus($G("numRows"));
}
init();
domUtils.on($G("width"),"keyup",function(){
var value = this.value;
if(value>100){
$G("widthUnit").value="px";
}
});
domUtils.on($G("height"),"keyup",function(){
var value = this.value;
if(value>100){
$G("heightUnit").value="px";
}
});
dialog.onok = function(){
for(var i=0,opt={},ci;ci=inputs[i++];){
switch (ci.id){
case 'numRows':
case 'numCols':
case 'height':
case 'width':
if(ci.value && !/^[1-9]+[0-9]*$/.test(ci.value)){
alert("请输入正确的数值!");
$focus(ci);
return false;
}
break;
case 'cellspacing':
case 'cellpadding':
case 'border':
if(ci.value && !/^[0-9]*$/.test(ci.value)){
alert("请输入正确的数值!");
$focus(ci);
return false;
}
break;
case 'bgColor':
case 'borderColor':
if(ci.value && !/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(ci.value)){
alert("请输入正确的颜色值");
$focus(ci);
return false;
}
break;
default:
}
opt[ci.id] = ci.value;
}
for(var i=0,ci;ci=selects[i++];){
opt[ci.id] = ci.value.toUpperCase();
}
editor.execCommand(state == -1 ? 'inserttable' : 'edittable',opt );
};
</script>
</body>
</html> | 10npsite | trunk/guanli/system/ueditor/dialogs/table/table.html | HTML | asf20 | 11,341 |
/**
* Created by JetBrains PhpStorm.
* User: taoqili
* Date: 12-2-23
* Time: 上午11:32
* To change this template use File | Settings | File Templates.
*/
var init = function(){
addColorPickListener();
addPxChangeListener();
addFloatListener();
addBorderTypeChangeListener();
};
function addBorderTypeChangeListener(){
domUtils.on($G("borderType"),"change",createTable);
}
function addFloatListener(){
domUtils.on($G("align"),"change",function(){
setTablePosition(this.value);
})
}
/**
* 根据传入的value值变更table的位置
* @param value
*/
function setTablePosition(value){
var table = $G("preview").children[0],
margin = (table.parentNode.offsetWidth - table.offsetWidth)/2;
if(value=="center"){
table.style.marginLeft = margin +"px";
}else if(value=="right"){
table.style.marginLeft = 2*margin +"px";
}else{
table.style.marginLeft = "5px";
}
}
/**
* 绑定border、spaceing等更改事件
*/
function addPxChangeListener(){
var ids = ["border","cellPadding","cellSpacing"];
for(var i=0,ci;ci=$G(ids[i++]);){
domUtils.on(ci,"keyup",function(){
$G("message").style.display="none";
switch(this.id){
case "border":
$G("border").value = filter(this.value,"border","边框");
break;
case "cellPadding":
$G("cellPadding").value = filter(this.value,"cellPadding","边距");
break;
case "cellSpacing":
$G("cellSpacing").value = filter(this.value,"cellSpacing","间距");
break;
default:
}
createTable();
//setTablePosition($G("align").value);
});
}
}
function isNum(str){
return /^(0|[1-9][0-9]*)$/.test( str );
}
/**
* 依据属性框中的属性值创建table对象
*/
function createTable(){
var border=$G("border").value || 1,
borderColor=$G("borderColor").value || "#000000",
cellPadding=$G("cellPadding").value || 0,
cellSpacing=$G("cellSpacing").value || 0,
bgColor=$G("bgColor").value || "#FFFFFF",
align=$G("align").value || "",
borderType=$G("borderType").value || 0;
border = setMax(border,5);
cellPadding = setMax(cellPadding,5);
cellSpacing = setMax(cellSpacing,5);
var html = ["<table "];
if(cellSpacing>0){
html.push(' style="border-collapse:separate;" ')
}else{
html.push(' style="border-collapse:collapse;" ')
}
cellSpacing>0 && html.push(' cellSpacing="' + cellSpacing + '" ');
html.push(' border="' + (border||1) +'" borderColor="' + (borderColor||'#000000') +'"');
bgColor && html.push(' bgColor="' + bgColor + '"');
html.push(' ><tr><td>这</td><td>是</td><td>用</td></tr><tr><td>来</td><td>预</td><td>览</td></tr><tr><td>的</td><td></td><td></td></tr></table>');
var preview = $G("preview");
preview.innerHTML = html.join("");
//如果针对每个单元格
var table = preview.firstChild;
if(borderType=="1"){
for(var i =0,td,tds = domUtils.getElementsByTagName(table,"td");td = tds[i++];){
td.style.border = border + "px solid " + borderColor;
}
}
for(var i =0,td,tds = domUtils.getElementsByTagName(table,"td");td = tds[i++];){
td.style.padding = cellPadding + "px";
}
}
function setMax(value,max){
return value>max? max:value;
}
function filter(value,property,des){
var maxPreviewValue = 5,
maxValue = 10;
if(!isNum(value) && value!=""){
$G(property).value = "";
$G("message").style.display ="";
$G("messageContent").innerHTML= "请输入正确的数值!";
return property=="border"?1:0;
}
if(value > maxPreviewValue){
$G("message").style.display ="";
$G("messageContent").innerHTML= des+"超过" + maxPreviewValue+"px时不再提供实时预览!";
if(value>maxValue){
$G("messageContent").innerHTML = des+"最大值不能超过"+maxValue+"px!";
$G(property).value = maxValue;
return maxValue;
}
}
return value;
}
/**
* 绑定取色器监听事件
*/
function addColorPickListener(){
var colorPicker = getColorPicker(),
ids = ["bgColor","borderColor"];
for(var i=0,ci;ci = $G(ids[i++]); ){
domUtils.on(ci,"click",function(){
var me = this;
showColorPicker(colorPicker,me);
colorPicker.content.onpickcolor = function(t, color){
me.value = color.toUpperCase();
colorPicker.hide();
createTable();
};
colorPicker.content.onpicknocolor = function(){
me.value = '';
colorPicker.hide();
createTable();
};
});
domUtils.on(ci,"keyup",function(){
colorPicker.hide();
createTable();
});
}
domUtils.on(document, 'mousedown', function (){
UE.ui.Popup.postHide(this);
});
}
/**
* 实例化一个colorpicker对象
*/
function getColorPicker(){
return new UE.ui.Popup({
content: new UE.ui.ColorPicker({
noColorText: '清除颜色'
})
});
}
/**
* 在anchorObj上显示colorpicker
* @param anchorObj
*/
function showColorPicker(colorPicker,anchorObj){
colorPicker.showAnchor(anchorObj);
}
| 10npsite | trunk/guanli/system/ueditor/dialogs/table/table.js | JavaScript | asf20 | 6,369 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>标题</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<script type="text/javascript" src="../internal.js"></script>
<style type="text/css">
* {margin: 0; padding: 0}
table { margin: 10px;font-size: 12px}
table tr { height: 25px}
input { width: 110px;border: 1px solid #ccc;}
select { width: 76px;margin-left:6px\9; }
span.strong {font-weight: bold;}
</style>
</head>
<body>
<table>
<tr>
<td width="70"><span class="strong">背景颜色</span></td>
<td><input id="bgColor" type="text" value="#FFFFFF"></td>
</tr>
<tr>
<td rowspan="2"><span class="strong">对齐方式</span></td>
<td>水平: <select id="align">
<option value="">默认</option>
<option value="center">居中</option>
<option value="left">居左</option>
<option value="right">居右</option>
</select>
</td>
</tr>
<tr>
<td>垂直: <select id="vAlign">
<option value="">默认</option>
<option value="middle">居中</option>
<option value="top">顶端对齐</option>
<option value="bottom">底端对齐</option>
</select>
</td>
</tr>
</table>
<script type="text/javascript">
addColorPickListener();
dialog.onok = function () {
var tdItem = {
bgColor:$G( "bgColor" ).value || "#FFFFFF",
align:$G( "align" ).value || "",
vAlign:$G( "vAlign" ).value || ""
};
editor.execCommand( "edittd", tdItem );
};
(function () {
if ( !editor.currentSelectedArr.length ) {
var range = editor.selection.getRange();
var td = domUtils.findParentByTagName( range.startContainer, 'td', true );
if ( td ) {
$G( "bgColor" ).value = (td.bgColor || "#FFFFFF").toUpperCase();
$G( "align" ).value = td.align || "";
$G( "vAlign" ).value = td.vAlign || "";
}
}
})();
/**
* 绑定取色器监听事件
*/
function addColorPickListener() {
var colorPicker = getColorPicker(),
ids = ["bgColor"];
for ( var i = 0, ci; ci = $G( ids[i++] ); ) {
domUtils.on( ci, "click", function () {
var me = this;
showColorPicker( colorPicker, me );
colorPicker.content.onpickcolor = function ( t, color ) {
me.value = color.toUpperCase();
colorPicker.hide();
};
colorPicker.content.onpicknocolor = function () {
me.value = '';
colorPicker.hide();
};
} );
domUtils.on( ci, "keyup", function () {
colorPicker.hide();
} );
}
domUtils.on( document, 'mousedown', function () {
UE.ui.Popup.postHide( this );
} );
}
/**
* 实例化一个colorpicker对象
*/
function getColorPicker() {
return new UE.ui.Popup( {
content:new UE.ui.ColorPicker( {
noColorText:'清除颜色'
} )
} );
}
/**
* 在anchorObj上显示colorpicker
* @param anchorObj
*/
function showColorPicker( colorPicker, anchorObj ) {
colorPicker.showAnchor( anchorObj );
}
</script>
</body>
</html> | 10npsite | trunk/guanli/system/ueditor/dialogs/table/edittd.html | HTML | asf20 | 3,792 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>查找替换</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<script type="text/javascript" src="../internal.js"></script>
<style type="text/css">
*{color: #838383}
body {
font-size: 12px;
width:380px;
height: 170px;
overflow: hidden;
margin:0px;padding:0px;
}
.warp{
padding: 39px 0px 0px 15px;
height:88%;position:relative;
}
* +html .warp{height:80%}
.head{position:absolute;height:31px;top:9px;}
.content{height:110px;border: 1px solid #ddd;padding:5px}
.head span{width:62px;height:29px;line-height:29px;background:red;display:block;float: left;text-align: center;margin-right: 1px;cursor: pointer }
.head span.def{background:url("../../themes/default/images/dialog-title-bg.png") repeat-x;border:1px solid #ccc;}
.head span.act{background:#FFF;border:1px solid #ccc;border-bottom: 1px solid #FFF}
.content table{width:100%;}
.content input.int{ width:190px;height:21px;background: #FFF;border:1px solid #d7d7d7;padding: 0px; margin: 0px;line-height:21px;}
.content input.btn{width:60px; text-align:center;line-height:24px; text-decoration: none;height:24px;border: 0px;margin:0px;padding:0px;background:url("../../themes/default/images/dialog-title-bg.png") repeat-x;border:1px solid #ccc; }
</style>
</head>
<body>
<div class="warp">
<div id="head" class="head">
<span name="find" class="act">查找</span> <span name="replace" class="def">替换</span>
</div>
<div class="content" id="find">
<table>
<tr>
<td width="80">查找:</td>
<td><input id="findtxt" type="text" class="int" /></td>
</tr>
<tr>
<td>区分大小写:</td>
<td>
<input id="matchCase" type="checkbox" />
</td>
</tr>
<tr>
<td colspan="2">
<input id="nextFindBtn" type="button" value="下一个" class="btn" />
<input id="preFindBtn" type="button" value="上一个"class="btn" />
</td>
</tr>
</table>
</div>
<div class="content" id="replace">
<table>
<tr>
<td width="80">查找:</td>
<td><input id="findtxt1" type="text" class="int" /></td>
</tr>
<tr>
<td>替换:</td>
<td><input id="replacetxt" type="text" class="int" /></td>
</tr>
<tr>
<td>区分大小写:</td>
<td>
<input id="matchCase1" type="checkbox" />
</td>
</tr>
<tr>
<td colspan="2">
<input id="nextReplaceBtn" type="button" value="下一个" class="btn" />
<input id="preReplaceBtn" type="button" value="上一个" class="btn" />
<input id="repalceBtn" type="button" value="替换" class="btn" />
<input id="allrepalceBtn" type="button" value="全部替换" class="btn" />
</td>
</tr>
</table>
</div>
</div>
<script type="text/javascript">
//清空上次查选的痕迹
editor.firstForSR = 0;
editor.currentRangeForSR = null;
g("replace").style.display = "none";
var sel = editor.selection,
range = sel.getRange(),
searchStr = "";
if(!range.collapsed){
searchStr = sel._bakIERange ? sel._bakIERange.text : sel.getText();
g('findtxt').value = searchStr;
}
function g (id){
return document.getElementById(id);
}
function jbind (obj,evt,fun){
if(obj.addEventListener){ // firefox,w3c
obj.addEventListener(evt,fun,false);
}else{// ie
obj.attachEvent("on"+evt,function(){fun.apply(obj);});
}
}
//给tab注册切换事件
function toggletab(){
var tabs = document.getElementsByTagName("span");
for(var i=0,j;j=tabs[i];i++){
jbind(j,"click",function(){
var name = this.getAttribute("name");
var spans = document.getElementsByTagName("span");
var len = spans.length;
for(var s=0;s<len;s++){
spans[s].className = 'def';
}
this.className = 'act';
g("find").style.display = "none";
g("replace").style.display = "none";
g(name).style.display = "";
g('findtxt1').value = g('findtxt').value;
});
}
tabs[0].focus();
g("findtxt").focus();
}
//是否区分大小写
function getMatchCase (id){
return g(id).checked ? true : false;
}
//查找
g("nextFindBtn").onclick = function(txt,dir,mcase){
var findtxt = g("findtxt").value,obj;
if(!findtxt){
alert("请输入查找内容!");
return false;
}
obj = {
searchStr : findtxt,
dir : 1,
casesensitive : getMatchCase("matchCase")
};
if(!frCommond(obj)){
alert("没有找到内容");
}
}
g("nextReplaceBtn").onclick = function(txt,dir,mcase){
var findtxt = g("findtxt1").value,obj;
if(!findtxt){
alert("请输入查找内容!");
return false;
}
obj = {
searchStr : findtxt,
dir : 1,
casesensitive : getMatchCase("matchCase1")
};
frCommond(obj);
}
g("preFindBtn").onclick = function(txt,dir,mcase){
var findtxt = g("findtxt").value,obj;
if(!findtxt){
alert("请输入查找内容!");
return false;
}
obj = {
searchStr : findtxt,
dir : -1,
casesensitive : getMatchCase("matchCase")
};
if(!frCommond(obj)){
alert("没有找到内容");
}
}
g("preReplaceBtn").onclick = function(txt,dir,mcase){
var findtxt = g("findtxt1").value,obj;
if(!findtxt){
alert("请输入查找内容!");
return false;
}
obj = {
searchStr : findtxt,
dir : -1,
casesensitive : getMatchCase("matchCase1")
};
frCommond(obj);
}
//替换
g("repalceBtn").onclick = function(){
var findtxt = g("findtxt1").value.replace(/^\s|\s$/g,""),obj,
replacetxt = g("replacetxt").value.replace(/^\s|\s$/g,"");
if(!findtxt){
alert("请输入需要替换的内容!");
return false;
}
if(findtxt == replacetxt || (!getMatchCase("matchCase1") && findtxt.toLowerCase() == replacetxt.toLowerCase())){
alert("查找内容与替换内容一样!")
return false;
}
obj = {
searchStr : findtxt,
dir : 1,
casesensitive : getMatchCase("matchCase1"),
replaceStr : replacetxt
};
if(!frCommond(obj)){
alert("没有可替换的内容");
}
}
//全部替换
g("allrepalceBtn").onclick = function(){
var findtxt = g("findtxt1").value.replace(/^\s|\s$/g,""),obj,
replacetxt = g("replacetxt").value.replace(/^\s|\s$/g,"");
if(!findtxt){
alert("请输入需要替换的内容!");
return false;
}
if(findtxt == replacetxt || (!getMatchCase("matchCase1") && findtxt.toLowerCase() == replacetxt.toLowerCase())){
alert("查找内容与替换内容一样!")
return false;
}
obj = {
searchStr : findtxt,
casesensitive : getMatchCase("matchCase1"),
replaceStr : replacetxt,
all : true
};
var num = frCommond(obj);
if(num){
alert("总共替换了"+num+"个");
}
if(!num){
alert("没有可替换的内容");
}
}
//执行
var frCommond = function(obj){
return editor.execCommand("searchreplace",obj);
}
toggletab();
</script>
</body>
</html> | 10npsite | trunk/guanli/system/ueditor/dialogs/searchreplace/searchreplace.html | HTML | asf20 | 9,480 |
/* common layer */
.edui-box { border: none; padding: 0; margin: 0; overflow: hidden; }
a.edui-box { display: block; text-decoration: none; color: black; }
a.edui-box:hover { text-decoration: none; }
a.edui-box:active { text-decoration: none; }
table.edui-box { border-collapse: collapse; }
ul.edui-box { list-style-type: none; }
div.edui-box { position: relative; display: -moz-inline-box!important; display: inline-block!important; vertical-align: top; }
.edui-clearfix { zoom:1 }
.edui-clearfix:after { content: '\20'; display: block; clear: both; }
* html div.edui-box { display: inline!important; }
*:first-child+html div.edui-box { display: inline!important; }
/* control layout */
.edui-button-body, .edui-splitbutton-body, .edui-menubutton-body, .edui-combox-body { position: relative; }
.edui-popup { position: absolute; -webkit-user-select: none; -moz-user-select: none; }
.edui-popup .edui-shadow { position: absolute; z-index: -1; }
.edui-popup .edui-bordereraser { position: absolute; overflow: hidden; }
.edui-tablepicker .edui-canvas { position: relative; }
.edui-tablepicker .edui-canvas .edui-overlay { position: absolute; }
.edui-dialog-modalmask, .edui-dialog-dragmask { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.edui-toolbar { position: relative; }
/*
* default theme
*/
.edui-label {
cursor: default;
}
span.edui-clickable {
color: blue;
cursor: pointer;
text-decoration: underline;
}
span.edui-unclickable {
color: gray;
cursor:default;
}
/* popup */
.edui-popup {
z-index: 3000;
}
.edui-popup .edui-shadow {
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: black;
box-shadow: 3px 3px 5px #818181;
-webkit-box-shadow: 3px 3px 5px #818181;
-moz-box-shadow: 3px 3px 5px #818181;
-ms-filter: 'progid:DXImageTransform.Microsoft.Blur(PixelRadius='3', MakeShadow='true', ShadowOpacity='0.5')';
filter: progid:DXImageTransform.Microsoft.Blur(PixelRadius='3', MakeShadow='true', ShadowOpacity='0.5');
}
.edui-popup-content {
border: 1px solid gray;
background-color: white;
padding: 5px;
}
.edui-popup .edui-bordereraser {
background-color: white;
height: 3px;
}
.edui-menu .edui-bordereraser {
background-color: #f1f1f1;
height: 3px;
}
.edui-anchor-topleft .edui-bordereraser {
left: 1px;
top: -2px;
}
.edui-anchor-topright .edui-bordereraser {
right: 1px;
top: -2px;
}
.edui-anchor-bottomleft .edui-bordereraser {
left: 0;
bottom: -6px;
height: 7px;
border-left: 1px solid gray;
border-right: 1px solid gray;
}
.edui-anchor-bottomright .edui-bordereraser {
right: 0;
bottom: -6px;
height: 7px;
border-left: 1px solid gray;
border-right: 1px solid gray;
}
/* menu */
.edui-menu {
z-index: 3000;
}
.edui-menu .edui-popup-content {
background-color: white;
padding: 3px;
}
.edui-menu-body {
_width: 150px;
min-width: 150px;
background: url("images/menu/sparator_v.png") repeat-y 25px;
}
.edui-menuitem-body {
}
.edui-menuitem {
height: 20px;
cursor: default;
vertical-align: top;
}
.edui-menuitem .edui-icon {
width: 20px;
height: 20px;
background: url(images/icons.png) 0 -40px;
background: url(images/icons.gif) 0 -40px\9;
}
.edui-menuitem .edui-label {
font-size: 12px;
line-height: 20px;
height: 20px;
padding-left: 10px;
padding-right: 20px;
}
.edui-state-checked .edui-menuitem-body {
background: url("images/icons-all.gif") no-repeat 6px -205px;
}
.edui-state-disabled .edui-menuitem-label {
color: gray;
}
.edui-state-disabled .edui-icon {
opacity: 0.3;
-ms-filter: 'alpha(opacity=30)';
filter: alpha(opacity=30);
}
/*by taoqili*/
.edui-state-disabled .edui-label {
color: gray;
}
.edui-hassubmenu .edui-arrow {
height: 20px;
width: 20px;
float: right;
background: url("images/icons-all.gif") no-repeat 10px -233px;
}
.edui-menu-body .edui-menuitem {
padding: 1px;
}
.edui-menuseparator {
margin: 2px 0;
height: 1px;
overflow: hidden;
}
.edui-menuseparator-inner {
border-bottom: 1px solid #e2e3e3;
margin-left: 29px;
margin-right: 1px;
}
.edui-menu-body .edui-state-hover {
padding: 0 !important;
background-color: #fff5d4;
border: 1px solid #dcac6c;
}
/* dialog */
.edui-dialog {
z-index: 2000;
position: absolute;
}
.edui-dialog-wrap {
margin-right: 6px;
margin-bottom: 6px;
border: 1px solid #c6c6c6;
}
.edui-dialog-body {
position: relative;
background-color: white;
_zoom: 1;
}
.edui-dialog-shadow {
position: absolute;
z-index: -1;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: black;
box-shadow: 3px 3px 5px #818181;
-webkit-box-shadow: 3px 3px 5px #818181;
-moz-box-shadow: 3px 3px 5px #818181;
-ms-filter: 'progid:DXImageTransform.Microsoft.Blur(PixelRadius='3', MakeShadow='true', ShadowOpacity='0.5')';
filter: progid:DXImageTransform.Microsoft.Blur(PixelRadius='3', MakeShadow='true', ShadowOpacity='0.5');
}
.edui-dialog-foot {
background-color: white;
}
.edui-dialog-titlebar {
height: 26px;
border-bottom: 1px solid #c6c6c6;
background: url(images/dialog-title-bg.png) repeat-x bottom;
position: relative;
cursor: move;
}
.edui-dialog-caption {
font-weight: bold;
font-size: 12px;
line-height: 26px;
padding-left: 5px;
}
.edui-dialog-draghandle {
height: 26px;
}
.edui-dialog-closebutton {
position: absolute !important;
right: 5px;
top: 3px;
}
.edui-dialog-closebutton .edui-button-body {
height: 20px;
width: 20px;
cursor: pointer;
background: url("images/icons-all.gif") no-repeat 0 -59px;
}
.edui-dialog-closebutton .edui-state-hover .edui-button-body {
background: url("images/icons-all.gif") no-repeat 0 -89px;
}
.edui-dialog-foot {
height: 40px;
}
.edui-dialog-buttons {
position: absolute;
right: 0;
}
.edui-dialog-buttons .edui-button {
margin-right: 10px;
}
.edui-dialog-buttons .edui-button .edui-button-body {
background: url("images/icons-all.gif") no-repeat;
height: 24px;
width: 96px;
font-size: 12px;
line-height: 24px;
text-align: center;
cursor: default;
}
.edui-dialog-buttons .edui-button .edui-state-hover .edui-button-body {
background: url("images/icons-all.gif") no-repeat 0 -30px;
}
.edui-dialog iframe {
border: 0;
padding: 0;
margin: 0;
vertical-align: top;
}
.edui-dialog-modalmask {
opacity: 0.3;
filter: alpha(opacity=30);
background-color: #ccc;
position: absolute;
/*z-index: 1999;*/
}
.edui-dialog-dragmask {
position: absolute;
/*z-index: 2001;*/
background-color: transparent;
cursor: move;
}
.edui-dialog-content {
position: relative;
}
/* color picker */
.edui-colorpicker-topbar {
height: 27px;
width: 200px;
/*border-bottom: 1px gray dashed;*/
}
.edui-colorpicker-preview {
height: 20px;
border: 1px inset black;
margin-left: 1px;
width: 128px;
float: left;
}
.edui-colorpicker-nocolor {
float: right;
margin-right: 1px;
font-size: 12px;
line-height: 14px;
height: 14px;
border: 1px solid #333;
padding: 3px 5px;
cursor: pointer;
}
.edui-colorpicker-tablefirstrow {
height: 30px;
}
.edui-colorpicker-colorcell {
width: 14px;
height: 14px;
display: block;
margin: 0;
cursor: pointer;
}
.edui-colorpicker-colorcell:hover {
width: 14px;
height: 14px;
margin: 0;
}
/* tablepicker */
.edui-tablepicker .edui-infoarea {
height: 14px;
line-height: 14px;
font-size: 12px;
width: 220px;
margin-bottom: 3px;
clear: both;
}
.edui-tablepicker .edui-infoarea .edui-label {
float: left;
}
.edui-tablepicker .edui-infoarea .edui-clickable {
float: right;
}
.edui-tablepicker .edui-pickarea {
background: url("images/tablepicker/unhighlighted.gif") repeat;
height: 220px;
width: 220px;
}
.edui-tablepicker .edui-pickarea .edui-overlay {
background: url("images/tablepicker/highlighted.gif") repeat;
}
/*autotypeset*/
.edui-autotypesetpicker .edui-autotypesetpicker-body{
font-size: 12px;
width: 340px;
margin-bottom: 3px;
clear: both;
}
/* toolbar */
.edui-toolbar {
cursor: default;
-webkit-user-select: none;
-moz-user-select: none;
padding: 1px;
}
.edui-toolbar .edui-button,
.edui-toolbar .edui-splitbutton,
.edui-toolbar .edui-menubutton,
.edui-toolbar .edui-combox {
margin: 1px ;
}
/* toolbar sparator */
.edui-toolbar .edui-separator {
width: 2px;
height: 20px;
margin: 2px 4px 2px 3px;
background: url(images/icons.png) -180px 0;
background: url(images/icons.gif) -180px 0\9;
}
/* toolbar button */
.edui-toolbar .edui-button .edui-icon,
.edui-toolbar .edui-menubutton .edui-icon,
.edui-toolbar .edui-splitbutton .edui-icon {
height: 20px!important;
width: 20px!important;
background-image: url(images/icons.png);
background-image: url(images/icons.gif)\9;
}
.edui-toolbar .edui-button .edui-button-wrap {
padding: 1px;
position: relative;
}
.edui-toolbar .edui-button .edui-state-hover .edui-button-wrap {
background-color: #fff5d4;
padding: 0;
border: 1px solid #dcac6c;
}
.edui-toolbar .edui-button .edui-state-checked .edui-button-wrap {
background-color: #ffe69f;
padding: 0;
border: 1px solid #dcac6c;
}
.edui-toolbar .edui-button .edui-state-active .edui-button-wrap {
background-color: #ffffff;
padding: 0;
border: 1px solid gray;
}
/* toolbar splitbutton */
.edui-toolbar .edui-splitbutton-body .edui-arrow,
.edui-toolbar .edui-menubutton-body .edui-arrow{
background: url(images/icons.png) -741px 0;
_background: url(images/icons.gif) -741px 0;
height: 20px;
width: 9px;
}
.edui-toolbar .edui-splitbutton .edui-splitbutton-body,
.edui-toolbar .edui-menubutton .edui-menubutton-body{
padding: 1px;
}
.edui-toolbar .edui-splitborder{
width: 1px;
height: 20px;
}
.edui-toolbar .edui-state-hover .edui-splitborder{
width: 1px;
border-left: 0px solid #dcac6c;
}
.edui-toolbar .edui-state-active .edui-splitborder{
width: 0;
border-left: 1px solid gray;
}
.edui-toolbar .edui-state-opened .edui-splitborder{
width: 1px;
border: 0;
}
.edui-toolbar .edui-splitbutton .edui-state-hover .edui-splitbutton-body,
.edui-toolbar .edui-menubutton .edui-state-hover .edui-menubutton-body{
background-color: #fff5d4;
border: 1px solid #dcac6c;
padding: 0;
}
.edui-toolbar .edui-splitbutton .edui-state-checked .edui-splitbutton-body,
.edui-toolbar .edui-menubutton .edui-state-checked .edui-menubutton-body{
background-color: #FFE69F;
border: 1px solid #DCAC6C;
padding: 0;
}
.edui-toolbar .edui-splitbutton .edui-state-active .edui-splitbutton-body,
.edui-toolbar .edui-menubutton .edui-state-active .edui-menubutton-body{
background-color: #ffffff;
border: 1px solid gray;
padding: 0;
}
.edui-state-disabled .edui-arrow{
opacity: 0.3;
-ms-filter: 'alpha(opacity=30)';
_filter: alpha(opacity=30);
}
.edui-toolbar .edui-splitbutton .edui-state-opened .edui-splitbutton-body,
.edui-toolbar .edui-menubutton .edui-state-opened .edui-menubutton-body{
background-color: white;
border: 1px solid gray;
padding: 0;
}
.edui-for-insertorderedlist .edui-bordereraser,
.edui-for-lineheight .edui-bordereraser,
.edui-for-rowspacingtop .edui-bordereraser,
.edui-for-rowspacingbottom .edui-bordereraser,
.edui-for-insertunorderedlist .edui-bordereraser {
background-color: white;
}
/* 解决嵌套导致的图标问题 */
.edui-for-insertorderedlist .edui-popup-body .edui-icon,
.edui-for-lineheight .edui-popup-body .edui-icon,
.edui-for-rowspacingtop .edui-popup-body .edui-icon,
.edui-for-rowspacingbottom .edui-popup-body .edui-icon,
.edui-for-insertunorderedlist .edui-popup-body .edui-icon {
background-position: 0 -40px;
}
/* toolbar colorbutton */
.edui-toolbar .edui-colorbutton .edui-colorlump {
position: absolute;
overflow: hidden;
bottom: 1px;
left: 1px;
width: 18px;
height: 4px;
}
/* toolbar combox */
.edui-toolbar .edui-combox-body .edui-button-body {
width: 60px;
font-size: 12px;
height: 20px;
line-height: 20px;
padding-left: 5px;
white-space: nowrap;
}
.edui-toolbar .edui-combox-body .edui-arrow {
background: url(images/icons.png) -741px 0;
_background: url(images/icons.gif) -741px 0;
height: 20px;
width: 9px;
}
.edui-toolbar .edui-combox .edui-combox-body {
border: 1px solid #CCC;
background-color: white;
}
.edui-toolbar .edui-combox-body .edui-splitborder {
display: none;
}
.edui-toolbar .edui-combox-body .edui-arrow {
border-left: 1px solid #CCC;
}
.edui-toolbar .edui-state-hover .edui-combox-body {
background-color: #fff5d4;
border: 1px solid #dcac6c;
}
.edui-toolbar .edui-state-hover .edui-combox-body .edui-arrow {
border-left: 1px solid #dcac6c;
}
.edui-toolbar .edui-state-checked .edui-combox-body {
background-color: #FFE69F;
border: 1px solid #DCAC6C;
}
.edui-toolbar .edui-state-checked .edui-combox-body .edui-arrow {
border-left: 1px solid #DCAC6C;
}
.edui-toolbar .edui-state-disabled .edui-combox-body {
background-color: #F0F0EE;
opacity: 0.3;
-ms-filter: 'alpha(opacity=30)';
filter: alpha(opacity=30);
}
.edui-toolbar .edui-state-opened .edui-combox-body {
background-color: white;
border: 1px solid gray;
}
.edui-list .edui-bordereraser {
display: none;
}
.edui-listitem {
padding: 1px;
white-space: nowrap;
}
.edui-list .edui-state-hover {
position: relative;
background-color: #fff5d4;
border: 1px solid #dcac6c;
padding: 0;
}
.edui-for-fontfamily .edui-listitem-label {
min-width: 120px;
_width: 120px;
font-size: 12px;
height: 22px;
line-height: 22px;
padding-left: 5px;
}
.edui-for-underline .edui-listitem-label{
min-width: 120px;
_width: 120px;
padding: 3px 5px;
font-size:12px;
}
.edui-for-fontsize .edui-listitem-label {
min-width: 120px;
_width: 120px;
padding: 3px 5px;
}
.edui-for-paragraph .edui-listitem-label {
min-width: 200px;
_width: 200px;
padding: 2px 5px;
}
.edui-for-rowspacingtop .edui-listitem-label,
.edui-for-rowspacingbottom .edui-listitem-label {
min-width: 53px;
_width: 53px;
padding: 2px 5px;
}
.edui-for-lineheight .edui-listitem-label {
min-width: 53px;
_width: 53px;
padding: 2px 5px;
}
.edui-for-customstyle .edui-listitem-label {
min-width: 200px;
_width: 200px;
width:200px!important;
padding:2px 5px;
}
/* toolbar icons */
.edui-for-undo .edui-icon {
background-position: -160px 0;
}
.edui-for-redo .edui-icon {
background-position: -100px 0;
}
.edui-for-bold .edui-icon {
background-position: 0 0;
}
.edui-for-italic .edui-icon {
background-position: -60px 0;
}
.edui-for-underline .edui-icon {
background-position: -140px 0;
}
.edui-for-strikethrough .edui-icon {
background-position: -120px 0;
}
.edui-for-subscript .edui-icon {
background-position: -600px 0;
}
.edui-for-superscript .edui-icon {
background-position: -620px 0;
}
.edui-for-blockquote .edui-icon {
background-position: -220px 0;
}
.edui-for-forecolor .edui-icon {
background-position: -720px 0;
}
.edui-for-backcolor .edui-icon {
background-position: -760px 0;
}
.edui-for-inserttable .edui-icon {
background-position: -580px -20px;
}
.edui-for-autotypeset .edui-icon {
background-position: -640px -40px;
}
.edui-for-justifyleft .edui-icon {
background-position: -460px 0;
}
.edui-for-justifycenter .edui-icon {
background-position: -420px 0;
}
.edui-for-justifyright .edui-icon {
background-position: -480px 0;
}
.edui-for-justifyjustify .edui-icon {
background-position: -440px 0;
}
.edui-for-insertorderedlist .edui-icon {
background-position: -80px 0;
}
.edui-for-insertunorderedlist .edui-icon {
background-position: -20px 0;
}
.edui-for-lineheight .edui-icon {
background-position: -725px -40px;
}
.edui-for-rowspacingbottom .edui-icon {
background-position: -745px -40px;
}
.edui-for-rowspacingtop .edui-icon {
background-position: -765px -40px;
}
.edui-for-horizontal .edui-icon {
background-position: -360px 0;
}
.edui-for-link .edui-icon {
background-position: -500px 0;
}
.edui-for-code .edui-icon {
background-position: -440px -40px;
}
.edui-for-insertimage .edui-icon {
background-position: -380px 0;
}
.edui-for-insertframe .edui-icon {
background-position: -240px -40px;
}
.edui-for-emoticon .edui-icon {
background-position: -60px -20px;
}
.edui-for-spechars .edui-icon {
background-position: -240px 0;
}
.edui-for-help .edui-icon {
background-position: -340px 0;
}
.edui-for-print .edui-icon {
background-position: -440px -20px;
}
.edui-for-preview .edui-icon {
background-position: -420px -20px;
}
.edui-for-selectall .edui-icon {
background-position: -400px -20px;
}
.edui-for-searchreplace .edui-icon {
background-position: -520px -20px;
}
.edui-for-map .edui-icon {
background-position: -40px -40px;
}
.edui-for-gmap .edui-icon {
background-position: -260px -40px;
}
.edui-for-insertvideo .edui-icon {
background-position: -320px -20px;
}
.edui-for-time .edui-icon {
background-position: -160px -20px;
}
.edui-for-date .edui-icon {
background-position: -140px -20px;
}
.edui-for-cut .edui-icon {
background-position: -680px 0;
}
.edui-for-copy .edui-icon {
background-position: -700px 0;
}
.edui-for-paste .edui-icon {
background-position: -560px 0;
}
.edui-for-formatmatch .edui-icon {
background-position: -40px 0;
}
.edui-for-pasteplain .edui-icon {
background-position: -360px -20px;
}
.edui-for-directionalityltr .edui-icon {
background-position: -20px -20px;
}
.edui-for-directionalityrtl .edui-icon {
background-position: -40px -20px;
}
.edui-for-source .edui-icon {
background-position: -260px -0px;
}
.edui-for-removeformat .edui-icon {
background-position: -580px 0;
}
.edui-for-unlink .edui-icon {
background-position: -640px 0;
}
.edui-for-insertrow .edui-icon {
background-position: -740px -20px;
}
.edui-for-insertcol .edui-icon {
background-position: -700px -20px;
}
.edui-for-mergeright .edui-icon {
background-position: -60px -40px;
}
.edui-for-mergedown .edui-icon {
background-position: -80px -40px;
}
.edui-for-splittorows .edui-icon {
background-position: -100px -40px;
}
.edui-for-splittocols .edui-icon {
background-position: -120px -40px;
}
.edui-for-insertparagraphbeforetable .edui-icon {
background-position: -140px -40px;
}
.edui-for-deleterow .edui-icon {
background-position: -660px -20px;
}
.edui-for-deletecol .edui-icon {
background-position: -640px -20px;
}
.edui-for-splittocells .edui-icon {
background-position: -800px -20px;
}
.edui-for-mergecells .edui-icon {
background-position: -760px -20px;
}
.edui-for-deletetable .edui-icon {
background-position: -620px -20px;
}
.edui-for-cleardoc .edui-icon {
background-position: -520px 0;
}
.edui-for-fullscreen .edui-icon {
background-position: -100px -20px;
}
.edui-for-anchor .edui-icon {
background-position: -200px 0;
}
.edui-for-pagebreak .edui-icon {
background-position: -460px -40px;
}
.edui-for-imagenone .edui-icon {
background-position: -480px -40px;
}
.edui-for-imageleft .edui-icon {
background-position: -500px -40px;
}
.edui-for-wordimage .edui-icon {
background-position: -660px -40px;
}
.edui-for-imageright .edui-icon {
background-position: -520px -40px;
}
.edui-for-imagecenter .edui-icon {
background-position: -540px -40px;
}
.edui-for-indent .edui-icon {
background-position: -400px 0;
}
.edui-for-outdent .edui-icon {
background-position: -540px 0;
}
.edui-for-table .edui-icon {
background-position: -580px -20px;
}
.edui-for-edittable .edui-icon {
background-position: -420px -40px;
}
.edui-for-delete .edui-icon {
background-position: -360px -40px;
}
.edui-for-highlightcode .edui-icon{
background-position: -440px -40px;
}
.edui-for-deletehighlightcode .edui-icon{
background-position: -360px -40px;
}
.edui-for-attachment .edui-icon{
background-position: -620px -40px;
}
.edui-for-edittd .edui-icon {
background-position: -700px -40px;
}
.edui-for-snapscreen .edui-icon {
background-position: -581px -40px
}
/*link-dialog*/
.edui-for-link .edui-dialog-content {
width:420px;
height:150px;
overflow: hidden;
}
/*emoticon-dialog*/
.edui-for-emoticon .edui-dialog-content{
width:515px;
*width:506px;
height:360px;
}
/*spechars-dialog*/
.edui-for-spechars .edui-dialog-content{
width:620px;
height:500px;
}
/*image-dialog*/
.edui-for-insertimage .edui-dialog-content {
width:640px;
height:390px;
overflow: hidden;
}
/*image-insertframe*/
.edui-for-insertframe .edui-dialog-content {
width:350px;
height:200px;
overflow: hidden;
}
/*wordImage-dialog*/
.edui-for-wordimage .edui-dialog-content {
width:620px;
height:380px;
overflow: hidden;
}
/*attachment-dialog*/
.edui-for-attachment .edui-dialog-content {
width:480px;
height:360px;
overflow: hidden;
}
/*code-dialog*/
.edui-for-highlightcode .edui-dialog-content {
width:550px;
height:360px;
overflow: hidden;
}
/*map-dialog*/
.edui-for-map .edui-dialog-content {
width:550px;
height:400px;
}
/*gmap-dialog*/
.edui-for-gmap .edui-dialog-content {
width:550px;
height:400px;
}
/*video-dialog*/
.edui-for-insertvideo .edui-dialog-content {
width:590px;
height:390px;
}
/*anchor-dialog*/
.edui-for-anchor .edui-dialog-content {
width:320px;
height:60px;
overflow: hidden;
}
/*searchreplace-dialog*/
.edui-for-searchreplace .edui-dialog-content {
width:400px;
height:180px;
}
/*help-dialog*/
.edui-for-help .edui-dialog-content {
width:400px;
height:420px;
}
/*table-dialog*/
.edui-for-inserttable .edui-dialog-content {
width:510px;
height:275px;
}
/*td-dialog*/
.edui-for-edittd .edui-dialog-content {
width:220px;
height:125px;
}
/*snapscreen-dialog*/
.edui-for-snapscreen .edui-dialog-content {
width:400px;
height:220px;
}
/*for wordimage*/
.edui-editor-toolbarmsg-upload{
font-size: 14px;
color: blue;
width: 100px;
height: 16px;
line-height:16px;
cursor:pointer;
position:absolute;
top:5px;
left:350px;
}
.edui-for-paragraph .edui-listitem-label .edui-for-p{
font-size: 22px;
font-family: Tahoma,Verdana,Arial,Helvetica;
}
.edui-for-paragraph .edui-listitem-label .edui-for-h1{
font-weight: bolder;
font-size: 1.9em;
font-family: Tahoma,Verdana,Arial,Helvetica;
}
.edui-for-paragraph .edui-listitem-label .edui-for-h2{
font-weight: bolder;
font-size: 1.5em;
font-family: Tahoma,Verdana,Arial,Helvetica;
}
.edui-for-paragraph .edui-listitem-label .edui-for-h3{
font-weight: bolder;
font-size: 1.17em;
font-family: Tahoma,Verdana,Arial,Helvetica;
}
.edui-for-paragraph .edui-listitem-label .edui-for-h4{
font-weight: bolder;
font-size: 1em;
font-family: Tahoma,Verdana,Arial,Helvetica;
}
.edui-for-paragraph .edui-listitem-label .edui-for-h5{
font-weight: bolder;
font-size: 0.83em;
font-family: Tahoma,Verdana,Arial,Helvetica;
}
.edui-for-paragraph .edui-listitem-label .edui-for-h6{
font-weight: bolder;
font-size: .75em;
font-family: Tahoma,Verdana,Arial,Helvetica;
}
/* ui.Editor */
.edui-editor {
border: 1px solid #ccc;
background-color: white;
position: relative;
overflow: visible;
}
.edui-editor-toolbarbox {
position: relative;
zoom: 1;
}
.edui-editor-toolbarboxouter {
border-bottom: 1px solid #ccc;
background: white url(images/toolbar_bg.png) repeat-x bottom left;
}
.edui-editor-toolbarboxinner {
padding: 2px;
}
.edui-editor-iframeholder {
position: relative;
/*for fix ie6 toolbarmsg under iframe bug. relative -> static */
/*_position: static !important;*/
}
.edui-editor-iframeholder textarea {
font-family: consolas, "Courier New", "lucida console", monospace;
font-size: 12px;
line-height: 18px;
}
.edui-editor-bottombar {
/*border-top: 1px solid #ccc;*/
/*height: 20px;*/
/*width: 40%;*/
/*float: left;*/
/*overflow: hidden;*/
}
.edui-editor-bottomContainer{overflow:hidden;}
.edui-editor-bottomContainer table{width:100%;height:0;overflow:hidden;border-spacing:0;border-collapse:collapse;}
.edui-editor-bottomContainer td{white-space:nowrap;border-top: 1px solid #ccc;line-height: 20px;font-size:12px;font-family: Arial,Helvetica,Tahoma,Verdana,Sans-Serif;}
.edui-editor-wordcount{
text-align: right;
margin-right: 5px;
color: #aaa;
}
.edui-editor-breadcrumb {
margin: 2px 0 0 3px;
}
.edui-editor-breadcrumb span {
cursor: pointer;
text-decoration: underline;
color: blue;
}
.edui-toolbar .edui-for-fullscreen {
float: right;
}
.edui-bubble .edui-popup-content {
border: 1px solid #DCAC6C;
background-color: #fff6d9;
padding: 5px;
font-size: 10pt;
font-family: "宋体";
}
.edui-bubble .edui-shadow {
box-shadow: 1px 1px 3px #818181;
-webkit-box-shadow: 2px 2px 3px #818181;
-moz-box-shadow: 2px 2px 3px #818181;
-ms-filter: 'progid:DXImageTransform.Microsoft.Blur(PixelRadius='2', MakeShadow='true', ShadowOpacity='0.5')';
filter: progid:DXImageTransform.Microsoft.Blur(PixelRadius='2', MakeShadow='true', ShadowOpacity='0.5');
}
.edui-editor-toolbarmsg {
background-color: #FFF6D9;
border-bottom: 1px solid #ccc;
position: absolute;
bottom:-25px;
left:0;
z-index: 1009;
width: 99.9%;
}
.edui-editor-toolbarmsg-label {
font-size: 12px;
line-height: 16px;
padding: 4px;
}
.edui-editor-toolbarmsg-close {
float: right;
width: 20px;
height: 16px;
line-height:16px;
cursor:pointer;
color:red;
}
/**for edui-emotion-menu*/
.edui-for-emotion .edui-icon {background-position: -60px -20px;}
.edui-for-emotion .edui-popup-content{position: relative;z-index: 555}
.edui-for-emotion .edui-popup-content iframe{width:514px;height:367px;overflow:hidden;}
.edui-for-emotion .edui-splitborder{display:none}
.edui-for-emotion .edui-splitbutton-body .edui-arrow{width:0} /*去除了表情的下拉箭头*/
/* 日期选择控件 */
.tangram-calendar {
height: 164px;
width: 178px;
font-size:12px;
text-align: center;
border: 5px solid #EEEEEE;
}
.tangram-calendar-title {
position: relative;
background-color: #EEEEEE;
}
.tangram-calendar-label{
width: 100%;/*ie必要*/
background-color: #EEEEEE;
}
.tangram-calendar-prev {
position: absolute;
text-align: center;
cursor: pointer;
left: 0px;
top: 0px;
width: 30px;
}
.tangram-calendar-next{
position: absolute;
text-align: center;
cursor: pointer;
right: 0px;
top: 0px;
width: 30px;
}
.tangram-calendar-table {
width: 100%;
height: 100%;
}
.tangram-calendar-week td{
cursor: default;
font-weight: bold;
font-size:12px;
background-color: #EEEEEE;
}
.tangram-calendar-date td{
cursor:pointer;
text-align: center;
border: 1px solid #FAFAFA;
}
td.tangram-calendar-date-current{
border: 1px solid #A00000;
}
.tangram-calendar-date-other{
color: #ccc;
}
.tangram-calendar-disabled{
background: #CCCCCC;
}
.tangram-calendar-date-disable{
background: gray;
}
td.tangram-calendar-hover{
border: 1px solid blue;
}
| 10npsite | trunk/guanli/system/ueditor/themes/default/ueditor.css | CSS | asf20 | 28,780 |
/*可以在这里添加你自己的css*/ | 10npsite | trunk/guanli/system/ueditor/themes/default/iframe.css | CSS | asf20 | 40 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title></title>
<script type="text/javascript" charset="utf-8" src="../editor_config.js"></script>
<script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
<style type="text/css">
#editor {
border: 1px solid #CCC;
width: 1000px
}
#editor_toolbar_box {
background: #F0F0EE;
padding: 2px;
}
#editor_iframe_holder {
border-top: 1px solid #CCC;
border-bottom: 1px solid #CCC;
}
</style>
</head>
<body>
<h1>UEditor自定义toolbar</h1>
<div id="editor">
<div id="editor_toolbar_box">
<div id="editor_toolbar">
<input id="bold" type="button" value="加粗" onclick="myeditor.execCommand('bold')" style="height:24px;line-height:20px"/>
<input id="italic" type="button" value="加斜" onclick="myeditor.execCommand('italic')" style="height:24px;line-height:20px"/>
<select id="fontfamily" onchange="myeditor.execCommand('fontfamily',this.value)">
<option value="宋体,simsun">宋体</option>
<option value="楷体,楷体_gb2312,simkai">楷体</option>
<option value="隶书,simli">隶书</option>
<option value="黑体,simhei">黑体</option>
<option value="andale mono,times">andale mono</option>
<option value="arial,helvetica,sans-serif">arial</option>
<option value="arial black,avant garde">arial black</option>
<option value="comic sans ms,sans-serif">comic sans ms</option>
</select>
<select id="fontsize" onchange="myeditor.execCommand('fontsize',this.value)">
<option value="10pt">10pt</option>
<option value="11pt">11pt</option>
<option value="12pt">12pt</option>
<option value="14pt">14pt</option>
<option value="16pt">16pt</option>
<option value="18pt">18pt</option>
<option value="20pt">20pt</option>
<option value="22pt">22pt</option>
<option value="24pt">24pt</option>
<option value="36pt">36pt</option>
</select>
<input type="button" value="插入html" onclick="insert()" style="height:24px;line-height:20px"/>
<input type="button" value="清除格式" onclick="myeditor.execCommand('removeformat')" style="height:24px;line-height:20px"/>
<input type="button" value="获得编辑器内容" onclick="alert(myeditor.getContent())" style="height:24px;line-height:20px"/>
<input type="button" value="获得编辑器纯文本内容" onclick="alert(myeditor.getContentTxt())" style="height:24px;line-height:20px"/>
</div>
</div>
<div id="editor_iframe_holder" style="height:400px;"></div>
</div>
<script type="text/javascript" charset="utf-8">
//editor的属性
var option = {
initialContent: '初始化内容',//初始化编辑器的内容
minFrameHeight: 200
};
//实例化一个不带ui的编辑器,注意此处的实例化对象是baidu.editor下的Editor,而非baidu.editor.ui下的Editor
var myeditor = new baidu.editor.Editor(option);
//给编辑器增加一个选中改变的事件,用来判断所选内容以及状态
myeditor.addListener('selectionchange', function (){
var cmdName = ['bold','italic'],//命令列表
fontName = ['fontfamily','fontsize'];//字体设置下拉框列表,此处选择其中两个
//查询每个命令当前的状态,并设置对应状态样式
var i =-1;
while(i++ < cmdName.length-1){
var state = myeditor.queryCommandState(cmdName[i]);
if(state == 1){ //高亮
document.getElementById(cmdName[i]).style.color = "red";
}else{
document.getElementById(cmdName[i]).style.color = "";
}
}
//依据当前光标所在的字体改变下拉列表的选中值
i = -1;
while(i++<fontName.length-1){
var fstate = myeditor.queryCommandValue(fontName[i]).toLowerCase();
var fselect = document.getElementById(fontName[i]);
for(var j= 0;j<fselect.options.length;j++){
if(fselect.options[j].value.toLowerCase().indexOf(fstate.split(",")[0])!=-1){
fselect.options[j].selected = "true";
}
}
}
});
//渲染编辑器
myeditor.render('editor_iframe_holder');
//插入文本
function insert(){
var insertTxt = "插入的文本";
insertTxt = prompt("插入的内容",insertTxt);
if(insertTxt){
myeditor.execCommand("inserthtml",insertTxt);
}
}
function execUnderline(cmd){
myeditor.execCommand(cmd);
}
</script>
</body>
</html> | 10npsite | trunk/guanli/system/ueditor/_examples/customToolbarDemo.html | HTML | asf20 | 5,607 |
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style type="text/css">
h3{
color:#630000;
}
ul li{
margin: 10px;
}
a:link,a:active,a:visited{
color: #0000EE;
}
</style>
</head>
<body>
<h2>UEditor各种实例演示</h2>
<h3>基础示例</h3>
<ul>
<li>
<a href="simpleDemo.html" target="_self">简单示例</a><br/>
使用基础的按钮实现简单的功能
</li>
</ul>
<h3>应用展示</h3>
<ul>
<li>
<a href="customPluginDemo.html" target="_self">自定义插件</a><br/>
在编辑器的基础上开发自己的插件
</li>
<li>
<a href="submitFormDemo.html" target="_self">表单应用</a><br/>
编辑器的内容通过表单提交到后台
</li>
<li>
<a href="resetDemo.html" target="_self">重置编辑器</a><br/>
将编辑器的内部变量清空,重置。
</li>
<li>
<a href="textareaDemo.html" target="_self">文本域渲染编辑器</a><br/>
将编辑器渲染到文本域,并且将文本域的内容放到编辑器的初始化内容里
</li>
</ul>
<h3>高级案例</h3>
<ul>
<li>
<a href="completeDemo.html" target="_self">完整示例</a><br/>
编辑器的完整功能
</li>
<li>
<a href="multiDemo.html" target="_self">多编辑器实例</a><br/>
一个页面实例化多个编辑器,互不影响
</li>
<li>
<a href="customToolbarDemo.html" target="_self">自定义Toolbar</a><br/>
用自己的皮肤,设计自己的编辑器
</li>
<li>
<a href="highlightDemo.html" target="_self">代码高亮</a><br/>
代码高亮展示及其编辑
</li>
</ul>
</body>
</html> | 10npsite | trunk/guanli/system/ueditor/_examples/index.html | HTML | asf20 | 1,931 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title></title>
<script type="text/javascript" charset="utf-8" src="../editor_config.js"></script>
<!--加入高亮的js和css文件,如果你的编辑器和展示也是一个页面那么高亮的js可以不加载-->
<script type="text/javascript" charset="utf-8" src="../third-party/SyntaxHighlighter/shCore.js"></script>
<link rel="stylesheet" type="text/css" href="../third-party/SyntaxHighlighter/shCoreDefault.css"/>
<!--开发版-->
<script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
<link rel="stylesheet" type="text/css" href="../themes/default/ueditor.css"/>
</head>
<body>
<h1>代码高亮演示</h1>
<h2>页面上已经有的代码</h2>
<div style="width:200px">
<pre class="brush:js;toolbar:false;">
var editor_a = new baidu.editor.ui.Editor();
editor_a.render( 'myEditor' );
</pre>
<pre class="brush:js;toolbar:false;">
function adjustList(list,tag,style){
var nextList = list.nextSibling;
if(nextList && nextList.nodeType == 1 && nextList.tagName.toLowerCase() == tag && (domUtils.getStyle(nextList,'list-style-type')||(tag == 'ol'?'decimal' : 'disc')) == style){
domUtils.moveChild(nextList,list);
if(nextList.childNodes.length == 0){
domUtils.remove(nextList);
}
}
var preList = list.previousSibling;
}
</pre>
</div>
<!--style给定宽度可以影响编辑器的最终宽度-->
<script type="text/plain" id="myEditor" style="width:500px">
<pre class="brush:js;toolbar:false;">
function adjustList(list,tag,style){
var nextList = list.nextSibling;
if(nextList && nextList.nodeType == 1 && nextList.tagName.toLowerCase() == tag && (domUtils.getStyle(nextList,'list-style-type')||(tag == 'ol'?'decimal' : 'disc')) == style){
domUtils.moveChild(nextList,list);
if(nextList.childNodes.length == 0){
domUtils.remove(nextList);
}
}
}
</pre>
</script>
<script type="text/javascript">
//为了在编辑器之外能展示高亮代码
SyntaxHighlighter.highlight();
//调整左右对齐
for(var i=0,di;di=SyntaxHighlighter.highlightContainers[i++];){
var tds = di.getElementsByTagName('td');
for(var j=0,li,ri;li=tds[0].childNodes[j];j++){
ri = tds[1].firstChild.childNodes[j];
ri.style.height = li.style.height = ri.offsetHeight + 'px';
}
}
var editor_a = new baidu.editor.ui.Editor();
editor_a.render( 'myEditor' );
</script>
</body>
</html>
| 10npsite | trunk/guanli/system/ueditor/_examples/highlightDemo.html | HTML | asf20 | 2,895 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title></title>
<script type="text/javascript" charset="utf-8" src="../editor_config.js"></script>
<!--使用版-->
<!--<script type="text/javascript" charset="utf-8" src="../editor_all.js"></script>-->
<!--开发版-->
<script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
<link rel="stylesheet" type="text/css" href="../themes/default/ueditor.css"/>
<style>
body{
font-size:14px;
}
</style>
</head>
<body>
<h1>UEditor提交示例</h1>
<form id="form" method="post" action="../server/submit/php/getContent.php">
<p style="color:red">给容器name,那么在后台就可以按着name给的键值在后台一次取的编辑器的值</p>
<!--style给定宽度可以影响编辑器的最终宽度-->
<script type="text/plain" id="myEditor" name="myEditor"style="width:1000px">
<p>这里我可以写一些输入提示<img src="http://ueditor.baidu.com/img/logo.png" alt=""></p>
</script>
<p> </p>
<textarea id="myEditor1" name="myEditor1" style="width:600px;">编辑器2</textarea>
<p>直接提交<input type="submit" id="submitInner" value="表单内部提交" /></p>
</form>
手动调用form的submit方法提交需要使用sync方法<input type="button" value="手动提交" onclick="sync()" />
<script type="text/javascript">
var editor_a = new baidu.editor.ui.Editor();
editor_a.render( 'myEditor' );
var editor_a1 = new baidu.editor.ui.Editor();
editor_a1.render( 'myEditor1' );
//同步
function sync(){
editor_a.sync();
editor_a1.sync();
document.getElementById('form').submit()
}
</script>
</body>
</html>
| 10npsite | trunk/guanli/system/ueditor/_examples/submitFormDemo.html | HTML | asf20 | 2,062 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title></title>
<script type="text/javascript" charset="utf-8" src="../editor_config.js"></script>
<!--使用版-->
<!--<script type="text/javascript" charset="utf-8" src="../editor_all.js"></script>-->
<!--开发版-->
<script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
<link rel="stylesheet" type="text/css" href="../themes/default/ueditor.css"/>
</head>
<body>
<h1>UEditor简单功能</h1>
<!--style给定宽度可以影响编辑器的最终宽度-->
<script type="text/plain" id="myEditor" style="width:1000px">
<p>这里我可以写一些输入提示</p>
</script>
<script type="text/javascript">
// 自定义的编辑器配置项,此处定义的配置项将覆盖editor_config.js中的同名配置
var editorOption = {
//这里可以选择自己需要的工具按钮名称,此处仅选择如下五个
toolbars:[['FullScreen', 'Source', 'Undo', 'Redo','Bold']],
//focus时自动清空初始化时的内容
autoClearinitialContent:true,
//关闭字数统计
wordCount:false,
//关闭elementPath
elementPathEnabled:false
//更多其他参数,请参考editor_config.js中的配置项
};
var editor_a = new baidu.editor.ui.Editor(editorOption);
editor_a.render( 'myEditor' );
</script>
</body>
</html>
| 10npsite | trunk/guanli/system/ueditor/_examples/simpleDemo.html | HTML | asf20 | 1,687 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title></title>
<script type="text/javascript" charset="utf-8" src="../editor_config.js"></script>
<!--开发版-->
<script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
<link rel="stylesheet" type="text/css" href="../themes/default/ueditor.css"/>
</head>
<body>
<h1>UEditor多实例</h1>
<!--style给定宽度可以影响编辑器的最终宽度-->
<script type="text/plain" id="myEditor" style="width:800px">
</script>
<script type="text/plain" id="myEditor1" style="width:800px">
<p>这里我可以写一些输入提示</p>
</script>
<script type="text/javascript">
var editor_a = new baidu.editor.ui.Editor();
editor_a.render( 'myEditor' );
var editor_a1 = new baidu.editor.ui.Editor({
//这里可以选择自己需要的工具按钮名称,此处仅选择如下五个
toolbars:[['FullScreen', 'Source', 'Undo', 'Redo','Bold']],
//focus时自动清空初始化时的内容
autoClearinitialContent:true,
//关闭字数统计
wordCount:false,
//关闭elementPath
elementPathEnabled:false
//更多其他参数,请参考editor_config.js中的配置项
});
editor_a1.render( 'myEditor1' );
</script>
</body>
</html>
| 10npsite | trunk/guanli/system/ueditor/_examples/multiDemo.html | HTML | asf20 | 1,524 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title></title>
<script type="text/javascript" charset="utf-8" src="../editor_config.js"></script>
<!--使用版-->
<!--<script type="text/javascript" charset="utf-8" src="../editor_all.js"></script>-->
<!--开发版-->
<script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
<link rel="stylesheet" type="text/css" href="../themes/default/ueditor.css"/>
</head>
<body>
<h1>UEditor自定义插件</h1>
<!--style给定宽度可以影响编辑器的最终宽度-->
<script type="text/plain" id="myEditor" style="width:1000px">
<p><img src="http://ueditor.baidu.com/img/logo.png" alt=""></p>
<p>插件描述:选中图片,在其上单击,会改变图片的边框!</p>
</script>
<script type="text/javascript">
var editor_a = new baidu.editor.ui.Editor();
editor_a.render( 'myEditor' );
//创建一个在选中的图片单击时添加边框的插件,其实质就是在baidu.editor.plugins塞进一个闭包
baidu.editor.plugins["addborder"] = function () {
var me = editor_a; //在此处添加的插件由于没有经过render操作将editor实例传入,因此需要手动传入editor_a对象,如果按照官网教程来做,此处的editor_a使用this对象替换即可
//创建一个改变图片边框的命令
me.commands["addborder"] = {
execCommand:function () {
//获取当前选区
var range = me.selection.getRange();
//选区没闭合的情况下操作
if ( !range.collapsed ) {
//图片判断
var img = range.getClosedNode();
if ( img && img.tagName == "IMG" ) {
if(img.style.borderWidth == "5px" ){
img.style.borderWidth = "1px";
}else{
img.style.border = "5px solid red";
}
}
}
}
};
//注册一个触发命令的事件,同学们可以在任意地放绑定触发此命令的事件
me.addListener( 'click', function () {
me.execCommand( "addborder" );
} );
}();
</script>
</body>
</html>
| 10npsite | trunk/guanli/system/ueditor/_examples/customPluginDemo.html | HTML | asf20 | 2,543 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<title>完整demo</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<script type="text/javascript" charset="utf-8" src="../editor_config.js"></script>
<script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
<link rel="stylesheet" type="text/css" href="../themes/default/ueditor.css"/>
<style type="text/css">
textarea{
float: left;
width:300px;
height: 400px;
margin-left: 20px;
}
.clear{
clear: both;
}
</style>
</head>
<body>
<script type="text/plain" id="editor" style="width:800px;">
</script>
<div class="clear"></div>
<div id="btns">
<input type="button" value="获得内容" onclick="getContent()">
<input type="button" value="写入内容" onclick="setContent()">
<input type="button" value="获得纯文本" onclick="getContentTxt()">
<input type="button" value="判断是否有内容" onclick="hasContent()">
<input type="button" value="使编辑器获得焦点" onclick="setFocus()">
<input type="button" value="获得当前选中的文本" onclick="getText()" />
<input type="button" value="删除编辑器" onclick="ue.destroy()" />
</div>
</body>
<script type="text/javascript">
var ue = new baidu.editor.ui.Editor();
ue.render('editor');
ue.addListener("selectionchange",function(){
var state = ue.queryCommandState("source");
var btndiv = document.getElementById("btns");
if(btndiv){
if(state){
btndiv.style.display = "none";
}else{
btndiv.style.display = "";
}
}
});
function getContent(){
var arr = [];
arr.push("使用editor.getContent()方法可以获得编辑器的内容");
arr.push("内容为:");
arr.push(ue.getContent());
alert(arr.join("\n"));
}
function setContent(){
var arr = [];
arr.push("使用editor.setContent('欢迎使用ueditor')方法可以设置编辑器的内容");
ue.setContent('欢迎使用ueditor');
alert(arr.join("\n"));
}
function getText(){
//当你点击按钮时编辑区域已经失去了焦点,如果直接用getText将不会得到内容,所以要在选回来,然后取得内容
var range = ue.selection.getRange();
range.select();
var txt = ue.selection.getText();
alert(txt)
}
function getContentTxt(){
var arr = [];
arr.push("使用editor.getContentTxt()方法可以获得编辑器的纯文本内容");
arr.push("编辑器的纯文本内容为:");
arr.push(ue.getContentTxt());
alert(arr.join("\n"));
}
function hasContent(){
var arr = [];
arr.push("使用editor.hasContents()方法判断编辑器里是否有内容");
arr.push("判断结果为:");
arr.push(ue.hasContents());
alert(arr.join("\n"));
}
function setFocus(){
ue.focus();
}
</script>
</html> | 10npsite | trunk/guanli/system/ueditor/_examples/completeDemo.html | HTML | asf20 | 3,281 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title></title>
<script type="text/javascript" charset="utf-8" src="../editor_config.js"></script>
<!--使用版-->
<!--<script type="text/javascript" charset="utf-8" src="../editor_all.js"></script>-->
<!--开发版-->
<script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
<style type="text/css">
#myEditor{
width: 500px;
height: 300px;
}
</style>
<link rel="stylesheet" type="text/css" href="../themes/default/ueditor.css"/>
</head>
<body>
<h1>UEditor简单功能</h1>
<!--style给定宽度可以影响编辑器的最终宽度-->
<textarea id="myEditor">这里是原始的textarea中的内容,可以从数据中读取</textarea>
<br/>
<input type="button" onclick="render()" value="渲染编辑器">
<script type="text/javascript">
var editor_a = new baidu.editor.ui.Editor();
//渲染编辑器
function render(){
editor_a.render('myEditor');
}
</script>
</body>
</html>
| 10npsite | trunk/guanli/system/ueditor/_examples/textareaDemo.html | HTML | asf20 | 1,298 |
/**
* 开发版本的文件导入
*/
(function (){
var paths = [
'editor.js',
'core/browser.js',
'core/utils.js',
'core/EventBase.js',
'core/dom/dtd.js',
'core/dom/domUtils.js',
'core/dom/Range.js',
'core/dom/Selection.js',
'core/Editor.js',
'core/ajax.js',
'plugins/inserthtml.js',
'plugins/autotypeset.js',
'plugins/image.js',
'plugins/justify.js',
'plugins/font.js',
'plugins/link.js',
'plugins/map.js',
'plugins/iframe.js',
'plugins/removeformat.js',
'plugins/blockquote.js',
'plugins/indent.js',
'plugins/print.js',
'plugins/preview.js',
'plugins/spechars.js',
'plugins/emotion.js',
'plugins/selectall.js',
'plugins/paragraph.js',
'plugins/directionality.js',
'plugins/horizontal.js',
'plugins/time.js',
'plugins/rowspacing.js',
'plugins/lineheight.js',
'plugins/cleardoc.js',
'plugins/anchor.js',
'plugins/delete.js',
'plugins/wordcount.js',
'plugins/pagebreak.js',
'plugins/wordimage.js',
'plugins/undo.js',
'plugins/paste.js', //粘贴时候的提示依赖了UI
'plugins/list.js',
'plugins/source.js',
'plugins/shortcutkeys.js',
'plugins/enterkey.js',
'plugins/keystrokes.js',
'plugins/fiximgclick.js',
'plugins/autolink.js',
'plugins/autoheight.js',
'plugins/autofloat.js', //依赖UEditor UI,在IE6中,会覆盖掉body的背景图属性
'plugins/highlight.js',
'plugins/serialize.js',
'plugins/video.js',
'plugins/table.js',
'plugins/contextmenu.js',
'plugins/basestyle.js',
'plugins/elementpath.js',
'plugins/formatmatch.js',
'plugins/searchreplace.js',
'plugins/customstyle.js',
'plugins/catchremoteimage.js',
'plugins/snapscreen.js',
'plugins/attachment.js',
'ui/ui.js',
'ui/uiutils.js',
'ui/uibase.js',
'ui/separator.js',
'ui/mask.js',
'ui/popup.js',
'ui/colorpicker.js',
'ui/tablepicker.js',
'ui/stateful.js',
'ui/button.js',
'ui/splitbutton.js',
'ui/colorbutton.js',
'ui/tablebutton.js',
'ui/autotypesetpicker.js',
'ui/autotypesetbutton.js',
'ui/toolbar.js',
'ui/menu.js',
'ui/combox.js',
'ui/dialog.js',
'ui/menubutton.js',
'ui/editorui.js',
'ui/editor.js',
'ui/multiMenu.js'
],
baseURL = '../_src/';
for (var i=0,pi;pi = paths[i++];) {
document.write('<script type="text/javascript" src="'+ baseURL + pi +'"></script>');
}
})();
| 10npsite | trunk/guanli/system/ueditor/_examples/editor_api.js | JavaScript | asf20 | 3,315 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>选项卡编辑器</title>
<script type="text/javascript" charset="utf-8" src="../editor_config.js"></script>
<script type="text/javascript" charset="utf-8" src="editor_api.js"></script>
<link rel="stylesheet" type="text/css" href="../themes/default/ueditor.css"/>
<style type="text/css">
#simple {
width: 1000px;
border: 1px solid #ddd;
}
</style>
</head>
<body>
<h2>重置编辑器和销毁编辑器示例</h2>
<div class="content" id="simple"></div>
<p><input type="button" onclick="simple()" value="重置编辑器内部参数"><span id="txt"></span></p>
<p><input id="destroy" type="button" onclick="destroy()" value="销毁编辑器"></p>
<script type="text/javascript" charset="utf-8">
var editor = new baidu.editor.ui.Editor();
editor.render( "simple" );
function simple() {
editor.setContent("编辑器内部变量已经被重置!");
editor.reset();
}
function destroy(){
editor.destroy();
var button = document.getElementById("destroy");
button.value = "重新渲染";
button.onclick = function(){
editor = new baidu.editor.ui.Editor();
editor.render( "simple" );
this.value="销毁编辑器";
this.onclick = destroy;
}
}
function setMsg() {
document.getElementById( "txt" ).innerHTML = "编辑器当前保存了 <span style='color: red'> " + editor.undoManger.list.length + " </span>次操作";
}
setInterval( setMsg, 100 );
</script>
</body>
</html> | 10npsite | trunk/guanli/system/ueditor/_examples/resetDemo.html | HTML | asf20 | 1,988 |
<?php
session_start();
require "../../../global.php";//$dirname."/".
require RootDir."/"."inc/config.php";
require RootDir."/"."inc/Uifunction.php";
require RootDir."/".$SystemConest[1]."/UIFunction/adminClass.php";
require RootDir."/".$SystemConest[1]."/system/Config.php";
require RootDir."/".$SystemConest[1]."/system/menusys/function.php";
require RootDir."/".$SystemConest[1]."/system/classsys/function.php";
$mydb=new YYBDB();
//权限检查
$TableName= $mydb->getTableName($MenuId);
CheckRule($MenuId,$mydb,$TableName,"");//检查登陆权限
if(strlen($MenuId)==0) die;
$CurrPage=$_REQUEST["CurrPage"];
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>房型管理</title>
<link href="../../Inc/Css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?
echo CurrPosition($MenuId,$mydb)
?>
<br>
<?
ShowList($mydb,$MenuId,$CurrPage,$StrWhere,"YKTtable","YKTth","YKTtd");
?>
</body>
</html>
| 10npsite | trunk/guanli/system/hotelroom/Index.php | PHP | asf20 | 1,026 |
<?php
session_start();
require "../../../global.php";//$dirname."/".
require RootDir."/"."inc/config.php";
require RootDir."/"."inc/Uifunction.php";
require RootDir."/".$SystemConest[1]."/UIFunction/adminClass.php";
require RootDir."/".$SystemConest[1]."/system/Config.php";
require RootDir."/".$SystemConest[1]."/system/menusys/function.php";
require RootDir."/".$SystemConest[1]."/system/classsys/function.php";
$mydb=new YYBDB();
//权限检查
$TableName= $mydb->getTableName($MenuId);
CheckRule($MenuId,$mydb,$TableName,"");//检查登陆权限
if(strlen($MenuId)==0) die;
$CurrPage=$_REQUEST["CurrPage"];
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>主推产品</title>
<link href="../../Inc/Css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?
echo CurrPosition($MenuId,$mydb)
?>
<br>
<?
ShowList($mydb,$MenuId,$CurrPage,$StrWhere,"YKTtable","YKTth","YKTtd");
?>
</body>
</html>
| 10npsite | trunk/guanli/system/topproduct/Index.php | PHP | asf20 | 1,030 |
<?php
session_start();
require "../../../global.php";//$dirname."/".
require RootDir."/"."inc/config.php";
require RootDir."/"."inc/Uifunction.php";
require RootDir."/".$SystemConest[1]."/UIFunction/adminClass.php";
require RootDir."/".$SystemConest[1]."/system/Config.php";
require RootDir."/".$SystemConest[1]."/system/menusys/function.php";
require RootDir."/".$SystemConest[1]."/system/classsys/function.php";
$mydb=new YYBDB();
//权限检查
$TableName= $mydb->getTableName($MenuId);
CheckRule($MenuId,$mydb,$TableName,"");//检查登陆权限
if(strlen($MenuId)==0) die;
$CurrPage=$_REQUEST["CurrPage"];
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>签证管理</title>
<link href="../../Inc/Css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?
echo CurrPosition($MenuId,$mydb)
?>
<br>
<?
ShowList($mydb,$MenuId,$CurrPage,$StrWhere,"YKTtable","YKTth","YKTtd");
?>
</body>
</html>
| 10npsite | trunk/guanli/system/visa/Index.php | PHP | asf20 | 1,031 |
<?php
session_start();
require "../../../global.php";//$dirname."/".
require RootDir."/"."inc/config.php";
require RootDir."/"."inc/Uifunction.php";
require RootDir."/".$SystemConest[1]."/UIFunction/adminClass.php";
require RootDir."/".$SystemConest[1]."/system/Config.php";
require RootDir."/".$SystemConest[1]."/system/menusys/function.php";
require RootDir."/".$SystemConest[1]."/system/classsys/function.php";
$mydb=new YYBDB();
//权限检查
$TableName=$mydb->getTableName($MenuId);
CheckRule($MenuId,$mydb,$TableName,"");//检查登陆权限
$MenuId=$_REQUEST["MenuId"];
if(strlen(MenuId)==0) die;
$CurrPage=$_REQUEST["CurrPage"];
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>广告列表</title>
<link href="../../Inc/Css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?
echo CurrPosition($MenuId,$mydb)
?>
<br>
<?
ShowList($mydb,$MenuId,$CurrPage,$StrWhere,"YKTtable","YKTth","YKTtd");
?>
</body>
</html>
| 10npsite | trunk/guanli/system/adsys/Index.php | PHP | asf20 | 1,056 |
<?php
session_start();
require "../../../global.php";//$dirname."/".
require RootDir."/"."inc/config.php";
require RootDir."/"."inc/Uifunction.php";
require RootDir."/".$SystemConest[1]."/UIFunction/adminClass.php";
require RootDir."/".$SystemConest[1]."/system/Config.php";
require RootDir."/".$SystemConest[1]."/system/menusys/function.php";
require RootDir."/".$SystemConest[1]."/system/classsys/function.php";
$mydb=new YYBDB();
//权限检查
$TableName= $mydb->getTableName($MenuId);
CheckRule($MenuId,$mydb,$TableName,"");//检查登陆权限
if(strlen($MenuId)==0) die;
$CurrPage=$_REQUEST["CurrPage"];
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>招聘管理</title>
<link href="../../Inc/Css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?
echo CurrPosition($MenuId,$mydb)
?>
<br>
<?
ShowList($mydb,$MenuId,$CurrPage,$StrWhere,"YKTtable","YKTth","YKTtd");
?>
</body>
</html>
| 10npsite | trunk/guanli/system/jobmeetsys/Index.php | PHP | asf20 | 1,031 |
<?
session_start();
require "../../../global.php";//$dirname."/".
require $SystemConest[0]."/"."inc/Uifunction.php";
require "../../../inc/ActionFile.Class.php";
$myfile=new ActionFile();
$myfile->DelFile("/index.htm");
if($myfile->CreateAnyPageToPage("http://".$_SERVER['HTTP_HOST'],$SystemConest[0]."/index.htm"))
{
alert("",1,"首页生成成功");
}
else
{
alert("",1,"首页生成失败");
}
unset($myfile);
?> | 10npsite | trunk/guanli/system/plug/createIndexTohtm.php | PHP | asf20 | 435 |
<?php
session_start();
require "../../../global.php";//$dirname."/".
require RootDir."/"."inc/config.php";
require RootDir."/"."inc/Uifunction.php";
require RootDir."/".$SystemConest[1]."/UIFunction/adminClass.php";
require RootDir."/".$SystemConest[1]."/system/Config.php";
require RootDir."/".$SystemConest[1]."/system/menusys/function.php";
require RootDir."/".$SystemConest[1]."/system/classsys/function.php";
$mydb=new YYBDB();
//权限检查
$TableName= $mydb->getTableName($MenuId);
CheckRule($MenuId,$mydb,$TableName,"");//检查登陆权限
if(strlen($MenuId)==0) die;
$CurrPage=$_REQUEST["CurrPage"];
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>统计分析</title>
<link href="../../Inc/Css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?
echo CurrPosition($MenuId,$mydb)
?>
<br>
<?
ShowList($mydb,$MenuId,$CurrPage,$StrWhere,"YKTtable","YKTth","YKTtd");
?>
</body>
</html>
| 10npsite | trunk/guanli/system/votesys/Index.php | PHP | asf20 | 1,031 |
<?php
session_start();
require "../../../global.php";//$dirname."/".
require RootDir."/"."inc/config.php";
require RootDir."/"."inc/Uifunction.php";
require RootDir."/".$SystemConest[1]."/UIFunction/adminClass.php";
require RootDir."/".$SystemConest[1]."/system/Config.php";
require RootDir."/".$SystemConest[1]."/system/menusys/function.php";
require RootDir."/".$SystemConest[1]."/system/classsys/function.php";
$mydb=new YYBDB();
CheckRule($MenuId,$mydb,$System[13][3],"");//检查登陆权限
if(strlen($MenuId)==0) die;
$CurrPage=$_REQUEST["CurrPage"];
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>新闻系统</title>
<link href="../../Inc/Css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?
echo CurrPosition($MenuId,$mydb)
?>
<br>
<?
ShowList($mydb,$MenuId,$CurrPage,$StrWhere,"YKTtable","YKTth","YKTtd");
?>
</body>
</html>
| 10npsite | trunk/guanli/system/news/Index.php | PHP | asf20 | 972 |
"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2009 Frederico Caldeira Knabben
== BEGIN LICENSE ==
Licensed under the terms of any of the following licenses at your
choice:
- GNU General Public License Version 2 or later (the "GPL")
http://www.gnu.org/licenses/gpl.html
- GNU Lesser General Public License Version 2.1 or later (the "LGPL")
http://www.gnu.org/licenses/lgpl.html
- Mozilla Public License Version 1.1 or later (the "MPL")
http://www.mozilla.org/MPL/MPL-1.1.html
== END LICENSE ==
This is the integration file for Python.
"""
import cgi
import os
import re
import string
def escape(text, replace=string.replace):
"""Converts the special characters '<', '>', and '&'.
RFC 1866 specifies that these characters be represented
in HTML as < > and & respectively. In Python
1.5 we use the new string.replace() function for speed.
"""
text = replace(text, '&', '&') # must be done 1st
text = replace(text, '<', '<')
text = replace(text, '>', '>')
text = replace(text, '"', '"')
text = replace(text, "'", ''')
return text
# The FCKeditor class
class FCKeditor(object):
def __init__(self, instanceName):
self.InstanceName = instanceName
self.BasePath = '/fckeditor/'
self.Width = '100%'
self.Height = '200'
self.ToolbarSet = 'Default'
self.Value = '';
self.Config = {}
def Create(self):
return self.CreateHtml()
def CreateHtml(self):
HtmlValue = escape(self.Value)
Html = ""
if (self.IsCompatible()):
File = "fckeditor.html"
Link = "%seditor/%s?InstanceName=%s" % (
self.BasePath,
File,
self.InstanceName
)
if (self.ToolbarSet is not None):
Link += "&Toolbar=%s" % self.ToolbarSet
# Render the linked hidden field
Html += "<input type=\"hidden\" id=\"%s\" name=\"%s\" value=\"%s\" style=\"display:none\" />" % (
self.InstanceName,
self.InstanceName,
HtmlValue
)
# Render the configurations hidden field
Html += "<input type=\"hidden\" id=\"%s___Config\" value=\"%s\" style=\"display:none\" />" % (
self.InstanceName,
self.GetConfigFieldString()
)
# Render the editor iframe
Html += "<iframe id=\"%s\__Frame\" src=\"%s\" width=\"%s\" height=\"%s\" frameborder=\"0\" scrolling=\"no\"></iframe>" % (
self.InstanceName,
Link,
self.Width,
self.Height
)
else:
if (self.Width.find("%%") < 0):
WidthCSS = "%spx" % self.Width
else:
WidthCSS = self.Width
if (self.Height.find("%%") < 0):
HeightCSS = "%spx" % self.Height
else:
HeightCSS = self.Height
Html += "<textarea name=\"%s\" rows=\"4\" cols=\"40\" style=\"width: %s; height: %s;\" wrap=\"virtual\">%s</textarea>" % (
self.InstanceName,
WidthCSS,
HeightCSS,
HtmlValue
)
return Html
def IsCompatible(self):
if (os.environ.has_key("HTTP_USER_AGENT")):
sAgent = os.environ.get("HTTP_USER_AGENT", "")
else:
sAgent = ""
if (sAgent.find("MSIE") >= 0) and (sAgent.find("mac") < 0) and (sAgent.find("Opera") < 0):
i = sAgent.find("MSIE")
iVersion = float(sAgent[i+5:i+5+3])
if (iVersion >= 5.5):
return True
return False
elif (sAgent.find("Gecko/") >= 0):
i = sAgent.find("Gecko/")
iVersion = int(sAgent[i+6:i+6+8])
if (iVersion >= 20030210):
return True
return False
elif (sAgent.find("Opera/") >= 0):
i = sAgent.find("Opera/")
iVersion = float(sAgent[i+6:i+6+4])
if (iVersion >= 9.5):
return True
return False
elif (sAgent.find("AppleWebKit/") >= 0):
p = re.compile('AppleWebKit\/(\d+)', re.IGNORECASE)
m = p.search(sAgent)
if (m.group(1) >= 522):
return True
return False
else:
return False
def GetConfigFieldString(self):
sParams = ""
bFirst = True
for sKey in self.Config.keys():
sValue = self.Config[sKey]
if (not bFirst):
sParams += "&"
else:
bFirst = False
if (sValue):
k = escape(sKey)
v = escape(sValue)
if (sValue == "true"):
sParams += "%s=true" % k
elif (sValue == "false"):
sParams += "%s=false" % k
else:
sParams += "%s=%s" % (k, v)
return sParams
| 10npsite | trunk/guanli/system/fckeditor/fckeditor.py | Python | asf20 | 4,371 |
<!---
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* ColdFusion integration.
* This function is used by FCKeditor module to check browser compatibility
--->
<cfscript>
function FCKeditor_IsCompatibleBrowser()
{
sAgent = lCase( cgi.HTTP_USER_AGENT );
isCompatibleBrowser = false;
// check for Internet Explorer ( >= 5.5 )
if( find( "msie", sAgent ) and not find( "mac", sAgent ) and not find( "opera", sAgent ) )
{
// try to extract IE version
stResult = reFind( "msie ([5-9]\.[0-9])", sAgent, 1, true );
if( arrayLen( stResult.pos ) eq 2 )
{
// get IE Version
sBrowserVersion = mid( sAgent, stResult.pos[2], stResult.len[2] );
if( sBrowserVersion GTE 5.5 )
isCompatibleBrowser = true;
}
}
// check for Gecko ( >= 20030210+ )
else if( find( "gecko/", sAgent ) )
{
// try to extract Gecko version date
stResult = reFind( "gecko/(200[3-9][0-1][0-9][0-3][0-9])", sAgent, 1, true );
if( arrayLen( stResult.pos ) eq 2 )
{
// get Gecko build (i18n date)
sBrowserVersion = mid( sAgent, stResult.pos[2], stResult.len[2] );
if( sBrowserVersion GTE 20030210 )
isCompatibleBrowser = true;
}
}
else if( find( "opera/", sAgent ) )
{
// try to extract Opera version
stResult = reFind( "opera/([0-9]+\.[0-9]+)", sAgent, 1, true );
if( arrayLen( stResult.pos ) eq 2 )
{
if ( mid( sAgent, stResult.pos[2], stResult.len[2] ) gte 9.5)
isCompatibleBrowser = true;
}
}
else if( find( "applewebkit", sAgent ) )
{
// try to extract Gecko version date
stResult = reFind( "applewebkit/([0-9]+)", sAgent, 1, true );
if( arrayLen( stResult.pos ) eq 2 )
{
if( mid( sAgent, stResult.pos[2], stResult.len[2] ) gte 522 )
isCompatibleBrowser = true;
}
}
return isCompatibleBrowser;
}
</cfscript>
| 10npsite | trunk/guanli/system/fckeditor/fckutils.cfm | ColdFusion | asf20 | 2,400 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>FCKeditor - Upgrade</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body { font-family: arial, verdana, sans-serif }
p { margin-left: 20px }
</style>
</head>
<body>
<h1>
FCKeditor Upgrade</h1>
<p>
Please check the following URL for notes regarding upgrade:<br />
<a href="http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Installation/Upgrading">
http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Installation/Upgrading</a></p>
</body>
</html>
| 10npsite | trunk/guanli/system/fckeditor/_upgrade.html | HTML | asf20 | 1,359 |
<!--
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This is the integration file for ASP.
*
* It defines the FCKeditor class that can be used to create editor
* instances in ASP pages on server side.
-->
<%
Class FCKeditor
private sBasePath
private sInstanceName
private sWidth
private sHeight
private sToolbarSet
private sValue
private oConfig
Private Sub Class_Initialize()
sBasePath = "/fckeditor/"
sWidth = "100%"
sHeight = "200"
sToolbarSet = "Default"
sValue = ""
Set oConfig = CreateObject("Scripting.Dictionary")
End Sub
Public Property Let BasePath( basePathValue )
sBasePath = basePathValue
End Property
Public Property Let InstanceName( instanceNameValue )
sInstanceName = instanceNameValue
End Property
Public Property Let Width( widthValue )
sWidth = widthValue
End Property
Public Property Let Height( heightValue )
sHeight = heightValue
End Property
Public Property Let ToolbarSet( toolbarSetValue )
sToolbarSet = toolbarSetValue
End Property
Public Property Let Value( newValue )
If ( IsNull( newValue ) OR IsEmpty( newValue ) ) Then
sValue = ""
Else
sValue = newValue
End If
End Property
Public Property Let Config( configKey, configValue )
oConfig.Add configKey, configValue
End Property
' Generates the instace of the editor in the HTML output of the page.
Public Sub Create( instanceName )
response.write CreateHtml( instanceName )
end Sub
' Returns the html code that must be used to generate an instance of FCKeditor.
Public Function CreateHtml( instanceName )
dim html
If IsCompatible() Then
Dim sFile, sLink
If Request.QueryString( "fcksource" ) = "true" Then
sFile = "fckeditor.original.html"
Else
sFile = "fckeditor.html"
End If
sLink = sBasePath & "editor/" & sFile & "?InstanceName=" + instanceName
If (sToolbarSet & "") <> "" Then
sLink = sLink + "&Toolbar=" & sToolbarSet
End If
html = ""
' Render the linked hidden field.
html = html & "<input type=""hidden"" id=""" & instanceName & """ name=""" & instanceName & """ value=""" & Server.HTMLEncode( sValue ) & """ style=""display:none"" />"
' Render the configurations hidden field.
html = html & "<input type=""hidden"" id=""" & instanceName & "___Config"" value=""" & GetConfigFieldString() & """ style=""display:none"" />"
' Render the editor IFRAME.
html = html & "<iframe id=""" & instanceName & "___Frame"" src=""" & sLink & """ width=""" & sWidth & """ height=""" & sHeight & """ frameborder=""0"" scrolling=""no""></iframe>"
Else
Dim sWidthCSS, sHeightCSS
If InStr( sWidth, "%" ) > 0 Then
sWidthCSS = sWidth
Else
sWidthCSS = sWidth & "px"
End If
If InStr( sHeight, "%" ) > 0 Then
sHeightCSS = sHeight
Else
sHeightCSS = sHeight & "px"
End If
html = "<textarea name=""" & instanceName & """ rows=""4"" cols=""40"" style=""width: " & sWidthCSS & "; height: " & sHeightCSS & """>" & Server.HTMLEncode( sValue ) & "</textarea>"
End If
CreateHtml = html
End Function
Private Function IsCompatible()
IsCompatible = FCKeditor_IsCompatibleBrowser()
End Function
Private Function GetConfigFieldString()
Dim sParams
Dim bFirst
bFirst = True
Dim sKey
For Each sKey in oConfig
If bFirst = False Then
sParams = sParams & "&"
Else
bFirst = False
End If
sParams = sParams & EncodeConfig( sKey ) & "=" & EncodeConfig( oConfig(sKey) )
Next
GetConfigFieldString = sParams
End Function
Private Function EncodeConfig( valueToEncode )
' The locale of the asp server makes the conversion of a boolean to string different to "true" or "false"
' so we must do it manually
If vartype(valueToEncode) = vbBoolean then
If valueToEncode=True Then
EncodeConfig="True"
Else
EncodeConfig="False"
End If
Else
EncodeConfig = Replace( valueToEncode, "&", "%26" )
EncodeConfig = Replace( EncodeConfig , "=", "%3D" )
EncodeConfig = Replace( EncodeConfig , """", "%22" )
End if
End Function
End Class
' A function that can be used to check if the current browser is compatible with FCKeditor
' without the need to create an instance of the class.
Function FCKeditor_IsCompatibleBrowser()
Dim sAgent
sAgent = Request.ServerVariables("HTTP_USER_AGENT")
Dim iVersion
Dim re, Matches
If InStr(sAgent, "MSIE") > 0 AND InStr(sAgent, "mac") <= 0 AND InStr(sAgent, "Opera") <= 0 Then
iVersion = CInt( FCKeditor_ToNumericFormat( Mid(sAgent, InStr(sAgent, "MSIE") + 5, 3) ) )
FCKeditor_IsCompatibleBrowser = ( iVersion >= 5.5 )
ElseIf InStr(sAgent, "Gecko/") > 0 Then
iVersion = CLng( Mid( sAgent, InStr( sAgent, "Gecko/" ) + 6, 8 ) )
FCKeditor_IsCompatibleBrowser = ( iVersion >= 20030210 )
ElseIf InStr(sAgent, "Opera/") > 0 Then
iVersion = CSng( FCKeditor_ToNumericFormat( Mid( sAgent, InStr( sAgent, "Opera/" ) + 6, 4 ) ) )
FCKeditor_IsCompatibleBrowser = ( iVersion >= 9.5 )
ElseIf InStr(sAgent, "AppleWebKit/") > 0 Then
Set re = new RegExp
re.IgnoreCase = true
re.global = false
re.Pattern = "AppleWebKit/(\d+)"
Set Matches = re.Execute(sAgent)
FCKeditor_IsCompatibleBrowser = ( re.Replace(Matches.Item(0).Value, "$1") >= 522 )
Else
FCKeditor_IsCompatibleBrowser = False
End If
End Function
' By Agrotic
' On ASP, when converting string to numbers, the number decimal separator is localized
' so 5.5 will not work on systems were the separator is "," and vice versa.
Private Function FCKeditor_ToNumericFormat( numberStr )
If IsNumeric( "5.5" ) Then
FCKeditor_ToNumericFormat = Replace( numberStr, ",", ".")
Else
FCKeditor_ToNumericFormat = Replace( numberStr, ".", ",")
End If
End Function
%>
| 10npsite | trunk/guanli/system/fckeditor/fckeditor.asp | Classic ASP | asf20 | 6,508 |
<?php
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This is the integration file for PHP 4.
*
* It defines the FCKeditor class that can be used to create editor
* instances in PHP pages on server side.
*/
/**
* Check if browser is compatible with FCKeditor.
* Return true if is compatible.
*
* @return boolean
*/
function FCKeditor_IsCompatibleBrowser()
{
if ( isset( $_SERVER ) ) {
$sAgent = $_SERVER['HTTP_USER_AGENT'] ;
}
else {
global $HTTP_SERVER_VARS ;
if ( isset( $HTTP_SERVER_VARS ) ) {
$sAgent = $HTTP_SERVER_VARS['HTTP_USER_AGENT'] ;
}
else {
global $HTTP_USER_AGENT ;
$sAgent = $HTTP_USER_AGENT ;
}
}
if ( strpos($sAgent, 'MSIE') !== false && strpos($sAgent, 'mac') === false && strpos($sAgent, 'Opera') === false )
{
$iVersion = (float)substr($sAgent, strpos($sAgent, 'MSIE') + 5, 3) ;
return ($iVersion >= 5.5) ;
}
else if ( strpos($sAgent, 'Gecko/') !== false )
{
$iVersion = (int)substr($sAgent, strpos($sAgent, 'Gecko/') + 6, 8) ;
return ($iVersion >= 20030210) ;
}
else if ( strpos($sAgent, 'Opera/') !== false )
{
$fVersion = (float)substr($sAgent, strpos($sAgent, 'Opera/') + 6, 4) ;
return ($fVersion >= 9.5) ;
}
else if ( preg_match( "|AppleWebKit/(\d+)|i", $sAgent, $matches ) )
{
$iVersion = $matches[1] ;
return ( $matches[1] >= 522 ) ;
}
else
return false ;
}
class FCKeditor
{
/**
* Name of the FCKeditor instance.
*
* @access protected
* @var string
*/
var $InstanceName ;
/**
* Path to FCKeditor relative to the document root.
*
* @var string
*/
var $BasePath ;
/**
* Width of the FCKeditor.
* Examples: 100%, 600
*
* @var mixed
*/
var $Width ;
/**
* Height of the FCKeditor.
* Examples: 400, 50%
*
* @var mixed
*/
var $Height ;
/**
* Name of the toolbar to load.
*
* @var string
*/
var $ToolbarSet ;
/**
* Initial value.
*
* @var string
*/
var $Value ;
/**
* This is where additional configuration can be passed.
* Example:
* $oFCKeditor->Config['EnterMode'] = 'br';
*
* @var array
*/
var $Config ;
/**
* Main Constructor.
* Refer to the _samples/php directory for examples.
*
* @param string $instanceName
*/
function FCKeditor( $instanceName )
{
$this->InstanceName = $instanceName ;
$this->BasePath = '/fckeditor/' ;
$this->Width = '100%' ;
$this->Height = '200' ;
$this->ToolbarSet = 'Default' ;
$this->Value = '' ;
$this->Config = array() ;
}
/**
* Display FCKeditor.
*
*/
function Create()
{
echo $this->CreateHtml() ;
}
/**
* Return the HTML code required to run FCKeditor.
*
* @return string
*/
function CreateHtml()
{
$HtmlValue = htmlspecialchars( $this->Value ) ;
$Html = '' ;
if ( !isset( $_GET ) ) {
global $HTTP_GET_VARS ;
$_GET = $HTTP_GET_VARS ;
}
if ( $this->IsCompatible() )
{
if ( isset( $_GET['fcksource'] ) && $_GET['fcksource'] == "true" )
$File = 'fckeditor.original.html' ;
else
$File = 'fckeditor.html' ;
$Link = "{$this->BasePath}editor/{$File}?InstanceName={$this->InstanceName}" ;
if ( $this->ToolbarSet != '' )
$Link .= "&Toolbar={$this->ToolbarSet}" ;
// Render the linked hidden field.
$Html .= "<input type=\"hidden\" id=\"{$this->InstanceName}\" name=\"{$this->InstanceName}\" value=\"{$HtmlValue}\" style=\"display:none\" />" ;
// Render the configurations hidden field.
$Html .= "<input type=\"hidden\" id=\"{$this->InstanceName}___Config\" value=\"" . $this->GetConfigFieldString() . "\" style=\"display:none\" />" ;
// Render the editor IFRAME.
$Html .= "<iframe id=\"{$this->InstanceName}___Frame\" src=\"{$Link}\" width=\"{$this->Width}\" height=\"{$this->Height}\" frameborder=\"0\" scrolling=\"no\"></iframe>" ;
}
else
{
if ( strpos( $this->Width, '%' ) === false )
$WidthCSS = $this->Width . 'px' ;
else
$WidthCSS = $this->Width ;
if ( strpos( $this->Height, '%' ) === false )
$HeightCSS = $this->Height . 'px' ;
else
$HeightCSS = $this->Height ;
$Html .= "<textarea name=\"{$this->InstanceName}\" rows=\"4\" cols=\"40\" style=\"width: {$WidthCSS}; height: {$HeightCSS}\">{$HtmlValue}</textarea>" ;
}
return $Html ;
}
/**
* Returns true if browser is compatible with FCKeditor.
*
* @return boolean
*/
function IsCompatible()
{
return FCKeditor_IsCompatibleBrowser() ;
}
/**
* Get settings from Config array as a single string.
*
* @access protected
* @return string
*/
function GetConfigFieldString()
{
$sParams = '' ;
$bFirst = true ;
foreach ( $this->Config as $sKey => $sValue )
{
if ( $bFirst == false )
$sParams .= '&' ;
else
$bFirst = false ;
if ( $sValue === true )
$sParams .= $this->EncodeConfig( $sKey ) . '=true' ;
else if ( $sValue === false )
$sParams .= $this->EncodeConfig( $sKey ) . '=false' ;
else
$sParams .= $this->EncodeConfig( $sKey ) . '=' . $this->EncodeConfig( $sValue ) ;
}
return $sParams ;
}
/**
* Encode characters that may break the configuration string
* generated by GetConfigFieldString().
*
* @access protected
* @param string $valueToEncode
* @return string
*/
function EncodeConfig( $valueToEncode )
{
$chars = array(
'&' => '%26',
'=' => '%3D',
'"' => '%22' ) ;
return strtr( $valueToEncode, $chars ) ;
}
}
| 10npsite | trunk/guanli/system/fckeditor/fckeditor_php4.php | PHP | asf20 | 6,182 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>FCKeditor ChangeLog - What's New?</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body { font-family: arial, verdana, sans-serif }
p { margin-left: 20px }
h1 { border-bottom: solid 1px gray; padding-bottom: 20px }
</style>
</head>
<body>
<h1>
FCKeditor ChangeLog - What's New?</h1>
<h3>
Version 2.6.4.1</h3>
<p>
Fixed Bugs:</p>
<ul>
<li><strong>Security release, upgrade is highly recommended.</strong></li>
</ul>
<h3>
Version 2.6.4</h3>
<p>
Fixed Bugs:</p>
<ul>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2777">#2777</a>] Merging
cells between table header and body is no longer possible.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2815">#2815</a>] Fixed
WSC issues at slow connection speed. Added SSL support.</li>
<li>Language file updates for the following languages:
<ul>
<li>Chinese (Traditional)</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2846">#2846</a>] French</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2801">#2801</a>] Hebrew</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2824">#2824</a>] Russian</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2811">#2811</a>] Turkish</li>
</ul>
</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2757">#2757</a>] Fixed
a minor bug which causes selection positions to be improperly restored during undos
and redos.</li>
</ul>
<h3>
Version 2.6.4 Beta</h3>
<p>
New Features and Improvements:</p>
<ul>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2685">#2685</a>] Integration
with "WebSpellChecker", a <strong>zero installation and free spell checker</strong>
provided by SpellChecker.net. This is now the default spell checker in the editor
(requires internet connection). All previous spell checking solutions are still
available.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2430">#2430</a>] In the
table dialog it's possible to create header cells in the first row (included in
a thead element) or the first column of the table. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/822">#822</a>] The table
cell dialog allows switching between normal data cells or header cells (TD vs. TH).
</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2515">#2515</a>] New language
file for Icelandic.</li>
</ul>
<p>
Fixed Bugs:</p>
<ul>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2381">#2381</a>] Protected
the editor from duplicate iframes</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1752">#1752</a>] Fixed
the issue with tablecommands plugin and undefined tagName.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2333">#2333</a>] The &gt;
character inside text wasn't encoded in Opera and Safari.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2467">#2467</a>] Fixed
JavaScript error with the fit window command in source mode.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2472">#2472</a>] Splitting
a TH will create a two TH, not a TH and a TD.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1891">#1891</a>] Removed
unnecessary name attributes in dialogs. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/798">#798</a>, <a target="_blank"
href="http://dev.fckeditor.net/ticket/2495">#2495</a>] If an image was placed inside
a container with dimensions or floating it wasn't possible to edit its properties
from the toolbar or context menu.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1982">#1982</a>] Submenus
in IE7 now are shown properly.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2496">#2496</a>] Using
the Paste dialogs in IE might insert the content at the start of the editor.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2349">#2496</a>] Fixed
RTL dialog layout in Internet Explorer.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2488">#2488</a>] Fixed
the issue where email links in IE would take the browser to a new page in addition
to calling up the email client.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2519">#2519</a>] Fixed
race condition at registering the FCKeditorAPI object in multiple editor scenarios.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2525">#2525</a>] Fixed
JavaScript error in Google Chrome when StartupShowBlocks is set to true.</li>
<li>Language file updates for the following languages:
<ul>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2440">#2440</a>] Dutch</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2451">#2451</a>] Basque</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2451">#2650</a>] Danish</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2208">#2535</a>] German
</li>
</ul>
</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2531">#2531</a>] The ENTER
key will properly scroll to the cursor position when breaking long paragraphs.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2573">#2573</a>] The type
name in configurations for the ASP connector are now case sensitive.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2503">#2503</a>] DL, DT
and DD where missing the formatting in the generated HTML.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2516">#2516</a>] Replaced
the extension AddItem of Array with the standard "push" method.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2486">#2486</a>] Vertically
splitting cell with colspan > 1 breaks table layout.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2597">#2597</a>] Fixed
the issue where dropping contents from outside of the editor doesn't work in Safari.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2412">#2412</a>] Fixed
the issue where FCK.InsertHtml() is no longer removing selected contents after content
insertion in Firefox.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2407">#2407</a>] Fixed
the issue where the Div container command and the blockquote command would break
lists.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2469">#2469</a>] Fixed
a minor issue where FCK.SetData() may cause the editor to become unresponsive to
the first click after being defocused.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2611">#2611</a>] Fixed
an extra slash on quickupload of the asp connector.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2616">#2616</a>] Fixed
another situation where new elements were inserted at the beginning of the content
in IE.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2634">#2634</a>] Fixed
two obsolete references to Array::AddItem() instances still in the code.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2679">#2679</a>] Fixed
infinite loop problems with FCKDomRangeIterator class which causes some commands
to hang when applied to certain document structures.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2649">#2649</a>] Fixed
a JavaScript error in IE when user tries to search with the "Match whole word" option
enabled and the matched word is at exactly the end of document.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2603">#2603</a>] Changed
the <a href="http://docs.fckeditor.net/EMailProtection">EMailProtection</a> to "none"
for better compatibility.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2612">#2612</a>] The 'ForcePasteAsPlainText'
configuration option didn't work correctly in Safari and Chrome.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2696">#2696</a>] Fixed
non-working autogrow plugin.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2753">#2753</a>] Fixed
occasional exceptions in the dragersizetable plugin with IE.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2653">#2653</a>] and [<a
target="_blank" href="http://dev.fckeditor.net/ticket/2733">#2733</a>] Enable undo
of changes to tables and table cells.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1865">#1865</a>] The context
menu is now working properly over the last row in a table with thead. Thanks to
Koen Willems.</li>
</ul>
<h3>
Version 2.6.3</h3>
<p>
Fixed Bugs:</p>
<ul>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2412">#2412</a>] FCK.InsertHtml()
is now properly removing selected contents after content insertion in Firefox.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2420">#2420</a>] Spelling
mistake corrections made by the spell checking dialog are now undoable. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2411">#2411</a>] Insert
anchor was not working for non-empty selections.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2426">#2426</a>] It was
impossible to switch between editor areas with a single click.</li>
<li>Language file updates for the following languages:
<ul>
<li>Canadian French</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2402">#2402</a>] Catalan
</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2400">#2400</a>] Chinese
(Simplified and Traditional)</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2401">#2401</a>] Croatian</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2422">#2422</a>] Czech</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2417">#2417</a>] Dutch</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2428">#2428</a>] French</li>
<li>German</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2427">#2427</a>] Hebrew</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2410">#2410</a>] Hindi</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2405">#2405</a>] Japanese</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2409">#2409</a>] Norwegian
and Norwegian Bokmål</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2429">#2429</a>] Spanish</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2406">#2406</a>] Vietnamese</li>
</ul>
</li>
</ul>
<p>
This version has been sponsored by <a href="http://www.dataillusion.com/fs/">Data Illusion
survey software solutions</a>.</p>
<h3>
Version 2.6.3 Beta</h3>
<p>
New Features and Improvements:</p>
<ul>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/439">#439</a>] Added a
new <strong>context menu option for opening links</strong> in the editor.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2220">#2220</a>] <strong>
Email links</strong> from the Link dialog <strong>are now encoded</strong> by default
to prevent being harvested by spammers. (Kudos to asuter for proposing the patch)
</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2234">#2234</a>] Added
the ability to create, modify and remove <strong>DIV containers</strong>. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2247">#2247</a>] The <strong>
SHIFT+SPACE</strong> keystroke will now <strong>produce a &nbsp;</strong> character.
</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2252">#2252</a>] It's
now possible to enable the browsers default menu using the configuration file (FCKConfig.BrowserContextMenu
option). </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2032">#2032</a>] Added
HTML samples for legacy HTML and Flash HTML. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/234">#234</a>] Introduced
the "PreventSubmitHandler" setting, which makes it possible to instruct the editor
to not handle the hidden field update on form submit events.</li>
</ul>
<p>
Fixed Bugs:</p>
<ul>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2319">#2319</a>] On Opera
and Firefox 3, the entire page was scrolling on SHIFT+ENTER, or when EnterMode='br'.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2321">#2321</a>] On Firefox
3, the entire page was scrolling when inserting block elements with the FCK.InsertElement
function, used by the Table and Horizontal Rule buttons.. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/692">#692</a>] Added some
hints in editor/css/fck_editorarea.css on how to handle style items that would break
the style combo. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2263">#2263</a>] Fixed
a JavaScript error in IE which occurs when there are placeholder elements in the
document and the user has pressed the Source button.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2314">#2314</a>] Corrected
mixed up Chinese translations for the blockquote command.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2323">#2323</a>] Fixed
the issue where the show blocks command loses the current selection from the view
area when editing a long document.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2322">#2322</a>] Fixed
the issue where the fit window command loses the current selection and scroll position
in the editing area.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1917">#1917</a>] Fixed
the issue where the merge down command for tables cells does not work in IE for
more than two cells.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2320">#2320</a>] Fixed
the issue where the Find/Replace dialog scrolls the entire page.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1645">#1645</a>] Added
warning message about Firefox 3's strict origin policy.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2272">#2272</a>] Improved
the garbage filter in Paste from Word dialog.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2327">#2327</a>] Fixed
invalid HTML in the Paste dialog.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1907">#1907</a>] Fixed
sporadic "FCKeditorAPI is not defined" errors in Firefox 3.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2356">#2356</a>] Fixed
access denied error in IE7 when FCKeditor is launched from local filesystem.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1150">#1150</a>] Fixed
the type="_moz" attribute that sometimes appear in <br> tags in non-IE browsers.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1229">#1229</a>] Converting
multiple contiguous paragraphs to Formatted will now be merged into a single <PRE>
block.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2363">#2363</a>] There
were some sporadic "Permission Denied" errors with IE on some situations.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2135">#2135</a>] Fixed
a data loss bug in IE when there are @import statements in the editor's CSS files,
and IE's cache is set to "Check for newer versions on every visit".</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2376">#2376</a>] FCK.InsertHtml()
will now insert to the last selected position after the user has selected things
outside of FCKeditor, in IE.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2368">#2368</a>] Fixed
broken protect source logic for comments in IE.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2387">#2387</a>] Fixed
JavaScript error with list commands when the editable document is selected with
Ctrl-A.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2390">#2390</a>] Fixed
the issue where indent styles in JavaScript-generated <p> blocks are erased
in IE.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2394">#2394</a>] Fixed
JavaScript error with the "split vertically" command in IE when attempting to split
cells in the last row of a table.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2316">#2316</a>] The sample
posted data page has now the table fixed at 100% width. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2396">#2396</a>] SpellerPages
was causing a "Permission Denied" error in some situations. </li>
</ul>
<h3>
Version 2.6.2</h3>
<p>
New Features and Improvements:</p>
<ul>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2043">#2043</a>] The debug
script is not any more part of the compressed files. If FCKeditor native debugging
features (FCKDebug) are required, the _source folder must be present in your installation.</li>
</ul>
<p>
Fixed Bugs:</p>
<ul>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2248">#2248</a>] Calling
FCK.InsertHtml( 'nbsp;') was inserting a plain space instead of a non breaking space
character.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2273">#2273</a>] The dragresizetable
plugin now works in Firefox 3 as well.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2254">#2254</a>] Minor
fix in FCKSelection for nodeTagName object.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1614">#1614</a>] Unified
FCKConfig.FullBasePath with FCKConfig.BasePath.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2127">#2127</a>] Changed
floating dialogs to use fixed positioning so that they are no longer affected by
scrolling.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2018">#2018</a>] Reversed
the fix for <a target="_blank" href="http://dev.fckeditor.net/ticket/183">#183</a>
which broke FCKeditorAPI's cleanup logic. A new configuration directive <strong>MsWebBrowserControlCompat</strong>
has been added for those who wish to force the #183 fix to be enabled.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2276">#2276</a>] [<a
target="_blank" href="http://dev.fckeditor.net/ticket/2279">#2279</a>] On Opera
and Firefox 3, the entire page was scrolling on ENTER.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2149">#2149</a>] CSS urls
with querystring parameters were not being accepted for CSS values in the configuration
file (like EditorAreaCSS).</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2287">#2287</a>] On some
specific cases, with Firefox 2, some extra spacing was appearing in the final HTML
on posting, if inserting two successive tables.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2287">#2287</a>] Block
elements (like tables or horizontal rules) will be inserted correctly now when the
cursor is at the start or the end of blocks. No extra paragraphs will be included
in this operation.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2149">#2197</a>] The TAB
key will now have the default browser behavior if TabSpaces=0. It will move the
focus out of the editor (expect on Safari).</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2296">#2296</a>] Fixed
permission denied error on clicking on files in the file browser.</li>
</ul>
<h3>
Version 2.6.1</h3>
<p>
New Features and Improvements:</p>
<ul>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2150">#2150</a>] The searching
speed of the Find/Replace dialog has been vastly improved.</li>
<li>New language file for <strong>Gujarati</strong> (by Nilam Doctor).</li>
<li>A new TabIndex property has been added to the JavaScript integration files.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2215">#2215</a>] Following
the above new feature, the ReplaceTextarea method will now copy the textarea.tabIndex
value if available.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2163">#2163</a>] If the
FCKConfig.DocType setting points to a HTML DocType then the output won't generate
self-closing tags (it will output <img > instead of <img />).</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2173">#2173</a>] A throbber
will be shown in the Quick Uploads.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2142">#2142</a>] HTML
samples will now use sampleposteddata.php in action parameter inside a form.</li>
</ul>
<p>
Fixed Bugs:</p>
<ul>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/768">#768</a>] It is no
longer possible for an image to have its width and height defined with both HTML
attributes and inline CSS styles in IE.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1426">#1426</a>] Fixed
the error loading fckstyles.xml in servers which cannot return the correct content
type header for .xml files.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2102">#2102</a>] Fixed
FCKConfig.DocType which stopped working in FCKeditor 2.6.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2039">#2039</a>] Fixed
the locking up issue in the Find/Replace dialog.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2124">#2124</a>] PHP File
Browser: fixed issue with resolving paths on Windows servers with PHP 5.2.4/5.2.5.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2059">#2059</a>] Fixed
the error in the toolbar name in fckeditor.py.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2065">#2065</a>] Floating
dialogs will now block the user from re-selecting the editing area by pressing Tab.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2114">#2114</a>] Added
a workaround for an IE6 bug which causes floating dialogs to appear blank after
opening it for the first time.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2136">#2136</a>] Fixed
JavaScript error in IE when opening the bullet list properties dialog.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1633">#1633</a>] External
styles should no longer interfere with the appearance of the editor and floating
panels now.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2113">#2113</a>] Fixed
unneeded <span class="Apple-style-span"> created after inserting
special characters.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2170">#2170</a>] Fixed
Ctrl-Insert hotkey for copying.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2125">#2125</a>] Fixed
the issue that FCK.InsertHtml() doesn't insert contents at the caret position when
dialogs are opened in IE. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1764">#1764</a>] FCKeditor
will no longer catch focus in IE on load when StartupFocus is false and the initial
content is empty.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2126">#2126</a>] Opening
and closing floating dialogs will no longer cause toolbar button states to become
frozen.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2159">#2159</a>] Selection
are now correctly restored when undoing changes made by the Replace dialog.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2160">#2160</a>] "Match
whole word" in the Find and Replace dialog will now find words next to punctuation
marks as well.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2162">#2162</a>] If the
configuration is set to work including the <head> (FullPage), references to
stylesheets added by Firefox extensions won't be added to the output.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2168">#2168</a>] Comments
won't generate new paragraphs in the output.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2184">#2184</a>] Fixed
several validation errors in the File Browser.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1383">#1383</a>] Fixed
an IE issue where pressing backspace may merge a hyperlink on the previous line
with the text on the current line.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1691">#1691</a>] Creation
of links in Safari failed if there was no selection.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2188">#2188</a>] PreserveSessionOnFileBrowser
is now removed as it was made obsolete with 2.6.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/898">#898</a>] The styles
for the editing area are applied in the image preview dialog.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2056">#2056</a>] Fixed
several validation errors in the dialogs.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2063">#2063</a>] Fixed
some problems in asp related to the use of network paths for the location of the
uploaded files.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1593">#1593</a>] The "Sample
Posted Data" page will now properly wrap the text.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2239">#2239</a>] The PHP
code in sampleposteddata.php has been changed from "<?=" to "<? echo".</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2241">#2241</a>] Fixed
404 error in floating panels when FCKeditor is installed to a different domain.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2066">#2066</a>] Added
a workaround for a Mac Safari 3.1 browser bug which caused the Fit Window button
to give a blank screen.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2218">#2218</a>] Improved
Gecko based browser detection to accept Epiphany/Gecko as well.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2193">#2193</a>] Fixed
the issue where the caret cannot reach the last character of a paragraph in Opera
9.50.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2264">#2264</a>] Fixed
empty spaces that appear at the top of the editor in Opera 9.50.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2238">#2238</a>] The <object>
placeholder was not being properly displayed in the compressed distribution version
and nightly builds.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2115">#2115</a>] Fixed
JavaScript (permission denied) error in Firefox when file has been uploaded.</li>
</ul>
<h3>
Version 2.6</h3>
<p>
No changes. The stabilization of the 2.6 RC was completed successfully, as expected.</p>
<h3>
Version 2.6 RC</h3>
<p>
New Features and Improvements:</p>
<ul>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2017">#2017</a>] The FCKeditorAPI.Instances
object can now be used to access all FCKeditor instances available in the page.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1980">#1980</a>] <span
style="color: #ff0000">Attention:</span> By default, the editor now produces <strong>
and <em> instead of <b> and <i>.</li>
</ul>
<p>
Fixed Bugs:</p>
<ul>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1924">#1924</a>] The dialog
close button is now correctly positioned in IE in RTL languages.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1933">#1933</a>] Placeholder
dialog will now display the placeholder value correctly in IE.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/957">#957</a>] Pressing
Enter or typing after a placeholder with the placeholder plugin will no longer generate
colored text.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1952">#1952</a>] Fixed
an issue in FCKTools.FixCssUrls that, other than wrong, was breaking Opera.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1695">#1695</a>] Removed
Ctrl-Tab hotkey for Source mode and allowed Ctrl-T to work in Firefox.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1666">#1666</a>] Fixed
permission denied errors during opening popup menus in IE6 under domain relaxation
mode.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1934">#1934</a>] Fixed
JavaScript errors when calling Selection.EnsureSelection() in dialogs.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1920">#1920</a>] Fixed
SSL warning message when opening image and flash dialogs under HTTPS in IE6.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1955">#1955</a>] [<a
target="_blank" href="http://dev.fckeditor.net/ticket/1981">#1981</a>] [<a target="_blank"
href="http://dev.fckeditor.net/ticket/1985">#1985</a>] [<a target="_blank" href="http://dev.fckeditor.net/ticket/1989">#1989</a>]
Fixed XHTML source formatting errors in non-IE browsers.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2000">#2000</a>] The #
character is now properly encoded in file names returned by the File Browser.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1945">#1945</a>] New folders
and file names are now properly sanitized against control characters. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1944">#1944</a>] Backslash
character is now disallowed in current folder path.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1055">#1055</a>] Added
logic to override JavaScript errors occurring inside the editing frame due to user
added JavaScript code.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1647">#1647</a>] Hitting
ENTER on list items containing block elements will now create new list item elements,
instead of adding further blocks to the same list item.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1411">#1411</a>] Label
only combos now get properly grayed out when moving to source view.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2009">#2009</a>] Fixed
an important bug regarding styles removal on styled text boundaries, introduced
with the 2.6 Beta 1. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2011">#2011</a>] Internal
CSS <style> tags where being outputted when FullPage=true.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2016">#2016</a>] The Link
dialog now properly selects the first field when opening it to modify mailto or
anchor links. This problem was also throwing an error in IE.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2021">#2021</a>] The caret
will no longer remain behind in the editing area when the placeholder dialog is
opened.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2024">#2024</a>] Fixed
JavaScript error in IE when the user tries to open dialogs in Source mode.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1853">#1853</a>] Setting
ShiftEnterMode to p or div now works correctly when EnterMode is br.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1838">#1838</a>] Fixed
the issue where context menus sometimes don't disappear after selecting an option.
</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2028">#2028</a>] Fixed
JavaScript error when EnterMode=br and user tries to insert a page break.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2002">#2002</a>] Fixed
the issue where the maximize editor button does not vertically expand the editing
area in Firefox.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1842">#1842</a>] PHP integration:
fixed filename encoding problems in file browser.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1832">#1832</a>] Calling
FCK.InsertHtml() in non-IE browsers would now activate the document processor as
expected.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1998">#1998</a>] The native
XMLHttpRequest class is now used in IE, whenever it is available.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1792">#1792</a>] In IE,
the browser was able to enter in an infinite loop when working with multiple editors
in the same page. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1948">#1948</a>] Some
CSS rules are reset to dialog elements to avoid conflict with the page CSS.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1965">#1965</a>] IE was
having problems with SpellerPages, causing some errors to be thrown when completing
the spell checking in some situations.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2042">#2042</a>] The FitWindow
command was throwing an error if executed in an editor where its relative button
is not present in the toolbar.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/922">#922</a>] Implemented
a generic document processor for <OBJECT> and <EMBED> tags.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1831">#1831</a>] Fixed
the issue where the placeholder icon for <EMBED> tags does not always show
up in IE7.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2049">#2049</a>] Fixed
a deleted cursor CSS attribute in the minified CSS inside fck_dialog_common.js.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1806">#1806</a>] In IE,
the caret will not any more move to the previous line when selecting a Format style
inside an empty paragraph.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1990">#1990</a>] In IE,
dialogs using API calls which deals with the selection, like InsertHtml now can
be sure the selection will be placed in the correct position.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1997">#1997</a>] With
IE, the first character of table captions where being lost on table creation.</li>
<li>The selection and cursor position was not being properly handled when creating some
elements like forms and tables.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/662">#662</a>] In the
Perl sample files, the GetServerPath function will now calculate the path properly.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2208">#2208</a>] Added
missing translations in Italian language file.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2096">#2096</a>] Added
the codepage to basexml file. Filenames with special chars should now display properly.</li>
</ul>
<h3>
Version 2.6 Beta 1</h3>
<p>
New Features and Improvements:</p>
<ul>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/35">#35</a>] <strong>New
(and cool!) floating dialog system</strong>, avoiding problems with popup blockers
and enhancing the editor usability.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1886">#1886</a>] <strong>
Adobe AIR</strong> compatibility.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/123">#123</a>] Full support
for <strong>document.domain</strong> with automatic domain detection.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1622">#1622</a>] New <strong>
inline CSS cache</strong> feature, making it possible to avoid downloading the CSS
files for the editing area and skins. For that, it is enough to set the EditorAreaCSS,
SkinEditorCSS and SkinDialogCSS to string values in the format "/absolute/path/for/urls/|<minified
CSS styles". All internal CSS links are already using this feature. </li>
<li>New language file for <strong>Canadian French</strong>.</li>
</ul>
<p>
Fixed Bugs:</p>
<ul>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1643">#1643</a>] Resolved
several "strict warning" messages in Firefox when running FCKeditor.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1522">#1522</a>] The ENTER
key will now work properly in IE with the cursor at the start of a formatted block.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1503">#1503</a>] It's
possible to define in the Styles that a Style (with an empty class) must be shown
selected only when no class is present in the current element, and selecting that
item will clear the current class (it does apply to any attribute, not only classes).</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/191">#191</a>] The scrollbars
are now being properly shown in Firefox Mac when placing FCKeditor inside a hidden
div.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/503">#503</a>] Orphaned
<li> elements now get properly enclosed in a <ul> on output.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/309">#309</a>] The ENTER
key will not any more break <button> elements at the beginning of paragraphs.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1654">#1654</a>] The editor
was not loading on a specific unknown situation. The breaking point has been removed.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1707">#1707</a>] The editor
no longer hangs when operating on documents imported from Microsoft Word.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1514">#1514</a>] Floating
panels attached to a shared toolbar among multiple FCKeditor instances are no longer
misplaced when the editing areas are absolutely or relatively positioned.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1715">#1715</a>] The ShowDropDialog
is now enforced only when ForcePasteAsPlainText = true.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1336">#1336</a>] Sometimes
the autogrow plugin didn't work properly in Firefox.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1728">#1728</a>] External
toolbars are now properly sized in Opera.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1782">#1782</a>] Clicking
on radio buttons or checkboxes in the editor in IE will no longer cause lockups
in IE.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/805">#805</a>] The FCKConfig.Keystrokes
commands where executed even if the command itself was disabled.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/982">#982</a>] The button
to empty the box in the "Paste from Word" has been removed as it leads to confusion
for some users.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1682">#1682</a>] Editing
control elements in Firefox, Opera and Safari now works properly.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1613">#1613</a>] The editor
was surrounded by a <div> element that wasn't really needed.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/676">#676</a>] If a form
control was moved in IE after creating it, then it did lose its name.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/738">#738</a>] It wasn't
possible to change the type of an existing button.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1854">#1854</a>] Indentation
now works inside table cells.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1717">#1717</a>] The editor
was entering on looping on some specific cases when dealing with invalid source
markup.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1530">#1530</a>] Pasting
text into the "Find what" fields in the Find and Replace dialog would now activate
the find and replace buttons.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1828">#1828</a>] The Find/Replace
dialog will no longer display wrong starting positions for the match when there
are multiple and identical characters preceding the character at the real starting
point of the match.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1878">#1878</a>] Fixed
a JavaScript error which occurs in the Find/Replace dialog when the user presses
"Find" or "Replace" after the "No match found" message has appeared.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1355">#1355</a>] Line
breaks and spaces are now conserved when converting to and from the "Formatted"
format.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1670">#1670</a>] Improved
the background color behind smiley icons and special characters in their corresponding
dialogs.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1693">#1693</a>] Custom
error messages are now properly displayed in the file browser.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/970">#970</a>] The text
and value fields in the selection box dialog will no longer extend beyond the dialog
limits when the user inputs a very long text or value for one of the selection options.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/479">#479</a>] Fixed the
issue where pressing Enter in an <o:p> tag in IE does not generate line breaks.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/481">#481</a>] Fixed the
issue where the image preview in image dialog sometimes doesn't display after selecting
the image from server browser.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1488">#1488</a>] PHP integration:
the FCKeditor class is now more PHP5/6 friendly ("public" keyword is used instead
of depreciated "var").</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1815">#1815</a>] PHP integration:
removed closing tag: "?>", so no additional whitespace added when files are included.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1906">#1906</a>] PHP file
browser: fixed problems with DetectHtml() function when open_basedir was set.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1871">#1871</a>] PHP file
browser: permissions applied with the chmod command are now configurable.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1872">#1872</a>] Perl
file browser: permissions applied with the chmod command are now configurable.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1873">#1873</a>] Python
file browser: permissions applied with the chmod command are now configurable.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1572">#1572</a>] ColdFusion
integration: fixed issues with setting the editor height.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1692">#1692</a>] ColdFusion
file browser: it is possible now to define TempDirectory to avoid issues with GetTempdirectory()
returning an empty string.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1379">#1379</a>] ColdFusion
file browser: resolved issues with OnRequestEnd.cfm breaking the file browser.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1509">#1509</a>] InsertHtml()
in IE will no longer turn the preceding normal whitespace into &nbsp;.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/958">#958</a>] The AddItem
method now has an additional fifth parameter "customData" that will be sent to the
Execute method of the command for that menu item, allowing a single command to be
used for different menu items..</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1502">#1502</a>] The RemoveFormat
command now also removes the attributes from the cleaned text. The list of attributes
is configurable with FCKConfig.RemoveAttributes.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1596">#1596</a>] On Safari,
dialogs have now right-to-left layout when it runs a RTL language, like Arabic.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1344">#1344</a>] Added
warning message on Copy and Cut operation failure on IE due to paste permission
settings.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1868">#1868</a>] Links
to file browser has been changed to avoid requests containing double dots.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1229">#1229</a>] Converting
multiple contiguous paragraphs to Formatted will now be merged into a single <PRE>
block.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1627">#1627</a>] Samples
failed to load from local filesystem in IE7.</li>
</ul>
<h3>
Version 2.5.1</h3>
<p>
New Features and Improvements:</p>
<ul>
<li><strong>FCKeditor.Net 2.5</strong> compatibility.</li>
<li>JavaScript integration file:
<ul>
<li>The new "<strong>FCKeditor.ReplaceAllTextareas</strong>" function is being introduced,
making it possible to replace many (or unknown) <textarea> elements in a single
call. The replacement can be also filtered by CSS class name, or by a custom function
evaluator. </li>
<li>It is now possible to set the default BasePath for all editor instances by setting
<strong>FCKeditor.BasePath</strong>. This is extremely useful when working with
the ReplaceAllTextareas function. </li>
</ul>
</li>
</ul>
<p>
Fixed Bugs:</p>
<ul>
<li>[<a href="http://dev.fckeditor.net/ticket/339" target="_blank">#339</a>] [<a
href="http://dev.fckeditor.net/ticket/681" target="_blank">#681</a>] The SpellerPages
spell checker will now completely ignore the presence of HTML tags in the text.
</li>
<li>[<a href="http://dev.fckeditor.net/ticket/1643" target="_blank">#1643</a>] Resolved
several "strict warning" messages in Firefox when running FCKeditor. </li>
<li>[<a href="http://dev.fckeditor.net/ticket/1603" target="_blank">#1603</a>] Certain
specific markup was making FCKeditor entering in a loop, blocking its execution.
</li>
<li>[<a href="http://dev.fckeditor.net/ticket/1664" target="_blank">#1664</a>] The ENTER
key will not any more swap the order of the tags when hit at the end of paragraphs.
</li>
</ul>
<h3>
Version 2.5</h3>
<p>
New Features and Improvements:</p>
<ul>
<li>The heading options have been moved to the top, in the default settings for the
Format combo.</li>
</ul>
<p>
Fixed Bugs:</p>
<ul>
<li>The focus is now correctly set when working on Safari.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1436">#1436</a>] Nested
context menu panels are now correctly closed on Safari.</li>
<li>Empty anchors are now properly created on Safari.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1359">#1359</a>] FCKeditor
will no longer produce the strange visual effect of creating a selected space and
then deleting it in Internet Explorer.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1399">#1399</a>] Removed
the empty entry in the language selection box of sample03.html.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1400">#1400</a>] Fixed
the issue where the style selection box in sample14.html is not context sensitive.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1401">#1401</a>] Completed
Hebrew translation of the user interface.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1409">#1409</a>] Completed
Finnish translation of the user interface.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1414">#1414</a>] Fixed
the issue where entity code words written inside a <pre> block in Source mode
are not converted to the corresponding characters after switching back to editor
mode.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1418">#1418</a>] Fixed
the issue where a detached toolbar would flicker when FCKeditor is being loaded.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1419">#1419</a>] Fixed
the issue where pressing Delete in the middle of two lists would incorrectly move
contents after the lists to the character position.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1420">#1420</a>] Fixed
the issue where empty list items can become collapsed and uneditable when it has
one of more indented list items directly under it. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1431">#1431</a>] Fixed
the issue where pressing Enter in a <pre> block in Internet Explorer would
move the caret one space forward instead of sending it to the next line.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1472">#1472</a>] Completed
Arabic translation of the user interface.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1474">#1474</a>] Fixed
the issue where reloading a page containing FCKeditor may provoke JavaScript errors
in Internet Explorer.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1478">#1478</a>] Fixed
the issue where parsing fckstyles.xml fails if the file contains no <style>
nodes.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1491">#1491</a>] Fixed
the issue where FCKeditor causes the selection to include an "end of line" character
in list items even though the list item is empty.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1496">#1496</a>] Fixed
the issue where attributes under <area> and <map> nodes are destroyed
or left unprotected when switching to and from Source mode.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1500">#1500</a>] Fixed
the issue where the function _FCK_PaddingNodeListener() is called excessively which
negatively affects performance.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1514">#1514</a>] Fixed
the issue where floating menus are incorrectly positioned when the toolbar or the
editor frame are not static positioned.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1518">#1518</a>] Fixed
the issue where excessive <BR> nodes are not removed after a paragraph is
split when creating lists.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1521">#1521</a>] Fixed
JavaScript error and erratic behavior of the Replace dialog.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1524">#1524</a>] Fixed
the issue where the caret jumps to the beginning or end of a list block and when
user is trying to select the end of a list item.</li>
<li>Completed Simplified Chinese translation of the user interface.</li>
<li>Completed Estonian translation of the user interface.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1406">#1406</a>] Editor
was always "dirty" if flash is available in the contents.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1561">#1561</a>] Non standard
elements are now properly applied if defined in the styles XML file.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1412">#1412</a>] The _QuickUploadLanguage
value is now work properly for Perl.</li>
<li>Several compatibility fixes for Firefox 3 (Beta 1):
<ul>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1558">#1558</a>] Nested
context menu close properly when one of their options is selected.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1556">#1556</a>] Dialogs
contents are now showing completely, without scrollbar.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1559">#1559</a>] It is
not possible to have more than one panel opened at the same time.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1554">#1554</a>] Links
now get underlined.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1557">#1557</a>] The "Automatic"
and "More colors..." buttons were improperly styled in the color selector panels
(Opera too).</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1462">#1462</a>] The enter
key will not any more scroll the main window.</li>
</ul>
</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1562">#1562</a>] Fixed
the issue where empty paragraphs are added around page breaks each time the user
switches to Source mode.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1578">#1578</a>] The editor
will now scroll correctly when hitting enter in front of a paragraph.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1579">#1579</a>] Fixed
the issue where the create table and table properties dialogs are too narrow for
certain translations.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1580">#1580</a>] Completed
Polish translation of the user interface.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1591">#1591</a>] Fixed
JavaScript error when using the blockquote command in an empty document in IE.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1592">#1592</a>] Fixed
the issue where attempting to remove a blockquote with an empty paragraph would
leave behind an empty blockquote IE.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1594">#1594</a>] Undo/Redo
will now work properly for the color selectors.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1597">#1597</a>] The color
boxes are now properly rendered in the color selector panels on sample14.html.</li>
</ul>
<h3>
Version 2.5 Beta</h3>
<p>
New Features and Improvements:</p>
<ul>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/624">#624</a>] [<a
target="_blank" href="http://dev.fckeditor.net/ticket/634">#634</a>] [<a target="_blank"
href="http://dev.fckeditor.net/ticket/1300">#1300</a>] [<a target="_blank" href="http://dev.fckeditor.net/ticket/1301">#1301</a>]
Official compatibility support with <strong>Opera 9.50</strong> and <strong>Safari 3</strong>
(WebKit based browsers actually). These browsers are still in Beta, but we are confident
that we'll have amazing results as soon as they get stable. We are continuously
collaborating with Opera Software and Apple to bring a wonderful FCKeditor experience
over their browser platforms.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/494">#494</a>] Introduced
the <strong>new Style System</strong>. We are not anymore relaying on browser features
to apply and remove styles, which guarantees that the editor will <strong>behave in
the same way in all browsers</strong>. It is an incredibly flexible system,
which aims to fit all developer's needs, from Flash content or HTML4 to XHTML 1.0
Strict or XHTML 1.1:
<ul>
<li>All basic formatting features, like Bold and Italic, can be precisely controlled
by using the configuration file (<b>CoreStyles</b> setting). It means that now,
the Bold button, for example, can produce <b>, <strong>, <span class...>,
<span style...> or anything the developer prefers.</li>
<li>Again with the <b>CoreStyles</b> setting, each block format, font, size, and even
the color pickers can precisely reflect end developer's needs.</li>
<li>Because of the above changes, font sizes are much more flexible. <b>Any kind of
font unit</b> can be used, including a mix of units.</li>
<li>All styles, including toolbar bottom styles, are precisely controlled when being
applied to the document. FCKeditor uses an element table derived from the <b>W3C XHTML
DTDs</b> to precisely create the elements, guarantee standards compliant code.</li>
<li><b>No more <font> tags</b>... well... actually, the system is so flexible
that it is up to you to use them or not.</li>
<li>It is possible to configure FCKeditor to produce a truly <b>semantic aware </b>and<b>
XHTML 1.1 compliant </b>code. Check out sample14.html.</li>
<li>It's also possible to precisely control which inline elements must be removed with
the "Remove All" button, by using the "<b>RemoveFormatTags</b>"
setting.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1231">#1231</a>] [<a
target="_blank" href="http://dev.fckeditor.net/ticket/160">#160</a>] Paragraph <b>indentation</b>
and <b>justification</b> now uses style attributes and don't create unnecessary
elements, and <blockquote> is not anymore used for it. Now, even CSS classes
can be used to indent or align text.</li>
<li>All paragraph formatting features work well when EnterMode=br.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/172">#172</a>] All paragraph
formatting features work well when list items too.</li>
</ul>
</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1197">#1197</a>] [<a
target="_blank" href="http://dev.fckeditor.net/ticket/132">#132</a>] The toolbar
now presents a <strong>new button for Blockquote</strong>. The indentation button
will not anymore be used for that.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/125">#125</a>] Table's
<strong>columns size can now be changed by dragging on cell borders</strong>, with
the "dragresizetable" plugin. </li>
<li>The EditorAreaCSS config option can now also be set to a string of paths separated
by commas.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/212">#212</a>] New "<strong>Show
Blocks</strong>" command button in toolbar to show block details in the editing
area. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/915">#915</a>] The <strong>
undo/redo system has been revamped</strong> to work the same across Internet Explorer
and Gecko-based browsers (e.g. Firefox). A number of critical bugs in the undo/redo
system are also fixed. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/194">#194</a>] The editor
now uses the <strong>Data Processor</strong> technology, which makes it possible
to handle different input formats. A sample of it may be found at "editor/plugins/bbcode/_sample",
that shows some simple BBCode support. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/145">#145</a>] The "htaccess.txt"
file has been renamed to ".htaccess" as it doesn't bring security concerns, being
active out of the box.</li>
<li>File Browser and Quick Upload changes:
<ul>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/163">#163</a>] <span
style="color: #ff0000"><strong>Attention:</strong></span> The default connector
in fckconfig.js has been changed from ASP to PHP. If you are using ASP remember
to change the _FileBrowserLanguage and _QuickUploadLanguage settings in your fckconfig.js.
[<a target="_blank" href="http://dev.fckeditor.net/ticket/454">#454</a>] The file
browser and upload connectors have been unified so they can reuse the same configuration
settings.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/865">#865</a>] The ASP
and PHP connectors have been improved so it's easy to select the location of the
destination folder for each file type, and it's no longer necessary to use the "file",
"image", "flash" subfolders<br />
<span style="color: #ff0000"><strong>Attention:</strong></span> The location of
all the connectors have been changed in the fckconfig.js file. Please check your
settings to match the current ones. Also review carefully the config file for your
server language. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/688">#688</a>] Now the
Perl quick upload is available. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/575">#575</a>] The Python
connector has been rewritten as a WSGI app to be fully compatible with the latest
python frameworks and servers. The QuickUpload feature has been added as well as
all the features available in the PHP connector. Thanks to Mariano Reingart.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/561">#561</a>] The ASP
connector provides an AbsolutePath setting so it's possible to set the url to a
full domain or a relative path and specify that way the physical folder where the
files are stored..</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/333">#333</a>] The Quick
Upload now can use the same ServerPath parameter as the full connector.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/199">#199</a>] The AllowedCommands
configuration setting is available in the asp and php connectors so it's possible
to disallow the upload of files (although the "select file" button will still be
available in the file browser).</li>
</ul>
</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/100">#100</a>] A new configuration
directive "FCKConfig.EditorAreaStyles" has been implemented to allow setting editing
area styles from JavaScript. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/102">#102</a>] HTML code
generated by the "Paste As Plain Text" feature now obeys the EnterMode setting.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1266">#1266</a>] Introducing
the HtmlEncodeOutput setting to instruct the editor to HTML-encode some characters
(&, < and >) in the posted data.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/357">#357</a>] Added a
"Remove Anchor" option in the context menu for anchors. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1060">#1060</a>] Compatibility
checks with Firefox 3.0 Alpha. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/817">#817</a>] [<a
target="_blank" href="http://dev.fckeditor.net/ticket/1077">#1077</a>] New "Merge
Down/Right" commands for merging tables cells in non-Gecko browsers.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1288">#1288</a>] The "More
Colors..." button in color selector popup has been made optional and configurable
by the <strong>EnableMoreFontColors</strong> option. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/356">#356</a>] The <strong>
Find and Replace</strong> dialogs are now unified into a single dialog with tabs.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/549">#549</a>] Added a
'None' option to the FCKConfig.ToolbarLocation option to allow for hidden toolbars.
</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1313">#1313</a>] An XHTML
1.1 target editor sample has been created as sample14.html. </li>
<li>The ASP, ColdFusion and PHP integration have been aligned to our standards.</li>
</ul>
<p>
Fixed Bugs:</p>
<ul>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/71">#71</a>] [<a target="_blank"
href="http://dev.fckeditor.net/ticket/243">#243</a>] [<a target="_blank" href="http://dev.fckeditor.net/ticket/267">#267</a>]
The editor now takes care to not create invalid nested block elements, like creating
<form> or <hr> inside <p>. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1511298&group_id=75348&atid=543655">SF
Patch 1511298</a>] The CF Component failed on CFMX 6.0</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/639">#639</a>] If the
FCKConfig.DefaultLinkTarget setting was missing in fckconfig.js the links has target="undefined".</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/497">#497</a>] Fixed EMBED
attributes handling in IE.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1315722&group_id=75348&atid=543655">SF
Patch 1315722</a>] Avoid getting a cached version of the folder contents after uploading
a file</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1386086&group_id=75348&atid=543655">SF
Patch 1386086</a>] The php connector has been protected so mkdir doesn't fail if
there are double slashes.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/943">#943</a>] The PHP
connector now specifies that the included files are relative to the current path.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/560">#560</a>] The PHP
connector will work better if the connector or the userfiles folder is a symlink.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/784">#784</a>] Fixed a
non initialized $php_errormsg in the PHP connector.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/802">#802</a>] The replace
dialog will now advance its searching position correctly and is able to search for
strings spanning across multiple inline tags.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/944">#944</a>] The _samples
didn't work directly from the Mac filesystem.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/946">#946</a>] Toolbar
images didn't show in non-IE browsers if the path contained a space.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/291">#291</a>] [<a
target="_blank" href="http://dev.fckeditor.net/ticket/395">#395</a>] [<a target="_blank"
href="http://dev.fckeditor.net/ticket/932">#932</a>] Clicking outside the editor
it was possible to paste or apply formatting to the rest of the page in IE.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/137">#137</a>] Fixed FCKConfig.TabSpaces
being ignored, and weird behaviors when pressing tab in edit source mode.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/268">#268</a>] Fixed special
XHTML characters present in event attribute values being converted inappropriately
when switching to source view.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/272">#272</a>] The toolbar
was cut sometimes in IE to just one row if there are multiple instances of the editor.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/515">#515</a>] Tables
in Firefox didn't inherit font styles properly in Standards mode.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/321">#321</a>] If FCKeditor
is initially hidden in Firefox it will no longer be necessary to call the oEditor.MakeEditable()
function.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/299">#299</a>] The 'Browse
Server' button in the Image and Flash dialogs was a little too high.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/931">#931</a>] The BodyId
and BodyClass configuration settings weren't applied in the preview window.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/583">#583</a>] The "noWrap"
attribute for table cells was getting an empty value in Firefox. Thanks to geirhelge.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/141">#141</a>] Fixed incorrect
startup focus in Internet Explorer after page reloads. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/143">#143</a>] Fixed browser
lockup when the user writes <!--{PS..x}> into the editor in source mode. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/174">#174</a>] Fixed incorrect
positioning of FCKeditor in full screen mode. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/978">#978</a>] Fixed a
SpellerPages error with ColdFusion when no suggestions where available for a word.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/977">#977</a>] The "shape"
attribute of <area> had its value changed to uppercase in IE.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/996">#996</a>] "OnPaste"
event listeners will now get executed only once.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/289">#289</a>] Removed
debugging popups from page load regarding JavaScript and CSS loading errors.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/328">#328</a>] [<a
target="_blank" href="http://dev.fckeditor.net/ticket/346">#346</a>] [<a target="_blank"
href="http://dev.fckeditor.net/ticket/404">#404</a>] Fixed a number of problems
regarding <pre> blocks:
<ol>
<li>Leading whitespaces and line breaks in <pre> blocks are trimmed when the user
switches between editor mode and source mode;</li>
<li>Pressing Enter inside a <pre> block would split the block into two, but the
expected behavior is simply inserting a line break;</li>
<li>Simple line breaks inside <pre> blocks entered in source mode are being turned
into <br> tags when the user switches to editor mode and back.</li>
</ol>
</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/581">#581</a>] Fixed the
issue where the "Maximize the editor size" toolbar button stops working if any of
the following occurs:
<ol>
<li>There exists a form input whose name or id is "style" in FCKeditor's host form;</li>
<li>There exists a form input whose name or id is "className" in FCKeditor's host form;</li>
<li>There exists a form and a form input whose name of id is "style" in the editing
frame.</li>
</ol>
</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/183">#183</a>] Fixed the
issue when FCKeditor is being executed in a custom application with the WebBrowser
ActiveX control, hiding the WebBrowser control would incorrectly invoke FCKeditor's
cleanup routines, causing FCKeditor to stop working.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/539">#539</a>] Fixed the
issue where right clicking on a table inside the editing frame in Firefox would
cause the editor the scroll to the top of the document.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/523">#523</a>] Fixed the
issue where, under certain circumstances, FCKeditor would obtain focus at startup
even though FCKConfig.StartupFocus is set to false. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/393">#393</a>] Fixed the
issue where if an inline tag is at the end of the document, the user would have
no way of escaping from the inline tag if he continues typing at the end of the
document. FCKeditor's behaviors regarding inline tags has been made to be more like
MS Word's:
<ol>
<li>If the caret is moved to the end of a hyperlink by the keyboard, then hyperlink
mode is disabled. </li>
<li>If the caret is moved to the end of other styled inline tags by any key other than
the End key (like bold text or italic text), the original bold/italic/... modes
would continue to be effective. </li>
<li>If the caret is moved to the end of other styled inline tags by the End key, all
style tag modes (e.g. bold, italic, underline, etc.) would be canceled. This is
not consistent with MS Word, but provides a convenient way for the user to escape
the inline tag at the end of a line.</li>
</ol>
</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/338">#338</a>] Fixed the
issue where the configuration directive FCKConfig.ForcePasteAsPlainText is ignored
when new contents are pasted into the editor via drag-and drop from outside of the
editor. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1026">#1026</a>] Fixed
the issue where the cursor or selection positions are not restored with undo/redo
commands correctly in IE, under some circumstances. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1160">#1160</a>] [<a
target="_blank" href="http://dev.fckeditor.net/ticket/1184">#1184</a>] Home, End
and Tab keys are working properly for numeric fields in dialogs. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/68">#68</a>] The style
system now properly handles Format styles when EnterMode=br.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/525">#525</a>] The union
of successive DIVs will work properly now if EnterMode!=div.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1227">#1227</a>] The color
commands used an unnecessary temporary variable. Thanks to Matthias Miller</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/67">#67</a>] [<a target="_blank"
href="http://dev.fckeditor.net/ticket/277">#277</a>] [<a target="_blank" href="http://dev.fckeditor.net/ticket/427">#427</a>]
[<a target="_blank" href="http://dev.fckeditor.net/ticket/428">#428</a>] [<a target="_blank"
href="http://dev.fckeditor.net/ticket/965">#965</a>] [<a target="_blank" href="http://dev.fckeditor.net/ticket/1178">#1178</a>]
[<a target="_blank" href="http://dev.fckeditor.net/ticket/1267">#1267</a>] The list
insertion/removal/indent/outdent logic in FCKeditor has been rewritten, such that:
<ol>
<li>Text separated by <br> will always be treated as separate items during list
insertion regardless of browser;</li>
<li>List removal will now always obey the FCKConfig.EnterMode setting;</li>
<li>List indentation will be XHTML 1.1 compliant - all child elements under an <ol>
or <ul> must be <li> nodes;</li>
<li>IE editor hacks like <ul type="1"> will no longer appear;</li>
<li>Excessive <div> nodes are no longer inserted into list items due to alignment
changes.</li>
</ol>
</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/205">#205</a>] Fixed the
issue where visible <br> tags at the end of paragraphs are incorrectly removed
after switching to and from source mode.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1050">#1050</a>] Fixed
a minor PHP/XML incompatibility bug in editor/dialog/fck_docprops.html.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/462">#462</a>] Fixed an
algorithm bug in switching from source mode to WYSIWYG mode which causes the browser
to spin up and freeze for broken HTML code inputs.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1019">#1019</a>] Table
command buttons are now disabled when the current selection is not inside a table.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/135">#135</a>] Fixed the
issue where context menus are misplaced in FCKeditor when FCKeditor is created inside
a <div> node with scrolling. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1067">#1067</a>] Fixed
the issue where context menus are misplaced in Safari when FCKeditor is scrolled
down.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1081">#1081</a>] Fixed
the issue where undoing table deletion in IE7 would cause JavaScript errors.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1061">#1061</a>] Fixed
the issue where backspace and delete cannot delete special characters in Firefox
under some circumstances.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/403">#403</a>] Fixed the
issue where switching to and from source mode in full page mode under IE would add
excessive line breaks to <style> blocks.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/121">#121</a>] Fixed the
issue where maximizing FCKeditor inside a frameset would resize FCKeditor to the
whole window's size instead of just the container frame's size.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1093">#1093</a>] Fixed
the issue where pressing Enter inside an inline tag would not create a new paragraph
correctly.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1089">#1089</a>] Fixed
the issue where pressing Enter inside a <pre> block do not generate visible
line breaks in IE.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/332">#332</a>] Hitting
Enter when the caret is at the end of a hyperlink will no longer continue the link
at the new paragraph.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1121">#1121</a>] Hitting
Enter with FCKConfig.EnterMode=br will now scroll the document correctly when the
new lines have exceeded the lower boundary of the editor frame.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1063">#1063</a>] [<a
target="_blank" href="http://dev.fckeditor.net/ticket/1084">#1084</a>] [<a target="_blank"
href="http://dev.fckeditor.net/ticket/1092">#1092</a>] Fixed a few Norwegian
language translation errors.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1148">#1148</a>] Fixed
the issue where the "Automatic" and "More Colors..." buttons
in the color selection panel are not centered in Safari.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1187">#1187</a>] Fixed
the issue where the "Paste as plain text" command cannot be undone in
non-IE browsers.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1222">#1222</a>] Ctrl-Backspace
operations will now save undo snapshots in all browsers.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1223">#1223</a>] Fixed
the issue where the insert link dialog would save multiple undo snapshots for a
single operation.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/247">#247</a>] Fixed the
issue where deleting everything in the document in IE would create an empty <p>
block in the document regardless of EnterMode setting. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1280">#1280</a>] Fixed
the issue where opening a combo box will cause the editor frames to lose focus when
there are multiple editors in the same document.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/363">#363</a>] Fixed the
issue where the Find dialog does not work under Opera.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/50">#50</a>] Fixed the
issue where the Paste button is always disabled in Safari.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/389">#389</a>] Pasting
text with comments from Word won't generate errors in IE, thanks to the idea from
Swift.</li>
<li>The pasting area in the Paste from Word dialog is focused on initial load</li>
<li>Some fixes related to html comment handling in the Word clean up routine</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1303">#1303</a>] <col>
is correctly treated as an empty element.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/969">#969</a>] Removed
unused files (fcknumericfield.htc and moz-bindings.xml).</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1166">#1166</a>] Fixed
the issue where <meta> tags are incorrectly outputted with closing tags in
full page mode.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1200">#1200</a>] Fixed
the issue where context menus sometimes disappear prematurely before the user can
click on any items in Opera.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1315">#1315</a>] Fixed
the issue where the source view text area in Safari is displayed with an excessive
blue border.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1201">#1201</a>] Fixed
the issue where hitting Backspace or Delete inside a table cell deletes the table
cell instead of its contents in Opera.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1311">#1311</a>] Fixed
the issue where undoing and redoing a special character insertion would send the
caret to incorrect positions. (e.g. the beginning of document)</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/923">#923</a>] Font colors
are now properly applied on links.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1316">#1316</a>] Fixed
the issue where the image dialog expands to a size too big in Safari.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1306">#1306</a>] [<a
target="_blank" href="http://dev.fckeditor.net/ticket/894">#894</a>] The undo system
can now undo text formatting steps like setting fonts to bold and italic.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/95">#95</a>] Fixed the
issue where FCKeditor breaks <meta> tags in full page mode in some circumstances.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/175">#175</a>] Fixed the
issue where entering an email address with a '%' sign in the insert link dialog
would cause JavaScript error.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/180">#180</a>] Improved
backward compatibility with older PHP versions. FCKeditor can now work with PHP
versions down to 4.0.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/192">#192</a>] Document
modifying actions from the FCKeditor JavaScript API will now save undo steps.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/246">#246</a>] Using text
formatting commands in EnterMode=div will no longer cause tags to randomly disappear.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/327">#327</a>] It is no
longer possible for the browser's back action to misfire when a user presses backspace
while an image is being selected in FCKeditor.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/362">#362</a>] Ctrl-Backspace
now works in FCKeditor.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/390">#390</a>] Text alignment
and justification commands now respects EnterMode=br paragraph rules.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/534">#534</a>] Pressing
Ctrl-End while the document contains a list towards the end will no longer make
the cursor disappear.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/906">#906</a>] It is now
possible to have XHTML 1.0 Strict compliant output from a document pasted from Word.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/929">#929</a>] Pressing
the Enter key will now produce an undo step.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/934">#934</a>] Fixed the
"Cannot execute code from a freed script" error in IE from editor dialogs.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/942">#942</a>] Server
based spell checking with ColdFusion integration no longer breaks fir non en_US
languages.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/942">#1056</a>] Deleting
everything in the editor document and moving the cursor around will no longer leave
the cursor hanging beyond the top of the editor document.</li>
</ul>
<p>
# This version has been <a href="http://dev.fckeditor.net/wiki/SD/COE">partially sponsored</a>
by the <a href="http://www.coe.int/">Council of Europe</a>.
</p>
<h3>
Version 2.4.3</h3>
<p>
New Features and Improvements:</p>
<ul>
<li>It is now possible to set the default target when creating links, with the new "<strong>DefaultLinkTarget</strong>"
setting. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/436">#436</a>] The new
"<strong>FirefoxSpellChecker</strong>" setting is available, to enable/disable the
Firefox built-in spellchecker while typing. Even if word suggestions will not appear
in the FCKeditor context menu, this feature is useful to quickly identify misspelled
words.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/311">#311</a>] The new
"<strong>BrowserContextMenuOnCtrl</strong>" setting is being introduced, to enable/disable
the ability of displaying the default browser's context menu when right-clicking
with the CTRL key pressed.</li>
</ul>
<p>
Fixed Bugs:</p>
<ul>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/300">#300</a>] The fck_internal.css
file was not validating with the W3C CSS Validation Service.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/336">#336</a>] Ordered
list didn't keep the Type attribute properly (it was converted to lowercase when
the properties dialog was opened again).</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/318">#318</a>] Multiple
linked images are merged in a single link in IE.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/350">#350</a>] The <marquee>
element will no longer append unwanted <p>&nbsp;</p> to the code.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/351">#351</a>] The content
was being lost for images or comments only HTML inserted directly in the editor
source or loaded in the editor.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/388">#388</a>] Creating
links in lines separated by <br> in IE can lead to a merge of the links.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/325">#325</a>] Calling
the GetXHTML can distort visually the rendering in Firefox.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/391">#391</a>] When ToolbarLocation=Out,
a "Security Warning" alert was being shown in IE if under https. Thanks to reister.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/360">#360</a>] Form "name"
was being set to "[object]" if it contained an element with id="name".</li>
<li>Fixed a type that was breaking the ColdFusion SpellerPages integration file when
no spelling errors were found.</li>
<li>The ColdFusion SpellerPages integration was not working it Aspell was installed
in a directory with spaces in the name.</li>
<li>Added option to SpellerPages to ignore "alt" attributes.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/451">#451</a>] Classes
for images in IE didn't take effect immediately.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/430">#430</a>] Links with
a class did generate a span in Firefox when removing them.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/274">#274</a>] The PHP
quick upload still tried to use the uppercased types instead of the lowercased ones.
</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/416">#416</a>] The PHP
quick upload didn't check for the existence of the folder before saving.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/467">#467</a>] If InsertHtml
was called in IE with a comment (or any protected source at the beginning) it was
lost.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1518766&group_id=75348&atid=543653">SF
BUG-1518766</a>] Mozilla 1.7.13 wasn't recognized properly as an old Gecko engine.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/324">#324</a>] Improperly
nested tags could lead to a crash in IE.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/455">#455</a>] Files and
folders with non-ANSI names were returned with a double UTF-8 encoding in the PHP
File Manager.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/273">#273</a>] The extensions
"sh", "shtml", "shtm" and "phtm" have been added to the list of denied extensions
on upload.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/453">#453</a>] No more
errors when hitting del inside an empty table cell.</li>
<li>The perl connector cgi file has been changed to Unix line endings.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/202">#202</a>] Regression:
The HR tag will not anymore break the contents loaded in the editor. </li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/508">#508</a>] The HR
command had a typo.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/505">#505</a>] Regression:
IE crashed if a table caption was deleted.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/82">#82</a>] [<a target="_blank"
href="http://dev.fckeditor.net/ticket/359">#359</a>] <object> and <embed>
tags are not anymore lost in IE.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/493">#493</a>] If the
containing form had a button named "submit" the "Save" command didn't work in Firefox.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/414">#414</a>] If tracing
was globally enabled in Asp.Net 2.0 then the Asp.Net connector did fail.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/520">#520</a>] The "Select
Field" properties dialog was not correctly handling select options with &, <
and >.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/258">#258</a>] The Asp
integration didn't pass boolean values in English, using instead the locale of the
server and failing.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/487">#487</a>] If an image
with dimensions set as styles was opened with the image manager and then the dialog
was canceled the dimensions in the style were lost.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/220">#220</a>] The creation
of links or anchors in a selection that results on more than a single link created
will not anymore leave temporary links in the source. All links will be defined
as expected.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/220">#182</a>] [<a
target="_blank" href="http://dev.fckeditor.net/ticket/220">#261</a>] [<a target="_blank"
href="http://dev.fckeditor.net/ticket/220">#511</a>] Special characters, like
percent signs or accented chars, and spaces are now correctly returned by the File
Browser.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/281">#281</a>] Custom
toolbar buttons now render correctly in all skins.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/527">#527</a>] If the
configuration for a toolbar isn't fully valid, try to keep on parsing it.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/187">#187</a>] [<a
target="_blank" href="http://dev.fckeditor.net/ticket/435">#435</a>] [<a target="_blank"
href="https://sourceforge.net/tracker/?func=detail&aid=1612978&group_id=75348&atid=543653">SF
BUG-1612978</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1163511&group_id=75348&atid=543653">SF
BUG-1163511</a>] Updated the configuration options in the ColdFusion integration
files.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1726781&group_id=75348&atid=543655">SF
Patch-1726781</a>] Updated the upload class for asp to handle large files and other
data in the forms. Thanks to NetRube.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/225">#225</a>] With ColdFusion,
the target directory is now being automatically created if needed when "quick uploading".
Thanks to sirmeili.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/295">#295</a>] [<a
target="_blank" href="http://dev.fckeditor.net/ticket/510">#510</a>] Corrected some
path resolution issues with the File Browser connector for ColdFusion.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/239">#239</a>] The <xml>
tag will not anymore cause troubles.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1721787&group_id=75348&atid=543653">SF
BUG-1721787</a>] If the editor is run from a virtual dir, the PHP connector will
detect that and avoid generating a wrong folder.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/431">#431</a>] PHP: The
File Browser now displays an error message when it is not able to create the configured
target directory for files (instead of sending broken XML responses).</li>
</ul>
<h3>
Version 2.4.2</h3>
<p>
Fixed Bugs:</p>
<ul>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/279">#279</a>] The UTF-8
BOM was being included in the wrong files, affecting mainly PHP installations.</li>
</ul>
<h3>
Version 2.4.1</h3>
<p>
New Features and Improvements:</p>
<ul>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/118">#118</a>] The SelectAll
command now is available in Source Mode.</li>
<li>The new open source FCKpackager sub-project is now available. It replaces the FCKeditor.Packager
software to compact the editor source.</li>
<li>With Firefox, if a paste execution is blocked by the browser security settings,
the new "Paste" popup is shown to the user to complete the pasting operation. </li>
</ul>
<p>
Fixed Bugs:</p>
<ul>
<li>Various fixes to the ColdFusion File Browser connector.</li>
<li>We are now pointing the download of ieSpell to their pages, instead to a direct
file download from one of their mirrors. This disables the ability of "click and
go" (which can still be achieved by pointing the download to a file in your server),
but removes any troubles with mirrors link changes (and they change it frequently).</li>
<li>The Word cleanup has been changed to remove "display:none" tags that may come from
Word.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1659613&group_id=75348">SF
BUG-1659613</a>] The 2.4 version introduced a bug in the flash handling code that
generated out of memory errors in IE7.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1660456&group_id=75348">SF
BUG-1660456</a>] The icons in context menus were draggable.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1653009&group_id=75348">SF
BUG-1653009</a>] If the server is configured to process html files as asp then it
generated ASP error 0138.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1288609&group_id=75348">SF
BUG-1288609</a>] The content of iframes is now preserved.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1245504&group_id=75348">SF
BUG-1245504</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1652240&group_id=75348">SF
BUG-1652240</a>] Flash files without the .swf extension weren't recognized upon
reload.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1649753&group_id=75348&atid=543655">SF
PATCH-1649753</a>] Node selection for text didn't work in IE. Thanks to yurik dot
m.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1573191&group_id=75348&atid=543653">SF
BUG-1573191</a>] The Html code inserted with FCK.InsertHtml didn't have the same
protection for special tags.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/110">#110</a>] The OK
button in dialogs had its width set as an inline style.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/113">#113</a>] [<a
target="_blank" href="http://dev.fckeditor.net/ticket/94">#94</a>] [<a target="_blank"
href="https://sourceforge.net/tracker/?func=detail&aid=1659270&group_id=75348&atid=543653">SF
BUG-1659270</a>] ForcePasteAsPlainText didn't work in Firefox.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/114">#114</a>] The correct
entity is now used to fill empty blocks when ProcessHTMLEntities is disabled.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/90">#90</a>] The editor
was wrongly removing some <br> tags from the code.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/139">#139</a>] The CTRL+F
and CTRL+S keystroke default behaviors are now preserved.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/138">#138</a>] We are
not providing a CTRL + ALT combination in the default configuration file because
it may be incompatible with some keyboard layouts. So, the CTRL + ALT + S combination
has been changed to CTRL + SHIFT + S.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/129">#129</a>] In IE,
it was not possible to paste if "Allow paste operation via script" was disabled
in the browser security settings.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/112">#112</a>] The enter
key now behaves correctly on lists with Firefox, when the EnterMode is set to 'br'.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/152">#152</a>] Invalid
self-closing tags are now being fixed before loading. </li>
<li>A few tags were being ignored to the check for required contents (not getting stripped
out, as expected). Fixed.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/202">#202</a>] The HR
tag will not anymore break the contents loaded in the editor.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/211">#211</a>] Some invalid
inputs, like "<p>" where making the caret disappear in Firefox.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/99">#99</a>] The <div>
element is now considered a block container if EnterMode=p|br. It acts like a simple
block only if EnterMode=div.</li>
<li>Hidden fields will now show up as an icon in IE, instead of a normal text field.
They are also selectable and draggable, in all browsers.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/213">#213</a>] Styles
are now preserved when hitting enter at the end of a paragraph.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/77">#77</a>] If ShiftEnterMode
is set to a block tag (p or div), the desired block creation in now enforced, instead
of copying the current block (which is still the behavior of the simple enter).</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/209">#209</a>] Links and
images URLs will now be correctly preserved with Netscape 7.1.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/165">#165</a>] The enter
key now honors the EnterMode settings when outdenting a list item.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/190">#190</a>] Toolbars
may be wrongly positioned. Fixed.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/254">#254</a>] The IgnoreEmptyParagraphValue
setting is now correctly handled in Firefox.</li>
<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/254">#248</a>] The behavior
of the backspace key has been fixed on some very specific cases.</li>
</ul>
<h3>
Version 2.4</h3>
<p>
New Features and Improvements:</p>
<ul>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1329273&group_id=75348&atid=543656">SF
Feature-1329273</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1456005&group_id=75348&atid=543656">SF
Feature-1456005</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1315002&group_id=75348&atid=543653">SF
BUG-1315002</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1350180&group_id=75348&atid=543653">SF
BUG-1350180</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1450689&group_id=75348&atid=543653">SF
BUG-1450689</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1461033&group_id=75348&atid=543653">SF
BUG-1461033</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1510111&group_id=75348&atid=543653">SF
BUG-1510111</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1203560&group_id=75348&atid=543653">SF
BUG-1203560</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1564838&group_id=75348&atid=543653">SF
BUG-1564838</a>] The advance <strong>Enter Key Handler</strong>
is now being introduced. It gives you complete freedom to configure the editor to
generate <strong><p>, <div> or <br></strong> when the user uses
both the [Enter] and [Shift]+[Enter] keys. The new "EnterMode" and "ShiftEnterMode"
settings can be use to control its behavior. It also guarantees that all browsers
will generate the same output. </li>
<li>The new and powerful <strong>Keyboard Accelerator System</strong> is being introduced.
You can now precisely control the commands to execute when some key combinations
are activated by the user. It guarantees that all browsers will have the same behavior
regarding the shortcuts.<br />
It also makes it possible to remove buttons from the toolbar and still invoke their
features by using the keyboard instead.
<br />
It also blocks all default "CTRL based shortcuts" imposed by the browsers, so if
you don't want users to underline text, just remove the CTRL+U combination from
the keystrokes table. Take a look at the FCKConfig.Keystrokes setting in the fckconfig.js
file. </li>
<li>The new "<strong>ProtectedTags</strong>" configuration option is being introduced.
It will accept a list of tags (separated by a pipe "|"), which will have no effect
during editing, but will still be part of the document DOM. This can be used mainly
for non HTML standard, custom tags.</li>
<li>Dialog box commands can now open resizable dialogs (by setting oCommand.Resizable
= true).</li>
<li>Updated support for AFP. Thanks to Soenke Freitag.</li>
<li>New language file:<ul>
<li><strong>Afrikaans</strong> (by Willem Petrus Botha). </li>
</ul>
</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1456343&group_id=75348&atid=543655">SF
Patch-1456343</a>] New sample file showing how to dynamically exchange a textarea
and an instance of FCKeditor. Thanks to Finn Hakansson</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1496115&group_id=75348&atid=543655">SF
Patch-1496115</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1588578&group_id=75348&atid=543653">SF
BUG-1588578</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1376534&group_id=75348&atid=543653">SF
BUG-1376534</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1343506&group_id=75348&atid=543653">SF
BUG-1343506</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1211065&group_id=75348&atid=543656">SF
Feature-1211065</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=949144&group_id=75348&atid=543656">SF
Feature-949144</a>] The content of anchors are shown and preserved
on creation. * </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1587175&group_id=75348&atid=543656">SF
Feature-1587175</a>] Local links to an anchor are readjusted if the anchor changes.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1500040&group_id=75348&atid=543655">SF
Patch-1500040</a>] New configuration values to specify the Id and Class for the
body element.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1577202&group_id=75348&atid=543655">SF
Patch-1577202</a>] The links created with the popup option now are accessible even
if the user has JavaScript disabled.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1443472&group_id=75348&atid=543655">SF
Patch-1443472</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1576488&group_id=75348&atid=543653">SF
BUG-1576488</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1334305&group_id=75348&atid=543653">SF
BUG-1334305</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1578312&group_id=75348&atid=543653">SF
BUG-1578312</a>] The Paste from Word clean up function can be configured
with FCKConfig.CleanWordKeepsStructure to preserve the markup as much as possible.
Thanks Jean-Charles ROGEZ. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1472654&group_id=75348&atid=543655">SF
Patch-1472654</a>] The server side script location for SpellerPages can now be set
in the configuration file, by using the SpellerPagesServerScript setting.</li>
<li><span style="color: #ff0000">Attention:</span> All connectors are now pointing by
default to the "/userfiles/" folder instead of "/UserFiles/" (case change). Also,
the inner folders for each type (file, image, flash and media) are all lower-cased
too.</li>
<li><span style="color: #ff0000">Attention:</span> The UseBROnCarriageReturn configuration
is not anymore valid. The EnterMode setting can now be used to precisely set the
enter key behavior.</li>
</ul>
<p>
Fixed Bugs:</p>
<ul>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1444937&group_id=75348">SF
BUG-1444937</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1274364&group_id=75348">SF
BUG-1274364</a>] Shortcut keys are now undoable correctly.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1015230&group_id=75348">SF
BUG-1015230</a>] Toolbar buttons now update their state on shortcut keys activation.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1485621&group_id=75348">SF
BUG-1485621</a>] It is now possible to precisely control which shortcut keys can
be used.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1573714&group_id=75348">SF
BUG-1573714</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1593323&group_id=75348">SF
BUG-1593323</a>] Paste was not working in IE if both AutoDetectPasteFromWord
and ForcePasteAsPlainText settings were set to "false". </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1578306&group_id=75348">SF
BUG-1578306</a>] The context menu was wrongly positioned if the editing document
was set to render in strict mode. Thanks to Alfonso Martinez.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1567060&group_id=75348">SF
BUG-1567060</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1565902&group_id=75348">SF
BUG-1565902</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1440631&group_id=75348">SF
BUG-1440631</a>] IE was getting locked on some specific cases. Fixed.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1582859&group_id=75348">SF
BUG-1582859</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1579507&group_id=75348&atid=543655">SF
Patch-1579507</a>] Firefox' spellchecker is now disabled during editing mode.
Thanks to Alfonso Martinez.</li>
<li>Fixed Safari and Opera detection system (for development purposes only).</li>
<li>Paste from Notepad was including font information in IE. Fixed.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1584092&group_id=75348">SF
BUG-1584092</a>] When replacing text area, names with spaces are now accepted.</li>
<li>Depending on the implementation of toolbar combos (mainly for custom plugins) the
editor area was loosing the focus when clicking in the combo label. Fixed.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1596937&group_id=75348&atid=543653">SF
BUG-1596937</a>] InsertHtml() was inserting the HTML outside the editor area on
some very specific cases.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1585548&group_id=75348">SF
BUG-1585548</a>] On very specific, rare and strange cases, the XHTML processor was
not working properly in IE. Fixed.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1584951&group_id=75348">SF
BUG-1584951</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1380598&group_id=75348">SF
BUG-1380598</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1198139&group_id=75348">SF
BUG-1198139</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1437318&group_id=75348">SF
BUG-1437318</a>] In Firefox, the style selector will not anymore delete
the contents when removing styles on specific cases.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1515441&group_id=75348">SF
BUG-1515441</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1451071&group_id=75348">SF
BUG-1451071</a>] The "Insert/Edit Link" and "Select All" buttons are now working
properly when the editor is running on a IE Modal dialog.</li>
<li>On some very rare cases, IE was throwing a memory error when hiding the context
menus. Fixed.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1526154&group_id=75348">SF
BUG-1526154</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1509208&group_id=75348&atid=543653">SF
BUG-1509208</a>] With Firefox, <style> tags defined in the source are
now preserved.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1535946&group_id=75348">SF
BUG-1535946</a>] The IE dialog system has been changed to better work with custom
dialogs.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1599520&group_id=75348">SF
BUG-1599520</a>] The table dialog was producing empty tags when leaving some of
its fields empty.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1599545&group_id=75348">SF
BUG-1599545</a>] HTML entities are now processed on attribute values too.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1598517&group_id=75348">SF
BUG-1598517</a>] Meta tags are now protected from execution during editing (avoiding
the "redirect" meta to be activated).</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1415601&group_id=75348">SF
BUG-1415601</a>] Firefox internals: styleWithCSS is used instead of the deprecated
useCSS whenever possible.</li>
<li>All JavaScript Core extension function have been renamed to "PascalCase" (some were
in "camelCase"). This may have impact on plugins that use any of those functions.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1592311&group_id=75348">SF
BUG-1592311</a>] Operations in the caption of tables are now working correctly in
both browsers.</li>
<li>Small interface fixes to the about box.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1604576&group_id=75348&atid=543655">SF
PATCH-1604576</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1604301&group_id=75348">SF
BUG-1604301</a>] Link creation failed in Firefox 3 alpha. Thanks to Arpad Borsos</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1577247&group_id=75348&atid=543653">SF
BUG-1577247</a>] Unneeded call to captureEvents and releaseEvents.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1610790&group_id=75348">SF
BUG-1610790</a>] On some specific situations, the call to form.submit(), in form
were FCKeditor has been unloaded by code, was throwing the "Can't execute code from
a freed script" error.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1613167&group_id=75348&atid=543653">SF
BUG-1613167</a>] If the configuration was missing the FCKConfig.AdditionalNumericEntities
entry an error appeared.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1590848&group_id=75348&atid=543653">SF
BUG-1590848</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1626360&group_id=75348&atid=543653">SF
BUG-1626360</a>] Cleaning of JavaScript strict warnings in the source code.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1559466&group_id=75348&atid=543653">SF
BUG-1559466</a>] The ol/ul list property window always searched first for a UL element.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1516008&group_id=75348&atid=543653">SF
BUG-1516008</a>] Class attribute in IE wasn't loaded in the image dialog.</li>
<li>The "OnAfterSetHTML" event is now fired when being/switching to Source View.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1631807&group_id=75348&atid=543653">SF
BUG-1631807</a>] Elements' style properties are now forced to lowercase in IE.</li>
<li>The extensions "html", "htm" and "asis" have been added to the list of denied extensions
on upload.</li>
<li>Empty inline elements (like span and strong) will not be generated any more.</li>
<li>Some elements attributes (like hspace) where not being retrieved when set to "0".</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&aid=1508341&group_id=75348&atid=543653">SF
BUG-1508341</a>] Fix for the ColdFusion script file of SpellerPages.</li>
</ul>
<p>
* This version has been partially sponsored by <a href="http://www.imedi.org/">Medical
Media Lab</a>.</p>
<h3>
Version 2.3.3</h3>
<p>
New Features and Improvements:</p>
<ul>
<li>The project has been <strong>relicensed</strong> under the terms of the <strong>
GPL / LGPL / MPL</strong> licenses. This change will remove many licensing compatibility
issues with other open source licenses, making the editor even more "open" than
before. </li>
<li><font color="#ff0000">Attention:</font> The default directory in the distribution
package is now named "fckeditor" (in lowercase) instead of "FCKeditor". This
change may impact installations on case sensitive OSs, like Linux. </li>
<li><font color="#ff0000">Attention:</font> The "Universal Keyboard" has been removed
from the package. The license of those files was unclear so they can't be included
alongside the rest of FCKeditor.</li>
</ul>
<h3>
Version 2.3.2</h3>
<p>
New Features and Improvements:</p>
<ul>
<li>Users can now decide if the template dialog will replace the entire contents of
the editor or simply place the template in the cursor position. This feature can
be controlled by the "TemplateReplaceAll" and "TemplateReplaceCheckbox" configuration
options.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1237693&group_id=75348&atid=543655">SF
Patch-1237693</a>] A new configuration option (<strong>ProcessNumericEntities</strong>)
is now available to tell the editor to convert non ASCII chars to their relative
numeric entity references. It is disabled by default.</li>
<li>The new "<strong>AdditionalNumericEntities</strong>" setting makes it possible to
define a set of characters to be transformed to their relative numeric entities.
This is useful when you don't want the code to have simple quotes ('), for example.</li>
<li>The Norwegian language file (no.js) has been duplicated to include the Norwegian
Bokmal (nb.js) in the supported interface languages. Thanks to Martin Kronstad.
</li>
<li>Two new patterns have been added to the Universal Keyboard:
<ul>
<li>Persian. Thanks to Pooyan Mahdavi</li>
<li>Portuguese. Thanks to Bo Brandt.</li>
</ul>
</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1517322&group_id=75348&atid=543655">SF
Patch-1517322</a>] It is now possible to define the start number on numbered lists.
Thanks to Marcel Bennett.</li>
<li>The Font Format combo will now reflect the EditorAreaCSS styles.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1461539&group_id=75348&atid=543655">SF
Patch-1461539</a>] The File Browser connector can now optionally return a "url"
attribute for the files. Thanks to Pent.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1090851&group_id=75348">SF
BUG-1090851</a>] The new "ToolbarComboPreviewCSS" configuration option has been
created, so it is possible to point the Style and Format toolbar combos to a different
CSS, avoiding conflicts with the editor area CSS.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1421309&group_id=75348&atid=543656">SF
Feature-1421309</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1489402&group_id=75348">SF
BUG-1489402</a>] It is now possible to configure the Quick Uploder target path
to consider the file type (ex: Image or File) in the target path for uploads.</li>
<li>The JavaScript integration file has two new things:
<ul>
<li>The "CreateHtml()" function in the FCKeditor object, used to retrieve the HTML of
an editor instance, instead of writing it directly to the page (as done by "Create()").</li>
<li>The global "FCKeditor_IsCompatibleBrowser()" function, which tells if the executing
browser is compatible with FCKeditor. This makes it possible to do any necessary
processing depending on the compatibility, without having to create and editor instance.</li>
</ul>
</li>
</ul>
<p>
Fixed Bugs:</p>
<ul>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1525242&group_id=75348">SF
BUG-1525242</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1500050&group_id=75348">SF
BUG-1500050</a>] All event attributes (like onclick or onmouseover) are now
being protected before loading the editor. In this way, we avoid firing those events
during editing (IE issue) and they don't interfere in other specific processors
in the editor.</li>
<li>Small security fixes to the File Browser connectors. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1546226&group_id=75348">SF
BUG-1546226</a>] Small fix to the ColdFusion CFC integration file.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&atid=543655&aid=1547768&group_id=75348">SF
Patch-1407500</a>] The Word Cleanup function was breaking the HTML on pasting, on
very specific cases. Fixed, thanks to Frode E. Moe.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1551979&group_id=75348&atid=543655">SF
Patch-1551979</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1418066&group_id=75348">SF
BUG-1418066</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1439621&group_id=75348">SF
BUG-1439621</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1501698&group_id=75348&atid=543653">SF
BUG-1501698</a>] Make FCKeditor work with application/xhtml+xml. Thanks
to Arpad Borsos.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1547738&group_id=75348&atid=543655">SF
Patch-1547738</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1550595&group_id=75348&atid=543653">SF
BUG-1550595</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1540807&group_id=75348&atid=543653">SF
BUG-1540807</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1510685&group_id=75348&atid=543653">SF
BUG-1510685</a>] Fixed problem with panels wrongly positioned when the
editor is placed on absolute or relative positioned elements. Thanks to Filipe Martins.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1511294&group_id=75348&atid=543655">SF
Patch-1511294</a>] Small fix for the File Browser compatibility with IE 5.5.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1503178&group_id=75348&atid=543655">SF
Patch-1503178</a>] Small improvement to stop IE from loading smiley images when
one smiley is quickly selected from a huge list of smileys. Thanks to stuckhere.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1549112&group_id=75348&atid=543653">SF
BUG-1549112</a>] The Replace dialog window now escapes regular expression specific
characters in the find and replace fields.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1548788&group_id=75348&atid=543653">SF
BUG-1548788</a>] Updated the ieSpell download URL.</li>
<li>In FF, the editor was throwing an error when closing the window. Fixed.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1538509&group_id=75348&atid=543653">SF
BUG-1538509</a>] The "type" attribute for text fields will always be set now.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1551734&group_id=75348&atid=543653">SF
BUG-1551734</a>] The SetHTML function will now update the editing area height no
matter which editing mode is active.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1554141&group_id=75348&atid=543653">SF
BUG-1554141</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1565562&group_id=75348&atid=543653">SF
BUG-1565562</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1451056&group_id=75348&atid=543653">SF
BUG-1451056</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1478408&group_id=75348&atid=543653">SF
BUG-1478408</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1489322&group_id=75348&atid=543653">SF
BUG-1489322</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1513667&group_id=75348&atid=543653">SF
BUG-1513667</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1562134&group_id=75348&atid=543653">SF
BUG-1562134</a>] The protection of URLs has been enhanced
and now it will not break URLs on very specific cases.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1545732&group_id=75348&atid=543653">SF
BUG-1545732</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1490919&group_id=75348&atid=543653">SF
BUG-1490919</a>] No security errors will be thrown when loading FCKeditor in
page inside a FRAME defined in a different domain.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1512817&group_id=75348&atid=543653">SF
BUG-1512817</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1571345&group_id=75348&atid=543653">SF
BUG-1571345</a>] Fixed the "undefined" addition to the content when ShowBorders
= false and FullPage = true in Firefox. Thanks to Brett.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1512798&group_id=75348&atid=543653">SF
BUG-1512798</a>] BaseHref will now work well on FullPage, even if no <head>
is available.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1509923&group_id=75348&atid=543653">SF
BUG-1509923</a>] The DocumentProcessor is now called when using InserHtml().</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1505964&group_id=75348&atid=543653">SF
BUG-1505964</a>] The DOCTYPE declaration is now preserved when working in FullPage.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1553727&group_id=75348&atid=543653">SF
BUG-1553727</a>] The editor was throwing an error when inserting complex templates.
Fixed.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1564930&group_id=75348&atid=543655">SF
Patch-1564930</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1562828&group_id=75348">SF
BUG-1562828</a>] In IE, anchors where incorrectly copied when using the Paste
from Word button. Fixed, thanks to geirhelge.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1557709&group_id=75348&atid=543653">SF
BUG-1557709</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1421810&group_id=75348&atid=543653">SF
BUG-1421810</a>] The link dialog now validates Popup Window names.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1556878&group_id=75348&atid=543653">SF
BUG-1556878</a>] Firefox was creating empty tags when deleting the selection in
some special cases.</li>
<li>The context menu for links is now correctly shown when right-clicking on floating
divs.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1084404&group_id=75348&atid=543653">SF
BUG-1084404</a>] The XHTML processor now ignores empty span tags.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1221728&group_id=75348&atid=543653">SF
BUG-1221728</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1174503&group_id=75348&atid=543653">SF
BUG-1174503</a>] The <abbr> tag is not anymore getting broken by IE.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1182906&group_id=75348&atid=543653">SF
BUG-1182906</a>] IE is not anymore messing up mailto links.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1386094&group_id=75348&atid=543653">SF
BUG-1386094</a>] Fixed an issue when setting configuration options to empty ('')
by code.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1389435&group_id=75348&atid=543653">SF
BUG-1389435</a>] Fixed an issue in some dialog boxes when handling numeric inputs.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1398829&group_id=75348&atid=543653">SF
BUG-1398829</a>] Some links may got broken on very specific cases. Fixed.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1409969&group_id=75348&atid=543653">SF
BUG-1409969</a>] <noscript> tags now remain untouched by the editor.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1433457&group_id=75348&atid=543653">SF
BUG-1433457</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1513631&group_id=75348&atid=543653">SF
BUG-1513631</a>] Empty "href" attributes in <a> or empty "src" in <img>
will now be correctly preserved.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1435195&group_id=75348&atid=543653">SF
BUG-1435195</a>] Scrollbars are now visible in the File Browser (for custom implementations).</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1438296&group_id=75348&atid=543653">SF
BUG-1438296</a>] The "ForceSimpleAmpersand" setting is now being honored in all
tags.</li>
<li>If a popup blocker blocks context menu operations, the correct alert message is
displayed now, instead of a ugly JavaScript error.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1454116&group_id=75348&atid=543653">SF
BUG-1454116</a>] The GetXHTML() function will not change the IsDirty() value of
the editor.</li>
<li>The spell check may not work correctly when using SpellerPages with ColdFusion.
Fixed.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1481861&group_id=75348&atid=543653">SF
BUG-1481861</a>] HTML comments are now removed by the Word Cleanup System.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1489390&group_id=75348&atid=543653">SF
BUG-1489390</a>] A few missing hard coded combo options used in some dialogs are
now localizable.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1505448&group_id=75348&atid=543653">SF
BUG-1505448</a>] The Form dialog now retrieves the value of the "action" attribute
exactly as defined in the source.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1517322&group_id=75348&atid=543655">SF
Patch-1517322</a>] Solved an issue when the toolbar has buttons with simple icons
(usually used by plugins) mixed with icons coming from a strip (the default toolbar
buttons).</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1575261&group_id=75348&atid=543655">SF
Patch-1575261</a>] Some fields in the Table and Cell Properties dialogs were being
cut. Fixed.</li>
<li>Fixed a startup compatibility issue with Firefox 1.0.4.</li>
</ul>
<h3>
Version 2.3.1</h3>
<p>
Fixed Bugs:</p>
<ul>
<li>[<a target="_blank" href="https://sourceforge.net/support/tracker.php?aid=1506126">SF
BUG-1506126</a>] Fixed the Catalan language file, which had been published with
problems in accented letters. </li>
<li>More performance improvements in the default File Browser.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1506701&group_id=75348&atid=543653">SF
BUG-1506701</a>] Fixed compatibility issues with IE 5.5.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1509073&group_id=75348&atid=543653">SF
BUG-1509073</a>] Fixed the "Image Properties" dialog window, which was making invalid
calls to the "editor/dialog/" directory, generating error 400 entries in the web
server log.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1507294&group_id=75348&atid=543653">SF
BUG-1507294</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1507953&group_id=75348&atid=543653">SF
BUG-1507953</a>] The editing area was getting a fixed size when using the "SetHTML"
API command or even when switching back from the source view. Fixed.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1507755&group_id=75348">SF
BUG-1507755</a>] Fixed a conflict between the "DisableObjectResizing" and "ShowBorders"
configuration options over IE.</li>
<li>Opera 9 tries to "mimic" Gecko in the browser detection system of FCKeditor. As
this browser is not "yet" supported, the editor was broken on it. It has been fixed,
and now a textarea is displayed, as in any other unsupported browser. Support for
Opera is still experimental and can be activated by setting the property "EnableOpera"
to true when creating an instance of the editor with the JavaScript integration
files.</li>
<li>With Opera 9, the toolbar was jumping on buttons rollover. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1509479&group_id=75348&atid=543656">SF
BUG-1509479</a>] The iframes used in Firefox for all editor panels (dropdown combos,
context menu, etc...) are now being placed right before the main iframe that holds
the editor. In this way, if the editor container element is removed from the DOM
(by DHTML) they are removed together with it.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1271070&group_id=75348&atid=543653">SF
BUG-1271070</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1411430&group_id=75348&atid=543653">SF
BUG-1411430</a>] The editor API now works well on DHTML pages that create and
remove instances of FCKeditor dynamically. </li>
<li>A second call to a page with the editor was not working correctly with Firefox 1.0.x.
Fixed.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1511460&group_id=75348&atid=543653">SF
BUG-1511460</a>] Small correction to the <script> protected source regex.
Thanks to Randall Severy.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1521754&group_id=75348">SF
BUG-1521754</a>] Small fix to the paths of the internal CSS files used by FCKeditor.
Thanks to johnw_ceb.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1511442&group_id=75348&atid=543653">SF
BUG-1511442</a>] The <base> tag is now correctly handled in IE, no matter
its position in the source code.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1507773&group_id=75348&atid=543653">SF
BUG-1507773</a>] The "Lock" and "Reset" buttons in the Image Properties dialog window
are not anymore jumping with Firefox 1.5.</li>
</ul>
<h3>
Version 2.3</h3>
<p>
New Features and Improvements:</p>
<ul>
<li>The <strong>Toolbar Sharing</strong> system has been completed. See sample10.html
and sample11.html.*</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1407500&group_id=75348&atid=543655">SF
Patch-1407500</a>] Small enhancement to the Find and Replace dialog windows.</li>
</ul>
<p>
Fixed Bugs:</p>
<ul>
<li>Small security fixes.</li>
<li>The context menu system has been optimized. Nested menus now open "onmouseover".
</li>
<li>An error in the image preloader system was making the toolbar strip being downloaded
once for each button on slow connections. Some enhancements have also been made
so now the smaple05.html is loading fast for all skins.</li>
<li>Fixed many memory leak issues with IE.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1489768&group_id=75348&atid=543653">SF
BUG-1489768</a>] The panels (context menus, toolbar combos and color selectors),
where being displayed in the wrong position if the contents of the editor, or its
containing window were scrolled down. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1493176&group_id=75348">SF
BUG-1493176</a>] Using ASP, the connector was not working on servers with buffer
disable by default.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1491784&group_id=75348&atid=543653">SF
BUG-1491784</a>] Language files have been updated to not include html entities.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1490259&group_id=75348&atid=543653">SF
BUG-1490259</a>] No more security warning on IE over HTTPS.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1493173&group_id=75348&atid=543653">SF
BUG-1493173</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1499708&group_id=75348">SF
BUG-1499708</a>] We now assume that, if a user is in source editing, he/she
wants to control the HTML, so the editor doesn't make changes to it when posting
the form being in source view or when calling the GetXHTML function in the API.
</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1490610&group_id=75348&atid=543653">SF
BUG-1490610</a>] The FitWindow is now working on elements set with relative position.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1493438&group_id=75348&atid=543653">SF
BUG-1493438</a>] The "Word Wrap" combo in the cell properties dialog now accepts
only Yes/No (no more <Not Set> value).</li>
<li>The context menu is now being hidden when a nested menu option is selected.</li>
<li>Table cell context menu operations are now working correctly.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1494549&group_id=75348&atid=543653">SF
BUG-1494549</a>] The code formatter was having problems with dollar signs inside
<pre> tags.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1459740&group_id=75348&atid=543655">SF
Patch-1459740</a>] The "src" element of images can now be set by styles definitions.
Thanks to joelwreed.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1437052&group_id=75348&atid=543655">SF
Patch-1437052</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1436166&group_id=75348&atid=543655">SF
Patch-1436166</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1352385&group_id=75348&atid=543655">SF
Patch-1352385</a>] Small fix to the FCK.InsertHtml, FCKTools.AppendStyleSheet
and FCKSelection.SelectNode functions over IE. Thanks to Alfonso Martinez.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1349765&group_id=75348&atid=543655">SF
Patch-1349765</a>] Small fix to the FCKSelection.GetType over Firefox. Thanks to
Alfonso Martinez.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543655&aid=1495422&group_id=75348">SF
Patch-1495422</a>] The editor now creates link based on the URL when no selection
is available. Thanks to Dominik Pesch.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543655&aid=1478859&group_id=75348">SF
Patch-1478859</a>] On some circumstances, the Yahoo popup blocker was blocking the
File Browser window, giving no feedback to the user. Now an alert message is displayed.</li>
<li>When using the editor in a RTL localized interface, like Arabic, the toolbar combos
were not showing completely in the first click. Fixed.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1500212&group_id=75348">SF
BUG-1500212</a>] All "_samples/html" samples are now working when loading directly
from the Windows Explorer. Thanks to Alfonso Martinez.</li>
<li>The "FitWindow" feature was breaking the editor under Firefox 1.0.x.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1500032&group_id=75348&atid=543655">SF
Patch-1500032</a>] In Firefox, the caret position now follows the user clicks when
clicking in the white area bellow the editor contents. Thanks to Alfonso Martinez.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1499522&group_id=75348">SF
BUG-1499522</a>] In Firefox, the link dialog window was loosing the focus (and quickly
reacquiring it) when opening. This behavior was blocking the dialog in some Linux
installations. </li>
<li>Drastically improved the loading performance of the file list in the default File
Browser.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1503059&group_id=75348">SF
BUG-1503059</a>] The default "BasePath" for FCKeditor in all integration files has
been now unified to "/fckeditor/" (lower-case). This is the usual casing system
in case sensitive OSs like Linux.</li>
<li>The "DisableFFTableHandles" setting is now honored when switching the full screen
mode with FitWindow.</li>
<li>Some fixes has been applied to the cell merging in Firefox.</li>
</ul>
<p>
* This version has been partially sponsored by <a href="http://www.footsteps.nl/">Footsteps</a>
and <a href="http://www.kentico.com/">Kentico</a>.</p>
<h3>
Version 2.3 Beta</h3>
<p>
New Features and Improvements:</p>
<ul>
<li><span><strong>Extremely Fast Loading!</strong> The editor now loads more than 3
times faster than before, with no impact on its advanced features.</span> </li>
<li><span><strong>New toolbar system</strong>:</span>
<ul>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1454850&group_id=75348&atid=543656">SF
Feature-1454850</a>] The toolbar will now <strong>load much faster</strong>. All
images have being merged in a single image file using a unique system available
only with FCKeditor. </li>
<li>The "Text Color" and "Background Color" commands buttons have
enhancements on the interface.</li>
<li><strong><span style="color: #ff0000">Attention</span></strong>: As a completely
new system has being developed. Skins created for versions prior this one will not
work. Skin styles definitions have being merged, added and removed. All skins have
been a little bit reviewed. </li>
<li>It is possible to <strong>detach the toolbar</strong> from an editor instance and
share it with other instances. In this way you may have only one toolbar (in the
top of the window, for example, that can be used by many editors (see <a href="_samples/html/sample10.html">
sample10.html</a>). This feature is still under development (issues with IE
focus still to be solved).* </li>
</ul>
</li>
<li><strong><span>New context menu system</span></strong>:
<ul>
<li>It uses the same (fast) loading system as the toolbar. </li>
<li>Sub-Menus are now available to group features (try the context menu over a table
cell). </li>
<li>It is now possible to create your own context menu entries by creating plugins.
</li>
</ul>
</li>
<li><strong>New "FitWindow" toolbar button</strong>, based on the <a href="https://sourceforge.net/tracker/index.php?func=detail&aid=1431638&group_id=75348&atid=737639">
plugin</a> published by Paul Moers. Thanks Paul!</li>
<li><strong>"Auto Grow" Plugin</strong>: automatically resizes the editor
until a maximum height, based on its contents size.** </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1444943&group_id=75348&atid=543656">SF
Feature-1444943</a>] <strong>Multiple CSS files</strong> can now be used in the
editing area. Just define FCKConfig.EditorAreaCSS as an array of strings (each one
is a path to a different css file). It works also as a simple string, as on prior
versions. </li>
<li>New language files:<ul>
<li><strong>Bengali / Bangla</strong> (by Richard Walledge).</li>
<li><strong>English (Canadian)</strong> (by Kevin Bennett). </li>
<li><strong>Khmer</strong> (by Sengtha Chay).</li>
</ul>
</li>
<li>The source view is now available in the editing area on Gecko browsers. Previously
a popup was used for it (due to a Firefox bug). </li>
<li><span>As some people may prefer the popup way for source editing, a new configuration
option (SourcePopup) has being introduced.</span> </li>
<li>The IEForceVScroll configuration option has been removed. The editor now automatically
shows the vertical scrollbar when needed (for XHTML doctypes). </li>
<li>The configuration file doesn't define a default DOCTYPE to be used now. </li>
<li>It is now possible to easily change the toolbar using the JavaScript API by just
calling <EditorInstance>.ToolbarSet.Load( '<ToolbarName>' ). See _testcases/010.html
for a sample. </li>
<li>The "OnBlur" and "OnFocus" JavaScript API events are now compatible
with all supported browsers. </li>
<li>Some few updates in the Lasso connector and uploader. </li>
<li>The GeckoUseSPAN setting is now set to "false" by default. In this way, the code
produced by the bold, italic and underline commands are the same on all browsers.</li>
</ul>
<p>
Fixed Bugs:</p>
<ul>
<li><strong>Important security fixes have been applied to the File Manager, Uploader
and Connectors. Upgrade is highly recommended.</strong> Thanks to Alberto Moro,
Baudouin Lamourere and James Bercegay.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1399966&group_id=75348&atid=543653">SF
BUG-1399966</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1249853&group_id=75348&atid=543653">SF
BUG-1249853</a>] The "BaseHref" configuration is now working with
Firefox in both normal and full page modes.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1405263&group_id=75348&atid=543653">SF
BUG-1405263</a>] A typo in the configuration file was impacting the Quick Upload
feature. </li>
<li>Nested <ul> and <ol> tags are now generating valid html.</li>
<li>The "wmode" and "quality" attributes are now preserved for Flash
embed tags, in case they are entered manually in the source view. Also, empty attributes
are removed from that tag. </li>
<li>Tables where not being created correctly on Opera. </li>
<li>The XHTML processor will ignore invalid tags with names ending with ":",
like http:. </li>
<li><span>On Firefox, the scrollbar is not anymore displayed on toolbar dropdown commands
when not needed.</span> </li>
<li><span>Some small fixes have being done to the dropdown commands rendering for FF</span>.
</li>
<li>The table dialog window has been a little bit enlarged to avoid contents being cropped
on some languages, like Russian. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1465203&group_id=75348&atid=543653">SF
BUG-1465203</a>] The ieSpell download URL has been updated. The problem is that
they don't have a fixed URL for it, so let's hope the mirror will be up for it.
</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1456332&group_id=75348&atid=543653">SF
BUG-1456332</a>] Small fix in the Spanish language file. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1457078&group_id=75348&atid=543653">SF
BUG-1457078</a>] The File Manager was generating 404 calls in the server. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1459846&group_id=75348&atid=543653">SF
BUG-1459846</a>] Fixed a problem with the config file if PHP is set to parse .js
files. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1432120&group_id=75348&atid=543653">SF
BUG-1432120</a>] The "UserFilesAbsolutePath" setting is not correctly
used in the PHP uploader. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1432120&group_id=75348&atid=543653">SF
BUG-1408869</a>] The collapse handler is now rendering correctly in Firefox 1.5.
</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1410082&group_id=75348&atid=543653">SF
BUG-1410082</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1424240&group_id=75348&atid=543653">SF
BUG-1424240</a>] The "moz-bindings.xml" file is now well formed. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1413980&group_id=75348&atid=543653">SF
BUG-1413980</a>] All frameborder "yes/no" values have been changes to
"1/0". </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1414101&group_id=75348&atid=543653">SF
BUG-1414101</a>] The fake table borders are now showing correctly when running under
the "file://" protocol. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1414155&group_id=75348&atid=543653">SF
BUG-1414155</a>] Small typo in the cell properties dialog window.</li>
<li>Fixed a problem in the File Manager. It was not working well with folder or file
names with apostrophes ('). Thanks to René de Jong.</li>
<li>Small "lenght" type corrected in the select dialog window. Thanks to Bernd Nussbaumer.</li>
<li>The about box is now showing correctly in Firefox 1.5.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1464020&group_id=75348&atid=543655">SF
Patch-1464020</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1155793&group_id=75348&atid=543653">SF
BUG-1155793</a>] The "Unlink" command is now working correctly under Firefox
if you don't have a complete link selection. Thanks to Johnny Egeland.</li>
<li>In the File Manager, it was not possible to upload files to folders with ampersands
in the name. Thanks to Mike Pone.</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1178359&group_id=75348&atid=543653">SF
BUG-1178359</a>] Elements from the toolbar are not anymore draggable in the editing
area.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1487544&group_id=75348&atid=543653">SF
BUG-1487544</a>] Fixed a small issue in the code formatter for <br /> and
<hr /> tags.</li>
<li>The "Background Color" command now works correctly when the GeckoUseSPAN setting
is disabled (default).</li>
<li>Links are now rendered in blue with Firefox (they were black before). Actually,
an entry for it has been added to the editing area CSS, so you can customize with
the color you prefer. </li>
</ul>
<p>
* This version has been partially sponsored by <a href="http://www.footsteps.nl/">Footsteps</a>
and <a href="http://www.kentico.com/">Kentico</a>.
<br />
** This version has been partially sponsored by <a href="http://www.nextide.ca/">Nextide</a>.</p>
<h3>
Version 2.2</h3>
<p>
New Features and Improvements:</p>
<ul>
<li>Let's welcome Wim Lemmens (didgiman). He's our new responsible for the ColdFusion
integration. In this version we are introducing his new files with the following
changes:
<ul>
<li>The "<strong>Uploader</strong>", used for quick uploads, is now available
<strong>natively for ColdFusion</strong>. </li>
<li>Small bugs have been corrected in the <strong>File Browser connector</strong>. </li>
<li>The samples now work as is, even if you don't install the editor in the "/FCKeditor"
directory.</li>
</ul>
</li>
<li>And a big welcome also to "Andrew Liu", our responsible for the <strong>
Python</strong> integration. This version is bringing <strong>native support for Python</strong>
, including the File Browser connector and Quick Upload. </li>
<li>The "<strong>IsDirty()</strong>" and "<strong>ResetIsDirty()</strong>"
functions have been added to the JavaScript API to check if the editor
content has been changed.* </li>
<li>New language files:
<ul>
<li><strong>Hindi</strong> (by Utkarshraj Atmaram) </li>
<li><strong>Latvian </strong>(by Janis Klavinš)</li>
</ul>
</li>
<li>For the interface, now we have complete <strong>RTL support</strong> also for
the drop-down toolbar commands, color selectors and context menu. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1325113&group_id=75348&atid=543653">SF
BUG-1325113</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1277661&group_id=75348&atid=543653">SF
BUG-1277661</a>] The new "Delete Table" command is available in the
Context Menu when right-clicking inside a table. </li>
<li>The "FCKConfig.DisableTableHandles" configuration option is now working
on Firefox 1.5. </li>
<li>The new "<strong>OnBlur</strong>" and "<strong>OnFocus</strong>"
events have been added to the JavaScript API (IE only). See "_samples/html/sample09.html" *
</li>
<li><strong><font color="#ff0000">Attention</font></strong>: The "<strong>GetHTML</strong>"
function has been deprecated. It now returns the same value as "<strong>GetXHTML</strong>".
The same is valid for the "EnableXHTML" and "EnableSourceXHTML"
that have no effects now. The editor now works with XHTML output only. </li>
<li><strong><font color="#ff0000">Attention</font></strong>: A new "<strong>PreserveSessionOnFileBrowser</strong>"
configuration option has been introduced. It makes it possible to set whenever is
needed to maintain the user session in the File Browser. It is disabled by default,
as it has very specific usage and may cause the File Browser to be blocked by popup
blockers. If you have custom File Browsers that depends on session information,
remember to activate it. </li>
<li><strong><font color="#ff0000">Attention</font></strong>: The "<strong>fun</strong>"
smileys set has been removed from the package. If you are using it, you must manually
copy it to newer installations and upgrades. </li>
<li><strong><font color="#ff0000">Attention</font></strong>: The "<strong>mcpuk</strong>"
file browser has been removed from the package. We have no ways to support it. There
were also some licensing issues with it. Its web site can still be found at <a href="http://mcpuk.net/fbxp/">
http://mcpuk.net/fbxp/</a>. </li>
<li>It is now possible to set different CSS styles for the chars in the Special Chars
dialog window by adding the "SpecialCharsOut" and "SpecialCharsOver"
in the "fck_dialog.css" skin file.* </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1268726&group_id=75348&atid=543655">SF
Patch-1268726</a>] Added table "summary" support in the table dialog.
Thanks to Sebastien-Mahe. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1284380&group_id=75348&atid=543655">SF
Patch-1284380</a>] It is now possible to define the icon of a FCKToolbarPanelButton
object without being tied to the skin path (just like FCKToolbarButton). Thanks
to Ian Sullivan. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1338610&group_id=75348&atid=543655">SF
Patch-1338610</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1263009&group_id=75348&atid=543656">SF
Patch-1263009</a>] New characters have been added to the "Special Characters"
dialog window. Thanks to Deian. </li>
<li>You can set the QueryString value "fckdebug=true" to activate "debug
mode" in the editor (showing the debug window), overriding the configurations.
The "AllowQueryStringDebug" configuration option is also available so
you can disable this feature.</li>
</ul>
<p>
Fixed Bugs:</p>
<ul>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1363548&group_id=75348&atid=543653">SF
BUG-1363548</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1364425&group_id=75348&atid=543653">SF
BUG-1364425</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1335045&group_id=75348&atid=543653">SF
BUG-1335045</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1289661&group_id=75348&atid=543653">SF
BUG-1289661</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1225370&group_id=75348&atid=543653">SF
BUG-1225370</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1156291&group_id=75348&atid=543653">SF
BUG-1156291</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1165914&group_id=75348&atid=543653">SF
BUG-1165914</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1111877&group_id=75348&atid=543653">SF
BUG-1111877</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1092373&group_id=75348&atid=543653">SF
BUG-1092373</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1101596&group_id=75348&atid=543653">SF
BUG-1101596</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1246952&group_id=75348&atid=543653">SF
BUG-1246952</a>] The URLs for links and
images are now correctly preserved as entered, no matter if you are using relative
or absolute paths. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1162809&group_id=75348&atid=543653">SF
BUG-1162809</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1205638&group_id=75348&atid=543653">SF
BUG-1205638</a>] The "Image" and "Flash" dialog windows
now loads the preview correctly if the "BaseHref" configuration option
is set. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1329807&group_id=75348&atid=543653">SF
BUG-1329807</a>] The alert boxes are now showing correctly when doing cut/copy/paste
operations on Firefox installations when it is not possible to execute that operations
due to security settings. </li>
<li>A new "Panel" system (used in the drop-dowm toolbar commands, color selectors
and context menu) has been developed. The following bugs have been fixed with it:
<ul>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1186927&group_id=75348&atid=543653">SF
BUG-1186927</a>] On IE, sometimes the context menu was being partially hidden.*
</li>
<li>On Firefox, the context menu was flashing in the wrong position before showing.
</li>
<li>On Firefox 1.5, the Color Selector was not working. </li>
<li>On Firefox 1.5, the fonts in the panels were too big. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1076435&group_id=75348&atid=543653">SF
BUG-1076435</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1200631&group_id=75348&atid=543653">SF
BUG-1200631</a>] On Firefox, sometimes the context menu was being shown in the
wrong position.</li>
</ul>
</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1364094&group_id=75348">SF
BUG-1364094</a>] Font families were <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=317572">
not being rendered correctly on Firefox</a> . </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1315954&group_id=75348">SF
BUG-1315954</a>] No error is thrown when pasting some case specific code from editor
to editor. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1341553&group_id=75348&atid=543653">SF
BUG-1341553</a>] A small fix for a security alert in the File Browser has been
applied. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1370953&group_id=75348&atid=543653">SF
BUG-1370953</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1339898&group_id=75348&atid=543653">SF
BUG-1339898</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1323319&group_id=75348&atid=543653">SF
BUG-1323319</a>] A message will be shown to the user (instead of a JS error) if
a "popup blocker" blocks the "Browser Server" button. Thanks
to Erwin Verdonk. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1370355&group_id=75348&atid=543653">SF
BUG-1370355</a>] Anchor links that points to a single character anchor, like "#A",
are now correctly detected in the Link dialog window. Thanks to Ricky Casey. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1368998&group_id=75348&atid=543653">SF
BUG-1368998</a>] Custom error processing has been added to the file upload on the
File Browser. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1367802&group_id=75348&atid=543653">SF
BUG-1367802</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1207740&group_id=75348&atid=543653">SF
BUG-1207740</a>] A message is shown to the user if a dialog box is blocked by
a popup blocker in Firefox. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1358891&group_id=75348&atid=543653">SF
BUG-1358891</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1340960&group_id=75348&atid=543653">SF
BUG-1340960</a>] The editor not works locally (without a web server) on directories
where the path contains spaces. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1357247&group_id=75348&atid=543653">SF
BUG-1357247</a>] The editor now intercepts SHIFT + INS keystrokes when needed. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1328488&group_id=75348&atid=543653">SF
BUG-1328488</a>] <strong><font color="#ff0000">Attention</font></strong>: The Page
Break command now produces different tags to avoid XHTML compatibility
issues. Any Page Break previously applied to content produced with previous versions
of FCKeditor will not me rendered now, even if they will still be working correctly.
</li>
<li>It is now possible to allow cut/copy/past operations on Firefox using the <a
href="http://kb.mozillazine.org/Granting_JavaScript_access_to_the_clipboard"
target="_blank">user.js</a> file. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1336792&group_id=75348&atid=543653">SF
BUG-1336792</a>] A fix has been applied to the XHTML processor to allow tag names
with the "minus" char (-). </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1339560&group_id=75348&atid=543653">SF
BUG-1339560</a>] The editor now correctly removes the "selected" option
for checkboxes and radio buttons. </li>
<li>The Table dialog box now selects the table correctly when right-clicking on objects
(like images) placed inside the table. </li>
<li><strong><font color="#ff0000">Attention</font></strong>: A few changes have been
made in the skins. If you have a custom skin, it is recommended you to make a diff
of the fck_contextmenu.css file of the default skin with your implementation. </li>
<li>Mouse select (marking things in blue, like selecting text) has been disabled
on panels (drop-down menu commands, color selector and context menu) and toolbar,
for both IE and Firefox. </li>
<li>On Gecko, fake borders will not be applied to tables with the border attribute set
to more than 0, but placed inside tables with border set to 0. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1360717&group_id=75348&atid=543653">SF
BUG-1360717</a>] A wrapping issue in the "Silver" skin has been corrected.
Thanks to Ricky Casey. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1251145&group_id=75348&atid=543653">SF
BUG-1251145</a>] In IE, the focus is now maintained in the text when clicking in
the empty area following it. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1181386&group_id=75348&atid=543653">SF
BUG-1181386</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1237791&group_id=75348&atid=543653">SF
BUG-1237791</a>] The "Stylesheet Classes" field in the Link dialog
window in now applied correctly on IE. Thanks to Andrew Crowe. </li>
<li>The "Past from Word" dialog windows is now showing correctly on Firefox
on some languages. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1315008&group_id=75348&atid=543653">SF
BUG-1315008</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1241992&group_id=75348&atid=543653">SF
BUG-1241992</a>] IE, when selecting objects (like images) and hitting the "Backspace"
button, the browser's "back" will not get executed anymore and the object
will be correctly deleted. </li>
<li>The "AutoDetectPasteFromWord" is now working correctly in IE. Thanks to
Juan Ant. Gómez. </li>
<li>A small enhancement has been made in the Word pasting detection. Thanks to Juan
Ant. Gómez. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1090686&group_id=75348&atid=543653">SF
BUG-1090686</a>] No more conflict with Firefox "Type-Ahead Find" feature.
</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=942653&group_id=75348&atid=543653">SF
BUG-942653</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1155856&group_id=75348&atid=543653">SF
BUG-1155856</a>] The "width" and "height" of images sized
using the inline handlers are now correctly loaded in the image dialog box. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1209093&group_id=75348&atid=543653">SF
BUG-1209093</a>] When "Full Page Editing" is active, in the "Document
Properties" dialog, the "Browse Server" button for the page background
is now correctly hidden if "ImageBrowser" is set to "false"
in the configurations file. Thanks to Richard. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1120266&group_id=75348&atid=543653">SF
BUG-1120266</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1186196&group_id=75348&atid=543653">SF
BUG-1186196</a>] The editor now retains the focus when selecting commands in
the toolbar. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1244480&group_id=75348&atid=543653">SF
BUG-1244480</a>] The editor now will look first to linked fields "ids"
and second to "names". </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1252905&group_id=75348&atid=543653">SF
BUG-1252905</a>] The "InsertHtml" function now preserves URLs as entered.
</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1266317&group_id=75348&atid=543653">SF
BUG-1266317</a>] Toolbar commands are not anymore executed outside the editor. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1365664&group_id=75348&atid=543653">SF
BUG-1365664</a>] The "wrap=virtual" attribute has been removed from the
integration files for validation purposes. No big impact. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=972193&group_id=75348&atid=543653">SF
BUG-972193</a>] Now just one click is needed to active the cursor inside the editor.
</li>
<li>The hidden fields used by the editor are now protected from changes using the "Web
Developer Add-On > Forms > Display Forms Details" extension. Thanks to
Jean-Marie Griess. </li>
<li>On IE, the "Format" toolbar dropdown now reflects the current paragraph
type on IE. Because of a bug in the browser, it is quite dependent on the browser
language and the editor interface language (both must be the same). Also, as the
"Normal (DIV)" type is seen by IE as "Normal", to avoid confusion,
both types are ignored by this fix. </li>
<li>On some very rare cases, IE was loosing the "align" attribute for DIV
tags. Fixed. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1388799&group_id=75348">SF
BUG-1388799</a>] The code formatter was removing spaces on the beginning of lines
inside PRE tags. Fixed. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1387135&group_id=75348&atid=543653">SF
BUG-1387135</a>] No more "NaN" values in the image dialog, when changing
the sizes in some situations. </li>
<li>Corrected a small type in the table handler. </li>
<li>You can now set the "z-index" for floating panels (toolbar dropdowns,
color selectors, context menu) in Firefox, avoiding having them hidden under another
objects. By default it is set to 10,000. Use the FloatingPanelsZIndex configuration
option to change this value.</li>
</ul>
<p>
<strong>Special thanks</strong> to <a target="_blank" href="https://sourceforge.net/users/alfonsoml/">
Alfonso Martinez</a>, who have provided many patches and suggestions for the
following features / fixes present in this version. I encourage all you to <a href="https://sourceforge.net/donate/index.php?user_id=1356422">
donate</a> to Alfonso, as a way to say thanks for his nice open source approach.
Thanks Alfonso!. Check out his contributions:</p>
<ul>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1364094&group_id=75348">SF
BUG-1352539</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1208348&group_id=75348&atid=543653">SF
BUG-1208348</a>] With Firefox, no more "fake" selections are appearing
when inserting images, tables, special chars or when using the "insertHtml"
function. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543655&aid=1382588&group_id=75348">SF
Patch-1382588</a>] The "FCKConfig.DisableImageHandles" configuration option
is not working on Firefox 1.5. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1368586&group_id=75348&atid=543655">SF
Patch-1368586</a>] Some fixes have been applied to the Flash dialog box and the
Flash pre-processor. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1360253&group_id=75348&atid=543655">SF
Patch-1360253</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1378782&group_id=75348&atid=543653">SF
BUG-1378782</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1305899&group_id=75348&atid=543653">SF
BUG-1305899</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1344738&group_id=75348&atid=543653">SF
BUG-1344738</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1347808&group_id=75348&atid=543653">SF
BUG-1347808</a>] On dialogs, some fields became impossible
to select or change when using Firefox. It has been fixed. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1357445&group_id=75348&atid=543655">SF
Patch-1357445</a>] Add support for DIV in the Format drop-down combo for Firefox.
</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1350465&group_id=75348&atid=543653">SF
BUG-1350465</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1376175&group_id=75348&atid=543653">SF
BUG-1376175</a>] The "Cell Properties" dialog now works correctly
when right-clicking in an object (image, for example) placed inside the cell itself.
</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1349166&group_id=75348&atid=543655">SF
Patch-1349166</a>] On IE, there is now support for namespaces on tags names. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1350552&group_id=75348&atid=543655">SF
Patch-1350552</a>] Fix the display issue when applying styles on tables. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1352320&group_id=75348&atid=543655">SF
Patch-1352320</a> ] Fixed a wrong usage of the "parentElement"
property on Gecko. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1355007&group_id=75348&atid=543655">SF
Patch-1355007</a>] The new "FCKDebug.OutputObject" function is available
to dump all object information in the debug window. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1329500&group_id=75348&atid=543655">SF
Patch-1329500</a>] It is now possible to delete table columns when clicking on a
TH cell of the column. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1315351&group_id=75348&atid=543655">SF
Patch-1315351</a>] It is now possible to pass the image width and height to the
"SetUrl" function of the Flash dialog box. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1327384&group_id=75348&atid=543655">SF
Patch-1327384</a>] TH tags are now correctly handled by the source code formatter
and the "FillEmptyBlocks" configuration option. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1327406&group_id=75348&atid=543655">SF
Patch-1327406</a>] Fake borders are now displayed for TH elements on tables with
border set to 0. Also, on Firefox, it will now work even if the border attribute
is not defined and the borders are not dotted. </li>
<li>Hidden fields now get rendered on Firefox. </li>
<li>The BasePath is now included in the debugger URL to avoid problems when calling
it from plugins.</li>
</ul>
<p>
* This version has been partially sponsored by <a target="_blank" href="http://www.alkacon.com">
Alkacon Software</a>.</p>
<h3>
Version 2.1.1</h3>
<p>
New Features and Improvements:</p>
<ul>
<li>The new "<strong>Insert Page Break</strong>" command (for printing) has
been introduced.* </li>
<li>The editor package now has a root directory called "FCKeditor".</li>
</ul>
<p>
Fixed Bugs:</p>
<ul>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1326285&group_id=75348&atid=543653">SF
BUG-1326285</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1316430&group_id=75348&atid=543653">SF
BUG-1316430</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1323662&group_id=75348&atid=543653">SF
BUG-1323662</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1326223&group_id=75348&atid=543653">SF
BUG-1326223</a>] We are doing a little step back with this version.
The ENTER and BACKSPACE behavior changes for Firefox have been remove. It is a nice
feature, but we need much more testing on it. It introduced some bugs and so
its preferable to not have that feature, avoiding problems (even if that feature
was intended to solve some issues). </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1289372&group_id=75348&atid=543653">SF
BUG-1275714</a>] Comments in the beginning of the source are now preserved when
using the "undo" and "redo" commands. </li>
<li>The "undo" and "redo" commands now work for the Style command.
</li>
<li>An error in the execution of the pasting commands on Firefox has been fixed. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1326184&group_id=75348">SF
BUG-1326184</a>] No strange (invalid) entities are created when using Firefox. Also,
the &nbsp; used by the FillEmptyBlocks setting is maintained even if you disable
the ProcessHTMLEntities setting.</li>
</ul>
<p>
* This version has been partially sponsored by <a target="_blank" href="http://www.acttive.com.br/">
Acctive Software S.A.</a>.</p>
<h3>
Version 2.1</h3>
<p>
New Features and Improvements:</p>
<ul>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1200328&group_id=75348&atid=543653">SF
BUG-1200328</a>] The editor now offers a way to "protect" part of the
source to remain untouched while editing or changing views. Just use the "FCKConfig.ProtectedSource"
object to configure it and customize to your needs. It is based on regular expressions.
See fckconfig.js for some samples. </li>
<li>The editor now offers native support for <strong>Lasso</strong>. Thanks and welcome to
our new developer Jason Huck. </li>
<li>New language files are available:
<ul>
<li><strong>Faraose</strong> (by Símin Lassaberg and Helgi Arnthorsson)
</li>
<li><strong>Malay</strong> (by Fairul Izham Mohd Mokhlas) </li>
<li><strong>Mongolian</strong> (by Lkamtseren Odonbaatar) </li>
<li><strong>Vietnamese</strong> (by Phan Binh Giang)</li>
</ul>
</li>
<li>A new configurable ColdFusion connector is available. Thanks to Mark Woods.
Many enhancements has been introduced with it. </li>
<li>The PHP connector for the default File Browser now sorts the folders and files names.
</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1289372&group_id=75348&atid=543653">SF
BUG-1289372</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1282758&group_id=75348&atid=543653">SF
BUG-1282758</a>] In the PHP connector it is now possible to set the absolute
(server) path to the User Files directory, avoiding problems with Virtual Directories,
Symbolic Links or Aliases. Take a look at the config.php file. </li>
<li>The ASP.Net uploader (for Quick Uploads) has been added to the package. </li>
<li>A new way to define <strong>simple "combo" toolbar items</strong> , like
Style and Font, has been introduced. Thanks to Steve Lineberry. See
sample06.html and the "simplecommands" plugin to fully understand
it. </li>
<li>A new test case has been added that shows how to set the editor background dynamically
without using a CSS. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1155906&group_id=75348&atid=543653">SF
BUG-1155906</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1110116&group_id=75348&atid=543653">SF
BUG-1110116</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1216332&group_id=75348&atid=543653">SF
BUG-1216332</a>] The "AutoDetectPasteFromWord" configuration option
is back (IE only feature). </li>
<li>The new "OnAfterLinkedFieldUpdate" event has been introduced. If
is fired when the editor updates its hidden associated field. </li>
<li>Attention: The color of the right border of the toolbar (left on RTL interfaces)
has been moved from code to the CSS (TB_SideBorder class). Update your custom skins.
</li>
<li>A sample "htaccess.txt" file has been added to the editor's package
to show how to configure some Linux sites that could present problems on Firefox
with "Illegal characters" errors. Respectively the ""
chars. </li>
<li>With the JavaScript, ASP and PHP integration files, you can set the QueryString
value "fcksource=true" to load the editor using the source files (located
in the _source directory) instead of the compressed ones. Thanks to Kae Verens for
the suggestion. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1246623&group_id=75348&atid=543656">SF
Feature-1246623</a>] The new configuration option "ForceStrongEm" has
been introduced so you can force the editor to convert all <B> and <I>
tags to <STRONG> and <EM> respectively. </li>
<li>A nice contribution has been done by Goss Interactive Ltd:
<ul>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1246949&group_id=75348&atid=543653">SF
BUG-1246949</a>] Implemented ENTER key and BACKSPACE key handlers for Gecko so that
P tags (or an appropriate block element) get inserted instead of BR tags when not
in the UseBROnCarriageReturn config mode.
<br />
The ENTER key handling has been written to function much the same as the ENTER key
handling on IE : as soon as the ENTER key is pressed, existing content will be wrapped
with a suitable block element (P tag) as appropriate and a new block element (P
tag) will be started.
<br />
The ENTER key handler also caters for pressing ENTER within empty list items - ENTER
in an empty item at the top of a list will remove that list item and start a new
P tag above the list; ENTER in an empty item at the bottom of a list will remove
that list item and start a new P tag below the list; ENTER in an empty item in the
middle of a list will remove that list item, split the list into two, and start
a new P tag between the two lists. </li>
<li>Any tables that are found to be incorrectly nested within a block element (P tag)
will be moved out of the block element when loaded into the editor. This is required
for the new ENTER/BACKSPACE key handlers and it also avoids non-compliant HTML.
</li>
<li>The InsertOrderedList and InsertUnorderedList commands have been overridden on Gecko
to ensure that block elements (P tags) are placed around a list item's content when
it is moved out of the list due to clicking on the editor's list toolbar buttons
(when not in the UseBROnCarriageReturn config mode). </li>
</ul>
</li>
</ul>
<p>
Fixed Bugs:</p>
<ul>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1253255&group_id=75348&atid=543653">SF
BUG-1253255</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1253255&group_id=75348&atid=543653">SF
BUG-1265520</a>] Due to changes on version 2.0, the anchor list was not anymore
visible in the link dialog window. It has been fixed. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1242979&group_id=75348">SF
BUG-1242979</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1251354&group_id=75348&atid=543653">SF
BUG-1251354</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1256178&group_id=75348&atid=543653">SF
BUG-1256178</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1274841&group_id=75348&atid=543653">SF
BUG-1274841</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1303949&group_id=75348&atid=543653">SF
BUG-1303949</a>] Due to a bug on Firefox, some keys stopped working
on startup over Firefox. It has been fixed. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1251373&group_id=75348&atid=543653">SF
BUG-1251373</a> ] The above fix also has corrected some strange behaviors on
Firefox. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?group_id=75348&atid=543653&func=detail&aid=1144258">SF
BUG-1144258</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?group_id=75348&atid=543653&func=detail&aid=1092081">SF
BUG-1092081</a>] The File Browsers now run on the same server session used
in the page where the editor is placed in (IE issue). Thanks to Simone Chiaretta.
</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1305619&group_id=75348&atid=543653">SF
BUG-1305619</a> ] No more repeated login dialogs when running the editor with Windows
Integrated Security with IIS. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1245304&group_id=75348&atid=543655">SF
Patch-1245304</a>] The Test Case 004 is now working correctly. It has been changed
to set the editor hidden at startup. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1290610&group_id=75348&atid=543653">SF
BUG-1290610</a> ] Over HTTPS, there were some warnings when loading the Images,
Flash and Link dialogs. Fixed. </li>
<li>Due to Gecko bugs, two errors were thrown when loading the editor in a hidden div.
Workarounds have been introduced. In any case, the testcase 004 hack is needed when
showing the editor (as in a tabbed interface). </li>
<li>An invalid path in the dialogs CSS file has been corrected. </li>
<li>On IE, the Undo/Redo can now be controlled using the Ctrl+Z and Ctrl+Y shortcut
keys. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1295538&group_id=75348&atid=543653">SF
BUG-1295538</a> ] A few Undo/Redo fixes for IE have been done. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1247070&group_id=75348&atid=543653">SF
BUG-1247070</a>] On Gecko, it is now possible to use the shortcut keys for Bold
(CTRL+B), Italic (CTRL+I) and Underline (CTRL+U), like in IE. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1274303&group_id=75348&atid=543653">SF
BUG-1274303</a>] The "Insert Column" command is now working correctly
on TH cells. It also copies any attribute applied to the source cells. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1287070&group_id=75348&atid=543655">SF
Patch-1287070</a> ] In the Universal Keyboard, the Arabic keystrokes translator
is now working with Firefox. Thanks again to Abdul-Aziz Al-Oraij. </li>
<li>The editor now handles AJAX requests with HTTP status 304. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1157780&group_id=75348&atid=543653">SF
BUG-1157780</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1229077&group_id=75348&atid=543653">SF
BUG-1229077</a>] Weird comments are now handled correctly (ignored on some cases).
</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1155774&group_id=75348&atid=543653">SF
BUG-1155774</a>] A spelling error in the Bulleted List Properties dialog has been
corrected. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1272018&group_id=75348&atid=543653">SF
BUG-1272018</a>] The ampersand character can now be added from the Special Chars
dialog. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1263161&group_id=75348&atid=543653">SF
BUG-1263161</a>] A small fix has been applied to the sampleposteddata.php file.
Thanks to Mike Wallace. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1241504&group_id=75348&atid=543653">SF
BUG-1241504</a>] The editor now looks also for the ID of the hidden linked field.
</li>
<li>The caption property on tables is now working on Gecko. Thanks to Helen Somers (Goss
Interactive Ltd). </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1297431&group_id=75348&atid=543653">SF
BUG-1297431</a>] With IE, the editor now works locally when its files are placed
in a directory path that contains spaces. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1279551&group_id=75348&atid=543653">SF
BUG-1279551</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1242105&group_id=75348&atid=543653">SF
BUG-1242105</a>] On IE, some features are dependant of ActiveX components (secure...
distributed with IE itself). Some security setting could avoid the usage of
those components and the editor would stop working. Now a message is shown, indicating
the use the minimum necessary settings need by the editor to run. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1298880&group_id=75348&atid=543653">SF
BUG-1298880</a>] Firefox can't handle the STRONG and EM tags. Those tags are now
converted to B and I so it works accordingly. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1271723&group_id=75348&atid=543653">SF
BUG-1271723</a>] On IE, it is now possible to select the text and work correctly
in the contents of absolute positioned/dimensioned divs. </li>
<li>On IE, there is no need to click twice in the editor to activate the cursor
in the editing area. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1221621&group_id=75348">SF
BUG-1221621</a>] Many "warnings" in the Firefox console are not thrown
anymore. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1295526&group_id=75348&atid=543653">SF
BUG-1295526</a>] While editing on "FullPage" mode the basehref is
now active for CSS "link" tags. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1222584&group_id=75348&atid=543655">SF
Patch-1222584</a>] A small fix to the PHP connector has been applied. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1281313&group_id=75348&atid=543655">SF
Patch-1281313</a>] A few small changes to avoid problems with Plone. Thanks to Jean-mat.
</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1275911&group_id=75348&atid=543653">SF
BUG-1275911</a>] A check for double dots sequences on directory names on creation
has been introduced to the PHP and ASP connectors.</li>
</ul>
<h3>
Version 2.0</h3>
<p>
New Features and Improvements:</p>
<ul>
<li>The new "<strong>Flash</strong>" command is available. Now you can
easily handle Flash content, over IE and Gecko, including server browser integration
and context menu support. Due to limitations of the browsers, it is not possible
to see the preview of the movie while editing, so a nice "placeholder"
is used instead. * </li>
<li>A "<strong>Quick Upload</strong> " option is now available in the
link, image and flash dialog windows, so the user don't need to go (or have) the
File Browser for this operations. The ASP and PHP uploader are included. Take
a look at the configuration file.*** </li>
<li>Added support for <strong>Active FoxPro Pages</strong> . Thanks to our new developer,
Sönke Freitag. </li>
<li>It is now possible to <strong>disable the size handles</strong> for images and tables
(IE only feature). Take a look at the DisableImageHandles and DisableTableHandles
configuration options. </li>
<li>The handles on form fields (small squares around them) and the inline editing
of its contents have been disabled. This makes it easier to users to use
the controls. </li>
<li>A much better support for Word pasting operations has been introduced. Now it uses
a dialog box, in this way we have better results and more control.** </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1225372&group_id=75348&atid=543655">SF
Patch-1225372</a>] A small change has been done to the PHP integration file. The
generic __construct constructor has been added for better PHP 5 sub-classing compatibility
(backward compatible). Thanks to Marcus Bointon.</li>
</ul>
<p>
Fixed Bugs:</p>
<ul>
<li>ATTENTION: Some security changes have been made to the connectors. Now you must
explicitly enable the connector you want to use. Please test your application before
deploying this update. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/?group_id=75348&atid=543653&func=detail&aid=1211591">SF
BUG-1211591</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1204273&group_id=75348&atid=543653">SF
BUG-1204273</a>] The connectors have been changed so it is not possible to use
".." on directory names. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1219734&group_id=75348&atid=543655">SF
Patch-1219734</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1219728&group_id=75348&atid=543653">SF
BUG-1219728</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1208654&group_id=75348&atid=543653">SF
BUG-1208654</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1205442&group_id=75348&atid=543653">SF
BUG-1205442</a>] There was an error in the page unload on some cases
that has been fixed. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/?group_id=75348&atid=543653&func=detail&aid=1209708">SF
BUG-1209708</a>] [<a target="_blank" href="http://sourceforge.net/tracker/?group_id=75348&atid=543653&func=detail&aid=1214125">SF
BUG-1214125</a>] The undo on IE is now working correctly when the user starts
typing. </li>
<li>The preview now loads "Full Page" editing correctly. It also uses the
same XHTML code produced by the final output. </li>
<li>The "Templates" dialog was not working on some very specific (and strange)
occasions over IE. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1199631&group_id=75348">SF
BUG-1199631</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1171944&group_id=75348&atid=543653">SF
BUG-1171944</a>] A new option is available to avoid a bad IE behavior that shows
the horizontal scrollbar even when not needed. You can now force the vertical scrollbar
to be always visible. Just set the "IEForceVScroll" configuration option
to "true". Thanks to Grant Bartlett. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1212026&group_id=75348&atid=543655">SF
Patch-1212026</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1228860&group_id=75348&atid=543653">SF
BUG-1228860</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1211775&group_id=75348&atid=543653">SF
BUG-1211775</a>] [<a target="_blank" href="http://sourceforge.net/tracker/?group_id=75348&atid=543653&func=detail&aid=1199824">SF
BUG-1199824</a>] An error in the Packager has been corrected. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/?group_id=75348&atid=543653&func=detail&aid=1163669">SF
BUG-1163669</a>] The XHTML processor now adds a space before the closing slash of
tags that don't have a closing tag, like <br />. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1213733&group_id=75348&atid=543653">SF
BUG-1213733</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1216866&group_id=75348&atid=543653">SF
BUG-1216866</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1209673&group_id=75348&atid=543653">SF
BUG-1209673</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1155454&group_id=75348&atid=543653">SF
BUG-1155454</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1187936&group_id=75348&atid=543653">SF
BUG-1187936</a> ] Now, on Gecko, the source is opened in a
dialog window to avoid fatal errors (Gecko bugs). </li>
<li>Some pages have been changed to avoid importing errors on Plone. Thanks to Arthur
Kalmenson. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1171606&group_id=75348&atid=543653">SF
BUG-1171606</a>] There is a bug on IE that makes the editor to not work if
the instance name matches a meta tag name. Fixed. </li>
<li>On Firefox, the source code is now opened in a dialog box, to avoid error on pages
with more than one editor. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1225703&group_id=75348&atid=543655">SF
Patch-1225703</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1214941&group_id=75348&atid=543653">SF
BUG-1214941</a>] The "ForcePasteAsPlainText" configuration option
is now working correctly on Gecko browsers. Thanks to Manuel Polo. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1228836&group_id=75348&atid=543653">SF
BUG-1228836</a>] The "Show Table Borders" feature is now working on Gecko
browsers. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1212529&group_id=75348&atid=543655">SF
Patch-1212529</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1212517&group_id=75348&atid=543653">SF
BUG-1212517</a>] The default File Browser now accepts connectors with querystring
parameters (with "?"). Thanks to Tomas Jucius. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1233318&group_id=75348&atid=543653">SF
BUG-1233318</a>] A JavaScript error thrown when using the Print command has been
fixed. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1229696&group_id=75348&atid=543653">SF
BUG-1229696</a>] A regular expression has been escaped to avoid problems when opening
the code in some editors. It has been moved to a dialog window. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1231978&group_id=75348&atid=543653">SF
BUG-1231978</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1228939&group_id=75348&atid=543653">SF
BUG-1228939</a>] The Preview window is now using the Content Type and Base href.
</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1232056&group_id=75348&atid=543653">SF
BUG-1232056</a>] The anchor icon is now working correctly on IE. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1232056&group_id=75348&atid=543653">SF
BUG-1202468</a>] The anchor icon is now available on Gecko too. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1236279&group_id=75348&atid=543653">SF
BUG-1236279</a>] A security warning has been corrected when using the File Browser
over HTTPS. </li>
<li>The ASP implementation now avoid errors when setting the editor value to null values.
</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1237359&group_id=75348&atid=543653">SF
BUG-1237359</a>] The trailing <BR> added by Gecko at the end of the source
is now removed. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/?group_id=75348&atid=543653&func=detail&aid=1170828">SF
BUG-1170828</a>] No more &nbsp; is added to the source when using the "New
Page" button. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1165264&group_id=75348&atid=543653">SF
BUG-1165264</a>] A new configuration option has been included to force the
editor to ignore empty paragraph values (<p>&nbsp;</p>), returning
empty (""). </li>
<li>No more &nbsp; is added when creating a table or adding columns, rows or cells.
</li>
<li>The <TD> tags are now included in the FillEmptyBlocks configuration handling.
</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1224829&group_id=75348&atid=543653">SF
BUG-1224829</a>] A small bug in the "Find" dialog has been fixed. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1221307&group_id=75348&atid=543653">SF
BUG-1221307</a>] A small bug in the "Image" dialog has been fixed. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1219981&group_id=75348&atid=543653">SF
BUG-1219981</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1155726&group_id=75348&atid=543653">SF
BUG-1155726</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1178473&group_id=75348&atid=543653">SF
BUG-1178473</a>] It is handling the <FORM>, <TEXTAREA> and <SELECT>
tags "name" attribute correctly. Thanks to thc33. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1205403&group_id=75348&atid=543653">SF
BUG-1205403</a>] The checkbox and radio button values are now handled correctly
in their dialog windows. Thanks to thc33. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1236626&group_id=75348&atid=543653">SF
BUG-1236626</a>] The toolbar now doesn't need to collapse when unloading the page
(IE only). </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1212559&group_id=75348&atid=543653">SF
BUG-1212559</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1017231&group_id=75348&atid=543653">SF
BUG-1017231</a>] The "Save" button now calls the "onsubmit"
event before posting the form. The submit can be cancelled if the onsubmit returns
"false". </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1215823&group_id=75348&atid=543653">SF
BUG-1215823</a>] The editor now works correctly on Firefox if it values is set to
"<p></p>". </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1217546&group_id=75348&atid=543653">SF
BUG-1217546</a>] No error is thrown when "pasting as plain text" and no
text is available for pasting (as an image for example). </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1207031&group_id=75348&atid=543653">SF
BUG-1207031</a>] [<a target="_blank" href="http://sourceforge.net/tracker/?group_id=75348&atid=543653&func=detail&aid=1223978">SF
BUG-1223978</a>] The context menu is now available in the source view. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/?group_id=75348&atid=543653&func=detail&aid=1213871">SF
BUG-1213871</a>] Undo has been added to table creation and table operation commands.
</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1205211&group_id=75348&atid=543653">SF
BUG-1205211</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1229941&group_id=75348&atid=543653">SF
BUG-1229941</a>] Small bug in the mcpuk file browser have been corrected.</li>
</ul>
<p>
* This version has been partially sponsored by <a target="_blank" href="http://www.infineon.com/">
Infineon Technologies AG</a>.<br />
** This version has been partially sponsored by <a href="http://www.visualsoft.co.uk">
Visualsoft</a> <a href="http://www.visualsoft.co.uk/websolutions.html">Web Solutions</a>.<br />
*** This version has been partially sponsored by <a target="_blank" href="http://www.webcrossing.com">
Web Crossing, Inc</a>.</p>
<h3>
Version 2.0 FC (Final Candidate)</h3>
<p>
New Features and Improvements:</p>
<ul>
<li>A new tab called "<strong>Link</strong>" is available in the<strong> Image
Dialog</strong> window. In this way you can insert or modify the image link directly
from that dialog.* </li>
<li>The new "<strong>Templates</strong>" command is now available. Now the
user can select from a list of pre-build HTML and fill the editor with it. Take
a look at the "_docs" for more info.** </li>
<li>The <a target="_blank" href="http://mcpuk.net/fbxp/">mcpuk's</a> File Browser for
PHP has been included in the package. He became the official developer of the File
Manager for FCKeditor, so we can expect good news in the future. </li>
<li>New configuration options are available to <strong>hide tabs</strong> from the <strong>
Image</strong> Dialog and <strong>Link</strong> Dialog windows: LinkDlgHideTarget,
LinkDlgHideAdvanced, ImageDlgHideLink and ImageDlgHideAdvanced. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1189442&group_id=75348&atid=543653">SF
BUG-1189442</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1187164&group_id=75348&atid=543653">SF
BUG-1187164</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1185905&group_id=75348&atid=543653">SF
BUG-1185905</a>] It is now possible to configure the editor to <strong>not convert Greek</strong>
or special <strong>Latin </strong>letters to ther specific HTML entities. You
can also configure it to not convert any character at all. Take a look at the "ProcessHTMLEntities",
"IncludeLatinEntities" and "IncludeGreekEntities" configuration
options. </li>
<li>New language files are available:
<ul>
<li><strong>Basque</strong> (by Ibon Igartua) </li>
<li><strong>English (Australia / United Kingdom)</strong> (by Christopher Dawes) </li>
<li><strong>Ukrainian</strong> (by Alexander Pervak)</li>
</ul>
</li>
<li>The version and date information have been removed from the files headers to avoid
unecessary diffs in source control systems when new versions are released (from
now on). </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1159854&group_id=75348&atid=543655">SF
Patch-1159854</a>] Ther HTML output rendered by the server side integration files
are now XHTML compatible. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1181823&group_id=75348&atid=543653">SF
BUG-1181823</a>] It is now possible to set the desired DOCTYPE to use when edit
HTML fragments (not in Full Page mode). </li>
<li>There is now an optional way to implement different "mouse over" effects
to the buttons when they are "on" of "off".</li>
</ul>
<p>
Fixed Bugs:</p>
<ul>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1162200&group_id=75348&atid=543653">SF
BUG-1162200</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1161633&group_id=75348&atid=543653">SF
BUG-1161633</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1050293&group_id=75348&atid=543653">SF
BUG-1050293</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1058948&group_id=75348&atid=543653">SF
BUG-1058948</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1109120&group_id=75348&atid=543653">SF
BUG-1109120</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1155408&group_id=75348&atid=543653">SF
BUG-1155408</a>] The IE memory leak bug has been solved. The
code has been completely reviewed and many memory usage improvements have been done.
</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1179645&group_id=75348&atid=543653">SF
BUG-1179645</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1183252&group_id=75348&atid=543653">SF
BUG-1183252</a> ] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1166779&group_id=75348&atid=543653">SF
BUG-1181647</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1155627&group_id=75348&atid=543653">SF
BUG-1155627</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1155782&group_id=75348&atid=543653">SF
BUG-1155782</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1155750&group_id=75348&atid=543653">SF
BUG-1155750</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1157166&group_id=75348&atid=543653">SF
BUG-1157166</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1157857&group_id=75348&atid=543653">SF
BUG-1157857</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1158121&group_id=75348&atid=543653">SF
BUG-1158121</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1177153&group_id=75348&atid=543653">SF
BUG-1177153</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1175847&group_id=75348&atid=543653">SF
BUG-1175847</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1155747&group_id=75348&atid=543653">SF
BUG-1155747</a>] There was a loading
problem in Gecko browsers in some cases. It has been solved. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1161147&group_id=75348&atid=543653">SF
BUG-1161147</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1157635&group_id=75348&atid=543653">SF
BUG-1157635</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1149805&group_id=75348&atid=543653">SF
BUG-1149805</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1124600&group_id=75348&atid=543653">SF
BUG-1124600</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1117535&group_id=75348&atid=543653">SF
BUG-1117535</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1118145&group_id=75348&atid=543653">SF
BUG-1118145</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1098113&group_id=75348&atid=543653">SF
BUG-1098113</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1092272&group_id=75348&atid=543653">SF
BUG-1092272</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1086416&group_id=75348&atid=543653">SF
BUG-1086416</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1027952&group_id=75348&atid=543653">SF
BUG-1027952</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=978441&group_id=75348&atid=543653">SF
BUG-978441</a> ] A custom Undo/Redo system
has been implemented for IE. </li>
<li>The editor startup execution is now made in the right order (so configurations override
works correctly). </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1166779&group_id=75348&atid=543653">SF
BUG-1166779</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1166651&group_id=75348&atid=543653">SF
BUG-1166651</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1066198&group_id=75348&atid=543653">SF
BUG-1066198</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1090388&group_id=75348&atid=543653">SF
BUG-1090388</a> ] No more "illegible" characters in the
toolbar when "ClearType" is active. </li>
<li>It is now possible to set the "width" style of the BODY tag in the EditorAreaCSS
to limit the editing area size. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1113620&group_id=75348&atid=543653">SF
BUG-1113620</a>] In IE, the editor doesn't generate new entries in the browser history
anymore. </li>
<li>The editor now uses the same method used on version RC2 to load its contents on
Gecko. It is now possible to have more than one editor in the page. This change
has a negative impact: the BaseHref property is not working. </li>
<li>Changes have been made to make the editor work with PHP versions older than 2.1.0.
</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1190835&group_id=75348&atid=543653">SF
BUG-1190835</a>] [<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1196547&group_id=75348">SF
BUG-1196547</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1156863&group_id=75348&atid=543653">SF
BUG-1156863</a>] The "Insert Horizontal Line" command is now working
correctly. Thanks to Hector Raul Colonia Coral. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1101861&group_id=75348&atid=543653">SF
BUG-1101861</a>] The editor now shows a normal textarea correctly (as expected)
on Safari browsers (and all "like Gecko" browsers). Thanks to Bob Paul.
</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1182224&group_id=75348&atid=543653">SF
BUG-1182224</a>] The PHP connector can now handle file extensions in upper case, like
JPG or Gif, correctly. Thanks to Georg Ivancsic. </li>
<li>The "sample06.html" is now working correctly with Gecko browsers. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1156660&group_id=75348&atid=543653">SF
BUG-1156660</a>] Some fixes have been applied to the Universal Keyboard. Thanks
to Abdul-Aziz Al-Oraij. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1192881&group_id=75348&atid=543653">SF
BUG-1192881</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1185006&group_id=75348&atid=543653">SF
BUG-1185006</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1156068&group_id=75348&atid=543653">SF
BUG-1156068</a>] The "Browse Server" button is now working correctly
for the Background Image in the "Document Properties" dialog window (full
page editing). The active "BaseHref" is also set to the preview window.
</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1191704&group_id=75348&atid=543653">SF
BUG-1191704</a>] Invalid HTML tags (according to the W3C naming standards for XHTML)
are ignored with no errors. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1185911&group_id=75348&atid=543653">SF
BUG-1185911</a>] The Greek language file name has been corrected to "el.js".
</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1181572&group_id=75348&atid=543653">SF
BUG-1181572</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1158421&group_id=75348&atid=543653">SF
BUG-1158421</a>] The "Print" button is now active on startup. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1181572&group_id=75348&atid=543653">SF
BUG-1165219</a>] No error occours when the user defines just one color to the FontColors
on "in page" configurations. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1162957&group_id=75348&atid=543653">SF
BUG-1162957</a>] The small problem with Zope (ZPT) has been solved. </li>
<li>Some small RTL / LTR corrections has been done in the interface and the Farsi language
has been added to the Universal Keyboard. Thanks to Silver Baghdasarian.</li>
</ul>
<p>
* This version has been partially sponsored by the <a href="http://www.hamilton.edu">
Hamilton College</a>.<br />
** This version has been partially sponsored by <a target="_blank" href="http://www.infineon.com/">
Infineon Technologies AG</a>.</p>
<h3>
Version 2.0 RC3 (Release Candidate 3)</h3>
<p>
New Features and Improvements:</p>
<ul>
<li>The editor now offers native <strong>Perl integration</strong>! Thanks and welcome
to Takashi Yamaguchi, our official Perl developer. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1026584&group_id=75348&atid=543656">SF
Feature-1026584</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1112692&group_id=75348&atid=543656">SF
Feature-1112692</a>] <strong>Formatting </strong>has been introduced to the
<strong>Source View</strong>. The output HTML can also be formatted. You can choose
to use spaces or tab for indentation. See the configuration file. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1031492&group_id=75348&atid=543656">SF
Feature-1031492</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1004293&group_id=75348&atid=543656">SF
Feature-1004293</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=784281&group_id=75348&atid=543656">SF
Feature-784281</a>] It is now possible to edit <strong>full HTML pages</strong>
with the editor. Use the "FullPage" configuration setting to activate
it. </li>
<li>The new toolbar command, "<strong>Document Properties</strong>" is
available to edit document header info, title, colors, background, etc... Full page
editing must be enabled. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1151448&group_id=75348&atid=543656">SF
Feature-1151448</a>] <strong>Spell Check</strong> is now available. You can use
<strong>ieSpell</strong> or <strong>Speller Pages</strong> right from FCKeditor.
More info about configuration can be found in the _docs folder. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1041686&group_id=75348&atid=543656">SF
Feature-1041686</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1086386&group_id=75348&atid=543656">SF
Feature-1086386</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1124602&group_id=75348&atid=543656">SF
Feature-1124602</a>] New "<strong>Insert Anchor</strong>" command
has been introduced. (The anchor icon is visible only over IE for now). </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1123816&group_id=75348&atid=543656">SF
Feature-1123816</a>] It is now possible to configure the editor to <strong>show "fake"
table borders</strong> when the border size is set to zero. (It is working only
on IE for now). </li>
<li><strong>Numbered</strong> and <strong>Bulleted</strong> lists can now be <strong>
configured</strong> . Just right click on then. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1088608&group_id=75348&atid=543656">SF
Feature-1088608</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1144047&group_id=75348&atid=543656">SF
Feature-1144047</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1149808&group_id=75348&atid=543656">SF
Feature-1149808</a>] A new configuration setting is available, "<strong>BaseHref</strong>
", to set the URL used to resolve relative links. </li>
<li>It is now possible to set the <strong>content language direction</strong> .
See the "FCKConfig.ContentLangDirection" configurations setting. </li>
<li>All <strong>Field Commands</strong> available on version 1.6 have been upgraded
and included in this version: <strong>form</strong>, <strong>checkbox</strong>,
<strong>radio button</strong>, <strong>text field</strong>, text <strong>area</strong>,
<strong>select field</strong>, <strong>button</strong>, <strong>image button</strong>
and <strong>hidden field</strong> . </li>
<li><strong>Context menu</strong> options (right-click) has been added for: <strong>
anchors</strong>, <strong>select field</strong>, <strong>textarea</strong>, <strong>
checkbox</strong>, <strong>radio button</strong>, <strong>text field</strong>,
<strong>hidden field</strong>, <strong>textarea</strong>, <strong>button</strong>,
<strong>image button</strong>, <strong>form</strong>, <strong>bulleted list</strong>
and <strong>numbered list</strong> . </li>
<li>The "<strong>Universal Keyboard</strong>" has been converted from version
1.6 to this one and it's now available. </li>
<li>It is now possible to <strong>configure</strong> the items to be shown in the <strong>
context menu</strong> . Just use the FCKConfig.ContextMenu option at fckconfig.js.
</li>
<li>A new configuration (FillEmptyBlocks) is available to force the editor to <strong>
automatically insert a &nbsp;</strong> on empty block elements (p, div, pre,
h1, etc...) to avoid differences from the editing and the final result. (Actually,
the editor automatically "grows" empty elements to make the user able
to enter text on it). Attention: the extra &nbsp; will be added when switching
from WYSIWYG to Source View, so the user may see an additional space on empty blocks.
(XHTML support must be enabled). </li>
<li>It is now possible to configure the <strong>toolbar</strong> to "<strong>break</strong>
" between two toolbar strips. Just insert a "/" between then. Take
a look at fckconfig.js for a sample. </li>
<li>New Language files are available:
<ul>
<li><strong>Brazilian Portuguese</strong> (by Carlos Alberto Tomatis Loth) </li>
<li><strong>Bulgarian</strong> (by Miroslav Ivanov) </li>
<li><strong>Esperanto</strong> (by Tim Morley) </li>
<li><strong>Galician</strong> (by Fernando Riveiro Lopez) </li>
<li><strong>Japanese</strong> ( by Takashi Yamaguchi) </li>
<li><strong>Persian</strong> (by Hamed Taj-Abadi) </li>
<li><strong>Romanian</strong> (by Adrian Nicoara) </li>
<li><strong>Slovak</strong> (by Gabriel Kiss) </li>
<li><strong>Thai </strong>(by Audy Charin Arsakit) </li>
<li><strong>Turkish</strong> (by Reha Biçer) </li>
<li>The Chinese Traditional has been set as the default (zn) instead of zn-tw.</li>
</ul>
</li>
<li>Warning: All toolbar image images have been changed. The "button." prefix
has been removed. If you have your custom skin, please rename your files. </li>
<li>A new plugin is available in the package: "<strong>Placeholders</strong>".
In this way you can insert non editable tags in your document to be processed on
server side (very specific usage). </li>
<li>The ASPX files are no longer available in this package. They have been moved to
the FCKeditor.Net package. In this way the ASP.Net integration is much better organized.
</li>
<li>The FCKeditor.Packager program is now part of the main package. It is not anymore distributed
separately. </li>
<li>The PHP connector now sets the uploaded file permissions (chmod) to 0777. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1090215&group_id=75348&atid=543655">SF
Patch-1090215</a>] It's now possible to give back more info from your custom image
browser calling the SetUrl( url [, width] [, height] [, alt] ). Thanks to Ben Noblet.
</li>
<li>The package files now maintain their original "Last Modified" date, so
incremental FTP uploads can be used to update to new versions of the editor
(from now on). </li>
<li>The "Source" view now forces its contents to be written in "Left
to Right" direction even when the editor interface language is running a RTL
language (like Arabic, Hebrew or Persian). </li>
</ul>
<p>
Fixed Bugs:</p>
<ul>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1124220&group_id=75348&atid=543653">SF
BUG-1124220</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1119894&group_id=75348&atid=543653">SF
BUG-1119894</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1090986&group_id=75348&atid=543653">SF
BUG-1090986</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1100408&group_id=75348&atid=543653">SF
BUG-1100408</a>] The editor now works correctly when starting with an
empty value and switching to the Source mode. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1119380&group_id=75348&atid=543653">SF
BUG-1119380</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1115750&group_id=75348&atid=543653">SF
BUG-1115750</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1101808&group_id=75348&atid=543653">SF
BUG-1101808</a>] The problem with the scrollbar and the toolbar combos (Style,
Font, etc...) over Mac has been fixed. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1098460&group_id=75348&atid=543653">SF
BUG-1098460</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1076544&group_id=75348&atid=543653">SF
BUG-1076544</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1077845&group_id=75348&atid=543653">SF
BUG-1077845</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1092395&group_id=75348&atid=543653">SF
BUG-1092395</a>] A new upload class has been included for the ASP File
Manager Connector. It uses the "ADODB.Stream" object. Many thanks to "NetRube".
</li>
<li>I small correction has been made to the ColdFusion integration files. Thanks to
Hendrik Kramer. </li>
<li>There was a very specific problem when the editor was running over a FRAME executed
on another domain. </li>
<li>The performance problem on Gecko while typing quickly has been solved. </li>
<li>The <br type= "_moz">is not anymore shown on XHTML source. </li>
<li>It has been introduced a mechanism to avoid automatic contents duplication on very
specific occasions (bad formatted HTML). </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1146407&group_id=75348&atid=543653">SF
BUG-1146407</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1145800&group_id=75348&atid=543653">SF
BUG-1145800</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1118803&group_id=75348&atid=543653">SF
BUG-1118803</a> ] Other issues in the XHTML processor have been solved.
</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1143969&group_id=75348&atid=543653">SF
BUG-1143969</a>] The editor now accepts the "accept-charset" attribute
in the FORM tag (IE specific bug). </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1122742&group_id=75348&atid=543653">SF
BUG-1122742</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1089548&group_id=75348&atid=543653">SF
BUG-1089548</a> ] Now, the contents of the SCRIPT and STYLE tags remain untouched.
</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1114748&group_id=75348&atid=543653">SF
BUG-1114748</a>] The PHP File Manager Connector now sets the new folders permissions
(chmod) to 0777 correctly. </li>
<li>The PHP File Manager Connector now has a configuration file (editor/filemanager/browser/default/connectors/php/config.php)
to set some security preferences. </li>
<li>The ASP File Manager Connector now has a configuration file (editor/filemanager/browser/default/connectors/asp/config.asp)
to set some security preferences. </li>
<li>A small bug in the toolbar rendering (strips auto position) has been corrected.
</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1093732&group_id=75348&atid=543653">SF
BUG-1093732</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1091377&group_id=75348&atid=543653">SF
BUG-1091377</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1083044&group_id=75348&atid=543653">SF
BUG-1083044</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1096307&group_id=75348&atid=543653">SF
BUG-1096307</a>] The configurations are now encoded so a user can use
values that has special chars (&=/). </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1103688&group_id=75348&atid=543653">SF
BUG-1103688</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1092331&group_id=75348&atid=543653">SF
BUG-1092331</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1088220&group_id=75348&atid=543653">SF
BUG-1088220</a>] PHP samples now use PHP_SELF to automatically discover
the editor's base path. </li>
<li>Some small wrapping problems with some labels in the Image and Table dialog windows
have been fixed. </li>
<li>All .js files are now encoded in UTF-8 format with the BOM (byte order mask) to
avoid some errors on specific Linux installations. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1114449&group_id=75348&atid=543653">SF
BUG-1114449</a>] The editor packager program has been modified so now it is possible
to use the source files to run the editor as described in the documentation. The
new packager must be downloaded. </li>
<li>A small problem with the editor focus while in source mode has been corrected.
Thanks to Eric (ric1607). </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1108167&group_id=75348&atid=543653">SF
BUG-1108167</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1085149&group_id=75348&atid=543653">SF
BUG-1085149</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1151296&group_id=75348&atid=543653">SF
BUG-1151296</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1082433&group_id=75348&atid=543653">SF
BUG-1082433</a>] No more IFRAMEs without src attribute. Now it points
to a blank page located in the editor's package. In this way we avoid security warnings
when using the editor over HTTPS. Thanks to Guillermo Bozovich. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1117779&group_id=75348&atid=543653">SF
BUG-1117779</a>] The editor now works well if you have more than one element named
"submit" on its form (even if it is not correct to have this situation).
</li>
<li>The XHTML processor was duplicating the text on some specific situation. It has
been fixed. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1090213&group_id=75348&atid=543655">SF
Patch-1090213</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1098929&group_id=75348&atid=543653">SF
Patch-1098929</a>] With ASP, the editor now works correctly on pages using "Option
Explicit". Thanks to Ben Noblet. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1100759&group_id=75348&atid=543653">SF
BUG-1100759</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1029125&group_id=75348&atid=543653">SF
BUG-1029125</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=966130&group_id=75348&atid=543653">SF
BUG-966130</a>] The editor was not working with old IE 5.5 browsers. There
was a problem with the XML parser. It has been fixed. </li>
<li>The localization engine is now working correctly over IE 5.5 browsers. </li>
<li>Some commands where not working well over IE 5.5 (emoticons, image,...). It has
been fixed. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1146441&group_id=75348&atid=543653">SF
BUG-1146441</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1149777&group_id=75348&atid=543653">SF
BUG-1149777</a>] The editor now uses the TEXTAREA id in the ReplaceTextarea
function. If the id is now found, it uses the "name". The docs have been
updated. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1144297&group_id=75348&atid=543653">SF
BUG-1144297</a>] Some corrections have been made to the Dutch language file. Thanks
to Erwin Dondorp. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1121365&group_id=75348&atid=543653">SF
BUG-1121365</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1090102&group_id=75348&atid=543653">SF
BUG-1090102</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1152171&group_id=75348&atid=543653">SF
BUG-1152171</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1102907&group_id=75348&atid=543653">SF
BUG-1102907</a>] There is no problem now to start the editor with values
like "<div></div>" or "<p></p>". </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1114059&group_id=75348&atid=543653">SF
BUG-1114059</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1041861&group_id=75348&atid=543653">SF
BUG-1041861</a>] The click on the disabled options in the Context Menu has no
effects now. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1152617&group_id=75348&atid=543653">SF
BUG-1152617</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1102441&group_id=75348&atid=543653">SF
BUG-1102441</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1095312&group_id=75348&atid=543653">SF
BUG-1095312</a>] Some problems when setting the editor source to very specific
values has been fixed. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1093514&group_id=75348&atid=543653">SF
BUG-1093514</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1089204&group_id=75348&atid=543653">SF
BUG-1089204</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1077609&group_id=75348&atid=543653">SF
BUG-1077609</a>] The editor now runs correctly if called directly (locally) without
a server installation (just opening the HTML sample files). </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1088248&group_id=75348&atid=543653">SF
BUG-1088248</a>] The editor now uses a different method to load its contents. In
this way the URLs remain untouched. </li>
<li>The PHP integration file now detects Internet Explorer 5.5 correctly.</li>
</ul>
<h3>
Version 2.0 RC2 (Release Candidate 2)</h3>
<ul>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1042034&group_id=75348&atid=543656">SF
Feature-1042034</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1075961&group_id=75348&atid=543656">SF
Feature-1075961</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1083200&group_id=75348&atid=543656">SF
Feature-1083200</a>] A new dialog window for the <strong>table cell properties</strong>
is now available (right-click). </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1042034&group_id=75348&atid=543656">SF
Feature-1042034</a>] The new "<strong>Split Cell</strong> ", to split
a table cell in two columns, has been introduced (right-click). </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1042034&group_id=75348&atid=543656">SF
Feature-1042034</a>] The new "<strong>Merge Cells</strong>", to merge
table cells (in the same row), has been introduced (right-click). </li>
<li>The "fake" <strong>TAB key support</strong> (available by default over
Gecko browsers is now available over IE too. You can set the number of spaces to
add setting the FCKConfig.TabSpaces configuration setting. Set it to 0 (zero) to
disable this feature (IE). </li>
<li>It now possible to tell IE to send a <strong><BR></strong> when the user presses
the <strong>Enter key</strong>. Take a look at the FCKConfig.UseBROnCarriageReturn
configuration setting. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1085422&group_id=75348&atid=543656">SF
Feature-1085422</a>] <strong>ColdFusion</strong>: The <strong>File Manager connector</strong>
is now available! (Thanks to Hendrik Kramer). </li>
<li>The editor is now available in <strong>29 languages!</strong> The new language files
available are:
<ul>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1067775&group_id=75348&atid=543656">SF
Feature-1067775</a>] <strong>Chinese Simplified and Traditional</strong> (Taiwan
and Hong Kong) (by NetRube). </li>
<li><strong>Czech</strong> (by David Horák). </li>
<li><strong>Danish</strong> (by Jesper Michelsen). </li>
<li><strong>Dutch</strong> (by Bram Crins). </li>
<li><strong>German</strong> (by Maik Unruh). </li>
<li><strong>Portuguese</strong> (Portugal) (by Francisco Pereira). </li>
<li><strong>Russian</strong> (by Andrey Grebnev). </li>
<li><strong>Slovenian</strong> (by Boris Volaric).</li>
</ul>
</li>
<li>Updates to the <strong>French</strong> language files (by Hubert Garrido). </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1085816&group_id=75348&atid=543653">SF
BUG-1085816</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1083743&group_id=75348&atid=543653">SF
BUG-1083743</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1078783&group_id=75348&atid=543653">SF
BUG-1078783</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1077861&group_id=75348&atid=543653">SF
BUG-1077861</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1077861&group_id=75348&atid=543653">SF
BUG-1037404</a>] Many small bugs in the XHTML processor
has been corrected (workarounds to browser specific bugs). These are some things
to consider regarding the changes:
<ul>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1083744&group_id=75348&atid=543653">SF
BUG-1083744</a>] On Gecko browsers, any element attribute that the name starts with
"_moz" will be ignored. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1060073&group_id=75348&atid=543653">SF
BUG-1060073</a>] The <STYLE> and <SCRIPT> elements contents will be
handled as is, without CDATA tag surrounding. This may break XHTML validation. In
any case the use of external files for scripts and styles is recommended (W3C recommendation).</li>
</ul>
</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1088310&group_id=75348&atid=543653">SF
BUG-1088310</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1078837&group_id=75348&atid=543653">SF
BUG-1078837</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=999792&group_id=75348&atid=543653">SF
BUG-999792</a>] URLs now remain untouched when initializing the editor or
switching from WYSYWYG to Source and vice versa. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1082323&group_id=75348&atid=543653">SF
BUG-1082323</a>] The problem in the ASP and PHP connectors when handling non
"strange" chars in file names has been corrected. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1085034&group_id=75348&atid=543653">SF
BUG-1085034</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1076796&group_id=75348&atid=543653">SF
BUG-1076796</a>] Some bugs in the PHP connector have been corrected. </li>
<li>A problem with the "Format" command on IE browsers on languages different
of English has been solved. The negative side of this correction is that due to
a IE bad design it is not possible to update the "Format" combo while
moving throw the text (context sensitive). </li>
<li>On Gecko browsers, when selecting an image and executing the "New Page"
command, the image handles still appear, even if the image is not available anymore
(this is a Gecko bug). When clicking in a "phanton" randle, the browser
crashes. It doesn't happen (the crash) anymore. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1082197&group_id=75348&atid=543653">SF
BUG-1082197</a>] On ASP, the bug in the browser detection system for Gecko browsers
has been corrected. Thanks to Alex Varga. </li>
<li>Again on ASP, the browser detection for IE had some problems on servers that use
comma for decimal separators on numbers. It has been corrected. Thanks to Agrotic.
</li>
<li>No error is thrown now when non existing language is configured in the
editor. The English language file is loaded in that case. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1077747&group_id=75348&atid=543653">SF
BUG-1077747</a>] The missing images on the Office2003 and Silver skins are now included
in the package. </li>
<li>On some Gecko browsers, the dialog window was not loading correctly. I couldn't
reproduce the problem, but a fix has been applied based on users tests. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1004078&group_id=75348&atid=543653">SF
BUG-1004078</a>] ColdFusion: The "config" structure/hash table with keys
and values is in ColdFusion not(!) case sensitive. All keys returned by ColdFusion
are in upper case format. Because the FCKeditor configuration keys must be case
sensitive, we had to match all structure/hash keys with a list of the correct configuration
names in mixed case. This has been added to the fckeditor.cfc and fckeditor.cfm.
</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1075166&group_id=75348&atid=543653">SF
BUG-1075166</a>] ColdFusion: The "fallback" variant of the texteditor
(<textarea>) has a bug in the fckeditor.cfm. This has been fixed. </li>
<li>A typo in the Polish language file has been corrected. Thanks to Pawel Tomicki.
</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1086370&group_id=75348&atid=543653">SF
BUG-1086370</a>] A small coding type in the Link dialog window has been corrected.
</li>
</ul>
<h3>
Version 2.0 RC1 (Release Candidate 1)</h3>
<ul>
<li><strong>ASP</strong> support is now available (including the File Manager connector).
</li>
<li><strong>PHP</strong> support is now available (including the File Manager connector).
</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1063217&group_id=75348&atid=543656">SF
Feature-1063217</a>] The new advanced <strong>Style</strong> command is available
in the toolbar: full preview, context sensitive, style definitions are loaded from
a XML file (see documentation for more instructions). </li>
<li>The <strong>Font Format</strong>, <strong>Font Name</strong> and <strong>Font Size</strong>
toolbar command now show a <strong>preview</strong> of the available options. </li>
<li>The new <strong>Find</strong> and <strong>Replace</strong> features has been introduced.
</li>
<li>A new <strong>Plug-in</strong> system has been developed. Now it is quite easy to
customize the editor to your needs. (Take a look at the html/sample06.html file).
</li>
<li>The editor now handles <strong>HTML entities</strong> in the right way (XHTML support
must be set to "true"). It handles all entities defined in the W3C XHTML
DTD file. </li>
<li>A new "_docs" folder has been introduced for the <strong>documentation</strong>.
It is not yet complete, but I hope the community will help us to fill it better.
</li>
<li>It is now possible (even if it is not recommended by the W3C) to force the use of
simple ampersands (&) on attributes (like the links href) instead of its entity
&amp;. Just set FCKConfig.ForceSimpleAmpersand = true in the configuration
file. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1026866&group_id=75348&atid=543656">SF
Feature-1026866</a>] The "<strong>EditorAreaCSS</strong>" configuration
option has been introduced. In this way you can set the CSS to use in the editor
(editable area). </li>
<li>The editing area is not anymore clipped if the toolbar is too large and exceeds
the window width. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1064902&group_id=75348&atid=543653">SF
BUG-1064902</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1033933&group_id=75348&atid=543653">SF
BUG-1033933</a>] The editor <strong>interface</strong> is now completely <strong>localizable</strong>.
The version ships with 19 languages including: <b>Arabic</b>, <b>Bosnian</b>, <b>Catalan</b>,
<b>English</b>, <b>Spanish</b>, <b>Estonian</b>, <b>Finnish</b>, <b>French</b>,
<b>Greek</b>, <b>Hebrew</b>, <b>Croatian</b>, <b>Italian</b>, <b>Korean</b>, <b>Lithuanian</b>,
<b>Norwegian</b>, <strong>Polish</strong>, <strong>Serbian (Cyrillic)</strong>,
<strong>Serbian (Latin)</strong> and <strong>Swedish</strong>.</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1027858&group_id=75348&atid=543653">SF
BUG-1027858</a>] Firefox 1.0 PR introduced a bug that made the editor
stop working on it. A workaround has been developed to fix the problem. </li>
<li>There was a positioning problem over IE with the color panel. It has been corrected.
</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1049842&group_id=75348&atid=543653">SF
BUG-1049842</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1033832&group_id=75348&atid=543653">SF
BUG-1033832</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1028623&group_id=75348&atid=543653">SF
BUG-1028623</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1026610&group_id=75348&atid=543653">SF
BUG-1026610</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1064498&group_id=75348&atid=543653">SF
BUG-1064498</a>] The combo commands in the toolbar were not opening
in the right way. It has been fixed. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1053399&group_id=75348&atid=543653">SF
BUG-1053399</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=965318&group_id=75348&atid=543653">SF
BUG-965318</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1018296&group_id=75348&atid=543653">SF
BUG-1018296</a>] The toolbar buttons icons were not showing on some IE and
Firefox/Mac installations. It has been fixed. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1054621&group_id=75348&atid=543653">SF
BUG-1054621</a>] Color pickers are now working with the "office2003" and
"silver" skins. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1054108&group_id=75348&atid=543653">SF
BUG-1054108</a>] IE doesn’t recognize the "&apos;" entity for
apostrophes, so a workaround has been developed to replace it with "&#39;"
(its numeric entity representation). </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=983434&group_id=75348&atid=543653">SF
BUG-983434</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=983398&group_id=75348&atid=543653">SF
BUG-983398</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1028103&group_id=75348&atid=543653">SF
BUG-1028103</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1072496&group_id=75348&atid=543653">SF
BUG-1072496</a>] The problem with elements with name "submit"
inside the editor's form has been solved. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1018743&group_id=75348&atid=543653">SF
BUG-1018743</a>] The problem with Gecko when collapsing the toolbar while in source
mode has been fixed. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1065268&group_id=75348">SF
BUG-1065268</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1034354&group_id=75348&atid=543653">SF
BUG-1034354</a>] The XHTML processor now doesn’t use the minimized tag
syntax (like <br/>) for empty elements that are not marked as EMPTY in the
W3C XHTML DTD specifications. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1029654&group_id=75348&atid=543653">SF
BUG-1029654</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1046500&group_id=75348&atid=543653">SF
BUG-1046500</a>] Due to a bug on Gecko there was a problem when creating links.
It has been fixed. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1065973&group_id=75348&atid=543653">SF
BUG-1065973</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=999792&group_id=75348&atid=543653">SF
BUG-999792</a>] The editor now handles relative URLs in IE. In effect IE transform
all relative URLs to absolute links, pointing to the site the editor is running.
So now the editor removes the protocol and host part of the link if it matches the
running server. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1071824&group_id=75348&atid=543653">SF
BUG-1071824</a>] The color dialog box bug has been fixed. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1052856&group_id=75348&atid=543653">SF
BUG-1052856</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1046493&group_id=75348&atid=543653">SF
BUG-1046493</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1023530&group_id=75348&atid=543653">SF
BUG-1023530</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1025978&group_id=75348&atid=543653">SF
BUG-1025978</a>] The editor now doesn’t throw an error if no selection
was made and the create link command is used. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1036756&group_id=75348&atid=543653">SF
BUG-1036756</a>] The XHTML processor has been reviewed. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1029101&group_id=75348&atid=543653">SF
BUG-1029101</a>] The Paste from Word feature is working correctly. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1034623&group_id=75348&atid=543653">SF
BUG-1034623</a>] There is an IE bug when setting the editor value to "<p><hr></p>".
A workaround has been developed. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1052695&group_id=75348&atid=543653">SF
BUG-1052695</a>] There are some rendering differences between Netscape and Mozilla.
(Actually that is a bug on both browsers). A workaround has been developed to solve
it. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1073053&group_id=75348&atid=543653">SF
BUG-1073053</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1050394&group_id=75348&atid=543653">SF
BUG-1050394</a>] The editor doesn’t throw errors when hidden. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1066321&group_id=75348&atid=543653">SF
BUG-1066321</a>] Scrollbars should not appear on dialog boxes (at least for the
Image and Link ones). </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1046490&group_id=75348&atid=543653">SF
BUG-1046490</a>] Dialogs now are forced to show on foreground over Mac. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1073955&group_id=75348">SF
BUG-1073955</a>] A small bug in the image dialog window has been corrected. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1049534&group_id=75348&atid=543653">SF
BUG-1049534</a>] The Resources Browser window is now working well over Gecko browsers.
</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1036675&group_id=75348&atid=543653">SF
BUG-1036675</a>] The Resources Browser window now displays the server error on bad
installations.</li>
</ul>
<h3>
Version 2.0 Beta 2</h3>
<ul>
<li>There is a new configuration - "<strong>GeckoUseSPAN</strong>" - that
can be used to tell Gecko browsers to use <SPAN style...> or <B>, <I>
and <U> for the bold, italic and underline commands. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1002622&group_id=75348&atid=543656">SF
Feature-1002622</a>] New <strong>Text Color</strong> and <strong>Background Color</strong>
commands have been added to the editor. </li>
<li>On Gecko browsers, a message is shown when, because of security settings, the
user is not able to cut, copy or paste data from the clipboard using the
toolbar buttons or the context menu. </li>
<li>The new "<strong>Paste as Plain Text</strong> " command has been introduced.
</li>
<li>The new "<strong>Paste from Word</strong> " command has been introduced.
</li>
<li>A new configuration named "StartupFocus" can be used to tell the
editor to get the focus when the page is loaded. </li>
<li>All <strong>Java </strong>integration files has been moved to a new separated package.
</li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1016781&group_id=75348&atid=543653">SF
BUG-1016781</a>] <strong>Table operations</strong> are now working when right click
inside a table. The following commands has been introduced: <strong>Insert Row</strong>,
<strong>Delete Row</strong>, <strong>Insert Column</strong>, <strong>Delete Column</strong>,
<strong>Insert Cell</strong> and <strong>Delete Cells</strong> . </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=965067&group_id=75348&atid=543653">SF
BUG-965067</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1010379&group_id=75348&atid=543653">SF
BUG-1010379</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=977713&group_id=75348&atid=543653">SF
BUG-977713</a>] XHTML support was not working with FireFox, blocking the
editor when submitting data. It has been fixed. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1007547&group_id=75348&atid=543653">SF
BUG-1007547</a> ] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=974595&group_id=75348&atid=543653">SF
BUG-974595</a> ] The "FCKLang not defined" error when loading
has been fixed. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=1021028&group_id=75348&atid=543653">SF
BUG-1021028</a>] If the editor doesn't have the focus, some commands were been executed
outside the editor in the place where the focus is. It has been fixed. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=981191&group_id=75348&atid=543653">SF
BUG-981191</a>] We are now using <!--- ---> for ColdFusion comments.</li>
</ul>
<h3>
Version 2.0 Beta 1</h3>
<p>
This is the first beta of the 2.x series. It brings a lot of new and important things.
Beta versions will be released until all features available on version 1.x will
be introduced in the 2.0.<br />
<br />
<strong>Note:</strong> As it is a beta, it is not yet completely developed. Future
versions can bring new features that can break backward compatibility with this
version.
</p>
<ul>
<li>Gecko browsers (<strong>Mozilla</strong> and <strong>Netscape</strong>) support.
</li>
<li><strong>Quick startup</strong> response times. </li>
<li>Complete <strong>XHTML</strong> 1.0 support. </li>
<li><strong>Advanced link</strong> dialog box:
<ul>
<li>Target selection. </li>
<li>Popup configurator. </li>
<li>E-Mail link. </li>
<li>Anchor selector. </li>
</ul>
</li>
<li>New <strong>File Manager</strong>. </li>
<li>New dialog box system, with <strong>tabbed dialogs</strong> support. </li>
<li>New <strong>context menus</strong> with icons. </li>
<li>New toolbar with "expand/collapse" feature. </li>
<li><strong>Skins</strong> support. </li>
<li><strong>Right to left languages</strong> support. </li>
</ul>
<h3>
Version 1.6.1</h3>
<ul>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=862364&group_id=75348&atid=543653">SF
BUG-862364</a>] [<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=812733&group_id=75348&atid=543653">SF
BUG-812733</a>] There was a problem when the user tried to delete the last row,
collumn or cell in a table. It has been corrected.* </li>
<li>New Estonian language file. Thanks to Kristjan Kivikangur </li>
<li>New Croatian language file. Thanks to Alex Varga. </li>
<li>Updated language file for Czech. Thanks to Plachow. </li>
<li>Updated language file for Chineze (zh-cn). Thanks to Yanglin. </li>
<li>Updated language file for Catalan. Thanks to Jordi Cerdan.</li>
</ul>
<p>
* This version has been partially sponsored by <a href="http://www.genuitec.com/">Genuitec,
LLC</a>.</p>
<h3>
Version 1.6</h3>
<ul>
<li><strong>Context Menu</strong> support for <strong>form</strong> elements.* </li>
<li>New <strong>"Selection Field" command</strong> with advanced dialog box
for options definitions.* </li>
<li>New <strong>"Image Button" command</strong> is available.* </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=936196&group_id=75348&atid=543656">SF
Feature-936196</a>] Many form elements <strong>bugs has been fixed</strong> and
<strong>many improvements</strong> has been done.* </li>
<li>New <strong>Java Integration Module</strong>. There is a complete Java API and Tag
Library implementations. Take a look at the _jsp directory. Thanks to Simone Chiaretta
and Hao Jiang. </li>
<li>The <strong>Word Spell Checker</strong> can be used. To be able to run it, your
browser security configuration "Initialize and script ActiveX controls not
marked as safe" must be set to "Enable" or "Prompt". And
easier and more secure way to do that is to add your site in the list of trusted
sites. IeSpell can still be used. Take a look at the fck_config.js file for some
configuration options. Thanks to EdwardRF. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=748807&group_id=75348&atid=543656">SF
Feature-748807</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=801030&group_id=75348&atid=543656">SF
Feature-801030</a>] [<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=880684&group_id=75348&atid=543656">SF
Feature-880684</a>] New "<strong>Anchor" command</strong>, including
context menu support. Thanks to G.Meijer. </li>
<li>Special characters are replaced with their decimal HTML entities when the XHMTL
support is enabled (only over IE5.5+). </li>
<li>New <strong>Office 2003 Style</strong> toolbar icons are available. Just uncomment
the config.ToolbarImagesPath key in the fck_config.js file. Thanks to Abdul-Aziz
A. Al-Oraij. <strong>Attention</strong>: the default toolbar items have been moved
to the "images/toolbar/default" directory. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=934566&group_id=75348&atid=543655">SF
Patch-934566</a>] <strong>Double click support</strong> for Images, Tables, Links,
Anchors and all Form elements. Thanks to Top Man. </li>
<li>New <strong>"New Page" command</strong> to start a typing from scratch.
Thanks to Abdul-Aziz A. Al-Oraij. </li>
<li>New <strong>"Replace" command</strong>. Thanks to Abdul-Aziz A. Al-Oraij.
</li>
<li>New <strong>"Advanced Font Style" command</strong>. Thanks to Abdul-Aziz
A. Al-Oraij. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=738193&group_id=75348&atid=543656">SF
Feature-738193</a>] New <strong>"Save" command</strong>. It can be used
to simulate a save action, but in fact it just submits the form where the editor
is placed in. Thanks to Abdul-Aziz A. Al-Oraij. </li>
<li>New <strong>"Universal Keyboard" command</strong>. This 22 charsets are
available: Arabic, Belarusian, Bulgarian, Croatian, Czech, Danish, Finnish, French,
Greek, Hebrew, Hungarian, Diacritical, Macedonian, Norwegian, Polish, Russian, Serbian
(Cyrillic), Serbian (Latin), Slovak, Spanish, Ukrainian and Vietnamese. Includes
a keystroke listener to type Arabic on none Arabic OS or machine. Thanks to Abdul-Aziz
A. Al-Oraij. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=935358&group_id=75348&atid=543655">SF
Patch-935358</a>] New <strong>"Preview" command</strong>. Context menu
option is included and can be deactivated throw the config.ShowPreviewContextMenu
configuration. Thanks to Ben Ramsey. </li>
<li>New "<strong>Table Auto Format</strong>" context menu command. Hack a
little the fck_config.js and the fck_editorarea.css files. Thanks to Alexandros
Lezos. </li>
<li>New "<strong>Bulleted List Properties</strong> " context menu to define
its type and class. Thanks to Alexandros Lezos. </li>
<li>The <strong>image dialog</strong> box has been a <strong>redesigned</strong> . Thanks
to Mark Fierling. </li>
<li>Images now always have the <strong>"alt" attribute</strong> set, even
when it's value is empty. Thanks to Andreas Barnet. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=942250&group_id=75348&atid=543655">SF
Patch-942250</a>] You can set on fck_config.js to <strong>automatically clean Word</strong>
pasting operations without a user confirmation. </li>
<li>Forms element dialogs and other localization pending labels has been updated. </li>
<li>A new <strong>Lithuanian</strong> language file is available. Thanks to Tauras Paliulis.
</li>
<li>A new <strong>Hebrew</strong> language file is available. Thanks to Ophir Radnitz.
</li>
<li>A new <strong>Serbian</strong> language file is available. Thanks to Zoran Subic.
</li>
<li><strong>Danish</strong> language file updates. Thanks to Flemming Jensen. </li>
<li><strong>Catalan</strong> language file updates. Thanks to Jordi Cerdan. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=936514&group_id=75348&atid=543655">SF
Patch-936514</a>] [<a href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=918716&group_id=75348">SF
BUG-918716</a>] [<a href="https://sourceforge.net/tracker/index.php?func=detail&aid=931037&group_id=75348&atid=543653">SF
BUG-931037</a>] [<a href="https://sourceforge.net/tracker/index.php?func=detail&aid=865864&group_id=75348&atid=543653">SF
BUG-865864</a>] [<a href="https://sourceforge.net/tracker/index.php?func=detail&aid=915410&group_id=75348&atid=543653">SF
BUG-915410</a>] [<a href="https://sourceforge.net/tracker/index.php?func=detail&aid=918716&group_id=75348&atid=543653">SF
BUG-918716</a>] Some <strong>languages files</strong> were not
saved on <strong>UTF-8</strong> format causing some javascript errors on loading
the editor or making "undefined" to show on editor labels. This problem
was solved. </li>
<li>Updates on the testsubmit.php file. Thanks to Geat and Gabriel Schillaci </li>
<li>[<a href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=924620&group_id=75348">SF
BUG-924620</a>] There was a problem when setting a name to an editor instance when
the name is used by another tag. For example when using "description"
as the name in a page with the <META name="description"> tag. </li>
<li>[<a href="https://sourceforge.net/tracker/index.php?func=detail&aid=935018&group_id=75348&atid=543653">SF
BUG-935018</a>] The "buletted" typo has been corrected. </li>
<li>[<a href="https://sourceforge.net/tracker/index.php?func=detail&aid=902122&group_id=75348&atid=543653">SF
BUG-902122</a>] Wrong css and js file references have been corrected. </li>
<li>[<a href="https://sourceforge.net/tracker/index.php?func=detail&aid=918942&group_id=75348&atid=543653">SF
BUG-918942</a>] All dialog boxes now accept Enter and Escape keys as Ok and Cancel
buttons.</li>
</ul>
<p>
* This version has been partially sponsored by <a href="http://www.genuitec.com/">Genuitec,
LLC</a>.</p>
<h3>
Version 1.5</h3>
<ul>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543656&aid=913777&group_id=75348">SF
Feature-913777</a>] <strong>New Form Commands</strong> are now available! Special
thanks to G.Meijer. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=861149&group_id=75348&atid=543656">SF
Feature-861149</a>] <strong>Print Command</strong> is now available! </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=743546&group_id=75348">SF
BUG-743546</a>] The <strong>XHTML content duplication problem </strong>has been
<strong>solved</strong> . Thanks to Paul Hutchison. </li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=875853&group_id=75348">SF
BUG-875853</a>] The <strong>image dialog box</strong> now gives precedence for width
and height values set as styles. In this way a user can change the size of the image
directly inside the editor and the changes will be reflected in the dialog box.
</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543656&aid=913777&group_id=75348">SF
Feature-788368</a>] The sample <strong>file upload </strong>manager for ASPX now
uses <strong>guids</strong> for the file name generation. In this way a support
XML file is not needed anymore. </li>
<li>It's possible now to <strong>programmatically change the Base Path</strong> of the
editor if it's installed in a directory different of "/FCKeditor/". Something
like this:<br />
oFCKeditor.BasePath = '/FCKeditor/' ;<br />
Take a look at the _test directory for samples. </li>
<li>There was a little bug in the TAB feature that moved the insertion point if there
were any object (images, tables) in the content. It has been fixed. </li>
<li>The problem with <strong>accented and international characters</strong> on the PHP
test page was solved. </li>
<li>A new <strong>Chinese (Taiwan)</strong> language file is available. Thanks to Nil.
</li>
<li>A new <strong>Slovenian</strong> language file is available. Thanks to Pavel Rotar.
</li>
<li>A new <strong>Catalan</strong> language file is available. Thanks to Jordi Cerdan.
</li>
<li>A new <strong>Arabic</strong> language file is available. Thanks to Abdul-Aziz A.
Al-Oraij. </li>
<li>Small corrections on the <strong>Norwegian</strong> language file. </li>
<li>A Java version for the test results (testsubmit.jsp) is now available. Thanks to
Pritpal Dhaliwal. </li>
<li>When using JavaScript to create a editor instance it's possible now to easily get
the editor's value calling oFCKeditor.GetValue() (eg.). Better JavaScript API interfaces
will be available on version 2.0. </li>
<li>If <strong>XHTML</strong> is enabled the editor cleans the HTML before showing it
on the Source View, so the exact result can be viewed by the user. This option can
be activated setting config.EnableSourceXHTML = true in the fck_config.js file.
</li>
<li>The <strong>JS integration object</strong> now escapes all configuration settings,
in this way a user can use <strong>reserved chars</strong> on it. For example:
<br />
oFCKeditor.Config["ImageBrowserURL"] = '/imgs/browse.asp?filter=abc*.jpg&userid=1';
</li>
<li>A minimal browse server sample is now available in ASP. Thanks to Andreas Barnet.
</li>
</ul>
<h3>
Version 1.4</h3>
<ul>
<li><strong>ATTENTION: For PHP users</strong>: The editor was changed and now uses <strong>
htmlspecialchars</strong> instead of <strong>htmlentities</strong> when handling
the initial value. It should works well, but please make some tests before upgrading
definitively. If there is any problem just uncomment the line in the fckeditor.php
file (and send me a message!). </li>
<li>The editor is now integrated with <strong>ieSpell</strong> (<a href="http://www.iespell.com">http://www.iespell.com</a>)
for <strong>Spell Checking</strong>. You can configure the download URL in then
fck_config.js file. Thanks to Sanjay Sharma. (ieSpell is free for personal use but
must be paid for commercial use) </li>
<li><strong>Table</strong> and <strong>table cell</strong> dialogs has been changed.
Now you can <strong>select the class</strong> you want to be applied. Thanks to
Alexander Lezos. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=865378&group_id=75348&atid=543656">SF
Feature-865378</a>]A new <strong>upload support is available for ASP</strong>. It
uses the /UserImages/ folder in the root of the web site as the files container
and a counter controlled by the upload.cnt file. Both must have write permissions
set to the IUSR_xxx user. Thanks to Trax and Juanjo. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=798128&group_id=75348&atid=543655">SF
Patch-798128</a>] The user (programmer) can now define a <strong>custom separator</strong>
for the list items of a combo in the toolbar. Thanks to Wulff D. Heiss. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=741963&group_id=75348&atid=543656">SF
Feature-741963</a>][<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=878941&group_id=75348&atid=543656">SF
Feature-878941</a>][<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=869389&group_id=75348&atid=543655">SF
Patch-869389</a>] A minimal support for a “fake” <strong>TAB is now available</strong>,
even if HTML has no support for TAB. Now when the user presses the TAB key a configurable
number of spaces (&nbsp;) is added. Take a look at config.TabSpaces on the fck_config.js
file. No action is performed if it is set to zero. The default value is 4. Thanks
to Phil Hassey. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=782779&group_id=75348&atid=543653">SF
BUG-782779</a>][<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=790939&group_id=75348&atid=543653">SF
BUG-790939</a>] The problem with big images has been corrected. Thanks to Raver.
</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=853374&group_id=75348">SF
BUG-862975</a>] Now the editor does nothing if no image is selected in the image
dialog box and the OK button is hit. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=851609&group_id=75348&atid=543653">SF
BUG-851609</a>] The problem with ASP and null values has been solved. </li>
<li><strong>Norwegean</strong> language pack. Thanks to Martin Kronstad. </li>
<li><strong>Hungarian</strong> language pack. Thanks to Balázs Szabó.
</li>
<li><strong>Bosnian</strong> language pack. Thanks to Trax. </li>
<li><strong>Japanese</strong> language pack. Thanks to Kato Yuichiro. </li>
<li>Updates on the <strong>Polish</strong> language pack. Thanks to Norbert Neubauer.
</li>
<li>The <strong>Chinese (Taiwan)</strong> (zh-tw) has been removed from the package
because it's corrupt. I'm sorry. I hope someone could send me a good version soon.
</li>
</ul>
<h3>
Version 1.3.1</h3>
<ul>
<li>It's now possible to configure the editor the insert a <strong><BR> tag instead
of <P></strong> when the user presses the <strong><Enter></strong> key.
Take a look at the fck_config.js configuration file for the "<strong>UseBROnCarriageReturn</strong>"
key. This option is disabled by default. </li>
<li><strong>Icelandic</strong> language pack. Thanks to Andri Óskarsson. </li>
<li>[<a href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=853374&group_id=75348">SF
BUG-853374</a>] On IE 5.0 there was a little error introduced with version 1.3 on
initialization. It was corrected. </li>
<li>[<a href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=853372&group_id=75348">SF
BUG-853372</a>] On IE 5.0 there was a little error introduced with version 1.3 when
setting the focus in the editor. It was corrected. </li>
<li>Minor errors on the language file for <strong>english</strong> has been corrected.
Thanks to Anders Madsen. </li>
<li>Minor errors on the language file for <strong>danish</strong> has been corrected.
Thanks to Martin Johansen. </li>
</ul>
<h3>
Version 1.3</h3>
<ul>
<li>Language support for <strong>Danish, Polish, Simple Chinese, Slovak, Swedish and
Turkish</strong>. </li>
<li>Language updates for <strong>Romanian</strong>. </li>
<li>It's now possible to <strong>override</strong> any of the <strong>editor's configurations</strong>
(for now it's implemented just for JavaScript, ASPX and HTC modules). See _test/test.html
for a sample. I'm now waiting for the Community for the ASP, CFM and PHP versions.
</li>
<li>A new method is available for <strong>PHP</strong> users. It's called <strong>ReturnFCKeditor</strong>.
It works exactly like CreateFCKeditor, but it <strong>returns a string with the HTML</strong>
for the editor instead of output it (echo). This feature is useful for people who
are working with Smarty Templates or something like that. Thanks to Timothy J. Finucane.
</li>
<li>Many people have had problems with <strong>international characters</strong> over
<strong>PHP</strong>. I had also the same problem. PHP have strange problems with
character encoding. The code hasn't been changed but just saved again with Western
European encoding. <strong>Now it works well</strong> in my system.<br />
Take a look also at the "default_charset" configuration option at the
php.ini file. It doesn't seem to be an editor's problem but a PHP issue. </li>
<li>The "<strong>testsubmit.php</strong>" file now strips the "<strong>Magic
Quotes</strong> " that are automatically added by PHP on form posts. </li>
<li>A <strong>new language</strong> integration module is available for <strong>ASP/Jscript</strong>.
Thanks to Dimiter Naydenov. </li>
<li><strong>New configuration</strong> options are available to <strong>customize the
Target</strong> combo box in the <strong>Insert/Modify Link</strong> dialog box.
Now you can hide it, or set which options are available in the combo box. Take a
look at the fck_config.js file. </li>
<li>The <strong>Text as Plain Text</strong> toolbar <strong>icon</strong> has been changed
<strong>to avoid confusion</strong> with the Normal Paste or. Thanks to Kaupo Kalda.
</li>
<li>The file <strong>dhtmled.cab has been removed</strong> from the package. It's not
needed to the editor to work and caused some confusion for a few users. </li>
<li>The <strong>editor's content</strong> now <strong>doesn't loose the focus</strong>
when the user clicks with the mouse in a toolbar button. </li>
<li>On <strong>drag-and-drop</strong> operations the data to be inserted in the editor
is now <strong>converted to plain text</strong> when the "<strong>ForcePasteAsPlainText</strong>"
configuration is set to <strong>true</strong>. </li>
<li>The <strong>image browser</strong> sample in PHP now <strong>sorts the files</strong>
by name. Thanks to Sergey Lupashko. </li>
<li>Two <strong>new configuration</strong> options are available to <strong>turn on/off
by default</strong> the "<strong>Show Borders</strong>" and "<strong>Show
Details</strong>" commands. </li>
<li>Some <strong>characters have been removed</strong> from the "<strong>Insert
Special Chars</strong>" dialog box because they were causing encoding problems
in some languages. Thanks to Abomb Hua. </li>
<li><strong>JSP</strong> versions of the <strong>image and file upload and browsing</strong>
features. Thanks to Simone Chiaretta.</li>
</ul>
<h3>
Version 1.2.4</h3>
<ul>
<li>Language support for <strong>Spanish, Finnish, Romanian and Korean</strong>. </li>
<li>Language updates for <strong>German</strong>. </li>
<li>New <strong>Zoom</strong> toolbar option. (<a href="https://sourceforge.net/forum/forum.php?thread_id=904116&forum_id=257180">Thanks
to "mtn_roadie"</a>)</li>
</ul>
<h3>
Version 1.2.2</h3>
<ul>
<li>Language support for <strong>French</strong>. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=782779&group_id=75348&atid=543653">SF
BUG-782779</a>] Version 1.2 introduced a bug on the image dialog window: when changing
the image, no update was done. This bug is now fixed. </li>
</ul>
<h3>
Version 1.2</h3>
<ul>
<li>Enhancements to the <strong>Word cleaning</strong> feature (Thanks to Karl von Randow).
</li>
<li>The <strong>Table dialog box</strong> now handles the Style width and height set
in the table (Thanks to Roberto Arruda). There where many problems on prior version
when people changed manually the table's size, dragging the size handles, and then
it was not possible to set a new size using the table dialog box. </li>
<li>For the <strong>Image dialog box:</strong>
<ul>
<li>No image is shown in the preview pane if no image has been set. </li>
<li>If no HSpace is set in the image a "-1" value was shown in the dialog
box. Now, nothing is shown if the value is negative. </li>
</ul>
</li>
<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=739630&group_id=75348&atid=543653">SF
BUG-739630</a>] Image with link lost the link when changing its properties. The
problem is solved. </li>
<li>Due to some problems in the XHTML cleaning (content duplication when the source
HTML is dirty and malformed), the <strong>XHTML support is turned off by default</strong>
from this version. You can still change this behavior and turn it on in the configuration
file. </li>
<li>Some little updates on the <strong>English </strong>language file. </li>
<li>A few addition of missing entries on all languages files (translations for these
changes are pending). </li>
<li>Language files has been added for the following languages:
<ul>
<li><strong>Brazilian Portuguese</strong> (pt-br) </li>
<li><strong>Czech</strong> (cz) </li>
<li><strong>Dutch</strong> (nl) </li>
<li><strong>Russian</strong> (ru) </li>
<li><strong>Chinese (Taiwan)</strong> (zh-tw) </li>
<li><strong>Greek</strong> (gr) </li>
<li><strong>German</strong> (de)</li>
</ul>
</li>
</ul>
<h3>
Version 1.1</h3>
<ul>
<li>The "<strong>Multi Language</strong>" system is now available. This version
ships with English and Italian versions completed. Other languages will be available
soon. The editor automatically detects the client language and sets all labels,
tooltips and dialog boxes to it, if available. The auto detection and the default
language can be set in the <strong>fck_config.file</strong>. </li>
<li>Two files can now be created to isolate customizations code from the original source
code of the editor: <strong>fckeditor.config.js</strong> and <strong>fckeditor.custom.js</strong>.
Create these files in the root folder of your web site, if needed. The first one
can be used to add or override configurations set on fck_config.js. The second one
is used for custom actions and behaviors. </li>
<li>A problem with relative links and images like "/test/test.doc" has been
solved. In prior versions, only with XHTML support enabled, the URL was changed
to something like "http://www.mysite.xxx/test/test.doc" (The domain was
automatically added). Now the XHTML cleaning procedure gets the URLs exactly how
they are defined in the editor’s HTML. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=742168&group_id=75348&atid=543653">SF
BUG-742168</a>] Mouse drag and drop from toolbar buttons has been disabled. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=768210&group_id=75348&atid=543653">SF
BUG-768210</a>] HTML entities, like <strong>&lt;</strong>, were not load correctly.
The problem is solved. </li>
<li>[<a target="_blank" href="http://sourceforge.net/tracker/index.php?func=detail&aid=748812&group_id=75348&atid=543653">SF
BUG-748812</a>] The link dialog window doesn't open when the link button is grayed.
</li>
</ul>
<h3>
Version 1.0</h3>
<ul>
<li>Three new options are available in the configuration file to set what file types
are allowed / denied to be uploaded from the "Insert Link" and "Insert
Image" dialog boxes. </li>
<li>Upload options, for links and images, are automatically hidden on IE 5.0 browsers
(it's not compatible). </li>
<li>[SF BUG-734894] Fixed a problem on XHTML cleaning: the value on INPUT fields were
lost. </li>
<li>[SF BUG-713797] Fixed some image dialog errors when trying to set image properties
when no image is available. </li>
<li>[SF BUG-736414] Developed a workaround for a DHTML control bug when loading in the
editor some HTML started with <p><hr></p>. </li>
<li>[SF BUG-737143] Paste from Word cleaning changed to solve some IE 5.0 errors. This
feature is still not available over IE 5.0. </li>
<li>[SF BUG-737233] CSS mappings are now OK on the PHP image browser module. </li>
<li>[SF BUG-737495] The image preview in the image dialog box is now working correctly.
</li>
<li>[SF BUG-737532] The editor automatically switches to WYSIWYG mode when the form
is posted. </li>
<li>[SF BUG-739571] The editor is now working well over Opera (as for Netscape, a TEXTAREA
is shown). </li>
</ul>
<h3>
Version 1.0 Final Candidate</h3>
<ul>
<li>A new dialog box for the "Link" command is available. Now you can upload
and browse the server exactly like the image dialog box. It's also possible to define
the link title and target window (_blank, _self, _parent and _top). As with the
image dialog box, a sample (and simple) file server browser is available. </li>
<li>A new configuration option is available to force every paste action to be handled
as plain text. See "config.ForcePasteAsPlainText" in fck_config.js. </li>
<li>A new Toolbar button is available: "Paste from Word". It automatically
cleans the clipboard content before pasting (removesWord styles, classes, xml stuff,
etc...). This command is available for IE 5.5 and more. For IE 5.0 users, a message
is displayed advising that the text will not be cleaned before pasting. </li>
<li>The editor automatically detects Word clipboard data on pasting operations and asks
the user to clean it before pasting. This option is turned on by default but it
can be configured. See "config.AutoDetectPasteFromWord" in fck_config.js.
</li>
<li>Table properties are now available in cells' right click context menu. </li>
<li>It's now possible to edit cells advanced properties from it's right click context
menu. </li>
</ul>
<h3>
Version 1.0 Release Candidate 1 (RC1)</h3>
<ul>
<li>Some performance improvements. </li>
<li>The file dhtmled.cab has been added to the package for clients ho needs to install
the Microsoft DHTML Editor component. </li>
<li>[SF BUG-713952] The format command options are localized, so it depends on the IE
language to work. Until version 0.9.5 it was working only over English IE browsers.
Now the options are load dynamically on the client using the client's language.
</li>
<li>[SF BUG-712103] The style command is localized, so it depends on the IE language
to work. Until version 0.9.5 it was working only over English IE browsers. Now it
configures itself using the client's language. </li>
<li>[SF BUG-726137] On version 0.9.5, some commands (special chars, image, emoticons,
...) remove the next available character before inserting the required content even
if no selection was made in the editor. Now the editor replaces only the selected
content (if available). </li>
</ul>
<h3>
Version 0.9.5 beta</h3>
<ul>
<li>XHTML support is now available! It can be enabled/disabled in the fck_config.js
file. </li>
<li>"Show Table Borders" option: show borders for tables with borders size
set to zero. </li>
<li>"Show Details" option: show hidden elements (comments, scripts, paragraphs,
line breaks) </li>
<li>IE behavior integration module. Thanks to Daniel Shryock. </li>
<li>"Find" option: to find text in the document. </li>
<li>More performance enhancements. </li>
<li>New testsubmit.php file. Thansk to Jim Michaels. </li>
<li>Two initial PHP upload manager implementations (not working yet). Thanks to Frederic
Tyndiuk and Christian Liljedahl. </li>
<li>Initial PHP image browser implementation (not working yet). Thanks to Frederic Tyndiuk.
</li>
<li>Initial CFM upload manager implementation. Thanks to John Watson. </li>
</ul>
<h3>
Version 0.9.4 beta</h3>
<ul>
<li>ColdFusion module integration is now available! Thanks to John Watson. </li>
<li>"Insert Smiley" toolbar option! Thanks to Fredox. Take a look at fck_config.js
for configuration options. </li>
<li>"Paste as plain text" toolbar option! </li>
<li>Right click support for links (edit / remove). </li>
<li>Buttons now are shown in gray when disabled. </li>
<li>Buttons are shown just when the image is downloaded (no more "red x" while
waiting for it). </li>
<li>The toolbar background color can be set with a CSS style (see fck_editor.css). </li>
<li>Toolbar images have been reviewed:
<ul>
<li>Now they are transparent. </li>
<li>No more over...gif for every button (so the editor loads quicker). </li>
<li>Buttons states are controlled with CSS styles. (see fck_editor.css).</li>
</ul>
</li>
<li>Internet Explorer 5.0 compatibility, except for the image uploading popup. </li>
<li>Optimizations when loading the editor. </li>
<li>[SF BUG-709544] - Toolbar buttons wait for the images to be downloaded to start
watching and responding the user actions (turn buttons on/off when the user changes
position inside the editor). </li>
<li>JavaScript integration is now Object Oriented. CreateFCKeditor function is not available
anymore. Take a look in test.html. </li>
<li>Two new configuration options, ImageBrowser and ImageUpload, are available to turn
on and off the image upload and image browsing options in the Image dialog box.
This options can be hidden for a specific editor instance throw specific URL parameter
in the editor’s IFRAME (upload=true/false&browse=true/false). All specific
language integration modules handle this option. For sample see the _test directory.
</li>
</ul>
</body>
</html>
| 10npsite | trunk/guanli/system/fckeditor/_whatsnew_history.html | HTML | asf20 | 309,406 |
<?php
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* This is the integration file for PHP 5.
*
* It defines the FCKeditor class that can be used to create editor
* instances in PHP pages on server side.
*/
/**
* Check if browser is compatible with FCKeditor.
* Return true if is compatible.
*
* @return boolean
*/
function FCKeditor_IsCompatibleBrowser()
{
if ( isset( $_SERVER ) ) {
$sAgent = $_SERVER['HTTP_USER_AGENT'] ;
}
else {
global $HTTP_SERVER_VARS ;
if ( isset( $HTTP_SERVER_VARS ) ) {
$sAgent = $HTTP_SERVER_VARS['HTTP_USER_AGENT'] ;
}
else {
global $HTTP_USER_AGENT ;
$sAgent = $HTTP_USER_AGENT ;
}
}
if ( strpos($sAgent, 'MSIE') !== false && strpos($sAgent, 'mac') === false && strpos($sAgent, 'Opera') === false )
{
$iVersion = (float)substr($sAgent, strpos($sAgent, 'MSIE') + 5, 3) ;
return ($iVersion >= 5.5) ;
}
else if ( strpos($sAgent, 'Gecko/') !== false )
{
$iVersion = (int)substr($sAgent, strpos($sAgent, 'Gecko/') + 6, 8) ;
return ($iVersion >= 20030210) ;
}
else if ( strpos($sAgent, 'Opera/') !== false )
{
$fVersion = (float)substr($sAgent, strpos($sAgent, 'Opera/') + 6, 4) ;
return ($fVersion >= 9.5) ;
}
else if ( preg_match( "|AppleWebKit/(\d+)|i", $sAgent, $matches ) )
{
$iVersion = $matches[1] ;
return ( $matches[1] >= 522 ) ;
}
else
return false ;
}
class FCKeditor
{
/**
* Name of the FCKeditor instance.
*
* @access protected
* @var string
*/
public $InstanceName ;
/**
* Path to FCKeditor relative to the document root.
*
* @var string
*/
public $BasePath ;
/**
* Width of the FCKeditor.
* Examples: 100%, 600
*
* @var mixed
*/
public $Width ;
/**
* Height of the FCKeditor.
* Examples: 400, 50%
*
* @var mixed
*/
public $Height ;
/**
* Name of the toolbar to load.
*
* @var string
*/
public $ToolbarSet ;
/**
* Initial value.
*
* @var string
*/
public $Value ;
/**
* This is where additional configuration can be passed.
* Example:
* $oFCKeditor->Config['EnterMode'] = 'br';
*
* @var array
*/
public $Config ;
/**
* Main Constructor.
* Refer to the _samples/php directory for examples.
*
* @param string $instanceName
*/
public function __construct( $instanceName )
{
$this->InstanceName = $instanceName ;
$this->BasePath = '/fckeditor/' ;
$this->Width = '100%' ;
$this->Height = '200' ;
$this->ToolbarSet = 'Default' ;
$this->Value = '' ;
$this->Config = array() ;
}
/**
* Display FCKeditor.
*
*/
public function Create()
{
echo $this->CreateHtml() ;
}
/**
* Return the HTML code required to run FCKeditor.
*
* @return string
*/
public function CreateHtml()
{
$HtmlValue = htmlspecialchars( $this->Value ) ;
$Html = '' ;
if ( $this->IsCompatible() )
{
if ( isset( $_GET['fcksource'] ) && $_GET['fcksource'] == "true" )
$File = 'fckeditor.original.html' ;
else
$File = 'fckeditor.html' ;
$Link = "{$this->BasePath}editor/{$File}?InstanceName={$this->InstanceName}" ;
if ( $this->ToolbarSet != '' )
$Link .= "&Toolbar={$this->ToolbarSet}" ;
// Render the linked hidden field.
$Html .= "<input type=\"hidden\" id=\"{$this->InstanceName}\" name=\"{$this->InstanceName}\" value=\"{$HtmlValue}\" style=\"display:none\" />" ;
// Render the configurations hidden field.
$Html .= "<input type=\"hidden\" id=\"{$this->InstanceName}___Config\" value=\"" . $this->GetConfigFieldString() . "\" style=\"display:none\" />" ;
// Render the editor IFRAME.
$Html .= "<iframe id=\"{$this->InstanceName}___Frame\" src=\"{$Link}\" width=\"{$this->Width}\" height=\"{$this->Height}\" frameborder=\"0\" scrolling=\"no\"></iframe>" ;
}
else
{
if ( strpos( $this->Width, '%' ) === false )
$WidthCSS = $this->Width . 'px' ;
else
$WidthCSS = $this->Width ;
if ( strpos( $this->Height, '%' ) === false )
$HeightCSS = $this->Height . 'px' ;
else
$HeightCSS = $this->Height ;
$Html .= "<textarea name=\"{$this->InstanceName}\" rows=\"4\" cols=\"40\" style=\"width: {$WidthCSS}; height: {$HeightCSS}\">{$HtmlValue}</textarea>" ;
}
return $Html ;
}
/**
* Returns true if browser is compatible with FCKeditor.
*
* @return boolean
*/
public function IsCompatible()
{
return FCKeditor_IsCompatibleBrowser() ;
}
/**
* Get settings from Config array as a single string.
*
* @access protected
* @return string
*/
public function GetConfigFieldString()
{
$sParams = '' ;
$bFirst = true ;
foreach ( $this->Config as $sKey => $sValue )
{
if ( $bFirst == false )
$sParams .= '&' ;
else
$bFirst = false ;
if ( $sValue === true )
$sParams .= $this->EncodeConfig( $sKey ) . '=true' ;
else if ( $sValue === false )
$sParams .= $this->EncodeConfig( $sKey ) . '=false' ;
else
$sParams .= $this->EncodeConfig( $sKey ) . '=' . $this->EncodeConfig( $sValue ) ;
}
return $sParams ;
}
/**
* Encode characters that may break the configuration string
* generated by GetConfigFieldString().
*
* @access protected
* @param string $valueToEncode
* @return string
*/
public function EncodeConfig( $valueToEncode )
{
$chars = array(
'&' => '%26',
'=' => '%3D',
'"' => '%22' ) ;
return strtr( $valueToEncode, $chars ) ;
}
}
| 10npsite | trunk/guanli/system/fckeditor/fckeditor_php5.php | PHP | asf20 | 6,156 |
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Defines some constants used by the editor. These constants are also
* globally available in the page where the editor is placed.
*/
// Editor Instance Status.
var FCK_STATUS_NOTLOADED = window.parent.FCK_STATUS_NOTLOADED = 0 ;
var FCK_STATUS_ACTIVE = window.parent.FCK_STATUS_ACTIVE = 1 ;
var FCK_STATUS_COMPLETE = window.parent.FCK_STATUS_COMPLETE = 2 ;
// Tristate Operations.
var FCK_TRISTATE_OFF = window.parent.FCK_TRISTATE_OFF = 0 ;
var FCK_TRISTATE_ON = window.parent.FCK_TRISTATE_ON = 1 ;
var FCK_TRISTATE_DISABLED = window.parent.FCK_TRISTATE_DISABLED = -1 ;
// For unknown values.
var FCK_UNKNOWN = window.parent.FCK_UNKNOWN = -9 ;
// Toolbar Items Style.
var FCK_TOOLBARITEM_ONLYICON = window.parent.FCK_TOOLBARITEM_ONLYICON = 0 ;
var FCK_TOOLBARITEM_ONLYTEXT = window.parent.FCK_TOOLBARITEM_ONLYTEXT = 1 ;
var FCK_TOOLBARITEM_ICONTEXT = window.parent.FCK_TOOLBARITEM_ICONTEXT = 2 ;
// Edit Mode
var FCK_EDITMODE_WYSIWYG = window.parent.FCK_EDITMODE_WYSIWYG = 0 ;
var FCK_EDITMODE_SOURCE = window.parent.FCK_EDITMODE_SOURCE = 1 ;
var FCK_IMAGES_PATH = 'images/' ; // Check usage.
var FCK_SPACER_PATH = 'images/spacer.gif' ;
var CTRL = 1000 ;
var SHIFT = 2000 ;
var ALT = 4000 ;
var FCK_STYLE_BLOCK = 0 ;
var FCK_STYLE_INLINE = 1 ;
var FCK_STYLE_OBJECT = 2 ;
| 10npsite | trunk/guanli/system/fckeditor/editor/_source/fckconstants.js | JavaScript | asf20 | 1,968 |