Site icon Hip-Hop Website Design and Development

Gutenberg 11.6 Introduces New API for Locking Blocks

Gutenberg 11.6 was launched this week with a new API for managing lock management on the block-type stage. When defining a block, builders can now use the lock attribute to designate whether or not a block will be moved or eliminated. The PR introduces components of the locking assist mechanisms proposed by Matias Ventura in a separate difficulty earlier this 12 months.

Ventura defined that whereas the editor already has template locking assist to forestall inserting or shifting blocks (i.e. for customized publish sort templates), it doesn’t but provide a lot granular management or a UI for the completely different locking states. He recognized block themes as an vital use case for establishing a brand new block-level API for representing lock standing. Block themes might necessitate the power to lock down key components, equivalent to stopping the removing of the post-content for a single publish template. When you’ve got ever performed round with the template editor then you could have possible found how straightforward it’s to take away vital components accidentally.

“One other use case that we’re constructing for is having a Checkout Block with completely different blocks that act as basic steps,” WooCommerce and Gutenberg engineer Seghir Nadir stated. “We don’t need folks to delete or transfer these steps since they’re basic and their order can also be vital, however we wish to enable folks to pick out them, entry settings, and insert blocks in between them.”

Throughout this week’s core editor chat, Paal Joachim Romdahl highlighted the necessity for a locking mechanism for Reusable blocks.

“In the meanwhile it’s too straightforward to make an unintended change to a Reusable block,” Romdahl stated. “I fear that solely having the hover overlay and the preliminary click on [to] choose the guardian Reusable block is simply not adequate, that we quickly ought to get a lock mechanism in place. There’s plenty of suggestions from customers who’ve by chance deleted the internal contents of the blocks and questioned what occurred.”

Romdahl has created a number of points about to the opportunity of including a locking mechanism to the inline toolbar for reusable blocks, the place customers would wish to unlock to edit the contents.

Now that the foundational infrastructure is in place for managing lock management on the block-type stage, contributors can start constructing a UI to manage it, as outlined within the Locking and TemplateLocking difficulty. Ventura stated future iterations ought to embody a UI that signifies which blocks are user-editable and in addition show block standing within the record view and block inspector.