From 8243a30daf04298fc849760aa49bd3045a075e1a Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Wed, 28 Jul 2021 13:17:37 +0800 Subject: [PATCH] Changed docs/json/roodata.jsondocs/src/Roo_HtmlEditorCore.js.htmldocs/src/Roo_form_HtmlEditor.js.htmldocs/symbols/Roo.HtmlEditorCore.jsondocs/symbols/Roo.form.HtmlEditor.jsonroojs-bootstrap-debug.jsroojs-bootstrap.js --- docs/json/roodata.json | 12 +++ docs/src/Roo_HtmlEditorCore.js.html | 7 +- docs/src/Roo_form_HtmlEditor.js.html | 4 + docs/symbols/Roo.HtmlEditorCore.json | 7 ++ docs/symbols/Roo.form.HtmlEditor.json | 147 ++++++++++++++------------ roojs-bootstrap-debug.js | 7 +- roojs-bootstrap.js | 4 +- 7 files changed, 114 insertions(+), 74 deletions(-) diff --git a/docs/json/roodata.json b/docs/json/roodata.json index 368178f05d..fb34ff95eb 100644 --- a/docs/json/roodata.json +++ b/docs/json/roodata.json @@ -7196,6 +7196,12 @@ "desc" : "which property holds the element that used for hide() / show() / disable() / enable()\ndefault is 'el' for forms you probably want to set this to fieldEl", "memberOf" : "Roo.Component" }, + { + "name" : "allowComments", + "type" : "boolean", + "desc" : "- default false - allow comments in HTML source - by default they are stripped - if you are editing email you may need this.", + "memberOf" : "" + }, { "name" : "allowDomMove", "type" : "Boolean", @@ -88230,6 +88236,12 @@ "desc" : "which property holds the element that used for hide() / show() / disable() / enable()\ndefault is 'el' for forms you probably want to set this to fieldEl", "memberOf" : "Roo.Component" }, + { + "name" : "allowComments", + "type" : "boolean", + "desc" : "- default false - allow comments in HTML source - by default they are stripped - if you are editing email you may need this.", + "memberOf" : "" + }, { "name" : "allowDomMove", "type" : "Boolean", diff --git a/docs/src/Roo_HtmlEditorCore.js.html b/docs/src/Roo_HtmlEditorCore.js.html index 41e1e51260..db967c20e8 100644 --- a/docs/src/Roo_HtmlEditorCore.js.html +++ b/docs/src/Roo_HtmlEditorCore.js.html @@ -114,6 +114,11 @@ */ stylesheets: false, + /** + * @cfg {boolean} allowComments - default false - allow comments in HTML source - by default they are stripped - if you are editing email you may need this. + */ + + allowComments: false, // id of frame.. frameId: false, @@ -1027,7 +1032,7 @@ // clean up silly Windows -- stuff? return; } - if (node.nodeName == "#comment") { + if (node.nodeName == "#comment" && !this.allowComments) { node.parentNode.removeChild(node); // clean up silly Windows -- stuff? return; diff --git a/docs/src/Roo_form_HtmlEditor.js.html b/docs/src/Roo_form_HtmlEditor.js.html index c78be385ad..8d6ff55653 100644 --- a/docs/src/Roo_form_HtmlEditor.js.html +++ b/docs/src/Roo_form_HtmlEditor.js.html @@ -86,6 +86,10 @@ * */ white: false, + /** + * @cfg {boolean} allowComments - default false - allow comments in HTML source - by default they are stripped - if you are editing email you may need this. + */ + allowComments: false, // id of frame.. frameId: false, diff --git a/docs/symbols/Roo.HtmlEditorCore.json b/docs/symbols/Roo.HtmlEditorCore.json index 0823e827ea..d2d1d91549 100644 --- a/docs/symbols/Roo.HtmlEditorCore.json +++ b/docs/symbols/Roo.HtmlEditorCore.json @@ -23,6 +23,13 @@ "memberOf" : "Roo.util.Observable", "optvals" : [] }, + { + "name" : "allowComments", + "type" : "boolean", + "desc" : "- default false - allow comments in HTML source - by default they are stripped - if you are editing email you may need this.", + "memberOf" : "Roo.HtmlEditorCore", + "optvals" : [] + }, { "name" : "the", "type" : "Roo.form.HtmlEditor|Roo.bootstrap.HtmlEditor", diff --git a/docs/symbols/Roo.form.HtmlEditor.json b/docs/symbols/Roo.form.HtmlEditor.json index 869e2ca097..ce64d429aa 100644 --- a/docs/symbols/Roo.form.HtmlEditor.json +++ b/docs/symbols/Roo.form.HtmlEditor.json @@ -26,55 +26,55 @@ "optvals" : [] }, { - "name" : "listeners", - "type" : "Object", - "desc" : "list of events and functions to call for this object, \nFor example :\n
\n    listeners :  { \n       'click' : function(e) {\n           ..... \n        } ,\n        .... \n    } \n  
", - "memberOf" : "Roo.util.Observable", - "optvals" : [] + "name" : "hideMode", + "type" : "String", + "desc" : "y)\nHow this component should hidden. Supported values are\n\"visibility\" (css visibility), \"offsets\" (negative offset position) and\n\"display\" (css display) - defaults to \"display\".", + "memberOf" : "Roo.Component", + "optvals" : [ + "display", + "visibility" + ] }, { - "name" : "fieldLabel", - "type" : "String", - "desc" : "Label to use when rendering a form.", + "name" : "disabled", + "type" : "Boolean", + "desc" : "True to disable the field (defaults to false).", "memberOf" : "Roo.form.Field", "optvals" : [] }, { - "name" : "validationDelay", - "type" : "Number", - "desc" : "The length of time in milliseconds after user input begins until validation is initiated (defaults to 250)", + "name" : "name", + "type" : "String", + "desc" : "The field's HTML name attribute.", "memberOf" : "Roo.form.Field", "optvals" : [] }, { - "name" : "msgTarget", + "name" : "resizable", "type" : "String", - "desc" : "The location where error text should display. Should be one of the following values (defaults to 'qtip'):\n
\nValue         Description\n-----------   ----------------------------------------------------------------------\nqtip          Display a quick tip when the user hovers over the field\ntitle         Display a default browser title attribute popup\nunder         Add a block div beneath the field containing the error text\nside          Add an error icon to the right of the field with a popup on hover\n[element id]  Add the error text directly to the innerHTML of the specified element\n
", - "memberOf" : "Roo.form.Field", + "desc" : "'s' or 'se' or 'e' - wrapps the element in a\n Roo.resizable.", + "memberOf" : "Roo.form.HtmlEditor", "optvals" : [] }, { - "name" : "hideMode", - "type" : "String", - "desc" : "y)\nHow this component should hidden. Supported values are\n\"visibility\" (css visibility), \"offsets\" (negative offset position) and\n\"display\" (css display) - defaults to \"display\".", - "memberOf" : "Roo.Component", - "optvals" : [ - "display", - "visibility" - ] + "name" : "toolbars", + "type" : "Array", + "desc" : "Array of toolbars. - defaults to just the Standard one", + "memberOf" : "Roo.form.HtmlEditor", + "optvals" : [] }, { - "name" : "disabled", - "type" : "Boolean", - "desc" : "True to disable the field (defaults to false).", - "memberOf" : "Roo.form.Field", + "name" : "width", + "type" : "Number", + "desc" : "(in pixels)", + "memberOf" : "Roo.form.HtmlEditor", "optvals" : [] }, { - "name" : "value", - "type" : "Mixed", - "desc" : "A value to initialize this field with.", - "memberOf" : "Roo.form.Field", + "name" : "allowComments", + "type" : "boolean", + "desc" : "- default false - allow comments in HTML source - by default they are stripped - if you are editing email you may need this.", + "memberOf" : "Roo.form.HtmlEditor", "optvals" : [] }, { @@ -85,33 +85,26 @@ "optvals" : [] }, { - "name" : "tabIndex", + "name" : "height", "type" : "Number", - "desc" : "The tabIndex for this field. Note this only applies to fields that are rendered, not those which are built via applyTo (defaults to undefined).", - "memberOf" : "Roo.form.Field", + "desc" : "(in pixels)", + "memberOf" : "Roo.form.HtmlEditor", "optvals" : [] }, { - "name" : "readOnly", + "name" : "clearUp", "type" : "Boolean", - "desc" : "True to mark the field as readOnly in HTML (defaults to false) -- Note: this only sets the element's readOnly DOM attribute.", - "memberOf" : "Roo.form.Field", + "desc" : "", + "memberOf" : "Roo.form.HtmlEditor", "optvals" : [] }, { - "name" : "cls", - "type" : "String", - "desc" : "A CSS class to apply to the field's underlying element.", + "name" : "value", + "type" : "Mixed", + "desc" : "A value to initialize this field with.", "memberOf" : "Roo.form.Field", "optvals" : [] }, - { - "name" : "toolbars", - "type" : "Array", - "desc" : "Array of toolbars. - defaults to just the Standard one", - "memberOf" : "Roo.form.HtmlEditor", - "optvals" : [] - }, { "name" : "actionMode", "type" : "String", @@ -120,44 +113,44 @@ "optvals" : [] }, { - "name" : "width", - "type" : "Number", - "desc" : "(in pixels)", - "memberOf" : "Roo.form.HtmlEditor", + "name" : "msgTarget", + "type" : "String", + "desc" : "The location where error text should display. Should be one of the following values (defaults to 'qtip'):\n
\nValue         Description\n-----------   ----------------------------------------------------------------------\nqtip          Display a quick tip when the user hovers over the field\ntitle         Display a default browser title attribute popup\nunder         Add a block div beneath the field containing the error text\nside          Add an error icon to the right of the field with a popup on hover\n[element id]  Add the error text directly to the innerHTML of the specified element\n
", + "memberOf" : "Roo.form.Field", "optvals" : [] }, { - "name" : "resizable", - "type" : "String", - "desc" : "'s' or 'se' or 'e' - wrapps the element in a\n Roo.resizable.", - "memberOf" : "Roo.form.HtmlEditor", + "name" : "listeners", + "type" : "Object", + "desc" : "list of events and functions to call for this object, \nFor example :\n
\n    listeners :  { \n       'click' : function(e) {\n           ..... \n        } ,\n        .... \n    } \n  
", + "memberOf" : "Roo.util.Observable", "optvals" : [] }, { - "name" : "validationEvent", - "type" : "String/Boolean", - "desc" : "The event that should initiate field validation. Set to false to disable\n automatic validation (defaults to \"keyup\").", + "name" : "readOnly", + "type" : "Boolean", + "desc" : "True to mark the field as readOnly in HTML (defaults to false) -- Note: this only sets the element's readOnly DOM attribute.", "memberOf" : "Roo.form.Field", "optvals" : [] }, { - "name" : "height", - "type" : "Number", - "desc" : "(in pixels)", - "memberOf" : "Roo.form.HtmlEditor", + "name" : "cls", + "type" : "String", + "desc" : "A CSS class to apply to the field's underlying element.", + "memberOf" : "Roo.form.Field", "optvals" : [] }, { - "name" : "name", - "type" : "String", - "desc" : "The field's HTML name attribute.", + "name" : "validationEvent", + "type" : "String/Boolean", + "desc" : "The event that should initiate field validation. Set to false to disable\n automatic validation (defaults to \"keyup\").", "memberOf" : "Roo.form.Field", "optvals" : [] }, { - "name" : "qtip", + "name" : "fieldLabel", "type" : "String", - "desc" : "Mouse over tip", + "desc" : "Label to use when rendering a form.", "memberOf" : "Roo.form.Field", "optvals" : [] }, @@ -168,6 +161,13 @@ "memberOf" : "Roo.Component", "optvals" : [] }, + { + "name" : "validationDelay", + "type" : "Number", + "desc" : "The length of time in milliseconds after user input begins until validation is initiated (defaults to 250)", + "memberOf" : "Roo.form.Field", + "optvals" : [] + }, { "name" : "stylesheets", "type" : "Array", @@ -175,6 +175,13 @@ "memberOf" : "Roo.form.HtmlEditor", "optvals" : [] }, + { + "name" : "tabIndex", + "type" : "Number", + "desc" : "The tabIndex for this field. Note this only applies to fields that are rendered, not those which are built via applyTo (defaults to undefined).", + "memberOf" : "Roo.form.Field", + "optvals" : [] + }, { "name" : "blacklist", "type" : "Array", @@ -183,10 +190,10 @@ "optvals" : [] }, { - "name" : "clearUp", - "type" : "Boolean", - "desc" : "", - "memberOf" : "Roo.form.HtmlEditor", + "name" : "qtip", + "type" : "String", + "desc" : "Mouse over tip", + "memberOf" : "Roo.form.Field", "optvals" : [] } ], diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 053261ff9e..2a9d14f3c3 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -25609,6 +25609,11 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { */ stylesheets: false, + /** + * @cfg {boolean} allowComments - default false - allow comments in HTML source - by default they are stripped - if you are editing email you may need this. + */ + + allowComments: false, // id of frame.. frameId: false, @@ -26522,7 +26527,7 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { // clean up silly Windows -- stuff? return; } - if (node.nodeName == "#comment") { + if (node.nodeName == "#comment" && !this.allowComments) { node.parentNode.removeChild(node); // clean up silly Windows -- stuff? return; diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 22247fb0ad..bcdd93760a 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -1076,7 +1076,7 @@ this.errorMsg='';return true;},CharacterSetChecks:function(A){this.type=A;this.f break;}}}var E=0;for(var D=0;D';}else{for(var i in this.stylesheets){st+='';} }st+='';var A='roo-htmleditor-body';if(this.bodyCls.length){A+=' '+this.bodyCls;}return ''+st+' '; @@ -1114,7 +1114,7 @@ try{C.selectNode(B);}catch(e){C.selectNodeContents(B);}var D=A.cloneRange();D.co },rangeCompareNode:function(A,B){var C=B.ownerDocument.createRange();try{C.selectNode(B);}catch(e){C.selectNodeContents(B);}A.collapse(true);C.collapse(true);var ss=A.compareBoundaryPoints(Range.START_TO_START,C);var ee=A.compareBoundaryPoints(Range.END_TO_END,C); var D=ss==1;var E=ee==-1;if(D&&E){return 0;}if(!D&&E){return 1;}if(D&&!E){return 2;}return 3;},cleanUpPaste:function(){Roo.log('cleanuppaste');this.cleanUpChildren(this.doc.body);var A=this.cleanWordChars(this.doc.body.innerHTML);if(A!=this.doc.body.innerHTML){this.doc.body.innerHTML=A; }},cleanWordChars:function(A){var he=Roo.HtmlEditorCore;var B=A;Roo.each(he.swapCodes,function(sw){var C=new RegExp("\\u"+sw[0].toString(16),"g");B=B.replace(C,sw[1]);});return B;},cleanUpChildren:function(n){if(!n.childNodes.length){return;}for(var i=n.childNodes.length-1; -i>-1;i--){this.cleanUpChild(n.childNodes[i]);}},cleanUpChild:function(A){var ed=this;if(A.nodeName=="#text"){return;}if(A.nodeName=="#comment"){A.parentNode.removeChild(A);return;}var B=A.tagName.toLowerCase();if(this.black.indexOf(B)>-1&&this.clearUp){A.parentNode.removeChild(A); +i>-1;i--){this.cleanUpChild(n.childNodes[i]);}},cleanUpChild:function(A){var ed=this;if(A.nodeName=="#text"){return;}if(A.nodeName=="#comment"&&!this.allowComments){A.parentNode.removeChild(A);return;}var B=A.tagName.toLowerCase();if(this.black.indexOf(B)>-1&&this.clearUp){A.parentNode.removeChild(A); return;}var C=Roo.HtmlEditorCore.remove.indexOf(A.tagName.toLowerCase())>-1;if((!A.attributes||!A.attributes.length)&&B=='span'){C=true;}if(C){this.cleanUpChildren(A);while(A.childNodes.length){var cn=A.childNodes[0];A.removeChild(cn);A.parentNode.insertBefore(cn,A); }A.parentNode.removeChild(A);return;}if(!A.attributes||!A.attributes.length){this.cleanUpChildren(A);return;}function cleanAttr(n,v){if(v.match(/^\./)||v.match(/^\//)){return;}if(v.match(/^(http|https):\/\//)||v.match(/^mailto:/)||v.match(/^ftp:/)){return; }if(v.match(/^#/)){return;}if(v.match(/^\{/)){return;}A.removeAttribute(n);}var D=this.cwhite;var E=this.cblack;function cleanStyle(n,v){if(v.match(/expression/)){A.removeAttribute(n);return;}var F=v.split(/;/);var G=[];Roo.each(F,function(p){p=p.replace(/^\s+/g,'').replace(/\s+$/g,''); -- 2.39.2