question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] editor.render with "blocks":[] breaks the editor

See original GitHub issue

(Not sure if exact duplicate of https://github.com/codex-team/editor.js/pull/1741 )

Steps to reproduce:

  1. call editor.render with this json: {“time”:1655483036373,“blocks”:[],“version”:“2.24.3”}
  2. Observe editor gives errors in console, and it is now impossible to add blocks or type into the editor.

Expected behavior: Editor operates as normal, with either no blocks present or with one default block.

Workaround: If you make a blank document and save it, it returns “blocks”:[]. However you cannot load this to get back your blank document. I’ve had to manually change blank documents to have instead: “blocks”:[{“id”:“dvSFGiwGIy”,“type”:“paragraph”,“data”:{“text”:“”}}] With at least one block, the file loads correctly.

Screenshots: I get three different errors when clicking around on the broken editor:

Editor.js 2.24.3 There is no block at index -1 8 editor.js:1:3853 Uncaught TypeError: this.Editor.BlockManager.lastBlock is undefined Uncaught TypeError: s is undefined value editor.js:1 value editor.js:1 value editor.js:1 on editor.js:1 value editor.js:1 value editor.js:1 t editor.js:1 l editor.js:1 _invoke editor.js:1 e editor.js:1 n editor.js:1 s editor.js:1 exports editor.js:1 exports editor.js:1 value editor.js:1 t editor.js:1 l editor.js:1 _invoke editor.js:1 e editor.js:1 n editor.js:1 s editor.js:1 exports editor.js:1 exports editor.js:1 value editor.js:1 t editor.js:1 l editor.js:1 _invoke editor.js:1 e editor.js:1 n editor.js:1 s editor.js:1 exports editor.js:1 exports editor.js:1 promise callback*t/</< editor.js:1 t editor.js:1 l editor.js:1 _invoke editor.js:1 e editor.js:1 n editor.js:1 s editor.js:1 exports editor.js:1 exports editor.js:1 value editor.js:1 t editor.js:1 l editor.js:1 _invoke editor.js:1 e editor.js:1 n editor.js:1 s editor.js:1 promise callback*n editor.js:1 s editor.js:1 promise callback*n editor.js:1 s editor.js:1 exports editor.js:1 exports editor.js:1 promise callback*t editor.js:1 t editor.js:1 <anonymous> book.js:1 <anonymous> book.js:1 <anonymous> book.js:1 Device, Browser, OS:

Device, Browser, OS: Desktop/Firefox/Windows 10

Editor.js version: 2.24.3

Plugins you use with their versions: paragraph@2.8.0 header@2.6.2 simple-image@1.4.1 delimiter@1.2.0

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

3reactions
AlexRMUcommented, Oct 29, 2022

Instead of blocks: [], use blocks: [{ type: "paragraph", data: {} }]

1reaction
dafrinacommented, Sep 14, 2022

this is a real problem for me… is there any way to check if the editor is empty? i found that editor.clear() works but editor.render() breaks so if i could check if its empty and call a clear before safing that would fix it

Since the devs dont seem to care to address one of the most basic functionalities of an editor I resolved it by making sure the editor is never empty. Initialize it with a block saying „enter content here“ or something and dont save when the editor is empty.

Read more comments on GitHub >

github_iconTop Results From Across the Web

turning off render content in editor breaks embed - Bug Reports - our ...
Hi Michiel,. Am I right in understanding that when you stop the macro from rendering in the backend node editor, then insert the...
Read more >
Workaround: On Page Editing broken after rendering a block
After rendering a block that doesn't have a controller but instead is rendered using only a partial view (which, as we know, is...
Read more >
The 1.2.8 update breaks the post editor - WordPress.org
Today I updated the plugin to 1.2.8 but the post editor completely breaks. By “break” I mean the right-side toolbar disappears, the title...
Read more >
URP Rendering bug - breaking full pipeline - Unity Forum
If I toggle the camera on and off I get: Code (CSharp):. AssertionException: Editor camera must resolve target upon finish rendering.
Read more >
4 Common render problems in Blender and how to solve them
There are many potential problems when it comes to rendering. ... By default, there is no video editing workspace open in Blender. To...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found