Opened 17 years ago
Closed 17 years ago
#2797 closed Bug (fixed)
Styles cannot be applied when a whole paragraph is selected
| Reported by: | Martin Kou | Owned by: | Frederico Caldeira Knabben |
|---|---|---|---|
| Priority: | Must have (possibly next milestone) | Milestone: | CKEditor 3.0 |
| Component: | General | Version: | SVN (FCKeditor) - Retired |
| Keywords: | Confirmed Firefox Review+ | Cc: |
Description
To reproduce:
- Open replacebyclass.html in Firefox 3.
- Double click on the empty area to the right of the first paragraph to select the whole paragraph.
- Try to apply any style, e.g. press the bold button.
- It doesn't work.
Attachments (3)
Change History (16)
comment:1 Changed 17 years ago by
| Keywords: | Confirmed Firefox added |
|---|
comment:2 Changed 17 years ago by
comment:3 Changed 17 years ago by
| Owner: | set to Martin Kou |
|---|---|
| Status: | new → assigned |
comment:4 Changed 17 years ago by
It works sometimes, but other times it doesn't work. I've tested under Firefox 3.0.5 with OSX Leopard and Windows XP.
comment:5 Changed 17 years ago by
Ok, I think I've found a way to reliably reproduce this.
The trick to reproduce the bug is to triple click on the right side of the paragraph. Double click doesn't seem to trigger the bug.
Changed 17 years ago by
| Attachment: | 2797.patch added |
|---|
comment:6 Changed 17 years ago by
| Keywords: | Review? added |
|---|
comment:7 Changed 17 years ago by
The problem was found to be caused by line 226 in the style plugin. Whenever the user triple clicks to the right of a paragraph, the selection range becomes like this:
<p>^This is some <b>sample text</b>. You ...^</p>
Line 226 in the style plugin expands the selection range to include the outermost element. Thus, after line 226, the range becomes like this:
^<p>This is some <b>sample text</b>. You ...</p>^
The logic after line 226 assumes everything in the range is inline stuff, but turns out we've got a block in the range. So the range is ignored.
My patch adds a mode to CKEDITOR.dom.range::enlarge() called CKEDITOR.ENLARGE_INLINE_ELEMENTS. It does the same thing as CKEDITOR.ENLARGE_ELEMENT, but stops when a non-inline element is met.
comment:8 Changed 17 years ago by
| Keywords: | Review? removed |
|---|
Retracted review request, the patch seems to cause other problems with inline styles.
Changed 17 years ago by
| Attachment: | 2797_2.patch added |
|---|
comment:9 Changed 17 years ago by
| Keywords: | Review? added |
|---|
Ok, the bug with the previous patch should be fixed.
comment:10 Changed 17 years ago by
| Keywords: | Review- added; Review? removed |
|---|---|
| Owner: | changed from Martin Kou to Frederico Caldeira Knabben |
| Status: | assigned → new |
The problem here is not really the "enlarge" call, which is correct and has the expected behaviour. The real problem is that the <p> is set as the first node to be processed *and* the last node, which stops processing. So, nothing happens.
There is a simple solution for it. I'll come with a new patch.
Changed 17 years ago by
| Attachment: | 2797_3.patch added |
|---|
comment:11 Changed 17 years ago by
| Keywords: | Review? added; Review- removed |
|---|---|
| Status: | new → assigned |
comment:12 Changed 17 years ago by
| Keywords: | Review+ added; Review? removed |
|---|

It works for me with FF3.0.5