@wordpress/block-editor 12.9.1-next.5a1d1283.0 → 12.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +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 +28 -8
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +68 -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 +45 -22
- package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/sidebar.js +9 -9
- package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build/components/inserter/block-patterns-filter.js +137 -0
- package/build/components/inserter/block-patterns-filter.js.map +1 -0
- package/build/components/inserter/block-patterns-tab.js +128 -42
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-paging.js +61 -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 +12 -2
- package/build/components/link-control/index.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 +263 -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 +161 -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 +10 -3
- package/build/hooks/style.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 +25 -3
- 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 +30 -10
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +61 -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 +47 -24
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js +9 -9
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build-module/components/inserter/block-patterns-filter.js +128 -0
- package/build-module/components/inserter/block-patterns-filter.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab.js +125 -44
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-paging.js +54 -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 +12 -2
- package/build-module/components/link-control/index.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 +249 -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 +154 -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 +10 -3
- package/build-module/hooks/style.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 +23 -3
- 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 +201 -131
- package/build-style/style.css +201 -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 +53 -19
- 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 +45 -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 +68 -43
- package/src/components/inserter/block-patterns-explorer/sidebar.js +8 -8
- package/src/components/inserter/block-patterns-filter.js +183 -0
- package/src/components/inserter/block-patterns-tab.js +217 -58
- package/src/components/inserter/hooks/use-patterns-paging.js +76 -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 +36 -7
- 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 +13 -0
- package/src/components/link-control/style.scss +23 -2
- 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 +299 -0
- package/src/hooks/background.scss +75 -0
- package/src/hooks/block-hooks.js +257 -0
- package/src/hooks/block-hooks.scss +16 -0
- package/src/hooks/block-rename-ui.js +231 -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 +11 -2
- package/src/hooks/test/align.native.js +4 -3
- 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 +28 -3
- 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
|
@@ -86,9 +86,15 @@ function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
|
|
|
86
86
|
const isFullscreen =
|
|
87
87
|
document.body.classList.contains( 'is-fullscreen-mode' );
|
|
88
88
|
|
|
89
|
+
/**
|
|
90
|
+
* The following code is a workaround to fix the width of the toolbar
|
|
91
|
+
* it should be removed when the toolbar will be rendered inline
|
|
92
|
+
* FIXME: remove this layout effect when the toolbar is no longer
|
|
93
|
+
* absolutely positioned
|
|
94
|
+
*/
|
|
89
95
|
useLayoutEffect( () => {
|
|
90
96
|
// don't do anything if not fixed toolbar
|
|
91
|
-
if ( ! isFixed
|
|
97
|
+
if ( ! isFixed ) {
|
|
92
98
|
return;
|
|
93
99
|
}
|
|
94
100
|
|
|
@@ -100,6 +106,11 @@ function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
|
|
|
100
106
|
return;
|
|
101
107
|
}
|
|
102
108
|
|
|
109
|
+
if ( ! blockType ) {
|
|
110
|
+
blockToolbar.style.width = 'initial';
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
103
114
|
if ( ! isLargerThanTabletViewport ) {
|
|
104
115
|
// set the width of the toolbar to auto
|
|
105
116
|
blockToolbar.style = {};
|
|
@@ -112,11 +123,10 @@ function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
|
|
|
112
123
|
return;
|
|
113
124
|
}
|
|
114
125
|
|
|
115
|
-
// get the width of the pinned items in the post editor
|
|
126
|
+
// get the width of the pinned items in the post editor or widget editor
|
|
116
127
|
const pinnedItems = document.querySelector(
|
|
117
|
-
'.edit-post-header__settings'
|
|
128
|
+
'.edit-post-header__settings, .edit-widgets-header__actions'
|
|
118
129
|
);
|
|
119
|
-
|
|
120
130
|
// get the width of the left header in the site editor
|
|
121
131
|
const leftHeader = document.querySelector(
|
|
122
132
|
'.edit-site-header-edit-mode__end'
|
|
@@ -132,7 +142,7 @@ function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
|
|
|
132
142
|
|
|
133
143
|
const marginLeft = parseFloat( computedToolbarStyle.marginLeft );
|
|
134
144
|
const pinnedItemsWidth = computedPinnedItemsStyle
|
|
135
|
-
? parseFloat( computedPinnedItemsStyle.width )
|
|
145
|
+
? parseFloat( computedPinnedItemsStyle.width )
|
|
136
146
|
: 0;
|
|
137
147
|
const leftHeaderWidth = computedLeftHeaderStyle
|
|
138
148
|
? parseFloat( computedLeftHeaderStyle.width )
|
|
@@ -143,6 +153,7 @@ function BlockContextualToolbar( { focusOnMount, isFixed, ...props } ) {
|
|
|
143
153
|
leftHeaderWidth +
|
|
144
154
|
pinnedItemsWidth +
|
|
145
155
|
marginLeft +
|
|
156
|
+
( pinnedItems || leftHeader ? 2 : 0 ) + // Prevents button focus border from being cut off
|
|
146
157
|
( isFullscreen ? 0 : 160 ) // the width of the admin sidebar expanded
|
|
147
158
|
}px)`;
|
|
148
159
|
}, [
|
|
@@ -165,7 +165,7 @@ function BlockSelectionButton( { clientId, rootClientId } ) {
|
|
|
165
165
|
selectedBlockClientId;
|
|
166
166
|
} else if ( navigateIn ) {
|
|
167
167
|
focusedBlockUid =
|
|
168
|
-
getClientIdsOfDescendants(
|
|
168
|
+
getClientIdsOfDescendants( selectedBlockClientId )[ 0 ] ??
|
|
169
169
|
selectedBlockClientId;
|
|
170
170
|
}
|
|
171
171
|
const startingBlockClientId = hasBlockMovingClientId();
|
|
@@ -193,6 +193,14 @@ function BlockSelectionButton( { clientId, rootClientId } ) {
|
|
|
193
193
|
selectBlock( startingBlockClientId );
|
|
194
194
|
setBlockMovingClientId( null );
|
|
195
195
|
}
|
|
196
|
+
// Prevent the block from being moved into itself.
|
|
197
|
+
if (
|
|
198
|
+
startingBlockClientId &&
|
|
199
|
+
selectedBlockClientId === startingBlockClientId &&
|
|
200
|
+
navigateIn
|
|
201
|
+
) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
196
204
|
if ( navigateDown || navigateUp || navigateOut || navigateIn ) {
|
|
197
205
|
if ( focusedBlockUid ) {
|
|
198
206
|
event.preventDefault();
|
|
@@ -89,9 +89,6 @@
|
|
|
89
89
|
* Block Toolbar when contextual.
|
|
90
90
|
*/
|
|
91
91
|
|
|
92
|
-
// Base left position for the toolbar when fixed.
|
|
93
|
-
@include editor-left(".block-editor-block-contextual-toolbar.is-fixed");
|
|
94
|
-
|
|
95
92
|
.block-editor-block-contextual-toolbar {
|
|
96
93
|
// Block UI appearance.
|
|
97
94
|
display: inline-flex;
|
|
@@ -105,11 +102,6 @@
|
|
|
105
102
|
}
|
|
106
103
|
|
|
107
104
|
&.is-fixed {
|
|
108
|
-
position: sticky;
|
|
109
|
-
top: 0;
|
|
110
|
-
z-index: z-index(".block-editor-block-popover");
|
|
111
|
-
display: block;
|
|
112
|
-
width: 100%;
|
|
113
105
|
overflow: hidden;
|
|
114
106
|
|
|
115
107
|
.block-editor-block-toolbar {
|
|
@@ -137,51 +129,8 @@
|
|
|
137
129
|
background: linear-gradient(to right, $white, transparent);
|
|
138
130
|
}
|
|
139
131
|
|
|
140
|
-
// on desktop and tablet viewports the toolbar is fixed
|
|
141
|
-
// on top of interface header
|
|
142
|
-
$toolbar-margin: $grid-unit-80 * 3 - 2 * $grid-unit + $grid-unit-05;
|
|
143
132
|
@include break-medium() {
|
|
144
133
|
&.is-fixed {
|
|
145
|
-
// leave room for block inserter, undo and redo, list view
|
|
146
|
-
margin-left: $toolbar-margin;
|
|
147
|
-
// position on top of interface header
|
|
148
|
-
position: fixed;
|
|
149
|
-
top: $admin-bar-height;
|
|
150
|
-
// Don't fill up when empty
|
|
151
|
-
min-height: initial;
|
|
152
|
-
// remove the border
|
|
153
|
-
border-bottom: none;
|
|
154
|
-
// has to be flex for collapse button to fit
|
|
155
|
-
display: flex;
|
|
156
|
-
|
|
157
|
-
// Mimic the height of the parent, vertically align center, and provide a max-height.
|
|
158
|
-
height: $header-height;
|
|
159
|
-
align-items: center;
|
|
160
|
-
|
|
161
|
-
&.is-collapsed {
|
|
162
|
-
width: initial;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
&:empty {
|
|
166
|
-
width: initial;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
.is-fullscreen-mode & {
|
|
170
|
-
// leave room for block inserter, undo and redo, list view
|
|
171
|
-
// and some margin left
|
|
172
|
-
margin-left: $grid-unit-80 * 4 - 2 * $grid-unit;
|
|
173
|
-
|
|
174
|
-
top: 0;
|
|
175
|
-
|
|
176
|
-
&.is-collapsed {
|
|
177
|
-
width: initial;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
&:empty {
|
|
181
|
-
width: initial;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
134
|
& > .block-editor-block-toolbar {
|
|
186
135
|
flex-grow: initial;
|
|
187
136
|
width: initial;
|
|
@@ -264,13 +213,6 @@
|
|
|
264
213
|
}
|
|
265
214
|
|
|
266
215
|
.show-icon-labels & {
|
|
267
|
-
|
|
268
|
-
margin-left: $grid-unit-80 + 2 * $grid-unit; // inserter and margin
|
|
269
|
-
|
|
270
|
-
.is-fullscreen-mode & {
|
|
271
|
-
margin-left: $grid-unit * 18; // site hub, inserter and margin
|
|
272
|
-
}
|
|
273
|
-
|
|
274
216
|
.block-editor-block-parent-selector .block-editor-block-parent-selector__button::after {
|
|
275
217
|
left: 0;
|
|
276
218
|
}
|
|
@@ -287,14 +229,6 @@
|
|
|
287
229
|
}
|
|
288
230
|
}
|
|
289
231
|
}
|
|
290
|
-
|
|
291
|
-
.blocks-widgets-container & {
|
|
292
|
-
margin-left: $grid-unit-80 * 2.4;
|
|
293
|
-
|
|
294
|
-
&.is-collapsed {
|
|
295
|
-
margin-left: $grid-unit-80 * 4.2;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
232
|
}
|
|
299
233
|
|
|
300
234
|
&.is-fixed .block-editor-block-parent-selector {
|
|
@@ -332,38 +266,6 @@
|
|
|
332
266
|
}
|
|
333
267
|
}
|
|
334
268
|
}
|
|
335
|
-
|
|
336
|
-
// on tablet viewports the toolbar is fixed
|
|
337
|
-
// on top of interface header and covers the whole header
|
|
338
|
-
// except for the inserter on the left
|
|
339
|
-
@include break-medium() {
|
|
340
|
-
&.is-fixed {
|
|
341
|
-
width: calc(100% - #{$toolbar-margin});
|
|
342
|
-
|
|
343
|
-
.show-icon-labels & {
|
|
344
|
-
width: calc(100% + 40px - #{$toolbar-margin}); //there are no undo, redo and list view buttons
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
// on desktop viewports the toolbar is fixed
|
|
351
|
-
// on top of interface header and leaves room
|
|
352
|
-
// for the block inserter the publish button
|
|
353
|
-
@include break-large() {
|
|
354
|
-
&.is-fixed {
|
|
355
|
-
width: auto;
|
|
356
|
-
.show-icon-labels & {
|
|
357
|
-
width: auto; //there are no undo, redo and list view buttons
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
.is-fullscreen-mode &.is-fixed {
|
|
361
|
-
// in full screen mode we need to account for
|
|
362
|
-
// the combined with of the tools at the right of the header and the margin left
|
|
363
|
-
// of the toolbar which includes four buttons
|
|
364
|
-
width: calc(100% - 280px - #{4 * $grid-unit-80});
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
269
|
}
|
|
368
270
|
|
|
369
271
|
/**
|
|
@@ -68,7 +68,7 @@ export default function BoxInputControls( {
|
|
|
68
68
|
: selectedUnits[ corner ] || selectedUnits.flat;
|
|
69
69
|
|
|
70
70
|
return (
|
|
71
|
-
<Tooltip text={ label }
|
|
71
|
+
<Tooltip text={ label } placement="top" key={ corner }>
|
|
72
72
|
<div className="components-border-radius-control__tooltip-wrapper">
|
|
73
73
|
<UnitControl
|
|
74
74
|
{ ...props }
|
|
@@ -8,19 +8,16 @@ import { __ } from '@wordpress/i18n';
|
|
|
8
8
|
export default function LinkedButton( { isLinked, ...props } ) {
|
|
9
9
|
const label = isLinked ? __( 'Unlink radii' ) : __( 'Link radii' );
|
|
10
10
|
|
|
11
|
-
// TODO: Remove span after merging https://github.com/WordPress/gutenberg/pull/44198
|
|
12
11
|
return (
|
|
13
12
|
<Tooltip text={ label }>
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/>
|
|
23
|
-
</span>
|
|
13
|
+
<Button
|
|
14
|
+
{ ...props }
|
|
15
|
+
className="component-border-radius-control__linked-button"
|
|
16
|
+
isSmall
|
|
17
|
+
icon={ isLinked ? link : linkOff }
|
|
18
|
+
iconSize={ 24 }
|
|
19
|
+
aria-label={ label }
|
|
20
|
+
/>
|
|
24
21
|
</Tooltip>
|
|
25
22
|
);
|
|
26
23
|
}
|
|
@@ -202,31 +202,44 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
|
|
|
202
202
|
class="components-circular-option-picker"
|
|
203
203
|
>
|
|
204
204
|
<div
|
|
205
|
-
|
|
205
|
+
aria-label="Custom color picker."
|
|
206
|
+
id="components-circular-option-picker-0"
|
|
207
|
+
role="listbox"
|
|
206
208
|
>
|
|
207
209
|
<div
|
|
208
|
-
class="components-circular-option-
|
|
210
|
+
class="components-circular-option-picker__swatches"
|
|
209
211
|
>
|
|
210
|
-
<
|
|
211
|
-
|
|
212
|
-
aria-pressed="true"
|
|
213
|
-
class="components-button components-circular-option-picker__option is-pressed"
|
|
214
|
-
style="background-color: rgb(255, 0, 0); color: rgb(255, 0, 0);"
|
|
215
|
-
type="button"
|
|
216
|
-
/>
|
|
217
|
-
<svg
|
|
218
|
-
aria-hidden="true"
|
|
219
|
-
fill="#000"
|
|
220
|
-
focusable="false"
|
|
221
|
-
height="24"
|
|
222
|
-
viewBox="0 0 24 24"
|
|
223
|
-
width="24"
|
|
224
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
212
|
+
<div
|
|
213
|
+
class="components-circular-option-picker__option-group components-circular-option-picker__swatches"
|
|
225
214
|
>
|
|
226
|
-
<
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
215
|
+
<div
|
|
216
|
+
class="components-circular-option-picker__option-wrapper"
|
|
217
|
+
>
|
|
218
|
+
<button
|
|
219
|
+
aria-label="Color: red"
|
|
220
|
+
aria-selected="true"
|
|
221
|
+
class="components-button components-circular-option-picker__option is-pressed"
|
|
222
|
+
id="components-circular-option-picker-0-0"
|
|
223
|
+
role="option"
|
|
224
|
+
style="background-color: rgb(255, 0, 0); color: rgb(255, 0, 0);"
|
|
225
|
+
tabindex="0"
|
|
226
|
+
type="button"
|
|
227
|
+
/>
|
|
228
|
+
<svg
|
|
229
|
+
aria-hidden="true"
|
|
230
|
+
fill="#000"
|
|
231
|
+
focusable="false"
|
|
232
|
+
height="24"
|
|
233
|
+
viewBox="0 0 24 24"
|
|
234
|
+
width="24"
|
|
235
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
236
|
+
>
|
|
237
|
+
<path
|
|
238
|
+
d="M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
|
|
239
|
+
/>
|
|
240
|
+
</svg>
|
|
241
|
+
</div>
|
|
242
|
+
</div>
|
|
230
243
|
</div>
|
|
231
244
|
</div>
|
|
232
245
|
<div
|
|
@@ -36,8 +36,9 @@ const upperFirst = ( [ firstLetter, ...rest ] ) =>
|
|
|
36
36
|
*/
|
|
37
37
|
const withCustomColorPalette = ( colorsArray ) =>
|
|
38
38
|
createHigherOrderComponent(
|
|
39
|
-
( WrappedComponent ) => ( props ) =>
|
|
40
|
-
<WrappedComponent { ...props } colors={ colorsArray }
|
|
39
|
+
( WrappedComponent ) => ( props ) => (
|
|
40
|
+
<WrappedComponent { ...props } colors={ colorsArray } />
|
|
41
|
+
),
|
|
41
42
|
'withCustomColorPalette'
|
|
42
43
|
);
|
|
43
44
|
|
|
@@ -34,55 +34,28 @@ export default function useConvertToGroupButtonProps( selectedClientIds ) {
|
|
|
34
34
|
return useSelect(
|
|
35
35
|
( select ) => {
|
|
36
36
|
const {
|
|
37
|
-
getBlockRootClientId,
|
|
38
37
|
getBlocksByClientId,
|
|
39
|
-
canInsertBlockType,
|
|
40
38
|
getSelectedBlockClientIds,
|
|
39
|
+
isUngroupable,
|
|
40
|
+
isGroupable,
|
|
41
41
|
} = select( blockEditorStore );
|
|
42
42
|
const { getGroupingBlockName, getBlockType } =
|
|
43
43
|
select( blocksStore );
|
|
44
44
|
const clientIds = selectedClientIds?.length
|
|
45
45
|
? selectedClientIds
|
|
46
46
|
: getSelectedBlockClientIds();
|
|
47
|
-
const groupingBlockName = getGroupingBlockName();
|
|
48
|
-
|
|
49
|
-
const rootClientId = clientIds?.length
|
|
50
|
-
? getBlockRootClientId( clientIds[ 0 ] )
|
|
51
|
-
: undefined;
|
|
52
|
-
|
|
53
|
-
const groupingBlockAvailable = canInsertBlockType(
|
|
54
|
-
groupingBlockName,
|
|
55
|
-
rootClientId
|
|
56
|
-
);
|
|
57
|
-
|
|
58
47
|
const blocksSelection = getBlocksByClientId( clientIds );
|
|
59
|
-
const isSingleBlockSelected = blocksSelection.length === 1;
|
|
60
48
|
const [ firstSelectedBlock ] = blocksSelection;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
// requirement of being the default grouping block.
|
|
64
|
-
// Do we have a single grouping Block selected and does that group have inner blocks?
|
|
65
|
-
const isUngroupable =
|
|
66
|
-
isSingleBlockSelected &&
|
|
67
|
-
( firstSelectedBlock.name === groupingBlockName ||
|
|
68
|
-
getBlockType( firstSelectedBlock.name )?.transforms
|
|
69
|
-
?.ungroup ) &&
|
|
70
|
-
!! firstSelectedBlock.innerBlocks.length;
|
|
71
|
-
|
|
72
|
-
// Do we have
|
|
73
|
-
// 1. Grouping block available to be inserted?
|
|
74
|
-
// 2. One or more blocks selected
|
|
75
|
-
const isGroupable =
|
|
76
|
-
groupingBlockAvailable && blocksSelection.length;
|
|
77
|
-
|
|
49
|
+
const _isUngroupable =
|
|
50
|
+
clientIds.length === 1 && isUngroupable( clientIds[ 0 ] );
|
|
78
51
|
return {
|
|
79
52
|
clientIds,
|
|
80
|
-
isGroupable,
|
|
81
|
-
isUngroupable,
|
|
53
|
+
isGroupable: isGroupable( clientIds ),
|
|
54
|
+
isUngroupable: _isUngroupable,
|
|
82
55
|
blocksSelection,
|
|
83
|
-
groupingBlockName,
|
|
56
|
+
groupingBlockName: getGroupingBlockName(),
|
|
84
57
|
onUngroup:
|
|
85
|
-
|
|
58
|
+
_isUngroupable &&
|
|
86
59
|
getBlockType( firstSelectedBlock.name )?.transforms
|
|
87
60
|
?.ungroup,
|
|
88
61
|
};
|
|
@@ -24,6 +24,7 @@ const hitSlop = { top: 22, bottom: 22, left: 22, right: 22 };
|
|
|
24
24
|
const noop = () => {};
|
|
25
25
|
|
|
26
26
|
export function DefaultBlockAppender( {
|
|
27
|
+
baseGlobalStyles,
|
|
27
28
|
isLocked,
|
|
28
29
|
isVisible,
|
|
29
30
|
onAppend,
|
|
@@ -34,6 +35,15 @@ export function DefaultBlockAppender( {
|
|
|
34
35
|
if ( isLocked || ! isVisible ) {
|
|
35
36
|
return null;
|
|
36
37
|
}
|
|
38
|
+
const blockGlobalStyles = baseGlobalStyles?.blocks?.[ 'core/paragraph' ];
|
|
39
|
+
const { fontSize, lineHeight } = blockGlobalStyles?.typography || {};
|
|
40
|
+
|
|
41
|
+
const textStyles = blockGlobalStyles?.typography
|
|
42
|
+
? {
|
|
43
|
+
...( fontSize && { fontSize } ),
|
|
44
|
+
...( lineHeight && { lineHeight } ),
|
|
45
|
+
}
|
|
46
|
+
: undefined;
|
|
37
47
|
|
|
38
48
|
const value =
|
|
39
49
|
typeof placeholder === 'string'
|
|
@@ -51,7 +61,12 @@ export function DefaultBlockAppender( {
|
|
|
51
61
|
{ showSeparator ? (
|
|
52
62
|
<BlockInsertionPoint />
|
|
53
63
|
) : (
|
|
54
|
-
<RichText
|
|
64
|
+
<RichText
|
|
65
|
+
placeholder={ value }
|
|
66
|
+
onChange={ noop }
|
|
67
|
+
tagName="p"
|
|
68
|
+
style={ textStyles }
|
|
69
|
+
/>
|
|
55
70
|
) }
|
|
56
71
|
</View>
|
|
57
72
|
</Pressable>
|
|
@@ -60,16 +75,24 @@ export function DefaultBlockAppender( {
|
|
|
60
75
|
|
|
61
76
|
export default compose(
|
|
62
77
|
withSelect( ( select, ownProps ) => {
|
|
63
|
-
const {
|
|
64
|
-
|
|
78
|
+
const {
|
|
79
|
+
getBlockCount,
|
|
80
|
+
getBlockName,
|
|
81
|
+
getSettings,
|
|
82
|
+
isBlockValid,
|
|
83
|
+
getTemplateLock,
|
|
84
|
+
} = select( blockEditorStore );
|
|
65
85
|
|
|
66
86
|
const isEmpty = ! getBlockCount( ownProps.rootClientId );
|
|
67
87
|
const isLastBlockDefault =
|
|
68
88
|
getBlockName( ownProps.lastBlockClientId ) ===
|
|
69
89
|
getDefaultBlockName();
|
|
70
90
|
const isLastBlockValid = isBlockValid( ownProps.lastBlockClientId );
|
|
91
|
+
const globalStylesBaseStyles =
|
|
92
|
+
getSettings()?.__experimentalGlobalStylesBaseStyles;
|
|
71
93
|
|
|
72
94
|
return {
|
|
95
|
+
baseGlobalStyles: globalStylesBaseStyles,
|
|
73
96
|
isVisible: isEmpty || ! isLastBlockDefault || ! isLastBlockValid,
|
|
74
97
|
isLocked: !! getTemplateLock( ownProps.rootClientId ),
|
|
75
98
|
};
|
|
@@ -23,3 +23,68 @@ export function getValuesFromColors( colors = [] ) {
|
|
|
23
23
|
|
|
24
24
|
return values;
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Stylesheet for disabling a global styles duotone filter.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} selector Selector to disable the filter for.
|
|
31
|
+
*
|
|
32
|
+
* @return {string} Filter none style.
|
|
33
|
+
*/
|
|
34
|
+
export function getDuotoneUnsetStylesheet( selector ) {
|
|
35
|
+
return `${ selector }{filter:none}`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* SVG and stylesheet needed for rendering the duotone filter.
|
|
40
|
+
*
|
|
41
|
+
* @param {string} selector Selector to apply the filter to.
|
|
42
|
+
* @param {string} id Unique id for this duotone filter.
|
|
43
|
+
*
|
|
44
|
+
* @return {string} Duotone filter style.
|
|
45
|
+
*/
|
|
46
|
+
export function getDuotoneStylesheet( selector, id ) {
|
|
47
|
+
return `${ selector }{filter:url(#${ id })}`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The SVG part of the duotone filter.
|
|
52
|
+
*
|
|
53
|
+
* @param {string} id Unique id for this duotone filter.
|
|
54
|
+
* @param {string[]} colors Color strings from dark to light.
|
|
55
|
+
*
|
|
56
|
+
* @return {string} Duotone SVG.
|
|
57
|
+
*/
|
|
58
|
+
export function getDuotoneFilter( id, colors ) {
|
|
59
|
+
const values = getValuesFromColors( colors );
|
|
60
|
+
return `
|
|
61
|
+
<svg
|
|
62
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
63
|
+
viewBox="0 0 0 0"
|
|
64
|
+
width="0"
|
|
65
|
+
height="0"
|
|
66
|
+
focusable="false"
|
|
67
|
+
role="none"
|
|
68
|
+
aria-hidden="true"
|
|
69
|
+
style="visibility: hidden; position: absolute; left: -9999px; overflow: hidden;"
|
|
70
|
+
>
|
|
71
|
+
<defs>
|
|
72
|
+
<filter id="${ id }">
|
|
73
|
+
<!--
|
|
74
|
+
Use sRGB instead of linearRGB so transparency looks correct.
|
|
75
|
+
Use perceptual brightness to convert to grayscale.
|
|
76
|
+
-->
|
|
77
|
+
<feColorMatrix color-interpolation-filters="sRGB" type="matrix" values=" .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 "></feColorMatrix>
|
|
78
|
+
<!-- Use sRGB instead of linearRGB to be consistent with how CSS gradients work. -->
|
|
79
|
+
<feComponentTransfer color-interpolation-filters="sRGB">
|
|
80
|
+
<feFuncR type="table" tableValues="${ values.r.join( ' ' ) }"></feFuncR>
|
|
81
|
+
<feFuncG type="table" tableValues="${ values.g.join( ' ' ) }"></feFuncG>
|
|
82
|
+
<feFuncB type="table" tableValues="${ values.b.join( ' ' ) }"></feFuncB>
|
|
83
|
+
<feFuncA type="table" tableValues="${ values.a.join( ' ' ) }"></feFuncA>
|
|
84
|
+
</feComponentTransfer>
|
|
85
|
+
<!-- Re-mask the image with the original transparency since the feColorMatrix above loses that information. -->
|
|
86
|
+
<feComposite in2="SourceGraphic" operator="in"></feComposite>
|
|
87
|
+
</filter>
|
|
88
|
+
</defs>
|
|
89
|
+
</svg>`;
|
|
90
|
+
}
|
|
@@ -10,16 +10,18 @@ import a11yPlugin from 'colord/plugins/a11y';
|
|
|
10
10
|
*/
|
|
11
11
|
import { SVG } from '@wordpress/components';
|
|
12
12
|
import { useCallback, useMemo } from '@wordpress/element';
|
|
13
|
+
import { useSelect } from '@wordpress/data';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Internal dependencies
|
|
16
17
|
*/
|
|
17
18
|
import transformStyles from '../../utils/transform-styles';
|
|
19
|
+
import { store as blockEditorStore } from '../../store';
|
|
20
|
+
import { unlock } from '../../lock-unlock';
|
|
18
21
|
|
|
19
|
-
const EDITOR_STYLES_SELECTOR = '.editor-styles-wrapper';
|
|
20
22
|
extend( [ namesPlugin, a11yPlugin ] );
|
|
21
23
|
|
|
22
|
-
function useDarkThemeBodyClassName( styles ) {
|
|
24
|
+
function useDarkThemeBodyClassName( styles, scope ) {
|
|
23
25
|
return useCallback(
|
|
24
26
|
( node ) => {
|
|
25
27
|
if ( ! node ) {
|
|
@@ -28,9 +30,7 @@ function useDarkThemeBodyClassName( styles ) {
|
|
|
28
30
|
|
|
29
31
|
const { ownerDocument } = node;
|
|
30
32
|
const { defaultView, body } = ownerDocument;
|
|
31
|
-
const canvas = ownerDocument.querySelector(
|
|
32
|
-
EDITOR_STYLES_SELECTOR
|
|
33
|
-
);
|
|
33
|
+
const canvas = scope ? ownerDocument.querySelector( scope ) : body;
|
|
34
34
|
|
|
35
35
|
let backgroundColor;
|
|
36
36
|
|
|
@@ -63,38 +63,47 @@ function useDarkThemeBodyClassName( styles ) {
|
|
|
63
63
|
body.classList.add( 'is-dark-theme' );
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
|
-
[ styles ]
|
|
66
|
+
[ styles, scope ]
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
export default function EditorStyles( { styles } ) {
|
|
71
|
-
const
|
|
72
|
-
() =>
|
|
73
|
-
[
|
|
70
|
+
export default function EditorStyles( { styles, scope } ) {
|
|
71
|
+
const overrides = useSelect(
|
|
72
|
+
( select ) => unlock( select( blockEditorStore ) ).getStyleOverrides(),
|
|
73
|
+
[]
|
|
74
74
|
);
|
|
75
|
-
const transformedStyles = useMemo(
|
|
76
|
-
()
|
|
75
|
+
const [ transformedStyles, transformedSvgs ] = useMemo( () => {
|
|
76
|
+
const _styles = Object.values( styles ?? [] );
|
|
77
|
+
|
|
78
|
+
for ( const [ id, override ] of overrides ) {
|
|
79
|
+
const index = _styles.findIndex( ( { id: _id } ) => id === _id );
|
|
80
|
+
const overrideWithId = { ...override, id };
|
|
81
|
+
if ( index === -1 ) {
|
|
82
|
+
_styles.push( overrideWithId );
|
|
83
|
+
} else {
|
|
84
|
+
_styles[ index ] = overrideWithId;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return [
|
|
77
89
|
transformStyles(
|
|
78
|
-
|
|
79
|
-
|
|
90
|
+
_styles.filter( ( style ) => style?.css ),
|
|
91
|
+
scope
|
|
80
92
|
),
|
|
81
|
-
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
const transformedSvgs = useMemo(
|
|
85
|
-
() =>
|
|
86
|
-
stylesArray
|
|
93
|
+
_styles
|
|
87
94
|
.filter( ( style ) => style.__unstableType === 'svgs' )
|
|
88
95
|
.map( ( style ) => style.assets )
|
|
89
96
|
.join( '' ),
|
|
90
|
-
|
|
91
|
-
);
|
|
97
|
+
];
|
|
98
|
+
}, [ styles, overrides, scope ] );
|
|
92
99
|
|
|
93
100
|
return (
|
|
94
101
|
<>
|
|
95
102
|
{ /* Use an empty style element to have a document reference,
|
|
96
103
|
but this could be any element. */ }
|
|
97
|
-
<style
|
|
104
|
+
<style
|
|
105
|
+
ref={ useDarkThemeBodyClassName( transformedStyles, scope ) }
|
|
106
|
+
/>
|
|
98
107
|
{ transformedStyles.map( ( css, index ) => (
|
|
99
108
|
<style key={ index }>{ css }</style>
|
|
100
109
|
) ) }
|