ckeditor / ckeditor4

The best enterprise-grade WYSIWYG editor. Fully customizable with countless features and plugins.
https://ckeditor.com/ckeditor-4
Other
5.79k stars 2.47k forks source link

Deleting content spanning different tags messes up html structure #2279

Open jbalsas opened 6 years ago

jbalsas commented 6 years ago

Type of report

Bug

Provide detailed reproduction steps (if any)

  1. Navigate to https://ckeditor.com/ckeditor-5/ (or https://ckeditor.com/ckeditor-4/)
  2. Select content spanning different tags, header and paragraph (see animated attachment) making sure all the content in the header block is selected
  3. Press backspace to delete the selection

Expected result

The second block of content remains untouched and inside a <p> element rather than collapsing into the <h*> element.

Actual result

The second block of content remains untouched and inside a <p> element rather than collapsing into the <h*> element.

Other details

This might make sense when partially selecting a preceding tag, but when selecting it completely the expectation is more likely to remove the tag completely.

delete_h1

msamsel commented 6 years ago

Hi @jbalsas, this behaviour is not related to editor itself. It's native behaviour of browsers. Please taka a look at this simple sample. https://codepen.io/msamsel/pen/YjLGKz

Changing this behaviour would be more likely some feature request.

jbalsas commented 6 years ago

Hey @msamsel, thanks for the quick response!

I wouldn't mind turning this into a feature request. I'd expect at least this should be better and easier to do in CK5, seeing as it is no longer backed by DOM.

At least in the case where a user selects all contents inside a tag and just partially the contents in the next one... said user would likely expect to keep the latter tag and not see those contents collapsed in something that was meant to be completely deleted.

msamsel commented 6 years ago

@jbalsas as CKEditor5 is separate project please report the case in its repository here: https://github.com/ckeditor/ckeditor5

I'll make the feature request from this then.