зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
5d5f1e3826
Коммит
681b0e8a1b
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче