mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-05-13 08:57:27 +00:00
Changed editor AppCore to use nsHTMLEditor instead of nsTextEditor
This commit is contained in:
parent
b71d9e04d6
commit
08d2ae207b
@ -68,6 +68,7 @@
|
||||
|
||||
#include "nsIEditor.h"
|
||||
#include "nsITextEditor.h"
|
||||
#include "nsIHTMLEditor.h"
|
||||
#include "nsEditorCID.h"
|
||||
|
||||
#include "nsRepository.h"
|
||||
@ -504,6 +505,14 @@ nsEditorAppCore::SetToEditorMode(nsIDOMDocument *aDOMDocument, nsIPresShell* aPr
|
||||
if (PR_TRUE==needsInit)
|
||||
{
|
||||
needsInit=PR_FALSE;
|
||||
result = nsRepository::RegisterFactory(kHTMLEditorCID, EDITOR_DLL,
|
||||
PR_FALSE, PR_FALSE);
|
||||
if (NS_ERROR_FACTORY_EXISTS!=result)
|
||||
{
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
}
|
||||
|
||||
result = nsRepository::RegisterFactory(kTextEditorCID, EDITOR_DLL,
|
||||
PR_FALSE, PR_FALSE);
|
||||
if (NS_ERROR_FACTORY_EXISTS!=result)
|
||||
@ -511,6 +520,7 @@ nsEditorAppCore::SetToEditorMode(nsIDOMDocument *aDOMDocument, nsIPresShell* aPr
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
}
|
||||
|
||||
result = nsRepository::RegisterFactory(kEditorCID, EDITOR_DLL,
|
||||
PR_FALSE, PR_FALSE);
|
||||
if (NS_ERROR_FACTORY_EXISTS!=result)
|
||||
@ -522,19 +532,19 @@ nsEditorAppCore::SetToEditorMode(nsIDOMDocument *aDOMDocument, nsIPresShell* aPr
|
||||
/** end temp code **/
|
||||
/*
|
||||
nsISupports *isup = nsnull;
|
||||
result = nsServiceManager::GetService(kTextEditorCID,
|
||||
kITextEditorIID, &isup);
|
||||
result = nsServiceManager::GetService(kHTMLEditorCID,
|
||||
kIHTMLEditorIID, &isup);
|
||||
*/
|
||||
result = nsRepository::CreateInstance(kTextEditorCID,
|
||||
result = nsRepository::CreateInstance(kHTMLEditorCID,
|
||||
nsnull,
|
||||
kITextEditorIID, (void **)&gEditor);
|
||||
kIHTMLEditorIID, (void **)&gEditor);
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
if (!gEditor) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
gEditor->InitTextEditor(aDOMDocument, aPresShell);
|
||||
gEditor->InitHTMLEditor(aDOMDocument, aPresShell);
|
||||
gEditor->EnableUndo(PR_TRUE);
|
||||
#endif
|
||||
return result;
|
||||
|
@ -36,7 +36,7 @@ class nsIDOMWindow;
|
||||
class nsIURL;
|
||||
class nsIWebShellWindow;
|
||||
class nsIPresShell;
|
||||
class nsITextEditor;
|
||||
class nsIHTMLEditor;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsEditorAppCore:
|
||||
@ -92,7 +92,7 @@ class nsEditorAppCore : public nsBaseAppCore,
|
||||
nsIWebShellWindow *mWebShellWin;
|
||||
nsIWebShell * mWebShell;
|
||||
|
||||
nsITextEditor * mEditor;
|
||||
nsIHTMLEditor * mEditor;
|
||||
nsIDOMDocument* mDomDoc;
|
||||
nsIDOMNode* mCurrentNode;
|
||||
|
||||
|
@ -19,18 +19,21 @@
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
|
||||
#include "nsITextEditor.h"
|
||||
#include "nsIHTMLEditor.h"
|
||||
#include "nsEditorCID.h"
|
||||
|
||||
#include "nsRepository.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
static nsITextEditor *gEditor;
|
||||
static nsIHTMLEditor *gEditor;
|
||||
|
||||
static NS_DEFINE_IID(kITextEditorIID, NS_ITEXTEDITOR_IID);
|
||||
static NS_DEFINE_CID(kTextEditorCID, NS_TEXTEDITOR_CID);
|
||||
static NS_DEFINE_IID(kIHTMLEditorIID, NS_IHTMLEDITOR_IID);
|
||||
static NS_DEFINE_CID(kHTMLEditorCID, NS_HTMLEDITOR_CID);
|
||||
static NS_DEFINE_IID(kIEditorIID, NS_IEDITOR_IID);
|
||||
static NS_DEFINE_CID(kEditorCID, NS_EDITOR_CID);
|
||||
static NS_DEFINE_CID(kTextEditorCID, NS_TEXTEDITOR_CID); // Still needed to register factory
|
||||
//Don't think we these - switched to using HTMLEditor
|
||||
//static NS_DEFINE_IID(kITextEditorIID, NS_ITEXTEDITOR_IID);
|
||||
|
||||
#ifdef XP_PC
|
||||
#define EDITOR_DLL "ender.dll"
|
||||
@ -42,7 +45,7 @@ static NS_DEFINE_CID(kEditorCID, NS_EDITOR_CID);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
nsITextEditor * GetEditor()
|
||||
nsIHTMLEditor * GetEditor()
|
||||
{
|
||||
return gEditor;
|
||||
}
|
||||
@ -65,15 +68,22 @@ nsresult NS_InitEditorMode(nsIDOMDocument *aDOMDocument, nsIPresShell* aPresShel
|
||||
if (PR_TRUE==needsInit)
|
||||
{
|
||||
needsInit=PR_FALSE;
|
||||
result = nsRepository::RegisterComponent(kTextEditorCID, NULL, NULL,
|
||||
EDITOR_DLL, PR_FALSE, PR_FALSE);
|
||||
result = nsRepository::RegisterComponent(kHTMLEditorCID, NULL, NULL, EDITOR_DLL,
|
||||
PR_FALSE, PR_FALSE);
|
||||
if (NS_ERROR_FACTORY_EXISTS!=result)
|
||||
{
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
}
|
||||
result = nsRepository::RegisterComponent(kEditorCID, NULL, NULL,
|
||||
EDITOR_DLL, PR_FALSE, PR_FALSE);
|
||||
result = nsRepository::RegisterComponent(kTextEditorCID, NULL, NULL, EDITOR_DLL,
|
||||
PR_FALSE, PR_FALSE);
|
||||
if (NS_ERROR_FACTORY_EXISTS!=result)
|
||||
{
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
}
|
||||
result = nsRepository::RegisterComponent(kEditorCID, NULL, NULL, EDITOR_DLL,
|
||||
PR_FALSE, PR_FALSE);
|
||||
if (NS_ERROR_FACTORY_EXISTS!=result)
|
||||
{
|
||||
if (NS_FAILED(result))
|
||||
@ -83,20 +93,21 @@ nsresult NS_InitEditorMode(nsIDOMDocument *aDOMDocument, nsIPresShell* aPresShel
|
||||
/** end temp code **/
|
||||
/*
|
||||
nsISupports *isup = nsnull;
|
||||
result = nsServiceManager::GetService(kTextEditorCID,
|
||||
kITextEditorIID, &isup);
|
||||
result = nsServiceManager::GetService(kHTMLEditorCID,
|
||||
kIHTMLEditorIID, &isup);
|
||||
*/
|
||||
result = nsRepository::CreateInstance(kTextEditorCID,
|
||||
result = nsRepository::CreateInstance(kHTMLEditorCID,
|
||||
nsnull,
|
||||
kITextEditorIID, (void **)&gEditor);
|
||||
kIHTMLEditorIID, (void **)&gEditor);
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
if (!gEditor) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
gEditor->InitTextEditor(aDOMDocument, aPresShell);
|
||||
gEditor->InitHTMLEditor(aDOMDocument, aPresShell);
|
||||
gEditor->EnableUndo(PR_TRUE);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -23,9 +23,9 @@
|
||||
|
||||
class nsIDOMDocument;
|
||||
class nsIPresShell;
|
||||
class nsITextEditor;
|
||||
class nsIHTMLEditor;
|
||||
|
||||
extern nsresult NS_InitEditorMode(nsIDOMDocument * aDOMDocument, nsIPresShell* aPresShell);
|
||||
extern nsITextEditor * GetEditor();
|
||||
extern nsIHTMLEditor * GetEditor();
|
||||
|
||||
#endif //nsEditorMode_h__
|
||||
|
Loading…
x
Reference in New Issue
Block a user