Ticket #3231 (closed Bug: fixed)
Unable to apply inline styles when selection touches end of area with the same style already applied.
| Reported by: | martinkou | Owned by: | garry.yao |
|---|---|---|---|
| Priority: | High | Milestone: | CKEditor 3.0 |
| Component: | Core : Styles | Version: | SVN (CKEditor) - OLD |
| Keywords: | Oracle Review+ | Cc: | Senthil |
Description
To reproduce:
- Open replacebyclass.html in Windows Firefox.
- Double click on the first word "This ".
- Click the Bold button - the text is bolded.
- Double click on the second word "is ".
- Click the Bold button again.
- Nothing happens.
Attachments
Change History
comment:1 Changed 4 years ago by garry.yao
- Status changed from new to assigned
- Owner set to garry.yao
comment:2 in reply to: ↑ description Changed 4 years ago by garry.yao
- Status changed from assigned to closed
- Resolution set to duplicate
comment:3 Changed 4 years ago by fredck
- Status changed from closed to reopened
- Resolution duplicate deleted
comment:4 Changed 4 years ago by garry.yao
- Keywords Review? added
The proposed path now checking the range root node instead of the first node for disambiguition explained here.
comment:6 Changed 4 years ago by fredck
- Keywords Review- added; Review? removed
i think the right fix here would have getStartElement returning the proper element in this situations.
After a chat with Garry, it looks like the correct solution would have this range...
<p> <strong>This ^</strong>is^ some ....
... getting fixed to this...
<p> <strong>This </strong>^is^ some ....
... in this case before trying to detect the start element (for non collapsed selections only).
comment:7 Changed 4 years ago by garry.yao
- Keywords Review? added; Review- removed
The new patch is proposing the following changes:
- Introduce a new method of 'shrink' as well as related TC, which helps to deal with the above situation;
- Moving 'getChild' and 'getChildCount' from node.js into element.js where they should belonged to.
comment:8 Changed 4 years ago by fredck
- Keywords Review- added; Review? removed
The solution is good, and it works well.
I just see one problem here. You are introducing a new public function to the API (range::shrink), but that function is not complete because it doesn't consider two features that we don't need to care about for now:
- It acts only in the start boundary (as specified in the comments).
- It should have no effect in a collapsed range.
As we don't need the above features, it makes less sense placing them into the API just to make the shrink function complete. So I think it's better to simply move the code into line 626 at the selection plugin (adding a comment about it, pointing to this ticket).
Also, some minor enhancements to the code:
- Instead of "getText().length" you can use "getLength()".
- "this.startContainer" has been used four times in that code block. It would be better to have a local variable to point to it.
comment:10 Changed 4 years ago by fredck
- Keywords Review+ added; Review? removed
Instead of doing do{}while(true), you can can go simpler with while(true){} . Please fix it before committing.
comment:11 Changed 4 years ago by garry.yao
- Status changed from reopened to closed
- Resolution set to fixed
