[upstream] Allow copying semantic structure from Word without non-semantic styling to prevent insertion of extraneous non-breaking spaces

Created on 7 December 2023, 6 months ago
Updated 8 December 2023, 6 months ago

Note: Drupal.org does not allow uploading .docx files so I saved as a .odt file and then re-saved from that as a .docx file to verify the problem still occurred with the round-tripped file. It does.

Problem/Motivation

When I copy and paste text from a particular Word document, the paste procedure introduces non-breaking spaces which did not exist in the original.

Steps to reproduce

1. Launch Word and Chrome in Windows 11
2. In Word, open "test document.docx" (attached to issue)
3. In Chrome, go to https://simplytest.me
4. In the first field, type Drupal
5. Select the most recent version (10.2 rc for me)
6. Log in
7. Click Manage
8. Click Content
9. Click Add content
10. Click Basic page
11. Type title Test paste from Word
12. In Word, if codes are not revealed, click the reverse P icon to reveal codes.
13. Visually verify that the words between the spaces are actual plain spaces (which appear in reveal codes as a vertically-centered dot) and not non-breaking spaces (degree symbols, that is, raised small circles).
14. Use Ctrl-A to select the entire text.
15. Use Ctrl-C to copy the selected text.
16. In Chrome, click in the Body field
17. Use Ctrl-V to paste the selected text.
18. Click Save to publish
19. Copy the URL
20. Log out
21. Paste the URL
22. Narrow the browser window as much as the browser will let you.

Expected result: All text wraps to fit the window width.
Actual result: The text in the first sentence gets cut off.

23. Right-click the sentence that is cut off.
24. Choose Inspect

Expected result: There are no non-breaking spaces in the exposed code.
Actual result: There are multiple non-breaking spaces in the exposed code which were spaces in the source Word document.

Proposed resolution

Don't introduce non-breaking spaces on paste.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

10.2

Component
CKEditor 5 

Last updated about 8 hours ago

Created by

🇺🇸United States Charles Belov San Francisco, CA, US

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024