OutputData is wrongly manipulated and does not match expected output
See original GitHub issueCurrent Setup
Documented and prepared in this codesandbox example.
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:
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
).
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
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Database Engine events and errors - SQL Server
Consult this MSSQL error code list to find explanations for error messages for SQL Server database engine events.
Read more >dplyr Tutorial : Data Manipulation (50 Examples) - ListenData
LEFT JOIN : It returns all rows from the left table, even if there are no matches in the right table. left_join(df1, df2,...
Read more >API Testing Tips | How To Test APIs - Katalon
Here are the 10 basic tips that you need to know for API testing. ... that the API returns an appropriate response when...
Read more >SUGI 27: Tips for Manipulating Data - SAS Support
To place the OBS= option on the input data set can result in an output data set containing 0 to 5 observations, depending...
Read more >What is Data Flow Diagram? - Visual Paradigm
Also known as DFD, Data flow diagrams are used to graphically represent the ... of DFD mistakes arise when the outputs from one...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @natterstefan
Thanks for the reminder 😃
A method that sanitizes blocks after save called is here — https://github.com/codex-team/editor.js/blob/master/src/components/modules/sanitizer.ts#L59
As you can see, if there is no sanitize config of any kind, it returns data as it is. But the problem is there is always sanitize config for inline-tools as this method appends
br
andwbr
tags (2.17 changes).The solution is actually simple — if a tool doesn’t provide
inlineToolbar
option, return an empty object fromgetInlineToolsConfig
.The second step would be to decode HTML entities after sanitize, but as we include inline tags to Editor’s output, it would break the markup
Hi @natterstefan Thanks for the report! It seems we need to escape entities after saving as html-janitor inserts data to temp DOM nodes on sanitizing