Modify editor mode to work in frames

git-svn-id: svn://10.0.0.236/trunk@8004 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
joki%netscape.com 1998-08-14 01:51:00 +00:00
parent 1d32638925
commit 0e0f4e9f83
3 changed files with 32 additions and 15 deletions

View File

@ -331,7 +331,7 @@ nsBrowserWindow::DispatchMenuItem(PRInt32 aID)
break;
case EDITOR_MODE:
DoEditorMode();
DoEditorMode(mWebShell);
break;
}
@ -1158,21 +1158,37 @@ nsBrowserWindow::DoJSConsole()
}
void
nsBrowserWindow::DoEditorMode()
nsBrowserWindow::DoEditorMode(nsIWebShell *aWebShell)
{
nsIPresShell* shell = GetPresShell();
if (nsnull != shell) {
nsIDocument* doc = shell->GetDocument();
if (nsnull != doc) {
nsIDOMDocument *domdoc = nsnull;
doc->QueryInterface(kIDOMDocumentIID, (void**) &domdoc);
if (nsnull != domdoc) {
NS_InitEditorMode(domdoc);
NS_RELEASE(domdoc);
PRInt32 i, n;
if (nsnull != aWebShell) {
nsIContentViewer* mCViewer;
aWebShell->GetContentViewer(mCViewer);
if (nsnull != mCViewer) {
nsIDocumentViewer* mDViewer;
if (NS_OK == mCViewer->QueryInterface(kIDocumentViewerIID, (void**) &mDViewer)) {
nsIDocument* mDoc;
mDViewer->GetDocument(mDoc);
if (nsnull != mDoc) {
nsIDOMDocument* mDOMDoc;
if (NS_OK == mDoc->QueryInterface(kIDOMDocumentIID, (void**) &mDOMDoc)) {
NS_InitEditorMode(mDOMDoc);
NS_RELEASE(mDOMDoc);
}
NS_RELEASE(mDoc);
}
NS_RELEASE(mDViewer);
}
NS_RELEASE(doc);
NS_RELEASE(mCViewer);
}
aWebShell->GetChildCount(n);
for (i = 0; i < n; i++) {
nsIWebShell* mChild;
aWebShell->ChildAt(i, mChild);
DoEditorMode(mChild);
NS_RELEASE(mChild);
}
NS_RELEASE(shell);
}
}

View File

@ -118,7 +118,7 @@ public:
void DoFileOpen();
void DoCopy();
void DoJSConsole();
void DoEditorMode();
void DoEditorMode(nsIWebShell* aWebShell);
nsIPresShell* GetPresShell();
void DoSelectAll();

View File

@ -32,11 +32,12 @@ static NS_DEFINE_IID(kIDOMElementIID, NS_IDOMELEMENT_IID);
nsresult NS_InitEditorMode(nsIDOMDocument *aDOMDocument)
{
NS_IF_RELEASE(kCurrentNode);
NS_IF_RELEASE(kDomDoc);
kCurrentNode = nsnull;
kDomDoc = aDOMDocument;
kDomDoc->AddRef();
NS_IF_ADDREF(kDomDoc);
RegisterEventListeners();