From 3db29ed843019fb78bf11238e8a42e9b9fd0eb7a Mon Sep 17 00:00:00 2001 From: "brade%netscape.com" Date: Wed, 25 Aug 1999 14:36:13 +0000 Subject: [PATCH] xul overlay for ok/cancel git-svn-id: svn://10.0.0.236/trunk@44503 18797224-902f-48f8-a5cc-f745e15eee43 --- .../editor/ui/dialogs/content/EdHLineProps.js | 7 +++--- .../editor/ui/dialogs/content/EdImageProps.js | 25 ++++++++----------- mozilla/editor/ui/dialogs/content/EdInsSrc.js | 11 +++++--- .../ui/dialogs/content/EdInsertTable.js | 9 ++++--- .../editor/ui/dialogs/content/EdLinkProps.js | 7 +++--- .../ui/dialogs/content/EdNamedAnchorProps.js | 10 +++++--- .../editor/ui/dialogs/content/EdTableProps.js | 5 ++-- 7 files changed, 40 insertions(+), 34 deletions(-) diff --git a/mozilla/editor/ui/dialogs/content/EdHLineProps.js b/mozilla/editor/ui/dialogs/content/EdHLineProps.js index 13aad5436e7..e550ab5e733 100644 --- a/mozilla/editor/ui/dialogs/content/EdHLineProps.js +++ b/mozilla/editor/ui/dialogs/content/EdHLineProps.js @@ -33,6 +33,8 @@ function Startup() if (!InitEditorShell()) return; + doSetOKCancel(onOK, null); + // Get the selected horizontal line hLineElement = editorShell.GetSelectedElement(tagName); @@ -171,11 +173,8 @@ function ValidateData(setAttributes) function onOK() { - dump("************* onOK for HLine props\n"); // Since we only edit existing HLines, // ValidateData will set the new attributes // so there's nothing else to do - if (ValidateData(true)) { - window.close(); - } + return (ValidateData(true)); } diff --git a/mozilla/editor/ui/dialogs/content/EdImageProps.js b/mozilla/editor/ui/dialogs/content/EdImageProps.js index 42177c7d853..e48a15ae8c7 100644 --- a/mozilla/editor/ui/dialogs/content/EdImageProps.js +++ b/mozilla/editor/ui/dialogs/content/EdImageProps.js @@ -36,7 +36,8 @@ function Startup() { if (!InitEditorShell()) return; - dump("EditoreditorShell found for Image Properties dialog\n"); + + doSetOKCancel(onOK, null); // Create dialog object to store controls for easy access @@ -328,12 +329,13 @@ function doOverallEnabling() wasEnableAll = canEnableAll; - btn = document.getElementById("OK"); + btn = document.getElementById("ok"); if ( btn ) { + dump("ok button found!\n") btn.disabled = (!canEnableAll && hasAnyChanged); } - + else dump("ok button not found\n"); fieldset = document.getElementById("imagedimensionsFieldset"); if ( fieldset ) @@ -494,11 +496,9 @@ function onOK() { if ( !imageType ) { dump("alert *** please choose an image of typ gif, jpg or png.\n\n"); - return; + return false; } - else { - imageElement.setAttribute("src",dialog.srcInput.value); // We must convert to "file:///" format else image doesn't load! @@ -553,20 +553,17 @@ function onOK() // handle insertion of new image - if (insertNew) { - dump("src="+imageElement.getAttribute("src")+" alt="+imageElement.getAttribute("alt")+"\n"); - + if (insertNew) + { // 'true' means delete the selection before inserting editorShell.InsertElement(imageElement, true); } - // dismiss dialog - - window.close(); - - } + return true; } + + // setDimensions() // sets height and width attributes to inserted image // Brian King - XML Workshop diff --git a/mozilla/editor/ui/dialogs/content/EdInsSrc.js b/mozilla/editor/ui/dialogs/content/EdInsSrc.js index 96f8437b3fd..f7aa1b95a56 100644 --- a/mozilla/editor/ui/dialogs/content/EdInsSrc.js +++ b/mozilla/editor/ui/dialogs/content/EdInsSrc.js @@ -25,6 +25,8 @@ function Startup() { if (!InitEditorShell()) return; + + doSetOKCancel(onOK, null); // Create dialog object to store controls for easy access dialog = new Object; @@ -49,8 +51,11 @@ function onOK() { if (dialog.srcInput.value != "") editorShell.InsertSource(dialog.srcInput.value); - else dump("Null value -- not inserting\n"); - - window.close(); + else { + dump("Null value -- not inserting\n"); + return false; + } + + return true; } diff --git a/mozilla/editor/ui/dialogs/content/EdInsertTable.js b/mozilla/editor/ui/dialogs/content/EdInsertTable.js index ee2b3c3a317..cf2e817093c 100644 --- a/mozilla/editor/ui/dialogs/content/EdInsertTable.js +++ b/mozilla/editor/ui/dialogs/content/EdInsertTable.js @@ -35,7 +35,8 @@ function Startup() { if (!InitEditorShell()) return; - dump("EditoreditorShell found for Insert Table dialog\n"); + + doSetOKCancel(onOK, null); dump(tagName+" = InsertTable tagName\n"); tableElement = editorShell.CreateElementWithDefaults(tagName); @@ -71,14 +72,14 @@ function onOK() if (rows == "") { // Set focus to the offending control dialog.rowsInput.focus(); - return; + return false; } columns = ValidateNumberString(dialog.columnsInput.value, 1, maxColumns); if (columns == "") { // Set focus to the offending control dialog.columnsInput.focus(); - return; + return false; } dump("Rows = "+rows+" Columns = "+columns+"\n"); for (i = 0; i < rows; i++) @@ -126,5 +127,5 @@ function onOK() // Don't delete selected text when inserting editorShell.InsertElement(tableElement, false); - window.close(); + return true; } diff --git a/mozilla/editor/ui/dialogs/content/EdLinkProps.js b/mozilla/editor/ui/dialogs/content/EdLinkProps.js index 556fc100af3..3328a002908 100644 --- a/mozilla/editor/ui/dialogs/content/EdLinkProps.js +++ b/mozilla/editor/ui/dialogs/content/EdLinkProps.js @@ -38,7 +38,8 @@ function Startup() { if (!InitEditorShell()) return; - dump("Starting Link Properties Dialog\n"); + + doSetOKCancel(onOK, null); // Message was wrapped in a