bug fix 84744: insert br after user creates table if table is last node in block. r=brade; sr=kin; a=blizzard

git-svn-id: svn://10.0.0.236/trunk@97993 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jfrancis%netscape.com
2001-06-26 23:13:01 +00:00
parent f3017b86b9
commit cce6bfcc93
2 changed files with 32 additions and 2 deletions

View File

@@ -1784,8 +1784,23 @@ nsHTMLEditor::InsertElementAtSelection(nsIDOMElement* aElement, PRBool aDeleteSe
// Set caret after element, but check for special case
// of inserting table-related elements: set in first cell instead
if (!SetCaretInTableCell(aElement))
{
res = SetCaretAfterElement(aElement);
if (NS_FAILED(res)) return res;
}
// check for inserting a whole table at the end of a block. If so insert a br after it.
if (nsHTMLEditUtils::IsTable(node))
{
PRBool isLast;
res = IsLastEditableChild(node, &isLast);
if (NS_FAILED(res)) return res;
if (isLast)
{
nsCOMPtr<nsIDOMNode> brNode;
res = CreateBR(parentSelectedNode, offsetForInsert+1, address_of(brNode));
if (NS_FAILED(res)) return res;
}
}
}
}
res = mRules->DidDoAction(selection, &ruleInfo, res);

View File

@@ -1784,8 +1784,23 @@ nsHTMLEditor::InsertElementAtSelection(nsIDOMElement* aElement, PRBool aDeleteSe
// Set caret after element, but check for special case
// of inserting table-related elements: set in first cell instead
if (!SetCaretInTableCell(aElement))
{
res = SetCaretAfterElement(aElement);
if (NS_FAILED(res)) return res;
}
// check for inserting a whole table at the end of a block. If so insert a br after it.
if (nsHTMLEditUtils::IsTable(node))
{
PRBool isLast;
res = IsLastEditableChild(node, &isLast);
if (NS_FAILED(res)) return res;
if (isLast)
{
nsCOMPtr<nsIDOMNode> brNode;
res = CreateBR(parentSelectedNode, offsetForInsert+1, address_of(brNode));
if (NS_FAILED(res)) return res;
}
}
}
}
res = mRules->DidDoAction(selection, &ruleInfo, res);