mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
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:
parent
91f9527d19
commit
a430943829
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user