@wordpress/block-editor 14.0.0 → 14.2.0
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 +4 -0
- package/README.md +10 -24
- package/build/autocompleters/block.js +1 -1
- package/build/autocompleters/block.js.map +1 -1
- package/build/components/block-alignment-matrix-control/index.js +2 -2
- package/build/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build/components/block-breadcrumb/index.js +8 -2
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-canvas/index.js +8 -1
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-compare/block-view.js +4 -1
- package/build/components/block-compare/block-view.js.map +1 -1
- package/build/components/block-draggable/index.js +4 -4
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/use-scroll-when-dragging.js +25 -25
- package/build/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
- package/build/components/block-edit/multiple-usage-warning.js +8 -2
- package/build/components/block-edit/multiple-usage-warning.js.map +1 -1
- package/build/components/block-inspector/index.js +27 -9
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.js +6 -3
- package/build/components/block-list/block-invalid-warning.js.map +1 -1
- package/build/components/block-list/block.js +5 -1
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +7 -3
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +1 -0
- package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +46 -0
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -0
- package/build/components/block-list/use-in-between-inserter.js +11 -4
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-lock/toolbar.js +3 -3
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-mover/button.js +4 -1
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +4 -1
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +4 -1
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +1 -4
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +22 -7
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-patterns-list/index.js +11 -14
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +12 -3
- package/build/components/block-patterns-paging/index.js.map +1 -1
- package/build/components/block-popover/index.js +2 -15
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-quick-navigation/index.js +4 -1
- package/build/components/block-quick-navigation/index.js.map +1 -1
- package/build/components/block-settings-menu/block-mode-toggle.js +28 -34
- package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +4 -0
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-switcher/index.js +22 -17
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +1 -4
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-toolbar/index.js +12 -11
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +6 -2
- package/build/components/block-toolbar/shuffle.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +8 -2
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/block-toolbar-popover.js +10 -6
- package/build/components/block-tools/block-toolbar-popover.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +14 -3
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js +2 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +2 -1
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +4 -5
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-popover.js +3 -4
- package/build/components/block-tools/zoom-out-popover.js.map +1 -1
- package/build/components/block-tools/zoom-out-toolbar.js +14 -5
- package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build/components/block-variation-picker/index.js +4 -1
- package/build/components/block-variation-picker/index.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +4 -1
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/border-radius-control/index.js +1 -0
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/button-block-appender/index.js +14 -3
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +4 -1
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/content-lock/index.js +13 -0
- package/build/components/content-lock/index.js.map +1 -0
- package/build/components/content-lock/modify-content-lock-menu-item.js +64 -0
- package/build/components/content-lock/modify-content-lock-menu-item.js.map +1 -0
- package/build/components/convert-to-group-buttons/index.js +1 -1
- package/build/components/convert-to-group-buttons/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +2 -0
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/editor-styles/index.js +4 -3
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +3 -0
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/font-family/index.js +3 -0
- package/build/components/font-family/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +118 -50
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +8 -5
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.native.js +1 -1
- package/build/components/global-styles/color-panel.native.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +34 -37
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +4 -1
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +3 -1
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build/components/global-styles/hooks.js +0 -7
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +0 -6
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/shadow-panel-components.js +13 -7
- package/build/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +17 -6
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +3 -3
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +11 -29
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/grid/grid-item-movers.js +2 -2
- package/build/components/grid/grid-item-movers.js.map +1 -1
- package/build/components/grid/grid-visualizer.js +20 -5
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/height-control/index.js +1 -0
- package/build/components/height-control/index.js.map +1 -1
- package/build/components/iframe/index.js +8 -6
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/zoom-dropdown.js +11 -7
- package/build/components/image-editor/zoom-dropdown.js.map +1 -1
- package/build/components/inner-blocks/button-block-appender.js +8 -8
- package/build/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build/components/inner-blocks/default-block-appender.js +7 -25
- package/build/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build/components/inner-blocks/index.js +8 -12
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +3 -3
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +4 -1
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/index.js +4 -1
- package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +3 -3
- package/build/components/inserter/media-tab/hooks.js.map +1 -1
- package/build/components/inserter/media-tab/media-list.js +1 -4
- package/build/components/inserter/media-tab/media-list.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +8 -2
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/media-tab/media-tab.js +4 -1
- package/build/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build/components/inserter/menu.js +14 -13
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +8 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter-list-item/index.js +4 -4
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/inserter-listbox/index.js +3 -7
- package/build/components/inserter-listbox/index.js.map +1 -1
- package/build/components/inserter-listbox/item.js +4 -1
- package/build/components/inserter-listbox/item.js.map +1 -1
- package/build/components/inspector-controls/groups.js +2 -0
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls-tabs/index.js +4 -1
- package/build/components/inspector-controls-tabs/index.js.map +1 -1
- package/build/components/inspector-controls-tabs/settings-tab.js +3 -1
- package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +2 -1
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build/components/inspector-popover-header/index.js +8 -2
- package/build/components/inspector-popover-header/index.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +7 -4
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/line-height-control/index.js +3 -0
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/index.js +19 -10
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/settings-drawer.js +4 -1
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/list-view/block-select-button.js +4 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/media-placeholder/index.js +36 -10
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +8 -1
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/media-upload/index.native.js +4 -1
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/multi-selection-inspector/index.js +12 -12
- package/build/components/multi-selection-inspector/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +19 -19
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/event-listeners/paste-handler.js +12 -1
- package/build/components/rich-text/event-listeners/paste-handler.js.map +1 -1
- package/build/components/rich-text/index.js +38 -30
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-mark-persistent.js +5 -5
- package/build/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js +4 -1
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -2
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/text-alignment-control/index.js +13 -8
- package/build/components/text-alignment-control/index.js.map +1 -1
- package/build/components/text-decoration-control/index.js +13 -8
- package/build/components/text-decoration-control/index.js.map +1 -1
- package/build/components/text-transform-control/index.js +13 -8
- package/build/components/text-transform-control/index.js.map +1 -1
- package/build/components/tool-selector/index.js +4 -1
- package/build/components/tool-selector/index.js.map +1 -1
- package/build/components/url-input/button.js +12 -3
- package/build/components/url-input/button.js.map +1 -1
- package/build/components/url-input/index.js +4 -1
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +2 -0
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +12 -2
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/writing-flow/index.js +2 -1
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +4 -1
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/components/writing-flow/use-event-redirect.js +66 -0
- package/build/components/writing-flow/use-event-redirect.js.map +1 -0
- package/build/components/writing-flow/use-input.js +31 -1
- package/build/components/writing-flow/use-input.js.map +1 -1
- package/build/components/writing-flow/use-select-all.js +14 -1
- package/build/components/writing-flow/use-select-all.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +20 -6
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +4 -4
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/components/writing-flow/utils.js +27 -0
- package/build/components/writing-flow/utils.js.map +1 -1
- package/build/components/writing-mode-control/index.js +13 -8
- package/build/components/writing-mode-control/index.js.map +1 -1
- package/build/hooks/background.js +19 -23
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-bindings.js +64 -103
- package/build/hooks/block-bindings.js.map +1 -1
- package/build/hooks/content-lock-ui.js +8 -26
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/duotone.js +0 -4
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/layout.js +4 -1
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/spacing-visualizer.js +3 -3
- package/build/hooks/spacing-visualizer.js.map +1 -1
- package/build/hooks/style.js +1 -5
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +19 -20
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/hooks/use-zoom-out.js +7 -7
- package/build/hooks/use-zoom-out.js.map +1 -1
- package/build/layouts/constrained.js +42 -41
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/flex.js +6 -1
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/grid.js +3 -0
- package/build/layouts/grid.js.map +1 -1
- package/build/layouts/utils.js +1 -7
- package/build/layouts/utils.js.map +1 -1
- package/build/private-apis.js +4 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +2 -7
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +1 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-keys.js +2 -1
- package/build/store/private-keys.js.map +1 -1
- package/build/store/private-selectors.js +39 -11
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +2 -0
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +19 -43
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +48 -0
- package/build/store/utils.js.map +1 -1
- package/build/utils/block-bindings.js +117 -0
- package/build/utils/block-bindings.js.map +1 -0
- package/build/utils/dom.js +101 -0
- package/build/utils/dom.js.map +1 -1
- package/build/utils/get-font-styles-and-weights.js +4 -4
- package/build/utils/get-font-styles-and-weights.js.map +1 -1
- package/build/utils/transform-styles/index.js +120 -16
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/autocompleters/block.js +1 -1
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/components/block-alignment-matrix-control/index.js +1 -1
- package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +8 -2
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-canvas/index.js +9 -1
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-compare/block-view.js +4 -1
- package/build-module/components/block-compare/block-view.js.map +1 -1
- package/build-module/components/block-draggable/index.js +4 -4
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/use-scroll-when-dragging.js +25 -25
- package/build-module/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
- package/build-module/components/block-edit/multiple-usage-warning.js +8 -2
- package/build-module/components/block-edit/multiple-usage-warning.js.map +1 -1
- package/build-module/components/block-inspector/index.js +27 -9
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.js +6 -3
- package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
- package/build-module/components/block-list/block.js +5 -1
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +7 -3
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +1 -0
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +40 -0
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -0
- package/build-module/components/block-list/use-in-between-inserter.js +11 -4
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +3 -3
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-mover/button.js +4 -1
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +4 -1
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +4 -1
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +1 -4
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +23 -8
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +11 -14
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +12 -3
- package/build-module/components/block-patterns-paging/index.js.map +1 -1
- package/build-module/components/block-popover/index.js +2 -15
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-quick-navigation/index.js +4 -1
- package/build-module/components/block-quick-navigation/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-mode-toggle.js +29 -34
- package/build-module/components/block-settings-menu/block-mode-toggle.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +4 -0
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +22 -17
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +1 -4
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +12 -11
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +6 -2
- package/build-module/components/block-toolbar/shuffle.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +8 -2
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-popover.js +10 -6
- package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +14 -3
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js +2 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +2 -1
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +4 -5
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-popover.js +3 -4
- package/build-module/components/block-tools/zoom-out-popover.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js +15 -6
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build-module/components/block-variation-picker/index.js +4 -1
- package/build-module/components/block-variation-picker/index.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +4 -1
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/border-radius-control/index.js +1 -0
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/button-block-appender/index.js +15 -4
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +4 -1
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/content-lock/index.js +2 -0
- package/build-module/components/content-lock/index.js.map +1 -0
- package/build-module/components/content-lock/modify-content-lock-menu-item.js +57 -0
- package/build-module/components/content-lock/modify-content-lock-menu-item.js.map +1 -0
- package/build-module/components/convert-to-group-buttons/index.js +1 -1
- package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +2 -0
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/editor-styles/index.js +4 -3
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +3 -0
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/font-family/index.js +3 -0
- package/build-module/components/font-family/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +121 -53
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +7 -4
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.native.js +2 -2
- package/build-module/components/global-styles/color-panel.native.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +36 -39
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +4 -1
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +3 -1
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +0 -6
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +1 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel-components.js +13 -7
- package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +17 -6
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +5 -5
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +11 -28
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/grid/grid-item-movers.js +3 -3
- package/build-module/components/grid/grid-item-movers.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js +20 -5
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/height-control/index.js +1 -0
- package/build-module/components/height-control/index.js.map +1 -1
- package/build-module/components/iframe/index.js +8 -6
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/zoom-dropdown.js +12 -8
- package/build-module/components/image-editor/zoom-dropdown.js.map +1 -1
- package/build-module/components/inner-blocks/button-block-appender.js +7 -6
- package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build-module/components/inner-blocks/default-block-appender.js +6 -23
- package/build-module/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +8 -12
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +3 -3
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +4 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js +4 -1
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +3 -3
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-list.js +1 -4
- package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +8 -2
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-tab.js +4 -1
- package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build-module/components/inserter/menu.js +14 -13
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +9 -2
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +4 -4
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/inserter-listbox/index.js +3 -7
- package/build-module/components/inserter-listbox/index.js.map +1 -1
- package/build-module/components/inserter-listbox/item.js +4 -1
- package/build-module/components/inserter-listbox/item.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +2 -0
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +4 -1
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/settings-tab.js +3 -1
- package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +2 -1
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build-module/components/inspector-popover-header/index.js +8 -2
- package/build-module/components/inspector-popover-header/index.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +7 -4
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js +3 -0
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/index.js +19 -10
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +4 -1
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +4 -1
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +36 -10
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +8 -1
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +4 -1
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/multi-selection-inspector/index.js +12 -12
- package/build-module/components/multi-selection-inspector/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +19 -19
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/paste-handler.js +12 -1
- package/build-module/components/rich-text/event-listeners/paste-handler.js.map +1 -1
- package/build-module/components/rich-text/index.js +39 -31
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-mark-persistent.js +5 -5
- package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js +4 -1
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -2
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/text-alignment-control/index.js +13 -8
- package/build-module/components/text-alignment-control/index.js.map +1 -1
- package/build-module/components/text-decoration-control/index.js +13 -8
- package/build-module/components/text-decoration-control/index.js.map +1 -1
- package/build-module/components/text-transform-control/index.js +13 -8
- package/build-module/components/text-transform-control/index.js.map +1 -1
- package/build-module/components/tool-selector/index.js +4 -1
- package/build-module/components/tool-selector/index.js.map +1 -1
- package/build-module/components/url-input/button.js +12 -3
- package/build-module/components/url-input/button.js.map +1 -1
- package/build-module/components/url-input/index.js +4 -1
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +2 -0
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +12 -2
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/writing-flow/index.js +2 -1
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +4 -1
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/components/writing-flow/use-event-redirect.js +60 -0
- package/build-module/components/writing-flow/use-event-redirect.js.map +1 -0
- package/build-module/components/writing-flow/use-input.js +31 -1
- package/build-module/components/writing-flow/use-input.js.map +1 -1
- package/build-module/components/writing-flow/use-select-all.js +14 -1
- package/build-module/components/writing-flow/use-select-all.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +16 -2
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +4 -4
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/components/writing-flow/utils.js +26 -0
- package/build-module/components/writing-flow/utils.js.map +1 -1
- package/build-module/components/writing-mode-control/index.js +13 -8
- package/build-module/components/writing-mode-control/index.js.map +1 -1
- package/build-module/hooks/background.js +19 -23
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-bindings.js +66 -105
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +10 -30
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/duotone.js +0 -4
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/layout.js +4 -1
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/spacing-visualizer.js +3 -3
- package/build-module/hooks/spacing-visualizer.js.map +1 -1
- package/build-module/hooks/style.js +1 -5
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +19 -20
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/use-zoom-out.js +7 -7
- package/build-module/hooks/use-zoom-out.js.map +1 -1
- package/build-module/layouts/constrained.js +44 -43
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/flex.js +6 -1
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/grid.js +3 -0
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/layouts/utils.js +1 -7
- package/build-module/layouts/utils.js.map +1 -1
- package/build-module/private-apis.js +5 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +2 -7
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +1 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-keys.js +1 -0
- package/build-module/store/private-keys.js.map +1 -1
- package/build-module/store/private-selectors.js +36 -12
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +2 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +22 -46
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +46 -0
- package/build-module/store/utils.js.map +1 -1
- package/build-module/utils/block-bindings.js +110 -0
- package/build-module/utils/block-bindings.js.map +1 -0
- package/build-module/utils/dom.js +99 -0
- package/build-module/utils/dom.js.map +1 -1
- package/build-module/utils/get-font-styles-and-weights.js +4 -4
- package/build-module/utils/get-font-styles-and-weights.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +120 -16
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/content-rtl.css +9 -25
- package/build-style/content.css +9 -25
- package/build-style/default-editor-styles-rtl.css +2 -2
- package/build-style/default-editor-styles.css +2 -2
- package/build-style/style-rtl.css +53 -76
- package/build-style/style.css +53 -76
- package/build-types/utils/dom.d.ts +25 -0
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +34 -32
- package/src/autocompleters/block.js +2 -1
- package/src/components/block-alignment-matrix-control/index.js +1 -1
- package/src/components/block-breadcrumb/index.js +4 -0
- package/src/components/block-breadcrumb/style.scss +1 -1
- package/src/components/block-canvas/index.js +9 -1
- package/src/components/block-compare/block-view.js +7 -1
- package/src/components/block-draggable/content.scss +1 -1
- package/src/components/block-draggable/index.js +4 -4
- package/src/components/block-draggable/style.scss +1 -1
- package/src/components/block-draggable/use-scroll-when-dragging.js +25 -25
- package/src/components/block-edit/multiple-usage-warning.js +4 -0
- package/src/components/block-inspector/index.js +22 -6
- package/src/components/block-list/block-invalid-warning.js +4 -2
- package/src/components/block-list/block.js +6 -2
- package/src/components/block-list/content.scss +7 -16
- package/src/components/block-list/use-block-props/index.js +5 -2
- package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -0
- package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +44 -0
- package/src/components/block-list/use-in-between-inserter.js +17 -5
- package/src/components/block-lock/style.scss +1 -1
- package/src/components/block-lock/toolbar.js +3 -3
- package/src/components/block-mover/button.js +2 -0
- package/src/components/block-mover/index.js +2 -0
- package/src/components/block-mover/style.scss +1 -1
- package/src/components/block-navigation/dropdown.js +2 -0
- package/src/components/block-pattern-setup/index.js +3 -7
- package/src/components/block-pattern-setup/setup-toolbar.js +17 -4
- package/src/components/block-pattern-setup/style.scss +2 -2
- package/src/components/block-patterns-list/index.js +15 -13
- package/src/components/block-patterns-list/style.scss +2 -2
- package/src/components/block-patterns-paging/index.js +6 -0
- package/src/components/block-popover/index.js +7 -28
- package/src/components/block-popover/style.scss +1 -1
- package/src/components/block-quick-navigation/index.js +2 -0
- package/src/components/block-settings-menu/block-mode-toggle.js +28 -31
- package/src/components/block-settings-menu/test/block-mode-toggle.js +26 -23
- package/src/components/block-settings-menu-controls/index.js +7 -1
- package/src/components/block-switcher/index.js +26 -20
- package/src/components/block-switcher/pattern-transformations-menu.js +3 -7
- package/src/components/block-switcher/style.scss +5 -6
- package/src/components/block-toolbar/index.js +17 -8
- package/src/components/block-toolbar/shuffle.js +9 -7
- package/src/components/block-tools/block-selection-button.js +4 -0
- package/src/components/block-tools/block-toolbar-popover.js +10 -6
- package/src/components/block-tools/insertion-point.js +11 -0
- package/src/components/block-tools/style.scss +4 -5
- package/src/components/block-tools/use-block-toolbar-popover-props.js +2 -1
- package/src/components/block-tools/use-show-block-tools.js +4 -1
- package/src/components/block-tools/zoom-out-mode-inserters.js +5 -2
- package/src/components/block-tools/zoom-out-popover.js +3 -7
- package/src/components/block-tools/zoom-out-toolbar.js +20 -6
- package/src/components/block-variation-picker/README.md +2 -2
- package/src/components/block-variation-picker/index.js +6 -1
- package/src/components/block-variation-transforms/index.js +2 -0
- package/src/components/block-variation-transforms/style.scss +2 -2
- package/src/components/border-radius-control/index.js +1 -0
- package/src/components/border-radius-control/style.scss +0 -10
- package/src/components/button-block-appender/content.scss +0 -1
- package/src/components/button-block-appender/index.js +14 -3
- package/src/components/color-palette/test/control.js +15 -2
- package/src/components/colors-gradients/dropdown.js +5 -1
- package/src/components/colors-gradients/style.scss +4 -4
- package/src/components/content-lock/index.js +1 -0
- package/src/components/content-lock/modify-content-lock-menu-item.js +58 -0
- package/src/components/convert-to-group-buttons/index.js +1 -1
- package/src/components/date-format-picker/index.js +2 -0
- package/src/components/default-block-appender/content.scss +0 -1
- package/src/components/editor-styles/index.js +4 -3
- package/src/components/font-appearance-control/index.js +3 -0
- package/src/components/font-family/README.md +11 -2
- package/src/components/font-family/index.js +3 -0
- package/src/components/global-styles/background-panel.js +135 -64
- package/src/components/global-styles/color-panel.js +8 -4
- package/src/components/global-styles/color-panel.native.js +2 -2
- package/src/components/global-styles/dimensions-panel.js +40 -40
- package/src/components/global-styles/filters-panel.js +5 -1
- package/src/components/global-styles/get-global-styles-changes.js +4 -1
- package/src/components/global-styles/hooks.js +0 -5
- package/src/components/global-styles/index.js +0 -1
- package/src/components/global-styles/shadow-panel-components.js +12 -8
- package/src/components/global-styles/style.scss +16 -6
- package/src/components/global-styles/test/typography-utils.js +96 -5
- package/src/components/global-styles/test/use-global-styles-output.js +20 -4
- package/src/components/global-styles/test/utils.js +10 -0
- package/src/components/global-styles/typography-utils.js +22 -6
- package/src/components/global-styles/use-global-styles-output.js +5 -6
- package/src/components/global-styles/utils.js +11 -35
- package/src/components/grid/grid-item-movers.js +3 -3
- package/src/components/grid/grid-visualizer.js +22 -7
- package/src/components/grid/style.scss +1 -1
- package/src/components/height-control/index.js +1 -0
- package/src/components/iframe/index.js +8 -6
- package/src/components/image-editor/zoom-dropdown.js +17 -9
- package/src/components/inner-blocks/button-block-appender.js +5 -7
- package/src/components/inner-blocks/default-block-appender.js +4 -23
- package/src/components/inner-blocks/index.js +11 -10
- package/src/components/inner-blocks/use-inner-block-template-sync.js +3 -3
- package/src/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +2 -0
- package/src/components/inserter/block-patterns-tab/index.js +2 -0
- package/src/components/inserter/media-tab/hooks.js +3 -3
- package/src/components/inserter/media-tab/media-list.js +1 -4
- package/src/components/inserter/media-tab/media-preview.js +12 -2
- package/src/components/inserter/media-tab/media-tab.js +2 -0
- package/src/components/inserter/menu.js +13 -22
- package/src/components/inserter/quick-inserter.js +6 -1
- package/src/components/inserter/style.scss +7 -9
- package/src/components/inserter-list-item/index.js +4 -4
- package/src/components/inserter-list-item/style.scss +2 -3
- package/src/components/inserter-listbox/index.js +2 -8
- package/src/components/inserter-listbox/item.js +9 -1
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/index.js +2 -0
- package/src/components/inspector-controls-tabs/settings-tab.js +1 -0
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +5 -2
- package/src/components/inspector-popover-header/index.js +4 -0
- package/src/components/letter-spacing-control/README.md +8 -1
- package/src/components/letter-spacing-control/index.js +7 -4
- package/src/components/line-height-control/README.md +7 -0
- package/src/components/line-height-control/index.js +3 -0
- package/src/components/link-control/index.js +17 -8
- package/src/components/link-control/settings-drawer.js +2 -0
- package/src/components/link-control/style.scss +2 -4
- package/src/components/list-view/block-select-button.js +2 -0
- package/src/components/list-view/style.scss +14 -16
- package/src/components/media-placeholder/index.js +26 -7
- package/src/components/media-replace-flow/index.js +12 -1
- package/src/components/media-upload/README.md +2 -0
- package/src/components/media-upload/index.native.js +2 -0
- package/src/components/multi-selection-inspector/index.js +8 -9
- package/src/components/provider/use-block-sync.js +20 -20
- package/src/components/responsive-block-control/README.md +3 -26
- package/src/components/responsive-block-control/test/index.js +1 -0
- package/src/components/rich-text/content.scss +1 -1
- package/src/components/rich-text/event-listeners/paste-handler.js +6 -1
- package/src/components/rich-text/index.js +54 -41
- package/src/components/rich-text/style.scss +1 -1
- package/src/components/rich-text/use-mark-persistent.js +5 -5
- package/src/components/skip-to-selected-block/index.js +2 -0
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +8 -4
- package/src/components/spacing-sizes-control/style.scss +17 -16
- package/src/components/text-alignment-control/index.js +20 -8
- package/src/components/text-decoration-control/index.js +20 -8
- package/src/components/text-decoration-control/stories/index.story.js +0 -4
- package/src/components/text-transform-control/index.js +20 -8
- package/src/components/text-transform-control/stories/index.story.js +0 -4
- package/src/components/tool-selector/index.js +2 -0
- package/src/components/url-input/button.js +6 -0
- package/src/components/url-input/index.js +2 -0
- package/src/components/url-input/style.scss +2 -2
- package/src/components/url-popover/image-url-input-ui.js +2 -0
- package/src/components/url-popover/stories/index.story.js +7 -1
- package/src/components/use-block-drop-zone/index.js +21 -3
- package/src/components/warning/content.scss +3 -10
- package/src/components/writing-flow/index.js +2 -0
- package/src/components/writing-flow/use-arrow-nav.js +9 -2
- package/src/components/writing-flow/use-event-redirect.js +72 -0
- package/src/components/writing-flow/use-input.js +36 -1
- package/src/components/writing-flow/use-select-all.js +18 -1
- package/src/components/writing-flow/use-selection-observer.js +23 -3
- package/src/components/writing-flow/use-tab-nav.js +4 -4
- package/src/components/writing-flow/utils.js +30 -0
- package/src/components/writing-mode-control/index.js +20 -8
- package/src/hooks/background.js +21 -27
- package/src/hooks/block-bindings.js +64 -122
- package/src/hooks/block-bindings.scss +2 -10
- package/src/hooks/content-lock-ui.js +11 -36
- package/src/hooks/duotone.js +0 -4
- package/src/hooks/layout.js +2 -0
- package/src/hooks/layout.scss +3 -11
- package/src/hooks/spacing-visualizer.js +3 -3
- package/src/hooks/style.js +1 -4
- package/src/hooks/test/background.js +60 -0
- package/src/hooks/use-bindings-attributes.js +23 -24
- package/src/hooks/use-zoom-out.js +7 -7
- package/src/layouts/constrained.js +51 -47
- package/src/layouts/flex.js +4 -0
- package/src/layouts/grid.js +3 -0
- package/src/layouts/test/grid.js +2 -2
- package/src/layouts/test/utils.js +6 -8
- package/src/layouts/utils.js +1 -9
- package/src/private-apis.js +4 -0
- package/src/store/actions.js +4 -6
- package/src/store/private-actions.js +1 -0
- package/src/store/private-keys.js +1 -0
- package/src/store/private-selectors.js +44 -7
- package/src/store/reducer.js +2 -0
- package/src/store/selectors.js +32 -51
- package/src/store/test/private-selectors.js +89 -0
- package/src/store/utils.js +50 -0
- package/src/style.scss +0 -1
- package/src/utils/block-bindings.js +97 -0
- package/src/utils/dom.js +117 -0
- package/src/utils/get-font-styles-and-weights.js +12 -4
- package/src/utils/test/get-font-styles-and-weights.js +148 -0
- package/src/utils/test/transform-styles.js +284 -26
- package/src/utils/transform-styles/index.js +132 -21
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/global-styles/theme-file-uri-utils.js +0 -21
- package/build/components/global-styles/theme-file-uri-utils.js.map +0 -1
- package/build/components/inner-blocks/with-client-id.js +0 -28
- package/build/components/inner-blocks/with-client-id.js.map +0 -1
- package/build/components/segmented-text-control/index.js +0 -63
- package/build/components/segmented-text-control/index.js.map +0 -1
- package/build-module/components/global-styles/theme-file-uri-utils.js +0 -15
- package/build-module/components/global-styles/theme-file-uri-utils.js.map +0 -1
- package/build-module/components/inner-blocks/with-client-id.js +0 -21
- package/build-module/components/inner-blocks/with-client-id.js.map +0 -1
- package/build-module/components/segmented-text-control/index.js +0 -58
- package/build-module/components/segmented-text-control/index.js.map +0 -1
- package/src/components/global-styles/test/theme-file-uri-utils.js +0 -41
- package/src/components/global-styles/theme-file-uri-utils.js +0 -18
- package/src/components/inner-blocks/with-client-id.js +0 -19
- package/src/components/segmented-text-control/index.js +0 -63
- package/src/components/segmented-text-control/style.scss +0 -15
- package/src/utils/test/__snapshots__/transform-styles.js.snap +0 -109
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { privateApis as blocksPrivateApis } from '@wordpress/blocks';
|
|
6
|
-
import { __experimentalItemGroup as ItemGroup, __experimentalItem as Item, __experimentalText as Text, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem,
|
|
7
|
-
import {
|
|
6
|
+
import { __experimentalItemGroup as ItemGroup, __experimentalItem as Item, __experimentalText as Text, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, __experimentalVStack as VStack, privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
7
|
+
import { useRegistry, useSelect } from '@wordpress/data';
|
|
8
8
|
import { useContext, Fragment } from '@wordpress/element';
|
|
9
9
|
import { useViewportMatch } from '@wordpress/compose';
|
|
10
10
|
|
|
@@ -12,20 +12,16 @@ import { useViewportMatch } from '@wordpress/compose';
|
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
14
|
import { canBindAttribute, getBindableAttributes } from '../hooks/use-bindings-attributes';
|
|
15
|
-
import { store as blockEditorStore } from '../store';
|
|
16
15
|
import { unlock } from '../lock-unlock';
|
|
17
16
|
import InspectorControls from '../components/inspector-controls';
|
|
18
17
|
import BlockContext from '../components/block-context';
|
|
18
|
+
import { useBlockBindingsUtils } from '../utils/block-bindings';
|
|
19
|
+
import { store as blockEditorStore } from '../store';
|
|
19
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
21
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
22
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
22
23
|
const {
|
|
23
|
-
DropdownMenuV2
|
|
24
|
-
DropdownMenuGroupV2: DropdownMenuGroup,
|
|
25
|
-
DropdownMenuRadioItemV2: DropdownMenuRadioItem,
|
|
26
|
-
DropdownMenuItemLabelV2: DropdownMenuItemLabel,
|
|
27
|
-
DropdownMenuItemHelpTextV2: DropdownMenuItemHelpText,
|
|
28
|
-
DropdownMenuSeparatorV2: DropdownMenuSeparator
|
|
24
|
+
DropdownMenuV2
|
|
29
25
|
} = unlock(componentsPrivateApis);
|
|
30
26
|
const useToolsPanelDropdownMenuProps = () => {
|
|
31
27
|
const isMobile = useViewportMatch('medium', '<');
|
|
@@ -39,33 +35,42 @@ const useToolsPanelDropdownMenuProps = () => {
|
|
|
39
35
|
};
|
|
40
36
|
function BlockBindingsPanelDropdown({
|
|
41
37
|
fieldsList,
|
|
42
|
-
addConnection,
|
|
43
38
|
attribute,
|
|
44
39
|
binding
|
|
45
40
|
}) {
|
|
41
|
+
const {
|
|
42
|
+
getBlockBindingsSources
|
|
43
|
+
} = unlock(blocksPrivateApis);
|
|
44
|
+
const registeredSources = getBlockBindingsSources();
|
|
45
|
+
const {
|
|
46
|
+
updateBlockBindings
|
|
47
|
+
} = useBlockBindingsUtils();
|
|
46
48
|
const currentKey = binding?.args?.key;
|
|
47
49
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
48
|
-
children: Object.entries(fieldsList).map(([
|
|
49
|
-
children: [/*#__PURE__*/_jsxs(
|
|
50
|
-
children: [Object.keys(fieldsList).length > 1 && /*#__PURE__*/_jsx(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
children: Object.entries(fieldsList).map(([name, fields], i) => /*#__PURE__*/_jsxs(Fragment, {
|
|
51
|
+
children: [/*#__PURE__*/_jsxs(DropdownMenuV2.Group, {
|
|
52
|
+
children: [Object.keys(fieldsList).length > 1 && /*#__PURE__*/_jsx(DropdownMenuV2.GroupLabel, {
|
|
53
|
+
children: registeredSources[name].label
|
|
54
|
+
}), Object.entries(fields).map(([key, value]) => /*#__PURE__*/_jsxs(DropdownMenuV2.RadioItem, {
|
|
55
|
+
onChange: () => updateBlockBindings({
|
|
56
|
+
[attribute]: {
|
|
57
|
+
source: name,
|
|
58
|
+
args: {
|
|
59
|
+
key
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}),
|
|
58
63
|
name: attribute + '-binding',
|
|
59
64
|
value: key,
|
|
60
65
|
checked: key === currentKey,
|
|
61
|
-
children: [/*#__PURE__*/_jsx(
|
|
66
|
+
children: [/*#__PURE__*/_jsx(DropdownMenuV2.ItemLabel, {
|
|
62
67
|
children: key
|
|
63
|
-
}), /*#__PURE__*/_jsx(
|
|
68
|
+
}), /*#__PURE__*/_jsx(DropdownMenuV2.ItemHelpText, {
|
|
64
69
|
children: value
|
|
65
70
|
})]
|
|
66
71
|
}, key))]
|
|
67
|
-
}), i !== Object.keys(fieldsList).length - 1 && /*#__PURE__*/_jsx(
|
|
68
|
-
},
|
|
72
|
+
}), i !== Object.keys(fieldsList).length - 1 && /*#__PURE__*/_jsx(DropdownMenuV2.Separator, {})]
|
|
73
|
+
}, name))
|
|
69
74
|
});
|
|
70
75
|
}
|
|
71
76
|
function BlockBindingsAttribute({
|
|
@@ -77,15 +82,17 @@ function BlockBindingsAttribute({
|
|
|
77
82
|
args
|
|
78
83
|
} = binding || {};
|
|
79
84
|
const sourceProps = unlock(blocksPrivateApis).getBlockBindingsSource(sourceName);
|
|
85
|
+
const isSourceInvalid = !sourceProps;
|
|
80
86
|
return /*#__PURE__*/_jsxs(VStack, {
|
|
81
|
-
|
|
87
|
+
className: "block-editor-bindings__item",
|
|
88
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
89
|
+
truncate: true,
|
|
82
90
|
children: attribute
|
|
83
91
|
}), !!binding && /*#__PURE__*/_jsx(Text, {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
})
|
|
92
|
+
truncate: true,
|
|
93
|
+
variant: !isSourceInvalid && 'muted',
|
|
94
|
+
isDestructive: isSourceInvalid,
|
|
95
|
+
children: isSourceInvalid ? __('Invalid source') : args?.key || sourceProps?.label || sourceName
|
|
89
96
|
})]
|
|
90
97
|
});
|
|
91
98
|
}
|
|
@@ -104,10 +111,11 @@ function ReadOnlyBlockBindingsPanelItems({
|
|
|
104
111
|
function EditableBlockBindingsPanelItems({
|
|
105
112
|
attributes,
|
|
106
113
|
bindings,
|
|
107
|
-
fieldsList
|
|
108
|
-
addConnection,
|
|
109
|
-
removeConnection
|
|
114
|
+
fieldsList
|
|
110
115
|
}) {
|
|
116
|
+
const {
|
|
117
|
+
updateBlockBindings
|
|
118
|
+
} = useBlockBindingsUtils();
|
|
111
119
|
const isMobile = useViewportMatch('medium', '<');
|
|
112
120
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
113
121
|
children: attributes.map(attribute => {
|
|
@@ -116,12 +124,13 @@ function EditableBlockBindingsPanelItems({
|
|
|
116
124
|
hasValue: () => !!binding,
|
|
117
125
|
label: attribute,
|
|
118
126
|
onDeselect: () => {
|
|
119
|
-
|
|
127
|
+
updateBlockBindings({
|
|
128
|
+
[attribute]: undefined
|
|
129
|
+
});
|
|
120
130
|
},
|
|
121
|
-
children: /*#__PURE__*/_jsx(
|
|
131
|
+
children: /*#__PURE__*/_jsx(DropdownMenuV2, {
|
|
122
132
|
placement: isMobile ? 'bottom-start' : 'left-start',
|
|
123
133
|
gutter: isMobile ? 8 : 36,
|
|
124
|
-
className: "block-editor-bindings__popover",
|
|
125
134
|
trigger: /*#__PURE__*/_jsx(Item, {
|
|
126
135
|
children: /*#__PURE__*/_jsx(BlockBindingsAttribute, {
|
|
127
136
|
attribute: attribute,
|
|
@@ -130,7 +139,6 @@ function EditableBlockBindingsPanelItems({
|
|
|
130
139
|
}),
|
|
131
140
|
children: /*#__PURE__*/_jsx(BlockBindingsPanelDropdown, {
|
|
132
141
|
fieldsList: fieldsList,
|
|
133
|
-
addConnection: addConnection,
|
|
134
142
|
attribute: attribute,
|
|
135
143
|
binding: binding
|
|
136
144
|
})
|
|
@@ -140,7 +148,7 @@ function EditableBlockBindingsPanelItems({
|
|
|
140
148
|
});
|
|
141
149
|
}
|
|
142
150
|
export const BlockBindingsPanel = ({
|
|
143
|
-
name,
|
|
151
|
+
name: blockName,
|
|
144
152
|
metadata
|
|
145
153
|
}) => {
|
|
146
154
|
const registry = useRegistry();
|
|
@@ -148,86 +156,38 @@ export const BlockBindingsPanel = ({
|
|
|
148
156
|
const {
|
|
149
157
|
bindings
|
|
150
158
|
} = metadata || {};
|
|
151
|
-
const
|
|
159
|
+
const {
|
|
160
|
+
removeAllBlockBindings
|
|
161
|
+
} = useBlockBindingsUtils();
|
|
162
|
+
const bindableAttributes = getBindableAttributes(blockName);
|
|
152
163
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
153
164
|
const filteredBindings = {
|
|
154
165
|
...bindings
|
|
155
166
|
};
|
|
156
167
|
Object.keys(filteredBindings).forEach(key => {
|
|
157
|
-
if (!canBindAttribute(
|
|
168
|
+
if (!canBindAttribute(blockName, key) || filteredBindings[key].source === 'core/pattern-overrides') {
|
|
158
169
|
delete filteredBindings[key];
|
|
159
170
|
}
|
|
160
171
|
});
|
|
161
172
|
const {
|
|
162
|
-
|
|
163
|
-
} = useDispatch(blockEditorStore);
|
|
164
|
-
const {
|
|
165
|
-
_id
|
|
173
|
+
canUpdateBlockBindings
|
|
166
174
|
} = useSelect(select => {
|
|
167
|
-
const {
|
|
168
|
-
getSelectedBlockClientId
|
|
169
|
-
} = select(blockEditorStore);
|
|
170
175
|
return {
|
|
171
|
-
|
|
176
|
+
canUpdateBlockBindings: select(blockEditorStore).getSettings().canUpdateBlockBindings
|
|
172
177
|
};
|
|
173
178
|
}, []);
|
|
174
179
|
if (!bindableAttributes || bindableAttributes.length === 0) {
|
|
175
180
|
return null;
|
|
176
181
|
}
|
|
177
|
-
const removeAllConnections = () => {
|
|
178
|
-
const newMetadata = {
|
|
179
|
-
...metadata
|
|
180
|
-
};
|
|
181
|
-
delete newMetadata.bindings;
|
|
182
|
-
updateBlockAttributes(_id, {
|
|
183
|
-
metadata: Object.keys(newMetadata).length === 0 ? undefined : newMetadata
|
|
184
|
-
});
|
|
185
|
-
};
|
|
186
|
-
const addConnection = (value, attribute) => {
|
|
187
|
-
// Assuming the block expects a flat structure for its metadata attribute
|
|
188
|
-
const newMetadata = {
|
|
189
|
-
...metadata,
|
|
190
|
-
// Adjust this according to the actual structure expected by your block
|
|
191
|
-
bindings: {
|
|
192
|
-
...metadata?.bindings,
|
|
193
|
-
[attribute]: {
|
|
194
|
-
source: 'core/post-meta',
|
|
195
|
-
args: {
|
|
196
|
-
key: value
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
// Update the block's attributes with the new metadata
|
|
202
|
-
updateBlockAttributes(_id, {
|
|
203
|
-
metadata: newMetadata
|
|
204
|
-
});
|
|
205
|
-
};
|
|
206
|
-
const removeConnection = key => {
|
|
207
|
-
const newMetadata = {
|
|
208
|
-
...metadata
|
|
209
|
-
};
|
|
210
|
-
if (!newMetadata.bindings) {
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
delete newMetadata.bindings[key];
|
|
214
|
-
if (Object.keys(newMetadata.bindings).length === 0) {
|
|
215
|
-
delete newMetadata.bindings;
|
|
216
|
-
}
|
|
217
|
-
updateBlockAttributes(_id, {
|
|
218
|
-
metadata: Object.keys(newMetadata).length === 0 ? undefined : newMetadata
|
|
219
|
-
});
|
|
220
|
-
};
|
|
221
182
|
const fieldsList = {};
|
|
222
183
|
const {
|
|
223
184
|
getBlockBindingsSources
|
|
224
185
|
} = unlock(blocksPrivateApis);
|
|
225
186
|
const registeredSources = getBlockBindingsSources();
|
|
226
|
-
Object.
|
|
187
|
+
Object.entries(registeredSources).forEach(([sourceName, {
|
|
227
188
|
getFieldsList,
|
|
228
|
-
label,
|
|
229
189
|
usesContext
|
|
230
|
-
}) => {
|
|
190
|
+
}]) => {
|
|
231
191
|
if (getFieldsList) {
|
|
232
192
|
// Populate context.
|
|
233
193
|
const context = {};
|
|
@@ -242,7 +202,7 @@ export const BlockBindingsPanel = ({
|
|
|
242
202
|
});
|
|
243
203
|
// Only add source if the list is not empty.
|
|
244
204
|
if (sourceList) {
|
|
245
|
-
fieldsList[
|
|
205
|
+
fieldsList[sourceName] = {
|
|
246
206
|
...sourceList
|
|
247
207
|
};
|
|
248
208
|
}
|
|
@@ -255,16 +215,17 @@ export const BlockBindingsPanel = ({
|
|
|
255
215
|
}
|
|
256
216
|
});
|
|
257
217
|
|
|
258
|
-
// Lock the UI when the
|
|
259
|
-
const readOnly = !
|
|
218
|
+
// Lock the UI when the user can't update bindings or there are no fields to connect to.
|
|
219
|
+
const readOnly = !canUpdateBlockBindings || !Object.keys(fieldsList).length;
|
|
260
220
|
if (readOnly && Object.keys(filteredBindings).length === 0) {
|
|
261
221
|
return null;
|
|
262
222
|
}
|
|
263
223
|
return /*#__PURE__*/_jsx(InspectorControls, {
|
|
224
|
+
group: "bindings",
|
|
264
225
|
children: /*#__PURE__*/_jsxs(ToolsPanel, {
|
|
265
226
|
label: __('Attributes'),
|
|
266
227
|
resetAll: () => {
|
|
267
|
-
|
|
228
|
+
removeAllBlockBindings();
|
|
268
229
|
},
|
|
269
230
|
dropdownMenuProps: dropdownMenuProps,
|
|
270
231
|
className: "block-editor-bindings__panel",
|
|
@@ -276,13 +237,13 @@ export const BlockBindingsPanel = ({
|
|
|
276
237
|
}) : /*#__PURE__*/_jsx(EditableBlockBindingsPanelItems, {
|
|
277
238
|
attributes: bindableAttributes,
|
|
278
239
|
bindings: filteredBindings,
|
|
279
|
-
fieldsList: fieldsList
|
|
280
|
-
|
|
281
|
-
|
|
240
|
+
fieldsList: fieldsList
|
|
241
|
+
})
|
|
242
|
+
}), /*#__PURE__*/_jsx(ItemGroup, {
|
|
243
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
244
|
+
variant: "muted",
|
|
245
|
+
children: __('Attributes connected to custom fields or other dynamic data.')
|
|
282
246
|
})
|
|
283
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
284
|
-
variant: "muted",
|
|
285
|
-
children: __('Attributes connected to various sources.')
|
|
286
247
|
})]
|
|
287
248
|
})
|
|
288
249
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","privateApis","blocksPrivateApis","__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__experimentalText","Text","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalTruncate","Truncate","__experimentalVStack","VStack","componentsPrivateApis","useSelect","useDispatch","useRegistry","useContext","Fragment","useViewportMatch","canBindAttribute","getBindableAttributes","store","blockEditorStore","unlock","InspectorControls","BlockContext","jsx","_jsx","jsxs","_jsxs","_Fragment","DropdownMenuV2","DropdownMenu","DropdownMenuGroupV2","DropdownMenuGroup","DropdownMenuRadioItemV2","DropdownMenuRadioItem","DropdownMenuItemLabelV2","DropdownMenuItemLabel","DropdownMenuItemHelpTextV2","DropdownMenuItemHelpText","DropdownMenuSeparatorV2","DropdownMenuSeparator","useToolsPanelDropdownMenuProps","isMobile","popoverProps","placement","offset","BlockBindingsPanelDropdown","fieldsList","addConnection","attribute","binding","currentKey","args","key","children","Object","entries","map","label","fields","i","keys","length","className","upperCase","variant","value","onChange","name","checked","BlockBindingsAttribute","source","sourceName","sourceProps","getBlockBindingsSource","ReadOnlyBlockBindingsPanelItems","bindings","EditableBlockBindingsPanelItems","attributes","removeConnection","hasValue","onDeselect","gutter","trigger","BlockBindingsPanel","metadata","registry","blockContext","bindableAttributes","dropdownMenuProps","filteredBindings","forEach","updateBlockAttributes","_id","select","getSelectedBlockClientId","removeAllConnections","newMetadata","undefined","getBlockBindingsSources","registeredSources","values","getFieldsList","usesContext","context","sourceList","readOnly","window","__experimentalBlockBindingsUI","resetAll","isBordered","isSeparated","edit","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/block-bindings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalText as Text,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalTruncate as Truncate,\n\t__experimentalVStack as VStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useSelect, useDispatch, useRegistry } from '@wordpress/data';\nimport { useContext, Fragment } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcanBindAttribute,\n\tgetBindableAttributes,\n} from '../hooks/use-bindings-attributes';\nimport { store as blockEditorStore } from '../store';\nimport { unlock } from '../lock-unlock';\nimport InspectorControls from '../components/inspector-controls';\nimport BlockContext from '../components/block-context';\n\nconst {\n\tDropdownMenuV2: DropdownMenu,\n\tDropdownMenuGroupV2: DropdownMenuGroup,\n\tDropdownMenuRadioItemV2: DropdownMenuRadioItem,\n\tDropdownMenuItemLabelV2: DropdownMenuItemLabel,\n\tDropdownMenuItemHelpTextV2: DropdownMenuItemHelpText,\n\tDropdownMenuSeparatorV2: DropdownMenuSeparator,\n} = unlock( componentsPrivateApis );\n\nconst useToolsPanelDropdownMenuProps = () => {\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn ! isMobile\n\t\t? {\n\t\t\t\tpopoverProps: {\n\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t\t\t\t\toffset: 259,\n\t\t\t\t},\n\t\t }\n\t\t: {};\n};\n\nfunction BlockBindingsPanelDropdown( {\n\tfieldsList,\n\taddConnection,\n\tattribute,\n\tbinding,\n} ) {\n\tconst currentKey = binding?.args?.key;\n\treturn (\n\t\t<>\n\t\t\t{ Object.entries( fieldsList ).map( ( [ label, fields ], i ) => (\n\t\t\t\t<Fragment key={ label }>\n\t\t\t\t\t<DropdownMenuGroup>\n\t\t\t\t\t\t{ Object.keys( fieldsList ).length > 1 && (\n\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\tclassName=\"block-editor-bindings__source-label\"\n\t\t\t\t\t\t\t\tupperCase\n\t\t\t\t\t\t\t\tvariant=\"muted\"\n\t\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ Object.entries( fields ).map( ( [ key, value ] ) => (\n\t\t\t\t\t\t\t<DropdownMenuRadioItem\n\t\t\t\t\t\t\t\tkey={ key }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\taddConnection( key, attribute )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tname={ attribute + '-binding' }\n\t\t\t\t\t\t\t\tvalue={ key }\n\t\t\t\t\t\t\t\tchecked={ key === currentKey }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<DropdownMenuItemLabel>\n\t\t\t\t\t\t\t\t\t{ key }\n\t\t\t\t\t\t\t\t</DropdownMenuItemLabel>\n\t\t\t\t\t\t\t\t<DropdownMenuItemHelpText>\n\t\t\t\t\t\t\t\t\t{ value }\n\t\t\t\t\t\t\t\t</DropdownMenuItemHelpText>\n\t\t\t\t\t\t\t</DropdownMenuRadioItem>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</DropdownMenuGroup>\n\t\t\t\t\t{ i !== Object.keys( fieldsList ).length - 1 && (\n\t\t\t\t\t\t<DropdownMenuSeparator />\n\t\t\t\t\t) }\n\t\t\t\t</Fragment>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction BlockBindingsAttribute( { attribute, binding } ) {\n\tconst { source: sourceName, args } = binding || {};\n\tconst sourceProps =\n\t\tunlock( blocksPrivateApis ).getBlockBindingsSource( sourceName );\n\treturn (\n\t\t<VStack>\n\t\t\t<Truncate>{ attribute }</Truncate>\n\t\t\t{ !! binding && (\n\t\t\t\t<Text\n\t\t\t\t\tvariant=\"muted\"\n\t\t\t\t\tclassName=\"block-editor-bindings__item-explanation\"\n\t\t\t\t>\n\t\t\t\t\t<Truncate>\n\t\t\t\t\t\t{ args?.key || sourceProps?.label || sourceName }\n\t\t\t\t\t</Truncate>\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nfunction ReadOnlyBlockBindingsPanelItems( { bindings } ) {\n\treturn (\n\t\t<>\n\t\t\t{ Object.entries( bindings ).map( ( [ attribute, binding ] ) => (\n\t\t\t\t<Item key={ attribute }>\n\t\t\t\t\t<BlockBindingsAttribute\n\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t/>\n\t\t\t\t</Item>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction EditableBlockBindingsPanelItems( {\n\tattributes,\n\tbindings,\n\tfieldsList,\n\taddConnection,\n\tremoveConnection,\n} ) {\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn (\n\t\t<>\n\t\t\t{ attributes.map( ( attribute ) => {\n\t\t\t\tconst binding = bindings[ attribute ];\n\t\t\t\treturn (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tkey={ attribute }\n\t\t\t\t\t\thasValue={ () => !! binding }\n\t\t\t\t\t\tlabel={ attribute }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tremoveConnection( attribute );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\tplacement={\n\t\t\t\t\t\t\t\tisMobile ? 'bottom-start' : 'left-start'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgutter={ isMobile ? 8 : 36 }\n\t\t\t\t\t\t\tclassName=\"block-editor-bindings__popover\"\n\t\t\t\t\t\t\ttrigger={\n\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t<BlockBindingsAttribute\n\t\t\t\t\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockBindingsPanelDropdown\n\t\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t\t\taddConnection={ addConnection }\n\t\t\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</DropdownMenu>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nexport const BlockBindingsPanel = ( { name, metadata } ) => {\n\tconst registry = useRegistry();\n\tconst blockContext = useContext( BlockContext );\n\tconst { bindings } = metadata || {};\n\n\tconst bindableAttributes = getBindableAttributes( name );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst filteredBindings = { ...bindings };\n\tObject.keys( filteredBindings ).forEach( ( key ) => {\n\t\tif (\n\t\t\t! canBindAttribute( name, key ) ||\n\t\t\tfilteredBindings[ key ].source === 'core/pattern-overrides'\n\t\t) {\n\t\t\tdelete filteredBindings[ key ];\n\t\t}\n\t} );\n\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst { _id } = useSelect( ( select ) => {\n\t\tconst { getSelectedBlockClientId } = select( blockEditorStore );\n\n\t\treturn {\n\t\t\t_id: getSelectedBlockClientId(),\n\t\t};\n\t}, [] );\n\n\tif ( ! bindableAttributes || bindableAttributes.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst removeAllConnections = () => {\n\t\tconst newMetadata = { ...metadata };\n\t\tdelete newMetadata.bindings;\n\t\tupdateBlockAttributes( _id, {\n\t\t\tmetadata:\n\t\t\t\tObject.keys( newMetadata ).length === 0\n\t\t\t\t\t? undefined\n\t\t\t\t\t: newMetadata,\n\t\t} );\n\t};\n\n\tconst addConnection = ( value, attribute ) => {\n\t\t// Assuming the block expects a flat structure for its metadata attribute\n\t\tconst newMetadata = {\n\t\t\t...metadata,\n\t\t\t// Adjust this according to the actual structure expected by your block\n\t\t\tbindings: {\n\t\t\t\t...metadata?.bindings,\n\t\t\t\t[ attribute ]: {\n\t\t\t\t\tsource: 'core/post-meta',\n\t\t\t\t\targs: { key: value },\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t\t// Update the block's attributes with the new metadata\n\t\tupdateBlockAttributes( _id, {\n\t\t\tmetadata: newMetadata,\n\t\t} );\n\t};\n\n\tconst removeConnection = ( key ) => {\n\t\tconst newMetadata = { ...metadata };\n\t\tif ( ! newMetadata.bindings ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdelete newMetadata.bindings[ key ];\n\t\tif ( Object.keys( newMetadata.bindings ).length === 0 ) {\n\t\t\tdelete newMetadata.bindings;\n\t\t}\n\t\tupdateBlockAttributes( _id, {\n\t\t\tmetadata:\n\t\t\t\tObject.keys( newMetadata ).length === 0\n\t\t\t\t\t? undefined\n\t\t\t\t\t: newMetadata,\n\t\t} );\n\t};\n\n\tconst fieldsList = {};\n\tconst { getBlockBindingsSources } = unlock( blocksPrivateApis );\n\tconst registeredSources = getBlockBindingsSources();\n\tObject.values( registeredSources ).forEach(\n\t\t( { getFieldsList, label, usesContext } ) => {\n\t\t\tif ( getFieldsList ) {\n\t\t\t\t// Populate context.\n\t\t\t\tconst context = {};\n\t\t\t\tif ( usesContext?.length ) {\n\t\t\t\t\tfor ( const key of usesContext ) {\n\t\t\t\t\t\tcontext[ key ] = blockContext[ key ];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst sourceList = getFieldsList( {\n\t\t\t\t\tregistry,\n\t\t\t\t\tcontext,\n\t\t\t\t} );\n\t\t\t\t// Only add source if the list is not empty.\n\t\t\t\tif ( sourceList ) {\n\t\t\t\t\tfieldsList[ label ] = { ...sourceList };\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t// Remove empty sources.\n\tObject.entries( fieldsList ).forEach( ( [ key, value ] ) => {\n\t\tif ( ! Object.keys( value ).length ) {\n\t\t\tdelete fieldsList[ key ];\n\t\t}\n\t} );\n\n\t// Lock the UI when the experiment is not enabled or there are no fields to connect to.\n\tconst readOnly =\n\t\t! window.__experimentalBlockBindingsUI ||\n\t\t! Object.keys( fieldsList ).length;\n\n\tif ( readOnly && Object.keys( filteredBindings ).length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Attributes' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tremoveAllConnections();\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\tclassName=\"block-editor-bindings__panel\"\n\t\t\t>\n\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t{ readOnly ? (\n\t\t\t\t\t\t<ReadOnlyBlockBindingsPanelItems\n\t\t\t\t\t\t\tbindings={ filteredBindings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<EditableBlockBindingsPanelItems\n\t\t\t\t\t\t\tattributes={ bindableAttributes }\n\t\t\t\t\t\t\tbindings={ filteredBindings }\n\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t\taddConnection={ addConnection }\n\t\t\t\t\t\t\tremoveConnection={ removeConnection }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ItemGroup>\n\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t{ __( 'Attributes connected to various sources.' ) }\n\t\t\t\t</Text>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n};\n\nexport default {\n\tedit: BlockBindingsPanel,\n\tattributeKeys: [ 'metadata' ],\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SACCC,uBAAuB,IAAIC,SAAS,EACpCC,kBAAkB,IAAIC,IAAI,EAC1BC,kBAAkB,IAAIC,IAAI,EAC1BC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,EAC9CC,sBAAsB,IAAIC,QAAQ,EAClCC,oBAAoB,IAAIC,MAAM,EAC9Bf,WAAW,IAAIgB,qBAAqB,QAC9B,uBA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C;MAAC,CAC7C,CAAC;IAAA,CACI;EAAC,CACK,CAAC;AAEtB,CAAC;AAED,eAAe;EACduH,IAAI,EAAE5B,kBAAkB;EACxB6B,aAAa,EAAE,CAAE,UAAU,CAAE;EAC7BC,UAAUA,CAAA,EAAG;IACZ,OAAO,IAAI;EACZ;AACD,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["__","privateApis","blocksPrivateApis","__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__experimentalText","Text","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalVStack","VStack","componentsPrivateApis","useRegistry","useSelect","useContext","Fragment","useViewportMatch","canBindAttribute","getBindableAttributes","unlock","InspectorControls","BlockContext","useBlockBindingsUtils","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","_Fragment","DropdownMenuV2","useToolsPanelDropdownMenuProps","isMobile","popoverProps","placement","offset","BlockBindingsPanelDropdown","fieldsList","attribute","binding","getBlockBindingsSources","registeredSources","updateBlockBindings","currentKey","args","key","children","Object","entries","map","name","fields","i","Group","keys","length","GroupLabel","label","value","RadioItem","onChange","source","checked","ItemLabel","ItemHelpText","Separator","BlockBindingsAttribute","sourceName","sourceProps","getBlockBindingsSource","isSourceInvalid","className","truncate","variant","isDestructive","ReadOnlyBlockBindingsPanelItems","bindings","EditableBlockBindingsPanelItems","attributes","hasValue","onDeselect","undefined","gutter","trigger","BlockBindingsPanel","blockName","metadata","registry","blockContext","removeAllBlockBindings","bindableAttributes","dropdownMenuProps","filteredBindings","forEach","canUpdateBlockBindings","select","getSettings","getFieldsList","usesContext","context","sourceList","readOnly","group","resetAll","isBordered","isSeparated","edit","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/block-bindings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalText as Text,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalVStack as VStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useRegistry, useSelect } from '@wordpress/data';\nimport { useContext, Fragment } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcanBindAttribute,\n\tgetBindableAttributes,\n} from '../hooks/use-bindings-attributes';\nimport { unlock } from '../lock-unlock';\nimport InspectorControls from '../components/inspector-controls';\nimport BlockContext from '../components/block-context';\nimport { useBlockBindingsUtils } from '../utils/block-bindings';\nimport { store as blockEditorStore } from '../store';\n\nconst { DropdownMenuV2 } = unlock( componentsPrivateApis );\n\nconst useToolsPanelDropdownMenuProps = () => {\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn ! isMobile\n\t\t? {\n\t\t\t\tpopoverProps: {\n\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t\t\t\t\toffset: 259,\n\t\t\t\t},\n\t\t }\n\t\t: {};\n};\n\nfunction BlockBindingsPanelDropdown( { fieldsList, attribute, binding } ) {\n\tconst { getBlockBindingsSources } = unlock( blocksPrivateApis );\n\tconst registeredSources = getBlockBindingsSources();\n\tconst { updateBlockBindings } = useBlockBindingsUtils();\n\tconst currentKey = binding?.args?.key;\n\treturn (\n\t\t<>\n\t\t\t{ Object.entries( fieldsList ).map( ( [ name, fields ], i ) => (\n\t\t\t\t<Fragment key={ name }>\n\t\t\t\t\t<DropdownMenuV2.Group>\n\t\t\t\t\t\t{ Object.keys( fieldsList ).length > 1 && (\n\t\t\t\t\t\t\t<DropdownMenuV2.GroupLabel>\n\t\t\t\t\t\t\t\t{ registeredSources[ name ].label }\n\t\t\t\t\t\t\t</DropdownMenuV2.GroupLabel>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ Object.entries( fields ).map( ( [ key, value ] ) => (\n\t\t\t\t\t\t\t<DropdownMenuV2.RadioItem\n\t\t\t\t\t\t\t\tkey={ key }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tupdateBlockBindings( {\n\t\t\t\t\t\t\t\t\t\t[ attribute ]: {\n\t\t\t\t\t\t\t\t\t\t\tsource: name,\n\t\t\t\t\t\t\t\t\t\t\targs: { key },\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tname={ attribute + '-binding' }\n\t\t\t\t\t\t\t\tvalue={ key }\n\t\t\t\t\t\t\t\tchecked={ key === currentKey }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t\t\t\t{ key }\n\t\t\t\t\t\t\t\t</DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t\t\t<DropdownMenuV2.ItemHelpText>\n\t\t\t\t\t\t\t\t\t{ value }\n\t\t\t\t\t\t\t\t</DropdownMenuV2.ItemHelpText>\n\t\t\t\t\t\t\t</DropdownMenuV2.RadioItem>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</DropdownMenuV2.Group>\n\t\t\t\t\t{ i !== Object.keys( fieldsList ).length - 1 && (\n\t\t\t\t\t\t<DropdownMenuV2.Separator />\n\t\t\t\t\t) }\n\t\t\t\t</Fragment>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction BlockBindingsAttribute( { attribute, binding } ) {\n\tconst { source: sourceName, args } = binding || {};\n\tconst sourceProps =\n\t\tunlock( blocksPrivateApis ).getBlockBindingsSource( sourceName );\n\tconst isSourceInvalid = ! sourceProps;\n\treturn (\n\t\t<VStack className=\"block-editor-bindings__item\">\n\t\t\t<Text truncate>{ attribute }</Text>\n\t\t\t{ !! binding && (\n\t\t\t\t<Text\n\t\t\t\t\ttruncate\n\t\t\t\t\tvariant={ ! isSourceInvalid && 'muted' }\n\t\t\t\t\tisDestructive={ isSourceInvalid }\n\t\t\t\t>\n\t\t\t\t\t{ isSourceInvalid\n\t\t\t\t\t\t? __( 'Invalid source' )\n\t\t\t\t\t\t: args?.key || sourceProps?.label || sourceName }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nfunction ReadOnlyBlockBindingsPanelItems( { bindings } ) {\n\treturn (\n\t\t<>\n\t\t\t{ Object.entries( bindings ).map( ( [ attribute, binding ] ) => (\n\t\t\t\t<Item key={ attribute }>\n\t\t\t\t\t<BlockBindingsAttribute\n\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t/>\n\t\t\t\t</Item>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction EditableBlockBindingsPanelItems( {\n\tattributes,\n\tbindings,\n\tfieldsList,\n} ) {\n\tconst { updateBlockBindings } = useBlockBindingsUtils();\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn (\n\t\t<>\n\t\t\t{ attributes.map( ( attribute ) => {\n\t\t\t\tconst binding = bindings[ attribute ];\n\t\t\t\treturn (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tkey={ attribute }\n\t\t\t\t\t\thasValue={ () => !! binding }\n\t\t\t\t\t\tlabel={ attribute }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tupdateBlockBindings( {\n\t\t\t\t\t\t\t\t[ attribute ]: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<DropdownMenuV2\n\t\t\t\t\t\t\tplacement={\n\t\t\t\t\t\t\t\tisMobile ? 'bottom-start' : 'left-start'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgutter={ isMobile ? 8 : 36 }\n\t\t\t\t\t\t\ttrigger={\n\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t<BlockBindingsAttribute\n\t\t\t\t\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockBindingsPanelDropdown\n\t\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</DropdownMenuV2>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nexport const BlockBindingsPanel = ( { name: blockName, metadata } ) => {\n\tconst registry = useRegistry();\n\tconst blockContext = useContext( BlockContext );\n\tconst { bindings } = metadata || {};\n\tconst { removeAllBlockBindings } = useBlockBindingsUtils();\n\tconst bindableAttributes = getBindableAttributes( blockName );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst filteredBindings = { ...bindings };\n\tObject.keys( filteredBindings ).forEach( ( key ) => {\n\t\tif (\n\t\t\t! canBindAttribute( blockName, key ) ||\n\t\t\tfilteredBindings[ key ].source === 'core/pattern-overrides'\n\t\t) {\n\t\t\tdelete filteredBindings[ key ];\n\t\t}\n\t} );\n\n\tconst { canUpdateBlockBindings } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tcanUpdateBlockBindings:\n\t\t\t\tselect( blockEditorStore ).getSettings().canUpdateBlockBindings,\n\t\t};\n\t}, [] );\n\n\tif ( ! bindableAttributes || bindableAttributes.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst fieldsList = {};\n\tconst { getBlockBindingsSources } = unlock( blocksPrivateApis );\n\tconst registeredSources = getBlockBindingsSources();\n\tObject.entries( registeredSources ).forEach(\n\t\t( [ sourceName, { getFieldsList, usesContext } ] ) => {\n\t\t\tif ( getFieldsList ) {\n\t\t\t\t// Populate context.\n\t\t\t\tconst context = {};\n\t\t\t\tif ( usesContext?.length ) {\n\t\t\t\t\tfor ( const key of usesContext ) {\n\t\t\t\t\t\tcontext[ key ] = blockContext[ key ];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst sourceList = getFieldsList( {\n\t\t\t\t\tregistry,\n\t\t\t\t\tcontext,\n\t\t\t\t} );\n\t\t\t\t// Only add source if the list is not empty.\n\t\t\t\tif ( sourceList ) {\n\t\t\t\t\tfieldsList[ sourceName ] = { ...sourceList };\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t// Remove empty sources.\n\tObject.entries( fieldsList ).forEach( ( [ key, value ] ) => {\n\t\tif ( ! Object.keys( value ).length ) {\n\t\t\tdelete fieldsList[ key ];\n\t\t}\n\t} );\n\n\t// Lock the UI when the user can't update bindings or there are no fields to connect to.\n\tconst readOnly =\n\t\t! canUpdateBlockBindings || ! Object.keys( fieldsList ).length;\n\n\tif ( readOnly && Object.keys( filteredBindings ).length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorControls group=\"bindings\">\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Attributes' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tremoveAllBlockBindings();\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\tclassName=\"block-editor-bindings__panel\"\n\t\t\t>\n\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t{ readOnly ? (\n\t\t\t\t\t\t<ReadOnlyBlockBindingsPanelItems\n\t\t\t\t\t\t\tbindings={ filteredBindings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<EditableBlockBindingsPanelItems\n\t\t\t\t\t\t\tattributes={ bindableAttributes }\n\t\t\t\t\t\t\tbindings={ filteredBindings }\n\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ItemGroup>\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Attributes connected to custom fields or other dynamic data.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t</ItemGroup>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n};\n\nexport default {\n\tedit: BlockBindingsPanel,\n\tattributeKeys: [ 'metadata' ],\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SACCC,uBAAuB,IAAIC,SAAS,EACpCC,kBAAkB,IAAIC,IAAI,EAC1BC,kBAAkB,IAAIC,IAAI,EAC1BC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,EAC9CC,oBAAoB,IAAIC,MAAM,EAC9Bb,WAAW,IAAIc,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,UAAU,EAAEC,QAAQ,QAAQ,oBAAoB;AACzD,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA,SACCC,gBAAgB,EAChBC,qBAAqB,QACf,kCAAkC;AACzC,SAASC,MAAM,QAAQ,gBAAgB;AACvC,OAAOC,iBAAiB,MAAM,kCAAkC;AAChE,OAAOC,YAAY,MAAM,6BAA6B;AACtD,SAASC,qBAAqB,QAAQ,yBAAyB;AAC/D,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAb,QAAA,IAAAc,SAAA;AAErD,MAAM;EAAEC;AAAe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@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { ToolbarButton
|
|
4
|
+
import { ToolbarButton } from '@wordpress/components';
|
|
5
5
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
import { useCallback } from '@wordpress/element';
|
|
@@ -10,7 +10,7 @@ import { useCallback } from '@wordpress/element';
|
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
12
|
import { store as blockEditorStore } from '../store';
|
|
13
|
-
import { BlockControls
|
|
13
|
+
import { BlockControls } from '../components';
|
|
14
14
|
import { unlock } from '../lock-unlock';
|
|
15
15
|
|
|
16
16
|
// The implementation of content locking is mainly in this file, although the mechanism
|
|
@@ -19,11 +19,8 @@ import { unlock } from '../lock-unlock';
|
|
|
19
19
|
// Besides the components on this file and the file referenced above the implementation
|
|
20
20
|
// also includes artifacts on the store (actions, reducers, and selector).
|
|
21
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
23
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
22
|
function ContentLockControlsPure({
|
|
25
|
-
clientId
|
|
26
|
-
isSelected
|
|
23
|
+
clientId
|
|
27
24
|
}) {
|
|
28
25
|
const {
|
|
29
26
|
templateLock,
|
|
@@ -42,8 +39,7 @@ function ContentLockControlsPure({
|
|
|
42
39
|
};
|
|
43
40
|
}, [clientId]);
|
|
44
41
|
const {
|
|
45
|
-
stopEditingAsBlocks
|
|
46
|
-
modifyContentLockBlock
|
|
42
|
+
stopEditingAsBlocks
|
|
47
43
|
} = unlock(useDispatch(blockEditorStore));
|
|
48
44
|
const isContentLocked = !isLockedByParent && templateLock === 'contentOnly';
|
|
49
45
|
const stopEditingAsBlockCallback = useCallback(() => {
|
|
@@ -53,28 +49,12 @@ function ContentLockControlsPure({
|
|
|
53
49
|
return null;
|
|
54
50
|
}
|
|
55
51
|
const showStopEditingAsBlocks = isEditingAsBlocks && !isContentLocked;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
children:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
onClick: stopEditingAsBlockCallback,
|
|
63
|
-
children: __('Done')
|
|
64
|
-
})
|
|
65
|
-
})
|
|
66
|
-
}), showStartEditingAsBlocks && /*#__PURE__*/_jsx(BlockSettingsMenuControls, {
|
|
67
|
-
children: ({
|
|
68
|
-
selectedClientIds,
|
|
69
|
-
onClose
|
|
70
|
-
}) => selectedClientIds.length === 1 && selectedClientIds[0] === clientId && /*#__PURE__*/_jsx(MenuItem, {
|
|
71
|
-
onClick: () => {
|
|
72
|
-
modifyContentLockBlock(clientId);
|
|
73
|
-
onClose();
|
|
74
|
-
},
|
|
75
|
-
children: __('Modify')
|
|
76
|
-
})
|
|
77
|
-
})]
|
|
52
|
+
return showStopEditingAsBlocks && /*#__PURE__*/_jsx(BlockControls, {
|
|
53
|
+
group: "other",
|
|
54
|
+
children: /*#__PURE__*/_jsx(ToolbarButton, {
|
|
55
|
+
onClick: stopEditingAsBlockCallback,
|
|
56
|
+
children: __('Done')
|
|
57
|
+
})
|
|
78
58
|
});
|
|
79
59
|
}
|
|
80
60
|
export default {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ToolbarButton","
|
|
1
|
+
{"version":3,"names":["ToolbarButton","useDispatch","useSelect","__","useCallback","store","blockEditorStore","BlockControls","unlock","jsx","_jsx","ContentLockControlsPure","clientId","templateLock","isLockedByParent","isEditingAsBlocks","select","getContentLockingParent","getTemplateLock","getTemporarilyEditingAsBlocks","stopEditingAsBlocks","isContentLocked","stopEditingAsBlockCallback","showStopEditingAsBlocks","group","children","onClick","edit","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/content-lock-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToolbarButton } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { BlockControls } from '../components';\nimport { unlock } from '../lock-unlock';\n\n// The implementation of content locking is mainly in this file, although the mechanism\n// to stop temporarily editing as blocks when an outside block is selected is on component StopEditingAsBlocksOnOutsideSelect\n// at block-editor/src/components/block-list/index.js.\n// Besides the components on this file and the file referenced above the implementation\n// also includes artifacts on the store (actions, reducers, and selector).\n\nfunction ContentLockControlsPure( { clientId } ) {\n\tconst { templateLock, isLockedByParent, isEditingAsBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetContentLockingParent,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetTemporarilyEditingAsBlocks,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\treturn {\n\t\t\t\ttemplateLock: getTemplateLock( clientId ),\n\t\t\t\tisLockedByParent: !! getContentLockingParent( clientId ),\n\t\t\t\tisEditingAsBlocks: getTemporarilyEditingAsBlocks() === clientId,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { stopEditingAsBlocks } = unlock( useDispatch( blockEditorStore ) );\n\tconst isContentLocked =\n\t\t! isLockedByParent && templateLock === 'contentOnly';\n\n\tconst stopEditingAsBlockCallback = useCallback( () => {\n\t\tstopEditingAsBlocks( clientId );\n\t}, [ clientId, stopEditingAsBlocks ] );\n\n\tif ( ! isContentLocked && ! isEditingAsBlocks ) {\n\t\treturn null;\n\t}\n\n\tconst showStopEditingAsBlocks = isEditingAsBlocks && ! isContentLocked;\n\n\treturn (\n\t\tshowStopEditingAsBlocks && (\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<ToolbarButton onClick={ stopEditingAsBlockCallback }>\n\t\t\t\t\t{ __( 'Done' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</BlockControls>\n\t\t)\n\t);\n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e,IAAI,CAAEN,iBAAiB,EAAG;IAC/C,OAAO,IAAI;EACZ;EAEA,MAAMQ,uBAAuB,GAAGR,iBAAiB,IAAI,CAAEM,eAAe;EAEtE,OACCE,uBAAuB,iBACtBb,IAAA,CAACH,aAAa;IAACiB,KAAK,EAAC,OAAO;IAAAC,QAAA,eAC3Bf,IAAA,CAACV,aAAa;MAAC0B,OAAO,EAAGJ,0BAA4B;MAAAG,QAAA,EAClDtB,EAAE,CAAE,MAAO;IAAC,CACA;EAAC,CACF,CACf;AAEH;AAEA,eAAe;EACdwB,IAAI,EAAEhB,uBAAuB;EAC7BiB,UAAUA,CAAA,EAAG;IACZ,OAAO,IAAI;EACZ;AACD,CAAC","ignoreList":[]}
|
|
@@ -208,10 +208,6 @@ function useDuotoneStyles({
|
|
|
208
208
|
// Build the CSS selectors to which the filter will be applied.
|
|
209
209
|
const selectors = duotoneSelector.split(',');
|
|
210
210
|
const selectorsScoped = selectors.map(selectorPart => {
|
|
211
|
-
// Extra .editor-styles-wrapper specificity is needed in the editor
|
|
212
|
-
// since we're not using inline styles to apply the filter. We need to
|
|
213
|
-
// override duotone applied by global styles and theme.json.
|
|
214
|
-
|
|
215
211
|
// Assuming the selector part is a subclass selector (not a tag name)
|
|
216
212
|
// so we can prepend the filter id class. If we want to support elements
|
|
217
213
|
// such as `img` or namespaces, we'll need to add a case for that here.
|