-
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
Block Bindings: enhance block attribute binding to external sources #58895
Closed
Closed
Changes from 1 commit
Commits
Show all changes
74 commits
Select commit
Hold shift + click to select a range
e9a1ddf
replace use-binding-attributes with block-binding-support
retrofox 8c20db3
minor enhancement
retrofox 31c1bec
minor change
retrofox 8a8a839
tweak
retrofox 39b7a89
do not import use-binding-attributes
retrofox 9f643e7
use isItPossibleToBindBlock() helper
retrofox f89fc68
introduce core/entity source handler
retrofox 8ef5a5b
rename folder
retrofox b5a86ac
rename source name
retrofox 71e716c
polish post-entity source handler
retrofox 12d5cd4
make core/post-entity more consistent with core-data
retrofox ebb9bb2
make entity source hand;ler more generic
retrofox 1470818
fix entity sour handl;er issues
retrofox 64eedc2
remove uneeded useValue () hook (crossfingers)
retrofox a2d5cb2
minor jsdoc improvement
retrofox 4deda60
clean
retrofox 2510322
rename with updateValue()
retrofox fce8539
remove core/entity binding source handler
retrofox 8d71311
move useSource to Connector cmp
retrofox 411ede8
move the whole dryining logic to the Connect component
retrofox eb7e032
improve jsdoc
retrofox b8a9061
rename to blockProps
retrofox 2ae62f0
minor jsdoc improvements
retrofox cc21a16
use a single effect to update attr and value
retrofox 396dfb3
discard useValue. Return value and setValue instead
retrofox f25f9b8
check wheter updateValue function is defined
retrofox f3b3e05
check prop value is defined when updating attr
retrofox 56ae182
handle `placerholder`
retrofox 7de80c3
ensure to put attribute in sync when onmount
retrofox 8866135
remove // eslint comment
retrofox 42ed184
enable editing for bound with post-meta
retrofox 60e73d4
move block bindiung processor to hooks/
retrofox 3c9a341
ensure update bound attr once when mounting
retrofox 7263d22
Update packages/block-editor/src/hooks/block-binding-support/index.js
retrofox d5b5e78
disable editing block attribute
retrofox 7268a55
move changes to the use-binding-attributes file
retrofox 10b7765
introduce BlockBindingBridge component
retrofox 472d01e
update isItPossibleToBindBlock() import path
retrofox 37c6ab9
introduce hasPossibleBlockBinding() helper
retrofox eab050b
use hooks API to extened blocks with bound attts
retrofox de04130
fix propagating attr value. jsdoc
retrofox 28eb168
minor changes
retrofox fcc5b8a
minor code enhancement
retrofox cb9e380
not edit bound prop for now
retrofox bd9cf18
jsdoc
retrofox 7ecfab9
revert using hooks API to extrend block
retrofox ed16267
jsdoc
retrofox dbf70e5
update internal path
retrofox 8bb843d
rollback hook utils chnages
retrofox 1abf420
tidy
retrofox ef40bd4
wrap Connector instances with a Fragment
retrofox ca54c3f
return original Edit instance when no bindings
retrofox bfde100
check whether useSource is defined
retrofox 9aedf87
Use `useSelect` and move it out of the for loop
michalczaplinski dd77b7c
check attr value type
retrofox b17ce14
iterare when creating BindingConnector instances
retrofox 74b32ad
rename helper functions
retrofox 93430da
use useSelect to get binding sources
retrofox ecaf10a
Update packages/block-editor/src/hooks/use-bindings-attributes.js
retrofox 2fd9911
Update packages/block-editor/src/hooks/use-bindings-attributes.js
retrofox 5bd3a79
pass prev attr value to compare
retrofox 1741497
improve binding allowed block attributes
retrofox e435a3d
sync derevied updates when updating bound attr
retrofox 8f27c48
improve getting attr source
retrofox 3d953f8
check properly bindings data
retrofox 3d106ce
preserve the RichTextData for block attr
retrofox 994bed1
comment line just for tesrting purposes
retrofox 4998315
rebasing changes
retrofox 9072e6a
rollback change foir testing purposes
retrofox 2133393
change cmp prop name. improve jsdoc
retrofox 91f64d6
simplify checking bindins value
retrofox 987fb58
use attr name as key instance
retrofox db32d18
Refactor useMarkPersistent function
michalczaplinski e55f6bc
pick block data from straight props
retrofox 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
preserve the RichTextData for block attr
- Loading branch information
commit 3d106ce3c37d2d40dfb50d591eb4c60d452c26dd
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
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.
I think it's not a workaround and necessary. Attribute values should be serializable and deserializable.
RichTextData
is the only special type of value AFAIK. However, we can implement some kind of universal contract for values to serialize/deserialize automatically though.For instance, when registering a new custom type, we need to specify both a serialize and a deserialize function.
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.
I've added this checking as a quick temporary solution. This is needed because when comparing initially the value provided by the external source (HTML) with the bound attribute( RichTextData instance), it will always be different.