-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Framework: Adding the possibility to lock the editor #3686
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3686 +/- ##
==========================================
+ Coverage 37.67% 38.71% +1.04%
==========================================
Files 279 277 -2
Lines 6737 6901 +164
Branches 1226 1279 +53
==========================================
+ Hits 2538 2672 +134
- Misses 3538 3566 +28
- Partials 661 663 +2
Continue to review full report at Codecov.
|
Do not forget very variety of cases with partial lock.
|
@StaggerLeee Yes, that's on the roadmap. With block nesting, the implementation of these flexible layouts would not be so complex. Just add a "free" block list container and leave the rest locked. |
@youknowriad nice work. I have been thinking that we might still want to allow moving blocks as an option instead of full lock, which might change the api to be: // Locks everything, like current implementation
template_lock => 'all'
// Locks inserting and deleting, but allows moving the blocks and changing their order
template_lock => 'insert' Too schematic? Would we need an array instead? |
@mtias Do you have an example of a use-case where we'd allow moving blocks but not inserting/moving? Honestly, I'm not sure this is something that would be heavily used. Implementing it is easy enough though. |
Ok after a small discussion, I implemented the locking level using a string value. |
(Note: I updated the description to fix a typo: |
Related: #2632 |
eed266c
to
b413329
Compare
b413329
to
657c587
Compare
50104e6
to
a16ef0c
Compare
If not major concerns, I'll be merging this so we can prove it. |
Nice work! |
] ); | ||
} } | ||
onSplit={ | ||
insertBlocksAfter ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be the responsibility of the block implementer to account for? Or could we just turn insertBlocksAfter
and setAttributes
into noop
for a locked editor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmm, I didn't think about it. Sounds reasonable
This PR is the first one introducing the Block Templates Locking. (details on those here #3588 ).
Locking the editor means, you can't add new blocks, you can't move blocks, you can't remove blocks.
Testing instructions
Notes
Next