更新前端文件
87
public/static/libs/umeditor/dialogs/emotion/emotion.css
Normal file
@@ -0,0 +1,87 @@
|
||||
.edui-popup-emotion .edui-emotion-jd img{
|
||||
background:transparent url(images/jxface2.gif?v=1.1) no-repeat scroll left top;
|
||||
cursor:pointer;width:35px;height:35px;display:block;
|
||||
}
|
||||
.edui-popup-emotion .edui-emotion-pp img{
|
||||
background:transparent url(images/fface.gif?v=1.1) no-repeat scroll left top;
|
||||
cursor:pointer;width:25px;height:25px;display:block;
|
||||
}
|
||||
|
||||
.edui-popup-emotion .edui-emotion-ldw img{
|
||||
background:transparent url(images/wface.gif?v=1.1) no-repeat scroll left top;
|
||||
cursor:pointer;width:35px;height:35px;display:block;
|
||||
}
|
||||
|
||||
.edui-popup-emotion .edui-emotion-tsj img{
|
||||
background:transparent url(images/tface.gif?v=1.1) no-repeat scroll left top;
|
||||
cursor:pointer;width:35px;height:35px;display:block;
|
||||
}
|
||||
|
||||
.edui-popup-emotion .edui-emotion-cat img{
|
||||
background:transparent url(images/cface.gif?v=1.1) no-repeat scroll left top;
|
||||
cursor:pointer;width:35px;height:35px;display:block;
|
||||
}
|
||||
|
||||
.edui-popup-emotion .edui-emotion-bb img{
|
||||
background:transparent url(images/bface.gif?v=1.1) no-repeat scroll left top;
|
||||
cursor:pointer;width:35px;height:35px;display:block;
|
||||
}
|
||||
|
||||
.edui-popup-emotion .edui-emotion-youa img{
|
||||
background:transparent url(images/yface.gif?v=1.1) no-repeat scroll left top;
|
||||
cursor:pointer;width:35px;height:35px;display:block;
|
||||
}
|
||||
|
||||
.edui-popup-emotion .edui-emotion-smileytable {
|
||||
width: 100%;
|
||||
border-spacing: 0;
|
||||
border-collapse: collapse;
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
.edui-popup-emotion .edui-emotion-wrapper {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.edui-popup-emotion .edui-tab-nav{
|
||||
height: auto;
|
||||
*height: 31px;
|
||||
}
|
||||
.edui-popup-emotion .edui-emotion-tabs{
|
||||
clear: both;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.edui-popup-emotion .edui-tab-content {
|
||||
padding: 15px 0;
|
||||
}
|
||||
|
||||
.edui-popup-emotion .edui-emotion-preview-box {
|
||||
width:90px;
|
||||
height:76px;
|
||||
border:2px solid #9cb945;
|
||||
background:#FFFFFF;
|
||||
background-position:center;
|
||||
background-repeat:no-repeat;
|
||||
position: absolute;
|
||||
top: 67px;
|
||||
left: 494px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.edui-popup-emotion .edui-tab-text {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.edui-popup-emotion .edui-emotion-preview-left {
|
||||
left: 15px;
|
||||
}
|
||||
|
||||
.edui-popup-emotion .edui-emotion-preview-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
}
|
||||
272
public/static/libs/umeditor/dialogs/emotion/emotion.js
Normal file
@@ -0,0 +1,272 @@
|
||||
(function(){
|
||||
|
||||
var editor = null;
|
||||
|
||||
UM.registerWidget('emotion',{
|
||||
|
||||
tpl: "<link type=\"text/css\" rel=\"stylesheet\" href=\"<%=emotion_url%>emotion.css\">" +
|
||||
"<div class=\"edui-emotion-tab-Jpanel edui-emotion-wrapper\">" +
|
||||
"<ul class=\"edui-emotion-Jtabnav edui-tab-nav\">" +
|
||||
"<li class=\"edui-tab-item\"><a data-context=\".edui-emotion-Jtab0\" hideFocus=\"true\" class=\"edui-tab-text\"><%=lang_input_choice%></a></li>" +
|
||||
"<li class=\"edui-tab-item\"><a data-context=\".edui-emotion-Jtab1\" class=\"edui-tab-text\"><%=lang_input_Tuzki%></a></li>" +
|
||||
"<li class=\"edui-tab-item\"><a data-context=\".edui-emotion-Jtab2\" hideFocus=\"true\" class=\"edui-tab-text\"><%=lang_input_lvdouwa%></a></li>" +
|
||||
"<li class=\"edui-tab-item\"><a data-context=\".edui-emotion-Jtab3\" hideFocus=\"true\" class=\"edui-tab-text\"><%=lang_input_BOBO%></a></li>" +
|
||||
"<li class=\"edui-tab-item\"><a data-context=\".edui-emotion-Jtab4\" hideFocus=\"true\" class=\"edui-tab-text\"><%=lang_input_babyCat%></a></li>" +
|
||||
"<li class=\"edui-tab-item\"><a data-context=\".edui-emotion-Jtab5\" hideFocus=\"true\" class=\"edui-tab-text\"><%=lang_input_bubble%></a></li>" +
|
||||
"<li class=\"edui-tab-item\"><a data-context=\".edui-emotion-Jtab6\" hideFocus=\"true\" class=\"edui-tab-text\"><%=lang_input_youa%></a></li>" +
|
||||
"<li class=\"edui-emotion-tabs\"></li>" +
|
||||
"</ul>" +
|
||||
"<div class=\"edui-tab-content edui-emotion-JtabBodys\">" +
|
||||
"<div class=\"edui-emotion-Jtab0 edui-tab-pane\"></div>" +
|
||||
"<div class=\"edui-emotion-Jtab1 edui-tab-pane\"></div>" +
|
||||
"<div class=\"edui-emotion-Jtab2 edui-tab-pane\"></div>" +
|
||||
"<div class=\"edui-emotion-Jtab3 edui-tab-pane\"></div>" +
|
||||
"<div class=\"edui-emotion-Jtab4 edui-tab-pane\"></div>" +
|
||||
"<div class=\"edui-emotion-Jtab5 edui-tab-pane\"></div>" +
|
||||
"<div class=\"edui-emotion-Jtab6 edui-tab-pane\"></div>" +
|
||||
"</div>" +
|
||||
"<div class=\"edui-emotion-JtabIconReview edui-emotion-preview-box\">" +
|
||||
"<img src=\"<%=cover_img%>\" class=\'edui-emotion-JfaceReview edui-emotion-preview-img\'/>" +
|
||||
"</div>",
|
||||
|
||||
sourceData: {
|
||||
emotion: {
|
||||
tabNum:7, //切换面板数量
|
||||
SmilmgName:{ 'edui-emotion-Jtab0':['j_00', 84], 'edui-emotion-Jtab1':['t_00', 40], 'edui-emotion-Jtab2':['w_00', 52], 'edui-emotion-Jtab3':['B_00', 63], 'edui-emotion-Jtab4':['C_00', 20], 'edui-emotion-Jtab5':['i_f', 50], 'edui-emotion-Jtab6':['y_00', 40] }, //图片前缀名
|
||||
imageFolders:{ 'edui-emotion-Jtab0':'jx2/', 'edui-emotion-Jtab1':'tsj/', 'edui-emotion-Jtab2':'ldw/', 'edui-emotion-Jtab3':'bobo/', 'edui-emotion-Jtab4':'babycat/', 'edui-emotion-Jtab5':'face/', 'edui-emotion-Jtab6':'youa/'}, //图片对应文件夹路径
|
||||
imageCss:{'edui-emotion-Jtab0':'jd', 'edui-emotion-Jtab1':'tsj', 'edui-emotion-Jtab2':'ldw', 'edui-emotion-Jtab3':'bb', 'edui-emotion-Jtab4':'cat', 'edui-emotion-Jtab5':'pp', 'edui-emotion-Jtab6':'youa'}, //图片css类名
|
||||
imageCssOffset:{'edui-emotion-Jtab0':35, 'edui-emotion-Jtab1':35, 'edui-emotion-Jtab2':35, 'edui-emotion-Jtab3':35, 'edui-emotion-Jtab4':35, 'edui-emotion-Jtab5':25, 'edui-emotion-Jtab6':35}, //图片偏移
|
||||
SmileyInfor:{
|
||||
'edui-emotion-Jtab0':['Kiss', 'Love', 'Yeah', '啊!', '背扭', '顶', '抖胸', '88', '汗', '瞌睡', '鲁拉', '拍砖', '揉脸', '生日快乐', '大笑', '瀑布汗~', '惊讶', '臭美', '傻笑', '抛媚眼', '发怒', '打酱油', '俯卧撑', '气愤', '?', '吻', '怒', '胜利', 'HI', 'KISS', '不说', '不要', '扯花', '大心', '顶', '大惊', '飞吻', '鬼脸', '害羞', '口水', '狂哭', '来', '发财了', '吃西瓜', '套牢', '害羞', '庆祝', '我来了', '敲打', '晕了', '胜利', '臭美', '被打了', '贪吃', '迎接', '酷', '微笑', '亲吻', '调皮', '惊恐', '耍酷', '发火', '害羞', '汗水', '大哭', '', '加油', '困', '你NB', '晕倒', '开心', '偷笑', '大哭', '滴汗', '叹气', '超赞', '??', '飞吻', '天使', '撒花', '生气', '被砸', '吓傻', '随意吐'],
|
||||
'edui-emotion-Jtab1':['Kiss', 'Love', 'Yeah', '啊!', '背扭', '顶', '抖胸', '88', '汗', '瞌睡', '鲁拉', '拍砖', '揉脸', '生日快乐', '摊手', '睡觉', '瘫坐', '无聊', '星星闪', '旋转', '也不行', '郁闷', '正Music', '抓墙', '撞墙至死', '歪头', '戳眼', '飘过', '互相拍砖', '砍死你', '扔桌子', '少林寺', '什么?', '转头', '我爱牛奶', '我踢', '摇晃', '晕厥', '在笼子里', '震荡'],
|
||||
'edui-emotion-Jtab2':['大笑', '瀑布汗~', '惊讶', '臭美', '傻笑', '抛媚眼', '发怒', '我错了', 'money', '气愤', '挑逗', '吻', '怒', '胜利', '委屈', '受伤', '说啥呢?', '闭嘴', '不', '逗你玩儿', '飞吻', '眩晕', '魔法', '我来了', '睡了', '我打', '闭嘴', '打', '打晕了', '刷牙', '爆揍', '炸弹', '倒立', '刮胡子', '邪恶的笑', '不要不要', '爱恋中', '放大仔细看', '偷窥', '超高兴', '晕', '松口气', '我跑', '享受', '修养', '哭', '汗', '啊~', '热烈欢迎', '打酱油', '俯卧撑', '?'],
|
||||
'edui-emotion-Jtab3':['HI', 'KISS', '不说', '不要', '扯花', '大心', '顶', '大惊', '飞吻', '鬼脸', '害羞', '口水', '狂哭', '来', '泪眼', '流泪', '生气', '吐舌', '喜欢', '旋转', '再见', '抓狂', '汗', '鄙视', '拜', '吐血', '嘘', '打人', '蹦跳', '变脸', '扯肉', '吃To', '吃花', '吹泡泡糖', '大变身', '飞天舞', '回眸', '可怜', '猛抽', '泡泡', '苹果', '亲', '', '骚舞', '烧香', '睡', '套娃娃', '捅捅', '舞倒', '西红柿', '爱慕', '摇', '摇摆', '杂耍', '招财', '被殴', '被球闷', '大惊', '理想', '欧打', '呕吐', '碎', '吐痰'],
|
||||
'edui-emotion-Jtab4':['发财了', '吃西瓜', '套牢', '害羞', '庆祝', '我来了', '敲打', '晕了', '胜利', '臭美', '被打了', '贪吃', '迎接', '酷', '顶', '幸运', '爱心', '躲', '送花', '选择'],
|
||||
'edui-emotion-Jtab5':['微笑', '亲吻', '调皮', '惊讶', '耍酷', '发火', '害羞', '汗水', '大哭', '得意', '鄙视', '困', '夸奖', '晕倒', '疑问', '媒婆', '狂吐', '青蛙', '发愁', '亲吻', '', '爱心', '心碎', '玫瑰', '礼物', '哭', '奸笑', '可爱', '得意', '呲牙', '暴汗', '楚楚可怜', '困', '哭', '生气', '惊讶', '口水', '彩虹', '夜空', '太阳', '钱钱', '灯泡', '咖啡', '蛋糕', '音乐', '爱', '胜利', '赞', '鄙视', 'OK'],
|
||||
'edui-emotion-Jtab6':['男兜', '女兜', '开心', '乖乖', '偷笑', '大笑', '抽泣', '大哭', '无奈', '滴汗', '叹气', '狂晕', '委屈', '超赞', '??', '疑问', '飞吻', '天使', '撒花', '生气', '被砸', '口水', '泪奔', '吓傻', '吐舌头', '点头', '随意吐', '旋转', '困困', '鄙视', '狂顶', '篮球', '再见', '欢迎光临', '恭喜发财', '稍等', '我在线', '恕不议价', '库房有货', '货在路上']
|
||||
}
|
||||
}
|
||||
},
|
||||
initContent:function( _editor, $widget ){
|
||||
|
||||
var me = this,
|
||||
emotion = me.sourceData.emotion,
|
||||
lang = _editor.getLang( 'emotion' )['static'],
|
||||
emotionUrl = UMEDITOR_CONFIG.UMEDITOR_HOME_URL + 'dialogs/emotion/',
|
||||
options = $.extend( {}, lang, {
|
||||
emotion_url: emotionUrl
|
||||
}),
|
||||
$root = me.root();
|
||||
|
||||
if( me.inited ) {
|
||||
me.preventDefault();
|
||||
this.switchToFirst();
|
||||
return;
|
||||
}
|
||||
|
||||
me.inited = true;
|
||||
|
||||
editor = _editor;
|
||||
this.widget = $widget;
|
||||
|
||||
emotion.SmileyPath = _editor.options.emotionLocalization === true ? emotionUrl + 'images/' : "http://img.baidu.com/hi/";
|
||||
emotion.SmileyBox = me.createTabList( emotion.tabNum );
|
||||
emotion.tabExist = me.createArr( emotion.tabNum );
|
||||
|
||||
options['cover_img'] = emotion.SmileyPath + (editor.options.emotionLocalization ? '0.gif' : 'default/0.gif');
|
||||
|
||||
$root.html( $.parseTmpl( me.tpl, options ) );
|
||||
|
||||
me.tabs = $.eduitab({selector:".edui-emotion-tab-Jpanel"});
|
||||
|
||||
//缓存预览对象
|
||||
me.previewBox = $root.find(".edui-emotion-JtabIconReview");
|
||||
me.previewImg = $root.find(".edui-emotion-JfaceReview");
|
||||
|
||||
me.initImgName();
|
||||
|
||||
},
|
||||
initEvent:function(){
|
||||
|
||||
var me = this;
|
||||
|
||||
//防止点击过后关闭popup
|
||||
me.root().on('click', function(e){
|
||||
return false;
|
||||
});
|
||||
|
||||
//移动预览
|
||||
me.root().delegate( 'td', 'mouseover mouseout', function( evt ){
|
||||
|
||||
var $td = $( this),
|
||||
url = $td.attr('data-surl') || null;
|
||||
|
||||
if( url ) {
|
||||
me[evt.type]( this, url , $td.attr('data-posflag') );
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
} );
|
||||
|
||||
//点击选中
|
||||
me.root().delegate( 'td', 'click', function( evt ){
|
||||
|
||||
var $td = $( this),
|
||||
realUrl = $td.attr('data-realurl') || null;
|
||||
|
||||
if( realUrl ) {
|
||||
me.insertSmiley( realUrl.replace( /'/g, "\\'" ), evt );
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
} );
|
||||
|
||||
//更新模板
|
||||
me.tabs.edui().on("beforeshow", function( evt ){
|
||||
|
||||
var contentId = $(evt.target).attr('data-context').replace( /^.*\.(?=[^\s]*$)/, '' );
|
||||
|
||||
evt.stopPropagation();
|
||||
|
||||
me.updateTab( contentId );
|
||||
|
||||
});
|
||||
|
||||
this.switchToFirst();
|
||||
|
||||
},
|
||||
initImgName: function() {
|
||||
|
||||
var emotion = this.sourceData.emotion;
|
||||
|
||||
for ( var pro in emotion.SmilmgName ) {
|
||||
var tempName = emotion.SmilmgName[pro],
|
||||
tempBox = emotion.SmileyBox[pro],
|
||||
tempStr = "";
|
||||
|
||||
if ( tempBox.length ) return;
|
||||
|
||||
for ( var i = 1; i <= tempName[1]; i++ ) {
|
||||
tempStr = tempName[0];
|
||||
if ( i < 10 ) tempStr = tempStr + '0';
|
||||
tempStr = tempStr + i + '.gif';
|
||||
tempBox.push( tempStr );
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
/**
|
||||
* 切换到第一个tab
|
||||
*/
|
||||
switchToFirst: function(){
|
||||
this.root().find(".edui-emotion-Jtabnav .edui-tab-text:first").trigger('click');
|
||||
},
|
||||
updateTab: function( contentBoxId ) {
|
||||
|
||||
var me = this,
|
||||
emotion = me.sourceData.emotion;
|
||||
|
||||
me.autoHeight( contentBoxId );
|
||||
|
||||
if ( !emotion.tabExist[ contentBoxId ] ) {
|
||||
|
||||
emotion.tabExist[ contentBoxId ] = true;
|
||||
me.createTab( contentBoxId );
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
autoHeight: function( ) {
|
||||
this.widget.height(this.root() + 2);
|
||||
},
|
||||
createTabList: function( tabNum ) {
|
||||
var obj = {};
|
||||
for ( var i = 0; i < tabNum; i++ ) {
|
||||
obj["edui-emotion-Jtab" + i] = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
mouseover: function( td, srcPath, posFlag ) {
|
||||
|
||||
posFlag -= 0;
|
||||
|
||||
$(td).css( 'backgroundColor', '#ACCD3C' );
|
||||
|
||||
this.previewImg.css( "backgroundImage", "url(" + srcPath + ")" );
|
||||
posFlag && this.previewBox.addClass('edui-emotion-preview-left');
|
||||
this.previewBox.show();
|
||||
|
||||
},
|
||||
mouseout: function( td ) {
|
||||
$(td).css( 'backgroundColor', 'transparent' );
|
||||
this.previewBox.removeClass('edui-emotion-preview-left').hide();
|
||||
},
|
||||
insertSmiley: function( url, evt ) {
|
||||
var obj = {
|
||||
src: url
|
||||
};
|
||||
obj._src = obj.src;
|
||||
editor.execCommand( 'insertimage', obj );
|
||||
if ( !evt.ctrlKey ) {
|
||||
//关闭预览
|
||||
this.previewBox.removeClass('edui-emotion-preview-left').hide();
|
||||
this.widget.edui().hide();
|
||||
}
|
||||
},
|
||||
createTab: function( contentBoxId ) {
|
||||
|
||||
var faceVersion = "?v=1.1", //版本号
|
||||
me = this,
|
||||
$contentBox = this.root().find("."+contentBoxId),
|
||||
emotion = me.sourceData.emotion,
|
||||
imagePath = emotion.SmileyPath + emotion.imageFolders[ contentBoxId ], //获取显示表情和预览表情的路径
|
||||
positionLine = 11 / 2, //中间数
|
||||
iWidth = iHeight = 35, //图片长宽
|
||||
iColWidth = 3, //表格剩余空间的显示比例
|
||||
tableCss = emotion.imageCss[ contentBoxId ],
|
||||
cssOffset = emotion.imageCssOffset[ contentBoxId ],
|
||||
textHTML = ['<table border="1" class="edui-emotion-smileytable">'],
|
||||
i = 0, imgNum = emotion.SmileyBox[ contentBoxId ].length, imgColNum = 11, faceImage,
|
||||
sUrl, realUrl, posflag, offset, infor;
|
||||
|
||||
for ( ; i < imgNum; ) {
|
||||
textHTML.push( '<tr>' );
|
||||
for ( var j = 0; j < imgColNum; j++, i++ ) {
|
||||
faceImage = emotion.SmileyBox[ contentBoxId ][i];
|
||||
if ( faceImage ) {
|
||||
sUrl = imagePath + faceImage + faceVersion;
|
||||
realUrl = imagePath + faceImage;
|
||||
posflag = j < positionLine ? 0 : 1;
|
||||
offset = cssOffset * i * (-1) - 1;
|
||||
infor = emotion.SmileyInfor[ contentBoxId ][i];
|
||||
|
||||
textHTML.push( '<td class="edui-emotion-' + tableCss + '" data-surl="'+ sUrl +'" data-realurl="'+ realUrl +'" data-posflag="'+ posflag +'" align="center">' );
|
||||
textHTML.push( '<span>' );
|
||||
textHTML.push( '<img style="background-position:left ' + offset + 'px;" title="' + infor + '" src="' + emotion.SmileyPath + (editor.options.emotionLocalization ? '0.gif" width="' : 'default/0.gif" width="') + iWidth + '" height="' + iHeight + '"></img>' );
|
||||
textHTML.push( '</span>' );
|
||||
} else {
|
||||
textHTML.push( '<td bgcolor="#FFFFFF">' );
|
||||
}
|
||||
textHTML.push( '</td>' );
|
||||
}
|
||||
textHTML.push( '</tr>' );
|
||||
}
|
||||
textHTML.push( '</table>' );
|
||||
textHTML = textHTML.join( "" );
|
||||
$contentBox.html( textHTML );
|
||||
},
|
||||
createArr: function( tabNum ) {
|
||||
var arr = [];
|
||||
for ( var i = 0; i < tabNum; i++ ) {
|
||||
arr[i] = 0;
|
||||
}
|
||||
return arr;
|
||||
},
|
||||
width:603,
|
||||
height:400
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
BIN
public/static/libs/umeditor/dialogs/emotion/images/0.gif
Normal file
|
After Width: | Height: | Size: 43 B |
BIN
public/static/libs/umeditor/dialogs/emotion/images/bface.gif
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
public/static/libs/umeditor/dialogs/emotion/images/cface.gif
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
BIN
public/static/libs/umeditor/dialogs/emotion/images/fface.gif
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
public/static/libs/umeditor/dialogs/emotion/images/jxface2.gif
Normal file
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 216 B |
BIN
public/static/libs/umeditor/dialogs/emotion/images/tface.gif
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
public/static/libs/umeditor/dialogs/emotion/images/wface.gif
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
public/static/libs/umeditor/dialogs/emotion/images/yface.gif
Normal file
|
After Width: | Height: | Size: 28 KiB |
32
public/static/libs/umeditor/dialogs/formula/formula.css
Normal file
@@ -0,0 +1,32 @@
|
||||
.edui-popup-formula .edui-formula-wrapper {
|
||||
padding: 15px;
|
||||
}
|
||||
.edui-popup-formula .edui-formula-wrapper .edui-tab-nav{
|
||||
height: auto;
|
||||
*height: 31px;
|
||||
}
|
||||
.edui-popup-formula .edui-formula-wrapper .edui-tab-text {
|
||||
font-size: 12px;
|
||||
}
|
||||
.edui-popup-formula .edui-formula-wrapper .edui-formula-clearboth {
|
||||
clear: both;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
.edui-popup-formula .edui-formula-wrapper .edui-tab-pane ul {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
.edui-popup-formula .edui-formula-wrapper .edui-tab-content {
|
||||
padding: 5px 0px 0px 0px;
|
||||
}
|
||||
.edui-popup-formula .edui-formula-wrapper .edui-tab-pane .edui-formula-latex-item {
|
||||
display: block;
|
||||
float: left;
|
||||
margin: 0px 3px 3px 0px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border:1px solid #cccccc;
|
||||
background-image: url("images/formula.png");
|
||||
cursor: pointer;
|
||||
}
|
||||
213
public/static/libs/umeditor/dialogs/formula/formula.html
Normal file
@@ -0,0 +1,213 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Document</title>
|
||||
<link rel="stylesheet" href="../../third-party/mathquill/mathquill.css"/>
|
||||
<style>
|
||||
html, body, .main{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.main{
|
||||
width:1024px;
|
||||
height:1024px;
|
||||
}
|
||||
.mathquill-editable,
|
||||
.mathquill-rendered-math{
|
||||
border: 0px;
|
||||
padding: 0px;
|
||||
margin:4px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="main">
|
||||
<div class="mathquill-editable"></div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input id="blurHelper" />
|
||||
</div>
|
||||
|
||||
<script src="../../third-party/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="../third-party/template.min.js"></script>
|
||||
<script src="../../third-party/mathquill/mathquill.js"></script>
|
||||
<script>
|
||||
$(function(){
|
||||
|
||||
var UM = parent.UM,
|
||||
$iframe = $(getSelfIframe()),
|
||||
editorId = $iframe.parents('.edui-body-container').attr('id'),
|
||||
editor = UM.getEditor(editorId),
|
||||
timer;
|
||||
|
||||
/* 获得当前公式所在的iframe节点 */
|
||||
function getSelfIframe(){
|
||||
var iframes = parent.document.getElementsByTagName('iframe');
|
||||
for (var key in iframes) {
|
||||
if (iframes[key].contentWindow == window) {
|
||||
return iframes[key];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/* 获得当前url上的hash存储的参数值 */
|
||||
function getLatex() {
|
||||
return $iframe.attr('data-latex') || '';
|
||||
}
|
||||
/* 保存场景 */
|
||||
function saveScene(){
|
||||
timer && clearTimeout(timer);
|
||||
timer = setTimeout(function(){
|
||||
editor.fireEvent('savescene');
|
||||
editor.fireEvent('contentchange');
|
||||
editor.fireEvent('selectionchange');
|
||||
timer = null;
|
||||
}, 300);
|
||||
}
|
||||
/* 设置编辑器可编辑 */
|
||||
function enableEditor(){
|
||||
if(editor.body.contentEditable == 'false') {
|
||||
editor.setEnabled();
|
||||
}
|
||||
}
|
||||
/* 设置编辑器不可编辑 */
|
||||
function disableEditor(){
|
||||
if(editor.body.contentEditable == 'true') {
|
||||
editor.setDisabled(['undo', 'redo', 'preview', 'formula'], true);
|
||||
}
|
||||
}
|
||||
|
||||
/* 公式 */
|
||||
var Formula = function(){
|
||||
var _this = this,
|
||||
latex = getLatex();
|
||||
|
||||
this.isFocus = false;
|
||||
this.isDisabled = false;
|
||||
|
||||
/* 加载公式内容 */
|
||||
this.$mathquill = $('.mathquill-editable').mathquill('latex', latex);
|
||||
|
||||
/* 设置活动状态的公式iframe */
|
||||
this.$mathquill.on('mousedown', function(){
|
||||
/* 编辑器不可用时,公式也不可用 */
|
||||
if(_this.disabled) return false;
|
||||
|
||||
/* 第一次点击当前公式,设置公式活动 */
|
||||
if(!$iframe.hasClass('edui-formula-active')) {
|
||||
disableEditor();
|
||||
editor.blur();
|
||||
editor.$body.find('iframe').not($iframe).each(function(k, v){
|
||||
v.contentWindow.formula.blur();
|
||||
});
|
||||
if(_this.$mathquill.find('.cursor').css('display') == 'none') {
|
||||
_this.refresh();
|
||||
_this.$mathquill.addClass('hasCursor');
|
||||
}
|
||||
}
|
||||
_this.focus();
|
||||
});
|
||||
editor.addListener('click', function(){
|
||||
_this.blur();
|
||||
enableEditor();
|
||||
});
|
||||
|
||||
/* 里面focus,编辑器也判断为focus */
|
||||
editor.addListener('isFocus', function(){
|
||||
return _this.isFocus;
|
||||
});
|
||||
/* um不可用,公式也不可编辑 */
|
||||
editor.addListener('setDisabled', function(type, except){
|
||||
if (!(except && except.join(' ').indexOf('formula') != -1) && _this.isDisabled != true ) {
|
||||
_this.setDisabled();
|
||||
}
|
||||
});
|
||||
editor.addListener('setEnabled', function(){
|
||||
if (_this.isDisabled != false) {
|
||||
_this.setEnabled();
|
||||
}
|
||||
});
|
||||
|
||||
/* 设置更新外层iframe的大小和属性 */
|
||||
$(document.body).on('keydown', function(){
|
||||
_this.updateIframe();
|
||||
}).on('keyup', function(){
|
||||
_this.updateIframe();
|
||||
});
|
||||
|
||||
/* 清除初始化的高亮状态 */
|
||||
this.$mathquill.removeClass('hasCursor');
|
||||
|
||||
/* 初始化后延迟刷新外层iframe大小 */
|
||||
setTimeout(function(){
|
||||
_this.updateIframe();
|
||||
}, 300);
|
||||
};
|
||||
|
||||
Formula.prototype = {
|
||||
focus:function(){
|
||||
$iframe.addClass('edui-formula-active');
|
||||
this.isFocus = true;
|
||||
},
|
||||
blur:function(){
|
||||
$iframe.removeClass('edui-formula-active');
|
||||
this.removeCursor();
|
||||
this.isFocus = false;
|
||||
},
|
||||
removeCursor: function(){
|
||||
this.$mathquill.find('span.cursor').hide();
|
||||
this.$mathquill.parent().find('.hasCursor').removeClass('hasCursor');
|
||||
},
|
||||
updateIframe: function(){
|
||||
$iframe.width(this.$mathquill.width()+8).height(this.$mathquill.height()+8);
|
||||
var latex = $iframe.attr('data-latex'),
|
||||
newLatex = this.getLatex();
|
||||
if(latex != newLatex) {
|
||||
$iframe.attr('data-latex', this.getLatex());
|
||||
saveScene();
|
||||
}
|
||||
},
|
||||
insertLatex: function(latex){
|
||||
this.$mathquill.mathquill('write', latex);
|
||||
this.updateIframe();
|
||||
this.removeCursor();
|
||||
},
|
||||
setLatex: function(latex){
|
||||
this.$mathquill.mathquill('latex', latex);
|
||||
this.updateIframe();
|
||||
},
|
||||
getLatex: function(){
|
||||
return this.$mathquill.mathquill('latex');
|
||||
},
|
||||
redraw: function(){
|
||||
this.$mathquill.mathquill('redraw');
|
||||
},
|
||||
setDisabled: function(){
|
||||
this.blur();
|
||||
var latex = this.getLatex();
|
||||
this.$mathquill.mathquill('revert').text(latex).mathquill();
|
||||
this.updateIframe();
|
||||
this.isDisabled = true;
|
||||
},
|
||||
setEnabled: function(){
|
||||
this.$mathquill.removeClass('mathquill-rendered-math');
|
||||
this.refresh();
|
||||
this.isDisabled = false;
|
||||
},
|
||||
refresh: function(){
|
||||
var latex = this.getLatex();
|
||||
this.$mathquill.mathquill('revert').text(latex).mathquill('editable');
|
||||
this.updateIframe();
|
||||
}
|
||||
};
|
||||
|
||||
/* 绑定到window上,给上级window调用 */
|
||||
window.formula = new Formula();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
124
public/static/libs/umeditor/dialogs/formula/formula.js
Normal file
@@ -0,0 +1,124 @@
|
||||
(function () {
|
||||
|
||||
var editor = null;
|
||||
|
||||
UM.registerWidget('formula', {
|
||||
|
||||
tpl: "<link type=\"text/css\" rel=\"stylesheet\" href=\"<%=formula_url%>formula.css\">" +
|
||||
"<div class=\"edui-formula-wrapper\">" +
|
||||
"<ul class=\"edui-tab-nav\"></ul>" +
|
||||
"<div class=\"edui-tab-content\"></div>" +
|
||||
"</div>",
|
||||
|
||||
sourceData: {
|
||||
formula: {
|
||||
'common': [
|
||||
"{/}frac{ }{ }", "^{ }/_{ }", "x^{ }", "x_{ }", "x^{ }_{ }", "{/}bar{ }", "{/}sqrt{ }", "{/}nthroot{ }{ }",
|
||||
"{/}sum^{ }_{n=}", "{/}sum", "{/}log_{ }", "{/}ln", "{/}int_{ }^{ }", "{/}oint_{ }^{ }"
|
||||
],
|
||||
'symbol': [
|
||||
"+", "-", "{/}pm", "{/}times", "{/}ast", "{/}div", "/", "{/}bigtriangleup",
|
||||
"=", "{/}ne", "{/}approx", ">", "<", "{/}ge", "{/}le", "{/}infty",
|
||||
"{/}cap", "{/}cup", "{/}because", "{/}therefore", "{/}subset", "{/}supset", "{/}subseteq", "{/}supseteq",
|
||||
"{/}nsubseteq", "{/}nsupseteq", "{/}in", "{/}ni", "{/}notin", "{/}mapsto", "{/}leftarrow", "{/}rightarrow",
|
||||
"{/}Leftarrow", "{/}Rightarrow", "{/}leftrightarrow", "{/}Leftrightarrow"
|
||||
],
|
||||
'letter': [
|
||||
"{/}alpha", "{/}beta", "{/}gamma", "{/}delta", "{/}varepsilon", "{/}varphi", "{/}lambda", "{/}mu",
|
||||
"{/}rho", "{/}sigma", "{/}omega", "{/}Gamma", "{/}Delta", "{/}Theta", "{/}Lambda", "{/}Xi",
|
||||
"{/}Pi", "{/}Sigma", "{/}Upsilon", "{/}Phi", "{/}Psi", "{/}Omega"
|
||||
]
|
||||
}
|
||||
},
|
||||
initContent: function (_editor, $widget) {
|
||||
|
||||
var me = this,
|
||||
formula = me.sourceData.formula,
|
||||
lang = _editor.getLang('formula').static,
|
||||
formulaUrl = UMEDITOR_CONFIG.UMEDITOR_HOME_URL + 'dialogs/formula/',
|
||||
options = $.extend({}, lang, { 'formula_url': formulaUrl }),
|
||||
$root = me.root();
|
||||
|
||||
if (me.inited) {
|
||||
me.preventDefault();
|
||||
return;
|
||||
}
|
||||
me.inited = true;
|
||||
|
||||
editor = _editor;
|
||||
me.$widget = $widget;
|
||||
|
||||
$root.html($.parseTmpl(me.tpl, options));
|
||||
me.tabs = $.eduitab({selector: "#edui-formula-tab-Jpanel"});
|
||||
|
||||
/* 初始化popup的内容 */
|
||||
var headHtml = [], xMax = 0, yMax = 0,
|
||||
$tabContent = me.root().find('.edui-tab-content');
|
||||
$.each(formula, function (k, v) {
|
||||
var contentHtml = [];
|
||||
$.each(v, function (i, f) {
|
||||
contentHtml.push('<li class="edui-formula-latex-item" data-latex="' + f + '" style="background-position:-' + (xMax * 30) + 'px -' + (yMax * 30) + 'px"></li>');
|
||||
if (++xMax >=8) {
|
||||
++yMax; xMax = 0;
|
||||
}
|
||||
});
|
||||
yMax++; xMax = 0;
|
||||
$tabContent.append('<div class="edui-tab-pane"><ul>' + contentHtml.join('') + '</ul>');
|
||||
headHtml.push('<li class="edui-tab-item"><a href="javascript:void(0);" class="edui-tab-text">' + lang['lang_tab_' + k] + '</a></li>');
|
||||
});
|
||||
headHtml.push('<li class="edui-formula-clearboth"></li>');
|
||||
$root.find('.edui-tab-nav').html(headHtml.join(''));
|
||||
$root.find('.edui-tab-content').append('<div class="edui-formula-clearboth"></div>');
|
||||
|
||||
/* 选中第一个tab */
|
||||
me.switchTab(0);
|
||||
},
|
||||
initEvent: function () {
|
||||
var me = this;
|
||||
|
||||
//防止点击过后关闭popup
|
||||
me.root().on('click', function (e) {
|
||||
return false;
|
||||
});
|
||||
|
||||
//点击tab切换菜单
|
||||
me.root().find('.edui-tab-nav').delegate('.edui-tab-item', 'click', function (evt) {
|
||||
me.switchTab(this);
|
||||
return false;
|
||||
});
|
||||
|
||||
//点击选中公式
|
||||
me.root().find('.edui-tab-pane').delegate('.edui-formula-latex-item', 'click', function (evt) {
|
||||
var $item = $(this),
|
||||
latex = $item.attr('data-latex') || '';
|
||||
|
||||
if (latex) {
|
||||
me.insertLatex(latex.replace("{/}", "\\"));
|
||||
}
|
||||
me.$widget.edui().hide();
|
||||
return false;
|
||||
});
|
||||
},
|
||||
switchTab:function(index){
|
||||
var me = this,
|
||||
$root = me.root(),
|
||||
index = $.isNumeric(index) ? index:$.inArray(index, $root.find('.edui-tab-nav .edui-tab-item'));
|
||||
|
||||
$root.find('.edui-tab-nav .edui-tab-item').removeClass('edui-active').eq(index).addClass('edui-active');
|
||||
$root.find('.edui-tab-content .edui-tab-pane').removeClass('edui-active').eq(index).addClass('edui-active');
|
||||
|
||||
/* 自动长高 */
|
||||
me.autoHeight(0);
|
||||
},
|
||||
autoHeight: function () {
|
||||
this.$widget.height(this.root() + 2);
|
||||
},
|
||||
insertLatex: function (latex) {
|
||||
editor.execCommand('formula', latex );
|
||||
},
|
||||
width: 350,
|
||||
height: 400
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
BIN
public/static/libs/umeditor/dialogs/formula/images/formula.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
42
public/static/libs/umeditor/dialogs/image/image.css
Normal file
@@ -0,0 +1,42 @@
|
||||
.edui-dialog-image .edui-image-wrapper{font-size: 12px;margin: 15px;}
|
||||
|
||||
/*upload*/
|
||||
.edui-dialog-image .edui-image-upload1{position: absolute;top:50%;left:50%;width:44px;height:38px;margin-top:-19px; margin-left: -22px;}
|
||||
.edui-dialog-image .edui-image-upload2{position:relative;float:left;width:120px;height:120px;margin:5px 0 0 5px;}
|
||||
|
||||
.edui-dialog-image .edui-image-form{position: absolute;left: 0px;top: 0px;width: 100%;height: 100%;opacity: 0;cursor: pointer;}
|
||||
.edui-dialog-image .edui-image-form .edui-image-file{width: 100%;height:100%;filter: alpha(opacity=0)}
|
||||
|
||||
.edui-dialog-image .edui-image-upload1 .edui-image-icon{display: inline-block;width:44px;height:38px;background-image: url('images/upload1.png')}
|
||||
.edui-dialog-image .edui-image-upload1 .edui-image-icon.hover{background-position: -50px 0;}
|
||||
.edui-dialog-image .edui-image-upload2 .edui-image-icon{display: inline-block;width:120px;height:120px;background-image: url('images/upload2.png')}
|
||||
|
||||
.edui-dialog-image .edui-image-dragTip{position: absolute;display:none;top:50%;left:50%;margin-top:30px;margin-left: -60px;
|
||||
color: #222;font-size:14px;text-shadow: 0px 2px 3px #555;}
|
||||
|
||||
.edui-dialog-image .edui-image-content{height:330px;width:100%;position: relative;}
|
||||
|
||||
.edui-dialog-image .edui-image-mask{display: none;position: absolute;top:0;left:0;width: 100%; height: 100%;background-color:#fff;
|
||||
text-align: center;line-height:300px;color:#000;font-size:14px;font-weight:bold;opacity: 0.6;filter: alpha(opacity=60);}
|
||||
.edui-dialog-image .edui-image-mask.edui-active{display: block;}
|
||||
|
||||
/*network*/
|
||||
.edui-dialog-image .edui-image-searchBar{margin: 10px;}
|
||||
.edui-dialog-image .edui-image-searchBar .edui-image-searchTxt{display: inline-block !important;*display: inline !important;*zoom:1;width:400px; border: 1px solid #c5d2ff; height: 20px; line-height: 18px; font-size: 14px; padding: 3px; margin: 0;outline:0;}
|
||||
.edui-dialog-image .edui-image-searchBar .edui-image-searchAdd{display: inline-block !important;*display: inline !important;*zoom:1;
|
||||
width:60px; text-align:center;height: 25px;text-align: center;line-height: 25px;
|
||||
background-color: #ffffff;padding: 0; border: 1px solid #ababab;margin-left: 20px;cursor: pointer;
|
||||
}
|
||||
.edui-dialog-image .edui-image-searchBar .edui-image-searchAdd.hover{
|
||||
background-color: #d5e1f2;
|
||||
padding: 0;
|
||||
border: 1px solid #a3bde3;
|
||||
}
|
||||
.edui-dialog-image .edui-image-searchRes{height:280px;overflow:auto;}
|
||||
|
||||
|
||||
/*common*/
|
||||
.edui-dialog-image .edui-image-item{position:relative;float:left;width:120px;height:120px;border: 1px solid #CCC;cursor: default;margin: 5px 0 0 5px;}
|
||||
.edui-dialog-image .edui-image-item .edui-image-pic{position: absolute;left:-9999px;}
|
||||
.edui-dialog-image .edui-image-item .edui-image-close{position:absolute;right:0;background: url('images/close.png');width:17px;height:17px;cursor:pointer;z-index:1}
|
||||
.edui-dialog-image .edui-image-item.hover .edui-image-close{display: block;}
|
||||
445
public/static/libs/umeditor/dialogs/image/image.js
Normal file
@@ -0,0 +1,445 @@
|
||||
(function () {
|
||||
|
||||
var utils = UM.utils,
|
||||
browser = UM.browser,
|
||||
Base = {
|
||||
checkURL: function (url) {
|
||||
if(!url) return false;
|
||||
url = utils.trim(url);
|
||||
if (url.length <= 0) {
|
||||
return false;
|
||||
}
|
||||
if (url.search(/http:\/\/|https:\/\//) !== 0) {
|
||||
url += 'http://';
|
||||
}
|
||||
|
||||
url=url.replace(/\?[\s\S]*$/,"");
|
||||
|
||||
if (!/(.gif|.jpg|.jpeg|.png)$/i.test(url)) {
|
||||
return false;
|
||||
}
|
||||
return url;
|
||||
},
|
||||
getAllPic: function (sel, $w, editor) {
|
||||
var me = this,
|
||||
arr = [],
|
||||
$imgs = $(sel, $w);
|
||||
|
||||
$.each($imgs, function (index, node) {
|
||||
$(node).removeAttr("width").removeAttr("height");
|
||||
|
||||
// if (node.width > editor.options.initialFrameWidth) {
|
||||
// me.scale(node, editor.options.initialFrameWidth -
|
||||
// parseInt($(editor.body).css("padding-left")) -
|
||||
// parseInt($(editor.body).css("padding-right")));
|
||||
// }
|
||||
|
||||
return arr.push({
|
||||
_src: node.src,
|
||||
src: node.src
|
||||
});
|
||||
});
|
||||
|
||||
return arr;
|
||||
},
|
||||
scale: function (img, max, oWidth, oHeight) {
|
||||
var width = 0, height = 0, percent, ow = img.width || oWidth, oh = img.height || oHeight;
|
||||
if (ow > max || oh > max) {
|
||||
if (ow >= oh) {
|
||||
if (width = ow - max) {
|
||||
percent = (width / ow).toFixed(2);
|
||||
img.height = oh - oh * percent;
|
||||
img.width = max;
|
||||
}
|
||||
} else {
|
||||
if (height = oh - max) {
|
||||
percent = (height / oh).toFixed(2);
|
||||
img.width = ow - ow * percent;
|
||||
img.height = max;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
close: function ($img) {
|
||||
|
||||
$img.css({
|
||||
top: ($img.parent().height() - $img.height()) / 2,
|
||||
left: ($img.parent().width()-$img.width())/2
|
||||
}).prev().on("click",function () {
|
||||
|
||||
if ( $(this).parent().remove().hasClass("edui-image-upload-item") ) {
|
||||
//显示图片计数-1
|
||||
Upload.showCount--;
|
||||
Upload.updateView();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return this;
|
||||
},
|
||||
createImgBase64: function (img, file, $w) {
|
||||
if (browser.webkit) {
|
||||
//Chrome8+
|
||||
img.src = window.webkitURL.createObjectURL(file);
|
||||
} else if (browser.gecko) {
|
||||
//FF4+
|
||||
img.src = window.URL.createObjectURL(file);
|
||||
} else {
|
||||
//实例化file reader对象
|
||||
var reader = new FileReader();
|
||||
reader.onload = function (e) {
|
||||
img.src = this.result;
|
||||
$w.append(img);
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
},
|
||||
callback: function (editor, $w, url, state) {
|
||||
|
||||
if (state == "SUCCESS") {
|
||||
//显示图片计数+1
|
||||
Upload.showCount++;
|
||||
var $img = $("<img src='" + editor.options.imagePath + url + "' class='edui-image-pic' />"),
|
||||
$item = $("<div class='edui-image-item edui-image-upload-item'><div class='edui-image-close'></div></div>").append($img);
|
||||
|
||||
if ($(".edui-image-upload2", $w).length < 1) {
|
||||
$(".edui-image-content", $w).append($item);
|
||||
|
||||
Upload.render(".edui-image-content", 2)
|
||||
.config(".edui-image-upload2");
|
||||
} else {
|
||||
$(".edui-image-upload2", $w).before($item).show();
|
||||
}
|
||||
|
||||
$img.on("load", function () {
|
||||
Base.scale(this, 120);
|
||||
Base.close($(this));
|
||||
$(".edui-image-content", $w).focus();
|
||||
});
|
||||
|
||||
} else {
|
||||
currentDialog.showTip( state );
|
||||
window.setTimeout( function () {
|
||||
|
||||
currentDialog.hideTip();
|
||||
|
||||
}, 3000 );
|
||||
}
|
||||
|
||||
Upload.toggleMask();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* 本地上传
|
||||
* */
|
||||
var Upload = {
|
||||
showCount: 0,
|
||||
uploadTpl: '<div class="edui-image-upload%%">' +
|
||||
'<span class="edui-image-icon"></span>' +
|
||||
'<form class="edui-image-form" method="post" enctype="multipart/form-data" target="up">' +
|
||||
'<input style=\"filter: alpha(opacity=0);\" class="edui-image-file" type="file" hidefocus name="upfile" accept="image/gif,image/jpeg,image/png,image/jpg,image/bmp"/>' +
|
||||
'</form>' +
|
||||
|
||||
'</div>',
|
||||
init: function (editor, $w) {
|
||||
var me = this;
|
||||
|
||||
me.editor = editor;
|
||||
me.dialog = $w;
|
||||
me.render(".edui-image-local", 1);
|
||||
me.config(".edui-image-upload1");
|
||||
me.submit();
|
||||
me.drag();
|
||||
|
||||
$(".edui-image-upload1").hover(function () {
|
||||
$(".edui-image-icon", this).toggleClass("hover");
|
||||
});
|
||||
|
||||
if (!(UM.browser.ie && UM.browser.version <= 9)) {
|
||||
$(".edui-image-dragTip", me.dialog).css("display", "block");
|
||||
}
|
||||
|
||||
|
||||
return me;
|
||||
},
|
||||
render: function (sel, t) {
|
||||
var me = this;
|
||||
|
||||
$(sel, me.dialog).append($(me.uploadTpl.replace(/%%/g, t)));
|
||||
|
||||
return me;
|
||||
},
|
||||
config: function (sel) {
|
||||
var me = this,
|
||||
url=me.editor.options.imageUrl;
|
||||
|
||||
url=url + (url.indexOf("?") == -1 ? "?" : "&") + "editorid="+me.editor.id;//初始form提交地址;
|
||||
|
||||
$("form", $(sel, me.dialog)).attr("action", url);
|
||||
|
||||
return me;
|
||||
},
|
||||
uploadComplete: function(r){
|
||||
var me = this;
|
||||
try{
|
||||
var json = eval('('+r+')');
|
||||
Base.callback(me.editor, me.dialog, json.url, json.state);
|
||||
}catch (e){
|
||||
var lang = me.editor.getLang('image');
|
||||
Base.callback(me.editor, me.dialog, '', (lang && lang.uploadError) || 'Error!');
|
||||
}
|
||||
},
|
||||
submit: function (callback) {
|
||||
|
||||
var me = this,
|
||||
input = $( '<input style="filter: alpha(opacity=0);" class="edui-image-file" type="file" hidefocus="" name="upfile" accept="image/gif,image/jpeg,image/png,image/jpg,image/bmp">'),
|
||||
input = input[0];
|
||||
|
||||
$(me.dialog).delegate( ".edui-image-file", "change", function ( e ) {
|
||||
|
||||
if ( !this.parentNode ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$('<iframe name="up" style="display: none"></iframe>').insertBefore(me.dialog).on('load', function(){
|
||||
var r = this.contentWindow.document.body.innerHTML;
|
||||
if(r == '')return;
|
||||
me.uploadComplete(r);
|
||||
$(this).unbind('load');
|
||||
$(this).remove();
|
||||
|
||||
});
|
||||
|
||||
$(this).parent()[0].submit();
|
||||
Upload.updateInput( input );
|
||||
me.toggleMask("Loading....");
|
||||
callback && callback();
|
||||
|
||||
});
|
||||
|
||||
return me;
|
||||
},
|
||||
//更新input
|
||||
updateInput: function ( inputField ) {
|
||||
|
||||
$( ".edui-image-file", this.dialog ).each( function ( index, ele ) {
|
||||
|
||||
ele.parentNode.replaceChild( inputField.cloneNode( true ), ele );
|
||||
|
||||
} );
|
||||
|
||||
},
|
||||
//更新上传框
|
||||
updateView: function () {
|
||||
|
||||
if ( Upload.showCount !== 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$(".edui-image-upload2", this.dialog).hide();
|
||||
$(".edui-image-dragTip", this.dialog).show();
|
||||
$(".edui-image-upload1", this.dialog).show();
|
||||
|
||||
},
|
||||
drag: function () {
|
||||
var me = this;
|
||||
//做拽上传的支持
|
||||
if (!UM.browser.ie9below) {
|
||||
me.dialog.find('.edui-image-content').on('drop',function (e) {
|
||||
|
||||
//获取文件列表
|
||||
var fileList = e.originalEvent.dataTransfer.files;
|
||||
var img = document.createElement('img');
|
||||
var hasImg = false;
|
||||
$.each(fileList, function (i, f) {
|
||||
if (/^image/.test(f.type)) {
|
||||
//创建图片的base64
|
||||
Base.createImgBase64(img, f, me.dialog);
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("post", me.editor.getOpt('imageUrl') + "?type=ajax", true);
|
||||
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
||||
|
||||
//模拟数据
|
||||
var fd = new FormData();
|
||||
fd.append(me.editor.getOpt('imageFieldName'), f);
|
||||
|
||||
xhr.send(fd);
|
||||
xhr.addEventListener('load', function (e) {
|
||||
var r = e.target.response, json;
|
||||
me.uploadComplete(r);
|
||||
if (i == fileList.length - 1) {
|
||||
$(img).remove()
|
||||
}
|
||||
});
|
||||
hasImg = true;
|
||||
}
|
||||
});
|
||||
if (hasImg) {
|
||||
e.preventDefault();
|
||||
me.toggleMask("Loading....");
|
||||
}
|
||||
|
||||
}).on('dragover', function (e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
},
|
||||
toggleMask: function (html) {
|
||||
var me = this;
|
||||
|
||||
var $mask = $(".edui-image-mask", me.dialog);
|
||||
if (html) {
|
||||
if (!(UM.browser.ie && UM.browser.version <= 9)) {
|
||||
$(".edui-image-dragTip", me.dialog).css( "display", "none" );
|
||||
}
|
||||
$(".edui-image-upload1", me.dialog).css( "display", "none" );
|
||||
$mask.addClass("edui-active").html(html);
|
||||
} else {
|
||||
|
||||
$mask.removeClass("edui-active").html();
|
||||
|
||||
if ( Upload.showCount > 0 ) {
|
||||
return me;
|
||||
}
|
||||
|
||||
if (!(UM.browser.ie && UM.browser.version <= 9) ){
|
||||
$(".edui-image-dragTip", me.dialog).css("display", "block");
|
||||
}
|
||||
$(".edui-image-upload1", me.dialog).css( "display", "block" );
|
||||
}
|
||||
|
||||
return me;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* 网络图片
|
||||
* */
|
||||
var NetWork = {
|
||||
init: function (editor, $w) {
|
||||
var me = this;
|
||||
|
||||
me.editor = editor;
|
||||
me.dialog = $w;
|
||||
|
||||
me.initEvt();
|
||||
},
|
||||
initEvt: function () {
|
||||
var me = this,
|
||||
url,
|
||||
$ele = $(".edui-image-searchTxt", me.dialog);
|
||||
|
||||
$(".edui-image-searchAdd", me.dialog).on("click", function () {
|
||||
url = Base.checkURL($ele.val());
|
||||
|
||||
if (url) {
|
||||
|
||||
$("<img src='" + url + "' class='edui-image-pic' />").on("load", function () {
|
||||
|
||||
|
||||
|
||||
var $item = $("<div class='edui-image-item'><div class='edui-image-close'></div></div>").append(this);
|
||||
|
||||
$(".edui-image-searchRes", me.dialog).append($item);
|
||||
|
||||
Base.scale(this, 120);
|
||||
|
||||
$item.width($(this).width());
|
||||
|
||||
Base.close($(this));
|
||||
|
||||
$ele.val("");
|
||||
});
|
||||
}
|
||||
})
|
||||
.hover(function () {
|
||||
$(this).toggleClass("hover");
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var $tab = null,
|
||||
currentDialog = null;
|
||||
|
||||
UM.registerWidget('image', {
|
||||
tpl: "<link rel=\"stylesheet\" type=\"text/css\" href=\"<%=image_url%>image.css\">" +
|
||||
"<div class=\"edui-image-wrapper\">" +
|
||||
"<ul class=\"edui-tab-nav\">" +
|
||||
"<li class=\"edui-tab-item edui-active\"><a data-context=\".edui-image-local\" class=\"edui-tab-text\"><%=lang_tab_local%></a></li>" +
|
||||
"<li class=\"edui-tab-item\"><a data-context=\".edui-image-JimgSearch\" class=\"edui-tab-text\"><%=lang_tab_imgSearch%></a></li>" +
|
||||
"</ul>" +
|
||||
"<div class=\"edui-tab-content\">" +
|
||||
"<div class=\"edui-image-local edui-tab-pane edui-active\">" +
|
||||
"<div class=\"edui-image-content\"></div>" +
|
||||
"<div class=\"edui-image-mask\"></div>" +
|
||||
"<div class=\"edui-image-dragTip\"><%=lang_input_dragTip%></div>" +
|
||||
"</div>" +
|
||||
"<div class=\"edui-image-JimgSearch edui-tab-pane\">" +
|
||||
"<div class=\"edui-image-searchBar\">" +
|
||||
"<table><tr><td><input class=\"edui-image-searchTxt\" type=\"text\"></td>" +
|
||||
"<td><div class=\"edui-image-searchAdd\"><%=lang_btn_add%></div></td></tr></table>" +
|
||||
"</div>" +
|
||||
"<div class=\"edui-image-searchRes\"></div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>",
|
||||
initContent: function (editor, $dialog) {
|
||||
var lang = editor.getLang('image')["static"],
|
||||
opt = $.extend({}, lang, {
|
||||
image_url: UMEDITOR_CONFIG.UMEDITOR_HOME_URL + 'dialogs/image/'
|
||||
});
|
||||
|
||||
Upload.showCount = 0;
|
||||
|
||||
if (lang) {
|
||||
var html = $.parseTmpl(this.tpl, opt);
|
||||
}
|
||||
|
||||
currentDialog = $dialog.edui();
|
||||
|
||||
this.root().html(html);
|
||||
|
||||
},
|
||||
initEvent: function (editor, $w) {
|
||||
$tab = $.eduitab({selector: ".edui-image-wrapper"})
|
||||
.edui().on("beforeshow", function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
Upload.init(editor, $w);
|
||||
|
||||
NetWork.init(editor, $w);
|
||||
},
|
||||
buttons: {
|
||||
'ok': {
|
||||
exec: function (editor, $w) {
|
||||
var sel = "",
|
||||
index = $tab.activate();
|
||||
|
||||
if (index == 0) {
|
||||
sel = ".edui-image-content .edui-image-pic";
|
||||
} else if (index == 1) {
|
||||
sel = ".edui-image-searchRes .edui-image-pic";
|
||||
}
|
||||
|
||||
var list = Base.getAllPic(sel, $w, editor);
|
||||
|
||||
if (index != -1) {
|
||||
editor.execCommand('insertimage', list);
|
||||
}
|
||||
}
|
||||
},
|
||||
'cancel': {}
|
||||
},
|
||||
width: 700,
|
||||
height: 408
|
||||
}, function (editor, $w, url, state) {
|
||||
Base.callback(editor, $w, url, state)
|
||||
})
|
||||
})();
|
||||
|
||||
BIN
public/static/libs/umeditor/dialogs/image/images/close.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
public/static/libs/umeditor/dialogs/image/images/upload1.png
Normal file
|
After Width: | Height: | Size: 848 B |
BIN
public/static/libs/umeditor/dialogs/image/images/upload2.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
73
public/static/libs/umeditor/dialogs/link/link.js
Normal file
@@ -0,0 +1,73 @@
|
||||
(function(){
|
||||
var utils = UM.utils;
|
||||
function hrefStartWith(href, arr) {
|
||||
href = href.replace(/^\s+|\s+$/g, '');
|
||||
for (var i = 0, ai; ai = arr[i++];) {
|
||||
if (href.indexOf(ai) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
UM.registerWidget('link', {
|
||||
tpl: "<style type=\"text/css\">" +
|
||||
".edui-dialog-link .edui-link-table{font-size: 12px;margin: 10px;line-height: 30px}" +
|
||||
".edui-dialog-link .edui-link-txt{width:300px;height:21px;line-height:21px;border:1px solid #d7d7d7;}" +
|
||||
"</style>" +
|
||||
"<table class=\"edui-link-table\">" +
|
||||
"<tr>" +
|
||||
"<td><label for=\"href\"><%=lang_input_url%></label></td>" +
|
||||
"<td><input class=\"edui-link-txt\" id=\"edui-link-Jhref\" type=\"text\" /></td>" +
|
||||
"</tr>" +
|
||||
"<tr>" +
|
||||
"<td><label for=\"title\"><%=lang_input_title%></label></td>" +
|
||||
"<td><input class=\"edui-link-txt\" id=\"edui-link-Jtitle\" type=\"text\"/></td>" +
|
||||
"</tr>" +
|
||||
"<tr>" +
|
||||
"<td colspan=\"2\">" +
|
||||
"<label for=\"target\"><%=lang_input_target%></label>" +
|
||||
"<input id=\"edui-link-Jtarget\" type=\"checkbox\"/>" +
|
||||
"</td>" +
|
||||
"</tr>" +
|
||||
// "<tr>" +
|
||||
// "<td colspan=\"2\" id=\"edui-link-Jmsg\"></td>" +
|
||||
// "</tr>" +
|
||||
"</table>",
|
||||
initContent: function (editor) {
|
||||
var lang = editor.getLang('link');
|
||||
if (lang) {
|
||||
var html = $.parseTmpl(this.tpl, lang.static);
|
||||
}
|
||||
this.root().html(html);
|
||||
},
|
||||
initEvent: function (editor, $w) {
|
||||
var link = editor.queryCommandValue('link');
|
||||
if(link){
|
||||
$('#edui-link-Jhref',$w).val(utils.html($(link).attr('href')));
|
||||
$('#edui-link-Jtitle',$w).val($(link).attr('title'));
|
||||
$(link).attr('target') == '_blank' && $('#edui-link-Jtarget').attr('checked',true)
|
||||
}
|
||||
$('#edui-link-Jhref',$w).focus();
|
||||
},
|
||||
buttons: {
|
||||
'ok': {
|
||||
exec: function (editor, $w) {
|
||||
var href = $('#edui-link-Jhref').val().replace(/^\s+|\s+$/g, '');
|
||||
|
||||
if (href) {
|
||||
editor.execCommand('link', {
|
||||
'href': href,
|
||||
'target': $("#edui-link-Jtarget:checked").length ? "_blank" : '_self',
|
||||
'title': $("#edui-link-Jtitle").val().replace(/^\s+|\s+$/g, ''),
|
||||
'_href': href
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
'cancel':{}
|
||||
},
|
||||
width: 400
|
||||
})
|
||||
})();
|
||||
|
||||
148
public/static/libs/umeditor/dialogs/map/map.html
Normal file
@@ -0,0 +1,148 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="keywords" content="百度地图,百度地图API,百度地图自定义工具,百度地图所见即所得工具"/>
|
||||
<meta name="description" content="百度地图API自定义地图,帮助用户在可视化操作下生成百度地图"/>
|
||||
<title>百度地图API自定义地图</title>
|
||||
<!--引用百度地图API-->
|
||||
<style type="text/css">
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript" src="http://api.map.baidu.com/api?key=&v=2.0&ak=6b6c1a67eaa7db1ca6d6da28e590e343&services=true"></script>
|
||||
</head>
|
||||
|
||||
<body onload="initMap();">
|
||||
<!--百度地图容器-->
|
||||
<div style="width:697px;height:550px;border:#ccc solid 1px;" id="dituContent"></div>
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
function getParam(name) {
|
||||
return location.href.match(new RegExp('[?#&]' + name + '=([^?#&]+)', 'i')) ? RegExp.$1 : '';
|
||||
}
|
||||
var map, marker;
|
||||
var centerParam = getParam('center');
|
||||
var zoomParam = getParam('zoom');
|
||||
var widthParam = getParam('width');
|
||||
var heightParam = getParam('height');
|
||||
var markersParam = getParam('markers');
|
||||
var markerStylesParam = getParam('markerStyles');
|
||||
var iframe = getSelfIframe();
|
||||
var UM = parent.UM;
|
||||
var editor = getEditor();
|
||||
|
||||
//创建和初始化地图函数:
|
||||
function initMap() {
|
||||
// [FF]切换模式后报错
|
||||
if (!window.BMap) {
|
||||
return;
|
||||
}
|
||||
var dituContent = document.getElementById('dituContent');
|
||||
dituContent.style.width = widthParam + 'px';
|
||||
dituContent.style.height = heightParam + 'px';
|
||||
|
||||
createMap();//创建地图
|
||||
setMapEvent();//设置地图事件
|
||||
addMapControl();//向地图添加控件
|
||||
|
||||
// 创建标注
|
||||
var markersArr = markersParam.split(',');
|
||||
var point = new BMap.Point(markersArr[0], markersArr[1]);
|
||||
marker = new BMap.Marker(point);
|
||||
marker.enableDragging();
|
||||
map.addOverlay(marker); // 将标注添加到地图中
|
||||
|
||||
if(iframe && UM && editor) { //在编辑状态下
|
||||
setMapListener();//地图改变修改外层的iframe标签src属性
|
||||
} else {
|
||||
document.focus();
|
||||
}
|
||||
}
|
||||
|
||||
//创建地图函数:
|
||||
function createMap() {
|
||||
map = new BMap.Map("dituContent");//在百度地图容器中创建一个地图
|
||||
var centerArr = centerParam.split(',');
|
||||
var point = new BMap.Point(parseFloat(centerArr[0]), parseFloat(centerArr[1]));//定义一个中心点坐标
|
||||
map.centerAndZoom(point, parseInt(zoomParam));//设定地图的中心点和坐标并将地图显示在地图容器中
|
||||
}
|
||||
|
||||
//地图事件设置函数:
|
||||
function setMapEvent() {
|
||||
map.enableDragging();//启用地图拖拽事件,默认启用(可不写)
|
||||
map.enableScrollWheelZoom();//启用地图滚轮放大缩小
|
||||
map.enableDoubleClickZoom();//启用鼠标双击放大,默认启用(可不写)
|
||||
map.enableKeyboard();//启用键盘上下左右键移动地图
|
||||
}
|
||||
|
||||
//地图控件添加函数:
|
||||
function addMapControl() {
|
||||
//向地图中添加缩放控件
|
||||
var ctrl_nav = new BMap.NavigationControl({anchor: BMAP_ANCHOR_TOP_LEFT, type: BMAP_NAVIGATION_CONTROL_LARGE});
|
||||
map.addControl(ctrl_nav);
|
||||
//向地图中添加缩略图控件
|
||||
var ctrl_ove = new BMap.OverviewMapControl({anchor: BMAP_ANCHOR_BOTTOM_RIGHT, isOpen: 1});
|
||||
map.addControl(ctrl_ove);
|
||||
//向地图中添加比例尺控件
|
||||
var ctrl_sca = new BMap.ScaleControl({anchor: BMAP_ANCHOR_BOTTOM_LEFT});
|
||||
map.addControl(ctrl_sca);
|
||||
}
|
||||
|
||||
function setMapListener() {
|
||||
var timer;
|
||||
|
||||
map.addEventListener('moveend', mapListenerHandler);
|
||||
map.addEventListener('zoomend', mapListenerHandler);
|
||||
marker.addEventListener('dragend', mapListenerHandler);
|
||||
|
||||
function mapListenerHandler() {
|
||||
var zoom = map.getZoom(),
|
||||
center = map.getCenter(),
|
||||
marker = window.marker.P;
|
||||
|
||||
iframe.src = iframe.src.
|
||||
replace(new RegExp('([?#&])center=([^?#&]+)', 'i'), '$1center=' + center.lng + ',' + center.lat).
|
||||
replace(new RegExp('([?#&])markers=([^?#&]+)', 'i'), '$1markers=' + marker.lng + ',' + marker.lat).
|
||||
replace(new RegExp('([?#&])zoom=([^?#&]+)', 'i'), '$1zoom=' + zoom);
|
||||
editor.fireEvent('saveScene');
|
||||
saveScene(editor);
|
||||
}
|
||||
|
||||
function saveScene(){
|
||||
if(!timer) {
|
||||
timer = setTimeout(function(){
|
||||
editor.fireEvent('savescene');
|
||||
editor.fireEvent('contentchange');
|
||||
timer = null;
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getSelfIframe(){
|
||||
var iframes = parent.document.getElementsByTagName('iframe');
|
||||
for (var key in iframes) {
|
||||
if (iframes[key].contentWindow == window) {
|
||||
return iframes[key];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function getEditor(){
|
||||
var parentNode = iframe.parentNode;
|
||||
while (parentNode && parentNode.tagName && parentNode.tagName.toLowerCase() != 'body') {
|
||||
if (parentNode.className && parentNode.className.indexOf('edui-body-container')!=-1) {
|
||||
return UM.getEditor(parentNode.id);
|
||||
}
|
||||
parentNode = parentNode.parentNode;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
</script>
|
||||
</html>
|
||||
263
public/static/libs/umeditor/dialogs/map/map.js
Normal file
@@ -0,0 +1,263 @@
|
||||
(function () {
|
||||
|
||||
var widgetName = 'map';
|
||||
|
||||
UM.registerWidget(widgetName, {
|
||||
|
||||
tpl: "<style type=\"text/css\">" +
|
||||
".edui-dialog-map .edui-map-content{width:530px; height: 350px;margin: 10px auto;}" +
|
||||
".edui-dialog-map .edui-map-content table{width: 100%}" +
|
||||
".edui-dialog-map .edui-map-content table td{vertical-align: middle;}" +
|
||||
".edui-dialog-map .edui-map-button { border: 1px solid #ccc; float: left; cursor: default; height: 23px; width: 70px; cursor: pointer; margin: 0; font-size: 12px; line-height: 24px; text-align: center; }" +
|
||||
".edui-dialog-map .edui-map-button:hover {background:#eee;}" +
|
||||
".edui-dialog-map .edui-map-city,.edui-dialog-map .edui-map-address{height:21px;background: #FFF;border:1px solid #d7d7d7; line-height: 21px;}" +
|
||||
".edui-dialog-map .edui-map-city{width:90px}" +
|
||||
".edui-dialog-map .edui-map-address{width:150px}" +
|
||||
".edui-dialog-map .edui-map-dynamic-label span{vertical-align:middle;margin: 3px 0px 3px 3px;}" +
|
||||
".edui-dialog-map .edui-map-dynamic-label input{vertical-align:middle;margin: 3px;}" +
|
||||
"</style>" +
|
||||
"<div class=\"edui-map-content\">" +
|
||||
"<table>" +
|
||||
"<tr>" +
|
||||
"<td><%=lang_city%>:</td>" +
|
||||
"<td><input class=\"edui-map-city\" type=\"text\" value=\"<%=city.value%>\"/></td>" +
|
||||
"<td><%=lang_address%>:</td>" +
|
||||
"<td><input class=\"edui-map-address\" type=\"text\" value=\"\" /></td>" +
|
||||
"<td><a class=\"edui-map-button\"><%=lang_search%></a></td>" +
|
||||
"<td><label class=\"edui-map-dynamic-label\"><input class=\"edui-map-dynamic\" type=\"checkbox\" name=\"edui-map-dynamic\" /><span><%=lang_dynamicmap%></span></label></td>"+
|
||||
"</tr>" +
|
||||
"</table>" +
|
||||
"<div style=\"width:100%;height:340px;margin:5px auto;border:1px solid gray\" class=\"edui-map-container\"></div>" +
|
||||
"</div>" +
|
||||
"<script class=\"edui-tpl-container\" type=\"text/plain\">" +
|
||||
"<!DOCTYPE html>" +
|
||||
"<html>" +
|
||||
"<head>" +
|
||||
"<title></title>" +
|
||||
"</head>" +
|
||||
"<body>" +
|
||||
"<scr_ipt>" +
|
||||
"window.onload = function(){" +
|
||||
"var scripts = document.scripts || document.getElementsByTagName(\"script\")," +
|
||||
"src = [];" +
|
||||
"for( var i = 1, len = scripts.length; i<len; i++ ) {" +
|
||||
"src.push( scripts[i].src );" +
|
||||
"}" +
|
||||
"parent.UM.getEditor(<<id>>).getWidgetData(\'map\').requestMapApi( src );" +
|
||||
"};" +
|
||||
"function mapReadyStateChange ( state ) { " +
|
||||
" if ( state === 'complete' || state === 'loaded' ) {" +
|
||||
" document.close(); " +
|
||||
" } }" +
|
||||
"</scr_ipt>" +
|
||||
"<scr_ipt onreadystatechange='mapReadyStateChange(this.readyState);' onload='mapReadyStateChange(\"loaded\");' src=\"http://api.map.baidu.com/api?v=2.0&ak=6b6c1a67eaa7db1ca6d6da28e590e343&services=true\"></scr_ipt>" +
|
||||
"</body>" +
|
||||
"</html>" +
|
||||
"</script>",
|
||||
initContent: function (editor, $widget) {
|
||||
|
||||
var me = this,
|
||||
lang = editor.getLang(widgetName),
|
||||
theme_url = editor.options.themePath + editor.options.theme;
|
||||
|
||||
if( me.inited ) {
|
||||
me.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
me.inited = true;
|
||||
|
||||
me.lang = lang;
|
||||
me.editor = editor;
|
||||
|
||||
me.root().html($.parseTmpl(me.tpl, $.extend({}, lang['static'], {
|
||||
'theme_url': theme_url
|
||||
})));
|
||||
|
||||
me.initRequestApi();
|
||||
|
||||
},
|
||||
/**
|
||||
* 初始化请求API
|
||||
*/
|
||||
initRequestApi: function () {
|
||||
|
||||
var $ifr = null;
|
||||
|
||||
//已经初始化过, 不用再次初始化
|
||||
if (window.BMap && window.BMap.Map) {
|
||||
this.initBaiduMap();
|
||||
} else {
|
||||
|
||||
$ifr = $('<iframe style="display: none;"></iframe>');
|
||||
$ifr.appendTo( this.root() );
|
||||
|
||||
$ifr = $ifr[ 0 ].contentWindow.document;
|
||||
|
||||
$ifr.open();
|
||||
$ifr.write( this.root().find(".edui-tpl-container").html().replace( /scr_ipt/g, 'script').replace('<<id>>',"'" + this.editor.id + "'") );
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
requestMapApi: function (src) {
|
||||
|
||||
var me = this;
|
||||
|
||||
if (src.length) {
|
||||
|
||||
var _src = src[0];
|
||||
|
||||
src = src.slice(1);
|
||||
|
||||
if (_src) {
|
||||
$.getScript(_src, function () {
|
||||
me.requestMapApi(src);
|
||||
});
|
||||
} else {
|
||||
me.requestMapApi(src);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
me.initBaiduMap();
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
initBaiduMap: function () {
|
||||
|
||||
var $root = this.root(),
|
||||
map = new BMap.Map($root.find(".edui-map-container")[0]),
|
||||
me = this,
|
||||
marker,
|
||||
point,
|
||||
imgcss,
|
||||
img = $(me.editor.selection.getRange().getClosedNode());
|
||||
|
||||
map.enableInertialDragging();
|
||||
map.enableScrollWheelZoom();
|
||||
map.enableContinuousZoom();
|
||||
|
||||
if (img.length && /api[.]map[.]baidu[.]com/ig.test(img.attr("src"))) {
|
||||
var url = img.attr("src"),
|
||||
centerPos = me.getPars(url, "center").split(","),
|
||||
markerPos = me.getPars(url, "markers").split(",");
|
||||
point = new BMap.Point(Number(centerPos[0]), Number(centerPos[1]));
|
||||
marker = new BMap.Marker(new BMap.Point(Number(markerPos[0]), Number(markerPos[1])));
|
||||
map.addControl(new BMap.NavigationControl());
|
||||
map.centerAndZoom(point, Number(me.getPars(url, "zoom")));
|
||||
imgcss = img.attr('style');
|
||||
} else {
|
||||
point = new BMap.Point(116.404, 39.915); // 创建点坐标
|
||||
marker = new BMap.Marker(point);
|
||||
map.addControl(new BMap.NavigationControl());
|
||||
map.centerAndZoom(point, 10); // 初始化地图,设置中心点坐标和地图级别。
|
||||
}
|
||||
marker.enableDragging();
|
||||
map.addOverlay(marker);
|
||||
|
||||
me.map = map;
|
||||
me.marker = marker;
|
||||
me.imgcss = imgcss;
|
||||
},
|
||||
doSearch: function () {
|
||||
var me = this,
|
||||
city = me.root().find('.edui-map-city').val(),
|
||||
address = me.root().find('.edui-map-address').val();
|
||||
|
||||
if (!city) {
|
||||
alert(me.lang.cityMsg);
|
||||
return;
|
||||
}
|
||||
var search = new BMap.LocalSearch(city, {
|
||||
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) {
|
||||
me.map.setViewport(points);
|
||||
} else {
|
||||
me.map.centerAndZoom(points[0], 13);
|
||||
}
|
||||
point = me.map.getCenter();
|
||||
me.marker.setPoint(point);
|
||||
} else {
|
||||
alert(me.lang.errorMsg);
|
||||
}
|
||||
}
|
||||
});
|
||||
search.search(address || city);
|
||||
},
|
||||
getPars: function (str, par) {
|
||||
var reg = new RegExp(par + "=((\\d+|[.,])*)", "g");
|
||||
return reg.exec(str)[1];
|
||||
},
|
||||
reset: function(){
|
||||
this.map && this.map.reset();
|
||||
},
|
||||
initEvent: function () {
|
||||
var me = this,
|
||||
$root = me.root();
|
||||
|
||||
$root.find('.edui-map-address').on('keydown', function (evt) {
|
||||
evt = evt || event;
|
||||
if (evt.keyCode == 13) {
|
||||
me.doSearch();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$root.find(".edui-map-button").on('click', function (evt) {
|
||||
me.doSearch();
|
||||
});
|
||||
|
||||
$root.find(".edui-map-address").focus();
|
||||
|
||||
$root.on( "mousewheel DOMMouseScroll", function ( e ) {
|
||||
return false;
|
||||
} );
|
||||
|
||||
},
|
||||
width: 580,
|
||||
height: 408,
|
||||
buttons: {
|
||||
ok: {
|
||||
exec: function (editor) {
|
||||
var widget = editor.getWidgetData(widgetName),
|
||||
center = widget.map.getCenter(),
|
||||
zoom = widget.map.getZoom(),
|
||||
size = widget.map.getSize(),
|
||||
point = widget.marker.P;
|
||||
|
||||
if (widget.root().find(".edui-map-dynamic")[0].checked) {
|
||||
var URL = editor.getOpt('UMEDITOR_HOME_URL'),
|
||||
url = [URL + (/\/$/.test(URL) ? '':'/') + "dialogs/map/map.html" +
|
||||
'#center=' + center.lng + ',' + center.lat,
|
||||
'&zoom=' + zoom,
|
||||
'&width=' + size.width,
|
||||
'&height=' + size.height,
|
||||
'&markers=' + point.lng + ',' + point.lat].join('');
|
||||
editor.execCommand('inserthtml', '<iframe class="ueditor_baidumap" src="' + url + '" frameborder="0" width="' + (size.width+4) + '" height="' + (size.height+4) + '"></iframe>');
|
||||
} else {
|
||||
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 + '"' + (widget.imgcss ? ' style="' + widget.imgcss + '"' : '') + '/>', true);
|
||||
}
|
||||
|
||||
widget.reset();
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
exec: function(editor){
|
||||
editor.getWidgetData(widgetName).reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
|
After Width: | Height: | Size: 12 KiB |
BIN
public/static/libs/umeditor/dialogs/video/images/left_focus.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
public/static/libs/umeditor/dialogs/video/images/none_focus.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
public/static/libs/umeditor/dialogs/video/images/right_focus.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
59
public/static/libs/umeditor/dialogs/video/video.css
Normal file
@@ -0,0 +1,59 @@
|
||||
@charset "utf-8";
|
||||
.edui-dialog-video .edui-video-wrapper{ width: 570px;_width:575px;margin: 10px auto; zoom:1;position: relative}
|
||||
.edui-dialog-video .edui-video-tabbody{height:335px;}
|
||||
.edui-dialog-video .edui-video-panel { position: absolute;width:100%; height:100%;background: #fff;}
|
||||
.edui-dialog-video .edui-video-panel table td{vertical-align: middle;}
|
||||
.edui-dialog-video #eduiVideoUrl {
|
||||
width: 470px;
|
||||
height: 21px;
|
||||
line-height: 21px;
|
||||
margin: 8px 5px;
|
||||
background: #FFF;
|
||||
border: 1px solid #d7d7d7;
|
||||
}
|
||||
.edui-dialog-video #eduiVideoSearchTxt{margin-left:15px;background: #FFF;width:200px;height:21px;line-height:21px;border: 1px solid #d7d7d7;}
|
||||
.edui-dialog-video #searchList{width: 570px;overflow: auto;zoom:1;height: 270px;}
|
||||
.edui-dialog-video #searchList div{float: left;width: 120px;height: 135px;margin: 5px 15px;}
|
||||
.edui-dialog-video #searchList img{margin: 2px 8px;cursor: pointer;border: 2px solid #fff} /*不用缩略图*/
|
||||
.edui-dialog-video #searchList p{margin-left: 10px;}
|
||||
.edui-dialog-video #eduiVideoType{
|
||||
width: 65px;
|
||||
height: 23px;
|
||||
line-height: 22px;
|
||||
border: 1px solid #d7d7d7;
|
||||
}
|
||||
.edui-dialog-video #eduiVideoSearchBtn,.edui-dialog-video #eduiVideoSearchReset{
|
||||
/*width: 80px;*/
|
||||
height: 25px;
|
||||
line-height: 25px;
|
||||
background: #eee;
|
||||
border: 1px solid #d7d7d7;
|
||||
cursor: pointer;
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.edui-dialog-video #eduiVideoPreview{width: 420px; margin-left: 10px; _margin-left:5px; height: 280px;background-color: #ddd;float: left}
|
||||
.edui-dialog-video #eduiVideoInfo {width: 120px;float: left;margin-left: 10px;_margin-left:7px;}
|
||||
.edui-dialog-video .edui-video-wrapper fieldset{
|
||||
border: 1px solid #ddd;
|
||||
padding-left: 5px;
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 5px;
|
||||
width: 115px;
|
||||
}
|
||||
.edui-dialog-video .edui-video-wrapper fieldset legend{font-weight: bold;}
|
||||
.edui-dialog-video .edui-video-wrapper fieldset p{line-height: 30px;}
|
||||
.edui-dialog-video .edui-video-wrapper fieldset input.edui-video-txt{
|
||||
width: 65px;
|
||||
height: 21px;
|
||||
line-height: 21px;
|
||||
margin: 8px 5px;
|
||||
background: #FFF;
|
||||
border: 1px solid #d7d7d7;
|
||||
}
|
||||
.edui-dialog-video .edui-video-wrapper label.edui-video-url{font-weight: bold;margin-left: 5px;color: #06c;}
|
||||
.edui-dialog-video #eduiVideoFloat div{cursor:pointer;opacity: 0.5;filter: alpha(opacity = 50);margin:9px;_margin:5px;width:38px;height:36px;float:left;}
|
||||
.edui-dialog-video #eduiVideoFloat .edui-video-focus{opacity: 1;filter: alpha(opacity = 100)}
|
||||
.edui-dialog-video .edui-video-wrapper span.edui-video-view{display: inline-block;width: 30px;float: right;cursor: pointer;color: blue}
|
||||
282
public/static/libs/umeditor/dialogs/video/video.js
Normal file
@@ -0,0 +1,282 @@
|
||||
|
||||
(function(){
|
||||
var domUtils = UM.dom.domUtils;
|
||||
var widgetName = 'video';
|
||||
|
||||
UM.registerWidget( widgetName,{
|
||||
|
||||
tpl: "<link rel=\"stylesheet\" type=\"text/css\" href=\"<%=video_url%>video.css\" />" +
|
||||
"<div class=\"edui-video-wrapper\">" +
|
||||
"<div id=\"eduiVideoTab\">" +
|
||||
"<div id=\"eduiVideoTabHeads\" class=\"edui-video-tabhead\">" +
|
||||
"<span tabSrc=\"video\" class=\"edui-video-focus\"><%=lang_tab_insertV%></span>" +
|
||||
"</div>" +
|
||||
"<div id=\"eduiVideoTabBodys\" class=\"edui-video-tabbody\">" +
|
||||
"<div id=\"eduiVideoPanel\" class=\"edui-video-panel\">" +
|
||||
"<table><tr><td><label for=\"eduiVideoUrl\" class=\"edui-video-url\"><%=lang_video_url%></label></td><td><input id=\"eduiVideoUrl\" type=\"text\"></td></tr></table>" +
|
||||
"<div id=\"eduiVideoPreview\"></div>" +
|
||||
"<div id=\"eduiVideoInfo\">" +
|
||||
"<fieldset>" +
|
||||
"<legend><%=lang_video_size%></legend>" +
|
||||
"<table>" +
|
||||
"<tr><td><label for=\"eduiVideoWidth\"><%=lang_videoW%></label></td><td><input class=\"edui-video-txt\" id=\"eduiVideoWidth\" type=\"text\"/></td></tr>" +
|
||||
"<tr><td><label for=\"eduiVideoHeight\"><%=lang_videoH%></label></td><td><input class=\"edui-video-txt\" id=\"eduiVideoHeight\" type=\"text\"/></td></tr>" +
|
||||
"</table>" +
|
||||
"</fieldset>" +
|
||||
"<fieldset>" +
|
||||
"<legend><%=lang_alignment%></legend>" +
|
||||
"<div id=\"eduiVideoFloat\"></div>" +
|
||||
"</fieldset>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>",
|
||||
initContent:function( editor, $widget ){
|
||||
|
||||
var me = this,
|
||||
lang = editor.getLang( widgetName),
|
||||
video_url = UMEDITOR_CONFIG.UMEDITOR_HOME_URL + 'dialogs/video/';
|
||||
|
||||
me.lang = lang;
|
||||
me.editor = editor;
|
||||
me.$widget = $widget;
|
||||
me.root().html( $.parseTmpl( me.tpl, $.extend( { video_url: video_url }, lang['static'] ) ) );
|
||||
|
||||
me.initController( lang );
|
||||
|
||||
},
|
||||
initEvent:function(){
|
||||
|
||||
var me = this,
|
||||
url = $("#eduiVideoUrl", me.$widget)[0];
|
||||
|
||||
if( 'oninput' in url ) {
|
||||
url.oninput = function(){
|
||||
me.createPreviewVideo( this.value );
|
||||
};
|
||||
} else {
|
||||
url.onpropertychange = function () {
|
||||
me.createPreviewVideo( this.value );
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
initController: function( lang ){
|
||||
|
||||
var me = this,
|
||||
img = me.editor.selection.getRange().getClosedNode(),
|
||||
url;
|
||||
|
||||
me.createAlignButton( ["eduiVideoFloat"] );
|
||||
|
||||
//编辑视频时初始化相关信息
|
||||
if(img && img.className == "edui-faked-video"){
|
||||
$("#eduiVideoUrl", me.$widget)[0].value = url = img.getAttribute("_url");
|
||||
$("#eduiVideoWidth", me.$widget)[0].value = img.width;
|
||||
$("#eduiVideoHeight", me.$widget)[0].value = img.height;
|
||||
var align = domUtils.getComputedStyle(img,"float"),
|
||||
parentAlign = domUtils.getComputedStyle(img.parentNode,"text-align");
|
||||
me.updateAlignButton(parentAlign==="center"?"center":align);
|
||||
}
|
||||
me.createPreviewVideo(url);
|
||||
|
||||
},
|
||||
/**
|
||||
* 根据url生成视频预览
|
||||
*/
|
||||
createPreviewVideo: function(url){
|
||||
|
||||
if ( !url )return;
|
||||
|
||||
var me = this,
|
||||
lang = me.lang,
|
||||
conUrl = me.convert_url(url);
|
||||
|
||||
if(!me.endWith(conUrl,[".swf",".flv",".wmv"])){
|
||||
$("#eduiVideoPreview", me.$widget).html( lang.urlError );
|
||||
return;
|
||||
}
|
||||
$("#eduiVideoPreview", me.$widget)[0].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>';
|
||||
|
||||
},
|
||||
/**
|
||||
* 将单个视频信息插入编辑器中
|
||||
*/
|
||||
insertSingle: function(){
|
||||
|
||||
var me = this,
|
||||
width = $("#eduiVideoWidth", me.$widget)[0],
|
||||
height = $("#eduiVideoHeight", me.$widget)[0],
|
||||
url=$('#eduiVideoUrl', me.$widget)[0].value,
|
||||
align = this.findFocus("eduiVideoFloat","name");
|
||||
|
||||
if(!url) return false;
|
||||
if ( !me.checkNum( [width, height] ) ) return false;
|
||||
this.editor.execCommand('insertvideo', {
|
||||
url: me.convert_url(url),
|
||||
width: width.value,
|
||||
height: height.value,
|
||||
align: align
|
||||
});
|
||||
|
||||
},
|
||||
/**
|
||||
* URL转换
|
||||
*/
|
||||
convert_url: function(url){
|
||||
if ( !url ) return '';
|
||||
var matches = url.match(/youtu.be\/(\w+)$/) ||
|
||||
url.match(/youtube\.com\/watch\?v=(\w+)/) ||
|
||||
url.match(/youtube.com\/v\/(\w+)/),
|
||||
youku = url.match(/youku\.com\/v_show\/id_(\w+)/),
|
||||
youkuPlay = /player\.youku\.com/ig.test(url);
|
||||
|
||||
if(youkuPlay){
|
||||
url = url.replace(/\?f=.*/, "");
|
||||
} else if (matches){
|
||||
url = "https://www.youtube.com/v/" + matches[1] + "?version=3&feature=player_embedded";
|
||||
}else if(youku){
|
||||
url = "http://player.youku.com/player.php/sid/"+youku[1]+"/v.swf"
|
||||
} else {
|
||||
url = url.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")
|
||||
.replace(/\?f=.*/, "");
|
||||
}
|
||||
return url;
|
||||
},
|
||||
/**
|
||||
* 检测传入的所有input框中输入的长宽是否是正数
|
||||
*/
|
||||
checkNum: function checkNum( nodes ) {
|
||||
|
||||
var me = this;
|
||||
|
||||
for ( var i = 0, ci; ci = nodes[i++]; ) {
|
||||
var value = ci.value;
|
||||
if ( !me.isNumber( value ) && value) {
|
||||
alert( me.lang.numError );
|
||||
ci.value = "";
|
||||
ci.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
/**
|
||||
* 数字判断
|
||||
* @param value
|
||||
*/
|
||||
isNumber: function( value ) {
|
||||
return /(0|^[1-9]\d*$)/.test( value );
|
||||
},
|
||||
updateAlignButton: function( align ) {
|
||||
var aligns = $( "#eduiVideoFloat", this.$widget )[0].children;
|
||||
|
||||
for ( var i = 0, ci; ci = aligns[i++]; ) {
|
||||
if ( ci.getAttribute( "name" ) == align ) {
|
||||
if ( ci.className !="edui-video-focus" ) {
|
||||
ci.className = "edui-video-focus";
|
||||
}
|
||||
} else {
|
||||
if ( ci.className =="edui-video-focus" ) {
|
||||
ci.className = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
/**
|
||||
* 创建图片浮动选择按钮
|
||||
* @param ids
|
||||
*/
|
||||
createAlignButton: function( ids ) {
|
||||
var lang = this.lang,
|
||||
vidoe_home = UMEDITOR_CONFIG.UMEDITOR_HOME_URL + 'dialogs/video/';
|
||||
|
||||
for ( var i = 0, ci; ci = ids[i++]; ) {
|
||||
var floatContainer = $( "#" + ci, this.$widget ) [0],
|
||||
nameMaps = {"none":lang['default'], "left":lang.floatLeft, "right":lang.floatRight};
|
||||
for ( var j in nameMaps ) {
|
||||
var div = document.createElement( "div" );
|
||||
div.setAttribute( "name", j );
|
||||
if ( j == "none" ) div.className="edui-video-focus";
|
||||
div.style.cssText = "background:url("+ vidoe_home +"images/" + j + "_focus.jpg);";
|
||||
div.setAttribute( "title", nameMaps[j] );
|
||||
floatContainer.appendChild( div );
|
||||
}
|
||||
this.switchSelect( ci );
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 选择切换
|
||||
*/
|
||||
switchSelect: function( selectParentId ) {
|
||||
var selects = $( "#" + selectParentId, this.$widget )[0].children;
|
||||
for ( var i = 0, ci; ci = selects[i++]; ) {
|
||||
$(ci).on("click", function () {
|
||||
for ( var j = 0, cj; cj = selects[j++]; ) {
|
||||
cj.className = "";
|
||||
cj.removeAttribute && cj.removeAttribute( "class" );
|
||||
}
|
||||
this.className = "edui-video-focus";
|
||||
} )
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 找到id下具有focus类的节点并返回该节点下的某个属性
|
||||
* @param id
|
||||
* @param returnProperty
|
||||
*/
|
||||
findFocus: function( id, returnProperty ) {
|
||||
var tabs = $( "#" + id , this.$widget)[0].children,
|
||||
property;
|
||||
for ( var i = 0, ci; ci = tabs[i++]; ) {
|
||||
if ( ci.className=="edui-video-focus" ) {
|
||||
property = ci.getAttribute( returnProperty );
|
||||
break;
|
||||
}
|
||||
}
|
||||
return property;
|
||||
},
|
||||
/**
|
||||
* 末尾字符检测
|
||||
*/
|
||||
endWith: function(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;
|
||||
},
|
||||
width:610,
|
||||
height:498,
|
||||
buttons: {
|
||||
ok: {
|
||||
exec: function( editor, $w ){
|
||||
$("#eduiVideoPreview", $w).html("");
|
||||
editor.getWidgetData(widgetName).insertSingle();
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
exec: function(){
|
||||
//清除视频
|
||||
$("#eduiVideoPreview").html("");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})();
|
||||
150
public/static/libs/umeditor/lang/en/en.js
Normal file
@@ -0,0 +1,150 @@
|
||||
/**
|
||||
* English language package
|
||||
*/
|
||||
UM.I18N['en'] = {
|
||||
'labelMap':{
|
||||
'anchor':'Anchor', 'undo':'Undo', 'redo':'Redo', 'bold':'Bold', 'indent':'Indent', 'snapscreen':'SnapScreen',
|
||||
'italic':'Italic', 'underline':'Underline', 'strikethrough':'Strikethrough', 'subscript':'SubScript','fontborder':'text border',
|
||||
'superscript':'SuperScript', 'formatmatch':'Format Match', 'source':'Source', 'blockquote':'BlockQuote',
|
||||
'pasteplain':'PastePlain', 'selectall':'SelectAll', 'print':'Print', 'preview':'Preview',
|
||||
'horizontal':'Horizontal', 'removeformat':'RemoveFormat', 'time':'Time', 'date':'Date',
|
||||
'unlink':'Unlink', 'insertrow':'InsertRow', 'insertcol':'InsertCol', 'mergeright':'MergeRight', 'mergedown':'MergeDown',
|
||||
'deleterow':'DeleteRow', 'deletecol':'DeleteCol', 'splittorows':'SplitToRows','insertcode':'insert code',
|
||||
'splittocols':'SplitToCols', 'splittocells':'SplitToCells','deletecaption':'DeleteCaption','inserttitle':'InsertTitle',
|
||||
'mergecells':'MergeCells', 'deletetable':'DeleteTable', 'cleardoc':'Clear', 'insertparagraphbeforetable':"InsertParagraphBeforeTable",
|
||||
'fontfamily':'FontFamily', 'fontsize':'FontSize', 'paragraph':'Paragraph', 'image':'Image','edittable':'Edit Table', 'edittd':'Edit Td','link':'Link',
|
||||
'emotion':'Emotion', 'spechars':'Spechars', 'searchreplace':'SearchReplace', 'map':'BaiduMap', 'gmap':'GoogleMap',
|
||||
'video':'Video', 'help':'Help', 'justifyleft':'JustifyLeft', 'justifyright':'JustifyRight', 'justifycenter':'JustifyCenter',
|
||||
'justifyjustify':'Justify', 'forecolor':'FontColor', 'backcolor':'BackColor', 'insertorderedlist':'OL',
|
||||
'insertunorderedlist':'UL', 'fullscreen':'FullScreen', 'directionalityltr':'EnterFromLeft', 'directionalityrtl':'EnterFromRight',
|
||||
'rowspacingtop':'RowSpacingTop', 'rowspacingbottom':'RowSpacingBottom', 'highlightcode':'Code', 'pagebreak':'PageBreak', 'insertframe':'Iframe', 'imagenone':'Default',
|
||||
'imageleft':'ImageLeft', 'imageright':'ImageRight', 'attachment':'Attachment', 'imagecenter':'ImageCenter', 'wordimage':'WordImage',
|
||||
'lineheight':'LineHeight','edittip':'EditTip','customstyle':'CustomStyle', 'scrawl':'Scrawl', 'autotypeset':'AutoTypeset',
|
||||
'webapp':'WebAPP', 'touppercase':'UpperCase', 'tolowercase':'LowerCase','template':'Template','background':'Background','inserttable':'InsertTable',
|
||||
'drafts': 'drafts', 'formula':'formula'
|
||||
},
|
||||
'paragraph':{'p':'Paragraph', 'h1':'Title 1', 'h2':'Title 2', 'h3':'Title 3', 'h4':'Title 4', 'h5':'Title 5', 'h6':'Title 6'},
|
||||
'fontfamily':{
|
||||
'songti':'Sim sun',
|
||||
'kaiti':'Sim kai',
|
||||
'heiti':'Sim hei',
|
||||
'lishu':'Sim li',
|
||||
'yahei': 'Microsoft yahei',
|
||||
'andaleMono':'Andale mono',
|
||||
'arial': 'Arial',
|
||||
'arialBlack':'Arial black',
|
||||
'comicSansMs':'Comic sans ms',
|
||||
'impact':'Impact',
|
||||
'timesNewRoman':'Times new roman'
|
||||
},
|
||||
'ok':"OK",
|
||||
'cancel':"Cancel",
|
||||
'closeDialog':"closeDialog",
|
||||
'tableDrag':"You must import the file uiUtils.js before drag! ",
|
||||
'autofloatMsg':"The plugin AutoFloat depends on EditorUI!",
|
||||
'anthorMsg':"Link",
|
||||
'clearColor':'Clear',
|
||||
'standardColor':'Standard color',
|
||||
'themeColor':'Theme color',
|
||||
'property':'Property',
|
||||
'default':'Default',
|
||||
'modify':'Modify',
|
||||
'justifyleft':'Justify Left',
|
||||
'justifyright':'Justify Right',
|
||||
'justifycenter':'Justify Center',
|
||||
'justify':'Default',
|
||||
'clear':'Clear',
|
||||
'anchorMsg':'Anchor',
|
||||
'delete':'Delete',
|
||||
'clickToUpload':"Click to upload",
|
||||
'unset':"Language hasn't been set!",
|
||||
't_row':'row',
|
||||
't_col':'col',
|
||||
'more':'More',
|
||||
'pasteOpt':'Paste Option',
|
||||
'pasteSourceFormat':"Keep Source Formatting",
|
||||
'tagFormat':'Keep tag',
|
||||
'pasteTextFormat':'Keep Text only',
|
||||
|
||||
//===============dialog i18N=======================
|
||||
'image':{
|
||||
'static':{
|
||||
'lang_tab_local':"Local Upload",
|
||||
'lang_tab_imgSearch':"Network Pictures",
|
||||
'lang_input_dragTip':"Support drag upload",
|
||||
'lang_btn_add':"Add"
|
||||
},
|
||||
'uploadError': 'Upload Error'
|
||||
},
|
||||
'emotion':{
|
||||
'static':{
|
||||
'lang_input_choice':'Choice',
|
||||
'lang_input_Tuzki':'Tuzki',
|
||||
'lang_input_lvdouwa':'LvDouWa',
|
||||
'lang_input_BOBO':'BOBO',
|
||||
'lang_input_babyCat':'BabyCat',
|
||||
'lang_input_bubble':'Bubble',
|
||||
'lang_input_youa':'YouA'
|
||||
}
|
||||
},
|
||||
'gmap':{
|
||||
'static':{
|
||||
'lang_input_address':'Address:',
|
||||
'lang_input_search':'Search',
|
||||
'address':{'value':"Beijing"}
|
||||
},
|
||||
'searchError':'Unable to locate the address!'
|
||||
},
|
||||
'link':{
|
||||
'static':{
|
||||
'lang_input_text':'Text:',
|
||||
'lang_input_url':'URL:',
|
||||
'lang_input_title':'Title:',
|
||||
'lang_input_target':'open in new window:'
|
||||
},
|
||||
'validLink':'Supports only effective when a link is selected',
|
||||
'httpPrompt':'The hyperlink you enter should start with "http|https|ftp://"!'
|
||||
},
|
||||
'map':{
|
||||
'static':{
|
||||
'lang_city':"City",
|
||||
'lang_address':"Address",
|
||||
'city':{'value':"Beijing"},
|
||||
'lang_search':"Search",
|
||||
'lang_dynamicmap':"Dynamic map"
|
||||
},
|
||||
'cityMsg':"Please enter the city name!",
|
||||
'errorMsg':"Can't find the place!"
|
||||
},
|
||||
'video':{
|
||||
'static':{
|
||||
'lang_tab_insertV':"Video",
|
||||
'lang_video_url':" URL ",
|
||||
'lang_video_size':"Video Size",
|
||||
'lang_videoW':"Width",
|
||||
'lang_videoH':"Height",
|
||||
'lang_alignment':"Alignment",
|
||||
'videoSearchTxt':{'value':"Enter the search keyword!"},
|
||||
'videoType':{'options':["All", "Hot", "Entertainment", "Funny", "Sports", "Science", "variety"]},
|
||||
'videoSearchBtn':{'value':"Search in Baidu"},
|
||||
'videoSearchReset':{'value':"Clear result"}
|
||||
},
|
||||
'numError':"Please enter the correct Num. e.g 123,400",
|
||||
'floatLeft':"Float left",
|
||||
'floatRight':"Float right",
|
||||
'default':"Default",
|
||||
'block':"Display in block",
|
||||
'urlError':"The video url format may be wrong!",
|
||||
'loading':" The video is loading, please wait…",
|
||||
'clickToSelect':"Click to select",
|
||||
'goToSource':'Visit source video ',
|
||||
'noVideo':" Sorry,can't find the video,please try again!"
|
||||
},
|
||||
'formula':{
|
||||
'static':{
|
||||
'lang_tab_common':'Common',
|
||||
'lang_tab_symbol':'Symbol',
|
||||
'lang_tab_letter':'Letter'
|
||||
}
|
||||
}
|
||||
};
|
||||
BIN
public/static/libs/umeditor/lang/en/images/addimage.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 743 B |
|
After Width: | Height: | Size: 743 B |
BIN
public/static/libs/umeditor/lang/en/images/background.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
public/static/libs/umeditor/lang/en/images/button.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
public/static/libs/umeditor/lang/en/images/copy.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
public/static/libs/umeditor/lang/en/images/deletedisable.png
Normal file
|
After Width: | Height: | Size: 649 B |
BIN
public/static/libs/umeditor/lang/en/images/deleteenable.png
Normal file
|
After Width: | Height: | Size: 664 B |
BIN
public/static/libs/umeditor/lang/en/images/imglabel.png
Normal file
|
After Width: | Height: | Size: 672 B |
BIN
public/static/libs/umeditor/lang/en/images/listbackground.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
public/static/libs/umeditor/lang/en/images/localimage.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
public/static/libs/umeditor/lang/en/images/music.png
Normal file
|
After Width: | Height: | Size: 89 KiB |
BIN
public/static/libs/umeditor/lang/en/images/rotateleftdisable.png
Normal file
|
After Width: | Height: | Size: 719 B |
BIN
public/static/libs/umeditor/lang/en/images/rotateleftenable.png
Normal file
|
After Width: | Height: | Size: 952 B |
|
After Width: | Height: | Size: 754 B |
BIN
public/static/libs/umeditor/lang/en/images/rotaterightenable.png
Normal file
|
After Width: | Height: | Size: 1007 B |
BIN
public/static/libs/umeditor/lang/en/images/upload.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
public/static/libs/umeditor/lang/zh-cn/images/copy.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
public/static/libs/umeditor/lang/zh-cn/images/imglabel.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
public/static/libs/umeditor/lang/zh-cn/images/localimage.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
public/static/libs/umeditor/lang/zh-cn/images/music.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
public/static/libs/umeditor/lang/zh-cn/images/upload.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
150
public/static/libs/umeditor/lang/zh-cn/zh-cn.js
Normal file
@@ -0,0 +1,150 @@
|
||||
/**
|
||||
* 中文语言包
|
||||
*/
|
||||
UM.I18N['zh-cn'] = {
|
||||
'labelMap':{
|
||||
'anchor':'锚点', 'undo':'撤销', 'redo':'重做', 'bold':'加粗', 'indent':'首行缩进', 'snapscreen':'截图',
|
||||
'italic':'斜体', 'underline':'下划线', 'strikethrough':'删除线', 'subscript':'下标','fontborder':'字符边框',
|
||||
'superscript':'上标', 'formatmatch':'格式刷', 'source':'源代码', 'blockquote':'引用',
|
||||
'pasteplain':'纯文本粘贴模式', 'selectall':'全选', 'print':'打印', 'preview':'预览',
|
||||
'horizontal':'分隔线', 'removeformat':'清除格式', 'time':'时间', 'date':'日期',
|
||||
'unlink':'取消链接', 'insertrow':'前插入行', 'insertcol':'前插入列', 'mergeright':'右合并单元格', 'mergedown':'下合并单元格',
|
||||
'deleterow':'删除行', 'deletecol':'删除列', 'splittorows':'拆分成行', 'splittocols':'拆分成列', 'splittocells':'完全拆分单元格',
|
||||
'mergecells':'合并多个单元格', 'deletetable':'删除表格', 'cleardoc':'清空文档','insertparagraphbeforetable':"表格前插入行",'insertcode':'代码语言','fontfamily':'字体', 'fontsize':'字号', 'paragraph':'段落格式', 'image':'图片',
|
||||
'edittable':'表格属性','edittd':'单元格属性', 'link':'超链接','emotion':'表情', 'spechars':'特殊字符', 'searchreplace':'查询替换', 'map':'百度地图', 'gmap':'Google地图',
|
||||
'video':'视频', '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':'行间距','edittip' :'编辑提示','customstyle':'自定义标题', 'autotypeset':'自动排版', 'webapp':'百度应用',
|
||||
'touppercase':'字母大写', 'tolowercase':'字母小写','background':'背景','template':'模板','scrawl':'涂鸦','music':'音乐','inserttable':'插入表格',
|
||||
'drafts': '草稿箱', 'formula':'数学公式','save':'保存'
|
||||
|
||||
|
||||
},
|
||||
'paragraph':{'p':'段落', 'h1':'标题 1', 'h2':'标题 2', 'h3':'标题 3', 'h4':'标题 4', 'h5':'标题 5', 'h6':'标题 6'},
|
||||
'fontfamily':{
|
||||
'songti':'宋体',
|
||||
'kaiti':'楷体',
|
||||
'heiti':'黑体',
|
||||
'lishu':'隶书',
|
||||
'yahei':'微软雅黑',
|
||||
'andaleMono':'andale mono',
|
||||
'arial': 'arial',
|
||||
'arialBlack':'arial black',
|
||||
'comicSansMs':'comic sans ms',
|
||||
'impact':'impact',
|
||||
'timesNewRoman':'times new roman'
|
||||
},
|
||||
'ok':"确认",
|
||||
'cancel':"取消",
|
||||
'closeDialog':"关闭对话框",
|
||||
'tableDrag':"表格拖动必须引入uiUtils.js文件!",
|
||||
'autofloatMsg':"工具栏浮动依赖编辑器UI,您首先需要引入UI文件!",
|
||||
'anthorMsg':"链接",
|
||||
'clearColor':'清空颜色',
|
||||
'standardColor':'标准颜色',
|
||||
'themeColor':'主题颜色',
|
||||
'property':'属性',
|
||||
'default':'默认',
|
||||
'modify':'修改',
|
||||
'justifyleft':'左对齐',
|
||||
'justifyright':'右对齐',
|
||||
'justifycenter':'居中',
|
||||
'justify':'默认',
|
||||
'clear':'清除',
|
||||
'anchorMsg':'锚点',
|
||||
'delete':'删除',
|
||||
'clickToUpload':"点击上传",
|
||||
'unset':'尚未设置语言文件',
|
||||
't_row':'行',
|
||||
't_col':'列',
|
||||
'more':'更多',
|
||||
'pasteOpt':'粘贴选项',
|
||||
'pasteSourceFormat':"保留源格式",
|
||||
'tagFormat':'只保留标签',
|
||||
'pasteTextFormat':'只保留文本',
|
||||
|
||||
//===============dialog i18N=======================
|
||||
'image':{
|
||||
'static':{
|
||||
'lang_tab_local':"本地上传",
|
||||
'lang_tab_imgSearch':"网络图片",
|
||||
'lang_input_dragTip':"支持图片拖拽上传",
|
||||
'lang_btn_add':"添加"
|
||||
},
|
||||
'uploadError': '上传出错'
|
||||
},
|
||||
'emotion':{
|
||||
'static':{
|
||||
'lang_input_choice':'精选',
|
||||
'lang_input_Tuzki':'兔斯基',
|
||||
'lang_input_BOBO':'BOBO',
|
||||
'lang_input_lvdouwa':'绿豆蛙',
|
||||
'lang_input_babyCat':'baby猫',
|
||||
'lang_input_bubble':'泡泡',
|
||||
'lang_input_youa':'有啊'
|
||||
}
|
||||
},
|
||||
'gmap':{
|
||||
'static':{
|
||||
'lang_input_address':'地址',
|
||||
'lang_input_search':'搜索',
|
||||
'address':{'value':"北京"}
|
||||
},
|
||||
'searchError':'无法定位到该地址!'
|
||||
},
|
||||
'link':{
|
||||
'static':{
|
||||
'lang_input_text':'文本内容:',
|
||||
'lang_input_url':'链接地址:',
|
||||
'lang_input_title':'标题:',
|
||||
'lang_input_target':'是否在新窗口打开:'
|
||||
},
|
||||
'validLink':'只支持选中一个链接时生效',
|
||||
'httpPrompt':'您输入的超链接中不包含http等协议名称,默认将为您添加http://前缀'
|
||||
},
|
||||
'map':{
|
||||
'static':{
|
||||
'lang_city':"城市",
|
||||
'lang_address':"地址",
|
||||
'city':{'value':"北京"},
|
||||
'lang_search':"搜索",
|
||||
'lang_dynamicmap':"插入动态地图"
|
||||
},
|
||||
'cityMsg':"请选择城市",
|
||||
'errorMsg':"抱歉,找不到该位置!"
|
||||
},
|
||||
'video':{
|
||||
'static':{
|
||||
'lang_tab_insertV':"插入视频",
|
||||
'lang_video_url':"视频网址",
|
||||
'lang_video_size':"视频尺寸",
|
||||
'lang_videoW':"宽度",
|
||||
'lang_videoH':"高度",
|
||||
'lang_alignment':"对齐方式",
|
||||
'videoSearchTxt':{'value':"请输入搜索关键字!"},
|
||||
'videoType':{'options':["全部", "热门", "娱乐", "搞笑", "体育", "科技", "综艺"]},
|
||||
'videoSearchBtn':{'value':"百度一下"},
|
||||
'videoSearchReset':{'value':"清空结果"}
|
||||
},
|
||||
'numError':"请输入正确的数值,如123,400",
|
||||
'floatLeft':"左浮动",
|
||||
'floatRight':"右浮动",
|
||||
'default':"默认",
|
||||
'block':"独占一行",
|
||||
'urlError':"输入的视频地址有误,请检查后再试!",
|
||||
'loading':" 视频加载中,请等待……",
|
||||
'clickToSelect':"点击选中",
|
||||
'goToSource':'访问源视频',
|
||||
'noVideo':" 抱歉,找不到对应的视频,请重试!"
|
||||
},
|
||||
'formula':{
|
||||
'static':{
|
||||
'lang_tab_common':'常用公式',
|
||||
'lang_tab_symbol':'符号',
|
||||
'lang_tab_letter':'字母'
|
||||
}
|
||||
}
|
||||
};
|
||||
208
public/static/libs/umeditor/php/Uploader.class.php
Normal file
@@ -0,0 +1,208 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
* User: taoqili
|
||||
* Date: 12-7-18
|
||||
* Time: 上午11: 32
|
||||
* UEditor编辑器通用上传类
|
||||
*/
|
||||
class Uploader
|
||||
{
|
||||
private $fileField; //文件域名
|
||||
private $file; //文件上传对象
|
||||
private $config; //配置信息
|
||||
private $oriName; //原始文件名
|
||||
private $fileName; //新文件名
|
||||
private $fullName; //完整文件名,即从当前配置目录开始的URL
|
||||
private $fileSize; //文件大小
|
||||
private $fileType; //文件类型
|
||||
private $stateInfo; //上传状态信息,
|
||||
private $stateMap = array( //上传状态映射表,国际化用户需考虑此处数据的国际化
|
||||
"SUCCESS" , //上传成功标记,在UEditor中内不可改变,否则flash判断会出错
|
||||
"文件大小超出 upload_max_filesize 限制" ,
|
||||
"文件大小超出 MAX_FILE_SIZE 限制" ,
|
||||
"文件未被完整上传" ,
|
||||
"没有文件被上传" ,
|
||||
"上传文件为空" ,
|
||||
"POST" => "文件大小超出 post_max_size 限制" ,
|
||||
"SIZE" => "文件大小超出网站限制" ,
|
||||
"TYPE" => "不允许的文件类型" ,
|
||||
"DIR" => "目录创建失败" ,
|
||||
"IO" => "输入输出错误" ,
|
||||
"UNKNOWN" => "未知错误" ,
|
||||
"MOVE" => "文件保存时出错",
|
||||
"DIR_ERROR" => "创建目录失败"
|
||||
);
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
* @param string $fileField 表单名称
|
||||
* @param array $config 配置项
|
||||
* @param bool $base64 是否解析base64编码,可省略。若开启,则$fileField代表的是base64编码的字符串表单名
|
||||
*/
|
||||
public function __construct( $fileField , $config , $base64 = false )
|
||||
{
|
||||
$this->fileField = $fileField;
|
||||
$this->config = $config;
|
||||
$this->stateInfo = $this->stateMap[ 0 ];
|
||||
$this->upFile( $base64 );
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件的主处理方法
|
||||
* @param $base64
|
||||
* @return mixed
|
||||
*/
|
||||
private function upFile( $base64 )
|
||||
{
|
||||
//处理base64上传
|
||||
if ( "base64" == $base64 ) {
|
||||
$content = $_POST[ $this->fileField ];
|
||||
$this->base64ToImage( $content );
|
||||
return;
|
||||
}
|
||||
|
||||
//处理普通上传
|
||||
$file = $this->file = $_FILES[ $this->fileField ];
|
||||
if ( !$file ) {
|
||||
$this->stateInfo = $this->getStateInfo( 'POST' );
|
||||
return;
|
||||
}
|
||||
if ( $this->file[ 'error' ] ) {
|
||||
$this->stateInfo = $this->getStateInfo( $file[ 'error' ] );
|
||||
return;
|
||||
}
|
||||
if ( !is_uploaded_file( $file[ 'tmp_name' ] ) ) {
|
||||
$this->stateInfo = $this->getStateInfo( "UNKNOWN" );
|
||||
return;
|
||||
}
|
||||
|
||||
$this->oriName = $file[ 'name' ];
|
||||
$this->fileSize = $file[ 'size' ];
|
||||
$this->fileType = $this->getFileExt();
|
||||
|
||||
if ( !$this->checkSize() ) {
|
||||
$this->stateInfo = $this->getStateInfo( "SIZE" );
|
||||
return;
|
||||
}
|
||||
if ( !$this->checkType() ) {
|
||||
$this->stateInfo = $this->getStateInfo( "TYPE" );
|
||||
return;
|
||||
}
|
||||
|
||||
$folder = $this->getFolder();
|
||||
|
||||
if ( $folder === false ) {
|
||||
$this->stateInfo = $this->getStateInfo( "DIR_ERROR" );
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fullName = $folder . '/' . $this->getName();
|
||||
|
||||
if ( $this->stateInfo == $this->stateMap[ 0 ] ) {
|
||||
if ( !move_uploaded_file( $file[ "tmp_name" ] , $this->fullName ) ) {
|
||||
$this->stateInfo = $this->getStateInfo( "MOVE" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理base64编码的图片上传
|
||||
* @param $base64Data
|
||||
* @return mixed
|
||||
*/
|
||||
private function base64ToImage( $base64Data )
|
||||
{
|
||||
$img = base64_decode( $base64Data );
|
||||
$this->fileName = time() . rand( 1 , 10000 ) . ".png";
|
||||
$this->fullName = $this->getFolder() . '/' . $this->fileName;
|
||||
if ( !file_put_contents( $this->fullName , $img ) ) {
|
||||
$this->stateInfo = $this->getStateInfo( "IO" );
|
||||
return;
|
||||
}
|
||||
$this->oriName = "";
|
||||
$this->fileSize = strlen( $img );
|
||||
$this->fileType = ".png";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前上传成功文件的各项信息
|
||||
* @return array
|
||||
*/
|
||||
public function getFileInfo()
|
||||
{
|
||||
return array(
|
||||
"originalName" => $this->oriName ,
|
||||
"name" => $this->fileName ,
|
||||
"url" => $this->fullName ,
|
||||
"size" => $this->fileSize ,
|
||||
"type" => $this->fileType ,
|
||||
"state" => $this->stateInfo
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传错误检查
|
||||
* @param $errCode
|
||||
* @return string
|
||||
*/
|
||||
private function getStateInfo( $errCode )
|
||||
{
|
||||
return !$this->stateMap[ $errCode ] ? $this->stateMap[ "UNKNOWN" ] : $this->stateMap[ $errCode ];
|
||||
}
|
||||
|
||||
/**
|
||||
* 重命名文件
|
||||
* @return string
|
||||
*/
|
||||
private function getName()
|
||||
{
|
||||
return $this->fileName = time() . rand( 1 , 10000 ) . $this->getFileExt();
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件类型检测
|
||||
* @return bool
|
||||
*/
|
||||
private function checkType()
|
||||
{
|
||||
return in_array( $this->getFileExt() , $this->config[ "allowFiles" ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件大小检测
|
||||
* @return bool
|
||||
*/
|
||||
private function checkSize()
|
||||
{
|
||||
return $this->fileSize <= ( $this->config[ "maxSize" ] * 1024 );
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件扩展名
|
||||
* @return string
|
||||
*/
|
||||
private function getFileExt()
|
||||
{
|
||||
return strtolower( strrchr( $this->file[ "name" ] , '.' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 按照日期自动创建存储文件夹
|
||||
* @return string
|
||||
*/
|
||||
private function getFolder()
|
||||
{
|
||||
$pathStr = $this->config[ "savePath" ];
|
||||
if ( strrchr( $pathStr , "/" ) != "/" ) {
|
||||
$pathStr .= "/";
|
||||
}
|
||||
$pathStr .= date( "Ymd" );
|
||||
if ( !file_exists( $pathStr ) ) {
|
||||
if ( !mkdir( $pathStr , 0777 , true ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return $pathStr;
|
||||
}
|
||||
}
|
||||
14
public/static/libs/umeditor/php/getContent.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<script src="../third-party/jquery.min.js"></script>
|
||||
<script src="../third-party/mathquill/mathquill.min.js"></script>
|
||||
<link rel="stylesheet" href="../third-party/mathquill/mathquill.css"/>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
||||
<?php
|
||||
|
||||
//获取数据
|
||||
error_reporting(E_ERROR|E_WARNING);
|
||||
$content = htmlspecialchars($_POST['myEditor']);
|
||||
|
||||
//存入数据库或者其他操作
|
||||
|
||||
//显示
|
||||
echo "<div class='content'>".htmlspecialchars_decode($content)."</div>";
|
||||
29
public/static/libs/umeditor/php/imageUp.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
header("Content-Type:text/html;charset=utf-8");
|
||||
error_reporting( E_ERROR | E_WARNING );
|
||||
date_default_timezone_set("Asia/chongqing");
|
||||
include "Uploader.class.php";
|
||||
//上传配置
|
||||
$config = array(
|
||||
"savePath" => "../../../uploads/editor/" , //存储文件夹
|
||||
"maxSize" => 1000 , //允许的文件最大尺寸,单位KB
|
||||
"allowFiles" => array( ".gif" , ".png" , ".jpg" , ".jpeg" , ".bmp" ) //允许的文件格式
|
||||
);
|
||||
//上传文件目录
|
||||
$Path = "../../../uploads/editor/";
|
||||
|
||||
//背景保存在临时目录中
|
||||
$config[ "savePath" ] = $Path;
|
||||
$up = new Uploader( "upfile" , $config );
|
||||
$type = $_REQUEST['type'];
|
||||
$callback=$_GET['callback'];
|
||||
|
||||
$info = $up->getFileInfo();
|
||||
/**
|
||||
* 返回数据
|
||||
*/
|
||||
if($callback) {
|
||||
echo '<script>'.$callback.'('.json_encode($info).')</script>';
|
||||
} else {
|
||||
echo json_encode($info);
|
||||
}
|
||||
773
public/static/libs/umeditor/themes/default/css/umeditor.css
Normal file
@@ -0,0 +1,773 @@
|
||||
.edui-container{
|
||||
position: relative;
|
||||
border: 1px solid #d4d4d4;
|
||||
box-shadow: 2px 2px 5px #d3d6da;
|
||||
background-color: #fff;
|
||||
}
|
||||
.edui-container .edui-toolbar{
|
||||
position: relative;
|
||||
width:auto;
|
||||
border-bottom: 1px solid #e1e1e1;
|
||||
box-shadow: 2px 2px 5px #d3d6da;
|
||||
background-color: #fafafa;
|
||||
z-index: 99999;
|
||||
}
|
||||
.edui-toolbar .edui-btn-toolbar{
|
||||
position: relative;
|
||||
padding: 5px;
|
||||
}
|
||||
.edui-container .edui-editor-body{
|
||||
background-color: #fff;
|
||||
}
|
||||
.edui-editor-body .edui-body-container{
|
||||
}
|
||||
|
||||
.edui-editor-body .edui-body-container p{margin:5px 0;}
|
||||
.edui-editor-body .edui-body-container{
|
||||
border:0;
|
||||
outline:none;
|
||||
cursor:text;
|
||||
padding:0 10px 0;
|
||||
overflow:auto;
|
||||
display:block;
|
||||
word-wrap:break-word;
|
||||
font-size:16px;
|
||||
font-family:sans-serif;
|
||||
}
|
||||
.edui-editor-body.focus{border:1px solid #5c9dff}
|
||||
.edui-editor-body table{margin:10px 0 10px;border-collapse:collapse;display:table;}
|
||||
.edui-editor-body td{padding: 5px 10px;border: 1px solid #DDD;}
|
||||
.edui-editor-body iframe.mathquill-embedded-latex{
|
||||
border: 0px;
|
||||
padding: 0px;
|
||||
display: inline;
|
||||
margin: 0px;
|
||||
background: none;
|
||||
vertical-align: middle;
|
||||
width: 0px;
|
||||
height: 0px;
|
||||
}
|
||||
/*普通按钮*/
|
||||
.edui-btn-toolbar .edui-btn{
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
*display: inline;
|
||||
*zoom:1;
|
||||
width:auto;
|
||||
margin: 0 1px;
|
||||
padding:1px;
|
||||
border:none;
|
||||
background: none;
|
||||
}
|
||||
.edui-btn-toolbar .edui-btn .edui-icon{
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin: 0;
|
||||
padding:0;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url(../images/icons.png);
|
||||
background-image: url(../images/icons.gif) \9;
|
||||
}
|
||||
|
||||
/*状态反射*/
|
||||
.edui-btn-toolbar .edui-btn.edui-hover,
|
||||
.edui-btn-toolbar .edui-btn.edui-active{
|
||||
background-color: #d5e1f2;
|
||||
padding: 0;
|
||||
border: 1px solid #a3bde3;
|
||||
_z-index: 1;
|
||||
}
|
||||
.edui-btn-toolbar .edui-btn.edui-disabled{
|
||||
opacity: 0.3;
|
||||
filter: alpha(opacity = 30);
|
||||
}
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-source {
|
||||
background-position:-260px -0px;
|
||||
}
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-undo {
|
||||
background-position: -160px 0;
|
||||
}
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-redo {
|
||||
background-position: -100px 0;
|
||||
}
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-bold{
|
||||
background-position: 0 0;
|
||||
}
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-italic {
|
||||
background-position: -60px 0;
|
||||
}
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-underline {
|
||||
background-position: -140px 0
|
||||
}
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-strikethrough {
|
||||
background-position: -120px 0;
|
||||
}
|
||||
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-superscript {
|
||||
background-position: -620px 0;
|
||||
}
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-subscript {
|
||||
background-position: -600px 0;
|
||||
}
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-font, .edui-btn-toolbar .edui-btn .edui-icon-forecolor {
|
||||
background-position: -720px 0;
|
||||
}
|
||||
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-backcolor {
|
||||
background-position: -760px 0;
|
||||
}
|
||||
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-insertorderedlist {
|
||||
background-position: -80px 0;
|
||||
}
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-insertunorderedlist {
|
||||
background-position: -20px 0;
|
||||
}
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-selectall {
|
||||
background-position: -400px -20px;
|
||||
}
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-cleardoc {
|
||||
background-position: -520px 0;
|
||||
}
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-paragraph {
|
||||
background-position: -140px 0;
|
||||
}
|
||||
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-fontfamily {
|
||||
background-position: -140px 0;
|
||||
}
|
||||
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-fontsize {
|
||||
background-position: -140px 0;
|
||||
}
|
||||
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-justifyleft {
|
||||
background-position: -460px 0;
|
||||
}
|
||||
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-justifycenter {
|
||||
background-position: -420px 0;
|
||||
}
|
||||
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-justifyright {
|
||||
background-position:-480px 0;
|
||||
}
|
||||
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-justifyjustify {
|
||||
background-position: -440px 0;
|
||||
}
|
||||
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-link {
|
||||
background-position: -500px 0;
|
||||
}
|
||||
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-unlink {
|
||||
background-position: -640px 0;
|
||||
}
|
||||
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-image {
|
||||
background-position: -380px 0;
|
||||
}
|
||||
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-emotion {
|
||||
background-position: -60px -20px;
|
||||
}
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-video {
|
||||
background-position: -320px -20px;
|
||||
}
|
||||
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-map {
|
||||
background-position: -40px -40px;
|
||||
}
|
||||
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-gmap {
|
||||
background-position: -260px -40px;
|
||||
}
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-horizontal {
|
||||
background-position: -360px 0;
|
||||
}
|
||||
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-print {
|
||||
background-position: -440px -20px;
|
||||
}
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-preview {
|
||||
background-position: -420px -20px;
|
||||
}
|
||||
|
||||
.edui-btn-toolbar .edui-btn-fullscreen{
|
||||
float:right;
|
||||
}
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-fullscreen {
|
||||
background-position: -100px -20px;
|
||||
}
|
||||
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-removeformat {
|
||||
background-position: -580px 0;
|
||||
}
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-drafts {
|
||||
background-position: -560px 0;
|
||||
}
|
||||
.edui-btn-toolbar .edui-btn .edui-icon-formula {
|
||||
background-position: -80px -20px;
|
||||
}
|
||||
.edui-btn-toolbar .edui-splitbutton{
|
||||
position: relative;
|
||||
display: inline-block ;
|
||||
vertical-align: top;
|
||||
*display: inline ;
|
||||
*zoom:1;
|
||||
margin:0 2px;
|
||||
}
|
||||
.edui-splitbutton .edui-btn{
|
||||
margin: 0;
|
||||
}
|
||||
.edui-splitbutton .edui-caret{
|
||||
position: relative;
|
||||
display: inline-block ;
|
||||
vertical-align: top;
|
||||
*display: inline ;
|
||||
*zoom:1;
|
||||
width: 8px;
|
||||
height: 20px;
|
||||
background: url(../images/icons.png) -741px 0;
|
||||
_background: url(../images/icons.gif) -741px 0;
|
||||
}
|
||||
|
||||
.edui-btn-toolbar .edui-splitbutton,
|
||||
.edui-btn-toolbar .edui-splitbutton{
|
||||
_border: none;
|
||||
}
|
||||
|
||||
/*状态反射*/
|
||||
.edui-btn-toolbar .edui-splitbutton.edui-hover .edui-btn{
|
||||
background-color: #d5e1f2;
|
||||
}
|
||||
|
||||
.edui-btn-toolbar .edui-splitbutton.edui-disabled{
|
||||
opacity: 0.3;
|
||||
filter: alpha(opacity = 30);
|
||||
}
|
||||
.edui-btn-toolbar .edui-splitbutton.edui-disabled .edui-caret{
|
||||
opacity: 0.3 \0;
|
||||
filter: alpha(opacity = 30)\0;
|
||||
}
|
||||
|
||||
|
||||
.edui-btn-toolbar .edui-combobox{
|
||||
border: 1px solid #CCC;
|
||||
padding:0;
|
||||
margin:0 2px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.edui-combobox .edui-button-label{
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
*display: inline ;
|
||||
*zoom:1;
|
||||
width:60px;
|
||||
height:20px;
|
||||
line-height: 20px;
|
||||
padding: 2px;
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
cursor: default;
|
||||
}
|
||||
.edui-combobox .edui-button-spacing{
|
||||
position: relative;
|
||||
display: inline-block ;
|
||||
vertical-align: top;
|
||||
*display: inline ;
|
||||
*zoom:1;
|
||||
height:20px;
|
||||
margin: 0;
|
||||
padding:0 3px;
|
||||
}
|
||||
.edui-combobox .edui-caret{
|
||||
position: relative;
|
||||
display: inline-block ;
|
||||
vertical-align: top;
|
||||
*display: inline ;
|
||||
*zoom:1;
|
||||
height:20px;
|
||||
width: 12px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: url(../images/icons.png) -741px 0;
|
||||
_background: url(../images/icons.gif) -741px 0;
|
||||
}
|
||||
.edui-btn-toolbar .edui-combobox.edui-disabled{
|
||||
opacity: 0.2;
|
||||
filter: alpha(opacity = 20);
|
||||
}
|
||||
.edui-btn-toolbar .edui-combobox.edui-disabled .edui-button-label,
|
||||
.edui-btn-toolbar .edui-combobox.edui-disabled .edui-caret{
|
||||
opacity: 0.2 \0;
|
||||
filter: alpha(opacity = 20)\0;
|
||||
}
|
||||
.edui-combobox-menu{
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
display: none;
|
||||
list-style: none;
|
||||
text-decoration: none;
|
||||
margin: 0;
|
||||
padding:5px;
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #ccc;
|
||||
font-size: 12px;
|
||||
box-shadow: 2px 2px 5px #d3d6da;
|
||||
min-width: 160px;
|
||||
_width: 160px;
|
||||
}
|
||||
|
||||
.edui-combobox-menu .edui-combobox-item {
|
||||
display: block;
|
||||
border: 1px solid white;
|
||||
}
|
||||
|
||||
.edui-combobox-menu .edui-combobox-item-label {
|
||||
height: 25px;
|
||||
line-height: 25px;
|
||||
display: inline-block;
|
||||
_display: inline;
|
||||
_zoom: 1;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.edui-combobox-menu .edui-combobox-item:hover, .edui-combobox-menu .edui-combobox-stack-item:hover, .edui-combobox-menu .edui-combobox-item-hover {
|
||||
background-color: #d5e1f2;
|
||||
padding: 0;
|
||||
border: 1px solid #a3bde3;
|
||||
}
|
||||
|
||||
.edui-combobox-menu .edui-combobox-item .edui-combobox-icon {
|
||||
display: inline-block;
|
||||
*zoom: 1;
|
||||
*display: inline;
|
||||
width: 24px;
|
||||
height: 25px;
|
||||
background: red;
|
||||
vertical-align: bottom;
|
||||
background: url(../images/ok.gif) no-repeat 1000px 1000px;
|
||||
}
|
||||
|
||||
.edui-combobox-menu .edui-combobox-checked .edui-combobox-icon {
|
||||
background-position: 10px 7px;
|
||||
}
|
||||
|
||||
|
||||
.edui-combobox-menu .edui-combobox-item-separator {
|
||||
min-width: 160px;
|
||||
height: 1px;
|
||||
line-height: 1px;
|
||||
overflow: hidden;
|
||||
background: #d3d3d3;
|
||||
margin: 5px 0;
|
||||
*margin-top: -8px;
|
||||
}
|
||||
|
||||
/* 字体样式校正 */
|
||||
|
||||
.edui-combobox-fontsize .edui-combobox-item-0.edui-combobox-checked .edui-combobox-icon {
|
||||
background-position: 10px 7px;
|
||||
}
|
||||
|
||||
.edui-combobox-fontsize .edui-combobox-item-1.edui-combobox-checked .edui-combobox-icon {
|
||||
background-position: 10px 7px;
|
||||
}
|
||||
|
||||
.edui-combobox-fontsize .edui-combobox-item-2.edui-combobox-checked .edui-combobox-icon {
|
||||
background-position: 10px 7px;
|
||||
}
|
||||
|
||||
.edui-combobox-fontsize .edui-combobox-item-3.edui-combobox-checked .edui-combobox-icon {
|
||||
background-position: 10px 7px;
|
||||
}
|
||||
|
||||
/* 24 */
|
||||
.edui-combobox-fontsize .edui-combobox-item-4 .edui-combobox-item-label {
|
||||
height: 27px;
|
||||
line-height: 27px;
|
||||
}
|
||||
|
||||
.edui-combobox-fontsize .edui-combobox-item-4.edui-combobox-checked .edui-combobox-icon {
|
||||
background-position: 10px 5px;
|
||||
}
|
||||
|
||||
/* 32 */
|
||||
.edui-combobox-fontsize .edui-combobox-item-5 .edui-combobox-item-label {
|
||||
height: 31px;
|
||||
line-height: 31px;
|
||||
}
|
||||
|
||||
.edui-combobox-fontsize .edui-combobox-item-5.edui-combobox-checked .edui-combobox-icon {
|
||||
background-position: 10px 4px;
|
||||
}
|
||||
|
||||
|
||||
/* 48 */
|
||||
.edui-combobox-fontsize .edui-combobox-item-6 .edui-combobox-item-label {
|
||||
height: 47px;
|
||||
line-height: 47px;
|
||||
}
|
||||
|
||||
/*.edui-combobox-fontsize .edui-combobox-item-6 .edui-combobox-icon {*/
|
||||
/*height: 25px;*/
|
||||
/*margin-bottom: 11px;*/
|
||||
/*}*/
|
||||
|
||||
/*.edui-combobox-fontsize .edui-combobox-item-6.edui-combobox-checked .edui-combobox-icon {*/
|
||||
/*background-position: 10px 7px;*/
|
||||
/*}*/
|
||||
|
||||
|
||||
/* 段落样式校正 */
|
||||
/* h1 */
|
||||
.edui-combobox-paragraph .edui-combobox-item-1 .edui-combobox-item-label {
|
||||
font-size: 32px;
|
||||
height: 36px;
|
||||
line-height: 36px;
|
||||
}
|
||||
|
||||
.edui-combobox-paragraph .edui-combobox-item-1 .edui-combobox-icon {
|
||||
height: 25px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.edui-combobox-paragraph .edui-combobox-item-1.edui-combobox-checked .edui-combobox-icon {
|
||||
background-position: 10px 7px;
|
||||
}
|
||||
|
||||
/* h2 */
|
||||
.edui-combobox-paragraph .edui-combobox-item-2 .edui-combobox-item-label {
|
||||
font-size: 28px;
|
||||
height: 27px;
|
||||
line-height: 27px;
|
||||
}
|
||||
|
||||
.edui-combobox-paragraph .edui-combobox-item-2 .edui-combobox-icon {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.edui-combobox-paragraph .edui-combobox-item-2.edui-combobox-checked .edui-combobox-icon {
|
||||
background-position: 10px 10px;
|
||||
}
|
||||
|
||||
/* h3 */
|
||||
.edui-combobox-paragraph .edui-combobox-item-3 .edui-combobox-item-label {
|
||||
font-size: 24px;
|
||||
height: 25px;
|
||||
line-height: 25px;
|
||||
}
|
||||
|
||||
.edui-combobox-paragraph .edui-combobox-item-3 .edui-combobox-icon {
|
||||
height: 25px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.edui-combobox-paragraph .edui-combobox-item-3.edui-combobox-checked .edui-combobox-icon {
|
||||
background-position: 10px 11px;
|
||||
}
|
||||
|
||||
/* h4 */
|
||||
.edui-combobox-paragraph .edui-combobox-item-4 .edui-combobox-item-label {
|
||||
font-size: 18px;
|
||||
height: 25px;
|
||||
line-height: 25px;
|
||||
}
|
||||
|
||||
.edui-combobox-paragraph .edui-combobox-item-4.edui-combobox-checked .edui-combobox-icon {
|
||||
background-position: 10px 6px;
|
||||
}
|
||||
|
||||
/* h5 */
|
||||
.edui-combobox-paragraph .edui-combobox-item-5 .edui-combobox-item-label {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
/* h6 */
|
||||
.edui-combobox-paragraph .edui-combobox-item-6 .edui-combobox-item-label {
|
||||
font-size: 12px;
|
||||
}
|
||||
.edui-modal {
|
||||
position: fixed;
|
||||
_position: absolute;
|
||||
top: 10%;
|
||||
left: 50%;
|
||||
border: 1px solid #acacac;
|
||||
box-shadow: 2px 2px 5px #d3d6da;
|
||||
background-color: #ffffff;
|
||||
outline: 0;
|
||||
}
|
||||
.edui-modal-header {
|
||||
padding: 5px 10px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
.edui-modal-header .edui-close {
|
||||
float: right;
|
||||
width:20px;
|
||||
height:20px;
|
||||
margin-top: 2px;
|
||||
padding: 1px;
|
||||
border: 0;
|
||||
background: url("../images/close.png") no-repeat center center;
|
||||
cursor: pointer;
|
||||
}
|
||||
.edui-modal-header .edui-close.edui-hover {
|
||||
background-color: #d5e1f2;
|
||||
padding:0;
|
||||
border: 1px solid #a3bde3;
|
||||
}
|
||||
.edui-modal-header .edui-title {
|
||||
margin: 0;
|
||||
line-height: 25px;
|
||||
font-size: 20px;
|
||||
}
|
||||
.edui-modal-body {
|
||||
position: relative;
|
||||
max-height: 400px;
|
||||
font-size: 12px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.edui-modal-footer {
|
||||
float: right;
|
||||
padding: 5px 15px 15px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.edui-modal-footer .edui-btn {
|
||||
float: left;
|
||||
height: 24px;
|
||||
width: 96px;
|
||||
margin: 0 10px;
|
||||
background-color: #ffffff;
|
||||
padding: 0;
|
||||
border: 1px solid #ababab;
|
||||
font-size: 12px;
|
||||
line-height: 24px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
.edui-modal-footer .edui-btn.edui-hover{
|
||||
background-color: #d5e1f2;
|
||||
border: 1px solid #a3bde3;
|
||||
}
|
||||
.edui-modal-backdrop{
|
||||
opacity: 0.5;
|
||||
filter: alpha(opacity=50);
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: #c6c6c6;
|
||||
}
|
||||
|
||||
.edui-modal .edui-modal-tip {
|
||||
color: red;
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
left: 10px;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
display: none;
|
||||
}
|
||||
/*图片上传*/
|
||||
.edui-dialog-image-body {
|
||||
width: 700px;
|
||||
height: 400px;
|
||||
}
|
||||
/*插入视频*/
|
||||
.edui-dialog-video-body{
|
||||
width: 600px;
|
||||
height: 350px;
|
||||
}
|
||||
/*谷歌地图*/
|
||||
.edui-dialog-gmap-body{
|
||||
width:550px;
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
/*百度地图*/
|
||||
.edui-dialog-map-body{
|
||||
width:580px;
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
/*链接*/
|
||||
.edui-dialog-link-body{
|
||||
width:400px;
|
||||
height:200px;
|
||||
}
|
||||
.edui-popup{
|
||||
display: none;
|
||||
background: url('../images/pop-bg.png') repeat #fff;
|
||||
padding: 2px;
|
||||
}
|
||||
.edui-popup .edui-popup-body{
|
||||
border: 1px solid #bfbfbf;
|
||||
background-color: #fff;
|
||||
}
|
||||
.edui-popup .edui-popup-caret{
|
||||
width: 21px;
|
||||
height: 11px;
|
||||
}
|
||||
.edui-popup .edui-popup-caret.up{
|
||||
background:url('../images/caret.png') no-repeat 0 0;
|
||||
}
|
||||
.edui-popup .edui-popup-caret.down{
|
||||
background:url('../images/caret.png') no-repeat 0 0;
|
||||
}
|
||||
|
||||
|
||||
.edui-tab-nav {
|
||||
margin: 0;
|
||||
padding:0;
|
||||
border-bottom: 1px solid #ddd;
|
||||
list-style: none;
|
||||
height:30px;
|
||||
}
|
||||
.edui-tab-nav .edui-tab-item {
|
||||
float:left;
|
||||
margin-bottom: -1px;
|
||||
margin-top: 1px;
|
||||
margin-top: 0\9;
|
||||
}
|
||||
.edui-tab-nav .edui-tab-item .edui-tab-text{
|
||||
display: block;
|
||||
padding:8px 12px;
|
||||
border: 1px solid transparent;
|
||||
color: #0088cc;
|
||||
text-decoration: none;
|
||||
outline: 0;
|
||||
_border:1px solid #fff ;
|
||||
cursor: pointer;
|
||||
}
|
||||
.edui-tab-nav .edui-tab-item .edui-tab-text:FOCUS {
|
||||
outline: none;
|
||||
}
|
||||
.edui-tab-nav .edui-tab-item.edui-active .edui-tab-text{
|
||||
border: 1px solid #ddd;
|
||||
border-bottom-color: transparent;
|
||||
background-color: #fff;
|
||||
padding:8px 12px;
|
||||
color: #555555;
|
||||
cursor: default;
|
||||
}
|
||||
.edui-tab-content .edui-tab-pane{
|
||||
padding: 1px;
|
||||
position: relative;
|
||||
display: none;
|
||||
background-color: #fff;
|
||||
clear: both;
|
||||
}
|
||||
.edui-tab-content .edui-tab-pane.edui-active{
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
.edui-btn-toolbar .edui-tooltip{
|
||||
position: absolute;
|
||||
padding: 5px 0;
|
||||
display: none;
|
||||
/*opacity: 0.8;*/
|
||||
/*filter: alpha(opacity=80);*/
|
||||
z-index: 99999;
|
||||
}
|
||||
.edui-tooltip .edui-tooltip-arrow{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
_top: -2px;
|
||||
left: 50%;
|
||||
width: 0;
|
||||
height: 0;
|
||||
padding: 0;
|
||||
font-size:0;
|
||||
margin-left: -5px;
|
||||
border-color: transparent;
|
||||
border-style: dashed dashed solid dashed;
|
||||
border-bottom-color: #000000;
|
||||
border-width: 0 5px 5px;
|
||||
background: transparent;
|
||||
}
|
||||
.edui-tooltip .edui-tooltip-inner{
|
||||
padding: 6px;
|
||||
color: #ffffff;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
font-size: 10px;
|
||||
background-color: #000000;
|
||||
white-space: nowrap;
|
||||
line-height: 12px;
|
||||
}
|
||||
.edui-splitbutton-color-label {
|
||||
width: 16px;
|
||||
height: 3px;
|
||||
position: absolute;
|
||||
bottom: 2px;
|
||||
left: 50%;
|
||||
margin-left: -8px;
|
||||
overflow: hidden;
|
||||
line-height: 3px;
|
||||
}
|
||||
.edui-popup .edui-colorpicker {
|
||||
margin: 10px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.edui-colorpicker .edui-colorpicker-topbar{
|
||||
height: 27px;
|
||||
width: 200px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.edui-colorpicker .edui-colorpicker-topbar .edui-colorpicker-preview{
|
||||
height: 20px;
|
||||
border: 1px inset black;
|
||||
margin-left: 1px;
|
||||
width: 128px;
|
||||
float: left;
|
||||
}
|
||||
.edui-colorpicker .edui-colorpicker-topbar .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 table{
|
||||
border-collapse: collapse;
|
||||
border-spacing: 2px;
|
||||
}
|
||||
.edui-colorpicker tr.edui-colorpicker-firstrow{
|
||||
height: 30px;
|
||||
}
|
||||
.edui-colorpicker table td{
|
||||
padding: 0 2px;
|
||||
}
|
||||
.edui-colorpicker table td .edui-colorpicker-colorcell{
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
margin: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
.edui-toolbar .edui-separator{
|
||||
width: 2px;
|
||||
height: 20px;
|
||||
padding: 1px 2px;
|
||||
background: url(../images/icons.png) -179px 1px;
|
||||
background: url(../images/icons.gif) -179px 1px \9;
|
||||
display: inline-block ;
|
||||
vertical-align: top;
|
||||
*display: inline ;
|
||||
*zoom:1;
|
||||
border:none;
|
||||
|
||||
}
|
||||
8
public/static/libs/umeditor/themes/default/css/umeditor.min.css
vendored
Normal file
BIN
public/static/libs/umeditor/themes/default/images/caret.png
Normal file
|
After Width: | Height: | Size: 293 B |
BIN
public/static/libs/umeditor/themes/default/images/close.png
Normal file
|
After Width: | Height: | Size: 291 B |
BIN
public/static/libs/umeditor/themes/default/images/icons.gif
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
public/static/libs/umeditor/themes/default/images/icons.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
public/static/libs/umeditor/themes/default/images/ok.gif
Normal file
|
After Width: | Height: | Size: 866 B |
BIN
public/static/libs/umeditor/themes/default/images/pop-bg.png
Normal file
|
After Width: | Height: | Size: 1003 B |
BIN
public/static/libs/umeditor/themes/default/images/spacer.gif
Normal file
|
After Width: | Height: | Size: 43 B |
BIN
public/static/libs/umeditor/themes/default/images/videologo.gif
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
6
public/static/libs/umeditor/third-party/jquery.min.js
vendored
Normal file
BIN
public/static/libs/umeditor/third-party/mathquill/font/Symbola.eot
vendored
Normal file
BIN
public/static/libs/umeditor/third-party/mathquill/font/Symbola.otf
vendored
Normal file
5102
public/static/libs/umeditor/third-party/mathquill/font/Symbola.svg
vendored
Normal file
|
After Width: | Height: | Size: 2.1 MiB |
BIN
public/static/libs/umeditor/third-party/mathquill/font/Symbola.ttf
vendored
Normal file
BIN
public/static/libs/umeditor/third-party/mathquill/font/Symbola.woff
vendored
Normal file
103
public/static/libs/umeditor/third-party/mathquill/font/stixgeneral-bundle/STIXFontLicense2010.txt
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
STIX Font License
|
||||
|
||||
24 May 2010
|
||||
|
||||
Copyright (c) 2001-2010 by the STI Pub Companies, consisting of the American
|
||||
Institute of Physics, the American Chemical Society, the American Mathematical
|
||||
Society, the American Physical Society, Elsevier, Inc., and The Institute of
|
||||
Electrical and Electronic Engineers, Inc. (www.stixfonts.org), with Reserved
|
||||
Font Name STIX Fonts, STIX Fonts (TM) is a trademark of The Institute of
|
||||
Electrical and Electronics Engineers, Inc.
|
||||
|
||||
Portions copyright (c) 1998-2003 by MicroPress, Inc. (www.micropress-inc.com),
|
||||
with Reserved Font Name TM Math. To obtain additional mathematical fonts, please
|
||||
contact MicroPress, Inc., 68-30 Harrow Street, Forest Hills, NY 11375, USA,
|
||||
Phone: (718) 575-1816.
|
||||
|
||||
Portions copyright (c) 1990 by Elsevier, Inc.
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide development
|
||||
of collaborative font projects, to support the font creation efforts of academic
|
||||
and linguistic communities, and to provide a free and open framework in which
|
||||
fonts may be shared and improved in partnership with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and redistributed
|
||||
freely as long as they are not sold by themselves. The fonts, including any
|
||||
derivative works, can be bundled, embedded, redistributed and/or sold with any
|
||||
software provided that any reserved names are not used by derivative works. The
|
||||
fonts and derivatives, however, cannot be released under any other type of license.
|
||||
The requirement for fonts to remain under this license does not apply to any
|
||||
document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
|
||||
"Font Software" refers to the set of files released by the Copyright Holder(s) under
|
||||
this license and clearly marked as such. This may include source files, build
|
||||
scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the copyright
|
||||
statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting, or
|
||||
substituting -- in part or in whole -- any of the components of the Original Version,
|
||||
by changing formats or by porting the Font Software to a new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical writer or other
|
||||
person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of the
|
||||
Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell
|
||||
modified and unmodified copies of the Font Software, subject to the following
|
||||
conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components, in Original or
|
||||
Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled, redistributed
|
||||
and/or sold with any software, provided that each copy contains the above copyright
|
||||
notice and this license. These can be included either as stand-alone text files,
|
||||
human-readable headers or in the appropriate machine-readable metadata fields within
|
||||
text or binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless
|
||||
explicit written permission is granted by the corresponding Copyright Holder. This
|
||||
restriction only applies to the primary font name as presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall
|
||||
not be used to promote, endorse or advertise any Modified Version, except to
|
||||
acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with
|
||||
their explicit written permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole, must be distributed
|
||||
entirely under this license, and must not be distributed under any other license. The
|
||||
requirement for fonts to remain under this license does not apply to any document
|
||||
created using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
|
||||
This license becomes null and void if any of the above conditions are not met.
|
||||
|
||||
DISCLAIMER
|
||||
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER
|
||||
RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR
|
||||
INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
BIN
public/static/libs/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneral-webfont.eot
vendored
Normal file
3318
public/static/libs/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneral-webfont.svg
vendored
Normal file
|
After Width: | Height: | Size: 1.0 MiB |
BIN
public/static/libs/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneral-webfont.ttf
vendored
Normal file
BIN
public/static/libs/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneral-webfont.woff
vendored
Normal file
BIN
public/static/libs/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralbol-webfont.eot
vendored
Normal file
1738
public/static/libs/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralbol-webfont.svg
vendored
Normal file
|
After Width: | Height: | Size: 533 KiB |
BIN
public/static/libs/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralbol-webfont.ttf
vendored
Normal file
1137
public/static/libs/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralbolita-webfont.svg
vendored
Normal file
|
After Width: | Height: | Size: 415 KiB |
1089
public/static/libs/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralitalic-webfont.svg
vendored
Normal file
|
After Width: | Height: | Size: 397 KiB |
357
public/static/libs/umeditor/third-party/mathquill/mathquill.css
vendored
Normal file
@@ -0,0 +1,357 @@
|
||||
/*
|
||||
* LaTeX Math in pure HTML and CSS -- No images whatsoever
|
||||
* v0.xa
|
||||
* by Jay and Han
|
||||
* Lesser GPL Licensed: http: //www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* This file is automatically included by mathquill.js
|
||||
*
|
||||
*/
|
||||
@font-face {
|
||||
font-family: Symbola;
|
||||
src: url(font/Symbola.eot);
|
||||
src: local("Symbola Regular"), local("Symbola"), url(font/Symbola.ttf) format("truetype"), url(font/Symbola.otf) format("opentype"), url(font/Symbola.svg#Symbola) format("svg");
|
||||
}
|
||||
.mathquill-editable {
|
||||
display: -moz-inline-box;
|
||||
display: inline-block;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.mathquill-editable .cursor {
|
||||
border-left: 1px solid black;
|
||||
margin-right: -1px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
padding: 0;
|
||||
display: -moz-inline-box;
|
||||
display: inline-block;
|
||||
}
|
||||
.mathquill-editable .cursor.blink {
|
||||
visibility: hidden;
|
||||
}
|
||||
.mathquill-editable,
|
||||
.mathquill-embedded-latex .mathquill-editable {
|
||||
border: 1px solid gray;
|
||||
padding: 2px;
|
||||
}
|
||||
.mathquill-embedded-latex .mathquill-editable {
|
||||
margin: 1px;
|
||||
}
|
||||
.mathquill-editable.hasCursor,
|
||||
.mathquill-editable .hasCursor {
|
||||
-webkit-box-shadow: #68b4df 0 0 3px 2px;
|
||||
-moz-box-shadow: #68b4df 0 0 3px 2px;
|
||||
box-shadow: #68b4df 0 0 3px 2px;
|
||||
}
|
||||
.mathquill-editable .latex-command-input {
|
||||
color: inherit;
|
||||
font-family: "Courier New", monospace;
|
||||
border: 1px solid gray;
|
||||
padding-right: 1px;
|
||||
margin-right: 1px;
|
||||
margin-left: 2px;
|
||||
}
|
||||
.mathquill-editable .latex-command-input.empty {
|
||||
background: transparent;
|
||||
}
|
||||
.mathquill-editable .latex-command-input.hasCursor {
|
||||
border-color: ActiveBorder;
|
||||
}
|
||||
.mathquill-editable.empty:after,
|
||||
.mathquill-textbox:after,
|
||||
.mathquill-rendered-math .empty:after {
|
||||
visibility: hidden;
|
||||
content: 'c';
|
||||
}
|
||||
.mathquill-editable .cursor:only-child:after,
|
||||
.mathquill-editable .textarea + .cursor:last-child:after {
|
||||
visibility: hidden;
|
||||
content: 'c';
|
||||
}
|
||||
.mathquill-textbox {
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
.mathquill-rendered-math {
|
||||
font-variant: normal;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-size: 115%;
|
||||
line-height: 1;
|
||||
display: -moz-inline-box;
|
||||
display: inline-block;
|
||||
}
|
||||
.mathquill-rendered-math .non-leaf,
|
||||
.mathquill-rendered-math .scaled {
|
||||
display: -moz-inline-box;
|
||||
display: inline-block;
|
||||
}
|
||||
.mathquill-rendered-math var,
|
||||
.mathquill-rendered-math .text,
|
||||
.mathquill-rendered-math .nonSymbola {
|
||||
font-family: "Times New Roman", Symbola, serif;
|
||||
line-height: .9;
|
||||
}
|
||||
.mathquill-rendered-math * {
|
||||
font-size: inherit;
|
||||
line-height: inherit;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border-color: black;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
.mathquill-rendered-math .empty {
|
||||
background: #ccc;
|
||||
}
|
||||
.mathquill-rendered-math.empty {
|
||||
background: transparent;
|
||||
}
|
||||
.mathquill-rendered-math .text {
|
||||
font-size: 87%;
|
||||
}
|
||||
.mathquill-rendered-math .font {
|
||||
font: 1em "Times New Roman", Symbola, serif;
|
||||
}
|
||||
.mathquill-rendered-math .font * {
|
||||
font-family: inherit;
|
||||
font-style: inherit;
|
||||
}
|
||||
.mathquill-rendered-math b,
|
||||
.mathquill-rendered-math b.font {
|
||||
font-weight: bolder;
|
||||
}
|
||||
.mathquill-rendered-math var,
|
||||
.mathquill-rendered-math i,
|
||||
.mathquill-rendered-math i.font {
|
||||
font-syle: italic;
|
||||
}
|
||||
.mathquill-rendered-math var.florin {
|
||||
margin: 0 -0.1em;
|
||||
}
|
||||
.mathquill-rendered-math big {
|
||||
font-size: 125%;
|
||||
}
|
||||
.mathquill-rendered-math .roman {
|
||||
font-style: normal;
|
||||
}
|
||||
.mathquill-rendered-math .sans-serif {
|
||||
font-family: sans-serif, Symbola, serif;
|
||||
}
|
||||
.mathquill-rendered-math .monospace {
|
||||
font-family: monospace, Symbola, serif;
|
||||
}
|
||||
.mathquill-rendered-math .overline {
|
||||
border-top: 1px solid black;
|
||||
margin-top: 1px;
|
||||
}
|
||||
.mathquill-rendered-math .underline {
|
||||
border-bottom: 1px solid black;
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
.mathquill-rendered-math .binary-operator {
|
||||
padding: 0 0.2em;
|
||||
display: -moz-inline-box;
|
||||
display: inline-block;
|
||||
}
|
||||
.mathquill-rendered-math .unary-operator {
|
||||
padding-left: 0.2em;
|
||||
}
|
||||
.mathquill-rendered-math sup,
|
||||
.mathquill-rendered-math sub {
|
||||
position: relative;
|
||||
font-size: 90%;
|
||||
}
|
||||
.mathquill-rendered-math sup .binary-operator,
|
||||
.mathquill-rendered-math sub .binary-operator {
|
||||
padding: 0 .1em;
|
||||
}
|
||||
.mathquill-rendered-math sup .unary-operator,
|
||||
.mathquill-rendered-math sub .unary-operator {
|
||||
padding-left: .1em;
|
||||
}
|
||||
.mathquill-rendered-math sup.limit,
|
||||
.mathquill-rendered-math sub.limit,
|
||||
.mathquill-rendered-math sup.nthroot,
|
||||
.mathquill-rendered-math sub.nthroot {
|
||||
font-size: 80%;
|
||||
}
|
||||
.mathquill-rendered-math sup .fraction,
|
||||
.mathquill-rendered-math sub .fraction {
|
||||
font-size: 70%;
|
||||
vertical-align: -0.4em;
|
||||
}
|
||||
.mathquill-rendered-math sup .numerator,
|
||||
.mathquill-rendered-math sub .numerator {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
.mathquill-rendered-math sup .denominator,
|
||||
.mathquill-rendered-math sub .denominator {
|
||||
padding-top: 0;
|
||||
}
|
||||
.mathquill-rendered-math sup {
|
||||
vertical-align: .5em;
|
||||
}
|
||||
.mathquill-rendered-math sup.limit,
|
||||
.mathquill-rendered-math sup.nthroot {
|
||||
vertical-align: 0.8em;
|
||||
}
|
||||
.mathquill-rendered-math sup.nthroot {
|
||||
margin-right: -0.6em;
|
||||
margin-left: .2em;
|
||||
min-width: .5em;
|
||||
}
|
||||
.mathquill-rendered-math sub {
|
||||
vertical-align: -0.4em;
|
||||
}
|
||||
.mathquill-rendered-math sub.limit {
|
||||
vertical-align: -0.6em;
|
||||
}
|
||||
.mathquill-rendered-math .paren {
|
||||
padding: 0 .1em;
|
||||
vertical-align: bottom;
|
||||
-webkit-transform-origin: bottom center;
|
||||
-moz-transform-origin: bottom center;
|
||||
-ms-transform-origin: bottom center;
|
||||
-o-transform-origin: bottom center;
|
||||
transform-origin: bottom center;
|
||||
}
|
||||
.mathquill-rendered-math .array {
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
}
|
||||
.mathquill-rendered-math .array > span {
|
||||
display: block;
|
||||
}
|
||||
.mathquill-rendered-math .non-italicized-function {
|
||||
font-family: Symbola, "Times New Roman", serif;
|
||||
line-height: .9;
|
||||
font-style: normal;
|
||||
padding-right: .2em;
|
||||
}
|
||||
.mathquill-rendered-math .fraction {
|
||||
font-size: 90%;
|
||||
text-align: center;
|
||||
vertical-align: -0.5em;
|
||||
padding: 0 .2em;
|
||||
}
|
||||
.mathquill-rendered-math .fraction,
|
||||
.mathquill-rendered-math x:-moz-any-link {
|
||||
display: -moz-groupbox;
|
||||
}
|
||||
.mathquill-rendered-math .fraction,
|
||||
.mathquill-rendered-math x:-moz-any-link,
|
||||
.mathquill-rendered-math x:default {
|
||||
display: inline-block;
|
||||
}
|
||||
.mathquill-rendered-math .numerator,
|
||||
.mathquill-rendered-math .denominator {
|
||||
display: block;
|
||||
}
|
||||
.mathquill-rendered-math .numerator {
|
||||
padding: 0 0.1em;
|
||||
margin-bottom: -0.1em;
|
||||
}
|
||||
.mathquill-rendered-math .denominator {
|
||||
border-top: 1px solid;
|
||||
float: right;
|
||||
width: 100%;
|
||||
padding: .1em .1em 0 .1em;
|
||||
margin-right: -0.1em;
|
||||
margin-left: -0.1em;
|
||||
}
|
||||
.mathquill-rendered-math .sqrt-prefix {
|
||||
padding-top: 0;
|
||||
position: relative;
|
||||
top: .1em;
|
||||
vertical-align: top;
|
||||
-webkit-transform-origin: top;
|
||||
-moz-transform-origin: top;
|
||||
-ms-transform-origin: top;
|
||||
-o-transform-origin: top;
|
||||
transform-origin: top;
|
||||
}
|
||||
.mathquill-rendered-math .sqrt-stem {
|
||||
border-top: 1px solid;
|
||||
margin-top: 1px;
|
||||
padding-left: .15em;
|
||||
padding-right: .2em;
|
||||
margin-right: .1em;
|
||||
}
|
||||
.mathquill-rendered-math .vector-prefix {
|
||||
display: block;
|
||||
text-align: center;
|
||||
line-height: .25em;
|
||||
margin-bottom: -0.1em;
|
||||
font-size: 0.75em;
|
||||
}
|
||||
.mathquill-rendered-math .vector-stem {
|
||||
display: block;
|
||||
}
|
||||
.mathquill-rendered-math,
|
||||
.mathquill-rendered-math .mathquill-editable {
|
||||
cursor: text;
|
||||
font-family: Symbola, "Times New Roman", serif;
|
||||
}
|
||||
.mathquill-rendered-math .selection,
|
||||
.mathquill-editable .selection,
|
||||
.mathquill-rendered-math .selection .non-leaf,
|
||||
.mathquill-editable .selection .non-leaf,
|
||||
.mathquill-rendered-math .selection .scaled,
|
||||
.mathquill-editable .selection .scaled {
|
||||
background: #B4D5FE !important;
|
||||
background: Highlight !important;
|
||||
color: HighlightText;
|
||||
border-color: HighlightText;
|
||||
}
|
||||
.mathquill-rendered-math .selection .matrixed,
|
||||
.mathquill-editable .selection .matrixed {
|
||||
background: #39F !important;
|
||||
}
|
||||
.mathquill-rendered-math .selection .matrixed-container,
|
||||
.mathquill-editable .selection .matrixed-container {
|
||||
filter: progid:DXImageTransform.Microsoft.Chroma(color='#3399FF') !important;
|
||||
}
|
||||
.mathquill-rendered-math .selection.blur,
|
||||
.mathquill-editable .selection.blur,
|
||||
.mathquill-rendered-math .selection.blur .non-leaf,
|
||||
.mathquill-editable .selection.blur .non-leaf,
|
||||
.mathquill-rendered-math .selection.blur .scaled,
|
||||
.mathquill-editable .selection.blur .scaled,
|
||||
.mathquill-rendered-math .selection.blur .matrixed,
|
||||
.mathquill-editable .selection.blur .matrixed {
|
||||
background: #D4D4D4 !important;
|
||||
color: black;
|
||||
border-color: black;
|
||||
}
|
||||
.mathquill-rendered-math .selection.blur .matrixed-container,
|
||||
.mathquill-editable .selection.blur .matrixed-container {
|
||||
filter: progid:DXImageTransform.Microsoft.Chroma(color='#D4D4D4') !important;
|
||||
}
|
||||
.mathquill-editable .textarea,
|
||||
.mathquill-rendered-math .textarea {
|
||||
position: relative;
|
||||
-webkit-user-select: text;
|
||||
-moz-user-select: text;
|
||||
user-select: text;
|
||||
}
|
||||
.mathquill-editable .textarea textarea,
|
||||
.mathquill-rendered-math .textarea textarea,
|
||||
.mathquill-editable .selectable,
|
||||
.mathquill-rendered-math .selectable {
|
||||
-webkit-user-select: text;
|
||||
-moz-user-select: text;
|
||||
user-select: text;
|
||||
position: absolute;
|
||||
clip: rect(1em 1em 1em 1em);
|
||||
}
|
||||
.mathquill-rendered-math .matrixed {
|
||||
background: white;
|
||||
display: -moz-inline-box;
|
||||
display: inline-block;
|
||||
}
|
||||
.mathquill-rendered-math .matrixed-container {
|
||||
filter: progid:DXImageTransform.Microsoft.Chroma(color='white');
|
||||
margin-top: -0.1em;
|
||||
}
|
||||
3888
public/static/libs/umeditor/third-party/mathquill/mathquill.js
vendored
Normal file
2
public/static/libs/umeditor/third-party/mathquill/mathquill.min.js
vendored
Normal file
9
public/static/libs/umeditor/third-party/template.min.js
vendored
Normal file
329
public/static/libs/umeditor/umeditor.config.js
Normal file
@@ -0,0 +1,329 @@
|
||||
/**
|
||||
* umeditor完整配置项
|
||||
* 可以在这里配置整个编辑器的特性
|
||||
*/
|
||||
/**************************提示********************************
|
||||
* 所有被注释的配置项均为UEditor默认值。
|
||||
* 修改默认配置请首先确保已经完全明确该参数的真实用途。
|
||||
* 主要有两种修改方案,一种是取消此处注释,然后修改成对应参数;另一种是在实例化编辑器时传入对应参数。
|
||||
* 当升级编辑器时,可直接使用旧版配置文件替换新版配置文件,不用担心旧版配置文件中因缺少新功能所需的参数而导致脚本报错。
|
||||
**************************提示********************************/
|
||||
|
||||
etpl.config({
|
||||
commandOpen: '<%',
|
||||
commandClose: '%>'
|
||||
});
|
||||
|
||||
(function () {
|
||||
/**
|
||||
* 编辑器资源文件根路径。它所表示的含义是:以编辑器实例化页面为当前路径,指向编辑器资源文件(即dialog等文件夹)的路径。
|
||||
* 鉴于很多同学在使用编辑器的时候出现的种种路径问题,此处强烈建议大家使用"相对于网站根目录的相对路径"进行配置。
|
||||
* "相对于网站根目录的相对路径"也就是以斜杠开头的形如"/myProject/umeditor/"这样的路径。
|
||||
* 如果站点中有多个不在同一层级的页面需要实例化编辑器,且引用了同一UEditor的时候,此处的URL可能不适用于每个页面的编辑器。
|
||||
* 因此,UEditor提供了针对不同页面的编辑器可单独配置的根路径,具体来说,在需要实例化编辑器的页面最顶部写上如下代码即可。当然,需要令此处的URL等于对应的配置。
|
||||
* window.UMEDITOR_HOME_URL = "/xxxx/xxxx/";
|
||||
*/
|
||||
var URL = window.UMEDITOR_HOME_URL || (function(){
|
||||
|
||||
function PathStack() {
|
||||
|
||||
this.documentURL = self.document.URL || self.location.href;
|
||||
|
||||
this.separator = '/';
|
||||
this.separatorPattern = /\\|\//g;
|
||||
this.currentDir = './';
|
||||
this.currentDirPattern = /^[.]\/]/;
|
||||
|
||||
this.path = this.documentURL;
|
||||
this.stack = [];
|
||||
|
||||
this.push( this.documentURL );
|
||||
|
||||
}
|
||||
|
||||
PathStack.isParentPath = function( path ){
|
||||
return path === '..';
|
||||
};
|
||||
|
||||
PathStack.hasProtocol = function( path ){
|
||||
return !!PathStack.getProtocol( path );
|
||||
};
|
||||
|
||||
PathStack.getProtocol = function( path ){
|
||||
|
||||
var protocol = /^[^:]*:\/*/.exec( path );
|
||||
|
||||
return protocol ? protocol[0] : null;
|
||||
|
||||
};
|
||||
|
||||
PathStack.prototype = {
|
||||
push: function( path ){
|
||||
|
||||
this.path = path;
|
||||
|
||||
update.call( this );
|
||||
parse.call( this );
|
||||
|
||||
return this;
|
||||
|
||||
},
|
||||
getPath: function(){
|
||||
return this + "";
|
||||
},
|
||||
toString: function(){
|
||||
return this.protocol + ( this.stack.concat( [''] ) ).join( this.separator );
|
||||
}
|
||||
};
|
||||
|
||||
function update() {
|
||||
|
||||
var protocol = PathStack.getProtocol( this.path || '' );
|
||||
|
||||
if( protocol ) {
|
||||
|
||||
//根协议
|
||||
this.protocol = protocol;
|
||||
|
||||
//local
|
||||
this.localSeparator = /\\|\//.exec( this.path.replace( protocol, '' ) )[0];
|
||||
|
||||
this.stack = [];
|
||||
} else {
|
||||
protocol = /\\|\//.exec( this.path );
|
||||
protocol && (this.localSeparator = protocol[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function parse(){
|
||||
|
||||
var parsedStack = this.path.replace( this.currentDirPattern, '' );
|
||||
|
||||
if( PathStack.hasProtocol( this.path ) ) {
|
||||
parsedStack = parsedStack.replace( this.protocol , '');
|
||||
}
|
||||
|
||||
parsedStack = parsedStack.split( this.localSeparator );
|
||||
parsedStack.length = parsedStack.length - 1;
|
||||
|
||||
for(var i= 0,tempPath,l=parsedStack.length,root = this.stack;i<l;i++){
|
||||
tempPath = parsedStack[i];
|
||||
if(tempPath){
|
||||
if( PathStack.isParentPath( tempPath ) ) {
|
||||
root.pop();
|
||||
} else {
|
||||
root.push( tempPath );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
var currentPath = document.getElementsByTagName('script');
|
||||
|
||||
currentPath = currentPath[ currentPath.length -1 ].src;
|
||||
|
||||
return new PathStack().push( currentPath ) + "";
|
||||
|
||||
|
||||
})();
|
||||
|
||||
/**
|
||||
* 配置项主体。注意,此处所有涉及到路径的配置别遗漏URL变量。
|
||||
*/
|
||||
window.UMEDITOR_CONFIG = {
|
||||
|
||||
//为编辑器实例添加一个路径,这个不能被注释
|
||||
UMEDITOR_HOME_URL : URL
|
||||
|
||||
//图片上传配置区
|
||||
// ,imageUrl:URL+"php/imageUp.php" //图片上传提交地址
|
||||
,imageUrl:"/admin/system.system_attachment/upload" //图片上传提交地址
|
||||
,imagePath:"/" //图片修正地址,引用了fixedImagePath,如有特殊需求,可自行配置
|
||||
,imageFieldName:"upfile" //图片数据的key,若此处修改,需要在后台对应文件修改对应参数
|
||||
|
||||
|
||||
//工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的从新定义
|
||||
,toolbar:[
|
||||
'source | undo redo | bold italic underline strikethrough | superscript subscript | forecolor backcolor | removeformat |',
|
||||
'insertorderedlist insertunorderedlist | selectall cleardoc paragraph | fontfamily fontsize' ,
|
||||
'| justifyleft justifycenter justifyright justifyjustify |',
|
||||
'link unlink | emotion image video | map',
|
||||
'| horizontal print preview fullscreen', 'drafts', 'formula'
|
||||
]
|
||||
|
||||
//语言配置项,默认是zh-cn。有需要的话也可以使用如下这样的方式来自动多语言切换,当然,前提条件是lang文件夹下存在对应的语言文件:
|
||||
//lang值也可以通过自动获取 (navigator.language||navigator.browserLanguage ||navigator.userLanguage).toLowerCase()
|
||||
//,lang:"zh-cn"
|
||||
//,langPath:URL +"lang/"
|
||||
|
||||
//ie下的链接自动监测
|
||||
//,autourldetectinie:false
|
||||
|
||||
//主题配置项,默认是default。有需要的话也可以使用如下这样的方式来自动多主题切换,当然,前提条件是themes文件夹下存在对应的主题文件:
|
||||
//现有如下皮肤:default
|
||||
//,theme:'default'
|
||||
//,themePath:URL +"themes/"
|
||||
|
||||
|
||||
|
||||
//针对getAllHtml方法,会在对应的head标签中增加该编码设置。
|
||||
//,charset:"utf-8"
|
||||
|
||||
//常用配置项目
|
||||
//,isShow : true //默认显示编辑器
|
||||
|
||||
//,initialContent:'欢迎使用UMEDITOR!' //初始化编辑器的内容,也可以通过textarea/script给值,看官网例子
|
||||
|
||||
//,initialFrameWidth:500 //初始化编辑器宽度,默认500
|
||||
//,initialFrameHeight:500 //初始化编辑器高度,默认500
|
||||
|
||||
//,autoClearinitialContent:true //是否自动清除编辑器初始内容,注意:如果focus属性设置为true,这个也为真,那么编辑器一上来就会触发导致初始化的内容看不到了
|
||||
|
||||
//,textarea:'editorValue' // 提交表单时,服务器获取编辑器提交内容的所用的参数,多实例时可以给容器name属性,会将name给定的值最为每个实例的键值,不用每次实例化的时候都设置这个值
|
||||
|
||||
//,focus:false //初始化时,是否让编辑器获得焦点true或false
|
||||
|
||||
//,autoClearEmptyNode : true //getContent时,是否删除空的inlineElement节点(包括嵌套的情况)
|
||||
|
||||
//,fullscreen : false //是否开启初始化时即全屏,默认关闭
|
||||
|
||||
//,readonly : false //编辑器初始化结束后,编辑区域是否是只读的,默认是false
|
||||
|
||||
//,zIndex : 900 //编辑器层级的基数,默认是900
|
||||
|
||||
//如果自定义,最好给p标签如下的行高,要不输入中文时,会有跳动感
|
||||
//注意这里添加的样式,最好放在.edui-editor-body .edui-body-container这两个的下边,防止跟页面上css冲突
|
||||
//,initialStyle:'.edui-editor-body .edui-body-container p{line-height:1em}'
|
||||
|
||||
//,autoSyncData:true //自动同步编辑器要提交的数据
|
||||
|
||||
//,emotionLocalization:false //是否开启表情本地化,默认关闭。若要开启请确保emotion文件夹下包含官网提供的images表情文件夹
|
||||
|
||||
//,allHtmlEnabled:false //提交到后台的数据是否包含整个html字符串
|
||||
|
||||
//fontfamily
|
||||
//字体设置
|
||||
// ,'fontfamily':[
|
||||
// { name: 'songti', val: '宋体,SimSun'},
|
||||
// ]
|
||||
|
||||
//fontsize
|
||||
//字号
|
||||
//,'fontsize':[10, 11, 12, 14, 16, 18, 20, 24, 36]
|
||||
|
||||
//paragraph
|
||||
//段落格式 值留空时支持多语言自动识别,若配置,则以配置值为准
|
||||
//,'paragraph':{'p':'', 'h1':'', 'h2':'', 'h3':'', 'h4':'', 'h5':'', 'h6':''}
|
||||
|
||||
//undo
|
||||
//可以最多回退的次数,默认20
|
||||
//,maxUndoCount:20
|
||||
//当输入的字符数超过该值时,保存一次现场
|
||||
//,maxInputCount:1
|
||||
|
||||
//imageScaleEnabled
|
||||
// 是否允许点击文件拖拽改变大小,默认true
|
||||
//,imageScaleEnabled:true
|
||||
|
||||
//dropFileEnabled
|
||||
// 是否允许拖放图片到编辑区域,上传并插入,默认true
|
||||
//,dropFileEnabled:true
|
||||
|
||||
//pasteImageEnabled
|
||||
// 是否允许粘贴QQ截屏,上传并插入,默认true
|
||||
//,pasteImageEnabled:true
|
||||
|
||||
//autoHeightEnabled
|
||||
// 是否自动长高,默认true
|
||||
//,autoHeightEnabled:true
|
||||
|
||||
//autoFloatEnabled
|
||||
//是否保持toolbar的位置不动,默认true
|
||||
//,autoFloatEnabled:true
|
||||
|
||||
//浮动时工具栏距离浏览器顶部的高度,用于某些具有固定头部的页面
|
||||
//,topOffset:30
|
||||
|
||||
//填写过滤规则
|
||||
,filterRules: {}
|
||||
// xss 过滤是否开启,inserthtml等操作
|
||||
,xssFilterRules: true
|
||||
//input xss过滤
|
||||
,inputXssFilter: true
|
||||
//output xss过滤
|
||||
,outputXssFilter: true
|
||||
// xss过滤白名单 名单来源: https://raw.githubusercontent.com/leizongmin/js-xss/master/lib/default.js
|
||||
,whiteList: {
|
||||
a: ['target', 'href', 'title', 'style', 'class', 'id'],
|
||||
abbr: ['title', 'style', 'class', 'id'],
|
||||
address: ['style', 'class', 'id'],
|
||||
area: ['shape', 'coords', 'href', 'alt', 'style', 'class', 'id'],
|
||||
article: ['style', 'class', 'id'],
|
||||
aside: ['style', 'class', 'id'],
|
||||
audio: ['autoplay', 'controls', 'loop', 'preload', 'src', 'style', 'class', 'id'],
|
||||
b: ['style', 'class', 'id'],
|
||||
bdi: ['dir'],
|
||||
bdo: ['dir'],
|
||||
big: [],
|
||||
blockquote: ['cite', 'style', 'class', 'id'],
|
||||
br: [],
|
||||
caption: ['style', 'class', 'id'],
|
||||
center: [],
|
||||
cite: [],
|
||||
code: ['style', 'class', 'id'],
|
||||
col: ['align', 'valign', 'span', 'width', 'style', 'class', 'id'],
|
||||
colgroup: ['align', 'valign', 'span', 'width', 'style', 'class', 'id'],
|
||||
dd: ['style', 'class', 'id'],
|
||||
del: ['datetime', 'style', 'class', 'id'],
|
||||
details: ['open', 'style', 'class', 'id'],
|
||||
div: ['style', 'class', 'id'],
|
||||
dl: ['style', 'class', 'id'],
|
||||
dt: ['style', 'class', 'id'],
|
||||
em: ['style', 'class', 'id'],
|
||||
embed: ['style', 'class', 'id', '_url', 'type', 'pluginspage', 'src', 'width', 'height', 'wmode', 'play', 'loop', 'menu', 'allowscriptaccess', 'allowfullscreen'],
|
||||
font: ['color', 'size', 'face', 'style', 'class', 'id'],
|
||||
footer: ['style', 'class', 'id'],
|
||||
h1: ['style', 'class', 'id'],
|
||||
h2: ['style', 'class', 'id'],
|
||||
h3: ['style', 'class', 'id'],
|
||||
h4: ['style', 'class', 'id'],
|
||||
h5: ['style', 'class', 'id'],
|
||||
h6: ['style', 'class', 'id'],
|
||||
header: ['style', 'class', 'id'],
|
||||
hr: ['style', 'class', 'id'],
|
||||
i: ['style', 'class', 'id'],
|
||||
iframe: ['style', 'class', 'id', 'src', 'frameborder', 'data-latex'],
|
||||
img: ['src', 'alt', 'title', 'width', 'height', 'style', 'class', 'id', '_url'],
|
||||
ins: ['datetime', 'style', 'class', 'id'],
|
||||
li: ['style', 'class', 'id'],
|
||||
mark: [],
|
||||
nav: [],
|
||||
ol: ['style', 'class', 'id'],
|
||||
p: ['style', 'class', 'id'],
|
||||
pre: ['style', 'class', 'id'],
|
||||
s: [],
|
||||
section:[],
|
||||
small: ['style', 'class', 'id'],
|
||||
span: ['style', 'class', 'id'],
|
||||
sub: ['style', 'class', 'id'],
|
||||
sup: ['style', 'class', 'id'],
|
||||
strong: ['style', 'class', 'id'],
|
||||
table: ['width', 'border', 'align', 'valign', 'style', 'class', 'id'],
|
||||
tbody: ['align', 'valign', 'style', 'class', 'id'],
|
||||
td: ['width', 'rowspan', 'colspan', 'align', 'valign', 'style', 'class', 'id'],
|
||||
tfoot: ['align', 'valign', 'style', 'class', 'id'],
|
||||
th: ['width', 'rowspan', 'colspan', 'align', 'valign', 'style', 'class', 'id'],
|
||||
thead: ['align', 'valign', 'style', 'class', 'id'],
|
||||
tr: ['rowspan', 'align', 'valign', 'style', 'class', 'id'],
|
||||
tt: ['style', 'class', 'id'],
|
||||
u: [],
|
||||
ul: ['style', 'class', 'id'],
|
||||
svg: ['style', 'class', 'id', 'width', 'height', 'xmlns', 'fill', 'viewBox'],
|
||||
video: ['autoplay', 'controls', 'loop', 'preload', 'src', 'height', 'width', 'style', 'class', 'id']
|
||||
}
|
||||
};
|
||||
})();
|
||||
11015
public/static/libs/umeditor/umeditor.js
Normal file
273
public/static/libs/umeditor/umeditor.min.js
vendored
Normal file
@@ -0,0 +1,273 @@
|
||||
/*
|
||||
UEditor Mini??
|
||||
version: 1.2.2
|
||||
build: Fri Feb 10 2017 15:00:06 GMT+0800 (CST)
|
||||
*/
|
||||
var $jscomp={scope:{},findInternal:function(g,B,w){g instanceof String&&(g=String(g));for(var x=g.length,m=0;m<x;m++){var E=g[m];if(B.call(w,E,m,g))return{i:m,v:E}}return{i:-1,v:void 0}}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(g,B,w){if(w.get||w.set)throw new TypeError("ES3 does not support getters and setters.");g!=Array.prototype&&g!=Object.prototype&&(g[B]=w.value)};
|
||||
$jscomp.getGlobal=function(g){return"undefined"!=typeof window&&window===g?g:"undefined"!=typeof global&&null!=global?global:g};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(g,B,w,x){if(B){w=$jscomp.global;g=g.split(".");for(x=0;x<g.length-1;x++){var m=g[x];m in w||(w[m]={});w=w[m]}g=g[g.length-1];x=w[g];B=B(x);B!=x&&null!=B&&$jscomp.defineProperty(w,g,{configurable:!0,writable:!0,value:B})}};
|
||||
$jscomp.polyfill("Array.prototype.find",function(g){return g?g:function(g,w){return $jscomp.findInternal(this,g,w).v}},"es6-impl","es3");
|
||||
(function(g){function B(a,b,d){var c;b=b.toLowerCase();return(c=a.__allListeners||d&&(a.__allListeners={}))&&(c[b]||d&&(c[b]=[]))}function w(a,b,d,c,f,h){c=c&&a[b];var e;for(!c&&(c=a[d]);!c&&(e=(e||a).parentNode);){if("BODY"==e.tagName||h&&!h(e))return null;c=e[d]}return c&&f&&!f(c)?w(c,b,d,!1,f):c}UMEDITOR_CONFIG=window.UMEDITOR_CONFIG||{};window.UM={plugins:{},commands:{},I18N:{},version:"1.2.2"};var x=UM.dom={},m=UM.browser=function(){var a=navigator.userAgent.toLowerCase(),b=window.opera,d={ie:/(msie\s|trident.*rv:)([\w.]+)/.test(a),
|
||||
opera:!!b&&b.version,webkit:-1<a.indexOf(" applewebkit/"),mac:-1<a.indexOf("macintosh"),quirks:"BackCompat"==document.compatMode};d.gecko="Gecko"==navigator.product&&!d.webkit&&!d.opera&&!d.ie;var c=0;if(d.ie){var c=a.match(/(?:msie\s([\w.]+))/),f=a.match(/(?:trident.*rv:([\w.]+))/),c=c&&f&&c[1]&&f[1]?Math.max(1*c[1],1*f[1]):c&&c[1]?1*c[1]:f&&f[1]?1*f[1]:0;d.ie11Compat=11==document.documentMode;d.ie9Compat=9==document.documentMode;d.ie8=!!document.documentMode;d.ie8Compat=8==document.documentMode;
|
||||
d.ie7Compat=7==c&&!document.documentMode||7==document.documentMode;d.ie6Compat=7>c||d.quirks;d.ie9above=8<c;d.ie9below=9>c}d.gecko&&(f=a.match(/rv:([\d\.]+)/))&&(f=f[1].split("."),c=1E4*f[0]+100*(f[1]||0)+1*(f[2]||0));/chrome\/(\d+\.\d)/i.test(a)&&(d.chrome=+RegExp.$1);/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(a)&&!/chrome/i.test(a)&&(d.safari=+(RegExp.$1||RegExp.$2));d.opera&&(c=parseFloat(b.version()));d.webkit&&(c=parseFloat(a.match(/ applewebkit\/(\d+)/)[1]));d.version=c;d.isCompatible=
|
||||
!d.mobile&&(d.ie&&6<=c||d.gecko&&10801<=c||d.opera&&9.5<=c||d.air&&1<=c||d.webkit&&522<=c||!1);return d}(),E=m.ie,n=UM.utils={each:function(a,b,d){if(null!=a)if(a.length===+a.length)for(var c=0,f=a.length;c<f;c++){if(!1===b.call(d,a[c],c,a))return!1}else for(c in a)if(a.hasOwnProperty(c)&&!1===b.call(d,a[c],c,a))return!1},makeInstance:function(a){var b=new Function;b.prototype=a;a=new b;b.prototype=null;return a},extend:function(a,b,d){if(b)for(var c in b)d&&a.hasOwnProperty(c)||(a[c]=b[c]);return a},
|
||||
extend2:function(a){for(var b=arguments,d=1;d<b.length;d++){var c=b[d],f;for(f in c)a.hasOwnProperty(f)||(a[f]=c[f])}return a},inherits:function(a,b){var d=a.prototype,c=n.makeInstance(b.prototype);n.extend(c,d,!0);a.prototype=c;return c.constructor=a},bind:function(a,b){return function(){return a.apply(b,arguments)}},defer:function(a,b,d){var c;return function(){d&&clearTimeout(c);c=setTimeout(a,b)}},indexOf:function(a,b,d){var c=-1;d=this.isNumber(d)?d:0;this.each(a,function(a,h){if(h>=d&&a===b)return c=
|
||||
h,!1});return c},removeItem:function(a,b){for(var d=0,c=a.length;d<c;d++)a[d]===b&&(a.splice(d,1),d--)},trim:function(a){return a.replace(/(^[ \t\n\r]+)|([ \t\n\r]+$)/g,"")},listToMap:function(a){if(!a)return{};a=n.isArray(a)?a:a.split(",");for(var b=0,d,c={};d=a[b++];)c[d.toUpperCase()]=c[d]=1;return c},unhtml:function(a,b){return a?a.replace(b||/[&<">'](?:(amp|lt|quot|gt|#39|nbsp);)?/g,function(a,b){return b?a:{"<":"<","&":"&",'"':""",">":">","'":"'"}[a]}):""},html:function(a){return a?
|
||||
a.replace(/&((g|l|quo)t|amp|#39);/g,function(a){return{"<":"<","&":"&",""":'"',">":">","'":"'"}[a]}):""},cssStyleToDomStyle:function(){var a=document.createElement("div").style,b={"float":void 0!=a.cssFloat?"cssFloat":void 0!=a.styleFloat?"styleFloat":"float"};return function(a){return b[a]||(b[a]=a.toLowerCase().replace(/-./g,function(a){return a.charAt(1).toUpperCase()}))}}(),loadFile:function(){function a(a,c){try{for(var d=0,h;h=b[d++];)if(h.doc===a&&h.url==(c.src||c.href))return h}catch(e){return null}}
|
||||
var b=[];return function(d,c,f){var h=a(d,c);if(h)h.ready?f&&f():h.funs.push(f);else if(b.push({doc:d,url:c.src||c.href,funs:[f]}),!d.body){f=[];for(var e in c)"tag"!=e&&f.push(e+'="'+c[e]+'"');d.write("<"+c.tag+" "+f.join(" ")+" ></"+c.tag+">")}else if(!c.id||!d.getElementById(c.id)){var l=d.createElement(c.tag);delete c.tag;for(e in c)l.setAttribute(e,c[e]);l.onload=l.onreadystatechange=function(){if(!this.readyState||/loaded|complete/.test(this.readyState)){h=a(d,c);if(0<h.funs.length){h.ready=
|
||||
1;for(var b;b=h.funs.pop();)b()}l.onload=l.onreadystatechange=null}};l.onerror=function(){throw Error("The load "+(c.href||c.src)+" fails,check the url settings of file umeditor.config.js ");};d.getElementsByTagName("head")[0].appendChild(l)}}}(),isEmptyObject:function(a){if(null==a)return!0;if(this.isArray(a)||this.isString(a))return 0===a.length;for(var b in a)if(a.hasOwnProperty(b))return!1;return!0},fixColor:function(a,b){if(/color/i.test(a)&&/rgba?/.test(b)){var d=b.split(",");if(3<d.length)return"";
|
||||
b="#";for(var c=0,f;f=d[c++];)f=parseInt(f.replace(/[^\d]/gi,""),10).toString(16),b+=1==f.length?"0"+f:f;b=b.toUpperCase()}return b},clone:function(a,b){var d;b=b||{};for(var c in a)a.hasOwnProperty(c)&&(d=a[c],"object"==typeof d?(b[c]=n.isArray(d)?[]:{},n.clone(a[c],b[c])):b[c]=d);return b},transUnitToPx:function(a){if(!/(pt|cm)/.test(a))return a;var b;a.replace(/([\d.]+)(\w+)/,function(d,c,f){a=c;b=f});switch(b){case "cm":a=25*parseFloat(a);break;case "pt":a=Math.round(96*parseFloat(a)/72)}return a+
|
||||
(a?"px":"")},cssRule:m.ie&&11!=m.version?function(a,b,d){var c;d=d||document;c=d.indexList?d.indexList:d.indexList={};var f;if(c[a])f=d.styleSheets[c[a]];else{if(void 0===b)return"";f=d.createStyleSheet("",d=d.styleSheets.length);c[a]=d}if(void 0===b)return f.cssText;f.cssText=b||""}:function(a,b,d){d=d||document;var c=d.getElementsByTagName("head")[0],f;if(!(f=d.getElementById(a))){if(void 0===b)return"";f=d.createElement("style");f.id=a;c.appendChild(f)}if(void 0===b)return f.innerHTML;""!==b?f.innerHTML=
|
||||
b:c.removeChild(f)},render:function(a,b){return etpl.compile(a)(b)}};n.each("String Function Array Number RegExp Object".split(" "),function(a){UM.utils["is"+a]=function(b){return Object.prototype.toString.apply(b)=="[object "+a+"]"}});var I=UM.EventBase=function(){};I.prototype={addListener:function(a,b){a=n.trim(a).split(" ");for(var d=0,c;c=a[d++];)B(this,c,!0).push(b)},removeListener:function(a,b){a=n.trim(a).split(" ");for(var d=0,c;c=a[d++];)n.removeItem(B(this,c)||[],b)},fireEvent:function(){for(var a=
|
||||
arguments[0],a=n.trim(a).split(" "),b=0,d;d=a[b++];){var c=B(this,d),f,h,e;if(c)for(e=c.length;e--;)if(c[e]){h=c[e].apply(this,arguments);if(!0===h)return h;void 0!==h&&(f=h)}if(h=this["on"+d.toLowerCase()])f=h.apply(this,arguments)}return f}};var p=x.dtd=function(){function a(a){for(var b in a)a[b.toUpperCase()]=a[b];return a}var b=n.extend2,d=a({isindex:1,fieldset:1}),c=a({input:1,button:1,select:1,textarea:1,label:1}),f=b(a({a:1}),c),h=b({iframe:1},f),e=a({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}),l=a({ins:1,del:1,script:1,style:1}),t=b(a({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}),l),v=b(a({sub:1,img:1,embed:1,object:1,sup:1,basefont:1,map:1,applet:1,font:1,big:1,small:1}),t),r=b(a({p:1}),v),c=b(a({iframe:1}),v,c),v=a({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}),q=b(a({a:0}),c),y=a({tr:1}),g=a({"#":1}),k=b(a({param:1}),v),u=b(a({form:1}),d,h,e,r),m=a({li:1,ol:1,ul:1}),p=a({style:1,script:1}),C=a({base:1,
|
||||
link:1,meta:1,title:1}),p=b(C,p),F=a({head:1,body:1}),z=a({html:1}),D=a({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}),w=a({area:1,base:1,basefont:1,br:1,col:1,command:1,dialog:1,embed:1,hr:1,img:1,input:1,isindex:1,keygen:1,link:1,meta:1,param:1,source:1,track:1,wbr:1});return a({$nonBodyContent:b(z,F,C),$block:D,$inline:q,$inlineWithA:b(a({a:1}),q),$body:b(a({script:1,style:1}),D),$cdata:a({script:1,
|
||||
style:1}),$empty:w,$nonChild:a({iframe:1,textarea:1}),$listItem:a({dd:1,dt:1,li:1}),$list:a({ul:1,ol:1,dl:1}),$isNotEmpty:a({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,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1}),$removeEmpty:a({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:a({p:1,div:1}),$tableContent:a({caption:1,
|
||||
col:1,colgroup:1,tbody:1,td:1,tfoot:1,th:1,thead:1,tr:1,table:1}),$notTransContent:a({pre:1,script:1,style:1,textarea:1}),html:F,head:p,style:g,script:g,body:u,base:{},link:{},meta:{},title:g,col:{},tr:a({td:1,th:1}),img:{},embed:{},colgroup:a({thead:1,col:1,tbody:1,tr:1,tfoot:1}),noscript:u,td:u,br:{},th:u,center:u,kbd:q,button:b(r,e),basefont:{},h5:q,h4:q,samp:q,h6:q,ol:m,h1:q,h3:q,option:g,h2:q,form:b(d,h,e,r),select:a({optgroup:1,option:1}),font:q,ins:q,menu:m,abbr:q,label:q,table:a({thead:1,
|
||||
col:1,tbody:1,tr:1,colgroup:1,caption:1,tfoot:1}),code:q,tfoot:y,cite:q,li:u,input:{},iframe:u,strong:q,textarea:g,noframes:u,big:q,small:q,span:a({"#":1,br:1,b:1,strong:1,u:1,i:1,em:1,sub:1,sup:1,strike:1,span:1}),hr:q,dt:q,sub:q,optgroup:a({option:1}),param:{},bdo:q,"var":q,div:u,object:k,sup:q,dd:u,strike:q,area:{},dir:m,map:b(a({area:1,form:1,p:1}),d,l,e),applet:k,dl:a({dt:1,dd:1}),del:q,isindex:{},fieldset:b(a({legend:1}),v),thead:y,ul:m,acronym:q,b:q,a:b(a({a:1}),c),blockquote:b(a({td:1,tr:1,
|
||||
tbody:1,li:1}),u),caption:q,i:q,u:q,tbody:y,s:q,address:b(h,r),tt:q,legend:q,q:q,pre:b(t,f),p:b(a({a:1}),q),em:q,dfn:q})}(),J=E&&9>m.version?{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"},K=n.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".split(" ")),
|
||||
k=x.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,fillChar:E&&"6"==m.version?"\ufeff":"\u200b",keys:{8:1,46:1,16:1,17:1,18:1,37:1,38:1,39:1,40:1,13:1},breakParent:function(a,b){var d,c=a,f=a,h,e;do{c=c.parentNode;h?(d=c.cloneNode(!1),d.appendChild(h),h=d,d=c.cloneNode(!1),d.appendChild(e),e=d):(h=c.cloneNode(!1),e=h.cloneNode(!1));
|
||||
for(;d=f.previousSibling;)h.insertBefore(d,h.firstChild);for(;d=f.nextSibling;)e.appendChild(d);f=c}while(b!==c);d=b.parentNode;d.insertBefore(h,b);d.insertBefore(e,b);d.insertBefore(a,e);k.remove(b);return a},trimWhiteTextNode:function(a){function b(b){for(var c;(c=a[b])&&3==c.nodeType&&k.isWhitespace(c);)a.removeChild(c)}b("firstChild");b("lastChild")},getPosition:function(a,b){if(a===b)return 0;var d,c=[a],f=[b];for(d=a;d=d.parentNode;){if(d===b)return 10;c.push(d)}for(d=b;d=d.parentNode;){if(d===
|
||||
a)return 20;f.push(d)}c.reverse();f.reverse();if(c[0]!==f[0])return 1;for(d=-1;d++,c[d]===f[d];);a=c[d];for(b=f[d];a=a.nextSibling;)if(a===b)return 4;return 2},getNodeIndex:function(a,b){for(var d=a,c=0;d=d.previousSibling;)b&&3==d.nodeType?d.nodeType!=d.nextSibling.nodeType&&c++:c++;return c},inDoc:function(a,b){return 10==k.getPosition(a,b)},findParent:function(a,b,d){if(a&&!k.isBody(a))for(a=d?a:a.parentNode;a;){if(!b||b(a)||k.isBody(a))return b&&!b(a)&&k.isBody(a)?null:a;a=a.parentNode}return null},
|
||||
findParentByTagName:function(a,b,d,c){b=n.listToMap(n.isArray(b)?b:[b]);return k.findParent(a,function(a){return b[a.tagName]&&!(c&&c(a))},d)},findParents:function(a,b,d,c){for(b=b&&(d&&d(a)||!d)?[a]:[];a=k.findParent(a,d);)b.push(a);return c?b:b.reverse()},insertAfter:function(a,b){return a.parentNode.insertBefore(b,a.nextSibling)},remove:function(a,b){var d=a.parentNode,c;if(d){if(b&&a.hasChildNodes())for(;c=a.firstChild;)d.insertBefore(c,a);d.removeChild(a)}return a},getNextDomNode:function(a,
|
||||
b,d,c){return w(a,"firstChild","nextSibling",b,d,c)},getPreDomNode:function(a,b,d,c){return w(a,"lastChild","previousSibling",b,d,c)},isBookmarkNode:function(a){return 1==a.nodeType&&a.id&&/^_baidu_bookmark_/i.test(a.id)},getWindow:function(a){a=a.ownerDocument||a;return a.defaultView||a.parentWindow},getCommonAncestor:function(a,b){if(a===b)return a;for(var d=[a],c=[b],f=a,h=-1;f=f.parentNode;){if(f===b)return f;d.push(f)}for(f=b;f=f.parentNode;){if(f===a)return f;c.push(f)}d.reverse();for(c.reverse();h++,
|
||||
d[h]===c[h];);return 0==h?null:d[h-1]},clearEmptySibling:function(a,b,d){function c(a,b){for(var c;a&&!k.isBookmarkNode(a)&&(k.isEmptyInlineElement(a)||!(new RegExp("[^\t\n\r"+k.fillChar+"]")).test(a.nodeValue));)c=a[b],k.remove(a),a=c}!b&&c(a.nextSibling,"nextSibling");!d&&c(a.previousSibling,"previousSibling")},split:function(a,b){var d=a.ownerDocument;if(m.ie&&b==a.nodeValue.length){var c=d.createTextNode("");return k.insertAfter(a,c)}c=a.splitText(b);m.ie8&&(d=d.createTextNode(""),k.insertAfter(c,
|
||||
d),k.remove(d));return c},isWhitespace:function(a){return!(new RegExp("[^ \t\n\r"+k.fillChar+"]")).test(a.nodeValue)},getXY:function(a){for(var b=0,d=0;a.offsetParent;)d+=a.offsetTop,b+=a.offsetLeft,a=a.offsetParent;return{x:b,y:d}},isEmptyInlineElement:function(a){if(1!=a.nodeType||!p.$removeEmpty[a.tagName])return 0;for(a=a.firstChild;a;){if(k.isBookmarkNode(a)||1==a.nodeType&&!k.isEmptyInlineElement(a)||3==a.nodeType&&!k.isWhitespace(a))return 0;a=a.nextSibling}return 1},isBlockElm:function(a){return 1==
|
||||
a.nodeType&&(p.$block[a.tagName]||K[k.getComputedStyle(a,"display")])&&!p.$nonChild[a.tagName]},getElementsByTagName:function(a,b,d){if(d&&n.isString(d)){var c=d;d=function(a){var b=!1;g.each(n.trim(c).replace(/[ ]{2,}/g," ").split(" "),function(l,c){if(g(a).hasClass(c))return b=!0,!1});return b}}b=n.trim(b).replace(/[ ]{2,}/g," ").split(" ");for(var f=[],h=0,e;e=b[h++];){e=a.getElementsByTagName(e);for(var l=0,t;t=e[l++];)d&&!d(t)||f.push(t)}return f},unSelectable:E&&m.ie9below||m.opera?function(a){a.onselectstart=
|
||||
function(){return!1};a.onclick=a.onkeyup=a.onkeydown=function(){return!1};a.unselectable="on";a.setAttribute("unselectable","on");for(var b=0,d;d=a.all[b++];)switch(d.tagName.toLowerCase()){case "iframe":case "textarea":case "input":case "select":break;default:d.unselectable="on",a.setAttribute("unselectable","on")}}:function(a){a.style.MozUserSelect=a.style.webkitUserSelect=a.style.msUserSelect=a.style.KhtmlUserSelect="none"},removeAttributes:function(a,b){b=n.isArray(b)?b:n.trim(b).replace(/[ ]{2,}/g,
|
||||
" ").split(" ");for(var d=0,c;c=b[d++];){c=J[c]||c;switch(c){case "className":a[c]="";break;case "style":a.style.cssText="",a.getAttributeNode("style")&&!m.ie&&a.removeAttributeNode(a.getAttributeNode("style"))}a.removeAttribute(c)}},createElement:function(a,b,d){return k.setAttributes(a.createElement(b),d)},setAttributes:function(a,b){for(var d in b)if(b.hasOwnProperty(d)){var c=b[d];switch(d){case "class":a.className=c;break;case "style":a.style.cssText=a.style.cssText+";"+c;break;case "innerHTML":a[d]=
|
||||
c;break;case "value":a.value=c;break;default:a.setAttribute(J[d]||d,c)}}return a},getComputedStyle:function(a,b){return n.transUnitToPx(n.fixColor(b,g(a).css(b)))},preventDefault:function(a){a.preventDefault?a.preventDefault():a.returnValue=!1},removeStyle:function(a,b){m.ie?("color"==b&&(b="(^|;)"+b),a.style.cssText=a.style.cssText.replace(new RegExp(b+"[^:]*:[^;]+;?","ig"),"")):a.style.removeProperty?a.style.removeProperty(b):a.style.removeAttribute(n.cssStyleToDomStyle(b));a.style.cssText||k.removeAttributes(a,
|
||||
["style"])},getStyle:function(a,b){var d=a.style[n.cssStyleToDomStyle(b)];return n.fixColor(b,d)},setStyle:function(a,b,d){a.style[n.cssStyleToDomStyle(b)]=d;n.trim(a.style.cssText)||this.removeAttributes(a,"style")},removeDirtyAttr:function(a){for(var b=0,d,c=a.getElementsByTagName("*");d=c[b++];)d.removeAttribute("_moz_dirty");a.removeAttribute("_moz_dirty")},getChildCount:function(a,b){var d=0,c=a.firstChild;for(b=b||function(){return 1};c;)b(c)&&d++,c=c.nextSibling;return d},isEmptyNode:function(a){return!a.firstChild||
|
||||
0==k.getChildCount(a,function(a){return!k.isBr(a)&&!k.isBookmarkNode(a)&&!k.isWhitespace(a)})},isBr:function(a){return 1==a.nodeType&&"BR"==a.tagName},isEmptyBlock:function(a,b){if(1!=a.nodeType)return 0;b=b||new RegExp("[ \t\r\n"+k.fillChar+"]","g");if(0<a[m.ie?"innerText":"textContent"].replace(b,"").length)return 0;for(var d in p.$isNotEmpty)if(a.getElementsByTagName(d).length)return 0;return 1},isCustomeNode:function(a){return 1==a.nodeType&&a.getAttribute("_ue_custom_node_")},fillNode:function(a,
|
||||
b){var d=m.ie?a.createTextNode(k.fillChar):a.createElement("br");b.innerHTML="";b.appendChild(d)},isBoundaryNode:function(a,b){for(var d;!k.isBody(a);)if(d=a,a=a.parentNode,d!==a[b])return!1;return!0},isFillChar:function(a,b){return 3==a.nodeType&&!a.nodeValue.replace(new RegExp((b?"^":"")+k.fillChar),"").length},isBody:function(a){return g(a).hasClass("edui-body-container")}},H=new RegExp(k.fillChar,"g");(function(){function a(a,b,c,e){1==b.nodeType&&(p.$empty[b.tagName]||p.$nonChild[b.tagName])&&
|
||||
(c=k.getNodeIndex(b)+(a?0:1),b=b.parentNode);a?(e.startContainer=b,e.startOffset=c,e.endContainer||e.collapse(!0)):(e.endContainer=b,e.endOffset=c,e.startContainer||e.collapse(!1));e.collapsed=e.startContainer&&e.endContainer&&e.startContainer===e.endContainer&&e.startOffset==e.endOffset;return e}function b(a,b){try{if(h&&k.inDoc(h,a))if(h.nodeValue.replace(H,"").length)h.nodeValue=h.nodeValue.replace(H,"");else{var l=h.parentNode;for(k.remove(h);l&&k.isEmptyInlineElement(l)&&(m.safari?!(k.getPosition(l,
|
||||
b)&k.POSITION_CONTAINS):!l.contains(b));)h=l.parentNode,k.remove(l),l=h}}catch(r){}}function d(a,b){var l;for(a=a[b];a&&k.isFillChar(a);)l=a[b],k.remove(a),a=l}var c=0,f=k.fillChar,h,e=x.Range=function(a,b){this.startContainer=this.startOffset=this.endContainer=this.endOffset=null;this.document=a;this.collapsed=!0;this.body=b};e.prototype={deleteContents:function(){var a;if(!this.collapsed){a=this.startContainer;var b=this.endContainer,c=this.startOffset,e=this.endOffset,d=this.document,f=d.createDocumentFragment(),
|
||||
h,g;1==a.nodeType&&(a=a.childNodes[c]||(h=a.appendChild(d.createTextNode(""))));1==b.nodeType&&(b=b.childNodes[e]||(g=b.appendChild(d.createTextNode(""))));if(a===b&&3==a.nodeType)f.appendChild(d.createTextNode(a.substringData(c,e-c))),a.deleteData(c,e-c),this.collapse(!0);else{for(var u,n,p=f,C=k.findParents(a,!0),F=k.findParents(b,!0),z=0;C[z]==F[z];)z++;for(var D=z,w;w=C[D];D++){u=w.nextSibling;w==a?h||(3==this.startContainer.nodeType?(p.appendChild(d.createTextNode(a.nodeValue.slice(c))),a.deleteData(c,
|
||||
a.nodeValue.length-c)):p.appendChild(a)):(n=w.cloneNode(!1),p.appendChild(n));for(;u&&u!==b&&u!==F[D];)w=u.nextSibling,p.appendChild(u),u=w;p=n}p=f;C[z]||(p.appendChild(C[z-1].cloneNode(!1)),p=p.firstChild);for(D=z;c=F[D];D++){u=c.previousSibling;c==b?g||3!=this.endContainer.nodeType||(p.appendChild(d.createTextNode(b.substringData(0,e))),b.deleteData(0,e)):(n=c.cloneNode(!1),p.appendChild(n));if(D!=z||!C[z])for(;u&&u!==a;)c=u.previousSibling,p.insertBefore(u,p.firstChild),u=c;p=n}this.setStartBefore(F[z]?
|
||||
C[z]?F[z]:C[z-1]:F[z-1]).collapse(!0);h&&k.remove(h);g&&k.remove(g)}}m.webkit&&(a=this.startContainer,3!=a.nodeType||a.nodeValue.length||(this.setStartBefore(a).collapse(!0),k.remove(a)));return this},inFillChar:function(){var a=this.startContainer;return this.collapsed&&3==a.nodeType&&a.nodeValue.replace(new RegExp("^"+k.fillChar),"").length+1==a.nodeValue.length?!0:!1},setStart:function(b,c){return a(!0,b,c,this)},setEnd:function(b,c){return a(!1,b,c,this)},setStartAfter:function(a){return this.setStart(a.parentNode,
|
||||
k.getNodeIndex(a)+1)},setStartBefore:function(a){return this.setStart(a.parentNode,k.getNodeIndex(a))},setEndAfter:function(a){return this.setEnd(a.parentNode,k.getNodeIndex(a)+1)},setEndBefore:function(a){return this.setEnd(a.parentNode,k.getNodeIndex(a))},setStartAtFirst:function(a){return this.setStart(a,0)},setStartAtLast:function(a){return this.setStart(a,3==a.nodeType?a.nodeValue.length:a.childNodes.length)},setEndAtFirst:function(a){return this.setEnd(a,0)},setEndAtLast:function(a){return this.setEnd(a,
|
||||
3==a.nodeType?a.nodeValue.length:a.childNodes.length)},selectNode:function(a){return this.setStartBefore(a).setEndAfter(a)},selectNodeContents:function(a){return this.setStart(a,0).setEndAtLast(a)},cloneRange:function(){return(new e(this.document)).setStart(this.startContainer,this.startOffset).setEnd(this.endContainer,this.endOffset)},collapse:function(a){a?(this.endContainer=this.startContainer,this.endOffset=this.startOffset):(this.startContainer=this.endContainer,this.startOffset=this.endOffset);
|
||||
this.collapsed=!0;return this},shrinkBoundary:function(a){function b(a){return 1==a.nodeType&&!k.isBookmarkNode(a)&&!p.$empty[a.tagName]&&!p.$nonChild[a.tagName]}for(var c,l=this.collapsed;1==this.startContainer.nodeType&&(c=this.startContainer.childNodes[this.startOffset])&&b(c);)this.setStart(c,0);if(l)return this.collapse(!0);if(!a)for(;1==this.endContainer.nodeType&&0<this.endOffset&&(c=this.endContainer.childNodes[this.endOffset-1])&&b(c);)this.setEnd(c,c.childNodes.length);return this},trimBoundary:function(a){this.txtToElmBoundary();
|
||||
var b=this.startContainer,c=this.startOffset,l=this.collapsed,e=this.endContainer;if(3==b.nodeType){if(0==c)this.setStartBefore(b);else if(c>=b.nodeValue.length)this.setStartAfter(b);else{var d=k.split(b,c);b===e?this.setEnd(d,this.endOffset-c):b.parentNode===e&&(this.endOffset+=1);this.setStartBefore(d)}if(l)return this.collapse(!0)}a||(c=this.endOffset,e=this.endContainer,3==e.nodeType&&(0==c?this.setEndBefore(e):(c<e.nodeValue.length&&k.split(e,c),this.setEndAfter(e))));return this},txtToElmBoundary:function(a){function b(a,
|
||||
b){var c=a[b+"Container"],l=a[b+"Offset"];if(3==c.nodeType)if(!l)a["set"+b.replace(/(\w)/,function(a){return a.toUpperCase()})+"Before"](c);else if(l>=c.nodeValue.length)a["set"+b.replace(/(\w)/,function(a){return a.toUpperCase()})+"After"](c)}if(a||!this.collapsed)b(this,"start"),b(this,"end");return this},insertNode:function(a){var b=a,c=1;11==a.nodeType&&(b=a.firstChild,c=a.childNodes.length);this.trimBoundary(!0);var l=this.startContainer,e=l.childNodes[this.startOffset];e?l.insertBefore(a,e):
|
||||
l.appendChild(a);b.parentNode===this.endContainer&&(this.endOffset+=c);return this.setStartBefore(b)},setCursor:function(a,b){return this.collapse(!a).select(b)},createBookmark:function(a,b){var l,e=this.document.createElement("span");e.style.cssText="display:none;line-height:0px;";e.appendChild(this.document.createTextNode("\u200d"));e.id="_baidu_bookmark_start_"+(b?"":c++);this.collapsed||(l=e.cloneNode(!0),l.id="_baidu_bookmark_end_"+(b?"":c++));this.insertNode(e);l&&this.collapse().insertNode(l).setEndBefore(l);
|
||||
this.setStartAfter(e);return{start:a?e.id:e,end:l?a?l.id:l:null,id:a}},moveToBookmark:function(a){var b=a.id?this.document.getElementById(a.start):a.start;a=a.end&&a.id?this.document.getElementById(a.end):a.end;this.setStartBefore(b);k.remove(b);a?(this.setEndBefore(a),k.remove(a)):this.collapse(!0);return this},adjustmentBoundary:function(){if(!this.collapsed){for(;!k.isBody(this.startContainer)&&this.startOffset==this.startContainer[3==this.startContainer.nodeType?"nodeValue":"childNodes"].length&&
|
||||
this.startContainer[3==this.startContainer.nodeType?"nodeValue":"childNodes"].length;)this.setStartAfter(this.startContainer);for(;!k.isBody(this.endContainer)&&!this.endOffset&&this.endContainer[3==this.endContainer.nodeType?"nodeValue":"childNodes"].length;)this.setEndBefore(this.endContainer)}return this},getClosedNode:function(){var a;if(!this.collapsed){var b=this.cloneRange().adjustmentBoundary().shrinkBoundary();b.collapsed||1!=b.startContainer.nodeType||b.startContainer!==b.endContainer||
|
||||
1!=b.endOffset-b.startOffset||(b=b.startContainer.childNodes[b.startOffset])&&1==b.nodeType&&(p.$empty[b.tagName]||p.$nonChild[b.tagName])&&(a=b)}return a},select:m.ie?function(a,c){var l;this.collapsed||this.shrinkBoundary();var e=this.getClosedNode();if(e&&!c){try{l=this.document.body.createControlRange(),l.addElement(e),l.select()}catch(G){}return this}var e=this.createBookmark(),t=e.start;l=this.document.body.createTextRange();l.moveToElementText(t);l.moveStart("character",1);if(!this.collapsed){var g=
|
||||
this.document.body.createTextRange(),t=e.end;g.moveToElementText(t);l.setEndPoint("EndToEnd",g)}else if(!a&&3!=this.startContainer.nodeType){var g=this.document.createTextNode(f),A=this.document.createElement("span");A.appendChild(this.document.createTextNode(f));t.parentNode.insertBefore(A,t);t.parentNode.insertBefore(g,t);b(this.document,g);h=g;d(A,"previousSibling");d(t,"nextSibling");l.moveStart("character",-1);l.collapse(!0)}this.moveToBookmark(e);A&&k.remove(A);try{l.select()}catch(G){}return this}:
|
||||
function(a){function c(a){function b(b,c,e){3==b.nodeType&&b.nodeValue.length<c&&(a[e+"Offset"]=b.nodeValue.length)}b(a.startContainer,a.startOffset,"start");b(a.endContainer,a.endOffset,"end")}var e=k.getWindow(this.document),l=e.getSelection();m.gecko?this.body.focus():e.focus();if(l){l.removeAllRanges();this.collapsed&&!a&&(a=e=this.startContainer,1==e.nodeType&&(a=e.childNodes[this.startOffset]),3==e.nodeType&&this.startOffset||(a?a.previousSibling&&3==a.previousSibling.nodeType:e.lastChild&&
|
||||
3==e.lastChild.nodeType)||(a=this.document.createTextNode(f),this.insertNode(a),b(this.document,a),d(a,"previousSibling"),d(a,"nextSibling"),h=a,this.setStart(a,m.webkit?1:0).collapse(!0)));e=this.document.createRange();if(this.collapsed&&m.opera&&1==this.startContainer.nodeType)if(a=this.startContainer.childNodes[this.startOffset]){for(;a&&k.isBlockElm(a);)if(1==a.nodeType&&a.childNodes[0])a=a.childNodes[0];else break;a&&this.setStartBefore(a).collapse(!0)}else(a=this.startContainer.lastChild)&&
|
||||
k.isBr(a)&&this.setStartBefore(a).collapse(!0);c(this);e.setStart(this.startContainer,this.startOffset);e.setEnd(this.endContainer,this.endOffset);l.addRange(e)}return this},createAddress:function(a,b){function c(a){for(var c=a?l.startContainer:l.endContainer,e=k.findParents(c,!0,function(a){return!k.isBody(a)}),d=[],f=0,h;h=e[f++];)d.push(k.getNodeIndex(h,b));e=0;if(b)if(3==c.nodeType){for(c=c.previousSibling;c&&3==c.nodeType;)e+=c.nodeValue.replace(H,"").length,c=c.previousSibling;e+=a?l.startOffset:
|
||||
l.endOffset}else if(c=c.childNodes[a?l.startOffset:l.endOffset])e=k.getNodeIndex(c,b);else for(c=a?l.startContainer:l.endContainer,a=c.firstChild;a;)if(k.isFillChar(a))a=a.nextSibling;else if(e++,3==a.nodeType)for(;a&&3==a.nodeType;)a=a.nextSibling;else a=a.nextSibling;else e=a?k.isFillChar(c)?0:l.startOffset:l.endOffset;0>e&&(e=0);d.push(e);return d}var e={},l=this;e.startAddress=c(!0);a||(e.endAddress=l.collapsed?[].concat(e.startAddress):c());return e},moveToAddress:function(a,b){function c(a,
|
||||
b){for(var c=e.body,l,d,f=0,h,t=a.length;f<t;f++)if(h=a[f],l=c,c=c.childNodes[h],!c){d=h;break}b?c?e.setStartBefore(c):e.setStart(l,d):c?e.setEndBefore(c):e.setEnd(l,d)}var e=this;c(a.startAddress,!0);!b&&a.endAddress&&c(a.endAddress);return e},equals:function(a){for(var b in this)if(this.hasOwnProperty(b)&&this[b]!==a[b])return!1;return!0},scrollIntoView:function(){var a=g('<span style="padding:0;margin:0;display:block;border:0"> </span>');this.cloneRange().insertNode(a.get(0));var b=g(window).scrollTop(),
|
||||
c=g(window).height(),e=a.offset().top;if(e<b-c||e>b+c)e>b+c?window.scrollTo(0,e-c+a.height()):window.scrollTo(0,b-e);a.remove()},getOffset:function(){var a=this.createBookmark(),b=g(a.start).css("display","inline-block").offset();this.moveToBookmark(a);return b}}})();(function(){function a(a,b){var c=k.getNodeIndex;a=a.duplicate();a.collapse(b);var e=a.parentElement();if(!e.hasChildNodes())return{container:e,offset:0};for(var l=e.children,d,f=a.duplicate(),r=0,g=l.length-1,y=-1;r<=g;){y=Math.floor((r+
|
||||
g)/2);d=l[y];f.moveToElementText(d);var A=f.compareEndPoints("StartToStart",a);if(0<A)g=y-1;else if(0>A)r=y+1;else return{container:e,offset:c(d)}}if(-1==y){f.moveToElementText(e);f.setEndPoint("StartToStart",a);f=f.text.replace(/(\r\n|\r)/g,"\n").length;l=e.childNodes;if(!f)return d=l[l.length-1],{container:d,offset:d.nodeValue.length};for(c=l.length;0<f;)f-=l[--c].nodeValue.length;return{container:l[c],offset:-f}}f.collapse(0<A);f.setEndPoint(0<A?"StartToStart":"EndToStart",a);f=f.text.replace(/(\r\n|\r)/g,
|
||||
"\n").length;if(!f)return p.$empty[d.tagName]||p.$nonChild[d.tagName]?{container:e,offset:c(d)+(0<A?0:1)}:{container:d,offset:0<A?0:d.childNodes.length};for(;0<f;)try{l=d,d=d[0<A?"previousSibling":"nextSibling"],f-=d.nodeValue.length}catch(G){return{container:e,offset:c(l)}}return{container:d,offset:0<A?-f:d.nodeValue.length+f}}function b(b,d){if(b.item)d.selectNode(b.item(0));else{var c=a(b,!0);d.setStart(c.container,c.offset);0!=b.compareEndPoints("StartToEnd",b)&&(c=a(b,!1),d.setEnd(c.container,
|
||||
c.offset))}return d}function d(a,b){var c;try{c=a.getNative(b).createRange()}catch(l){return null}var e=c.item?c.item(0):c.parentElement();return(e.ownerDocument||e)===a.document?c:null}(x.Selection=function(a,b){var c=this;c.document=a;c.body=b;if(m.ie9below)g(b).on("beforedeactivate",function(){c._bakIERange=c.getIERange()}).on("activate",function(){try{var a=d(c);a&&c.rangeInBody(a)||!c._bakIERange||c._bakIERange.select()}catch(l){}c._bakIERange=null})}).prototype={hasNativeRange:function(){var a;
|
||||
if(!m.ie||m.ie9above){a=this.getNative();if(!a.rangeCount)return!1;a=a.getRangeAt(0)}else a=d(this);return this.rangeInBody(a)},getNative:function(a){var b=this.document;try{return b?m.ie9below||a?b.selection:k.getWindow(b).getSelection():null}catch(h){return null}},getIERange:function(a){var b=d(this,a);return b&&this.rangeInBody(b,a)||!this._bakIERange?b:this._bakIERange},rangeInBody:function(a,b){var c=m.ie9below||b?a.item?a.item():a.parentElement():a.startContainer;return c===this.body||k.inDoc(c,
|
||||
this.body)},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 a=this.getStart();return a?k.findParents(a,!0,null,!0):[]},clear:function(){this._cachedStartElementPath=this._cachedRange=this._cachedStartElement=null},isFocus:function(){return this.hasNativeRange()},getRange:function(){function a(a){for(var b=
|
||||
d.body.firstChild,c=a.collapsed;b&&b.firstChild;)a.setStart(b,0),b=b.firstChild;a.startContainer||a.setStart(d.body,0);c&&a.collapse(!0)}var d=this;if(null!=d._cachedRange)return this._cachedRange;var h=new x.Range(d.document,d.body);if(m.ie9below){var e=d.getIERange();if(e&&this.rangeInBody(e))try{b(e,h)}catch(t){a(h)}else a(h)}else{var l=d.getNative();if(l&&l.rangeCount&&d.rangeInBody(l.getRangeAt(0)))e=l.getRangeAt(0),l=l.getRangeAt(l.rangeCount-1),h.setStart(e.startContainer,e.startOffset).setEnd(l.endContainer,
|
||||
l.endOffset),h.collapsed&&k.isBody(h.startContainer)&&!h.startOffset&&a(h);else{if(this._bakRange&&(this._bakRange.startContainer===this.body||k.inDoc(this._bakRange.startContainer,this.body)))return this._bakRange;a(h)}}return this._bakRange=h},getStart:function(){if(this._cachedStartElement)return this._cachedStartElement;var a=m.ie9below?this.getIERange():this.getRange(),b,d;if(m.ie9below){if(!a)return this.document.body.firstChild;if(a.item)return a.item(0);b=a.duplicate();0<b.text.length&&b.moveStart("character",
|
||||
1);b.collapse(1);b=b.parentElement();for(d=a=a.parentElement();a=a.parentNode;)if(a==b){b=d;break}}else if(b=a.startContainer,1==b.nodeType&&b.hasChildNodes()&&(b=b.childNodes[Math.min(b.childNodes.length-1,a.startOffset)]),3==b.nodeType)return b.parentNode;return b},getText:function(){var a;return this.isFocus()&&(a=this.getNative())?(a=m.ie9below?a.createRange():a.getRangeAt(0),m.ie9below?a.text:a.toString()):""}}})();(function(){function a(a,b){var c;if(b.textarea)if(n.isString(b.textarea))for(var e=
|
||||
0,d,l=k.getElementsByTagName(a,"textarea");d=l[e++];){if(d.id=="umeditor_textarea_"+b.options.textarea){c=d;break}}else c=b.textarea;c||(a.appendChild(c=k.createElement(document,"textarea",{name:b.options.textarea,id:"umeditor_textarea_"+b.options.textarea,style:"display:none"})),b.textarea=c);c.value=b.hasContents()?b.options.allHtmlEnabled?b.getAllHtml():b.getContent(null,null,!0):""}function b(a){for(var b in UM.plugins)-1==a.options.excludePlugins.indexOf(b)&&(UM.plugins[b].call(a),a.plugins[b]=
|
||||
1);a.langIsReady=!0;a.fireEvent("langReady")}function d(a){for(var b in a)return b}var c=0,f,h=UM.Editor=function(a){var e=this;e.uid=c++;I.call(e);e.commands={};e.options=n.extend(n.clone(a||{}),UMEDITOR_CONFIG,!0);e.shortcutkeys={};e.inputRules=[];e.outputRules=[];e.setOpt({isShow:!0,initialContent:"",initialStyle:"",autoClearinitialContent:!1,textarea:"editorValue",focus:!1,focusInEnd:!0,autoClearEmptyNode:!0,fullscreen:!1,readonly:!1,zIndex:999,enterTag:"p",lang:"zh-cn",langPath:e.options.UMEDITOR_HOME_URL+
|
||||
"lang/",theme:"default",themePath:e.options.UMEDITOR_HOME_URL+"themes/",allHtmlEnabled:!1,autoSyncData:!0,autoHeightEnabled:!0,excludePlugins:""});e.plugins={};n.isEmptyObject(UM.I18N)?n.loadFile(document,{src:e.options.langPath+e.options.lang+"/"+e.options.lang+".js",tag:"script",type:"text/javascript",defer:"defer"},function(){b(e)}):(e.options.lang=d(UM.I18N),b(e))};h.prototype={ready:function(a){a&&(this.isReady?a.apply(this):this.addListener("ready",a))},setOpt:function(a,b){var c={};n.isString(a)?
|
||||
c[a]=b:c=a;n.extend(this.options,c,!0)},getOpt:function(a){return this.options[a]||""},destroy:function(){this.fireEvent("destroy");var a=this.container.parentNode;a===document.body&&(a=this.container);var b=this.textarea;b?b.style.display="":(b=document.createElement("textarea"),a.parentNode.insertBefore(b,a));b.style.width=this.body.offsetWidth+"px";b.style.height=this.body.offsetHeight+"px";b.value=this.getContent();b.id=this.key;a.contains(b)&&g(b).insertBefore(a);a.innerHTML="";k.remove(a);UM.clearCache(this.id);
|
||||
for(var c in this)this.hasOwnProperty(c)&&delete this[c]},initialCont:function(a){if(a){a.getAttribute("name")&&(this.options.textarea=a.getAttribute("name"));if(a&&/script|textarea/ig.test(a.tagName)){var b=document.createElement("div");a.parentNode.insertBefore(b,a);this.options.initialContent=UM.htmlparser(a.value||a.innerHTML||this.options.initialContent).toHtml();a.className&&(b.className=a.className);a.style.cssText&&(b.style.cssText=a.style.cssText);/textarea/i.test(a.tagName)?(this.textarea=
|
||||
a,this.textarea.style.display="none"):(a.parentNode.removeChild(a),a.id&&(b.id=a.id));a=b;a.innerHTML=""}return a}return null},render:function(a){var b=this.options,c=function(b){return parseInt(g(a).css(b))};n.isString(a)&&(a=document.getElementById(a));a&&(this.id=a.getAttribute("id"),UM.setEditor(this),n.cssRule("edui-style-body",this.options.initialStyle,document),a=this.initialCont(a),a.className+=" edui-body-container",b.minFrameWidth=b.initialFrameWidth?b.initialFrameWidth:b.initialFrameWidth=
|
||||
g(a).width()||UM.defaultWidth,b.initialFrameHeight?b.minFrameHeight=b.initialFrameHeight:b.initialFrameHeight=b.minFrameHeight=g(a).height()||UM.defaultHeight,a.style.width=/%$/.test(b.initialFrameWidth)?"100%":b.initialFrameWidth-c("padding-left")-c("padding-right")+"px",c=/%$/.test(b.initialFrameHeight)?"100%":b.initialFrameHeight-c("padding-top")-c("padding-bottom"),this.options.autoHeightEnabled?(a.style.minHeight=c+"px",a.style.height="",m.ie&&6>=m.version&&(a.style.height=c,a.style.setExpression("height",
|
||||
"this.scrollHeight <= "+c+' ? "'+c+'px" : "auto"'))):g(a).height(c),a.style.zIndex=b.zIndex,this._setup(a))},_setup:function(b){var c=this,d=c.options;b.contentEditable=!0;document.body.spellcheck=!1;c.document=document;c.window=document.defaultView||document.parentWindow;c.body=b;c.$body=g(b);c.selection=new x.Selection(document,c.body);c._isEnabled=!1;var e;m.gecko&&(e=this.selection.getNative())&&e.removeAllRanges();this._initEvents();for(var f=b.parentNode;f&&!k.isBody(f);f=f.parentNode)if("FORM"==
|
||||
f.tagName){c.form=f;if(c.options.autoSyncData)g(b).on("blur",function(){a(f,c)});else g(f).on("submit",function(){a(this,c)});break}if(d.initialContent)if(d.autoClearinitialContent){var h=c.execCommand;c.execCommand=function(){c.fireEvent("firstBeforeExecCommand");return h.apply(c,arguments)};this._setDefaultContent(d.initialContent)}else this.setContent(d.initialContent,!1,!0);k.isEmptyNode(c.body)&&(c.body.innerHTML="<p>"+(m.ie?"":"<br/>")+"</p>");d.focus&&setTimeout(function(){c.focus(c.options.focusInEnd);
|
||||
!c.options.autoClearinitialContent&&c._selectionChange()},0);c.container||(c.container=b.parentNode);c._bindshortcutKeys();c.isReady=1;c.fireEvent("ready");d.onready&&d.onready.call(c);if(!m.ie||m.ie9above)g(c.body).on("blur focus",function(a){var b=c.selection.getNative();if("blur"==a.type)0<b.rangeCount&&(c._bakRange=b.getRangeAt(0));else{try{c._bakRange&&b.addRange(c._bakRange)}catch(G){}c._bakRange=null}});!d.isShow&&c.setHide();d.readonly&&c.setDisabled()},sync:function(b){(b=b?document.getElementById(b):
|
||||
k.findParent(this.body.parentNode,function(a){return"FORM"==a.tagName},!0))&&a(b,this)},setHeight:function(a,b){!b&&(this.options.initialFrameHeight=a);this.options.autoHeightEnabled?(g(this.body).css({"min-height":a+"px"}),m.ie&&6>=m.version&&this.container&&(this.container.style.height=a,this.container.style.setExpression("height","this.scrollHeight <= "+a+' ? "'+a+'px" : "auto"'))):g(this.body).height(a);this.fireEvent("resize")},setWidth:function(a){this.$container&&this.$container.width(a);g(this.body).width(a-
|
||||
1*g(this.body).css("padding-left").replace("px","")-1*g(this.body).css("padding-right").replace("px",""));this.fireEvent("resize")},addshortcutkey:function(a,b){var c={};b?c[a]=b:c=a;n.extend(this.shortcutkeys,c)},_bindshortcutKeys:function(){var a=this,b=this.shortcutkeys;a.addListener("keydown",function(c,d){var e=d.keyCode||d.which,f;for(f in b)for(var l=b[f].split(","),h=0,t;t=l[h++];){t=t.split(":");var g=t[0];t=t[1];if(/^(ctrl)(\+shift)?\+(\d+)$/.test(g.toLowerCase())||/^(\d+)$/.test(g))if("ctrl"==
|
||||
RegExp.$1&&(d.ctrlKey||d.metaKey)&&(""!=RegExp.$2?d[RegExp.$2.slice(1)+"Key"]:1)&&e==RegExp.$3||e==RegExp.$1)-1!=a.queryCommandState(f,t)&&a.execCommand(f,t),k.preventDefault(d)}})},getContent:function(a,b,c,d,f){a&&n.isFunction(a)&&(b=a);if(b?!b():!this.hasContents())return"";this.fireEvent("beforegetcontent");a=UM.htmlparser(this.body.innerHTML,d);this.filterOutputRule(a);this.fireEvent("aftergetcontent",a);return a.toHtml(f)},getAllHtml:function(){var a=[];this.fireEvent("getAllHtml",a);if(m.ie&&
|
||||
8<m.version){var b="";n.each(this.document.styleSheets,function(a){b+=a.href?'<link rel="stylesheet" type="text/css" href="'+a.href+'" />':"<style>"+a.cssText+"</style>"});n.each(this.document.getElementsByTagName("script"),function(a){b+=a.outerHTML})}return"<html><head>"+(this.options.charset?'<meta http-equiv="Content-Type" content="text/html; charset='+this.options.charset+'"/>':"")+(b||this.document.getElementsByTagName("head")[0].innerHTML)+a.join("\n")+"</head><body "+(E&&9>m.version?'class="view"':
|
||||
"")+">"+this.getContent(null,null,!0)+"</body></html>"},getPlainTxt:function(){var a=new RegExp(k.fillChar,"g"),b=this.body.innerHTML.replace(/[\n\r]/g,""),b=b.replace(/<(p|div)[^>]*>(<br\/?>| )<\/\1>/gi,"\n").replace(/<br\/?>/gi,"\n").replace(/<[^>/]+>/g,"").replace(/(\n)?<\/([^>]+)>/g,function(a,b,c){return p.$block[c]?"\n":b?b:""});return b.replace(a,"").replace(/\u00a0/g," ").replace(/ /g," ")},getContentTxt:function(){return this.body[m.ie?"innerText":"textContent"].replace(new RegExp(k.fillChar,
|
||||
"g"),"").replace(/\u00a0/g," ")},setContent:function(b,c,d){this.fireEvent("beforesetcontent",b);b=UM.htmlparser(b);this.filterInputRule(b);b=b.toHtml();this.body.innerHTML=(c?this.body.innerHTML:"")+b;if("p"==this.options.enterTag)if(c=this.body.firstChild,!c||1==c.nodeType&&(p.$cdata[c.tagName]||"DIV"==c.tagName&&c.getAttribute("cdata_tag")||k.isCustomeNode(c))&&c===this.body.lastChild)this.body.innerHTML="<p>"+(m.ie?" ":"<br/>")+"</p>"+this.body.innerHTML;else for(var e=this.document.createElement("p");c;){for(;c&&
|
||||
(3==c.nodeType||1==c.nodeType&&p.p[c.tagName]&&!p.$cdata[c.tagName]);)b=c.nextSibling,e.appendChild(c),c=b;if(e.firstChild)if(c)c.parentNode.insertBefore(e,c),e=this.document.createElement("p");else{this.body.appendChild(e);break}c=c.nextSibling}this.fireEvent("aftersetcontent");this.fireEvent("contentchange");!d&&this._selectionChange();this._bakRange=this._bakIERange=this._bakNativeRange=null;var f;m.gecko&&(f=this.selection.getNative())&&f.removeAllRanges();this.options.autoSyncData&&this.form&&
|
||||
a(this.form,this)},focus:function(a){try{var b=this.selection.getRange();a?b.setStartAtLast(this.body.lastChild).setCursor(!1,!0):b.select(!0);this.fireEvent("focus")}catch(t){}},blur:function(){var a=this.selection.getNative();a.empty?a.empty():a.removeAllRanges();this.fireEvent("blur")},isFocus:function(){return!0===this.fireEvent("isfocus")?!0:this.selection.isFocus()},_initEvents:function(){var a=this,b=function(){a._proxyDomEvent.apply(a,arguments)};g(a.body).on("click contextmenu mousedown keydown keyup keypress mouseup mouseover mouseout selectstart",
|
||||
b).on("focus blur",b).on("mouseup keydown",function(b){"keydown"==b.type&&(b.ctrlKey||b.metaKey||b.shiftKey||b.altKey)||2!=b.button&&a._selectionChange(250,b)})},_proxyDomEvent:function(a){return this.fireEvent(a.type.replace(/^on/,""),a)},_selectionChange:function(a,b){var c=this,d=!1,e,l;m.ie&&9>m.version&&b&&"mouseup"==b.type&&!this.selection.getRange().collapsed&&(d=!0,e=b.clientX,l=b.clientY);clearTimeout(f);f=setTimeout(function(){if(c.selection.getNative()){var a;if(d&&"None"==c.selection.getNative().type){a=
|
||||
c.document.body.createTextRange();try{a.moveToPoint(e,l)}catch(G){a=null}}var f;a&&(f=c.selection.getIERange,c.selection.getIERange=function(){return a});c.selection.cache();f&&(c.selection.getIERange=f);c.selection._cachedRange&&c.selection._cachedStartElement&&(c.fireEvent("beforeselectionchange"),c.fireEvent("selectionchange",!!b),c.fireEvent("afterselectionchange"),c.selection.clear())}},a||50)},_callCmdFn:function(a,b){b=Array.prototype.slice.call(b,0);var c=b.shift().toLowerCase(),d,e;e=(d=
|
||||
this.commands[c]||UM.commands[c])&&d[a];if(!(d&&e||"queryCommandState"!=a))return 0;if(e)return e.apply(this,[c].concat(b))},execCommand:function(a){if(!this.isFocus()){var b=this.selection._bakRange;b?b.select():this.focus(!0)}a=a.toLowerCase();var c,b=this.commands[a]||UM.commands[a];if(!b||!b.execCommand)return null;b.notNeedUndo||this.__hasEnterExecCommand?(c=this._callCmdFn("execCommand",arguments),this.__hasEnterExecCommand||b.ignoreContentChange||this._ignoreContentChange||this.fireEvent("contentchange")):
|
||||
(this.__hasEnterExecCommand=!0,-1!=this.queryCommandState.apply(this,arguments)&&(this.fireEvent("saveScene"),this.fireEvent("beforeexeccommand",a),c=this._callCmdFn("execCommand",arguments),b.ignoreContentChange||this._ignoreContentChange||this.fireEvent("contentchange"),this.fireEvent("afterexeccommand",a),this.fireEvent("saveScene")),this.__hasEnterExecCommand=!1);this.__hasEnterExecCommand||b.ignoreContentChange||this._ignoreContentChange||this._selectionChange();return c},queryCommandState:function(a){try{return this._callCmdFn("queryCommandState",
|
||||
arguments)}catch(l){return 0}},queryCommandValue:function(a){try{return this._callCmdFn("queryCommandValue",arguments)}catch(l){return null}},hasContents:function(a){if(a)for(var b=0,c;c=a[b++];)if(0<this.body.getElementsByTagName(c).length)return!0;if(!k.isEmptyBlock(this.body))return!0;a=["div"];for(b=0;c=a[b++];){c=k.getElementsByTagName(this.body,c);for(var d=0,e;e=c[d++];)if(k.isCustomeNode(e))return!0}return!1},reset:function(){this.fireEvent("reset")},isEnabled:function(){return 1!=this._isEnabled},
|
||||
setEnabled:function(){var a;this.body.contentEditable=!0;if(this.lastBk){a=this.selection.getRange();try{a.moveToBookmark(this.lastBk),delete this.lastBk}catch(l){a.setStartAtFirst(this.body).collapse(!0)}a.select(!0)}this.bkqueryCommandState&&(this.queryCommandState=this.bkqueryCommandState,delete this.bkqueryCommandState);this._bkproxyDomEvent&&(this._proxyDomEvent=this._bkproxyDomEvent,delete this._bkproxyDomEvent);this.fireEvent("setEnabled")},enable:function(){return this.setEnabled()},setDisabled:function(a,
|
||||
b){var c=this;c.body.contentEditable=!1;c._except=a?n.isArray(a)?a:[a]:[];c.lastBk||(c.lastBk=c.selection.getRange().createBookmark(!0));c.bkqueryCommandState||(c.bkqueryCommandState=c.queryCommandState,c.queryCommandState=function(a){return-1!=n.indexOf(c._except,a)?c.bkqueryCommandState.apply(c,arguments):-1});b||c._bkproxyDomEvent||(c._bkproxyDomEvent=c._proxyDomEvent,c._proxyDomEvent=function(){return!1});c.fireEvent("selectionchange");c.fireEvent("setDisabled",c._except)},disable:function(a){return this.setDisabled(a)},
|
||||
_setDefaultContent:function(){function a(){var b=this;b.document.getElementById("initContent")&&(b.body.innerHTML="<p>"+(E?"":"<br/>")+"</p>",b.removeListener("firstBeforeExecCommand focus",a),setTimeout(function(){b.focus();b._selectionChange()},0))}return function(b){this.body.innerHTML='<p id="initContent">'+b+"</p>";this.addListener("firstBeforeExecCommand focus",a)}}(),setShow:function(){var a=this.selection.getRange();if("none"==this.container.style.display){try{a.moveToBookmark(this.lastBk),
|
||||
delete this.lastBk}catch(l){a.setStartAtFirst(this.body).collapse(!0)}setTimeout(function(){a.select(!0)},100);this.container.style.display=""}},show:function(){return this.setShow()},setHide:function(){this.lastBk||(this.lastBk=this.selection.getRange().createBookmark(!0));this.container.style.display="none"},hide:function(){return this.setHide()},getLang:function(a){var b=UM.I18N[this.options.lang];if(!b)throw Error("not import language file");a=(a||"").split(".");for(var c=0,d;(d=a[c++])&&(b=b[d],
|
||||
b););return b},getContentLength:function(a,b){var c=this.getContent(!1,!1,!0).length;if(a){b=(b||[]).concat(["hr","img","iframe"]);for(var c=this.getContentTxt().replace(/[\t\r\n]+/g,"").length,d=0,e;e=b[d++];)c+=this.body.getElementsByTagName(e).length}return c},addInputRule:function(a,b){a.ignoreUndo=b;this.inputRules.push(a)},filterInputRule:function(a,b){for(var c=0,d;d=this.inputRules[c++];)b&&d.ignoreUndo||d.call(this,a)},addOutputRule:function(a,b){a.ignoreUndo=b;this.outputRules.push(a)},
|
||||
filterOutputRule:function(a,b){for(var c=0,d;d=this.outputRules[c++];)b&&d.ignoreUndo||d.call(this,a)}};n.inherits(h,I)})();UM.filterWord=function(){function a(a){return a=a.replace(/[\d.]+\w+/g,function(a){return n.transUnitToPx(a)})}function b(b){return b.replace(/[\t\r\n]+/g," ").replace(/\x3c!--[\s\S]*?--\x3e/ig,"").replace(/<v:shape [^>]*>[\s\S]*?.<\/v:shape>/gi,function(b){if(m.opera)return"";try{if(/Bitmap/i.test(b))return"";var c=b.match(/width:([ \d.]*p[tx])/i)[1],d=b.match(/height:([ \d.]*p[tx])/i)[1],
|
||||
e=b.match(/src=\s*"([^"]*)"/i)[1];return'<img width="'+a(c)+'" height="'+a(d)+'" src="'+e+'" />'}catch(l){return""}}).replace(/<\/?div[^>]*>/g,"").replace(/v:\w+=(["']?)[^'"]+\1/g,"").replace(/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|xml|meta|link|style|\w+:\w+)(?=[\s\/>]))[^>]*>/gi,"").replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi,"<p><strong>$1</strong></p>").replace(/\s+(class|lang|align)\s*=\s*(['"]?)([\w-]+)\2/ig,function(a,b,d,e){return"class"==b&&"MsoListParagraph"==
|
||||
e?a:""}).replace(/<(font|span)[^>]*>(\s*)<\/\1>/gi,function(a,b,d){return d.replace(/[\t\r\n ]+/g," ")}).replace(/(<[a-z][^>]*)\sstyle=(["'])([^\2]*?)\2/gi,function(b,d,h,e){b=[];e=e.replace(/^\s+|\s+$/,"").replace(/'/g,"'").replace(/"/gi,"'").split(/;\s*/g);h=0;for(var c;c=e[h];h++){var f,g=c.split(":");if(2==g.length&&(c=g[0].toLowerCase(),f=g[1].toLowerCase(),!(/^(background)\w*/.test(c)&&0==f.replace(/(initial|\s)/g,"").length||/^(margin)\w*/.test(c)&&/^0\w+$/.test(f)))){switch(c){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-height":case "mso-width":case "mso-vertical-align-alt":/<table/.test(d)||
|
||||
(b[h]=c.replace(/^mso-|-alt$/g,"")+":"+a(f));continue;case "horiz-align":b[h]="text-align:"+f;continue;case "vert-align":b[h]="vertical-align:"+f;continue;case "font-color":case "mso-foreground":b[h]="color:"+f;continue;case "mso-background":case "mso-highlight":b[h]="background:"+f;continue;case "mso-default-height":b[h]="min-height:"+a(f);continue;case "mso-default-width":b[h]="min-width:"+a(f);continue;case "mso-padding-between-alt":b[h]="border-collapse:separate;border-spacing:"+a(f);continue;
|
||||
case "text-line-through":if("single"==f||"double"==f)b[h]="text-decoration:line-through";continue;case "mso-zero-height":"yes"==f&&(b[h]="display:none");continue;case "margin":if(!/[1-9]/.test(f))continue}/^(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(c)||/text\-indent|padding|margin/.test(c)&&/\-[\d.]+/.test(f)||(b[h]=c+":"+g[1])}}return d+(b.length?' style="'+b.join(";").replace(/;{2,}/g,
|
||||
";")+'"':"")}).replace(/[\d.]+(cm|pt)/g,function(a){return n.transUnitToPx(a)})}return function(a){return/(class="?Mso|style="[^"]*\bmso\-|w:WordDocument|<(v|o):|lang=)/ig.test(a)?b(a):a}}();(function(){function a(a,b,c){a.push("\n");return b+(c?1:-1)}function b(a,b){for(var c=0;c<b;c++)a.push(" ")}function d(f,e,l,h){switch(f.type){case "root":for(var r=0,g;g=f.children[r++];)l&&"element"==g.type&&!p.$inlineWithA[g.tagName]&&1<r&&(a(e,h,!0),b(e,h)),d(g,e,l,h);break;case "text":"pre"==f.parentNode.tagName?
|
||||
e.push(f.data):e.push(k[f.parentNode.tagName]?n.html(f.data):f.data.replace(/[ ]{2}/g," "));break;case "element":c(f,e,l,h);break;case "comment":e.push("\x3c!--"+f.data+"--\x3e")}return e}function c(c,f,e,l){var h="";if(c.attrs){var h=[],r=c.attrs,g;for(g in r)h.push(g+(void 0!==r[g]?'="'+(t[g]?n.html(r[g]).replace(/["]/g,function(a){return"""}):n.unhtml(r[g]))+'"':""));h=h.join(" ")}f.push("<"+c.tagName+(h?" "+h:"")+(p.$empty[c.tagName]?"/":"")+">");e&&!p.$inlineWithA[c.tagName]&&"pre"!=
|
||||
c.tagName&&c.children&&c.children.length&&(l=a(f,l,!0),b(f,l));if(c.children&&c.children.length)for(h=0;r=c.children[h++];)e&&"element"==r.type&&!p.$inlineWithA[r.tagName]&&1<h&&(a(f,l),b(f,l)),d(r,f,e,l);p.$empty[c.tagName]||(e&&!p.$inlineWithA[c.tagName]&&"pre"!=c.tagName&&c.children&&c.children.length&&(l=a(f,l),b(f,l)),f.push("</"+c.tagName+">"))}function f(a,b){var c;if("element"==a.type&&a.getAttr("id")==b)return a;if(a.children&&a.children.length)for(var d=0;c=a.children[d++];)if(c=f(c,b))return c}
|
||||
function h(a,b,c){"element"==a.type&&a.tagName==b&&c.push(a);if(a.children&&a.children.length)for(var d=0,f;f=a.children[d++];)h(f,b,c)}function e(a,b){if(a.children&&a.children.length)for(var c=0,d;d=a.children[c];)e(d,b),d.parentNode&&(d.children&&d.children.length&&b(d),d.parentNode&&c++);else b(a)}var l=UM.uNode=function(a){this.type=a.type;this.data=a.data;this.tagName=a.tagName;this.parentNode=a.parentNode;this.attrs=a.attrs||{};this.children=a.children},t={href:1,src:1,_src:1,_href:1,cdata_data:1},
|
||||
k={style:1,script:1};l.createElement=function(a){return/[<>]/.test(a)?UM.htmlparser(a).children[0]:new l({type:"element",children:[],tagName:a})};l.createText=function(a,b){return new UM.uNode({type:"text",data:b?a:n.unhtml(a||"")})};l.prototype={toHtml:function(a){var b=[];d(this,b,a,0);return b.join("")},innerHTML:function(a){if("element"!=this.type||p.$empty[this.tagName])return this;if(n.isString(a)){if(this.children)for(var b=0,c;c=this.children[b++];)c.parentNode=null;this.children=[];a=UM.htmlparser(a);
|
||||
for(b=0;c=a.children[b++];)this.children.push(c),c.parentNode=this;return this}a=new UM.uNode({type:"root",children:this.children});return a.toHtml()},innerText:function(a,b){if("element"!=this.type||p.$empty[this.tagName])return this;if(a){if(this.children)for(var c=0,d;d=this.children[c++];)d.parentNode=null;this.children=[];this.appendChild(l.createText(a,b));return this}return this.toHtml().replace(/<[^>]+>/g,"")},getData:function(){return"element"==this.type?"":this.data},firstChild:function(){return this.children?
|
||||
this.children[0]:null},lastChild:function(){return this.children?this.children[this.children.length-1]:null},previousSibling:function(){for(var a=this.parentNode,b=0,c;c=a.children[b];b++)if(c===this)return 0==b?null:a.children[b-1]},nextSibling:function(){for(var a=this.parentNode,b=0,c;c=a.children[b++];)if(c===this)return a.children[b]},replaceChild:function(a,b){if(this.children){a.parentNode&&a.parentNode.removeChild(a);for(var c=0,d;d=this.children[c];c++)if(d===b)return this.children.splice(c,
|
||||
1,a),b.parentNode=null,a.parentNode=this,a}},appendChild:function(a){if("root"==this.type||"element"==this.type&&!p.$empty[this.tagName]){this.children||(this.children=[]);a.parentNode&&a.parentNode.removeChild(a);for(var b=0,c;c=this.children[b];b++)if(c===a){this.children.splice(b,1);break}this.children.push(a);a.parentNode=this;return a}},insertBefore:function(a,b){if(this.children){a.parentNode&&a.parentNode.removeChild(a);for(var c=0,d;d=this.children[c];c++)if(d===b)return this.children.splice(c,
|
||||
0,a),a.parentNode=this,a}},insertAfter:function(a,b){if(this.children){a.parentNode&&a.parentNode.removeChild(a);for(var c=0,d;d=this.children[c];c++)if(d===b)return this.children.splice(c+1,0,a),a.parentNode=this,a}},removeChild:function(a,b){if(this.children)for(var c=0,d;d=this.children[c];c++)if(d===a){this.children.splice(c,1);d.parentNode=null;if(b&&d.children&&d.children.length)for(var f=0,e;e=d.children[f];f++)this.children.splice(c+f,0,e),e.parentNode=this;return d}},getAttr:function(a){return this.attrs&&
|
||||
this.attrs[a.toLowerCase()]},setAttr:function(a,b){if(a)if(this.attrs||(this.attrs={}),n.isObject(a))for(var c in a)a[c]?this.attrs[c.toLowerCase()]=a[c]:delete this.attrs[c];else b?this.attrs[a.toLowerCase()]=b:delete this.attrs[a];else delete this.attrs},hasAttr:function(a){a=this.getAttr(a);return null!==a&&void 0!==a},getIndex:function(){for(var a=this.parentNode,b=0,c;c=a.children[b];b++)if(c===this)return b;return-1},getNodeById:function(a){var b;if(this.children&&this.children.length)for(var c=
|
||||
0;b=this.children[c++];)if(b=f(b,a))return b},getNodesByTagName:function(a){a=n.trim(a).replace(/[ ]{2,}/g," ").split(" ");var b=[],c=this;n.each(a,function(a){if(c.children&&c.children.length)for(var d=0,f;f=c.children[d++];)h(f,a,b)});return b},getStyle:function(a){var b=this.getAttr("style");return b?(a=b.match(new RegExp("(^|;)\\s*"+a+":([^;]+)","i")))&&a[0]?a[2]:"":""},setStyle:function(a,b){function c(a,b){d=d.replace(new RegExp("(^|;)\\s*"+a+":([^;]+;?)","gi"),"$1");b&&(d=a+":"+n.unhtml(b)+
|
||||
";"+d)}var d=this.getAttr("style");d||(d="");if(n.isObject(a))for(var f in a)c(f,a[f]);else c(a,b);this.setAttr("style",n.trim(d))},hasClass:function(a){if(this.hasAttr("class")){var b=this.getAttr("class").split(/\s+/),c=!1;g.each(b,function(b,d){d===a&&(c=!0)});return c}return!1},addClass:function(a){var b=null,c=!1;this.hasAttr("class")?(b=this.getAttr("class"),b=b.split(/\s+/),b.forEach(function(b){b===a&&(c=!0)}),!c&&b.push(a),this.setAttr("class",b.join(" "))):this.setAttr("class",a)},removeClass:function(a){if(this.hasAttr("class")){var b=
|
||||
this.getAttr("class"),b=b.replace(new RegExp("\\b"+a+"\\b","g"),"");this.setAttr("class",n.trim(b).replace(/[ ]{2,}/g," "))}},traversal:function(a){this.children&&this.children.length&&e(this,a);return this}}})();UM.htmlparser=function(a,b){function d(a,b){if(r[a.tagName]){var c=g.createElement(r[a.tagName]);a.appendChild(c);c.appendChild(g.createText(b))}else a.appendChild(g.createText(b))}function c(a,b,d){var f;if(f=v[b]){for(var e=a,t;"root"!=e.type;){if(n.isArray(f)?-1!=n.indexOf(f,e.tagName):
|
||||
f==e.tagName){a=e;t=!0;break}e=e.parentNode}t||(a=c(a,n.isArray(f)?f[0]:f))}f=new g({parentNode:a,type:"element",tagName:b.toLowerCase(),children:p.$empty[b]?null:[]});if(d){for(e={};t=h.exec(d);)e[t[1].toLowerCase()]=l[t[1].toLowerCase()]?t[2]||t[3]||t[4]:n.unhtml(t[2]||t[3]||t[4]);f.attrs=e}a.children.push(f);return p.$empty[b]?a:f}var f=/<(?:(?:\/([^>]+)>)|(?:!--([\S|\s]*?)--\x3e)|(?:([^\s\/>]+)\s*((?:(?:"[^"]*")|(?:'[^']*')|[^"'<>])*)\/?>))/g,h=/([\w\-:.]+)(?:(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+)))|(?=\s|$))/g,
|
||||
e={b:1,code:1,i:1,u:1,strike:1,s:1,tt:1,strong:1,q:1,samp:1,em:1,span:1,sub:1,img:1,sup:1,font:1,big:1,small:1,iframe:1,a:1,br:1,pre:1};a=a.replace(new RegExp(k.fillChar,"g"),"");b||(a=a.replace(new RegExp("[\\r\\t\\n"+(b?"":" ")+"]*</?(\\w+)\\s*(?:[^>]*)>[\\r\\t\\n"+(b?"":" ")+"]*","g"),function(a,c){return c&&e[c.toLowerCase()]?a.replace(/(^[\n\r]+)|([\n\r]+$)/g,""):a.replace(new RegExp("^[\\r\\n"+(b?"":" ")+"]+"),"").replace(new RegExp("[\\r\\n"+(b?"":" ")+"]+$"),"")}));for(var l={href:1,src:1},
|
||||
g=UM.uNode,v={td:"tr",tr:["tbody","thead","tfoot"],tbody:"table",th:"tr",thead:"table",tfoot:"table",caption:"table",li:["ul","ol"],dt:"dl",dd:"dl",option:"select"},r={ol:"li",ul:"li"},q,y=0,m=0,G=new g({type:"root",children:[]}),u=G;q=f.exec(a);){y=q.index;try{if(y>m&&d(u,a.slice(m,y)),q[3])p.$cdata[u.tagName]?d(u,q[0]):u=c(u,q[3].toLowerCase(),q[4]);else if(q[1]){if("root"!=u.type)if(p.$cdata[u.tagName]&&!p.$cdata[q[1]])d(u,q[0]);else{for(y=u;"element"==u.type&&u.tagName!=q[1].toLowerCase();)if(u=
|
||||
u.parentNode,"root"==u.type)throw u=y,"break";u=u.parentNode}}else q[2]&&u.children.push(new g({type:"comment",data:q[2],parentNode:u}))}catch(L){}m=f.lastIndex}m<a.length&&d(u,a.slice(m));return G};UM.filterNode=function(){function a(b,d){switch(b.type){case "element":var c;if(c=d[b.tagName])if("-"===c)b.parentNode.removeChild(b);else if(n.isFunction(c)){var f=b.parentNode,h=b.getIndex();c(b);if(b.parentNode){if(b.children)for(c=0;h=b.children[c];)a(h,d),h.parentNode&&c++}else for(c=h;h=f.children[c];)a(h,
|
||||
d),h.parentNode&&c++}else{if((c=c.$)&&b.attrs){var h={},e;for(f in c){e=b.getAttr(f);if("style"==f&&n.isArray(c[f])){var l=[];n.each(c[f],function(a){var c;(c=b.getStyle(a))&&l.push(a+":"+c)});e=l.join(";")}e&&(h[f]=e)}b.attrs=h}if(b.children)for(c=0;h=b.children[c];)a(h,d),h.parentNode&&c++}else if(p.$cdata[b.tagName])b.parentNode.removeChild(b);else for(f=b.parentNode,h=b.getIndex(),b.parentNode.removeChild(b,!0),c=h;h=f.children[c];)a(h,d),h.parentNode&&c++;break;case "comment":b.parentNode.removeChild(b)}}
|
||||
return function(b,d){if(n.isEmptyObject(d))return b;var c;(c=d["-"])&&n.each(c.split(" "),function(a){d[a]="-"});c=0;for(var f;f=b.children[c];)a(f,d),f.parentNode&&c++;return b}}();UM.commands.inserthtml={execCommand:function(a,b,d){var c=this,f;if(b&&!0!==c.fireEvent("beforeinserthtml",b)){f=c.selection.getRange();a=f.document.createElement("div");a.style.display="inline";d||(b=UM.htmlparser(b),c.options.filterRules&&UM.filterNode(b,c.options.filterRules),c.filterInputRule(b),b=b.toHtml());a.innerHTML=
|
||||
n.trim(b);if(!f.collapsed&&(b=f.startContainer,k.isFillChar(b)&&f.setStartBefore(b),b=f.endContainer,k.isFillChar(b)&&f.setEndAfter(b),f.txtToElmBoundary(),f.endContainer&&1==f.endContainer.nodeType&&(b=f.endContainer.childNodes[f.endOffset])&&k.isBr(b)&&f.setEndAfter(b),0==f.startOffset&&(b=f.startContainer,k.isBoundaryNode(b,"firstChild")&&(b=f.endContainer,f.endOffset==(3==b.nodeType?b.nodeValue.length:b.childNodes.length)&&k.isBoundaryNode(b,"lastChild")&&(c.body.innerHTML="<p>"+(m.ie?"":"<br/>")+
|
||||
"</p>",f.setStart(c.body.firstChild,0).collapse(!0)))),!f.collapsed&&f.deleteContents(),1==f.startContainer.nodeType)){b=f.startContainer.childNodes[f.startOffset];var h;if(b&&k.isBlockElm(b)&&(h=b.previousSibling)&&k.isBlockElm(h)){for(f.setEnd(h,h.childNodes.length).collapse();b.firstChild;)h.appendChild(b.firstChild);k.remove(b)}}var e,l;d=0;var g;f.inFillChar()&&(b=f.startContainer,k.isFillChar(b)?(f.setStartBefore(b).collapse(!0),k.remove(b)):k.isFillChar(b,!0)&&(b.nodeValue=b.nodeValue.replace(H,
|
||||
""),f.startOffset--,f.collapsed&&f.collapse(!0)));for(;b=a.firstChild;){if(d){for(e=c.document.createElement("p");b&&(3==b.nodeType||!p.$block[b.tagName]);)g=b.nextSibling,e.appendChild(b),b=g;e.firstChild&&(b=e)}f.insertNode(b);g=b.nextSibling;if(!d&&b.nodeType==k.NODE_ELEMENT&&k.isBlockElm(b)&&(e=k.findParent(b,function(a){return k.isBlockElm(a)}))&&"body"!=e.tagName.toLowerCase()&&(!p[e.tagName][b.nodeName]||b.parentNode!==e)){if(p[e.tagName][b.nodeName])for(l=b.parentNode;l!==e;)h=l,l=l.parentNode;
|
||||
else h=e;k.breakParent(b,h||l);h=b.previousSibling;k.trimWhiteTextNode(h);h.childNodes.length||k.remove(h);!m.ie&&(v=b.nextSibling)&&k.isBlockElm(v)&&v.lastChild&&!k.isBr(v.lastChild)&&v.appendChild(c.document.createElement("br"));d=1}var v=b.nextSibling;if(!a.firstChild&&v&&k.isBlockElm(v)){f.setStart(v,0).collapse(!0);break}f.setEndAfter(b).collapse()}b=f.startContainer;g&&k.isBr(g)&&k.remove(g);if(k.isBlockElm(b)&&k.isEmptyNode(b))if(g=b.nextSibling)k.remove(b),1==g.nodeType&&p.$block[g.tagName]&&
|
||||
f.setStart(g,0).collapse(!0).shrinkBoundary();else try{b.innerHTML=m.ie?k.fillChar:"<br/>"}catch(q){f.setStartBefore(b),k.remove(b)}try{if(m.ie9below&&1==f.startContainer.nodeType&&!f.startContainer.childNodes[f.startOffset]&&(h=f.startContainer.childNodes[f.startOffset-1])&&1==h.nodeType&&p.$empty[h.tagName]){var r=this.document.createTextNode(k.fillChar);f.insertNode(r).setStart(r,0).collapse(!0)}setTimeout(function(){f.select(!0)})}catch(q){}setTimeout(function(){f=c.selection.getRange();f.scrollIntoView();
|
||||
c.fireEvent("afterinserthtml")},200)}}};UM.commands.insertimage={execCommand:function(a,b){b=n.isArray(b)?b:[b];if(b.length){var d=[],c,f;f=b[0];if(1==b.length)c='<img src="'+f.src+'" '+(f._src?' _src="'+f._src+'" ':"")+(f.width?'width="'+f.width+'" ':"")+(f.height?' height="'+f.height+'" ':"")+("left"==f.floatStyle||"right"==f.floatStyle?' style="float:'+f.floatStyle+';"':"")+(f.title&&""!=f.title?' title="'+f.title+'"':"")+(f.border&&"0"!=f.border?' border="'+f.border+'"':"")+(f.alt&&""!=f.alt?
|
||||
' alt="'+f.alt+'"':"")+(f.hspace&&"0"!=f.hspace?' hspace = "'+f.hspace+'"':"")+(f.vspace&&"0"!=f.vspace?' vspace = "'+f.vspace+'"':"")+"/>","center"==f.floatStyle&&(c='<p style="text-align: center">'+c+"</p>"),d.push(c);else for(var h=0;f=b[h++];)c="<p "+("center"==f.floatStyle?'style="text-align: center" ':"")+'><img src="'+f.src+'" '+(f.width?'width="'+f.width+'" ':"")+(f._src?' _src="'+f._src+'" ':"")+(f.height?' height="'+f.height+'" ':"")+' style="'+(f.floatStyle&&"center"!=f.floatStyle?"float:"+
|
||||
f.floatStyle+";":"")+(f.border||"")+'" '+(f.title?' title="'+f.title+'"':"")+" /></p>",d.push(c);this.execCommand("insertHtml",d.join(""),!0)}}};UM.plugins.justify=function(){var a=this;g.each(["justifyleft","justifyright","justifycenter","justifyfull"],function(b,d){a.commands[d]={execCommand:function(a){return this.document.execCommand(a)},queryCommandValue:function(a){var b=this.document.queryCommandValue(a);return!0===b||"true"===b?a.replace(/justify/,""):""},queryCommandState:function(a){return this.document.queryCommandState(a)?
|
||||
1:0}}})};UM.plugins.font=function(){var a=this,b={forecolor:"forecolor",backcolor:"backcolor",fontsize:"fontsize",fontfamily:"fontname"},d={forecolor:"color",backcolor:"background-color",fontsize:"font-size",fontfamily:"font-family"},c={forecolor:"color",fontsize:"size",fontfamily:"face"};a.setOpt({fontfamily:[{name:"songti",val:"\u5b8b\u4f53,SimSun"},{name:"yahei",val:"\u5fae\u8f6f\u96c5\u9ed1,Microsoft YaHei"},{name:"kaiti",val:"\u6977\u4f53,\u6977\u4f53_GB2312, SimKai"},{name:"heiti",val:"\u9ed1\u4f53, SimHei"},
|
||||
{name:"lishu",val:"\u96b6\u4e66, SimLi"},{name:"andaleMono",val:"andale mono"},{name:"arial",val:"arial, helvetica,sans-serif"},{name:"arialBlack",val:"arial black,avant garde"},{name:"comicSansMs",val:"comic sans ms"},{name:"impact",val:"impact,chicago"},{name:"timesNewRoman",val:"times new roman"},{name:"sans-serif",val:"sans-serif"}],fontsize:[10,12,16,18,24,32,48]});a.addOutputRule(function(a){n.each(a.getNodesByTagName("font"),function(a){if("font"==a.tagName){var b=[],c;for(c in a.attrs)switch(c){case "size":var d=
|
||||
a.attrs[c];g.each({10:"1",12:"2",16:"3",18:"4",24:"5",32:"6",48:"7"},function(a,b){if(b==d)return d=a,!1});b.push("font-size:"+d+"px");break;case "color":b.push("color:"+a.attrs[c]);break;case "face":b.push("font-family:"+a.attrs[c]);break;case "style":b.push(a.attrs[c])}a.attrs={style:b.join(";")}}a.tagName="span";"span"==a.parentNode.tagName&&1==a.parentNode.children.length&&(g.each(a.attrs,function(b,c){a.parentNode.attrs[b]="style"==b?a.parentNode.attrs[b]+c:c}),a.parentNode.removeChild(a,!0))})});
|
||||
for(var f in b)(function(f){a.commands[f]={execCommand:function(a,c){if("transparent"!=c){var f=this.selection.getRange();if(f.collapsed){var e=g("<span></span>").css(d[a],c)[0];f.insertNode(e).setStart(e,0).setCursor()}else{"fontsize"==a&&(c={10:"1",12:"2",16:"3",18:"4",24:"5",32:"6",48:"7"}[(c+"").replace(/px/,"")]);this.document.execCommand(b[a],!1,c);m.gecko&&g.each(this.$body.find("a"),function(a,b){var c=b.parentNode;if(c.lastChild===c.firstChild&&/FONT|SPAN/.test(c.tagName)){var d=c.cloneNode(!1);
|
||||
d.innerHTML=b.innerHTML;g(b).html("").append(d).insertBefore(c);g(c).remove()}});if(!m.ie){var e=this.selection.getNative().getRangeAt(0).commonAncestorContainer,f=this.selection.getRange(),l=f.createBookmark(!0);g(e).find("a").each(function(a,b){var c=b.parentNode;"FONT"==c.nodeName&&(c=c.cloneNode(!1),c.innerHTML=b.innerHTML,g(b).html("").append(c))});f.moveToBookmark(l).select()}return!0}}},queryCommandValue:function(b){var f=a.selection.getStart(),e=g(f).css(d[b]);void 0===e&&(e=g(f).attr(c[b]));
|
||||
return e?n.fixColor(b,e).replace(/px/,""):""},queryCommandState:function(a){return this.queryCommandValue(a)}}})(f)};UM.plugins.link=function(){this.setOpt("autourldetectinie",!1);m.ie&&!1===this.options.autourldetectinie&&this.addListener("keyup",function(a,b){var d=b.keyCode;if(13==d||32==d){var c=this.selection.getRange().startContainer;13==d?"P"==c.nodeName&&(d=c.previousSibling)&&1==d.nodeType&&(d=d.lastChild)&&"A"==d.nodeName&&!d.getAttribute("_href")&&k.remove(d,!0):32==d&&3==c.nodeType&&/^\s$/.test(c.nodeValue)&&
|
||||
(c=c.previousSibling)&&"A"==c.nodeName&&!c.getAttribute("_href")&&k.remove(c,!0)}});this.addOutputRule(function(a){g.each(a.getNodesByTagName("a"),function(a,d){var b=d.getAttr("_href");/^(ftp|https?|\/|file)/.test(b)||(b="http://"+b);d.setAttr("href",b);d.setAttr("_href");""==d.getAttr("title")&&d.setAttr("title")})});this.addInputRule(function(a){g.each(a.getNodesByTagName("a"),function(a,d){d.setAttr("_href",d.getAttr("href"))})});this.commands.link={execCommand:function(a,b){var d=this.selection.getRange();
|
||||
b._href&&(b._href=n.unhtml(b._href,/[<">'](?:(amp|lt|quot|gt|#39|nbsp);)?/g));b.href&&(b.href=n.unhtml(b.href,/[<">'](?:(amp|lt|quot|gt|#39|nbsp);)?/g));if(d.collapsed){var c=d.startContainer;(c=k.findParentByTagName(c,"a",!0))?(g(c).attr(b),d.selectNode(c).select()):d.insertNode(g("<a>"+b.href+"</a>").attr(b)[0]).select()}else this.document.execCommand("createlink",!1,"_umeditor_link"),n.each(k.getElementsByTagName(this.body,"a",function(a){return"_umeditor_link"==a.getAttribute("href")}),function(a){"_umeditor_link"==
|
||||
g(a).text()&&g(a).text(b.href);k.setAttributes(a,b);d.selectNode(a).select()})},queryCommandState:function(){return this.queryCommandValue("link")?1:0},queryCommandValue:function(){var a=this.selection.getStartElementPath(),b;g.each(a,function(a,c){if("A"==c.nodeName)return b=c,!1});return b}};this.commands.unlink={execCommand:function(){this.document.execCommand("unlink")}}};UM.commands.print={execCommand:function(){var a="editor_print_"+ +new Date;g('<iframe src="" id="'+a+'" name="'+a+'" frameborder="0"></iframe>').attr("id",
|
||||
a).css({width:"0px",height:"0px",overflow:"hidden","float":"left",position:"absolute",top:"-10000px",left:"-10000px"}).appendTo(this.$container.find(".edui-dialog-container"));var b=window.open("",a,"").document;b.open();b.write("<html><head></head><body><div>"+this.getContent(null,null,!0)+"</div><script>setTimeout(function(){window.print();setTimeout(function(){window.parent.$('#"+a+"').remove();},100);},200);\x3c/script></body></html>");b.close()},notNeedUndo:1};UM.plugins.paragraph=function(){this.setOpt("paragraph",
|
||||
{p:"",h1:"",h2:"",h3:"",h4:"",h5:"",h6:""});this.commands.paragraph={execCommand:function(a,b){return this.document.execCommand("formatBlock",!1,"<"+b+">")},queryCommandValue:function(){try{var a=this.document.queryCommandValue("formatBlock")}catch(b){}return a}}};UM.plugins.horizontal=function(){var a=this;a.commands.horizontal={execCommand:function(){this.document.execCommand("insertHorizontalRule");var b=a.selection.getRange().txtToElmBoundary(!0),d=b.startContainer;if(k.isBody(b.startContainer))(d=
|
||||
b.startContainer.childNodes[b.startOffset])||(d=g("<p></p>").appendTo(b.startContainer).html(m.ie?" ":"<br/>")[0]),b.setStart(d,0).setCursor();else{for(;p.$inline[d.tagName]&&d.lastChild===d.firstChild;){var c=d.parentNode;c.appendChild(d.firstChild);c.removeChild(d);d=c}for(;p.$inline[d.tagName];)d=d.parentNode;1==d.childNodes.length&&"HR"==d.lastChild.nodeName?(c=d.lastChild,g(c).insertBefore(d),b.setStart(d,0).setCursor()):(c=g("hr",d)[0],k.breakParent(c,d),(d=c.previousSibling)&&k.isEmptyBlock(d)&&
|
||||
g(d).remove(),b.setStart(c.nextSibling,0).setCursor())}}}};UM.commands.cleardoc={execCommand:function(){var a=this,b=a.selection.getRange();a.body.innerHTML="<p>"+(E?"":"<br/>")+"</p>";b.setStart(a.body.firstChild,0).setCursor(!1,!0);setTimeout(function(){a.fireEvent("clearDoc")},0)}};UM.plugins.undo=function(){function a(a,b){if(a.length!=b.length)return 0;for(var c=0,d=a.length;c<d;c++)if(a[c]!=b[c])return 0;return 1}function b(){this.undoManger.save()}var d,c=this.options.maxUndoCount||20,f=this.options.maxInputCount||
|
||||
20,h=new RegExp(k.fillChar+"|</hr>","gi"),e={ol:1,ul:1,table:1,tbody:1,tr:1,body:1},l=this.options.autoClearEmptyNode;this.undoManger=new function(){this.list=[];this.index=0;this.hasRedo=this.hasUndo=!1;this.undo=function(){if(this.hasUndo)if(this.list[this.index-1]||1!=this.list.length){for(;this.list[this.index].content==this.list[this.index-1].content;)if(this.index--,0==this.index)return this.restore(0);this.restore(--this.index)}else this.reset()};this.redo=function(){if(this.hasRedo){for(;this.list[this.index].content==
|
||||
this.list[this.index+1].content;)if(this.index++,this.index==this.list.length-1)return this.restore(this.index);this.restore(++this.index)}};this.restore=function(){var a=this.editor,b=this.list[this.index],c=UM.htmlparser(b.content.replace(h,""));a.options.autoClearEmptyNode=!1;a.filterInputRule(c,!0);a.options.autoClearEmptyNode=l;a.body.innerHTML=c.toHtml();a.fireEvent("afterscencerestore");m.ie&&n.each(k.getElementsByTagName(a.document,"td th caption p"),function(b){k.isEmptyNode(b)&&k.fillNode(a.document,
|
||||
b)});try{var d=(new x.Range(a.document,a.body)).moveToAddress(b.address);if(m.ie&&d.collapsed&&1==d.startContainer.nodeType){var f=d.startContainer.childNodes[d.startOffset];(!f||1==f.nodeType&&p.$empty[f])&&d.insertNode(a.document.createTextNode(" ")).collapse(!0)}d.select(e[d.startContainer.nodeName.toLowerCase()])}catch(M){}this.update();this.clearKey();a.fireEvent("reset",!0)};this.getScene=function(){var a=this.editor,b=a.selection.getRange().createAddress(!1,!0);a.fireEvent("beforegetscene");
|
||||
var c=UM.htmlparser(a.body.innerHTML,!0);a.options.autoClearEmptyNode=!1;a.filterOutputRule(c,!0);a.options.autoClearEmptyNode=l;c=c.toHtml();m.ie&&(c=c.replace(/> </g,"><").replace(/\s*</g,"<").replace(/>\s*/g,">"));a.fireEvent("aftergetscene");return{address:b,content:c}};this.save=function(b,f){clearTimeout(d);var e=this.getScene(f),l=this.list[this.index],h;if(h=l&&l.content==e.content)b?l=1:(l=l.address,h=e.address,l=l.collapsed!=h.collapsed?0:a(l.startAddress,h.startAddress)&&a(l.endAddress,
|
||||
h.endAddress)?1:0),h=l;h||(this.list=this.list.slice(0,this.index+1),this.list.push(e),this.list.length>c&&this.list.shift(),this.index=this.list.length-1,this.clearKey(),this.update())};this.update=function(){this.hasRedo=!!this.list[this.index+1];this.hasUndo=!!this.list[this.index-1]};this.reset=function(){this.list=[];this.index=0;this.hasRedo=this.hasUndo=!1;this.clearKey()};this.clearKey=function(){v=0}};this.undoManger.editor=this;this.addListener("saveScene",function(){var a=Array.prototype.splice.call(arguments,
|
||||
1);this.undoManger.save.apply(this.undoManger,a)});this.addListener("beforeexeccommand",b);this.addListener("afterexeccommand",b);this.addListener("reset",function(a,b){b||this.undoManger.reset()});this.commands.redo=this.commands.undo={execCommand:function(a){this.undoManger[a]()},queryCommandState:function(a){return this.undoManger["has"+("undo"==a.toLowerCase()?"Undo":"Redo")]?0:-1},notNeedUndo:1};var t={16:1,17:1,18:1,37:1,38:1,39:1,40:1},v=0,r=!1;this.addListener("ready",function(){g(this.body).on("compositionstart",
|
||||
function(){r=!0}).on("compositionend",function(){r=!1})});this.addshortcutkey({Undo:"ctrl+90",Redo:"ctrl+89,shift+ctrl+z"});var q=!0;this.addListener("keydown",function(a,b){var c=this;if(!(t[b.keyCode||b.which]||b.ctrlKey||b.metaKey||b.shiftKey||b.altKey)){var e=function(a){a.selection.getRange().collapsed&&a.fireEvent("contentchange");a.undoManger.save(!1,!0);a.fireEvent("selectionchange")};r||(c.selection.getRange().collapsed?(0==c.undoManger.list.length&&c.undoManger.save(!0),clearTimeout(d),
|
||||
d=setTimeout(function(){if(r)var a=setInterval(function(){r||(e(c),clearInterval(a))},300);else e(c)},200),v++,v>=f&&e(c)):(c.undoManger.save(!1,!0),q=!1))}});this.addListener("keyup",function(a,b){t[b.keyCode||b.which]||b.ctrlKey||b.metaKey||b.shiftKey||b.altKey||r||q||(this.undoManger.save(!1,!0),q=!0)})};UM.plugins.paste=function(){function a(a){var b=this.document;if(!b.getElementById("baidu_pastebin")){var c=this.selection.getRange(),d=c.createBookmark(),l=b.createElement("div");l.id="baidu_pastebin";
|
||||
m.webkit&&l.appendChild(b.createTextNode(k.fillChar+k.fillChar));this.body.appendChild(l);d.start.style.display="";l.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;left:-1000px;white-space:nowrap;top:"+g(d.start).position().top+"px";c.selectNodeContents(l).select(!0);setTimeout(function(){if(m.webkit)for(var f=0,e=b.querySelectorAll("#baidu_pastebin"),h;h=e[f++];)if(k.isEmptyNode(h))k.remove(h);else{l=h;break}try{l.parentNode.removeChild(l)}catch(q){}c.moveToBookmark(d).select(!0);
|
||||
a(l)},0)}}function b(a){var b;if(a.firstChild){var c=k.getElementsByTagName(a,"span");b=0;for(var e;e=c[b++];)"_baidu_cut_start"!=e.id&&"_baidu_cut_end"!=e.id||k.remove(e);if(m.webkit){e=a.querySelectorAll("div br");for(b=0;c=e[b++];)c=c.parentNode,"DIV"==c.tagName&&1==c.childNodes.length&&(c.innerHTML="<p><br/></p>",k.remove(c));c=a.querySelectorAll("#baidu_pastebin");for(b=0;e=c[b++];){var l=d.document.createElement("p");for(e.parentNode.insertBefore(l,e);e.firstChild;)l.appendChild(e.firstChild);
|
||||
k.remove(e)}e=a.querySelectorAll("meta");for(b=0;c=e[b++];)k.remove(c);e=a.querySelectorAll("br");for(b=0;c=e[b++];)/^apple-/i.test(c.className)&&k.remove(c)}if(m.gecko)for(e=a.querySelectorAll("[_moz_dirty]"),b=0;c=e[b++];)c.removeAttribute("_moz_dirty");if(!m.ie)for(e=a.querySelectorAll("span.Apple-style-span"),b=0;c=e[b++];)k.remove(c,!0);b=a.innerHTML;b=UM.filterWord(b);a=UM.htmlparser(b);d.options.filterRules&&UM.filterNode(a,d.options.filterRules);d.filterInputRule(a);m.webkit&&((b=a.lastChild())&&
|
||||
"element"==b.type&&"br"==b.tagName&&a.removeChild(b),n.each(d.body.querySelectorAll("div"),function(a){k.isEmptyBlock(a)&&k.remove(a)}));b={html:a.toHtml()};d.fireEvent("beforepaste",b,a);b.html&&(d.execCommand("insertHtml",b.html,!0),d.fireEvent("afterpaste",b))}}var d=this;d.addListener("ready",function(){g(d.body).on("cut",function(){!d.selection.getRange().collapsed&&d.undoManger&&d.undoManger.save()}).on(m.ie||m.opera?"keydown":"paste",function(c){(!m.ie&&!m.opera||(c.ctrlKey||c.metaKey)&&"86"==
|
||||
c.keyCode)&&a.call(d,function(a){b(a)})})})};UM.plugins.list=function(){this.setOpt({insertorderedlist:{decimal:"","lower-alpha":"","lower-roman":"","upper-alpha":"","upper-roman":""},insertunorderedlist:{circle:"",disc:"",square:""}});this.addInputRule(function(a){n.each(a.getNodesByTagName("li"),function(a){0==a.children.length&&a.parentNode.removeChild(a)})});this.commands.insertorderedlist=this.commands.insertunorderedlist={execCommand:function(a){this.document.execCommand(a);a=this.selection.getRange();
|
||||
var b=a.createBookmark(!0);this.$body.find("ol,ul").each(function(a,b){var c=b.parentNode;"P"==c.tagName&&c.lastChild===c.firstChild&&(g(b).children().each(function(a,b){var d=c.cloneNode(!1);g(d).append(b.innerHTML);g(b).html("").append(d)}),g(b).insertBefore(c),g(c).remove());p.$inline[c.tagName]&&("SPAN"==c.tagName&&g(b).children().each(function(a,b){var d=c.cloneNode(!1);if("P"!=b.firstChild.nodeName){for(;b.firstChild;)d.appendChild(b.firstChild);g("<p></p>").appendTo(b).append(d)}else{for(;b.firstChild;)d.appendChild(b.firstChild);
|
||||
g(b.firstChild).append(d)}}),k.remove(c,!0))});a.moveToBookmark(b).select();return!0},queryCommandState:function(a){return this.document.queryCommandState(a)}}};(function(){var a={textarea:function(a,d){var b=d.ownerDocument.createElement("textarea");b.style.cssText="resize:none;border:0;padding:0;margin:0;overflow-y:auto;outline:0";m.ie&&8>m.version&&(b.style.width=d.offsetWidth+"px",b.style.height=d.offsetHeight+"px",d.onresize=function(){b.style.width=d.offsetWidth+"px";b.style.height=d.offsetHeight+
|
||||
"px"});d.appendChild(b);return{container:b,setContent:function(a){b.value=a},getContent:function(){return b.value},select:function(){var a;m.ie?(a=b.createTextRange(),a.collapse(!0),a.select()):(b.setSelectionRange(0,0),b.focus())},dispose:function(){d.removeChild(b);d=b=d.onresize=null}}}};UM.plugins.source=function(){var b=this,d=!1,c;this.options.sourceEditor="textarea";b.setOpt({sourceEditorFirst:!1});var f=b.getContent,h;b.commands.source={execCommand:function(){if(d=!d){h=b.selection.getRange().createAddress(!1,
|
||||
!0);b.undoManger&&b.undoManger.save(!0);m.gecko&&(b.body.contentEditable=!1);b.body.style.cssText+=";position:absolute;left:-32768px;top:-32768px;";b.fireEvent("beforegetcontent");var e=UM.htmlparser(b.body.innerHTML);b.filterOutputRule(e);e.traversal(function(a){if("element"==a.type)switch(a.tagName){case "td":case "th":case "caption":a.children&&1==a.children.length&&"br"==a.firstChild().tagName&&a.removeChild(a.firstChild());break;case "pre":a.innerText(a.innerText().replace(/ /g," "))}});
|
||||
b.fireEvent("aftergetcontent");e=e.toHtml(!0);c=a.textarea(b,b.body.parentNode);c.setContent(e);g(c.container).width(g(b.body).width()+parseInt(g(b.body).css("padding-left"))+parseInt(g(b.body).css("padding-right"))).height(g(b.body).height());setTimeout(function(){c.select()});b.getContent=function(){return c.getContent()||"<p>"+(m.ie?"":"<br/>")+"</p>"}}else{b.$body.css({position:"",left:"",top:""});e=c.getContent()||"<p>"+(m.ie?"":"<br/>")+"</p>";e=e.replace(RegExp("[\\r\\t\\n ]*</?(\\w+)\\s*(?:[^>]*)>",
|
||||
"g"),function(a,b){return b&&!p.$inlineWithA[b.toLowerCase()]?a.replace(/(^[\n\r\t ]*)|([\n\r\t ]*$)/g,""):a.replace(/(^[\n\r\t]*)|([\n\r\t]*$)/g,"")});b.setContent(e);c.dispose();c=null;b.getContent=f;b.body.firstChild||(b.body.innerHTML="<p>"+(m.ie?"":"<br/>")+"</p>");b.undoManger&&b.undoManger.save(!0);m.gecko&&(b.body.contentEditable=!0);try{b.selection.getRange().moveToAddress(h).select()}catch(t){}}this.fireEvent("sourcemodechanged",d)},queryCommandState:function(){return d|0},notNeedUndo:1};
|
||||
var e=b.queryCommandState;b.queryCommandState=function(a){a=a.toLowerCase();return d?a in{source:1,fullscreen:1}?e.apply(this,arguments):-1:e.apply(this,arguments)}}})();UM.plugins.enterkey=function(){var a,b=this,d=b.options.enterTag;b.addListener("keyup",function(c,d){if(13==(d.keyCode||d.which)){var f=b.selection.getRange(),e=f.startContainer,l;if(m.ie)b.fireEvent("saveScene",!0,!0);else{if(/h\d/i.test(a)){if(m.gecko)k.findParentByTagName(e,"h1 h2 h3 h4 h5 h6 blockquote caption table".split(" "),
|
||||
!0)||(b.document.execCommand("formatBlock",!1,"<p>"),l=1);else if(1==e.nodeType){var e=b.document.createTextNode(""),g;f.insertNode(e);if(g=k.findParentByTagName(e,"div",!0)){for(l=b.document.createElement("p");g.firstChild;)l.appendChild(g.firstChild);g.parentNode.insertBefore(l,g);k.remove(g);f.setStartBefore(e).setCursor();l=1}k.remove(e)}b.undoManger&&l&&b.undoManger.save()}m.opera&&f.select()}}});b.addListener("keydown",function(c,f){if(13==(f.keyCode||f.which))if(b.fireEvent("beforeenterkeydown"))k.preventDefault(f);
|
||||
else{b.fireEvent("saveScene",!0,!0);a="";var h=b.selection.getRange();if(!h.collapsed){var e=h.startContainer,l=h.endContainer,e=k.findParentByTagName(e,"td",!0),l=k.findParentByTagName(l,"td",!0);if(e&&l&&e!==l||!e&&l||e&&!l){f.preventDefault?f.preventDefault():f.returnValue=!1;return}}"p"!=d||m.ie||((e=k.findParentByTagName(h.startContainer,"ol ul p h1 h2 h3 h4 h5 h6 blockquote caption".split(" "),!0))||m.opera?(a=e.tagName,"p"==e.tagName.toLowerCase()&&m.gecko&&k.removeDirtyAttr(e)):(b.document.execCommand("formatBlock",
|
||||
!1,"<p>"),m.gecko&&(h=b.selection.getRange(),(e=k.findParentByTagName(h.startContainer,"p",!0))&&k.removeDirtyAttr(e))))}});m.ie&&b.addListener("setDisabled",function(){g(b.body).find("p").each(function(a,b){k.isEmptyBlock(b)&&(b.innerHTML=" ")})})};UM.commands.preview={execCommand:function(){var a=window.open("","_blank","").document,b=this.getContent(null,null,!0),d=this.getOpt("UMEDITOR_HOME_URL"),d=-1!=b.indexOf("mathquill-embedded-latex")?'<link rel="stylesheet" href="'+d+'third-party/mathquill/mathquill.css"/><script src="'+
|
||||
d+'third-party/jquery.min.js">\x3c/script><script src="'+d+'third-party/mathquill/mathquill.min.js">\x3c/script>':"";a.open();a.write("<html><head>"+d+"</head><body><div>"+b+"</div></body></html>");a.close()},notNeedUndo:1};UM.plugins.basestyle=function(){var a=this;a.addshortcutkey({Bold:"ctrl+66",Italic:"ctrl+73",Underline:"ctrl+shift+85",strikeThrough:"ctrl+shift+83"});a.addOutputRule(function(a){g.each(a.getNodesByTagName("b i u strike s"),function(a,b){switch(b.tagName){case "b":b.tagName="strong";
|
||||
break;case "i":b.tagName="em";break;case "u":b.tagName="span";b.setStyle("text-decoration","underline");break;case "s":case "strike":b.tagName="span",b.setStyle("text-decoration","line-through")}})});g.each("bold underline superscript subscript italic strikethrough".split(" "),function(b,d){a.commands[d]={execCommand:function(a){var b=this.selection.getRange();return b.collapsed&&1!=this.queryCommandState(a)?(a=this.document.createElement({bold:"strong",underline:"u",superscript:"sup",subscript:"sub",
|
||||
italic:"em",strikethrough:"strike"}[a]),b.insertNode(a).setStart(a,0).setCursor(!1),!0):this.document.execCommand(a)},queryCommandState:function(a){if(m.gecko)return this.document.queryCommandState(a);var b=this.selection.getStartElementPath(),c=!1;g.each(b,function(b,d){switch(a){case "bold":if("STRONG"==d.nodeName||"B"==d.nodeName)return c=1,!1;break;case "underline":if("U"==d.nodeName||"SPAN"==d.nodeName&&"underline"==g(d).css("text-decoration"))return c=1,!1;break;case "superscript":if("SUP"==
|
||||
d.nodeName)return c=1,!1;break;case "subscript":if("SUB"==d.nodeName)return c=1,!1;break;case "italic":if("EM"==d.nodeName||"I"==d.nodeName)return c=1,!1;break;case "strikethrough":if("S"==d.nodeName||"STRIKE"==d.nodeName||"SPAN"==d.nodeName&&"line-through"==g(d).css("text-decoration"))return c=1,!1}});return c}}})};UM.plugins.video=function(){function a(a,b,h,e,l,g){return g?'<embed type="application/x-shockwave-flash" class="edui-faked-video" pluginspage="http://www.macromedia.com/go/getflashplayer" src="'+
|
||||
a+'" width="'+b+'" height="'+h+'"'+(l?' style="float:'+l+'"':"")+' wmode="transparent" play="true" loop="false" menu="false" allowscriptaccess="never" allowfullscreen="true" >':"<img "+(e?'id="'+e+'"':"")+' width="'+b+'" height="'+h+'" _url="'+a+'" class="edui-faked-video" src="'+d.options.UMEDITOR_HOME_URL+'themes/default/images/spacer.gif" style="background:url('+d.options.UMEDITOR_HOME_URL+"themes/default/images/videologo.gif) no-repeat center center; border:1px solid gray;"+(l?"float:"+l+";":
|
||||
"")+'" />'}function b(b,d){n.each(b.getNodesByTagName(d?"img":"embed"),function(b){if("edui-faked-video"==b.getAttr("class")){var c=a(d?b.getAttr("_url"):b.getAttr("src"),b.getAttr("width"),b.getAttr("height"),null,b.getStyle("float")||"",d);b.parentNode.replaceChild(UM.uNode.createElement(c),b)}})}var d=this;d.addOutputRule(function(a){b(a,!0)});d.addInputRule(function(a){b(a)});d.commands.insertvideo={execCommand:function(b,f){f=n.isArray(f)?f:[f];for(var c=[],e=0,l,g=f.length;e<g;e++)l=f[e],l.url=
|
||||
n.unhtml(l.url,/[<">'](?:(amp|lt|quot|gt|#39|nbsp);)?/g),c.push(a(l.url,l.width||420,l.height||280,"tmpVedio"+e,l.align,!1));d.execCommand("inserthtml",c.join(""),!0)},queryCommandState:function(){var a=d.selection.getRange().getClosedNode();return a&&"edui-faked-video"==a.className?1:0}}};UM.plugins.selectall=function(){this.commands.selectall={execCommand:function(){var a=this.body,b=this.selection.getRange();b.selectNodeContents(a);k.isEmptyBlock(a)&&(m.opera&&a.firstChild&&1==a.firstChild.nodeType&&
|
||||
b.setStartAtFirst(a.firstChild),b.collapse(!0));b.select(!0)},notNeedUndo:1};this.addshortcutkey({selectAll:"ctrl+65"})};UM.plugins.removeformat=function(){this.setOpt({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"});this.commands.removeformat={execCommand:function(a,b,d,c,f){function h(a){if(3==a.nodeType||"span"!=a.tagName.toLowerCase())return 0;if(m.ie){var b=a.attributes;
|
||||
if(b.length){a=0;for(var c=b.length;a<c;a++)if(b[a].specified)return 0;return 1}}return!a.attributes.length}function e(a){var b=a.createBookmark();a.collapsed&&a.enlarge(!0);if(!f){var c=k.findParentByTagName(a.startContainer,"a",!0);c&&a.setStartBefore(c);(c=k.findParentByTagName(a.endContainer,"a",!0))&&a.setEndAfter(c)}v=a.createBookmark();for(c=v.start;(r=c.parentNode)&&!k.isBlockElm(r);)k.breakParent(c,r),k.clearEmptySibling(c);if(v.end){for(c=v.end;(r=c.parentNode)&&!k.isBlockElm(r);)k.breakParent(c,
|
||||
r),k.clearEmptySibling(c);for(var c=k.getNextDomNode(v.start,!1,q),e;c&&c!=v.end;)e=k.getNextDomNode(c,!0,q),p.$empty[c.tagName.toLowerCase()]||k.isBookmarkNode(c)||(l.test(c.tagName)?d?(k.removeStyle(c,d),h(c)&&"text-decoration"!=d&&k.remove(c,!0)):k.remove(c,!0):p.$tableContent[c.tagName]||p.$list[c.tagName]||(k.removeAttributes(c,g),h(c)&&k.remove(c,!0))),c=e}c=v.start.parentNode;!k.isBlockElm(c)||p.$tableContent[c.tagName]||p.$list[c.tagName]||k.removeAttributes(c,g);c=v.end.parentNode;v.end&&
|
||||
k.isBlockElm(c)&&!p.$tableContent[c.tagName]&&!p.$list[c.tagName]&&k.removeAttributes(c,g);a.moveToBookmark(v).moveToBookmark(b);c=a.startContainer;for(e=a.collapsed;1==c.nodeType&&k.isEmptyNode(c)&&p.$removeEmpty[c.tagName];)b=c.parentNode,a.setStartBefore(c),a.startContainer===a.endContainer&&a.endOffset--,k.remove(c),c=b;if(!e)for(c=a.endContainer;1==c.nodeType&&k.isEmptyNode(c)&&p.$removeEmpty[c.tagName];)b=c.parentNode,a.setEndBefore(c),k.remove(c),c=b}var l=new RegExp("^(?:"+(b||this.options.removeFormatTags).replace(/,/g,
|
||||
"|")+")$","i"),g=d?[]:(c||this.options.removeFormatAttributes).split(",");a=new x.Range(this.document);var v,r,q=function(a){return 1==a.nodeType};a=this.selection.getRange();a.collapsed||(e(a),a.select())}}};UM.plugins.keystrokes=function(){var a=this,b=!0;a.addListener("keydown",function(d,c){var f=c.keyCode||c.which,h=a.selection.getRange();if(!(h.collapsed||c.ctrlKey||c.shiftKey||c.altKey||c.metaKey)&&(65<=f&&90>=f||48<=f&&57>=f||96<=f&&111>=f||{13:1,8:1,46:1}[f])){var e=h.startContainer;k.isFillChar(e)&&
|
||||
h.setStartBefore(e);e=h.endContainer;k.isFillChar(e)&&h.setEndAfter(e);h.txtToElmBoundary();h.endContainer&&1==h.endContainer.nodeType&&(e=h.endContainer.childNodes[h.endOffset])&&k.isBr(e)&&h.setEndAfter(e);if(0==h.startOffset&&(e=h.startContainer,k.isBoundaryNode(e,"firstChild")&&(e=h.endContainer,h.endOffset==(3==e.nodeType?e.nodeValue.length:e.childNodes.length)&&k.isBoundaryNode(e,"lastChild")))){a.fireEvent("saveScene");a.body.innerHTML="<p>"+(m.ie?"":"<br/>")+"</p>";h.setStart(a.body.firstChild,
|
||||
0).setCursor(!1,!0);a._selectionChange();return}}if(8==f){h=a.selection.getRange();b=h.collapsed;if(a.fireEvent("delkeydown",c))return;var l;h.collapsed&&h.inFillChar()&&(e=h.startContainer,k.isFillChar(e)?(h.setStartBefore(e).shrinkBoundary(!0).collapse(!0),k.remove(e)):(e.nodeValue=e.nodeValue.replace(new RegExp("^"+k.fillChar),""),h.startOffset--,h.collapse(!0).select(!0)));if(e=h.getClosedNode()){a.fireEvent("saveScene");h.setStartBefore(e);k.remove(e);h.setCursor();a.fireEvent("saveScene");k.preventDefault(c);
|
||||
return}if(!m.ie&&(e=k.findParentByTagName(h.startContainer,"table",!0),l=k.findParentByTagName(h.endContainer,"table",!0),e&&!l||!e&&l||e!==l)){c.preventDefault();return}e=h.startContainer;h.collapsed&&1==e.nodeType&&(e=e.childNodes[h.startOffset-1])&&1==e.nodeType&&"BR"==e.tagName&&(a.fireEvent("saveScene"),h.setStartBefore(e).collapse(!0),k.remove(e),h.select(),a.fireEvent("saveScene"));if(m.chrome&&h.collapsed){for(;0==h.startOffset&&!k.isEmptyBlock(h.startContainer);)h.setStartBefore(h.startContainer);
|
||||
(e=h.startContainer.childNodes[h.startOffset-1])&&"BR"==e.nodeName&&(h.setStartBefore(e),a.fireEvent("saveScene"),g(e).remove(),h.setCursor(),a.fireEvent("saveScene"))}}if(m.gecko&&46==f&&(f=a.selection.getRange(),f.collapsed&&(e=f.startContainer,k.isEmptyBlock(e)))){for(f=e.parentNode;1==k.getChildCount(f)&&!k.isBody(f);)e=f,f=f.parentNode;e===f.lastChild&&c.preventDefault()}});a.addListener("keyup",function(a,c){var d;if(8==(c.keyCode||c.which)&&!this.fireEvent("delkeyup")){d=this.selection.getRange();
|
||||
if(d.collapsed){var h;if((h=k.findParentByTagName(d.startContainer,"h1 h2 h3 h4 h5 h6".split(" "),!0))&&k.isEmptyBlock(h)){var e=h.previousSibling;if(e&&"TABLE"!=e.nodeName){k.remove(h);d.setStartAtLast(e).setCursor(!1,!0);return}if((e=h.nextSibling)&&"TABLE"!=e.nodeName){k.remove(h);d.setStartAtFirst(e).setCursor(!1,!0);return}}k.isBody(d.startContainer)&&(h=k.createElement(this.document,"p",{innerHTML:m.ie?k.fillChar:"<br/>"}),d.insertNode(h).setStart(h,0).setCursor(!1,!0))}!b&&(3==d.startContainer.nodeType||
|
||||
1==d.startContainer.nodeType&&k.isEmptyBlock(d.startContainer))&&(m.ie?(h=d.document.createElement("span"),d.insertNode(h).setStartBefore(h).collapse(!0),d.select(),k.remove(h)):d.select())}})};UM.plugins.autosave=function(){function a(a){var e;20>new Date-d||(a.hasContents()?(d=new Date,a._saveFlag=null,e=b.body.innerHTML,!1!==a.fireEvent("beforeautosave",{content:e})&&(f.saveLocalData(c,e),a.fireEvent("afterautosave",{content:e}))):c&&f.removeItem(c))}var b=this,d=new Date,c=null;b.setOpt("saveInterval",
|
||||
500);var f=UM.LocalStorage=function(){function a(){var a=document.createElement("div");a.style.display="none";if(!a.addBehavior)return null;a.addBehavior("#default#userdata");return{getItem:function(b){var d=null;try{document.body.appendChild(a),a.load(c),d=a.getAttribute(b),document.body.removeChild(a)}catch(q){}return d},setItem:function(b,d){document.body.appendChild(a);a.setAttribute(b,d);a.save(c);document.body.removeChild(a)},removeItem:function(b){document.body.appendChild(a);a.removeAttribute(b);
|
||||
a.save(c);document.body.removeChild(a)}}}var b=window.localStorage||a()||null,c="localStorage";return{saveLocalData:function(a,c){return b&&c?(b.setItem(a,c),!0):!1},getLocalData:function(a){return b?b.getItem(a):null},removeItem:function(a){b&&b.removeItem(a)}}}();b.addListener("ready",function(){var a;a=b.key?b.key+"-drafts-data":(b.container.parentNode.id||"ue-common")+"-drafts-data";c=(location.protocol+location.host+location.pathname).replace(/[.:\/]/g,"_")+a});b.addListener("contentchange",
|
||||
function(){c&&(b._saveFlag&&window.clearTimeout(b._saveFlag),0<b.options.saveInterval?b._saveFlag=window.setTimeout(function(){a(b)},b.options.saveInterval):a(b))});b.commands.clearlocaldata={execCommand:function(a,b){c&&f.getLocalData(c)&&f.removeItem(c)},notNeedUndo:!0,ignoreContentChange:!0};b.commands.getlocaldata={execCommand:function(a,b){return c?f.getLocalData(c)||"":""},notNeedUndo:!0,ignoreContentChange:!0};b.commands.drafts={execCommand:function(a,d){c&&(b.body.innerHTML=f.getLocalData(c)||
|
||||
"<p>"+(m.ie?" ":"<br/>")+"</p>",b.focus(!0))},queryCommandState:function(){return c?null===f.getLocalData(c)?-1:0:-1},notNeedUndo:!0,ignoreContentChange:!0}};UM.plugins.autoupload=function(){var a=this;a.setOpt("pasteImageEnabled",!0);a.setOpt("dropFileEnabled",!0);var b=function(b,c){var d=new FormData;d.append(c.options.imageFieldName||"upfile",b,b.name||"blob."+b.type.substr(6));d.append("type","ajax");var h=new XMLHttpRequest;h.open("post",a.options.imageUrl,!0);h.setRequestHeader("X-Requested-With",
|
||||
"XMLHttpRequest");h.addEventListener("load",function(b){try{var d=eval("("+b.target.response+")").url,e=a.options.imagePath+d;c.execCommand("insertimage",{src:e,_src:e})}catch(v){}});h.send(d)};a.addListener("ready",function(){if(window.FormData&&window.FileReader){var d=function(c){var d=!1;"paste"==c.type?(c=c.originalEvent,c=c.clipboardData&&c.clipboardData.items&&1==c.clipboardData.items.length&&/^image\//.test(c.clipboardData.items[0].type)?c.clipboardData.items:null):(c=c.originalEvent,c=c.dataTransfer&&
|
||||
c.dataTransfer.files?c.dataTransfer.files:null);if(c){for(var h=c.length,e;h--;)e=c[h],e.getAsFile&&(e=e.getAsFile()),e&&0<e.size&&/image\/\w+/i.test(e.type)&&(b(e,a),d=!0);if(d)return!1}};a.getOpt("pasteImageEnabled")&&a.$body.on("paste",d);a.getOpt("dropFileEnabled")&&a.$body.on("drop",d);a.$body.on("dragover",function(a){if("Files"==a.originalEvent.dataTransfer.types[0])return!1})}})};UM.plugins.formula=function(){function a(){return d.$body.find("iframe.edui-formula-active")[0]||null}function b(){var b=
|
||||
a();b&&b.contentWindow.formula.blur()}var d=this;d.addInputRule(function(a){g.each(a.getNodesByTagName("span"),function(a,b){if(b.hasClass("mathquill-embedded-latex")){for(var c,f="";c=b.firstChild();)f+=c.data,b.removeChild(c);b.tagName="iframe";b.setAttr({frameborder:"0",src:d.getOpt("UMEDITOR_HOME_URL")+"dialogs/formula/formula.html","data-latex":n.unhtml(f)})}})});d.addOutputRule(function(a){g.each(a.getNodesByTagName("iframe"),function(a,b){b.hasClass("mathquill-embedded-latex")&&(b.tagName=
|
||||
"span",b.appendChild(UM.uNode.createText(b.getAttr("data-latex"))),b.setAttr({frameborder:"",src:"","data-latex":""}))})});d.addListener("click",function(){b()});d.addListener("afterexeccommand",function(a,d){"formula"!=d&&b()});d.commands.formula={execCommand:function(b,f){var c=a();c?c.contentWindow.formula.insertLatex(f):(d.execCommand("inserthtml",'<span class="mathquill-embedded-latex">'+f+"</span>"),m.ie&&m.ie9below&&setTimeout(function(){var a=d.selection.getRange(),b=a.startContainer;1!=b.nodeType||
|
||||
b.childNodes[a.startOffset]||(a.insertNode(d.document.createTextNode(" ")),a.setCursor())},100))},queryCommandState:function(a){return 0},queryCommandValue:function(b){return(b=a())&&b.contentWindow.formula.getLatex()}}};UM.plugins.xssFilter=function(){function a(a){var b=a.tagName,c=a.attrs;if(!d.hasOwnProperty(b))return a.parentNode.removeChild(a),!1;UM.utils.each(c,function(c,e){-1===UM.utils.indexOf(d[b],e)&&a.setAttr(e)})}var b=UMEDITOR_CONFIG,d=b.whiteList;d&&b.xssFilterRules&&(this.options.filterRules=
|
||||
function(){var b={};UM.utils.each(d,function(c,d){b[d]=function(b){return a(b)}});return b}());var c=[];UM.utils.each(d,function(a,b){c.push(b)});d&&b.inputXssFilter&&this.addInputRule(function(b){b.traversal(function(b){if("element"!==b.type)return!1;a(b)})});d&&b.outputXssFilter&&this.addOutputRule(function(b){b.traversal(function(b){if("element"!==b.type)return!1;a(b)})})};(function(a){function b(b,c,d){b.prototype=a.extend2(a.extend({},c),(UM.ui[d]||f).prototype,!0);b.prototype.supper=(UM.ui[d]||
|
||||
f).prototype;UM.ui[d]&&UM.ui[d].prototype.defaultOpt&&(b.prototype.defaultOpt=a.extend({},UM.ui[d].prototype.defaultOpt,b.prototype.defaultOpt||{}));return b}function d(b,c){a["edui"+c]=b;a.fn["edui"+c]=function(c){var d,e=Array.prototype.slice.call(arguments,1);this.each(function(f,l){var g=a(l),h=g.edui();h||(b(c&&a.isPlainObject(c)?c:{},g),g.edui(h));if("string"==a.type(c))if("this"==c)d=h;else{d=h[c].apply(h,e);if(d!==h&&void 0!==d)return!1;d=null}});return null!==d?d:this}}a.parseTmpl=function(a,
|
||||
b){var c="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/<%=([\s\S]+?)%>/g,function(a,b){return"',obj."+b.replace(/\\'/g,"'")+",'"}).replace(/<%([\s\S]+?)%>/g,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",c=new Function("obj",c);return b?c(b):c};a.extend2=function(b,c){for(var d=
|
||||
arguments,e="boolean"==a.type(d[d.length-1])?d[d.length-1]:!1,f="boolean"==a.type(d[d.length-1])?d.length-1:d.length,l=1;l<f;l++){var g=d[l],h;for(h in g)e&&b.hasOwnProperty(h)||(b[h]=g[h])}return b};a.IE6=!!window.ActiveXObject&&6==parseFloat(navigator.userAgent.match(/msie (\d+)/i)[1]);var c=[],f=function(){};f.prototype={on:function(b,c){this.root().on(b,a.proxy(c,this));return this},off:function(b,c){this.root().off(b,a.proxy(c,this));return this},trigger:function(a,b){return!1===this.root().trigger(a,
|
||||
b)?!1:this},root:function(a){return this._$el||(this._$el=a)},destroy:function(){},data:function(a,b){return void 0!==b?(this.root().data("edui"+a,b),this):this.root().data("edui"+a)},register:function(b,d,f){c.push({evtname:b,$els:a.isArray(d)?d:[d],handler:a.proxy(f,d)})}};a.fn.edui=function(a){return a?this.data("eduiwidget",a):this.data("eduiwidget")};var g=1;UM.ui={define:function(c,f,h){var e=UM.ui[c]=b(function(b,d){var f=function(){};a.extend(f.prototype,e.prototype,{guid:c+g++,widgetName:c});
|
||||
f=new f;if("string"==a.type(b))return f.init&&f.init({}),f.root().edui(f),f.root().find("a").click(function(a){a.preventDefault()}),f.root()["edui"+c].apply(f.root(),arguments);d&&f.root(d);f.init&&f.init(!b||a.isPlainObject(b)?a.extend2(b||{},f.defaultOpt||{},!0):b);try{f.root().find("a").click(function(a){a.preventDefault()})}catch(A){}return f.root().edui(f)},f,h);d(e,c)}};a(function(){a(document).on("click mouseup mousedown dblclick mouseover",function(b){a.each(c,function(c,d){d.evtname==b.type&&
|
||||
a.each(d.$els,function(c,f){f[0]===b.target||a.contains(f[0],b.target)||d.handler(b)})})})})})(jQuery);UM.ui.define("button",{tpl:'<<%if : !${texttype}%>div class="edui-btn edui-btn-${icon} <%if : ${name}%>edui-btn-name-${name}<%/if%>" unselectable="on" onmousedown="return false" <%else%>a class="edui-text-btn"<%/if%><% if: ${title} %> data-original-title="${title}" <%/if%>> <% if: ${icon} %><div unselectable="on" class="edui-icon-${icon} edui-icon"></div><%/if%><%if: ${text} %><span unselectable="on" onmousedown="return false" class="edui-button-label">${text}</span><%/if%><%if: ${caret} && ${text}%><span class="edui-button-spacing"></span><%/if%><% if: ${caret} %><span unselectable="on" onmousedown="return false" class="edui-caret"></span><%/if%></<%if: !${texttype}%>div<%else%>a<%/if%>>',
|
||||
defaultOpt:{text:"",title:"",icon:"",width:"",caret:!1,texttype:!1,click:function(){}},init:function(a){var b=this;b.root(g(UM.utils.render(b.tpl,a))).click(function(d){b.wrapclick(a.click,d)});b.root().hover(function(){b.root().hasClass("edui-disabled")||b.root().toggleClass("edui-hover")});return b},wrapclick:function(a,b){this.disabled()||(this.root().trigger("wrapclick"),g.proxy(a,this,b)());return this},label:function(a){if(void 0===a)return this.root().find(".edui-button-label").text();this.root().find(".edui-button-label").text(a);
|
||||
return this},disabled:function(a){if(void 0===a)return this.root().hasClass("edui-disabled");this.root().toggleClass("edui-disabled",a);this.root().hasClass("edui-disabled")&&this.root().removeClass("edui-hover");return this},active:function(a){if(void 0===a)return this.root().hasClass("edui-active");this.root().toggleClass("edui-active",a);return this},mergeWith:function(a){var b=this;b.data("$mergeObj",a);a.edui().data("$mergeObj",b.root());g.contains(document.body,a[0])||a.appendTo(b.root());b.on("click",
|
||||
function(){b.wrapclick(function(){a.edui().show()})}).register("click",b.root(),function(b){a.hide()})}});(function(){UM.ui.define("toolbar",{tpl:'<div class="edui-toolbar" ><div class="edui-btn-toolbar" unselectable="on" onmousedown="return false" ></div></div>',init:function(){var a=this.root(g(this.tpl));this.data("$btnToolbar",a.find(".edui-btn-toolbar"))},appendToBtnmenu:function(a){var b=this.data("$btnToolbar");a=g.isArray(a)?a:[a];g.each(a,function(a,c){b.append(c)})}})})();UM.ui.define("menu",
|
||||
{show:function(a,b,d,c,f){d=d||"position";!1!==this.trigger("beforeshow")&&(this.root().css(g.extend({display:"block"},a?{top:a[d]().top+("right"==b?0:a.outerHeight())-(c||0),left:a[d]().left+("right"==b?a.outerWidth():0)-(f||0)}:{})),this.trigger("aftershow"))},hide:function(a){var b;!1!==this.trigger("beforehide")&&((b=this.root().data("parentmenu"))&&(b.data("parentmenu")||a)&&b.edui().hide(),this.root().css("display","none"),this.trigger("afterhide"))},attachTo:function(a){var b=this;a.data("$mergeObj")||
|
||||
(a.data("$mergeObj",b.root()),a.on("wrapclick",function(a){b.show()}),b.register("click",a,function(a){b.hide()}),b.data("$mergeObj",a))}});UM.ui.define("dropmenu",{tmpl:'<ul class="edui-dropdown-menu" aria-labelledby="dropdownMenu" ><%for: ${data} as ${ci}%><%if: ${ci.divider}%><li class="edui-divider"></li><%else%><li class="${ci.active} || ${ci.disabled}" data-value="${ci.value}"><a href="#" tabindex="-1"><em class="edui-dropmenu-checkbox"><i class="edui-icon-ok"></i></em>${ci.label}</a></li><%/if%><%/for%></ul>',
|
||||
defaultOpt:{data:[],click:function(){}},init:function(a){var b=this,d={click:1,mouseover:1,mouseout:1};this.root(g(UM.utils.render(this.tmpl,a))).on("click",'li[class!="edui-disabled edui-divider edui-dropdown-submenu"]',function(c){g.proxy(a.click,b,c,g(this).data("value"),g(this))()}).find("li").each(function(c,f){var h=g(this);if(!h.hasClass("edui-disabled edui-divider edui-dropdown-submenu")){var e=a.data[c];g.each(d,function(a){e[a]&&h[a](function(c){g.proxy(e[a],f)(c,e,b.root)})})}})},disabled:function(a){g("li[class!=edui-divider]",
|
||||
this.root()).each(function(){var b=g(this);!0===a?b.addClass("edui-disabled"):g.isFunction(a)?b.toggleClass("edui-disabled",a(li)):b.removeClass("edui-disabled")})},val:function(a){var b;g('li[class!="edui-divider edui-disabled edui-dropdown-submenu"]',this.root()).each(function(){var d=g(this);if(void 0===a){if(d.find("em.edui-dropmenu-checked").length)return b=d.data("value"),!1}else d.find("em").toggleClass("edui-dropmenu-checked",d.data("value")==a)});if(void 0===a)return b},addSubmenu:function(a,
|
||||
b,d){d=d||0;var c=g("li[class!=edui-divider]",this.root());a=g('<li class="edui-dropdown-submenu"><a tabindex="-1" href="#">'+a+"</a></li>").append(b);0<=d&&d<c.length?a.insertBefore(c[d]):0>d?a.insertBefore(c[0]):d>=c.length&&a.appendTo(c)}},"menu");UM.ui.define("splitbutton",{tpl:'<div class="edui-splitbutton <%if: ${name}%>edui-splitbutton-${name}<%/if%>" unselectable="on" <%if: ${title}%>data-original-title="${title}"<%/if%>><div class="edui-btn" unselectable="on" ><%if: ${icon}%><div unselectable="on" class="edui-icon-${icon} edui-icon"></div><%/if%><%if: ${text}%>${text}<%/if%></div><div unselectable="on" class="edui-btn edui-dropdown-toggle" ><div unselectable="on" class="edui-caret"></div></div></div>',
|
||||
defaultOpt:{text:"",title:"",click:function(){}},init:function(a){var b=this;b.root(g(UM.utils.render(b.tpl,a)));b.root().find(".edui-btn:first").click(function(d){b.disabled()||g.proxy(a.click,b)()});b.root().find(".edui-dropdown-toggle").click(function(){b.disabled()||b.trigger("arrowclick")});b.root().hover(function(){b.root().hasClass("edui-disabled")||b.root().toggleClass("edui-hover")});return b},wrapclick:function(a,b){this.disabled()||g.proxy(a,this,b)();return this},disabled:function(a){if(void 0===
|
||||
a)return this.root().hasClass("edui-disabled");this.root().toggleClass("edui-disabled",a).find(".edui-btn").toggleClass("edui-disabled",a);return this},active:function(a){if(void 0===a)return this.root().hasClass("edui-active");this.root().toggleClass("edui-active",a).find(".edui-btn:first").toggleClass("edui-active",a);return this},mergeWith:function(a){var b=this;b.data("$mergeObj",a);a.edui().data("$mergeObj",b.root());g.contains(document.body,a[0])||a.appendTo(b.root());b.root().delegate(".edui-dropdown-toggle",
|
||||
"click",function(){b.wrapclick(function(){a.edui().show()})});b.register("click",b.root().find(".edui-dropdown-toggle"),function(b){a.hide()})}});UM.ui.define("colorsplitbutton",{tpl:'<div class="edui-splitbutton <%if : ${name}%>edui-splitbutton-${name}<%/if%>" unselectable="on" <%if: ${title}%>data-original-title="${title}"<%/if%>><div class="edui-btn" unselectable="on" ><%if: ${icon}%><div unselectable="on" class="edui-icon-${icon} edui-icon"></div><%/if%><div class="edui-splitbutton-color-label" <%if: ${color}%>style="background: ${color}"<%/if%>></div><%if: ${text}%>${text}<%/if%></div><div unselectable="on" class="edui-btn edui-dropdown-toggle" ><div unselectable="on" class="edui-caret"></div></div></div>',
|
||||
defaultOpt:{color:""},init:function(a){this.supper.init.call(this,a)},colorLabel:function(){return this.root().find(".edui-splitbutton-color-label")}},"splitbutton");UM.ui.define("popup",{tpl:'<div class="edui-dropdown-menu edui-popup"<%if:!${stopprop}%>onmousedown="return false"<%/if%>><div class="edui-popup-body" unselectable="on" onmousedown="return false">${subtpl|raw}</div><div class="edui-popup-caret"></div></div>',defaultOpt:{stopprop:!1,subtpl:"",width:"",height:""},init:function(a){this.root(g(UM.utils.render(this.tpl,
|
||||
a)));return this},mergeTpl:function(a){return UM.utils.render(this.tpl,{subtpl:a})},show:function(a,b){b||(b={});var d=b.fnname||"position";!1!==this.trigger("beforeshow")&&(this.root().css(g.extend({display:"block"},a?{top:a[d]().top+("right"==b.dir?0:a.outerHeight())-(b.offsetTop||0),left:a[d]().left+("right"==b.dir?a.outerWidth():0)-(b.offsetLeft||0),position:"absolute"}:{})),this.root().find(".edui-popup-caret").css({top:b.caretTop||0,left:b.caretLeft||0,position:"absolute"}).addClass(b.caretDir||
|
||||
"up"),this.trigger("aftershow"))},hide:function(){this.root().css("display","none");this.trigger("afterhide")},attachTo:function(a,b){var d=this;a.data("$mergeObj")||(a.data("$mergeObj",d.root()),a.on("wrapclick",function(c){d.show(a,b)}),d.register("click",a,function(a){d.hide()}),d.data("$mergeObj",a))},getBodyContainer:function(){return this.root().find(".edui-popup-body")}});UM.ui.define("scale",{tpl:'<div class="edui-scale" unselectable="on"><span class="edui-scale-hand0"></span><span class="edui-scale-hand1"></span><span class="edui-scale-hand2"></span><span class="edui-scale-hand3"></span><span class="edui-scale-hand4"></span><span class="edui-scale-hand5"></span><span class="edui-scale-hand6"></span><span class="edui-scale-hand7"></span></div>',
|
||||
defaultOpt:{$doc:g(document),$wrap:g(document)},init:function(a){a.$doc&&(this.defaultOpt.$doc=a.$doc);a.$wrap&&(this.defaultOpt.$wrap=a.$wrap);this.root(g(UM.utils.render(this.tpl,a)));this.initStyle();this.startPos=this.prePos={x:0,y:0};this.dragId=-1;return this},initStyle:function(){n.cssRule("edui-style-scale",".edui-scale{display:none;position:absolute;border:1px solid #38B2CE;cursor:hand;}.edui-scale span{position:absolute;left:0;top:0;width:7px;height:7px;overflow:hidden;font-size:0px;display:block;background-color:#3C9DD0;}.edui-scale .edui-scale-hand0{cursor:nw-resize;top:0;margin-top:-4px;left:0;margin-left:-4px;}.edui-scale .edui-scale-hand1{cursor:n-resize;top:0;margin-top:-4px;left:50%;margin-left:-4px;}.edui-scale .edui-scale-hand2{cursor:ne-resize;top:0;margin-top:-4px;left:100%;margin-left:-3px;}.edui-scale .edui-scale-hand3{cursor:w-resize;top:50%;margin-top:-4px;left:0;margin-left:-4px;}.edui-scale .edui-scale-hand4{cursor:e-resize;top:50%;margin-top:-4px;left:100%;margin-left:-3px;}.edui-scale .edui-scale-hand5{cursor:sw-resize;top:100%;margin-top:-3px;left:0;margin-left:-4px;}.edui-scale .edui-scale-hand6{cursor:s-resize;top:100%;margin-top:-3px;left:50%;margin-left:-4px;}.edui-scale .edui-scale-hand7{cursor:se-resize;top:100%;margin-top:-3px;left:100%;margin-left:-3px;}")},
|
||||
_eventHandler:function(a){var b=this.defaultOpt.$doc;switch(a.type){case "mousedown":var d=a.target||a.srcElement;-1!=d.className.indexOf("edui-scale-hand")&&(this.dragId=d.className.slice(-1),this.startPos.x=this.prePos.x=a.clientX,this.startPos.y=this.prePos.y=a.clientY,b.bind("mousemove",g.proxy(this._eventHandler,this)));break;case "mousemove":-1!=this.dragId&&(this.updateContainerStyle(this.dragId,{x:a.clientX-this.prePos.x,y:a.clientY-this.prePos.y}),this.prePos.x=a.clientX,this.prePos.y=a.clientY,
|
||||
this.updateTargetElement());break;case "mouseup":-1!=this.dragId&&(this.dragId=-1,this.updateTargetElement(),this.data("$scaleTarget").parent()&&this.attachTo(this.data("$scaleTarget"))),b.unbind("mousemove",g.proxy(this._eventHandler,this))}},updateTargetElement:function(){var a=this.root(),b=this.data("$scaleTarget");b.css({width:a.width(),height:a.height()});this.attachTo(b)},updateContainerStyle:function(a,b){var d=this.root(),c,f=[[0,0,-1,-1],[0,0,0,-1],[0,0,1,-1],[0,0,-1,0],[0,0,1,0],[0,0,-1,
|
||||
1],[0,0,0,1],[0,0,1,1]];0!=f[a][0]&&(c=parseInt(d.offset().left)+b.x,d.css("left",this._validScaledProp("left",c)));0!=f[a][1]&&(c=parseInt(d.offset().top)+b.y,d.css("top",this._validScaledProp("top",c)));0!=f[a][2]&&(c=d.width()+f[a][2]*b.x,d.css("width",this._validScaledProp("width",c)));0!=f[a][3]&&(c=d.height()+f[a][3]*b.y,d.css("height",this._validScaledProp("height",c)))},_validScaledProp:function(a,b){var d=this.root(),c=this.defaultOpt.$doc,f=function(a,c,d){return a+c>d?d-c:b};b=isNaN(b)?
|
||||
0:b;switch(a){case "left":return 0>b?0:f(b,d.width(),c.width());case "top":return 0>b?0:f(b,d.height(),c.height());case "width":return 0>=b?1:f(b,d.offset().left,c.width());case "height":return 0>=b?1:f(b,d.offset().top,c.height())}},show:function(a){a&&this.attachTo(a);this.root().bind("mousedown",g.proxy(this._eventHandler,this));this.defaultOpt.$doc.bind("mouseup",g.proxy(this._eventHandler,this));this.root().show();this.trigger("aftershow")},hide:function(){this.root().unbind("mousedown",g.proxy(this._eventHandler,
|
||||
this));this.defaultOpt.$doc.unbind("mouseup",g.proxy(this._eventHandler,this));this.root().hide();this.trigger("afterhide")},attachTo:function(a){var b=a.offset(),d=this.root(),c=this.defaultOpt.$wrap,f=c.offset();this.data("$scaleTarget",a);this.root().css({position:"absolute",width:a.width(),height:a.height(),left:b.left-f.left-parseInt(c.css("border-left-width"))-parseInt(d.css("border-left-width")),top:b.top-f.top-parseInt(c.css("border-top-width"))-parseInt(d.css("border-top-width"))})},getScaleTarget:function(){return this.data("$scaleTarget")[0]}});
|
||||
UM.ui.define("colorpicker",{tpl:function(a){for(var b="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(" "),
|
||||
d='<div unselectable="on" onmousedown="return false" class="edui-colorpicker<%if : ${name}%> edui-colorpicker-${name}<%/if%>" ><table unselectable="on" onmousedown="return false"><tr><td colspan="10">'+a.lang_themeColor+'</td> </tr><tr class="edui-colorpicker-firstrow" >',c=0;c<b.length;c++)c&&0===c%10&&(d+="</tr>"+(60==c?'<tr><td colspan="10">'+a.lang_standardColor+"</td></tr>":"")+"<tr"+(60==c?' class="edui-colorpicker-firstrow"':"")+">"),d+=70>c?'<td><a unselectable="on" onmousedown="return false" title="'+
|
||||
b[c]+'" class="edui-colorpicker-colorcell" data-color="#'+b[c]+'" style="background-color:#'+b[c]+";border:solid #ccc;"+(10>c||60<=c?"border-width:1px;":10<=c&&20>c?"border-width:1px 1px 0 1px;":"border-width:0 1px 0 1px;")+'"></a></td>':"";return d+"</tr></table></div>"},init:function(a){var b=this;b.root(g(UM.utils.render(b.supper.mergeTpl(b.tpl(a)),a)));b.root().on("click",function(a){b.trigger("pickcolor",g(a.target).data("color"))})}},"popup");(function(){UM.ui.define("combobox",function(){return{tpl:'<ul class="dropdown-menu edui-combobox-menu<%if: ${comboboxName} !==\'\'%> edui-combobox-${comboboxName}<%/if%>" unselectable="on" onmousedown="return false" role="menu" aria-labelledby="dropdownMenu"><%if: ${autoRecord} %><%for : ${recordStack} as ${recordItem}, ${index}%><%var : style = ${itemStyles}[${recordItem}]%><%var : record = ${items}[${recordItem}]%><li class="${itemClassName}<%if: ${selected} == ${recordItem}%> edui-combobox-checked<%/if%>" data-item-index="${recordItem}" unselectable="on" onmousedown="return false"><span class="edui-combobox-icon" unselectable="on" onmousedown="return false"></span><label class="${labelClassName}" style="${style}" unselectable="on" onmousedown="return false">${record}</label></li><%/for%><%if: ${index} %><li class="edui-combobox-item-separator"></li><%/if%><%/if%><%for: ${items} as ${item}, ${itemIndex}%><%var : labelStyle = ${itemStyles}[${itemIndex}]%><li class="${itemClassName}<%if: ${selected} == ${item} %> edui-combobox-checked<%/if%> edui-combobox-item-${itemIndex}" data-item-index="${itemIndex}" unselectable="on" onmousedown="return false"><span class="edui-combobox-icon" unselectable="on" onmousedown="return false"></span><label class="${labelClassName}" style="${labelStyle}" unselectable="on" onmousedown="return false">${item}</label></li><%/for%></ul>',
|
||||
defaultOpt:{recordStack:[],items:[],value:[],comboboxName:"",selected:"",autoRecord:!0,recordCount:5},init:function(a){g.extend(this._optionAdaptation(a),this._createItemMapping(a.recordStack,a.items),{itemClassName:"edui-combobox-item",iconClass:"edui-combobox-checked-icon",labelClassName:"edui-combobox-item-label"});this._transStack(a);this.root(g(UM.utils.render(this.tpl,a)));this.data("options",a).initEvent()},initEvent:function(){this.initSelectItem();this.initItemActive()},initSelectItem:function(){var a=
|
||||
this;a.root().delegate(".edui-combobox-item","click",function(){var b=g(this),d=b.attr("data-item-index");a.trigger("comboboxselect",{index:d,label:b.find(".edui-combobox-item-label").text(),value:a.data("options").value[d]}).select(d);a.hide();return!1})},initItemActive:function(){var a={mouseenter:"addClass",mouseleave:"removeClass"};if(g.IE6)this.root().delegate(".edui-combobox-item","mouseenter mouseleave",function(b){g(this)[a[b.type]]("edui-combobox-item-hover")}).one("afterhide",function(){})},
|
||||
select:function(a){var b=this.data("options").itemCount,d=this.data("options").autowidthitem;d&&!d.length&&(d=this.data("options").items);if(0==b)return null;0>a?a=b+a%b:a>=b&&(a=b-1);this.trigger("changebefore",d[a]);this._update(a);this.trigger("changeafter",d[a]);return null},selectItemByLabel:function(a){var b=this.data("options").itemMapping,d=this,c=null;!g.isArray(a)&&(a=[a]);g.each(a,function(a,g){c=b[g];if(void 0!==c)return d.select(c),!1})},_transStack:function(a){var b=[],d=-1,c=-1;g.each(a.recordStack,
|
||||
function(f,h){d=a.itemMapping[h];g.isNumeric(d)&&(b.push(d),h==a.selected&&(c=d))});a.recordStack=b;a.selected=c;b=null},_optionAdaptation:function(a){if(!("itemStyles"in a)){a.itemStyles=[];for(var b=0,d=a.items.length;b<d;b++)a.itemStyles.push("")}a.autowidthitem=a.autowidthitem||a.items;a.itemCount=a.items.length;return a},_createItemMapping:function(a,b){var d={},c={recordStack:[],mapping:{}};g.each(b,function(a,b){d[b]=a});c.itemMapping=d;g.each(a,function(a,b){void 0!==d[b]&&(c.recordStack.push(d[b]),
|
||||
c.mapping[b]=d[b])});return c},_update:function(a){var b=this.data("options"),d=[],c=null;g.each(b.recordStack,function(b,c){c!=a&&d.push(+c)});d.unshift(+a);d.length>b.recordCount&&(d.length=b.recordCount);b.recordStack=d;b.selected=+a;c=g(UM.utils.render(this.tpl,b));this.root().html(c.html());d=c=null}}}(),"menu")})();(function(){UM.ui.define("buttoncombobox",function(){return{defaultOpt:{label:"",title:""},init:function(a){var b=this,d=g.eduibutton({caret:!0,name:a.comboboxName,title:a.title,
|
||||
text:a.label,click:function(){b.show(this.root())}});b.supper.init.call(b,a);b.on("changebefore",function(a,b){d.eduibutton("label",b)});b.data("button",d);b.attachTo(d)},button:function(){return this.data("button")}}}(),"combobox")})();UM.ui.define("modal",{tpl:'<div class="edui-modal" tabindex="-1" ><div class="edui-modal-header"><div class="edui-close" data-hide="modal"></div><h3 class="edui-title">${title}</h3></div><div class="edui-modal-body" style="<%if: ${width}%>width:${width}px;<%/if%><%if: ${height}%>height:${height}px;<%/if%>"> </div><% if: ${cancellabel} || ${oklabel} %><div class="edui-modal-footer"><div class="edui-modal-tip"></div><%if: ${oklabel}%><div class="edui-btn edui-btn-primary" data-ok="modal">${oklabel}</div><%/if%><%if: ${cancellabel}%><div class="edui-btn" data-hide="modal">${cancellabel}</div><%/if%></div><%/if%></div>',
|
||||
defaultOpt:{title:"",cancellabel:"",oklabel:"",width:"",height:"",backdrop:!0,keyboard:!0},init:function(a){this.root(g(UM.utils.render(this.tpl,a||{})));this.data("options",a);if(a.okFn)this.on("ok",g.proxy(a.okFn,this));if(a.cancelFn)this.on("beforehide",g.proxy(a.cancelFn,this));this.root().delegate('[data-hide="modal"]',"click",g.proxy(this.hide,this)).delegate('[data-ok="modal"]',"click",g.proxy(this.ok,this));g('[data-hide="modal"],[data-ok="modal"]',this.root()).hover(function(){g(this).toggleClass("edui-hover")})},
|
||||
toggle:function(){return this[this.data("isShown")?"hide":"show"]()},show:function(){var a=this;a.trigger("beforeshow");a.data("isShown")||(a.data("isShown",!0),a.escape(),a.backdrop(function(){a.autoCenter();a.root().show().focus().trigger("aftershow")}))},showTip:function(a){g(".edui-modal-tip",this.root()).html(a).fadeIn()},hideTip:function(a){g(".edui-modal-tip",this.root()).fadeOut(function(){g(this).html("")})},autoCenter:function(){!g.IE6&&this.root().css("margin-left",-(this.root().width()/
|
||||
2))},hide:function(){this.trigger("beforehide");this.data("isShown")&&(this.data("isShown",!1),this.escape(),this.hideModal())},escape:function(){var a=this;if(a.data("isShown")&&a.data("options").keyboard)a.root().on("keyup",function(b){27==b.which&&a.hide()});else a.data("isShown")||a.root().off("keyup")},hideModal:function(){var a=this;a.root().hide();a.backdrop(function(){a.removeBackdrop();a.trigger("afterhide")})},removeBackdrop:function(){this.$backdrop&&this.$backdrop.remove();this.$backdrop=
|
||||
null},backdrop:function(a){this.data("isShown")&&this.data("options").backdrop&&(this.$backdrop=g('<div class="edui-modal-backdrop" />').click("static"==this.data("options").backdrop?g.proxy(this.root()[0].focus,this.root()[0]):g.proxy(this.hide,this)));this.trigger("afterbackdrop");a&&a()},attachTo:function(a){var b=this;a.data("$mergeObj")||(a.data("$mergeObj",b.root()),a.on("click",function(){b.toggle(a)}),b.data("$mergeObj",a))},ok:function(){this.trigger("beforeok");!1!==this.trigger("ok",this)&&
|
||||
this.hide()},getBodyContainer:function(){return this.root().find(".edui-modal-body")}});UM.ui.define("tooltip",{tpl:'<div class="edui-tooltip" unselectable="on" onmousedown="return false"><div class="edui-tooltip-arrow" unselectable="on" onmousedown="return false"></div><div class="edui-tooltip-inner" unselectable="on" onmousedown="return false"></div></div>',init:function(a){this.root(g(UM.utils.render(this.tpl,a||{})))},content:function(a){a=g(a.currentTarget).attr("data-original-title");this.root().find(".edui-tooltip-inner").text(a)},
|
||||
position:function(a){a=g(a.currentTarget);this.root().css(g.extend({display:"block"},a?{top:a.outerHeight(),left:(a.outerWidth()-this.root().outerWidth())/2}:{}))},show:function(a){g(a.currentTarget).hasClass("edui-disabled")||(this.content(a),this.root().appendTo(g(a.currentTarget)),this.position(a),this.root().css("display","block"))},hide:function(){this.root().css("display","none")},attachTo:function(a){function b(a){var b=this;g.contains(document.body,b.root()[0])||b.root().appendTo(a);b.data("tooltip",
|
||||
b.root());a.each(function(){if(g(this).attr("data-original-title"))g(this).on("mouseenter",g.proxy(b.show,b)).on("mouseleave click",g.proxy(b.hide,b))})}var d=this;"undefined"===g.type(a)?g("[data-original-title]").each(function(a,f){b.call(d,g(f))}):a.data("tooltip")||b.call(d,a)}});UM.ui.define("tab",{init:function(a){var b=this,d=a.selector;g.type(d)&&(b.root(g(d,a.context)),b.data("context",a.context),g(d,b.data("context")).on("click",function(a){b.show(a)}))},show:function(a){var b=this,d=g(a.target),
|
||||
c=d.closest("ul"),f,h;f=(f=d.attr("data-context"))&&f.replace(/.*(?=#[^\s]*$)/,"");a=d.parent("li");a.length&&!a.hasClass("edui-active")&&(h=c.find(".edui-active:last a")[0],a=g.Event("beforeshow",{target:d[0],relatedTarget:h}),b.trigger(a),a.isDefaultPrevented()||(f=g(f,b.data("context")),b.activate(d.parent("li"),c),b.activate(f,f.parent(),function(){b.trigger({type:"aftershow",relatedTarget:h})})))},activate:function(a,b,d){if(void 0===a)return g(".edui-tab-item.edui-active",this.root()).index();
|
||||
b.find("> .edui-active").removeClass("edui-active");a.addClass("edui-active");d&&d()}});UM.ui.define("separator",{tpl:'<div class="edui-separator" unselectable="on" onmousedown="return false" ></div>',init:function(a){this.root(g(g.parseTmpl(this.tpl,a)));return this}});(function(){var a={},b={},d=[],c={},f={},h={},e=null;n.extend(UM,{defaultWidth:500,defaultHeight:500,registerUI:function(b,c){n.each(b.split(/\s+/),function(b){a[b]=c})},setEditor:function(a){!b[a.id]&&(b[a.id]=a)},registerWidget:function(a,
|
||||
b,d){c[a]=g.extend2(b,{$root:"",_preventDefault:!1,root:function(a){return this.$root||(this.$root=a)},preventDefault:function(){this._preventDefault=!0},clear:!1});d&&(f[a]=d)},getWidgetData:function(a){return c[a]},setWidgetBody:function(a,b,d){d._widgetData||n.extend(d,{_widgetData:{},getWidgetData:function(a){return this._widgetData[a]},getWidgetCallback:function(a){var c=this;return function(){return f[a].apply(c,[c,b].concat(Array.prototype.slice.call(arguments,0)))}}});var e=c[a];if(!e)return null;
|
||||
e=d._widgetData[a];e||(e=c[a],e=d._widgetData[a]="function"==g.type(e)?e:n.clone(e));e.root(b.edui().getBodyContainer());e.initContent(d,b);e._preventDefault||e.initEvent(d,b);e.width&&b.width(e.width)},setActiveWidget:function(a){},getEditor:function(a,c){var d=b[a]||(b[a]=this.createEditor(a,c));e=e?Math.max(d.getOpt("zIndex"),e):d.getOpt("zIndex");return d},setTopEditor:function(a){g.each(b,function(b,c){a==c?a.$container&&a.$container.css("zIndex",e+1):c.$container&&c.$container.css("zIndex",
|
||||
c.getOpt("zIndex"))})},clearCache:function(a){b[a]&&delete b[a]},delEditor:function(a){var c;(c=b[a])&&c.destroy()},ready:function(a){d.push(a)},createEditor:function(a,b){function c(){var b=this.createUI("#"+a,e);e.key=a;e.ready(function(){g.each(d,function(a,b){g.proxy(b,e)()})});var c=e.options;c.minFrameWidth=c.initialFrameWidth?c.initialFrameWidth:c.initialFrameWidth=e.$body.width()||UM.defaultWidth;b.css({width:c.initialFrameWidth,zIndex:e.getOpt("zIndex")});UM.browser.ie&&6===UM.browser.version&&
|
||||
document.execCommand("BackgroundImageCache",!1,!0);e.render(a);g.eduitooltip&&g.eduitooltip("attachTo",g("[data-original-title]",b)).css("z-index",e.getOpt("zIndex")+1);b.find("a").click(function(a){a.preventDefault()});e.fireEvent("afteruiready")}var e=new UM.Editor(b);e.langIsReady?g.proxy(c,this)():e.addListener("langReady",g.proxy(c,this));return e},createUI:function(b,c){var d=g(b),e=g('<div class="edui-container"><div class="edui-editor-body"></div></div>').insertBefore(d);c.$container=e;c.container=
|
||||
e[0];c.$body=d;m.ie&&m.ie9above&&g('<span style="padding:0;margin:0;height:0;width:0"></span>').insertAfter(e);g.each(a,function(a,b){var d=b.call(c,a);d&&(h[a]=d)});e.find(".edui-editor-body").append(d).before(this.createToolbar(c.options,c));e.find(".edui-toolbar").append(g('<div class="edui-dialog-container"></div>'));return e},createToolbar:function(a,b){var c=g.eduitoolbar(),d=c.edui();if(a.toolbar&&a.toolbar.length){var e=[];g.each(a.toolbar,function(a,b){g.each(b.split(/\s+/),function(a,b){if("|"==
|
||||
b)g.eduiseparator&&e.push(g.eduiseparator());else{var c=h[b];"fullscreen"==b?c&&e.unshift(c):c&&e.push(c)}});e.length&&d.appendToBtnmenu(e)})}else c.find(".edui-btn-toolbar").remove();return c}})})();UM.registerUI("bold italic redo undo underline strikethrough superscript subscript insertorderedlist insertunorderedlist cleardoc selectall link unlink print preview justifyleft justifycenter justifyright justifyfull removeformat horizontal drafts",function(a){var b=this,d=g.eduibutton({icon:a,click:function(){b.execCommand(a)},
|
||||
title:this.getLang("labelMap")[a]||""});this.addListener("selectionchange",function(){var b=this.queryCommandState(a);d.edui().disabled(-1==b).active(1==b)});return d});(function(){function a(a){var b=this;if(!a)throw Error("invalid params, notfound editor");b.editor=a;e[a.uid]=this;a.addListener("destroy",function(){delete e[a.uid];b.editor=null})}var b={},d="width height position top left margin padding overflowX overflowY".split(" "),c={},f={},h={},e={};UM.registerUI("fullscreen",function(b){var c=
|
||||
this,d=g.eduibutton({icon:"fullscreen",title:c.options.labelMap&&c.options.labelMap[b]||c.getLang("labelMap."+b),click:function(){c.execCommand(b);UM.setTopEditor(c)}});c.addListener("selectionchange",function(){var a=this.queryCommandState(b);d.edui().disabled(-1==a).active(1==a)});c.addListener("ready",function(){c.options.fullscreen&&a.getInstance(c).toggle()});return d});UM.commands.fullscreen={execCommand:function(b){a.getInstance(this).toggle()},queryCommandState:function(a){return this._edui_fullscreen_status},
|
||||
notNeedUndo:1};a.prototype={toggle:function(){var a=this.editor,b=this.isFullState();a.fireEvent("beforefullscreenchange",!b);this.update(!b);b?this.revert():this.enlarge();a.fireEvent("afterfullscreenchange",!b);"true"===a.body.contentEditable&&a.fireEvent("fullscreenchanged",!b);a.fireEvent("selectionchange")},enlarge:function(){this.saveSataus();this.setDocumentStatus();this.resize()},revert:function(){var a=this.editor.options,a=/%$/.test(a.initialFrameHeight)?"100%":a.initialFrameHeight-this.getStyleValue("padding-top")-
|
||||
this.getStyleValue("padding-bottom")-this.getStyleValue("border-width");g.IE6&&this.getEditorHolder().style.setExpression("height","this.scrollHeight <= "+a+' ? "'+a+'px" : "auto"');this.revertContainerStatus();this.revertContentAreaStatus();this.revertDocumentStatus()},update:function(a){this.editor._edui_fullscreen_status=a},resize:function(){var a,b,c,d=0,e=this.editor,f,h;this.isFullState()&&(a=g(window),b=a.width(),a=a.height(),h=this.getEditorHolder(),c=parseInt(k.getComputedStyle(h,"border-width"),
|
||||
10)||0,c+=parseInt(k.getComputedStyle(e.container,"border-width"),10)||0,d+=parseInt(k.getComputedStyle(h,"padding-left"),10)+parseInt(k.getComputedStyle(h,"padding-right"),10)||0,g.IE6&&h.style.setExpression("height",null),f=this.getBound(),g(e.container).css({width:b+"px",height:a+"px",position:g.IE6?"absolute":"fixed",top:f.top,left:f.left,margin:0,padding:0,overflowX:"hidden",overflowY:"hidden"}),g(h).css({width:b-2*c-d+"px",height:a-2*c-(e.options.withoutToolbar?0:g(".edui-toolbar",e.container).outerHeight())-
|
||||
g(".edui-bottombar",e.container).outerHeight()+"px",overflowX:"hidden",overflowY:"auto"}))},saveSataus:function(){for(var a=this.editor.container.style,c,e={},f=0,g=d.length;f<g;f++)c=d[f],e[c]=a[c];b[this.editor.uid]=e;this.saveContentAreaStatus();this.saveDocumentStatus()},saveContentAreaStatus:function(){var a=g(this.getEditorHolder());c[this.editor.uid]={width:a.css("width"),overflowX:a.css("overflowX"),overflowY:a.css("overflowY"),height:a.css("height")}},saveDocumentStatus:function(){var a=
|
||||
g(this.getEditorDocumentBody());f[this.editor.uid]={overflowX:a.css("overflowX"),overflowY:a.css("overflowY")};h[this.editor.uid]={overflowX:g(this.getEditorDocumentElement()).css("overflowX"),overflowY:g(this.getEditorDocumentElement()).css("overflowY")}},revertContainerStatus:function(){g(this.editor.container).css(this.getEditorStatus())},revertContentAreaStatus:function(){var a=this.getEditorHolder(),b=this.getContentAreaStatus();this.supportMin()&&(delete b.height,a.style.height=null);g(a).css(b)},
|
||||
revertDocumentStatus:function(){var a=this.getDocumentStatus();g(this.getEditorDocumentBody()).css("overflowX",a.body.overflowX);g(this.getEditorDocumentElement()).css("overflowY",a.html.overflowY)},setDocumentStatus:function(){g(this.getEditorDocumentBody()).css({overflowX:"hidden",overflowY:"hidden"});g(this.getEditorDocumentElement()).css({overflowX:"hidden",overflowY:"hidden"})},isFullState:function(){return!!this.editor._edui_fullscreen_status},getEditorStatus:function(){return b[this.editor.uid]},
|
||||
getContentAreaStatus:function(){return c[this.editor.uid]},getEditorDocumentElement:function(){return this.editor.container.ownerDocument.documentElement},getEditorDocumentBody:function(){return this.editor.container.ownerDocument.body},getEditorHolder:function(){return this.editor.body},getDocumentStatus:function(){return{body:f[this.editor.uid],html:h[this.editor.uid]}},supportMin:function(){var a;this._support||(a=document.createElement("div"),this._support="minWidth"in a.style);return this._support},
|
||||
getBound:function(){var a={html:!0,body:!0},b={top:0,left:0},c;if(!g.IE6)return b;(c=this.editor.container.offsetParent)&&!a[c.nodeName.toLowerCase()]&&(a=c.getBoundingClientRect(),b.top=-a.top,b.left=-a.left);return b},getStyleValue:function(a){return parseInt(k.getComputedStyle(this.getEditorHolder(),a))}};g.extend(a,{listen:function(){var b=null;a._hasFullscreenListener||(a._hasFullscreenListener=!0,g(window).on("resize",function(){null!==b&&(window.clearTimeout(b),b=null);b=window.setTimeout(function(){for(var a in e)e[a].resize();
|
||||
b=null},50)}))},getInstance:function(b){e[b.uid]||new a(b);return e[b.uid]}});a.listen()})();UM.registerUI("link image video map formula",function(a){var b=this,d,c,f={title:b.options.labelMap&&b.options.labelMap[a]||b.getLang("labelMap."+a),url:b.options.UMEDITOR_HOME_URL+"dialogs/"+a+"/"+a+".js"},h=g.eduibutton({icon:a,title:this.getLang("labelMap")[a]||""});n.loadFile(document,{src:f.url,tag:"script",type:"text/javascript",defer:"defer"},function(){var e=UM.getWidgetData(a);if(e){if(e.buttons){var l=
|
||||
e.buttons.ok;l&&(f.oklabel=l.label||b.getLang("ok"),l.exec&&(f.okFn=function(){return g.proxy(l.exec,null,b,c)()}));var k=e.buttons.cancel;k&&(f.cancellabel=k.label||b.getLang("cancel"),k.exec&&(f.cancelFn=function(){return g.proxy(k.exec,null,b,c)()}))}e.width&&(f.width=e.width);e.height&&(f.height=e.height);c=g.eduimodal(f);c.attr("id","edui-dialog-"+a).addClass("edui-dialog-"+a).find(".edui-modal-body").addClass("edui-dialog-"+a+"-body");c.edui().on("beforehide",function(){var a=b.selection.getRange();
|
||||
a.equals(d)&&a.select()}).on("beforeshow",function(){var e,f=this.root(),h;d=b.selection.getRange();f.parent()[0]||b.$container.find(".edui-dialog-container").append(f);g.IE6&&(e=g(window).width(),g(window).height(),h=f.parents(".edui-toolbar")[0].getBoundingClientRect(),f.css({position:"absolute",margin:0,left:(e-f.width())/2-h.left,top:100-h.top}));UM.setWidgetBody(a,c,b);UM.setTopEditor(b)}).on("afterbackdrop",function(){this.$backdrop.css("zIndex",b.getOpt("zIndex")+1).appendTo(b.$container.find(".edui-dialog-container"));
|
||||
c.css("zIndex",b.getOpt("zIndex")+2)}).on("beforeok",function(){try{d.select()}catch(v){}}).attachTo(h)}});b.addListener("selectionchange",function(){var b=this.queryCommandState(a);h.edui().disabled(-1==b).active(1==b)});return h});UM.registerUI("emotion formula",function(a){var b=this,d=b.options.UMEDITOR_HOME_URL+"dialogs/"+a+"/"+a+".js",c=g.eduibutton({icon:a,title:this.getLang("labelMap")[a]||""});n.loadFile(document,{src:d,tag:"script",type:"text/javascript",defer:"defer"},function(){var f=
|
||||
{url:d},h=UM.getWidgetData(a);h.width&&(f.width=h.width);h.height&&(f.height=h.height);g.eduipopup(f).css("zIndex",b.options.zIndex+1).addClass("edui-popup-"+a).edui().on("beforeshow",function(){var c=this.root();c.parent().length||b.$container.find(".edui-dialog-container").append(c);UM.setWidgetBody(a,c,b);UM.setTopEditor(b)}).attachTo(c,{offsetTop:-5,offsetLeft:10,caretLeft:11,caretTop:-8});b.addListener("selectionchange",function(){var b=this.queryCommandState(a);c.edui().disabled(-1==b).active(1==
|
||||
b)})});return c});UM.registerUI("imagescale",function(){var a=this,b;a.setOpt("imageScaleEnabled",!0);m.webkit&&a.getOpt("imageScaleEnabled")&&(a.addListener("click",function(d,c){var f=a.selection.getRange().getClosedNode(),h=c.target;if(f&&"IMG"==f.tagName&&h==f){if(!b){b=g.eduiscale({$wrap:a.$container}).css("zIndex",a.options.zIndex);a.$container.append(b);var e=function(){b.edui().hide()},k=function(a){var b=a.target||a.srcElement;b&&-1==b.className.indexOf("edui-scale")&&e(a)},m;b.edui().on("aftershow",
|
||||
function(){g(document).bind("keydown",e);g(document).bind("mousedown",k);a.selection.getNative().removeAllRanges()}).on("afterhide",function(){g(document).unbind("keydown",e);g(document).unbind("mousedown",k);var c=b.edui().getScaleTarget();c.parentNode&&a.selection.getRange().selectNode(c).select()}).on("mousedown",function(c){a.selection.getNative().removeAllRanges();(c=c.target||c.srcElement)&&-1==c.className.indexOf("edui-scale-hand")&&(m=setTimeout(function(){b.edui().hide()},200))}).on("mouseup",
|
||||
function(a){(a=a.target||a.srcElement)&&-1==a.className.indexOf("edui-scale-hand")&&clearTimeout(m)})}b.edui().show(g(f))}else b&&"none"!=b.css("display")&&b.edui().hide()}),a.addListener("click",function(b,c){"IMG"==c.target.tagName&&(new x.Range(a.document,a.body)).selectNode(c.target).select()}))});UM.registerUI("autofloat",function(){var a=this,b=a.getLang();a.setOpt({autoFloatEnabled:!0,topOffset:0});var d=a.options.topOffset;!1!==a.options.autoFloatEnabled&&a.ready(function(){function c(){var a=
|
||||
document.body.style;a.backgroundImage='url("about:blank")';a.backgroundAttachment="fixed"}function f(){v.parentNode&&v.parentNode.removeChild(v);r.style.cssText=p}function h(){var b=a.container,c;try{c=b.getBoundingClientRect()}catch(z){c={left:0,top:0,height:0,width:0}}for(var g=Math.round(c.top),h=Math.round(c.bottom-c.top),n;(n=b.ownerDocument)!==document&&(b=k.getWindow(n).frameElement);)c=b.getBoundingClientRect(),g+=c.top;b=a.options.toolbarTopOffset||0;0>g&&g+h-r.offsetHeight>b?y||(g=k.getXY(r),
|
||||
h=k.getComputedStyle(r,"position"),b=k.getComputedStyle(r,"left"),r.style.width=r.offsetWidth+"px",r.style.zIndex=1*a.options.zIndex+1,r.parentNode.insertBefore(v,r),e||l&&m.ie?("absolute"!=r.style.position&&(r.style.position="absolute"),r.style.top=(document.body.scrollTop||document.documentElement.scrollTop)-q+d+"px"):"fixed"!=r.style.position&&(r.style.position="fixed",r.style.top=d+"px",("absolute"==h||"relative"==h)&&parseFloat(b)&&(r.style.left=g.x+"px"))):f()}var e=m.ie&&6>=m.version,l=m.quirks,
|
||||
p,v=document.createElement("div"),r,q,y=!1,w=n.defer(function(){h()},m.ie?200:100,!0);a.addListener("destroy",function(){g(window).off("scroll resize",h);a.removeListener("keydown",w)});var x;UM.ui?x=1:(alert(b.autofloatMsg),x=0);x&&(r=g(".edui-toolbar",a.container)[0],a.addListener("afteruiready",function(){setTimeout(function(){q=g(r).offset().top},100)}),p=r.style.cssText,v.style.height=r.offsetHeight+"px",e&&c(),g(window).on("scroll resize",h),a.addListener("keydown",w),a.addListener("resize",
|
||||
function(){f();v.style.height=r.offsetHeight+"px";h()}),a.addListener("beforefullscreenchange",function(a,b){b&&(f(),y=b)}),a.addListener("fullscreenchanged",function(a,b){b||h();y=b}),a.addListener("sourcemodechanged",function(a,b){setTimeout(function(){h()},0)}),a.addListener("clearDoc",function(){setTimeout(function(){h()},0)}))})});UM.registerUI("source",function(a){var b=this;b.addListener("fullscreenchanged",function(){b.$container.find("textarea").width(b.$body.width()-10).height(b.$body.height())});
|
||||
var d=g.eduibutton({icon:a,click:function(){b.execCommand(a);UM.setTopEditor(b)},title:this.getLang("labelMap")[a]||""});this.addListener("selectionchange",function(){var b=this.queryCommandState(a);d.edui().disabled(-1==b).active(1==b)});return d});UM.registerUI("paragraph fontfamily fontsize",function(a){function b(a,c){var d=g("<span>").html(a).css({display:"inline",position:"absolute",top:-1E7,left:-1E5}).appendTo(document.body),e=d.width();d.remove();if(50>e)return a;a=a.slice(0,c?-4:-1);return a.length?
|
||||
b(a+"...",!0):"..."}function d(a){var c=[],d;for(d in a.items)a.value.push(d),c.push(d),a.autowidthitem.push(b(d));a.items=c;a.autoRecord=!1;return a}function c(a){for(var c,d=[],e=0,f=a.items.length;e<f;e++)c=a.items[e].val,d.push(c.split(/\s*,\s*/)[0]),a.itemStyles.push("font-family: "+c),a.value.push(c),a.autowidthitem.push(b(d[e]));a.items=d;return a}function f(a){var b,c=[];a.itemStyles=[];a.value=[];for(var d=0,e=a.items.length;d<e;d++)b=a.items[d],c.push(b),a.itemStyles.push("font-size: "+
|
||||
b+"px");a.value=a.items;a.items=c;a.autoRecord=!1;return a}var h=this,e=h.options.labelMap&&h.options.labelMap[a]||h.getLang("labelMap."+a),e={label:e,title:e,comboboxName:a,items:h.options[a]||[],itemStyles:[],value:[],autowidthitem:[]},k=null,m=null;if(0==e.items.length)return null;switch(a){case "paragraph":e=d(e);break;case "fontfamily":e=c(e);break;case "fontsize":e=f(e)}k=g.eduibuttoncombobox(e).css("zIndex",h.getOpt("zIndex")+1);m=k.edui();m.on("comboboxselect",function(b,c){h.execCommand(a,
|
||||
c.value)}).on("beforeshow",function(){0===k.parent().length&&k.appendTo(h.$container.find(".edui-dialog-container"));UM.setTopEditor(h)});this.addListener("selectionchange",function(b){b=this.queryCommandState(a);var c=this.queryCommandValue(a);m.button().edui().disabled(-1==b).active(1==b);c&&(c=c.replace(/['"]/g,"").toLowerCase().split(/['|"]?\s*,\s*[\1]?/),m.selectItemByLabel(c))});return m.button().addClass("edui-combobox")});UM.registerUI("forecolor backcolor",function(a){var b=this,d=null,c=
|
||||
null,f=null;this.addListener("selectionchange",function(){var b=this.queryCommandState(a);f.edui().disabled(-1==b).active(1==b)});f=g.eduicolorsplitbutton({icon:a,caret:!0,name:a,title:b.getLang("labelMap")[a],click:function(){b.execCommand(a,k.getComputedStyle(c[0],"background-color"))}});c=f.edui().colorLabel();d=g.eduicolorpicker({name:a,lang_clearColor:b.getLang("clearColor")||"",lang_themeColor:b.getLang("themeColor")||"",lang_standardColor:b.getLang("standardColor")||""}).on("pickcolor",function(d,
|
||||
e){window.setTimeout(function(){c.css("backgroundColor",e);b.execCommand(a,e)},0)}).on("show",function(){UM.setActiveWidget(colorPickerWidget.root())}).css("zIndex",b.getOpt("zIndex")+1);f.edui().on("arrowclick",function(){d.parent().length||b.$container.find(".edui-dialog-container").append(d);d.edui().show(f,{caretDir:"down",offsetTop:-5,offsetLeft:8,caretLeft:11,caretTop:-8});UM.setTopEditor(b)}).register("click",f,function(){d.edui().hide()});return f})})(jQuery);
|
||||