Bug 528793 - Disable "Choose color for text" / "Choose color for background" icons when not in HTML edit mode in message composer. ui-r=bwinton, r=mkmelin
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -842,16 +842,18 @@ function updateComposeItems()
try {
// Edit Menu
goUpdateCommand("cmd_rewrap");
// Insert Menu
if (gMsgCompose && gMsgCompose.composeHTML)
{
goUpdateCommand("cmd_renderedHTMLEnabler");
+ goUpdateCommand("cmd_fontColor");
+ goUpdateCommand("cmd_backgroundColor");
goUpdateCommand("cmd_decreaseFont");
goUpdateCommand("cmd_increaseFont");
goUpdateCommand("cmd_bold");
goUpdateCommand("cmd_italic");
goUpdateCommand("cmd_underline");
goUpdateCommand("cmd_ul");
goUpdateCommand("cmd_ol");
goUpdateCommand("cmd_indent");
--- a/mail/components/compose/content/editorOverlay.xul
+++ b/mail/components/compose/content/editorOverlay.xul
@@ -137,18 +137,18 @@
<command id="cmd_indent" oncommand="goDoCommand('cmd_indent')"/>
<command id="cmd_outdent" oncommand="goDoCommand('cmd_outdent')"/>
<!-- the state attribute gets filled with the paragraph format before the command is exectued -->
<command id="cmd_paragraphState" state="" oncommand="doStatefulCommand('cmd_paragraphState', event.target.value)"/>
<command id="cmd_fontFace" state="" oncommand="doStatefulCommand('cmd_fontFace', event.target.value)"/>
<!-- No "oncommand", use EditorSelectColor() to bring up color dialog -->
- <command id="cmd_fontColor" state=""/>
- <command id="cmd_backgroundColor" state=""/>
+ <command id="cmd_fontColor" state="" disabled="false"/>
+ <command id="cmd_backgroundColor" state="" disabled="false"/>
<command id="cmd_highlight" state="transparent" oncommand="EditorSelectColor('Highlight', event);"/>
<command id="cmd_fontSize" oncommand="goDoCommand('cmd_fontSize')"/>
<command id="cmd_align" state=""/>
<command id="cmd_absPos" state="" oncommand="goDoCommand('cmd_absPos')"/>
<command id="cmd_increaseZIndex" state="" oncommand="goDoCommand('cmd_increaseZIndex')"/>
<command id="cmd_decreaseZIndex" state="" oncommand="goDoCommand('cmd_decreaseZIndex')"/>
@@ -923,23 +923,27 @@
</toolbaritem>
<toolbaritem id="color-buttons-container"
class="formatting-button">
<stack id="ColorButtons" align="center">
<observes element="cmd_fontColor" attribute="state" onbroadcast="onFontColorChange()"/>
<observes element="cmd_backgroundColor" attribute="state" onbroadcast="onBackgroundColorChange()"/>
<box class="color-button" id="BackgroundColorButton"
- onclick="if (!gWindowLocked) { EditorSelectColor('', event); }"
+ onclick="if (!this.hasAttribute('disabled')) { EditorSelectColor('', event); }"
tooltiptext="&BackgroundColorButton.tooltip;"
- oncommand="/* See MsgComposeCommands.js::updateAllItems for why this attribute is needed here. */"/>
+ oncommand="/* See MsgComposeCommands.js::updateAllItems for why this attribute is needed here. */">
+ <observes element="cmd_backgroundColor" attribute="disabled"/>
+ </box>
<box class="color-button" id="TextColorButton"
- onclick="if (!gWindowLocked) { EditorSelectColor('Text', event); }"
+ onclick="if (!this.hasAttribute('disabled')) { EditorSelectColor('Text', event); }"
tooltiptext="&TextColorButton.tooltip;"
- oncommand="/* See MsgComposeCommands.js::updateAllItems for why this attribute is needed here. */"/>
+ oncommand="/* See MsgComposeCommands.js::updateAllItems for why this attribute is needed here. */">
+ <observes element="cmd_fontColor" attribute="disabled"/>
+ </box>
</stack>
</toolbaritem>
<toolbarbutton id="HighlightColorButton"
class="formatting-button"
tooltiptext="&HighlightColorButton.tooltip;"
command="cmd_highlight">
<observes element="cmd_highlight" attribute="state" onbroadcast="onHighlightColorChange()"/>
<observes element="cmd_highlight" attribute="collapsed"/>