@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
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { addFilter } from '@wordpress/hooks';
|
|
6
|
-
import { SelectControl } from '@wordpress/components';
|
|
7
|
-
import { __ } from '@wordpress/i18n';
|
|
8
|
-
import { hasBlockSupport } from '@wordpress/blocks';
|
|
9
|
-
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
10
|
-
import { useSelect } from '@wordpress/data';
|
|
11
|
-
import { useMemo } from '@wordpress/element';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
|
-
import { store as blockEditorStore } from '../store';
|
|
17
|
-
import { InspectorControls } from '../components';
|
|
18
|
-
function BehaviorsControl({
|
|
19
|
-
blockName,
|
|
20
|
-
blockBehaviors,
|
|
21
|
-
onChangeBehavior,
|
|
22
|
-
onChangeAnimation,
|
|
23
|
-
disabled = false
|
|
24
|
-
}) {
|
|
25
|
-
const {
|
|
26
|
-
settings
|
|
27
|
-
} = useSelect(select => {
|
|
28
|
-
const {
|
|
29
|
-
getSettings
|
|
30
|
-
} = select(blockEditorStore);
|
|
31
|
-
return {
|
|
32
|
-
settings: getSettings()?.__experimentalFeatures?.blocks?.[blockName]?.behaviors || {}
|
|
33
|
-
};
|
|
34
|
-
}, [blockName]);
|
|
35
|
-
const defaultBehaviors = {
|
|
36
|
-
default: {
|
|
37
|
-
value: 'default',
|
|
38
|
-
label: __('Default')
|
|
39
|
-
},
|
|
40
|
-
noBehaviors: {
|
|
41
|
-
value: '',
|
|
42
|
-
label: __('No behaviors')
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const behaviorsOptions = Object.entries(settings).filter(([behaviorName, behaviorValue]) => hasBlockSupport(blockName, `behaviors.${behaviorName}`) && behaviorValue) // Filter out behaviors that are disabled.
|
|
46
|
-
.map(([behaviorName]) => ({
|
|
47
|
-
value: behaviorName,
|
|
48
|
-
// Capitalize the first letter of the behavior name.
|
|
49
|
-
label: `${behaviorName.charAt(0).toUpperCase()}${behaviorName.slice(1).toLowerCase()}`
|
|
50
|
-
}));
|
|
51
|
-
const options = [...Object.values(defaultBehaviors), ...behaviorsOptions];
|
|
52
|
-
const {
|
|
53
|
-
behaviors,
|
|
54
|
-
behaviorsValue
|
|
55
|
-
} = useMemo(() => {
|
|
56
|
-
const mergedBehaviors = {
|
|
57
|
-
...(blockBehaviors || {})
|
|
58
|
-
};
|
|
59
|
-
let value = '';
|
|
60
|
-
if (blockBehaviors === undefined) {
|
|
61
|
-
value = 'default';
|
|
62
|
-
}
|
|
63
|
-
if (blockBehaviors?.lightbox.enabled) {
|
|
64
|
-
value = 'lightbox';
|
|
65
|
-
}
|
|
66
|
-
return {
|
|
67
|
-
behaviors: mergedBehaviors,
|
|
68
|
-
behaviorsValue: value
|
|
69
|
-
};
|
|
70
|
-
}, [blockBehaviors]);
|
|
71
|
-
|
|
72
|
-
// If every behavior is disabled, do not show the behaviors inspector control.
|
|
73
|
-
if (behaviorsOptions.length === 0) {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
const helpText = disabled ? __('The lightbox behavior is disabled for linked images.') : '';
|
|
77
|
-
return createElement(InspectorControls, {
|
|
78
|
-
group: "advanced"
|
|
79
|
-
}, createElement("div", null, createElement(SelectControl, {
|
|
80
|
-
label: __('Behaviors')
|
|
81
|
-
// At the moment we are only supporting one behavior (Lightbox)
|
|
82
|
-
,
|
|
83
|
-
value: behaviorsValue,
|
|
84
|
-
options: options,
|
|
85
|
-
onChange: onChangeBehavior,
|
|
86
|
-
hideCancelButton: true,
|
|
87
|
-
help: helpText,
|
|
88
|
-
size: "__unstable-large",
|
|
89
|
-
disabled: disabled
|
|
90
|
-
}), behaviorsValue === 'lightbox' && createElement(SelectControl, {
|
|
91
|
-
label: __('Animation')
|
|
92
|
-
// At the moment we are only supporting one behavior (Lightbox)
|
|
93
|
-
,
|
|
94
|
-
value: behaviors?.lightbox.animation ? behaviors?.lightbox.animation : '',
|
|
95
|
-
options: [{
|
|
96
|
-
value: 'zoom',
|
|
97
|
-
label: __('Zoom')
|
|
98
|
-
}, {
|
|
99
|
-
value: 'fade',
|
|
100
|
-
label: __('Fade')
|
|
101
|
-
}],
|
|
102
|
-
onChange: onChangeAnimation,
|
|
103
|
-
hideCancelButton: false,
|
|
104
|
-
size: "__unstable-large",
|
|
105
|
-
disabled: disabled
|
|
106
|
-
})));
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Override the default edit UI to include a new block inspector control for
|
|
111
|
-
* assigning behaviors to blocks if behaviors are enabled in the theme.json.
|
|
112
|
-
*
|
|
113
|
-
* Currently, only the `core/image` block is supported.
|
|
114
|
-
*
|
|
115
|
-
* @param {WPComponent} BlockEdit Original component.
|
|
116
|
-
*
|
|
117
|
-
* @return {WPComponent} Wrapped component.
|
|
118
|
-
*/
|
|
119
|
-
export const withBehaviors = createHigherOrderComponent(BlockEdit => {
|
|
120
|
-
return props => {
|
|
121
|
-
const blockEdit = createElement(BlockEdit, {
|
|
122
|
-
key: "edit",
|
|
123
|
-
...props
|
|
124
|
-
});
|
|
125
|
-
// Only add behaviors to blocks with support.
|
|
126
|
-
if (!hasBlockSupport(props.name, 'behaviors')) {
|
|
127
|
-
return blockEdit;
|
|
128
|
-
}
|
|
129
|
-
const blockHasLink = typeof props.attributes?.linkDestination !== 'undefined' && props.attributes?.linkDestination !== 'none';
|
|
130
|
-
return createElement(Fragment, null, blockEdit, createElement(BehaviorsControl, {
|
|
131
|
-
blockName: props.name,
|
|
132
|
-
blockBehaviors: props.attributes.behaviors,
|
|
133
|
-
onChangeBehavior: nextValue => {
|
|
134
|
-
if (nextValue === 'default') {
|
|
135
|
-
props.setAttributes({
|
|
136
|
-
behaviors: undefined
|
|
137
|
-
});
|
|
138
|
-
} else {
|
|
139
|
-
// If the user selects something, it means that they want to
|
|
140
|
-
// change the default value (true) so we save it in the attributes.
|
|
141
|
-
props.setAttributes({
|
|
142
|
-
behaviors: {
|
|
143
|
-
lightbox: {
|
|
144
|
-
enabled: nextValue === 'lightbox',
|
|
145
|
-
animation: nextValue === 'lightbox' ? 'zoom' : ''
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
onChangeAnimation: nextValue => {
|
|
152
|
-
props.setAttributes({
|
|
153
|
-
behaviors: {
|
|
154
|
-
lightbox: {
|
|
155
|
-
enabled: props.attributes.behaviors.lightbox.enabled,
|
|
156
|
-
animation: nextValue
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
},
|
|
161
|
-
disabled: blockHasLink
|
|
162
|
-
}));
|
|
163
|
-
};
|
|
164
|
-
}, 'withBehaviors');
|
|
165
|
-
addFilter('editor.BlockEdit', 'core/behaviors/with-inspector-control', withBehaviors);
|
|
166
|
-
//# sourceMappingURL=behaviors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["addFilter","SelectControl","__","hasBlockSupport","createHigherOrderComponent","useSelect","useMemo","store","blockEditorStore","InspectorControls","BehaviorsControl","blockName","blockBehaviors","onChangeBehavior","onChangeAnimation","disabled","settings","select","getSettings","__experimentalFeatures","blocks","behaviors","defaultBehaviors","default","value","label","noBehaviors","behaviorsOptions","Object","entries","filter","behaviorName","behaviorValue","map","charAt","toUpperCase","slice","toLowerCase","options","values","behaviorsValue","mergedBehaviors","undefined","lightbox","enabled","length","helpText","createElement","group","onChange","hideCancelButton","help","size","animation","withBehaviors","BlockEdit","props","blockEdit","key","name","blockHasLink","attributes","linkDestination","Fragment","nextValue","setAttributes"],"sources":["@wordpress/block-editor/src/hooks/behaviors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\n\nfunction BehaviorsControl( {\n\tblockName,\n\tblockBehaviors,\n\tonChangeBehavior,\n\tonChangeAnimation,\n\tdisabled = false,\n} ) {\n\tconst { settings } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tsettings:\n\t\t\t\t\tgetSettings()?.__experimentalFeatures?.blocks?.[ blockName ]\n\t\t\t\t\t\t?.behaviors || {},\n\t\t\t};\n\t\t},\n\t\t[ blockName ]\n\t);\n\n\tconst defaultBehaviors = {\n\t\tdefault: {\n\t\t\tvalue: 'default',\n\t\t\tlabel: __( 'Default' ),\n\t\t},\n\t\tnoBehaviors: {\n\t\t\tvalue: '',\n\t\t\tlabel: __( 'No behaviors' ),\n\t\t},\n\t};\n\tconst behaviorsOptions = Object.entries( settings )\n\t\t.filter(\n\t\t\t( [ behaviorName, behaviorValue ] ) =>\n\t\t\t\thasBlockSupport( blockName, `behaviors.${ behaviorName }` ) &&\n\t\t\t\tbehaviorValue\n\t\t) // Filter out behaviors that are disabled.\n\t\t.map( ( [ behaviorName ] ) => ( {\n\t\t\tvalue: behaviorName,\n\t\t\t// Capitalize the first letter of the behavior name.\n\t\t\tlabel: `${ behaviorName.charAt( 0 ).toUpperCase() }${ behaviorName\n\t\t\t\t.slice( 1 )\n\t\t\t\t.toLowerCase() }`,\n\t\t} ) );\n\tconst options = [\n\t\t...Object.values( defaultBehaviors ),\n\t\t...behaviorsOptions,\n\t];\n\n\tconst { behaviors, behaviorsValue } = useMemo( () => {\n\t\tconst mergedBehaviors = {\n\t\t\t...( blockBehaviors || {} ),\n\t\t};\n\n\t\tlet value = '';\n\t\tif ( blockBehaviors === undefined ) {\n\t\t\tvalue = 'default';\n\t\t}\n\t\tif ( blockBehaviors?.lightbox.enabled ) {\n\t\t\tvalue = 'lightbox';\n\t\t}\n\t\treturn {\n\t\t\tbehaviors: mergedBehaviors,\n\t\t\tbehaviorsValue: value,\n\t\t};\n\t}, [ blockBehaviors ] );\n\n\t// If every behavior is disabled, do not show the behaviors inspector control.\n\tif ( behaviorsOptions.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst helpText = disabled\n\t\t? __( 'The lightbox behavior is disabled for linked images.' )\n\t\t: '';\n\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<div>\n\t\t\t\t<SelectControl\n\t\t\t\t\tlabel={ __( 'Behaviors' ) }\n\t\t\t\t\t// At the moment we are only supporting one behavior (Lightbox)\n\t\t\t\t\tvalue={ behaviorsValue }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\tonChange={ onChangeBehavior }\n\t\t\t\t\thideCancelButton={ true }\n\t\t\t\t\thelp={ helpText }\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t/>\n\t\t\t\t{ behaviorsValue === 'lightbox' && (\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'Animation' ) }\n\t\t\t\t\t\t// At the moment we are only supporting one behavior (Lightbox)\n\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\tbehaviors?.lightbox.animation\n\t\t\t\t\t\t\t\t? behaviors?.lightbox.animation\n\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t}\n\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvalue: 'zoom',\n\t\t\t\t\t\t\t\tlabel: __( 'Zoom' ),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvalue: 'fade',\n\t\t\t\t\t\t\t\tlabel: __( 'Fade' ),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tonChange={ onChangeAnimation }\n\t\t\t\t\t\thideCancelButton={ false }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</InspectorControls>\n\t);\n}\n\n/**\n * Override the default edit UI to include a new block inspector control for\n * assigning behaviors to blocks if behaviors are enabled in the theme.json.\n *\n * Currently, only the `core/image` block is supported.\n *\n * @param {WPComponent} BlockEdit Original component.\n *\n * @return {WPComponent} Wrapped component.\n */\nexport const withBehaviors = createHigherOrderComponent( ( BlockEdit ) => {\n\treturn ( props ) => {\n\t\tconst blockEdit = <BlockEdit key=\"edit\" { ...props } />;\n\t\t// Only add behaviors to blocks with support.\n\t\tif ( ! hasBlockSupport( props.name, 'behaviors' ) ) {\n\t\t\treturn blockEdit;\n\t\t}\n\t\tconst blockHasLink =\n\t\t\ttypeof props.attributes?.linkDestination !== 'undefined' &&\n\t\t\tprops.attributes?.linkDestination !== 'none';\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ blockEdit }\n\t\t\t\t<BehaviorsControl\n\t\t\t\t\tblockName={ props.name }\n\t\t\t\t\tblockBehaviors={ props.attributes.behaviors }\n\t\t\t\t\tonChangeBehavior={ ( nextValue ) => {\n\t\t\t\t\t\tif ( nextValue === 'default' ) {\n\t\t\t\t\t\t\tprops.setAttributes( {\n\t\t\t\t\t\t\t\tbehaviors: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// If the user selects something, it means that they want to\n\t\t\t\t\t\t\t// change the default value (true) so we save it in the attributes.\n\t\t\t\t\t\t\tprops.setAttributes( {\n\t\t\t\t\t\t\t\tbehaviors: {\n\t\t\t\t\t\t\t\t\tlightbox: {\n\t\t\t\t\t\t\t\t\t\tenabled: nextValue === 'lightbox',\n\t\t\t\t\t\t\t\t\t\tanimation:\n\t\t\t\t\t\t\t\t\t\t\tnextValue === 'lightbox'\n\t\t\t\t\t\t\t\t\t\t\t\t? 'zoom'\n\t\t\t\t\t\t\t\t\t\t\t\t: '',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tonChangeAnimation={ ( nextValue ) => {\n\t\t\t\t\t\tprops.setAttributes( {\n\t\t\t\t\t\t\tbehaviors: {\n\t\t\t\t\t\t\t\tlightbox: {\n\t\t\t\t\t\t\t\t\tenabled:\n\t\t\t\t\t\t\t\t\t\tprops.attributes.behaviors.lightbox\n\t\t\t\t\t\t\t\t\t\t\t.enabled,\n\t\t\t\t\t\t\t\t\tanimation: nextValue,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdisabled={ blockHasLink }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t};\n}, 'withBehaviors' );\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/beha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B;MAChBC,SAAS,EAAG6C,KAAK,CAACG,IAAM;MACxB/C,cAAc,EAAG4C,KAAK,CAACK,UAAU,CAACxC,SAAW;MAC7CR,gBAAgB,EAAKmD,SAAS,IAAM;QACnC,IAAKA,SAAS,KAAK,SAAS,EAAG;UAC9BR,KAAK,CAACS,aAAa,CAAE;YACpB5C,SAAS,EAAEqB;UACZ,CAAE,CAAC;QACJ,CAAC,MAAM;UACN;UACA;UACAc,KAAK,CAACS,aAAa,CAAE;YACpB5C,SAAS,EAAE;cACVsB,QAAQ,EAAE;gBACTC,OAAO,EAAEoB,SAAS,KAAK,UAAU;gBACjCX,SAAS,EACRW,SAAS,KAAK,UAAU,GACrB,MAAM,GACN;cACL;YACD;UACD,CAAE,CAAC;QACJ;MACD,CAAG;MACHlD,iBAAiB,EAAKkD,SAAS,IAAM;QACpCR,KAAK,CAACS,aAAa,CAAE;UACpB5C,SAAS,EAAE;YACVsB,QAAQ,EAAE;cACTC,OAAO,EACNY,KAAK,CAACK,UAAU,CAACxC,SAAS,CAACsB,QAAQ,CACjCC,OAAO;cACVS,SAAS,EAAEW;YACZ;UACD;QACD,CAAE,CAAC;MACJ,CAAG;MACHjD,QAAQ,EAAG6C;IAAc,CACzB,CACA,CAAC;EAEL,CAAC;AACF,CAAC,EAAE,eAAgB,CAAC;AAEpB5D,SAAS,CACR,kBAAkB,EAClB,uCAAuC,EACvCsD,aACD,CAAC"}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { SVG } from '@wordpress/components';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { __unstableGetValuesFromColors as getValuesFromColors } from './index';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* SVG and stylesheet needed for rendering the duotone filter.
|
|
13
|
-
*
|
|
14
|
-
* @param {Object} props Duotone props.
|
|
15
|
-
* @param {string} props.selector Selector to apply the filter to.
|
|
16
|
-
* @param {string} props.id Unique id for this duotone filter.
|
|
17
|
-
*
|
|
18
|
-
* @return {WPElement} Duotone element.
|
|
19
|
-
*/
|
|
20
|
-
export function DuotoneStylesheet( { selector, id } ) {
|
|
21
|
-
const css = `
|
|
22
|
-
${ selector } {
|
|
23
|
-
filter: url( #${ id } );
|
|
24
|
-
}
|
|
25
|
-
`;
|
|
26
|
-
return <style>{ css }</style>;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Stylesheet for disabling a global styles duotone filter.
|
|
31
|
-
*
|
|
32
|
-
* @param {Object} props Duotone props.
|
|
33
|
-
* @param {string} props.selector Selector to disable the filter for.
|
|
34
|
-
*
|
|
35
|
-
* @return {WPElement} Filter none style element.
|
|
36
|
-
*/
|
|
37
|
-
export function DuotoneUnsetStylesheet( { selector } ) {
|
|
38
|
-
const css = `
|
|
39
|
-
${ selector } {
|
|
40
|
-
filter: none;
|
|
41
|
-
}
|
|
42
|
-
`;
|
|
43
|
-
return <style>{ css }</style>;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* The SVG part of the duotone filter.
|
|
48
|
-
*
|
|
49
|
-
* @param {Object} props Duotone props.
|
|
50
|
-
* @param {string} props.id Unique id for this duotone filter.
|
|
51
|
-
* @param {string[]} props.colors Color strings from dark to light.
|
|
52
|
-
*
|
|
53
|
-
* @return {WPElement} Duotone SVG.
|
|
54
|
-
*/
|
|
55
|
-
export function DuotoneFilter( { id, colors } ) {
|
|
56
|
-
const values = getValuesFromColors( colors );
|
|
57
|
-
return (
|
|
58
|
-
<SVG
|
|
59
|
-
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
60
|
-
viewBox="0 0 0 0"
|
|
61
|
-
width="0"
|
|
62
|
-
height="0"
|
|
63
|
-
focusable="false"
|
|
64
|
-
role="none"
|
|
65
|
-
style={ {
|
|
66
|
-
visibility: 'hidden',
|
|
67
|
-
position: 'absolute',
|
|
68
|
-
left: '-9999px',
|
|
69
|
-
overflow: 'hidden',
|
|
70
|
-
} }
|
|
71
|
-
>
|
|
72
|
-
<defs>
|
|
73
|
-
<filter id={ id }>
|
|
74
|
-
<feColorMatrix
|
|
75
|
-
// Use sRGB instead of linearRGB so transparency looks correct.
|
|
76
|
-
colorInterpolationFilters="sRGB"
|
|
77
|
-
type="matrix"
|
|
78
|
-
// Use perceptual brightness to convert to grayscale.
|
|
79
|
-
values="
|
|
80
|
-
.299 .587 .114 0 0
|
|
81
|
-
.299 .587 .114 0 0
|
|
82
|
-
.299 .587 .114 0 0
|
|
83
|
-
.299 .587 .114 0 0
|
|
84
|
-
"
|
|
85
|
-
/>
|
|
86
|
-
<feComponentTransfer
|
|
87
|
-
// Use sRGB instead of linearRGB to be consistent with how CSS gradients work.
|
|
88
|
-
colorInterpolationFilters="sRGB"
|
|
89
|
-
>
|
|
90
|
-
<feFuncR
|
|
91
|
-
type="table"
|
|
92
|
-
tableValues={ values.r.join( ' ' ) }
|
|
93
|
-
/>
|
|
94
|
-
<feFuncG
|
|
95
|
-
type="table"
|
|
96
|
-
tableValues={ values.g.join( ' ' ) }
|
|
97
|
-
/>
|
|
98
|
-
<feFuncB
|
|
99
|
-
type="table"
|
|
100
|
-
tableValues={ values.b.join( ' ' ) }
|
|
101
|
-
/>
|
|
102
|
-
<feFuncA
|
|
103
|
-
type="table"
|
|
104
|
-
tableValues={ values.a.join( ' ' ) }
|
|
105
|
-
/>
|
|
106
|
-
</feComponentTransfer>
|
|
107
|
-
<feComposite
|
|
108
|
-
// Re-mask the image with the original transparency since the feColorMatrix above loses that information.
|
|
109
|
-
in2="SourceGraphic"
|
|
110
|
-
operator="in"
|
|
111
|
-
/>
|
|
112
|
-
</filter>
|
|
113
|
-
</defs>
|
|
114
|
-
</SVG>
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* SVG from a duotone preset
|
|
120
|
-
*
|
|
121
|
-
* @param {Object} props Duotone props.
|
|
122
|
-
* @param {Object} props.preset Duotone preset settings.
|
|
123
|
-
*
|
|
124
|
-
* @return {WPElement} Duotone element.
|
|
125
|
-
*/
|
|
126
|
-
export function PresetDuotoneFilter( { preset } ) {
|
|
127
|
-
return (
|
|
128
|
-
<DuotoneFilter
|
|
129
|
-
id={ `wp-duotone-${ preset.slug }` }
|
|
130
|
-
colors={ preset.colors }
|
|
131
|
-
/>
|
|
132
|
-
);
|
|
133
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { getValuesFromColors as __unstableGetValuesFromColors } from './utils';
|
|
2
|
-
export {
|
|
3
|
-
DuotoneFilter as __unstableDuotoneFilter,
|
|
4
|
-
PresetDuotoneFilter as __unstablePresetDuotoneFilter,
|
|
5
|
-
DuotoneStylesheet as __unstableDuotoneStylesheet,
|
|
6
|
-
DuotoneUnsetStylesheet as __unstableDuotoneUnsetStylesheet,
|
|
7
|
-
} from './components';
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { SelectControl } from '@wordpress/components';
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
|
|
7
|
-
export default function ( { onChange, value, behaviors } ) {
|
|
8
|
-
const defaultBehaviors = {
|
|
9
|
-
default: {
|
|
10
|
-
value: 'default',
|
|
11
|
-
label: __( 'Default' ),
|
|
12
|
-
},
|
|
13
|
-
noBehaviors: {
|
|
14
|
-
value: '',
|
|
15
|
-
label: __( 'No behaviors' ),
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const behaviorsOptions = Object.entries( behaviors ).map(
|
|
20
|
-
( [ behaviorName ] ) => ( {
|
|
21
|
-
value: behaviorName,
|
|
22
|
-
// Capitalize the first letter of the behavior name.
|
|
23
|
-
label: `${ behaviorName.charAt( 0 ).toUpperCase() }${ behaviorName
|
|
24
|
-
.slice( 1 )
|
|
25
|
-
.toLowerCase() }`,
|
|
26
|
-
} )
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
const options = [
|
|
30
|
-
...Object.values( defaultBehaviors ),
|
|
31
|
-
...behaviorsOptions,
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
const animations = [
|
|
35
|
-
{
|
|
36
|
-
value: 'zoom',
|
|
37
|
-
label: __( 'Zoom' ),
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
value: 'fade',
|
|
41
|
-
label: __( 'Fade' ),
|
|
42
|
-
},
|
|
43
|
-
];
|
|
44
|
-
return (
|
|
45
|
-
<div style={ { marginTop: '2rem' } }>
|
|
46
|
-
<SelectControl
|
|
47
|
-
label={ __( 'Behaviors' ) }
|
|
48
|
-
// At the moment we are only supporting one behavior (Lightbox)
|
|
49
|
-
value={ value }
|
|
50
|
-
options={ options }
|
|
51
|
-
onChange={ onChange }
|
|
52
|
-
hideCancelButton={ true }
|
|
53
|
-
size="__unstable-large"
|
|
54
|
-
/>
|
|
55
|
-
{ value === 'lightbox' && (
|
|
56
|
-
<SelectControl
|
|
57
|
-
label={ __( 'Animation' ) }
|
|
58
|
-
value={
|
|
59
|
-
behaviors?.lightbox.animation
|
|
60
|
-
? behaviors?.lightbox.animation
|
|
61
|
-
: ''
|
|
62
|
-
}
|
|
63
|
-
options={ animations }
|
|
64
|
-
onChange={ onChange }
|
|
65
|
-
hideCancelButton={ false }
|
|
66
|
-
size="__unstable-large"
|
|
67
|
-
/>
|
|
68
|
-
) }
|
|
69
|
-
</div>
|
|
70
|
-
);
|
|
71
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useMemo } from '@wordpress/element';
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { addQueryArgs } from '@wordpress/url';
|
|
7
|
-
import { Button } from '@wordpress/components';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
import BlockTypesList from '../block-types-list';
|
|
13
|
-
import InserterPanel from './panel';
|
|
14
|
-
import InserterNoResults from './no-results';
|
|
15
|
-
import useBlockTypesState from './hooks/use-block-types-state';
|
|
16
|
-
import ReusableBlocksRenameHint from './reusable-block-rename-hint';
|
|
17
|
-
|
|
18
|
-
function ReusableBlocksList( { onHover, onInsert, rootClientId } ) {
|
|
19
|
-
const [ items, , , onSelectItem ] = useBlockTypesState(
|
|
20
|
-
rootClientId,
|
|
21
|
-
onInsert
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
const filteredItems = useMemo( () => {
|
|
25
|
-
return items.filter(
|
|
26
|
-
( { category, syncStatus } ) =>
|
|
27
|
-
category === 'reusable' && syncStatus !== 'unsynced'
|
|
28
|
-
);
|
|
29
|
-
}, [ items ] );
|
|
30
|
-
|
|
31
|
-
if ( filteredItems.length === 0 ) {
|
|
32
|
-
return <InserterNoResults />;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<InserterPanel title={ __( 'Synced patterns' ) }>
|
|
37
|
-
<BlockTypesList
|
|
38
|
-
items={ filteredItems }
|
|
39
|
-
onSelect={ onSelectItem }
|
|
40
|
-
onHover={ onHover }
|
|
41
|
-
label={ __( 'Synced patterns' ) }
|
|
42
|
-
/>
|
|
43
|
-
</InserterPanel>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// The unwrapped component is only exported for use by unit tests.
|
|
48
|
-
/**
|
|
49
|
-
* List of reusable blocks shown in the "Reusable" tab of the inserter.
|
|
50
|
-
*
|
|
51
|
-
* @param {Object} props Component props.
|
|
52
|
-
* @param {?string} props.rootClientId Client id of block to insert into.
|
|
53
|
-
* @param {Function} props.onInsert Callback to run when item is inserted.
|
|
54
|
-
* @param {Function} props.onHover Callback to run when item is hovered.
|
|
55
|
-
*
|
|
56
|
-
* @return {WPComponent} The component.
|
|
57
|
-
*/
|
|
58
|
-
export function ReusableBlocksTab( { rootClientId, onInsert, onHover } ) {
|
|
59
|
-
return (
|
|
60
|
-
<>
|
|
61
|
-
<div className="block-editor-inserter__hint">
|
|
62
|
-
<ReusableBlocksRenameHint />
|
|
63
|
-
</div>
|
|
64
|
-
<ReusableBlocksList
|
|
65
|
-
onHover={ onHover }
|
|
66
|
-
onInsert={ onInsert }
|
|
67
|
-
rootClientId={ rootClientId }
|
|
68
|
-
/>
|
|
69
|
-
<div className="block-editor-inserter__manage-reusable-blocks-container">
|
|
70
|
-
<Button
|
|
71
|
-
className="block-editor-inserter__manage-reusable-blocks"
|
|
72
|
-
variant="secondary"
|
|
73
|
-
href={ addQueryArgs( 'edit.php', {
|
|
74
|
-
post_type: 'wp_block',
|
|
75
|
-
} ) }
|
|
76
|
-
>
|
|
77
|
-
{ __( 'Manage my patterns' ) }
|
|
78
|
-
</Button>
|
|
79
|
-
</div>
|
|
80
|
-
</>
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export default ReusableBlocksTab;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { render, screen } from '@testing-library/react';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { registerBlockType, unregisterBlockType } from '@wordpress/blocks';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import { ReusableBlocksTab } from '../reusable-blocks-tab';
|
|
15
|
-
import items, { categories, collections } from './fixtures';
|
|
16
|
-
import useBlockTypesState from '../hooks/use-block-types-state';
|
|
17
|
-
|
|
18
|
-
jest.mock( '../hooks/use-block-types-state', () => {
|
|
19
|
-
// This allows us to tweak the returned value on each test.
|
|
20
|
-
const mock = jest.fn();
|
|
21
|
-
return mock;
|
|
22
|
-
} );
|
|
23
|
-
|
|
24
|
-
describe( 'InserterMenu', () => {
|
|
25
|
-
beforeAll( () => {
|
|
26
|
-
registerBlockType( 'core/block', {
|
|
27
|
-
save: () => {},
|
|
28
|
-
title: 'reusable block',
|
|
29
|
-
edit: () => {},
|
|
30
|
-
} );
|
|
31
|
-
} );
|
|
32
|
-
|
|
33
|
-
afterAll( () => {
|
|
34
|
-
unregisterBlockType( 'core/block' );
|
|
35
|
-
} );
|
|
36
|
-
|
|
37
|
-
beforeEach( () => {
|
|
38
|
-
useBlockTypesState.mockImplementation( () => [
|
|
39
|
-
items,
|
|
40
|
-
categories,
|
|
41
|
-
collections,
|
|
42
|
-
] );
|
|
43
|
-
} );
|
|
44
|
-
|
|
45
|
-
it( 'should show nothing if there are no items', () => {
|
|
46
|
-
const noItems = [];
|
|
47
|
-
useBlockTypesState.mockImplementation( () => [
|
|
48
|
-
noItems,
|
|
49
|
-
categories,
|
|
50
|
-
collections,
|
|
51
|
-
] );
|
|
52
|
-
|
|
53
|
-
render( <ReusableBlocksTab filterValue="random" /> );
|
|
54
|
-
|
|
55
|
-
expect( screen.queryByRole( 'option' ) ).not.toBeInTheDocument();
|
|
56
|
-
} );
|
|
57
|
-
|
|
58
|
-
it( 'should list reusable blocks', () => {
|
|
59
|
-
render( <ReusableBlocksTab /> );
|
|
60
|
-
|
|
61
|
-
expect(
|
|
62
|
-
screen.getByRole( 'option', { name: 'My reusable block' } )
|
|
63
|
-
).toBeVisible();
|
|
64
|
-
} );
|
|
65
|
-
|
|
66
|
-
it( 'should trim whitespace of search terms', () => {
|
|
67
|
-
render( <ReusableBlocksTab filterValue=" my reusable" /> );
|
|
68
|
-
|
|
69
|
-
expect(
|
|
70
|
-
screen.getByRole( 'option', { name: 'My reusable block' } )
|
|
71
|
-
).toBeVisible();
|
|
72
|
-
} );
|
|
73
|
-
} );
|