Opened 17 years ago
Closed 17 years ago
#1308 closed Bug (fixed)
Paragraph justification should not have default values
Reported by: | Frederico Caldeira Knabben | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | FCKeditor 2.5 Beta |
Component: | General | Version: | |
Keywords: | Discussion | Cc: |
Description
This ticket is not here to define our definitive approach for it, but to open a discussion around this argument.
With the recent rework made for the paragraph alignment features, we have also introduced an "automatic default" for the alignment buttons. It means that if the content is LTR, the left align button will be enabled by default. In RTL instead, the right align button will be highlighted instead.
It sounded nice in the beginning, but now I'm a little bit worried about it. Let me bring some thoughts so we can discuss about it.
Let's suppose we have the following HTML:
<p>This is a test.</p>
Looking at it as is, what is the alignment of this paragraph? "None", is the only correct answer. But FCKeditor says it is "Left Aligned" if LTR or "Right Aligned" if "RTL".
The document direction setting in FCKeditor are there just to help reflecting the final result we'll have when loading the contents at the target web site. But the fact is that the direction information is not in any way saved along with the HTML produced with the editor.
Now... what if I want to "force" the paragraph to be left aligned, even if the document is LTR. Here is a simple sample:
<td align="center"> <p>This is a test.</p> </td>
Here the editor is saying that my <p> is left aligned, which is not true. It is actually has no alignment specified, so it simply inherits it. But I can't make it left aligned, because the editor is saying that it is already to the left. There is a hack for it: align to right, and then to left.
Those are just some issues that came to my mind. I know MS Word has this default behavior, but is also true that MS Word is not made to produce pieces of content to be injected, as FCKeditor does. Who knows how creatively will the content be used by our developers base.
Maybe I'm wrong, so please correct me in this case.
Attachments (1)
Change History (5)
comment:1 Changed 17 years ago by
Milestone: | → FCKeditor 2.5 |
---|
comment:2 Changed 17 years ago by
Changed 17 years ago by
Attachment: | getStyleExperiment.html added |
---|
Getting paragraph alignment by getComputedStyle() and currentStyle attribute
comment:3 Changed 17 years ago by
Your proposal seams to be good Martin. Let's see the results of it.
comment:4 Changed 17 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed with [958].
Click here for more info about our SVN system.
A rationale for the automatic default alignment display is the rule of least astonishment - a user who have been using desktop word processors are used to seeing an alignment button highlighted to reflect how his paragraph is aligned visually. When the same user is using FCKeditor, he would expect the same behavior. So in my eyes, having the automatic default alignment display is a small usability feature.
The problem I see here, is whether the feature can be implemented correctly. Currently, the block alignment checking is done by checking for the align attribute, inline CSS properties, and associated CSS classes, in the nearest selected block. For many cases, the current alignment detection logic would detect the wrong alignment, like your given case, and things like these:
I've found a way to retrieve the visual text alignment directly, however. It works for even the traditional align attribute. We can use the getComputedStyle() method in Gecko, Opera and Safari, and the currentStyle attribute in IE.
I've created a test case for this. Similar logic is being used in the drag resize table plugin right now, so I'm pretty confident it will be ok.