From e47926563562a0f6c56b89db30df0ccf595b1f02 Mon Sep 17 00:00:00 2001 From: "cmanske%netscape.com" Date: Thu, 24 Jan 2002 22:01:10 +0000 Subject: [PATCH] Update on insert Form widgets dialogs, b=45495, fixes by neil/cmanske, r=neil/cmanske, sr=hewitt --- .../ui/dialogs/content/EdAEHTMLAttributes.js | 5 +- editor/ui/dialogs/content/EdColorPicker.js | 2 + editor/ui/dialogs/content/EdDialogCommon.js | 1 - editor/ui/dialogs/content/EdFieldSetProps.js | 23 +++-- editor/ui/dialogs/content/EdHLineProps.js | 9 +- editor/ui/dialogs/content/EdImageProps.xul | 4 +- editor/ui/dialogs/content/EdInputImage.xul | 4 +- editor/ui/dialogs/content/EdInputProps.js | 27 +----- editor/ui/dialogs/content/EdInputProps.xul | 77 +++++++-------- editor/ui/dialogs/content/EdLabelProps.js | 7 +- editor/ui/dialogs/content/EdTextAreaProps.js | 55 +++++------ editor/ui/dialogs/content/EdTextAreaProps.xul | 94 ++++++++++--------- editor/ui/dialogs/content/EditorPublish.js | 4 + 13 files changed, 149 insertions(+), 163 deletions(-) diff --git a/editor/ui/dialogs/content/EdAEHTMLAttributes.js b/editor/ui/dialogs/content/EdAEHTMLAttributes.js index 24b39727c20b..5ebf457e8248 100644 --- a/editor/ui/dialogs/content/EdAEHTMLAttributes.js +++ b/editor/ui/dialogs/content/EdAEHTMLAttributes.js @@ -358,10 +358,7 @@ function UpdateHTMLAttributes() { var name = HTMLRAttrs[i]; - // We can't use getAttribute to figure out if attribute already - // exists for attributes that don't require a value - // This gets the attribute NODE from the attributes NamedNodeMap - if (gElement.attributes.getNamedItem(name)) + if (gElement.hasAttribute(name)) doRemoveAttribute(name); } diff --git a/editor/ui/dialogs/content/EdColorPicker.js b/editor/ui/dialogs/content/EdColorPicker.js index ac1bd85fcae0..0eb9bdeca7ea 100644 --- a/editor/ui/dialogs/content/EdColorPicker.js +++ b/editor/ui/dialogs/content/EdColorPicker.js @@ -217,6 +217,8 @@ function SelectLastPickedColor() if ( onAccept() ) //window.close(); return true; + + return false; } function SetCurrentColor(color) diff --git a/editor/ui/dialogs/content/EdDialogCommon.js b/editor/ui/dialogs/content/EdDialogCommon.js index 60fdaf9a1bba..cea3f2dea208 100644 --- a/editor/ui/dialogs/content/EdDialogCommon.js +++ b/editor/ui/dialogs/content/EdDialogCommon.js @@ -659,7 +659,6 @@ function onMoreFewer() gDialog.MoreFewerButton.setAttribute("more","0"); gDialog.MoreFewerButton.setAttribute("label",GetString("MoreProperties")); SeeMore = false; -// window.sizeToContent(); } else { diff --git a/editor/ui/dialogs/content/EdFieldSetProps.js b/editor/ui/dialogs/content/EdFieldSetProps.js index 2ee8774f85f6..c7557d33e426 100644 --- a/editor/ui/dialogs/content/EdFieldSetProps.js +++ b/editor/ui/dialogs/content/EdFieldSetProps.js @@ -86,7 +86,7 @@ function Startup() newLegend = false; editorShell.SelectElement(legendElement); gDialog.legendText.value = GetSelectionAsText(); - if (legendElement.innerHTML.match(/s needed RemoveElementKeepingChildren(fieldsetElement); } finally { editorShell.EndBatchChanges(); @@ -160,16 +161,11 @@ function ValidateData() function onAccept() { // All values are valid - copy to actual element in doc - // ValidateData(); + ValidateData(); editorShell.BeginBatchChanges(); try { - editorShell.CloneAttributes(legendElement, globalElement); - - if (insertNew) - InsertElementAroundSelection(fieldsetElement); - if (gDialog.editText.checked) { if (gDialog.legendText.value) @@ -179,11 +175,18 @@ function onAccept() editorShell.InsertElement(legendElement, fieldsetElement, 0, true); else while (legendElement.firstChild) editor.DeleteNode(legendElement.firstChild); - editor.InsertNode(document.createTextNode(gDialog.legendText.value), legendElement, 0); + editor.InsertNode(editorShell.editorDocument.createTextNode(gDialog.legendText.value), legendElement, 0); } else if (!newLegend) editorShell.DeleteElement(legendElement); } + + if (insertNew) + InsertElementAroundSelection(fieldsetElement); + else + editorShell.SelectElement(fieldsetElement); + + editorShell.CloneAttributes(legendElement, globalElement); } finally { editorShell.EndBatchChanges(); diff --git a/editor/ui/dialogs/content/EdHLineProps.js b/editor/ui/dialogs/content/EdHLineProps.js index 66a4f10b5c08..e58a4e5a3625 100644 --- a/editor/ui/dialogs/content/EdHLineProps.js +++ b/editor/ui/dialogs/content/EdHLineProps.js @@ -103,14 +103,7 @@ function InitDialog() gDialog.alignGroup.selectedItem = gDialog.leftAlign; } - // This is tricky! Since the "noshade" attribute doesn't always have a value, - // we can't use getAttribute to figure out if it's set! - // This gets the attribute NODE from the attributes NamedNodeMap - if (globalElement.attributes.getNamedItem("noshade")) - gDialog.shading.checked = false; - else - gDialog.shading.checked = true; - + gDialog.shading.checked = globalElement.hasAttribute("noshade"); } function onSaveDefault() diff --git a/editor/ui/dialogs/content/EdImageProps.xul b/editor/ui/dialogs/content/EdImageProps.xul index 21e7323b323f..2ecd84dcdd04 100644 --- a/editor/ui/dialogs/content/EdImageProps.xul +++ b/editor/ui/dialogs/content/EdImageProps.xul @@ -61,8 +61,8 @@ - - + + diff --git a/editor/ui/dialogs/content/EdInputImage.xul b/editor/ui/dialogs/content/EdInputImage.xul index f117a9cddc8e..8918d0b6cb70 100644 --- a/editor/ui/dialogs/content/EdInputImage.xul +++ b/editor/ui/dialogs/content/EdInputImage.xul @@ -88,8 +88,8 @@ - - + + diff --git a/editor/ui/dialogs/content/EdInputProps.js b/editor/ui/dialogs/content/EdInputProps.js index b87d509e96e1..c0317b4ab5a1 100644 --- a/editor/ui/dialogs/content/EdInputProps.js +++ b/editor/ui/dialogs/content/EdInputProps.js @@ -243,32 +243,6 @@ function doImageProperties() function ValidateData() { - var index = gDialog.inputType.selectedIndex; - switch (index) - { - case 4: - case 5: - break; - case 8: - if (!globalElement.hasAttribute("src")) - { - doImageProperties(); - if (!globalElement.hasAttribute("src")) - return false; - } - break; - case 3: - default: - if (!gDialog.inputName.value || !gDialog.inputValue.value) - { - AlertWithTitle(GetString("Alert"), GetString("FormInputError")); - if (!gDialog.inputName.value) - gDialog.inputName.focus(); - else - gDialog.inputValue.focus(); - return false; - } - } var attributes = { type: "", name: gDialog.inputName.value, @@ -279,6 +253,7 @@ function ValidateData() maxlength: "", accept: "" }; + var index = gDialog.inputType.selectedIndex; var flags = { checked: false, readonly: false, diff --git a/editor/ui/dialogs/content/EdInputProps.xul b/editor/ui/dialogs/content/EdInputProps.xul index d697bbb09be6..c263ae5b65e2 100644 --- a/editor/ui/dialogs/content/EdInputProps.xul +++ b/editor/ui/dialogs/content/EdInputProps.xul @@ -99,43 +99,46 @@ - -