mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-01 11:27:55 +00:00
Added Page Properties (26889) and Page Colors dialogs (14344), removed debug menu only in release (27237), link dialog fixes (27308), lots of dialog rewrite to use titledbox instead of fieldset, rewrote insert table dialog to use boxes. Changed font size to use CSS strings, not <font size> for ui, but other bugs prevented inserting spans for size. Other small bug fixes. r=brade.
This commit is contained in:
parent
c6a144449a
commit
770a137b12
@ -125,6 +125,7 @@ static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
static NS_DEFINE_CID(kCommonDialogsCID, NS_CommonDialog_CID );
|
||||
static NS_DEFINE_CID(kDialogParamBlockCID, NS_DialogParamBlock_CID);
|
||||
static NS_DEFINE_CID(kEditorControllerCID, NS_EDITORCONTROLLER_CID);
|
||||
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
|
||||
|
||||
/* Define Interface IDs */
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
@ -384,10 +385,10 @@ nsEditorShell::PrepareDocumentForEditing(nsIURI *aUrl)
|
||||
aUrl->GetScheme(&pageScheme);
|
||||
aUrl->GetSpec(&pageURLString);
|
||||
|
||||
// only save the file spec if this is a local file, and is not
|
||||
// about:blank
|
||||
if (nsCRT::strncmp(pageScheme, "file", 4) == 0 &&
|
||||
nsCRT::strncmp(pageURLString,"about:blank", 11) != 0)
|
||||
// only save the file spec if this is a local file, and is not
|
||||
// about:blank
|
||||
if (nsCRT::strncmp(pageScheme, "file", 4) == 0 &&
|
||||
nsCRT::strncmp(pageURLString,"about:blank", 11) != 0)
|
||||
{
|
||||
nsFileURL pageURL(pageURLString);
|
||||
nsFileSpec pageSpec(pageURL);
|
||||
@ -422,6 +423,15 @@ nsEditorShell::PrepareDocumentForEditing(nsIURI *aUrl)
|
||||
// This will be remove for "Browser" mode
|
||||
SetDisplayMode(eDisplayModeEdit);
|
||||
|
||||
#ifdef DEBUG
|
||||
// Activate the debug menu only in debug builds
|
||||
// by removing the "hidden" attribute set "true" in XUL
|
||||
nsCOMPtr<nsIDOMElement> elem;
|
||||
rv = xulDoc->GetElementById("debugMenu", getter_AddRefs(elem));
|
||||
if (elem)
|
||||
elem->RemoveAttribute("hidden");
|
||||
#endif
|
||||
|
||||
// Force initial focus to the content window -- HOW?
|
||||
// mWebShellWin->SetFocus();
|
||||
return NS_OK;
|
||||
@ -1247,6 +1257,10 @@ nsEditorShell::CheckAndSaveDocument(const PRUnichar *reasonToSave, PRBool *_retv
|
||||
nsAutoString tmp2 = GetString("DontSave");
|
||||
nsAutoString title;
|
||||
GetDocumentTitleString(title);
|
||||
// If title is empty, use "untitled"
|
||||
if (title.Length() == 0)
|
||||
title = GetString("untitled");
|
||||
|
||||
nsAutoString saveMsg = ((GetString("SaveFilePrompt")).ReplaceSubstring("%title%",title)).ReplaceSubstring("%reason%",ReasonToSave);
|
||||
|
||||
EConfirmResult result = ConfirmWithCancel(GetString("SaveDocument"), saveMsg,
|
||||
@ -1613,6 +1627,9 @@ nsEditorShell::UpdateWindowTitle()
|
||||
|
||||
nsAutoString windowCaption;
|
||||
res = GetDocumentTitleString(windowCaption);
|
||||
// If title is empty, use "untitled"
|
||||
if (windowCaption.Length() == 0)
|
||||
windowCaption = GetString("untitled");
|
||||
|
||||
// Append just the 'leaf' filename to the Doc. Title for the window caption
|
||||
if (NS_SUCCEEDED(res))
|
||||
@ -1666,10 +1683,6 @@ nsEditorShell::GetDocumentTitleString(nsString& title)
|
||||
nsCOMPtr<nsIDOMHTMLDocument> HTMLDoc = do_QueryInterface(domDoc);
|
||||
if (HTMLDoc)
|
||||
res = HTMLDoc->GetTitle(title);
|
||||
|
||||
// If title is empty, use "untitled"
|
||||
if (title.Length() == 0)
|
||||
title = GetString("untitled");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@ -1745,7 +1758,7 @@ nsEditorShell::SetDocumentTitle(const PRUnichar *title)
|
||||
|
||||
if (titleNode)
|
||||
{
|
||||
//Delete existing children
|
||||
//Delete existing children (text) of title node
|
||||
nsCOMPtr<nsIDOMNodeList> children;
|
||||
res = titleNode->GetChildNodes(getter_AddRefs(children));
|
||||
if(NS_SUCCEEDED(res) && children)
|
||||
@ -1766,7 +1779,8 @@ nsEditorShell::SetDocumentTitle(const PRUnichar *title)
|
||||
// Get the <HEAD> node, create a <TITLE> and insert it under the HEAD
|
||||
nsCOMPtr<nsIDOMNodeList> headList;
|
||||
res = domDoc->GetElementsByTagName("head",getter_AddRefs(headList));
|
||||
if (NS_SUCCEEDED(res) && headList)
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (headList)
|
||||
{
|
||||
headList->Item(0, getter_AddRefs(headNode));
|
||||
if (headNode)
|
||||
@ -1785,8 +1799,7 @@ nsEditorShell::SetDocumentTitle(const PRUnichar *title)
|
||||
// Note: There should ALWAYS be a <title> in any HTML document,
|
||||
// so we will insert the node and not make it undoable
|
||||
res = headNode->AppendChild(titleNode, getter_AddRefs(resultNode));
|
||||
if (NS_FAILED(res))
|
||||
return NS_ERROR_FAILURE;
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
// Append a text node under the TITLE
|
||||
// only if the title text isn't empty
|
||||
@ -1794,13 +1807,10 @@ nsEditorShell::SetDocumentTitle(const PRUnichar *title)
|
||||
{
|
||||
nsCOMPtr<nsIDOMText> textNode;
|
||||
res = domDoc->CreateTextNode(titleStr, getter_AddRefs(textNode));
|
||||
if (NS_SUCCEEDED(res) && textNode)
|
||||
{
|
||||
// Go through the editor API so action is undoable
|
||||
res = editor->InsertNode(textNode, titleNode, 0);
|
||||
// This is the non-undoable code:
|
||||
//res = titleNode->AppendChild(textNode,getter_AddRefs(resultNode));
|
||||
}
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!textNode) return NS_ERROR_FAILURE;
|
||||
// Go through the editor API so action is undoable
|
||||
res = editor->InsertNode(textNode, titleNode, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3440,8 +3450,7 @@ nsEditorShell::GetSelectedOrParentTableElement(PRUnichar **aTagName, PRBool *aIs
|
||||
nsAutoString TagName(*aTagName);
|
||||
if (tableEditor)
|
||||
result = tableEditor->GetSelectedOrParentTableElement(*_retval, TagName, *aIsSelected);
|
||||
// Need an ugly cast to get around "const" return value
|
||||
*aTagName = (PRUnichar*)TagName.GetUnicode();
|
||||
*aTagName = TagName.ToNewUnicode();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -2781,10 +2781,10 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu
|
||||
if (selectedElement)
|
||||
{
|
||||
// If we already found a node, then we have another element,
|
||||
// so don't return an element
|
||||
// thus there's not just one element selected
|
||||
if (bNodeFound)
|
||||
{
|
||||
//bNodeFound;
|
||||
bNodeFound = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2935,9 +2935,8 @@ nsHTMLEditor::InsertLinkAroundSelection(nsIDOMElement* aAnchorElement)
|
||||
nsresult res=NS_ERROR_NULL_POINTER;
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
|
||||
// DON'T RETURN EXCEPT AT THE END -- WE NEED TO RELEASE THE aAnchorElement
|
||||
if (!aAnchorElement)
|
||||
goto DELETE_ANCHOR; // DON'T USE GOTO IN C++!
|
||||
if (!aAnchorElement) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
|
||||
// We must have a real selection
|
||||
res = GetSelection(getter_AddRefs(selection));
|
||||
@ -2945,8 +2944,8 @@ nsHTMLEditor::InsertLinkAroundSelection(nsIDOMElement* aAnchorElement)
|
||||
{
|
||||
res = NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (NS_FAILED(res) || !selection)
|
||||
goto DELETE_ANCHOR;
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!selection) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
PRBool isCollapsed;
|
||||
res = selection->GetIsCollapsed(&isCollapsed);
|
||||
@ -2963,8 +2962,9 @@ nsHTMLEditor::InsertLinkAroundSelection(nsIDOMElement* aAnchorElement)
|
||||
if (anchor)
|
||||
{
|
||||
nsAutoString href;
|
||||
// XXX: ERROR_HANDLING return code lost
|
||||
if (NS_SUCCEEDED(anchor->GetHref(href)) && href.GetUnicode() && href.Length() > 0)
|
||||
res = anchor->GetHref(href);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (href.GetUnicode() && href.Length() > 0)
|
||||
{
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
const nsString attribute("href");
|
||||
@ -2975,16 +2975,11 @@ nsHTMLEditor::InsertLinkAroundSelection(nsIDOMElement* aAnchorElement)
|
||||
}
|
||||
}
|
||||
}
|
||||
DELETE_ANCHOR:
|
||||
// We don't insert the element created in CreateElementWithDefaults
|
||||
// into the document like we do in InsertElement,
|
||||
// so shouldn't we have to do this here?
|
||||
// It crashes in JavaScript if we do this!
|
||||
//NS_RELEASE(aAnchorElement);
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::SetBackgroundColor(const nsString& aColor)
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SetBackgroundColor(const nsString& aColor)
|
||||
{
|
||||
NS_PRECONDITION(mDocWeak, "Missing Editor DOM Document");
|
||||
|
||||
@ -7505,7 +7500,7 @@ nsHTMLEditor::RelativeFontChange( PRInt32 aSizeChange)
|
||||
|
||||
// now that we have the list, do the font size change on each node
|
||||
PRUint32 listCount;
|
||||
PRInt32 j;
|
||||
PRUint32 j;
|
||||
arrayOfNodes->Count(&listCount);
|
||||
for (j = 0; j < listCount; j++)
|
||||
{
|
||||
@ -7565,7 +7560,7 @@ nsHTMLEditor::RelativeFontChangeOnTextNode( PRInt32 aSizeChange,
|
||||
PRUint32 textLen;
|
||||
aTextNode->GetLength(&textLen);
|
||||
|
||||
if ( aEndOffset != textLen )
|
||||
if ( (PRUint32)aEndOffset != textLen )
|
||||
{
|
||||
// we need to split off back of text node
|
||||
res = SplitNode(node, aEndOffset, getter_AddRefs(tmp));
|
||||
@ -7636,7 +7631,7 @@ nsHTMLEditor::RelativeFontChangeOnNode( PRInt32 aSizeChange,
|
||||
PRInt32 j;
|
||||
PRUint32 childCount;
|
||||
childNodes->GetLength(&childCount);
|
||||
for (j=0 ; j<childCount; j++)
|
||||
for (j=0 ; j < (PRInt32)childCount; j++)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> childNode;
|
||||
res = childNodes->Item(j, getter_AddRefs(childNode));
|
||||
|
@ -125,6 +125,7 @@ static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
static NS_DEFINE_CID(kCommonDialogsCID, NS_CommonDialog_CID );
|
||||
static NS_DEFINE_CID(kDialogParamBlockCID, NS_DialogParamBlock_CID);
|
||||
static NS_DEFINE_CID(kEditorControllerCID, NS_EDITORCONTROLLER_CID);
|
||||
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
|
||||
|
||||
/* Define Interface IDs */
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
@ -384,10 +385,10 @@ nsEditorShell::PrepareDocumentForEditing(nsIURI *aUrl)
|
||||
aUrl->GetScheme(&pageScheme);
|
||||
aUrl->GetSpec(&pageURLString);
|
||||
|
||||
// only save the file spec if this is a local file, and is not
|
||||
// about:blank
|
||||
if (nsCRT::strncmp(pageScheme, "file", 4) == 0 &&
|
||||
nsCRT::strncmp(pageURLString,"about:blank", 11) != 0)
|
||||
// only save the file spec if this is a local file, and is not
|
||||
// about:blank
|
||||
if (nsCRT::strncmp(pageScheme, "file", 4) == 0 &&
|
||||
nsCRT::strncmp(pageURLString,"about:blank", 11) != 0)
|
||||
{
|
||||
nsFileURL pageURL(pageURLString);
|
||||
nsFileSpec pageSpec(pageURL);
|
||||
@ -422,6 +423,15 @@ nsEditorShell::PrepareDocumentForEditing(nsIURI *aUrl)
|
||||
// This will be remove for "Browser" mode
|
||||
SetDisplayMode(eDisplayModeEdit);
|
||||
|
||||
#ifdef DEBUG
|
||||
// Activate the debug menu only in debug builds
|
||||
// by removing the "hidden" attribute set "true" in XUL
|
||||
nsCOMPtr<nsIDOMElement> elem;
|
||||
rv = xulDoc->GetElementById("debugMenu", getter_AddRefs(elem));
|
||||
if (elem)
|
||||
elem->RemoveAttribute("hidden");
|
||||
#endif
|
||||
|
||||
// Force initial focus to the content window -- HOW?
|
||||
// mWebShellWin->SetFocus();
|
||||
return NS_OK;
|
||||
@ -1247,6 +1257,10 @@ nsEditorShell::CheckAndSaveDocument(const PRUnichar *reasonToSave, PRBool *_retv
|
||||
nsAutoString tmp2 = GetString("DontSave");
|
||||
nsAutoString title;
|
||||
GetDocumentTitleString(title);
|
||||
// If title is empty, use "untitled"
|
||||
if (title.Length() == 0)
|
||||
title = GetString("untitled");
|
||||
|
||||
nsAutoString saveMsg = ((GetString("SaveFilePrompt")).ReplaceSubstring("%title%",title)).ReplaceSubstring("%reason%",ReasonToSave);
|
||||
|
||||
EConfirmResult result = ConfirmWithCancel(GetString("SaveDocument"), saveMsg,
|
||||
@ -1613,6 +1627,9 @@ nsEditorShell::UpdateWindowTitle()
|
||||
|
||||
nsAutoString windowCaption;
|
||||
res = GetDocumentTitleString(windowCaption);
|
||||
// If title is empty, use "untitled"
|
||||
if (windowCaption.Length() == 0)
|
||||
windowCaption = GetString("untitled");
|
||||
|
||||
// Append just the 'leaf' filename to the Doc. Title for the window caption
|
||||
if (NS_SUCCEEDED(res))
|
||||
@ -1666,10 +1683,6 @@ nsEditorShell::GetDocumentTitleString(nsString& title)
|
||||
nsCOMPtr<nsIDOMHTMLDocument> HTMLDoc = do_QueryInterface(domDoc);
|
||||
if (HTMLDoc)
|
||||
res = HTMLDoc->GetTitle(title);
|
||||
|
||||
// If title is empty, use "untitled"
|
||||
if (title.Length() == 0)
|
||||
title = GetString("untitled");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@ -1745,7 +1758,7 @@ nsEditorShell::SetDocumentTitle(const PRUnichar *title)
|
||||
|
||||
if (titleNode)
|
||||
{
|
||||
//Delete existing children
|
||||
//Delete existing children (text) of title node
|
||||
nsCOMPtr<nsIDOMNodeList> children;
|
||||
res = titleNode->GetChildNodes(getter_AddRefs(children));
|
||||
if(NS_SUCCEEDED(res) && children)
|
||||
@ -1766,7 +1779,8 @@ nsEditorShell::SetDocumentTitle(const PRUnichar *title)
|
||||
// Get the <HEAD> node, create a <TITLE> and insert it under the HEAD
|
||||
nsCOMPtr<nsIDOMNodeList> headList;
|
||||
res = domDoc->GetElementsByTagName("head",getter_AddRefs(headList));
|
||||
if (NS_SUCCEEDED(res) && headList)
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (headList)
|
||||
{
|
||||
headList->Item(0, getter_AddRefs(headNode));
|
||||
if (headNode)
|
||||
@ -1785,8 +1799,7 @@ nsEditorShell::SetDocumentTitle(const PRUnichar *title)
|
||||
// Note: There should ALWAYS be a <title> in any HTML document,
|
||||
// so we will insert the node and not make it undoable
|
||||
res = headNode->AppendChild(titleNode, getter_AddRefs(resultNode));
|
||||
if (NS_FAILED(res))
|
||||
return NS_ERROR_FAILURE;
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
// Append a text node under the TITLE
|
||||
// only if the title text isn't empty
|
||||
@ -1794,13 +1807,10 @@ nsEditorShell::SetDocumentTitle(const PRUnichar *title)
|
||||
{
|
||||
nsCOMPtr<nsIDOMText> textNode;
|
||||
res = domDoc->CreateTextNode(titleStr, getter_AddRefs(textNode));
|
||||
if (NS_SUCCEEDED(res) && textNode)
|
||||
{
|
||||
// Go through the editor API so action is undoable
|
||||
res = editor->InsertNode(textNode, titleNode, 0);
|
||||
// This is the non-undoable code:
|
||||
//res = titleNode->AppendChild(textNode,getter_AddRefs(resultNode));
|
||||
}
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!textNode) return NS_ERROR_FAILURE;
|
||||
// Go through the editor API so action is undoable
|
||||
res = editor->InsertNode(textNode, titleNode, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3440,8 +3450,7 @@ nsEditorShell::GetSelectedOrParentTableElement(PRUnichar **aTagName, PRBool *aIs
|
||||
nsAutoString TagName(*aTagName);
|
||||
if (tableEditor)
|
||||
result = tableEditor->GetSelectedOrParentTableElement(*_retval, TagName, *aIsSelected);
|
||||
// Need an ugly cast to get around "const" return value
|
||||
*aTagName = (PRUnichar*)TagName.GetUnicode();
|
||||
*aTagName = TagName.ToNewUnicode();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -2781,10 +2781,10 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu
|
||||
if (selectedElement)
|
||||
{
|
||||
// If we already found a node, then we have another element,
|
||||
// so don't return an element
|
||||
// thus there's not just one element selected
|
||||
if (bNodeFound)
|
||||
{
|
||||
//bNodeFound;
|
||||
bNodeFound = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2935,9 +2935,8 @@ nsHTMLEditor::InsertLinkAroundSelection(nsIDOMElement* aAnchorElement)
|
||||
nsresult res=NS_ERROR_NULL_POINTER;
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
|
||||
// DON'T RETURN EXCEPT AT THE END -- WE NEED TO RELEASE THE aAnchorElement
|
||||
if (!aAnchorElement)
|
||||
goto DELETE_ANCHOR; // DON'T USE GOTO IN C++!
|
||||
if (!aAnchorElement) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
|
||||
// We must have a real selection
|
||||
res = GetSelection(getter_AddRefs(selection));
|
||||
@ -2945,8 +2944,8 @@ nsHTMLEditor::InsertLinkAroundSelection(nsIDOMElement* aAnchorElement)
|
||||
{
|
||||
res = NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (NS_FAILED(res) || !selection)
|
||||
goto DELETE_ANCHOR;
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!selection) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
PRBool isCollapsed;
|
||||
res = selection->GetIsCollapsed(&isCollapsed);
|
||||
@ -2963,8 +2962,9 @@ nsHTMLEditor::InsertLinkAroundSelection(nsIDOMElement* aAnchorElement)
|
||||
if (anchor)
|
||||
{
|
||||
nsAutoString href;
|
||||
// XXX: ERROR_HANDLING return code lost
|
||||
if (NS_SUCCEEDED(anchor->GetHref(href)) && href.GetUnicode() && href.Length() > 0)
|
||||
res = anchor->GetHref(href);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (href.GetUnicode() && href.Length() > 0)
|
||||
{
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
const nsString attribute("href");
|
||||
@ -2975,16 +2975,11 @@ nsHTMLEditor::InsertLinkAroundSelection(nsIDOMElement* aAnchorElement)
|
||||
}
|
||||
}
|
||||
}
|
||||
DELETE_ANCHOR:
|
||||
// We don't insert the element created in CreateElementWithDefaults
|
||||
// into the document like we do in InsertElement,
|
||||
// so shouldn't we have to do this here?
|
||||
// It crashes in JavaScript if we do this!
|
||||
//NS_RELEASE(aAnchorElement);
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::SetBackgroundColor(const nsString& aColor)
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SetBackgroundColor(const nsString& aColor)
|
||||
{
|
||||
NS_PRECONDITION(mDocWeak, "Missing Editor DOM Document");
|
||||
|
||||
@ -7505,7 +7500,7 @@ nsHTMLEditor::RelativeFontChange( PRInt32 aSizeChange)
|
||||
|
||||
// now that we have the list, do the font size change on each node
|
||||
PRUint32 listCount;
|
||||
PRInt32 j;
|
||||
PRUint32 j;
|
||||
arrayOfNodes->Count(&listCount);
|
||||
for (j = 0; j < listCount; j++)
|
||||
{
|
||||
@ -7565,7 +7560,7 @@ nsHTMLEditor::RelativeFontChangeOnTextNode( PRInt32 aSizeChange,
|
||||
PRUint32 textLen;
|
||||
aTextNode->GetLength(&textLen);
|
||||
|
||||
if ( aEndOffset != textLen )
|
||||
if ( (PRUint32)aEndOffset != textLen )
|
||||
{
|
||||
// we need to split off back of text node
|
||||
res = SplitNode(node, aEndOffset, getter_AddRefs(tmp));
|
||||
@ -7636,7 +7631,7 @@ nsHTMLEditor::RelativeFontChangeOnNode( PRInt32 aSizeChange,
|
||||
PRInt32 j;
|
||||
PRUint32 childCount;
|
||||
childNodes->GetLength(&childCount);
|
||||
for (j=0 ; j<childCount; j++)
|
||||
for (j=0 ; j < (PRInt32)childCount; j++)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> childNode;
|
||||
res = childNodes->Item(j, getter_AddRefs(childNode));
|
||||
|
@ -34,7 +34,7 @@ var WebCompose = false; // Set true for Web Composer, leave false for Messen
|
||||
// These must be kept in synch with the XUL <options> lists
|
||||
var gParagraphTagNames = new Array("","P","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","ADDRESS","PRE","DT","DD");
|
||||
var gFontFaceNames = new Array("","tt","Arial, Helvetica","Times","Courier");
|
||||
var gFontSizeNames = new Array("-2","-1","0","+1","+2","+3","+4");
|
||||
var gFontSizeNames = new Array("xx-small","x-small","small","medium","large","x-large","xx-large");
|
||||
|
||||
var gStyleTags = {
|
||||
"bold" : "b",
|
||||
@ -629,14 +629,47 @@ function onFontSizeChange()
|
||||
function EditorSetFontSize(size)
|
||||
{
|
||||
if( size == "0" || size == "normal" ||
|
||||
size == "+0" )
|
||||
size == "medium" )
|
||||
{
|
||||
editorShell.RemoveTextProperty("font", size);
|
||||
dump("Removing font size\n");
|
||||
} else {
|
||||
dump("Setting font size\n");
|
||||
// Temp: convert from new CSS size strings to old HTML size strings
|
||||
switch (size)
|
||||
{
|
||||
case "xx-small":
|
||||
case "x-small":
|
||||
size = "-2";
|
||||
break;
|
||||
case "small":
|
||||
size = "-1";
|
||||
break;
|
||||
case "large":
|
||||
size = "+1";
|
||||
break;
|
||||
case "x-large":
|
||||
size = "+2";
|
||||
break;
|
||||
case "xx-large":
|
||||
size = "+3";
|
||||
break;
|
||||
}
|
||||
editorShell.SetTextProperty("font", "size", size);
|
||||
}
|
||||
/*
|
||||
BIG BUG! Setting <span> tag is totally horked -- stick with <font size> for beta1
|
||||
{
|
||||
// XXX-THIS IS DEFINITELY WRONG!
|
||||
// We need to parse the style tag to set/remove only the "font-size"
|
||||
// TODO: We need a general SetInlineStyle(), RemoveInlineStyle() interface
|
||||
editorShell.RemoveTextProperty("span", "style");
|
||||
dump("Removing font size\n");
|
||||
} else {
|
||||
dump("Setting font size to: "+size+"\n");
|
||||
editorShell.SetTextProperty("span", "style", "font-size:"+size);
|
||||
}
|
||||
*/
|
||||
contentWindow.focus();
|
||||
}
|
||||
|
||||
@ -739,9 +772,20 @@ function EditorRemoveLinks()
|
||||
object-specific "Properties..." item
|
||||
*/
|
||||
|
||||
function EditorObjectProperties()
|
||||
// For property dialogs, we want the selected element,
|
||||
// but will accept a parent table cell if inside one
|
||||
function GetSelectedElementOrParentCell()
|
||||
{
|
||||
var element = editorShell.GetSelectedElement("");
|
||||
if (!element)
|
||||
element = editorShell.GetElementOrParentByTagName("td",null);
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
function EditorObjectProperties()
|
||||
{
|
||||
var element = GetSelectedElementOrParentCell();
|
||||
dump("EditorObjectProperties: element="+element+"\n");
|
||||
if (element)
|
||||
{
|
||||
@ -757,6 +801,9 @@ function EditorObjectProperties()
|
||||
case 'TABLE':
|
||||
EditorInsertOrEditTable(false);
|
||||
break;
|
||||
case 'TD':
|
||||
EditorTableCellProperties();
|
||||
break;
|
||||
case 'A':
|
||||
if(element.href)
|
||||
EditorInsertOrEditLink();
|
||||
@ -1054,9 +1101,30 @@ function CheckSpelling()
|
||||
contentWindow.focus();
|
||||
}
|
||||
|
||||
function InitBackColorPopup()
|
||||
{
|
||||
var caption = document.getElementById("BackColorCaption");
|
||||
if (caption)
|
||||
{
|
||||
var captionStr;
|
||||
var isSelectedObj = new Object();
|
||||
var tagNameObj = new Object();
|
||||
var element = editorShell.GetSelectedOrParentTableElement(tagNameObj, isSelectedObj);
|
||||
|
||||
if (tagNameObj.value == "table")
|
||||
captionStr = editorShell.GetString("TableBackColor");
|
||||
else if (tagNameObj.value == "td")
|
||||
captionStr = editorShell.GetString("CellBackColor");
|
||||
else
|
||||
captionStr = editorShell.GetString("PageBackColor");
|
||||
|
||||
caption.setAttribute("value",captionStr);
|
||||
}
|
||||
}
|
||||
|
||||
function EditorInitEditMenu()
|
||||
{
|
||||
|
||||
// We will be modifying the Paste menuitem in the future
|
||||
}
|
||||
|
||||
function EditorInitFormatMenu()
|
||||
@ -1064,8 +1132,7 @@ function EditorInitFormatMenu()
|
||||
var propertiesMenu = document.getElementById("objectProperties");
|
||||
if (propertiesMenu)
|
||||
{
|
||||
var element = editorShell.GetSelectedElement("");
|
||||
dump("EditorObjectProperties: element="+element+"\n");
|
||||
var element = GetSelectedElementOrParentCell();
|
||||
if (element)
|
||||
{
|
||||
dump("TagName="+element.nodeName+"\n");
|
||||
@ -1077,22 +1144,25 @@ function EditorInitFormatMenu()
|
||||
switch (element.nodeName)
|
||||
{
|
||||
case 'IMG':
|
||||
objStr = "Image";
|
||||
objStr = editorShell.GetString("Image");
|
||||
break;
|
||||
case 'HR':
|
||||
objStr = "H.Line";
|
||||
objStr = editorShell.GetString("HLine");
|
||||
break;
|
||||
case 'TABLE':
|
||||
objStr = "Table";
|
||||
objStr = editorShell.GetString("Table");
|
||||
break;
|
||||
case 'TD':
|
||||
objStr = editorShell.GetString("TableCell");
|
||||
break;
|
||||
case 'A':
|
||||
if(element.href)
|
||||
{
|
||||
objStr = "Link";
|
||||
objStr = editorShell.GetString("Link");
|
||||
EditorInsertOrEditLink();
|
||||
} else if (element.name)
|
||||
{
|
||||
objStr = "Named Anchor";
|
||||
objStr = editorShell.GetString("NamedAnchor");
|
||||
EditorInsertOrEditNamedAnchor();
|
||||
}
|
||||
break;
|
||||
@ -1100,32 +1170,16 @@ function EditorInitFormatMenu()
|
||||
menuStr = menuStr.replace(/%obj%/,objStr);
|
||||
propertiesMenu.setAttribute("value", menuStr)
|
||||
} else {
|
||||
// No element to set properties on - hide menu item
|
||||
propertiesMenu.setAttribute("hidden","true");
|
||||
}
|
||||
}
|
||||
}
|
||||
dump("Calling EditorInitViewMenu()\n");
|
||||
}
|
||||
|
||||
function EditorInitToolbars()
|
||||
{
|
||||
// Set title edit field
|
||||
var domdoc;
|
||||
try { domdoc = window.editorShell.editorDocument; } catch (e) { dump( e + "\n"); }
|
||||
if ( !domdoc )
|
||||
{
|
||||
dump("EditorInitToolbars: EDITOR DOCUMENT NOT FOUND\n");
|
||||
return;
|
||||
}
|
||||
var title = domdoc.title;
|
||||
var titleInput = document.getElementById("PageTitleInput");
|
||||
if (!title) title = "";
|
||||
titleInput.setAttribute("value", title);
|
||||
|
||||
var authorInput = document.getElementById("AuthorInput");
|
||||
if (authorInput)
|
||||
{
|
||||
}
|
||||
// Nothing to do now, but we might want some state updating here
|
||||
}
|
||||
|
||||
function EditorSetDefaultPrefs()
|
||||
@ -1445,13 +1499,23 @@ function EditorInsertOrEditTable(insertAllowed)
|
||||
// Edit properties of existing table
|
||||
dump("Existing table found ... Editing its properties\n");
|
||||
|
||||
window.openDialog("chrome://editor/content/EdTableProps.xul", "_blank", "chrome,close,titlebar,modal", "");
|
||||
window.openDialog("chrome://editor/content/EdTableProps.xul", "_blank", "chrome,close,titlebar,modal", "","TablePanel");
|
||||
contentWindow.focus();
|
||||
} else if(insertAllowed) {
|
||||
EditorInsertTable();
|
||||
}
|
||||
}
|
||||
|
||||
function EditorTableCellProperties()
|
||||
{
|
||||
var cell = editorShell.GetElementOrParentByTagName("td", null);
|
||||
if (cell) {
|
||||
// Start Table Properties dialog on the "Cell" panel
|
||||
window.openDialog("chrome://editor/content/EdTableProps.xul", "_blank", "chrome,close,titlebar,modal", "", "CellPanel");
|
||||
contentWindow.focus();
|
||||
}
|
||||
}
|
||||
|
||||
function EditorSelectTableCell()
|
||||
{
|
||||
editorShell.SelectTableCell();
|
||||
|
@ -28,24 +28,27 @@
|
||||
*/
|
||||
|
||||
a[name] {
|
||||
margin-left: 2px;
|
||||
/* TEMPORARY TO COMPENSATE FOR BUG */
|
||||
padding-left: 16px;
|
||||
padding-left: 13px;
|
||||
background: url(chrome://editor/skin/images/anchor-in-doc.gif) no-repeat;
|
||||
background-position: center center;
|
||||
background-position: center left;
|
||||
}
|
||||
|
||||
div {
|
||||
margin-left: 2px;
|
||||
/* TEMPORARY TO COMPENSATE FOR BUG */
|
||||
padding-left: 16px;
|
||||
padding-left: 13px;
|
||||
background: url(chrome://editor/skin/images/div.gif) no-repeat;
|
||||
/* background-position: center center; */
|
||||
background-position: center left;
|
||||
}
|
||||
|
||||
span {
|
||||
margin-left: 2px;
|
||||
/* TEMPORARY TO COMPENSATE FOR BUG */
|
||||
padding-left: 16px;
|
||||
padding-left: 13px;
|
||||
background: url(chrome://editor/skin/images/span.gif) no-repeat;
|
||||
/* background-position: center center; */
|
||||
background-position: center left;
|
||||
}
|
||||
|
||||
table {
|
||||
|
@ -81,7 +81,6 @@
|
||||
<menupopup id="menu_View_Popup">
|
||||
<menu id="viewToolbar"/>
|
||||
<menuseparator/>
|
||||
<!-- item with "disable=true" will be hidden -->
|
||||
<menuitem id="ShowExtraMarkup" value="&showExtraMarkup.label;" accesskey="&extraMarkup.accesskey;" oncommand="EditorSetDisplayStyle(0)" hidden="true"/>
|
||||
<menuitem id="HideExtraMarkup" value="&hideExtraMarkup.label;" accesskey="&extraMarkup.accesskey;" oncommand="EditorSetDisplayStyle(1)"/>
|
||||
<menuitem id="viewSourceMenuitem"/>
|
||||
@ -145,22 +144,6 @@
|
||||
</titledbutton>
|
||||
</box>
|
||||
</toolbar>
|
||||
|
||||
<toolbar id="TitleToolbar" persist="collapsed">
|
||||
<box align="vertical">
|
||||
<spring flex="1"/>
|
||||
<html:label>Title:</html:label>
|
||||
<spring flex="1"/>
|
||||
</box>
|
||||
<html:input type="text" id="PageTitleInput" flex="70%"/>
|
||||
<box align="vertical">
|
||||
<spring flex="3"/>
|
||||
<html:label>Author:</html:label>
|
||||
<spring flex="2"/>
|
||||
</box>
|
||||
<html:input type="text" id="PageAuthorInput" flex="30%"/>
|
||||
<spring class="spacer-throbber" flex="5%"/>
|
||||
</toolbar>
|
||||
<toolbar id="FormatToolbar" persist="collapsed">
|
||||
<html:div>
|
||||
<!-- items are filled out from editorOverlay -->
|
||||
|
@ -72,8 +72,8 @@
|
||||
<key id="outdentkb" xulkey="true" key="&formatoutdent.keybinding;" onkeypress="EditorIndent('outdent')" />
|
||||
|
||||
<key id="removestyleskb" shift="true" xulkey="true" key="&formatremovestyles.keybinding;" onkeypress="EditorRemoveStyle('all')" />
|
||||
<key id="decreasefontsizekb" shift="true" xulkey="true" key="&decreaseFontSize.keybinding;" onkeypress="DecreaseFontSize()" />
|
||||
<key id="increasefontsizekb" shift="true" xulkey="true" key="&increaseFontSize.keybinding;" onkeypress="IncreaseFontSize()" />
|
||||
<key id="decreasefontsizekb" shift="true" xulkey="true" key="&decreaseFontSize.keybinding;" onkeypress="EditorDecreaseFontSize()" />
|
||||
<key id="increasefontsizekb" shift="true" xulkey="true" key="&increaseFontSize.keybinding;" onkeypress="EditorIncreaseFontSize()" />
|
||||
|
||||
<!-- how to handle return, enter, tab, function keys, arrow keys, others? saari working on solution -->
|
||||
<!-- scroll document/page/line and move caret -->
|
||||
@ -379,13 +379,16 @@
|
||||
accesskey="&formatsizemenu.accesskey;"
|
||||
position="2">
|
||||
<menupopup>
|
||||
<menuitem value="&size-2Cmd.label;" accesskey="&size-2.accesskey;" oncommand="EditorSetFontSize('-2')"/>
|
||||
<menuitem value="&size-1Cmd.label;" accesskey="&size-1.accesskey;" oncommand="EditorSetFontSize('-1')"/>
|
||||
<menuitem value="&size0Cmd.label;" accesskey="&size0.accesskey;" oncommand="EditorSetFontSize('0')"/>
|
||||
<menuitem value="&size1Cmd.label;" accesskey="&size1.accesskey;" oncommand="EditorSetFontSize('+1')"/>
|
||||
<menuitem value="&size2Cmd.label;" accesskey="&size2.accesskey;" oncommand="EditorSetFontSize('+2')"/>
|
||||
<menuitem value="&size3Cmd.label;" accesskey="&size3.accesskey;" oncommand="EditorSetFontSize('+3')"/>
|
||||
<menuitem value="&size4Cmd.label;" accesskey="&size4.accesskey;" oncommand="EditorSetFontSize('+4')"/>
|
||||
<menuitem value="&decreaseFontSize.label;" accesskey="&decreasefontsize.accesskey;" oncommand="EditorDecreaseFontSize()"/>
|
||||
<menuitem value="&increaseFontSize.label;" accesskey="&increasefontsize.accesskey;" oncommand="EditorIncreaseFontSize()"/>
|
||||
<menuseparator/>
|
||||
<menuitem value="&size-xx-smallCmd.label;" accesskey="&size-xx-small.accesskey;" oncommand="EditorSetFontSize('xx-small')"/>
|
||||
<menuitem value="&size-x-smallCmd.label;" accesskey="&size-x-small.accesskey;" oncommand="EditorSetFontSize('x-small')"/>
|
||||
<menuitem value="&size-smallCmd.label;" accesskey="&size-small.accesskey;" oncommand="EditorSetFontSize('small')"/>
|
||||
<menuitem value="&size-mediumCmd.label;" accesskey="&size-medium.accesskey;" oncommand="EditorSetFontSize('medium')"/>
|
||||
<menuitem value="&size-largeCmd.label;" accesskey="&size-large.accesskey;" oncommand="EditorSetFontSize('large')"/>
|
||||
<menuitem value="&size-x-largeCmd.label;" accesskey="&size-x-large.accesskey;" oncommand="EditorSetFontSize('x-large')"/>
|
||||
<menuitem value="&size-xx-largeCmd.label;" accesskey="&size-xx-large.accesskey;" oncommand="EditorSetFontSize('xx-large')"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
@ -400,7 +403,6 @@
|
||||
<menuitem value="&styleStrikeThruCmd.label;" accesskey="&stylestrikethru.accesskey;" oncommand="EditorApplyStyle('strike')"/>
|
||||
<menuitem value="&styleSuperscriptCmd.label;" accesskey="&stylesuperscript.accesskey;" oncommand="EditorApplyStyle('sup')"/>
|
||||
<menuitem value="&styleSubscriptCmd.label;" accesskey="&stylesubscript.accesskey;" oncommand="EditorApplyStyle('sub')"/>
|
||||
<menuitem value="&styleBlinkCmd.label;" accesskey="&styleblink.accesskey;" oncommand="EditorApplyStyle('blink')"/>
|
||||
<menuitem value="&styleNonbreakingCmd.label;" accesskey="&stylenonbreaking.accesskey;" oncommand="EditorApplyStyle('nobr')"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
@ -580,16 +582,16 @@
|
||||
</menu>
|
||||
|
||||
<popup id="TextColorPopup" popupanchor="bottomleft">
|
||||
<html:div id="TextColorCaption" class="color-caption" align="center">&textColorCaption.label;</html:div>
|
||||
<titledbutton id="TextColorCaption" class="color-caption" value="&textColorCaption.label;" flex="1"/>
|
||||
<!-- TODO: Add "Last color picked" button and text -->
|
||||
<colorpicker id="TextColorPicker" palettename="standard" onclick="EditorSelectTextColor('TextColorPicker','TextColorPopupButton'); parentNode.closePopup();"/>
|
||||
<titledbutton class="push" value="&formatToolbar.colorPicker.default.label;" onclick="EditorRemoveTextColor('TextColorPopupButton'); parentNode.closePopup();"/>
|
||||
</popup>
|
||||
|
||||
<popup id="BackColorPopup" popupanchor="bottomleft">
|
||||
<!-- Text Caption is filled in at runtime -->
|
||||
<popup id="BackColorPopup" popupanchor="bottomleft" oncreate="InitBackColorPopup()">
|
||||
<!-- Text is filled in at runtime according to what background element will be set -->
|
||||
<titledbutton id="BackColorCaption" class="color-caption" value="Background Color" flex="1"/>
|
||||
<!-- TODO: Add "Last color picked" button and text -->
|
||||
<html:div id="BackColorCaption" class="color-caption" align="center">Background Color</html:div>
|
||||
<colorpicker id="BackColorPicker" palettename="standard" onclick="EditorSelectBackColor('BackColorPicker','BackColorPopupButton'); parentNode.closePopup();"/>
|
||||
<titledbutton class="push" value="&formatToolbar.colorPicker.default.label;" onclick="EditorRemoveBackColor('BackColorPopupButton'); parentNode.closePopup();"/>
|
||||
</popup>
|
||||
@ -674,13 +676,13 @@
|
||||
|
||||
<html:select class="toolbar" id="FontSizeSelect" size="1" onchange="EditorSelectFontSize()">
|
||||
<observes element="Editor:Font:Size" attribute="fontsize" onbroadcast="onFontSizeChange()"/>
|
||||
<html:option>&size-2Cmd.label;</html:option>
|
||||
<html:option>&size-1Cmd.label;</html:option>
|
||||
<html:option>&size0Cmd.label;</html:option>
|
||||
<html:option>&size1Cmd.label;</html:option>
|
||||
<html:option>&size2Cmd.label;</html:option>
|
||||
<html:option>&size3Cmd.label;</html:option>
|
||||
<html:option>&size4Cmd.label;</html:option>
|
||||
<html:option>&size-xx-smallCmd.label;</html:option>
|
||||
<html:option>&size-x-smallCmd.label;</html:option>
|
||||
<html:option>&size-smallCmd.label;</html:option>
|
||||
<html:option>&size-mediumCmd.label;</html:option>
|
||||
<html:option>&size-largeCmd.label;</html:option>
|
||||
<html:option>&size-x-largeCmd.label;</html:option>
|
||||
<html:option>&size-xx-largeCmd.label;</html:option>
|
||||
</html:select>
|
||||
|
||||
<!-- The new Color Picker UI -->
|
||||
@ -719,7 +721,7 @@
|
||||
|
||||
|
||||
<!-- DEBUG only -->
|
||||
<menu id="debugMenu" value="&debugMenu.label;">
|
||||
<menu id="debugMenu" value="&debugMenu.label;" hidden="true">
|
||||
<menupopup>
|
||||
<menuitem value="&newEditorTestPage.label;" oncommand="window.openDialog('chrome://editor/content','_blank','chrome,all,dialog=no','chrome://editor/content/EditorInitPage.html')"/>
|
||||
<menuitem value="&textEditorCmd.label;" oncommand="EditorNewPlaintext();" />
|
||||
|
@ -24,7 +24,6 @@ OpenHTMLFile=Open HTML File
|
||||
SelectImageFile=Select Image File
|
||||
SaveDocument=Save Document
|
||||
SaveDocumentAs=Save Document As
|
||||
LinkImage=Link Image:
|
||||
EditMode=Edit Mode
|
||||
Preview=Preview
|
||||
CorrectSpelling=(correct spelling)
|
||||
@ -44,9 +43,11 @@ SaveFileFailed=Saving file failed!
|
||||
DocumentTitle=Document Title
|
||||
NeedDocTitle=Enter a title for the current page. The title identifies the page in the window title and bookmarks.
|
||||
AttributesFor=Current attributes for:
|
||||
MissingImageError=Please enter or choose an image of type gif, jpg or png.
|
||||
MissingImageError=Please enter or choose an image of type gif, jpg, or png.
|
||||
EmptyHREFError=You must enter or choose a location (URL) to create a new link.
|
||||
LinkText=Link text:
|
||||
LinkImage=Link image:
|
||||
MixedSelection=[Mixed selection]
|
||||
EnterLinkText=Enter text to display for the link:
|
||||
EmptyLinkTextError=You must enter some text for this link.
|
||||
#Don't translate: %n% %min% %max%
|
||||
@ -73,8 +74,9 @@ untitled=untitled
|
||||
NoNamedAnchors=(No named anchors in this page)
|
||||
NoHeadings=(No headings without anchors)
|
||||
PageBackColor=Page Background Color
|
||||
CallBackColor=Cell Background Color
|
||||
CellBackColor=Cell Background Color
|
||||
TableBackColor=Table Background Color
|
||||
LastPickedColor=Last picked color
|
||||
Table=Table
|
||||
TableCell=Table Cell
|
||||
HLine=H.Line
|
||||
|
@ -259,24 +259,29 @@
|
||||
<!ENTITY fontcourier.accesskey "c">
|
||||
|
||||
<!-- Font Size SubMenu -->
|
||||
<!ENTITY decreaseFontSize.label "Decrease">
|
||||
<!ENTITY decreasefontsize.accesskey "d">
|
||||
<!ENTITY decreaseFontSize.keybinding "[">
|
||||
<!ENTITY increaseFontSize.label "Increase">
|
||||
<!ENTITY increasefontsize.accesskey "i">
|
||||
<!ENTITY increaseFontSize.keybinding "]">
|
||||
|
||||
<!ENTITY fontsizeMenu.label "Size">
|
||||
<!ENTITY formatsizemenu.accesskey "s">
|
||||
<!ENTITY size-2Cmd.label " -2">
|
||||
<!ENTITY size-2.accesskey "-">
|
||||
<!ENTITY size-1Cmd.label " -1">
|
||||
<!ENTITY size-1.accesskey "s">
|
||||
<!ENTITY size0Cmd.label " 0">
|
||||
<!ENTITY size0.accesskey "n">
|
||||
<!ENTITY size1Cmd.label " +1">
|
||||
<!ENTITY size1.accesskey "1">
|
||||
<!ENTITY size2Cmd.label " +2">
|
||||
<!ENTITY size2.accesskey "2">
|
||||
<!ENTITY size3Cmd.label " +3">
|
||||
<!ENTITY size3.accesskey "3">
|
||||
<!ENTITY size4Cmd.label " +4">
|
||||
<!ENTITY size4.accesskey "4">
|
||||
<!ENTITY increaseFontSize.keybinding "]">
|
||||
<!ENTITY decreaseFontSize.keybinding "[">
|
||||
<!ENTITY size-xx-smallCmd.label "xx-small">
|
||||
<!ENTITY size-xx-small.accesskey "a">
|
||||
<!ENTITY size-x-smallCmd.label "x-small">
|
||||
<!ENTITY size-x-small.accesskey "m">
|
||||
<!ENTITY size-smallCmd.label "small">
|
||||
<!ENTITY size-small.accesskey "s">
|
||||
<!ENTITY size-mediumCmd.label "medium">
|
||||
<!ENTITY size-medium.accesskey "m">
|
||||
<!ENTITY size-largeCmd.label "large">
|
||||
<!ENTITY size-large.accesskey "l">
|
||||
<!ENTITY size-x-largeCmd.label "x-large">
|
||||
<!ENTITY size-x-large.accesskey "r">
|
||||
<!ENTITY size-xx-largeCmd.label "xx-large">
|
||||
<!ENTITY size-xx-large.accesskey "e">
|
||||
|
||||
<!-- Font Style SubMenu -->
|
||||
<!ENTITY fontStyleMenu.label "Style">
|
||||
@ -296,8 +301,6 @@
|
||||
<!ENTITY stylesuperscript.accesskey "p">
|
||||
<!ENTITY styleSubscriptCmd.label "Subscript">
|
||||
<!ENTITY stylesubscript.accesskey "s">
|
||||
<!ENTITY styleBlinkCmd.label "Blink">
|
||||
<!ENTITY styleblink.accesskey "l">
|
||||
<!ENTITY styleNonbreakingCmd.label "Nonbreaking">
|
||||
<!ENTITY stylenonbreaking.accesskey "n">
|
||||
|
||||
|
@ -33,7 +33,7 @@ toolbox#EditorToolbox {
|
||||
min-width: 1px;
|
||||
}
|
||||
|
||||
toolbar#FormatToolbar, toolbar#TitleToolbar {
|
||||
toolbar#FormatToolbar {
|
||||
border-bottom: 1px solid #003366;
|
||||
}
|
||||
|
||||
@ -167,11 +167,6 @@ box#DisplayModeBar div.VerticalSeparator {
|
||||
margin: 1px 0px;
|
||||
}
|
||||
|
||||
/* SHOULD BE IN GLOBAL.CSS */
|
||||
menuitem[hidden="true"] {
|
||||
visibility: collapse;
|
||||
}
|
||||
|
||||
spring.spacer3 {
|
||||
width: 3px;
|
||||
height: 3px;
|
||||
@ -294,7 +289,7 @@ titledbutton#InsertPopupButton {
|
||||
list-style-image:url("chrome://editor/skin/images/object-popup.gif");
|
||||
}
|
||||
|
||||
div.color-caption {
|
||||
text.color-caption {
|
||||
border: 1px inset white;
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,51 @@
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
/*
|
||||
Behavior notes:
|
||||
Radio buttons select "UseDefaultColors" vs. "UseCustomColors" modes.
|
||||
If any color attribute is set in the body, mode is "Custom Colors",
|
||||
even if 1 or more (but not all) are actually null (= "use default")
|
||||
When in "Custom Colors" mode, all colors will be set on body tag,
|
||||
even if they are just default colors, to assure compatable colors in page.
|
||||
User cannot select "use default" for individual colors
|
||||
When in UseDefaultColors mode, the color buttons can be used,
|
||||
Instead of disabling using color buttons while in UseDefault mode,
|
||||
and we switch to UseCustom mode automatically
|
||||
This let's user start with default palette as starting point for
|
||||
really setting colors
|
||||
(2_13 Can't disable color buttons anyway!)
|
||||
*/
|
||||
|
||||
//Cancel() is in EdDialogCommon.js
|
||||
|
||||
var BodyElement;
|
||||
var prefs;
|
||||
var lastSetBackgroundImage;
|
||||
|
||||
// Initialize in case we can't get them from prefs???
|
||||
var defaultTextColor="#000000";
|
||||
var defaultLinkColor="#000099";
|
||||
var defaultVisitedLinkColor="#990099";
|
||||
var defaultBackgroundColor="#FFFFFF";
|
||||
|
||||
// Save
|
||||
var customTextColor;
|
||||
var customLinkColor;
|
||||
var customVisitedColor;
|
||||
var customActiveColor;
|
||||
var customBackgroundColor;
|
||||
|
||||
// Strings we use often
|
||||
var styleStr = "style";
|
||||
var textStr = "text";
|
||||
var linkStr = "link";
|
||||
var vlinkStr = "vlink";
|
||||
var alinkStr = "alink";
|
||||
var bgcolorStr = "bgcolor";
|
||||
var backgroundStr = "background";
|
||||
var colorStyle = "color:"
|
||||
|
||||
// dialog initialization code
|
||||
function Startup()
|
||||
{
|
||||
@ -38,62 +82,268 @@ function Startup()
|
||||
dialog.NormalText = document.getElementById("NormalText");
|
||||
dialog.LinkText = document.getElementById("LinkText");
|
||||
dialog.ActiveLinkText = document.getElementById("ActiveLinkText");
|
||||
dialog.FollowedLinkText = document.getElementById("FollowedLinkText");
|
||||
dialog.VisitedLinkText = document.getElementById("VisitedLinkText");
|
||||
dialog.DefaultColorsRadio = document.getElementById("DefaultColorsRadio");
|
||||
dialog.CustomColorsRadio = document.getElementById("CustomColorsRadio");
|
||||
dialog.BackgroundImageCheckbox = document.getElementById("BackgroundImageCheckbox");
|
||||
dialog.BackgroundImageInput = document.getElementById("BackgroundImageInput");
|
||||
|
||||
BodyElement = editorShell.editorDocument.body;
|
||||
if (!BodyElement)
|
||||
{
|
||||
dump("Failed to get BODY element!\n");
|
||||
window.close();
|
||||
}
|
||||
dump(BodyElement+"\n");
|
||||
|
||||
// Set element we will edit
|
||||
globalElement = BodyElement.cloneNode(false);
|
||||
|
||||
doSetOKCancel(onOK, null);
|
||||
|
||||
// Initialize default colors from browser prefs
|
||||
prefs = GetPrefs();
|
||||
if (prefs)
|
||||
{
|
||||
dump("Getting browser prefs...\n");
|
||||
|
||||
// This doesn't necessarily match what appears in the page
|
||||
// It is complicated by browser.use_document_colors
|
||||
// TODO: WE MUST FORCE WINDOW TO USE DOCUMENT COLORS!!!
|
||||
// How do we do that without changing browser prefs?
|
||||
var useDocumentColors = prefs.GetBoolPref("browser.use_document_colors");
|
||||
dump("browser.use_document_colors = "+ useDocumentColors+"\n");
|
||||
if (useDocumentColors)
|
||||
{
|
||||
// How do I get current colors as show in page?
|
||||
} else {
|
||||
// Use author's browser pref colors
|
||||
defaultTextColor = prefs.CopyCharPref("browser.foreground_color");
|
||||
defaultLinkColor = prefs.CopyCharPref("browser.anchor_color");
|
||||
// Note: Browser doesn't store a value for ActiveLinkColor
|
||||
defaultVisitedLinkColor = prefs.CopyCharPref("browser.visited_color");
|
||||
defaultBackgroundColor= prefs.CopyCharPref("browser.background_color");
|
||||
}
|
||||
// Get the last-set background image
|
||||
lastSetBackgroundImage = prefs.CopyCharPref("editor.default_background_image");
|
||||
}
|
||||
InitDialog();
|
||||
|
||||
//.focus();
|
||||
if (dialog.DefaultColorsRadio.checked)
|
||||
dialog.DefaultColorsRadio.focus();
|
||||
else
|
||||
dialog.CustomColorsRadio.focus();
|
||||
}
|
||||
|
||||
function InitDialog()
|
||||
{
|
||||
SetColor("textCW", globalElement.getAttribute(textStr));
|
||||
SetColor("linkCW", globalElement.getAttribute(linkStr));
|
||||
SetColor("visitedCW", globalElement.getAttribute(vlinkStr));
|
||||
SetColor("activeCW", globalElement.getAttribute(alinkStr));
|
||||
SetColor("backgroundCW", globalElement.getAttribute(bgcolorStr));
|
||||
|
||||
if (dialog.textColor ||
|
||||
dialog.linkColor ||
|
||||
dialog.visitedLinkColor ||
|
||||
dialog.activeLinkColor ||
|
||||
dialog.backgroundColor)
|
||||
{
|
||||
// If any colors are set, then check the "Custom" radio button
|
||||
dialog.CustomColorsRadio.checked = true;
|
||||
} else {
|
||||
dialog.DefaultColorsRadio.checked = true;
|
||||
}
|
||||
|
||||
// Save a copy to use when switching from UseDefault to UseCustom
|
||||
SaveCustomColors();
|
||||
|
||||
// Get image from document
|
||||
dialog.BackgroundImage = globalElement.getAttribute(backgroundStr);
|
||||
|
||||
if (dialog.BackgroundImage)
|
||||
dialog.BackgroundImageCheckbox.checked = true;
|
||||
else
|
||||
// See if we saved an image from previous dialog usage
|
||||
dialog.BackgroundImage = lastSetBackgroundImage;
|
||||
|
||||
if (dialog.BackgroundImage)
|
||||
{
|
||||
dialog.BackgroundImageInput.value = dialog.BackgroundImage;
|
||||
dialog.ColorPreview.setAttribute(backgroundStr, dialog.BackgroundImage);
|
||||
}
|
||||
}
|
||||
|
||||
function GetColor(ColorPickerID, ColorWellID)
|
||||
function SetColor(ColorWellID, color)
|
||||
{
|
||||
var color = getColorAndSetColorWell(ColorPickerID, ColorWellID);
|
||||
dump("GetColor, color="+color+"\n");
|
||||
if (!color)
|
||||
switch( ColorWellID )
|
||||
{
|
||||
// No color was clicked on,
|
||||
// so user clicked on "Don't Specify Color" button
|
||||
color = "inherit";
|
||||
dump("Don't specify color\n");
|
||||
}
|
||||
var colorString = "color:"+color;
|
||||
switch( ColorPickerID )
|
||||
{
|
||||
case "textCP":
|
||||
case "textCW":
|
||||
if (!color) color = defaultTextColor;
|
||||
dialog.textColor = color;
|
||||
dialog.NormalText.setAttribute("style",colorString);
|
||||
dialog.NormalText.setAttribute(styleStr,colorStyle+color);
|
||||
break;
|
||||
case "linkCP":
|
||||
case "linkCW":
|
||||
if (!color) color = defaultLinkColor;
|
||||
dialog.linkColor = color;
|
||||
dialog.LinkText.setAttribute("style",colorString);
|
||||
dialog.LinkText.setAttribute(styleStr,colorStyle+color);
|
||||
break;
|
||||
case "followedCP":
|
||||
dialog.followedLinkColor = color;
|
||||
dialog.FollowedLinkText.setAttribute("style",colorString);
|
||||
break;
|
||||
case "activeCP":
|
||||
case "activeCW":
|
||||
if (!color) color = defaultLinkColor;
|
||||
dialog.activeLinkColor = color;
|
||||
dialog.ActiveLinkText.setAttribute("style",colorString);
|
||||
dialog.ActiveLinkText.setAttribute(styleStr,colorStyle+color);
|
||||
break;
|
||||
case "backgroundCP":
|
||||
case "visitedCW":
|
||||
if (!color) color = defaultVisitedLinkColor;
|
||||
dialog.visitedLinkColor = color;
|
||||
dialog.VisitedLinkText.setAttribute(styleStr,colorStyle+color);
|
||||
break;
|
||||
case "backgroundCW":
|
||||
if (!color) color = defaultBackgroundColor;
|
||||
dialog.backgroundColor = color;
|
||||
dialog.ColorPreview.setAttribute("bgcolor",color);
|
||||
dialog.ColorPreview.setAttribute(bgcolorStr,color);
|
||||
break;
|
||||
}
|
||||
setColorWell(ColorWellID, color);
|
||||
}
|
||||
|
||||
function GetColorAndUpdate(ColorPickerID, ColorWellID, widget)
|
||||
{
|
||||
// Close the colorpicker
|
||||
widget.parentNode.closePopup();
|
||||
SetColor(ColorWellID, getColor(ColorPickerID));
|
||||
|
||||
// Setting a color automatically changes into UseCustomColors mode
|
||||
dialog.CustomColorsRadio.checked = true;
|
||||
}
|
||||
|
||||
function SaveCustomColors()
|
||||
{
|
||||
customTextColor = dialog.textColor;
|
||||
customLinkColor = dialog.linkColor;
|
||||
customVisitedColor = dialog.visitedLinkColor;
|
||||
customActiveColor = dialog.activeLinkColor;
|
||||
customBackgroundColor = dialog.backgroundColor;
|
||||
}
|
||||
|
||||
function UseCustomColors()
|
||||
{
|
||||
// Restore from saved colors
|
||||
SetColor("textCW", customTextColor);
|
||||
SetColor("linkCW", customLinkColor);
|
||||
SetColor("activeCW", customActiveColor);
|
||||
SetColor("visitedCW", customVisitedColor);
|
||||
SetColor("backgroundCW", customBackgroundColor);
|
||||
}
|
||||
|
||||
function UseDefaultColors()
|
||||
{
|
||||
dump("UseDefaultColors\n");
|
||||
// Save colors to use when switching back to UseCustomColors
|
||||
SaveCustomColors();
|
||||
|
||||
SetColor("textCW", defaultTextColor);
|
||||
SetColor("linkCW", defaultLinkColor);
|
||||
SetColor("activeCW", defaultLinkColor); //Browser doesn't store this separately
|
||||
SetColor("visitedCW", defaultVisitedLinkColor);
|
||||
SetColor("backgroundCW", defaultBackgroundColor);
|
||||
}
|
||||
|
||||
|
||||
function onBackgroundImageCheckbox()
|
||||
{
|
||||
if (dialog.BackgroundImageCheckbox.checked)
|
||||
{
|
||||
if (ValidateImage())
|
||||
dialog.ColorPreview.setAttribute(backgroundStr, dialog.BackgroundImage);
|
||||
} else {
|
||||
dialog.ColorPreview.removeAttribute(backgroundStr);
|
||||
}
|
||||
}
|
||||
|
||||
function RemoveColor(ColorWellID)
|
||||
function chooseFile()
|
||||
{
|
||||
// Get a local file, converted into URL format
|
||||
fileName = editorShell.GetLocalFileURL(window, "img");
|
||||
if (fileName && fileName != "")
|
||||
{
|
||||
dialog.BackgroundImage = fileName;
|
||||
dialog.BackgroundImageInput.value = fileName;
|
||||
dialog.BackgroundImageCheckbox.checked = true;
|
||||
dialog.ColorPreview.setAttribute(backgroundStr, fileName);
|
||||
}
|
||||
|
||||
// Put focus into the input field
|
||||
dialog.BackgroundImageInput.focus();
|
||||
}
|
||||
|
||||
function ValidateImage()
|
||||
{
|
||||
var image = dialog.BackgroundImageInput.value.trimString();
|
||||
if (image && image != "")
|
||||
{
|
||||
if (IsValidImage(image))
|
||||
{
|
||||
dialog.BackgroundImage = image;
|
||||
return true;
|
||||
} else {
|
||||
dialog.BackgroundImage = null;
|
||||
dialog.BackgroundImageInput.focus();
|
||||
ShowInputErrorMessage(GetString("MissingImageError"));
|
||||
}
|
||||
}
|
||||
// Don't allow checkbox if bad or no image
|
||||
dialog.BackgroundImageCheckbox.checked = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
function ValidateData()
|
||||
{
|
||||
// Colors values are updated as they are picked, no validation necessary
|
||||
if (dialog.DefaultColorsRadio.checked)
|
||||
{
|
||||
globalElement.removeAttribute(textStr);
|
||||
globalElement.removeAttribute(linkStr);
|
||||
globalElement.removeAttribute(vlinkStr);
|
||||
globalElement.removeAttribute(alinkStr);
|
||||
globalElement.removeAttribute(bgcolorStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
globalElement.setAttribute(textStr, dialog.textColor);
|
||||
globalElement.setAttribute(linkStr, dialog.linkColor);
|
||||
globalElement.setAttribute(vlinkStr, dialog.visitedLinkColor);
|
||||
globalElement.setAttribute(alinkStr, dialog.activeLinkColor);
|
||||
globalElement.setAttribute(bgcolorStr, dialog.backgroundColor);
|
||||
}
|
||||
if (dialog.BackgroundImageCheckbox.checked)
|
||||
{
|
||||
if (!ValidateImage())
|
||||
return false;
|
||||
|
||||
globalElement.setAttribute(backgroundStr, dialog.BackgroundImage);
|
||||
|
||||
} else {
|
||||
globalElement.removeAttribute(backgroundStr);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function onOK()
|
||||
{
|
||||
if (ValidateData())
|
||||
{
|
||||
// Save image for future editing
|
||||
if (prefs && dialog.BackgroundImage)
|
||||
{
|
||||
dump("Saving default background image in prefs\n");
|
||||
prefs.SetCharPref("editor.default_background_image", dialog.BackgroundImage);
|
||||
}
|
||||
|
||||
return true; // do close the window
|
||||
// Copy attributes to element we are changing
|
||||
editorShell.CloneAttributes(BodyElement, globalElement);
|
||||
return true; // do close the window
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -37,21 +37,24 @@
|
||||
align="vertical">
|
||||
|
||||
<html:script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js"/>
|
||||
<html:script language="JavaScript" src="chrome://editor/content/EdPageProps.js"/>
|
||||
<html:script language="JavaScript" src="chrome://editor/content/EdColorProps.js"/>
|
||||
<html:script language="JavaScript" src="chrome://global/content/dialogOverlay.js" />
|
||||
|
||||
<broadcaster id="args" value=""/>
|
||||
|
||||
<html:label>&pageColors.label;</html:label>
|
||||
<box align="horizontal" class="margin-left-right">
|
||||
<box class="margin-left-right">
|
||||
<!-- must use div else box stretches radio button size -->
|
||||
<html:div><html:input type="radio" name="ColorMode" id="DefaultColorsRadio"/></html:div>
|
||||
<html:div><html:input type="radio" name="ColorMode" id="DefaultColorsRadio" onclick="UseDefaultColors()"/></html:div>
|
||||
<html:label for="DefaultColorsRadio">&defaultColorsRadio.label;</html:label>
|
||||
</box>
|
||||
<box align="horizontal" class="margin-left-right">
|
||||
<html:div><html:input type="radio" name="ColorMode" id="CustomColorsRadio"/></html:div>
|
||||
<box class="margin-left-right">
|
||||
<html:div><html:input type="radio" name="ColorMode" id="CustomColorsRadio" onclick="UseCustomColors()"/></html:div>
|
||||
<html:label for="CustomColorsRadio">&customColorsRadio.label;</html:label>
|
||||
</box>
|
||||
<spring class="bigspacer"/>
|
||||
|
||||
<!-- DON'T SHOW COLOR SCHEMES UNTIL REDESIGNED
|
||||
<html:div>
|
||||
<box flex="1">
|
||||
<html:label for="ColorScheme"> &colorScheme.label;</html:label>
|
||||
@ -62,100 +65,99 @@
|
||||
<html:option> White on Black </html:option>
|
||||
</html:select>
|
||||
</box>
|
||||
<!-- TODO: COLOR SCHEME SELECT LIST -->
|
||||
</html:div>
|
||||
<spring class="bigspacer"/>
|
||||
<box align="horizontal">
|
||||
-->
|
||||
|
||||
<box>
|
||||
<spring class="bigspacer"/>
|
||||
<box align="vertical" flex="100%">
|
||||
<box align="vertical" flex="1">
|
||||
<box>
|
||||
<html:label class="margin-left-right"> &normalText.label; </html:label>
|
||||
<spring flex="100%"/>
|
||||
<spring flex="1"/>
|
||||
<menu class="colorpicker">
|
||||
<html:div id="textCW" class="color-well"/>
|
||||
<titledbutton class="popup" align="right" flex="100%" onclick="GetColor('textCP','textCW');"/>
|
||||
<titledbutton class="popup" align="right" flex="1" onclick="GetColorAndUpdate('textCP','textCW',this);"/>
|
||||
<menupopup id="normalMenuPopup">
|
||||
<colorpicker id="textCP" palettename="standard" onclick="GetColor('textCP','textCW');"/>
|
||||
<titledbutton class="push" value="&colorPicker.default.label;" onclick="GetColor('textCP','textCW');"/>
|
||||
<colorpicker id="textCP" palettename="standard" onclick="GetColorAndUpdate('textCP','textCW',this);"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box>
|
||||
<html:label class="margin-left-right"> &linkText.label; </html:label>
|
||||
<spring flex="100%"/>
|
||||
<spring flex="1"/>
|
||||
<menu class="colorpicker">
|
||||
<html:div id="linkCW" class="color-well"/>
|
||||
<titledbutton class="popup" align="right" flex="100%"/>
|
||||
<titledbutton class="popup" align="right" flex="1"/>
|
||||
<menupopup>
|
||||
<colorpicker id="linkCP" palettename="standard" onclick="GetColor('linkCP','linkCW');"/>
|
||||
<titledbutton class="push" value="&colorPicker.default.label;" onclick="RemoveColor('linkCW');"/>
|
||||
<colorpicker id="linkCP" palettename="standard" onclick="GetColorAndUpdate('linkCP','linkCW',this);"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box>
|
||||
<html:label class="margin-left-right"> &activeLinkText.label; </html:label>
|
||||
<spring flex="100%"/>
|
||||
<spring flex="1"/>
|
||||
<menu class="colorpicker">
|
||||
<html:div id="activeCW" class="color-well"/>
|
||||
<titledbutton class="popup" align="right" flex="100%"/>
|
||||
<titledbutton class="popup" align="right" flex="1"/>
|
||||
<menupopup>
|
||||
<colorpicker id="activeCP" palettename="standard" onclick="GetColor('activeCP','activeCW');"/>
|
||||
<titledbutton class="push" value="&colorPicker.default.label;" onclick="RemoveColor('activeCW');"/>
|
||||
<colorpicker id="activeCP" palettename="standard" onclick="GetColorAndUpdate('activeCP','activeCW',this);"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box>
|
||||
<html:label class="margin-left-right"> &followedLinkText.label; </html:label>
|
||||
<spring flex="100%"/>
|
||||
<html:label class="margin-left-right"> &visitedLinkText.label; </html:label>
|
||||
<spring flex="1"/>
|
||||
<menu class="colorpicker">
|
||||
<html:div id="followedCW" class="color-well"/>
|
||||
<titledbutton class="popup" align="right" flex="100%"/>
|
||||
<html:div id="visitedCW" class="color-well"/>
|
||||
<titledbutton class="popup" align="right" flex="1"/>
|
||||
<menupopup>
|
||||
<colorpicker id="followedCP" palettename="standard" onclick="GetColor('followedCP','followedCW');"/>
|
||||
<titledbutton class="push" value="&colorPicker.default.label;" onclick="RemoveColor('followedCW');"/>
|
||||
<colorpicker id="visitedCP" palettename="standard" onclick="GetColorAndUpdate('visitedCP','visitedCW',this);"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box>
|
||||
<html:label class="margin-left-right"> &background.label; </html:label>
|
||||
<spring flex="100%"/>
|
||||
<spring flex="1"/>
|
||||
<menu class="colorpicker">
|
||||
<html:div id="backgroundCW" class="color-well"/>
|
||||
<titledbutton class="popup" align="right" flex="100%"/>
|
||||
<titledbutton class="popup" align="right" flex="1"/>
|
||||
<menupopup>
|
||||
<colorpicker id="backgroundCP" palettename="standard" onclick="GetColor('backgroundCP','backgroundCW');"/>
|
||||
<titledbutton class="push" value="&colorPicker.default.label;" onclick="RemoveColor('backgroundCW');"/>
|
||||
<colorpicker id="backgroundCP" palettename="standard" onclick="GetColorAndUpdate('backgroundCP','backgroundCW',this);"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</box>
|
||||
</box>
|
||||
<spring class="bigspacer"/>
|
||||
<box align="vertical" flex="100%" id="ColorPreview">
|
||||
<!-- basestyle="min-height:50px; width: 100%; border: 1px inset #CCCCCC; padding: 5px; " style="min-height:50px; width: 100%; border: 1px inset #CCCCCC; padding: 5px; "-->
|
||||
<html:div id="NormalText">&normalText.label;</html:div>
|
||||
<spring class="spacer"/>
|
||||
<html:div id="LinkText">&linkText.label;</html:div>
|
||||
<spring class="spacer"/>
|
||||
<html:div id="ActiveLinkText">&activeLinkText.label;</html:div>
|
||||
<spring class="spacer"/>
|
||||
<html:div id="FollowedLinkText">&followedLinkText.label;</html:div>
|
||||
</box>
|
||||
<!-- Use table cell for preview so we can use BGCOLOR and BACKGROUND attributes -->
|
||||
<html:table><html:tr>
|
||||
<html:td id="ColorPreview" valign="top">
|
||||
<html:div id="NormalText">&normalText.label;</html:div>
|
||||
<html:div id="LinkText">&linkText.label;</html:div>
|
||||
<html:div id="ActiveLinkText">&activeLinkText.label;</html:div>
|
||||
<html:div id="VisitedLinkText">&visitedLinkText.label;</html:div>
|
||||
</html:td>
|
||||
</html:tr></html:table>
|
||||
</box>
|
||||
<html:div class="separator" align="horizontal"/>
|
||||
<box align="horizontal">
|
||||
<html:div><html:input type="checkbox" id="BackgroundImageCheckbox"/></html:div>
|
||||
<box>
|
||||
<html:div><html:input type="checkbox" id="BackgroundImageCheckbox" onclick="onBackgroundImageCheckbox()"/></html:div>
|
||||
<html:label for="BackgroundImageCheckbox"> &backgroundImage.label; </html:label>
|
||||
</box>
|
||||
<box align="horizontal">
|
||||
<box>
|
||||
<html:input type="text" class="SizeToParent" id="BackgroundImageInput" flex="1"/>
|
||||
<spring class="spacer"/>
|
||||
<!-- from EdDialogOverlay.xul -->
|
||||
<titledbutton id="ChooseFile"/>
|
||||
</box>
|
||||
<box>
|
||||
<html:div id="SaveImageMsg">&saveImageMsg.label;</html:div>
|
||||
<spring class="bigspacer"/>
|
||||
<spring flex="1"/>
|
||||
<box align="vertical">
|
||||
<spring class="bigspacer"/>
|
||||
<titledbutton id="AdvancedEditButton2"/>
|
||||
</box>
|
||||
</box>
|
||||
<html:div class="separator" align="horizontal"/>
|
||||
<box id="okCancelButtons"/>
|
||||
</window>
|
||||
|
@ -29,6 +29,9 @@ var SelectionOnly = 1;
|
||||
var FormatedWithDoctype = 2;
|
||||
var FormatedWithoutDoctype = 6;
|
||||
var maxPixels = 10000;
|
||||
// For dialogs that expand in size. Default is smaller size see "onMoreFewer()" below
|
||||
var SeeMore = false;
|
||||
|
||||
// The element being edited - so AdvancedEdit can have access to it
|
||||
var globalElement;
|
||||
|
||||
@ -270,7 +273,7 @@ function GetAppropriatePercentString()
|
||||
{
|
||||
var selection = window.editorShell.editorSelection;
|
||||
if (selection) {
|
||||
if (editorShell.GetElementOrParentByTagName("td",selection.focusNode))
|
||||
if (editorShell.GetElementOrParentByTagName("td",selection.anchorNode))
|
||||
return GetString("PercentOfCell");
|
||||
}
|
||||
return GetString("PercentOfWindow");
|
||||
@ -464,22 +467,126 @@ function getContainer ()
|
||||
return null;
|
||||
}
|
||||
|
||||
function getColorAndSetColorWell(ColorPickerID, ColorWellID)
|
||||
function getColor(ColorPickerID)
|
||||
{
|
||||
var colorWell = document.getElementById(ColorWellID);
|
||||
var colorPicker = document.getElementById(ColorPickerID);
|
||||
var color;
|
||||
if (colorPicker)
|
||||
{
|
||||
// Extract color from colorPicker and assign to colorWell.
|
||||
var color = colorPicker.getAttribute('color');
|
||||
dump("setColor to: "+color+"\n");
|
||||
|
||||
if (colorWell)
|
||||
{
|
||||
// Use setAttribute so colorwell can be a XUL element, such as titledbutton
|
||||
colorWell.setAttribute("style", "background-color: " + color);
|
||||
}
|
||||
color = colorPicker.getAttribute('color');
|
||||
if (color && color == "")
|
||||
return null;
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
function setColorWell(ColorWellID, color)
|
||||
{
|
||||
var colorWell = document.getElementById(ColorWellID);
|
||||
if (colorWell)
|
||||
{
|
||||
if (!color || color == "")
|
||||
{
|
||||
// Don't set color (use default)
|
||||
// Trigger change to not show color swatch
|
||||
colorWell.setAttribute("default","true");
|
||||
}
|
||||
else
|
||||
{
|
||||
colorWell.removeAttribute("default");
|
||||
// Use setAttribute so colorwell can be a XUL element, such as titledbutton
|
||||
colorWell.setAttribute("style", "background-color:"+color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getColorAndSetColorWell(ColorPickerID, ColorWellID)
|
||||
{
|
||||
var color = getColor(ColorPickerID);
|
||||
setColorWell(ColorWellID, color);
|
||||
return color;
|
||||
}
|
||||
|
||||
// Test for valid image by sniffing out the extension
|
||||
function IsValidImage(imageName)
|
||||
{
|
||||
image = imageName.trimString();
|
||||
if ( !image )
|
||||
return false;
|
||||
|
||||
/* look for an extension */
|
||||
var tailindex = image.lastIndexOf(".");
|
||||
if ( tailindex == 0 || tailindex == -1 ) /* -1 is not found */
|
||||
return false;
|
||||
|
||||
/* move past period, get the substring from the first character after the '.' to the last character (length) */
|
||||
tailindex = tailindex + 1;
|
||||
var type = image.substring(tailindex,image.length);
|
||||
|
||||
/* convert extension to lower case */
|
||||
if (type)
|
||||
type = type.toLowerCase();
|
||||
|
||||
// TODO: Will we convert .BMPs to a web format?
|
||||
switch( type ) {
|
||||
case "gif":
|
||||
case "jpg":
|
||||
case "jpeg":
|
||||
case "png":
|
||||
return true;
|
||||
break;
|
||||
default :
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function InitMoreFewer()
|
||||
{
|
||||
// Set SeeMore bool to the OPPOSITE of the current state,
|
||||
// which is automatically saved by using the 'persist="more"'
|
||||
// attribute on the dialog.MoreFewerButton button
|
||||
// onMoreFewer will toggle it and redraw the dialog
|
||||
SeeMore = (dialog.MoreFewerButton.getAttribute("more") != "1");
|
||||
onMoreFewer();
|
||||
}
|
||||
|
||||
function onMoreFewer()
|
||||
{
|
||||
if (SeeMore)
|
||||
{
|
||||
dialog.MoreSection.setAttribute("style","display: none");
|
||||
window.sizeToContent();
|
||||
dialog.MoreFewerButton.setAttribute("more","0");
|
||||
dialog.MoreFewerButton.setAttribute("value",GetString("MoreProperties"));
|
||||
SeeMore = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
dialog.MoreSection.setAttribute("style","display: inherit");
|
||||
window.sizeToContent();
|
||||
dialog.MoreFewerButton.setAttribute("more","1");
|
||||
dialog.MoreFewerButton.setAttribute("value",GetString("FewerProperties"));
|
||||
SeeMore = true;
|
||||
}
|
||||
}
|
||||
|
||||
function GetPrefs()
|
||||
{
|
||||
var prefs;
|
||||
try {
|
||||
prefs = Components.classes['component://netscape/preferences'];
|
||||
if (prefs) prefs = prefs.getService();
|
||||
if (prefs) prefs = prefs.QueryInterface(Components.interfaces.nsIPref);
|
||||
if (prefs)
|
||||
return prefs;
|
||||
else
|
||||
dump("failed to get prefs service!\n");
|
||||
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
dump("failed to get prefs service!\n");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -37,9 +37,10 @@
|
||||
<html:div class="separator" align="horizontal"/>
|
||||
</box>
|
||||
|
||||
<!-- Extra buttons to use in Image Properties Dialog,
|
||||
which switches position between 2 locations
|
||||
Placed here to use same attributes as regular button -->
|
||||
<!-- Extra buttons to use when just button is needed
|
||||
E.g. Image Properties Dialog switches position between 2 locations
|
||||
Placed here to use same attributes as AdvancedEditButton button
|
||||
-->
|
||||
<titledbutton
|
||||
id = "AdvancedEditButton2"
|
||||
class = "push dialog"
|
||||
|
@ -105,13 +105,7 @@ function onSaveDefault()
|
||||
// "false" means set attributes on the globalElement,
|
||||
// not the real element being edited
|
||||
if (ValidateData()) {
|
||||
var prefs = Components.classes['component://netscape/preferences'];
|
||||
if (prefs) {
|
||||
prefs = prefs.getService();
|
||||
}
|
||||
if (prefs) {
|
||||
prefs = prefs.QueryInterface(Components.interfaces.nsIPref);
|
||||
}
|
||||
var prefs = GetPrefs();
|
||||
if (prefs) {
|
||||
dump("Setting HLine prefs\n");
|
||||
|
||||
@ -145,8 +139,8 @@ function onSaveDefault()
|
||||
|
||||
// Write the prefs out NOW!
|
||||
prefs.SavePrefFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get and validate data from widgets.
|
||||
|
@ -43,7 +43,7 @@
|
||||
<html:script language="JavaScript" src="chrome://editor/content/EdHLineProps.js"/>
|
||||
|
||||
<keyset id="keyset"/>
|
||||
<html:fieldset><html:legend align="left">&dimensionsFieldset.label;</html:legend>
|
||||
<titledbox><title><text align="left" value="&dimensionsBox.label;"/></title>
|
||||
<html:table>
|
||||
<html:tr>
|
||||
<html:td align="right">
|
||||
@ -69,14 +69,14 @@
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
</html:fieldset>
|
||||
<html:fieldset><html:legend align="left">&alignmentFieldset.label;</html:legend>
|
||||
</titledbox>
|
||||
<titledbox><title><text align="left" value="&alignmentBox.label;"/></title>
|
||||
<box align="horizontal">
|
||||
<html:label><html:input type="radio" name="Align" id="leftAlign"/>&leftPopup.value;</html:label>
|
||||
<html:label><html:input type="radio" name="Align" id="centerAlign"/>¢erPopup.value;</html:label>
|
||||
<html:label><html:input type="radio" name="Align" id="rightAlign"/>&rightPopup.value;</html:label>
|
||||
</box>
|
||||
</html:fieldset>
|
||||
</titledbox>
|
||||
<box align="horizontal">
|
||||
<html:label><html:input type="checkbox" id="3dShading"/>&threeDShading.label;</html:label>
|
||||
<spring flex="100%"/>
|
||||
|
@ -24,7 +24,6 @@
|
||||
*/
|
||||
|
||||
var insertNew = true;
|
||||
var SeeMore = true;
|
||||
var wasEnableAll = false;
|
||||
var oldSourceInt = 0;
|
||||
var imageElement;
|
||||
@ -95,14 +94,14 @@ function Startup()
|
||||
// Set SeeMore bool to the OPPOSITE of the current state,
|
||||
// which is automatically saved by using the 'persist="more"'
|
||||
// attribute on the MoreFewerButton button
|
||||
// onMoreFewer will toggle the state and redraw the dialog
|
||||
// onMoreFewerImage will toggle the state and redraw the dialog
|
||||
SeeMore = (dialog.MoreFewerButton.getAttribute("more") != "1");
|
||||
|
||||
// Initialize widgets with image attributes in the case where the entire dialog isn't visible
|
||||
if ( SeeMore ) // this is actually in the opposite state until onMoreFewer is called below
|
||||
if ( SeeMore ) // this is actually in the opposite state until onMoreFewerImage is called below
|
||||
InitDialog();
|
||||
|
||||
onMoreFewer(); // this call will initialize all widgets if entire dialog is visible
|
||||
onMoreFewerImage(); // this call will initialize all widgets if entire dialog is visible
|
||||
dialog.srcInput.focus();
|
||||
}
|
||||
|
||||
@ -172,9 +171,8 @@ function InitDialog()
|
||||
}
|
||||
}
|
||||
|
||||
imageTypeExtension = checkForImage();
|
||||
// we want to force an update so initialize "wasEnableAll" to be the opposite of what the actual state is
|
||||
wasEnableAll = !imageTypeExtension;
|
||||
wasEnableAll = !IsValidImage(dialog.srcInput.value);
|
||||
doOverallEnabling();
|
||||
}
|
||||
|
||||
@ -259,7 +257,7 @@ dump("alignment ="+alignment+"\n");
|
||||
globalElement.setAttribute("height", str);
|
||||
}
|
||||
|
||||
function onMoreFewer()
|
||||
function onMoreFewerImage()
|
||||
{
|
||||
if (SeeMore)
|
||||
{
|
||||
@ -318,8 +316,7 @@ function doDimensionEnabling( doEnable )
|
||||
|
||||
function doOverallEnabling()
|
||||
{
|
||||
var imageTypeExtension = checkForImage();
|
||||
var canEnableAll = imageTypeExtension != 0;
|
||||
var canEnableAll = IsValidImage(dialog.srcInput.value);
|
||||
if ( wasEnableAll == canEnableAll )
|
||||
return;
|
||||
|
||||
@ -337,7 +334,7 @@ function doOverallEnabling()
|
||||
SetElementEnabledByID("alignLabel", canEnableAll );
|
||||
SetElementEnabledByID("alignTypeSelect", canEnableAll );
|
||||
|
||||
// spacing fieldset
|
||||
// spacing Box
|
||||
SetElementEnabledByID( "spacingLabel", canEnableAll );
|
||||
SetElementEnabledByID( "imageleftrightInput", canEnableAll );
|
||||
SetElementEnabledByID( "leftrightLabel", canEnableAll );
|
||||
@ -360,42 +357,6 @@ function doOverallEnabling()
|
||||
SetElementEnabledByID( "removeImageMap", canEnableAll && canRemoveImageMap);
|
||||
}
|
||||
|
||||
// an API to validate and image by sniffing out the extension
|
||||
/* assumes that the element id is "srcInput" */
|
||||
/* returns lower-case extension or 0 */
|
||||
function checkForImage()
|
||||
{
|
||||
image = dialog.srcInput.value.trimString();
|
||||
if ( !image )
|
||||
return 0;
|
||||
|
||||
/* look for an extension */
|
||||
var tailindex = image.lastIndexOf(".");
|
||||
if ( tailindex == 0 || tailindex == -1 ) /* -1 is not found */
|
||||
return 0;
|
||||
|
||||
/* move past period, get the substring from the first character after the '.' to the last character (length) */
|
||||
tailindex = tailindex + 1;
|
||||
var type = image.substring(tailindex,image.length);
|
||||
|
||||
/* convert extension to lower case */
|
||||
if (type)
|
||||
type = type.toLowerCase();
|
||||
|
||||
// TODO: Will we convert .BMPs to a web format?
|
||||
switch( type ) {
|
||||
case "gif":
|
||||
case "jpg":
|
||||
case "jpeg":
|
||||
case "png":
|
||||
return type;
|
||||
break;
|
||||
default :
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// constrainProportions contribution by pete@postpagan.com
|
||||
// needs to handle pixels/percent
|
||||
|
||||
@ -443,8 +404,7 @@ function removeImageMap()
|
||||
// accessible to AdvancedEdit() [in EdDialogCommon.js]
|
||||
function ValidateData()
|
||||
{
|
||||
var imageTypeExtension = checkForImage();
|
||||
if ( !imageTypeExtension ) {
|
||||
if ( !IsValidImage(dialog.srcInput.value )) {
|
||||
ShowInputErrorMessage(GetString("MissingImageError"));
|
||||
return false;
|
||||
}
|
||||
@ -498,7 +458,7 @@ function ValidateData()
|
||||
width = ValidateNumberString(width, 1, maxLimitWidth);
|
||||
if (width == "") {
|
||||
if ( !SeeMore )
|
||||
onMoreFewer();
|
||||
onMoreFewerImage();
|
||||
dialog.widthInput.focus();
|
||||
return false;
|
||||
}
|
||||
@ -509,7 +469,7 @@ function ValidateData()
|
||||
height = ValidateNumberString(height, 1, maxLimitHeight);
|
||||
if (height == "") {
|
||||
if ( !SeeMore )
|
||||
onMoreFewer();
|
||||
onMoreFewerImage();
|
||||
dialog.heightInput.focus();
|
||||
return false;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@
|
||||
<xul:title
|
||||
class = "dialog"
|
||||
align = "left">
|
||||
<xul:text value="&locationFieldset.label;"/>
|
||||
<xul:text value="&locationBox.label;"/>
|
||||
</xul:title>
|
||||
|
||||
<div style="width: 50px; height: 50px">
|
||||
@ -75,8 +75,8 @@
|
||||
onchange = "doOverallEnabling()" />
|
||||
</td>
|
||||
<td>
|
||||
<!-- from EdDialogOverlay.xul -->
|
||||
<xul:titledbutton id="ChooseFile"/>
|
||||
<!-- from EdDialogOverlay.xul - TEMP Style hack - use boxes -->
|
||||
<xul:titledbutton id="ChooseFile" style="margin-left:5px;"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -106,7 +106,7 @@
|
||||
class = "push dialog"
|
||||
id = "MoreFewerButton"
|
||||
align = "left"
|
||||
onclick = "onMoreFewer()"
|
||||
onclick = "onMoreFewerImage()"
|
||||
persist = "more"/>
|
||||
<xul:spring flex="100%"/>
|
||||
<!-- From EdDialogOverlay.xul -->
|
||||
@ -121,7 +121,7 @@
|
||||
<xul:title
|
||||
class="dialog"
|
||||
id="dimensionsLabel">
|
||||
<xul:text value="&dimensionsFieldset.label;"/>
|
||||
<xul:text value="&dimensionsBox.label;"/>
|
||||
</xul:title>
|
||||
<div>
|
||||
<!-- THIS NEEDS TO BE onchange RATHER THAN onclick -->
|
||||
@ -294,7 +294,7 @@
|
||||
<xul:title
|
||||
class = "dialog"
|
||||
id = "spacingLabel">
|
||||
<xul:text value="&spacingFieldset.label;"/>
|
||||
<xul:text value="&spacingBox.label;"/>
|
||||
</xul:title>
|
||||
<!-- preferred width and height added to increase performance in boxes (otherwise buttons will jump!!) -evaughan -->
|
||||
<div style="width: 50px; height: 50px">
|
||||
|
@ -153,13 +153,13 @@ function onOK()
|
||||
|
||||
// Create necessary rows and cells for the table
|
||||
dump("Rows = "+rows+" Columns = "+columns+"\n");
|
||||
for (i = 0; i < rows; i++)
|
||||
for (var i = 0; i < rows; i++)
|
||||
{
|
||||
var newRow = editorShell.CreateElementWithDefaults("tr");
|
||||
if (newRow)
|
||||
{
|
||||
tableBody.appendChild(newRow);
|
||||
for (j = 0; j < columns; j++)
|
||||
for (var j = 0; j < columns; j++)
|
||||
{
|
||||
newCell = editorShell.CreateElementWithDefaults("td");
|
||||
if (newCell)
|
||||
|
@ -30,80 +30,58 @@
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://editor/locale/EditorInsertTable.dtd">
|
||||
|
||||
<xul:window class="dialog" title="&windowTitle.label;"
|
||||
xmlns:xul ="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns="http://www.w3.org/TR/REC-html40"
|
||||
<window class="dialog" title="&windowTitle.label;"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
onload = "Startup()"
|
||||
align="vertical">
|
||||
|
||||
<!-- Methods common to all editor dialogs -->
|
||||
<script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js"/>
|
||||
<script language="JavaScript" src="chrome://editor/content/EdInsertTable.js"/>
|
||||
<script language="JavaScript" src="chrome://global/content/dialogOverlay.js"/>
|
||||
<html:script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js"/>
|
||||
<html:script language="JavaScript" src="chrome://editor/content/EdInsertTable.js"/>
|
||||
<html:script language="JavaScript" src="chrome://global/content/dialogOverlay.js"/>
|
||||
|
||||
<xul:broadcaster id="args" value=""/>
|
||||
<xul:keyset id="keyset"/>
|
||||
|
||||
<!-- preferred width and height added to increase performance in boxes (otherwise buttons will jump!!) -evaughan -->
|
||||
<div style="width: 50px; height: 50px">
|
||||
<table>
|
||||
<tr>
|
||||
<td align="right">
|
||||
<label for="rows"> &numRowsEditField.label; </label>
|
||||
</td>
|
||||
<td collspan="2">
|
||||
<input type="text" id="rows" maxlength="4" size="4"
|
||||
onkeyup="forceInteger('rows')" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
<label for="columns"> &numColumnsEditField.label; </label>
|
||||
</td>
|
||||
<td collspan="2">
|
||||
<input type="text" id="columns" maxlength="4" size="4"
|
||||
onkeyup="forceInteger('columns')" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
<label for="width" > &widthEditField.label; </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="width" size="4" maxlength="4"
|
||||
onkeyup="forceInteger('width')" />
|
||||
</td>
|
||||
<td>
|
||||
<select id="pixelOrPercentSelect" size="1"/>
|
||||
<!-- option elements are appended by JS -->
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
<label for="border"> &borderEditField.label; </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="borderInput" size="4" onkeyup="forceInteger('borderInput')"/>
|
||||
</td>
|
||||
<!-- THIS IS DUMB Can't figure out how to put "pixels" after the
|
||||
input box and make them center vertically. Used another TD instead -->
|
||||
<td>
|
||||
<div>&pixelsPopup.value;</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<xul:spring class="spacer"/>
|
||||
<broadcaster id="args" value=""/>
|
||||
<keyset id="keyset"/>
|
||||
|
||||
<box valign="middle">
|
||||
<text class="right" align="right" value="&numRowsEditField.label;"/>
|
||||
<html:input type="text" id="rows" maxlength="4" size="4"
|
||||
onkeyup="forceInteger('rows')" />
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box valign="middle">
|
||||
<text class="right" align="right" value="&numColumnsEditField.label;"/>
|
||||
<html:input type="text" id="columns" maxlength="4" size="4"
|
||||
onkeyup="forceInteger('columns')" />
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box valign="middle">
|
||||
<text class="right" align="right" value="&widthEditField.label;"/>
|
||||
<html:input type="text" id="width" size="4" maxlength="4"
|
||||
onkeyup="forceInteger('width')" />
|
||||
<spring class="spacer"/>
|
||||
<html:select id="pixelOrPercentSelect" size="1"/>
|
||||
<!-- option elements are appended by JS -->
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box valign="middle">
|
||||
<text class="right" align="right" value="&borderEditField.label;"/>
|
||||
<html:input type="text" id="borderInput" size="4" maxlength="4"
|
||||
onkeyup="forceInteger('borderInput')" />
|
||||
<spring class="spacer"/>
|
||||
<text align="left" value="&pixelsPopup.value;"/>
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<!-- from EdDialogOverlay -->
|
||||
<xul:box id="AdvancedEdit"/>
|
||||
<box id="AdvancedEdit"/>
|
||||
<!-- from global dialogOverlay -->
|
||||
<xul:box id="okCancelButtons"/>
|
||||
<box id="okCancelButtons"/>
|
||||
|
||||
<xul:popup id="PixelOrPercentMenu">
|
||||
<xul:menu>
|
||||
<xul:menuitem value="&pixelsPopup.value;" onclick="SetPixelOrPercentByID('pixelOrPercentButton', '')"/>
|
||||
<xul:menuitem value="&percentPopup.value;" onclick="SetPixelOrPercentByID('pixelOrPercentButton', '%')"/>
|
||||
</xul:menu>
|
||||
</xul:popup>
|
||||
|
||||
</xul:window>
|
||||
<popup id="PixelOrPercentMenu">
|
||||
<menu>
|
||||
<menuitem value="&pixelsPopup.value;" onclick="SetPixelOrPercentByID('pixelOrPercentButton', '')"/>
|
||||
<menuitem value="&percentPopup.value;" onclick="SetPixelOrPercentByID('pixelOrPercentButton', '%')"/>
|
||||
</menu>
|
||||
</popup>
|
||||
</window>
|
||||
|
@ -22,22 +22,14 @@
|
||||
|
||||
var anchorElement = null;
|
||||
var imageElement = null;
|
||||
var insertNew = true;
|
||||
var insertNew = false;
|
||||
var insertLinkAtCaret;
|
||||
var needLinkText = false;
|
||||
var insertLinkAroundSelection = false;
|
||||
var linkTextInput;
|
||||
var hrefInput;
|
||||
var linkMessage;
|
||||
var href;
|
||||
var newLinkText;
|
||||
var NamedAnchorList = 0;
|
||||
var HNodeArray;
|
||||
var haveNamedAnchors = false;
|
||||
var haveHeadings = false;
|
||||
var MoreSection;
|
||||
var MoreFewerButton;
|
||||
var SeeMore = false;
|
||||
var AdvancedEditSection;
|
||||
|
||||
// NOTE: Use "href" instead of "a" to distinguish from Named Anchor
|
||||
// The returned node is has an "a" tagName
|
||||
@ -50,20 +42,24 @@ function Startup()
|
||||
return;
|
||||
|
||||
doSetOKCancel(onOK, null);
|
||||
|
||||
// Message was wrapped in a <label> or <div>, so actual text is a child text node
|
||||
linkCaption = (document.getElementById("linkTextCaption")).firstChild;
|
||||
linkMessage = (document.getElementById("linkTextMessage")).firstChild;
|
||||
linkTextInput = document.getElementById("linkTextInput");
|
||||
hrefInput = document.getElementById("hrefInput");
|
||||
NamedAnchorList = document.getElementById("NamedAnchorList");
|
||||
HeadingsList = document.getElementById("HeadingsList");
|
||||
MoreSection = document.getElementById("MoreSection");
|
||||
MoreFewerButton = document.getElementById("MoreFewerButton");
|
||||
AdvancedEditSection = document.getElementById("AdvancedEdit");
|
||||
|
||||
// Get a single selected anchor element
|
||||
anchorElement = editorShell.GetSelectedElement(tagName);
|
||||
dialog = new Object;
|
||||
if (!dialog)
|
||||
{
|
||||
dump("Failed to create dialog object!!!\n");
|
||||
window.close();
|
||||
}
|
||||
|
||||
// Message was wrapped in a <label> or <div>, so actual text is a child text node
|
||||
dialog.linkTextCaption = document.getElementById("linkTextCaption");
|
||||
dialog.linkTextMessage = document.getElementById("linkTextMessage");
|
||||
dialog.linkTextInput = document.getElementById("linkTextInput");
|
||||
dialog.hrefInput = document.getElementById("hrefInput");
|
||||
dialog.NamedAnchorList = document.getElementById("NamedAnchorList");
|
||||
dialog.HeadingsList = document.getElementById("HeadingsList");
|
||||
dialog.MoreSection = document.getElementById("MoreSection");
|
||||
dialog.MoreFewerButton = document.getElementById("MoreFewerButton");
|
||||
dialog.AdvancedEditSection = document.getElementById("AdvancedEdit");
|
||||
|
||||
var selection = editorShell.editorSelection;
|
||||
if (selection) {
|
||||
@ -72,78 +68,126 @@ function Startup()
|
||||
dump("Failed to get selection\n");
|
||||
}
|
||||
|
||||
if (anchorElement) {
|
||||
// We found an element and don't need to insert one
|
||||
dump("found anchor element\n");
|
||||
insertNew = false;
|
||||
|
||||
// We get the anchor if any of the selection (or just caret)
|
||||
// is enclosed by the link. Select the entire link
|
||||
// so we can show the selection text
|
||||
editorShell.SelectElement(anchorElement);
|
||||
selection = editorShell.editorSelection;
|
||||
|
||||
} else {
|
||||
// See if we have a selected image instead of text
|
||||
imageElement = editorShell.GetSelectedElement("img");
|
||||
if (imageElement) {
|
||||
// See if the image is a child of a link
|
||||
dump("Image element found - check if its a link...\n");
|
||||
dump("Image Parent="+parent);
|
||||
parent = imageElement.parentNode;
|
||||
dump("Parent="+parent+" nodeName="+parent.nodeName+"\n");
|
||||
if (parent) {
|
||||
anchorElement = parent;
|
||||
insertNew = false;
|
||||
linkCaption.data = GetString("LinkImage");
|
||||
// Link source string is the source URL of image
|
||||
// TODO: THIS STILL DOESN'T HANDLE MULTIPLE SELECTED IMAGES!
|
||||
linkMessage.data = imageElement.getAttribute("src");;
|
||||
// See if we have a single selected image
|
||||
imageElement = editorShell.GetSelectedElement("img");
|
||||
|
||||
if (imageElement)
|
||||
{
|
||||
// Get the parent link if it exists -- more efficient than GetSelectedElement()
|
||||
anchorElement = editorShell.GetElementOrParentByTagName("href", imageElement);
|
||||
if (anchorElement)
|
||||
{
|
||||
dump("Existing image link"+anchorElement+"\n");
|
||||
if (anchorElement.childNodes.length > 1)
|
||||
{
|
||||
dump("Copying existing image link\n");
|
||||
// If there are other children, then we want to break
|
||||
// this image away by inserting a new link around it,
|
||||
// so make a new node and copy existing attributes
|
||||
anchorElement = anchorElement.cloneNode(false);
|
||||
insertNew = true;
|
||||
}
|
||||
} else {
|
||||
// We don't have an element selected,
|
||||
// so create one with default attributes
|
||||
dump("Element not selected - calling createElementWithDefaults\n");
|
||||
anchorElement = editorShell.CreateElementWithDefaults(tagName);
|
||||
|
||||
// We will insert a new link at caret location if there's no selection
|
||||
// TODO: This isn't entirely correct. If selection doesn't have any text
|
||||
// or an image, then shouldn't we clear the selection and insert new text?
|
||||
insertNew = selection.isCollapsed;
|
||||
dump("insertNew is " + insertNew + "\n");
|
||||
linkCaption.data = GetString("EnterLinkText");
|
||||
linkMessage.data = "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get an anchor element if caret or
|
||||
// entire selection is within the link.
|
||||
anchorElement = editorShell.GetSelectedElement(tagName);
|
||||
|
||||
if (anchorElement)
|
||||
{
|
||||
// Select the entire link
|
||||
editorShell.SelectElement(anchorElement);
|
||||
selection = editorShell.editorSelection;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If selection starts in a link, but extends beyond it,
|
||||
// the user probably wants to extend existing link to new selection,
|
||||
// so check if either end of selection is within a link
|
||||
// POTENTIAL PROBLEM: This prevents user from selecting text in an existing
|
||||
// link and making 2 links.
|
||||
// Note that this isn't a problem with images, handled above
|
||||
|
||||
anchorElement = editorShell.GetElementOrParentByTagName("href", selection.anchorNode);
|
||||
if (!anchorElement)
|
||||
anchorElement = editorShell.GetElementOrParentByTagName("href", selection.focusNode);
|
||||
|
||||
if (anchorElement)
|
||||
{
|
||||
// But clone it for reinserting/merging around existing
|
||||
// link that only partially overlaps the selection
|
||||
anchorElement = anchorElement.cloneNode(false);
|
||||
insertNew = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!anchorElement)
|
||||
{
|
||||
// No existing link -- create a new one
|
||||
anchorElement = editorShell.CreateElementWithDefaults(tagName);
|
||||
insertNew = true;
|
||||
}
|
||||
if(!anchorElement)
|
||||
{
|
||||
dump("Failed to get selected element or create a new one!\n");
|
||||
window.close();
|
||||
} else if (!insertNew && !imageElement) {
|
||||
}
|
||||
|
||||
// Replace the link message with the link source string
|
||||
selectedText = GetSelectionAsText();
|
||||
if (selectedText.length > 0) {
|
||||
// Use just the first 50 characters and add "..."
|
||||
selectedText = TruncateStringAtWordEnd(selectedText, 50, true);
|
||||
} else {
|
||||
dump("Selected text for link source not found. Non-text elements selected?\n");
|
||||
}
|
||||
linkMessage.data = selectedText;
|
||||
// The label above the selected text:
|
||||
linkCaption.data = GetString("LinkText");
|
||||
}
|
||||
|
||||
if (!selection.isCollapsed)
|
||||
// We insert at caret only when nothing is selected
|
||||
insertLinkAtCaret = selection.isCollapsed;
|
||||
|
||||
if (insertLinkAtCaret)
|
||||
{
|
||||
// HREF is a weird case: If selection extends beyond
|
||||
// the link, user probably wants to extend link to
|
||||
// entire selection.
|
||||
// TODO: If there was already a link,
|
||||
// we need to know if selection extends beyond existing
|
||||
// link text before we should do this
|
||||
insertLinkAroundSelection = true;
|
||||
dump("insertLinkAroundSelection is TRUE\n");
|
||||
// Note: Use linkTextMessage for normal weight,
|
||||
// because linkTextCaption is bold (set in EdDialog.css)
|
||||
dialog.linkTextMessage.setAttribute("value",GetString("EnterLinkText"));
|
||||
// Hide the other string
|
||||
dialog.linkTextCaption.setAttribute("hidden","true");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!imageElement)
|
||||
{
|
||||
// Don't think we can ever get here!
|
||||
|
||||
// Check if selection has some text - use that first
|
||||
selectedText = GetSelectionAsText();
|
||||
if (selectedText.length == 0)
|
||||
{
|
||||
// No text, look for first image in the selection
|
||||
var children = anchorElement.childNodes;
|
||||
if (children)
|
||||
{
|
||||
for(i=0; i < children.length; i++)
|
||||
{
|
||||
if (children.item(i) == "IMG")
|
||||
{
|
||||
imageElement = children.item(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Set "caption" for link source and the source text or image URL
|
||||
if (imageElement)
|
||||
{
|
||||
dialog.linkTextCaption.setAttribute("value",GetString("LinkImage"));
|
||||
// Link source string is the source URL of image
|
||||
// TODO: THIS DOESN'T HANDLE MULTIPLE SELECTED IMAGES!
|
||||
dialog.linkTextMessage.setAttribute("value",imageElement.src);
|
||||
} else {
|
||||
dialog.linkTextCaption.setAttribute("value",GetString("LinkText"));
|
||||
if (selectedText.length > 0) {
|
||||
// Use just the first 50 characters and add "..."
|
||||
dialog.linkTextMessage.setAttribute("value",TruncateStringAtWordEnd(selectedText, 50, true));
|
||||
} else {
|
||||
dialog.linkTextMessage.setAttribute("value",GetString("MixedSelection"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Make a copy to use for AdvancedEdit and onSaveDefault
|
||||
@ -156,28 +200,19 @@ function Startup()
|
||||
InitDialog();
|
||||
|
||||
// Set initial focus
|
||||
if (insertNew) {
|
||||
dump("Setting focus to linkTextInput\n");
|
||||
if (insertLinkAtCaret) {
|
||||
dump("Setting focus to dialog.linkTextInput\n");
|
||||
// We will be using the HREF inputbox, so text message
|
||||
linkTextInput.focus();
|
||||
dialog.linkTextInput.focus();
|
||||
} else {
|
||||
dump("Setting focus to linkTextInput\n");
|
||||
hrefInput.focus();
|
||||
dump("Setting focus to dialog.linkTextInput\n");
|
||||
dialog.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;
|
||||
}
|
||||
dialog.linkTextInput.setAttribute("hidden","true");
|
||||
dialog.linkTextInput = null;
|
||||
}
|
||||
// Set SeeMore bool to the OPPOSITE of the current state,
|
||||
// which is automatically saved by using the 'persist="more"'
|
||||
// attribute on the MoreFewerButton button
|
||||
// onMoreFewer will toggle it and redraw the dialog
|
||||
SeeMore = (MoreFewerButton.getAttribute("more") != "1");
|
||||
onMoreFewer();
|
||||
InitMoreFewer();
|
||||
}
|
||||
|
||||
// Set dialog widgets with attribute data
|
||||
@ -185,8 +220,7 @@ function Startup()
|
||||
// by AdvancedEdit(), which is shared by all property dialogs
|
||||
function InitDialog()
|
||||
{
|
||||
hrefInput.value = globalElement.getAttribute("href");
|
||||
dump("Current HREF: "+hrefInput.value+"\n");
|
||||
dialog.hrefInput.value = globalElement.href;
|
||||
}
|
||||
|
||||
function chooseFile()
|
||||
@ -194,31 +228,31 @@ function chooseFile()
|
||||
// Get a local file, converted into URL format
|
||||
fileName = editorShell.GetLocalFileURL(window, "html");
|
||||
if (fileName) {
|
||||
hrefInput.value = fileName;
|
||||
dialog.hrefInput.value = fileName;
|
||||
}
|
||||
// Put focus into the input field
|
||||
hrefInput.focus();
|
||||
dialog.hrefInput.focus();
|
||||
}
|
||||
|
||||
function RemoveLink()
|
||||
{
|
||||
// Simple clear the input field!
|
||||
hrefInput.value = "";
|
||||
dialog.hrefInput.value = "";
|
||||
}
|
||||
|
||||
function FillListboxes()
|
||||
{
|
||||
NamedAnchorNodeList = editorShell.editorDocument.anchors;
|
||||
var NamedAnchorNodeList = editorShell.editorDocument.anchors;
|
||||
var NamedAnchorCount = NamedAnchorNodeList.length;
|
||||
if (NamedAnchorCount > 0) {
|
||||
for (var i = 0; i < NamedAnchorCount; i++) {
|
||||
AppendStringToList(NamedAnchorList,NamedAnchorNodeList.item(i).name);
|
||||
AppendStringToList(dialog.NamedAnchorList,NamedAnchorNodeList.item(i).name);
|
||||
}
|
||||
haveNamedAnchors = true;
|
||||
} else {
|
||||
// Message to tell user there are none
|
||||
AppendStringToList(NamedAnchorList,GetString("NoNamedAnchors"));
|
||||
NamedAnchorList.setAttribute("disabled", "true");
|
||||
AppendStringToList(dialog.NamedAnchorList,GetString("NoNamedAnchors"));
|
||||
dialog.NamedAnchorList.setAttribute("disabled", "true");
|
||||
}
|
||||
var firstHeading = true;
|
||||
for (var j = 1; j <= 6; j++) {
|
||||
@ -250,7 +284,7 @@ function FillListboxes()
|
||||
// Append "_" to any name already in the list
|
||||
if (GetExistingHeadingIndex(text) > -1)
|
||||
text += "_";
|
||||
AppendStringToList(HeadingsList, text);
|
||||
AppendStringToList(dialog.HeadingsList, text);
|
||||
|
||||
// Save nodes in an array so we can create anchor node under it later
|
||||
if (!HNodeArray)
|
||||
@ -264,17 +298,17 @@ function FillListboxes()
|
||||
haveHeadings = true;
|
||||
} else {
|
||||
// Message to tell user there are none
|
||||
AppendStringToList(HeadingsList,GetString("NoHeadings"));
|
||||
HeadingsList.setAttribute("disabled", "true");
|
||||
AppendStringToList(dialog.HeadingsList,GetString("NoHeadings"));
|
||||
dialog.HeadingsList.setAttribute("disabled", "true");
|
||||
}
|
||||
}
|
||||
|
||||
function GetExistingHeadingIndex(text)
|
||||
{
|
||||
dump("Heading text: "+text+"\n");
|
||||
for (i=0; i < HeadingsList.length; i++) {
|
||||
dump("HeadingListItem"+i+": "+HeadingsList.options[i].value+"\n");
|
||||
if (HeadingsList.options[i].value == text)
|
||||
for (var i=0; i < dialog.HeadingsList.length; i++) {
|
||||
dump("HeadingListItem"+i+": "+dialog.HeadingsList.options[i].value+"\n");
|
||||
if (dialog.HeadingsList.options[i].value == text)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
@ -283,43 +317,22 @@ function GetExistingHeadingIndex(text)
|
||||
function SelectNamedAnchor()
|
||||
{
|
||||
if (haveNamedAnchors) {
|
||||
hrefInput.value = "#"+NamedAnchorList.options[NamedAnchorList.selectedIndex].value;
|
||||
dialog.hrefInput.value = "#"+dialog.NamedAnchorList.options[dialog.NamedAnchorList.selectedIndex].value;
|
||||
}
|
||||
}
|
||||
|
||||
function SelectHeading()
|
||||
{
|
||||
if (haveHeadings) {
|
||||
hrefInput.value = "#"+HeadingsList.options[HeadingsList.selectedIndex].value;
|
||||
dialog.hrefInput.value = "#"+dialog.HeadingsList.options[dialog.HeadingsList.selectedIndex].value;
|
||||
}
|
||||
}
|
||||
|
||||
function onMoreFewer()
|
||||
{
|
||||
if (SeeMore)
|
||||
{
|
||||
MoreSection.setAttribute("style","display: none");
|
||||
window.sizeToContent();
|
||||
MoreFewerButton.setAttribute("more","0");
|
||||
MoreFewerButton.setAttribute("value",GetString("MoreProperties"));
|
||||
SeeMore = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
MoreSection.setAttribute("style","display: inherit");
|
||||
window.sizeToContent();
|
||||
MoreFewerButton.setAttribute("more","1");
|
||||
MoreFewerButton.setAttribute("value",GetString("FewerProperties"));
|
||||
SeeMore = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Get and validate data from widgets.
|
||||
// Set attributes on globalElement so they can be accessed by AdvancedEdit()
|
||||
function ValidateData()
|
||||
{
|
||||
href = hrefInput.value.trimString();
|
||||
href = dialog.hrefInput.value.trimString();
|
||||
if (href.length > 0) {
|
||||
// Set the HREF directly on the editor document's anchor node
|
||||
// or on the newly-created node if insertNew is true
|
||||
@ -327,18 +340,18 @@ function ValidateData()
|
||||
dump("HREF:"+href+"|\n");
|
||||
} else if (insertNew) {
|
||||
// We must have a URL to insert a new link
|
||||
//NOTE: WE ACCEPT AN EMPTY HREF TO ALLOW REMOVING AN EXISTING LINK,
|
||||
//NOTE: We accept an empty HREF on existing link to indicate removing the link
|
||||
dump("Empty HREF error\n");
|
||||
ShowInputErrorMessage(GetString("EmptyHREFError"));
|
||||
return false;
|
||||
}
|
||||
if (linkTextInput) {
|
||||
if (dialog.linkTextInput) {
|
||||
// The text we will insert isn't really an attribute,
|
||||
// but it makes sense to validate it
|
||||
newLinkText = TrimString(linkTextInput.value);
|
||||
newLinkText = TrimString(dialog.linkTextInput.value);
|
||||
if (newLinkText.length == 0) {
|
||||
ShowInputErrorMessage(GetString("GetInputError"));
|
||||
linkTextInput.focus();
|
||||
dialog.linkTextInput.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -358,7 +371,7 @@ function onOK()
|
||||
editorShell.BeginBatchChanges();
|
||||
|
||||
// Get text to use for a new link
|
||||
if (insertNew) {
|
||||
if (insertLinkAtCaret) {
|
||||
// Append the link text as the last child node
|
||||
// of the anchor node
|
||||
textNode = editorShell.editorDocument.createTextNode(newLinkText);
|
||||
@ -371,10 +384,12 @@ function onOK()
|
||||
dump("Exception occured in InsertElementAtSelection\n");
|
||||
return true;
|
||||
}
|
||||
} else if (insertLinkAroundSelection) {
|
||||
// Text was supplied by the selection,
|
||||
// so insert a link node as parent of this text
|
||||
} else if (insertNew) {
|
||||
// Link source was supplied by the selection,
|
||||
// so insert a link node as parent of this
|
||||
// (may be text, image, or other inline content)
|
||||
try {
|
||||
dump("InsertLink around selection\n");
|
||||
editorShell.InsertLinkAroundSelection(anchorElement);
|
||||
} catch (e) {
|
||||
dump("Exception occured in InsertElementAtSelection\n");
|
||||
|
@ -45,45 +45,39 @@
|
||||
<keyset id="keyset"/>
|
||||
|
||||
<box align="vertical" style="min-width: 20em">
|
||||
<html:label id="linkTextCaption" for="linkTextMessage"> &LinkText.label; </html:label>
|
||||
<html:div id="linkTextMessage" style="margin-left: 3em">[replace this]</html:div>
|
||||
<html:input type="text" size="25" length="25" id="linkTextInput"/>
|
||||
<text id="linkTextCaption" value="&LinkTitle.label;" align="left" valign="bottom"/>
|
||||
<text id="linkTextMessage" style="min-width: 200px;" align="left"/>
|
||||
<html:input type="text" id="linkTextInput"/>
|
||||
<spring class="spacer"/>
|
||||
|
||||
<titledbox><title><text value="&LinkURLFieldset.label;"/></title>
|
||||
<box align="vertical">
|
||||
<box align="vertical">
|
||||
<box align="horizontal">
|
||||
<html:div> &LinkURLEditField.label;</html:div>
|
||||
<spring flex="100%"/>
|
||||
<html:div><titledbutton class="push" id="RemoveLink" onclick="RemoveLink()" value="&RemoveLinkButton.label;" style="width: 7em"/>
|
||||
</html:div>
|
||||
</box>
|
||||
<box align="horizontal">
|
||||
<html:input type="text" size="25" length="25" id="hrefInput"></html:input>
|
||||
<spring flex="100%"/>
|
||||
<!-- The div prevents button from being the same height as the input field -->
|
||||
<html:div>
|
||||
<!-- from EdDialogOverlay.xul -->
|
||||
<titledbutton id="ChooseFile"/>
|
||||
</html:div>
|
||||
</box>
|
||||
</box>
|
||||
<!-- ***** The style: width setting is need to cover a bug in button width resizing when text changes ***** -->
|
||||
<html:div><titledbutton class="push" id="MoreFewerButton" align="left" onclick="onMoreFewer()" persist="more"/></html:div>
|
||||
<box id="MoreSection" align="vertical">
|
||||
<spring class="spacer"/>
|
||||
<html:div>&NamedAnchorMsg.label;</html:div>
|
||||
<html:select id="NamedAnchorList" size="3" onchange="SelectNamedAnchor()"/>
|
||||
<spring class="spacer"/>
|
||||
<html:div>&HeadingMsg.label;</html:div>
|
||||
<html:select id="HeadingsList" size="3" onchange="SelectHeading()"/>
|
||||
<html:div>&HeadingMsg2.label;</html:div>
|
||||
</box>
|
||||
<titledbox orient="vertical"><title><text value="&LinkURLBox.label;"/></title>
|
||||
<text align="left" value="&LinkURLEditField.label;"/>
|
||||
<spring class="spacer"/>
|
||||
<box autostretch="never" valign="middle">
|
||||
<html:input type="text" style="min-width: 200px; margin-left:2px; margin-right:2px" id="hrefInput"></html:input>
|
||||
<spring class="spacer"/>
|
||||
<!-- from EdDialogOverlay.xul -->
|
||||
<!-- The style: width setting is need to cover a bug in button width resizing when text changes -->
|
||||
<titledbutton id="ChooseFile" style="width: 7em"/>
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box>
|
||||
<titledbutton class="push" id="MoreFewerButton" align="left" onclick="onMoreFewer()" persist="more"/>
|
||||
<spring flex="1"/>
|
||||
<titledbutton class="push" id="RemoveLink" onclick="RemoveLink()" value="&RemoveLinkButton.label;" style="width: 7em"/>
|
||||
</box>
|
||||
<box id="MoreSection" align="vertical">
|
||||
<spring class="bigspacer"/>
|
||||
<text align="left" value="&NamedAnchorMsg.label;"/>
|
||||
<html:select id="NamedAnchorList" size="3" onchange="SelectNamedAnchor()"/>
|
||||
<spring class="spacer"/>
|
||||
<text align="left" value="&HeadingMsg.label;"/>
|
||||
<html:select id="HeadingsList" size="3" onchange="SelectHeading()"/>
|
||||
<!-- Use div so it can wrap -->
|
||||
<html:div>&HeadingMsg2.label;</html:div>
|
||||
</box>
|
||||
</titledbox>
|
||||
</box>
|
||||
|
||||
<!-- from EdDialogOverlay -->
|
||||
<box id="AdvancedEdit"/>
|
||||
<!-- from global dialogOverlay -->
|
||||
|
@ -89,7 +89,7 @@ function AnchorNameExists(name)
|
||||
{
|
||||
anchorList = editorShell.editorDocument.anchors;
|
||||
if (anchorList) {
|
||||
for (i=0; i < anchorList.length; i++) {
|
||||
for (var i = 0; i < anchorList.length; i++) {
|
||||
if (anchorList[i].name == name)
|
||||
return true;
|
||||
}
|
||||
|
@ -30,28 +30,26 @@
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://editor/locale/EdNamedAnchorProperties.dtd">
|
||||
|
||||
<xul:window class="dialog" title="&windowTitle.label;"
|
||||
xmlns:xul ="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns="http://www.w3.org/TR/REC-html40"
|
||||
<window class="dialog" title="&windowTitle.label;"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
onload = "Startup()"
|
||||
align="vertical">
|
||||
|
||||
<!-- Methods common to all editor dialogs -->
|
||||
<script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js">
|
||||
</script>
|
||||
<script language="JavaScript" src="chrome://editor/content/EdNamedAnchorProps.js">
|
||||
</script>
|
||||
<script language="JavaScript" src="chrome://global/content/dialogOverlay.js" />
|
||||
<html:script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js"/>
|
||||
<html:script language="JavaScript" src="chrome://editor/content/EdNamedAnchorProps.js"/>
|
||||
<html:script language="JavaScript" src="chrome://global/content/dialogOverlay.js" />
|
||||
|
||||
<xul:keyset id="keyset"/>
|
||||
<keyset id="keyset"/>
|
||||
|
||||
<label for="nameInput"> &anchorNameEditField.label; </label>
|
||||
<input type="text" id="nameInput" size="30" maxlength="255" />
|
||||
<div>&noSpacesMsg.label;</div>
|
||||
<xul:spring class="spacer"/>
|
||||
<text align="left" for="nameInput" value="&anchorNameEditField.label;"/>
|
||||
<html:input type="text" class="MinWidth200" id="nameInput"/>
|
||||
<text align="left" value="&noSpacesMsg.label;"/>
|
||||
<spring class="spacer"/>
|
||||
<!-- from EdDialogOverlay -->
|
||||
<xul:box id="AdvancedEdit"/>
|
||||
<box id="AdvancedEdit"/>
|
||||
<!-- from global dialogOverlay -->
|
||||
<xul:box id="okCancelButtons"/>
|
||||
<box id="okCancelButtons"/>
|
||||
|
||||
</xul:window>
|
||||
</window>
|
||||
|
@ -20,10 +20,14 @@
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
var tabPanel;
|
||||
var currentTab;
|
||||
var colorPage;
|
||||
var colorIndex = 0;
|
||||
var MoreSection;
|
||||
var title = "";
|
||||
var author = "";
|
||||
var description = "";
|
||||
var authorElement;
|
||||
var descriptionElement;
|
||||
var insertNewAuthor = false;
|
||||
var insertNewDescription = false;
|
||||
|
||||
//Cancel() is in EdDialogCommon.js
|
||||
// dialog initialization code
|
||||
@ -32,104 +36,172 @@ function Startup()
|
||||
if (!InitEditorShell())
|
||||
return;
|
||||
|
||||
colorPage = new Object;
|
||||
if (!colorPage)
|
||||
dialog = new Object;
|
||||
if (!dialog)
|
||||
{
|
||||
dump("Failed to create colorPage object!!!\n");
|
||||
dump("Failed to create dialog object!!!\n");
|
||||
window.close();
|
||||
}
|
||||
|
||||
colorPage.ColorPreview = document.getElementById("ColorPreview");
|
||||
colorPage.NormalText = document.getElementById("NormalText");
|
||||
colorPage.LinkText = document.getElementById("LinkText");
|
||||
colorPage.ActiveLinkText = document.getElementById("ActiveLinkText");
|
||||
colorPage.FollowedLinkText = document.getElementById("FollowedLinkText");
|
||||
|
||||
// colorPage. = documentgetElementById("");
|
||||
|
||||
tabPanel = document.getElementById("tabPanel");
|
||||
|
||||
// Set the starting Tab:
|
||||
var tabName = window.arguments[1];
|
||||
currentTab = document.getElementById(tabName);
|
||||
if (!currentTab)
|
||||
currentTab = document.getElementById("GeneralTab");
|
||||
|
||||
if (!tabPanel || !currentTab)
|
||||
{
|
||||
dump("Not all dialog controls were found!!!\n");
|
||||
window.close;
|
||||
}
|
||||
|
||||
// Trigger setting of style for the selected tab widget
|
||||
currentTab.setAttribute("selected", "true");
|
||||
// Activate the corresponding panel
|
||||
var index = 0;
|
||||
switch(tabName)
|
||||
{
|
||||
case "ColorTab":
|
||||
index = 1;
|
||||
break;
|
||||
case "MetaTab":
|
||||
index = 2;
|
||||
break;
|
||||
}
|
||||
tabPanel.setAttribute("index",index);
|
||||
dialog.PageLocation = document.getElementById("PageLocation");
|
||||
dialog.PageModDate = document.getElementById("PageModDate");
|
||||
dialog.TitleInput = document.getElementById("TitleInput");
|
||||
dialog.AuthorInput = document.getElementById("AuthorInput");
|
||||
dialog.DescriptionInput = document.getElementById("DescriptionInput");
|
||||
dialog.MoreSection = document.getElementById("MoreSection");
|
||||
dialog.MoreFewerButton = document.getElementById("MoreFewerButton");
|
||||
|
||||
doSetOKCancel(onOK, null);
|
||||
|
||||
// Default string for new page is set from DTD string in XUL,
|
||||
// so set only if not new doc URL
|
||||
var location = editorShell.editorDocument.location;
|
||||
if (location != "about:blank")
|
||||
dialog.PageLocation.setAttribute("value", editorShell.editorDocument.location);
|
||||
|
||||
authorElement = GetMetaElement("author");
|
||||
if (!authorElement)
|
||||
{
|
||||
authorElement = CreateMetaElement("author");
|
||||
if (!authorElement)
|
||||
window.close();
|
||||
|
||||
insertNewAuthor = true;
|
||||
}
|
||||
|
||||
descriptionElement = GetMetaElement("description");
|
||||
if (!descriptionElement)
|
||||
{
|
||||
descriptionElement = CreateMetaElement("description");
|
||||
if (!descriptionElement)
|
||||
window.close();
|
||||
|
||||
insertNewDescription = true;
|
||||
}
|
||||
|
||||
InitMoreFewer();
|
||||
InitDialog();
|
||||
|
||||
//.focus();
|
||||
dialog.TitleInput.focus();
|
||||
}
|
||||
|
||||
function InitDialog()
|
||||
{
|
||||
dialog.TitleInput.value = editorShell.GetDocumentTitle();
|
||||
dialog.AuthorInput.value = authorElement.getAttribute("content");
|
||||
dialog.DescriptionInput.value = descriptionElement.getAttribute("content");
|
||||
}
|
||||
|
||||
function GetColor(ColorPickerID, ColorWellID)
|
||||
|
||||
function GetMetaElement(name)
|
||||
{
|
||||
var color = getColorAndSetColorWell(ColorPickerID, ColorWellID);
|
||||
dump("GetColor, color="+color+"\n");
|
||||
if (!color)
|
||||
if (name)
|
||||
{
|
||||
// No color was clicked on,
|
||||
// so user clicked on "Don't Specify Color" button
|
||||
color = "inherit";
|
||||
dump("Don't specify color\n");
|
||||
name = name.toLowerCase();
|
||||
if (name != "")
|
||||
{
|
||||
var metaNodes = editorShell.editorDocument.getElementsByTagName("meta");
|
||||
if (metaNodes && metaNodes.length > 0)
|
||||
{
|
||||
for (var i = 0; i < metaNodes.length; i++)
|
||||
{
|
||||
var metaNode = metaNodes.item(i);
|
||||
if (metaNode && metaNode.getAttribute("name") == name)
|
||||
return metaNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var colorString = "color:"+color;
|
||||
switch( ColorPickerID )
|
||||
return null;
|
||||
}
|
||||
|
||||
function CreateMetaElement(name)
|
||||
{
|
||||
metaElement = editorShell.CreateElementWithDefaults("meta");
|
||||
if (metaElement)
|
||||
metaElement.setAttribute("name", name);
|
||||
else
|
||||
dump("Failed to create metaElement!\n");
|
||||
|
||||
return metaElement;
|
||||
}
|
||||
|
||||
function CreateHTTPEquivElement(name)
|
||||
{
|
||||
metaElement = editorShell.CreateElementWithDefaults("meta");
|
||||
if (metaElement)
|
||||
metaElement.setAttribute("http-equiv", name);
|
||||
else
|
||||
dump("Failed to create metaElement for http-equiv!\n");
|
||||
|
||||
return metaElement;
|
||||
}
|
||||
|
||||
// Change "content" attribute on a META element,
|
||||
// or delete entire element it if content is empty
|
||||
// This uses undoable editor transactions
|
||||
function SetMetaElementContent(metaElement, content, insertNew)
|
||||
{
|
||||
if (metaElement)
|
||||
{
|
||||
case "textCP":
|
||||
colorPage.textColor = color;
|
||||
colorPage.NormalText.setAttribute("style",colorString);
|
||||
break;
|
||||
case "linkCP":
|
||||
colorPage.linkColor = color;
|
||||
colorPage.LinkText.setAttribute("style",colorString);
|
||||
break;
|
||||
case "followedCP":
|
||||
colorPage.followedLinkColor = color;
|
||||
colorPage.FollowedLinkText.setAttribute("style",colorString);
|
||||
break;
|
||||
case "activeCP":
|
||||
colorPage.activeLinkColor = color;
|
||||
colorPage.ActiveLinkText.setAttribute("style",colorString);
|
||||
break;
|
||||
case "backgroundCP":
|
||||
colorPage.backgroundColor = color;
|
||||
colorPage.ColorPreview.setAttribute("bgcolor",color);
|
||||
break;
|
||||
if(!content || content == "")
|
||||
{
|
||||
if (!insertNew)
|
||||
editorShell.DeleteElement(metaElement);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (insertNew)
|
||||
{
|
||||
// Don't need undo for set attribute, just for InsertElement
|
||||
metaElement.setAttribute("content", content);
|
||||
AppendHeadElement(metaElement);
|
||||
}
|
||||
else
|
||||
editorShell.SetAttribute(metaElement, "content", content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function RemoveColor(ColorWellID)
|
||||
function GetHeadElement()
|
||||
{
|
||||
var headList = editorShell.editorDocument.getElementsByTagName("head");
|
||||
if (headList)
|
||||
return headList.item(0);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function AppendHeadElement(element)
|
||||
{
|
||||
var head = GetHeadElement();
|
||||
if (head)
|
||||
head.appendChild(element);
|
||||
}
|
||||
|
||||
function ValidateData()
|
||||
{
|
||||
title = dialog.TitleInput.value.trimString();
|
||||
author = dialog.AuthorInput.value.trimString();
|
||||
description = dialog.DescriptionInput.value.trimString();
|
||||
return true;
|
||||
}
|
||||
|
||||
function onOK()
|
||||
{
|
||||
if (ValidateData())
|
||||
{
|
||||
editorShell.BeginBatchChanges();
|
||||
|
||||
return true; // do close the window
|
||||
// Set title contents even if string is empty
|
||||
// because TITLE is a required HTML element
|
||||
editorShell.SetDocumentTitle(title);
|
||||
|
||||
SetMetaElementContent(authorElement, author, insertNewAuthor);
|
||||
SetMetaElementContent(descriptionElement, description, insertNewDescription);
|
||||
|
||||
editorShell.EndBatchChanges();
|
||||
return true; // do close the window
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -43,181 +43,54 @@
|
||||
|
||||
<broadcaster id="args" value=""/>
|
||||
<keyset id="keyset"/>
|
||||
<tabcontrol align="vertical">
|
||||
<tabbox align="horizontal" flex="100%">
|
||||
<tab id="GeneralTab">&generalTab.label;</tab>
|
||||
<tab id="ColorTab">&backgroundTab.label;</tab>
|
||||
<tab id="MetaTab">&metaTagsTab.label;</tab>
|
||||
</tabbox>
|
||||
|
||||
<tabpanel id="tabPanel" flex="100%">
|
||||
<!-- ***** general tab ***** -->
|
||||
<box id="panel1" align="vertical">
|
||||
<html:table>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
&location.label;
|
||||
</html:td>
|
||||
<html:td id="location">
|
||||
<!-- fill in URL at runtime -->
|
||||
</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
&lastModified.label;
|
||||
</html:td>
|
||||
<html:td id="lastModified">
|
||||
<!-- fill in date at runtime -->
|
||||
</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
&titleInput.label;
|
||||
</html:td>
|
||||
<html:td id="titleInput">
|
||||
<html:input type="text" id="titleInput"/>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
&authorInput.label;
|
||||
</html:td>
|
||||
<html:td id="authorInput">
|
||||
<html:input type="text" id="titleInput"/>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
&descriptionInput.label;
|
||||
</html:td>
|
||||
<html:td id="title">
|
||||
<html:input type="text" id="descriptionInput"/>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
</box>
|
||||
|
||||
<!-- **** colors/background tab **** -->
|
||||
<box id="panel2" align="vertical">
|
||||
<html:fieldset><html:legend class = "dialog" align = "left">&pageColors.label;</html:legend>
|
||||
<html:input type="radio" name="ColorMode" id="DefaultColorsRadio"/>
|
||||
<html:label for="DefaultColorsRadio">&defaultColorsRadio.label;</html:label>
|
||||
<html:br/>
|
||||
<html:input type="radio" name="ColorMode" id="CustomColorsRadio"/>
|
||||
<html:label for="CustomColorsRadio">&customColorsRadio.label;</html:label>
|
||||
<html:br/>
|
||||
<html:div>
|
||||
<spring class="bigspacer"/>
|
||||
<box flex="1">
|
||||
<html:label> &colorScheme.label;
|
||||
<html:select id="ColorScheme" size="1" style="min-width: 10em">
|
||||
<html:option> Black on White </html:option>
|
||||
<html:option> Blue on White </html:option>
|
||||
<html:option> White on Black </html:option>
|
||||
</html:select>
|
||||
</html:label>
|
||||
</box>
|
||||
<!-- TODO: COLOR SCHEME SELECT LIST -->
|
||||
</html:div>
|
||||
<spring class="bigspacer"/>
|
||||
<box align="horizontal">
|
||||
<spring class="bigspacer"/>
|
||||
<box align="vertical" flex="100%">
|
||||
<box>
|
||||
<html:label class="margin-both"> &normalText.label; </html:label>
|
||||
<spring flex="100%"/>
|
||||
<menu class="colorpicker">
|
||||
<html:div id="textCW" class="color-well"/>
|
||||
<titledbutton class="popup" align="right" flex="100%" onclick="GetColor('textCP','textCW');"/>
|
||||
<menupopup id="normalMenuPopup">
|
||||
<colorpicker id="textCP" palettename="standard" onclick="GetColor('textCP','textCW');"/>
|
||||
<titledbutton class="push" value="&colorPicker.default.label;" onclick="GetColor('textCP','textCW');"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box>
|
||||
<html:label class="margin-both"> &linkText.label; </html:label>
|
||||
<spring flex="100%"/>
|
||||
<menu class="colorpicker">
|
||||
<html:div id="linkCW" class="color-well"/>
|
||||
<titledbutton class="popup" align="right" flex="100%"/>
|
||||
<menupopup>
|
||||
<colorpicker id="linkCP" palettename="standard" onclick="GetColor('linkCP','linkCW');"/>
|
||||
<titledbutton class="push" value="&colorPicker.default.label;" onclick="RemoveColor('linkCW');"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box>
|
||||
<html:label class="margin-both"> &activeLinkText.label; </html:label>
|
||||
<spring flex="100%"/>
|
||||
<menu class="colorpicker">
|
||||
<html:div id="activeCW" class="color-well"/>
|
||||
<titledbutton class="popup" align="right" flex="100%"/>
|
||||
<menupopup>
|
||||
<colorpicker id="activeCP" palettename="standard" onclick="GetColor('activeCP','activeCW');"/>
|
||||
<titledbutton class="push" value="&colorPicker.default.label;" onclick="RemoveColor('activeCW');"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box>
|
||||
<html:label class="margin-both"> &followedLinkText.label; </html:label>
|
||||
<spring flex="100%"/>
|
||||
<menu class="colorpicker">
|
||||
<html:div id="followedCW" class="color-well"/>
|
||||
<titledbutton class="popup" align="right" flex="100%"/>
|
||||
<menupopup>
|
||||
<colorpicker id="followedCP" palettename="standard" onclick="GetColor('followedCP','followedCW');"/>
|
||||
<titledbutton class="push" value="&colorPicker.default.label;" onclick="RemoveColor('followedCW');"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box>
|
||||
<html:label class="margin-both"> &background.label; </html:label>
|
||||
<spring flex="100%"/>
|
||||
<menu class="colorpicker">
|
||||
<html:div id="backgroundCW" class="color-well"/>
|
||||
<titledbutton class="popup" align="right" flex="100%"/>
|
||||
<menupopup>
|
||||
<colorpicker id="backgroundCP" palettename="standard" onclick="GetColor('backgroundCP','backgroundCW');"/>
|
||||
<titledbutton class="push" value="&colorPicker.default.label;" onclick="RemoveColor('backgroundCW');"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</box>
|
||||
</box>
|
||||
<spring class="bigspacer"/>
|
||||
<box align="vertical" flex="100%" id="ColorPreview">
|
||||
<!-- basestyle="min-height:50px; width: 100%; border: 1px inset #CCCCCC; padding: 5px; " style="min-height:50px; width: 100%; border: 1px inset #CCCCCC; padding: 5px; "-->
|
||||
<html:div id="NormalText">&normalText.label;</html:div>
|
||||
<spring class="spacer"/>
|
||||
<html:div id="LinkText">&linkText.label;</html:div>
|
||||
<spring class="spacer"/>
|
||||
<html:div id="ActiveLinkText">&activeLinkText.label;</html:div>
|
||||
<spring class="spacer"/>
|
||||
<html:div id="FollowedLinkText">&followedLinkText.label;</html:div>
|
||||
</box>
|
||||
</box>
|
||||
</html:fieldset>
|
||||
<box align="horizontal">
|
||||
<html:input type="checkbox" id="BackgroundImageCheckbox"/>
|
||||
<html:label for="BackgroundImageCheckbox"> &backgroundImage.label; </html:label>
|
||||
</box>
|
||||
<box align="horizontal">
|
||||
<html:input type="text" class="SizeToParent" id="BackgroundImageInput" size="20"/>
|
||||
<spring class="spacer"/>
|
||||
<!-- from EdDialogOverlay.xul -->
|
||||
<titledbutton id="ChooseFile"/>
|
||||
</box>
|
||||
</box> <!-- end of colors tab -->
|
||||
|
||||
<!-- **** meta tags tab **** -->
|
||||
<box id="panel3" align="vertical">
|
||||
</box>
|
||||
</tabpanel>
|
||||
</tabcontrol>
|
||||
<box id="okCancelButtons"/>
|
||||
|
||||
<box>
|
||||
<text value="&location.label;" flex ="1" align="left"/>
|
||||
<spring class="spacer"/>
|
||||
<spring flex="1"/>
|
||||
<text class="MinWidth200" value="&locationNewPage.label;" id="PageLocation" align="left"/>
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box>
|
||||
<text value="&lastModified.label;" flex ="1" align="left"/>
|
||||
<spring class="spacer"/>
|
||||
<spring flex="1"/>
|
||||
<text class="MinWidth200" value="[fill this in!]" id="PageModDate" align="left"/>
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box>
|
||||
<text value="&titleInput.label;" flex ="1" align="left"/>
|
||||
<spring class="spacer"/>
|
||||
<spring flex="1"/>
|
||||
<html:input class="MinWidth200" type="text" id="TitleInput"/>
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box>
|
||||
<text value="&authorInput.label;" flex ="1" align="left"/>
|
||||
<spring class="spacer"/>
|
||||
<spring flex="1"/>
|
||||
<html:input class="MinWidth200" type="text" id="AuthorInput"/>
|
||||
</box>
|
||||
<spring class="spacer"/>
|
||||
<box>
|
||||
<text value="&descriptionInput.label;" flex ="1" align="left"/>
|
||||
<spring flex="1"/>
|
||||
<html:input class="MinWidth200" type="text" id="DescriptionInput"/>
|
||||
</box>
|
||||
<spring class="bigspacer"/>
|
||||
<box align="horizontal">
|
||||
<titledbutton
|
||||
class = "push dialog"
|
||||
id = "MoreFewerButton"
|
||||
align = "left"
|
||||
onclick = "onMoreFewer()"
|
||||
persist = "more"/>
|
||||
<spring flex="1"/>
|
||||
</box>
|
||||
<box id="MoreSection" align="vertical" flex="1">
|
||||
<spring class="bigspacer"/>
|
||||
<html:div> [Meta Tags editing widgets will go here] </html:div>
|
||||
<spring class="bigspacer"/>
|
||||
</box>
|
||||
<html:div class="separator" align="horizontal"/>
|
||||
<box id="okCancelButtons"/>
|
||||
</window>
|
||||
|
@ -23,7 +23,14 @@
|
||||
|
||||
//Cancel() is in EdDialogCommon.js
|
||||
var tagname = "table"
|
||||
var tableElement;
|
||||
var TableElement;
|
||||
var CellElement;
|
||||
var TabPanel;
|
||||
var TablePanel;
|
||||
var CellPanel;
|
||||
var dialog;
|
||||
var cellGlobalElement;
|
||||
var tableGlobalElement
|
||||
|
||||
// dialog initialization code
|
||||
function Startup()
|
||||
@ -31,21 +38,81 @@ function Startup()
|
||||
if (!InitEditorShell())
|
||||
return;
|
||||
|
||||
doSetOKCancel(onOK, null);
|
||||
dialog = new Object;
|
||||
if (!dialog)
|
||||
{
|
||||
dump("Failed to create dialog object!!!\n");
|
||||
window.close();
|
||||
}
|
||||
|
||||
// Create dialog object to store controls for easy access
|
||||
// GET EACH CONTROL -- E.G.:
|
||||
//dialog.editBox = document.getElementById("editBox");
|
||||
|
||||
var table = editorShell.GetElementOrParentByTagName(tagname, null);
|
||||
if(!tableElement)
|
||||
TableElement = editorShell.GetElementOrParentByTagName("table", null);
|
||||
CellElement = editorShell.GetElementOrParentByTagName("td", null);
|
||||
// We allow a missing cell -- see below
|
||||
if(!TableElement)
|
||||
{
|
||||
dump("Failed to get selected element or create a new one!\n");
|
||||
window.close();
|
||||
}
|
||||
|
||||
globalElement = tableElement.cloneNode(false);
|
||||
var panelName;
|
||||
TabPanel = document.getElementById("TabPanel");
|
||||
TablePanel = document.getElementById("TablePanel");
|
||||
CellPanel = document.getElementById("CellPanel");
|
||||
var TableTab = document.getElementById("TableTab");
|
||||
var CellTab = document.getElementById("CellTab");
|
||||
|
||||
if (!TabPanel || !TablePanel || !CellPanel || !TableTab || !CellTab)
|
||||
{
|
||||
dump("Not all dialog controls were found!!!\n");
|
||||
window.close;
|
||||
}
|
||||
|
||||
// Get the starting TabPanel name
|
||||
var StartPanelName = window.arguments[1];
|
||||
|
||||
tableGlobalElement = TableElement.cloneNode(false);
|
||||
if (CellElement)
|
||||
cellGlobalElement = CellElement.cloneNode(false);
|
||||
|
||||
// Activate the Cell Panel if requested
|
||||
if (StartPanelName == "CellPanel")
|
||||
{
|
||||
// We must have a cell element to start in this panel
|
||||
if(!CellElement)
|
||||
{
|
||||
dump("Failed to get selected element or create a new one!\n");
|
||||
window.close();
|
||||
}
|
||||
|
||||
//Set index for starting panel on the <tabpanel> element
|
||||
TabPanel.setAttribute("index", 1);
|
||||
|
||||
// Trigger setting of style for the tab widgets
|
||||
CellTab.setAttribute("selected", "true");
|
||||
TableTab.removeAttribute("selected");
|
||||
|
||||
// Start editing on the cell element
|
||||
globalElement = cellGlobalElement;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Start editing on the table element
|
||||
globalElement = cellGlobalElement;
|
||||
}
|
||||
|
||||
if(!CellElement)
|
||||
{
|
||||
// Disable the Cell Properties tab -- only allow table props
|
||||
CellTab.setAttribute("disabled", "true");
|
||||
}
|
||||
|
||||
doSetOKCancel(onOK, null);
|
||||
|
||||
// Get widgets
|
||||
dialog.BorderWidthCheck = document.getElementById("BorderWidthCheck");
|
||||
dialog.BorderWidthInput = document.getElementById("BorderWidthInput");
|
||||
|
||||
|
||||
// This uses values set on globalElement
|
||||
InitDialog();
|
||||
|
||||
@ -55,12 +122,40 @@ function Startup()
|
||||
|
||||
function InitDialog()
|
||||
{
|
||||
dump{"Table Editing:InitDialog()\n");
|
||||
dump("Table Editing:InitDialog()\n");
|
||||
}
|
||||
|
||||
function SelectTableTab()
|
||||
{
|
||||
globalElement = tableGlobalElement;
|
||||
}
|
||||
|
||||
function SelectCellTab()
|
||||
{
|
||||
globalElement = cellGlobalElement;
|
||||
}
|
||||
|
||||
function GetColorAndUpdate(ColorPickerID, ColorWellID, widget)
|
||||
{
|
||||
// Close the colorpicker
|
||||
widget.parentNode.closePopup();
|
||||
SetColor(ColorWellID, getColor(ColorPickerID));
|
||||
}
|
||||
|
||||
function SetColor(ColorWellID, color)
|
||||
{
|
||||
// Save the color
|
||||
if (ColorWellID == "cellBackgroundCW")
|
||||
dialog.cellBackgroundColor = color;
|
||||
else
|
||||
dialog.tableBackgroundColor = color;
|
||||
|
||||
setColorWell(ColorWellID, color);
|
||||
}
|
||||
|
||||
function ValidateData()
|
||||
{
|
||||
dump{"Table Editing:ValidateData()\n");
|
||||
dump("Table Editing:ValidateData()\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -68,7 +163,7 @@ function onOK()
|
||||
{
|
||||
if (ValidateData())
|
||||
{
|
||||
editorShell.CloneAttributes(tableElement, globalElement);
|
||||
editorShell.CloneAttributes(TableElement, globalElement);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -45,345 +45,357 @@
|
||||
<broadcaster id="args" value=""/>
|
||||
<keyset id="keyset"/>
|
||||
|
||||
<tabcontrol align="vertical">
|
||||
<tabbox align="horizontal" flex="100%">
|
||||
<tab selected="true">&tableTab.label;</tab>
|
||||
<tab>&cellTab.label;</tab>
|
||||
<spring flex="1"/>
|
||||
</tabbox>
|
||||
|
||||
<tabpanel flex="100%">
|
||||
<!-- table tab -->
|
||||
<box align="vertical" class="panel">
|
||||
<html:fieldset class="holder">
|
||||
<html:legend>&tableSize.label;</html:legend>
|
||||
<html:table width="350">
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="tableRows.text">&tableRows.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="tableRows.text" size="3"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="checkbox" id="tableHeight.check"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:label for="tableHeight.check">&tableHeight.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="tableHeight.text" size="3"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:select id="heightUnits">
|
||||
<html:option value="px">&tablePixels.label;</html:option>
|
||||
<html:option value="pc">&tablePercent.label;</html:option>
|
||||
</html:select>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="tableColumns.text">&tableColumns.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="tableColumns.text" size="3"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="checkbox" id="tableWidth.check"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:label for="tableWidth.check">&tableWidth.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="tableWidth.text" size="3"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:select id="widthUnits">
|
||||
<html:option value="px">&tablePixels.label;</html:option>
|
||||
<html:option value="pc">&tablePercent.label;</html:option>
|
||||
</html:select>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
</html:fieldset>
|
||||
<box align="horizontal">
|
||||
<html:fieldset flex="100%">
|
||||
<html:legend>&tableBorderSpacing.label;</html:legend>
|
||||
<html:table>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:input type="checkbox" id="border.check"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:label for="border.check">&tableBorderWidth.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="borderWidth.text" size="3"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:div>&tablePixels.label;</html:div>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
<html:table>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="spacing.text">&tableSpacing.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="spacing.text" size="3"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:div>&tablePxBetwCells.label;</html:div>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="padding.text">&tablePadding.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="padding.text" size="3"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:div>&tablePxBetwBrdrCellContent.label;</html:div>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
</html:fieldset>
|
||||
<box align="vertical" flex="100%">
|
||||
<spring flex="100%"/>
|
||||
<html:table>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="alignment.select">&tableAlignment.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:select id="alignment.select">
|
||||
<html:option value="left">&tableAlignLeft.label;</html:option>
|
||||
<html:option value="center">&tableAlignCenter.label;</html:option>
|
||||
<html:option value="right">&tableAlignRight.label;</html:option>
|
||||
</html:select>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
<spring flex="100%"/>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="caption.select">&tableCaption.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:select id="caption.select">
|
||||
<html:option value="none">&tableCaptionNone.label;</html:option>
|
||||
<html:option value="above">&tableCaptionAbove.label;</html:option>
|
||||
<html:option value="below">&tableCaptionBelow.label;</html:option>
|
||||
</html:select>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
<spring flex="100%"/>
|
||||
</box>
|
||||
</box>
|
||||
<html:fieldset>
|
||||
<html:legend>&tableBackground.label;</html:legend>
|
||||
<html:table width="100%">
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="bgcolor.select">&tableColor.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:select id="bgcolor.select">
|
||||
<html:option> </html:option>
|
||||
</html:select>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="bgimage.text">&tableImage.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="bgimage.text" style="width: 70%;"/>
|
||||
<titledbutton class="push" value="&tableChooseImage.label;" id="bgimage.button"/>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td/>
|
||||
<html:td>
|
||||
<html:input type="checkbox" id="leaveLoc.check"/>
|
||||
<html:label for="leaveLoc.check">&tableLeaveImageAtLocation.label;</html:label>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
</html:fieldset>
|
||||
<tabcontrol align="vertical">
|
||||
<tabbox align="horizontal" flex="100%">
|
||||
<tab id="TableTab" selected="true" onclick="SelectTableTab()">&tableTab.label;</tab>
|
||||
<tab id="CellTab" onclick="SelectCellTab()">&cellTab.label;</tab>
|
||||
<spring flex="1"/>
|
||||
</tabbox>
|
||||
|
||||
<tabpanel id="TabPanel" flex="100%">
|
||||
<!-- table panel -->
|
||||
<box id="TablePanel" align="vertical" class="panel">
|
||||
<titledbox class="holder">
|
||||
<title>&tableSize.label;</title>
|
||||
<html:table width="350">
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="tableRows.text">&tableRows.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="tableRows.text" size="3"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="checkbox" id="tableHeight.check"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:label for="tableHeight.check">&tableHeight.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="tableHeight.text" size="3"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:select id="heightUnits">
|
||||
<html:option value="px">&tablePixels.label;</html:option>
|
||||
<html:option value="pc">&tablePercent.label;</html:option>
|
||||
</html:select>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="tableColumns.text">&tableColumns.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="tableColumns.text" size="3"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="checkbox" id="tableWidth.check"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:label for="tableWidth.check">&tableWidth.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="tableWidth.text" size="3"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:select id="widthUnits">
|
||||
<html:option value="px">&tablePixels.label;</html:option>
|
||||
<html:option value="pc">&tablePercent.label;</html:option>
|
||||
</html:select>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
</titledbox>
|
||||
<box align="horizontal">
|
||||
<titledbox flex="100%">
|
||||
<title>&tableBorderSpacing.label;</title>
|
||||
<html:table>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:input type="checkbox" id="BorderWidthCheck"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:label for="BorderWidthCheck">&tableBorderWidth.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="BorderWidthInput" size="3"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:div>&tablePixels.label;</html:div>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
<html:table>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="spacing.text">&tableSpacing.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="spacing.text" size="3"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:div>&tablePxBetwCells.label;</html:div>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="padding.text">&tablePadding.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="padding.text" size="3"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:div>&tablePxBetwBrdrCellContent.label;</html:div>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
</titledbox>
|
||||
<box align="vertical" flex="100%">
|
||||
<spring flex="100%"/>
|
||||
<html:table>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="alignment.select">&tableAlignment.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:select id="alignment.select">
|
||||
<html:option value="left">&tableAlignLeft.label;</html:option>
|
||||
<html:option value="center">&tableAlignCenter.label;</html:option>
|
||||
<html:option value="right">&tableAlignRight.label;</html:option>
|
||||
</html:select>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
<spring flex="100%"/>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="caption.select">&tableCaption.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:select id="caption.select">
|
||||
<html:option value="none">&tableCaptionNone.label;</html:option>
|
||||
<html:option value="above">&tableCaptionAbove.label;</html:option>
|
||||
<html:option value="below">&tableCaptionBelow.label;</html:option>
|
||||
</html:select>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
<spring flex="100%"/>
|
||||
</box>
|
||||
|
||||
<!-- cell tab -->
|
||||
<box align="vertical" class="panel">
|
||||
<html:fieldset class="holder">
|
||||
<html:legend>&cellSelection.label;</html:legend>
|
||||
<html:table width="350">
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:select id="selection.select">
|
||||
<html:option value="cell">&cellSelectionCell.label;</html:option>
|
||||
<html:option value="row">&cellSelectionRow.label;</html:option>
|
||||
<html:option value="column">&cellSelectionColumn.label;</html:option>
|
||||
</html:select>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<titledbutton class="push" value="&cellSelectionPrevious.label;" id="previous.button"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<titledbutton class="push" value="&cellSelectionNext.label;" id="next.button"/>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
</html:fieldset>
|
||||
<!-- cell size fieldset -->
|
||||
<html:fieldset>
|
||||
<html:legend>&tableSize.label;</html:legend>
|
||||
</box>
|
||||
<titledbox>
|
||||
<title>&tableBackground.label;</title>
|
||||
<html:table width="100%">
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="bgcolor.select">&tableColor.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<menu class="colorpicker">
|
||||
<html:div id="tableBackgroundCW" class="color-well"/>
|
||||
<titledbutton class="popup" align="right" flex="1"/>
|
||||
<menupopup>
|
||||
<colorpicker id="tableBackgroundCP" palettename="standard" onclick="GetColorAndUpdate('tableBackgroundCP','tableBackgroundCW',this);"/>
|
||||
<titledbutton class="push" value="&defaultColor.label;" onclick="GetColorAndUpdate('tableBackgroundCP','tableBackgroundCW',this"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="bgimage.text">&tableImage.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="bgimage.text" style="width: 70%;"/>
|
||||
<titledbutton class="push" value="&tableChooseImage.label;" id="bgimage.button"/>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td/>
|
||||
<html:td>
|
||||
<html:input type="checkbox" id="leaveLoc.check"/>
|
||||
<html:label for="leaveLoc.check">&tableLeaveImageAtLocation.label;</html:label>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
</titledbox>
|
||||
</box>
|
||||
|
||||
<!-- cell panel -->
|
||||
<box id="CellPanel" align="vertical" class="panel">
|
||||
<titledbox class="holder">
|
||||
<title>&cellSelection.label;</title>
|
||||
<html:table width="350">
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:select id="selection.select">
|
||||
<html:option value="cell">&cellSelectionCell.label;</html:option>
|
||||
<html:option value="row">&cellSelectionRow.label;</html:option>
|
||||
<html:option value="column">&cellSelectionColumn.label;</html:option>
|
||||
</html:select>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<titledbutton class="push" value="&cellSelectionPrevious.label;" id="previous.button"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<titledbutton class="push" value="&cellSelectionNext.label;" id="next.button"/>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
</titledbox>
|
||||
<!-- cell size fieldset -->
|
||||
<titledbox>
|
||||
<title>&tableSize.label;</title>
|
||||
<html:table>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:input type="checkbox" id="cellHeight.check"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:label for="tableHeight.check">&tableHeight.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="cellHeight.text" size="3"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:select id="cellHeightUnits">
|
||||
<html:option value="px">&tablePixels.label;</html:option>
|
||||
<html:option value="pc">&tablePercent.label;</html:option>
|
||||
</html:select>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:label for="rows.text">&cellSpans.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="rows.text" size="3"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:div>&cellSpanRows.label;</html:div>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:input type="checkbox" id="tableWidth.check"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:label for="tableWidth.check">&tableWidth.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="tableWidth.text" size="3"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:select id="cellWidthUnits">
|
||||
<html:option value="px">&tablePixels.label;</html:option>
|
||||
<html:option value="pc">&tablePercent.label;</html:option>
|
||||
</html:select>
|
||||
</html:td>
|
||||
<html:td> </html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="cols.text" size="3"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:div>&cellSpanCols.label;</html:div>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
</titledbox>
|
||||
<box align="horizontal">
|
||||
<titledbox flex="100%">
|
||||
<title>&cellContentAlignment.label;</title>
|
||||
<html:table>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="horzAlignment.select">&cellHorizontal.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:select id="horzAlignment.select">
|
||||
<html:option value="left">&tableAlignLeft.label;</html:option>
|
||||
<html:option value="center">&tableAlignCenter.label;</html:option>
|
||||
<html:option value="right">&tableAlignRight.label;</html:option>
|
||||
</html:select>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="vertAlignment.select">&cellVertical.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:select id="vertAlignment.select">
|
||||
<html:option value="top">&cellAlignTop.label;</html:option>
|
||||
<html:option value="center">&cellAlignCenter.label;</html:option>
|
||||
<html:option value="bottom">&cellAlignBottom.label;</html:option>
|
||||
</html:select>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
</titledbox>
|
||||
<box align="vertical">
|
||||
<titledbox>
|
||||
<title>&cellTextStyle.label;</title>
|
||||
<html:table>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:input type="checkbox" id="cellHeight.check"/>
|
||||
<html:input type="checkbox" id="header.check"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:label for="tableHeight.check">&tableHeight.label;</html:label>
|
||||
<html:label for="header.check">&cellHeader.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="cellHeight.text" size="3"/>
|
||||
<html:input type="checkbox" id="nonbreaking.check"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:select id="cellHeightUnits">
|
||||
<html:option value="px">&tablePixels.label;</html:option>
|
||||
<html:option value="pc">&tablePercent.label;</html:option>
|
||||
</html:select>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:label for="rows.text">&cellSpans.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="rows.text" size="3"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:div>&cellSpanRows.label;</html:div>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:input type="checkbox" id="tableWidth.check"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:label for="tableWidth.check">&tableWidth.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="tableWidth.text" size="3"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:select id="cellWidthUnits">
|
||||
<html:option value="px">&tablePixels.label;</html:option>
|
||||
<html:option value="pc">&tablePercent.label;</html:option>
|
||||
</html:select>
|
||||
</html:td>
|
||||
<html:td> </html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="cols.text" size="3"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:div>&cellSpanCells.label;</html:div>
|
||||
<html:label for="nonbreaking.check">&cellNonbreaking.label;</html:label>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
</html:fieldset>
|
||||
<box align="horizontal">
|
||||
<html:fieldset flex="100%">
|
||||
<html:legend>&cellContentAlignment.label;</html:legend>
|
||||
<html:table>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="horzAlignment.select">&cellHorizontal.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:select id="horzAlignment.select">
|
||||
<html:option value="left">&tableAlignLeft.label;</html:option>
|
||||
<html:option value="center">&tableAlignCenter.label;</html:option>
|
||||
<html:option value="right">&tableAlignRight.label;</html:option>
|
||||
</html:select>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="vertAlignment.select">&cellVertical.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:select id="vertAlignment.select">
|
||||
<html:option value="top">&cellAlignTop.label;</html:option>
|
||||
<html:option value="center">&cellAlignCenter.label;</html:option>
|
||||
<html:option value="bottom">&cellAlignBottom.label;</html:option>
|
||||
</html:select>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
</html:fieldset>
|
||||
<box align="vertical">
|
||||
<html:fieldset>
|
||||
<html:legend>&cellTextStyle.label;</html:legend>
|
||||
<html:table>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:input type="checkbox" id="header.check"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:label for="header.check">&cellHeader.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="checkbox" id="nonbreaking.check"/>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:label for="nonbreaking.check">&cellNonbreaking.label;</html:label>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
</html:fieldset>
|
||||
<spring flex="100%"/>
|
||||
</box>
|
||||
</box>
|
||||
|
||||
<html:fieldset>
|
||||
<html:legend>&tableBackground.label;</html:legend>
|
||||
<html:table width="100%">
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="cellbgcolor.select">&tableColor.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:select id="cellbgcolor.select">
|
||||
<html:option> </html:option>
|
||||
</html:select>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="cellbgimage.text">&tableImage.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="cellbgimage.text" style="width: 70%;"/>
|
||||
<titledbutton class="push" value="&tableChooseImage.label;" id="cellbgimage.button"/>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td/>
|
||||
<html:td>
|
||||
<html:input type="checkbox" id="cellleaveLoc.check"/>
|
||||
<html:label for="cellleaveLoc.check">&tableLeaveImageAtLocation.label;</html:label>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
</html:fieldset>
|
||||
</titledbox>
|
||||
<spring flex="100%"/>
|
||||
</box>
|
||||
</tabpanel>
|
||||
</tabcontrol>
|
||||
<!-- from EdDialogOverlay -->
|
||||
<box id="AdvancedEdit"/>
|
||||
<spring flex="100%"/>
|
||||
<box id="okCancelButtons"/>
|
||||
</box>
|
||||
|
||||
<titledbox>
|
||||
<title>&tableBackground.label;</title>
|
||||
<html:table width="100%">
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="cellbgcolor.select">&tableColor.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<menu class="colorpicker">
|
||||
<html:div id="cellBackgroundCW" class="color-well"/>
|
||||
<titledbutton class="popup" align="right" flex="1"/>
|
||||
<menupopup>
|
||||
<colorpicker id="cellBackgroundCP" palettename="standard"
|
||||
onclick="GetColorAndUpdate('cellBackgroundCP','cellBackgroundCW',this)"/>
|
||||
<titledbutton class="push" value="&defaultColor.label;"
|
||||
onclick="GetColorAndUpdate('cellBackgroundCP','cellBackgroundCW',this)"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td>
|
||||
<html:label for="cellbgimage.text">&tableImage.label;</html:label>
|
||||
</html:td>
|
||||
<html:td>
|
||||
<html:input type="text" id="cellbgimage.text" style="width: 70%;"/>
|
||||
<titledbutton class="push" value="&tableChooseImage.label;" id="cellbgimage.button"/>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
<html:tr>
|
||||
<html:td/>
|
||||
<html:td>
|
||||
<html:input type="checkbox" id="cellleaveLoc.check"/>
|
||||
<html:label for="cellleaveLoc.check">&tableLeaveImageAtLocation.label;</html:label>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
</titledbox>
|
||||
</box>
|
||||
</tabpanel>
|
||||
</tabcontrol>
|
||||
<!-- from EdDialogOverlay -->
|
||||
<box id="AdvancedEdit"/>
|
||||
<spring flex="100%"/>
|
||||
<box id="okCancelButtons"/>
|
||||
|
||||
</window>
|
||||
|
@ -29,7 +29,10 @@
|
||||
<!ENTITY normalText.label "Normal text:">
|
||||
<!ENTITY linkText.label "Link text:">
|
||||
<!ENTITY activeLinkText.label "Active link text:">
|
||||
<!ENTITY followedLinkText.label "Followed link text:">
|
||||
<!ENTITY visitedLinkText.label "Visited link text:">
|
||||
<!ENTITY background.label "Background:">
|
||||
<!ENTITY backgroundImage.label "Background Image: ">
|
||||
<!ENTITY colorPicker.default.label "Don't Specify Color">
|
||||
<!ENTITY backgroundImage.label "Background Image (Uncheck to edit without image): ">
|
||||
<!ENTITY colorPicker.default.label "Don't specify color">
|
||||
<!ENTITY saveImageMsg.label "Location will be saved so you can use it later.">
|
||||
|
||||
|
||||
|
@ -24,12 +24,12 @@
|
||||
<!-- Window title -->
|
||||
<!ENTITY windowTitle.label "Horizontal Line Properties">
|
||||
|
||||
<!ENTITY dimensionsFieldset.label "Dimensions">
|
||||
<!ENTITY dimensionsBox.label "Dimensions">
|
||||
<!ENTITY heightEditField.label "Height">
|
||||
<!ENTITY widthEditField.label "Width">
|
||||
<!ENTITY pixelsPopup.value "pixels">
|
||||
<!ENTITY percentPopup.value "percent">
|
||||
<!ENTITY alignmentFieldset.label "Alignment">
|
||||
<!ENTITY alignmentBox.label "Alignment">
|
||||
<!ENTITY leftPopup.value "Left">
|
||||
<!ENTITY centerPopup.value "Center">
|
||||
<!ENTITY rightPopup.value "Right">
|
||||
|
@ -28,13 +28,13 @@
|
||||
<!ENTITY pixelsPopup.value "pixels">
|
||||
<!ENTITY percentPopup.value "percent">
|
||||
|
||||
<!-- These are in the location fieldset. -->
|
||||
<!ENTITY locationFieldset.label "Image Information">
|
||||
<!-- These are in the location box. -->
|
||||
<!ENTITY locationBox.label "Image Information">
|
||||
<!ENTITY locationEditField.label "Image URL">
|
||||
<!ENTITY altTextEditField.label "Alternative Text">
|
||||
|
||||
<!-- These controls are in the Dimensions Fieldset of the expanded area -->
|
||||
<!ENTITY dimensionsFieldset.label "Dimensions">
|
||||
<!-- These controls are in the Dimensions box of the expanded area -->
|
||||
<!ENTITY dimensionsBox.label "Dimensions">
|
||||
<!ENTITY originalSizeRadio.label "Original Size">
|
||||
<!ENTITY customSizeRadio.label "Custom Size">
|
||||
<!ENTITY heightEditField.label "Height">
|
||||
@ -49,8 +49,8 @@
|
||||
<!ENTITY wrapRightPopup.value "wrap to the right">
|
||||
<!ENTITY wrapLeftPopup.value "wrap to the left">
|
||||
|
||||
<!-- These controls are in the Spacing Fieldset of the expanded area -->
|
||||
<!ENTITY spacingFieldset.label "Spacing">
|
||||
<!-- These controls are in the Spacing Box of the expanded area -->
|
||||
<!ENTITY spacingBox.label "Spacing">
|
||||
<!ENTITY leftRightEditField.label "Left and Right">
|
||||
<!ENTITY topBottomEditField.label "Top and Bottom">
|
||||
<!ENTITY borderEditField.label "Solid Border">
|
||||
|
@ -23,12 +23,12 @@
|
||||
<!-- Window title -->
|
||||
<!ENTITY windowTitle.label "Insert Table">
|
||||
|
||||
<!ENTITY numRowsEditField.label "Number of rows">
|
||||
<!ENTITY numColumnsEditField.label "Number of columns">
|
||||
<!ENTITY widthEditField.label "Table Width">
|
||||
<!ENTITY borderEditField.label "Border">
|
||||
<!ENTITY numRowsEditField.label "Number of rows:">
|
||||
<!ENTITY numColumnsEditField.label "Number of columns:">
|
||||
<!ENTITY widthEditField.label "Table width:">
|
||||
<!ENTITY borderEditField.label "Border:">
|
||||
|
||||
<!ENTITY alignmentFieldset.label "Alignment">
|
||||
<!ENTITY alignmentBox.label "Alignment:">
|
||||
<!ENTITY leftPopup.value "Left">
|
||||
<!ENTITY centerPopup.value "Center">
|
||||
<!ENTITY rightPopup.value "Right">
|
||||
|
@ -30,11 +30,12 @@
|
||||
<!-- These strings are for use specifically in the editor's link dialog. -->
|
||||
<!ENTITY windowTitle.label "Link Properties">
|
||||
|
||||
<!-- These are in the link source fieldset. -->
|
||||
<!ENTITY LinkText.label "Link text:">
|
||||
<!-- These are in the link source box. -->
|
||||
<!ENTITY LinkTitle.label "Link text:">
|
||||
<!ENTITY LinkImage.label "Link text:">
|
||||
|
||||
<!-- These controls are in the Dimensions Fieldset of the advanced area -->
|
||||
<!ENTITY LinkURLFieldset.label "Link to">
|
||||
<!-- These controls are in the Dimensions box of the advanced area -->
|
||||
<!ENTITY LinkURLBox.label "Link to:">
|
||||
<!ENTITY LinkURLEditField.label "Enter a web page location or local file:">
|
||||
<!ENTITY RemoveLinkButton.label "Remove Link">
|
||||
<!ENTITY NamedAnchorMsg.label "or select a Named Anchor:">
|
||||
|
@ -22,22 +22,9 @@
|
||||
|
||||
<!-- Window title -->
|
||||
<!ENTITY windowTitle.label "Page Properties">
|
||||
<!ENTITY generalTab.label "General">
|
||||
<!ENTITY backgroundTab.label "Colors and Background">
|
||||
<!ENTITY metaTagsTab.label "Meta Tags">
|
||||
<!ENTITY location.label "Location">
|
||||
<!ENTITY lastModified.label "Last Modified">
|
||||
<!ENTITY titleInput.label "Title">
|
||||
<!ENTITY authorInput.label "Author">
|
||||
<!ENTITY descriptionInput.label "Description">
|
||||
<!ENTITY pageColors.label "Page Colors">
|
||||
<!ENTITY defaultColorsRadio.label "Don't specify colors">
|
||||
<!ENTITY customColorsRadio.label "Use custom colors:">
|
||||
<!ENTITY colorScheme.label "Color Schemes:">
|
||||
<!ENTITY normalText.label "Normal text:">
|
||||
<!ENTITY linkText.label "Link text:">
|
||||
<!ENTITY activeLinkText.label "Active link text:">
|
||||
<!ENTITY followedLinkText.label "Followed link text:">
|
||||
<!ENTITY background.label "Background:">
|
||||
<!ENTITY backgroundImage.label "Background Image:">
|
||||
<!ENTITY colorPicker.default.label "Don't Specify Color">
|
||||
<!ENTITY location.label "Location:">
|
||||
<!ENTITY lastModified.label "Last Modified:">
|
||||
<!ENTITY titleInput.label "Title:">
|
||||
<!ENTITY authorInput.label "Author:">
|
||||
<!ENTITY descriptionInput.label "Description:">
|
||||
<!ENTITY locationNewPage.label "[New page, not saved yet]">
|
||||
|
@ -35,7 +35,7 @@
|
||||
<!ENTITY tableSpacing.label "Spacing:">
|
||||
<!ENTITY tablePadding.label "Padding:">
|
||||
<!ENTITY tablePxBetwCells.label "pixels between cells">
|
||||
<!ENTITY tablePxBetwBrdrCellContent.label "pixels between border <html:br/> and cell content">
|
||||
<!ENTITY tablePxBetwBrdrCellContent.label "pixels between border<html:br/>and cell content">
|
||||
<!ENTITY tableBackground.label "Background">
|
||||
<!ENTITY tableColor.label "Color:">
|
||||
<!ENTITY tableImage.label "Image:">
|
||||
@ -67,4 +67,5 @@
|
||||
<!ENTITY cellAlignCenter.label "Center">
|
||||
<!ENTITY cellAlignBottom.label "Bottom">
|
||||
<!ENTITY cellSpanRows.label "rows">
|
||||
<!ENTITY cellSpanCells.label "cells">
|
||||
<!ENTITY cellSpanCols.label "columns">
|
||||
<!ENTITY defaultColor.label "Don't specify color">
|
||||
|
@ -27,8 +27,6 @@
|
||||
*/
|
||||
|
||||
|
||||
/* HTML ELEMENTS */
|
||||
|
||||
table { cell-spacing: 0px; }
|
||||
td, table { border: 0px;}
|
||||
|
||||
@ -37,6 +35,10 @@ tr {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
input.MinWidth200, text.MinWidth200, titledbutton.MinWidth200 {
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
select.SpellCheckList, select.SpellCheckLanguage, input.SpellCheckWord {
|
||||
width: 200px;
|
||||
}
|
||||
@ -68,17 +70,35 @@ div.color-well {
|
||||
width:20px;
|
||||
border: 1px inset #CCCCCC;
|
||||
/* Background color is set at runtime */
|
||||
background-color: red;
|
||||
}
|
||||
div.color-well[default="true"] {
|
||||
border: 1px solid transparent;
|
||||
background-color: inherit;
|
||||
}
|
||||
|
||||
td#ColorPreview {
|
||||
border: 1px inset #CCCCCC;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
min-width: 100px;
|
||||
min-height: 50px;
|
||||
}
|
||||
|
||||
/* A line of text inside the preview cell */
|
||||
td#ColorPreview div {
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
/* XUL ELEMENTS */
|
||||
box#ColorPreview {
|
||||
border: 1px inset #CCCCCC;
|
||||
padding: 5px;
|
||||
width: 100%;
|
||||
min-height: 50px;
|
||||
height: 100px;
|
||||
background-color: white;
|
||||
|
||||
/* SHOULD GO IN GLOBAL.CSS */
|
||||
text {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
text[hidden="true"], input[hidden="true"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* values = margin, padding. Padding doesn't work yet */
|
||||
@ -92,9 +112,8 @@ select#alignTypeSelect,label#alignLabel {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
/* For right-aligned buttons - TODO: RESOLVE PROBLEM WITH FIELDSET MARGINS */
|
||||
/* For right-aligned buttons */
|
||||
titledbutton#AdvancedEditButton,titledbutton#AdvancedEditExtraButton,titledbutton#SaveDefault {
|
||||
margin-right: 6px;
|
||||
min-width: 8em;
|
||||
}
|
||||
|
||||
@ -122,9 +141,26 @@ titledbutton#MisspelledWord {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
text#linkTextCaption {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* For a column of right-aligned text before
|
||||
a column of input fields, e.g., InsertTable dialog
|
||||
*/
|
||||
text.right {
|
||||
/* doesn't work yet! must use align="right" in <text> */
|
||||
text-align: right;
|
||||
margin-right: 5px;
|
||||
/* Kludge: this needs to be wide enoungh for longest string */
|
||||
min-width: 10em;
|
||||
}
|
||||
|
||||
/* need rule for outset shape */
|
||||
menu.colorpicker {
|
||||
border: 1px outset #CCCCCC;
|
||||
/* For a little extra space between buttons */
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
titledbutton.color-well {
|
||||
@ -199,7 +235,12 @@ div.tagname {
|
||||
}
|
||||
|
||||
div#tagLabel {
|
||||
font-weight: bold;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* In Color Properties dialog */
|
||||
div#SaveImageMsg {
|
||||
max-width: 150px;
|
||||
}
|
||||
|
||||
/* styles for an attribute tree-table */
|
||||
|
Loading…
x
Reference in New Issue
Block a user