-
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
Add content only descriptions in dropdown menus for patterns and templates #61127
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
f4cf047
Remove the lock icon block content only blocks
kevin940726 328439c
Add content only description for patterns and templates
kevin940726 5fb135d
Tweak strings
kevin940726 ef80458
Remove convert template menu item if the block is content only
kevin940726 574019b
Fix canMoveBlock with block editing mode
kevin940726 91807e1
Address code review and hide non pattern/template menu
kevin940726 fe2f5cc
Fix lint errors
kevin940726 a1f066f
Show description for template lock content only
kevin940726 d404f33
Fix lint errors
kevin940726 038919d
Reword template lock
kevin940726 a13071f
Fix move to still showing in the menu
kevin940726 0147d37
Change to modify
kevin940726 a4b4877
Reword the description
kevin940726 a767bd1
Reword
kevin940726 68d2722
Add docblock and delete unused code
kevin940726 f730206
Add back native code
kevin940726 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -391,3 +391,27 @@ export function expandBlock( clientId ) { | |
clientId, | ||
}; | ||
} | ||
|
||
/** | ||
* Temporarily modify/unlock the content-only block for editions. | ||
* | ||
* @param {string} clientId The client id of the block. | ||
*/ | ||
export const modifyContentLockBlock = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It'd be good to add a docblock |
||
( clientId ) => | ||
( { select, dispatch } ) => { | ||
dispatch.__unstableMarkNextChangeAsNotPersistent(); | ||
dispatch.updateBlockAttributes( clientId, { | ||
templateLock: undefined, | ||
} ); | ||
dispatch.updateBlockListSettings( clientId, { | ||
...select.getBlockListSettings( clientId ), | ||
templateLock: false, | ||
} ); | ||
const focusModeToRevert = select.getSettings().focusMode; | ||
dispatch.updateSettings( { focusMode: true } ); | ||
dispatch.__unstableSetTemporarilyEditingAsBlocks( | ||
clientId, | ||
focusModeToRevert | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1759,14 +1759,16 @@ export function canMoveBlock( state, clientId, rootClientId = null ) { | |
if ( attributes === null ) { | ||
return true; | ||
} | ||
if ( getBlockEditingMode( state, rootClientId ) !== 'default' ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move the block editing check earlier so that blocks in the page editor won't be moved (which is expected.) |
||
return false; | ||
} | ||
if ( attributes.lock?.move !== undefined ) { | ||
return ! attributes.lock.move; | ||
} | ||
if ( getTemplateLock( state, rootClientId ) === 'all' ) { | ||
return false; | ||
} | ||
|
||
return getBlockEditingMode( state, rootClientId ) !== 'disabled'; | ||
return true; | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This check turned out to be too restrictive. See #62367.