Opened 15 years ago
Closed 15 years ago
#6496 closed Bug (invalid)
Replacing multiple paragraphs with an element does not fully remove the paragraphs
| Reported by: | Joe Kavanagh | Owned by: | |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | General | Version: | 3.5 |
| Keywords: | IBM | Cc: | Damian Lynne Kues |
Description (last modified by )
- Open the Ajax sample.
- Create four paragraphs, for example:
<p> paragraph one</p> <p> paragraph two</p> <p> paragraph three</p> <p> paragraph four</p>
- Select the two middle paragraphs.
- Execute the following code
var anchor = editor.document.createElement('a');
anchor.setAttribute('href', 'http://dev.ckeditor.com');
anchor.setHtml('dev.ckeditor.com');
editor.insertElement(anchor);
Observe that the contents of the selected paragraphs have been removed, but the empty tags remain:
<p>paragraph one</p> <p> </p> <p><a href="http://dev.ckeditor.com">dev.ckeditor.com</a></p> <p> </p> <p>paragraph four</p>
The selection should be fully replaced as expected.
Change History (1)
comment:1 Changed 15 years ago by
| Description: | modified (diff) |
|---|---|
| Resolution: | → invalid |
| Status: | new → closed |

There're always multiple possibilities with the same selection, result is a case-by-case thing, so making assumption of any of the result is incorrect, for this case, range::enlarge(CKEDITOR.ENLARGE_BLOCK_CONTENTS) should be in prior to the element insertion to have what you expected.