Fixed GetBodyElement. Changed editor test doc to not use CSS for background. Initial code to edit element properties when double-clicking on element.
git-svn-id: svn://10.0.0.236/trunk@36724 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -190,6 +190,7 @@ NS_IMETHODIMP nsHTMLEditor::SetBackgroundColor(const nsString& aColor)
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::SetBodyAttribute(const nsString& aAttribute, const nsString& aValue)
|
||||
{
|
||||
|
||||
#ifdef ENABLE_JS_EDITOR_LOG
|
||||
nsAutoJSEditorLogLock logLock(mJSEditorLog);
|
||||
|
||||
@@ -1859,6 +1860,8 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu
|
||||
|
||||
nsAutoString TagName = aTagName;
|
||||
TagName.ToLowerCase();
|
||||
// Empty string indicates we should match any element tag
|
||||
PRBool anyTag = (TagName == "");
|
||||
|
||||
//Note that this doesn't need to go through the transaction system
|
||||
|
||||
@@ -1919,6 +1922,14 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu
|
||||
selectedElement->GetNodeName(domTagName);
|
||||
domTagName.ToLowerCase();
|
||||
|
||||
if (anyTag)
|
||||
{
|
||||
// Get name of first selected element
|
||||
selectedElement->GetTagName(TagName);
|
||||
TagName.ToLowerCase();
|
||||
anyTag = PR_FALSE;
|
||||
}
|
||||
|
||||
// The "A" tag is a pain,
|
||||
// used for both link(href is set) and "Named Anchor"
|
||||
if (TagName == "href" || (TagName == "anchor"))
|
||||
@@ -2138,16 +2149,20 @@ nsHTMLEditor::InsertElement(nsIDOMElement* aElement, PRBool aDeleteSelection)
|
||||
selection->ClearSelection();
|
||||
}
|
||||
}
|
||||
|
||||
PRBool isInline;
|
||||
|
||||
//
|
||||
res = DeleteSelectionAndPrepareToCreateNode(parentSelectedNode, offsetOfNewNode);
|
||||
if (NS_SUCCEEDED(res))
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> newNode = do_QueryInterface(aElement);
|
||||
|
||||
res = InsertNode(aElement, parentSelectedNode, offsetOfNewNode);
|
||||
|
||||
res = IsNodeInline(newNode, isInline);
|
||||
if( NS_SUCCEEDED(res))
|
||||
{
|
||||
// The simple case of an inline node
|
||||
res = InsertNode(aElement, parentSelectedNode, offsetOfNewNode);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user