XMTT 6 years ago
parent
commit
7c5729b639

+ 6 - 0
js/ueditor/dialogs/image/image.css

@ -316,6 +316,7 @@
316 316
#upload .filelist li {
317 317
    width: 113px;
318 318
    height: 113px;
319
    box-sizing:border-box;
319 320
    background: url(./images/bg.png);
320 321
    text-align: center;
321 322
    margin: 9px 0 0 9px;
@ -327,6 +328,11 @@
327 328
    font-size: 12px;
328 329
}
329 330
331
#upload .filelist .move {
332
   border: 2px dashed green;
333
   opacity: 0.7
334
}
335
330 336
#upload .filelist li p.log {
331 337
    position: relative;
332 338
    top: -45px;

+ 2 - 2
js/ueditor/dialogs/image/image.html

@ -18,13 +18,13 @@
18 18
<body>
19 19
20 20
    <div class="wrapper">
21
        <div id="tabhead" class="tabhead">
21
        <div id="tabhead" class="tabhead" style="display:none;">
22 22
            <span class="tab" data-content-id="remote"><var id="lang_tab_remote"></var></span>
23 23
            <span class="tab focus" data-content-id="upload"><var id="lang_tab_upload"></var></span>
24 24
            <span class="tab" data-content-id="online"><var id="lang_tab_online"></var></span>
25 25
            <span class="tab" data-content-id="search"><var id="lang_tab_search"></var></span>
26 26
        </div>
27
        <div class="alignBar">
27
        <div class="alignBar" style="display:none;">
28 28
            <label class="algnLabel"><var id="lang_input_align"></var></label>
29 29
                    <span id="alignIcon">
30 30
                        <span id="noneAlign" class="none-align focus" data-align="none"></span>

+ 46 - 2
js/ueditor/dialogs/image/image.js

@ -399,10 +399,41 @@
399 399
            });
400 400
401 401
            setState('pedding');
402
402
            $('.filelist').on('dragstart','li', function(ev){
403
            	$(this).addClass('move')
404
				ev.originalEvent.dataTransfer.setData("Text",ev.currentTarget.id);
405
            })
406
             $('.filelist').on('dragend','li', function(ev){
407
            	$('.filelist').find('li').removeClass('move')
408
            })
409
             $('.filelist').on('drop','li', function(ev){ 
410
             	var currendId = ev.currentTarget.id;
411
             	var moveId = ev.originalEvent.dataTransfer.getData("Text");
412
             	if(currendId == 'filePickerBlock' || moveId == 'filePickerBlock') {
413
             		return;
414
             	}
415
             	var arr = [];
416
             	var $s = $('.filelist').children();
417
             	for(var i = 0; i < $s.length-1; i++) {
418
             		arr.push($s[i].id)
419
             	}
420
             	var currendIndex = arr.indexOf(currendId);
421
             	var moveIndex = arr.indexOf(moveId)
422
             	var chang1 = $('#'+ currendId);
423
             	var chang2 = $('#'+ moveId);
424
             	if (moveIndex < currendIndex) {
425
             		chang2.insertAfter(chang1);
426
             	} 
427
             	if (moveIndex > currendIndex) {
428
             		chang2.insertBefore(chang1);
429
             	}
430
            })
431
             $('.filelist').on('dragover','li', function(ev){
432
             	ev.preventDefault()
433
            })
403 434
            // 当有文件添加进来时执行,负责view的创建
404 435
            function addFile(file) {
405
                var $li = $('<li id="' + file.id + '">' +
436
                var $li = $('<li id="' + file.id + '" draggable="true" style="cursor:move">' +
406 437
                        '<p class="title">' + file.name + '</p>' +
407 438
                        '<p class="imgWrap"></p>' +
408 439
                        '<p class="progress"><span></span></p>' +
@ -721,6 +752,7 @@
721 752
                    var responseText = (ret._raw || ret),
722 753
                        json = utils.str2json(responseText);
723 754
                    if (json.state == 'SUCCESS') {
755
                    	json.index = file.id;
724 756
                        _this.imageList.push(json);
725 757
                        $file.append('<span class="success"></span>');
726 758
                    } else {
@ -770,9 +802,21 @@
770 802
            this.$wrap.remove();
771 803
        },
772 804
        getInsertList: function () {
805
            var $s = $('.filelist').children();
806
            var arr = []
807
            for(var i = 0; i < $s.length-1; i++) {
808
             	arr.push($s[i].id)
809
             }
810
            this.imageList.forEach(function(item) {
811
            	item.index = arr.indexOf(item.index);
812
            })
773 813
            var i, data, list = [],
774 814
                align = getAlign(),
775 815
                prefix = editor.getOpt('imageUrlPrefix');
816
                this.imageList.sort(function(x, y) {
817
	                if(x.index <= y.index) return -1;
818
	                return 1;
819
            	});
776 820
            for (i = 0; i < this.imageList.length; i++) {
777 821
                data = this.imageList[i];
778 822
                list.push({

+ 14 - 14
js/ueditor/lang/en/en.js

@ -28,24 +28,24 @@ UE.I18N['en'] = {
28 28
        'music':'Music', 'charts': 'charts','drafts': 'Load from Drafts'
29 29
    },
30 30
    'insertorderedlist':{
31
        'num':'1,2,3...',
32
        'num1':'1),2),3)...',
33
        'num2':'(1),(2),(3)...',
34
        'cn':'一,二,三....',
35
        'cn1':'一),二),三)....',
36
        'cn2':'(一),(二),(三)....',
31
//      'num':'1,2,3...',
32
//      'num1':'1),2),3)...',
33
//      'num2':'(1),(2),(3)...',
34
//      'cn':'一,二,三....',
35
//      'cn1':'一),二),三)....',
36
//      'cn2':'(一),(二),(三)....',
37 37
        'decimal':'1,2,3...',
38
        'lower-alpha':'a,b,c...',
39
        'lower-roman':'i,ii,iii...',
40
        'upper-alpha':'A,B,C...',
41
        'upper-roman':'I,II,III...'
38
//      'lower-alpha':'a,b,c...',
39
//      'lower-roman':'i,ii,iii...',
40
//      'upper-alpha':'A,B,C...',
41
//      'upper-roman':'I,II,III...'
42 42
    },
43 43
    'insertunorderedlist':{
44
        'circle':'○ Circle',
44
//      'circle':'○ Circle',
45 45
        'disc':'● Circle dot',
46
        'square':'■ Rectangle ',
47
        'dash' :'- Dash',
48
        'dot' : '。dot'
46
//      'square':'■ Rectangle ',
47
//      'dash' :'- Dash',
48
//      'dot' : '。dot'
49 49
    },
50 50
    'paragraph':{'p':'Paragraph', 'h1':'Title 1', 'h2':'Title 2', 'h3':'Title 3', 'h4':'Title 4', 'h5':'Title 5', 'h6':'Title 6'},
51 51
    'fontfamily':{

+ 5 - 5
js/ueditor/lang/zh-cn/zh-cn.js

@ -69,7 +69,7 @@ UE.I18N['zh-cn'] = {
69 69
    },
70 70
    'autoupload': {
71 71
        'exceedSizeError': '文件大小超出限制',
72
        'exceedTypeError': '文件格式不允许',
72
        'exceedTypeError': '只能上传jpeg/jpg/png/bmp/gif格式的图片',
73 73
        'jsonEncodeError': '服务器返回格式错误',
74 74
        'loading':"正在上传...",
75 75
        'loadError':"上传错误",
@ -77,7 +77,7 @@ UE.I18N['zh-cn'] = {
77 77
    },
78 78
    'simpleupload':{
79 79
        'exceedSizeError': '文件大小超出限制',
80
        'exceedTypeError': '文件格式不允许',
80
        'exceedTypeError': '只能上传jpeg/jpg/png/bmp/gif格式的图片',
81 81
        'jsonEncodeError': '服务器返回格式错误',
82 82
        'loading':"正在上传...",
83 83
        'loadError':"上传错误",
@ -297,7 +297,7 @@ UE.I18N['zh-cn'] = {
297 297
        'errorNotSupport': 'WebUploader 不支持您的浏览器!如果你使用的是IE浏览器,请尝试升级 flash 播放器。',
298 298
        'errorLoadConfig': '后端配置项没有正常加载,上传插件不能正常使用!',
299 299
        'errorExceedSize':'文件大小超出',
300
        'errorFileType':'文件格式不允许',
300
        'errorFileType':'只能上传jpeg/jpg/png/bmp/gif格式的图片',
301 301
        'errorInterrupt':'文件传输中断',
302 302
        'errorUploadRetry':'上传失败,请重试',
303 303
        'errorHttp':'http请求错误',
@ -334,7 +334,7 @@ UE.I18N['zh-cn'] = {
334 334
        'errorNotSupport': 'WebUploader 不支持您的浏览器!如果你使用的是IE浏览器,请尝试升级 flash 播放器。',
335 335
        'errorLoadConfig': '后端配置项没有正常加载,上传插件不能正常使用!',
336 336
        'errorExceedSize':'文件大小超出',
337
        'errorFileType':'文件格式不允许',
337
        'errorFileType':'只能上传jpeg/jpg/png/bmp/gif格式的图片',
338 338
        'errorInterrupt':'文件传输中断',
339 339
        'errorUploadRetry':'上传失败,请重试',
340 340
        'errorHttp':'http请求错误',
@ -420,7 +420,7 @@ UE.I18N['zh-cn'] = {
420 420
        'errorNotSupport': 'WebUploader 不支持您的浏览器!如果你使用的是IE浏览器,请尝试升级 flash 播放器。',
421 421
        'errorLoadConfig': '后端配置项没有正常加载,上传插件不能正常使用!',
422 422
        'errorExceedSize':'文件大小超出',
423
        'errorFileType':'文件格式不允许',
423
        'errorFileType':'只能上传jpeg/jpg/png/bmp/gif格式的图片',
424 424
        'errorInterrupt':'文件传输中断',
425 425
        'errorUploadRetry':'上传失败,请重试',
426 426
        'errorHttp':'http请求错误',

+ 63 - 26
js/ueditor/ueditor.all.js

@ -14953,24 +14953,24 @@ UE.plugins['list'] = function () {
14953 14953
    me.setOpt( {
14954 14954
        'autoTransWordToList':false,
14955 14955
        'insertorderedlist':{
14956
            'num':'',
14957
            'num1':'',
14958
            'num2':'',
14959
            'cn':'',
14960
            'cn1':'',
14961
            'cn2':'',
14956
//          'num':'',
14957
//          'num1':'',
14958
//          'num2':'',
14959
//          'cn':'',
14960
//          'cn1':'',
14961
//          'cn2':'',
14962 14962
            'decimal':'',
14963
            'lower-alpha':'',
14964
            'lower-roman':'',
14965
            'upper-alpha':'',
14966
            'upper-roman':''
14963
//          'lower-alpha':'',
14964
//          'lower-roman':'',
14965
//          'upper-alpha':'',
14966
//          'upper-roman':''
14967 14967
        },
14968 14968
        'insertunorderedlist':{
14969
            'circle':'',
14969
//          'circle':'',
14970 14970
            'disc':'',
14971
            'square':'',
14972
            'dash' : '',
14973
            'dot':''
14971
//          'square':'',
14972
//          'dash' : '',
14973
//          'dot':''
14974 14974
        },
14975 14975
        listDefaultPaddingLeft : '30',
14976 14976
        listiconpath : 'http://bs.baidu.com/listicon/',
@ -18966,12 +18966,12 @@ UE.plugins['video'] = function (){
18966 18966
                for (var r = 0; r < rowsNum; r++) {
18967 18967
                    html.push('<tr' + (r == 0 ? ' class="firstRow"':'') + '>');
18968 18968
                    for (var c = 0; c < colsNum; c++) {
18969
                        html.push('<td width="' + tdWidth + '"  vAlign="' + opt.tdvalign + '" >' + (browser.ie && browser.version < 11 ? domUtils.fillChar : '<br/>') + '</td>')
18969
                        html.push('<td style="border:1px solid #ccc;" width="' + tdWidth + '"  vAlign="' + opt.tdvalign + '" >' + (browser.ie && browser.version < 11 ? domUtils.fillChar : '<br/>') + '</td>')
18970 18970
                    }
18971 18971
                    html.push('</tr>')
18972 18972
                }
18973 18973
                //禁止指定table-width
18974
                return '<table><tbody>' + html.join('') + '</tbody></table>'
18974
                return '<table style="border-collapse:collapse;"><tbody>' + html.join('') + '</tbody></table>'
18975 18975
            }
18976 18976
18977 18977
            if (!opt) {
@ -19827,12 +19827,20 @@ UE.plugins['video'] = function (){
19827 19827
            return 0;
19828 19828
        },
19829 19829
        execCommand: function () {
19830
            var table = getTableItemsByRange(this).table;
19831
            utils.each(domUtils.getElementsByTagName(table,'td'),function(td){
19832
                td.style.borderWidth = '1px';
19833
                td.style.borderStyle = 'solid';
19834
            })
19835
        }
19830
		    var table = getTableItemsByRange(this).table;
19831
		    utils.each(domUtils.getElementsByTagName(table,'td'),function(td){
19832
		        td.style.borderWidth = '1px';
19833
		        td.style.borderStyle = 'solid';
19834
		        td.style.borderColor = 'windowtext';
19835
		    });
19836
		    //增加下面一段
19837
		    utils.each(domUtils.getElementsByTagName(table,'th'),function(th){
19838
		        th.style.borderWidth = domUtils.getComputedStyle(th, "border-width");
19839
		        th.style.borderStyle = 'solid';
19840
		        th.style.borderColor = 'windowtext';
19841
		    });
19842
		}
19843
19836 19844
    };
19837 19845
    function resetTdWidth(table, editor) {
19838 19846
        var tds = domUtils.getElementsByTagName(table,'td th');
@ -20238,17 +20246,40 @@ UE.plugins['table'] = function () {
20238 20246
                        div.innerHTML = div[browser.ie ? 'innerText' : 'textContent'];
20239 20247
                    }
20240 20248
                } else {
20241
                    utils.each(tables, function (table) {
20249
                	utils.each(tables, function (table) {                        
20250
                        //粘贴进来的表格table定义属性
20251
                        domUtils.setAttributes(table, {
20252
                            style:'border-left:1px solid #666; border-top:1px solid #ccc;',
20253
                        });                                            
20254
                        
20242 20255
                        removeStyleSize(table, true);
20243 20256
                        domUtils.removeAttributes(table, ['style', 'border']);
20257
                        //domUtils.removeAttributes(table, ['style']);//no remove table Style
20244 20258
                        utils.each(domUtils.getElementsByTagName(table, "td"), function (td) {
20259
                            
20260
                            //粘贴进来的表格td定义属性
20261
                            domUtils.setAttributes(td, {
20262
                                style:'border-bottom:1px solid #666; border-right:1px solid #ccc; padding:5px;',
20263
                            });                        
20264
                        
20245 20265
                            if (isEmptyBlock(td)) {
20246 20266
                                domUtils.fillNode(me.document, td);
20247 20267
                            }
20248 20268
                            removeStyleSize(td, true);
20249
//                            domUtils.removeAttributes(td, ['style'])
20269
                            //domUtils.removeAttributes(td, ['style'])
20250 20270
                        });
20251 20271
                    });
20272
20273
//                  utils.each(tables, function (table) {
20274
//                      removeStyleSize(table, true);
20275
//                      domUtils.removeAttributes(table, ['style']); // ['style', 'border']
20276
//                      utils.each(domUtils.getElementsByTagName(table, "td"), function (td) {
20277
//                          if (isEmptyBlock(td)) {
20278
//                              domUtils.fillNode(me.document, td);
20279
//                          }
20280
//                          removeStyleSize(td, true);
20281
//                      });
20282
//                  });
20252 20283
                }
20253 20284
                html.html = div.innerHTML;
20254 20285
            }
@ -21908,6 +21939,7 @@ UE.plugins['tablesort'] = function () {
21908 21939
        execCommand: function (cmd) {
21909 21940
            var table = getTableItemsByRange(this).table;
21910 21941
            table.setAttribute("data-sort", cmd == "enablesort" ? "sortEnabled" : "sortDisabled");
21942
            table.setAttribute("style", "border-collapse:collapse;");
21911 21943
            cmd == "enablesort" ? domUtils.addClass(table,"sortEnabled"):domUtils.removeClasses(table,"sortEnabled");
21912 21944
        }
21913 21945
    };
@ -21928,7 +21960,7 @@ UE.plugins['tablesort'] = function () {
21928 21960
21929 21961
UE.plugins['contextmenu'] = function () {
21930 21962
    var me = this;
21931
    me.setOpt('enableContextMenu',true);
21963
    me.setOpt('enableContextMenu',false);
21932 21964
    if(me.getOpt('enableContextMenu') === false){
21933 21965
        return;
21934 21966
    }
@ -24533,7 +24565,12 @@ UE.plugin.register('simpleupload', function (){
24533 24565
                            loader.removeAttribute('id');
24534 24566
                            domUtils.removeClasses(loader, 'loadingclass');
24535 24567
                        } else {
24536
                            showErrorLoader && showErrorLoader(json.state);
24568
                        	if(json.state=="文件大小超出限制") {
24569
                        		showErrorLoader && showErrorLoader("文件大小不能超过2M");
24570
                        	}else{
24571
                        		showErrorLoader && showErrorLoader(json.state);
24572
                        	}
24573
                            
24537 24574
                        }
24538 24575
                    }catch(er){
24539 24576
                        showErrorLoader && showErrorLoader(me.getLang('simpleupload.loadError'));

+ 9 - 71
js/ueditor/ueditor.config.js

@ -36,12 +36,13 @@
36 36
        //工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的重新定义
37 37
        , toolbars: [[
38 38
            'fullscreen', 'source', '|', 'undo', 'redo', '|',
39
            'bold', 'italic', 'underline', '|',
39
            'bold', 'italic',/* 'underline',*/ '|',
40 40
            'insertorderedlist', 'insertunorderedlist', '|',
41 41
            'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
42 42
            'spechars', '|',
43
           	'superscript', 'subscript','|',
44
            'simpleupload','link'
43
           	'superscript', 'subscript','|','link','simpleupload','insertimage', '|', 
44
           	'removeformat','formatmatch', '|',
45
           	'inserttable', 'mergecells', 'splittocells'
45 46
        ]]
46 47
        
47 48
        /*, toolbars: [[
@ -122,7 +123,7 @@
122 123
        //粘贴只保留标签,去除标签所有属性
123 124
        //,retainOnlyLabelPasted: false
124 125
125
        ,pasteplain:true  //是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
126
        ,pasteplain:false  //是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
126 127
        //纯文本粘贴模式下的过滤规则
127 128
        //'filterTxtRules' : function(){
128 129
        //    function transP(node){
@ -333,7 +334,7 @@
333 334
334 335
        //tableDragable
335 336
        //表格是否可以拖拽
336
        //,tableDragable: true
337
          ,tableDragable: true
337 338
338 339
339 340
@ -356,7 +357,7 @@
356 357
        //}
357 358
358 359
        //allowLinkProtocol 允许的链接地址,有这些前缀的链接地址不会自动添加http
359
        , allowLinkProtocols: ['http:', 'https:', '#', '/', 'ftp:', 'mailto:', 'tel:', 'git:', 'svn:']
360
        //, allowLinkProtocols: ['http:', 'https:', '#', '/', 'ftp:', 'mailto:', 'tel:', 'git:', 'svn:']
360 361
361 362
        //webAppKey 百度应用的APIkey,每个站长必须首先去百度官网注册一个key后方能正常使用app功能,注册介绍,http://app.baidu.com/static/cms/getapikey.html
362 363
        //, webAppKey: ""
@ -374,7 +375,7 @@
374 375
		,outputXssFilter: true
375 376
		// xss过滤白名单 名单来源: https://raw.githubusercontent.com/leizongmin/js-xss/master/lib/default.js
376 377
		,whitList: {
377
			/*a:      [],
378
			a:      ['target', 'href', 'title', 'class', 'style'],
378 379
			abbr:   ['title', 'class', 'style'],
379 380
			address: ['class', 'style'],
380 381
			area:   ['shape', 'coords', 'href', 'alt'],
@ -436,70 +437,7 @@
436 437
			tt:     [],
437 438
			u:      [],
438 439
			ul:     ['class', 'style'],
439
			video:  ['autoplay', 'controls', 'loop', 'preload', 'src', 'height', 'width', 'class', 'style']*/
440
			a:      ['target', 'href', 'title', 'class', 'style'],
441
			abbr:   [],
442
			address: [],
443
			area:   [],
444
			article: [],
445
			aside:  [],
446
			audio:  [],
447
			b:      [],
448
			bdi:    [],
449
			bdo:    [],
450
			big:    [],
451
			blockquote: [],
452
			br:     [],
453
			caption: [],
454
			center: [],
455
			cite:   [],
456
			code:   [],
457
			col:    [],
458
			colgroup: [],
459
			dd:     [],
460
			del:    [],
461
			details: [],
462
			div:    [],
463
			dl:     [],
464
			dt:     [],
465
			em:     [],
466
			font:   [],
467
			footer: [],
468
			h1:     [],
469
			h2:     [],
470
			h3:     [],
471
			h4:     [],
472
			h5:     [],
473
			h6:     [],
474
			header: [],
475
			hr:     [],
476
			i:      [],
477
			img:    ['src', 'alt', 'title', 'width', 'height', 'id', '_src', 'loadingclass', 'class', 'data-latex'],
478
			ins:    [],
479
			li:     [],
480
			mark:   [],
481
			nav:    [],
482
			ol:     [],
483
			p:      ['style'],
484
			pre:    [],
485
			s:      [],
486
			section:[],
487
			small:  [],
488
			span:   [],
489
			sub:    [],
490
			sup:    [],
491
			strong: [],
492
			table:  [],
493
			tbody:  [],
494
			td:     [],
495
			tfoot:  [],
496
			th:     [],
497
			thead:  [],
498
			tr:     [],
499
			tt:     [],
500
			u:      [],
501
			ul:     [],
502
			video:  []
440
			video:  ['autoplay', 'controls', 'loop', 'preload', 'src', 'height', 'width', 'class', 'style']
503 441
		}
504 442
    };
505 443