Opened 8 years ago

Closed 8 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 Garry Yao)

  1. Open the Ajax sample.
  1. Create four paragraphs, for example:
<p>  paragraph one</p>
<p>  paragraph two</p>
<p>  paragraph three</p>
<p>  paragraph four</p> 
  1. Select the two middle paragraphs.
  1. 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>&nbsp;</p>
<p><a href="http://dev.ckeditor.com">dev.ckeditor.com</a></p>
<p>&nbsp;</p>
<p>paragraph four</p> 

The selection should be fully replaced as expected.

Change History (1)

comment:1 Changed 8 years ago by Garry Yao

Description: modified (diff)
Resolution: invalid
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy