Explorar el Código

富文本问题优化

黄勇成 hace 1 año
padre
commit
65c1398751

+ 5 - 5
src/main/webapp/WEB-INF/pages/admin/notice/noticeAppPublish.jsp

@@ -14,13 +14,13 @@
 				/>
 				<!-- Theme style -->
 				<link href="<c:url value='/styles/AdminLTE.css'/>" rel="stylesheet" type="text/css" />
-				<link href="<c:url value='/styles/notice/noticeAppPublish.css?v=222222'/>" rel="stylesheet" type="text/css" />
+				<link href="<c:url value='/styles/notice/noticeAppPublish.css?v=20230526'/>" rel="stylesheet" type="text/css" />
 				<link href="<c:url value='/scripts/lib/plugins/noticePhotoClip/cropper.css'/>" rel="stylesheet" type="text/css" />
 				<link href="<c:url value='/scripts/lib/plugins/noticePhotoClip/myCrop.css'/>" rel="stylesheet" type="text/css" />
 
 				<script type="text/javascript" src="<c:url value='/scripts/lib/jquery-1.8.2.min.js'/>"></script>
-				<script type="text/javascript" src="<c:url value='/scripts/lib/ueditor/ueditor.config.js?v=1.4'/>"></script>
-				<script type="text/javascript" src="<c:url value='/scripts/lib/ueditor/ueditor.all.js'/>"></script>
+				<script type="text/javascript" src="<c:url value='/scripts/lib/ueditor/ueditor.config.js?v=20230526.3'/>"></script>
+				<script type="text/javascript" src="<c:url value='/scripts/lib/ueditor/ueditor.all.js?v=20230526.3'/>"></script>
 				<script type="text/javascript" src="<c:url value='/scripts/lib/layui/layui.js'/>"></script>
 				<script type="text/javascript" src="<c:url value='/scripts/lib/template-native.js'/>"></script>
 
@@ -343,7 +343,7 @@
 									<span class="add-notice-btn"></span>
 								</div>
 							</div>
-							<div class="announcement-right main-content-mode-wp">
+							<div class="announcement-right main-content-mode-wp" style="width: calc(100% - 400px);">
 								<div class="announcement-list">
 									<div class="announcement-item">
 										<div class="cover-wp clearfloat">
@@ -368,7 +368,7 @@
 										</div>
 										<div class="content-wp clearfloat">
 											<span class="tips">正文</span>
-											<div id="myeditor_a_1" class="u_editor"></div>
+											<div id="myeditor_a_1" class="u_editor" style=""></div>
 										</div>
 										<div class="summary-wp clearfloat">
 											<span class="tips">摘要</span>

+ 29 - 22
src/main/webapp/scripts/lib/ueditor/ueditor.all.js

@@ -6914,7 +6914,7 @@ var fillCharReg = new RegExp(domUtils.fillChar, 'g');
                 container.style.zIndex = options.zIndex;
 
                 var html = ( ie && browser.version < 9  ? '' : '<!DOCTYPE html>') +
-                    '<html xmlns=\'http://www.w3.org/1999/xhtml\' class=\'view\' style=\'overflow:hidden\'><head>' +
+                    '<html xmlns=\'http://www.w3.org/1999/xhtml\' class=\'view\' style=\'overflow:auto\'><head>' +
                     '<style type=\'text/css\'>' +
                     //设置四周的留边
                     '.view{padding:0;word-wrap:break-word;cursor:text;height:90%}\n' +
@@ -6941,7 +6941,7 @@ var fillCharReg = new RegExp(domUtils.fillChar, 'g');
                         'document.write("' + html + '");document.close();}())'
                 }));
                 container.style.overflow = 'hidden';
-                
+
                 //解决如果是给定的百分比,会导致高度算不对的问题
                 setTimeout(function(){
                     if( /%$/.test(options.initialFrameWidth)){
@@ -12667,7 +12667,7 @@ UE.plugins['paragraph'] = function() {
                         } );
                     }
                     tmpRange.setEndAfter( tmpNode );
-                    
+
                     para = range.document.createElement( style );
                     if(attrs){
                         domUtils.setAttributes(para,attrs);
@@ -12679,7 +12679,7 @@ UE.plugins['paragraph'] = function() {
                     //需要内容占位
                     if(domUtils.isEmptyNode(para)){
                         domUtils.fillChar(range.document,para);
-                        
+
                     }
 
                     tmpRange.insertNode( para );
@@ -12803,7 +12803,7 @@ UE.plugins['paragraph'] = function() {
 
         },
         doDirectionality = function(range,editor,forward){
-            
+
             var bookmark,
                 filterFn = function( node ) {
                     return   node.nodeType == 1 ? !domUtils.isBookmarkNode(node) : !domUtils.isWhitespace(node);
@@ -17988,6 +17988,9 @@ UE.plugins['video'] = function (){
     UETable.prototype = {
         getMaxRows:function () {
             var rows = this.table.rows, maxLen = 1;
+            if (rows.length===0) {
+              return maxLen;
+            }
             for (var i = 0, row; row = rows[i]; i++) {
                 var currentMax = 1;
                 for (var j = 0, cj; cj = row.cells[j++];) {
@@ -20249,10 +20252,10 @@ UE.plugins['table'] = function () {
                         // domUtils.removeAttributes(table, ['style', 'border']);
 
                         //2021-09-30修改 如下   参照https://www.cnblogs.com/xiangsj/p/6244794.html
-                
+
                         domUtils.setAttributes(table, {
                             style:'border-left:1px solid #666; border-top:1px solid #666;',
-                        }); 
+                        });
                         removeStyleSize(table, true);
 
                         utils.each(domUtils.getElementsByTagName(table, "td"), function (td) {
@@ -20260,7 +20263,7 @@ UE.plugins['table'] = function () {
                               //粘贴进来的表格td定义属性
                               domUtils.setAttributes(td, {
                                 style:'border-bottom:1px solid #666; border-right:1px solid #666; padding:5px;',
-                            }); 
+                            });
                             if (isEmptyBlock(td)) {
                                 domUtils.fillNode(me.document, td);
                             }
@@ -21132,11 +21135,11 @@ UE.plugins['table'] = function () {
 
         //是否正在等待resize的缓冲中
         isInResizeBuffer = true;
+        tableBorderDrag( evt );
 
-        tableDragTimer = setTimeout(function(){
-            tableBorderDrag( evt );
-        }, dblclickTime);
-
+        // tableDragTimer = setTimeout(function(){
+        //    tableBorderDrag( evt );
+        // }, dblclickTime);
     }
 
     function extractArray( originArr, key ) {
@@ -21195,7 +21198,7 @@ UE.plugins['table'] = function () {
         }
         hideDragLine(me);
         getDragLine(me, me.document);
-        me.fireEvent('saveScene');
+        // me.fireEvent('saveScene');
         showDragLineAt(state, startTd);
         mousedown = true;
         //拖动开始
@@ -22744,7 +22747,7 @@ UE.plugins['formatmatch'] = function(){
      });
 
     function addList(type,evt){
-        
+
         if(browser.webkit){
             var target = evt.target.tagName == 'IMG' ? evt.target : null;
         }
@@ -22810,7 +22813,7 @@ UE.plugins['formatmatch'] = function(){
 
     me.commands['formatmatch'] = {
         execCommand : function( cmdName ) {
-          
+
             if(flag){
                 flag = 0;
                 list = [];
@@ -22819,7 +22822,7 @@ UE.plugins['formatmatch'] = function(){
             }
 
 
-              
+
             var range = me.selection.getRange();
             img = range.getClosedNode();
             if(!img || img.tagName != 'IMG'){
@@ -23996,6 +23999,10 @@ UE.plugin.register('autosave', function (){
 
             'contentchange': function () {
 
+                if (!me.getOpt('enableAutoSave')) {
+                  return;
+                }
+
                 if ( !saveKey ) {
                     return;
                 }
@@ -25294,7 +25301,7 @@ UE.ui = baidu.editor.ui = {};
         domUtils = baidu.editor.dom.domUtils,
         UIBase = baidu.editor.ui.UIBase,
         uiUtils = baidu.editor.ui.uiUtils;
-    
+
     var Mask = baidu.editor.ui.Mask = function (options){
         this.initOptions(options);
         this.initUIBase();
@@ -25590,7 +25597,7 @@ UE.ui = baidu.editor.ui = {};
         }
     };
     utils.inherits(Popup, UIBase);
-    
+
     domUtils.on( document, 'mousedown', function ( evt ) {
         var el = evt.target || evt.srcElement;
         closeAllPopup( evt,el );
@@ -25686,7 +25693,7 @@ UE.ui = baidu.editor.ui = {};
     var utils = baidu.editor.utils,
         uiUtils = baidu.editor.ui.uiUtils,
         UIBase = baidu.editor.ui.UIBase;
-    
+
     var TablePicker = baidu.editor.ui.TablePicker = function (options){
         this.initOptions(options);
         this.initTablePicker();
@@ -25770,7 +25777,7 @@ UE.ui = baidu.editor.ui = {};
     var browser = baidu.editor.browser,
         domUtils = baidu.editor.dom.domUtils,
         uiUtils = baidu.editor.ui.uiUtils;
-    
+
     var TPL_STATEFUL = 'onmousedown="$$.Stateful_onMouseDown(event, this);"' +
         ' onmouseup="$$.Stateful_onMouseUp(event, this);"' +
         ( browser.ie ? (
@@ -25779,7 +25786,7 @@ UE.ui = baidu.editor.ui = {};
         : (
         ' onmouseover="$$.Stateful_onMouseOver(event, this);"' +
         ' onmouseout="$$.Stateful_onMouseOut(event, this);"' ));
-    
+
     baidu.editor.ui.Stateful = {
         alwalysHoverable: false,
         target:null,//目标元素和this指向dom不一样
@@ -27404,7 +27411,7 @@ UE.ui = baidu.editor.ui = {};
         setValue : function(value){
             this._value = value;
         }
-        
+
     };
     utils.inherits(MenuButton, SplitButton);
 })();

+ 23 - 23
src/main/webapp/scripts/lib/ueditor/ueditor.config.js

@@ -101,7 +101,7 @@
         //,autoClearEmptyNode : true //getContent时,是否删除空的inlineElement节点(包括嵌套的情况)
 
         //启用自动保存
-        //,enableAutoSave: true
+        ,enableAutoSave: false
         //自动保存间隔时间, 单位ms
         //,saveInterval: 500
 
@@ -148,31 +148,31 @@
 
         //insertorderedlist
         //有序列表的下拉配置,值留空时支持多语言自动识别,若配置值,则以此值为准
-        //,'insertorderedlist':{
-        //      //自定的样式
-        //        'num':'1,2,3...',
-        //        'num1':'1),2),3)...',
-        //        'num2':'(1),(2),(3)...',
-        //        'cn':'一,二,三....',
-        //        'cn1':'一),二),三)....',
-        //        'cn2':'(一),(二),(三)....',
-        //     //系统自带
-        //     'decimal' : '' ,         //'1,2,3...'
-        //     'lower-alpha' : '' ,    // 'a,b,c...'
-        //     'lower-roman' : '' ,    //'i,ii,iii...'
-        //     'upper-alpha' : '' , lang   //'A,B,C'
-        //     'upper-roman' : ''      //'I,II,III...'
-        //}
+        ,'insertorderedlist':{
+             // //自定的样式
+             //   'num':'1,2,3...',
+             //   'num1':'1),2),3)...',
+             //   'num2':'(1),(2),(3)...',
+             //   'cn':'一,二,三....',
+             //   'cn1':'一),二),三)....',
+             //   'cn2':'(一),(二),(三)....',
+            //系统自带
+            'decimal' : '' ,         //'1,2,3...'
+            'lower-alpha' : '' ,    // 'a,b,c...'
+            'lower-roman' : '' ,    //'i,ii,iii...'
+            'upper-alpha' : '' ,    //'A,B,C'
+            'upper-roman' : ''      //'I,II,III...'
+        }
 
         //insertunorderedlist
         //无序列表的下拉配置,值留空时支持多语言自动识别,若配置值,则以此值为准
-        //,insertunorderedlist : { //自定的样式
-        //    'dash' :'— 破折号', //-破折号
-        //    'dot':' 。 小圆圈', //系统自带
-        //    'circle' : '',  // '○ 小圆圈'
-        //    'disc' : '',    // '● 小圆点'
-        //    'square' : ''   //'■ 小方块'
-        //}
+        ,insertunorderedlist : { //自定的样式
+           // 'dash' :'— 破折号', //-破折号
+           // 'dot':' 。 小圆圈', //系统自带
+           'circle' : '',  // '○ 小圆圈'
+           'disc' : '',    // '● 小圆点'
+           'square' : ''   //'■ 小方块'
+        }
         //,listDefaultPaddingLeft : '30'//默认的左边缩进的基数倍
         //,listiconpath : 'http://bs.baidu.com/listicon/'//自定义标号的路径
         //,maxListLevel : 3 //限制可以tab的级数, 设置-1为不限制

+ 2 - 1
src/main/webapp/styles/notice/noticeAppPublish.css

@@ -5,7 +5,8 @@
 	float:left;
 }
 .main-content-mode-wp .u_editor{
-	width: 470px;
+	width: 80%;
+	min-width: 470px;
 	float:left;
 }
 .notice-form{