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: load blocks closed by default?

See original GitHub issue

I am using the following bit of code to collapse all the block categories, unfortunately, this is not working

const categories = editor.BlockManager.getCategories();
categories.each(category => {
	category.set('open', false).on('change:open', opened => {
		opened.get('open') && categories.each(category => {
            category !== opened && category.set('open', false)
        })
	})
})

live demo : https://jsfiddle.net/d4702yoh/2/

What is wrong here?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
artfcommented, Aug 14, 2021

That should be enough editor.Blocks.getCategories().forEach(ct => ct.set('open', false)) but categories are not created until the render of blocks (which happens, by default, when you click the Blocks tab) so you just need to execute that script once are rendered.

0reactions
throne1986commented, Aug 14, 2021

Thanks your right

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix Block Bug in Project Slayers Mobile - Unable To Change ...
For more information, follow this guide:https://www.techy.how/tutorials/project-slayers-fix- block - bug -unable-to-change-positionA short ...
Read more >
Resolve blocking problem caused by lock escalation - SQL ...
Typically, SQL Server's default behavior causes lock escalation to occur only at those times when it would improve performance or when you must ......
Read more >
How to Solve the Chunk Load Error in JavaScript - Rollbar
Whenever there's an error observed in dynamically fetching helper JavaScript files known as Chunks, a ChunkLoad Error is thrown.
Read more >
Chrome27 stops loading images ("pending") when a "forever ...
The connection is closed and suddendly the smiley will appear. It looks like if images in the browser cache load correctly. So if...
Read more >
Pitfalls and Common Mistakes | NGINX
Putting root inside of a location block will work and it's perfectly valid. ... server { server_name www.example.com; root /var/www/nginx-default/; ...
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