109380: Add an editor accessor to the editor box object. r=brade sr=sfraser a=asa

This commit is contained in:
akkana%netscape.com 2002-03-14 20:48:45 +00:00
Родитель 3a4b35934d
Коммит 0af08e81c2
2 изменённых файлов: 15 добавлений и 3 удалений

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

@ -38,12 +38,15 @@
#include "nsIBoxObject.idl" #include "nsIBoxObject.idl"
interface nsIEditorShell; interface nsIEditor;
interface nsIDocShell; interface nsIDocShell;
interface nsIEditorShell;
[scriptable, uuid(14B3B669-3414-4548-AA03-EDF257D889C8)] [scriptable, uuid(14B3B669-3414-4548-AA03-EDF257D889C8)]
interface nsIEditorBoxObject : nsISupports interface nsIEditorBoxObject : nsISupports
{ {
readonly attribute nsIEditor editor;
// nsIEditorShell is deprecated and will go away -- please don't use it!
readonly attribute nsIEditorShell editorShell; readonly attribute nsIEditorShell editorShell;
readonly attribute nsIDocShell docShell; readonly attribute nsIDocShell docShell;
}; };

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

@ -72,7 +72,7 @@ nsEditorBoxObject::SetDocument(nsIDocument* aDocument)
if (mEditorShell) if (mEditorShell)
{ {
rv = mEditorShell->Shutdown(); rv = mEditorShell->Shutdown();
NS_ASSERTION(NS_SUCCEEDED(rv), "Error from editorShell->Shutdown"); NS_ASSERTION(NS_SUCCEEDED(rv), "Error from editor->Shutdown");
} }
// this should only be called with a null document, which indicates // this should only be called with a null document, which indicates
@ -100,13 +100,22 @@ NS_IMETHODIMP nsEditorBoxObject::Init(nsIContent* aContent, nsIPresShell* aPresS
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
NS_ASSERTION(!mEditorShell, "Double init of nsEditorBoxObject"); NS_ASSERTION(!mEditorShell, "Double init of nsEditorBoxObject");
// When editorshell goes away, this is what we should be doing:
//mEditor = do_CreateInstance("@mozilla.org/editor/htmleditor;1");
// but we need an editorshell for the transitional period, so:
mEditorShell = do_CreateInstance("@mozilla.org/editor/editorshell;1"); mEditorShell = do_CreateInstance("@mozilla.org/editor/editorshell;1");
if (!mEditorShell) return NS_ERROR_OUT_OF_MEMORY; if (!mEditorShell) return NS_ERROR_OUT_OF_MEMORY;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsEditorBoxObject::GetEditor(nsIEditor** aResult)
{
NS_ASSERTION(mEditorShell, "Editor box object not initted");
return mEditorShell->GetEditor(aResult);
}
NS_IMETHODIMP nsEditorBoxObject::GetEditorShell(nsIEditorShell** aResult) NS_IMETHODIMP nsEditorBoxObject::GetEditorShell(nsIEditorShell** aResult)
{ {
NS_ASSERTION(mEditorShell, "Editor box object not initted"); NS_ASSERTION(mEditorShell, "Editor box object not initted");