From: Alan Date: Tue, 15 Mar 2022 08:51:38 +0000 (+0800) Subject: Fix #7151 - parse block for figure X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=d8d46460033881e248c734f400fc135d5b5c8ce6 Fix #7151 - parse block for figure --- diff --git a/Roo/Button.js b/Roo/Button.js index 4d4ddf22d2..9bcd179fee 100644 --- a/Roo/Button.js +++ b/Roo/Button.js @@ -369,7 +369,23 @@ Roo.extend(Roo.Button, Roo.util.Observable, { this.hide(); } }, - + /** + * Similar to toggle, but does not trigger event. + * @param {Boolean} state [required] Force a particular state + */ + setPressed : function(state) + { + if(state != this.pressed){ + if(state){ + this.el.addClass("x-btn-pressed"); + this.pressed = true; + }else{ + this.el.removeClass("x-btn-pressed"); + this.pressed = false; + } + } + }, + /** * If a state it passed, it becomes the pressed state otherwise the current state is toggled. * @param {Boolean} state (optional) Force a particular state @@ -392,6 +408,8 @@ Roo.extend(Roo.Button, Roo.util.Observable, { } }, + + /** * Focus the button */ diff --git a/Roo/HtmlEditorCore.js b/Roo/HtmlEditorCore.js index 8e8acbb52d..c79217340a 100644 --- a/Roo/HtmlEditorCore.js +++ b/Roo/HtmlEditorCore.js @@ -620,7 +620,7 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { new Roo.htmleditor.FilterStyleToTag({ node : d }); new Roo.htmleditor.FilterAttributes({ node : d, - attrib_white : ['href', 'src', 'name', 'align', 'colspan', 'rowspan'], + attrib_white : ['href', 'src', 'name', 'align', 'colspan', 'rowspan', 'data-display'], attrib_clean : ['href', 'src' ] }); new Roo.htmleditor.FilterBlack({ node : d, tag : this.black}); diff --git a/Roo/htmleditor/BlockFigure.js b/Roo/htmleditor/BlockFigure.js index 8bc7f8efb8..b7f3fc61da 100644 --- a/Roo/htmleditor/BlockFigure.js +++ b/Roo/htmleditor/BlockFigure.js @@ -234,7 +234,10 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { pressed : false, enableToggle : true, setValue : function(v) { - this.toggle(v == 'block' ? false : true); + // this trigger toggle. + + this.setText(v ? "Hide Caption" : "Show Caption"); + this.setPressed(v != 'block'); }, listeners : { toggle: function (btn, state) @@ -273,8 +276,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { style: { width : iw, maxWidth : iw + ' !important', // this is not getting rendered? - margin : m - + margin : m } }; @@ -315,7 +317,8 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { // we remove caption totally if its hidden... - will delete data.. but otherwise we end up with fake caption var captionhtml = this.caption_display == 'none' ? '' : (this.caption.length ? this.caption : "Caption"); - return { + + var ret = { tag: 'figure', 'data-block' : 'Figure', @@ -327,7 +330,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { maxWidth : this.align == 'center' ? '100% !important' : (this.width + ' !important'), width : this.align == 'center' ? '100%' : this.width, margin: '0px', - padding: this.align == 'center' ? '10px 0' : '0', + padding: this.align == 'center' ? '0' : '0 10px' , textAlign : this.align // seems to work for email.. }, @@ -376,6 +379,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { } ] }; + return ret; }, diff --git a/docs/json/roodata.json b/docs/json/roodata.json index 7e1375f62c..49146ce23e 100644 --- a/docs/json/roodata.json +++ b/docs/json/roodata.json @@ -7969,6 +7969,32 @@ ], "returns" : [] }, + { + "name" : "setPressed", + "type" : "function", + "desc" : "Similar to toggle, but does not trigger event.", + "sig" : "(state)", + "static" : false, + "memberOf" : "", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "state", + "type" : "Boolean", + "desc" : "[required] Force a particular state", + "isOptional" : false + } + ], + "returns" : [] + }, { "name" : "setText", "type" : "function", @@ -42849,6 +42875,32 @@ ], "returns" : [] }, + { + "name" : "setPressed", + "type" : "function", + "desc" : "Similar to toggle, but does not trigger event.", + "sig" : "(state)", + "static" : false, + "memberOf" : "Roo.Button", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "state", + "type" : "Boolean", + "desc" : "[required] Force a particular state", + "isOptional" : false + } + ], + "returns" : [] + }, { "name" : "setText", "type" : "function", @@ -47810,6 +47862,32 @@ ], "returns" : [] }, + { + "name" : "setPressed", + "type" : "function", + "desc" : "Similar to toggle, but does not trigger event.", + "sig" : "(state)", + "static" : false, + "memberOf" : "Roo.Button", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "state", + "type" : "Boolean", + "desc" : "[required] Force a particular state", + "isOptional" : false + } + ], + "returns" : [] + }, { "name" : "setText", "type" : "function", @@ -49651,6 +49729,32 @@ ], "returns" : [] }, + { + "name" : "setPressed", + "type" : "function", + "desc" : "Similar to toggle, but does not trigger event.", + "sig" : "(state)", + "static" : false, + "memberOf" : "Roo.Button", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "state", + "type" : "Boolean", + "desc" : "[required] Force a particular state", + "isOptional" : false + } + ], + "returns" : [] + }, { "name" : "setText", "type" : "function", diff --git a/docs/src/Roo_Button.js.html b/docs/src/Roo_Button.js.html index cb40668362..5b352c6d16 100644 --- a/docs/src/Roo_Button.js.html +++ b/docs/src/Roo_Button.js.html @@ -369,6 +369,22 @@ this.hide(); } }, + /** + * Similar to toggle, but does not trigger event. + * @param {Boolean} state [required] Force a particular state + */ + setPressed : function(state) + { + if(state != this.pressed){ + if(state){ + this.el.addClass("x-btn-pressed"); + this.pressed = true; + }else{ + this.el.removeClass("x-btn-pressed"); + this.pressed = false; + } + } + }, /** * If a state it passed, it becomes the pressed state otherwise the current state is toggled. @@ -392,6 +408,8 @@ } }, + + /** * Focus the button */ diff --git a/docs/src/Roo_HtmlEditorCore.js.html b/docs/src/Roo_HtmlEditorCore.js.html index d8f122d9f7..16cfbc9d32 100644 --- a/docs/src/Roo_HtmlEditorCore.js.html +++ b/docs/src/Roo_HtmlEditorCore.js.html @@ -620,7 +620,7 @@ new Roo.htmleditor.FilterStyleToTag({ node : d }); new Roo.htmleditor.FilterAttributes({ node : d, - attrib_white : ['href', 'src', 'name', 'align', 'colspan', 'rowspan'], + attrib_white : ['href', 'src', 'name', 'align', 'colspan', 'rowspan', 'data-display'], attrib_clean : ['href', 'src' ] }); new Roo.htmleditor.FilterBlack({ node : d, tag : this.black}); diff --git a/docs/src/Roo_htmleditor_BlockFigure.js.html b/docs/src/Roo_htmleditor_BlockFigure.js.html index 1ae477cd6e..25d4d24ec7 100644 --- a/docs/src/Roo_htmleditor_BlockFigure.js.html +++ b/docs/src/Roo_htmleditor_BlockFigure.js.html @@ -234,7 +234,10 @@ pressed : false, enableToggle : true, setValue : function(v) { - this.toggle(v == 'block' ? false : true); + // this trigger toggle. + + this.setText(v ? "Hide Caption" : "Show Caption"); + this.setPressed(v != 'block'); }, listeners : { toggle: function (btn, state) @@ -275,7 +278,6 @@ maxWidth : iw + ' !important', // this is not getting rendered? margin : m - } }; /* @@ -315,7 +317,8 @@ // we remove caption totally if its hidden... - will delete data.. but otherwise we end up with fake caption var captionhtml = this.caption_display == 'none' ? '' : (this.caption.length ? this.caption : "Caption"); - return { + + var ret = { tag: 'figure', 'data-block' : 'Figure', @@ -327,7 +330,7 @@ maxWidth : this.align == 'center' ? '100% !important' : (this.width + ' !important'), width : this.align == 'center' ? '100%' : this.width, margin: '0px', - padding: this.align == 'center' ? '10px 0' : '0', + padding: this.align == 'center' ? '0' : '0 10px' , textAlign : this.align // seems to work for email.. }, @@ -376,6 +379,7 @@ } ] }; + return ret; }, diff --git a/docs/symbols/Roo.Button.json b/docs/symbols/Roo.Button.json index 889eb8bb74..60c72c5378 100644 --- a/docs/symbols/Roo.Button.json +++ b/docs/symbols/Roo.Button.json @@ -390,6 +390,32 @@ ], "returns" : [] }, + { + "name" : "setPressed", + "type" : "function", + "desc" : "Similar to toggle, but does not trigger event.", + "sig" : "(state)", + "static" : false, + "memberOf" : "", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "state", + "type" : "Boolean", + "desc" : "[required] Force a particular state", + "isOptional" : false + } + ], + "returns" : [] + }, { "name" : "setVisible", "type" : "function", diff --git a/docs/symbols/Roo.SplitButton.json b/docs/symbols/Roo.SplitButton.json index 7a9ef3ae1f..a8b0deb8cd 100644 --- a/docs/symbols/Roo.SplitButton.json +++ b/docs/symbols/Roo.SplitButton.json @@ -441,6 +441,32 @@ ], "returns" : [] }, + { + "name" : "setPressed", + "type" : "function", + "desc" : "Similar to toggle, but does not trigger event.", + "sig" : "(state)", + "static" : false, + "memberOf" : "Roo.Button", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "state", + "type" : "Boolean", + "desc" : "[required] Force a particular state", + "isOptional" : false + } + ], + "returns" : [] + }, { "name" : "setVisible", "type" : "function", diff --git a/docs/symbols/Roo.Toolbar.Button.json b/docs/symbols/Roo.Toolbar.Button.json index 3e3c469969..1b5b7850fb 100644 --- a/docs/symbols/Roo.Toolbar.Button.json +++ b/docs/symbols/Roo.Toolbar.Button.json @@ -421,6 +421,32 @@ ], "returns" : [] }, + { + "name" : "setPressed", + "type" : "function", + "desc" : "Similar to toggle, but does not trigger event.", + "sig" : "(state)", + "static" : false, + "memberOf" : "Roo.Button", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "state", + "type" : "Boolean", + "desc" : "[required] Force a particular state", + "isOptional" : false + } + ], + "returns" : [] + }, { "name" : "setVisible", "type" : "function", diff --git a/docs/symbols/Roo.Toolbar.SplitButton.json b/docs/symbols/Roo.Toolbar.SplitButton.json index b7f8855674..caf4eca11e 100644 --- a/docs/symbols/Roo.Toolbar.SplitButton.json +++ b/docs/symbols/Roo.Toolbar.SplitButton.json @@ -470,6 +470,32 @@ ], "returns" : [] }, + { + "name" : "setPressed", + "type" : "function", + "desc" : "Similar to toggle, but does not trigger event.", + "sig" : "(state)", + "static" : false, + "memberOf" : "Roo.Button", + "isStatic" : false, + "isConstructor" : false, + "isPrivate" : false, + "example" : "", + "deprecated" : "", + "since" : "", + "see" : "", + "exceptions" : "", + "requires" : "", + "params" : [ + { + "name" : "state", + "type" : "Boolean", + "desc" : "[required] Force a particular state", + "isOptional" : false + } + ], + "returns" : [] + }, { "name" : "setVisible", "type" : "function", diff --git a/roojs-all.js b/roojs-all.js index 020bb2c01f..66b91383c2 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -1213,14 +1213,15 @@ B.on("mousedown",this.onMouseDown,this);}B.on(this.clickEvent,this.onClick,this) if(Roo.isIE7&&Roo.isStrict){var ib=this.el.child('button');if(ib&&ib.getWidth()>20){ib.clip();ib.setWidth(Roo.util.TextMetrics.measure(ib,this.text).width+ib.getFrameWidth('lr'));}}if(this.minWidth){if(this.hidden){this.el.beginMeasure();}if(this.el.getWidth()','','',"
 
",'','',"
 
"); var C=B.append(A,[this.text,this.type],true);var D=C.child("button");if(this.cls){C.addClass(this.cls);}if(this.icon){D.setStyle('background-image','url('+this.icon+')');}if(this.iconCls){D.addClass(this.iconCls);if(!this.cls){C.addClass(this.text?'x-btn-text-icon':'x-btn-icon'); @@ -1991,14 +1992,15 @@ Roo.htmleditor.BlockFigure=function(A){if(A.node){this.readElement(A.node);this. }b.href=I;b.updateElement();D();A.editorcore.onEditorEvent();},minWidth:250,prompt:true,modal:true,value:b.href});}},xns:C.Toolbar},{xtype:'Button',text:'Show Video URL',listeners:{click:function(F,G){Roo.MessageBox.alert("Video URL",B().video_url==''?'This image is not linked ot a video':'The image is linked to: '+B().video_url+''); }},xns:C.Toolbar},{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%'],['80%'],['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!='100%'&&this.align=='center'?'0 auto':0;var iw=this.align=='center'?this.width:'100%';var A={tag:'img',contenteditable:'false',src:this.image_src,alt:d.innerText.replace(/\n/g," ").replace(/\s+/g,' ').trim(),style:{width:iw,maxWidth:iw+' !important',margin:m} +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.setText(v?"Hide Caption":"Show Caption"); +this.setPressed(v!='block');},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!='100%'&&this.align=='center'?'0 auto':0;var iw=this.align=='center'?this.width:'100%';var A={tag:'img',contenteditable:'false',src:this.image_src,alt:d.innerText.replace(/\n/g," ").replace(/\s+/g,' ').trim(),style:{width:iw,maxWidth:iw+' !important',margin:m} };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"); -return {tag:'figure','data-block':'Figure',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'?'10px 0':'0',textAlign:this.align} +var C={tag:'figure','data-block':'Figure',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.width+' !important',margin:m,width:this.width},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}]}]}]};},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);this.caption=this.getVal(B,'i','html');this.caption_display=this.getVal(A,'figcaption','data-display');this.width=this.getVal(A,'figcaption','style','width');},removeNode:function(){return this.node;}}) +,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);this.caption=this.getVal(B,'i','html');this.caption_display=this.getVal(A,'figcaption','data-display');this.width=this.getVal(A,'figcaption','style','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;r');return false;}if(cd.types.indexOf('text/html')<0){return false;}var C=[];var D=cd.getData('text/html');if(cd.types.indexOf('text/rtf')>-1){var E=new Roo.rtf.Parser(cd.getData('text/rtf'));C=E.doc?E.doc.getElementsByType('pict'):[]; }Roo.log(C);C=C.filter(function(g){return !g.path.match(/^rtf\/(head|pgdsctbl|listtable|footerf)/);}).map(function(g){return g.toDataURL();}).filter(function(g){return g!='about:blank';});D=this.cleanWordChars(D);var d=(new DOMParser().parseFromString(D,'text/html')).body; var sn=this.getParentElement();if(d.getElementsByTagName('table').length&&sn&&sn.closest('table')){e.preventDefault();this.insertAtCursor("You can not nest tables");return false;}if(C.length>0){Roo.each(d.getElementsByTagName('img'),function(F,i){F.setAttribute('src',C[i]); -});}if(this.autoClean){new Roo.htmleditor.FilterStyleToTag({node:d});new Roo.htmleditor.FilterAttributes({node:d,attrib_white:['href','src','name','align','colspan','rowspan'],attrib_clean:['href','src']});new Roo.htmleditor.FilterBlack({node:d,tag:this.black} +});}if(this.autoClean){new Roo.htmleditor.FilterStyleToTag({node:d});new Roo.htmleditor.FilterAttributes({node:d,attrib_white:['href','src','name','align','colspan','rowspan','data-display'],attrib_clean:['href','src']});new Roo.htmleditor.FilterBlack({node:d,tag:this.black} );new Roo.htmleditor.FilterKeepChildren({node:d,tag:['FONT','O:P']});new Roo.htmleditor.FilterParagraph({node:d});new Roo.htmleditor.FilterSpan({node:d});new Roo.htmleditor.FilterLongBr({node:d});}if(this.enableBlocks){Array.from(d.getElementsByTagName('img')).forEach(function(F){if(F.closest('figure')){return; }var G=new Roo.htmleditor.BlockFigure({image_src:F.src});G.updateElement(F);});}this.insertAtCursor(d.innerHTML.replace(/ /g,' '));if(this.enableBlocks){Roo.htmleditor.Block.initAll(this.doc.body);}e.preventDefault();return false;},onDestroy:function(){if(this.rendered){} },onFirstFocus:function(){this.assignDocWin();this.undoManager=new Roo.lib.UndoManager(100,(this.doc.body||this.doc.documentElement));this.activated=true;if(Roo.isGecko){this.win.focus();var s=this.win.getSelection();if(!s.focusNode||s.focusNode.nodeType!=3){var r=s.getRangeAt(0); diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 3656b8c2d0..b322330f9f 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -8463,7 +8463,7 @@ Roo.grid.ColumnModel = function(config){ }; Roo.extend(Roo.grid.ColumnModel, Roo.util.Observable, { /** - * @cfg {String} header The header text to display in the Grid view. + * @cfg {String} header [required] The header text to display in the Grid view. */ /** * @cfg {String} xsHeader Header at Bootsrap Extra Small width (default for all) @@ -8481,66 +8481,66 @@ Roo.extend(Roo.grid.ColumnModel, Roo.util.Observable, { * @cfg {String} xlHeader Header at Bootsrap extra Large width */ /** - * @cfg {String} dataIndex (Optional) The name of the field in the grid's {@link Roo.data.Store}'s + * @cfg {String} dataIndex The name of the field in the grid's {@link Roo.data.Store}'s * {@link Roo.data.Record} definition from which to draw the column's value. If not * specified, the column's index is used as an index into the Record's data Array. */ /** - * @cfg {Number} width (Optional) The initial width in pixels of the column. Using this + * @cfg {Number} width The initial width in pixels of the column. Using this * instead of {@link Roo.grid.Grid#autoSizeColumns} is more efficient. */ /** - * @cfg {Boolean} sortable (Optional) True if sorting is to be allowed on this column. + * @cfg {Boolean} sortable True if sorting is to be allowed on this column. * Defaults to the value of the {@link #defaultSortable} property. * Whether local/remote sorting is used is specified in {@link Roo.data.Store#remoteSort}. */ /** - * @cfg {Boolean} locked (Optional) True to lock the column in place while scrolling the Grid. Defaults to false. + * @cfg {Boolean} locked True to lock the column in place while scrolling the Grid. Defaults to false. */ /** - * @cfg {Boolean} fixed (Optional) True if the column width cannot be changed. Defaults to false. + * @cfg {Boolean} fixed True if the column width cannot be changed. Defaults to false. */ /** - * @cfg {Boolean} resizable (Optional) False to disable column resizing. Defaults to true. + * @cfg {Boolean} resizable False to disable column resizing. Defaults to true. */ /** - * @cfg {Boolean} hidden (Optional) True to hide the column. Defaults to false. + * @cfg {Boolean} hidden True to hide the column. Defaults to false. */ /** - * @cfg {Function} renderer (Optional) A function used to generate HTML markup for a cell + * @cfg {Function} renderer A function used to generate HTML markup for a cell * given the cell's data value. See {@link #setRenderer}. If not specified, the * default renderer returns the escaped data value. If an object is returned (bootstrap only) * then it is treated as a Roo Component object instance, and it is rendered after the initial row is rendered */ /** - * @cfg {Roo.grid.GridEditor} editor (Optional) For grid editors - returns the grid editor + * @cfg {Roo.grid.GridEditor} editor For grid editors - returns the grid editor */ /** - * @cfg {String} align (Optional) Set the CSS text-align property of the column. Defaults to undefined. + * @cfg {String} align (left|right) Set the CSS text-align property of the column. Defaults to undefined (left). */ /** - * @cfg {String} valign (Optional) Set the CSS vertical-align property of the column (eg. middle, top, bottom etc). Defaults to undefined. + * @cfg {String} valign (top|bottom|middle) Set the CSS vertical-align property of the column (eg. middle, top, bottom etc). Defaults to undefined (middle) */ /** - * @cfg {String} cursor (Optional) + * @cfg {String} cursor ( auto|default|none|context-menu|help|pointer|progress|wait|cell|crosshair|text|vertical-text|alias|copy|move|no-drop|not-allowed|e-resize|n-resize|ne-resize|nw-resize|s-resize|se-resize|sw-resize|w-resize|ew-resize|ns-resize|nesw-resize|nwse-resize|col-resize|row-resize|all-scroll|zoom-in|zoom-out|grab|grabbing) */ /** - * @cfg {String} tooltip (Optional) + * @cfg {String} tooltip mouse over tooltip text */ /** - * @cfg {Number} xs (Optional) can be '0' for hidden at this size (number less than 12) + * @cfg {Number} xs can be '0' for hidden at this size (number less than 12) */ /** - * @cfg {Number} sm (Optional) can be '0' for hidden at this size (number less than 12) + * @cfg {Number} sm can be '0' for hidden at this size (number less than 12) */ /** - * @cfg {Number} md (Optional) can be '0' for hidden at this size (number less than 12) + * @cfg {Number} md can be '0' for hidden at this size (number less than 12) */ /** - * @cfg {Number} lg (Optional) can be '0' for hidden at this size (number less than 12) + * @cfg {Number} lg can be '0' for hidden at this size (number less than 12) */ /** - * @cfg {Number} xl (Optional) can be '0' for hidden at this size (number less than 12) + * @cfg {Number} xl can be '0' for hidden at this size (number less than 12) */ /** * Returns the id of the column at the specified index. @@ -27207,7 +27207,10 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { pressed : false, enableToggle : true, setValue : function(v) { - this.toggle(v == 'block' ? false : true); + // this trigger toggle. + + this.setText(v ? "Hide Caption" : "Show Caption"); + this.setPressed(v != 'block'); }, listeners : { toggle: function (btn, state) @@ -27246,8 +27249,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { style: { width : iw, maxWidth : iw + ' !important', // this is not getting rendered? - margin : m - + margin : m } }; @@ -27288,7 +27290,8 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { // we remove caption totally if its hidden... - will delete data.. but otherwise we end up with fake caption var captionhtml = this.caption_display == 'none' ? '' : (this.caption.length ? this.caption : "Caption"); - return { + + var ret = { tag: 'figure', 'data-block' : 'Figure', @@ -27300,7 +27303,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { maxWidth : this.align == 'center' ? '100% !important' : (this.width + ' !important'), width : this.align == 'center' ? '100%' : this.width, margin: '0px', - padding: '10px', + padding: this.align == 'center' ? '0' : '0 10px' , textAlign : this.align // seems to work for email.. }, @@ -27349,6 +27352,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { } ] }; + return ret; }, @@ -29246,7 +29250,7 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { new Roo.htmleditor.FilterStyleToTag({ node : d }); new Roo.htmleditor.FilterAttributes({ node : d, - attrib_white : ['href', 'src', 'name', 'align', 'colspan', 'rowspan'], + attrib_white : ['href', 'src', 'name', 'align', 'colspan', 'rowspan', 'data-display'], attrib_clean : ['href', 'src' ] }); new Roo.htmleditor.FilterBlack({ node : d, tag : this.black}); diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 0047723e87..d50209c757 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -1180,14 +1180,15 @@ Roo.htmleditor.BlockFigure=function(A){if(A.node){this.readElement(A.node);this. }b.href=I;b.updateElement();D();A.editorcore.onEditorEvent();},minWidth:250,prompt:true,modal:true,value:b.href});}},xns:C.Toolbar},{xtype:'Button',text:'Show Video URL',listeners:{click:function(F,G){Roo.MessageBox.alert("Video URL",B().video_url==''?'This image is not linked ot a video':'The image is linked to: '+B().video_url+''); }},xns:C.Toolbar},{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%'],['80%'],['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!='100%'&&this.align=='center'?'0 auto':0;var iw=this.align=='center'?this.width:'100%';var A={tag:'img',contenteditable:'false',src:this.image_src,alt:d.innerText.replace(/\n/g," ").replace(/\s+/g,' ').trim(),style:{width:iw,maxWidth:iw+' !important',margin:m} +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.setText(v?"Hide Caption":"Show Caption"); +this.setPressed(v!='block');},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!='100%'&&this.align=='center'?'0 auto':0;var iw=this.align=='center'?this.width:'100%';var A={tag:'img',contenteditable:'false',src:this.image_src,alt:d.innerText.replace(/\n/g," ").replace(/\s+/g,' ').trim(),style:{width:iw,maxWidth:iw+' !important',margin:m} };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"); -return {tag:'figure','data-block':'Figure',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:'10px',textAlign:this.align} +var C={tag:'figure','data-block':'Figure',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.width+' !important',margin:m,width:this.width},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}]}]}]};},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);this.caption=this.getVal(B,'i','html');this.caption_display=this.getVal(A,'figcaption','data-display');this.width=this.getVal(A,'figcaption','style','width');},removeNode:function(){return this.node;}}) +,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);this.caption=this.getVal(B,'i','html');this.caption_display=this.getVal(A,'figcaption','data-display');this.width=this.getVal(A,'figcaption','style','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;r');return false;}if(cd.types.indexOf('text/html')<0){return false;}var C=[];var D=cd.getData('text/html');if(cd.types.indexOf('text/rtf')>-1){var E=new Roo.rtf.Parser(cd.getData('text/rtf'));C=E.doc?E.doc.getElementsByType('pict'):[]; }Roo.log(C);C=C.filter(function(g){return !g.path.match(/^rtf\/(head|pgdsctbl|listtable|footerf)/);}).map(function(g){return g.toDataURL();}).filter(function(g){return g!='about:blank';});D=this.cleanWordChars(D);var d=(new DOMParser().parseFromString(D,'text/html')).body; var sn=this.getParentElement();if(d.getElementsByTagName('table').length&&sn&&sn.closest('table')){e.preventDefault();this.insertAtCursor("You can not nest tables");return false;}if(C.length>0){Roo.each(d.getElementsByTagName('img'),function(F,i){F.setAttribute('src',C[i]); -});}if(this.autoClean){new Roo.htmleditor.FilterStyleToTag({node:d});new Roo.htmleditor.FilterAttributes({node:d,attrib_white:['href','src','name','align','colspan','rowspan'],attrib_clean:['href','src']});new Roo.htmleditor.FilterBlack({node:d,tag:this.black} +});}if(this.autoClean){new Roo.htmleditor.FilterStyleToTag({node:d});new Roo.htmleditor.FilterAttributes({node:d,attrib_white:['href','src','name','align','colspan','rowspan','data-display'],attrib_clean:['href','src']});new Roo.htmleditor.FilterBlack({node:d,tag:this.black} );new Roo.htmleditor.FilterKeepChildren({node:d,tag:['FONT','O:P']});new Roo.htmleditor.FilterParagraph({node:d});new Roo.htmleditor.FilterSpan({node:d});new Roo.htmleditor.FilterLongBr({node:d});}if(this.enableBlocks){Array.from(d.getElementsByTagName('img')).forEach(function(F){if(F.closest('figure')){return; }var G=new Roo.htmleditor.BlockFigure({image_src:F.src});G.updateElement(F);});}this.insertAtCursor(d.innerHTML.replace(/ /g,' '));if(this.enableBlocks){Roo.htmleditor.Block.initAll(this.doc.body);}e.preventDefault();return false;},onDestroy:function(){if(this.rendered){} },onFirstFocus:function(){this.assignDocWin();this.undoManager=new Roo.lib.UndoManager(100,(this.doc.body||this.doc.documentElement));this.activated=true;if(Roo.isGecko){this.win.focus();var s=this.win.getSelection();if(!s.focusNode||s.focusNode.nodeType!=3){var r=s.getRangeAt(0); diff --git a/roojs-debug.js b/roojs-debug.js index 1dffbe2125..aa4a181345 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -31134,7 +31134,23 @@ Roo.extend(Roo.Button, Roo.util.Observable, { this.hide(); } }, - + /** + * Similar to toggle, but does not trigger event. + * @param {Boolean} state [required] Force a particular state + */ + setPressed : function(state) + { + if(state != this.pressed){ + if(state){ + this.el.addClass("x-btn-pressed"); + this.pressed = true; + }else{ + this.el.removeClass("x-btn-pressed"); + this.pressed = false; + } + } + }, + /** * If a state it passed, it becomes the pressed state otherwise the current state is toggled. * @param {Boolean} state (optional) Force a particular state @@ -31157,6 +31173,8 @@ Roo.extend(Roo.Button, Roo.util.Observable, { } }, + + /** * Focus the button */ @@ -48067,7 +48085,10 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { pressed : false, enableToggle : true, setValue : function(v) { - this.toggle(v == 'block' ? false : true); + // this trigger toggle. + + this.setText(v ? "Hide Caption" : "Show Caption"); + this.setPressed(v != 'block'); }, listeners : { toggle: function (btn, state) @@ -48106,8 +48127,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { style: { width : iw, maxWidth : iw + ' !important', // this is not getting rendered? - margin : m - + margin : m } }; @@ -48148,7 +48168,8 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { // we remove caption totally if its hidden... - will delete data.. but otherwise we end up with fake caption var captionhtml = this.caption_display == 'none' ? '' : (this.caption.length ? this.caption : "Caption"); - return { + + var ret = { tag: 'figure', 'data-block' : 'Figure', @@ -48160,7 +48181,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { maxWidth : this.align == 'center' ? '100% !important' : (this.width + ' !important'), width : this.align == 'center' ? '100%' : this.width, margin: '0px', - padding: this.align == 'center' ? '10px 0' : '0', + padding: this.align == 'center' ? '0' : '0 10px' , textAlign : this.align // seems to work for email.. }, @@ -48209,6 +48230,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { } ] }; + return ret; }, @@ -50106,7 +50128,7 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { new Roo.htmleditor.FilterStyleToTag({ node : d }); new Roo.htmleditor.FilterAttributes({ node : d, - attrib_white : ['href', 'src', 'name', 'align', 'colspan', 'rowspan'], + attrib_white : ['href', 'src', 'name', 'align', 'colspan', 'rowspan', 'data-display'], attrib_clean : ['href', 'src' ] }); new Roo.htmleditor.FilterBlack({ node : d, tag : this.black}); @@ -64302,7 +64324,7 @@ Roo.grid.ColumnModel = function(config){ }; Roo.extend(Roo.grid.ColumnModel, Roo.util.Observable, { /** - * @cfg {String} header The header text to display in the Grid view. + * @cfg {String} header [required] The header text to display in the Grid view. */ /** * @cfg {String} xsHeader Header at Bootsrap Extra Small width (default for all) @@ -64320,66 +64342,66 @@ Roo.extend(Roo.grid.ColumnModel, Roo.util.Observable, { * @cfg {String} xlHeader Header at Bootsrap extra Large width */ /** - * @cfg {String} dataIndex (Optional) The name of the field in the grid's {@link Roo.data.Store}'s + * @cfg {String} dataIndex The name of the field in the grid's {@link Roo.data.Store}'s * {@link Roo.data.Record} definition from which to draw the column's value. If not * specified, the column's index is used as an index into the Record's data Array. */ /** - * @cfg {Number} width (Optional) The initial width in pixels of the column. Using this + * @cfg {Number} width The initial width in pixels of the column. Using this * instead of {@link Roo.grid.Grid#autoSizeColumns} is more efficient. */ /** - * @cfg {Boolean} sortable (Optional) True if sorting is to be allowed on this column. + * @cfg {Boolean} sortable True if sorting is to be allowed on this column. * Defaults to the value of the {@link #defaultSortable} property. * Whether local/remote sorting is used is specified in {@link Roo.data.Store#remoteSort}. */ /** - * @cfg {Boolean} locked (Optional) True to lock the column in place while scrolling the Grid. Defaults to false. + * @cfg {Boolean} locked True to lock the column in place while scrolling the Grid. Defaults to false. */ /** - * @cfg {Boolean} fixed (Optional) True if the column width cannot be changed. Defaults to false. + * @cfg {Boolean} fixed True if the column width cannot be changed. Defaults to false. */ /** - * @cfg {Boolean} resizable (Optional) False to disable column resizing. Defaults to true. + * @cfg {Boolean} resizable False to disable column resizing. Defaults to true. */ /** - * @cfg {Boolean} hidden (Optional) True to hide the column. Defaults to false. + * @cfg {Boolean} hidden True to hide the column. Defaults to false. */ /** - * @cfg {Function} renderer (Optional) A function used to generate HTML markup for a cell + * @cfg {Function} renderer A function used to generate HTML markup for a cell * given the cell's data value. See {@link #setRenderer}. If not specified, the * default renderer returns the escaped data value. If an object is returned (bootstrap only) * then it is treated as a Roo Component object instance, and it is rendered after the initial row is rendered */ /** - * @cfg {Roo.grid.GridEditor} editor (Optional) For grid editors - returns the grid editor + * @cfg {Roo.grid.GridEditor} editor For grid editors - returns the grid editor */ /** - * @cfg {String} align (Optional) Set the CSS text-align property of the column. Defaults to undefined. + * @cfg {String} align (left|right) Set the CSS text-align property of the column. Defaults to undefined (left). */ /** - * @cfg {String} valign (Optional) Set the CSS vertical-align property of the column (eg. middle, top, bottom etc). Defaults to undefined. + * @cfg {String} valign (top|bottom|middle) Set the CSS vertical-align property of the column (eg. middle, top, bottom etc). Defaults to undefined (middle) */ /** - * @cfg {String} cursor (Optional) + * @cfg {String} cursor ( auto|default|none|context-menu|help|pointer|progress|wait|cell|crosshair|text|vertical-text|alias|copy|move|no-drop|not-allowed|e-resize|n-resize|ne-resize|nw-resize|s-resize|se-resize|sw-resize|w-resize|ew-resize|ns-resize|nesw-resize|nwse-resize|col-resize|row-resize|all-scroll|zoom-in|zoom-out|grab|grabbing) */ /** - * @cfg {String} tooltip (Optional) + * @cfg {String} tooltip mouse over tooltip text */ /** - * @cfg {Number} xs (Optional) can be '0' for hidden at this size (number less than 12) + * @cfg {Number} xs can be '0' for hidden at this size (number less than 12) */ /** - * @cfg {Number} sm (Optional) can be '0' for hidden at this size (number less than 12) + * @cfg {Number} sm can be '0' for hidden at this size (number less than 12) */ /** - * @cfg {Number} md (Optional) can be '0' for hidden at this size (number less than 12) + * @cfg {Number} md can be '0' for hidden at this size (number less than 12) */ /** - * @cfg {Number} lg (Optional) can be '0' for hidden at this size (number less than 12) + * @cfg {Number} lg can be '0' for hidden at this size (number less than 12) */ /** - * @cfg {Number} xl (Optional) can be '0' for hidden at this size (number less than 12) + * @cfg {Number} xl can be '0' for hidden at this size (number less than 12) */ /** * Returns the id of the column at the specified index. diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index 4a09273745..7099b8c94e 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -6642,7 +6642,23 @@ Roo.extend(Roo.Button, Roo.util.Observable, { this.hide(); } }, - + /** + * Similar to toggle, but does not trigger event. + * @param {Boolean} state [required] Force a particular state + */ + setPressed : function(state) + { + if(state != this.pressed){ + if(state){ + this.el.addClass("x-btn-pressed"); + this.pressed = true; + }else{ + this.el.removeClass("x-btn-pressed"); + this.pressed = false; + } + } + }, + /** * If a state it passed, it becomes the pressed state otherwise the current state is toggled. * @param {Boolean} state (optional) Force a particular state @@ -6665,6 +6681,8 @@ Roo.extend(Roo.Button, Roo.util.Observable, { } }, + + /** * Focus the button */ @@ -23575,7 +23593,10 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { pressed : false, enableToggle : true, setValue : function(v) { - this.toggle(v == 'block' ? false : true); + // this trigger toggle. + + this.setText(v ? "Hide Caption" : "Show Caption"); + this.setPressed(v != 'block'); }, listeners : { toggle: function (btn, state) @@ -23614,8 +23635,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { style: { width : iw, maxWidth : iw + ' !important', // this is not getting rendered? - margin : m - + margin : m } }; @@ -23656,7 +23676,8 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { // we remove caption totally if its hidden... - will delete data.. but otherwise we end up with fake caption var captionhtml = this.caption_display == 'none' ? '' : (this.caption.length ? this.caption : "Caption"); - return { + + var ret = { tag: 'figure', 'data-block' : 'Figure', @@ -23668,7 +23689,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { maxWidth : this.align == 'center' ? '100% !important' : (this.width + ' !important'), width : this.align == 'center' ? '100%' : this.width, margin: '0px', - padding: this.align == 'center' ? '10px 0' : '0', + padding: this.align == 'center' ? '0' : '0 10px' , textAlign : this.align // seems to work for email.. }, @@ -23717,6 +23738,7 @@ Roo.extend(Roo.htmleditor.BlockFigure, Roo.htmleditor.Block, { } ] }; + return ret; }, @@ -25614,7 +25636,7 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { new Roo.htmleditor.FilterStyleToTag({ node : d }); new Roo.htmleditor.FilterAttributes({ node : d, - attrib_white : ['href', 'src', 'name', 'align', 'colspan', 'rowspan'], + attrib_white : ['href', 'src', 'name', 'align', 'colspan', 'rowspan', 'data-display'], attrib_clean : ['href', 'src' ] }); new Roo.htmleditor.FilterBlack({ node : d, tag : this.black}); @@ -39810,7 +39832,7 @@ Roo.grid.ColumnModel = function(config){ }; Roo.extend(Roo.grid.ColumnModel, Roo.util.Observable, { /** - * @cfg {String} header The header text to display in the Grid view. + * @cfg {String} header [required] The header text to display in the Grid view. */ /** * @cfg {String} xsHeader Header at Bootsrap Extra Small width (default for all) @@ -39828,66 +39850,66 @@ Roo.extend(Roo.grid.ColumnModel, Roo.util.Observable, { * @cfg {String} xlHeader Header at Bootsrap extra Large width */ /** - * @cfg {String} dataIndex (Optional) The name of the field in the grid's {@link Roo.data.Store}'s + * @cfg {String} dataIndex The name of the field in the grid's {@link Roo.data.Store}'s * {@link Roo.data.Record} definition from which to draw the column's value. If not * specified, the column's index is used as an index into the Record's data Array. */ /** - * @cfg {Number} width (Optional) The initial width in pixels of the column. Using this + * @cfg {Number} width The initial width in pixels of the column. Using this * instead of {@link Roo.grid.Grid#autoSizeColumns} is more efficient. */ /** - * @cfg {Boolean} sortable (Optional) True if sorting is to be allowed on this column. + * @cfg {Boolean} sortable True if sorting is to be allowed on this column. * Defaults to the value of the {@link #defaultSortable} property. * Whether local/remote sorting is used is specified in {@link Roo.data.Store#remoteSort}. */ /** - * @cfg {Boolean} locked (Optional) True to lock the column in place while scrolling the Grid. Defaults to false. + * @cfg {Boolean} locked True to lock the column in place while scrolling the Grid. Defaults to false. */ /** - * @cfg {Boolean} fixed (Optional) True if the column width cannot be changed. Defaults to false. + * @cfg {Boolean} fixed True if the column width cannot be changed. Defaults to false. */ /** - * @cfg {Boolean} resizable (Optional) False to disable column resizing. Defaults to true. + * @cfg {Boolean} resizable False to disable column resizing. Defaults to true. */ /** - * @cfg {Boolean} hidden (Optional) True to hide the column. Defaults to false. + * @cfg {Boolean} hidden True to hide the column. Defaults to false. */ /** - * @cfg {Function} renderer (Optional) A function used to generate HTML markup for a cell + * @cfg {Function} renderer A function used to generate HTML markup for a cell * given the cell's data value. See {@link #setRenderer}. If not specified, the * default renderer returns the escaped data value. If an object is returned (bootstrap only) * then it is treated as a Roo Component object instance, and it is rendered after the initial row is rendered */ /** - * @cfg {Roo.grid.GridEditor} editor (Optional) For grid editors - returns the grid editor + * @cfg {Roo.grid.GridEditor} editor For grid editors - returns the grid editor */ /** - * @cfg {String} align (Optional) Set the CSS text-align property of the column. Defaults to undefined. + * @cfg {String} align (left|right) Set the CSS text-align property of the column. Defaults to undefined (left). */ /** - * @cfg {String} valign (Optional) Set the CSS vertical-align property of the column (eg. middle, top, bottom etc). Defaults to undefined. + * @cfg {String} valign (top|bottom|middle) Set the CSS vertical-align property of the column (eg. middle, top, bottom etc). Defaults to undefined (middle) */ /** - * @cfg {String} cursor (Optional) + * @cfg {String} cursor ( auto|default|none|context-menu|help|pointer|progress|wait|cell|crosshair|text|vertical-text|alias|copy|move|no-drop|not-allowed|e-resize|n-resize|ne-resize|nw-resize|s-resize|se-resize|sw-resize|w-resize|ew-resize|ns-resize|nesw-resize|nwse-resize|col-resize|row-resize|all-scroll|zoom-in|zoom-out|grab|grabbing) */ /** - * @cfg {String} tooltip (Optional) + * @cfg {String} tooltip mouse over tooltip text */ /** - * @cfg {Number} xs (Optional) can be '0' for hidden at this size (number less than 12) + * @cfg {Number} xs can be '0' for hidden at this size (number less than 12) */ /** - * @cfg {Number} sm (Optional) can be '0' for hidden at this size (number less than 12) + * @cfg {Number} sm can be '0' for hidden at this size (number less than 12) */ /** - * @cfg {Number} md (Optional) can be '0' for hidden at this size (number less than 12) + * @cfg {Number} md can be '0' for hidden at this size (number less than 12) */ /** - * @cfg {Number} lg (Optional) can be '0' for hidden at this size (number less than 12) + * @cfg {Number} lg can be '0' for hidden at this size (number less than 12) */ /** - * @cfg {Number} xl (Optional) can be '0' for hidden at this size (number less than 12) + * @cfg {Number} xl can be '0' for hidden at this size (number less than 12) */ /** * Returns the id of the column at the specified index. diff --git a/roojs-ui.js b/roojs-ui.js index 9c0b4572d6..9658b82d2f 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -267,14 +267,15 @@ B.on("mousedown",this.onMouseDown,this);}B.on(this.clickEvent,this.onClick,this) if(Roo.isIE7&&Roo.isStrict){var ib=this.el.child('button');if(ib&&ib.getWidth()>20){ib.clip();ib.setWidth(Roo.util.TextMetrics.measure(ib,this.text).width+ib.getFrameWidth('lr'));}}if(this.minWidth){if(this.hidden){this.el.beginMeasure();}if(this.el.getWidth()','','',"
 
",'','',"
 
"); var C=B.append(A,[this.text,this.type],true);var D=C.child("button");if(this.cls){C.addClass(this.cls);}if(this.icon){D.setStyle('background-image','url('+this.icon+')');}if(this.iconCls){D.addClass(this.iconCls);if(!this.cls){C.addClass(this.text?'x-btn-text-icon':'x-btn-icon'); @@ -1045,14 +1046,15 @@ Roo.htmleditor.BlockFigure=function(A){if(A.node){this.readElement(A.node);this. }b.href=I;b.updateElement();D();A.editorcore.onEditorEvent();},minWidth:250,prompt:true,modal:true,value:b.href});}},xns:C.Toolbar},{xtype:'Button',text:'Show Video URL',listeners:{click:function(F,G){Roo.MessageBox.alert("Video URL",B().video_url==''?'This image is not linked ot a video':'The image is linked to: '+B().video_url+''); }},xns:C.Toolbar},{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%'],['80%'],['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!='100%'&&this.align=='center'?'0 auto':0;var iw=this.align=='center'?this.width:'100%';var A={tag:'img',contenteditable:'false',src:this.image_src,alt:d.innerText.replace(/\n/g," ").replace(/\s+/g,' ').trim(),style:{width:iw,maxWidth:iw+' !important',margin:m} +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.setText(v?"Hide Caption":"Show Caption"); +this.setPressed(v!='block');},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!='100%'&&this.align=='center'?'0 auto':0;var iw=this.align=='center'?this.width:'100%';var A={tag:'img',contenteditable:'false',src:this.image_src,alt:d.innerText.replace(/\n/g," ").replace(/\s+/g,' ').trim(),style:{width:iw,maxWidth:iw+' !important',margin:m} };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"); -return {tag:'figure','data-block':'Figure',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'?'10px 0':'0',textAlign:this.align} +var C={tag:'figure','data-block':'Figure',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.width+' !important',margin:m,width:this.width},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}]}]}]};},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);this.caption=this.getVal(B,'i','html');this.caption_display=this.getVal(A,'figcaption','data-display');this.width=this.getVal(A,'figcaption','style','width');},removeNode:function(){return this.node;}}) +,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);this.caption=this.getVal(B,'i','html');this.caption_display=this.getVal(A,'figcaption','data-display');this.width=this.getVal(A,'figcaption','style','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;r');return false;}if(cd.types.indexOf('text/html')<0){return false;}var C=[];var D=cd.getData('text/html');if(cd.types.indexOf('text/rtf')>-1){var E=new Roo.rtf.Parser(cd.getData('text/rtf'));C=E.doc?E.doc.getElementsByType('pict'):[]; }Roo.log(C);C=C.filter(function(g){return !g.path.match(/^rtf\/(head|pgdsctbl|listtable|footerf)/);}).map(function(g){return g.toDataURL();}).filter(function(g){return g!='about:blank';});D=this.cleanWordChars(D);var d=(new DOMParser().parseFromString(D,'text/html')).body; var sn=this.getParentElement();if(d.getElementsByTagName('table').length&&sn&&sn.closest('table')){e.preventDefault();this.insertAtCursor("You can not nest tables");return false;}if(C.length>0){Roo.each(d.getElementsByTagName('img'),function(F,i){F.setAttribute('src',C[i]); -});}if(this.autoClean){new Roo.htmleditor.FilterStyleToTag({node:d});new Roo.htmleditor.FilterAttributes({node:d,attrib_white:['href','src','name','align','colspan','rowspan'],attrib_clean:['href','src']});new Roo.htmleditor.FilterBlack({node:d,tag:this.black} +});}if(this.autoClean){new Roo.htmleditor.FilterStyleToTag({node:d});new Roo.htmleditor.FilterAttributes({node:d,attrib_white:['href','src','name','align','colspan','rowspan','data-display'],attrib_clean:['href','src']});new Roo.htmleditor.FilterBlack({node:d,tag:this.black} );new Roo.htmleditor.FilterKeepChildren({node:d,tag:['FONT','O:P']});new Roo.htmleditor.FilterParagraph({node:d});new Roo.htmleditor.FilterSpan({node:d});new Roo.htmleditor.FilterLongBr({node:d});}if(this.enableBlocks){Array.from(d.getElementsByTagName('img')).forEach(function(F){if(F.closest('figure')){return; }var G=new Roo.htmleditor.BlockFigure({image_src:F.src});G.updateElement(F);});}this.insertAtCursor(d.innerHTML.replace(/ /g,' '));if(this.enableBlocks){Roo.htmleditor.Block.initAll(this.doc.body);}e.preventDefault();return false;},onDestroy:function(){if(this.rendered){} },onFirstFocus:function(){this.assignDocWin();this.undoManager=new Roo.lib.UndoManager(100,(this.doc.body||this.doc.documentElement));this.activated=true;if(Roo.isGecko){this.win.focus();var s=this.win.getSelection();if(!s.focusNode||s.focusNode.nodeType!=3){var r=s.getRangeAt(0);