Opened 16 years ago

Closed 16 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:

  1. Open replacebyclass.html in Firefox 3.
  2. Double click on the empty area to the right of the first paragraph to select the whole paragraph.
  3. Try to apply any style, e.g. press the bold button.
  4. It doesn't work.

Attachments (3)

2797.patch (2.6 KB) - added by Martin Kou 16 years ago.
2797_2.patch (3.1 KB) - added by Martin Kou 16 years ago.
2797_3.patch (1.1 KB) - added by Frederico Caldeira Knabben 16 years ago.

Download all attachments as: .zip

Change History (16)

comment:1 Changed 16 years ago by Artur Formella

Keywords: Confirmed Firefox added

comment:2 Changed 16 years ago by Garry Yao

It works for me with FF3.0.5

comment:3 Changed 16 years ago by Martin Kou

Owner: set to Martin Kou
Status: newassigned

comment:4 Changed 16 years ago by Martin Kou

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 16 years ago by Martin Kou

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 16 years ago by Martin Kou

Attachment: 2797.patch added

comment:6 Changed 16 years ago by Martin Kou

Keywords: Review? added

comment:7 Changed 16 years ago by Martin Kou

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 16 years ago by Martin Kou

Keywords: Review? removed

Retracted review request, the patch seems to cause other problems with inline styles.

Changed 16 years ago by Martin Kou

Attachment: 2797_2.patch added

comment:9 Changed 16 years ago by Martin Kou

Keywords: Review? added

Ok, the bug with the previous patch should be fixed.

comment:10 Changed 16 years ago by Frederico Caldeira Knabben

Keywords: Review- added; Review? removed
Owner: changed from Martin Kou to Frederico Caldeira Knabben
Status: assignednew

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 16 years ago by Frederico Caldeira Knabben

Attachment: 2797_3.patch added

comment:11 Changed 16 years ago by Frederico Caldeira Knabben

Keywords: Review? added; Review- removed
Status: newassigned

comment:12 Changed 16 years ago by Garry Yao

Keywords: Review+ added; Review? removed

comment:13 Changed 16 years ago by Frederico Caldeira Knabben

Resolution: fixed
Status: assignedclosed

Fixed with [3209].

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy