codex-team / codex-team/editor.js

Pasting from MS Word places random new line characters in the paragraph text

Open
#2,350 5 comments 0 reactions 0 assignees View on GitHub
bug good first issue
Dominant language
TypeScript
Stars
31.9k
Forks
2.2k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

### Describe a bug.
When pasting from MS Word into the editor, random new line characters (\n) get placed into the resultant JSON [within the paragraph text itself].

### Steps to reproduce:
1. Open the editor
2. Copy from Word and paste.
3. Save
~~~json
{
"id": "1LRfwKqMBi",
"type": "paragraph",
"data": {
"text": "For three days it rained and everything he carried except\nfor..."
}
},
~~~
These line breaks are not in the Word doc. I looked at the xml inside the .docx. Also, if you type everything into the editor, it doesn't put random line breaks.

### Expected behavior:
No extra line breaks.

### Why does this matter?
My content management system has an option to strip all line breaks before delivering the html to the browser to cut down on final size.

~~~html
......
~~~
I can't activate that option because then the paragraphs with random line breaks have words mashed together.

### Editor.js version:
v2.26.5

### Plugins you use with their versions:
No plugins

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.