codex-team / codex-team/editor.js
<br> tags not retained
- Dominant language
- TypeScript
- Stars
- 31.9k
- Forks
- 2.2k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
In a paragraph block, tapping shift-return shows a new line within the paragraph but there is no html to retain it once returned to the editor.
In short, typing the following:
```
Some stuff goes here.
A second line.
```
when returned to the editor it shows:
`Some stuff goes here.A second line.`
Full code:
```
const editor = new EditorJS({
// Id of Element that should contain the Editor
holder: 'app',
autofocus: true,
placeholder: 'Type here...',
// onReady callback
onReady: function() {
console.log('Editor.js is ready to work!')
},
// Previously saved data that should be rendered
data: {},
// onChange callback
onChange: function(api, event) {
console.log('Now I know that Editor\'s content changed!', event)
editor.save().then((outputData) => {
console.log('Article data: ', outputData)
console.log(JSON.stringify(outputData))
}).catch((error) => {
console.log('Saving failed: ', error)
});
},
```
The output from `JSON.stringify(...)` is as follows:
`{"time":1667747677067,"blocks":[{"id":"dieP2NpLBH","type":"paragraph","data":{"text":"Some stuff goes here.A second line."}},{"id":"mqozmvKlE9","type":"paragraph","data":{"text":"A new paragraph."}}],"version":"2.25.0"}
`
I took this output and pasted back into `data:` and refreshed the browser to see that the soft return was not retained. Given that, you can see from the JSON output that it is missing the `
` tag between `here.` and `A second line`.
Device, Browser, OS: MacBook Pro M1, MacOS 12.6.1, Safari 16.1
Editor.js version: 2.25.0
Plugins you use with their versions: none
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.