From 2a4759f28d373ef3605db55f6c6062c2516a4a20 Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 6 Jan 2022 14:38:23 +0800 Subject: [PATCH] roojs-ui.js roojs-ui-debug.js roojs-bootstrap.js roojs-bootstrap-debug.js roojs-all.js roojs-debug.js Roo/htmleditor/BlockFigure.js --- Roo/htmleditor/BlockFigure.js | 2 +- roojs-all.js | 4 ++-- roojs-bootstrap-debug.js | 6 ++++-- roojs-bootstrap.js | 4 ++-- roojs-debug.js | 6 ++++-- roojs-ui-debug.js | 6 ++++-- roojs-ui.js | 4 ++-- 7 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Roo/htmleditor/BlockFigure.js b/Roo/htmleditor/BlockFigure.js index 0c302c4570..16c544833f 100644 --- a/Roo/htmleditor/BlockFigure.js +++ b/Roo/htmleditor/BlockFigure.js @@ -276,7 +276,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { 'font-style': 'italic', display : this.caption_display }, - cls : this.cls + '-thumbnail', + cls : this.cls.length > 0 ? (this.cls + '-thumbnail' ) : '', html : this.caption } diff --git a/roojs-all.js b/roojs-all.js index d1f968ea43..0f27cef745 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -1959,14 +1959,14 @@ Roo.htmleditor.Block=function(A){};Roo.htmleditor.Block.factory=function(A){var },getVal:function(A,B,C,D){var n=A;if(B!==true&&n.tagName!=B.toUpperCase()){n=A.getElementsByTagName(B).item(0);}if(!n){return '';}if(C=='html'){return n.innerHTML;}if(C=='style'){return n.style[D];}return n.hasAttribute(C)?n.getAttribute(C):'';},toObject:function(){return {} ;},readElement:function(A){}}; // Roo/htmleditor/BlockFigure.js -Roo.htmleditor.BlockFigure=function(A){if(A.node){this.readElement(A.node);this.updateElement(A.node);}Roo.apply(this,A);};Roo.extend(Roo.htmleditor.BlockFigure,Roo.htmleditor.Block,{image_src:'',align:'center',caption:'',caption_display:'block',width:'100%',text_align:'left',friendly_name:'Image with caption',deleteTitle:"Delete Image and Caption",contextMenu:function(A){var B=function(){return Roo.htmleditor.Block.factory(A.tb.selectedNode); +Roo.htmleditor.BlockFigure=function(A){if(A.node){this.readElement(A.node);this.updateElement(A.node);}Roo.apply(this,A);};Roo.extend(Roo.htmleditor.BlockFigure,Roo.htmleditor.Block,{image_src:'',align:'center',caption:'',caption_display:'block',width:'100%',href:'',video_url:'',text_align:'left',friendly_name:'Image with caption',deleteTitle:"Delete Image and Caption",contextMenu:function(A){var B=function(){return Roo.htmleditor.Block.factory(A.tb.selectedNode); };var C=typeof(Roo.bootstrap)=='undefined'?Roo:Roo.bootstrap;var D=A.editorcore.syncValue;var E={};return [{xtype:'TextItem',text:"Source: ",xns:C.Toolbar},{xtype:'TextField',allowBlank:false,width:150,name:'image_src',listeners:{keyup:function(F,e){A.editorcore.selectNode(A.tb.selectedNode); var b=B();b.image_src=this.getValue();b.updateElement();D();A.editorcore.onEditorEvent();}},xns:C.form},{xtype:'TextItem',text:"Width: ",xns:C.Toolbar},{xtype:'ComboBox',allowBlank:false,displayField:'val',editable:true,listWidth:100,triggerAction:'all',typeAhead:true,valueField:'val',width:70,name:'width',listeners:{select:function(F,r,G){A.editorcore.selectNode(A.tb.selectedNode); var b=B();b.width=r.get('val');b.updateElement();D();A.editorcore.onEditorEvent();}},xns:C.form,store:{xtype:'SimpleStore',data:[['auto'],['50%'],['100%']],fields:['val'],xns:Roo.data}},{xtype:'TextItem',text:"Align: ",xns:C.Toolbar},{xtype:'ComboBox',allowBlank:false,displayField:'val',editable:true,listWidth:100,triggerAction:'all',typeAhead:true,valueField:'val',width:70,name:'align',listeners:{select:function(F,r,G){A.editorcore.selectNode(A.tb.selectedNode); var b=B();b.align=r.get('val');b.updateElement();D();A.editorcore.onEditorEvent();}},xns:C.form,store:{xtype:'SimpleStore',data:[['left'],['right'],['center']],fields:['val'],xns:Roo.data}},{xtype:'Button',text:'Hide Caption',name:'caption_display',pressed:false,enableToggle:true,setValue:function(v){this.toggle(v=='block'?false:true); },listeners:{toggle:function(F,G){var b=B();b.caption_display=b.caption_display=='block'?'none':'block';this.setText(b.caption_display=='block'?"Hide Caption":"Show Caption");b.updateElement();D();A.editorcore.selectNode(A.tb.selectedNode);A.editorcore.onEditorEvent(); }},xns:C.Toolbar}];},toObject:function(){var d=document.createElement('div');d.innerHTML=this.caption;var m=this.width=='50%'&&this.align=='center'?'0 auto':0;var A={tag:'img',src:this.image_src,alt:d.innerText.replace(/\n/g," "),style:{width:'auto','max-width':'100%',margin:'0px'} -};if(this.href){A={tag:'a',href:this.href,cn:[A]};}if(this.video_url){A={tag:'div',cls:this.cls,frameborder:0,allowfullscreen:true,width:420,height:315,src:this.video_src,cn:[A]};}return {tag:'figure','data-block':'Figure',contenteditable:'false',style:{display:'block',float:this.align,'max-width':this.width,width:'auto',margin:m,padding:'10px'} +};if(this.href.length>0){A={tag:'a',href:this.href,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_src,cn:[A]};}return {tag:'figure','data-block':'Figure',contenteditable:'false',style:{display:'block',float:this.align,'max-width':this.width,width:'auto',margin:m,padding:'10px'} ,align:this.align,cn:[A,{tag:'figcaption',contenteditable:true,style:{'text-align':'left','margin-top':'16px','font-size':'16px','line-height':'24px','font-style':'italic',display:this.caption_display},cls:this.cls+'-thumbnail',html:this.caption}]};},readElement:function(A){this.video_src=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');this.caption=this.getVal(A,'figcaption','html');this.width=this.getVal(A,'figure','style','max-width'); },removeNode:function(){return this.node;}}) diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 42594c9747..3f813f3cb6 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -27002,6 +27002,8 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { caption : '', caption_display : 'block', width : '100%', + href: '', + video_url : '', // margin: '2%', not used @@ -27188,7 +27190,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { '', */ - if (this.href) { + if (this.href.length > 0) { img = { tag : 'a', href: this.href, @@ -27199,7 +27201,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { } - if (this.video_url) { + if (this.video_url.length > 0) { img = { tag : 'div', cls : this.cls, diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 226a5b73d4..b5bb9b78f0 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -1174,14 +1174,14 @@ Roo.htmleditor.Block=function(A){};Roo.htmleditor.Block.factory=function(A){var },getVal:function(A,B,C,D){var n=A;if(B!==true&&n.tagName!=B.toUpperCase()){n=A.getElementsByTagName(B).item(0);}if(!n){return '';}if(C=='html'){return n.innerHTML;}if(C=='style'){return n.style[D];}return n.hasAttribute(C)?n.getAttribute(C):'';},toObject:function(){return {} ;},readElement:function(A){}}; // Roo/htmleditor/BlockFigure.js -Roo.htmleditor.BlockFigure=function(A){if(A.node){this.readElement(A.node);this.updateElement(A.node);}Roo.apply(this,A);};Roo.extend(Roo.htmleditor.BlockFigure,Roo.htmleditor.Block,{image_src:'',align:'center',caption:'',caption_display:'block',width:'100%',text_align:'left',friendly_name:'Image with caption',deleteTitle:"Delete Image and Caption",contextMenu:function(A){var B=function(){return Roo.htmleditor.Block.factory(A.tb.selectedNode); +Roo.htmleditor.BlockFigure=function(A){if(A.node){this.readElement(A.node);this.updateElement(A.node);}Roo.apply(this,A);};Roo.extend(Roo.htmleditor.BlockFigure,Roo.htmleditor.Block,{image_src:'',align:'center',caption:'',caption_display:'block',width:'100%',href:'',video_url:'',text_align:'left',friendly_name:'Image with caption',deleteTitle:"Delete Image and Caption",contextMenu:function(A){var B=function(){return Roo.htmleditor.Block.factory(A.tb.selectedNode); };var C=typeof(Roo.bootstrap)=='undefined'?Roo:Roo.bootstrap;var D=A.editorcore.syncValue;var E={};return [{xtype:'TextItem',text:"Source: ",xns:C.Toolbar},{xtype:'TextField',allowBlank:false,width:150,name:'image_src',listeners:{keyup:function(F,e){A.editorcore.selectNode(A.tb.selectedNode); var b=B();b.image_src=this.getValue();b.updateElement();D();A.editorcore.onEditorEvent();}},xns:C.form},{xtype:'TextItem',text:"Width: ",xns:C.Toolbar},{xtype:'ComboBox',allowBlank:false,displayField:'val',editable:true,listWidth:100,triggerAction:'all',typeAhead:true,valueField:'val',width:70,name:'width',listeners:{select:function(F,r,G){A.editorcore.selectNode(A.tb.selectedNode); var b=B();b.width=r.get('val');b.updateElement();D();A.editorcore.onEditorEvent();}},xns:C.form,store:{xtype:'SimpleStore',data:[['auto'],['50%'],['100%']],fields:['val'],xns:Roo.data}},{xtype:'TextItem',text:"Align: ",xns:C.Toolbar},{xtype:'ComboBox',allowBlank:false,displayField:'val',editable:true,listWidth:100,triggerAction:'all',typeAhead:true,valueField:'val',width:70,name:'align',listeners:{select:function(F,r,G){A.editorcore.selectNode(A.tb.selectedNode); var b=B();b.align=r.get('val');b.updateElement();D();A.editorcore.onEditorEvent();}},xns:C.form,store:{xtype:'SimpleStore',data:[['left'],['right'],['center']],fields:['val'],xns:Roo.data}},{xtype:'Button',text:'Hide Caption',name:'caption_display',pressed:false,enableToggle:true,setValue:function(v){this.toggle(v=='block'?false:true); },listeners:{toggle:function(F,G){var b=B();b.caption_display=b.caption_display=='block'?'none':'block';this.setText(b.caption_display=='block'?"Hide Caption":"Show Caption");b.updateElement();D();A.editorcore.selectNode(A.tb.selectedNode);A.editorcore.onEditorEvent(); }},xns:C.Toolbar}];},toObject:function(){var d=document.createElement('div');d.innerHTML=this.caption;var m=this.width=='50%'&&this.align=='center'?'0 auto':0;var A={tag:'img',src:this.image_src,alt:d.innerText.replace(/\n/g," "),style:{width:'auto','max-width':'100%',margin:'0px'} -};if(this.href){A={tag:'a',href:this.href,cn:[A]};}if(this.video_url){A={tag:'div',cls:this.cls,frameborder:0,allowfullscreen:true,width:420,height:315,src:this.video_src,cn:[A]};}return {tag:'figure','data-block':'Figure',contenteditable:'false',style:{display:'block',float:this.align,'max-width':this.width,width:'auto',margin:m,padding:'10px'} +};if(this.href.length>0){A={tag:'a',href:this.href,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_src,cn:[A]};}return {tag:'figure','data-block':'Figure',contenteditable:'false',style:{display:'block',float:this.align,'max-width':this.width,width:'auto',margin:m,padding:'10px'} ,align:this.align,cn:[A,{tag:'figcaption',contenteditable:true,style:{'text-align':'left','margin-top':'16px','font-size':'16px','line-height':'24px','font-style':'italic',display:this.caption_display},cls:this.cls+'-thumbnail',html:this.caption}]};},readElement:function(A){this.video_src=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');this.caption=this.getVal(A,'figcaption','html');this.width=this.getVal(A,'figure','style','max-width'); },removeNode:function(){return this.node;}}) diff --git a/roojs-debug.js b/roojs-debug.js index ba017f19ed..daf890ff1a 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -46711,6 +46711,8 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { caption : '', caption_display : 'block', width : '100%', + href: '', + video_url : '', // margin: '2%', not used @@ -46897,7 +46899,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { '', */ - if (this.href) { + if (this.href.length > 0) { img = { tag : 'a', href: this.href, @@ -46908,7 +46910,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { } - if (this.video_url) { + if (this.video_url.length > 0) { img = { tag : 'div', cls : this.cls, diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index 364b536a44..b2130eb1ef 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -22242,6 +22242,8 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { caption : '', caption_display : 'block', width : '100%', + href: '', + video_url : '', // margin: '2%', not used @@ -22428,7 +22430,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { '', */ - if (this.href) { + if (this.href.length > 0) { img = { tag : 'a', href: this.href, @@ -22439,7 +22441,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { } - if (this.video_url) { + if (this.video_url.length > 0) { img = { tag : 'div', cls : this.cls, diff --git a/roojs-ui.js b/roojs-ui.js index f06dcfc146..f0109adb24 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -1014,14 +1014,14 @@ Roo.htmleditor.Block=function(A){};Roo.htmleditor.Block.factory=function(A){var },getVal:function(A,B,C,D){var n=A;if(B!==true&&n.tagName!=B.toUpperCase()){n=A.getElementsByTagName(B).item(0);}if(!n){return '';}if(C=='html'){return n.innerHTML;}if(C=='style'){return n.style[D];}return n.hasAttribute(C)?n.getAttribute(C):'';},toObject:function(){return {} ;},readElement:function(A){}}; // Roo/htmleditor/BlockFigure.js -Roo.htmleditor.BlockFigure=function(A){if(A.node){this.readElement(A.node);this.updateElement(A.node);}Roo.apply(this,A);};Roo.extend(Roo.htmleditor.BlockFigure,Roo.htmleditor.Block,{image_src:'',align:'center',caption:'',caption_display:'block',width:'100%',text_align:'left',friendly_name:'Image with caption',deleteTitle:"Delete Image and Caption",contextMenu:function(A){var B=function(){return Roo.htmleditor.Block.factory(A.tb.selectedNode); +Roo.htmleditor.BlockFigure=function(A){if(A.node){this.readElement(A.node);this.updateElement(A.node);}Roo.apply(this,A);};Roo.extend(Roo.htmleditor.BlockFigure,Roo.htmleditor.Block,{image_src:'',align:'center',caption:'',caption_display:'block',width:'100%',href:'',video_url:'',text_align:'left',friendly_name:'Image with caption',deleteTitle:"Delete Image and Caption",contextMenu:function(A){var B=function(){return Roo.htmleditor.Block.factory(A.tb.selectedNode); };var C=typeof(Roo.bootstrap)=='undefined'?Roo:Roo.bootstrap;var D=A.editorcore.syncValue;var E={};return [{xtype:'TextItem',text:"Source: ",xns:C.Toolbar},{xtype:'TextField',allowBlank:false,width:150,name:'image_src',listeners:{keyup:function(F,e){A.editorcore.selectNode(A.tb.selectedNode); var b=B();b.image_src=this.getValue();b.updateElement();D();A.editorcore.onEditorEvent();}},xns:C.form},{xtype:'TextItem',text:"Width: ",xns:C.Toolbar},{xtype:'ComboBox',allowBlank:false,displayField:'val',editable:true,listWidth:100,triggerAction:'all',typeAhead:true,valueField:'val',width:70,name:'width',listeners:{select:function(F,r,G){A.editorcore.selectNode(A.tb.selectedNode); var b=B();b.width=r.get('val');b.updateElement();D();A.editorcore.onEditorEvent();}},xns:C.form,store:{xtype:'SimpleStore',data:[['auto'],['50%'],['100%']],fields:['val'],xns:Roo.data}},{xtype:'TextItem',text:"Align: ",xns:C.Toolbar},{xtype:'ComboBox',allowBlank:false,displayField:'val',editable:true,listWidth:100,triggerAction:'all',typeAhead:true,valueField:'val',width:70,name:'align',listeners:{select:function(F,r,G){A.editorcore.selectNode(A.tb.selectedNode); var b=B();b.align=r.get('val');b.updateElement();D();A.editorcore.onEditorEvent();}},xns:C.form,store:{xtype:'SimpleStore',data:[['left'],['right'],['center']],fields:['val'],xns:Roo.data}},{xtype:'Button',text:'Hide Caption',name:'caption_display',pressed:false,enableToggle:true,setValue:function(v){this.toggle(v=='block'?false:true); },listeners:{toggle:function(F,G){var b=B();b.caption_display=b.caption_display=='block'?'none':'block';this.setText(b.caption_display=='block'?"Hide Caption":"Show Caption");b.updateElement();D();A.editorcore.selectNode(A.tb.selectedNode);A.editorcore.onEditorEvent(); }},xns:C.Toolbar}];},toObject:function(){var d=document.createElement('div');d.innerHTML=this.caption;var m=this.width=='50%'&&this.align=='center'?'0 auto':0;var A={tag:'img',src:this.image_src,alt:d.innerText.replace(/\n/g," "),style:{width:'auto','max-width':'100%',margin:'0px'} -};if(this.href){A={tag:'a',href:this.href,cn:[A]};}if(this.video_url){A={tag:'div',cls:this.cls,frameborder:0,allowfullscreen:true,width:420,height:315,src:this.video_src,cn:[A]};}return {tag:'figure','data-block':'Figure',contenteditable:'false',style:{display:'block',float:this.align,'max-width':this.width,width:'auto',margin:m,padding:'10px'} +};if(this.href.length>0){A={tag:'a',href:this.href,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_src,cn:[A]};}return {tag:'figure','data-block':'Figure',contenteditable:'false',style:{display:'block',float:this.align,'max-width':this.width,width:'auto',margin:m,padding:'10px'} ,align:this.align,cn:[A,{tag:'figcaption',contenteditable:true,style:{'text-align':'left','margin-top':'16px','font-size':'16px','line-height':'24px','font-style':'italic',display:this.caption_display},cls:this.cls+'-thumbnail',html:this.caption}]};},readElement:function(A){this.video_src=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');this.caption=this.getVal(A,'figcaption','html');this.width=this.getVal(A,'figure','style','max-width'); },removeNode:function(){return this.node;}}) -- 2.39.2