Fixed reset selection when inserting under <head>. Also removed compile warning in nsTableEditor.cpp, b=71883, r=jfrancis,kin sr=sfraser

git-svn-id: svn://10.0.0.236/trunk@92060 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
cmanske%netscape.com
2001-04-12 03:41:06 +00:00
parent 40623e7a9a
commit faba49aa9b
13 changed files with 62 additions and 29 deletions

View File

@@ -3536,19 +3536,27 @@ nsEditorShell::DeleteElement(nsIDOMElement *element)
}
NS_IMETHODIMP
nsEditorShell::InsertElement(nsIDOMElement *element, nsIDOMElement *parent, PRInt32 position)
nsEditorShell::InsertElement(nsIDOMElement *element, nsIDOMElement *parent, PRInt32 position, PRBool dontChangeSelection)
{
if (!element || !parent)
return NS_ERROR_NULL_POINTER;
nsresult result = NS_NOINTERFACE;
nsCOMPtr<nsIEditor> editor = do_QueryInterface(mEditor);
if (editor) {
if (editor)
{
// Set flag so InsertElementTxn doesn't change the selection
if (dontChangeSelection)
editor->SetShouldTxnSetSelection(PR_FALSE);
// The nsIEditor::InsertNode() wants nodes as params,
// but it actually requires that they are elements!
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(element);
nsCOMPtr<nsIDOMNode> parentNode = do_QueryInterface(parent);
result = editor->InsertNode(node, parentNode, position);
if (dontChangeSelection)
editor->SetShouldTxnSetSelection(PR_TRUE);
}
return result;
}