173953: Fix plaintext quoting. r=ducarroz sr=bzbarsky

This commit is contained in:
akkana%netscape.com 2002-10-17 00:07:28 +00:00
Родитель 9f40fcb3c9
Коммит a6144bb9e3
2 изменённых файлов: 20 добавлений и 11 удалений

Просмотреть файл

@ -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<nsIDOMNode> newNode;
nsresult res = NS_OK;

Просмотреть файл

@ -534,7 +534,7 @@ nsMsgCompose::ConvertAndLoadComposeWindow(nsString& aPrefix,
nsCOMPtr<nsIEditorMailSupport> 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<nsIEditorMailSupport> 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<nsIPlaintextEditor> textEditor = do_QueryInterface(aEditor);