From 0af08e81c253b95ebcc87a95ce3d677c189aad34 Mon Sep 17 00:00:00 2001 From: "akkana%netscape.com" Date: Thu, 14 Mar 2002 20:48:45 +0000 Subject: [PATCH] 109380: Add an editor accessor to the editor box object. r=brade sr=sfraser a=asa --- layout/xul/base/public/nsIEditorBoxObject.idl | 5 ++++- layout/xul/base/src/nsEditorBoxObject.cpp | 13 +++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/layout/xul/base/public/nsIEditorBoxObject.idl b/layout/xul/base/public/nsIEditorBoxObject.idl index 76f1ed73fff..badaa6b0b57 100644 --- a/layout/xul/base/public/nsIEditorBoxObject.idl +++ b/layout/xul/base/public/nsIEditorBoxObject.idl @@ -38,12 +38,15 @@ #include "nsIBoxObject.idl" -interface nsIEditorShell; +interface nsIEditor; interface nsIDocShell; +interface nsIEditorShell; [scriptable, uuid(14B3B669-3414-4548-AA03-EDF257D889C8)] 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 nsIDocShell docShell; }; diff --git a/layout/xul/base/src/nsEditorBoxObject.cpp b/layout/xul/base/src/nsEditorBoxObject.cpp index 03f6b287a29..ff597efeb25 100644 --- a/layout/xul/base/src/nsEditorBoxObject.cpp +++ b/layout/xul/base/src/nsEditorBoxObject.cpp @@ -72,7 +72,7 @@ nsEditorBoxObject::SetDocument(nsIDocument* aDocument) if (mEditorShell) { 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 @@ -100,13 +100,22 @@ NS_IMETHODIMP nsEditorBoxObject::Init(nsIContent* aContent, nsIPresShell* aPresS if (NS_FAILED(rv)) return rv; 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"); if (!mEditorShell) return NS_ERROR_OUT_OF_MEMORY; 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_ASSERTION(mEditorShell, "Editor box object not initted");