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

Webkit: Pasting styled word before space and pressing arrow key removes visual space. #2128

Open jswiderski opened 6 years ago

jswiderski commented 6 years ago

Type of report

Bug

Provide detailed reproduction steps (if any)

  1. Open https://sdk.ckeditor.com/samples/classic.html
  2. Select 'spaceflight ' with leading space and make it bold.
  3. Copy the word and paste it before space of to word - first^ to step
  4. Press right arrow key

Expected result

There should be two spaces after the word spaceflight.

Actual result

One of two spaces gets removed.

Other details

In standard contenteditable element pasting results in to<strong>spaceflight&nbsp;</strong>&nbsp;step... while in CKEditor to<strong>spaceflight </strong>​​​​​​​​​​​​​​&#8203;&#8203;&#8203;&#8203;&#8203;&#8203;&#8203; step...

As you can see in standard editable element there are two &nbsp; created while in CKEditor there are regular spaces separated by ZWS characters. Once arrow key is press ZWS characters are removed and two standard spaces are shown as one (what is a standard in HTML).

Please also see attached screen-cast: zws-paste-space.zip

jswiderski commented 6 years ago

It seems, you can work around this problem by applying below rule to paragraph in contents.css file (classic editor) or main page CSS file (inline editor).

p {
    white-space: pre-wrap;
}