moorte icon indicating copy to clipboard operation
moorte copied to clipboard

justify problem

Open frozeman opened this issue 13 years ago • 3 comments

when i select a justify he adds always a new highlighted justify button without removing the old one (e.g. add justify right doesnt remove the highlighting f justify left)

frozeman avatar Mar 06 '11 18:03 frozeman

and in CHROME the buttons are not even highlighted

frozeman avatar Mar 06 '11 18:03 frozeman

This is fixed in the latest commit in develop. Will be working more on it today.

There are actually two issues here. The first is:

There are two different commands used to check the state of editable content: queryCommandState('justifyLeft'); queryCommandValue('justifyLeft'); The first returns a boolean - either justifyLeft is true [the content is justified to the left] or it is false. The second returns a string - either 'left', 'right', 'full', or 'center'.

It seems that somewhere along the line the Webkit team decided that 'center' is not a logical return value when checking for 'justifyLeft', and made queryCommandValue('justifyLeft') return the string "false" when content is centered. This is doubly insidious, as the string 'false' actually evaluates to true!!

The solution is to use queryCommandState which is correctly handled by Webkit and Firefox

siteroller avatar May 22 '12 07:05 siteroller

The second issue is the default value. In earlier versions of Firefox and current versions of Webkit, until a justify type is set on the content, it defaults to not being justified. This is rather inane, as the content is obviously being justified somehow - not letting us know how doesn't help anything. I imagine that if we check the CSS for the direction, text-align, and text-justify we can identify the default justification, and then set it on the editor. This would be a rather messy procedure, and will be fiddling with it.

Open to any other ideas if you have them. Until this is fixed, justify will work and will be updated correctly, but in Chrome it will not show the default justification till one of the buttons are pressed.

siteroller avatar May 22 '12 08:05 siteroller