Ticket #5536 (closed Bug: fixed)
Problems with pasting (executing insertHtml) and formatted text
| Reported by: | wwalc | Owned by: | tobiasz.cudnik |
|---|---|---|---|
| Priority: | Normal | Milestone: | CKEditor 3.5 |
| Component: | General | Version: | 3.2.1 |
| Keywords: | Firefox | Cc: |
Description
This is actually a duplicate of #5170, but since that ticket was already reviewed and committed, here's another one (I guess [5273] should be reverted as the issue was misunderstood).
Note that this bug occurs when pasting any content, this is not an issue that exists only when pasting special character.
Updated description below:
When inserting content with insertHtml() inside of formatted text, editor breaks formatting and inserts content without formatting. Confirmed in FF 3.5. Works fine in IE8 and Safari 4.
Steps to reproduce
- open _samples/api.html example
- start with
<p> <span style="color: rgb(255, 0, 0);">Sample ^text</span></p>
- clear the textarea below CKEditor and type there "foo"
- press "Insert HTML"
- Result:
<p> <span style="color: rgb(255, 0, 0);">Sample </span>foo<span style="color: rgb(255, 0, 0);">text</span></p>
This can be reproduced in many different ways in CKEditor, everywhere where insertHtml() is used.
Targetting to 3.3 as it might be a bit irritating.
Attachments
Change History
comment:1 Changed 3 years ago by garry.yao
- Status changed from new to assigned
- Owner set to garry.yao
comment:3 Changed 3 years ago by garry.yao
- Status changed from assigned to new
- Owner garry.yao deleted
We'll be working on this at #5309.
comment:5 Changed 3 years ago by tobiasz.cudnik
- Owner set to tobiasz.cudnik
- Status changed from confirmed to assigned
comment:7 Changed 3 years ago by tobiasz.cudnik
- Status changed from assigned to review
This is temporally fix before #5309 will be finished.
comment:8 Changed 3 years ago by garry.yao
- Status changed from review to review_failed
A temporary fix would not be a catch-all that replace entirely the original, but instead targeting only this specific case.
comment:9 Changed 3 years ago by tobiasz.cudnik
What would be a more specific case for this issue than targeting only Firefox ?
comment:10 Changed 3 years ago by tobiasz.cudnik
This patch may also fix #2204 for Opera.
comment:11 Changed 3 years ago by garry.yao
Browsers (especially Firefox) deliver context-based fixes on 'insertHtml', examples like pasting list and tables. The problem here is with text node only, the patch fixes this specific case here while it could potentially breaks even more, in case an emergent fix is really required, it should be well surged.
comment:12 Changed 3 years ago by garry.yao
- Milestone changed from CKEditor 3.4.2 to CKEditor 3.5
Defer this ticket to 3.5, if #5309 is not completed in 3.5, at least we could have this one as backup.
comment:13 Changed 2 years ago by garry.yao
- Status changed from review_failed to closed
- Resolution set to fixed
Now that we've reworked the editor::insertText method which should be relied on instead for inserting plain text (where styles context are inherited).

Ok, let's try to provide a managed the 'paste' command with our own logics.