Make 'sub' and 'sup' text styles mutually-exclusive, b=100825, r=jfrancis, sr=ben

This commit is contained in:
cmanske%netscape.com 2002-01-09 15:36:13 +00:00
parent 2880631fe6
commit a223374295

View File

@ -317,7 +317,26 @@ nsStyleUpdatingCommand::ToggleState(nsIEditorShell *aEditorShell, const char* aT
if (styleSet)
rv = aEditorShell->RemoveTextProperty(tagName.get(), nsnull);
else
rv = aEditorShell->SetTextProperty(tagName.get(), nsnull, nsnull);
{
// Superscript and Subscript styles are mutually exclusive
nsAutoString removeName;
aEditorShell->BeginBatchChanges();
if (tagName.Equals(NS_LITERAL_STRING("sub")))
{
removeName.AssignWithConversion("sup");
rv = aEditorShell->RemoveTextProperty(tagName.get(), nsnull);
}
else if (tagName.Equals(NS_LITERAL_STRING("sup")))
{
removeName.AssignWithConversion("sub");
rv = aEditorShell->RemoveTextProperty(tagName.get(), nsnull);
}
if (NS_SUCCEEDED(rv))
rv = aEditorShell->SetTextProperty(tagName.get(), nsnull, nsnull);
aEditorShell->EndBatchChanges();
}
return rv;
}