Blocks#render doesn't work (API)
See original GitHub issueHello. I have a basic editorJS setup, with only the header tool and a testtool. I’m trying to use the blocks#render function in the API. This is my tool.
class MyTool {
constructor({data, api}){
this.api = api;
// ...
setTimeout(() => {
this.test();
}, 1000);
}
test() {
this.api.blocks.render(
[
{
type: "header",
data: {
text: "New header",
level: 2
}
}
]
);
}
}
It’s almost a direct copy from the docs.
When I load the page, everything is fine. After one second the function “test” is called and the editor is blank.
I get this error in my console.
Uncaught (in promise) TypeError: Cannot read property 'map' of undefined
at e.<anonymous> (editorjs@latest:6)
at c (editorjs@latest:6)
at Generator._invoke (editorjs@latest:6)
at Generator.forEach.t.<computed> [as next] (editorjs@latest:6)
at c (editorjs@latest:6)
at e (editorjs@latest:6)
at editorjs@latest:6
at new Promise (<anonymous>)
at r (editorjs@latest:6)
at S._invoke (editorjs@latest:6)
Am I doing something wrong or is this a bug?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How can I block a React component to be rendered until I ...
The information will be provided by an API and fetched with an ajax call. I'm just trying to wait 10 seconds before rendering...
Read more >9 tricks to eliminate render blocking resources - LogRocket Blog
By reducing render blocking resources, you can shorten the critical rendering path and reduce page load times, thus improving UX and SEO.
Read more >Dynamic render blocks support (API rework using WordPress ...
Wordpress Gutenberg supports dynamic block use-case (through the use of render_callback ) where developers are capable of doing the rendering ...
Read more >Remove Render-Blocking JavaScript | PageSpeed Insights
You should avoid and minimize the use of blocking JavaScript, especially external scripts that must be fetched before they can be executed.
Read more >PerformanceResourceTiming.renderBlockingStatus - Web APIs
Render -blocking resources are static files, such as fonts, CSS, and JavaScript that block or delay the browser from rendering page content ...
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
The documentation site of this plugin is limited, unclear, less example oriented, more worried and very poor in knowledge base. It’s only super-heroic to ninja people or for those stupid folks who built this.
@psdon is editor.js ready before you try it?