@wordpress/block-editor 12.9.0 → 12.10.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 +6 -0
- package/README.md +33 -3
- package/build/components/block-canvas/index.js +107 -0
- package/build/components/block-canvas/index.js.map +1 -0
- package/build/components/block-inspector/index.js +4 -1
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +19 -4
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +66 -0
- package/build/components/block-patterns-paging/index.js.map +1 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js +28 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +4 -7
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/index.js +1 -0
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js +3 -7
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +18 -7
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +5 -1
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/border-radius-control/input-controls.js +1 -1
- package/build/components/border-radius-control/input-controls.js.map +1 -1
- package/build/components/border-radius-control/linked-button.js +2 -4
- package/build/components/border-radius-control/linked-button.js.map +1 -1
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -21
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build/components/default-block-appender/index.native.js +20 -1
- package/build/components/default-block-appender/index.native.js.map +1 -1
- package/build/components/duotone/utils.js +68 -0
- package/build/components/duotone/utils.js.map +1 -1
- package/build/components/editor-styles/index.js +28 -9
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/global-styles/hooks.js +2 -101
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +61 -0
- package/build/components/global-styles/image-settings-panel.js.map +1 -0
- package/build/components/global-styles/index.js +11 -17
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +19 -15
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +1 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +67 -33
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +2 -5
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/image-editor/use-transform-image.js +9 -9
- package/build/components/image-editor/use-transform-image.js.map +1 -1
- package/build/components/index.js +8 -12
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +6 -5
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +13 -7
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/explorer.js +12 -6
- package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/patterns-list.js +57 -23
- package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/sidebar.js +24 -9
- package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build/components/inserter/block-patterns-source-filter.js +54 -0
- package/build/components/inserter/block-patterns-source-filter.js.map +1 -0
- package/build/components/inserter/block-patterns-sync-filter.js +46 -0
- package/build/components/inserter/block-patterns-sync-filter.js.map +1 -0
- package/build/components/inserter/block-patterns-tab.js +91 -45
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-paging.js +57 -0
- package/build/components/inserter/hooks/use-patterns-paging.js.map +1 -0
- package/build/components/inserter/hooks/use-patterns-state.js +21 -10
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/menu.js +13 -11
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/search-results.js +4 -3
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +1 -12
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inspector-controls/block-support-slot-container.js +12 -1
- package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build/components/inspector-controls/fill.js +24 -13
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/groups.js +5 -3
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls/slot.js +13 -0
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +3 -0
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/link-control/index.js +13 -2
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/settings.js +2 -1
- package/build/components/link-control/settings.js.map +1 -1
- package/build/components/list-view/block-select-button.js +1 -3
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +13 -1
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +29 -24
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/media-placeholder/index.js +2 -2
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +11 -11
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/media-replace-flow/index.js +2 -3
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/media-upload/constants.js +30 -0
- package/build/components/media-upload/constants.js.map +1 -0
- package/build/components/media-upload/index.native.js +63 -53
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/preview-options/index.js +1 -1
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/rich-text/index.js +34 -35
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +14 -32
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/multiline.js +95 -0
- package/build/components/rich-text/multiline.js.map +1 -0
- package/build/components/rich-text/split-value.js +10 -16
- package/build/components/rich-text/split-value.js.map +1 -1
- package/build/components/rich-text/use-enter.js +31 -40
- package/build/components/rich-text/use-enter.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +18 -33
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +1 -1
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/use-block-commands/index.js +30 -18
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/use-block-display-information/index.js +5 -2
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/hooks/background.js +258 -0
- package/build/hooks/background.js.map +1 -0
- package/build/hooks/block-hooks.js +188 -0
- package/build/hooks/block-hooks.js.map +1 -0
- package/build/hooks/block-rename-ui.js +160 -0
- package/build/hooks/block-rename-ui.js.map +1 -0
- package/build/hooks/duotone.js +29 -42
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.js +2 -2
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +31 -14
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +4 -2
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +74 -25
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/utils.js +4 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +2 -0
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +33 -10
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +42 -8
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +23 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +43 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +84 -23
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +0 -4
- package/build/store/utils.js.map +1 -1
- package/build-module/components/block-canvas/index.js +97 -0
- package/build-module/components/block-canvas/index.js.map +1 -0
- package/build-module/components/block-inspector/index.js +4 -1
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +20 -5
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +59 -0
- package/build-module/components/block-patterns-paging/index.js.map +1 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +28 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +4 -7
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +1 -0
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js +3 -7
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +18 -7
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +5 -1
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/border-radius-control/input-controls.js +1 -1
- package/build-module/components/border-radius-control/input-controls.js.map +1 -1
- package/build-module/components/border-radius-control/linked-button.js +2 -4
- package/build-module/components/border-radius-control/linked-button.js.map +1 -1
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -21
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build-module/components/default-block-appender/index.native.js +20 -1
- package/build-module/components/default-block-appender/index.native.js.map +1 -1
- package/build-module/components/duotone/utils.js +65 -0
- package/build-module/components/duotone/utils.js.map +1 -1
- package/build-module/components/editor-styles/index.js +28 -9
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +3 -100
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +53 -0
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -0
- package/build-module/components/global-styles/index.js +2 -2
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +18 -16
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +1 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +66 -33
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +2 -5
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-editor/use-transform-image.js +9 -9
- package/build-module/components/image-editor/use-transform-image.js.map +1 -1
- package/build-module/components/index.js +1 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +2 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +14 -8
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/explorer.js +12 -6
- package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +59 -25
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js +23 -9
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build-module/components/inserter/block-patterns-source-filter.js +44 -0
- package/build-module/components/inserter/block-patterns-source-filter.js.map +1 -0
- package/build-module/components/inserter/block-patterns-sync-filter.js +38 -0
- package/build-module/components/inserter/block-patterns-sync-filter.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab.js +87 -46
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-paging.js +50 -0
- package/build-module/components/inserter/hooks/use-patterns-paging.js.map +1 -0
- package/build-module/components/inserter/hooks/use-patterns-state.js +22 -10
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/menu.js +13 -11
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/search-results.js +4 -3
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +1 -12
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-slot-container.js +13 -2
- package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +25 -14
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +5 -3
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +15 -1
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +3 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/link-control/index.js +13 -2
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/settings.js +2 -1
- package/build-module/components/link-control/settings.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +1 -3
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +13 -1
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +30 -25
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +2 -2
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +7 -7
- package/build-module/components/media-placeholder/index.native.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +2 -3
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-upload/constants.js +14 -0
- package/build-module/components/media-upload/constants.js.map +1 -0
- package/build-module/components/media-upload/index.native.js +53 -34
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/preview-options/index.js +1 -1
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +35 -37
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +15 -33
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/multiline.js +87 -0
- package/build-module/components/rich-text/multiline.js.map +1 -0
- package/build-module/components/rich-text/split-value.js +10 -16
- package/build-module/components/rich-text/split-value.js.map +1 -1
- package/build-module/components/rich-text/use-enter.js +33 -42
- package/build-module/components/rich-text/use-enter.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +19 -34
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +2 -2
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +28 -16
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +5 -2
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/hooks/background.js +244 -0
- package/build-module/hooks/background.js.map +1 -0
- package/build-module/hooks/block-hooks.js +181 -0
- package/build-module/hooks/block-hooks.js.map +1 -0
- package/build-module/hooks/block-rename-ui.js +153 -0
- package/build-module/hooks/block-rename-ui.js.map +1 -0
- package/build-module/hooks/duotone.js +26 -39
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.js +2 -2
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +33 -16
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +4 -2
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +73 -24
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/utils.js +4 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +2 -0
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +33 -10
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +39 -8
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +21 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +41 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +78 -22
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +0 -4
- package/build-module/store/utils.js.map +1 -1
- package/build-style/content-rtl.css +0 -1
- package/build-style/content.css +0 -1
- package/build-style/style-rtl.css +174 -131
- package/build-style/style.css +174 -131
- package/package.json +32 -32
- package/src/components/block-canvas/index.js +108 -0
- package/src/components/block-inspector/index.js +5 -1
- package/src/components/block-list/content.scss +0 -1
- package/src/components/block-patterns-list/index.js +32 -7
- package/src/components/block-patterns-list/style.scss +26 -9
- package/src/components/block-patterns-paging/index.js +92 -0
- package/src/components/block-patterns-paging/style.scss +42 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +44 -0
- package/src/components/block-settings-menu-controls/index.js +4 -9
- package/src/components/block-styles/index.js +1 -0
- package/src/components/block-styles/style.scss +3 -3
- package/src/components/block-toolbar/block-toolbar-menu.native.js +1 -6
- package/src/components/block-tools/block-contextual-toolbar.js +16 -5
- package/src/components/block-tools/block-selection-button.js +9 -1
- package/src/components/block-tools/style.scss +0 -98
- package/src/components/border-radius-control/input-controls.js +1 -1
- package/src/components/border-radius-control/linked-button.js +8 -11
- package/src/components/color-palette/test/__snapshots__/control.js.snap +34 -21
- package/src/components/colors/with-colors.js +3 -2
- package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -35
- package/src/components/default-block-appender/index.native.js +26 -3
- package/src/components/duotone/utils.js +65 -0
- package/src/components/editor-styles/index.js +32 -23
- package/src/components/global-styles/hooks.js +4 -112
- package/src/components/global-styles/image-settings-panel.js +71 -0
- package/src/components/global-styles/index.js +4 -3
- package/src/components/global-styles/use-global-styles-output.js +25 -16
- package/src/components/global-styles/utils.js +1 -2
- package/src/components/iframe/index.js +72 -33
- package/src/components/image-editor/use-save-image.js +2 -9
- package/src/components/image-editor/use-transform-image.js +9 -9
- package/src/components/index.js +1 -1
- package/src/components/index.native.js +2 -2
- package/src/components/inner-blocks/use-nested-settings-update.js +15 -10
- package/src/components/inserter/block-patterns-explorer/explorer.js +17 -5
- package/src/components/inserter/block-patterns-explorer/patterns-list.js +109 -40
- package/src/components/inserter/block-patterns-explorer/sidebar.js +23 -8
- package/src/components/inserter/block-patterns-source-filter.js +40 -0
- package/src/components/inserter/block-patterns-sync-filter.js +35 -0
- package/src/components/inserter/block-patterns-tab.js +168 -57
- package/src/components/inserter/hooks/use-patterns-paging.js +65 -0
- package/src/components/inserter/hooks/use-patterns-state.js +27 -16
- package/src/components/inserter/menu.js +15 -17
- package/src/components/inserter/search-results.js +6 -4
- package/src/components/inserter/style.scss +23 -2
- package/src/components/inserter/tabs.js +2 -12
- package/src/components/inserter/test/index.native.js +8 -12
- package/src/components/inspector-controls/block-support-slot-container.js +19 -3
- package/src/components/inspector-controls/fill.js +28 -14
- package/src/components/inspector-controls/groups.js +6 -2
- package/src/components/inspector-controls/slot.js +28 -3
- package/src/components/inspector-controls-tabs/styles-tab.js +4 -0
- package/src/components/link-control/index.js +14 -0
- package/src/components/link-control/settings.js +1 -0
- package/src/components/link-control/style.scss +28 -7
- package/src/components/link-control/test/index.js +88 -6
- package/src/components/list-view/block-select-button.js +1 -3
- package/src/components/list-view/block.js +19 -1
- package/src/components/list-view/style.scss +1 -2
- package/src/components/list-view/use-block-selection.js +38 -32
- package/src/components/media-placeholder/README.md +2 -2
- package/src/components/media-placeholder/index.js +2 -2
- package/src/components/media-placeholder/index.native.js +11 -12
- package/src/components/media-replace-flow/index.js +2 -2
- package/src/components/media-replace-flow/test/index.js +5 -23
- package/src/components/media-upload/README.md +3 -2
- package/src/components/media-upload/constants.js +15 -0
- package/src/components/media-upload/index.native.js +66 -40
- package/src/components/media-upload/style.native.scss +4 -0
- package/src/components/media-upload/test/index.native.js +2 -2
- package/src/components/preview-options/README.md +7 -0
- package/src/components/preview-options/index.js +1 -1
- package/src/components/rich-text/index.js +48 -44
- package/src/components/rich-text/index.native.js +14 -42
- package/src/components/rich-text/multiline.js +121 -0
- package/src/components/rich-text/split-value.js +10 -35
- package/src/components/rich-text/use-enter.js +32 -42
- package/src/components/rich-text/use-paste-handler.js +16 -40
- package/src/components/spacing-sizes-control/style.scss +5 -7
- package/src/components/spacing-sizes-control/utils.js +1 -2
- package/src/components/use-block-commands/index.js +28 -20
- package/src/components/use-block-display-information/index.js +3 -0
- package/src/hooks/background.js +288 -0
- package/src/hooks/background.scss +57 -0
- package/src/hooks/block-hooks.js +257 -0
- package/src/hooks/block-hooks.scss +16 -0
- package/src/hooks/block-rename-ui.js +230 -0
- package/src/hooks/block-rename-ui.scss +3 -0
- package/src/hooks/duotone.js +42 -43
- package/src/hooks/index.js +2 -2
- package/src/hooks/layout.js +31 -33
- package/src/hooks/position.js +4 -3
- package/src/hooks/style.js +96 -37
- package/src/hooks/test/align.native.js +4 -3
- package/src/hooks/utils.js +4 -0
- package/src/private-apis.js +2 -0
- package/src/store/actions.js +52 -10
- package/src/store/private-actions.js +37 -6
- package/src/store/private-selectors.js +21 -0
- package/src/store/reducer.js +38 -0
- package/src/store/selectors.js +107 -26
- package/src/store/test/actions.js +19 -8
- package/src/store/test/private-actions.js +17 -0
- package/src/store/test/reducer.js +25 -0
- package/src/store/test/selectors.js +130 -123
- package/src/store/utils.js +3 -10
- package/src/style.scss +4 -0
- package/build/components/duotone/components.js +0 -135
- package/build/components/duotone/components.js.map +0 -1
- package/build/components/duotone/index.js +0 -38
- package/build/components/duotone/index.js.map +0 -1
- package/build/components/global-styles/behaviors-panel.js +0 -64
- package/build/components/global-styles/behaviors-panel.js.map +0 -1
- package/build/components/inserter/reusable-blocks-tab.js +0 -85
- package/build/components/inserter/reusable-blocks-tab.js.map +0 -1
- package/build/hooks/auto-inserting-blocks.js +0 -174
- package/build/hooks/auto-inserting-blocks.js.map +0 -1
- package/build/hooks/behaviors.js +0 -173
- package/build/hooks/behaviors.js.map +0 -1
- package/build-module/components/duotone/components.js +0 -126
- package/build-module/components/duotone/components.js.map +0 -1
- package/build-module/components/duotone/index.js +0 -3
- package/build-module/components/duotone/index.js.map +0 -1
- package/build-module/components/global-styles/behaviors-panel.js +0 -57
- package/build-module/components/global-styles/behaviors-panel.js.map +0 -1
- package/build-module/components/inserter/reusable-blocks-tab.js +0 -76
- package/build-module/components/inserter/reusable-blocks-tab.js.map +0 -1
- package/build-module/hooks/auto-inserting-blocks.js +0 -167
- package/build-module/hooks/auto-inserting-blocks.js.map +0 -1
- package/build-module/hooks/behaviors.js +0 -166
- package/build-module/hooks/behaviors.js.map +0 -1
- package/src/components/duotone/components.js +0 -133
- package/src/components/duotone/index.js +0 -7
- package/src/components/global-styles/behaviors-panel.js +0 -71
- package/src/components/inserter/reusable-blocks-tab.js +0 -84
- package/src/components/inserter/test/reusable-blocks-tab.js +0 -73
- package/src/hooks/auto-inserting-blocks.js +0 -232
- package/src/hooks/behaviors.js +0 -206
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
6
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
7
|
+
ToggleControl,
|
|
8
|
+
} from '@wordpress/components';
|
|
9
|
+
import { __, _x } from '@wordpress/i18n';
|
|
10
|
+
|
|
11
|
+
export function useHasImageSettingsPanel( name, value, inheritedValue ) {
|
|
12
|
+
// Note: If lightbox `value` exists, that means it was
|
|
13
|
+
// defined via the the Global Styles UI and will NOT
|
|
14
|
+
// be a boolean value or contain the `allowEditing` property,
|
|
15
|
+
// so we should show the settings panel in those cases.
|
|
16
|
+
return (
|
|
17
|
+
( name === 'core/image' && inheritedValue?.lightbox?.allowEditing ) ||
|
|
18
|
+
!! value?.lightbox
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default function ImageSettingsPanel( {
|
|
23
|
+
onChange,
|
|
24
|
+
value,
|
|
25
|
+
inheritedValue,
|
|
26
|
+
panelId,
|
|
27
|
+
} ) {
|
|
28
|
+
const resetLightbox = () => {
|
|
29
|
+
onChange( undefined );
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const onChangeLightbox = ( newSetting ) => {
|
|
33
|
+
onChange( {
|
|
34
|
+
enabled: newSetting,
|
|
35
|
+
} );
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
let lightboxChecked = false;
|
|
39
|
+
|
|
40
|
+
if ( inheritedValue?.lightbox?.enabled ) {
|
|
41
|
+
lightboxChecked = inheritedValue.lightbox.enabled;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<>
|
|
46
|
+
<ToolsPanel
|
|
47
|
+
label={ _x( 'Settings', 'Image settings' ) }
|
|
48
|
+
resetAll={ resetLightbox }
|
|
49
|
+
panelId={ panelId }
|
|
50
|
+
>
|
|
51
|
+
<ToolsPanelItem
|
|
52
|
+
// We use the `userSettings` prop instead of `settings`, because `settings`
|
|
53
|
+
// contains the core/theme values for the lightbox and we want to show the
|
|
54
|
+
// "RESET" button ONLY when the user has explicitly set a value in the
|
|
55
|
+
// Global Styles.
|
|
56
|
+
hasValue={ () => !! value?.lightbox }
|
|
57
|
+
label={ __( 'Expand on Click' ) }
|
|
58
|
+
onDeselect={ resetLightbox }
|
|
59
|
+
isShownByDefault={ true }
|
|
60
|
+
panelId={ panelId }
|
|
61
|
+
>
|
|
62
|
+
<ToggleControl
|
|
63
|
+
label={ __( 'Expand on Click' ) }
|
|
64
|
+
checked={ lightboxChecked }
|
|
65
|
+
onChange={ onChangeLightbox }
|
|
66
|
+
/>
|
|
67
|
+
</ToolsPanelItem>
|
|
68
|
+
</ToolsPanel>
|
|
69
|
+
</>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export {
|
|
2
|
-
__experimentalUseGlobalBehaviors,
|
|
3
|
-
__experimentalUseHasBehaviorsPanel,
|
|
4
2
|
useGlobalStylesReset,
|
|
5
3
|
useGlobalSetting,
|
|
6
4
|
useGlobalStyle,
|
|
@@ -25,6 +23,9 @@ export { default as BorderPanel, useHasBorderPanel } from './border-panel';
|
|
|
25
23
|
export { default as ColorPanel, useHasColorPanel } from './color-panel';
|
|
26
24
|
export { default as EffectsPanel, useHasEffectsPanel } from './effects-panel';
|
|
27
25
|
export { default as FiltersPanel, useHasFiltersPanel } from './filters-panel';
|
|
28
|
-
export {
|
|
26
|
+
export {
|
|
27
|
+
default as ImageSettingsPanel,
|
|
28
|
+
useHasImageSettingsPanel,
|
|
29
|
+
} from './image-settings-panel';
|
|
29
30
|
export { default as AdvancedPanel } from './advanced-panel';
|
|
30
31
|
export { areGlobalStyleConfigsEqual } from './utils';
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
store as blocksStore,
|
|
10
10
|
} from '@wordpress/blocks';
|
|
11
11
|
import { useSelect } from '@wordpress/data';
|
|
12
|
-
import {
|
|
12
|
+
import { useContext, useMemo } from '@wordpress/element';
|
|
13
13
|
import { getCSSRules } from '@wordpress/style-engine';
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
} from './typography-utils';
|
|
24
24
|
import { GlobalStylesContext } from './context';
|
|
25
25
|
import { useGlobalSetting } from './hooks';
|
|
26
|
-
import {
|
|
26
|
+
import { getDuotoneFilter } from '../duotone/utils';
|
|
27
27
|
import { getGapCSSValue } from '../../hooks/gap';
|
|
28
28
|
import { store as blockEditorStore } from '../../store';
|
|
29
29
|
import { LAYOUT_DEFINITIONS } from '../../layouts/definitions';
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
kebabCase,
|
|
33
33
|
setImmutably,
|
|
34
34
|
} from '../../utils/object';
|
|
35
|
+
import BlockContext from '../block-context';
|
|
35
36
|
|
|
36
37
|
// List of block support features that can have their related styles
|
|
37
38
|
// generated under their own feature level selector rather than the block's.
|
|
@@ -163,11 +164,9 @@ function getPresetsSvgFilters( blockPresets = {} ) {
|
|
|
163
164
|
.filter( ( origin ) => presetByOrigin[ origin ] )
|
|
164
165
|
.flatMap( ( origin ) =>
|
|
165
166
|
presetByOrigin[ origin ].map( ( preset ) =>
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
key={ preset.slug }
|
|
170
|
-
/>
|
|
167
|
+
getDuotoneFilter(
|
|
168
|
+
`wp-duotone-${ preset.slug }`,
|
|
169
|
+
preset.colors
|
|
171
170
|
)
|
|
172
171
|
)
|
|
173
172
|
)
|
|
@@ -307,13 +306,15 @@ const getFeatureDeclarations = ( selectors, styles ) => {
|
|
|
307
306
|
*
|
|
308
307
|
* @param {Object} tree A theme.json tree containing layout definitions.
|
|
309
308
|
*
|
|
309
|
+
* @param {boolean} isTemplate Whether the entity being edited is a full template or a pattern.
|
|
310
310
|
* @return {Array} An array of style declarations.
|
|
311
311
|
*/
|
|
312
312
|
export function getStylesDeclarations(
|
|
313
313
|
blockStyles = {},
|
|
314
314
|
selector = '',
|
|
315
315
|
useRootPaddingAlign,
|
|
316
|
-
tree = {}
|
|
316
|
+
tree = {},
|
|
317
|
+
isTemplate = true
|
|
317
318
|
) {
|
|
318
319
|
const isRoot = ROOT_BLOCK_SELECTOR === selector;
|
|
319
320
|
const output = Object.entries( STYLE_PROPERTY ).reduce(
|
|
@@ -386,10 +387,10 @@ export function getStylesDeclarations(
|
|
|
386
387
|
// This is temporary as we absorb more and more styles into the engine.
|
|
387
388
|
const extraRules = getCSSRules( blockStyles );
|
|
388
389
|
extraRules.forEach( ( rule ) => {
|
|
389
|
-
// Don't output padding properties if padding variables are set.
|
|
390
|
+
// Don't output padding properties if padding variables are set or if we're not editing a full template.
|
|
390
391
|
if (
|
|
391
392
|
isRoot &&
|
|
392
|
-
useRootPaddingAlign &&
|
|
393
|
+
( useRootPaddingAlign || ! isTemplate ) &&
|
|
393
394
|
rule.key.startsWith( 'padding' )
|
|
394
395
|
) {
|
|
395
396
|
return;
|
|
@@ -757,7 +758,8 @@ export const toStyles = (
|
|
|
757
758
|
blockSelectors,
|
|
758
759
|
hasBlockGapSupport,
|
|
759
760
|
hasFallbackGapSupport,
|
|
760
|
-
disableLayoutStyles = false
|
|
761
|
+
disableLayoutStyles = false,
|
|
762
|
+
isTemplate = true
|
|
761
763
|
) => {
|
|
762
764
|
const nodesWithStyles = getNodesWithStyles( tree, blockSelectors );
|
|
763
765
|
const nodesWithSettings = getNodesWithSettings( tree, blockSelectors );
|
|
@@ -782,16 +784,17 @@ export const toStyles = (
|
|
|
782
784
|
ruleset += ` --wp--style--global--wide-size: ${ wideSize };`;
|
|
783
785
|
}
|
|
784
786
|
|
|
785
|
-
|
|
787
|
+
// Root padding styles should only be output for full templates, not patterns or template parts.
|
|
788
|
+
if ( useRootPaddingAlign && isTemplate ) {
|
|
786
789
|
/*
|
|
787
790
|
* These rules reproduce the ones from https://github.com/WordPress/gutenberg/blob/79103f124925d1f457f627e154f52a56228ed5ad/lib/class-wp-theme-json-gutenberg.php#L2508
|
|
788
791
|
* almost exactly, but for the selectors that target block wrappers in the front end. This code only runs in the editor, so it doesn't need those selectors.
|
|
789
792
|
*/
|
|
790
793
|
ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }
|
|
791
794
|
.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
|
|
792
|
-
.has-global-padding :where(.has-global-padding) { padding-right: 0; padding-left: 0; }
|
|
795
|
+
.has-global-padding :where(.has-global-padding:not(.wp-block-block)) { padding-right: 0; padding-left: 0; }
|
|
793
796
|
.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }
|
|
794
|
-
.has-global-padding :where(.has-global-padding) > .alignfull { margin-right: 0; margin-left: 0; }
|
|
797
|
+
.has-global-padding :where(.has-global-padding:not(.wp-block-block)) > .alignfull { margin-right: 0; margin-left: 0; }
|
|
795
798
|
.has-global-padding > .alignfull:where(:not(.has-global-padding):not(.is-layout-flex):not(.is-layout-grid)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
|
|
796
799
|
.has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0;`;
|
|
797
800
|
}
|
|
@@ -909,7 +912,8 @@ export const toStyles = (
|
|
|
909
912
|
styles,
|
|
910
913
|
selector,
|
|
911
914
|
useRootPaddingAlign,
|
|
912
|
-
tree
|
|
915
|
+
tree,
|
|
916
|
+
isTemplate
|
|
913
917
|
);
|
|
914
918
|
if ( declarations?.length ) {
|
|
915
919
|
ruleset += `${ selector }{${ declarations.join( ';' ) };}`;
|
|
@@ -1152,6 +1156,10 @@ export function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {
|
|
|
1152
1156
|
return !! getSettings().disableLayoutStyles;
|
|
1153
1157
|
} );
|
|
1154
1158
|
|
|
1159
|
+
const blockContext = useContext( BlockContext );
|
|
1160
|
+
|
|
1161
|
+
const isTemplate = blockContext?.templateSlug !== undefined;
|
|
1162
|
+
|
|
1155
1163
|
const getBlockStyles = useSelect( ( select ) => {
|
|
1156
1164
|
return select( blocksStore ).getBlockStyles;
|
|
1157
1165
|
}, [] );
|
|
@@ -1176,7 +1184,8 @@ export function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {
|
|
|
1176
1184
|
blockSelectors,
|
|
1177
1185
|
hasBlockGapSupport,
|
|
1178
1186
|
hasFallbackGapSupport,
|
|
1179
|
-
disableLayoutStyles
|
|
1187
|
+
disableLayoutStyles,
|
|
1188
|
+
isTemplate
|
|
1180
1189
|
);
|
|
1181
1190
|
const svgs = toSvgFilters( mergedConfig, blockSelectors );
|
|
1182
1191
|
|
|
@@ -415,7 +415,6 @@ export function areGlobalStyleConfigsEqual( original, variation ) {
|
|
|
415
415
|
}
|
|
416
416
|
return (
|
|
417
417
|
fastDeepEqual( original?.styles, variation?.styles ) &&
|
|
418
|
-
fastDeepEqual( original?.settings, variation?.settings )
|
|
419
|
-
fastDeepEqual( original?.behaviors, variation?.behaviors )
|
|
418
|
+
fastDeepEqual( original?.settings, variation?.settings )
|
|
420
419
|
);
|
|
421
420
|
}
|
|
@@ -31,6 +31,30 @@ import { useWritingFlow } from '../writing-flow';
|
|
|
31
31
|
import { useCompatibilityStyles } from './use-compatibility-styles';
|
|
32
32
|
import { store as blockEditorStore } from '../../store';
|
|
33
33
|
|
|
34
|
+
function bubbleEvent( event, Constructor, frame ) {
|
|
35
|
+
const init = {};
|
|
36
|
+
|
|
37
|
+
for ( const key in event ) {
|
|
38
|
+
init[ key ] = event[ key ];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if ( event instanceof frame.ownerDocument.defaultView.MouseEvent ) {
|
|
42
|
+
const rect = frame.getBoundingClientRect();
|
|
43
|
+
init.clientX += rect.left;
|
|
44
|
+
init.clientY += rect.top;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const newEvent = new Constructor( event.type, init );
|
|
48
|
+
if ( init.defaultPrevented ) {
|
|
49
|
+
newEvent.preventDefault();
|
|
50
|
+
}
|
|
51
|
+
const cancelled = ! frame.dispatchEvent( newEvent );
|
|
52
|
+
|
|
53
|
+
if ( cancelled ) {
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
34
58
|
/**
|
|
35
59
|
* Bubbles some event types (keydown, keypress, and dragover) to parent document
|
|
36
60
|
* document to ensure that the keyboard shortcuts and drag and drop work.
|
|
@@ -39,42 +63,33 @@ import { store as blockEditorStore } from '../../store';
|
|
|
39
63
|
* should be context dependent, e.g. actions on blocks like Cmd+A should not
|
|
40
64
|
* work globally outside the block editor.
|
|
41
65
|
*
|
|
42
|
-
* @param {Document}
|
|
66
|
+
* @param {Document} iframeDocument Document to attach listeners to.
|
|
43
67
|
*/
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const prototype = Object.getPrototypeOf( event );
|
|
50
|
-
const constructorName = prototype.constructor.name;
|
|
51
|
-
const Constructor = window[ constructorName ];
|
|
52
|
-
|
|
53
|
-
const init = {};
|
|
54
|
-
|
|
55
|
-
for ( const key in event ) {
|
|
56
|
-
init[ key ] = event[ key ];
|
|
68
|
+
function useBubbleEvents( iframeDocument ) {
|
|
69
|
+
return useRefEffect( ( body ) => {
|
|
70
|
+
const { defaultView } = iframeDocument;
|
|
71
|
+
if ( ! defaultView ) {
|
|
72
|
+
return;
|
|
57
73
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
event.preventDefault();
|
|
74
|
+
const { frameElement } = defaultView;
|
|
75
|
+
const eventTypes = [ 'dragover', 'mousemove' ];
|
|
76
|
+
const handlers = {};
|
|
77
|
+
for ( const name of eventTypes ) {
|
|
78
|
+
handlers[ name ] = ( event ) => {
|
|
79
|
+
const prototype = Object.getPrototypeOf( event );
|
|
80
|
+
const constructorName = prototype.constructor.name;
|
|
81
|
+
const Constructor = window[ constructorName ];
|
|
82
|
+
bubbleEvent( event, Constructor, frameElement );
|
|
83
|
+
};
|
|
84
|
+
body.addEventListener( name, handlers[ name ] );
|
|
70
85
|
}
|
|
71
|
-
}
|
|
72
86
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
87
|
+
return () => {
|
|
88
|
+
for ( const name of eventTypes ) {
|
|
89
|
+
body.removeEventListener( name, handlers[ name ] );
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
} );
|
|
78
93
|
}
|
|
79
94
|
|
|
80
95
|
function Iframe( {
|
|
@@ -117,7 +132,6 @@ function Iframe( {
|
|
|
117
132
|
const { documentElement } = contentDocument;
|
|
118
133
|
iFrameDocument = contentDocument;
|
|
119
134
|
|
|
120
|
-
bubbleEvents( contentDocument );
|
|
121
135
|
clearerRef( documentElement );
|
|
122
136
|
|
|
123
137
|
// Ideally ALL classes that are added through get_body_class should
|
|
@@ -182,6 +196,7 @@ function Iframe( {
|
|
|
182
196
|
|
|
183
197
|
const disabledRef = useDisabled( { isDisabled: ! readonly } );
|
|
184
198
|
const bodyRef = useMergeRefs( [
|
|
199
|
+
useBubbleEvents( iframeDocument ),
|
|
185
200
|
contentRef,
|
|
186
201
|
clearerRef,
|
|
187
202
|
writingFlowRef,
|
|
@@ -222,9 +237,11 @@ function Iframe( {
|
|
|
222
237
|
return (
|
|
223
238
|
<>
|
|
224
239
|
{ tabIndex >= 0 && before }
|
|
240
|
+
{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }
|
|
225
241
|
<iframe
|
|
226
242
|
{ ...props }
|
|
227
243
|
style={ {
|
|
244
|
+
border: 0,
|
|
228
245
|
...props.style,
|
|
229
246
|
height: expand ? contentHeight : props.style?.height,
|
|
230
247
|
marginTop:
|
|
@@ -248,9 +265,31 @@ function Iframe( {
|
|
|
248
265
|
// content.
|
|
249
266
|
src={ src }
|
|
250
267
|
title={ __( 'Editor canvas' ) }
|
|
268
|
+
onKeyDown={ ( event ) => {
|
|
269
|
+
// If the event originates from inside the iframe, it means
|
|
270
|
+
// it bubbled through the portal, but only with React
|
|
271
|
+
// events. We need to to bubble native events as well,
|
|
272
|
+
// though by doing so we also trigger another React event,
|
|
273
|
+
// so we need to stop the propagation of this event to avoid
|
|
274
|
+
// duplication.
|
|
275
|
+
if (
|
|
276
|
+
event.currentTarget.ownerDocument !==
|
|
277
|
+
event.target.ownerDocument
|
|
278
|
+
) {
|
|
279
|
+
event.stopPropagation();
|
|
280
|
+
bubbleEvent(
|
|
281
|
+
event,
|
|
282
|
+
window.KeyboardEvent,
|
|
283
|
+
event.currentTarget
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
} }
|
|
251
287
|
>
|
|
252
288
|
{ iframeDocument &&
|
|
253
289
|
createPortal(
|
|
290
|
+
// We want to prevent React events from bubbling throught the iframe
|
|
291
|
+
// we bubble these manually.
|
|
292
|
+
/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */
|
|
254
293
|
<body
|
|
255
294
|
ref={ bodyRef }
|
|
256
295
|
className={ classnames(
|
|
@@ -13,9 +13,6 @@ import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
|
|
|
13
13
|
export default function useSaveImage( {
|
|
14
14
|
crop,
|
|
15
15
|
rotation,
|
|
16
|
-
height,
|
|
17
|
-
width,
|
|
18
|
-
aspect,
|
|
19
16
|
url,
|
|
20
17
|
id,
|
|
21
18
|
onSaveImage,
|
|
@@ -27,7 +24,7 @@ export default function useSaveImage( {
|
|
|
27
24
|
const cancel = useCallback( () => {
|
|
28
25
|
setIsInProgress( false );
|
|
29
26
|
onFinishEditing();
|
|
30
|
-
}, [
|
|
27
|
+
}, [ onFinishEditing ] );
|
|
31
28
|
|
|
32
29
|
const apply = useCallback( () => {
|
|
33
30
|
setIsInProgress( true );
|
|
@@ -86,16 +83,12 @@ export default function useSaveImage( {
|
|
|
86
83
|
onFinishEditing();
|
|
87
84
|
} );
|
|
88
85
|
}, [
|
|
89
|
-
setIsInProgress,
|
|
90
86
|
crop,
|
|
91
87
|
rotation,
|
|
92
|
-
|
|
93
|
-
width,
|
|
94
|
-
aspect,
|
|
88
|
+
id,
|
|
95
89
|
url,
|
|
96
90
|
onSaveImage,
|
|
97
91
|
createErrorNotice,
|
|
98
|
-
setIsInProgress,
|
|
99
92
|
onFinishEditing,
|
|
100
93
|
] );
|
|
101
94
|
|
|
@@ -30,10 +30,10 @@ export default function useTransformImage( {
|
|
|
30
30
|
setEditedUrl();
|
|
31
31
|
setRotation( angle );
|
|
32
32
|
setAspect( defaultAspect );
|
|
33
|
-
setPosition( {
|
|
34
|
-
x: -(
|
|
35
|
-
y:
|
|
36
|
-
} );
|
|
33
|
+
setPosition( ( prevPosition ) => ( {
|
|
34
|
+
x: -( prevPosition.y * naturalAspectRatio ),
|
|
35
|
+
y: prevPosition.x * naturalAspectRatio,
|
|
36
|
+
} ) );
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -69,10 +69,10 @@ export default function useTransformImage( {
|
|
|
69
69
|
setEditedUrl( URL.createObjectURL( blob ) );
|
|
70
70
|
setRotation( angle );
|
|
71
71
|
setAspect( canvas.width / canvas.height );
|
|
72
|
-
setPosition( {
|
|
73
|
-
x: -(
|
|
74
|
-
y:
|
|
75
|
-
} );
|
|
72
|
+
setPosition( ( prevPosition ) => ( {
|
|
73
|
+
x: -( prevPosition.y * naturalAspectRatio ),
|
|
74
|
+
y: prevPosition.x * naturalAspectRatio,
|
|
75
|
+
} ) );
|
|
76
76
|
} );
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -88,7 +88,7 @@ export default function useTransformImage( {
|
|
|
88
88
|
if ( typeof imgCrossOrigin === 'string' ) {
|
|
89
89
|
el.crossOrigin = imgCrossOrigin;
|
|
90
90
|
}
|
|
91
|
-
}, [ rotation, defaultAspect ] );
|
|
91
|
+
}, [ rotation, defaultAspect, url ] );
|
|
92
92
|
|
|
93
93
|
return useMemo(
|
|
94
94
|
() => ( {
|
package/src/components/index.js
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
export * from './colors';
|
|
6
6
|
export * from './gradients';
|
|
7
7
|
export * from './font-sizes';
|
|
8
|
-
export * from './duotone';
|
|
9
8
|
export { AlignmentControl, AlignmentToolbar } from './alignment-control';
|
|
10
9
|
export { default as Autocomplete } from './autocomplete';
|
|
11
10
|
export {
|
|
@@ -17,6 +16,7 @@ export { default as __experimentalBlockAlignmentMatrixControl } from './block-al
|
|
|
17
16
|
export { default as BlockBreadcrumb } from './block-breadcrumb';
|
|
18
17
|
export { default as __experimentalUseBlockOverlayActive } from './block-content-overlay';
|
|
19
18
|
export { BlockContextProvider } from './block-context';
|
|
19
|
+
export { default as BlockCanvas } from './block-canvas';
|
|
20
20
|
export {
|
|
21
21
|
default as BlockControls,
|
|
22
22
|
BlockFormatControls,
|
|
@@ -38,13 +38,13 @@ export {
|
|
|
38
38
|
} from './rich-text';
|
|
39
39
|
export { default as MediaReplaceFlow } from './media-replace-flow';
|
|
40
40
|
export { default as MediaPlaceholder } from './media-placeholder';
|
|
41
|
+
export { default as MediaUpload } from './media-upload';
|
|
41
42
|
export {
|
|
42
|
-
default as MediaUpload,
|
|
43
43
|
MEDIA_TYPE_IMAGE,
|
|
44
44
|
MEDIA_TYPE_VIDEO,
|
|
45
45
|
MEDIA_TYPE_AUDIO,
|
|
46
46
|
MEDIA_TYPE_ANY,
|
|
47
|
-
} from './media-upload';
|
|
47
|
+
} from './media-upload/constants';
|
|
48
48
|
export {
|
|
49
49
|
default as MediaUploadProgress,
|
|
50
50
|
MEDIA_UPLOAD_STATE_UPLOADING,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useLayoutEffect, useMemo } from '@wordpress/element';
|
|
4
|
+
import { useLayoutEffect, useMemo, useState } from '@wordpress/element';
|
|
5
5
|
import { useSelect, useDispatch, useRegistry } from '@wordpress/data';
|
|
6
6
|
import deprecated from '@wordpress/deprecated';
|
|
7
|
+
import isShallowEqual from '@wordpress/is-shallow-equal';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Internal dependencies
|
|
@@ -15,6 +16,14 @@ import { getLayoutType } from '../../layouts';
|
|
|
15
16
|
|
|
16
17
|
const pendingSettingsUpdates = new WeakMap();
|
|
17
18
|
|
|
19
|
+
function useShallowMemo( value ) {
|
|
20
|
+
const [ prevValue, setPrevValue ] = useState( value );
|
|
21
|
+
if ( ! isShallowEqual( prevValue, value ) ) {
|
|
22
|
+
setPrevValue( value );
|
|
23
|
+
}
|
|
24
|
+
return prevValue;
|
|
25
|
+
}
|
|
26
|
+
|
|
18
27
|
/**
|
|
19
28
|
* This hook is a side effect which updates the block-editor store when changes
|
|
20
29
|
* happen to inner block settings. The given props are transformed into a
|
|
@@ -70,16 +79,12 @@ export default function useNestedSettingsUpdate(
|
|
|
70
79
|
[ clientId ]
|
|
71
80
|
);
|
|
72
81
|
|
|
73
|
-
//
|
|
74
|
-
// of the arrays. Implementors often pass a new array on every render,
|
|
82
|
+
// Implementors often pass a new array on every render,
|
|
75
83
|
// and the contents of the arrays are just strings, so the entire array
|
|
76
|
-
// can be passed as dependencies
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
81
|
-
allowedBlocks
|
|
82
|
-
);
|
|
84
|
+
// can be passed as dependencies but We need to include the length of the array,
|
|
85
|
+
// otherwise if the arrays change length but the first elements are equal the comparison,
|
|
86
|
+
// does not works as expected.
|
|
87
|
+
const _allowedBlocks = useShallowMemo( allowedBlocks );
|
|
83
88
|
|
|
84
89
|
const _prioritizedInserterBlocks = useMemo(
|
|
85
90
|
() => prioritizedInserterBlocks,
|
|
@@ -10,25 +10,37 @@ import { __ } from '@wordpress/i18n';
|
|
|
10
10
|
*/
|
|
11
11
|
import PatternExplorerSidebar from './sidebar';
|
|
12
12
|
import PatternList from './patterns-list';
|
|
13
|
+
import { usePatternsCategories } from '../block-patterns-tab';
|
|
14
|
+
|
|
15
|
+
function PatternsExplorer( { initialCategory, rootClientId } ) {
|
|
16
|
+
const [ searchValue, setSearchValue ] = useState( '' );
|
|
17
|
+
const [ patternSourceFilter, setPatternSourceFilter ] = useState( 'all' );
|
|
13
18
|
|
|
14
|
-
function PatternsExplorer( { initialCategory, patternCategories } ) {
|
|
15
|
-
const [ filterValue, setFilterValue ] = useState( '' );
|
|
16
19
|
const [ selectedCategory, setSelectedCategory ] = useState(
|
|
17
20
|
initialCategory?.name
|
|
18
21
|
);
|
|
22
|
+
|
|
23
|
+
const patternCategories = usePatternsCategories(
|
|
24
|
+
rootClientId,
|
|
25
|
+
patternSourceFilter
|
|
26
|
+
);
|
|
27
|
+
|
|
19
28
|
return (
|
|
20
29
|
<div className="block-editor-block-patterns-explorer">
|
|
21
30
|
<PatternExplorerSidebar
|
|
22
31
|
selectedCategory={ selectedCategory }
|
|
23
32
|
patternCategories={ patternCategories }
|
|
24
33
|
onClickCategory={ setSelectedCategory }
|
|
25
|
-
|
|
26
|
-
|
|
34
|
+
searchValue={ searchValue }
|
|
35
|
+
setSearchValue={ setSearchValue }
|
|
36
|
+
patternSourceFilter={ patternSourceFilter }
|
|
37
|
+
setPatternSourceFilter={ setPatternSourceFilter }
|
|
27
38
|
/>
|
|
28
39
|
<PatternList
|
|
29
|
-
|
|
40
|
+
searchValue={ searchValue }
|
|
30
41
|
selectedCategory={ selectedCategory }
|
|
31
42
|
patternCategories={ patternCategories }
|
|
43
|
+
patternSourceFilter={ patternSourceFilter }
|
|
32
44
|
/>
|
|
33
45
|
</div>
|
|
34
46
|
);
|