This commit is contained in:
brade%netscape.com 1999-08-25 14:36:13 +00:00
Родитель 277bc1f584
Коммит e5f28a2c97
7 изменённых файлов: 40 добавлений и 34 удалений

Просмотреть файл

@ -33,6 +33,8 @@ function Startup()
if (!InitEditorShell()) if (!InitEditorShell())
return; return;
doSetOKCancel(onOK, null);
// Get the selected horizontal line // Get the selected horizontal line
hLineElement = editorShell.GetSelectedElement(tagName); hLineElement = editorShell.GetSelectedElement(tagName);
@ -171,11 +173,8 @@ function ValidateData(setAttributes)
function onOK() function onOK()
{ {
dump("************* onOK for HLine props\n");
// Since we only edit existing HLines, // Since we only edit existing HLines,
// ValidateData will set the new attributes // ValidateData will set the new attributes
// so there's nothing else to do // so there's nothing else to do
if (ValidateData(true)) { return (ValidateData(true));
window.close();
}
} }

Просмотреть файл

@ -36,7 +36,8 @@ function Startup()
{ {
if (!InitEditorShell()) if (!InitEditorShell())
return; return;
dump("EditoreditorShell found for Image Properties dialog\n");
doSetOKCancel(onOK, null);
// Create dialog object to store controls for easy access // Create dialog object to store controls for easy access
@ -328,12 +329,13 @@ function doOverallEnabling()
wasEnableAll = canEnableAll; wasEnableAll = canEnableAll;
btn = document.getElementById("OK"); btn = document.getElementById("ok");
if ( btn ) if ( btn )
{ {
dump("ok button found!\n")
btn.disabled = (!canEnableAll && hasAnyChanged); btn.disabled = (!canEnableAll && hasAnyChanged);
} }
else dump("ok button not found\n");
fieldset = document.getElementById("imagedimensionsFieldset"); fieldset = document.getElementById("imagedimensionsFieldset");
if ( fieldset ) if ( fieldset )
@ -494,11 +496,9 @@ function onOK()
{ {
if ( !imageType ) { if ( !imageType ) {
dump("alert *** please choose an image of typ gif, jpg or png.\n\n"); dump("alert *** please choose an image of typ gif, jpg or png.\n\n");
return; return false;
} }
else {
imageElement.setAttribute("src",dialog.srcInput.value); imageElement.setAttribute("src",dialog.srcInput.value);
// We must convert to "file:///" format else image doesn't load! // We must convert to "file:///" format else image doesn't load!
@ -553,20 +553,17 @@ function onOK()
// handle insertion of new image // handle insertion of new image
if (insertNew) { if (insertNew)
dump("src="+imageElement.getAttribute("src")+" alt="+imageElement.getAttribute("alt")+"\n"); {
// 'true' means delete the selection before inserting // 'true' means delete the selection before inserting
editorShell.InsertElement(imageElement, true); editorShell.InsertElement(imageElement, true);
} }
// dismiss dialog return true;
window.close();
}
} }
// setDimensions() // setDimensions()
// sets height and width attributes to inserted image // sets height and width attributes to inserted image
// Brian King - XML Workshop // Brian King - XML Workshop

Просмотреть файл

@ -25,6 +25,8 @@ function Startup()
{ {
if (!InitEditorShell()) if (!InitEditorShell())
return; return;
doSetOKCancel(onOK, null);
// Create dialog object to store controls for easy access // Create dialog object to store controls for easy access
dialog = new Object; dialog = new Object;
@ -49,8 +51,11 @@ function onOK()
{ {
if (dialog.srcInput.value != "") if (dialog.srcInput.value != "")
editorShell.InsertSource(dialog.srcInput.value); editorShell.InsertSource(dialog.srcInput.value);
else dump("Null value -- not inserting\n"); else {
dump("Null value -- not inserting\n");
window.close(); return false;
}
return true;
} }

Просмотреть файл

@ -35,7 +35,8 @@ function Startup()
{ {
if (!InitEditorShell()) if (!InitEditorShell())
return; return;
dump("EditoreditorShell found for Insert Table dialog\n");
doSetOKCancel(onOK, null);
dump(tagName+" = InsertTable tagName\n"); dump(tagName+" = InsertTable tagName\n");
tableElement = editorShell.CreateElementWithDefaults(tagName); tableElement = editorShell.CreateElementWithDefaults(tagName);
@ -71,14 +72,14 @@ function onOK()
if (rows == "") { if (rows == "") {
// Set focus to the offending control // Set focus to the offending control
dialog.rowsInput.focus(); dialog.rowsInput.focus();
return; return false;
} }
columns = ValidateNumberString(dialog.columnsInput.value, 1, maxColumns); columns = ValidateNumberString(dialog.columnsInput.value, 1, maxColumns);
if (columns == "") { if (columns == "") {
// Set focus to the offending control // Set focus to the offending control
dialog.columnsInput.focus(); dialog.columnsInput.focus();
return; return false;
} }
dump("Rows = "+rows+" Columns = "+columns+"\n"); dump("Rows = "+rows+" Columns = "+columns+"\n");
for (i = 0; i < rows; i++) for (i = 0; i < rows; i++)
@ -126,5 +127,5 @@ function onOK()
// Don't delete selected text when inserting // Don't delete selected text when inserting
editorShell.InsertElement(tableElement, false); editorShell.InsertElement(tableElement, false);
window.close(); return true;
} }

Просмотреть файл

@ -38,7 +38,8 @@ function Startup()
{ {
if (!InitEditorShell()) if (!InitEditorShell())
return; return;
dump("Starting Link Properties Dialog\n");
doSetOKCancel(onOK, null);
// Message was wrapped in a <label> or <div>, so actual text is a child text node // Message was wrapped in a <label> or <div>, so actual text is a child text node
linkCaption = (document.getElementById("linkTextCaption")).firstChild; linkCaption = (document.getElementById("linkTextCaption")).firstChild;
@ -206,7 +207,7 @@ function onOK()
if (newText.length == 0) { if (newText.length == 0) {
ShowInputErrorMessage("You must enter some text for this link."); ShowInputErrorMessage("You must enter some text for this link.");
linkTextInput.focus(); linkTextInput.focus();
return; return false;
} }
textNode = editorShell.editorDocument.createTextNode(newText); textNode = editorShell.editorDocument.createTextNode(newText);
if (textNode) { if (textNode) {
@ -227,6 +228,6 @@ function onOK()
} }
// Note: if HREF is empty and we were inserting a new link, do nothing // Note: if HREF is empty and we were inserting a new link, do nothing
window.close(); return true;
} }

Просмотреть файл

@ -30,7 +30,9 @@ function Startup()
{ {
if (!InitEditorShell()) if (!InitEditorShell())
return; return;
dump("EditorShell found for NamedAnchor Properties dialog\n");
doSetOKCancel(onOK, null);
nameInput = document.getElementById("nameInput"); nameInput = document.getElementById("nameInput");
dump("tagName = "+tagName+"\n"); dump("tagName = "+tagName+"\n");
@ -93,20 +95,20 @@ function onOK()
if (name.length == 0) { if (name.length == 0) {
ShowInputErrorMessage("You must enter a name for this anchor."); ShowInputErrorMessage("You must enter a name for this anchor.");
nameInput.focus(); nameInput.focus();
return; return false;
} else { } else {
// Replace spaces with "_" else it causes trouble in URL parsing // Replace spaces with "_" else it causes trouble in URL parsing
name = ReplaceWhitespace(name, "_"); name = ReplaceWhitespace(name, "_");
if (AnchorNameExists(name)) { if (AnchorNameExists(name)) {
ShowInputErrorMessage("\""+name+"\" already exists in this page.\nPlease enter a different name."); ShowInputErrorMessage("\""+name+"\" already exists in this page.\nPlease enter a different name.");
nameInput.focus(); nameInput.focus();
return; return false;
} }
anchorElement.setAttribute("name",name); anchorElement.setAttribute("name",name);
if (insertNew) { if (insertNew) {
// Don't delete selected text when inserting // Don't delete selected text when inserting
editorShell.InsertElement(anchorElement, false); editorShell.InsertElement(anchorElement, false);
} }
window.close();
} }
return true;
} }

Просмотреть файл

@ -29,7 +29,8 @@ function Startup()
{ {
if (!InitEditorShell()) if (!InitEditorShell())
return; return;
dump("EditoreditorShell found for dialog Table Properties\n");
doSetOKCancel(onOK, null);
// Create dialog object to store controls for easy access // Create dialog object to store controls for easy access
dialog = new Object; dialog = new Object;
@ -61,5 +62,5 @@ function onOK()
{ {
// Set attribute example: // Set attribute example:
// imageElement.setAttribute("src",dialog.srcInput.value); // imageElement.setAttribute("src",dialog.srcInput.value);
window.close(); return true;
} }