Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#101 closed defect (fixed)

Text color highlight doesn't work in Mozilla

Reported by: anonymous Owned by: gogo
Priority: normal Milestone:
Component: Xinha Core Version:
Severity: normal Keywords:
Cc:

Description

If you highlight some text and then try to hightlight the background color it doesn't work with Mozilla, but works fine with IE. Popup appears for color selection, but selecting it doesn't make any change to the source HTML or the WYSIWYG window

Tested with both the daily build and the stable release

Change History (7)

comment:1 Changed 12 years ago by anonymous

  • Component changed from Plugin - Fullscreen to Xinha Core

comment:2 Changed 12 years ago by anonymous II

I have the same problem.

An additional detail:

I'm using xinha V 3.0 ( the ticket form only goes up to 2.0. I downloaded the recent-stable version this morning ( 28/0/2005 )).

If I highlight a text region and try to use the Background Color widgit to change the background color, nothing happens. No errors are generated and nothing is added to the text region.

The BG color thing works OK in IE 6. The HTML changes made with IE 6 work on FF 1.0, that is, once edited with IE 6, the changes work as advertized in FF.

Strangely, when I look at the result with IE 6, the region is set:

  <font style="BACKGROUND-COLOR: #123456">Blah blah...</font>

When I read it with FF I see:

  <font style="background-color: rgb( 123, 123, 123 );">Blah blah...</font>

I don't know who's doing the translating, or at what stage. I think its FF translating what it reads, but amn't sure.

Maybe FF is sensitive to the "#xxyyzz" format inside JS/XUL.

comment:3 Changed 12 years ago by Mike Harris

This happens in Mozilla because of line 2788 in htmlarea.js:

if (HTMLArea.is_gecko) try { this._doc.execCommand('useCSS', false, true); } catch (e) {};

This line is specific to Xinha and was not carried over from htmlarea 3. If you comment it out, background color begins working again in Firefox, etc.

comment:4 Changed 12 years ago by gogo

anonymous II: don't use the stable, use the nightly.

Mike: useCSS is to make Gecko behave more like IE, specifically so it won't use <span> all over the place (the behaviour of useCSS is "backwards" you set it to true to turn it off, and false to turn it on - https://bugzilla.mozilla.org/show_bug.cgi?id=239927).

The correct way to fix this would be to do a periodic scan of font tags in the editor and convert any split rgb background-colors it finds to hex triplet format (or vice-versa for IE).

comment:5 Changed 12 years ago by JC Meyrignac

Mike Harris was right about the useCSS. The trick is to disable the useCSS BEFORE and reenable it after the execCommand.

if (HTMLArea.is_gecko) try { editor._doc.execCommand('useCSS', false, false);} catch (e) {};
editor._doc.execCommand(cmdID, false, "#" + color);
if (HTMLArea.is_gecko) try { editor._doc.execCommand('useCSS', false, true); } catch (e) {};

This works fine with Firefox 1.3.

comment:6 Changed 12 years ago by niko

  • Resolution set to fixed
  • Status changed from new to closed

this is a mozilla bug, so please vote for it :D
https://bugzilla.mozilla.org/show_bug.cgi?id=279330

meanwhile as a workaround i commited something that switches off the useCSS for hillitecolor
changeset:103

comment:7 Changed 12 years ago by kim@…

My vote is in, :)

Note: See TracTickets for help on using tickets.