roojs-ui.js
authorAlan <alan@roojs.com>
Mon, 13 Dec 2021 06:43:41 +0000 (14:43 +0800)
committerAlan <alan@roojs.com>
Mon, 13 Dec 2021 06:43:41 +0000 (14:43 +0800)
roojs-ui-debug.js
roojs-all.js
roojs-debug.js
Roo/form/HtmlEditor/ToolbarContext.js

roojs-all.js
roojs-debug.js
roojs-ui-debug.js
roojs-ui.js

index 4a14b54..a0ede41 100644 (file)
@@ -2076,10 +2076,10 @@ if(I.optname){J=Roo.form.HtmlEditor.ToolbarContext.options[I.optname];}if(J){tb.
 b[c.attrname]=r.get('val');b.updateElement(tb.selectedNode);E.syncValue();return;}if(c.stylename){tb.selectedNode.style[c.stylename]=r.get('val');E.syncValue();return;}if(r===false){tb.selectedNode.removeAttribute(c.attrname);E.syncValue();return;}tb.selectedNode.setAttribute(c.attrname,r.get('val'));
 E.syncValue();}}}));continue;}tb.addField(new Roo.form.TextField({name:'-roo-edit-'+A[i].name,attrname:A[i].name,width:I.width,value:'',listeners:{'change':function(f,nv,ov){if(tb.selectedNode.hasAttribute('data-block')){var b=Roo.htmleditor.Block.factory(tb.selectedNode);
 b[f.attrname]=nv;b.updateElement(tb.selectedNode);E.syncValue();return;}tb.selectedNode.setAttribute(f.attrname,nv);E.syncValue();}}}));}var K=this;if(nm=='BODY'){tb.addSeparator();tb.addButton({text:'Stylesheets',listeners:{click:function(){K.editor.fireEvent('stylesheetsclick',K.editor);
-}}});}tb.addFill();tb.addButton({text:'Remove Block or Formating',listeners:{click:function(){var sn=tb.selectedNode;if(!sn){return;}var L=sn.childNodes[0]||sn.nextSibling||sn.previousSibling||sn.parentNode;if(sn.hasAttribute('data-block')){L=sn.nextSibling||sn.previousSibling||sn.parentNode;
-sn.parentNode.removeChild(sn);}else if(sn&&sn.tagName!='BODY'){a=new Roo.htmleditor.FilterKeepChildren({tag:false});a.removeTag(sn);}var M=E.createRange();M.setStart(L,0);M.setEnd(L,0);var N=E.getSelection();N.removeAllRanges();N.addRange(M);K.updateToolbar(null,null,null);
-K.updateFooter(false);}}});tb.el.on('click',function(e){e.preventDefault();});tb.el.setVisibilityMode(Roo.Element.DISPLAY);tb.el.hide();return tb;},buildFooter:function(){var A=this.editor.wrap.createChild();this.footer=new Roo.Toolbar(A);var B=new Roo.Toolbar.Fill();
-var _t=this;this.footer.add({text:'&lt;',xtype:'Button',handler:function(){_t.footDisp.scrollTo('left',0,true)}});this.footer.add(B);this.footer.add({text:'&gt;',xtype:'Button',handler:function(){_t.footDisp.select('span').last().scrollIntoView(_t.footDisp,true);
+}}});}tb.addFill();tb.addButton({text:'Remove Block or Formating',listeners:{click:function(){if(C){Roo.htmleditor.Block.factory(tb.selectedNode).remove();}var sn=tb.selectedNode;if(!sn){return;}var L=sn.childNodes[0]||sn.nextSibling||sn.previousSibling||sn.parentNode;
+if(sn.hasAttribute('data-block')){L=sn.nextSibling||sn.previousSibling||sn.parentNode;sn.parentNode.removeChild(sn);}else if(sn&&sn.tagName!='BODY'){a=new Roo.htmleditor.FilterKeepChildren({tag:false});a.removeTag(sn);}var M=E.createRange();M.setStart(L,0);
+M.setEnd(L,0);var N=E.getSelection();N.removeAllRanges();N.addRange(M);K.updateToolbar(null,null,null);K.updateFooter(false);}}});tb.el.on('click',function(e){e.preventDefault();});tb.el.setVisibilityMode(Roo.Element.DISPLAY);tb.el.hide();return tb;},buildFooter:function(){var A=this.editor.wrap.createChild();
+this.footer=new Roo.Toolbar(A);var B=new Roo.Toolbar.Fill();var _t=this;this.footer.add({text:'&lt;',xtype:'Button',handler:function(){_t.footDisp.scrollTo('left',0,true)}});this.footer.add(B);this.footer.add({text:'&gt;',xtype:'Button',handler:function(){_t.footDisp.select('span').last().scrollIntoView(_t.footDisp,true);
 }});var A=Roo.get(B.el);A.addClass('x-editor-context');this.footDispWrap=A;this.footDispWrap.overflow='hidden';this.footDisp=A.createChild();this.footDispWrap.on('click',this.onContextClick,this)},onContextClick:function(ev,A){ev.preventDefault();var cn=A.className;
 if(!cn.match(/x-ed-loc-/)){return;}var n=cn.split('-').pop();var B=this.footerEls;var C=B[n];var D=this.editorcore.createRange();D.selectNodeContents(C);var E=this.editorcore.getSelection();E.removeAllRanges();E.addRange(D);this.updateToolbar(null,null,C);
 }});
index 67170df..613def5 100644 (file)
@@ -49786,6 +49786,10 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
             listeners : {
                 click : function ()
                 {
+                    if (block) {
+                        Roo.htmleditor.Block.factory(tb.selectedNode).remove();
+                    }
+                    
                     // remove
                     // undo does not work.
                     var sn = tb.selectedNode;
index 282e878..561d56a 100644 (file)
@@ -25799,6 +25799,10 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarContext.prototype,  {
             listeners : {
                 click : function ()
                 {
+                    if (block) {
+                        Roo.htmleditor.Block.factory(tb.selectedNode).remove();
+                    }
+                    
                     // remove
                     // undo does not work.
                     var sn = tb.selectedNode;
index 3ad6cf6..51dab86 100644 (file)
@@ -1152,10 +1152,10 @@ if(I.optname){J=Roo.form.HtmlEditor.ToolbarContext.options[I.optname];}if(J){tb.
 b[c.attrname]=r.get('val');b.updateElement(tb.selectedNode);E.syncValue();return;}if(c.stylename){tb.selectedNode.style[c.stylename]=r.get('val');E.syncValue();return;}if(r===false){tb.selectedNode.removeAttribute(c.attrname);E.syncValue();return;}tb.selectedNode.setAttribute(c.attrname,r.get('val'));
 E.syncValue();}}}));continue;}tb.addField(new Roo.form.TextField({name:'-roo-edit-'+A[i].name,attrname:A[i].name,width:I.width,value:'',listeners:{'change':function(f,nv,ov){if(tb.selectedNode.hasAttribute('data-block')){var b=Roo.htmleditor.Block.factory(tb.selectedNode);
 b[f.attrname]=nv;b.updateElement(tb.selectedNode);E.syncValue();return;}tb.selectedNode.setAttribute(f.attrname,nv);E.syncValue();}}}));}var K=this;if(nm=='BODY'){tb.addSeparator();tb.addButton({text:'Stylesheets',listeners:{click:function(){K.editor.fireEvent('stylesheetsclick',K.editor);
-}}});}tb.addFill();tb.addButton({text:'Remove Block or Formating',listeners:{click:function(){var sn=tb.selectedNode;if(!sn){return;}var L=sn.childNodes[0]||sn.nextSibling||sn.previousSibling||sn.parentNode;if(sn.hasAttribute('data-block')){L=sn.nextSibling||sn.previousSibling||sn.parentNode;
-sn.parentNode.removeChild(sn);}else if(sn&&sn.tagName!='BODY'){a=new Roo.htmleditor.FilterKeepChildren({tag:false});a.removeTag(sn);}var M=E.createRange();M.setStart(L,0);M.setEnd(L,0);var N=E.getSelection();N.removeAllRanges();N.addRange(M);K.updateToolbar(null,null,null);
-K.updateFooter(false);}}});tb.el.on('click',function(e){e.preventDefault();});tb.el.setVisibilityMode(Roo.Element.DISPLAY);tb.el.hide();return tb;},buildFooter:function(){var A=this.editor.wrap.createChild();this.footer=new Roo.Toolbar(A);var B=new Roo.Toolbar.Fill();
-var _t=this;this.footer.add({text:'&lt;',xtype:'Button',handler:function(){_t.footDisp.scrollTo('left',0,true)}});this.footer.add(B);this.footer.add({text:'&gt;',xtype:'Button',handler:function(){_t.footDisp.select('span').last().scrollIntoView(_t.footDisp,true);
+}}});}tb.addFill();tb.addButton({text:'Remove Block or Formating',listeners:{click:function(){if(C){Roo.htmleditor.Block.factory(tb.selectedNode).remove();}var sn=tb.selectedNode;if(!sn){return;}var L=sn.childNodes[0]||sn.nextSibling||sn.previousSibling||sn.parentNode;
+if(sn.hasAttribute('data-block')){L=sn.nextSibling||sn.previousSibling||sn.parentNode;sn.parentNode.removeChild(sn);}else if(sn&&sn.tagName!='BODY'){a=new Roo.htmleditor.FilterKeepChildren({tag:false});a.removeTag(sn);}var M=E.createRange();M.setStart(L,0);
+M.setEnd(L,0);var N=E.getSelection();N.removeAllRanges();N.addRange(M);K.updateToolbar(null,null,null);K.updateFooter(false);}}});tb.el.on('click',function(e){e.preventDefault();});tb.el.setVisibilityMode(Roo.Element.DISPLAY);tb.el.hide();return tb;},buildFooter:function(){var A=this.editor.wrap.createChild();
+this.footer=new Roo.Toolbar(A);var B=new Roo.Toolbar.Fill();var _t=this;this.footer.add({text:'&lt;',xtype:'Button',handler:function(){_t.footDisp.scrollTo('left',0,true)}});this.footer.add(B);this.footer.add({text:'&gt;',xtype:'Button',handler:function(){_t.footDisp.select('span').last().scrollIntoView(_t.footDisp,true);
 }});var A=Roo.get(B.el);A.addClass('x-editor-context');this.footDispWrap=A;this.footDispWrap.overflow='hidden';this.footDisp=A.createChild();this.footDispWrap.on('click',this.onContextClick,this)},onContextClick:function(ev,A){ev.preventDefault();var cn=A.className;
 if(!cn.match(/x-ed-loc-/)){return;}var n=cn.split('-').pop();var B=this.footerEls;var C=B[n];var D=this.editorcore.createRange();D.selectNodeContents(C);var E=this.editorcore.getSelection();E.removeAllRanges();E.addRange(D);this.updateToolbar(null,null,C);
 }});