From 326331265adb3bdc233c96c9be0f28a8ec4fb946 Mon Sep 17 00:00:00 2001 From: leon Date: Thu, 2 Mar 2023 17:20:21 +0800 Subject: [PATCH] fix #7565 - New_Customer_Portal_205_misc --- Roo/HtmlEditorCore.js | 1 + Roo/bootstrap/form/Input.js | 2 -- Roo/bootstrap/form/TextArea.js | 2 +- Roo/bootstrap/form/TimeField.js | 6 +++++- Roo/htmleditor/BlockFigure.js | 2 +- roojs-bootstrap-debug.js | 13 ++++++++----- roojs-bootstrap.js | 12 ++++++------ 7 files changed, 22 insertions(+), 16 deletions(-) diff --git a/Roo/HtmlEditorCore.js b/Roo/HtmlEditorCore.js index dab5acd26d..6599b4d059 100644 --- a/Roo/HtmlEditorCore.js +++ b/Roo/HtmlEditorCore.js @@ -395,6 +395,7 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { 'rowspan', 'data-display', 'data-width', + 'data-caption', 'start' , 'style', // youtube embed. diff --git a/Roo/bootstrap/form/Input.js b/Roo/bootstrap/form/Input.js index 96fe412ad5..04209fab71 100644 --- a/Roo/bootstrap/form/Input.js +++ b/Roo/bootstrap/form/Input.js @@ -815,9 +815,7 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component, { * @return {Mixed} value The field value */ getValue : function(){ - var v = this.inputEl().getValue(); - return v; }, /** diff --git a/Roo/bootstrap/form/TextArea.js b/Roo/bootstrap/form/TextArea.js index 2c35437f1b..7c2138bd26 100644 --- a/Roo/bootstrap/form/TextArea.js +++ b/Roo/bootstrap/form/TextArea.js @@ -260,7 +260,7 @@ Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input, { this.el.select('.form-control-feedback', true).first().removeClass([this.invalidFeedbackClass, this.validFeedbackClass]); } - if(this.disabled || this.allowBlank){ + if(this.disabled){ return; } diff --git a/Roo/bootstrap/form/TimeField.js b/Roo/bootstrap/form/TimeField.js index e69972a131..3c7dce689c 100644 --- a/Roo/bootstrap/form/TimeField.js +++ b/Roo/bootstrap/form/TimeField.js @@ -280,7 +280,11 @@ Roo.extend(Roo.bootstrap.form.TimeField, Roo.bootstrap.form.Input, { update: function() { - + // default minute is a multiple of minuteStep + if(typeof(this.time) === 'undefined') { + this.time = new Date(); + this.time = this.time.add(Date.MINUTE, Math.round(parseInt(this.time.format('i')) / this.minuteStep) * this.minuteStep - parseInt(this.time.format('i'))); + } this.time = (typeof(this.time) === 'undefined') ? new Date() : this.time; this.fill(); diff --git a/Roo/htmleditor/BlockFigure.js b/Roo/htmleditor/BlockFigure.js index 2d8a6e9dc8..2b73405db4 100644 --- a/Roo/htmleditor/BlockFigure.js +++ b/Roo/htmleditor/BlockFigure.js @@ -405,7 +405,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { this.caption_display = this.getVal(node, 'figcaption', 'data-display'); - var dc = this.getVal(node, 'figcaption', 'data-caption'); + var dc = this.getVal(node, true, 'data-caption'); if (dc && dc.length) { this.caption = dc; } diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 3f835e47c4..acd4889e03 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -13088,9 +13088,7 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component, { * @return {Mixed} value The field value */ getValue : function(){ - var v = this.inputEl().getValue(); - return v; }, /** @@ -13657,7 +13655,7 @@ Roo.extend(Roo.bootstrap.form.TextArea, Roo.bootstrap.form.Input, { this.el.select('.form-control-feedback', true).first().removeClass([this.invalidFeedbackClass, this.validFeedbackClass]); } - if(this.disabled || this.allowBlank){ + if(this.disabled){ return; } @@ -24210,7 +24208,11 @@ Roo.extend(Roo.bootstrap.form.TimeField, Roo.bootstrap.form.Input, { update: function() { - + // default minute is a multiple of minuteStep + if(typeof(this.time) === 'undefined') { + this.time = new Date(); + this.time = this.time.add(Date.MINUTE, Math.round(parseInt(this.time.format('i')) / this.minuteStep) * this.minuteStep - parseInt(this.time.format('i'))); + } this.time = (typeof(this.time) === 'undefined') ? new Date() : this.time; this.fill(); @@ -29508,7 +29510,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { this.caption_display = this.getVal(node, 'figcaption', 'data-display'); - var dc = this.getVal(node, 'figcaption', 'data-caption'); + var dc = this.getVal(node, true, 'data-caption'); if (dc && dc.length) { this.caption = dc; } @@ -31175,6 +31177,7 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { 'rowspan', 'data-display', 'data-width', + 'data-caption', 'start' , 'style', // youtube embed. diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 761739cb07..f79404aaaa 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -586,7 +586,7 @@ if(A){this.el.select('.form-control-feedback',true).first().removeClass([this.in if(Roo.bootstrap.version==3){this.el.addClass(this.validClass);}else{this.inputEl().addClass('is-valid');}if(this.hasFeedback&&this.inputType!='hidden'&&!this.allowBlank&&(this.getValue().length||this.forceFeedback)){var A=this.el.select('.form-control-feedback',true).first(); if(A){this.el.select('.form-control-feedback',true).first().removeClass([this.invalidFeedbackClass,this.validFeedbackClass]);this.el.select('.form-control-feedback',true).first().addClass([this.validFeedbackClass]);}}this.fireEvent('valid',this);},markInvalid:function(A){if(!this.el||this.preventMark){return; }this.el.removeClass([this.invalidClass,this.validClass]);this.inputEl().removeClass(['is-valid','is-invalid']);var B=this.el.select('.form-control-feedback',true).first();if(B){this.el.select('.form-control-feedback',true).first().removeClass([this.invalidFeedbackClass,this.validFeedbackClass]); -}if(this.disabled||this.allowBlank){return;}var C=this.el.select('label',true).first();if(Roo.bootstrap.version==3){this.el.addClass(this.invalidClass);}else{this.inputEl().addClass('is-invalid');}if(this.hasFeedback&&this.inputType!='hidden'&&!this.allowBlank){var B=this.el.select('.form-control-feedback',true).first(); +}if(this.disabled){return;}var C=this.el.select('label',true).first();if(Roo.bootstrap.version==3){this.el.addClass(this.invalidClass);}else{this.inputEl().addClass('is-invalid');}if(this.hasFeedback&&this.inputType!='hidden'&&!this.allowBlank){var B=this.el.select('.form-control-feedback',true).first(); if(B){this.el.select('.form-control-feedback',true).first().removeClass([this.invalidFeedbackClass,this.validFeedbackClass]);if(this.getValue().length||this.forceFeedback){this.el.select('.form-control-feedback',true).first().addClass([this.invalidFeedbackClass]); }}}this.fireEvent('invalid',this,A);}}); // Roo/bootstrap/form/TriggerField.js @@ -1026,9 +1026,9 @@ this.pop.select('.minutes-down',true).first().on('click',this.onDecrementMinutes e.preventDefault();},picker:function(){return this.pickerEl;},fillTime:function(){var A=this.pop.select('tbody',true).first();A.dom.innerHTML='';A.createChild({tag:'tr',cn:[{tag:'td',cn:[{tag:'a',href:'#',cls:'btn',cn:[{tag:'i',cls:'hours-up fa fas fa-chevron-up'} ]}]},{tag:'td',cls:'separator'},{tag:'td',cn:[{tag:'a',href:'#',cls:'btn',cn:[{tag:'i',cls:'minutes-up fa fas fa-chevron-up'}]}]},{tag:'td',cls:'separator'}]});A.createChild({tag:'tr',cn:[{tag:'td',cn:[{tag:'span',cls:'timepicker-hour',html:'00'}]},{tag:'td',cls:'separator',html:':'} ,{tag:'td',cn:[{tag:'span',cls:'timepicker-minute',html:'00'}]},{tag:'td',cls:'separator'},{tag:'td',cn:[{tag:'button',type:'button',cls:'btn btn-primary period',html:'AM'}]}]});A.createChild({tag:'tr',cn:[{tag:'td',cn:[{tag:'a',href:'#',cls:'btn',cn:[{tag:'span',cls:'hours-down fa fas fa-chevron-down'} -]}]},{tag:'td',cls:'separator'},{tag:'td',cn:[{tag:'a',href:'#',cls:'btn',cn:[{tag:'span',cls:'minutes-down fa fas fa-chevron-down'}]}]},{tag:'td',cls:'separator'}]});},update:function(){this.time=(typeof(this.time)==='undefined')?new Date():this.time;this.fill(); -},fill:function(){var A=this.time.getHours();var B=this.time.getMinutes();var C='AM';if(A>11){C='PM';}if(A==0){A=12;}if(A>12){A=A-12;}if(A<10){A='0'+A;}if(B<10){B='0'+B;}this.pop.select('.timepicker-hour',true).first().dom.innerHTML=A;this.pop.select('.timepicker-minute',true).first().dom.innerHTML=B; -this.pop.select('button',true).first().dom.innerHTML=C;},place:function(){this.picker().removeClass(['bottom-left','bottom-right','top-left','top-right']);var A=['bottom'];if((Roo.lib.Dom.getViewHeight()+Roo.get(document.body).getScroll().top)-(this.inputEl().getBottom()+this.picker().getHeight())<0){A.pop(); +]}]},{tag:'td',cls:'separator'},{tag:'td',cn:[{tag:'a',href:'#',cls:'btn',cn:[{tag:'span',cls:'minutes-down fa fas fa-chevron-down'}]}]},{tag:'td',cls:'separator'}]});},update:function(){if(typeof(this.time)==='undefined'){this.time=new Date();this.time=this.time.add(Date.MINUTE,Math.round(parseInt(this.time.format('i'))/this.minuteStep)*this.minuteStep-parseInt(this.time.format('i'))); +}this.time=(typeof(this.time)==='undefined')?new Date():this.time;this.fill();},fill:function(){var A=this.time.getHours();var B=this.time.getMinutes();var C='AM';if(A>11){C='PM';}if(A==0){A=12;}if(A>12){A=A-12;}if(A<10){A='0'+A;}if(B<10){B='0'+B;}this.pop.select('.timepicker-hour',true).first().dom.innerHTML=A; +this.pop.select('.timepicker-minute',true).first().dom.innerHTML=B;this.pop.select('button',true).first().dom.innerHTML=C;},place:function(){this.picker().removeClass(['bottom-left','bottom-right','top-left','top-right']);var A=['bottom'];if((Roo.lib.Dom.getViewHeight()+Roo.get(document.body).getScroll().top)-(this.inputEl().getBottom()+this.picker().getHeight())<0){A.pop(); A.push('top');}A.push('right');if((Roo.lib.Dom.getViewWidth()+Roo.get(document.body).getScroll().left)-(this.inputEl().getLeft()+this.picker().getWidth())<0){A.pop();A.push('left');}this.picker().addClass(A.join('-'));var B=this;Roo.each(A,function(c){if(c=='bottom'){(function(){} ).defer(200);B.picker().alignTo(B.inputEl(),"tr-br",[0,10],false);return;}if(c=='top'){B.picker().alignTo(B.inputEl(),"br-tr",[0,10],false);return;}});},onFocus:function(){Roo.bootstrap.form.TimeField.superclass.onFocus.call(this);this.show();},onBlur:function(){Roo.bootstrap.form.TimeField.superclass.onBlur.call(this); this.hide();},show:function(){this.picker().show();this.pop.show();this.update();this.place();this.fireEvent('show',this,this.date);},hide:function(){this.picker().hide();this.pop.hide();this.fireEvent('hide',this,this.date);},setTime:function(){this.hide(); @@ -1274,7 +1274,7 @@ var C={tag:'figure','data-block':'Figure','data-width':this.width,'data-caption' ,align:this.align,cn:[A,{tag:'figcaption','data-display':this.caption_display,style:{textAlign:'left',fontSize:'16px',lineHeight:'24px',display:this.caption_display,maxWidth:(this.align=='center'?this.width:'100%')+' !important',margin:m,width:this.align=='center'?this.width:'100%'} ,cls:this.cls.length>0?(this.cls+'-thumbnail'):'',cn:[{tag:'div',style:{marginTop:'16px',textAlign:'left'},align:'left',cn:[{tag:'i',contenteditable:true,html:B}]}]}]};return C;},readElement:function(A){this.video_url=this.getVal(A,'div','src');this.cls=this.getVal(A,'div','class'); this.href=this.getVal(A,'a','href');this.image_src=this.getVal(A,'img','src');this.align=this.getVal(A,'figure','align');var B=this.getVal(A,'figcaption',false);if(B!==''){this.caption=this.getVal(B,'i','html');}this.caption_display=this.getVal(A,'figcaption','data-display'); -var dc=this.getVal(A,'figcaption','data-caption');if(dc&&dc.length){this.caption=dc;}this.width=this.getVal(A,true,'data-width');},removeNode:function(){return this.node;}}) +var dc=this.getVal(A,true,'data-caption');if(dc&&dc.length){this.caption=dc;}this.width=this.getVal(A,true,'data-width');},removeNode:function(){return this.node;}}) // Roo/htmleditor/BlockTable.js Roo.htmleditor.BlockTable=function(A){if(A.node){this.readElement(A.node);this.updateElement(A.node);}Roo.apply(this,A);if(!A.node){this.rows=[];for(var r=0;r5){if(Roo.isSafari){A=A.replace(/\sclass="(?:Apple-style-span|khtml-block-placeholder)"/gi,'');}}if(A==' '){A='';} return A;},syncValue:function(){if(this.initialized){if(this.undoManager){this.undoManager.addEvent();}var bd=(this.doc.body||this.doc.documentElement);var A=this.win.getSelection();var B=document.createElement('div');B.innerHTML=bd.innerHTML;var C=B.getElementsByClassName('gtx-trans-icon'); -if(C.length>0){var rm=C.item(0).parentNode;rm.parentNode.removeChild(rm);}if(this.enableBlocks){new Roo.htmleditor.FilterBlock({node:B});}var D=B.innerHTML;if(this.autoClean){new Roo.htmleditor.FilterAttributes({node:B,attrib_white:['href','src','name','align','colspan','rowspan','data-display','data-width','start','style','class','allowfullscreen','frameborder','width','height','alt'],attrib_clean:['href','src']} +if(C.length>0){var rm=C.item(0).parentNode;rm.parentNode.removeChild(rm);}if(this.enableBlocks){new Roo.htmleditor.FilterBlock({node:B});}var D=B.innerHTML;if(this.autoClean){new Roo.htmleditor.FilterAttributes({node:B,attrib_white:['href','src','name','align','colspan','rowspan','data-display','data-width','data-caption','start','style','class','allowfullscreen','frameborder','width','height','alt'],attrib_clean:['href','src']} );var E=new Roo.htmleditor.TidySerializer({inner:true});D=E.serialize(B);}if(Roo.isSafari){var bs=bd.getAttribute('style');var m=bs?bs.match(/text-align:(.*?);/i):false;if(m&&m[1]){D='
'+D+'
';}}D=this.cleanHtml(D);D=D.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[\u0080-\uFFFF]/g,function(F){var cc=F.charCodeAt(); if(F.length==2){var G=F.charCodeAt(0)-0xD800;var H=F.charCodeAt(1)-0xDC00;cc=(G*0x400)+H+0x10000;}else if((cc>=0x4E00&&cc<0xA000)||(cc>=0x3400&&cc<0x4E00)||(cc>=0xf900&&cc<0xfb00)){return F;}return "&#"+cc+";";});if(this.owner.fireEvent('beforesync',this,D)!==false){this.el.dom.value=D; this.owner.fireEvent('sync',this,D);}}},pushValue:function(){if(this.initialized){var v=this.el.dom.value.trim();if(this.owner.fireEvent('beforepush',this,v)!==false){var d=(this.doc.body||this.doc.documentElement);d.innerHTML=v;this.el.dom.value=d.innerHTML; -- 2.39.2