diff --git a/mozilla/editor/ui/composer/content/editor.js b/mozilla/editor/ui/composer/content/editor.js
index 769e5ba06d5..08ba40529c1 100644
--- a/mozilla/editor/ui/composer/content/editor.js
+++ b/mozilla/editor/ui/composer/content/editor.js
@@ -219,6 +219,43 @@ var DocumentReloadListener =
}
};
+function addEditorClickEventListener()
+{
+ try {
+ var bodyelement = GetBodyElement();
+ if (bodyelement)
+ bodyelement.addEventListener("click", EditorClick, false);
+ } catch (e) {}
+}
+
+var MessageComposeDocumentStateListener =
+{
+ NotifyDocumentCreated: function()
+ {
+ addEditorClickEventListener();
+ },
+
+ NotifyDocumentWillBeDestroyed: function()
+ {
+ // note that the editorshell seems to be gone at this point
+ // so we don't have a way to remove the click listener.
+ // hopefully it is being cleaned up with all listeners
+ },
+
+ NotifyDocumentStateChanged:function()
+ {
+ }
+};
+
+function isPlaintextEditor()
+{
+ var editorflags;
+ try {
+ editorflags = window.editorShell.editor.flags;
+ } catch(e) {}
+
+ return (editorflags & Components.interfaces.nsIPlaintextEditor.eEditorPlaintextMask);
+}
// This is called when the real editor document is created,
// before it's loaded.
@@ -245,9 +282,17 @@ var DocumentStateListener =
// We must wait until document is created to get proper Url
// (Windows may load with local file paths)
SetSaveAndPublishUI(GetDocumentUrl());
+
+ // Add mouse click watcher if right type of editor
+ if (!isPlaintextEditor())
+ addEditorClickEventListener();
},
+ // note that the editorshell seems to be gone at this point
+ // so we don't have a way to remove the click listener.
+ // hopefully it is being cleaned up with all listeners
NotifyDocumentWillBeDestroyed: function() {},
+
NotifyDocumentStateChanged:function( isNowDirty )
{
/* Notify our dirty detector so this window won't be closed if
@@ -293,9 +338,6 @@ function EditorStartup(editorType, editorElement)
editorShell.webShellWindow = window;
editorShell.contentWindow = window._content;
- // add a listener to be called when document is really done loading
- editorShell.RegisterDocumentStateListener( DocumentStateListener );
-
// set up our global prefs object
GetPrefsService();
@@ -331,12 +373,23 @@ function EditorSharedStartup()
case "htmlmail":
SetupHTMLEditorCommands();
editorShell.contentsMIMEType = "text/html";
+ if (editorShell.editorType == "htmlmail")
+ editorShell.RegisterDocumentStateListener( MessageComposeDocumentStateListener );
+ else
+ // add a listener to be called when document is really done loading
+ editorShell.RegisterDocumentStateListener( DocumentStateListener );
break;
+
case "text":
+ // add listener when document is done loading (for toolbar setup)
+ editorShell.RegisterDocumentStateListener( DocumentStateListener );
+ // continue below
+
case "textmail":
SetupTextEditorCommands();
editorShell.contentsMIMEType = "text/plain";
break;
+
default:
dump("INVALID EDITOR TYPE: "+editorShell.editorType+"\n");
SetupTextEditorCommands();
@@ -1265,10 +1318,19 @@ function EditorDblClick(event)
function EditorClick(event)
{
+ if (!event)
+ return;
+
+ if (event.detail == 2)
+ {
+ EditorDblClick(event);
+ return;
+ }
+
// In Show All Tags Mode,
// single click selects entire element,
// except for body and table elements
- if (event && event.target && gEditorDisplayMode == DisplayModeAllTags)
+ if (event.target && gEditorDisplayMode == DisplayModeAllTags)
{
try {
var element = event.target.QueryInterface( Components.interfaces.nsIDOMElement);
diff --git a/mozilla/editor/ui/composer/content/editor.xul b/mozilla/editor/ui/composer/content/editor.xul
index e387837db02..ed42b71e42a 100644
--- a/mozilla/editor/ui/composer/content/editor.xul
+++ b/mozilla/editor/ui/composer/content/editor.xul
@@ -244,8 +244,7 @@
which breaks deck frame-hiding mechanism
-->
-
+
diff --git a/mozilla/mailnews/compose/resources/content/messengercompose.xul b/mozilla/mailnews/compose/resources/content/messengercompose.xul
index ef2492e46a0..c0230acbe76 100644
--- a/mozilla/mailnews/compose/resources/content/messengercompose.xul
+++ b/mozilla/mailnews/compose/resources/content/messengercompose.xul
@@ -476,8 +476,7 @@
+ onkeypress="editorKeyPress(event);" context="msgComposeContext"/>