forked from WordPress/gutenberg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Block Bindings: Allow editing in post meta source (WordPress#61753)
* Create bindings util for transforming block attributes * Get attributes and name from the store * Change function to return only the bound attributes * Add action, selector, and reducer for block context * Sync store in edit component * Revert "Sync store in edit component" This reverts commit 988c4b6. * Move logic to BlockContextProvider * Change parent context logic * Use useLayoutEffect * Go back to syncing store in edit component * WIP: Move bindings logic to `getBlockAttributes` * WIP: Move bindings setAttributes logic to updateBlockBindings * Pass only `select` to `getValue` functions * Remove old editor hook * Add fallback to postId until context is ready * Remove setValue post-meta code * Simplify fallback conditional * Change bindings destructuring * Check canBindAttribute in updateBlockAttributes * Update unit tests to expect a dispatch * Add conditional in block * Don't use `getBlockAttributes` inside `getValue` * Revert "Don't use `getBlockAttributes` inside `getValue`" This reverts commit 0e91129. * Avoid processing bindings recursively * Access context through selector * Update getBlockAttributes logic * Don't use fallbacks * Add edit value posibility for post meta, add function to check if is admin * Revert "Add edit value posibility for post meta, add function to check if is admin" This reverts commit 9659455. * Test editing is allowed in paragraph block * Test protected fields are not editable * Revert "Enable parallel processing for PHPCS sniffs (WordPress#61700)" This reverts commit 8331820. * Add post meta setValue function * Update tests to check contenteditable * Update lockAttributesEditing default * Pass arguments to lockAttributesEditing * Check user can edit post meta * Check field is exposed in the REST API * Disable editing in templates * Add fallback for postId * Revert "Revert "Enable parallel processing for PHPCS sniffs (WordPress#61700)"" This reverts commit e74d71c. * Adapt old tests * Simplify lockAttributesEditing fallbacks * Don't use fallback for context * Add postType fallback when locking controls * Pass context in rich text * Check contenteditable attribute in test * Change name to `canUserEditValue` * Revert changes caused by rebasing * Add space back * Pass block context through rich text * Change imports * Transform block attributes into bindings in split selection * Pass context to in use-input * Change REST API check * Use getBoundAttributesValues * Don't split when attribute is bound * Revert changes caused by rebase * Cover more blocks when editing custom fields * Add a warning when pasting blocks --------- Co-authored-by: Carlos Bravo <carlos.bravo@automattic.com>
- Loading branch information
1 parent
e77eabf
commit c42420a
Showing
10 changed files
with
396 additions
and
72 deletions.
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
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 |
---|---|---|
|
@@ -89,7 +89,5 @@ export default { | |
}, | ||
} ); | ||
}, | ||
lockAttributesEditing() { | ||
return false; | ||
}, | ||
canUserEditValue: () => 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.