From 662edc25547160b8626b21eb899eccaab8e4d763 Mon Sep 17 00:00:00 2001 From: "cmanske%netscape.com" Date: Thu, 2 Sep 1999 01:47:18 +0000 Subject: [PATCH] Added CloneAttributes to IDL and nsIHTMLEditor. Reworked property dialogs to accomodate AdvancedEdit dialog. Preliminary version of AdvancedEdit dialog done --- editor/base/nsEditor.cpp | 4 +- editor/base/nsEditor.h | 2 +- editor/base/nsEditorShell.cpp | 24 +++++ editor/composer/src/nsEditorShell.cpp | 24 +++++ editor/idl/nsIEditorShell.idl | 12 +++ editor/libeditor/base/nsEditor.cpp | 4 +- editor/libeditor/base/nsEditor.h | 2 +- editor/public/nsIEditor.h | 12 +++ editor/ui/composer/content/editor.properties | 5 +- editor/ui/dialogs/content/EdAdvancedEdit.js | 65 +++++++++++-- editor/ui/dialogs/content/EdAdvancedEdit.xul | 20 +++- editor/ui/dialogs/content/EdDialogCommon.js | 16 +--- editor/ui/dialogs/content/EdDialogTemplate.js | 2 +- editor/ui/dialogs/content/EdHLineProps.js | 93 +++++++++---------- editor/ui/dialogs/content/EdImageProps.js | 22 +++-- editor/ui/dialogs/content/EdInsertTable.js | 5 + editor/ui/dialogs/content/EdLinkProps.js | 62 +++++++------ .../ui/dialogs/content/EdNamedAnchorProps.js | 21 ++++- editor/ui/dialogs/content/EdTableProps.js | 26 ++++-- .../dialogs/locale/en-US/EdAdvancedEdit.dtd | 4 +- 20 files changed, 297 insertions(+), 128 deletions(-) diff --git a/editor/base/nsEditor.cpp b/editor/base/nsEditor.cpp index e1c0306175eb..42c8bd4bb7bb 100644 --- a/editor/base/nsEditor.cpp +++ b/editor/base/nsEditor.cpp @@ -1275,7 +1275,7 @@ nsEditor::GetBodyElement(nsIDOMElement **aBodyElement) // Objects must be DOM elements NS_IMETHODIMP -nsEditor::CopyAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode) +nsEditor::CloneAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode) { nsresult result=NS_OK; @@ -1336,7 +1336,7 @@ nsEditor::CopyAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode) // Do we ever get here? destElement->RemoveAttribute(sourceAttrName); #if DEBUG_cmanske - printf("Attribute in NamedNodeMap has empty value in nsEditor::CopyAttributes()\n"); + printf("Attribute in NamedNodeMap has empty value in nsEditor::CloneAttributes()\n"); #endif } } diff --git a/editor/base/nsEditor.h b/editor/base/nsEditor.h index 2938eca723db..13015f2ff88c 100644 --- a/editor/base/nsEditor.h +++ b/editor/base/nsEditor.h @@ -213,7 +213,7 @@ protected: //NOTE: Most callers are dealing with Nodes, // but these objects must supports nsIDOMElement - NS_IMETHOD CopyAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode); + NS_IMETHOD CloneAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode); /* NS_IMETHOD SetProperties(nsVoidArray *aPropList); NS_IMETHOD GetProperties(nsVoidArray *aPropList); diff --git a/editor/base/nsEditorShell.cpp b/editor/base/nsEditorShell.cpp index 391d2b6efbfb..9f7d3d9c6aaa 100644 --- a/editor/base/nsEditorShell.cpp +++ b/editor/base/nsEditorShell.cpp @@ -1304,6 +1304,30 @@ nsEditorShell::GetLocalFileURL(nsIDOMWindow *parent, const PRUnichar *filterType return res; } +NS_IMETHODIMP +nsEditorShell::CloneAttributes(nsIDOMNode *destNode, nsIDOMNode *sourceNode) +{ + if (!destNode || !sourceNode) { return NS_ERROR_NULL_POINTER; } + nsresult rv = NS_NOINTERFACE; + + switch (mEditorType) + { + case ePlainTextEditorType: + case eHTMLTextEditorType: + { + nsCOMPtr editor = do_QueryInterface(mEditor); + if (editor) + rv = editor->CloneAttributes(destNode, sourceNode); + } + break; + + default: + rv = NS_ERROR_NOT_IMPLEMENTED; + } + + return rv; +} + NS_IMETHODIMP nsEditorShell::NodeIsBlock(nsIDOMNode *node, PRBool *_retval) { diff --git a/editor/composer/src/nsEditorShell.cpp b/editor/composer/src/nsEditorShell.cpp index 391d2b6efbfb..9f7d3d9c6aaa 100644 --- a/editor/composer/src/nsEditorShell.cpp +++ b/editor/composer/src/nsEditorShell.cpp @@ -1304,6 +1304,30 @@ nsEditorShell::GetLocalFileURL(nsIDOMWindow *parent, const PRUnichar *filterType return res; } +NS_IMETHODIMP +nsEditorShell::CloneAttributes(nsIDOMNode *destNode, nsIDOMNode *sourceNode) +{ + if (!destNode || !sourceNode) { return NS_ERROR_NULL_POINTER; } + nsresult rv = NS_NOINTERFACE; + + switch (mEditorType) + { + case ePlainTextEditorType: + case eHTMLTextEditorType: + { + nsCOMPtr editor = do_QueryInterface(mEditor); + if (editor) + rv = editor->CloneAttributes(destNode, sourceNode); + } + break; + + default: + rv = NS_ERROR_NOT_IMPLEMENTED; + } + + return rv; +} + NS_IMETHODIMP nsEditorShell::NodeIsBlock(nsIDOMNode *node, PRBool *_retval) { diff --git a/editor/idl/nsIEditorShell.idl b/editor/idl/nsIEditorShell.idl index d9d1daffb5d6..670ffcb08df1 100644 --- a/editor/idl/nsIEditorShell.idl +++ b/editor/idl/nsIEditorShell.idl @@ -297,6 +297,18 @@ interface nsIEditorShell : nsISupports */ boolean NodeIsBlock(in nsIDOMNode node); + /** + * This is similar to nsIDOMNode::cloneNode(), + * it assures the attribute nodes of the destination are identical with the source node + * by copying all existing attributes from the source and deleting those not in the source. + * This is used when the destination node (element) already exists + * + * The supplied nodes MUST BE ELEMENTS (most callers are working with nodes) + * destNode the destination element to operate on + * sourceNode the source element to copy attributes from + */ + void CloneAttributes(in nsIDOMNode destNode, in nsIDOMNode sourceNode); + void BeginBatchChanges(); void EndBatchChanges(); void RunUnitTests(); diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp index e1c0306175eb..42c8bd4bb7bb 100644 --- a/editor/libeditor/base/nsEditor.cpp +++ b/editor/libeditor/base/nsEditor.cpp @@ -1275,7 +1275,7 @@ nsEditor::GetBodyElement(nsIDOMElement **aBodyElement) // Objects must be DOM elements NS_IMETHODIMP -nsEditor::CopyAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode) +nsEditor::CloneAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode) { nsresult result=NS_OK; @@ -1336,7 +1336,7 @@ nsEditor::CopyAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode) // Do we ever get here? destElement->RemoveAttribute(sourceAttrName); #if DEBUG_cmanske - printf("Attribute in NamedNodeMap has empty value in nsEditor::CopyAttributes()\n"); + printf("Attribute in NamedNodeMap has empty value in nsEditor::CloneAttributes()\n"); #endif } } diff --git a/editor/libeditor/base/nsEditor.h b/editor/libeditor/base/nsEditor.h index 2938eca723db..13015f2ff88c 100644 --- a/editor/libeditor/base/nsEditor.h +++ b/editor/libeditor/base/nsEditor.h @@ -213,7 +213,7 @@ protected: //NOTE: Most callers are dealing with Nodes, // but these objects must supports nsIDOMElement - NS_IMETHOD CopyAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode); + NS_IMETHOD CloneAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode); /* NS_IMETHOD SetProperties(nsVoidArray *aPropList); NS_IMETHOD GetProperties(nsVoidArray *aPropList); diff --git a/editor/public/nsIEditor.h b/editor/public/nsIEditor.h index 344b04c78ad1..4ba0a8eefe3b 100644 --- a/editor/public/nsIEditor.h +++ b/editor/public/nsIEditor.h @@ -279,6 +279,18 @@ public: NS_IMETHOD RemoveAttribute(nsIDOMElement * aElement, const nsString& aAttribute)=0; + /** + * CloneAttributes() is similar to nsIDOMNode::cloneNode(), + * it assures the attribute nodes of the destination are identical with the source node + * by copying all existing attributes from the source and deleting those not in the source. + * This is used when the destination node (element) already exists + * + * The supplied nodes MUST BE ELEMENTS (most callers are working with nodes) + * @param aDestNode the destination element to operate on + * @param aSourceNode the source element to copy attributes from + */ + NS_IMETHOD CloneAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode)=0; + /** * CreateNode instantiates a new element of type aTag and inserts it into aParent at aPosition. * @param aTag The type of object to create diff --git a/editor/ui/composer/content/editor.properties b/editor/ui/composer/content/editor.properties index 43bf53c04bbb..253b30aaaca9 100644 --- a/editor/ui/composer/content/editor.properties +++ b/editor/ui/composer/content/editor.properties @@ -2,6 +2,7 @@ More=More Fewer=Fewer OpenHTMLFile=Open HTML File SelectImageFile=Select Image File +SaveDocument=Save Document SaveDocumentAs=Save Document As LinkImage=Link Image: EditMode=Edit Mode @@ -16,4 +17,6 @@ SaveFilePrompt=Save changes to current file? SaveFileFailed=Saving file failed! DocumentTitle=Document Title NeedDocTitle=Document does not have a title. -SaveDocument=Save Document +AttributesFor=Current attributes for: +foo=bar + diff --git a/editor/ui/dialogs/content/EdAdvancedEdit.js b/editor/ui/dialogs/content/EdAdvancedEdit.js index 8e412ce65689..ac32c6ed61e7 100644 --- a/editor/ui/dialogs/content/EdAdvancedEdit.js +++ b/editor/ui/dialogs/content/EdAdvancedEdit.js @@ -22,32 +22,77 @@ //Cancel() is in EdDialogCommon.js +// Note: This dialog var tagname; var element; // dialog initialization code function Startup() { + // This is the return value for the parent, + // who only needs to know if OK was clicked + window.opener.AdvancedEditOK = false; + if (!InitEditorShell()) return; doSetOKCancel(onOK, null); - // Create dialog object to store controls for easy access - dialog = new Object; - // GET EACH CONTROL -- E.G.: - dialog.editBox = document.getElementById("editBox"); - element = window.arguments[1]); - + // Element to edit is passed in + element = window.arguments[1]; + if (!element || element == "undefined") { + dump("Advanced Edit: Element to edit not supplied\n"); + window.close(); + } dump("*** Element passed into Advanced Edit: "+element+" ***\n"); + // Append tagname of element we are editing after the message text + // above the attribute editing treewidget + var msgParent = document.getElementById("AttributeMsgParent"); + + // Remove temporary place holder text: + // TODO: REMOVE THIS WHEN WE CAN RESIZE DIALOG AFTER CREATION + msgParent.removeChild(msgParent.firstChild); + + var msg = editorShell.GetString("AttributesFor"); + dump("Tagname Msg = "+msg+"\n"); + msg +=(" "+element.nodeName); + dump("Tagname Msg = "+msg+"\n"); + + textNode = editorShell.editorDocument.createTextNode(msg); + if (textNode) { + msgParent.appendChild(textNode); + } + + + // Create dialog object to store controls for easy access + dialog = new Object; + dialog.AddAttributeNameInput = document.getElementById("AddAttributeNameInput"); + //TODO: We should disable this button if the AddAttributeNameInput editbox is empty + dialog.AddAttribute = document.getElementById("AddAttribute"); + + //TODO: Get the list of attribute nodes, + // read each one, and use to build a text + editbox + // in a treewidget row for each attribute + var nodeMap = element.attributes; + var nodeMapCount = nodeMap.length; + // SET FOCUS TO FIRST CONTROL - //dialog.editBox.focus(); } +function onAddAttribute() +{ + var name = dialog.AddAttributeNameInput.value; + // TODO: Add a new text + editbox to the treewidget editing list +} + + function onOK() { -// Set attribute example: -// imageElement.setAttribute("src",dialog.srcInput.value); - return true; // do close the window + //TODO: Get all children of the treewidget to get all + // name, value strings for all attributes. + // Set those attributes on "element" we are editing. + + window.opener.AdvancedEditOK = true; + return true; // do close the window } diff --git a/editor/ui/dialogs/content/EdAdvancedEdit.xul b/editor/ui/dialogs/content/EdAdvancedEdit.xul index 72353cc3bc22..ebf26c7a3c22 100644 --- a/editor/ui/dialogs/content/EdAdvancedEdit.xul +++ b/editor/ui/dialogs/content/EdAdvancedEdit.xul @@ -30,7 +30,7 @@ - + + + + +
"REMOVE ME"
+ +
+ +
+ + + + + +
+
+ + diff --git a/editor/ui/dialogs/content/EdDialogCommon.js b/editor/ui/dialogs/content/EdDialogCommon.js index d708cc271735..37a899fb5fd2 100644 --- a/editor/ui/dialogs/content/EdDialogCommon.js +++ b/editor/ui/dialogs/content/EdDialogCommon.js @@ -29,6 +29,8 @@ var SelectionOnly = 1; var FormatedWithDoctype = 2; var FormatedWithoutDoctype = 6; var maxPixels = 10000; +// The element being edited - so AdvancedEdit can have access to it +var globalElement; function InitEditorShell() { @@ -408,20 +410,6 @@ function GetSelectionAsText() } -// This is here so to stop the annoying JS error that keeps poping up -// from the advanced edit button which points to a non existant onAdvanced() function -// Well now it exists -pete - -function onAdvancedEdit(){ - - -dump("\n\ncomming soon . . .\nthe \"onAdvancedEdit\" function\n\n"); - - - -} - - // ** getSelection () // ** This function checks for existence of table around the focus node // ** Brian King - XML Workshop diff --git a/editor/ui/dialogs/content/EdDialogTemplate.js b/editor/ui/dialogs/content/EdDialogTemplate.js index 70c454029843..30b516e54c7b 100644 --- a/editor/ui/dialogs/content/EdDialogTemplate.js +++ b/editor/ui/dialogs/content/EdDialogTemplate.js @@ -44,7 +44,7 @@ function Startup() //dialog.editBox.focus(); } -function initDialog() { +function InitDialog() { // Get a single selected element of the desired type element = editorShell.GetSelectedElement(tagName); diff --git a/editor/ui/dialogs/content/EdHLineProps.js b/editor/ui/dialogs/content/EdHLineProps.js index 5d89d4fb3f2a..27eab33a1d96 100644 --- a/editor/ui/dialogs/content/EdHLineProps.js +++ b/editor/ui/dialogs/content/EdHLineProps.js @@ -23,7 +23,6 @@ var toolkitCore; var tagName = "hr"; var hLineElement; -var tempLineElement; var percentChar = ""; var width; var height; @@ -47,13 +46,6 @@ function Startup() window.close(); return; } - // Create a temporary element to use with Save Settings as default - tempLineElement = editorShell.editorDocument.createElement("HR"); - if (!hLineElement) { - dump("Temporary HLine element was not created!\n"); - window.close(); - return; - } // Create dialog object to store controls for easy access dialog = new Object; @@ -64,18 +56,27 @@ function Startup() dialog.rightAlign = document.getElementById("rightAlign"); dialog.shading = document.getElementById("3dShading"); - - // Initialize control values based on existing attributes + // Make a copy to use for AdvancedEdit and onSaveDefault + globalElement = hLineElement.cloneNode(false); - // Just to be confusing, "size" is used instead of height - // We will use "height" here and in UI - dialog.heightInput.value = hLineElement.getAttribute("size"); + // Initialize control values based on existing attributes + InitDialog() + + // SET FOCUS TO FIRST CONTROL + dialog.heightInput.focus(); +} + +function InitDialog() +{ + // Just to be confusing, "size" is used instead of height + // We will use "height" here and in UI + dialog.heightInput.value = globalElement.getAttribute("size"); // Get the width attribute of the element, stripping out "%" // This sets contents of button text and "percentChar" variable - dialog.widthInput.value = InitPixelOrPercentPopupButton(hLineElement, "width", "pixelOrPercentButton"); + dialog.widthInput.value = InitPixelOrPercentPopupButton(globalElement, "width", "pixelOrPercentButton"); - align = hLineElement.getAttribute("align"); + align = globalElement.getAttribute("align"); if (align == "center") { dialog.centerAlign.checked = true; } else if (align == "right") { @@ -83,18 +84,15 @@ function Startup() } else { dialog.leftAlign.checked = true; } - noshade = hLineElement.getAttribute("noshade"); + noshade = globalElement.getAttribute("noshade"); dialog.shading.checked = (noshade == ""); - - // SET FOCUS TO FIRST CONTROL - dialog.heightInput.focus(); } function onSaveDefault() { - // "false" means set attributes on the tempLineElement, + // "false" means set attributes on the globalElement, // not the real element being edited - if (ValidateData(false)) { + if (ValidateData()) { var prefs = Components.classes['component://netscape/preferences']; if (prefs) { prefs = prefs.getService(); @@ -139,7 +137,24 @@ function onSaveDefault() } } -function ValidateData(setAttributes) +function onAdvancedEdit() +{ + if (ValidateData()) { + // Set true if OK is clicked in the Advanced Edit dialog + window.AdvancedEditOK = false; + window.openDialog("chrome://editor/content/EdAdvancedEdit.xul", "AdvancedEdit", "chrome,close,titlebar,modal", "", globalElement); + if (window.AdvancedEditOK) { + dump("OK was pressed in AdvancedEdit Dialog\n"); + // Copy edited attributes to the dialog widgets: + // Note that we still don't want + InitDialog(); + } else { + dump("OK was NOT pressed in AdvancedEdit Dialog\n"); + } + } +} + +function ValidateData() { // Height is always pixels height = ValidateNumberString(dialog.heightInput.value, 1, maxPixels); @@ -150,11 +165,7 @@ function ValidateData(setAttributes) return false; } dump("Setting height="+height+"\n"); - if (setAttributes) { - hLineElement.setAttribute("size", height); - } else { - tempLineElement.setAttribute("size", height); - } + globalElement.setAttribute("size", height); var maxLimit; dump("Validate width. PercentChar="+percentChar+"\n"); @@ -173,11 +184,7 @@ function ValidateData(setAttributes) } width = width + percentChar; dump("Height="+height+" Width="+width+"\n"); - if (setAttributes) { - hLineElement.setAttribute("width", width); - } else { - tempLineElement.setAttribute("width", width); - } + globalElement.setAttribute("width", width); align = "left"; if (dialog.centerAlign.checked) { @@ -185,26 +192,14 @@ function ValidateData(setAttributes) } else if (dialog.rightAlign.checked) { align = "right"; } - if (setAttributes) { - hLineElement.setAttribute("align", align); - } else { - tempLineElement.setAttribute("align", align); - } + globalElement.setAttribute("align", align); if (dialog.shading.checked) { shading = true; - if (setAttributes) { - hLineElement.removeAttribute("noshade"); - } else { - tempLineElement.removeAttribute("noshade"); - } + globalElement.removeAttribute("noshade"); } else { shading = false; - if (setAttributes) { - hLineElement.setAttribute("noshade", ""); - } else { - tempLineElement.setAttribute("noshade", ""); - } + globalElement.setAttribute("noshade", ""); } return true; } @@ -214,5 +209,9 @@ function onOK() // Since we only edit existing HLines, // ValidateData will set the new attributes // so there's nothing else to do + var res = ValidateData(); + // Copy attributes from the globalElement to the document element + if (res) + editorShell.CloneAttributes(hLineElement, globalElement); return (ValidateData(true)); } diff --git a/editor/ui/dialogs/content/EdImageProps.js b/editor/ui/dialogs/content/EdImageProps.js index 65f6a673fbd4..086452084af4 100644 --- a/editor/ui/dialogs/content/EdImageProps.js +++ b/editor/ui/dialogs/content/EdImageProps.js @@ -75,14 +75,7 @@ function Startup() dump("Not all dialog controls were found!!!\n"); } - initDialog(); - - dialog.srcInput.focus(); -} - -function initDialog() { - - // Get a single selected anchor element + // Get a single selected image element imageElement = editorShell.GetSelectedElement(tagName); @@ -107,6 +100,14 @@ function initDialog() { window.close(); } } + + // Initialize all widgets with image attributes + InitDialog(); + + dialog.srcInput.focus(); +} + +function InitDialog() { // Set the controls to the image's attributes @@ -492,6 +493,11 @@ function constrainProportions( srcID, destID ) oldSourceInt = srcElement.value; } +function onAdvancedEdit() +{ + dump("\n\n Need to write onAdvancedEdit for Image dialog\n\n"); +} + function onOK() { if ( !imageType ) { diff --git a/editor/ui/dialogs/content/EdInsertTable.js b/editor/ui/dialogs/content/EdInsertTable.js index cf2e817093c1..c63b7539b7d8 100644 --- a/editor/ui/dialogs/content/EdInsertTable.js +++ b/editor/ui/dialogs/content/EdInsertTable.js @@ -66,6 +66,11 @@ function Startup() dialog.rowsInput.focus(); } +function onAdvancedEdit() +{ + dump("\n\n Need to write onAdvancedEdit for Insert Table dialog\n\n"); +} + function onOK() { rows = ValidateNumberString(dialog.rowsInput.value, 1, maxRows); diff --git a/editor/ui/dialogs/content/EdLinkProps.js b/editor/ui/dialogs/content/EdLinkProps.js index 2f3bbf2b0081..8b42a01e6a56 100644 --- a/editor/ui/dialogs/content/EdLinkProps.js +++ b/editor/ui/dialogs/content/EdLinkProps.js @@ -55,31 +55,6 @@ function Startup() dump("Not all dialog controls were found!!!\n"); } - // Set data for the dialog controls - initDialog(); - - // Set initial focus - - if (insertNew) { - dump("Setting focus to linkTextInput\n"); - // We will be using the HREF inputbox, so text message - linkTextInput.focus(); - } else { - dump("Setting focus to linkTextInput\n"); - hrefInput.focus(); - - // We will not insert a new link at caret, so remove link text input field - parentNode = linkTextInput.parentNode; - if (parentNode) { - dump("Removing link text input field.\n"); - parentNode.removeChild(linkTextInput); - linkTextInput = null; - } - } -} - -function initDialog() -{ // Get a single selected anchor element anchorElement = editorShell.GetSelectedElement(tagName); @@ -101,8 +76,9 @@ function initDialog() editorShell.SelectElement(anchorElement); selection = editorShell.editorSelection; - hrefInput.value = anchorElement.getAttribute("href"); - dump("Current HREF: "+hrefInput.value+"\n"); +// Moved to InitDialog() +// hrefInput.value = anchorElement.getAttribute("href"); +// dump("Current HREF: "+hrefInput.value+"\n"); } else { // See if we have a selected image instead of text imageElement = editorShell.GetSelectedElement("img"); @@ -165,6 +141,33 @@ function initDialog() insertLinkAroundSelection = true; dump("insertLinkAroundSelection is TRUE\n"); } + + // Set data for the dialog controls + InitDialog(); + + // Set initial focus + if (insertNew) { + dump("Setting focus to linkTextInput\n"); + // We will be using the HREF inputbox, so text message + linkTextInput.focus(); + } else { + dump("Setting focus to linkTextInput\n"); + hrefInput.focus(); + + // We will not insert a new link at caret, so remove link text input field + parentNode = linkTextInput.parentNode; + if (parentNode) { + dump("Removing link text input field.\n"); + parentNode.removeChild(linkTextInput); + linkTextInput = null; + } + } +} + +function InitDialog() +{ + hrefInput.value = anchorElement.getAttribute("href"); + dump("Current HREF: "+hrefInput.value+"\n"); } function ChooseFile() @@ -184,6 +187,11 @@ function RemoveLink() hrefInput.value = ""; } +function onAdvancedEdit() +{ + dump("\n\n Need to write onAdvancedEdit for Link dialog\n\n"); +} + function onOK() { dump("***** Clicked OK in link props dialog\n"); diff --git a/editor/ui/dialogs/content/EdNamedAnchorProps.js b/editor/ui/dialogs/content/EdNamedAnchorProps.js index 4f0bf232ab61..42a96fbbb5be 100644 --- a/editor/ui/dialogs/content/EdNamedAnchorProps.js +++ b/editor/ui/dialogs/content/EdNamedAnchorProps.js @@ -24,6 +24,7 @@ var insertNew = true; var tagName = "anchor"; var anchorElement = null; var nameInput; +var name; // dialog initialization code function Startup() @@ -44,7 +45,7 @@ function Startup() // We found an element and don't need to insert one insertNew = false; dump("Found existing anchor\n"); - nameInput.value = anchorElement.getAttribute("name"); + name = anchorElement.getAttribute("name"); } else { insertNew = true; // We don't have an element selected, @@ -61,8 +62,6 @@ function Startup() //Be sure the name is unique to the document if (AnchorNameExists(name)) name += "_" - - nameInput.value = name; } if(!anchorElement) @@ -70,10 +69,19 @@ function Startup() dump("Failed to get selected element or create a new one!\n"); window.close(); } + // Make a copy to use for AdvancedEdit + globalElement = anchorElement.cloneNode; + + InitDialog(); nameInput.focus(); } +function InitDialog() +{ + nameInput.value = name; +} + function AnchorNameExists(name) { anchorList = editorShell.editorDocument.anchors; // getElementsByTagName("A"); @@ -88,6 +96,13 @@ function AnchorNameExists(name) return false; } +function onAdvancedEdit() +{ + dump("\n\n Need to write onAdvancedEdit for Named Anchor dialog\n\n"); +} + +} + function onOK() { name = nameInput.value; diff --git a/editor/ui/dialogs/content/EdTableProps.js b/editor/ui/dialogs/content/EdTableProps.js index c243cb356335..b224f5c64413 100644 --- a/editor/ui/dialogs/content/EdTableProps.js +++ b/editor/ui/dialogs/content/EdTableProps.js @@ -37,7 +37,15 @@ function Startup() // GET EACH CONTROL -- E.G.: //dialog.editBox = document.getElementById("editBox"); - initDialog(); +/* + // Get the selected or enclosing table element + if(!element) + { + dump("Failed to get selected element or create a new one!\n"); + window.close(); + } +*/ + InitDialog(); var table = editorShell.GetElementOrParentByTagName("table", null); if (!table) @@ -48,14 +56,14 @@ function Startup() } -function initDialog() { -/* - if(!element) - { - dump("Failed to get selected element or create a new one!\n"); - window.close(); - } -*/ +function InitDialog() +{ + dump{"Table Editing:InitDialog()\n"); +} + +function onAdvancedEdit() +{ + dump("\n\n Need to write onAdvancedEdit for Table and Cell dialog\n\n"); } function onOK() diff --git a/editor/ui/dialogs/locale/en-US/EdAdvancedEdit.dtd b/editor/ui/dialogs/locale/en-US/EdAdvancedEdit.dtd index 3b96f8dcd139..a040cf9d03e2 100644 --- a/editor/ui/dialogs/locale/en-US/EdAdvancedEdit.dtd +++ b/editor/ui/dialogs/locale/en-US/EdAdvancedEdit.dtd @@ -20,4 +20,6 @@ - Contributor(s): --> - + + +