From 1564a98a50f4cb7623b988affccfecc5a7c41b8c Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 15 Aug 2023 12:32:39 +0800 Subject: [PATCH] fix #7775 - BlockFigure caption_edit option - to enable/disable caption editing --- Roo/htmleditor/BlockFigure.js | 10 +++++++--- docs/src/Roo_bootstrap_form_DateField.js.html | 2 +- docs/src/Roo_bootstrap_form_TimeField.js.html | 4 ++-- docs/src/Roo_htmleditor_BlockFigure.js.html | 2 +- roojs-all.js | 6 +++--- roojs-bootstrap-debug.js | 10 +++++++--- roojs-bootstrap.js | 6 +++--- roojs-debug.js | 10 +++++++--- roojs-ui-debug.js | 10 +++++++--- roojs-ui.js | 6 +++--- 10 files changed, 41 insertions(+), 25 deletions(-) diff --git a/Roo/htmleditor/BlockFigure.js b/Roo/htmleditor/BlockFigure.js index d2a165d551..9fac188ed5 100644 --- a/Roo/htmleditor/BlockFigure.js +++ b/Roo/htmleditor/BlockFigure.js @@ -369,7 +369,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { { // we can not rely on yahoo syndication to use CSS elements - so have to use '' to encase stuff. tag : 'i', - contenteditable : true, + contenteditable : Roo.htmleditor.BlockFigure.caption_edit, html : captionhtml } @@ -406,7 +406,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { this.caption_display = this.getVal(node, 'figcaption', 'data-display'); var dc = this.getVal(node, true, 'data-caption'); - if (this.caption_display == 'none' && figcaption != '' && dc && dc.length) { + if (dc && dc.length) { this.caption = dc; } //this.text_align = this.getVal(node, 'figcaption', 'style','text-align'); @@ -426,5 +426,9 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { -}) +}); + +Roo.apply(Roo.htmleditor.BlockFigure, { + caption_edit : true +}); diff --git a/docs/src/Roo_bootstrap_form_DateField.js.html b/docs/src/Roo_bootstrap_form_DateField.js.html index 105f19a4c7..ecd83b4a6e 100644 --- a/docs/src/Roo_bootstrap_form_DateField.js.html +++ b/docs/src/Roo_bootstrap_form_DateField.js.html @@ -186,7 +186,7 @@ } translation.months.push(month); - translation.monthsShort.push(monthShort); + translation/monthsShort.push(monthShort); } }, diff --git a/docs/src/Roo_bootstrap_form_TimeField.js.html b/docs/src/Roo_bootstrap_form_TimeField.js.html index 0fc421bd81..6c228ac346 100644 --- a/docs/src/Roo_bootstrap_form_TimeField.js.html +++ b/docs/src/Roo_bootstrap_form_TimeField.js.html @@ -292,11 +292,11 @@ update: function() { // default minute is a multiple of minuteStep - if(typeof(this.time) === 'undefined' || this.time.length == 0) { + 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' || this.time.length == 0) ? new Date() : this.time; + this.time = (typeof(this.time) === 'undefined') ? new Date() : this.time; this.fill(); }, diff --git a/docs/src/Roo_htmleditor_BlockFigure.js.html b/docs/src/Roo_htmleditor_BlockFigure.js.html index 1fbf950d68..4991c1e3c3 100644 --- a/docs/src/Roo_htmleditor_BlockFigure.js.html +++ b/docs/src/Roo_htmleditor_BlockFigure.js.html @@ -406,7 +406,7 @@ this.caption_display = this.getVal(node, 'figcaption', 'data-display'); var dc = this.getVal(node, true, 'data-caption'); - if (this.caption_display == 'none' && figcaption != '' && dc && dc.length) { + if (dc && dc.length) { this.caption = dc; } //this.text_align = this.getVal(node, 'figcaption', 'style','text-align'); diff --git a/roojs-all.js b/roojs-all.js index c1e3c6e25d..f4eefbd1c6 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -2015,9 +2015,9 @@ A.editorcore.onEditorEvent();}},xns:C.Toolbar}];},toObject:function(){var d=docu };if(this.href.length>0){A={tag:'a',href:this.href,contenteditable:'true',cn:[A]};}if(this.video_url.length>0){A={tag:'div',cls:this.cls,frameborder:0,allowfullscreen:true,width:420,height:315,src:this.video_url,cn:[A]};}var B=this.caption_display=='none'?'':(this.caption.length?this.caption:"Caption"); var C={tag:'figure','data-block':'Figure','data-width':this.width,'data-caption':this.caption,contenteditable:'false',style:{display:'block',float:this.align,maxWidth:this.align=='center'?'100% !important':(this.width+' !important'),width:this.align=='center'?'100%':this.width,margin:'0px',padding:this.align=='center'?'0':'0 10px',textAlign:this.align} ,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,true,'data-caption');if(this.caption_display=='none'&&B!=''&&dc&&dc.length){this.caption=dc;}this.width=this.getVal(A,true,'data-width');},removeNode:function(){return this.node;}}) +,cls:this.cls.length>0?(this.cls+'-thumbnail'):'',cn:[{tag:'div',style:{marginTop:'16px',textAlign:'left'},align:'left',cn:[{tag:'i',contenteditable:Roo.htmleditor.BlockFigure.caption_edit,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,true,'data-caption');if(dc&&dc.length){this.caption=dc;}this.width=this.getVal(A,true,'data-width');},removeNode:function(){return this.node;}});Roo.apply(Roo.htmleditor.BlockFigure,{caption_edit:true}); // 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;r' to encase stuff. tag : 'i', - contenteditable : true, + contenteditable : Roo.htmleditor.BlockFigure.caption_edit, html : captionhtml } @@ -29788,7 +29788,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { this.caption_display = this.getVal(node, 'figcaption', 'data-display'); var dc = this.getVal(node, true, 'data-caption'); - if (this.caption_display == 'none' && figcaption != '' && dc && dc.length) { + if (dc && dc.length) { this.caption = dc; } //this.text_align = this.getVal(node, 'figcaption', 'style','text-align'); @@ -29808,7 +29808,11 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { -}) +}); + +Roo.apply(Roo.htmleditor.BlockFigure, { + caption_edit : true +}); diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index f58d8a128b..96e2f4c67d 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -1289,9 +1289,9 @@ A.editorcore.onEditorEvent();}},xns:C.Toolbar}];},toObject:function(){var d=docu };if(this.href.length>0){A={tag:'a',href:this.href,contenteditable:'true',cn:[A]};}if(this.video_url.length>0){A={tag:'div',cls:this.cls,frameborder:0,allowfullscreen:true,width:420,height:315,src:this.video_url,cn:[A]};}var B=this.caption_display=='none'?'':(this.caption.length?this.caption:"Caption"); var C={tag:'figure','data-block':'Figure','data-width':this.width,'data-caption':this.caption,contenteditable:'false',style:{display:'block',float:this.align,maxWidth:this.align=='center'?'100% !important':(this.width+' !important'),width:this.align=='center'?'100%':this.width,margin:'0px',padding:this.align=='center'?'0':'0 10px',textAlign:this.align} ,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,true,'data-caption');if(this.caption_display=='none'&&B!=''&&dc&&dc.length){this.caption=dc;}this.width=this.getVal(A,true,'data-width');},removeNode:function(){return this.node;}}) +,cls:this.cls.length>0?(this.cls+'-thumbnail'):'',cn:[{tag:'div',style:{marginTop:'16px',textAlign:'left'},align:'left',cn:[{tag:'i',contenteditable:Roo.htmleditor.BlockFigure.caption_edit,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,true,'data-caption');if(dc&&dc.length){this.caption=dc;}this.width=this.getVal(A,true,'data-width');},removeNode:function(){return this.node;}});Roo.apply(Roo.htmleditor.BlockFigure,{caption_edit:true}); // 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;r' to encase stuff. tag : 'i', - contenteditable : true, + contenteditable : Roo.htmleditor.BlockFigure.caption_edit, html : captionhtml } @@ -48681,7 +48681,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { this.caption_display = this.getVal(node, 'figcaption', 'data-display'); var dc = this.getVal(node, true, 'data-caption'); - if (this.caption_display == 'none' && figcaption != '' && dc && dc.length) { + if (dc && dc.length) { this.caption = dc; } //this.text_align = this.getVal(node, 'figcaption', 'style','text-align'); @@ -48701,7 +48701,11 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { -}) +}); + +Roo.apply(Roo.htmleditor.BlockFigure, { + caption_edit : true +}); diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index 2c1025a41d..2ecd656a42 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -24142,7 +24142,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { { // we can not rely on yahoo syndication to use CSS elements - so have to use '' to encase stuff. tag : 'i', - contenteditable : true, + contenteditable : Roo.htmleditor.BlockFigure.caption_edit, html : captionhtml } @@ -24179,7 +24179,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { this.caption_display = this.getVal(node, 'figcaption', 'data-display'); var dc = this.getVal(node, true, 'data-caption'); - if (this.caption_display == 'none' && figcaption != '' && dc && dc.length) { + if (dc && dc.length) { this.caption = dc; } //this.text_align = this.getVal(node, 'figcaption', 'style','text-align'); @@ -24199,7 +24199,11 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { -}) +}); + +Roo.apply(Roo.htmleditor.BlockFigure, { + caption_edit : true +}); diff --git a/roojs-ui.js b/roojs-ui.js index b19661d412..1c0beb2665 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -1068,9 +1068,9 @@ A.editorcore.onEditorEvent();}},xns:C.Toolbar}];},toObject:function(){var d=docu };if(this.href.length>0){A={tag:'a',href:this.href,contenteditable:'true',cn:[A]};}if(this.video_url.length>0){A={tag:'div',cls:this.cls,frameborder:0,allowfullscreen:true,width:420,height:315,src:this.video_url,cn:[A]};}var B=this.caption_display=='none'?'':(this.caption.length?this.caption:"Caption"); var C={tag:'figure','data-block':'Figure','data-width':this.width,'data-caption':this.caption,contenteditable:'false',style:{display:'block',float:this.align,maxWidth:this.align=='center'?'100% !important':(this.width+' !important'),width:this.align=='center'?'100%':this.width,margin:'0px',padding:this.align=='center'?'0':'0 10px',textAlign:this.align} ,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,true,'data-caption');if(this.caption_display=='none'&&B!=''&&dc&&dc.length){this.caption=dc;}this.width=this.getVal(A,true,'data-width');},removeNode:function(){return this.node;}}) +,cls:this.cls.length>0?(this.cls+'-thumbnail'):'',cn:[{tag:'div',style:{marginTop:'16px',textAlign:'left'},align:'left',cn:[{tag:'i',contenteditable:Roo.htmleditor.BlockFigure.caption_edit,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,true,'data-caption');if(dc&&dc.length){this.caption=dc;}this.width=this.getVal(A,true,'data-width');},removeNode:function(){return this.node;}});Roo.apply(Roo.htmleditor.BlockFigure,{caption_edit:true}); // 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;r