Opened 3 years ago

Last modified 3 years ago

#14393 confirmed Bug

New line after styled elements creates inline context which breaks pasting block elements.

Reported by: kkrzton Owned by:
Priority: Normal Milestone:
Component: Core : Pasting Version: 4.4.8
Keywords: Cc:

Description

There are 3 cases for pasting block elements (e.g. headers):

  1. Pasting multilined block element always creates block element (when pasted inside inline or block context)
  2. Pasting singlelined block element creates:
    1. Inline element when pasted inside inline context
    2. Block element when pasted inside non-inline context

This is desirable behavior which works pretty well, but there is one case which breaks pasting block elements.

After creating a new line (by pressing enter) from end of the line with styled/formatted text, e.g. bolded text like <p><strong>Line1</strong></p>, new line is <p><strong>^</strong></p> so the typing is still in bold. But when block element is pasted inside this new line, it is treated as pasted inside inline context and changed to inline element - which is rather non-intuitive behavior. The line contains only empty inline element so pasting probably should create block element instead of inlining it.

Steps to reproduce

  1. Go to http://ckeditor.com/demo
  2. Paste the following html <h1><strong>Line 1</strong></h1><p>Line 2</p> in the source mode
  3. Switch back to WYSIWYG mode and select Line 1
  4. Click h1 tag on the bottom bar of the editor (where path of selected element is visible) to make sure header is correctly selected
  5. Press Ctrl + C to copy selection
  6. Click on the end of the line
  7. Press Enter and Ctrl + V to paste copied header

Expected result

Pasted header should still be a bolded header.

Actual result

Pasted header is bolded text.

Other details (browser, OS, CKEditor version, installed plugins)

Tested in Chrome with CKEditor 4.5.7 and 4.4.8. In both versions of CKEditor this issue occurs.

Change History (1)

comment:1 Changed 3 years ago by kkrzton

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