Mozilla/mozilla/editor/ui/dialogs/content/EdDialogTemplate.js
cmanske%netscape.com 79fd9050ea Generic message dialog, fix insert element-related bugs, initial personal dictionary dialog, other editor bugs
git-svn-id: svn://10.0.0.236/trunk@39268 18797224-902f-48f8-a5cc-f745e15eee43
1999-07-14 15:24:33 +00:00

55 lines
1.3 KiB
JavaScript

//Cancel() is in EdDialogCommon.js
var insertNew = true;
var tagname = "TAG NAME"
// dialog initialization code
function Startup()
{
if (!InitEditorShell())
return;
dump("EditoreditorShell found for dialog\n");
// Create dialog object to store controls for easy access
dialog = new Object;
// GET EACH CONTROL -- E.G.:
//dialog.editBox = document.getElementById("editBox");
initDialog();
// SET FOCUS TO FIRST CONTROL
//dialog.editBox.focus();
}
function initDialog() {
// Get a single selected element of the desired type
element = editorShell.GetSelectedElement(tagName);
if (element) {
// We found an element and don't need to insert one
insertNew = false;
dump("Found existing image\n");
} else {
insertNew = true;
// We don't have an element selected,
// so create one with default attributes
dump("Element not selected - calling createElementWithDefaults\n");
element = appCore.createElementWithDefaults(tagName);
}
if(!element)
{
dump("Failed to get selected element or create a new one!\n");
window.close();
}
}
function onOK()
{
// Set attribute example:
// imageElement.setAttribute("src",dialog.srcInput.value);
if (insertNew) {
editorShell.InsertElement(element, false);
}
window.close();
}