diff --git a/editor/ui/dialogs/content/EdAEAttributes.js b/editor/ui/dialogs/content/EdAEAttributes.js index 075a3ca1a28f..3f351e610035 100644 --- a/editor/ui/dialogs/content/EdAEAttributes.js +++ b/editor/ui/dialogs/content/EdAEAttributes.js @@ -123,6 +123,7 @@ var gVAlignTable = are signal to do input filtering: "#" Allow only integer values "%" Allow integer values or a number ending in "%" + "+" Allow integer values and allow "+" or "-" as first character "!" Allow only one character "^" The first character can be only be A-Z, a-z, hyphen, underscore, colon or period "$" is an attribute required by HTML DTD @@ -616,7 +617,7 @@ gHTMLAttr.fieldset = // this is deprecated // gHTMLAttr.font = [ - "#size", + "+size", "color", "face", "-", diff --git a/editor/ui/dialogs/content/EdAEHTMLAttributes.js b/editor/ui/dialogs/content/EdAEHTMLAttributes.js index 72c5cc3feaed..58969e080b00 100644 --- a/editor/ui/dialogs/content/EdAEHTMLAttributes.js +++ b/editor/ui/dialogs/content/EdAEHTMLAttributes.js @@ -72,12 +72,13 @@ function BuildHTMLAttributeNameList() // Get information about value filtering var forceOneChar = name.indexOf("!") >= 0; var forceInteger = name.indexOf("#") >= 0; + var forceSignedInteger = name.indexOf("+") >= 0; var forceIntOrPercent = name.indexOf("%") >= 0; limitFirstChar = name.indexOf("\^") >= 0; //var required = name.indexOf("$") >= 0; // Strip flag characters ("_" is used when attribute name is reserved JS word) - name = name.replace(/[!^#%$_]/g, ""); + name = name.replace(/[!^#%$_+]/g, ""); menuitem = AppendStringToMenulist(dialog.AddHTMLAttributeNameInput, name); if (menuitem) @@ -92,6 +93,7 @@ function BuildHTMLAttributeNameList() menuitem.setAttribute("forceOneChar", forceOneChar ? "true" : ""); menuitem.setAttribute("limitFirstChar", limitFirstChar ? "true" : ""); menuitem.setAttribute("forceInteger", forceInteger ? "true" : ""); + menuitem.setAttribute("forceSignedInteger", forceSignedInteger ? "true" : ""); menuitem.setAttribute("forceIntOrPercent", forceIntOrPercent ? "true" : ""); } } @@ -300,6 +302,14 @@ function onInputHTMLAttributeValue() { value = value.replace(/\D+/g,""); } + else if ( selectedItem.getAttribute("forceSignedInteger") == "true" ) + { + // Allow integer with optional "+" or "-" as first character + var sign = value[0]; + value = value.replace(/\D+/g,""); + if (sign == "+" || sign == "-") + value = sign + value; + } // Special case attributes if (selectedItem.getAttribute("limitFirstChar") == "true")