ckeditor / ckeditor4

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

set Html to the editor removes the last BR #4320

Open KARTHIKSK92 opened 4 years ago

KARTHIKSK92 commented 4 years ago

Type of report

Bug

Provide detailed reproduction steps (if any)

  1. Configure CKEditor with the following settings. CKEDITOR.replace( 'editor', { enterMode : CKEDITOR.ENTER_BR, allowedContent : true });

2.Sample for the above setup: https://gist.github.com/tanmoyckeditor/aed98752dece0a69447308b4f1a9d953

  1. Copy some multi-line text with an empty newline at the end of the text.(In the Example I copied 3 lines of text with 2 new lines )
  2. Paste it on a standalone CKEditor.

5.From the source tab remove the last BR and the nbsp; . we have two BR's in the source tab

Expected result

only two new lines should be seen

Actual result

last BR is removed by the CKEditor

Other details

ckeditor-last-line-trimming-when-we-sethtml-to-editor

Comandeer commented 4 years ago

I can confirm the issue, is present also in other browsers.

tanmoyckeditor commented 4 years ago

Is there are workaround that you can provide for this issue, since this is impacting multiple browsers (IE11 and Chrome)?

Comandeer commented 4 years ago

@tanmoyckeditor, unfortunately there is no simple workaround for this issue. However you can leave the   at the end, which should prevent deleting the br.