no longer clearing selection when we detect empty document - selection is a perfectly valid concept in an empty document.

This commit is contained in:
jfrancis%netscape.com 1999-09-06 19:45:26 +00:00
Родитель ef4462884a
Коммит 7f0b5337ce
2 изменённых файлов: 10 добавлений и 6 удалений

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

@ -218,7 +218,9 @@ nsTextEditRules::WillInsert(nsIDOMSelection *aSelection, PRBool *aCancel)
mEditor->DeleteNode(mBogusNode);
mBogusNode = do_QueryInterface(nsnull);
// there is no longer any legit selection, so clear it.
aSelection->ClearSelection();
// xxx why? The selection is still legit, it just happens to be in an empty doc
//aSelection->ClearSelection();
}
return NS_OK;
@ -887,8 +889,8 @@ nsTextEditRules::CreateBogusNodeIfNeeded(nsIDOMSelection *aSelection)
}
if (PR_TRUE==needsBogusContent)
{
// set mBogusNode to be the newly created <P>
res = mEditor->CreateNode(nsAutoString("P"), bodyNode, 0,
// set mBogusNode to be the newly created <div>
res = mEditor->CreateNode(nsAutoString("div"), bodyNode, 0,
getter_AddRefs(mBogusNode));
if (NS_FAILED(res)) return res;
if (!mBogusNode) return NS_ERROR_NULL_POINTER;

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

@ -218,7 +218,9 @@ nsTextEditRules::WillInsert(nsIDOMSelection *aSelection, PRBool *aCancel)
mEditor->DeleteNode(mBogusNode);
mBogusNode = do_QueryInterface(nsnull);
// there is no longer any legit selection, so clear it.
aSelection->ClearSelection();
// xxx why? The selection is still legit, it just happens to be in an empty doc
//aSelection->ClearSelection();
}
return NS_OK;
@ -887,8 +889,8 @@ nsTextEditRules::CreateBogusNodeIfNeeded(nsIDOMSelection *aSelection)
}
if (PR_TRUE==needsBogusContent)
{
// set mBogusNode to be the newly created <P>
res = mEditor->CreateNode(nsAutoString("P"), bodyNode, 0,
// set mBogusNode to be the newly created <div>
res = mEditor->CreateNode(nsAutoString("div"), bodyNode, 0,
getter_AddRefs(mBogusNode));
if (NS_FAILED(res)) return res;
if (!mBogusNode) return NS_ERROR_NULL_POINTER;