allow the editor to correctly handle DL/DT/DD, switching from DT to DD when the user presses enter and vcie-versa; b=233261, r=timeless, sr=dbaron, a=tor

This commit is contained in:
daniel%glazman.org 2004-04-09 13:55:59 +00:00
Родитель 6207840361
Коммит f3a6db059e
2 изменённых файлов: 19 добавлений и 0 удалений

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

@ -6526,6 +6526,23 @@ nsHTMLEditRules::ReturnInListItem(nsISelection *aSelection,
if (NS_FAILED(res)) return res;
if (bIsEmptyNode)
{
nsCOMPtr<nsIAtom> nodeAtom = nsEditor::GetTag(aListItem);
if (nodeAtom == nsEditProperty::dd || nodeAtom == nsEditProperty::dt)
{
nsCOMPtr<nsIDOMNode> list;
PRInt32 itemOffset;
res = nsEditor::GetNodeLocation(aListItem, address_of(list), &itemOffset);
if (NS_FAILED(res)) return res;
nsAutoString listTag((nodeAtom == nsEditProperty::dt) ? NS_LITERAL_STRING("dd") : NS_LITERAL_STRING("dt"));
nsCOMPtr<nsIDOMNode> newListItem;
res = mHTMLEditor->CreateNode(listTag, list, itemOffset+1, getter_AddRefs(newListItem));
if (NS_FAILED(res)) return res;
res = mEditor->DeleteNode(aListItem);
if (NS_FAILED(res)) return res;
return aSelection->Collapse(newListItem, 0);
}
nsCOMPtr<nsIDOMNode> brNode;
res = mHTMLEditor->CopyLastEditableChildStyles(prevItem, aListItem, getter_AddRefs(brNode));
if (NS_FAILED(res)) return res;

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

@ -592,6 +592,8 @@ nsHTMLEditor::NodeIsBlockStatic(nsIDOMNode *aNode, PRBool *aIsBlock)
tagAtom==nsEditProperty::th ||
tagAtom==nsEditProperty::td ||
tagAtom==nsEditProperty::li ||
tagAtom==nsEditProperty::dt ||
tagAtom==nsEditProperty::dd ||
tagAtom==nsEditProperty::pre)
{
*aIsBlock = PR_TRUE;