@wordpress/block-editor 14.9.0 → 14.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/LICENSE.md +1 -1
- package/README.md +40 -0
- package/build/components/audio-player/index.native.js +1 -1
- package/build/components/audio-player/index.native.js.map +1 -1
- package/build/components/background-image-control/index.js +4 -0
- package/build/components/background-image-control/index.js.map +1 -1
- package/build/components/block-alignment-matrix-control/index.js +32 -0
- package/build/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build/components/block-card/index.js +45 -8
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-edit/edit.js +147 -10
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-list/index.js +1 -2
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +2 -2
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/zoom-out-separator.js +20 -3
- package/build/components/block-list/zoom-out-separator.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +5 -8
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/utils.js +3 -3
- package/build/components/block-styles/utils.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +19 -6
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/button-block-appender/index.js +1 -5
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/child-layout-control/index.js +6 -0
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +51 -11
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/contrast-checker/index.native.js +1 -1
- package/build/components/contrast-checker/index.native.js.map +1 -1
- package/build/components/date-format-picker/index.js +7 -16
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +9 -0
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/font-family/index.js +10 -1
- package/build/components/font-family/index.js.map +1 -1
- package/build/components/global-styles/color-panel.js +3 -0
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +1 -1
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +2 -2
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/grid/grid-visualizer.js +9 -0
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/grid/utils.js +12 -1
- package/build/components/grid/utils.js.map +1 -1
- package/build/components/iframe/index.js +1 -1
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +11 -11
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/index.js +1 -1
- package/build/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/index.js +1 -1
- package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -4
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js +2 -2
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build/components/inserter/category-tabs/index.js +1 -2
- package/build/components/inserter/category-tabs/index.js.map +1 -1
- package/build/components/inserter/index.js +6 -15
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -13
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +2 -2
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/line-height-control/index.js +9 -0
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/media-placeholder/index.js +2 -2
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +26 -26
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/plain-text/index.js +34 -0
- package/build/components/plain-text/index.js.map +1 -1
- package/build/components/provider/index.js +61 -5
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-media-upload-settings.js +28 -0
- package/build/components/provider/use-media-upload-settings.js.map +1 -0
- package/build/components/resolution-tool/index.js +3 -1
- package/build/components/resolution-tool/index.js.map +1 -1
- package/build/components/responsive-block-control/index.js +1 -1
- package/build/components/responsive-block-control/index.js.map +1 -1
- package/build/components/rich-text/event-listeners/delete.js +7 -1
- package/build/components/rich-text/event-listeners/delete.js.map +1 -1
- package/build/components/rich-text/index.js +2 -2
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +2 -1
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/hooks/background.js +2 -0
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-bindings.js +15 -14
- package/build/hooks/block-bindings.js.map +1 -1
- package/build/hooks/border.js +3 -3
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +1 -1
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/dimensions.js +2 -2
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/font-family.js +1 -1
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/gap.js +2 -2
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/index.js +0 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +7 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/style.js +7 -7
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/supports.js +7 -7
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/typography.js +6 -6
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/use-zoom-out.js +12 -1
- package/build/hooks/use-zoom-out.js.map +1 -1
- package/build/hooks/utils.js +1 -1
- package/build/hooks/utils.js.map +1 -1
- package/build/store/private-actions.js +1 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +11 -1
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +93 -12
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +6 -8
- package/build/store/selectors.js.map +1 -1
- package/build/utils/block-bindings.js +95 -0
- package/build/utils/block-bindings.js.map +1 -1
- package/build-module/components/audio-player/index.native.js +2 -2
- package/build-module/components/audio-player/index.native.js.map +1 -1
- package/build-module/components/background-image-control/index.js +5 -1
- package/build-module/components/background-image-control/index.js.map +1 -1
- package/build-module/components/block-alignment-matrix-control/index.js +32 -0
- package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build-module/components/block-card/index.js +45 -8
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-edit/edit.js +148 -11
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-list/index.js +2 -3
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +1 -1
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/zoom-out-separator.js +20 -3
- package/build-module/components/block-list/zoom-out-separator.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +5 -8
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/utils.js +3 -3
- package/build-module/components/block-styles/utils.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +19 -6
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/button-block-appender/index.js +2 -6
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +7 -1
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +51 -11
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/contrast-checker/index.native.js +2 -2
- package/build-module/components/contrast-checker/index.native.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +7 -16
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +8 -0
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/font-family/index.js +10 -1
- package/build-module/components/font-family/index.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +3 -0
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +1 -1
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +2 -2
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js +9 -0
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/grid/utils.js +12 -1
- package/build-module/components/grid/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +1 -1
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +12 -12
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/index.js +1 -1
- package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -4
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +2 -2
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/category-tabs/index.js +1 -2
- package/build-module/components/inserter/category-tabs/index.js.map +1 -1
- package/build-module/components/inserter/index.js +6 -15
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -13
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +2 -2
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js +8 -0
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +3 -3
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +28 -28
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/plain-text/index.js +34 -0
- package/build-module/components/plain-text/index.js.map +1 -1
- package/build-module/components/provider/index.js +62 -5
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-media-upload-settings.js +22 -0
- package/build-module/components/provider/use-media-upload-settings.js.map +1 -0
- package/build-module/components/resolution-tool/index.js +3 -1
- package/build-module/components/resolution-tool/index.js.map +1 -1
- package/build-module/components/responsive-block-control/index.js +1 -1
- package/build-module/components/responsive-block-control/index.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/delete.js +7 -1
- package/build-module/components/rich-text/event-listeners/delete.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +2 -1
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/hooks/background.js +2 -0
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-bindings.js +13 -12
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/border.js +3 -3
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +1 -1
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/dimensions.js +2 -2
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/font-family.js +1 -1
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/gap.js +2 -2
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/index.js +0 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +1 -0
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/style.js +7 -7
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/supports.js +7 -7
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/typography.js +6 -6
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/use-zoom-out.js +12 -2
- package/build-module/hooks/use-zoom-out.js.map +1 -1
- package/build-module/hooks/utils.js +1 -1
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/store/private-actions.js +1 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +11 -1
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +93 -12
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +6 -8
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/block-bindings.js +90 -0
- package/build-module/utils/block-bindings.js.map +1 -1
- package/build-style/style-rtl.css +27 -9
- package/build-style/style.css +27 -9
- package/package.json +33 -33
- package/src/components/audio-player/index.native.js +2 -2
- package/src/components/background-image-control/index.js +4 -0
- package/src/components/background-image-control/style.scss +4 -2
- package/src/components/block-alignment-matrix-control/README.md +29 -6
- package/src/components/block-alignment-matrix-control/index.js +31 -0
- package/src/components/block-alignment-matrix-control/stories/index.story.js +78 -0
- package/src/components/block-card/README.md +7 -0
- package/src/components/block-card/index.js +41 -12
- package/src/components/block-card/stories/index.story.js +79 -0
- package/src/components/block-card/style.scss +9 -1
- package/src/components/block-edit/edit.js +218 -11
- package/src/components/block-list/index.js +2 -7
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-list/zoom-out-separator.js +30 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +17 -20
- package/src/components/block-styles/utils.js +3 -3
- package/src/components/block-title/stories/index.story.js +76 -0
- package/src/components/block-tools/style.scss +1 -0
- package/src/components/block-tools/zoom-out-mode-inserters.js +21 -3
- package/src/components/border-radius-control/README.md +59 -0
- package/src/components/border-radius-control/stories/index.story.js +58 -0
- package/src/components/button-block-appender/index.js +2 -7
- package/src/components/child-layout-control/index.js +14 -0
- package/src/components/colors-gradients/dropdown.js +57 -8
- package/src/components/colors-gradients/style.scss +5 -0
- package/src/components/contrast-checker/index.native.js +2 -2
- package/src/components/contrast-checker/stories/index.story.js +117 -0
- package/src/components/date-format-picker/README.md +6 -13
- package/src/components/date-format-picker/index.js +10 -17
- package/src/components/date-format-picker/stories/index.story.js +69 -0
- package/src/components/date-format-picker/style.scss +3 -1
- package/src/components/default-block-appender/content.scss +1 -0
- package/src/components/dimensions-tool/stories/aspect-ratio-tool.story.js +2 -1
- package/src/components/dimensions-tool/stories/index.story.js +2 -1
- package/src/components/dimensions-tool/stories/scale-tool.story.js +2 -1
- package/src/components/dimensions-tool/stories/width-height-tool.story.js +2 -1
- package/src/components/font-appearance-control/index.js +15 -0
- package/src/components/font-family/README.md +1 -0
- package/src/components/font-family/index.js +17 -1
- package/src/components/font-family/stories/index.story.js +1 -0
- package/src/components/global-styles/color-panel.js +3 -0
- package/src/components/global-styles/test/use-global-styles-output.js +1 -1
- package/src/components/global-styles/typography-utils.js +1 -1
- package/src/components/global-styles/use-global-styles-output.js +2 -2
- package/src/components/grid/grid-visualizer.js +11 -0
- package/src/components/grid/utils.js +19 -1
- package/src/components/iframe/index.js +1 -1
- package/src/components/inner-blocks/use-inner-block-template-sync.js +17 -10
- package/src/components/inserter/block-patterns-explorer/index.js +2 -3
- package/src/components/inserter/block-patterns-tab/index.js +3 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -4
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +2 -2
- package/src/components/inserter/category-tabs/index.js +3 -2
- package/src/components/inserter/index.js +1 -13
- package/src/components/inserter/quick-inserter.js +2 -25
- package/src/components/keyboard-shortcuts/index.js +2 -2
- package/src/components/line-height-control/README.md +1 -0
- package/src/components/line-height-control/index.js +12 -0
- package/src/components/line-height-control/stories/index.story.js +1 -0
- package/src/components/line-height-control/test/index.js +7 -1
- package/src/components/list-view/style.scss +10 -5
- package/src/components/media-placeholder/index.js +3 -3
- package/src/components/media-replace-flow/README.md +7 -0
- package/src/components/media-replace-flow/index.js +28 -36
- package/src/components/media-replace-flow/style.scss +6 -6
- package/src/components/plain-text/README.md +2 -2
- package/src/components/plain-text/index.js +34 -0
- package/src/components/plain-text/stories/index.story.js +75 -0
- package/src/components/provider/index.js +81 -4
- package/src/components/provider/use-media-upload-settings.js +25 -0
- package/src/components/resolution-tool/index.js +2 -0
- package/src/components/resolution-tool/stories/index.story.js +36 -8
- package/src/components/responsive-block-control/index.js +1 -1
- package/src/components/rich-text/event-listeners/delete.js +6 -1
- package/src/components/rich-text/index.js +1 -1
- package/src/components/text-alignment-control/README.md +49 -0
- package/src/components/text-alignment-control/stories/index.story.js +56 -18
- package/src/components/text-decoration-control/README.md +0 -1
- package/src/components/text-decoration-control/stories/index.story.js +51 -16
- package/src/components/text-transform-control/README.md +3 -4
- package/src/components/text-transform-control/stories/index.story.js +53 -16
- package/src/components/use-block-drop-zone/index.js +8 -1
- package/src/components/warning/stories/index.story.js +86 -0
- package/src/hooks/background.js +6 -0
- package/src/hooks/block-bindings.js +17 -18
- package/src/hooks/border.js +9 -3
- package/src/hooks/color.js +1 -1
- package/src/hooks/dimensions.js +2 -2
- package/src/hooks/font-family.js +1 -1
- package/src/hooks/gap.js +2 -2
- package/src/hooks/index.js +0 -1
- package/src/hooks/index.native.js +1 -0
- package/src/hooks/style.js +13 -7
- package/src/hooks/supports.js +7 -7
- package/src/hooks/test/style.js +2 -1
- package/src/hooks/typography.js +6 -6
- package/src/hooks/use-zoom-out.js +10 -2
- package/src/hooks/utils.js +1 -1
- package/src/store/private-actions.js +1 -0
- package/src/store/private-selectors.js +15 -5
- package/src/store/reducer.js +112 -19
- package/src/store/selectors.js +6 -8
- package/src/store/test/private-selectors.js +53 -9
- package/src/store/test/reducer.js +172 -166
- package/src/store/test/selectors.js +23 -0
- package/src/utils/block-bindings.js +95 -0
- package/tsconfig.json +2 -5
- package/build/hooks/use-bindings-attributes.js +0 -262
- package/build/hooks/use-bindings-attributes.js.map +0 -1
- package/build-module/hooks/use-bindings-attributes.js +0 -253
- package/build-module/hooks/use-bindings-attributes.js.map +0 -1
- package/src/hooks/use-bindings-attributes.js +0 -322
|
@@ -9,10 +9,100 @@ import { useDispatch, useRegistry } from '@wordpress/data';
|
|
|
9
9
|
*/
|
|
10
10
|
import { store as blockEditorStore } from '../store';
|
|
11
11
|
import { useBlockEditContext } from '../components/block-edit';
|
|
12
|
+
const DEFAULT_ATTRIBUTE = '__default';
|
|
13
|
+
const PATTERN_OVERRIDES_SOURCE = 'core/pattern-overrides';
|
|
14
|
+
const BLOCK_BINDINGS_ALLOWED_BLOCKS = {
|
|
15
|
+
'core/paragraph': ['content'],
|
|
16
|
+
'core/heading': ['content'],
|
|
17
|
+
'core/image': ['id', 'url', 'title', 'alt'],
|
|
18
|
+
'core/button': ['url', 'text', 'linkTarget', 'rel']
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Checks if the given object is empty.
|
|
23
|
+
*
|
|
24
|
+
* @param {?Object} object The object to check.
|
|
25
|
+
*
|
|
26
|
+
* @return {boolean} Whether the object is empty.
|
|
27
|
+
*/
|
|
12
28
|
function isObjectEmpty(object) {
|
|
13
29
|
return !object || Object.keys(object).length === 0;
|
|
14
30
|
}
|
|
15
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Based on the given block name, checks if it is possible to bind the block.
|
|
34
|
+
*
|
|
35
|
+
* @param {string} blockName The name of the block.
|
|
36
|
+
*
|
|
37
|
+
* @return {boolean} Whether it is possible to bind the block to sources.
|
|
38
|
+
*/
|
|
39
|
+
export function canBindBlock(blockName) {
|
|
40
|
+
return blockName in BLOCK_BINDINGS_ALLOWED_BLOCKS;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Based on the given block name and attribute name, checks if it is possible to bind the block attribute.
|
|
45
|
+
*
|
|
46
|
+
* @param {string} blockName The name of the block.
|
|
47
|
+
* @param {string} attributeName The name of attribute.
|
|
48
|
+
*
|
|
49
|
+
* @return {boolean} Whether it is possible to bind the block attribute.
|
|
50
|
+
*/
|
|
51
|
+
export function canBindAttribute(blockName, attributeName) {
|
|
52
|
+
return canBindBlock(blockName) && BLOCK_BINDINGS_ALLOWED_BLOCKS[blockName].includes(attributeName);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Gets the bindable attributes for a given block.
|
|
57
|
+
*
|
|
58
|
+
* @param {string} blockName The name of the block.
|
|
59
|
+
*
|
|
60
|
+
* @return {string[]} The bindable attributes for the block.
|
|
61
|
+
*/
|
|
62
|
+
export function getBindableAttributes(blockName) {
|
|
63
|
+
return BLOCK_BINDINGS_ALLOWED_BLOCKS[blockName];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Checks if the block has the `__default` binding for pattern overrides.
|
|
68
|
+
*
|
|
69
|
+
* @param {?Record<string, object>} bindings A block's bindings from the metadata attribute.
|
|
70
|
+
*
|
|
71
|
+
* @return {boolean} Whether the block has the `__default` binding for pattern overrides.
|
|
72
|
+
*/
|
|
73
|
+
export function hasPatternOverridesDefaultBinding(bindings) {
|
|
74
|
+
return bindings?.[DEFAULT_ATTRIBUTE]?.source === PATTERN_OVERRIDES_SOURCE;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Returns the bindings with the `__default` binding for pattern overrides
|
|
79
|
+
* replaced with the full-set of supported attributes. e.g.:
|
|
80
|
+
*
|
|
81
|
+
* - bindings passed in: `{ __default: { source: 'core/pattern-overrides' } }`
|
|
82
|
+
* - bindings returned: `{ content: { source: 'core/pattern-overrides' } }`
|
|
83
|
+
*
|
|
84
|
+
* @param {string} blockName The block name (e.g. 'core/paragraph').
|
|
85
|
+
* @param {?Record<string, object>} bindings A block's bindings from the metadata attribute.
|
|
86
|
+
*
|
|
87
|
+
* @return {Object} The bindings with default replaced for pattern overrides.
|
|
88
|
+
*/
|
|
89
|
+
export function replacePatternOverridesDefaultBinding(blockName, bindings) {
|
|
90
|
+
// The `__default` binding currently only works for pattern overrides.
|
|
91
|
+
if (hasPatternOverridesDefaultBinding(bindings)) {
|
|
92
|
+
const supportedAttributes = BLOCK_BINDINGS_ALLOWED_BLOCKS[blockName];
|
|
93
|
+
const bindingsWithDefaults = {};
|
|
94
|
+
for (const attributeName of supportedAttributes) {
|
|
95
|
+
// If the block has mixed binding sources, retain any non pattern override bindings.
|
|
96
|
+
const bindingSource = bindings[attributeName] ? bindings[attributeName] : {
|
|
97
|
+
source: PATTERN_OVERRIDES_SOURCE
|
|
98
|
+
};
|
|
99
|
+
bindingsWithDefaults[attributeName] = bindingSource;
|
|
100
|
+
}
|
|
101
|
+
return bindingsWithDefaults;
|
|
102
|
+
}
|
|
103
|
+
return bindings;
|
|
104
|
+
}
|
|
105
|
+
|
|
16
106
|
/**
|
|
17
107
|
* Contains utils to update the block `bindings` metadata.
|
|
18
108
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDispatch","useRegistry","store","blockEditorStore","useBlockEditContext","isObjectEmpty","object","Object","keys","length","useBlockBindingsUtils","clientId","contextClientId","blockClientId","updateBlockAttributes","getBlockAttributes","select","updateBlockBindings","bindings","metadata","currentBindings","newBindings","entries","forEach","attribute","binding","newMetadata","undefined","removeAllBlockBindings"],"sources":["@wordpress/block-editor/src/utils/block-bindings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useRegistry } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { useBlockEditContext } from '../components/block-edit';\n\nfunction isObjectEmpty( object ) {\n\treturn ! object || Object.keys( object ).length === 0;\n}\n\n/**\n * Contains utils to update the block `bindings` metadata.\n *\n * @typedef {Object} WPBlockBindingsUtils\n *\n * @property {Function} updateBlockBindings Updates the value of the bindings connected to block attributes.\n * @property {Function} removeAllBlockBindings Removes the bindings property of the `metadata` attribute.\n */\n\n/**\n * Retrieves the existing utils needed to update the block `bindings` metadata.\n * They can be used to create, modify, or remove connections from the existing block attributes.\n *\n * It contains the following utils:\n * - `updateBlockBindings`: Updates the value of the bindings connected to block attributes. It can be used to remove a specific binding by setting the value to `undefined`.\n * - `removeAllBlockBindings`: Removes the bindings property of the `metadata` attribute.\n *\n * @since 6.7.0 Introduced in WordPress core.\n *\n * @param {?string} clientId Optional block client ID. If not set, it will use the current block client ID from the context.\n *\n * @return {?WPBlockBindingsUtils} Object containing the block bindings utils.\n *\n * @example\n * ```js\n * import { useBlockBindingsUtils } from '@wordpress/block-editor'\n * const { updateBlockBindings, removeAllBlockBindings } = useBlockBindingsUtils();\n *\n * // Update url and alt attributes.\n * updateBlockBindings( {\n * url: {\n * source: 'core/post-meta',\n * args: {\n * key: 'url_custom_field',\n * },\n * },\n * alt: {\n * source: 'core/post-meta',\n * args: {\n * key: 'text_custom_field',\n * },\n * },\n * } );\n *\n * // Remove binding from url attribute.\n * updateBlockBindings( { url: undefined } );\n *\n * // Remove bindings from all attributes.\n * removeAllBlockBindings();\n * ```\n */\nexport function useBlockBindingsUtils( clientId ) {\n\tconst { clientId: contextClientId } = useBlockEditContext();\n\tconst blockClientId = clientId || contextClientId;\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst { getBlockAttributes } = useRegistry().select( blockEditorStore );\n\n\t/**\n\t * Updates the value of the bindings connected to block attributes.\n\t * It removes the binding when the new value is `undefined`.\n\t *\n\t * @param {Object} bindings Bindings including the attributes to update and the new object.\n\t * @param {string} bindings.source The source name to connect to.\n\t * @param {Object} [bindings.args] Object containing the arguments needed by the source.\n\t *\n\t * @example\n\t * ```js\n\t * import { useBlockBindingsUtils } from '@wordpress/block-editor'\n\t *\n\t * const { updateBlockBindings } = useBlockBindingsUtils();\n\t * updateBlockBindings( {\n\t * url: {\n\t * source: 'core/post-meta',\n\t * args: {\n\t * key: 'url_custom_field',\n\t * },\n\t * \t },\n\t * alt: {\n\t * source: 'core/post-meta',\n\t * args: {\n\t * key: 'text_custom_field',\n\t * },\n\t * \t }\n\t * } );\n\t * ```\n\t */\n\tconst updateBlockBindings = ( bindings ) => {\n\t\tconst { metadata: { bindings: currentBindings, ...metadata } = {} } =\n\t\t\tgetBlockAttributes( blockClientId );\n\t\tconst newBindings = { ...currentBindings };\n\n\t\tObject.entries( bindings ).forEach( ( [ attribute, binding ] ) => {\n\t\t\tif ( ! binding && newBindings[ attribute ] ) {\n\t\t\t\tdelete newBindings[ attribute ];\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tnewBindings[ attribute ] = binding;\n\t\t} );\n\n\t\tconst newMetadata = {\n\t\t\t...metadata,\n\t\t\tbindings: newBindings,\n\t\t};\n\n\t\tif ( isObjectEmpty( newMetadata.bindings ) ) {\n\t\t\tdelete newMetadata.bindings;\n\t\t}\n\n\t\tupdateBlockAttributes( blockClientId, {\n\t\t\tmetadata: isObjectEmpty( newMetadata ) ? undefined : newMetadata,\n\t\t} );\n\t};\n\n\t/**\n\t * Removes the bindings property of the `metadata` attribute.\n\t *\n\t * @example\n\t * ```js\n\t * import { useBlockBindingsUtils } from '@wordpress/block-editor'\n\t *\n\t * const { removeAllBlockBindings } = useBlockBindingsUtils();\n\t * removeAllBlockBindings();\n\t * ```\n\t */\n\tconst removeAllBlockBindings = () => {\n\t\tconst { metadata: { bindings, ...metadata } = {} } =\n\t\t\tgetBlockAttributes( blockClientId );\n\t\tupdateBlockAttributes( blockClientId, {\n\t\t\tmetadata: isObjectEmpty( metadata ) ? undefined : metadata,\n\t\t} );\n\t};\n\n\treturn { updateBlockBindings, removeAllBlockBindings };\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,iBAAiB;;AAE1D;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AACpD,SAASC,mBAAmB,QAAQ,0BAA0B;AAE9D,SAASC,aAAaA,CAAEC,MAAM,EAAG;EAChC,OAAO,CAAEA,MAAM,IAAIC,MAAM,CAACC,IAAI,CAAEF,MAAO,CAAC,CAACG,MAAM,KAAK,CAAC;AACtD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAAEC,QAAQ,EAAG;EACjD,MAAM;IAAEA,QAAQ,EAAEC;EAAgB,CAAC,GAAGR,mBAAmB,CAAC,CAAC;EAC3D,MAAMS,aAAa,GAAGF,QAAQ,IAAIC,eAAe;EACjD,MAAM;IAAEE;EAAsB,CAAC,GAAGd,WAAW,CAAEG,gBAAiB,CAAC;EACjE,MAAM;IAAEY;EAAmB,CAAC,GAAGd,WAAW,CAAC,CAAC,CAACe,MAAM,CAAEb,gBAAiB,CAAC;;EAEvE;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMc,mBAAmB,GAAKC,QAAQ,IAAM;IAC3C,MAAM;MAAEC,QAAQ,EAAE;QAAED,QAAQ,EAAEE,eAAe;QAAE,GAAGD;MAAS,CAAC,GAAG,CAAC;IAAE,CAAC,GAClEJ,kBAAkB,CAAEF,aAAc,CAAC;IACpC,MAAMQ,WAAW,GAAG;MAAE,GAAGD;IAAgB,CAAC;IAE1Cb,MAAM,CAACe,OAAO,CAAEJ,QAAS,CAAC,CAACK,OAAO,CAAE,CAAE,CAAEC,SAAS,EAAEC,OAAO,CAAE,KAAM;MACjE,IAAK,CAAEA,OAAO,IAAIJ,WAAW,CAAEG,SAAS,CAAE,EAAG;QAC5C,OAAOH,WAAW,CAAEG,SAAS,CAAE;QAC/B;MACD;MACAH,WAAW,CAAEG,SAAS,CAAE,GAAGC,OAAO;IACnC,CAAE,CAAC;IAEH,MAAMC,WAAW,GAAG;MACnB,GAAGP,QAAQ;MACXD,QAAQ,EAAEG;IACX,CAAC;IAED,IAAKhB,aAAa,CAAEqB,WAAW,CAACR,QAAS,CAAC,EAAG;MAC5C,OAAOQ,WAAW,CAACR,QAAQ;IAC5B;IAEAJ,qBAAqB,CAAED,aAAa,EAAE;MACrCM,QAAQ,EAAEd,aAAa,CAAEqB,WAAY,CAAC,GAAGC,SAAS,GAAGD;IACtD,CAAE,CAAC;EACJ,CAAC;;EAED;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAME,sBAAsB,GAAGA,CAAA,KAAM;IACpC,MAAM;MAAET,QAAQ,EAAE;QAAED,QAAQ;QAAE,GAAGC;MAAS,CAAC,GAAG,CAAC;IAAE,CAAC,GACjDJ,kBAAkB,CAAEF,aAAc,CAAC;IACpCC,qBAAqB,CAAED,aAAa,EAAE;MACrCM,QAAQ,EAAEd,aAAa,CAAEc,QAAS,CAAC,GAAGQ,SAAS,GAAGR;IACnD,CAAE,CAAC;EACJ,CAAC;EAED,OAAO;IAAEF,mBAAmB;IAAEW;EAAuB,CAAC;AACvD","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useDispatch","useRegistry","store","blockEditorStore","useBlockEditContext","DEFAULT_ATTRIBUTE","PATTERN_OVERRIDES_SOURCE","BLOCK_BINDINGS_ALLOWED_BLOCKS","isObjectEmpty","object","Object","keys","length","canBindBlock","blockName","canBindAttribute","attributeName","includes","getBindableAttributes","hasPatternOverridesDefaultBinding","bindings","source","replacePatternOverridesDefaultBinding","supportedAttributes","bindingsWithDefaults","bindingSource","useBlockBindingsUtils","clientId","contextClientId","blockClientId","updateBlockAttributes","getBlockAttributes","select","updateBlockBindings","metadata","currentBindings","newBindings","entries","forEach","attribute","binding","newMetadata","undefined","removeAllBlockBindings"],"sources":["@wordpress/block-editor/src/utils/block-bindings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useRegistry } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { useBlockEditContext } from '../components/block-edit';\n\nconst DEFAULT_ATTRIBUTE = '__default';\nconst PATTERN_OVERRIDES_SOURCE = 'core/pattern-overrides';\nconst BLOCK_BINDINGS_ALLOWED_BLOCKS = {\n\t'core/paragraph': [ 'content' ],\n\t'core/heading': [ 'content' ],\n\t'core/image': [ 'id', 'url', 'title', 'alt' ],\n\t'core/button': [ 'url', 'text', 'linkTarget', 'rel' ],\n};\n\n/**\n * Checks if the given object is empty.\n *\n * @param {?Object} object The object to check.\n *\n * @return {boolean} Whether the object is empty.\n */\nfunction isObjectEmpty( object ) {\n\treturn ! object || Object.keys( object ).length === 0;\n}\n\n/**\n * Based on the given block name, checks if it is possible to bind the block.\n *\n * @param {string} blockName The name of the block.\n *\n * @return {boolean} Whether it is possible to bind the block to sources.\n */\nexport function canBindBlock( blockName ) {\n\treturn blockName in BLOCK_BINDINGS_ALLOWED_BLOCKS;\n}\n\n/**\n * Based on the given block name and attribute name, checks if it is possible to bind the block attribute.\n *\n * @param {string} blockName The name of the block.\n * @param {string} attributeName The name of attribute.\n *\n * @return {boolean} Whether it is possible to bind the block attribute.\n */\nexport function canBindAttribute( blockName, attributeName ) {\n\treturn (\n\t\tcanBindBlock( blockName ) &&\n\t\tBLOCK_BINDINGS_ALLOWED_BLOCKS[ blockName ].includes( attributeName )\n\t);\n}\n\n/**\n * Gets the bindable attributes for a given block.\n *\n * @param {string} blockName The name of the block.\n *\n * @return {string[]} The bindable attributes for the block.\n */\nexport function getBindableAttributes( blockName ) {\n\treturn BLOCK_BINDINGS_ALLOWED_BLOCKS[ blockName ];\n}\n\n/**\n * Checks if the block has the `__default` binding for pattern overrides.\n *\n * @param {?Record<string, object>} bindings A block's bindings from the metadata attribute.\n *\n * @return {boolean} Whether the block has the `__default` binding for pattern overrides.\n */\nexport function hasPatternOverridesDefaultBinding( bindings ) {\n\treturn bindings?.[ DEFAULT_ATTRIBUTE ]?.source === PATTERN_OVERRIDES_SOURCE;\n}\n\n/**\n * Returns the bindings with the `__default` binding for pattern overrides\n * replaced with the full-set of supported attributes. e.g.:\n *\n * - bindings passed in: `{ __default: { source: 'core/pattern-overrides' } }`\n * - bindings returned: `{ content: { source: 'core/pattern-overrides' } }`\n *\n * @param {string} blockName The block name (e.g. 'core/paragraph').\n * @param {?Record<string, object>} bindings A block's bindings from the metadata attribute.\n *\n * @return {Object} The bindings with default replaced for pattern overrides.\n */\nexport function replacePatternOverridesDefaultBinding( blockName, bindings ) {\n\t// The `__default` binding currently only works for pattern overrides.\n\tif ( hasPatternOverridesDefaultBinding( bindings ) ) {\n\t\tconst supportedAttributes = BLOCK_BINDINGS_ALLOWED_BLOCKS[ blockName ];\n\t\tconst bindingsWithDefaults = {};\n\t\tfor ( const attributeName of supportedAttributes ) {\n\t\t\t// If the block has mixed binding sources, retain any non pattern override bindings.\n\t\t\tconst bindingSource = bindings[ attributeName ]\n\t\t\t\t? bindings[ attributeName ]\n\t\t\t\t: { source: PATTERN_OVERRIDES_SOURCE };\n\t\t\tbindingsWithDefaults[ attributeName ] = bindingSource;\n\t\t}\n\n\t\treturn bindingsWithDefaults;\n\t}\n\n\treturn bindings;\n}\n\n/**\n * Contains utils to update the block `bindings` metadata.\n *\n * @typedef {Object} WPBlockBindingsUtils\n *\n * @property {Function} updateBlockBindings Updates the value of the bindings connected to block attributes.\n * @property {Function} removeAllBlockBindings Removes the bindings property of the `metadata` attribute.\n */\n\n/**\n * Retrieves the existing utils needed to update the block `bindings` metadata.\n * They can be used to create, modify, or remove connections from the existing block attributes.\n *\n * It contains the following utils:\n * - `updateBlockBindings`: Updates the value of the bindings connected to block attributes. It can be used to remove a specific binding by setting the value to `undefined`.\n * - `removeAllBlockBindings`: Removes the bindings property of the `metadata` attribute.\n *\n * @since 6.7.0 Introduced in WordPress core.\n *\n * @param {?string} clientId Optional block client ID. If not set, it will use the current block client ID from the context.\n *\n * @return {?WPBlockBindingsUtils} Object containing the block bindings utils.\n *\n * @example\n * ```js\n * import { useBlockBindingsUtils } from '@wordpress/block-editor'\n * const { updateBlockBindings, removeAllBlockBindings } = useBlockBindingsUtils();\n *\n * // Update url and alt attributes.\n * updateBlockBindings( {\n * url: {\n * source: 'core/post-meta',\n * args: {\n * key: 'url_custom_field',\n * },\n * },\n * alt: {\n * source: 'core/post-meta',\n * args: {\n * key: 'text_custom_field',\n * },\n * },\n * } );\n *\n * // Remove binding from url attribute.\n * updateBlockBindings( { url: undefined } );\n *\n * // Remove bindings from all attributes.\n * removeAllBlockBindings();\n * ```\n */\nexport function useBlockBindingsUtils( clientId ) {\n\tconst { clientId: contextClientId } = useBlockEditContext();\n\tconst blockClientId = clientId || contextClientId;\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst { getBlockAttributes } = useRegistry().select( blockEditorStore );\n\n\t/**\n\t * Updates the value of the bindings connected to block attributes.\n\t * It removes the binding when the new value is `undefined`.\n\t *\n\t * @param {Object} bindings Bindings including the attributes to update and the new object.\n\t * @param {string} bindings.source The source name to connect to.\n\t * @param {Object} [bindings.args] Object containing the arguments needed by the source.\n\t *\n\t * @example\n\t * ```js\n\t * import { useBlockBindingsUtils } from '@wordpress/block-editor'\n\t *\n\t * const { updateBlockBindings } = useBlockBindingsUtils();\n\t * updateBlockBindings( {\n\t * url: {\n\t * source: 'core/post-meta',\n\t * args: {\n\t * key: 'url_custom_field',\n\t * },\n\t * \t },\n\t * alt: {\n\t * source: 'core/post-meta',\n\t * args: {\n\t * key: 'text_custom_field',\n\t * },\n\t * \t }\n\t * } );\n\t * ```\n\t */\n\tconst updateBlockBindings = ( bindings ) => {\n\t\tconst { metadata: { bindings: currentBindings, ...metadata } = {} } =\n\t\t\tgetBlockAttributes( blockClientId );\n\t\tconst newBindings = { ...currentBindings };\n\n\t\tObject.entries( bindings ).forEach( ( [ attribute, binding ] ) => {\n\t\t\tif ( ! binding && newBindings[ attribute ] ) {\n\t\t\t\tdelete newBindings[ attribute ];\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tnewBindings[ attribute ] = binding;\n\t\t} );\n\n\t\tconst newMetadata = {\n\t\t\t...metadata,\n\t\t\tbindings: newBindings,\n\t\t};\n\n\t\tif ( isObjectEmpty( newMetadata.bindings ) ) {\n\t\t\tdelete newMetadata.bindings;\n\t\t}\n\n\t\tupdateBlockAttributes( blockClientId, {\n\t\t\tmetadata: isObjectEmpty( newMetadata ) ? undefined : newMetadata,\n\t\t} );\n\t};\n\n\t/**\n\t * Removes the bindings property of the `metadata` attribute.\n\t *\n\t * @example\n\t * ```js\n\t * import { useBlockBindingsUtils } from '@wordpress/block-editor'\n\t *\n\t * const { removeAllBlockBindings } = useBlockBindingsUtils();\n\t * removeAllBlockBindings();\n\t * ```\n\t */\n\tconst removeAllBlockBindings = () => {\n\t\tconst { metadata: { bindings, ...metadata } = {} } =\n\t\t\tgetBlockAttributes( blockClientId );\n\t\tupdateBlockAttributes( blockClientId, {\n\t\t\tmetadata: isObjectEmpty( metadata ) ? undefined : metadata,\n\t\t} );\n\t};\n\n\treturn { updateBlockBindings, removeAllBlockBindings };\n}\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -153,7 +153,9 @@
|
|
|
153
153
|
}
|
|
154
154
|
.block-editor-global-styles-background-panel__inspector-media-replace-container .components-dropdown {
|
|
155
155
|
display: block;
|
|
156
|
-
|
|
156
|
+
}
|
|
157
|
+
.block-editor-global-styles-background-panel__inspector-media-replace-container .components-dropdown .block-editor-global-styles-background-panel__dropdown-toggle {
|
|
158
|
+
height: 40px;
|
|
157
159
|
}
|
|
158
160
|
|
|
159
161
|
.block-editor-global-styles-background-panel__image-tools-panel-item {
|
|
@@ -166,7 +168,6 @@
|
|
|
166
168
|
}
|
|
167
169
|
.block-editor-global-styles-background-panel__image-tools-panel-item .components-dropdown {
|
|
168
170
|
display: block;
|
|
169
|
-
height: 36px;
|
|
170
171
|
}
|
|
171
172
|
.block-editor-global-styles-background-panel__image-tools-panel-item button.components-button {
|
|
172
173
|
color: #1e1e1e;
|
|
@@ -644,11 +645,18 @@ iframe[name=editor-canvas] {
|
|
|
644
645
|
|
|
645
646
|
.block-editor-block-card__title {
|
|
646
647
|
font-weight: 500;
|
|
648
|
+
display: flex;
|
|
649
|
+
align-items: center;
|
|
650
|
+
flex-wrap: wrap;
|
|
651
|
+
gap: 4px 8px;
|
|
647
652
|
}
|
|
648
653
|
.block-editor-block-card__title.block-editor-block-card__title {
|
|
649
654
|
font-size: 13px;
|
|
650
655
|
line-height: 1.4;
|
|
651
656
|
margin: 0;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
.block-editor-block-card__name {
|
|
652
660
|
padding: 3px 0;
|
|
653
661
|
}
|
|
654
662
|
|
|
@@ -1655,9 +1663,16 @@ iframe[name=editor-canvas] {
|
|
|
1655
1663
|
.block-editor-panel-color-gradient-settings__dropdown:hover + .block-editor-panel-color-gradient-settings__reset, .block-editor-panel-color-gradient-settings__reset:focus, .block-editor-panel-color-gradient-settings__reset:hover {
|
|
1656
1664
|
opacity: 1;
|
|
1657
1665
|
}
|
|
1666
|
+
@media (hover: none) {
|
|
1667
|
+
.block-editor-panel-color-gradient-settings__reset {
|
|
1668
|
+
opacity: 1;
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1658
1671
|
|
|
1659
1672
|
.block-editor-date-format-picker {
|
|
1660
|
-
margin
|
|
1673
|
+
margin: 0 0 16px;
|
|
1674
|
+
padding: 0;
|
|
1675
|
+
border: none;
|
|
1661
1676
|
}
|
|
1662
1677
|
|
|
1663
1678
|
.block-editor-date-format-picker__custom-format-select-control__custom-option {
|
|
@@ -2960,9 +2975,11 @@ iframe[name=editor-canvas] {
|
|
|
2960
2975
|
color: #fff;
|
|
2961
2976
|
margin: 8px 24px 0 0;
|
|
2962
2977
|
height: 24px;
|
|
2963
|
-
min-width: 24px;
|
|
2964
2978
|
padding: 0;
|
|
2965
2979
|
}
|
|
2980
|
+
.list-view-appender .block-editor-inserter__toggle.has-icon.is-next-40px-default-size {
|
|
2981
|
+
min-width: 24px;
|
|
2982
|
+
}
|
|
2966
2983
|
.list-view-appender .block-editor-inserter__toggle:hover, .list-view-appender .block-editor-inserter__toggle:focus {
|
|
2967
2984
|
background: var(--wp-admin-theme-color);
|
|
2968
2985
|
color: #fff;
|
|
@@ -2980,16 +2997,17 @@ iframe[name=editor-canvas] {
|
|
|
2980
2997
|
margin-right: 4px;
|
|
2981
2998
|
}
|
|
2982
2999
|
|
|
3000
|
+
.block-editor-media-replace-flow__media-upload-menu:not(:empty) + .block-editor-media-flow__url-input {
|
|
3001
|
+
border-top: 1px solid #1e1e1e;
|
|
3002
|
+
margin-top: 8px;
|
|
3003
|
+
padding-bottom: 8px;
|
|
3004
|
+
}
|
|
3005
|
+
|
|
2983
3006
|
.block-editor-media-flow__url-input {
|
|
2984
3007
|
margin-left: -8px;
|
|
2985
3008
|
margin-right: -8px;
|
|
2986
3009
|
padding: 16px;
|
|
2987
3010
|
}
|
|
2988
|
-
.block-editor-media-flow__url-input.has-siblings {
|
|
2989
|
-
border-top: 1px solid #1e1e1e;
|
|
2990
|
-
margin-top: 8px;
|
|
2991
|
-
padding-bottom: 8px;
|
|
2992
|
-
}
|
|
2993
3011
|
.block-editor-media-flow__url-input .block-editor-media-replace-flow__image-url-label {
|
|
2994
3012
|
display: block;
|
|
2995
3013
|
top: 16px;
|
package/build-style/style.css
CHANGED
|
@@ -153,7 +153,9 @@
|
|
|
153
153
|
}
|
|
154
154
|
.block-editor-global-styles-background-panel__inspector-media-replace-container .components-dropdown {
|
|
155
155
|
display: block;
|
|
156
|
-
|
|
156
|
+
}
|
|
157
|
+
.block-editor-global-styles-background-panel__inspector-media-replace-container .components-dropdown .block-editor-global-styles-background-panel__dropdown-toggle {
|
|
158
|
+
height: 40px;
|
|
157
159
|
}
|
|
158
160
|
|
|
159
161
|
.block-editor-global-styles-background-panel__image-tools-panel-item {
|
|
@@ -166,7 +168,6 @@
|
|
|
166
168
|
}
|
|
167
169
|
.block-editor-global-styles-background-panel__image-tools-panel-item .components-dropdown {
|
|
168
170
|
display: block;
|
|
169
|
-
height: 36px;
|
|
170
171
|
}
|
|
171
172
|
.block-editor-global-styles-background-panel__image-tools-panel-item button.components-button {
|
|
172
173
|
color: #1e1e1e;
|
|
@@ -644,11 +645,18 @@ iframe[name=editor-canvas] {
|
|
|
644
645
|
|
|
645
646
|
.block-editor-block-card__title {
|
|
646
647
|
font-weight: 500;
|
|
648
|
+
display: flex;
|
|
649
|
+
align-items: center;
|
|
650
|
+
flex-wrap: wrap;
|
|
651
|
+
gap: 4px 8px;
|
|
647
652
|
}
|
|
648
653
|
.block-editor-block-card__title.block-editor-block-card__title {
|
|
649
654
|
font-size: 13px;
|
|
650
655
|
line-height: 1.4;
|
|
651
656
|
margin: 0;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
.block-editor-block-card__name {
|
|
652
660
|
padding: 3px 0;
|
|
653
661
|
}
|
|
654
662
|
|
|
@@ -1655,9 +1663,16 @@ iframe[name=editor-canvas] {
|
|
|
1655
1663
|
.block-editor-panel-color-gradient-settings__dropdown:hover + .block-editor-panel-color-gradient-settings__reset, .block-editor-panel-color-gradient-settings__reset:focus, .block-editor-panel-color-gradient-settings__reset:hover {
|
|
1656
1664
|
opacity: 1;
|
|
1657
1665
|
}
|
|
1666
|
+
@media (hover: none) {
|
|
1667
|
+
.block-editor-panel-color-gradient-settings__reset {
|
|
1668
|
+
opacity: 1;
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1658
1671
|
|
|
1659
1672
|
.block-editor-date-format-picker {
|
|
1660
|
-
margin
|
|
1673
|
+
margin: 0 0 16px;
|
|
1674
|
+
padding: 0;
|
|
1675
|
+
border: none;
|
|
1661
1676
|
}
|
|
1662
1677
|
|
|
1663
1678
|
.block-editor-date-format-picker__custom-format-select-control__custom-option {
|
|
@@ -2961,9 +2976,11 @@ iframe[name=editor-canvas] {
|
|
|
2961
2976
|
color: #fff;
|
|
2962
2977
|
margin: 8px 0 0 24px;
|
|
2963
2978
|
height: 24px;
|
|
2964
|
-
min-width: 24px;
|
|
2965
2979
|
padding: 0;
|
|
2966
2980
|
}
|
|
2981
|
+
.list-view-appender .block-editor-inserter__toggle.has-icon.is-next-40px-default-size {
|
|
2982
|
+
min-width: 24px;
|
|
2983
|
+
}
|
|
2967
2984
|
.list-view-appender .block-editor-inserter__toggle:hover, .list-view-appender .block-editor-inserter__toggle:focus {
|
|
2968
2985
|
background: var(--wp-admin-theme-color);
|
|
2969
2986
|
color: #fff;
|
|
@@ -2981,16 +2998,17 @@ iframe[name=editor-canvas] {
|
|
|
2981
2998
|
margin-left: 4px;
|
|
2982
2999
|
}
|
|
2983
3000
|
|
|
3001
|
+
.block-editor-media-replace-flow__media-upload-menu:not(:empty) + .block-editor-media-flow__url-input {
|
|
3002
|
+
border-top: 1px solid #1e1e1e;
|
|
3003
|
+
margin-top: 8px;
|
|
3004
|
+
padding-bottom: 8px;
|
|
3005
|
+
}
|
|
3006
|
+
|
|
2984
3007
|
.block-editor-media-flow__url-input {
|
|
2985
3008
|
margin-right: -8px;
|
|
2986
3009
|
margin-left: -8px;
|
|
2987
3010
|
padding: 16px;
|
|
2988
3011
|
}
|
|
2989
|
-
.block-editor-media-flow__url-input.has-siblings {
|
|
2990
|
-
border-top: 1px solid #1e1e1e;
|
|
2991
|
-
margin-top: 8px;
|
|
2992
|
-
padding-bottom: 8px;
|
|
2993
|
-
}
|
|
2994
3012
|
.block-editor-media-flow__url-input .block-editor-media-replace-flow__image-url-label {
|
|
2995
3013
|
display: block;
|
|
2996
3014
|
top: 16px;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.10.1",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -37,37 +37,37 @@
|
|
|
37
37
|
"@emotion/react": "^11.7.1",
|
|
38
38
|
"@emotion/styled": "^11.6.0",
|
|
39
39
|
"@react-spring/web": "^9.4.5",
|
|
40
|
-
"@wordpress/a11y": "
|
|
41
|
-
"@wordpress/api-fetch": "
|
|
42
|
-
"@wordpress/blob": "
|
|
43
|
-
"@wordpress/block-serialization-default-parser": "
|
|
44
|
-
"@wordpress/blocks": "
|
|
45
|
-
"@wordpress/commands": "
|
|
46
|
-
"@wordpress/components": "
|
|
47
|
-
"@wordpress/compose": "
|
|
48
|
-
"@wordpress/data": "
|
|
49
|
-
"@wordpress/date": "
|
|
50
|
-
"@wordpress/deprecated": "
|
|
51
|
-
"@wordpress/dom": "
|
|
52
|
-
"@wordpress/element": "
|
|
53
|
-
"@wordpress/escape-html": "
|
|
54
|
-
"@wordpress/hooks": "
|
|
55
|
-
"@wordpress/html-entities": "
|
|
56
|
-
"@wordpress/i18n": "
|
|
57
|
-
"@wordpress/icons": "
|
|
58
|
-
"@wordpress/is-shallow-equal": "
|
|
59
|
-
"@wordpress/keyboard-shortcuts": "
|
|
60
|
-
"@wordpress/keycodes": "
|
|
61
|
-
"@wordpress/notices": "
|
|
62
|
-
"@wordpress/preferences": "
|
|
63
|
-
"@wordpress/priority-queue": "
|
|
64
|
-
"@wordpress/private-apis": "
|
|
65
|
-
"@wordpress/rich-text": "
|
|
66
|
-
"@wordpress/style-engine": "
|
|
67
|
-
"@wordpress/token-list": "
|
|
68
|
-
"@wordpress/url": "
|
|
69
|
-
"@wordpress/warning": "
|
|
70
|
-
"@wordpress/wordcount": "
|
|
40
|
+
"@wordpress/a11y": "^4.15.1",
|
|
41
|
+
"@wordpress/api-fetch": "^7.15.1",
|
|
42
|
+
"@wordpress/blob": "^4.15.0",
|
|
43
|
+
"@wordpress/block-serialization-default-parser": "^5.15.0",
|
|
44
|
+
"@wordpress/blocks": "^14.4.1",
|
|
45
|
+
"@wordpress/commands": "^1.15.1",
|
|
46
|
+
"@wordpress/components": "^29.1.1",
|
|
47
|
+
"@wordpress/compose": "^7.15.1",
|
|
48
|
+
"@wordpress/data": "^10.15.1",
|
|
49
|
+
"@wordpress/date": "^5.15.1",
|
|
50
|
+
"@wordpress/deprecated": "^4.15.1",
|
|
51
|
+
"@wordpress/dom": "^4.15.1",
|
|
52
|
+
"@wordpress/element": "^6.15.1",
|
|
53
|
+
"@wordpress/escape-html": "^3.15.0",
|
|
54
|
+
"@wordpress/hooks": "^4.15.0",
|
|
55
|
+
"@wordpress/html-entities": "^4.15.0",
|
|
56
|
+
"@wordpress/i18n": "^5.15.1",
|
|
57
|
+
"@wordpress/icons": "^10.15.1",
|
|
58
|
+
"@wordpress/is-shallow-equal": "^5.15.0",
|
|
59
|
+
"@wordpress/keyboard-shortcuts": "^5.15.1",
|
|
60
|
+
"@wordpress/keycodes": "^4.15.1",
|
|
61
|
+
"@wordpress/notices": "^5.15.1",
|
|
62
|
+
"@wordpress/preferences": "^4.15.1",
|
|
63
|
+
"@wordpress/priority-queue": "^3.15.0",
|
|
64
|
+
"@wordpress/private-apis": "^1.15.0",
|
|
65
|
+
"@wordpress/rich-text": "^7.15.1",
|
|
66
|
+
"@wordpress/style-engine": "^2.15.0",
|
|
67
|
+
"@wordpress/token-list": "^3.15.0",
|
|
68
|
+
"@wordpress/url": "^4.15.0",
|
|
69
|
+
"@wordpress/warning": "^3.15.0",
|
|
70
|
+
"@wordpress/wordcount": "^4.15.0",
|
|
71
71
|
"change-case": "^4.1.2",
|
|
72
72
|
"clsx": "^2.1.1",
|
|
73
73
|
"colord": "^2.7.0",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"publishConfig": {
|
|
91
91
|
"access": "public"
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "0d4503ecc364cf4ca16024673baf5a84dacf212f"
|
|
94
94
|
}
|
|
@@ -17,7 +17,7 @@ import { View } from '@wordpress/primitives';
|
|
|
17
17
|
import { Icon } from '@wordpress/components';
|
|
18
18
|
import { withPreferredColorScheme } from '@wordpress/compose';
|
|
19
19
|
import { __ } from '@wordpress/i18n';
|
|
20
|
-
import { audio,
|
|
20
|
+
import { audio, cautionFilled } from '@wordpress/icons';
|
|
21
21
|
import {
|
|
22
22
|
requestImageFailedRetryDialog,
|
|
23
23
|
requestImageUploadCancelDialog,
|
|
@@ -167,7 +167,7 @@ function Player( {
|
|
|
167
167
|
<View style={ styles.subtitleContainer }>
|
|
168
168
|
{ isUploadFailed && (
|
|
169
169
|
<Icon
|
|
170
|
-
icon={
|
|
170
|
+
icon={ cautionFilled }
|
|
171
171
|
style={ {
|
|
172
172
|
...styles.errorIcon,
|
|
173
173
|
...uploadFailedStyle,
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
Placeholder,
|
|
25
25
|
Spinner,
|
|
26
26
|
__experimentalDropdownContentWrapper as DropdownContentWrapper,
|
|
27
|
+
Button,
|
|
27
28
|
} from '@wordpress/components';
|
|
28
29
|
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
29
30
|
import { store as noticesStore } from '@wordpress/notices';
|
|
@@ -378,6 +379,9 @@ function BackgroundImageControls( {
|
|
|
378
379
|
/>
|
|
379
380
|
}
|
|
380
381
|
variant="secondary"
|
|
382
|
+
renderToggle={ ( props ) => (
|
|
383
|
+
<Button { ...props } __next40pxDefaultSize />
|
|
384
|
+
) }
|
|
381
385
|
onError={ onUploadError }
|
|
382
386
|
onReset={ () => {
|
|
383
387
|
closeAndFocus();
|
|
@@ -23,7 +23,10 @@
|
|
|
23
23
|
|
|
24
24
|
.components-dropdown {
|
|
25
25
|
display: block;
|
|
26
|
-
|
|
26
|
+
|
|
27
|
+
.block-editor-global-styles-background-panel__dropdown-toggle {
|
|
28
|
+
height: 40px;
|
|
29
|
+
}
|
|
27
30
|
}
|
|
28
31
|
}
|
|
29
32
|
|
|
@@ -44,7 +47,6 @@
|
|
|
44
47
|
|
|
45
48
|
.components-dropdown {
|
|
46
49
|
display: block;
|
|
47
|
-
height: 36px;
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
button.components-button {
|
|
@@ -41,13 +41,36 @@ const controls = (
|
|
|
41
41
|
/>
|
|
42
42
|
</BlockControls>
|
|
43
43
|
</>
|
|
44
|
-
|
|
44
|
+
);
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
### Props
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
### `label`
|
|
50
|
+
|
|
51
|
+
- **Type:** `string`
|
|
52
|
+
- **Default:** `'Change matrix alignment'`
|
|
53
|
+
|
|
54
|
+
Label for the control.
|
|
55
|
+
|
|
56
|
+
### `onChange`
|
|
57
|
+
|
|
58
|
+
- **Type:** `Function`
|
|
59
|
+
- **Default:** `noop`
|
|
60
|
+
|
|
61
|
+
Function to execute upon a user's change of the matrix state.
|
|
62
|
+
|
|
63
|
+
### `value`
|
|
64
|
+
|
|
65
|
+
- **Type:** `string`
|
|
66
|
+
- **Default:** `'center'`
|
|
67
|
+
- **Options:** `'center'`, `'center center'`, `'center left'`, `'center right'`, `'top center'`, `'top left'`, `'top right'`, `'bottom center'`, `'bottom left'`, `'bottom right'`
|
|
68
|
+
|
|
69
|
+
Content alignment location.
|
|
70
|
+
|
|
71
|
+
### `isDisabled`
|
|
72
|
+
|
|
73
|
+
- **Type:** `boolean`
|
|
74
|
+
- **Default:** `false`
|
|
75
|
+
|
|
76
|
+
Whether the control should be disabled.
|
|
@@ -11,6 +11,37 @@ import {
|
|
|
11
11
|
|
|
12
12
|
const noop = () => {};
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* The alignment matrix control allows users to quickly adjust inner block alignment.
|
|
16
|
+
*
|
|
17
|
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-alignment-matrix-control/README.md
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```jsx
|
|
21
|
+
* function Example() {
|
|
22
|
+
* return (
|
|
23
|
+
* <BlockControls>
|
|
24
|
+
* <BlockAlignmentMatrixControl
|
|
25
|
+
* label={ __( 'Change content position' ) }
|
|
26
|
+
* value="center"
|
|
27
|
+
* onChange={ ( nextPosition ) =>
|
|
28
|
+
* setAttributes( { contentPosition: nextPosition } )
|
|
29
|
+
* }
|
|
30
|
+
* />
|
|
31
|
+
* </BlockControls>
|
|
32
|
+
* );
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @param {Object} props Component props.
|
|
37
|
+
* @param {string} props.label Label for the control. Defaults to 'Change matrix alignment'.
|
|
38
|
+
* @param {Function} props.onChange Function to execute upon change of matrix state.
|
|
39
|
+
* @param {string} props.value Content alignment location. One of: 'center', 'center center',
|
|
40
|
+
* 'center left', 'center right', 'top center', 'top left',
|
|
41
|
+
* 'top right', 'bottom center', 'bottom left', 'bottom right'.
|
|
42
|
+
* @param {boolean} props.isDisabled Whether the control should be disabled.
|
|
43
|
+
* @return {Element} The BlockAlignmentMatrixControl component.
|
|
44
|
+
*/
|
|
14
45
|
function BlockAlignmentMatrixControl( props ) {
|
|
15
46
|
const {
|
|
16
47
|
label = __( 'Change matrix alignment' ),
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useState } from '@wordpress/element';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import BlockAlignmentMatrixControl from '../';
|
|
10
|
+
|
|
11
|
+
const meta = {
|
|
12
|
+
title: 'BlockEditor/BlockAlignmentMatrixControl',
|
|
13
|
+
component: BlockAlignmentMatrixControl,
|
|
14
|
+
parameters: {
|
|
15
|
+
docs: {
|
|
16
|
+
canvas: { sourceState: 'shown' },
|
|
17
|
+
description: {
|
|
18
|
+
component:
|
|
19
|
+
'Renders a control for selecting block alignment using a matrix of alignment options.',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
argTypes: {
|
|
24
|
+
label: {
|
|
25
|
+
control: 'text',
|
|
26
|
+
table: {
|
|
27
|
+
type: { summary: 'string' },
|
|
28
|
+
defaultValue: { summary: "'Change matrix alignment'" },
|
|
29
|
+
},
|
|
30
|
+
description: 'Label for the control.',
|
|
31
|
+
},
|
|
32
|
+
onChange: {
|
|
33
|
+
action: 'onChange',
|
|
34
|
+
control: { type: null },
|
|
35
|
+
table: {
|
|
36
|
+
type: { summary: 'function' },
|
|
37
|
+
defaultValue: { summary: '() => {}' },
|
|
38
|
+
},
|
|
39
|
+
description:
|
|
40
|
+
"Function to execute upon a user's change of the matrix state.",
|
|
41
|
+
},
|
|
42
|
+
isDisabled: {
|
|
43
|
+
control: 'boolean',
|
|
44
|
+
table: {
|
|
45
|
+
type: { summary: 'boolean' },
|
|
46
|
+
defaultValue: { summary: 'false' },
|
|
47
|
+
},
|
|
48
|
+
description: 'Whether the control should be disabled.',
|
|
49
|
+
},
|
|
50
|
+
value: {
|
|
51
|
+
control: { type: null },
|
|
52
|
+
table: {
|
|
53
|
+
type: { summary: 'string' },
|
|
54
|
+
defaultValue: { summary: "'center'" },
|
|
55
|
+
},
|
|
56
|
+
description: 'Content alignment location.',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export default meta;
|
|
62
|
+
|
|
63
|
+
export const Default = {
|
|
64
|
+
render: function Template( { onChange, ...args } ) {
|
|
65
|
+
const [ value, setValue ] = useState();
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<BlockAlignmentMatrixControl
|
|
69
|
+
{ ...args }
|
|
70
|
+
value={ value }
|
|
71
|
+
onChange={ ( ...changeArgs ) => {
|
|
72
|
+
onChange( ...changeArgs );
|
|
73
|
+
setValue( ...changeArgs );
|
|
74
|
+
} }
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
},
|
|
78
|
+
};
|
|
@@ -21,6 +21,7 @@ const MyBlockCard = () => (
|
|
|
21
21
|
icon={ paragraph }
|
|
22
22
|
title="Paragraph"
|
|
23
23
|
description="Start with the basic building block of all narrative."
|
|
24
|
+
name="Custom Block"
|
|
24
25
|
/>
|
|
25
26
|
);
|
|
26
27
|
```
|
|
@@ -45,6 +46,12 @@ The title of the block.
|
|
|
45
46
|
|
|
46
47
|
The description of the block.
|
|
47
48
|
|
|
49
|
+
#### name
|
|
50
|
+
|
|
51
|
+
- **Type:** `String`
|
|
52
|
+
|
|
53
|
+
The custom name of the block.
|
|
54
|
+
|
|
48
55
|
## Related components
|
|
49
56
|
|
|
50
57
|
Block Editor components are components that can be used to compose the UI of your block editor. Thus, they can only be used under a [`BlockEditorProvider`](https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/provider/README.md) in the components tree.
|