diff --git a/mozilla/editor/libeditor/html/nsHTMLDataTransfer.cpp b/mozilla/editor/libeditor/html/nsHTMLDataTransfer.cpp
index 07a80d27ba0..84f0a29a615 100644
--- a/mozilla/editor/libeditor/html/nsHTMLDataTransfer.cpp
+++ b/mozilla/editor/libeditor/html/nsHTMLDataTransfer.cpp
@@ -1810,6 +1810,13 @@ nsHTMLEditor::InsertAsCitedQuotation(const nsAString & aQuotedText,
const nsAString & aCharset,
nsIDOMNode **aNodeInserted)
{
+ // Don't let anyone insert html into a "plaintext" editor:
+ if (mFlags & eEditorPlaintextMask)
+ {
+ NS_ASSERTION(!aInsertHTML, "InsertAsCitedQuotation: trying to insert html into plaintext editor");
+ return InsertAsPlaintextQuotation(aQuotedText, PR_TRUE, aNodeInserted);
+ }
+
nsCOMPtr newNode;
nsresult res = NS_OK;
diff --git a/mozilla/mailnews/compose/src/nsMsgCompose.cpp b/mozilla/mailnews/compose/src/nsMsgCompose.cpp
index 105d36aa4ee..9362c8fd4aa 100644
--- a/mozilla/mailnews/compose/src/nsMsgCompose.cpp
+++ b/mozilla/mailnews/compose/src/nsMsgCompose.cpp
@@ -534,7 +534,7 @@ nsMsgCompose::ConvertAndLoadComposeWindow(nsString& aPrefix,
nsCOMPtr mailEditor (do_QueryInterface(m_editor));
if (!aBuf.IsEmpty() && mailEditor)
{
- if (!mCiteReference.IsEmpty())
+ if (aHTMLEditor && !mCiteReference.IsEmpty())
mailEditor->InsertAsCitedQuotation(aBuf,
mCiteReference,
PR_TRUE,
@@ -2281,8 +2281,6 @@ QuotingOutputStreamListener::InsertToCompose(nsIEditor *aEditor,
if (aEditor)
aEditor->EnableUndo(PR_TRUE);
- aEditor->BeginTransaction();
-
if (!mMsgBody.IsEmpty())
{
if (!mCitePrefix.IsEmpty())
@@ -2292,16 +2290,20 @@ QuotingOutputStreamListener::InsertToCompose(nsIEditor *aEditor,
}
nsCOMPtr mailEditor (do_QueryInterface(aEditor));
- nsAutoString empty;
- mailEditor->InsertAsCitedQuotation(mMsgBody,
- empty,
- PR_TRUE,
- NS_LITERAL_STRING("UTF-8"),
- getter_AddRefs(nodeInserted));
+ if (mailEditor)
+ {
+ if (aHTMLEditor)
+ mailEditor->InsertAsCitedQuotation(mMsgBody,
+ NS_LITERAL_STRING(""),
+ PR_TRUE,
+ NS_LITERAL_STRING("UTF-8"),
+ getter_AddRefs(nodeInserted));
+ else
+ mailEditor->InsertAsQuotation(mMsgBody, getter_AddRefs(nodeInserted));
+ }
+
}
- aEditor->EndTransaction();
-
if (aEditor)
{
nsCOMPtr textEditor = do_QueryInterface(aEditor);