fix insert HR command for Midas (bug 183793; r=cmanske, sr=smfr)
This commit is contained in:
Родитель
26be2f6538
Коммит
1c01e174ff
|
@ -4184,7 +4184,7 @@ static struct MidasCommand gMidasCommandTable[] = {
|
|||
{ "increasefontsize", "cmd_increaseFont", "", PR_FALSE },
|
||||
{ "decreasefontsize", "cmd_decreaseFont", "", PR_FALSE },
|
||||
{ "fontsize", "cmd_fontSize", "", PR_FALSE },
|
||||
{ "inserthorizontalrule", "cmd_hline", "", PR_TRUE },
|
||||
{ "inserthorizontalrule", "cmd_insertHR", "", PR_TRUE },
|
||||
{ "createlink", "cmd_insertLinkNoUI", "", PR_FALSE },
|
||||
{ "insertimage", "cmd_insertImageNoUI", "", PR_FALSE },
|
||||
{ "justifyleft", "cmd_align", "left", PR_TRUE },
|
||||
|
|
|
@ -1315,6 +1315,22 @@ nsInsertTagCommand::IsCommandEnabled(const char * aCommandName,
|
|||
NS_IMETHODIMP
|
||||
nsInsertTagCommand::DoCommand(const char *aCmdName, nsISupports *refCon)
|
||||
{
|
||||
if (0 == nsCRT::strcmp(mTagName, "hr"))
|
||||
{
|
||||
nsCOMPtr<nsIHTMLEditor> editor = do_QueryInterface(refCon);
|
||||
if (!editor)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domElem;
|
||||
nsresult rv;
|
||||
rv = editor->CreateElementWithDefaults(NS_ConvertASCIItoUCS2(mTagName),
|
||||
getter_AddRefs(domElem));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return editor->InsertElementAtSelection(domElem, PR_TRUE);
|
||||
}
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@ -1323,9 +1339,14 @@ nsInsertTagCommand::DoCommandParams(const char *aCommandName,
|
|||
nsICommandParams *aParams,
|
||||
nsISupports *refCon)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aParams);
|
||||
NS_ENSURE_ARG_POINTER(refCon);
|
||||
|
||||
// inserting an hr shouldn't have an parameters, just call DoCommand for that
|
||||
if (0 == nsCRT::strcmp(mTagName, "hr"))
|
||||
return DoCommand(aCommandName, refCon);
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aParams);
|
||||
|
||||
nsCOMPtr<nsIHTMLEditor> editor = do_QueryInterface(refCon);
|
||||
if (!editor)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
|
|
@ -163,6 +163,7 @@ nsComposerController::RegisterHTMLEditorCommands(
|
|||
NS_REGISTER_ONE_COMMAND(nsInsertHTMLCommand, "cmd_insertHTML");
|
||||
NS_REGISTER_TAG_COMMAND(nsInsertTagCommand, "cmd_insertLinkNoUI", "a");
|
||||
NS_REGISTER_TAG_COMMAND(nsInsertTagCommand, "cmd_insertImageNoUI", "img");
|
||||
NS_REGISTER_TAG_COMMAND(nsInsertTagCommand, "cmd_insertHR", "hr");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче