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

This commit is contained in:
jfrancis%netscape.com 2001-06-26 23:13:01 +00:00
Родитель 5d5f1e3826
Коммит 681b0e8a1b
2 изменённых файлов: 32 добавлений и 2 удалений

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

@ -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);

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

@ -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);