r=sfrasier a=pdt+ fixing plain text mail 33654 see kin@netscape.com

This commit is contained in:
mjudge%netscape.com 2000-09-22 00:43:44 +00:00
Родитель f7cec2cb2b
Коммит 9f6d3e1303
7 изменённых файлов: 34 добавлений и 32 удалений

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

@ -863,7 +863,7 @@ nsEditorShell::InstantiateEditor(nsIDOMDocument *aDoc, nsIPresShell *aPresShell)
{
if (mEditorTypeString.EqualsWithConversion("text"))
{
err = editor->Init(aDoc, aPresShell, nsnull, selCon, nsIHTMLEditor::eEditorPlaintextMask);
err = editor->Init(aDoc, aPresShell, nsnull, selCon, nsIHTMLEditor::eEditorPlaintextMask | nsIHTMLEditor::eEditorEnableWrapHackMask);
mEditorType = ePlainTextEditorType;
}
else if (mEditorTypeString.EqualsWithConversion("html") || mEditorTypeString.IsEmpty()) // empty string default to HTML editor
@ -1822,10 +1822,6 @@ nsEditorShell::SaveDocument(PRBool saveAs, PRBool saveCopy, PRBool *_retval)
// Use page title as suggested name for new document
if (fileName.Length() == 0 && title.Length() > 0)
{
// Strip out quote character
PRUnichar quote = (PRUnichar)'\"';
title.StripChar(quote);
//Replace "bad" filename characteres with "_"
PRUnichar space = (PRUnichar)' ';
PRUnichar dot = (PRUnichar)'.';

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

@ -4657,7 +4657,9 @@ NS_IMETHODIMP nsHTMLEditor::SetBodyWrapWidth(PRInt32 aWrapColumn)
// Make sure we have fixed-width font. This should be done for us,
// but it isn't, see bug 22502, so we have to add "font: monospace;".
// Only do this if we're wrapping.
if (aWrapColumn >= 0)
PRUint32 flags = 0;
GetFlags(&flags);
if ((flags & eEditorEnableWrapHackMask) && aWrapColumn >= 0)
styleValue.AppendWithConversion("font-family: monospace; ");
// and now we're ready to set the new whitespace/wrapping style.

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

@ -162,17 +162,19 @@ nsTextEditRules::SetFlags(PRUint32 aFlags)
// a style attribute on it, don't know why.
// SetFlags() is really meant to only be called once
// and at editor init time.
if (aFlags & nsIHTMLEditor::eEditorPlaintextMask)
{
if (!(mFlags & nsIHTMLEditor::eEditorPlaintextMask))
{
// Call the editor's SetBodyWrapWidth(), which will
// set the styles appropriately for plaintext:
mEditor->SetBodyWrapWidth(72);
}
}
PRBool willBePlaintext = (aFlags & nsIHTMLEditor::eEditorPlaintextMask) != 0;
PRBool alreadyPlaintext = (mFlags & nsIHTMLEditor::eEditorPlaintextMask) != 0;
mFlags = aFlags;
if (!alreadyPlaintext && willBePlaintext)
{
// Call the editor's SetBodyWrapWidth(), which will
// set the styles appropriately for plaintext:
mEditor->SetBodyWrapWidth(72);
}
return NS_OK;
}

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

@ -863,7 +863,7 @@ nsEditorShell::InstantiateEditor(nsIDOMDocument *aDoc, nsIPresShell *aPresShell)
{
if (mEditorTypeString.EqualsWithConversion("text"))
{
err = editor->Init(aDoc, aPresShell, nsnull, selCon, nsIHTMLEditor::eEditorPlaintextMask);
err = editor->Init(aDoc, aPresShell, nsnull, selCon, nsIHTMLEditor::eEditorPlaintextMask | nsIHTMLEditor::eEditorEnableWrapHackMask);
mEditorType = ePlainTextEditorType;
}
else if (mEditorTypeString.EqualsWithConversion("html") || mEditorTypeString.IsEmpty()) // empty string default to HTML editor
@ -1822,10 +1822,6 @@ nsEditorShell::SaveDocument(PRBool saveAs, PRBool saveCopy, PRBool *_retval)
// Use page title as suggested name for new document
if (fileName.Length() == 0 && title.Length() > 0)
{
// Strip out quote character
PRUnichar quote = (PRUnichar)'\"';
title.StripChar(quote);
//Replace "bad" filename characteres with "_"
PRUnichar space = (PRUnichar)' ';
PRUnichar dot = (PRUnichar)'.';

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

@ -4657,7 +4657,9 @@ NS_IMETHODIMP nsHTMLEditor::SetBodyWrapWidth(PRInt32 aWrapColumn)
// Make sure we have fixed-width font. This should be done for us,
// but it isn't, see bug 22502, so we have to add "font: monospace;".
// Only do this if we're wrapping.
if (aWrapColumn >= 0)
PRUint32 flags = 0;
GetFlags(&flags);
if ((flags & eEditorEnableWrapHackMask) && aWrapColumn >= 0)
styleValue.AppendWithConversion("font-family: monospace; ");
// and now we're ready to set the new whitespace/wrapping style.

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

@ -162,17 +162,19 @@ nsTextEditRules::SetFlags(PRUint32 aFlags)
// a style attribute on it, don't know why.
// SetFlags() is really meant to only be called once
// and at editor init time.
if (aFlags & nsIHTMLEditor::eEditorPlaintextMask)
{
if (!(mFlags & nsIHTMLEditor::eEditorPlaintextMask))
{
// Call the editor's SetBodyWrapWidth(), which will
// set the styles appropriately for plaintext:
mEditor->SetBodyWrapWidth(72);
}
}
PRBool willBePlaintext = (aFlags & nsIHTMLEditor::eEditorPlaintextMask) != 0;
PRBool alreadyPlaintext = (mFlags & nsIHTMLEditor::eEditorPlaintextMask) != 0;
mFlags = aFlags;
if (!alreadyPlaintext && willBePlaintext)
{
// Call the editor's SetBodyWrapWidth(), which will
// set the styles appropriately for plaintext:
mEditor->SetBodyWrapWidth(72);
}
return NS_OK;
}

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

@ -60,6 +60,7 @@ public:
eEditorMailBit, // use mail-compose editting rules
eEditorDisableForcedUpdatesBit, // prevent immediate view refreshes
eEditorDisableForcedReflowsBit, // prevent immediate reflows
eEditorEnableWrapHackBit, // allow the editor to set font: monospace on the root node
eEditorWidgetBit // bit for widgets
// max 32 bits
@ -75,6 +76,7 @@ public:
eEditorMailMask = (1 << eEditorMailBit),
eEditorDisableForcedUpdatesMask = (1 << eEditorDisableForcedUpdatesBit),
eEditorDisableForcedReflowsMask = (1 << eEditorDisableForcedReflowsBit),
eEditorEnableWrapHackMask = (1 << eEditorEnableWrapHackBit),
eEditorWidgetMask = (1 << eEditorWidgetBit)
};