From: stan Date: Fri, 8 Jul 2011 15:34:32 +0000 (-0400) Subject: [BUGFIX] htmlArea RTE: Text indicator refers to deleted color conversion function... X-Git-Tag: TYPO3_4-6-0alpha3~57 X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/commitdiff_plain/975eef44447367b4f1e4fef330d9faa35e7ae602?ds=sidebyside [BUGFIX] htmlArea RTE: Text indicator refers to deleted color conversion function aliases The function aliases were deleted as part of TYPO3 4.6 cleanup. Change-Id: I5f386cbd1c7e32e46440b4621fc9279ba1aa7cf8 Resolves: #27994 Related: #25093 Releases: 4.6 Reviewed-on: http://review.typo3.org/3154 Reviewed-by: Stanislas Rolland Tested-by: Stanislas Rolland --- diff --git a/typo3/sysext/rtehtmlarea/htmlarea/plugins/TextIndicator/text-indicator.js b/typo3/sysext/rtehtmlarea/htmlarea/plugins/TextIndicator/text-indicator.js index 54d6e1c9811..01b4675d28e 100644 --- a/typo3/sysext/rtehtmlarea/htmlarea/plugins/TextIndicator/text-indicator.js +++ b/typo3/sysext/rtehtmlarea/htmlarea/plugins/TextIndicator/text-indicator.js @@ -66,31 +66,35 @@ HTMLArea.TextIndicator = Ext.extend(HTMLArea.Plugin, { onUpdateToolbar: function (button, mode, selectionEmpty, ancestors) { var editor = this.editor; if (mode === 'wysiwyg' && editor.isEditable()) { - var doc = editor._doc; + var doc = editor.document; + var style = { + fontWeight: 'normal', + fontStyle: 'normal' + }; try { - var style = { - backgroundColor: HTMLArea._makeColor(doc.queryCommandValue((Ext.isIE || Ext.isWebKit) ? 'BackColor' : 'HiliteColor')), - color: HTMLArea._makeColor(doc.queryCommandValue('ForeColor')), - fontFamily: doc.queryCommandValue('FontName'), - fontWeight: 'normal', - fontStyle: 'normal' - }; - // Mozilla - if (/transparent/i.test(style.backgroundColor)) { - style.backgroundColor = HTMLArea._makeColor(doc.queryCommandValue('BackColor')); - } - try { - style.fontWeight = doc.queryCommandState('Bold') ? 'bold' : 'normal'; - } catch(e) { - style.fontWeight = 'normal'; - } - try { - style.fontStyle = doc.queryCommandState('Italic') ? 'italic' : 'normal'; - } catch(e) { - style.fontStyle = 'normal'; - } - button.getEl().setStyle(style); + // Note: IE always reports FFFFFF as background color + style.backgroundColor = HTMLArea.util.Color.colorToRgb(doc.queryCommandValue((Ext.isIE || Ext.isWebKit) ? 'BackColor' : 'HiliteColor')); + style.color = HTMLArea.util.Color.colorToRgb(doc.queryCommandValue('ForeColor')); + style.fontFamily = doc.queryCommandValue('FontName'); } catch (e) { } + // queryCommandValue does not work in Gecko + if (Ext.isGecko) { + var computedStyle = editor._iframe.contentWindow.getComputedStyle(editor.getParentElement(), null); + style.color = computedStyle.getPropertyValue('color'); + style.backgroundColor = computedStyle.getPropertyValue('background-color'); + style.fontFamily = computedStyle.getPropertyValue('font-family'); + } + try { + style.fontWeight = doc.queryCommandState('Bold') ? 'bold' : 'normal'; + } catch(e) { + style.fontWeight = 'normal'; + } + try { + style.fontStyle = doc.queryCommandState('Italic') ? 'italic' : 'normal'; + } catch(e) { + style.fontStyle = 'normal'; + } + button.getEl().setStyle(style); } } });