Lots and lots of bug fixes and XUL widget conversions. Work in progress, but must checkin to allow XPFE to fix bugs

This commit is contained in:
cmanske%netscape.com 2000-04-14 03:19:31 +00:00
Родитель 719e76556e
Коммит d5c3bc9965
57 изменённых файлов: 1569 добавлений и 801 удалений

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

@ -55,6 +55,7 @@ nsIAtom * nsIEditProperty::abbr;
nsIAtom * nsIEditProperty::acronym;
nsIAtom * nsIEditProperty::font;
nsIAtom * nsIEditProperty::a;
nsIAtom * nsIEditProperty::href;
nsIAtom * nsIEditProperty::img;
nsIAtom * nsIEditProperty::object;
nsIAtom * nsIEditProperty::br;
@ -154,6 +155,7 @@ nsEditProperty::nsEditProperty()
nsIEditProperty::acronym = NS_NewAtom("acronym");
nsIEditProperty::font = NS_NewAtom("font");
nsIEditProperty::a = NS_NewAtom("a");
nsIEditProperty::href = NS_NewAtom("href"); // Use to differentiate between "a" for link, "a" for named anchor
nsIEditProperty::img = NS_NewAtom("img");
nsIEditProperty::object = NS_NewAtom("object");
nsIEditProperty::br = NS_NewAtom("br");
@ -237,6 +239,7 @@ nsEditProperty::~nsEditProperty()
NS_IF_RELEASE(nsIEditProperty::acronym);
NS_IF_RELEASE(nsIEditProperty::font);
NS_IF_RELEASE(nsIEditProperty::a);
NS_IF_RELEASE(nsIEditProperty::href);
NS_IF_RELEASE(nsIEditProperty::img);
NS_IF_RELEASE(nsIEditProperty::object);
NS_IF_RELEASE(nsIEditProperty::br);

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

@ -2411,6 +2411,8 @@ nsEditor::CloneAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode)
if (!sourceAttributes || !destAttributes)
return NS_ERROR_FAILURE;
nsAutoEditBatch beginBatching(this);
PRUint32 sourceCount;
sourceAttributes->GetLength(&sourceCount);
PRUint32 i, destCount;
@ -2426,8 +2428,9 @@ nsEditor::CloneAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode)
nsCOMPtr<nsIDOMAttr> destAttribute = do_QueryInterface(attrNode);
if (destAttribute)
{
nsCOMPtr<nsIDOMAttr> resultAttribute;
destElement->RemoveAttributeNode(destAttribute, getter_AddRefs(resultAttribute));
nsAutoString str;
if (NS_SUCCEEDED(destAttribute->GetName(str)))
RemoveAttribute(destElement, str);
}
}
}
@ -2446,10 +2449,9 @@ nsEditor::CloneAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode)
if (NS_SUCCEEDED(sourceAttribute->GetValue(sourceAttrValue)) &&
!sourceAttrValue.IsEmpty())
{
destElement->SetAttribute(sourceAttrName, sourceAttrValue);
SetAttribute(destElement, sourceAttrName, sourceAttrValue);
} else {
// Do we ever get here?
destElement->RemoveAttribute(sourceAttrName);
#if DEBUG_cmanske
printf("Attribute in sourceAttribute has empty value in nsEditor::CloneAttributes()\n");
#endif

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

@ -537,12 +537,40 @@ nsTextEditorMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
return NS_OK; // did not process the event
}
nsresult
nsTextEditorMouseListener::MouseUp(nsIDOMEvent* aMouseEvent)
{
nsCOMPtr<nsIDOMMouseEvent> mouseEvent ( do_QueryInterface(aMouseEvent) );
if (!mouseEvent) {
//non-ui event passed in. bad things.
return NS_OK;
}
// Detect double click message:
PRUint16 clickCount;
nsresult res = mouseEvent->GetClickCount(&clickCount);
if (NS_FAILED(res)) return res;
if (clickCount == 2)
{
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(mEditor);
if (htmlEditor)
{
nsCOMPtr<nsIDOMElement> selectedElement;
if (NS_SUCCEEDED(htmlEditor->GetSelectedElement("", getter_AddRefs(selectedElement)))
&& selectedElement)
{
nsAutoString TagName;
selectedElement->GetTagName(TagName);
TagName.ToLowerCase();
#if DEBUG_cmanske
char szTagName[64];
TagName.ToCString(szTagName, 64);
printf("Single Selected element found: %s\n", szTagName);
#endif
}
}
}
return NS_OK;
}
@ -559,25 +587,6 @@ nsTextEditorMouseListener::MouseClick(nsIDOMEvent* aMouseEvent)
nsresult
nsTextEditorMouseListener::MouseDblClick(nsIDOMEvent* aMouseEvent)
{
// TODO: MOVE THIS TO ::MouseUp and test for click count to detect double click
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(mEditor);
if (htmlEditor)
{
nsCOMPtr<nsIDOMElement> selectedElement;
if (NS_SUCCEEDED(htmlEditor->GetSelectedElement("", getter_AddRefs(selectedElement)))
&& selectedElement)
{
nsAutoString TagName;
selectedElement->GetTagName(TagName);
TagName.ToLowerCase();
#if DEBUG_cmanske
char szTagName[64];
TagName.ToCString(szTagName, 64);
printf("Single Selected element found: %s\n", szTagName);
#endif
}
}
return NS_OK;
}

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

@ -464,7 +464,7 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr
// Load the edit mode override style sheet
// This will be remove for "Browser" mode
SetDisplayMode(eDisplayModeEdit);
SetDisplayMode(eDisplayModeNormal);
#ifdef DEBUG
// Activate the debug menu only in debug builds
@ -959,9 +959,30 @@ nsEditorShell::SetDisplayMode(PRInt32 aDisplayMode)
nsCOMPtr<nsIEditorStyleSheets> styleSheets = do_QueryInterface(mEditor);
if (!styleSheets) return NS_NOINTERFACE;
if (aDisplayMode == eDisplayModeEdit)
if (aDisplayMode == eDisplayModeWYSIWYG)
{
// We are already in EditMode
// Remove all extra "edit mode" style sheets
if (mEditModeStyleSheet)
{
styleSheets->RemoveOverrideStyleSheet(mEditModeStyleSheet);
mEditModeStyleSheet = nsnull;
}
if (mAllTagsModeStyleSheet)
{
styleSheets->RemoveOverrideStyleSheet(mAllTagsModeStyleSheet);
mAllTagsModeStyleSheet = nsnull;
}
}
else if (aDisplayMode == eDisplayModeNormal)
{
// Remove the AllTags sheet
if (mAllTagsModeStyleSheet)
{
styleSheets->RemoveOverrideStyleSheet(mAllTagsModeStyleSheet);
mAllTagsModeStyleSheet = nsnull;
}
// We are already in the requested mode
if (mEditModeStyleSheet) return NS_OK;
//Load the editmode style sheet
@ -974,15 +995,36 @@ nsEditorShell::SetDisplayMode(PRInt32 aDisplayMode)
mEditModeStyleSheet = styleSheet;
return res;
}
else if (aDisplayMode == eDisplayModeBrowserPreview)
else if (aDisplayMode == eDisplayModeAllTags)
{
// Remove all extra "edit mode" style sheets
if (mEditModeStyleSheet)
// We are already in the requested mode
if (mAllTagsModeStyleSheet) return NS_OK;
//Load the normal mode style sheet
if (!mEditModeStyleSheet)
{
styleSheets->RemoveOverrideStyleSheet(mEditModeStyleSheet);
mEditModeStyleSheet = nsnull;
// Note: using "@import url(chrome://editor/content/EditorContent.css);"
// in EditorAllTags.css doesn't seem to work!?
nsCOMPtr<nsICSSStyleSheet> styleSheet;
res = styleSheets->ApplyOverrideStyleSheet("chrome://editor/content/EditorContent.css",
getter_AddRefs(styleSheet));
// Save the returned style sheet so we can remove it later
if (NS_SUCCEEDED(res))
mEditModeStyleSheet = styleSheet;
}
//Load the editmode style sheet
nsCOMPtr<nsICSSStyleSheet> styleSheet;
res = styleSheets->ApplyOverrideStyleSheet("chrome://editor/content/EditorAllTags.css",
getter_AddRefs(styleSheet));
// Save the returned style sheet so we can remove it later
if (NS_SUCCEEDED(res))
mAllTagsModeStyleSheet = styleSheet;
return res;
}
return NS_OK;
}
@ -1157,14 +1199,9 @@ nsEditorShell::CheckOpenWindowForURLMatch(const PRUnichar* inFileURL, nsIDOMWind
// get an nsFileSpec from the URL
// This assumes inFileURL is "file://" format
//nsFileURL fileURL(inFileURL);
//nsFileSpec fileSpec(inFilePath);
nsFileURL fileURL(inFileURL);
nsFileSpec fileSpec(fileURL);
// Instead, assume inFileURL is native path and use the
// nsFilePath to convert to something nsFileSpec can handle
nsFilePath filePath(inFileURL);
nsFileSpec fileSpec(filePath);
nsCOMPtr<nsIDOMWindow> contentWindow;
inCheckWindow->GetContent(getter_AddRefs(contentWindow));
if (contentWindow)

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

@ -1312,6 +1312,7 @@ nsresult nsHTMLEditor::SplitStyleAbovePoint(nsCOMPtr<nsIDOMNode> *aNode,
while (tmp && !nsHTMLEditUtils::IsBody(tmp))
{
if ( (aProperty && NodeIsType(tmp, aProperty)) || // node is the correct inline prop
(aProperty == nsIEditProperty::href && IsLinkNode(tmp)) || // node is href - test if really <a href=...
(!aProperty && NodeIsProperty(tmp)) ) // or node is any prop, and we asked to split them all
{
// found a style node we need to split
@ -1344,7 +1345,7 @@ nsresult nsHTMLEditor::RemoveStyleInside(nsIDOMNode *aNode,
if (!aNode) return NS_ERROR_NULL_POINTER;
if (IsTextNode(aNode)) return NS_OK;
nsresult res = NS_OK;
// first process the children
nsCOMPtr<nsIDOMNode> child, tmp;
aNode->GetFirstChild(getter_AddRefs(child));
@ -1356,10 +1357,11 @@ nsresult nsHTMLEditor::RemoveStyleInside(nsIDOMNode *aNode,
if (NS_FAILED(res)) return res;
child = tmp;
}
// then process the node itself
if ( !aChildrenOnly &&
(aProperty && NodeIsType(aNode, aProperty)) || // node is prop we wasked for
((aProperty && NodeIsType(aNode, aProperty)) || // node is prop we asked for
(aProperty == nsIEditProperty::href && IsLinkNode(aNode))) || // but check for link (<a href=...)
(!aProperty && NodeIsProperty(aNode)) ) // or node is any prop and we asked for that
{
// if we weren't passed an attribute, then we want to
@ -1819,6 +1821,11 @@ nsresult nsHTMLEditor::RemoveInlinePropertyImpl(nsIAtom *aProperty, const nsStri
if (isCollapsed)
{
// manipulating text attributes on a collapsed selection only sets state for the next text insertion
// For links, aProperty uses "href", use "a" instead
if (aProperty == nsIEditProperty::href)
aProperty = nsIEditProperty::a;
if (aProperty) return mTypeInState->ClearProp(aProperty, *aAttribute);
// else return mTypeInState->ClearAllProps();
}
@ -1853,7 +1860,7 @@ nsresult nsHTMLEditor::RemoveInlinePropertyImpl(nsIAtom *aProperty, const nsStri
res = PromoteInlineRange(range);
if (NS_FAILED(res)) return res;
// remove this style from ancestors of our range empoints,
// remove this style from ancestors of our range endpoints,
// splitting them as appropriate
res = SplitStyleAboveRange(range, aProperty, aAttribute);
if (NS_FAILED(res)) return res;

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

@ -68,6 +68,7 @@ public:
static nsIAtom *acronym;
static nsIAtom *font;
static nsIAtom *a;
static nsIAtom *href;
static nsIAtom *img;
static nsIAtom *object;
static nsIAtom *br;

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

@ -464,7 +464,7 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr
// Load the edit mode override style sheet
// This will be remove for "Browser" mode
SetDisplayMode(eDisplayModeEdit);
SetDisplayMode(eDisplayModeNormal);
#ifdef DEBUG
// Activate the debug menu only in debug builds
@ -959,9 +959,30 @@ nsEditorShell::SetDisplayMode(PRInt32 aDisplayMode)
nsCOMPtr<nsIEditorStyleSheets> styleSheets = do_QueryInterface(mEditor);
if (!styleSheets) return NS_NOINTERFACE;
if (aDisplayMode == eDisplayModeEdit)
if (aDisplayMode == eDisplayModeWYSIWYG)
{
// We are already in EditMode
// Remove all extra "edit mode" style sheets
if (mEditModeStyleSheet)
{
styleSheets->RemoveOverrideStyleSheet(mEditModeStyleSheet);
mEditModeStyleSheet = nsnull;
}
if (mAllTagsModeStyleSheet)
{
styleSheets->RemoveOverrideStyleSheet(mAllTagsModeStyleSheet);
mAllTagsModeStyleSheet = nsnull;
}
}
else if (aDisplayMode == eDisplayModeNormal)
{
// Remove the AllTags sheet
if (mAllTagsModeStyleSheet)
{
styleSheets->RemoveOverrideStyleSheet(mAllTagsModeStyleSheet);
mAllTagsModeStyleSheet = nsnull;
}
// We are already in the requested mode
if (mEditModeStyleSheet) return NS_OK;
//Load the editmode style sheet
@ -974,15 +995,36 @@ nsEditorShell::SetDisplayMode(PRInt32 aDisplayMode)
mEditModeStyleSheet = styleSheet;
return res;
}
else if (aDisplayMode == eDisplayModeBrowserPreview)
else if (aDisplayMode == eDisplayModeAllTags)
{
// Remove all extra "edit mode" style sheets
if (mEditModeStyleSheet)
// We are already in the requested mode
if (mAllTagsModeStyleSheet) return NS_OK;
//Load the normal mode style sheet
if (!mEditModeStyleSheet)
{
styleSheets->RemoveOverrideStyleSheet(mEditModeStyleSheet);
mEditModeStyleSheet = nsnull;
// Note: using "@import url(chrome://editor/content/EditorContent.css);"
// in EditorAllTags.css doesn't seem to work!?
nsCOMPtr<nsICSSStyleSheet> styleSheet;
res = styleSheets->ApplyOverrideStyleSheet("chrome://editor/content/EditorContent.css",
getter_AddRefs(styleSheet));
// Save the returned style sheet so we can remove it later
if (NS_SUCCEEDED(res))
mEditModeStyleSheet = styleSheet;
}
//Load the editmode style sheet
nsCOMPtr<nsICSSStyleSheet> styleSheet;
res = styleSheets->ApplyOverrideStyleSheet("chrome://editor/content/EditorAllTags.css",
getter_AddRefs(styleSheet));
// Save the returned style sheet so we can remove it later
if (NS_SUCCEEDED(res))
mAllTagsModeStyleSheet = styleSheet;
return res;
}
return NS_OK;
}
@ -1157,14 +1199,9 @@ nsEditorShell::CheckOpenWindowForURLMatch(const PRUnichar* inFileURL, nsIDOMWind
// get an nsFileSpec from the URL
// This assumes inFileURL is "file://" format
//nsFileURL fileURL(inFileURL);
//nsFileSpec fileSpec(inFilePath);
nsFileURL fileURL(inFileURL);
nsFileSpec fileSpec(fileURL);
// Instead, assume inFileURL is native path and use the
// nsFilePath to convert to something nsFileSpec can handle
nsFilePath filePath(inFileURL);
nsFileSpec fileSpec(filePath);
nsCOMPtr<nsIDOMWindow> contentWindow;
inCheckWindow->GetContent(getter_AddRefs(contentWindow));
if (contentWindow)

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

@ -57,8 +57,9 @@ interface nsIEditorShell : nsISupports
};
enum {
eDisplayModeEdit,
eDisplayModeBrowserPreview
eDisplayModeWYSIWYG,
eDisplayModeNormal,
eDisplayModeAllTags
};
%}
readonly attribute boolean documentModified;
@ -429,12 +430,15 @@ interface nsIEditorShell : nsISupports
/** Set the display mode for editing
* displayMode
* 0 (eDisplayModeEdit) Use extra CSS style
* (from override styles in EditorContent.css)
* to show named anchors, table borders, etc for editing
* 1 (eDisplayModeBrowserPreview) "WYSIWIG" or Preview mode
* 0 (eDisplayModeWYSIWIG) Preview mode
* that looks exactly like the browser display except
* for certain behaviors like cursor style over links, etc.
* 1 (eDisplayModeNormal) Use minimal extra CSS style
* (from override styles in EditorContent.css)
* to show named anchors, table borders, etc for editing
* 2 (eDisplayModeAllTags) Use maximum extra CSS style
* (from override styles in EditorAllTags.css)
* to show icon for every HTML tag
*/
void SetDisplayMode(in PRInt32 displayMode);

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

@ -2411,6 +2411,8 @@ nsEditor::CloneAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode)
if (!sourceAttributes || !destAttributes)
return NS_ERROR_FAILURE;
nsAutoEditBatch beginBatching(this);
PRUint32 sourceCount;
sourceAttributes->GetLength(&sourceCount);
PRUint32 i, destCount;
@ -2426,8 +2428,9 @@ nsEditor::CloneAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode)
nsCOMPtr<nsIDOMAttr> destAttribute = do_QueryInterface(attrNode);
if (destAttribute)
{
nsCOMPtr<nsIDOMAttr> resultAttribute;
destElement->RemoveAttributeNode(destAttribute, getter_AddRefs(resultAttribute));
nsAutoString str;
if (NS_SUCCEEDED(destAttribute->GetName(str)))
RemoveAttribute(destElement, str);
}
}
}
@ -2446,10 +2449,9 @@ nsEditor::CloneAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode)
if (NS_SUCCEEDED(sourceAttribute->GetValue(sourceAttrValue)) &&
!sourceAttrValue.IsEmpty())
{
destElement->SetAttribute(sourceAttrName, sourceAttrValue);
SetAttribute(destElement, sourceAttrName, sourceAttrValue);
} else {
// Do we ever get here?
destElement->RemoveAttribute(sourceAttrName);
#if DEBUG_cmanske
printf("Attribute in sourceAttribute has empty value in nsEditor::CloneAttributes()\n");
#endif

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

@ -68,6 +68,7 @@ public:
static nsIAtom *acronym;
static nsIAtom *font;
static nsIAtom *a;
static nsIAtom *href;
static nsIAtom *img;
static nsIAtom *object;
static nsIAtom *br;

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

@ -55,6 +55,7 @@ nsIAtom * nsIEditProperty::abbr;
nsIAtom * nsIEditProperty::acronym;
nsIAtom * nsIEditProperty::font;
nsIAtom * nsIEditProperty::a;
nsIAtom * nsIEditProperty::href;
nsIAtom * nsIEditProperty::img;
nsIAtom * nsIEditProperty::object;
nsIAtom * nsIEditProperty::br;
@ -154,6 +155,7 @@ nsEditProperty::nsEditProperty()
nsIEditProperty::acronym = NS_NewAtom("acronym");
nsIEditProperty::font = NS_NewAtom("font");
nsIEditProperty::a = NS_NewAtom("a");
nsIEditProperty::href = NS_NewAtom("href"); // Use to differentiate between "a" for link, "a" for named anchor
nsIEditProperty::img = NS_NewAtom("img");
nsIEditProperty::object = NS_NewAtom("object");
nsIEditProperty::br = NS_NewAtom("br");
@ -237,6 +239,7 @@ nsEditProperty::~nsEditProperty()
NS_IF_RELEASE(nsIEditProperty::acronym);
NS_IF_RELEASE(nsIEditProperty::font);
NS_IF_RELEASE(nsIEditProperty::a);
NS_IF_RELEASE(nsIEditProperty::href);
NS_IF_RELEASE(nsIEditProperty::img);
NS_IF_RELEASE(nsIEditProperty::object);
NS_IF_RELEASE(nsIEditProperty::br);

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

@ -1312,6 +1312,7 @@ nsresult nsHTMLEditor::SplitStyleAbovePoint(nsCOMPtr<nsIDOMNode> *aNode,
while (tmp && !nsHTMLEditUtils::IsBody(tmp))
{
if ( (aProperty && NodeIsType(tmp, aProperty)) || // node is the correct inline prop
(aProperty == nsIEditProperty::href && IsLinkNode(tmp)) || // node is href - test if really <a href=...
(!aProperty && NodeIsProperty(tmp)) ) // or node is any prop, and we asked to split them all
{
// found a style node we need to split
@ -1344,7 +1345,7 @@ nsresult nsHTMLEditor::RemoveStyleInside(nsIDOMNode *aNode,
if (!aNode) return NS_ERROR_NULL_POINTER;
if (IsTextNode(aNode)) return NS_OK;
nsresult res = NS_OK;
// first process the children
nsCOMPtr<nsIDOMNode> child, tmp;
aNode->GetFirstChild(getter_AddRefs(child));
@ -1356,10 +1357,11 @@ nsresult nsHTMLEditor::RemoveStyleInside(nsIDOMNode *aNode,
if (NS_FAILED(res)) return res;
child = tmp;
}
// then process the node itself
if ( !aChildrenOnly &&
(aProperty && NodeIsType(aNode, aProperty)) || // node is prop we wasked for
((aProperty && NodeIsType(aNode, aProperty)) || // node is prop we asked for
(aProperty == nsIEditProperty::href && IsLinkNode(aNode))) || // but check for link (<a href=...)
(!aProperty && NodeIsProperty(aNode)) ) // or node is any prop and we asked for that
{
// if we weren't passed an attribute, then we want to
@ -1819,6 +1821,11 @@ nsresult nsHTMLEditor::RemoveInlinePropertyImpl(nsIAtom *aProperty, const nsStri
if (isCollapsed)
{
// manipulating text attributes on a collapsed selection only sets state for the next text insertion
// For links, aProperty uses "href", use "a" instead
if (aProperty == nsIEditProperty::href)
aProperty = nsIEditProperty::a;
if (aProperty) return mTypeInState->ClearProp(aProperty, *aAttribute);
// else return mTypeInState->ClearAllProps();
}
@ -1853,7 +1860,7 @@ nsresult nsHTMLEditor::RemoveInlinePropertyImpl(nsIAtom *aProperty, const nsStri
res = PromoteInlineRange(range);
if (NS_FAILED(res)) return res;
// remove this style from ancestors of our range empoints,
// remove this style from ancestors of our range endpoints,
// splitting them as appropriate
res = SplitStyleAboveRange(range, aProperty, aAttribute);
if (NS_FAILED(res)) return res;

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

@ -537,12 +537,40 @@ nsTextEditorMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
return NS_OK; // did not process the event
}
nsresult
nsTextEditorMouseListener::MouseUp(nsIDOMEvent* aMouseEvent)
{
nsCOMPtr<nsIDOMMouseEvent> mouseEvent ( do_QueryInterface(aMouseEvent) );
if (!mouseEvent) {
//non-ui event passed in. bad things.
return NS_OK;
}
// Detect double click message:
PRUint16 clickCount;
nsresult res = mouseEvent->GetClickCount(&clickCount);
if (NS_FAILED(res)) return res;
if (clickCount == 2)
{
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(mEditor);
if (htmlEditor)
{
nsCOMPtr<nsIDOMElement> selectedElement;
if (NS_SUCCEEDED(htmlEditor->GetSelectedElement("", getter_AddRefs(selectedElement)))
&& selectedElement)
{
nsAutoString TagName;
selectedElement->GetTagName(TagName);
TagName.ToLowerCase();
#if DEBUG_cmanske
char szTagName[64];
TagName.ToCString(szTagName, 64);
printf("Single Selected element found: %s\n", szTagName);
#endif
}
}
}
return NS_OK;
}
@ -559,25 +587,6 @@ nsTextEditorMouseListener::MouseClick(nsIDOMEvent* aMouseEvent)
nsresult
nsTextEditorMouseListener::MouseDblClick(nsIDOMEvent* aMouseEvent)
{
// TODO: MOVE THIS TO ::MouseUp and test for click count to detect double click
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(mEditor);
if (htmlEditor)
{
nsCOMPtr<nsIDOMElement> selectedElement;
if (NS_SUCCEEDED(htmlEditor->GetSelectedElement("", getter_AddRefs(selectedElement)))
&& selectedElement)
{
nsAutoString TagName;
selectedElement->GetTagName(TagName);
TagName.ToLowerCase();
#if DEBUG_cmanske
char szTagName[64];
TagName.ToCString(szTagName, 64);
printf("Single Selected element found: %s\n", szTagName);
#endif
}
}
return NS_OK;
}

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

@ -132,9 +132,12 @@ public:
* RemoveInlineProperty() deletes the properties from all text in the current selection.
* If aProperty is not set on the selection, nothing is done.
*
* @param aProperty the property to reomve from the selection
* @param aProperty the property to remove from the selection
* All atoms are for normal HTML tags (e.g.: nsIEditorProptery::font)
* except when you want to remove just links and not named anchors
* For that, use nsIEditorProperty::href
* @param aAttribute the attribute of the property, if applicable. May be null.
* Example: aProperty="font", aAttribute="color"
* Example: aProperty=nsIEditorProptery::font, aAttribute="color"
* nsIEditProperty::allAttributes is special. It indicates that
* all content-based text properties are to be removed from the selection.
*/

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

@ -0,0 +1,687 @@
o/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* Styles to alter look of things in the Editor content window
* for the "All Tags Edit Mode" Every HTML tag shows up as an icon.
*/
a[href] {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
a[name] {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/div.gif) no-repeat;
background-position: top left;
}
abbr {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
acronym {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
address {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
applet {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
area {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
b {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
base {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
basefont {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
bdo {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
big {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
blockquote {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
body {
margin-left: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/div.gif) no-repeat;
background-position: top left;
}
br {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
button {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
caption {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
top {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
cite {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
code {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
col {
margin-left: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
colgroup {
margin-left: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
dd {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
del {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
dfn {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
dir {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
div {
margin-left: 2px; margin-top: 2px;
/* TEMPORARY TO COMPENSATE FOR BUG */
padding-left: 13px;
background: url(chrome://editor/skin/images/div.gif) no-repeat;
background-position: top left;
}
dl {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
dt {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
em {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
fieldset {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
font {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
form {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
frame {
margin-left: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
frameset {
margin-left: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
h1 {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
h2 {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
h3 {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
h4 {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
h5 {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
h6 {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
/*
head {
margin-left: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
*/
hr {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
/*
html {
margin-left: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/anchor-in-doc.gif) no-repeat;
background-position: top left;
}
*/
i {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
iframe {
margin-left: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
img {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
input {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
ins {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
isindex {
margin-left: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
kbd {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
label {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
legend {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
li {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
link {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
map {
margin-left: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
menu {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
/*
meta {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
*/
noframes {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
noscript {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
object {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
ol {
margin-left: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
optgroup {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
option {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
p {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
param {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
pre {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
q {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
s {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
samp {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
/*
script {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
*/
select {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
small {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
span {
margin-left: 2px; margin-top: 2px;
/* TEMPORARY TO COMPENSATE FOR BUG */
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
strike {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
strong {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
/*
style {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
*/
sub {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
sup {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
table:before {
margin-left: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/anchor-in-doc.gif) no-repeat;
background-position: top left;
}
tbody:before {
margin-left: 2px; margin-top: 1px;
padding-left: 13px;
background: url(chrome://editor/skin/images/anchor-in-doc.gif) no-repeat;
background-position: top left;
}
td {
margin-left: 2px;
padding-left: 13px;
background-image: url(chrome://editor/skin/images/div.gif);
background-repeat: no-repeat;
background-position: top left;
}
textarea {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
tfoot {
margin-left: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
th {
margin-left: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
thead {
margin-left: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
/*
title {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
*/
tr {
margin-left: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/anchor-in-doc.gif) no-repeat;
background-position: top left;
}
tt {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
u {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
ul {
margin-left: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}
var {
margin-left: 2px; margin-top: 2px;
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: top left;
}

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

@ -28,7 +28,7 @@
var editorShell;
var documentModified;
var prefAuthorString = "";
var EditorDisplayMode = 0; // Normal Editor mode
var EditorDisplayMode = 1; // Normal Editor mode
var WebCompose = false; // Set true for Web Composer, leave false for Messenger Composer
// These must be kept in synch with the XUL <options> lists
@ -281,8 +281,12 @@ function EditorOpen()
dump("filePicker.chooseInputFile threw an exception\n");
}
/* check for already open window and activate it... */
if (fp.file) {
/* check for already open window and activate it...
* note that we have to test the native path length
* since fileURL.spec will be "file:///" if no filename picked (Cancel button used)
*/
if (fp.file && fp.file.path.length > 0) {
var found = FindAndSelectEditorWindowWithURL(fp.fileURL.spec);
if (!found) {
/* open new window */
@ -793,7 +797,7 @@ function EditorToggleStyle(styleName)
function EditorRemoveLinks()
{
editorShell.RemoveTextProperty("a", "");
editorShell.RemoveTextProperty("href", "");
contentWindow.focus();
}
@ -1014,31 +1018,33 @@ function EditorAlign(align)
contentWindow.focus();
}
function EditorSetDisplayStyle(mode)
function EditorSetDisplayMode(mode)
{
EditorDisplayMode = mode;
// Editor does the style sheet loading/unloading
editorShell.SetDisplayMode(mode);
var editButton = document.getElementById("EditModeButton");
var browserButton = document.getElementById("BrowserModeButton");
// Set the UI states
// TODO: Should we NOT have the menu items and eliminate this?
var showMenu = document.getElementById("ShowExtraMarkup");
var hideMenu = document.getElementById("HideExtraMarkup");
switch (mode ) {
case 0:
showMenu.setAttribute("hidden","true");
hideMenu.removeAttribute("hidden");
break;
var editSelected = 0;
var browserSelected = 0;
if (mode == 0)
{
editSelected = 1;
showMenu.setAttribute("hidden","true");
hideMenu.removeAttribute("hidden");
default: // = 1
showMenu.removeAttribute("hidden");
hideMenu.setAttribute("hidden","true");
break;
}
if (mode == 1)
{
browserSelected = 1;
showMenu.removeAttribute("hidden");
hideMenu.setAttribute("hidden","true");
}
editButton.setAttribute("selected",Number(editSelected));
browserButton.setAttribute("selected",Number(browserSelected));
document.getElementById("WYSIWYGModeButton").setAttribute("selected",Number(mode == 0));
document.getElementById("NormalModeButton").setAttribute("selected",Number(mode == 1));
document.getElementById("TagModeButton").setAttribute("selected",Number(mode == 2));
contentWindow.focus();
}
@ -1135,8 +1141,6 @@ function CheckSpelling()
dump("*** Exception error: SpellChecker Dialog Closing\n");
return;
}
// We might want to use this:
// editorShell.AlertWithTitle(editorShell.GetString("CheckSpelling"), editorShell.GetString("CheckSpellingDone"));
}
}
contentWindow.focus();

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

@ -27,28 +27,17 @@
* place in EditorOverride.css, instead of here.
*/
a[name] {
margin-left: 2px;
/* TEMPORARY TO COMPENSATE FOR BUG */
a[name]:before {
content: url(chrome://editor/skin/images/anchor-in-doc.gif);
/* display: inline; */
/* margin-left: 2px; */
/*
padding-left: 13px;
background: url(chrome://editor/skin/images/anchor-in-doc.gif) no-repeat;
background-position: center left;
}
div {
margin-left: 2px;
/* TEMPORARY TO COMPENSATE FOR BUG */
padding-left: 13px;
background: url(chrome://editor/skin/images/div.gif) no-repeat;
background-position: center left;
}
span {
margin-left: 2px;
/* TEMPORARY TO COMPENSATE FOR BUG */
padding-left: 13px;
background: url(chrome://editor/skin/images/span.gif) no-repeat;
background-position: center left;
*/
}
/* Force border display for empty cells
@ -65,8 +54,9 @@ table[empty-cells], table[border="0"] {
/* Also force border for cell children
Problem: what if children have a border?
*/
table[border="0"] > td, table[border="0"] > th {
table[border="0"] * td, table[border="0"] * th {
border: 1px dotted red;
background-color: blue;
}
/* For ease in caret placement,

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

@ -27,6 +27,8 @@
<style type="text/css">
/* Don't set attributes here, or they can't be changed! */
p.note:before { content: "Note: "; }
</style>
</head>

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

@ -30,6 +30,7 @@ EditorInitPage.html
EditorInitPagePlain.html
EditorStyles1.css
EditorContent.css
EditorAllTags.css
EditorOverride.css
EditorParagraphMarks.css
editorOverlay.js

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

@ -36,6 +36,7 @@ EXPORT_RESOURCE_CONTENT = \
$(srcdir)/EditorInitPagePlain.html \
$(srcdir)/EditorStyles1.css \
$(srcdir)/EditorContent.css \
$(srcdir)/EditorAllTags.css \
$(srcdir)/EditorOverride.css \
$(srcdir)/EditorParagraphMarks.css \
$(srcdir)/sidebar-editor.rdf \

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

@ -43,8 +43,8 @@
persist="screenX screenY width height"
>
<html:script language="JavaScript" src="chrome://editor/content/EditorCommands.js"/>
<html:script language="JavaScript" src="chrome://editor/content/EditorCommandsDebug.js"/>
<script language="JavaScript" src="chrome://editor/content/EditorCommands.js"/>
<script language="JavaScript" src="chrome://editor/content/EditorCommandsDebug.js"/>
<commands id="commands">
<commandset id="globalEditMenuItems"/>

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

@ -48,9 +48,9 @@
persist="screenX screenY width height"
>
<html:script language="JavaScript" src="chrome://editor/content/EditorCommands.js"/>
<html:script language="JavaScript" src="chrome://editor/content/EditorCommandsDebug.js"/>
<html:script language="javascript" src="chrome://global/content/strres.js"/>
<script language="JavaScript" src="chrome://editor/content/EditorCommands.js"/>
<script language="JavaScript" src="chrome://editor/content/EditorCommandsDebug.js"/>
<script language="javascript" src="chrome://global/content/strres.js"/>
<commands id="commands">
<commandset id="globalEditMenuItems"/>
@ -89,8 +89,8 @@
<menupopup id="menu_View_Popup">
<menu id="viewToolbar"/>
<menuseparator/>
<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="ShowExtraMarkup" value="&showExtraMarkup.label;" accesskey="&extraMarkup.accesskey;" oncommand="EditorSetDisplayMode(1)" hidden="true"/>
<menuitem id="HideExtraMarkup" value="&hideExtraMarkup.label;" accesskey="&extraMarkup.accesskey;" oncommand="EditorSetDisplayMode(0)"/>
<menuitem id="viewSourceMenuitem"/>
<menuitem id="viewParagraphMarks"/>
<menuseparator />
@ -148,7 +148,7 @@
<spring flex="100%"/>
<box id="toolbar_throbber_box" align="vertical">
<titledbutton id="Throbber" onclick='goClickThrobber("editor.throbber.url")'>
<titledbutton id="Throbber" oncommand='goClickThrobber("editor.throbber.url")'>
<observes element="Editor:Throbber" attribute="busy"/>
</titledbutton>
</box>
@ -198,14 +198,14 @@
<html:div>&displayMode.label;</html:div>
</box>
<spring class="spacer3"/>
<titledbutton id="BrowserModeButton" class="DisplayModeButton" selected="0" value="&hideExtraMarkup.label;" onclick="EditorSetDisplayStyle(1)"/>
<titledbutton id="EditModeButton" class="DisplayModeButton" selected="1" value="&showExtraMarkup.label;" onclick="EditorSetDisplayStyle(0)"/>
<titledbutton id="WYSIWYGModeButton" class="DisplayModeButton" selected="0" value="&hideExtraMarkup.label;" oncommand="EditorSetDisplayMode(0)"/>
<titledbutton id="NormalModeButton" class="DisplayModeButton" selected="1" value="&showExtraMarkup.label;" oncommand="EditorSetDisplayMode(1)"/>
<titledbutton id="TagModeButton" class="DisplayModeButton" selected="0" value="&showAllTags.label;" oncommand="EditorSetDisplayMode(2)"/>
<!--
Use this when implemented...
<titledbutton id="TagModeButton" class="DisplayModeButton" selected="0" value="Show All Tags" onclick="EditorSetDisplayStyle(1)"/>
<titledbutton id="HTMLModeButton" class="DisplayModeButton" selected="0" value="HTML Source" onclick="EditorSetDisplayStyle(1)"/>
<button id="HTMLModeButton" class="DisplayModeButton" selected="0" value="HTML Source" oncommand="EditorSetDisplayMode(1)"/>
<spring flex="100%"/>
<titledbutton id="PreviewModeButton" class="DisplayModeButton" selected="0" value="Full Preview" onclick="EditorSetDisplayStyle(0)"/>
<titledbutton id="PreviewModeButton" class="DisplayModeButton" selected="0" value="Full Preview" oncommand="EditorSetDisplayMode(0)"/>
-->
</box>

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

@ -29,7 +29,7 @@
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<html:script language="JavaScript" src="chrome://editor/content/editorOverlay.js"/>
<script language="JavaScript" src="chrome://editor/content/editorOverlay.js"/>
<keyset id="platformOverlayKeyset" />
@ -423,7 +423,7 @@
position="4">
<menupopup>
<colorpicker id="menuTextCP" palettename="standard"
onclick="EditorSelectTextColor('menuTextCP',null);"/>
oncommand="EditorSelectTextColor('menuTextCP',null);"/>
<menuitem value="&colorPicker.default.label;"
accesskey="&colorPicker.default.accesskey;"
oncommand="EditorRemoveTextColor(null)"/>
@ -435,7 +435,7 @@
position="5">
<menupopup>
<colorpicker id="menuBackCP" palettename="standard"
onclick="EditorSelectBackColor('menuBackCP',null);"/>
oncommand="EditorSelectBackColor('menuBackCP',null);"/>
<menuitem value="&colorPicker.default.label;"
accesskey="&colorPicker.default.accesskey;"
oncommand="EditorRemoveBackColor(null)"/>
@ -593,18 +593,18 @@ function EditorApplyStyleSheet(styleSheetURL)
</menu>
<popup id="TextColorPopup" popupanchor="bottomleft">
<titledbutton id="TextColorCaption" class="color-caption" value="&textColorCaption.label;" flex="1"/>
<text 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');"/>
<titledbutton class="push" value="&colorPicker.default.label;" onclick="EditorRemoveTextColor('TextColorPopupButton');"/>
<!-- <colorpicker id="TextColorPicker" palettename="standard" oncommand="EditorSelectTextColor('TextColorPicker','TextColorPopupButton');"/> -->
<titledbutton class="push" value="&colorPicker.default.label;" oncommand="EditorRemoveTextColor('TextColorPopupButton');"/>
</popup>
<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"/>
<text id="BackColorCaption" class="color-caption" value="Background Color" flex="1"/>
<!-- TODO: Add "Last color picked" button and text -->
<colorpicker id="BackColorPicker" palettename="standard" onclick="EditorSelectBackColor('BackColorPicker','BackColorPopupButton');"/>
<titledbutton class="push" value="&colorPicker.default.label;" onclick="EditorRemoveBackColor('BackColorPopupButton');"/>
<!-- <colorpicker id="BackColorPicker" palettename="standard" oncommand="EditorSelectBackColor('BackColorPicker','BackColorPopupButton');"/> -->
<titledbutton class="push" value="&colorPicker.default.label;" oncommand="EditorRemoveBackColor('BackColorPopupButton');"/>
</popup>
<menupopup id="AlignmentPopup">
@ -649,13 +649,13 @@ function EditorApplyStyleSheet(styleSheetURL)
<button class="key-toolbar left" orient="vertical" id="previewButton" observes="Editor:Preview" value="&previewToolbarCmd.label;"/>
<button class="toolbar left" orient="vertical" id="printButton" observes="Editor:Print" value="&printToolbarCmd.label;"/>
<button class="toolbar left" orient="vertical" id="findButton" observes="cmd_find" value="&findToolbarCmd.label;"/>
<button class="toolbar left" orient="vertical" id="spellingButton" value="&spellToolbarCmd.label;" onclick="CheckSpelling()"/>
<button class="toolbar left" orient="vertical" id="spellingButton" value="&spellToolbarCmd.label;" oncommand="CheckSpelling()"/>
<button class="toolbar left" orient="vertical" id="imageButton" value="&imageToolbarCmd.label;" onclick="EditorInsertOrEditImage()"/>
<button class="toolbar left" orient="vertical" id="hlineButton" value="&hruleToolbarCmd.label;" onclick="EditorInsertOrEditHLine()"/>
<button class="toolbar left" orient="vertical" id="tableButton" value="&tableToolbarCmd.label;" onclick="EditorInsertOrEditTable(true)"/>
<button class="toolbar left" orient="vertical" id="linkButton" value="&linkToolbarCmd.label;" onclick="EditorInsertOrEditLink()"/>
<button class="toolbar left" orient="vertical" id="namedAnchorButton" value="&anchorToolbarCmd.label;" onclick="EditorInsertOrEditNamedAnchor()"/>
<button class="toolbar left" orient="vertical" id="imageButton" value="&imageToolbarCmd.label;" oncommand="EditorInsertOrEditImage()"/>
<button class="toolbar left" orient="vertical" id="hlineButton" value="&hruleToolbarCmd.label;" oncommand="EditorInsertOrEditHLine()"/>
<button class="toolbar left" orient="vertical" id="tableButton" value="&tableToolbarCmd.label;" oncommand="EditorInsertOrEditTable(true)"/>
<button class="toolbar left" orient="vertical" id="linkButton" value="&linkToolbarCmd.label;" oncommand="EditorInsertOrEditLink()"/>
<button class="toolbar left" orient="vertical" id="namedAnchorButton" value="&anchorToolbarCmd.label;" oncommand="EditorInsertOrEditNamedAnchor()"/>
<!-- Formatting toolbar items -->
<html:select class="toolbar" id="ParagraphSelect" size="1" onchange="EditorSelectParagraphFormat()">
@ -696,37 +696,50 @@ function EditorApplyStyleSheet(styleSheetURL)
<html:option>&size-xx-largeCmd.label;</html:option>
</html:select>
<!-- The new Color Picker UI -->
<!-- The new Color Picker UI
<html:div id="ColorButtons">
<titledbutton id="BackColorPopupButton" popup="BackColorPopup"
tooltiptext="Set text color"/>
<titledbutton id="TextColorPopupButton" popup="TextColorPopup"
tooltiptext="Set page, table, or cell background color"/>
</html:div>
-->
<stack style="width: 20px; height: 20px;">
<box autostretch="never">
<spring style="margin-left: 5px;"/>
<box orient="vertical">
<spring style="margin-top: 5px;"/>
<titledbutton value="T" style="width: 14px; height: 14px;" id="BackColorPopupButton" popup="BackColorPopup"/>
</box>
</box>
<box autostretch="never">
<titledbutton value="B" style="width: 14px; height: 14px;" id="TextColorPopupButton" popup="BackColorPopup"/>
</box>
</stack>
<titledbutton id="DecreaseFontSizeButton" onclick="EditorDecreaseFontSize()"/>
<titledbutton id="IncreaseFontSizeButton" onclick="EditorIncreaseFontSize()"/>
<titledbutton id="DecreaseFontSizeButton" oncommand="EditorDecreaseFontSize()"/>
<titledbutton id="IncreaseFontSizeButton" oncommand="EditorIncreaseFontSize()"/>
<titledbutton id="boldButton" class="format" align="center" onclick="EditorToggleStyle('bold')">
<titledbutton id="boldButton" class="format" align="center" oncommand="EditorToggleStyle('bold')">
<observes element="Editor:Bold" attribute="bold" onbroadcast="onStyleChange('bold')"/>
</titledbutton>
<titledbutton id="italicButton" class="format" align="center" onclick="EditorToggleStyle('italic')">
<titledbutton id="italicButton" class="format" align="center" oncommand="EditorToggleStyle('italic')">
<observes element="Editor:Italic" attribute="italic" onbroadcast="onStyleChange('italic')"/>
</titledbutton>
<titledbutton id="underlineButton" class="format" align="center" onclick="EditorToggleStyle('underline')">
<titledbutton id="underlineButton" class="format" align="center" oncommand="EditorToggleStyle('underline')">
<observes element="Editor:Underline" attribute="underline" onbroadcast="onStyleChange('underline')"/>
</titledbutton>
<titledbutton id="ulButton" class="format" onclick="EditorMakeOrChangeList('ul')">
<titledbutton id="ulButton" class="format" oncommand="EditorMakeOrChangeList('ul')">
<observes element="Editor:Paragraph:ListType" attribute="format" onbroadcast="onListFormatChange('ul')"/>
</titledbutton>
<titledbutton id="olButton" class="format" onclick="EditorMakeOrChangeList('ol')">
<titledbutton id="olButton" class="format" oncommand="EditorMakeOrChangeList('ol')">
<observes element="Editor:Paragraph:ListType" attribute="format" onbroadcast="onListFormatChange('ol')"/>
</titledbutton>
<titledbutton id="outdentButton" class="format" onclick="EditorIndent('outdent')"/>
<titledbutton id="indentButton" class="format" onclick="EditorIndent('indent')"/>
<titledbutton id="outdentButton" class="format" oncommand="EditorIndent('outdent')"/>
<titledbutton id="indentButton" class="format" oncommand="EditorIndent('indent')"/>
<titledbutton id="AlignPopupButton" class="format popup"/>
<!-- InsertPopupButton is used by messengercompose.xul -->

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

@ -31,6 +31,7 @@ install::
$(MAKE_INSTALL) EditorInitPage.html $(DIST)\bin\chrome\editor\content\default
$(MAKE_INSTALL) EditorInitPagePlain.html $(DIST)\bin\chrome\editor\content\default
$(MAKE_INSTALL) EditorContent.css $(DIST)\bin\chrome\editor\content\default
$(MAKE_INSTALL) EditorAllTags.css $(DIST)\bin\chrome\editor\content\default
$(MAKE_INSTALL) EditorOverride.css $(DIST)\bin\chrome\editor\content\default
$(MAKE_INSTALL) EditorParagraphMarks.css $(DIST)\bin\chrome\editor\content\default
$(MAKE_INSTALL) sidebar-editor.rdf $(DIST)\bin\chrome\editor\content\default
@ -52,6 +53,7 @@ clobber::
rm -f $(DIST)\bin\chrome\editor\content\default\EditorInitPage.html
rm -f $(DIST)\bin\chrome\editor\content\default\EditorInitPagePlain.html
rm -f $(DIST)\bin\chrome\editor\content\default\EditorContent.css
rm -f $(DIST)\bin\chrome\editor\content\default\EditorAllTags.css
rm -f $(DIST)\bin\chrome\editor\content\default\EditorOverride.css
rm -f $(DIST)\bin\chrome\editor\content\default\EditorParagraphMarks.css
rm -f $(DIST)\bin\chrome\editor\content\default\sidebar-editor.rdf

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

@ -31,7 +31,7 @@
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<html:script src="chrome://editor/content/sb-bookmarks.js"/>
<script src="chrome://editor/content/sb-bookmarks.js"/>
<popup id="contextual" oncreate="return fillContextMenu('contextual');" >
<menu />

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

@ -31,9 +31,9 @@
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<html:script src="chrome://global/content/tasksOverlay.js"/>
<html:script src="chrome://editor/content/sb-file-panel.js"/>
<html:script src="chrome://editor/content/sb-FileWidgetFileHandler.js"/>
<script src="chrome://global/content/tasksOverlay.js"/>
<script src="chrome://editor/content/sb-file-panel.js"/>
<script src="chrome://editor/content/sb-FileWidgetFileHandler.js"/>
<popup id="contextual" oncreate="return fillContextMenu('contextual',event.target.parentNode.parentNode);" >
<menu />

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

@ -35,7 +35,7 @@
onload="Init('chrome://editor/content/sidebar-editor.rdf',
'NC:EditorSidebarRoot');" align="vertical">
<html:script src="chrome://sidebar/content/sidebar.js" />
<script src="chrome://sidebar/content/sidebar.js" />
<box id="sidebox" align="vertical" flex="100%">
<box class="sidebartitle">
<spring flex="100%"/>

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

@ -45,5 +45,6 @@
<!ENTITY extraMarkup.accesskey "e">
<!ENTITY hideExtraMarkup.label "Hide Extra Markup">
<!ENTITY viewModeButton.label "View Mode:">
<!ENTITY showAllTags.label "Show All Tags">
<!ENTITY htmlModeButton.label "HTML Source">
<!ENTITY treeModeButton.label "Tag Tree">

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

@ -26,13 +26,14 @@ SaveDocument=Save Document
SaveDocumentAs=Save Document As
EditMode=Edit Mode
Preview=Preview
MisspelledWordLabel=Misspelled word:
CorrectSpelling=(correct spelling)
NoSuggestedWords=(no suggested words)
NoMisspelledWord=No misspelled words were found.
CheckSpellingDone=No misspelled word was found.
CheckSpelling=Check Spelling
CheckSpellingDone=Spell checking is completed.
LoadingDone=Done loading document
InputError=Input Error
Alert=Alert
CantEditFramesetMsg=This editor cannot edit HTML framesets. Try editing the document for each frame separately.

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

@ -126,7 +126,7 @@ select.toolbar {
box#EditModeToolbar titledbutton.DisplayModeButton {
-moz-border-radius: 0px 0px 8px 8px;
border-top: 1px solid #CCCCCC; /* Should be same as background */
border-top: 1px solid #CCCCCC; /* Must be same as background */
border-bottom: 1px solid #666666;
border-left: 1px solid white;
border-right: 1px solid #666666;
@ -146,7 +146,7 @@ box#EditModeToolbar titledbutton.DisplayModeButton:active {
box#EditModeToolbar titledbutton.DisplayModeButton[selected="1"] {
padding: 0px 4px 0px 4px;
margin: -2px 0px 0px 0px;
margin: -1px 0px 0px 0px;
font-weight: bold;
}
@ -330,7 +330,7 @@ div#ColorButtons {
border: 1px solid white;
}
titledbutton#BackColorPopupButton {
#BackColorPopupButton {
list-style-image:url("chrome://editor/skin/images/color.gif");
border: 1px solid #CCCCCC;
padding: 0px;
@ -342,7 +342,8 @@ titledbutton#BackColorPopupButton {
/* TEMP: Set color here. TODO: Set color from page */
background-color: yellow;
}
titledbutton#BackColorPopupButton:hover {
#BackColorPopupButton:hover {
border: 1px solid white;
}

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

@ -42,16 +42,16 @@
align="vertical">
<!-- Methods common to all editor dialogs -->
<html:script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js"/>
<script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js"/>
<!-- global dialog functions -->
<html:script language="JavaScript" src="chrome://editor/content/EdAdvancedEdit.js"/>
<script language="JavaScript" src="chrome://editor/content/EdAdvancedEdit.js"/>
<!-- element page functions -->
<html:script language="JavaScript" src="chrome://editor/content/EdAEHTMLAttributes.js"/>
<html:script language="JavaScript" src="chrome://editor/content/EdAECSSAttributes.js"/>
<html:script language="JavaScript" src="chrome://editor/content/EdAEJSEAttributes.js"/>
<script language="JavaScript" src="chrome://editor/content/EdAEHTMLAttributes.js"/>
<script language="JavaScript" src="chrome://editor/content/EdAECSSAttributes.js"/>
<script language="JavaScript" src="chrome://editor/content/EdAEJSEAttributes.js"/>
<html:script language="JavaScript" src="chrome://global/content/dialogOverlay.js" />
<html:script language="javascript" src="chrome://global/content/strres.js" />
<script language="JavaScript" src="chrome://global/content/dialogOverlay.js" />
<script language="javascript" src="chrome://global/content/strres.js" />
<popupset>
<popup id="attlistPopup">

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

@ -56,14 +56,15 @@ 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:"
var styleStr = "style";
var textStr = "text";
var linkStr = "link";
var vlinkStr = "vlink";
var alinkStr = "alink";
var bgcolorStr = "bgcolor";
var backgroundStr = "background";
var colorStyle = "color:";
var backImageStyle = " background-image:";
// dialog initialization code
function Startup()
@ -186,6 +187,7 @@ function InitDialog()
}
}
function SetColor(ColorWellID, color)
{
switch( ColorWellID )
@ -213,7 +215,13 @@ function SetColor(ColorWellID, color)
case "backgroundCW":
if (!color) color = defaultBackgroundColor;
dialog.backgroundColor = color;
dialog.ColorPreview.setAttribute(bgcolorStr,color);
// Must combine background color and image style values
styleValue = colorStyle+color;
if (dialog.backgroundImage > 0)
{
styleValue += ";"+backImageStyle+backImageStyle+";";
}
dialog.ColorPreview.setAttribute(styleStr,styleValue);
break;
}
setColorWell(ColorWellID, color);
@ -264,15 +272,16 @@ function UseDefaultColors()
function onBackgroundImageCheckbox()
{
if (dialog.BackgroundImageCheckbox.checked)
// First make a string with just background color
var styleValue = colorStyle+dialog.backgroundColor+";";
if (dialog.BackgroundImageCheckbox.checked && ValidateImage())
{
if (ValidateImage())
{
dialog.ColorPreview.setAttribute(backgroundStr, dialog.BackgroundImage);
}
} else {
dialog.ColorPreview.removeAttribute(backgroundStr);
// Append image style
styleValue += backImageStyle+dialog.BackgroundImage+";";
}
dump(styleValue+"=style value when setting image\n")
// Set style on preview (removes image if not checked or not valid)
dialog.ColorPreview.setAttribute(styleStr, styleValue);
}
function chooseFile()

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

@ -36,44 +36,28 @@
onload="Startup()"
align="vertical">
<html:script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js"/>
<html:script language="JavaScript" src="chrome://editor/content/EdColorProps.js"/>
<html:script language="JavaScript" src="chrome://global/content/dialogOverlay.js" />
<script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js"/>
<script language="JavaScript" src="chrome://editor/content/EdColorProps.js"/>
<script language="JavaScript" src="chrome://global/content/dialogOverlay.js" />
<broadcaster id="args" value=""/>
<html:label>&pageColors.label;</html:label>
<box class="margin-left-right">
<!-- must use div else box stretches radio button size -->
<html:div><html:input type="radio" name="ColorMode" id="DefaultColorsRadio" onclick="UseDefaultColors()"/></html:div>
<html:label for="DefaultColorsRadio">&defaultColorsRadio.label;</html:label>
</box>
<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>
<text value="&pageColors.label;"/>
<spring class="bigspacer"/>
<box orient="vertical">
<radiogroup orient="vertical">
<radio id="DefaultColorsRadio" value="&defaultColorsRadio.label;" oncommand="UseDefaultColors()"/>
<radio id="CustomColorsRadio" value="&customColorsRadio.label;" oncommand="UseCustomColors()"/>
</radiogroup>
</box>
<spring class="bigspacer"/>
<!-- DON'T SHOW COLOR SCHEMES UNTIL REDESIGNED
<html:div>
<box flex="1">
<html:label for="ColorScheme"> &colorScheme.label;</html:label>
<spring class="bigspacer"/>
<html:select id="ColorScheme" size="1" flex="1">
<html:option> Black on White </html:option>
<html:option> Blue on White </html:option>
<html:option> White on Black </html:option>
</html:select>
</box>
</html:div>
<spring class="bigspacer"/>
-->
<!-- DON'T SHOW COLOR SCHEMES UNTIL REDESIGNED -->
<box>
<spring class="bigspacer"/>
<box align="vertical" flex="1">
<box>
<html:label class="margin-left-right"> &normalText.label; </html:label>
<text value="&normalText.label;"/>
<spring flex="1"/>
<menu class="colorpicker">
<box>
@ -81,12 +65,12 @@
<image class="popup-trigger"/>
</box>
<menupopup id="normalMenuPopup">
<colorpicker id="textCP" palettename="standard" onclick="GetColorAndUpdate('textCP','textCW',this);"/>
<colorpicker id="textCP" palettename="standard" oncommand="GetColorAndUpdate('textCP','textCW',this);"/>
</menupopup>
</menu>
</box>
<box>
<html:label class="margin-left-right"> &linkText.label; </html:label>
<text value="&linkText.label;"/>
<spring flex="1"/>
<menu class="colorpicker">
<box>
@ -94,12 +78,12 @@
<image class="popup-trigger"/>
</box>
<menupopup>
<colorpicker id="linkCP" palettename="standard" onclick="GetColorAndUpdate('linkCP','linkCW',this);"/>
<colorpicker id="linkCP" palettename="standard" oncommand="GetColorAndUpdate('linkCP','linkCW',this);"/>
</menupopup>
</menu>
</box>
<box>
<html:label class="margin-left-right"> &activeLinkText.label; </html:label>
<text value="&activeLinkText.label;"/>
<spring flex="1"/>
<menu class="colorpicker">
<box>
@ -107,12 +91,12 @@
<image class="popup-trigger"/>
</box>
<menupopup>
<colorpicker id="activeCP" palettename="standard" onclick="GetColorAndUpdate('activeCP','activeCW',this);"/>
<colorpicker id="activeCP" palettename="standard" oncommand="GetColorAndUpdate('activeCP','activeCW',this);"/>
</menupopup>
</menu>
</box>
<box>
<html:label class="margin-left-right"> &visitedLinkText.label; </html:label>
<text value ="&visitedLinkText.label;"/>
<spring flex="1"/>
<menu class="colorpicker">
<box>
@ -120,12 +104,12 @@
<image class="popup-trigger"/>
</box>
<menupopup>
<colorpicker id="visitedCP" palettename="standard" onclick="GetColorAndUpdate('visitedCP','visitedCW',this);"/>
<colorpicker id="visitedCP" palettename="standard" oncommand="GetColorAndUpdate('visitedCP','visitedCW',this);"/>
</menupopup>
</menu>
</box>
<box>
<html:label class="margin-left-right"> &background.label; </html:label>
<text value="&background.label;"/>
<spring flex="1"/>
<menu class="colorpicker">
<box>
@ -133,41 +117,35 @@
<image class="popup-trigger"/>
</box>
<menupopup>
<colorpicker id="backgroundCP" palettename="standard" onclick="GetColorAndUpdate('backgroundCP','backgroundCW',this);"/>
<colorpicker id="backgroundCP" palettename="standard" oncommand="GetColorAndUpdate('backgroundCP','backgroundCW',this);"/>
</menupopup>
</menu>
</box>
</box>
<spring class="bigspacer"/>
<!-- 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 orient="vertical" id="ColorPreview">
<text id="NormalText" value="&normalText.label;"/>
<text id="LinkText" value="&linkText.label;"/>
<text id="ActiveLinkText" value="&activeLinkText.label;"/>
<text id="VisitedLinkText" value="&visitedLinkText.label;"/>
</box>
</box>
<html:div class="separator" align="horizontal"/>
<separator class="groove"/>
<checkbox id="BackgroundImageCheckbox" value="&backgroundImage.label;" oncommand="onBackgroundImageCheckbox()"/>
<box>
<html:div><html:input type="checkbox" id="BackgroundImageCheckbox" onclick="onBackgroundImageCheckbox()"/></html:div>
<html:label for="BackgroundImageCheckbox"> &backgroundImage.label; </html:label>
</box>
<box>
<html:input type="text" class="SizeToParent" id="BackgroundImageInput" flex="1"/>
<textfield id="BackgroundImageInput" flex="1"/>
<spring class="spacer"/>
<titledbutton id="ChooseFile"/>
<button class="dialog" id="ChooseFile"/>
</box>
<box>
<html:div id="SaveImageMsg">&saveImageMsg.label;</html:div>
<html id="SaveImageMsg" value="&saveImageMsg.label;"/>
<spring class="bigspacer"/>
<spring flex="1"/>
<box align="vertical">
<spring class="bigspacer"/>
<titledbutton id="AdvancedEditButton2"/>
<button class="dialog" id="AdvancedEditButton2"/>
</box>
</box>
<html:div class="separator" align="horizontal"/>
<separator class="groove"/>
<box id="okCancelButtons"/>
</window>

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

@ -39,9 +39,9 @@ function InitEditorShell()
{
// get the editor shell from the parent window
editorShell = window.opener.editorShell;
editorShell = window.opener.editorShell;
if (editorShell) {
editorShell = editorShell.QueryInterface(Components.interfaces.nsIEditorShell);
editorShell = editorShell.QueryInterface(Components.interfaces.nsIEditorShell);
}
if (!editorShell) {
dump("EditorShell not found!!!\n");
@ -51,7 +51,7 @@ function InitEditorShell()
// Save as a property of the window so it can be used by child dialogs
window.editorShell = editorShell;
window.editorShell = editorShell;
return true;
}
@ -94,6 +94,7 @@ function ReplaceStringInList(list, index, string)
}
}
// THESE WILL BE REMOVE ONCE ALL DIALOGS ARE CONVERTED TO NEW WIDGETS
function AppendStringToListByID(list, stringID)
{
AppendStringToList(list, editorShell.GetString(stringID));
@ -141,7 +142,7 @@ function ValidateNumberString(value, minValue, maxValue)
function ShowInputErrorMessage(message)
{
window.openDialog("chrome://editor/content/EdMessage.xul", "_blank", "chrome,close,titlebar,modal", "", message, "Input Error");
editorShell.Alert(GetString("InputError"), message);
}
function GetString(name)
@ -261,106 +262,164 @@ function SetClassEnabledByID( elementID, doEnable )
}
// Get the text appropriate to parent container
// that may be a cell or window
// to determine what a "%" value is refering to.
// elementForAtt is element we are actually setting attributes on
// (a temporary copy of element in the doc to allow canceling),
// but elementInDoc is needed to find parent context in document
function GetAppropriatePercentString(elementForAtt, elementInDoc)
{
if (elementForAtt.nodeName == "TD" || elementForAtt.nodeName == "TH")
return GetString("PercentOfTable");
//TEMP: UNTIL InitPixelOrPercentCombobox() has elementInDoc param:
if(elementForAtt.nodeName == "TABLE")
return GetString("PercentOfWindow");
// Check if element is within a cell
// Check if element is within a table cell
if(editorShell.GetElementOrParentByTagName("td",elementInDoc))
return GetString("PercentOfCell");
else
return GetString("PercentOfWindow");
}
// TODO: MODIFY THIS TO PASS IN 2 ELEMENTS: ADD elementInDoc
// 1st is a temporary element containing current attributes,
// 2nd is element in document needed to check parent context for "percent of..." string
// Returns the value for the "size" input element ("%" is stripped)
// Appends option elements with the correct strings to the select widget
function InitPixelOrPercentCombobox(elementForAtt, attribute, selectID)
function InitPixelOrPercentMenulist(elementForAtt, elementInDoc, attribute, menulistID)
{
size = elementForAtt.getAttribute(attribute);
select = document.getElementById(selectID);
var size = elementForAtt.getAttribute(attribute);
var menulist = document.getElementById(menulistID);
var pixelItem;
var percentItem;
if (select) {
ClearList(select);
AppendStringToList(select,GetString("Pixels"));
// TEMPORARY: THIS WILL ALLOW US TO NOT HAVE TO CHANGE CALLS
// FROM IMAGE AN HLINE DIAOLGS -- USE SELECTION ANCHOR NODE
AppendStringToList(select,GetAppropriatePercentString(elementForAtt,window.editorShell.editorSelection.anchorNode));
}
// Search for a "%" character
percentIndex = size.search(/%/);
if (percentIndex > 0) {
// Strip out the %
size = size.substr(0, percentIndex);
if (select)
select.selectedIndex = 1;
} else {
if (select)
select.selectedIndex = 0;
}
return size;
}
// Next two methods assume caller has a "percentChar" variable
// to hold an empty string (pixels are used) or "%" (percent is used)
function InitPixelOrPercentPopupButton(element, attribute, buttonID)
{
size = element.getAttribute(attribute);
btn = document.getElementById(buttonID);
// Search for a "%" character
percentIndex = size.search(/%/);
if (percentIndex > 0) {
percentChar = "%";
// Strip out the %
size = size.substr(0, percentIndex);
if (btn)
btn.setAttribute("value",GetAppropriatePercentString(element));
} else {
if (btn)
btn.setAttribute("value",GetString("Pixels"));
}
return size;
}
// Input string is "" for pixel, or "%" for percent
function SetPixelOrPercentByID(elementID, percentString)
{
percentChar = percentString;
btn = document.getElementById( elementID );
if ( btn )
if (!menulist)
{
if ( percentChar == "%" )
dump("NO MENULIST found for ID="+menulistID+"\n");
return size;
}
ClearMenulist(menulist);
pixelItem = AppendStringToMenulist(menulist, GetString("Pixels"));
percentItem = AppendStringToMenulist(menulist, GetAppropriatePercentString(elementForAtt, elementInDoc));
// Search for a "%" character
percentIndex = size.search(/%/);
if (percentIndex > 0)
{
// Strip out the %
size = size.substr(0, percentIndex);
if (pixelItem)
menulist.selectedItem = pixelItem;
}
else if(percentItem)
menulist.selectedItem = percentItem;
return size;
}
function AppendStringToMenulistByID(menulist, stringID)
{
return AppendStringToMenulist(menulist, editorShell.GetString(stringID));
}
function AppendStringToMenulist(menulist, string)
{
if (menulist)
{
var menupopup = menulist.firstChild;
// May not have any popup yet -- so create one
if (!menupopup)
{
var containing = getContainer();
if (containing != null)
menupopup = document.createElement("menupopup");
if (menupopup)
menulist.appendChild(menupopup);
else
{
if (containing.nodeName == "TD")
btn.setAttribute("value", GetString("PercentOfCell"));
else
btn.setAttribute("value", GetString("PercentOfWindow"));
dump("Failed to create menupoup\n");
return null;
}
// need error handling
}
else
menuItem = document.createElement("menuitem");
if (menuItem)
{
btn.setAttribute("value", GetString("Pixels"));
menuItem.setAttribute("value", string);
menupopup.appendChild(menuItem);
dump("AppendStringToMenulist, menuItem="+menuItem+", value="+string+"\n");
return menuItem;
}
}
return null;
}
function ClearMenulist(menulist)
{
// There is usually not more than 1 menupopup under a menulist,
// but look for > 1 children anyway.
// Note -- this doesn't remove menuitems from the menupopop -- SHOULD WE?
if (menulist) {
dump(menulist+"=menulist in ClearMenulist\n");
menulist.selectedItem = null;
while (menulist.firstChild)
menulist.removeChild(menulist.firstChild);
}
}
/* These help using a <tree> for simple lists
Assumes this simple structure:
<tree>
<treechildren>
<treeitem>
<treerow>
<treecell value="the text the user sees"/>
*/
function AppendStringToTreelistByID(tree, stringID)
{
return AppendStringToTreelist(tree, editorShell.GetString(stringID));
}
function AppendStringToTreelist(tree, string)
{
if (tree)
{
var treechildren = tree.firstChild;
if (!treechildren)
{
treechildren = document.createElement("treechildren");
if (treechildren)
tree.appendChild(treechildren);
else
{
dump("Failed to create <treechildren>\n");
return null;
}
}
var treeitem = document.createElement("treeitem");
var treerow = document.createElement("treerow");
var treecell = document.createElement("treecell");
if (treeitem && treerow && treecell)
{
treerow.appendChild(treecell);
treeeitem.appendChild(treerow);
treechildren.appendChild(treeitem)
treecell.setAttribute("value", string);
return menuItem;
}
}
return null;
}
function ClearTreelist(tree)
{
if (tree)
while (tree.firstChild)
tree.removeChild(tree.firstChild);
}
function GetSelectedTreelistValue(tree)
{
var treeCell = tree.selectedCell;
if (treeCell)
return treeCell.getAttribute("value");
return "";
}
function SetSelectedTreelistItem()
{
}
// USE onkeyup!

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

@ -32,31 +32,31 @@
<box flex="1" style="margin-top: 0.2em" autostretch="never">
<!-- This will right-align the button -->
<spring flex="1"/>
<titledbutton id="AdvancedEditButton" class="push dialog" onclick="onAdvancedEdit()" value="&AdvancedEditButton.label;"/>
<button id="AdvancedEditButton" class="dialog" onclick="onAdvancedEdit()" value="&AdvancedEditButton.label;"/>
</box>
<html:div class="separator" align="horizontal"/>
<separator class="groove"/>
</box>
<!-- 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"
onclick = "onAdvancedEdit()"
value = "&AdvancedEditButton.label;"/>
<button
id = "AdvancedEditButton2"
class = "dialog"
oncommand = "onAdvancedEdit()"
value = "&AdvancedEditButton.label;"/>
<titledbutton
id = "AdvancedEditButton3"
class = "push dialog"
onclick = "onAdvancedEdit()"
value = "&AdvancedEditButton.label;"/>
<button
id = "AdvancedEditButton3"
class = "dialog"
oncommand = "onAdvancedEdit()"
value = "&AdvancedEditButton.label;"/>
<titledbutton
id = "ChooseFile"
class = "push dialog"
onclick = "chooseFile()"
value = "&chooseButton.label;"/>
<button
id = "ChooseFile"
class = "dialog"
oncommand = "chooseFile()"
value = "&chooseButton.label;"/>
</overlay>

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

@ -31,8 +31,8 @@
align="vertical">
<!-- Methods common to all editor dialogs -->
<html:script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js"/>
<html:script language="JavaScript" src="chrome://editor/content/EdDictionary.js"/>
<script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js"/>
<script language="JavaScript" src="chrome://editor/content/EdDictionary.js"/>
<broadcaster id="args" value=""/>

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

@ -45,7 +45,7 @@ function Startup()
window.close();
return;
}
dump("1\n");
// Create dialog object to store controls for easy access
dialog = new Object;
dialog.heightInput = document.getElementById("height");
@ -54,19 +54,23 @@ function Startup()
dialog.centerAlign = document.getElementById("centerAlign");
dialog.rightAlign = document.getElementById("rightAlign");
dialog.shading = document.getElementById("3dShading");
dialog.pixelOrPercentSelect = document.getElementById("pixelOrPercentSelect");
dialog.pixelOrPercentMenulist = document.getElementById("pixelOrPercentMenulist");
dump("2\n");
// Make a copy to use for AdvancedEdit and onSaveDefault
globalElement = hLineElement.cloneNode(false);
dump("3 Init called...\n");
// Initialize control values based on existing attributes
InitDialog()
dump("1\n");
// SET FOCUS TO FIRST CONTROL
dialog.heightInput.focus();
// Resize window
window.sizeToContent();
dump("after sizeToContent\n");
}
// Set dialog widgets with attribute data
@ -83,11 +87,12 @@ function InitDialog()
// We will use "height" here and in UI
dialog.heightInput.value = height;
dump("Calling InitPixelOrPercentMenulist\n");
// Get the width attribute of the element, stripping out "%"
// This sets contents of combobox (adds pixel and percent option elements)
dialog.widthInput.value = InitPixelOrPercentCombobox(globalElement,"width","pixelOrPercentSelect");
// This sets contents of combobox (adds pixel and percent menuitems elements)
dialog.widthInput.value = InitPixelOrPercentMenulist(globalElement, hLineElement, "width","pixelOrPercentMenulist");
dump("AFTER Calling InitPixelOrPercentMenulist\n");
align = globalElement.getAttribute("align");
if (align == "center") {
dialog.centerAlign.checked = true;
@ -104,6 +109,7 @@ function InitDialog()
dialog.shading.checked = false;
else
dialog.shading.checked = true;
dump("Done with INIT\n");
}
function onSaveDefault()
@ -164,7 +170,7 @@ function ValidateData()
dump("Setting height="+height+"\n");
globalElement.setAttribute("size", height);
var isPercent = (dialog.pixelOrPercentSelect.selectedIndex == 1);
var isPercent = (dialog.pixelOrPercentMenulist.selectedIndex == 1);
var maxLimit;
if (isPercent) {
maxLimit = 100;

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

@ -37,53 +37,46 @@
align="vertical">
<!-- Methods common to all editor dialogs -->
<html:script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js"/>
<html:script language="JavaScript" src="chrome://global/content/dialogOverlay.js" />
<script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js"/>
<script language="JavaScript" src="chrome://global/content/dialogOverlay.js" />
<!--- Element-specific methods -->
<html:script language="JavaScript" src="chrome://editor/content/EdHLineProps.js"/>
<script language="JavaScript" src="chrome://editor/content/EdHLineProps.js"/>
<keyset id="keyset"/>
<titledbox><title><text align="left" value="&dimensionsBox.label;"/></title>
<html:table>
<html:tr>
<html:td align="right">
<html:label for="height">&heightEditField.label;</html:label>
</html:td>
<html:td colspan="2">
<html:input type="text" id="height" size="4" maxlength="4"
onkeyup="forceInteger('height')" />
<html:label for="height"> &pixelsPopup.value; </html:label>
</html:td>
</html:tr>
<html:tr>
<html:td>
<html:label for="width">&widthEditField.label;</html:label>
</html:td>
<html:td>
<html:input type="text" id="width" size="4" maxlength="4"
onkeyup="forceInteger('width')" />
</html:td>
<html:td>
<html:select id="pixelOrPercentSelect" size="1"/>
<!-- option elements are appended by JS -->
</html:td>
</html:tr>
</html:table>
<grid>
<columns><column/><column/><column /></columns>
<rows>
<row vertical-align="baseline" autostretch="never">
<text value="&heightEditField.label;"/>
<textfield id="height" onkeyup="forceInteger('height')"/>
<text value="&pixelsPopup.value;"/>
</row>
<row vertical-align="baseline" autostretch="never">
<text value="&widthEditField.label;"/>
<textfield id="width" flex="1" onkeyup="forceInteger('width')"/>
<menulist id="pixelOrPercentMenulist"><menupopup/></menulist>
<!-- menupopup and menuitems added by JS -->
</row>
</rows>
</grid>
</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"/>&centerPopup.value;</html:label>
<html:label><html:input type="radio" name="Align" id="rightAlign"/>&rightPopup.value;</html:label>
</box>
<radiogroup orient="horizontal">
<radio id="leftAlign" value="&leftPopup.value;"/>
<radio id="centerAlign" value="&centerPopup.value;"/>
<radio id="rightAlign" value="&rightPopup.value;"/>
</radiogroup>
</titledbox>
<box align="horizontal">
<html:label><html:input type="checkbox" id="3dShading"/>&threeDShading.label;</html:label>
<spring flex="100%"/>
<titledbutton class="push" id="SaveDefault" onclick="onSaveDefault()" value="&saveSettings.label;"/>
<checkbox id="3dShading" value="&threeDShading.label;"/>
<spring flex="1"/>
<button class="dialog" id="SaveDefault" value="&saveSettings.label;" oncommand="onSaveDefault()"/>
</box>
<!-- from EdDialogOverlay -->
<box id="AdvancedEdit"/>
<!-- from global dialogOverlay -->
<box id="okCancelButtons"/>
<box id="okCancelButtons"/>
</window>

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

@ -46,12 +46,12 @@
<!-- Methods common to all editor dialogs -->
<html:script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js" />
<html:script language="JavaScript" src="chrome://global/content/dialogOverlay.js" />
<script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js" />
<script language="JavaScript" src="chrome://global/content/dialogOverlay.js" />
<!-- Methods for Image Map only -->
<html:script language="JavaScript" src="chrome://editor/content/EdImageMap.js" />
<html:script language="JavaScript" src="chrome://editor/content/EdImageMapShapes.js" />
<script language="JavaScript" src="chrome://editor/content/EdImageMap.js" />
<script language="JavaScript" src="chrome://editor/content/EdImageMapShapes.js" />
<broadcaster id="args" value=""/>

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

@ -51,8 +51,8 @@ function Startup()
dialog.constrainCheckbox = document.getElementById( "constrainCheckbox" );
dialog.widthInput = document.getElementById( "widthInput" );
dialog.heightInput = document.getElementById( "heightInput" );
dialog.widthUnitsSelect = document.getElementById( "widthUnitsSelect" );
dialog.heightUnitsSelect = document.getElementById( "heightUnitsSelect" );
dialog.widthUnitsMenulist = document.getElementById( "widthUnitsMenulist" );
dialog.heightUnitsMenulist = document.getElementById( "heightUnitsMenulist" );
dialog.imagelrInput = document.getElementById( "imageleftrightInput" );
dialog.imagetbInput = document.getElementById( "imagetopbottomInput" );
dialog.border = document.getElementById( "border" );
@ -123,8 +123,8 @@ function InitDialog()
if ( SeeMore )
{
// setup the height and width widgets
dialog.widthInput.value = InitPixelOrPercentCombobox(globalElement, "width", "widthUnitsSelect");
dialog.heightInput.value = InitPixelOrPercentCombobox(globalElement, "height", "heightUnitsSelect");
dialog.widthInput.value = InitPixelOrPercentPopup(globalElement, imageElement, "width", "widthUnitsMenulist");
dialog.heightInput.value = InitPixelOrPercentPopup(globalElement, imageElement, "height", "heightUnitsMenulist");
// TODO: We need to get the actual image dimensions.
// If different from attribute dimensions, then "custom" is checked.
@ -179,7 +179,7 @@ function InitDialog()
doOverallEnabling();
}
function chooseImageFile()
function chooseFile()
{
// Get a local file, converted into URL format
fileName = GetLocalFileURL("img");
@ -248,13 +248,13 @@ dump("alignment ="+alignment+"\n");
// width
str = dialog.widthInput.value;
if (dialog.widthUnitsSelect.selectedIndex == 1)
if (dialog.widthUnitsMenulist.selectedIndex == 1)
str = str + "%";
globalElement.setAttribute("width", str);
// height
str = dialog.heightInput.value;
if (dialog.heightUnitsSelect.selectedIndex == 1)
if (dialog.heightUnitsMenulist.selectedIndex == 1)
str = str + "%";
globalElement.setAttribute("height", str);
}
@ -311,15 +311,15 @@ function doDimensionEnabling( doEnable )
SetElementEnabledByID( "widthInput", enable );
SetElementEnabledByID( "widthLabel", enable);
SetElementEnabledByID( "widthUnitsSelect", enable );
SetElementEnabledByID( "widthUnitsMenulist", enable );
SetElementEnabledByID( "heightInput", enable );
SetElementEnabledByID( "heightLabel", enable );
SetElementEnabledByID( "heightUnitsSelect", enable );
SetElementEnabledByID( "heightUnitsMenulist", enable );
var constrainEnable = enable
&& ( dialog.widthUnitsSelect.selectedIndex == 0 )
&& ( dialog.heightUnitsSelect.selectedIndex == 0 );
&& ( dialog.widthUnitsMenulist.selectedIndex == 0 )
&& ( dialog.heightUnitsMenulist.selectedIndex == 0 );
SetElementEnabledByID( "constrainCheckbox", constrainEnable );
}
@ -446,8 +446,8 @@ function ValidateData()
if ( SeeMore )
{
dialog.isCustomSize = dialog.customsizeRadio.checked;
isPercentWidth = (dialog.widthUnitsSelect.selectedIndex == 1);
isPercentHeight = (dialog.heightUnitsSelect.selectedIndex == 1);
isPercentWidth = (dialog.widthUnitsMenulist.selectedIndex == 1);
isPercentHeight = (dialog.heightUnitsMenulist.selectedIndex == 1);
width = dialog.widthInput.value;
height = dialog.heightInput.value;
}

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

@ -37,7 +37,7 @@
xmlns ="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/TR/REC-html40"
onload = "Startup()"
align="vertical"
orient="vertical"
id="imagedialog"
persist="screenX screenY"
>
@ -56,17 +56,16 @@
<text value="&locationBox.label;"/>
</title>
<box align="horizontal">
<box>
<!--/////// Src URL and ALT Text //////-->
<box align="vertical">
<box align="horizontal">
<box orient="vertical">
<box>
<text class = "label"
for = "srcInput"
value = "&locationEditField.label;"
align = "right" />
</box>
<box align="horizontal">
<box>
<text class = "label"
id = "altTextLabel"
for = "altTextInput"
@ -76,48 +75,46 @@
<spring flex="100%"/>
<box align="vertical">
<box align="horizontal">
<box orient="vertical">
<box>
<textfield
id = "srcInput"
style = "min-width:150px; max-width:200px"
class = "MinWidth20em"
onkeyup = "doOverallEnabling()"
onmouseup = "doOverallEnabling()"
onchange = "doOverallEnabling()" />
<spring flex="100%"/>
<!-- from EdDialogOverlay.xul - TEMP Style hack - use boxes -->
<titledbutton id="ChooseFile" style="margin-left:5px"
class = "push dialog"
onclick = "chooseImageFile()" />
<!-- from EdDialogOverlay.xul -->
<button id="ChooseFile"/>
</box>
<spring flex="100%"/>
<box align="horizontal">
<box>
<textfield
id ="altTextInput"
style = "min-width:100px; max-width:200px"
class = "MinWidth20em"
onchange = "doOverallEnabling()"/>
</box>
</box>
</box>
</titledbox>
<box align="horizontal">
<titledbutton
class = "push dialog"
<box>
<button
class = "dialog"
id = "MoreFewerButton"
align = "left"
onclick = "onMoreFewerImage()"
oncommand = "onMoreFewerImage()"
persist = "more"/>
<spring flex="100%"/>
<!-- From EdDialogOverlay.xul -->
<titledbutton id="AdvancedEditButton2"/>
<button id="AdvancedEditButton2"/>
</box>
<!-- Area that shows and hides via MoreFewerButton -->
<box id="MoreSection" align="vertical" flex="100%">
<box align="horizontal" flex="100%">
<box align="vertical">
<box id="MoreSection" orient="vertical" flex="100%">
<box flex="100%">
<box orient="vertical">
<!-- //////// Image Dimensions //////// -->
<titledbox orient="vertical" flex="100%">
<title
@ -126,23 +123,23 @@
<text value="&dimensionsBox.label;"/>
</title>
<!-- THESE NEED TO BE onchange RATHER THAN onclick -->
<!-- THESE NEED TO BE onchange RATHER THAN oncommand -->
<radiogroup orient="vertical">
<radio
id = "originalsizeRadio"
value = "&originalSizeRadio.label;"
onclick = "doDimensionEnabling( false );"/>
oncommand = "doDimensionEnabling( false );"/>
<radio
id = "customsizeRadio"
value = "&customSizeRadio.label;"
onclick = "doDimensionEnabling( true );" />
oncommand = "doDimensionEnabling( true );" />
</radiogroup>
<!-- preferred width and height added to increase performance in boxes (otherwise buttons will jump!!) -evaughan -->
<spring flex="100%"/>
<!--////// IMAGE WIDTH //////-->
<box align="horizontal">
<box>
<text class = "label"
id = "widthLabel"
for = "widthInput"
@ -150,23 +147,17 @@
<spring flex="100%"/>
<textfield
id = "widthInput"
style = "min-width:30px; max-width:30px"
length = "4"
maxlength = "4"
class = "MinWidth20em"
onfocus = "oldSourceInt = this.value;"
onkeyup = "constrainProportions(this.id, 'heightInput')"
onchange = "doOverallEnabling()" />
<spring flex="100%"/>
<html:select
id = "widthUnitsSelect"
size = "1"
style = "width: 100px; min-width: 100px; max-width: 100px;"
onclick = "doOverallEnabling()"/>
<!-- option elements are appended by JS -->
<menulist id = "widthUnitsMenulist" oncommand = "doOverallEnabling()"/>
<!-- contents are appended by JS -->
</box>
<!--////// IMAGE HEIGHT //////-->
<box align="horizontal">
<box>
<text class = "label"
id = "heightLabel"
for = "heightInput"
@ -174,51 +165,44 @@
<spring flex="100%"/>
<textfield
id = "heightInput"
style = "min-width:30px; max-width:30px"
length = "4"
maxlength = "4"
onfocus = "oldSourceInt = this.value;"
onkeyup = "constrainProportions(this.id, 'widthInput')"
onchange = "doOverallEnabling()" />
<spring flex="100%"/>
<html:select
id = "heightUnitsSelect"
size = "1"
style = "width: 100px; min-width: 100px; max-width: 100px;"
onclick = "doOverallEnabling()"/>
<!-- option elements are appended by JS -->
<menulist id = "heightUnitsMenulist" oncommand = "doOverallEnabling()"/>
<!-- contents are appended by JS -->
</box>
<!--////// CONSTRAIN DIMENSIONS //////-->
<box align="horizontal">
<box>
<checkbox id="constrainCheckbox" value="&constrainCheckbox.label;"/>
</box>
</titledbox>
<titledbox orient="horizontal" flex="100%">
<titledbox flex="100%">
<title
class="dialog"
id="imagemapLabel">
<text value="&imagemapBox.label;"/>
</title>
<titledbutton
class = "push dialog"
<button
class = "dialog"
id = "editImageMap"
onclick = "editImageMap()"
oncommand = "editImageMap()"
value = "&editImageMapButton.label;"/>
<titledbutton
class = "push dialog"
<button
class = "dialog"
id = "removeImageMap"
onclick = "removeImageMap()"
oncommand = "removeImageMap()"
value = "&removeImageMapButton.label;"/>
</titledbox>
</box>
<box align="vertical" flex="100%">
<box orient="vertical" flex="100%">
<!-- Bottom Right Region -->
<!--//////// Alignment ////////-->
<titledbox flex="100%" orient="vertical">
<titledbox flex="1" orient="vertical">
<title
class = "dialog"
id = "alignLabel"
@ -248,60 +232,45 @@
</titledbox>
<!--//////// Borders and Spacing ////////-->
<titledbox orient="horizontal" flex="100%">
<titledbox flex="100%">
<title
class = "dialog"
id = "spacingLabel">
<text value="&spacingBox.label;"/>
</title>
<box align="vertical">
<text class = "label"
<box orient="vertical">
<text class = "align-right"
id = "leftrightLabel"
for = "imageleftrightInput"
value = "&leftRightEditField.label;"
style = "align:right" />
value = "&leftRightEditField.label;"/>
<spring flex="100%"/>
<text class = "label"
<text class = "align-right"
id = "topbottomLabel"
for = "imagetopbottomInput"
value = "&topBottomEditField.label;"
style = "align:right" />
value = "&topBottomEditField.label;"/>
<spring flex="100%"/>
<text class = "label"
<text class = "align-right"
id = "borderLabel"
for = "border"
value = "&borderEditField.label;"
style = "align:right" />
value = "&borderEditField.label;"/>
</box>
<box align="vertical">
<box orient="vertical">
<textfield
id = "imageleftrightInput"
style = "min-width:30px; max-width:30px"
length = "4"
maxlength = "4"
onkeyup = "forceInteger(this.id)"
onchange = "doOverallEnabling()"/>
<spring flex="100%"/>
<textfield
id = "imagetopbottomInput"
style = "min-width:30px; max-width:30px"
length = "4"
maxlength = "4"
onkeyup = "forceInteger(this.id)"
onchange = "doOverallEnabling()"/>
<spring flex="100%"/>
<textfield
id = "border"
style = "min-width:30px; max-width:30px"
length = "4"
maxlength = "4"
onkeyup = "forceInteger(this.id)"
onchange = "doOverallEnabling()" />
</box>
<box align="vertical">
<box orient="vertical">
<text class = "label"
id = "leftrighttypeLabel"
for = "imageleftrightInput"
@ -323,10 +292,10 @@
</box> <!-- The horizontal box -->
<!-- buttons along bottom -->
<box align="horizontal">
<box>
<spring flex="100%"/>
<!-- From EdDialogOverlay -->
<titledbutton id="AdvancedEditButton3"/>
<button id="AdvancedEditButton3"/>
</box>
</box> <!-- END OF MORE/FEWER SECTION -->

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

@ -30,9 +30,9 @@
<!DOCTYPE window SYSTEM "chrome://editor/locale/EditorInsertSource.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" flex="100%">
@ -41,14 +41,15 @@
<script language="JavaScript" src="chrome://editor/content/EdInsSrc.js"/>
<script language="JavaScript" src="chrome://global/content/dialogOverlay.js" />
<xul:broadcaster id="args" value=""/>
<xul:keyset id="keyset"/>
<broadcaster id="args" value=""/>
<keyset id="keyset"/>
<label id="srcMessage" for="srcInput">&sourceEditField.label;</label>
<text id="srcMessage" value="&sourceEditField.label;"/>
<textarea rows="16" cols="80" id="srcInput" flex="1"/>
<div>&example.label;</div>
<xul:spring class="spacer"/>
<div class="separator" align="horizontal"/>
<!-- Will this accept the embedded HTML tags? -->
<text value="&example.label;"/>
<spring class="spacer"/>
<separator class="groove"/>
<!-- from global dialogOverlay -->
<xul:box id="okCancelButtons"/>
</xul:window>
<box id="okCancelButtons"/>
</window>

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

@ -49,7 +49,7 @@ function Startup()
dump("Rows editbox:"+document.getElementById("rows")+"\n");
dump("Columns editbox:"+document.getElementById("columns")+"\n");
dump("width editbox:"+document.getElementById("width")+"\n");
dump("pixelOrPercentSelect:"+document.getElementById("pixelOrPercentSelect")+"\n");
dump("pixelOrPercentMenulist:"+document.getElementById("pixelOrPercentMenulist")+"\n");
dump("borderInput editbox:"+document.getElementById("borderInput")+"\n");
// Create dialog object to store controls for easy access
@ -58,7 +58,7 @@ function Startup()
dialog.columnsInput = document.getElementById("columns");
dialog.widthInput = document.getElementById("width");
dialog.borderInput = document.getElementById("borderInput");
dialog.pixelOrPercentSelect = document.getElementById("pixelOrPercentSelect");
dialog.pixelOrPercentMenulist = document.getElementById("pixelOrPercentMenulist");
// Make a copy to use for AdvancedEdit
globalElement = tableElement.cloneNode(false);
@ -88,7 +88,7 @@ function InitDialog()
// Get default attributes set on the created table:
// Get the width attribute of the element, stripping out "%"
// This sets contents of select combobox list
dialog.widthInput.value = InitPixelOrPercentCombobox(globalElement,"width","pixelOrPercentSelect");
dialog.widthInput.value = InitPixelOrPercentMenulist(globalElement, tableElement, "width","pixelOrPercentMenulist");
dialog.borderInput.value = globalElement.getAttribute("border");
}
@ -118,7 +118,7 @@ function ValidateData()
globalElement.setAttribute("border", borderText);
}
var isPercent = (dialog.pixelOrPercentSelect.selectedIndex == 1);
var isPercent = (dialog.pixelOrPercentMenulist.selectedIndex == 1);
widthText = TrimString(dialog.widthInput.value);
if (widthText) {
var maxLimit;

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

@ -37,51 +37,51 @@
align="vertical">
<!-- Methods common to all editor dialogs -->
<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"/>
<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"/>
<broadcaster id="args" value=""/>
<keyset id="keyset"/>
<box valign="middle" autostretch="never">
<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" autostretch="never">
<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" autostretch="never">
<text class="right" align="right" value="&widthEditField.label;"/>
<html:div><html:input type="text" id="width" size="4" maxlength="4"
onkeyup="forceInteger('width')" /></html:div>
<spring class="spacer"/>
<html:select id="pixelOrPercentSelect" size="1"/>
<!-- option elements are appended by JS -->
</box>
<spring class="spacer"/>
<box valign="middle" autostretch="never">
<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>
<grid>
<columns><column/><column/><column/></columns>
<rows>
<row vertical-align="baseline" autostretch="never">
<text class="align-right" flex="1" value="&numRowsEditField.label;"/>
<textfield id="rows" onkeyup="forceInteger(this.id)" />
<spring/>
</row>
<spring class="spacer"/>
<row vertical-align="baseline" autostretch="never">
<text class="align-right" flex="1" value="&numColumnsEditField.label;"/>
<textfield id="columns" onkeyup="forceInteger(this.id)" />
<spring/>
</row>
<spring class="spacer"/>
<row vertical-align="baseline" autostretch="never">
<text class="align-right" flex="1" value="&widthEditField.label;"/>
<textfield id="width" onkeyup="forceInteger(this.id)" />
<spring/>
</row>
<spring class="spacer"/>
<row vertical-align="baseline" autostretch="never">
<text class="align-right" flex="1" value="&widthEditField.label;"/>
<textfield id="width" onkeyup="forceInteger(this.id)" />
<menulist id="pixelOrPercentMenulist"><menupopup/></menulist>
<!-- child elements are appended by JS -->
</row>
<spring class="spacer"/>
<row vertical-align="baseline" autostretch="never">
<text class="align-right" flex="1" value="&borderEditField.label;"/>
<textfield id="borderInput" onkeyup="forceInteger(this.id)" />
<text value="&pixelsPopup.value;"/>
</row>
</rows>
</grid>
<spring class="spacer"/>
<!-- from EdDialogOverlay -->
<box id="AdvancedEdit"/>
<!-- from global dialogOverlay -->
<box id="okCancelButtons"/>
<popup id="PixelOrPercentMenu">
<menu>
<menuitem value="&pixelsPopup.value;" onclick="SetPixelOrPercentByID('pixelOrPercentButton', '')"/>
<menuitem value="&percentPopup.value;" onclick="SetPixelOrPercentByID('pixelOrPercentButton', '%')"/>
</menu>
</popup>
</window>

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

@ -37,9 +37,9 @@
onload = "Startup()"
align="vertical" >
<html:script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js"/>
<html:script language="JavaScript" src="chrome://editor/content/EdLinkProps.js"/>
<html:script language="JavaScript" src="chrome://global/content/dialogOverlay.js" />
<script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js"/>
<script language="JavaScript" src="chrome://editor/content/EdLinkProps.js"/>
<script language="JavaScript" src="chrome://global/content/dialogOverlay.js" />
<broadcaster id="args" value=""/>
<keyset id="keyset"/>
@ -47,14 +47,14 @@
<box align="vertical" style="min-width: 20em">
<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"/>
<textfield id="linkTextInput"/>
<spring class="spacer"/>
<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>
<textfield id="hrefInput"/>
<spring class="spacer"/>
<!-- from EdDialogOverlay.xul -->
<!-- The style: width setting is need to cover a bug in button width resizing when text changes -->

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

@ -35,9 +35,9 @@
align="vertical">
<!-- Methods common to all editor dialogs -->
<html:script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js"/>
<html:script language="JavaScript" src="chrome://editor/content/EdListProps.js"/>
<html:script language="JavaScript" src="chrome://global/content/dialogOverlay.js" />
<script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js"/>
<script language="JavaScript" src="chrome://editor/content/EdListProps.js"/>
<script language="JavaScript" src="chrome://global/content/dialogOverlay.js" />
<keyset id="keyset"/>
<broadcaster id="args" value=""/>

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

@ -1,56 +0,0 @@
<?xml version="1.0"?>
<!--
- The contents of this file are subject to the Netscape Public
- License Version 1.1 (the "License"); you may not use this file
- except in compliance with the License. You may obtain a copy of
- the License at http://www.mozilla.org/NPL/
-
- Software distributed under the License is distributed on an "AS
- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- implied. See the License for the specific language governing
- rights and limitations under the License.
-
- The Original Code is Mozilla Communicator client code, released
- March 31, 1998.
-
- The Initial Developer of the Original Code is Netscape
- Communications Corporation. Portions created by Netscape are
- Copyright (C) 1998-1999 Netscape Communications Corporation. All
- Rights Reserved.
-
- Contributor(s):
-->
<?xml-stylesheet href="chrome://editor/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://editor/skin/EditorDialog.css" type="text/css"?>
<!DOCTYPE window>
<!-- dialog containing a control requiring initial setup -->
<window title="Netscape" class="dialog"
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 -->
<html:script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js">
</html:script>
<html:script language="JavaScript" src="chrome://editor/content/EdMessage.js">
</html:script>
<broadcaster id="args" value=""/>
<box align="horizontal" style="margin: 10px">
<html:img src="chrome://global/skin/alert-icon.gif"/>
<!-- text node(s) with message text will be appended as children to this -->
<html:div id="message" flex="100%"/>
</box>
<!-- spring style="height: 15px"/ -->
<box align="horizontal" style="margin: 10px">
<spring flex="100%"/>
<titledbutton class="push MsgButton" id="button1" onclick="onButton(1)"/>
<titledbutton class="push MsgButton" id="button2" onclick="onButton(2)"/>
<titledbutton class="push MsgButton" id="button3" onclick="onButton(3)"/>
<titledbutton class="push MsgButton" id="button4" onclick="onButton(4)"/>
<spring flex="100%"/>
</box>
</window>

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

@ -82,6 +82,7 @@ function Startup()
function InitDialog()
{
//nameInput.setAttribute("value",globalElement.getAttribute("name"));
nameInput.value = globalElement.getAttribute("name");
}
@ -101,7 +102,7 @@ function AnchorNameExists(name)
// Set attributes on globalElement so they can be accessed by AdvancedEdit()
function ValidateData()
{
var name = TrimString(nameInput.value);
var name = TrimString(nameInput.getAttribute("value"));
if (name.length == 0) {
ShowInputErrorMessage(GetString("MissingAnchorNameError"));
nameInput.focus();

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

@ -37,14 +37,14 @@
align="vertical">
<!-- Methods common to all editor dialogs -->
<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" />
<script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js"/>
<script language="JavaScript" src="chrome://editor/content/EdNamedAnchorProps.js"/>
<script language="JavaScript" src="chrome://global/content/dialogOverlay.js" />
<keyset id="keyset"/>
<text align="left" for="nameInput" value="&anchorNameEditField.label;"/>
<html:input type="text" class="MinWidth200" id="nameInput"/>
<textfield class="MinWidth20em" id="nameInput"/>
<text align="left" value="&noSpacesMsg.label;"/>
<spring class="spacer"/>
<!-- from EdDialogOverlay -->

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

@ -37,9 +37,9 @@
align="vertical">
<!-- Methods common to all editor dialogs -->
<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://global/content/dialogOverlay.js" />
<script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js"/>
<script language="JavaScript" src="chrome://editor/content/EdPageProps.js"/>
<script language="JavaScript" src="chrome://global/content/dialogOverlay.js" />
<broadcaster id="args" value=""/>
<keyset id="keyset"/>
@ -47,34 +47,34 @@
<text value="&location.label;" flex ="1" align="left"/>
<spring class="spacer"/>
<spring flex="1"/>
<text class="MinWidth200" value="&locationNewPage.label;" id="PageLocation" align="left"/>
<text class="MinWidth20em" 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"/>
<text class="MinWidth20em" 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"/>
<html:input class="MinWidth20em" 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"/>
<html:input class="MinWidth20em" 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"/>
<html:input class="MinWidth20em" type="text" id="DescriptionInput"/>
</box>
<spring class="bigspacer"/>
<box align="horizontal">
@ -91,6 +91,6 @@
<html:div> [Meta Tags editing widgets will go here] </html:div>
<spring class="bigspacer"/>
</box>
<html:div class="separator" align="horizontal"/>
<separator class="groove"/>
<box id="okCancelButtons"/>
</window>

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

@ -20,7 +20,7 @@
* Contributor(s):
*/
var misspelledWord;
var MisspelledWord;
var spellChecker;
var allowSelectWord = true;
@ -47,75 +47,113 @@ function Startup()
dump("Failed to create dialog object!!!\n");
window.close();
}
dialog.MisspelledWordLabel = document.getElementById("MisspelledWordLabel");
dialog.MisspelledWord = document.getElementById("MisspelledWord");
dialog.ReplaceWordInput = document.getElementById("ReplaceWord");
dialog.SuggestedList = document.getElementById("SuggestedList");
dialog.LanguageList = document.getElementById("LanguageList");
dialog.misspelledWord = document.getElementById("MisspelledWord");
dialog.replaceWordInput = document.getElementById("ReplaceWord");
dialog.suggestedList = document.getElementById("SuggestedList");
dialog.languageList = document.getElementById("LanguageList");
if (!dialog.misspelledWord ||
!dialog.replaceWordInput ||
!dialog.suggestedList ||
!dialog.languageList )
if (!dialog.MisspelledWord ||
!dialog.ReplaceWordInput ||
!dialog.SuggestedList ||
!dialog.LanguageList )
{
dump("Not all dialog controls were found!!!\n");
}
// NOTE: We shouldn't have been created if there was no misspelled word
// The first misspelled word is passed as the 2nd extra parameter in window.openDialog()
misspelledWord = window.arguments[1];
MisspelledWord = window.arguments[1];
if (misspelledWord != "") {
dump("First misspelled word = "+misspelledWord+"\n");
if (MisspelledWord.length > 0) {
dump("First misspelled word = "+MisspelledWord+"\n");
// Put word in the borderless button used to show the misspelled word
dialog.misspelledWord.setAttribute("value", misspelledWord);
dialog.MisspelledWord.setAttribute("value", MisspelledWord);
// Get the list of suggested replacements
FillSuggestedList();
} else {
dump("No misspelled word found\n");
// No more words - we're done!
Close();
}
// Initial replace word is the misspelled word;
dialog.replaceWordInput.value = misspelledWord;
dialog.ReplaceWordInput.value = MisspelledWord;
//Use English for now TODO: Kin needs to finish this work so we can fill in list
dialog.languageList.selectedIndex = 0;
dump("Language Listed Index = "+dialog.languageList.selectedIndex+"\n");
dialog.LanguageList.selectedIndex = 0;
dump("Language Listed Index = "+dialog.LanguageList.selectedIndex+"\n");
dialog.suggestedList.focus();
DoEnabling();
dialog.SuggestedList.focus();
}
function DoEnabling()
{
if (MisspelledWord.length == 0)
{
dialog.MisspelledWordLabel.setAttribute("value",GetString("CheckSpellingDone"));
SetElementEnabledByID("MisspelledWord", false);
SetElementEnabledByID("ReplaceWordLabel", false);
SetElementEnabledByID("ReplaceWord", false);
SetElementEnabledByID("CheckWord", false);
SetElementEnabledByID("SuggestedListLabel", false);
SetElementEnabledByID("SuggestedList", false);
SetElementEnabledByID("Ignore", false);
SetElementEnabledByID("IgnoreAll", false);
SetElementEnabledByID("Replace", false);
SetElementEnabledByID("ReplaceAll", false);
SetElementEnabledByID("AddToDictionary", false);
} else {
dialog.MisspelledWordLabel.setAttribute("value",GetString("MisspelledWordLabel"));
SetElementEnabledByID("MisspelledWord", true);
SetElementEnabledByID("ReplaceWordLabel", true);
SetElementEnabledByID("ReplaceWord", true);
SetElementEnabledByID("CheckWord", true);
SetElementEnabledByID("SuggestedListLabel", true);
SetElementEnabledByID("SuggestedList", true);
SetElementEnabledByID("Ignore", true);
SetElementEnabledByID("IgnoreAll", true);
SetElementEnabledByID("Replace", true);
SetElementEnabledByID("ReplaceAll", true);
SetElementEnabledByID("AddToDictionary", true);
}
}
function NextWord()
{
misspelledWord = spellChecker.GetNextMisspelledWord();
dialog.misspelledWord.setAttribute("value",misspelledWord);
MisspelledWord = spellChecker.GetNextMisspelledWord();
SetWidgetsForMisspelledWord();
}
function SetWidgetsForMisspelledWord()
{
dialog.MisspelledWord.setAttribute("value",MisspelledWord);
FillSuggestedList();
if (misspelledWord == "") {
dump("FINISHED SPELL CHECKING\n");
// Simply close dialog when finished.
Close();
} else {
FillSuggestedList();
}
// Initial replace word is misspelled word
dialog.replaceWordInput.value = misspelledWord;
dialog.ReplaceWordInput.value = MisspelledWord;
DoEnabling();
// EXPERIMENTAL: Automatically shift focus to replace word editfield
if (MisspelledWord)
dialog.ReplaceWordInput.focus();
}
function CheckWord()
{
//dump("SpellCheck: CheckWord\n");
word = dialog.replaceWordInput.value;
word = dialog.ReplaceWordInput.value;
if (word != "") {
//dump("CheckWord: Word in edit field="+word+"\n");
isMisspelled = spellChecker.CheckCurrentWord(word);
if (isMisspelled) {
dump("CheckWord says word was misspelled\n");
misspelledWord = word;
MisspelledWord = word;
FillSuggestedList();
} else {
ClearList(dialog.suggestedList);
AppendStringToList(dialog.suggestedList, GetString("CorrectSpelling"));
ClearList(dialog.SuggestedList);
AppendStringToList(dialog.SuggestedList, GetString("CorrectSpelling"));
// Suppress being able to select the message text
allowSelectWord = false;
}
@ -126,13 +164,13 @@ function SelectSuggestedWord()
{
dump("SpellCheck: SelectSuggestedWord\n");
if (allowSelectWord)
dialog.replaceWordInput.value = dialog.suggestedList.options[dialog.suggestedList.selectedIndex].value;
dialog.ReplaceWordInput.value = dialog.SuggestedList.options[dialog.SuggestedList.selectedIndex].value;
}
function ChangeReplaceWord()
{
// Unselect the word in the suggested list when user edits the replacement word
dialog.suggestedList.selectedIndex = -1;
dialog.SuggestedList.selectedIndex = -1;
}
function Ignore()
@ -144,8 +182,8 @@ function Ignore()
function IgnoreAll()
{
dump("SpellCheck: IgnoreAll\n");
if (misspelledWord != "") {
spellChecker.IgnoreWordAllOccurrences(misspelledWord);
if (MisspelledWord != "") {
spellChecker.IgnoreWordAllOccurrences(MisspelledWord);
}
NextWord();
}
@ -153,10 +191,10 @@ function IgnoreAll()
function Replace()
{
dump("SpellCheck: Replace\n");
newWord = dialog.replaceWordInput.value;
//dump("New = "+newWord+" Misspelled = "+misspelledWord+"\n");
if (misspelledWord != "" && misspelledWord != newWord) {
isMisspelled = spellChecker.ReplaceWord(misspelledWord, newWord, false);
newWord = dialog.ReplaceWordInput.value;
//dump("New = "+newWord+" Misspelled = "+MisspelledWord+"\n");
if (MisspelledWord != "" && MisspelledWord != newWord) {
isMisspelled = spellChecker.ReplaceWord(MisspelledWord, newWord, false);
}
NextWord();
}
@ -164,9 +202,9 @@ function Replace()
function ReplaceAll()
{
dump("SpellCheck: ReplaceAll\n");
newWord = dialog.replaceWordInput.value;
if (misspelledWord != "" && misspelledWord != newWord) {
isMisspelled = spellChecker.ReplaceWord(misspelledWord, newWord, true);
newWord = dialog.ReplaceWordInput.value;
if (MisspelledWord != "" && MisspelledWord != newWord) {
isMisspelled = spellChecker.ReplaceWord(MisspelledWord, newWord, true);
}
NextWord();
}
@ -174,14 +212,14 @@ function ReplaceAll()
function AddToDictionary()
{
dump("SpellCheck: AddToDictionary\n");
if (misspelledWord != "") {
spellChecker.AddWordToDictionary(misspelledWord);
if (MisspelledWord != "") {
spellChecker.AddWordToDictionary(MisspelledWord);
}
}
function EditDictionary()
{
window.openDialog("chrome://editor/content/EdDictionary.xul", "_blank", "chrome,close,titlebar,modal", "", misspelledWord);
window.openDialog("chrome://editor/content/EdDictionary.xul", "_blank", "chrome,close,titlebar,modal", "", MisspelledWord);
}
function SelectLanguage()
@ -190,6 +228,14 @@ function SelectLanguage()
dump("SpellCheck: SelectLanguage.\n");
}
function Recheck()
{
//TODO: Should we bother to add a "Recheck" method to interface?
spellChecker.CloseSpellChecking();
MisspelledWord = spellChecker.StartSpellChecking();
SetWidgetsForMisspelledWord();
}
function Close()
{
// Shutdown the spell check and close the dialog
@ -197,33 +243,30 @@ function Close()
window.close();
}
function FillSuggestedList(firstWord)
function FillSuggestedList()
{
list = dialog.suggestedList;
list = dialog.SuggestedList;
// Clear the current contents of the list
ClearList(list);
// We may have the initial word
if (firstWord && firstWord != "") {
dump("First Word = "+firstWord+"\n");
AppendStringToList(list, firstWord);
}
// Get suggested words until an empty string is returned
do {
word = spellChecker.GetSuggestedWord();
dump("Suggested Word = "+word+"\n");
if (word != "") {
AppendStringToList(list, word);
if (MisspelledWord.length > 0)
{
// Get suggested words until an empty string is returned
do {
word = spellChecker.GetSuggestedWord();
dump("Suggested Word = "+word+"\n");
if (word != "") {
AppendStringToList(list, word);
}
} while (word != "");
if (list.length == 0) {
// No suggestions - show a message but don't let user select it
AppendStringToList(list, GetString("NoSuggestedWords"));
allowSelectWord = false;
} else {
allowSelectWord = true;
}
} while (word != "");
if (list.length == 0) {
// No suggestions - show a message but don't let user select it
AppendStringToList(list, GetString("NoSuggestedWords"));
allowSelectWord = false;
} else {
allowSelectWord = true;
}
}

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

@ -40,11 +40,12 @@
<box align="vertical">
<box align="horizontal">
<html:label for="MisspelledWord"> &misspelledWord.label; </html:label>
<!-- value is set in JS -->
<text id="MisspelledWordLabel"/>
<spring class="bigspacer"/>
<titledbutton id="MisspelledWord"/>
<text id="MisspelledWord"/>
</box>
<html:label for="ReplaceWord"> &wordEditField.label; </html:label>
<text id="ReplaceWordLabel" value="&wordEditField.label;"/>
<box align="horizontal">
<html:input type="text" class="SpellCheckWord" id="ReplaceWord" size="24" onkeyup="ChangeReplaceWord()"/>
<spring class="bigspacer"/>
@ -52,7 +53,7 @@
<spring flex="100%"/>
</box>
<spring class="spacer"/>
<html:label> &suggestions.label; </html:label>
<text id="SuggestedListLabel" value="&suggestions.label;"/>
<box align="horizontal">
<html:select class="SpellCheckList" id="SuggestedList" size="8" onchange="SelectSuggestedWord()"/>
<box align="vertical">
@ -87,7 +88,9 @@
<html:select class="SpellCheckLanguage" id="LanguageList" size="1" onchange="SelectLanguage()">
<option> &englishLanguagePopup.value; </option>
</html:select>
<spring flex="100%"/>
<spring class="bigspacer"/>
<titledbutton class="push SizeToParent" id="Recheck" onclick="Recheck()" value="&recheckButton.label;"/>
<spring class="bigspacer"/>
<titledbutton class="push SizeToParent" id="Close" onclick="Close()" value="&closeButton.label;"/>
<spring class="bigspacer"/>
</box>

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

@ -41,8 +41,6 @@ EdTableProps.js
EdTableProps.xul
EdInsSrc.xul
EdInsSrc.js
EdMessage.xul
EdMessage.js
EdDialogOverlay.xul
EdAdvancedEdit.xul
EdAdvancedEdit.js

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

@ -52,8 +52,6 @@ EXPORT_RESOURCE_CONTENT = \
$(srcdir)/EdInsertTable.js \
$(srcdir)/EdTableProps.xul \
$(srcdir)/EdTableProps.js \
$(srcdir)/EdMessage.xul \
$(srcdir)/EdMessage.js \
$(srcdir)/EdDialogOverlay.xul \
$(srcdir)/EdAdvancedEdit.xul \
$(srcdir)/EdAdvancedEdit.js \

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

@ -43,8 +43,6 @@ install::
$(MAKE_INSTALL) EdTableProps.js $(DIST)\bin\chrome\editor\content\default
$(MAKE_INSTALL) EdInsSrc.xul $(DIST)\bin\chrome\editor\content\default
$(MAKE_INSTALL) EdInsSrc.js $(DIST)\bin\chrome\editor\content\default
$(MAKE_INSTALL) EdMessage.xul $(DIST)\bin\chrome\editor\content\default
$(MAKE_INSTALL) EdMessage.js $(DIST)\bin\chrome\editor\content\default
$(MAKE_INSTALL) EdDialogOverlay.xul $(DIST)\bin\chrome\editor\content\default
$(MAKE_INSTALL) EdAdvancedEdit.xul $(DIST)\bin\chrome\editor\content\default
$(MAKE_INSTALL) EdAdvancedEdit.js $(DIST)\bin\chrome\editor\content\default
@ -85,8 +83,6 @@ clobber::
rm -f $(DIST)\bin\chrome\editor\content\default\EdInsertTable.js
rm -f $(DIST)\bin\chrome\editor\content\default\EdInsSrc.xul
rm -f $(DIST)\bin\chrome\editor\content\default\EdInsSrc.js
rm -f $(DIST)\bin\chrome\editor\content\default\EdMessage.xul
rm -f $(DIST)\bin\chrome\editor\content\default\EdMessage.js
rm -f $(DIST)\bin\chrome\editor\content\default\EdDialogOverlay.xul
rm -f $(DIST)\bin\chrome\editor\content\default\EdAdvancedEdit.xul
rm -f $(DIST)\bin\chrome\editor\content\default\EdAdvancedEdit.js

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

@ -23,7 +23,6 @@
<!-- Window title -->
<!ENTITY windowTitle.label "Check Spelling">
<!ENTITY misspelledWord.label "Misspelled word:">
<!ENTITY wordEditField.label "Replace with:">
<!ENTITY checkwordButton.label "Check Word">
<!ENTITY suggestions.label "Suggestions:">
@ -36,6 +35,7 @@
<!ENTITY userDictionary.label "User Dictionary:">
<!ENTITY addtouserdictionaryButton.label "Add Word">
<!ENTITY edituserdictionaryButton.label "Edit">
<!ENTITY recheckButton.label "Recheck">
<!ENTITY closeButton.label "Close">
<!ENTITY languagePopup.label "Language:">

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

@ -41,57 +41,6 @@ tr {
vertical-align: middle;
}
/* This strategy for hidding allows widget to keep layout space
while using "hidden" attribute sets to display: none, removing space
*/
input[visibility=hidden]
{
visibility: hidden;
}
input.MinWidth200,select.MinWidth200,div.MinWidth200,titledbutton.MinWidth200,text.MinWidth200,spring.MinWidth100 {
min-width: 200px;
}
input.MinWidth100,select.MinWidth100,div.MinWidth100,titledbutton.MinWidth100,text.MinWidth100,spring.MinWidth100 {
min-width: 100px;
}
input.MinWidth70,select.MinWidth70,label.MinWidth70,div.MinWidth70,titledbutton.MinWidth70,text.MinWidth70,spring.MinWidth70 {
min-width: 70px;
}
input.MinWidth50,select.MinWidth50,label.MinWidth50,div.MinWidth50,titledbutton.MinWidth50,text.MinWidth50,spring.MinWidth50 {
min-width: 50px;
}
input#CellAlignCharInput {
padding-left: 3px;
padding-right: 3px;
}
select.SpellCheckList, select.SpellCheckLanguage, input.SpellCheckWord {
width: 200px;
}
select.dialog {
font-size: smaller;
}
div.spacer [align~=horizontal] {
border: 1px inset white;
height: 2px;
}
div#message {
width: 20em;
margin-left: 10px;
}
div.middle-align {
vertical-align: middle;
}
.margin-left-right {
margin-left: 10px;
margin-right: 5px;
@ -113,7 +62,12 @@ image.popup-trigger {
list-style-image: url(chrome://global/skin/scroll-down.gif);
}
td#ColorPreview {
/* XUL ELEMENTS */
*.MinWidth20em {
min-width: 20em;
}
box#ColorPreview {
border: 1px inset #CCCCCC;
padding-left: 5px;
padding-right: 5px;
@ -121,17 +75,9 @@ td#ColorPreview {
min-height: 50px;
}
/* A line of text inside the preview cell */
td#ColorPreview div {
margin-top: 5px;
margin-bottom: 5px;
}
/* XUL ELEMENTS */
/* These reduce extra space to
minimize total height in Table Dialog
*/
titledbox.NoBottomPad {
padding-bottom: 0px;
}
@ -147,8 +93,13 @@ titledbox.NoTopPadding {
tabpanel.Padding5 {
padding: 5px;
}
*/
/* SHOULD GO IN GLOBAL.CSS */
*.align-right {
text-align: right;
}
text {
text-align: left;
}
@ -161,11 +112,6 @@ select#alignTypeSelect,label#alignLabel {
margin-left: 5px;
}
/* For right-aligned buttons */
titledbutton#AdvancedEditButton,titledbutton#AdvancedEditExtraButton,titledbutton#SaveDefault {
min-width: 8em;
}
titledbutton#MoreFewerButton[more="0"] {
margin-left: 6px;
list-style-image: url(chrome://global/skin/scroll-down.gif);
@ -180,11 +126,7 @@ titledbutton#MoreFewerButton[more="1"] {
}
/* We use a borderless button to show misspelled word in dialog */
titledbutton#MisspelledWord {
font-weight: bold;
}
text#linkTextCaption {
text#MisspelledWord {
font-weight: bold;
}