Opened 9 years ago
Last modified 9 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):
- Pasting multilined block element always creates block element (when pasted inside inline or block context)
- Pasting singlelined block element creates:
- Inline element when pasted inside inline context
- 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
- Go to http://ckeditor.com/demo
- Paste the following html
<h1><strong>Line 1</strong></h1><p>Line 2</p>
in the source mode - Switch back to WYSIWYG mode and select Line 1
- Click h1 tag on the bottom bar of the editor (where path of selected element is visible) to make sure header is correctly selected
- Press Ctrl + C to copy selection
- Click on the end of the line
- 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.