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, const nsAString & aCharset,
nsIDOMNode **aNodeInserted) 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; nsCOMPtr<nsIDOMNode> newNode;
nsresult res = NS_OK; nsresult res = NS_OK;

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

@ -534,7 +534,7 @@ nsMsgCompose::ConvertAndLoadComposeWindow(nsString& aPrefix,
nsCOMPtr<nsIEditorMailSupport> mailEditor (do_QueryInterface(m_editor)); nsCOMPtr<nsIEditorMailSupport> mailEditor (do_QueryInterface(m_editor));
if (!aBuf.IsEmpty() && mailEditor) if (!aBuf.IsEmpty() && mailEditor)
{ {
if (!mCiteReference.IsEmpty()) if (aHTMLEditor && !mCiteReference.IsEmpty())
mailEditor->InsertAsCitedQuotation(aBuf, mailEditor->InsertAsCitedQuotation(aBuf,
mCiteReference, mCiteReference,
PR_TRUE, PR_TRUE,
@ -2281,8 +2281,6 @@ QuotingOutputStreamListener::InsertToCompose(nsIEditor *aEditor,
if (aEditor) if (aEditor)
aEditor->EnableUndo(PR_TRUE); aEditor->EnableUndo(PR_TRUE);
aEditor->BeginTransaction();
if (!mMsgBody.IsEmpty()) if (!mMsgBody.IsEmpty())
{ {
if (!mCitePrefix.IsEmpty()) if (!mCitePrefix.IsEmpty())
@ -2292,16 +2290,20 @@ QuotingOutputStreamListener::InsertToCompose(nsIEditor *aEditor,
} }
nsCOMPtr<nsIEditorMailSupport> mailEditor (do_QueryInterface(aEditor)); nsCOMPtr<nsIEditorMailSupport> mailEditor (do_QueryInterface(aEditor));
nsAutoString empty; if (mailEditor)
mailEditor->InsertAsCitedQuotation(mMsgBody, {
empty, if (aHTMLEditor)
PR_TRUE, mailEditor->InsertAsCitedQuotation(mMsgBody,
NS_LITERAL_STRING("UTF-8"), NS_LITERAL_STRING(""),
getter_AddRefs(nodeInserted)); PR_TRUE,
NS_LITERAL_STRING("UTF-8"),
getter_AddRefs(nodeInserted));
else
mailEditor->InsertAsQuotation(mMsgBody, getter_AddRefs(nodeInserted));
}
} }
aEditor->EndTransaction();
if (aEditor) if (aEditor)
{ {
nsCOMPtr<nsIPlaintextEditor> textEditor = do_QueryInterface(aEditor); nsCOMPtr<nsIPlaintextEditor> textEditor = do_QueryInterface(aEditor);