diff --git a/mozilla/editor/base/Makefile.in b/mozilla/editor/base/Makefile.in index a16bfb54f45..05f1cb244be 100644 --- a/mozilla/editor/base/Makefile.in +++ b/mozilla/editor/base/Makefile.in @@ -44,6 +44,7 @@ CPPSRCS = \ TextEditorTest.cpp \ nsHTMLEditRules.cpp \ nsEditorEventListeners.cpp \ + nsEditorShellMouseListener.cpp \ nsEditProperty.cpp \ nsHTMLEditor.cpp \ ChangeAttributeTxn.cpp \ diff --git a/mozilla/editor/base/makefile.win b/mozilla/editor/base/makefile.win index 9fa937337cc..68c0731b79a 100644 --- a/mozilla/editor/base/makefile.win +++ b/mozilla/editor/base/makefile.win @@ -39,6 +39,7 @@ CPPSRCS = \ nsHTMLEditUtils.cpp \ TextEditorTest.cpp \ nsEditorEventListeners.cpp \ + nsEditorShellMouseListener.cpp \ nsEditProperty.cpp \ EditTxn.cpp \ EditAggregateTxn.cpp \ @@ -80,6 +81,7 @@ CPP_OBJS = \ .\$(OBJDIR)\nsHTMLEditRules.obj \ .\$(OBJDIR)\nsHTMLEditUtils.obj \ .\$(OBJDIR)\nsEditorEventListeners.obj \ + .\$(OBJDIR)\nsEditorShellMouseListener.obj \ .\$(OBJDIR)\nsEditProperty.obj \ .\$(OBJDIR)\EditTxn.obj \ .\$(OBJDIR)\EditAggregateTxn.obj \ diff --git a/mozilla/editor/base/nsComposerCommands.cpp b/mozilla/editor/base/nsComposerCommands.cpp index db47cd41a65..dc0a6f6984a 100644 --- a/mozilla/editor/base/nsComposerCommands.cpp +++ b/mozilla/editor/base/nsComposerCommands.cpp @@ -603,6 +603,7 @@ nsParagraphStateCommand::DoCommand(const PRUnichar *aCommand, nsISupports * refC return rv; } + #ifdef XP_MAC #pragma mark - #endif diff --git a/mozilla/editor/base/nsComposerCommands.h b/mozilla/editor/base/nsComposerCommands.h index 1d33d514388..673ac9a8edc 100644 --- a/mozilla/editor/base/nsComposerCommands.h +++ b/mozilla/editor/base/nsComposerCommands.h @@ -164,5 +164,4 @@ NS_DECL_COMPOSER_COMMAND(nsIncreaseFontSizeCommand) NS_DECL_COMPOSER_COMMAND(nsDecreaseFontSizeCommand) - #endif // nsComposerCommands_h_ diff --git a/mozilla/editor/base/nsEditorController.cpp b/mozilla/editor/base/nsEditorController.cpp index a099d2cf5c9..966015c71b4 100644 --- a/mozilla/editor/base/nsEditorController.cpp +++ b/mozilla/editor/base/nsEditorController.cpp @@ -331,7 +331,7 @@ nsresult nsComposerController::RegisterComposerCommands(nsIControllerCommandMana NS_REGISTER_ONE_COMMAND(nsRemoveStylesCommand, "cmd_removeStyles"); NS_REGISTER_ONE_COMMAND(nsIncreaseFontSizeCommand, "cmd_increaseFont"); NS_REGISTER_ONE_COMMAND(nsDecreaseFontSizeCommand, "cmd_decreaseFont"); - + return NS_OK; } diff --git a/mozilla/editor/base/nsEditorEventListeners.cpp b/mozilla/editor/base/nsEditorEventListeners.cpp index 34908273293..96ffdd0d538 100644 --- a/mozilla/editor/base/nsEditorEventListeners.cpp +++ b/mozilla/editor/base/nsEditorEventListeners.cpp @@ -25,6 +25,7 @@ #include "nsVoidArray.h" #include "nsString.h" +#include "nsIDOMEvent.h" #include "nsIDOMDocument.h" #include "nsIDocument.h" #include "nsIPresShell.h" @@ -352,8 +353,6 @@ nsTextEditorKeyListener::ScrollSelectionIntoView() * nsTextEditorMouseListener implementation */ - - NS_IMPL_ADDREF(nsTextEditorMouseListener) NS_IMPL_RELEASE(nsTextEditorMouseListener) @@ -540,42 +539,9 @@ nsTextEditorMouseListener::MouseDown(nsIDOMEvent* aMouseEvent) nsresult nsTextEditorMouseListener::MouseUp(nsIDOMEvent* aMouseEvent) { - nsCOMPtr mouseEvent ( do_QueryInterface(aMouseEvent) ); - if (!mouseEvent) { - //non-ui event passed in. bad things. - return NS_OK; - } - // Detect double click message: - PRUint16 clickCount; - nsresult res = mouseEvent->GetClickCount(&clickCount); - if (NS_FAILED(res)) return res; - - if (clickCount == 2) - { - nsCOMPtr htmlEditor = do_QueryInterface(mEditor); - if (htmlEditor) - { - nsCOMPtr selectedElement; - if (NS_SUCCEEDED(htmlEditor->GetSelectedElement(nsAutoString(), getter_AddRefs(selectedElement))) - && selectedElement) - { - nsAutoString TagName; - selectedElement->GetTagName(TagName); - TagName.ToLowerCase(); - - #if DEBUG_cmanske - char szTagName[64]; - TagName.ToCString(szTagName, 64); - printf("Single Selected element found: %s\n", szTagName); - #endif - } - } - } return NS_OK; } - - nsresult nsTextEditorMouseListener::MouseClick(nsIDOMEvent* aMouseEvent) { @@ -607,13 +573,10 @@ nsTextEditorMouseListener::MouseOut(nsIDOMEvent* aMouseEvent) } - /* - * nsTextEditorMouseListener implementation + * nsTextEditorTextListener implementation */ - - NS_IMPL_ADDREF(nsTextEditorTextListener) NS_IMPL_RELEASE(nsTextEditorTextListener) diff --git a/mozilla/editor/base/nsEditorEventListeners.h b/mozilla/editor/base/nsEditorEventListeners.h index 0e1e086295c..5d9b7864a4e 100644 --- a/mozilla/editor/base/nsEditorEventListeners.h +++ b/mozilla/editor/base/nsEditorEventListeners.h @@ -76,7 +76,7 @@ protected: }; -/** editor Implementation of the MouseListener interface +/** editor Implementation of the TextListener interface */ class nsTextEditorTextListener : public nsIDOMTextListener { @@ -140,7 +140,7 @@ protected: }; -/** editor Implementation of the TextListener interface +/** editor Implementation of the MouseListener interface */ class nsTextEditorMouseListener : public nsIDOMMouseListener { @@ -176,7 +176,7 @@ protected: }; -/** editor Implementation of the MouseListener interface +/** editor Implementation of the DragListener interface */ class nsTextEditorDragListener : public nsIDOMDragListener { diff --git a/mozilla/editor/base/nsEditorShell.cpp b/mozilla/editor/base/nsEditorShell.cpp index e43cc16d790..1e166b8d21e 100644 --- a/mozilla/editor/base/nsEditorShell.cpp +++ b/mozilla/editor/base/nsEditorShell.cpp @@ -44,6 +44,7 @@ #include "nsIDOMNodeList.h" #include "nsICSSLoader.h" #include "nsICSSStyleSheet.h" +#include "nsIContent.h" #include "nsIHTMLContentContainer.h" #include "nsIStyleSet.h" #include "nsIURI.h" @@ -92,7 +93,6 @@ /////////////////////////////////////// // Editor Includes /////////////////////////////////////// -#include "nsIDOMEventReceiver.h" #include "nsIDOMEventCapturer.h" #include "nsString.h" #include "nsIDOMText.h" @@ -117,6 +117,7 @@ #include "nsAOLCiter.h" #include "nsInternetCiter.h" +#include "nsEditorShellMouseListener.h" /////////////////////////////////////// @@ -143,6 +144,11 @@ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); #define EDITOR_BUNDLE_URL "chrome://editor/locale/editor.properties" +enum { + eEditorController, + eComposerController +}; + ///////////////////////////////////////////////////////////////////////// // Utility to extract document from a webshell object. static nsresult @@ -267,6 +273,17 @@ nsEditorShell::~nsEditorShell() NS_IF_RELEASE(mStateMaintainer); NS_IF_RELEASE(mParserObserver); + // Remove our document mouse event listener + if (mMouseListenerP) + { + nsCOMPtr erP; + nsresult rv = GetDocumentEventReceiver(getter_AddRefs(erP)); + if (NS_SUCCEEDED(rv) && erP) + { + erP->RemoveEventListenerByIID(mMouseListenerP, NS_GET_IID(nsIDOMMouseListener)); + mMouseListenerP = nsnull; + } + } // the only other references we hold are in nsCOMPtrs, so they'll take // care of themselves. } @@ -367,19 +384,32 @@ nsEditorShell::ResetEditingState() } } + nsresult rv; // now, unregister the selection listener, if there was one if (mStateMaintainer) { nsCOMPtr domSelection; // using a scoped result, because we don't really care if this fails - nsresult result = GetEditorSelection(getter_AddRefs(domSelection)); - if (NS_SUCCEEDED(result) && domSelection) + rv = GetEditorSelection(getter_AddRefs(domSelection)); + if (NS_SUCCEEDED(rv) && domSelection) { domSelection->RemoveSelectionListener(mStateMaintainer); NS_IF_RELEASE(mStateMaintainer); } } - + + // Remove our document mouse event listener + if (mMouseListenerP) + { + nsCOMPtr erP; + rv = GetDocumentEventReceiver(getter_AddRefs(erP)); + if (NS_SUCCEEDED(rv) && erP) + { + erP->RemoveEventListenerByIID(mMouseListenerP, NS_GET_IID(nsIDOMMouseListener)); + mMouseListenerP = nsnull; + } + } + // clear this editor out of the controller if (mEditorController) { @@ -476,6 +506,28 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr mEditorController->SetCommandRefCon(editorAsISupports); } + + // get a mouse listener for double click on tags + // We can't use nsEditor listener because core editor shouldn't call UI commands + rv = NS_NewEditorShellMouseListener(getter_AddRefs(mMouseListenerP), this); + if (NS_FAILED(rv)) + { + mMouseListenerP = nsnull; + return rv; + } + + // Add mouse listener to document + nsCOMPtr erP; + rv = GetDocumentEventReceiver(getter_AddRefs(erP)); + if (NS_FAILED(rv)) + { + mMouseListenerP = nsnull; + return rv; + } + + rv = erP->AddEventListenerByIID(mMouseListenerP, NS_GET_IID(nsIDOMMouseListener)); + if (NS_FAILED(rv)) return rv; + // now all the listeners are set up, we can call PostCreate rv = editor->PostCreate(); if (NS_FAILED(rv)) return rv; @@ -498,7 +550,7 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr nsCRT::strncmp(pageURLString,"about:blank", 11) != 0) { // Clutzy method of converting URL to local file format - // nsIFileSpec is going away -- is nsFileSpec??? + // nsIFileSpec is going away -- WE NEED TO REWRITE nsIDiskDocument! nsFileURL pageURL(pageURLString); nsFileSpec pageSpec(pageURL); @@ -554,6 +606,53 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr return NS_OK; } +nsresult nsEditorShell::GetDocumentEventReceiver(nsIDOMEventReceiver **aEventReceiver) +{ + if (!aEventReceiver) return NS_ERROR_NULL_POINTER; + if (!mContentWindow || !mEditor) return NS_ERROR_NOT_INITIALIZED; + + nsCOMPtr domDoc; + mContentWindow->GetDocument(getter_AddRefs(domDoc)); + if (!domDoc) return NS_ERROR_NOT_INITIALIZED; + + nsCOMPtr rootElement; + nsCOMPtr editor = do_QueryInterface(mEditor); + nsresult rv = editor->GetRootElement(getter_AddRefs(rootElement)); + + nsCOMPtr erP; + +//(Copied from nsHTMLEditor::InstallEventListeners) +//now hack to make sure we are not anonymous content if we are + // grabbing the parent of root element for our observer + nsCOMPtr content = do_QueryInterface(rootElement); + if (content) + { + nsCOMPtr parent; + if (NS_SUCCEEDED(content->GetParent(*getter_AddRefs(parent))) && parent) + { + PRInt32 index; + if (NS_FAILED(parent->IndexOf(content, index)) || index<0 ) + { + rootElement = do_QueryInterface(parent); + rv = rootElement->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), getter_AddRefs(erP)); + } + else + rootElement = 0; + } + } + if (!rootElement && domDoc) + rv = domDoc->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), getter_AddRefs(erP)); +//end hack + + if (erP) + { + *aEventReceiver = erP; + NS_ADDREF(*aEventReceiver); + } + return rv; +} + + NS_IMETHODIMP nsEditorShell::SetContentWindow(nsIDOMWindow* aWin) { @@ -592,12 +691,12 @@ nsEditorShell::SetContentWindow(nsIDOMWindow* aWin) mEditorController = editorController; // temp weak link, so we can get it and set the editor later - rv = controllers->InsertControllerAt(0, controller); + rv = controllers->InsertControllerAt(eEditorController, controller); if (NS_FAILED(rv)) return rv; } { - // the first is a composer controller, and takes an nsIEditorShell as the refCon + // the second is a composer controller, and takes an nsIEditorShell as the refCon nsCOMPtr controller = do_CreateInstance("component://netscape/editor/composercontroller", &rv); if (NS_FAILED(rv)) return rv; nsCOMPtr editorController = do_QueryInterface(controller); @@ -606,7 +705,7 @@ nsEditorShell::SetContentWindow(nsIDOMWindow* aWin) rv = editorController->Init(shellAsISupports); if (NS_FAILED(rv)) return rv; - rv = controllers->InsertControllerAt(1, controller); + rv = controllers->InsertControllerAt(eComposerController, controller); if (NS_FAILED(rv)) return rv; } @@ -2668,21 +2767,30 @@ nsEditorShell::ConfirmWithCancel(const nsString& aTitle, const nsString& aQuesti if ( NS_SUCCEEDED(rv) ) { // Stuff in Parameters - block->SetInt( nsICommonDialogs::eNumberButtons,3 ); block->SetString( nsICommonDialogs::eMsg, aQuestion.GetUnicode()); nsAutoString url; url.AssignWithConversion( "chrome://global/skin/question-icon.gif" ); block->SetString( nsICommonDialogs::eIconURL, url.GetUnicode()); nsAutoString yesStr, noStr; + // Default is Yes, No, Cancel + PRInt32 numberOfButtons = 3; if (aYesString) yesStr.Assign(*aYesString); else + // We always want a "Yes" string, so supply the default GetBundleString(NS_ConvertASCIItoUCS2("Yes"), yesStr); - if (aNoString) + if (aNoString && aNoString->Length() > 0) + { noStr.Assign(*aNoString); + block->SetString( nsICommonDialogs::eButton2Text, noStr.GetUnicode() ); + } else - GetBundleString(NS_ConvertASCIItoUCS2("No"), noStr); + { + // No string for "No" means we only want Yes, Cancel + numberOfButtons = 2; + } + block->SetInt( nsICommonDialogs::eNumberButtons, numberOfButtons ); nsAutoString cancelStr; GetBundleString(NS_ConvertASCIItoUCS2("Cancel"), cancelStr); @@ -2691,7 +2799,6 @@ nsEditorShell::ConfirmWithCancel(const nsString& aTitle, const nsString& aQuesti //Note: "button0" is always Ok or Yes action, "button1" is Cancel block->SetString( nsICommonDialogs::eButton0Text, yesStr.GetUnicode() ); block->SetString( nsICommonDialogs::eButton1Text, cancelStr.GetUnicode() ); - block->SetString( nsICommonDialogs::eButton2Text, noStr.GetUnicode() ); NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); if ( NS_SUCCEEDED( rv ) ) @@ -2922,7 +3029,6 @@ nsEditorShell::SetParagraphFormat(const PRUnichar * paragraphFormat) return err; } - NS_IMETHODIMP nsEditorShell::GetEditorDocument(nsIDOMDocument** aEditorDocument) { @@ -4663,3 +4769,33 @@ nsEditorShell::DocumentIsRootDoc(nsIDocumentLoader* aLoader, PRBool& outIsRoot) return NS_OK; } +NS_IMETHODIMP +nsEditorShell::EditElementProperties(nsIDOMElement *aElement, int x, int y) +{ + if (!aElement) return NS_OK; + nsresult rv = NS_ERROR_FAILURE; + +#if DEBUG_cmanske + nsAutoString TagName; + aElement->GetTagName(TagName); + TagName.ToLowerCase(); + char szTagName[64]; + TagName.ToCString(szTagName, 64); + printf("***** DBLClick: TagName of element clicked on: %s\n", szTagName); +#endif + // Get the ComposerController: + nsCOMPtr controllers; + rv = mContentWindow->GetControllers(getter_AddRefs(controllers)); + if (NS_FAILED(rv)) return rv; + if (!controllers) return NS_ERROR_NULL_POINTER; + + nsCOMPtr controller; + rv = controllers->GetControllerAt(eComposerController, getter_AddRefs(controller)); + if (NS_FAILED(rv)) return rv; + if (!controller) return NS_ERROR_NULL_POINTER; + nsCOMPtr composerController = do_QueryInterface(controller); + + // Execute the command + nsAutoString commandName(NS_ConvertASCIItoUCS2("cmd_advancedProperties")); + return composerController->DoCommand(commandName.GetUnicode()); +} diff --git a/mozilla/editor/base/nsEditorShell.h b/mozilla/editor/base/nsEditorShell.h index a84487a2142..58054abdf53 100644 --- a/mozilla/editor/base/nsEditorShell.h +++ b/mozilla/editor/base/nsEditorShell.h @@ -33,9 +33,11 @@ #include "nsIEditorController.h" #include "nsIDocumentLoaderObserver.h" #include "nsIDOMSelectionListener.h" +#include "nsIDOMEventReceiver.h" #include "nsIPrompt.h" #include "nsIStreamObserver.h" #include "nsIDOMDocument.h" +#include "nsIDOMEventListener.h" #include "nsVoidArray.h" #include "nsTextServicesCID.h" #include "nsIEditorSpellCheck.h" @@ -143,9 +145,15 @@ class nsEditorShell : public nsIEditorShell, // is the document being loaded the root of a frameset, or a non-frameset doc? nsresult DocumentIsRootDoc(nsIDocumentLoader* aLoader, PRBool& outIsRoot); - nsCOMPtr mEditor; // this can be either an HTML or plain text (or other?) editor - nsCOMPtr mSearchContext; // context used for search and replace. Owned by the appshell. - nsCOMPtr mSpellChecker; + nsCOMPtr mEditor; // this can be either an HTML or plain text (or other?) editor + nsCOMPtr mSearchContext; // context used for search and replace. Owned by the appshell. + nsCOMPtr mSpellChecker; + + // Let UI detect and process double click on elements for AdvancedProperties + // (see nsEditorShellMouseEventListener) + nsCOMPtr mMouseListenerP; + // We need this to add mMouseListenerP to document + nsresult GetDocumentEventReceiver(nsIDOMEventReceiver **aEventReceiver); PRBool mMailCompose; diff --git a/mozilla/editor/base/nsHTMLEditor.cpp b/mozilla/editor/base/nsHTMLEditor.cpp index 03d64be4c56..3b8c3b96240 100644 --- a/mozilla/editor/base/nsHTMLEditor.cpp +++ b/mozilla/editor/base/nsHTMLEditor.cpp @@ -2767,9 +2767,9 @@ nsHTMLEditor::SetCaretAfterElement(nsIDOMElement* aElement) return res; } -NS_IMETHODIMP nsHTMLEditor::SetParagraphFormat(const nsString& aParagraphFormat) +NS_IMETHODIMP +nsHTMLEditor::SetParagraphFormat(const nsString& aParagraphFormat) { - //Kinda sad to waste memory just to force lower case nsAutoString tag; tag.Assign(aParagraphFormat); tag.ToLowerCase(); return InsertBasicBlock(tag); @@ -3340,25 +3340,50 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu // default is null - no element found *aReturn = nsnull; + // First look for a single element in selection + nsCOMPtrselection; + nsresult res = GetSelection(getter_AddRefs(selection)); + if (NS_FAILED(res)) return res; + if (!selection) return NS_ERROR_NULL_POINTER; + + PRBool bNodeFound = PR_FALSE; + res=NS_ERROR_NOT_INITIALIZED; + PRBool isCollapsed; + selection->GetIsCollapsed(&isCollapsed); + + nsCOMPtr selectedElement; + nsCOMPtr range; + res = selection->GetRangeAt(0, getter_AddRefs(range)); + if (NS_FAILED(res)) return res; + + nsCOMPtr startParent; + PRInt32 startOffset, endOffset; + res = range->GetStartParent(getter_AddRefs(startParent)); + if (NS_FAILED(res)) return res; + res = range->GetStartOffset(&startOffset); + if (NS_FAILED(res)) return res; + + nsCOMPtr endParent; + res = range->GetEndParent(getter_AddRefs(endParent)); + if (NS_FAILED(res)) return res; + res = range->GetEndOffset(&endOffset); + if (NS_FAILED(res)) return res; + + if (startParent && startParent == endParent && (endOffset-startOffset) == 1) + { + nsCOMPtr selectedNode = GetChildAt(startParent, startOffset); + if (NS_FAILED(res)) return NS_OK; + + selectedElement = do_QueryInterface(selectedNode); + bNodeFound = PR_TRUE; + } + nsAutoString TagName = aTagName; TagName.ToLowerCase(); // Empty string indicates we should match any element tag PRBool anyTag = (TagName.IsEmpty()); //Note that this doesn't need to go through the transaction system - - nsresult res=NS_ERROR_NOT_INITIALIZED; - //PRBool first=PR_TRUE; - nsCOMPtrselection; - res = GetSelection(getter_AddRefs(selection)); - if (NS_FAILED(res)) return res; - if (!selection) return NS_ERROR_NULL_POINTER; - - PRBool isCollapsed; - selection->GetIsCollapsed(&isCollapsed); - nsCOMPtr selectedElement; - PRBool bNodeFound = PR_FALSE; - if (IsLink(TagName)) { // Link tag is a special case - we return the anchor node diff --git a/mozilla/editor/composer/src/nsComposerCommands.cpp b/mozilla/editor/composer/src/nsComposerCommands.cpp index db47cd41a65..dc0a6f6984a 100644 --- a/mozilla/editor/composer/src/nsComposerCommands.cpp +++ b/mozilla/editor/composer/src/nsComposerCommands.cpp @@ -603,6 +603,7 @@ nsParagraphStateCommand::DoCommand(const PRUnichar *aCommand, nsISupports * refC return rv; } + #ifdef XP_MAC #pragma mark - #endif diff --git a/mozilla/editor/composer/src/nsComposerCommands.h b/mozilla/editor/composer/src/nsComposerCommands.h index 1d33d514388..673ac9a8edc 100644 --- a/mozilla/editor/composer/src/nsComposerCommands.h +++ b/mozilla/editor/composer/src/nsComposerCommands.h @@ -164,5 +164,4 @@ NS_DECL_COMPOSER_COMMAND(nsIncreaseFontSizeCommand) NS_DECL_COMPOSER_COMMAND(nsDecreaseFontSizeCommand) - #endif // nsComposerCommands_h_ diff --git a/mozilla/editor/composer/src/nsEditorShell.cpp b/mozilla/editor/composer/src/nsEditorShell.cpp index e43cc16d790..1e166b8d21e 100644 --- a/mozilla/editor/composer/src/nsEditorShell.cpp +++ b/mozilla/editor/composer/src/nsEditorShell.cpp @@ -44,6 +44,7 @@ #include "nsIDOMNodeList.h" #include "nsICSSLoader.h" #include "nsICSSStyleSheet.h" +#include "nsIContent.h" #include "nsIHTMLContentContainer.h" #include "nsIStyleSet.h" #include "nsIURI.h" @@ -92,7 +93,6 @@ /////////////////////////////////////// // Editor Includes /////////////////////////////////////// -#include "nsIDOMEventReceiver.h" #include "nsIDOMEventCapturer.h" #include "nsString.h" #include "nsIDOMText.h" @@ -117,6 +117,7 @@ #include "nsAOLCiter.h" #include "nsInternetCiter.h" +#include "nsEditorShellMouseListener.h" /////////////////////////////////////// @@ -143,6 +144,11 @@ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); #define EDITOR_BUNDLE_URL "chrome://editor/locale/editor.properties" +enum { + eEditorController, + eComposerController +}; + ///////////////////////////////////////////////////////////////////////// // Utility to extract document from a webshell object. static nsresult @@ -267,6 +273,17 @@ nsEditorShell::~nsEditorShell() NS_IF_RELEASE(mStateMaintainer); NS_IF_RELEASE(mParserObserver); + // Remove our document mouse event listener + if (mMouseListenerP) + { + nsCOMPtr erP; + nsresult rv = GetDocumentEventReceiver(getter_AddRefs(erP)); + if (NS_SUCCEEDED(rv) && erP) + { + erP->RemoveEventListenerByIID(mMouseListenerP, NS_GET_IID(nsIDOMMouseListener)); + mMouseListenerP = nsnull; + } + } // the only other references we hold are in nsCOMPtrs, so they'll take // care of themselves. } @@ -367,19 +384,32 @@ nsEditorShell::ResetEditingState() } } + nsresult rv; // now, unregister the selection listener, if there was one if (mStateMaintainer) { nsCOMPtr domSelection; // using a scoped result, because we don't really care if this fails - nsresult result = GetEditorSelection(getter_AddRefs(domSelection)); - if (NS_SUCCEEDED(result) && domSelection) + rv = GetEditorSelection(getter_AddRefs(domSelection)); + if (NS_SUCCEEDED(rv) && domSelection) { domSelection->RemoveSelectionListener(mStateMaintainer); NS_IF_RELEASE(mStateMaintainer); } } - + + // Remove our document mouse event listener + if (mMouseListenerP) + { + nsCOMPtr erP; + rv = GetDocumentEventReceiver(getter_AddRefs(erP)); + if (NS_SUCCEEDED(rv) && erP) + { + erP->RemoveEventListenerByIID(mMouseListenerP, NS_GET_IID(nsIDOMMouseListener)); + mMouseListenerP = nsnull; + } + } + // clear this editor out of the controller if (mEditorController) { @@ -476,6 +506,28 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr mEditorController->SetCommandRefCon(editorAsISupports); } + + // get a mouse listener for double click on tags + // We can't use nsEditor listener because core editor shouldn't call UI commands + rv = NS_NewEditorShellMouseListener(getter_AddRefs(mMouseListenerP), this); + if (NS_FAILED(rv)) + { + mMouseListenerP = nsnull; + return rv; + } + + // Add mouse listener to document + nsCOMPtr erP; + rv = GetDocumentEventReceiver(getter_AddRefs(erP)); + if (NS_FAILED(rv)) + { + mMouseListenerP = nsnull; + return rv; + } + + rv = erP->AddEventListenerByIID(mMouseListenerP, NS_GET_IID(nsIDOMMouseListener)); + if (NS_FAILED(rv)) return rv; + // now all the listeners are set up, we can call PostCreate rv = editor->PostCreate(); if (NS_FAILED(rv)) return rv; @@ -498,7 +550,7 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr nsCRT::strncmp(pageURLString,"about:blank", 11) != 0) { // Clutzy method of converting URL to local file format - // nsIFileSpec is going away -- is nsFileSpec??? + // nsIFileSpec is going away -- WE NEED TO REWRITE nsIDiskDocument! nsFileURL pageURL(pageURLString); nsFileSpec pageSpec(pageURL); @@ -554,6 +606,53 @@ nsEditorShell::PrepareDocumentForEditing(nsIDocumentLoader* aLoader, nsIURI *aUr return NS_OK; } +nsresult nsEditorShell::GetDocumentEventReceiver(nsIDOMEventReceiver **aEventReceiver) +{ + if (!aEventReceiver) return NS_ERROR_NULL_POINTER; + if (!mContentWindow || !mEditor) return NS_ERROR_NOT_INITIALIZED; + + nsCOMPtr domDoc; + mContentWindow->GetDocument(getter_AddRefs(domDoc)); + if (!domDoc) return NS_ERROR_NOT_INITIALIZED; + + nsCOMPtr rootElement; + nsCOMPtr editor = do_QueryInterface(mEditor); + nsresult rv = editor->GetRootElement(getter_AddRefs(rootElement)); + + nsCOMPtr erP; + +//(Copied from nsHTMLEditor::InstallEventListeners) +//now hack to make sure we are not anonymous content if we are + // grabbing the parent of root element for our observer + nsCOMPtr content = do_QueryInterface(rootElement); + if (content) + { + nsCOMPtr parent; + if (NS_SUCCEEDED(content->GetParent(*getter_AddRefs(parent))) && parent) + { + PRInt32 index; + if (NS_FAILED(parent->IndexOf(content, index)) || index<0 ) + { + rootElement = do_QueryInterface(parent); + rv = rootElement->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), getter_AddRefs(erP)); + } + else + rootElement = 0; + } + } + if (!rootElement && domDoc) + rv = domDoc->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), getter_AddRefs(erP)); +//end hack + + if (erP) + { + *aEventReceiver = erP; + NS_ADDREF(*aEventReceiver); + } + return rv; +} + + NS_IMETHODIMP nsEditorShell::SetContentWindow(nsIDOMWindow* aWin) { @@ -592,12 +691,12 @@ nsEditorShell::SetContentWindow(nsIDOMWindow* aWin) mEditorController = editorController; // temp weak link, so we can get it and set the editor later - rv = controllers->InsertControllerAt(0, controller); + rv = controllers->InsertControllerAt(eEditorController, controller); if (NS_FAILED(rv)) return rv; } { - // the first is a composer controller, and takes an nsIEditorShell as the refCon + // the second is a composer controller, and takes an nsIEditorShell as the refCon nsCOMPtr controller = do_CreateInstance("component://netscape/editor/composercontroller", &rv); if (NS_FAILED(rv)) return rv; nsCOMPtr editorController = do_QueryInterface(controller); @@ -606,7 +705,7 @@ nsEditorShell::SetContentWindow(nsIDOMWindow* aWin) rv = editorController->Init(shellAsISupports); if (NS_FAILED(rv)) return rv; - rv = controllers->InsertControllerAt(1, controller); + rv = controllers->InsertControllerAt(eComposerController, controller); if (NS_FAILED(rv)) return rv; } @@ -2668,21 +2767,30 @@ nsEditorShell::ConfirmWithCancel(const nsString& aTitle, const nsString& aQuesti if ( NS_SUCCEEDED(rv) ) { // Stuff in Parameters - block->SetInt( nsICommonDialogs::eNumberButtons,3 ); block->SetString( nsICommonDialogs::eMsg, aQuestion.GetUnicode()); nsAutoString url; url.AssignWithConversion( "chrome://global/skin/question-icon.gif" ); block->SetString( nsICommonDialogs::eIconURL, url.GetUnicode()); nsAutoString yesStr, noStr; + // Default is Yes, No, Cancel + PRInt32 numberOfButtons = 3; if (aYesString) yesStr.Assign(*aYesString); else + // We always want a "Yes" string, so supply the default GetBundleString(NS_ConvertASCIItoUCS2("Yes"), yesStr); - if (aNoString) + if (aNoString && aNoString->Length() > 0) + { noStr.Assign(*aNoString); + block->SetString( nsICommonDialogs::eButton2Text, noStr.GetUnicode() ); + } else - GetBundleString(NS_ConvertASCIItoUCS2("No"), noStr); + { + // No string for "No" means we only want Yes, Cancel + numberOfButtons = 2; + } + block->SetInt( nsICommonDialogs::eNumberButtons, numberOfButtons ); nsAutoString cancelStr; GetBundleString(NS_ConvertASCIItoUCS2("Cancel"), cancelStr); @@ -2691,7 +2799,6 @@ nsEditorShell::ConfirmWithCancel(const nsString& aTitle, const nsString& aQuesti //Note: "button0" is always Ok or Yes action, "button1" is Cancel block->SetString( nsICommonDialogs::eButton0Text, yesStr.GetUnicode() ); block->SetString( nsICommonDialogs::eButton1Text, cancelStr.GetUnicode() ); - block->SetString( nsICommonDialogs::eButton2Text, noStr.GetUnicode() ); NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); if ( NS_SUCCEEDED( rv ) ) @@ -2922,7 +3029,6 @@ nsEditorShell::SetParagraphFormat(const PRUnichar * paragraphFormat) return err; } - NS_IMETHODIMP nsEditorShell::GetEditorDocument(nsIDOMDocument** aEditorDocument) { @@ -4663,3 +4769,33 @@ nsEditorShell::DocumentIsRootDoc(nsIDocumentLoader* aLoader, PRBool& outIsRoot) return NS_OK; } +NS_IMETHODIMP +nsEditorShell::EditElementProperties(nsIDOMElement *aElement, int x, int y) +{ + if (!aElement) return NS_OK; + nsresult rv = NS_ERROR_FAILURE; + +#if DEBUG_cmanske + nsAutoString TagName; + aElement->GetTagName(TagName); + TagName.ToLowerCase(); + char szTagName[64]; + TagName.ToCString(szTagName, 64); + printf("***** DBLClick: TagName of element clicked on: %s\n", szTagName); +#endif + // Get the ComposerController: + nsCOMPtr controllers; + rv = mContentWindow->GetControllers(getter_AddRefs(controllers)); + if (NS_FAILED(rv)) return rv; + if (!controllers) return NS_ERROR_NULL_POINTER; + + nsCOMPtr controller; + rv = controllers->GetControllerAt(eComposerController, getter_AddRefs(controller)); + if (NS_FAILED(rv)) return rv; + if (!controller) return NS_ERROR_NULL_POINTER; + nsCOMPtr composerController = do_QueryInterface(controller); + + // Execute the command + nsAutoString commandName(NS_ConvertASCIItoUCS2("cmd_advancedProperties")); + return composerController->DoCommand(commandName.GetUnicode()); +} diff --git a/mozilla/editor/composer/src/nsEditorShell.h b/mozilla/editor/composer/src/nsEditorShell.h index a84487a2142..58054abdf53 100644 --- a/mozilla/editor/composer/src/nsEditorShell.h +++ b/mozilla/editor/composer/src/nsEditorShell.h @@ -33,9 +33,11 @@ #include "nsIEditorController.h" #include "nsIDocumentLoaderObserver.h" #include "nsIDOMSelectionListener.h" +#include "nsIDOMEventReceiver.h" #include "nsIPrompt.h" #include "nsIStreamObserver.h" #include "nsIDOMDocument.h" +#include "nsIDOMEventListener.h" #include "nsVoidArray.h" #include "nsTextServicesCID.h" #include "nsIEditorSpellCheck.h" @@ -143,9 +145,15 @@ class nsEditorShell : public nsIEditorShell, // is the document being loaded the root of a frameset, or a non-frameset doc? nsresult DocumentIsRootDoc(nsIDocumentLoader* aLoader, PRBool& outIsRoot); - nsCOMPtr mEditor; // this can be either an HTML or plain text (or other?) editor - nsCOMPtr mSearchContext; // context used for search and replace. Owned by the appshell. - nsCOMPtr mSpellChecker; + nsCOMPtr mEditor; // this can be either an HTML or plain text (or other?) editor + nsCOMPtr mSearchContext; // context used for search and replace. Owned by the appshell. + nsCOMPtr mSpellChecker; + + // Let UI detect and process double click on elements for AdvancedProperties + // (see nsEditorShellMouseEventListener) + nsCOMPtr mMouseListenerP; + // We need this to add mMouseListenerP to document + nsresult GetDocumentEventReceiver(nsIDOMEventReceiver **aEventReceiver); PRBool mMailCompose; diff --git a/mozilla/editor/idl/nsIEditorShell.idl b/mozilla/editor/idl/nsIEditorShell.idl index 9b59d3eeb32..e6ee09efcb8 100644 --- a/mozilla/editor/idl/nsIEditorShell.idl +++ b/mozilla/editor/idl/nsIEditorShell.idl @@ -188,6 +188,13 @@ interface nsIEditorShell : nsISupports /** Element insert and property editing */ + /** Launch the "Advanced Edit" property dialog + * for the supplied element + * (Called by the DblClick handler in EditorShellMouseListener owned by EditorShell) + * Use x and y are hints to allow different behavior near left and top borders, etc. + */ + void EditElementProperties(in nsIDOMElement element, in PRInt32 x, in PRInt32 y); + /** Return an element only if it is the only node selected, * such as an image, horizontal rule, etc. * The exception is a link, which is more like a text attribute: diff --git a/mozilla/editor/libeditor/base/nsEditorController.cpp b/mozilla/editor/libeditor/base/nsEditorController.cpp index a099d2cf5c9..966015c71b4 100644 --- a/mozilla/editor/libeditor/base/nsEditorController.cpp +++ b/mozilla/editor/libeditor/base/nsEditorController.cpp @@ -331,7 +331,7 @@ nsresult nsComposerController::RegisterComposerCommands(nsIControllerCommandMana NS_REGISTER_ONE_COMMAND(nsRemoveStylesCommand, "cmd_removeStyles"); NS_REGISTER_ONE_COMMAND(nsIncreaseFontSizeCommand, "cmd_increaseFont"); NS_REGISTER_ONE_COMMAND(nsDecreaseFontSizeCommand, "cmd_decreaseFont"); - + return NS_OK; } diff --git a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp index 03d64be4c56..3b8c3b96240 100644 --- a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp @@ -2767,9 +2767,9 @@ nsHTMLEditor::SetCaretAfterElement(nsIDOMElement* aElement) return res; } -NS_IMETHODIMP nsHTMLEditor::SetParagraphFormat(const nsString& aParagraphFormat) +NS_IMETHODIMP +nsHTMLEditor::SetParagraphFormat(const nsString& aParagraphFormat) { - //Kinda sad to waste memory just to force lower case nsAutoString tag; tag.Assign(aParagraphFormat); tag.ToLowerCase(); return InsertBasicBlock(tag); @@ -3340,25 +3340,50 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu // default is null - no element found *aReturn = nsnull; + // First look for a single element in selection + nsCOMPtrselection; + nsresult res = GetSelection(getter_AddRefs(selection)); + if (NS_FAILED(res)) return res; + if (!selection) return NS_ERROR_NULL_POINTER; + + PRBool bNodeFound = PR_FALSE; + res=NS_ERROR_NOT_INITIALIZED; + PRBool isCollapsed; + selection->GetIsCollapsed(&isCollapsed); + + nsCOMPtr selectedElement; + nsCOMPtr range; + res = selection->GetRangeAt(0, getter_AddRefs(range)); + if (NS_FAILED(res)) return res; + + nsCOMPtr startParent; + PRInt32 startOffset, endOffset; + res = range->GetStartParent(getter_AddRefs(startParent)); + if (NS_FAILED(res)) return res; + res = range->GetStartOffset(&startOffset); + if (NS_FAILED(res)) return res; + + nsCOMPtr endParent; + res = range->GetEndParent(getter_AddRefs(endParent)); + if (NS_FAILED(res)) return res; + res = range->GetEndOffset(&endOffset); + if (NS_FAILED(res)) return res; + + if (startParent && startParent == endParent && (endOffset-startOffset) == 1) + { + nsCOMPtr selectedNode = GetChildAt(startParent, startOffset); + if (NS_FAILED(res)) return NS_OK; + + selectedElement = do_QueryInterface(selectedNode); + bNodeFound = PR_TRUE; + } + nsAutoString TagName = aTagName; TagName.ToLowerCase(); // Empty string indicates we should match any element tag PRBool anyTag = (TagName.IsEmpty()); //Note that this doesn't need to go through the transaction system - - nsresult res=NS_ERROR_NOT_INITIALIZED; - //PRBool first=PR_TRUE; - nsCOMPtrselection; - res = GetSelection(getter_AddRefs(selection)); - if (NS_FAILED(res)) return res; - if (!selection) return NS_ERROR_NULL_POINTER; - - PRBool isCollapsed; - selection->GetIsCollapsed(&isCollapsed); - nsCOMPtr selectedElement; - PRBool bNodeFound = PR_FALSE; - if (IsLink(TagName)) { // Link tag is a special case - we return the anchor node diff --git a/mozilla/editor/libeditor/text/nsEditorEventListeners.cpp b/mozilla/editor/libeditor/text/nsEditorEventListeners.cpp index 34908273293..96ffdd0d538 100644 --- a/mozilla/editor/libeditor/text/nsEditorEventListeners.cpp +++ b/mozilla/editor/libeditor/text/nsEditorEventListeners.cpp @@ -25,6 +25,7 @@ #include "nsVoidArray.h" #include "nsString.h" +#include "nsIDOMEvent.h" #include "nsIDOMDocument.h" #include "nsIDocument.h" #include "nsIPresShell.h" @@ -352,8 +353,6 @@ nsTextEditorKeyListener::ScrollSelectionIntoView() * nsTextEditorMouseListener implementation */ - - NS_IMPL_ADDREF(nsTextEditorMouseListener) NS_IMPL_RELEASE(nsTextEditorMouseListener) @@ -540,42 +539,9 @@ nsTextEditorMouseListener::MouseDown(nsIDOMEvent* aMouseEvent) nsresult nsTextEditorMouseListener::MouseUp(nsIDOMEvent* aMouseEvent) { - nsCOMPtr mouseEvent ( do_QueryInterface(aMouseEvent) ); - if (!mouseEvent) { - //non-ui event passed in. bad things. - return NS_OK; - } - // Detect double click message: - PRUint16 clickCount; - nsresult res = mouseEvent->GetClickCount(&clickCount); - if (NS_FAILED(res)) return res; - - if (clickCount == 2) - { - nsCOMPtr htmlEditor = do_QueryInterface(mEditor); - if (htmlEditor) - { - nsCOMPtr selectedElement; - if (NS_SUCCEEDED(htmlEditor->GetSelectedElement(nsAutoString(), getter_AddRefs(selectedElement))) - && selectedElement) - { - nsAutoString TagName; - selectedElement->GetTagName(TagName); - TagName.ToLowerCase(); - - #if DEBUG_cmanske - char szTagName[64]; - TagName.ToCString(szTagName, 64); - printf("Single Selected element found: %s\n", szTagName); - #endif - } - } - } return NS_OK; } - - nsresult nsTextEditorMouseListener::MouseClick(nsIDOMEvent* aMouseEvent) { @@ -607,13 +573,10 @@ nsTextEditorMouseListener::MouseOut(nsIDOMEvent* aMouseEvent) } - /* - * nsTextEditorMouseListener implementation + * nsTextEditorTextListener implementation */ - - NS_IMPL_ADDREF(nsTextEditorTextListener) NS_IMPL_RELEASE(nsTextEditorTextListener) diff --git a/mozilla/editor/libeditor/text/nsEditorEventListeners.h b/mozilla/editor/libeditor/text/nsEditorEventListeners.h index 0e1e086295c..5d9b7864a4e 100644 --- a/mozilla/editor/libeditor/text/nsEditorEventListeners.h +++ b/mozilla/editor/libeditor/text/nsEditorEventListeners.h @@ -76,7 +76,7 @@ protected: }; -/** editor Implementation of the MouseListener interface +/** editor Implementation of the TextListener interface */ class nsTextEditorTextListener : public nsIDOMTextListener { @@ -140,7 +140,7 @@ protected: }; -/** editor Implementation of the TextListener interface +/** editor Implementation of the MouseListener interface */ class nsTextEditorMouseListener : public nsIDOMMouseListener { @@ -176,7 +176,7 @@ protected: }; -/** editor Implementation of the MouseListener interface +/** editor Implementation of the DragListener interface */ class nsTextEditorDragListener : public nsIDOMDragListener { diff --git a/mozilla/editor/public/nsIEditorController.h b/mozilla/editor/public/nsIEditorController.h index 869d0b4c6e0..2e5ed8c67f3 100644 --- a/mozilla/editor/public/nsIEditorController.h +++ b/mozilla/editor/public/nsIEditorController.h @@ -47,6 +47,11 @@ public: */ NS_IMETHOD SetCommandRefCon(nsISupports *aCommandRefCon) = 0; + /** Execute the command identified by the ID string + * @param aCommandName ID string of the command + */ + NS_IMETHOD DoCommand(const PRUnichar *aCommandName)=0; + /* Should we expose nsEditorController::IsCommandEnabled() as well? */ }; diff --git a/mozilla/editor/ui/composer/content/ComposerCommands.js b/mozilla/editor/ui/composer/content/ComposerCommands.js index 2b882cc0089..a961af1ee7f 100644 --- a/mozilla/editor/ui/composer/content/ComposerCommands.js +++ b/mozilla/editor/ui/composer/content/ComposerCommands.js @@ -25,6 +25,8 @@ var gComposerCommandManager = null; +var commonDialogsService = Components.classes["component://netscape/appshell/commonDialogs"].getService(); +commonDialogsService = commonDialogsService.QueryInterface(Components.interfaces.nsICommonDialogs); //----------------------------------------------------------------------------------- function PrintObject(obj) @@ -102,6 +104,64 @@ var nsOpenCommand = } }; +//----------------------------------------------------------------------------------- +var nsRevertCommand = +{ + isCommandEnabled: function(aCommand, dummy) + { + return (window.editorShell && + window.editorShell.documentModified && + editorShell.editorDocument.location != "about:blank"); + }, + + doCommand: function(aCommand) + { + if (window.editorShell && + window.editorShell.documentModified && + editorShell.editorDocument.location != "about:blank") + { + // Confirm with the user to abandon current changes + if (commonDialogsService) + { + var result = {value:0}; + + // Put the page title in the message string + var title = editorShell.editorDocument.title; + if (!title || title.length == 0) + title = editorShell.GetTitle("untitled"); + + var msg = editorShell.GetString("AbandonChanges").replace(/%title%/,title); + + commonDialogsService.UniversalDialog( + window, + null, + editorShell.GetString("RevertCaption"), + msg, + null, + editorShell.GetString("Revert"), + editorShell.GetString("Cancel"), + null, + null, + null, + null, + {value:0}, + {value:0}, + "chrome://global/skin/question-icon.gif", + {value:"false"}, + 2, + 0, + 0, + result + ); + + // Reload page if first button (Rever) was pressed + if(result.value == 0) + editorShell.LoadUrl(editorShell.editorDocument.location); + } + } + } +}; + //----------------------------------------------------------------------------------- var nsNewEditorCommand = { @@ -296,8 +356,6 @@ var nsHLineCommand = hLine = window.editorShell.GetSelectedElement(tagName); if (hLine) { - dump("HLine was found -- opening dialog...!\n"); - // We only open the dialog for an existing HRule window.openDialog("chrome://editor/content/EdHLineProps.xul", "_blank", "chrome,close,titlebar,modal"); } else { @@ -307,7 +365,6 @@ var nsHLineCommand = // We change the default attributes to those saved in the user prefs if (gPrefs) { - dump(" We found the Prefs Service\n"); var percent; var height; var shading; @@ -315,7 +372,6 @@ var nsHLineCommand = try { var align = gPrefs.GetIntPref("editor.hrule.align"); - dump("Align pref: "+align+"\n"); if (align == 0 ) { hLine.setAttribute("align", "left"); } else if (align == 2) { @@ -327,18 +383,15 @@ var nsHLineCommand = var width = gPrefs.GetIntPref("editor.hrule.width"); var percent = gPrefs.GetBoolPref("editor.hrule.width_percent"); - dump("Width pref: "+width+", percent:"+percent+"\n"); if (percent) width = width +"%"; hLine.setAttribute("width", width); var height = gPrefs.GetIntPref("editor.hrule.height"); - dump("Size pref: "+height+"\n"); hLine.setAttribute("size", String(height)); var shading = gPrefs.GetBoolPref("editor.hrule.shading"); - dump("Shading pref:"+shading+"\n"); if (shading) { hLine.removeAttribute("noshade"); } else { @@ -491,6 +544,22 @@ var nsPagePropertiesCommand = } }; +//----------------------------------------------------------------------------------- + +var nsAdvancedPropertiesCommand = +{ + isCommandEnabled: function(aCommand, dummy) + { + return (window.editorShell && window.editorShell.documentEditable); + }, + doCommand: function(aCommand) + { + // Launch AdvancedEdit dialog for the selected element + var element = window.editorShell.GetSelectedElement(""); + if (element) + window.openDialog("chrome://editor/content/EdAdvancedEdit.xul", "_blank", "chrome,close,titlebar,modal,resizable=yes", "", element); + } +}; //----------------------------------------------------------------------------------- var nsColorPropertiesCommand = @@ -575,6 +644,7 @@ function SetupControllerCommands() gComposerCommandManager.registerCommand("cmd_newEditor", nsNewEditorCommand); gComposerCommandManager.registerCommand("cmd_open", nsOpenCommand); + gComposerCommandManager.registerCommand("cmd_revert", nsRevertCommand); gComposerCommandManager.registerCommand("cmd_openRemote", nsOpenRemoteCommand); gComposerCommandManager.registerCommand("cmd_preview", nsPreviewCommand); gComposerCommandManager.registerCommand("cmd_quit", nsQuitCommand); @@ -590,6 +660,8 @@ function SetupControllerCommands() gComposerCommandManager.registerCommand("cmd_listProperties", nsListPropertiesCommand); gComposerCommandManager.registerCommand("cmd_pageProperties", nsPagePropertiesCommand); gComposerCommandManager.registerCommand("cmd_colorProperties", nsColorPropertiesCommand); + gComposerCommandManager.registerCommand("cmd_advancedProperties", nsAdvancedPropertiesCommand); + gComposerCommandManager.registerCommand("cmd_image", nsImageCommand); gComposerCommandManager.registerCommand("cmd_hline", nsHLineCommand); diff --git a/mozilla/editor/ui/composer/content/EditorAllTags.css b/mozilla/editor/ui/composer/content/EditorAllTags.css index 0917cf3ff5f..664780cf02e 100644 --- a/mozilla/editor/ui/composer/content/EditorAllTags.css +++ b/mozilla/editor/ui/composer/content/EditorAllTags.css @@ -24,42 +24,34 @@ * for the "All Tags Edit Mode" Every HTML tag shows up as an icon. */ -/* For "userdefined" or "unknown" tags */ +/* For "userdefined" or "unknown" tags + (Note that "_" must be escaped) +*/ -*[_moz-userdefined] { +*[\_moz-userdefined] { + display: inline: min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-unknown.gif) no-repeat; + background: url(chrome://editor/content/images/tag-userdefined.gif) no-repeat; background-position: top left; } -*[_moz-userdefined]:before { - content: url(chrome://editor/skin/images/tag-unknown.gif); - min-height: 35px; margin-left: 2px; margin-top: 2px; -} - -foo[_moz-userdefined] { - padding-left: 16px; - background: url(chrome://editor/skin/images/tag-a.gif) no-repeat; - background-position: top left; -} - -foo[_moz-userdefined]:before { - content: url(chrome://editor/skin/images/tag-abr.gif.gif); - min-height: 35px; margin-left: 2px; margin-top: 2px; +a:before { + content: none; + /*url(chrome://editor/content/images/tag-a.gif);*/ } a { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-a.gif) no-repeat; + background: url(chrome://editor/content/images/tag-a.gif) no-repeat; background-position: top left; } abbr { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-abr.gif) no-repeat; + background: url(chrome://editor/content/images/tag-abr.gif) no-repeat; background-position: top left; } @@ -67,157 +59,154 @@ abbr { acronym { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-acr.gif) no-repeat; + background: url(chrome://editor/content/images/tag-acr.gif) no-repeat; background-position: top left; } address { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-adr.gif) no-repeat; + background: url(chrome://editor/content/images/tag-adr.gif) no-repeat; background-position: top left; } applet { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-app.gif) no-repeat; + background: url(chrome://editor/content/images/tag-app.gif) no-repeat; background-position: top left; } area { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-ara.gif) no-repeat; + background: url(chrome://editor/content/images/tag-ara.gif) no-repeat; background-position: top left; } b { - content: url(chrome://editor/skin/images/tag-b.gif); min-height: 35px; margin-left: 2px; margin-top: 2px; -/* padding-left: 16px; - background: url(chrome://editor/skin/images/tag-b.gif) no-repeat; + background: url(chrome://editor/content/images/tag-b.gif) no-repeat; background-position: top left; -*/ } basefont { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-bsf.gif) no-repeat; + background: url(chrome://editor/content/images/tag-bsf.gif) no-repeat; background-position: top left; } bdo { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-bdo.gif) no-repeat; + background: url(chrome://editor/content/images/tag-bdo.gif) no-repeat; background-position: top left; } big { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-big.gif) no-repeat; + background: url(chrome://editor/content/images/tag-big.gif) no-repeat; background-position: top left; } blockquote { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-blq.gif) no-repeat; + background: url(chrome://editor/content/images/tag-blq.gif) no-repeat; background-position: top left; } body { min-height: 35px; margin-left: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-body.gif) no-repeat; + background: url(chrome://editor/content/images/tag-body.gif) no-repeat; background-position: top left; } br { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-br.gif) no-repeat; + background: url(chrome://editor/content/images/tag-br.gif) no-repeat; background-position: top left; } button { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-btn.gif) no-repeat; + background: url(chrome://editor/content/images/tag-btn.gif) no-repeat; background-position: top left; } caption { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-cpt.gif) no-repeat; + background: url(chrome://editor/content/images/tag-cpt.gif) no-repeat; background-position: top left; } center { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-ctr.gif) no-repeat; + background: url(chrome://editor/content/images/tag-ctr.gif) no-repeat; background-position: top left; } cite { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-cit.gif) no-repeat; + background: url(chrome://editor/content/images/tag-cit.gif) no-repeat; background-position: top left; } code { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-cod.gif) no-repeat; + background: url(chrome://editor/content/images/tag-cod.gif) no-repeat; background-position: top left; } col { min-height: 35px; margin-left: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-col.gif) no-repeat; + background: url(chrome://editor/content/images/tag-col.gif) no-repeat; background-position: top left; } colgroup { min-height: 35px; margin-left: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-clg.gif) no-repeat; + background: url(chrome://editor/content/images/tag-clg.gif) no-repeat; background-position: top left; } dd { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-dd.gif) no-repeat; + background: url(chrome://editor/content/images/tag-dd.gif) no-repeat; background-position: top left; } del { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-del.gif) no-repeat; + background: url(chrome://editor/content/images/tag-del.gif) no-repeat; background-position: top left; } dfn { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-dfn.gif) no-repeat; + background: url(chrome://editor/content/images/tag-dfn.gif) no-repeat; background-position: top left; } dir { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-dir.gif) no-repeat; + background: url(chrome://editor/content/images/tag-dir.gif) no-repeat; background-position: top left; } @@ -225,315 +214,315 @@ div { min-height: 35px; margin-left: 2px; margin-top: 2px; /* TEMPORARY TO COMPENSATE FOR BUG */ padding-left: 16px; - background: url(chrome://editor/skin/images/tag-div.gif) no-repeat; + background: url(chrome://editor/content/images/tag-div.gif) no-repeat; background-position: top left; } dl { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-dl.gif) no-repeat; + background: url(chrome://editor/content/images/tag-dl.gif) no-repeat; background-position: top left; } dt { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-dt.gif) no-repeat; + background: url(chrome://editor/content/images/tag-dt.gif) no-repeat; background-position: top left; } em { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-em.gif) no-repeat; + background: url(chrome://editor/content/images/tag-em.gif) no-repeat; background-position: top left; } fieldset { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-fld.gif) no-repeat; + background: url(chrome://editor/content/images/tag-fld.gif) no-repeat; background-position: top left; } font { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-fnt.gif) no-repeat; + background: url(chrome://editor/content/images/tag-fnt.gif) no-repeat; background-position: top left; } form { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-for.gif) no-repeat; + background: url(chrome://editor/content/images/tag-for.gif) no-repeat; background-position: top left; } frame { min-height: 35px; margin-left: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-frm.gif) no-repeat; + background: url(chrome://editor/content/images/tag-frm.gif) no-repeat; background-position: top left; } frameset { min-height: 35px; margin-left: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-fst.gif) no-repeat; + background: url(chrome://editor/content/images/tag-fst.gif) no-repeat; background-position: top left; } h1 { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-h1.gif) no-repeat; + background: url(chrome://editor/content/images/tag-h1.gif) no-repeat; background-position: top left; } h2 { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-h2.gif) no-repeat; + background: url(chrome://editor/content/images/tag-h2.gif) no-repeat; background-position: top left; } h3 { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-h3.gif) no-repeat; + background: url(chrome://editor/content/images/tag-h3.gif) no-repeat; background-position: top left; } h4 { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-h4.gif) no-repeat; + background: url(chrome://editor/content/images/tag-h4.gif) no-repeat; background-position: top left; } h5 { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-h5.gif) no-repeat; + background: url(chrome://editor/content/images/tag-h5.gif) no-repeat; background-position: top left; } h6 { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-h6.gif) no-repeat; + background: url(chrome://editor/content/images/tag-h6.gif) no-repeat; background-position: top left; } hr { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-hr.gif) no-repeat; + background: url(chrome://editor/content/images/tag-hr.gif) no-repeat; background-position: top left; } i { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-i.gif) no-repeat; + background: url(chrome://editor/content/images/tag-i.gif) no-repeat; background-position: top left; } iframe { min-height: 35px; margin-left: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-ifr.gif) no-repeat; + background: url(chrome://editor/content/images/tag-ifr.gif) no-repeat; background-position: top left; } img { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-img.gif) no-repeat; + background: url(chrome://editor/content/images/tag-img.gif) no-repeat; background-position: top left; } input { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-inp.gif) no-repeat; + background: url(chrome://editor/content/images/tag-inp.gif) no-repeat; background-position: top left; } ins { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-ins.gif) no-repeat; + background: url(chrome://editor/content/images/tag-ins.gif) no-repeat; background-position: top left; } isindex { min-height: 35px; margin-left: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-isx.gif) no-repeat; + background: url(chrome://editor/content/images/tag-isx.gif) no-repeat; background-position: top left; } kbd { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-kbd.gif) no-repeat; + background: url(chrome://editor/content/images/tag-kbd.gif) no-repeat; background-position: top left; } label { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-lbl.gif) no-repeat; + background: url(chrome://editor/content/images/tag-lbl.gif) no-repeat; background-position: top left; } legend { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-lgn.gif) no-repeat; + background: url(chrome://editor/content/images/tag-lgn.gif) no-repeat; background-position: top left; } li { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-li.gif) no-repeat; + background: url(chrome://editor/content/images/tag-li.gif) no-repeat; background-position: top left; } listing { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-lst.gif) no-repeat; + background: url(chrome://editor/content/images/tag-lst.gif) no-repeat; background-position: top left; } map { min-height: 35px; margin-left: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-map.gif) no-repeat; + background: url(chrome://editor/content/images/tag-map.gif) no-repeat; background-position: top left; } menu { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-men.gif) no-repeat; + background: url(chrome://editor/content/images/tag-men.gif) no-repeat; background-position: top left; } noframes { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-nfr.gif) no-repeat; + background: url(chrome://editor/content/images/tag-nfr.gif) no-repeat; background-position: top left; } noscript { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-nsc.gif) no-repeat; + background: url(chrome://editor/content/images/tag-nsc.gif) no-repeat; background-position: top left; } object { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-obj.gif) no-repeat; + background: url(chrome://editor/content/images/tag-obj.gif) no-repeat; background-position: top left; } ol { min-height: 35px; margin-left: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-ol.gif) no-repeat; + background: url(chrome://editor/content/images/tag-ol.gif) no-repeat; background-position: top left; } optgroup { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-opg.gif) no-repeat; + background: url(chrome://editor/content/images/tag-opg.gif) no-repeat; background-position: top left; } option { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-opt.gif) no-repeat; + background: url(chrome://editor/content/images/tag-opt.gif) no-repeat; background-position: top left; } p { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-p.gif) no-repeat; + background: url(chrome://editor/content/images/tag-p.gif) no-repeat; background-position: top left; } param { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-prm.gif) no-repeat; + background: url(chrome://editor/content/images/tag-prm.gif) no-repeat; background-position: top left; } plaintext { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-pln.gif) no-repeat; + background: url(chrome://editor/content/images/tag-pln.gif) no-repeat; background-position: top left; } pre { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-pre.gif) no-repeat; + background: url(chrome://editor/content/images/tag-pre.gif) no-repeat; background-position: top left; } q { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-q.gif) no-repeat; + background: url(chrome://editor/content/images/tag-q.gif) no-repeat; background-position: top left; } s { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-s.gif) no-repeat; + background: url(chrome://editor/content/images/tag-s.gif) no-repeat; background-position: top left; } samp { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-smp.gif) no-repeat; + background: url(chrome://editor/content/images/tag-smp.gif) no-repeat; background-position: top left; } script { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-scr.gif) no-repeat; + background: url(chrome://editor/content/images/tag-scr.gif) no-repeat; background-position: top left; } select { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-slc.gif) no-repeat; + background: url(chrome://editor/content/images/tag-slc.gif) no-repeat; background-position: top left; } small { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-sml.gif) no-repeat; + background: url(chrome://editor/content/images/tag-sml.gif) no-repeat; background-position: top left; } @@ -541,35 +530,35 @@ span { min-height: 35px; margin-left: 2px; margin-top: 2px; /* TEMPORARY TO COMPENSATE FOR BUG */ padding-left: 16px; - background: url(chrome://editor/skin/images/tag-spn.gif) no-repeat; + background: url(chrome://editor/content/images/tag-spn.gif) no-repeat; background-position: top left; } strike { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-stk.gif) no-repeat; + background: url(chrome://editor/content/images/tag-stk.gif) no-repeat; background-position: top left; } strong { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-stn.gif) no-repeat; + background: url(chrome://editor/content/images/tag-stn.gif) no-repeat; background-position: top left; } sub { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-sub.gif) no-repeat; + background: url(chrome://editor/content/images/tag-sub.gif) no-repeat; background-position: top left; } sup { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-sup.gif) no-repeat; + background: url(chrome://editor/content/images/tag-sup.gif) no-repeat; background-position: top left; } @@ -577,30 +566,24 @@ sup { some table elements. Trying the "before" strategy */ -table:before { - content: url(chrome://editor/skin/images/tag-tbl.gif); - /* +table { min-height: 35px; margin-left: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-tbl.gif) no-repeat; + background: url(chrome://editor/content/images/tag-tbl.gif) no-repeat; background-position: top left; - */ } -tbody:before { - content: url(chrome://editor/skin/images/tag-tbd.gif); - /* +tbody { min-height: 35px; margin-left: 2px; margin-top: 1px; padding-left: 16px; - content: url(chrome://editor/skin/images/tag-tbd.gif) no-repeat; + content: url(chrome://editor/content/images/tag-tbd.gif) no-repeat; background-position: top left; - */ } td { min-height: 35px; margin-left: 2px; padding-left: 16px; - background-image: url(chrome://editor/skin/images/tag-td.gif); + background-image: url(chrome://editor/content/images/tag-td.gif); background-repeat: no-repeat; background-position: top left; } @@ -608,79 +591,69 @@ td { textarea { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-txt.gif) no-repeat; + background: url(chrome://editor/content/images/tag-txt.gif) no-repeat; background-position: top left; } -tfoot:before { - content: url(chrome://editor/skin/images/tag-tft.gif.gif); - /* +tfoot { min-height: 35px; margin-left: 2px; margin-top: 1px; padding-left: 16px; - content: url(chrome://editor/skin/images/tag-tft.gif) no-repeat; + content: url(chrome://editor/content/images/tag-tft.gif) no-repeat; background-position: top left; - */ } th { min-height: 35px; margin-left: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-th.gif) no-repeat; + background: url(chrome://editor/content/images/tag-th.gif) no-repeat; background-position: top left; } -thead:before { - content: url(chrome://editor/skin/images/tag-thd.gif); - /* +thead { min-height: 35px; margin-left: 2px; margin-top: 1px; padding-left: 16px; - content: url(chrome://editor/skin/images/tag-thd.gif) no-repeat; + content: url(chrome://editor/content/images/tag-thd.gif) no-repeat; background-position: top left; - */ } tr { min-height: 35px; margin-left: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-tr.gif) no-repeat; + background: url(chrome://editor/content/images/tag-tr.gif) no-repeat; background-position: top left; } tt { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-tt.gif) no-repeat; + background: url(chrome://editor/content/images/tag-tt.gif) no-repeat; background-position: top left; } -u:before { - min-height: 35px; margin-left: 2px; - content: url(chrome://editor/skin/images/tag-u.gif); -/* +u { padding-left: 16px; - background: url(chrome://editor/skin/images/tag-u.gif) no-repeat; + background: url(chrome://editor/content/images/tag-u.gif) no-repeat; background-position: top left; -*/ } ul { min-height: 35px; margin-left: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-ul.gif) no-repeat; + background: url(chrome://editor/content/images/tag-ul.gif) no-repeat; background-position: top left; } var { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-var.gif) no-repeat; + background: url(chrome://editor/content/images/tag-var.gif) no-repeat; background-position: top left; } xmp { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-xmp.gif) no-repeat; + background: url(chrome://editor/content/images/tag-xmp.gif) no-repeat; background-position: top left; } @@ -692,14 +665,14 @@ xmp { html { min-height: 35px; margin-left: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-html.gif) no-repeat; + background: url(chrome://editor/content/images/tag-html.gif) no-repeat; background-position: top left; } head { min-height: 35px; margin-left: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-hed.gif) no-repeat; + background: url(chrome://editor/content/images/tag-hed.gif) no-repeat; background-position: top left; } @@ -708,35 +681,35 @@ These are tags that are ONLY allowed as children of HEAD: title { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-ttl.gif) no-repeat; + background: url(chrome://editor/content/images/tag-ttl.gif) no-repeat; background-position: top left; } base { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-bas.gif) no-repeat; + background: url(chrome://editor/content/images/tag-bas.gif) no-repeat; background-position: top left; } style { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-stl.gif) no-repeat; + background: url(chrome://editor/content/images/tag-stl.gif) no-repeat; background-position: top left; } meta { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-met.gif) no-repeat; + background: url(chrome://editor/content/images/tag-met.gif) no-repeat; background-position: top left; } link { min-height: 35px; margin-left: 2px; margin-top: 2px; padding-left: 16px; - background: url(chrome://editor/skin/images/tag-lnk.gif) no-repeat; + background: url(chrome://editor/content/images/tag-lnk.gif) no-repeat; background-position: top left; } */ diff --git a/mozilla/editor/ui/composer/content/EditorCommandsOverlay.xul b/mozilla/editor/ui/composer/content/EditorCommandsOverlay.xul index c682b35f8f6..84e83551639 100644 --- a/mozilla/editor/ui/composer/content/EditorCommandsOverlay.xul +++ b/mozilla/editor/ui/composer/content/EditorCommandsOverlay.xul @@ -40,15 +40,15 @@ oncommand="EditorObjectProperties()"/> - + - - - - - + + + + + @@ -67,10 +67,11 @@ - - - - + + + + + diff --git a/mozilla/editor/ui/composer/content/EditorContent.css b/mozilla/editor/ui/composer/content/EditorContent.css index 8503c9b1d4d..de6f5cb4c0f 100644 --- a/mozilla/editor/ui/composer/content/EditorContent.css +++ b/mozilla/editor/ui/composer/content/EditorContent.css @@ -27,8 +27,9 @@ * place in EditorOverride.css, instead of here. */ +/* Use "before" rule so single click can select icon */ a[name]:before { - content: url(chrome://editor/skin/images/anchor-in-doc.gif); + content: url(chrome://editor/content/images/tag-anchor.gif); } /* Force border display for empty cells diff --git a/mozilla/editor/ui/composer/content/MANIFEST b/mozilla/editor/ui/composer/content/MANIFEST index 5e602a592cc..dd8139c51cf 100644 --- a/mozilla/editor/ui/composer/content/MANIFEST +++ b/mozilla/editor/ui/composer/content/MANIFEST @@ -47,3 +47,99 @@ sb-file-contextMenu.js sb-file-panel.js sb-file-panel.xul sb-FileWidgetFileHandler.js +images:tag-anchor.gif +images:tag-abr.gif +images:tag-acr.gif +images:tag-adr.gif +images:tag-ara.gif +images:tag-bas.gif +images:tag-blq.gif +images:tag-bsf.gif +images:tag-btn.gif +images:tag-cit.gif +images:tag-clg.gif +images:tag-cod.gif +images:tag-cpt.gif +images:tag-ctr.gif +images:tag-fld.gif +images:tag-fnt.gif +images:tag-for.gif +images:tag-frm.gif +images:tag-fst.gif +images:tag-ifr.gif +images:tag-inp.gif +images:tag-lbl.gif +images:tag-lgn.gif +images:tag-lnk.gif +images:tag-lst.gif +images:tag-men.gif +images:tag-nfr.gif +images:tag-nsc.gif +images:tag-opg.gif +images:tag-opt.gif +images:tag-prm.gif +images:tag-scr.gif +images:tag-slc.gif +images:tag-sml.gif +images:tag-smp.gif +images:tag-spn.gif +images:tag-stk.gif +images:tag-stl.gif +images:tag-stn.gif +images:tag-tbd.gif +images:tag-tbl.gif +images:tag-tft.gif +images:tag-thd.gif +images:tag-hed.gif +images:tag-isx.gif +images:tag-met.gif +images:tag-ttl.gif +images:tag-pln.gif +images:tag-xmp.gif +images:tag-txt.gif +images:tag-a.gif +images:tag-app.gif +images:tag-b.gif +images:tag-bdo.gif +images:tag-big.gif +images:tag-body.gif +images:tag-br.gif +images:tag-col.gif +images:tag-dd.gif +images:tag-del.gif +images:tag-dfn.gif +images:tag-dir.gif +images:tag-div.gif +images:tag-dl.gif +images:tag-dt.gif +images:tag-em.gif +images:tag-h1.gif +images:tag-h2.gif +images:tag-h3.gif +images:tag-h4.gif +images:tag-h5.gif +images:tag-h6.gif +images:tag-hr.gif +images:tag-html.gif +images:tag-i.gif +images:tag-img.gif +images:tag-ins.gif +images:tag-kbd.gif +images:tag-li.gif +images:tag-map.gif +images:tag-obj.gif +images:tag-ol.gif +images:tag-p.gif +images:tag-pre.gif +images:tag-q.gif +images:tag-s.gif +images:tag-sub.gif +images:tag-sup.gif +images:tag-td.gif +images:tag-th.gif +images:tag-tr.gif +images:tag-tt.gif +images:tag-u.gif +images:tag-ul.gif +images:tag-var.gif +images:tag-userdefined.gif diff --git a/mozilla/editor/ui/composer/content/Makefile.in b/mozilla/editor/ui/composer/content/Makefile.in index ecc24bf8981..158df1cbaaf 100644 --- a/mozilla/editor/ui/composer/content/Makefile.in +++ b/mozilla/editor/ui/composer/content/Makefile.in @@ -27,6 +27,8 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk +DIRS = images + CHROME_DIR = editor CHROME_CONTENT_DIR = content diff --git a/mozilla/editor/ui/composer/content/editor.xul b/mozilla/editor/ui/composer/content/editor.xul index d7bcd1e7397..2d3f40e6017 100644 --- a/mozilla/editor/ui/composer/content/editor.xul +++ b/mozilla/editor/ui/composer/content/editor.xul @@ -96,7 +96,6 @@ - @@ -202,14 +201,15 @@ - - + + - - - - + - + - - - + + + @@ -294,10 +297,10 @@ + - @@ -593,7 +596,7 @@ - + @@ -609,7 +612,7 @@