codex-team / codex-team/editor.js

OutputData is wrongly manipulated and does not match expected output

Open
#1,072 11 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
31.9k
Forks
2.2k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

## Current Setup

Documented and prepared in this [codesandbox example](https://codesandbox.io/s/vibrant-sun-ggivk).

Note: It _doesn't matter if this is tested with or without react_ (I've prepared both, see links below)

## Current Setup

Let's assume I've a the following data object:

```js
export const data = {
blocks: [
{
type: 'header',
data: {
text: 'Editor.js',
level: 2,
},
},
{
type: 'react',
data: {
url: 'remote.adjust.rotate=0&remote.size.w=5575&remote.size.h=3717',
},
},
],
}
```

When passing this later on to EditorJS everything works fine (note: tested in a react setup, but it does not really matter if it's plain js or not).

## Current Problem

When I now get the data from the editor with `await editor.save()` the data is corrupt and looks like this:

```
{
type: 'react',
data: {
url: 'remote.adjust.rotate=0&remote.size.w=5575&remote.size.h=3717',
},
},
```

`remote.adjust.rotate=0&` vs. `remote.adjust.rotate=0&remote...` :/

This only happens since `@editorjs/editorjs@2.17.0` in the latest `2.16` release everything works still (see [codesandbox with `2.16.1`](https://codesandbox.io/s/vigilant-cookies-1o7bj)).

## Example Apps

- @editorjs/editorjs@2.17 with the bug: https://codesandbox.io/s/vibrant-sun-ggivk
- @editorjs/editorjs@2.16 **without the bug**: https://codesandbox.io/s/vigilant-cookies-1o7bj
- @editorjs/editorjs@2.17 (**without react**): https://codepen.io/natterstefan/pen/dyPjaVx?editors=1111

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.