@wordpress/block-editor 8.0.12-next.33ec3857e2.0 → 8.0.15
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/README.md +0 -4
- package/build/components/block-caption/index.native.js +3 -14
- package/build/components/block-caption/index.native.js.map +1 -1
- package/build/components/block-inspector/index.js +33 -12
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block.js +1 -1
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +2 -3
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +1 -3
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +1 -1
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list-appender/index.js +11 -3
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +2 -2
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-mover/button.js +2 -2
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +2 -2
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-mover/index.native.js +2 -2
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-preview/auto.js +2 -10
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings/container.native.js +1 -2
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-styles/index.js +134 -110
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/utils.js +0 -39
- package/build/components/block-styles/utils.js.map +1 -1
- package/build/components/block-switcher/block-styles-menu.js +23 -3
- package/build/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build/components/block-tools/back-compat.js +1 -2
- package/build/components/block-tools/back-compat.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +3 -3
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js +9 -0
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +1 -11
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/button-block-appender/index.js +1 -2
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +10 -51
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/default-block-appender/index.js +19 -16
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/default-style-picker/index.js +3 -18
- package/build/components/default-style-picker/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +11 -11
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/gradients/use-gradient.js +4 -4
- package/build/components/gradients/use-gradient.js.map +1 -1
- package/build/components/iframe/index.js +6 -7
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/index.js +9 -9
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/default-block-appender.js +4 -2
- package/build/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js +2 -2
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/index.js +2 -2
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +3 -3
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +1 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/tabs.native.js +4 -7
- package/build/components/inserter/tabs.native.js.map +1 -1
- package/build/components/inspector-controls/block-support-slot-container.js +1 -2
- package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +50 -22
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +5 -3
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls/groups.js +0 -2
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls/slot.js +3 -1
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +6 -6
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +3 -23
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/media-placeholder/index.js +0 -2
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +0 -2
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +37 -10
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/file-paste-handler.js +1 -1
- package/build/components/rich-text/file-paste-handler.js.map +1 -1
- package/build/components/rich-text/use-input-rules.js +1 -3
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/selection-scroll-into-view/index.js +1 -2
- package/build/components/selection-scroll-into-view/index.js.map +1 -1
- package/build/components/use-canvas-click-redirect/index.js +66 -0
- package/build/components/use-canvas-click-redirect/index.js.map +1 -0
- package/build/components/use-on-block-drop/index.js +4 -8
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-setting/index.js +7 -0
- package/build/components/use-setting/index.js.map +1 -1
- package/build/components/writing-flow/use-multi-selection.js +1 -3
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/hooks/border-color.js +5 -63
- package/build/hooks/border-color.js.map +1 -1
- package/build/hooks/border-radius.js +0 -47
- package/build/hooks/border-radius.js.map +1 -1
- package/build/hooks/border-style.js +0 -41
- package/build/hooks/border-style.js.map +1 -1
- package/build/hooks/border-width.js +31 -70
- package/build/hooks/border-width.js.map +1 -1
- package/build/hooks/border.js +11 -81
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +6 -5
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/layout.js +2 -1
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/letter-spacing.js +1 -1
- package/build/hooks/letter-spacing.js.map +1 -1
- package/build/hooks/style.js +2 -1
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/typography.js +1 -1
- package/build/hooks/typography.js.map +1 -1
- package/build/layouts/flex.js +9 -29
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/flow.js +10 -6
- package/build/layouts/flow.js.map +1 -1
- package/build/store/actions.js +5 -4
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +1 -5
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +24 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +2 -2
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-paste-event-data.js +1 -1
- package/build/utils/get-paste-event-data.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +1 -1
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/components/block-caption/index.native.js +3 -13
- package/build-module/components/block-caption/index.native.js.map +1 -1
- package/build-module/components/block-inspector/index.js +33 -12
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block.js +1 -1
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +2 -3
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +1 -3
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +10 -3
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +2 -2
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-mover/button.js +2 -2
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +2 -2
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +2 -2
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-preview/auto.js +2 -10
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +1 -2
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-styles/index.js +133 -112
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/utils.js +0 -34
- package/build-module/components/block-styles/utils.js.map +1 -1
- package/build-module/components/block-switcher/block-styles-menu.js +21 -3
- package/build-module/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build-module/components/block-tools/back-compat.js +1 -2
- package/build-module/components/block-tools/back-compat.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +3 -3
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js +9 -0
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +1 -11
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/button-block-appender/index.js +1 -2
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +13 -54
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +18 -15
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/default-style-picker/index.js +3 -17
- package/build-module/components/default-style-picker/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +12 -12
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/gradients/use-gradient.js +4 -3
- package/build-module/components/gradients/use-gradient.js.map +1 -1
- package/build-module/components/iframe/index.js +6 -7
- package/build-module/components/iframe/index.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/inner-blocks/default-block-appender.js +4 -2
- package/build-module/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js +2 -2
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/index.js +2 -2
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +4 -4
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +1 -1
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/tabs.native.js +4 -7
- package/build-module/components/inserter/tabs.native.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-slot-container.js +1 -2
- package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +50 -22
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +5 -3
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +0 -2
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +3 -1
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +6 -6
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +3 -22
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +0 -2
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +0 -2
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +41 -14
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/file-paste-handler.js +1 -1
- package/build-module/components/rich-text/file-paste-handler.js.map +1 -1
- package/build-module/components/rich-text/use-input-rules.js +1 -2
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/selection-scroll-into-view/index.js +1 -2
- package/build-module/components/selection-scroll-into-view/index.js.map +1 -1
- package/build-module/components/use-canvas-click-redirect/index.js +54 -0
- package/build-module/components/use-canvas-click-redirect/index.js.map +1 -0
- package/build-module/components/use-on-block-drop/index.js +4 -8
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-setting/index.js +7 -0
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/components/writing-flow/use-multi-selection.js +4 -3
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/hooks/border-color.js +7 -61
- package/build-module/hooks/border-color.js.map +1 -1
- package/build-module/hooks/border-radius.js +0 -42
- package/build-module/hooks/border-radius.js.map +1 -1
- package/build-module/hooks/border-style.js +0 -36
- package/build-module/hooks/border-style.js.map +1 -1
- package/build-module/hooks/border-width.js +32 -66
- package/build-module/hooks/border-width.js.map +1 -1
- package/build-module/hooks/border.js +12 -80
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +6 -5
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/layout.js +2 -1
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/letter-spacing.js +1 -1
- package/build-module/hooks/letter-spacing.js.map +1 -1
- package/build-module/hooks/style.js +2 -1
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/typography.js +1 -1
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/layouts/flex.js +9 -29
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/flow.js +10 -6
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/store/actions.js +5 -4
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +1 -5
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +24 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +2 -2
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-paste-event-data.js +1 -1
- package/build-module/utils/get-paste-event-data.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +1 -1
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-style/style-rtl.css +180 -212
- package/build-style/style.css +180 -212
- package/package.json +27 -27
- package/src/components/block-caption/index.native.js +4 -22
- package/src/components/block-inspector/index.js +32 -13
- package/src/components/block-list/block.js +1 -1
- package/src/components/block-list/block.native.js +2 -2
- package/src/components/block-list/use-block-props/index.js +1 -3
- package/src/components/block-list/use-in-between-inserter.js +1 -1
- package/src/components/block-list-appender/index.js +21 -5
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +2 -5
- package/src/components/block-mover/button.js +2 -6
- package/src/components/block-mover/index.js +2 -5
- package/src/components/block-mover/index.native.js +2 -5
- package/src/components/block-preview/auto.js +2 -7
- package/src/components/block-settings/container.native.js +0 -1
- package/src/components/block-styles/index.js +145 -125
- package/src/components/block-styles/style.scss +51 -59
- package/src/components/block-styles/test/{utils.js → index.js} +1 -60
- package/src/components/block-styles/utils.js +0 -39
- package/src/components/block-switcher/block-styles-menu.js +38 -3
- package/src/components/block-tools/back-compat.js +0 -1
- package/src/components/block-tools/block-selection-button.js +3 -9
- package/src/components/block-tools/index.js +11 -0
- package/src/components/block-tools/insertion-point.js +1 -10
- package/src/components/border-style-control/style.scss +1 -0
- package/src/components/button-block-appender/index.js +0 -1
- package/src/components/colors-gradients/panel-color-gradient-settings.js +19 -75
- package/src/components/colors-gradients/style.scss +5 -42
- package/src/components/default-block-appender/index.js +24 -17
- package/src/components/default-block-appender/style.scss +0 -4
- package/src/components/default-block-appender/test/__snapshots__/index.js.snap +24 -12
- package/src/components/default-block-appender/test/index.js +14 -4
- package/src/components/default-style-picker/index.js +6 -18
- package/src/components/font-appearance-control/index.js +12 -12
- package/src/components/gradients/use-gradient.js +7 -7
- package/src/components/iframe/index.js +6 -13
- package/src/components/index.js +1 -1
- package/src/components/inner-blocks/README.md +0 -2
- package/src/components/inner-blocks/default-block-appender.js +7 -2
- package/src/components/inserter/hooks/use-insertion-point.js +2 -9
- package/src/components/inserter/index.js +2 -2
- package/src/components/inserter/index.native.js +4 -7
- package/src/components/inserter/quick-inserter.js +1 -1
- package/src/components/inserter/tabs.native.js +4 -5
- package/src/components/inspector-controls/block-support-slot-container.js +1 -3
- package/src/components/inspector-controls/block-support-tools-panel.js +57 -21
- package/src/components/inspector-controls/fill.native.js +3 -4
- package/src/components/inspector-controls/groups.js +0 -2
- package/src/components/inspector-controls/slot.js +7 -2
- package/src/components/letter-spacing-control/index.js +6 -6
- package/src/components/link-control/README.md +1 -1
- package/src/components/link-control/test/index.js +0 -2
- package/src/components/list-view/block-select-button.js +1 -20
- package/src/components/list-view/use-list-view-drop-zone.js +1 -1
- package/src/components/media-placeholder/index.js +0 -2
- package/src/components/media-replace-flow/index.js +0 -2
- package/src/components/provider/use-block-sync.js +45 -11
- package/src/components/rich-text/file-paste-handler.js +1 -3
- package/src/components/rich-text/use-input-rules.js +1 -2
- package/src/components/selection-scroll-into-view/index.js +0 -1
- package/src/components/url-input/README.md +0 -5
- package/src/components/use-canvas-click-redirect/index.js +57 -0
- package/src/components/use-on-block-drop/index.js +4 -11
- package/src/components/use-setting/index.js +9 -0
- package/src/components/writing-flow/use-multi-selection.js +9 -12
- package/src/hooks/border-color.js +3 -55
- package/src/hooks/border-radius.js +0 -32
- package/src/hooks/border-style.js +0 -26
- package/src/hooks/border-width.js +32 -56
- package/src/hooks/border.js +20 -115
- package/src/hooks/border.scss +17 -3
- package/src/hooks/color.js +13 -14
- package/src/hooks/layout.js +1 -0
- package/src/hooks/letter-spacing.js +1 -1
- package/src/hooks/style.js +2 -1
- package/src/hooks/test/style.js +0 -2
- package/src/hooks/typography.js +1 -1
- package/src/layouts/flex.js +8 -31
- package/src/layouts/flow.js +8 -6
- package/src/store/actions.js +5 -5
- package/src/store/defaults.js +0 -2
- package/src/store/reducer.js +23 -1
- package/src/store/selectors.js +2 -2
- package/src/store/test/reducer.js +35 -0
- package/src/store/test/selectors.js +1 -1
- package/src/style.scss +3 -4
- package/src/utils/get-paste-event-data.js +1 -1
- package/src/utils/parse-css-unit-to-px.js +1 -1
- package/src/utils/test/parse-css-unit-to-px.js +0 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-styles/menu-items.js +0 -63
- package/build/components/block-styles/menu-items.js.map +0 -1
- package/build/components/block-styles/preview-panel.js +0 -45
- package/build/components/block-styles/preview-panel.js.map +0 -1
- package/build/components/block-styles/use-styles-for-block.js +0 -119
- package/build/components/block-styles/use-styles-for-block.js.map +0 -1
- package/build/components/rich-text/prevent-event-discovery.js +0 -33
- package/build/components/rich-text/prevent-event-discovery.js.map +0 -1
- package/build/components/use-display-block-controls/index.native.js +0 -45
- package/build/components/use-display-block-controls/index.native.js.map +0 -1
- package/build-module/components/block-styles/menu-items.js +0 -50
- package/build-module/components/block-styles/menu-items.js.map +0 -1
- package/build-module/components/block-styles/preview-panel.js +0 -35
- package/build-module/components/block-styles/preview-panel.js.map +0 -1
- package/build-module/components/block-styles/use-styles-for-block.js +0 -107
- package/build-module/components/block-styles/use-styles-for-block.js.map +0 -1
- package/build-module/components/rich-text/prevent-event-discovery.js +0 -25
- package/build-module/components/rich-text/prevent-event-discovery.js.map +0 -1
- package/build-module/components/use-display-block-controls/index.native.js +0 -34
- package/build-module/components/use-display-block-controls/index.native.js.map +0 -1
- package/src/components/block-styles/menu-items.js +0 -49
- package/src/components/block-styles/preview-panel.js +0 -36
- package/src/components/block-styles/use-styles-for-block.js +0 -99
- package/src/components/rich-text/prevent-event-discovery.js +0 -23
- package/src/components/use-display-block-controls/index.native.js +0 -38
- package/src/components/writing-flow/test/use-multi-selection.js +0 -36
- package/src/hooks/dimensions.scss +0 -5
package/src/hooks/border.js
CHANGED
|
@@ -2,41 +2,23 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { getBlockSupport } from '@wordpress/blocks';
|
|
5
|
-
import {
|
|
5
|
+
import { PanelBody } from '@wordpress/components';
|
|
6
6
|
import { Platform } from '@wordpress/element';
|
|
7
7
|
import { __ } from '@wordpress/i18n';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
|
-
import {
|
|
13
|
-
BorderColorEdit,
|
|
14
|
-
hasBorderColorValue,
|
|
15
|
-
resetBorderColor,
|
|
16
|
-
} from './border-color';
|
|
17
|
-
import {
|
|
18
|
-
BorderRadiusEdit,
|
|
19
|
-
hasBorderRadiusValue,
|
|
20
|
-
resetBorderRadius,
|
|
21
|
-
} from './border-radius';
|
|
22
|
-
import {
|
|
23
|
-
BorderStyleEdit,
|
|
24
|
-
hasBorderStyleValue,
|
|
25
|
-
resetBorderStyle,
|
|
26
|
-
} from './border-style';
|
|
27
|
-
import {
|
|
28
|
-
BorderWidthEdit,
|
|
29
|
-
hasBorderWidthValue,
|
|
30
|
-
resetBorderWidth,
|
|
31
|
-
} from './border-width';
|
|
32
12
|
import InspectorControls from '../components/inspector-controls';
|
|
33
13
|
import useSetting from '../components/use-setting';
|
|
34
|
-
import {
|
|
14
|
+
import { BorderColorEdit } from './border-color';
|
|
15
|
+
import { BorderRadiusEdit } from './border-radius';
|
|
16
|
+
import { BorderStyleEdit } from './border-style';
|
|
17
|
+
import { BorderWidthEdit } from './border-width';
|
|
35
18
|
|
|
36
19
|
export const BORDER_SUPPORT_KEY = '__experimentalBorder';
|
|
37
20
|
|
|
38
21
|
export function BorderPanel( props ) {
|
|
39
|
-
const { clientId } = props;
|
|
40
22
|
const isDisabled = useIsBorderDisabled( props );
|
|
41
23
|
const isSupported = hasBorderSupport( props.name );
|
|
42
24
|
|
|
@@ -57,80 +39,22 @@ export function BorderPanel( props ) {
|
|
|
57
39
|
return null;
|
|
58
40
|
}
|
|
59
41
|
|
|
60
|
-
const defaultBorderControls = getBlockSupport( props.name, [
|
|
61
|
-
BORDER_SUPPORT_KEY,
|
|
62
|
-
'__experimentalDefaultControls',
|
|
63
|
-
] );
|
|
64
|
-
|
|
65
|
-
const createResetAllFilter = (
|
|
66
|
-
borderAttribute,
|
|
67
|
-
topLevelAttributes = {}
|
|
68
|
-
) => ( newAttributes ) => ( {
|
|
69
|
-
...newAttributes,
|
|
70
|
-
...topLevelAttributes,
|
|
71
|
-
style: {
|
|
72
|
-
...newAttributes.style,
|
|
73
|
-
border: {
|
|
74
|
-
...newAttributes.style?.border,
|
|
75
|
-
[ borderAttribute ]: undefined,
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
} );
|
|
79
|
-
|
|
80
42
|
return (
|
|
81
|
-
<InspectorControls
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
<ToolsPanelItem
|
|
97
|
-
className="single-column"
|
|
98
|
-
hasValue={ () => hasBorderStyleValue( props ) }
|
|
99
|
-
label={ __( 'Style' ) }
|
|
100
|
-
onDeselect={ () => resetBorderStyle( props ) }
|
|
101
|
-
isShownByDefault={ defaultBorderControls?.style }
|
|
102
|
-
resetAllFilter={ createResetAllFilter( 'style' ) }
|
|
103
|
-
panelId={ clientId }
|
|
104
|
-
>
|
|
105
|
-
<BorderStyleEdit { ...props } />
|
|
106
|
-
</ToolsPanelItem>
|
|
107
|
-
) }
|
|
108
|
-
{ isColorSupported && (
|
|
109
|
-
<ToolsPanelItem
|
|
110
|
-
hasValue={ () => hasBorderColorValue( props ) }
|
|
111
|
-
label={ __( 'Color' ) }
|
|
112
|
-
onDeselect={ () => resetBorderColor( props ) }
|
|
113
|
-
isShownByDefault={ defaultBorderControls?.color }
|
|
114
|
-
resetAllFilter={ createResetAllFilter( 'color', {
|
|
115
|
-
borderColor: undefined,
|
|
116
|
-
} ) }
|
|
117
|
-
panelId={ clientId }
|
|
118
|
-
>
|
|
119
|
-
<BorderColorEdit { ...props } />
|
|
120
|
-
</ToolsPanelItem>
|
|
121
|
-
) }
|
|
122
|
-
{ isRadiusSupported && (
|
|
123
|
-
<ToolsPanelItem
|
|
124
|
-
hasValue={ () => hasBorderRadiusValue( props ) }
|
|
125
|
-
label={ __( 'Radius' ) }
|
|
126
|
-
onDeselect={ () => resetBorderRadius( props ) }
|
|
127
|
-
isShownByDefault={ defaultBorderControls?.radius }
|
|
128
|
-
resetAllFilter={ createResetAllFilter( 'radius' ) }
|
|
129
|
-
panelId={ clientId }
|
|
130
|
-
>
|
|
131
|
-
<BorderRadiusEdit { ...props } />
|
|
132
|
-
</ToolsPanelItem>
|
|
133
|
-
) }
|
|
43
|
+
<InspectorControls>
|
|
44
|
+
<PanelBody
|
|
45
|
+
className="block-editor-hooks__border-controls"
|
|
46
|
+
title={ __( 'Border' ) }
|
|
47
|
+
initialOpen={ false }
|
|
48
|
+
>
|
|
49
|
+
{ ( isWidthSupported || isStyleSupported ) && (
|
|
50
|
+
<div className="block-editor-hooks__border-controls-row">
|
|
51
|
+
{ isWidthSupported && <BorderWidthEdit { ...props } /> }
|
|
52
|
+
{ isStyleSupported && <BorderStyleEdit { ...props } /> }
|
|
53
|
+
</div>
|
|
54
|
+
) }
|
|
55
|
+
{ isColorSupported && <BorderColorEdit { ...props } /> }
|
|
56
|
+
{ isRadiusSupported && <BorderRadiusEdit { ...props } /> }
|
|
57
|
+
</PanelBody>
|
|
134
58
|
</InspectorControls>
|
|
135
59
|
);
|
|
136
60
|
}
|
|
@@ -194,22 +118,3 @@ const useIsBorderDisabled = () => {
|
|
|
194
118
|
|
|
195
119
|
return configs.every( Boolean );
|
|
196
120
|
};
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Returns a new style object where the specified border attribute has been
|
|
200
|
-
* removed.
|
|
201
|
-
*
|
|
202
|
-
* @param {Object} style Styles from block attributes.
|
|
203
|
-
* @param {string} attribute The border style attribute to clear.
|
|
204
|
-
*
|
|
205
|
-
* @return {Object} Style object with the specified attribute removed.
|
|
206
|
-
*/
|
|
207
|
-
export function removeBorderAttribute( style, attribute ) {
|
|
208
|
-
return cleanEmptyObject( {
|
|
209
|
-
...style,
|
|
210
|
-
border: {
|
|
211
|
-
...style?.border,
|
|
212
|
-
[ attribute ]: undefined,
|
|
213
|
-
},
|
|
214
|
-
} );
|
|
215
|
-
}
|
package/src/hooks/border.scss
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
.
|
|
2
|
-
.
|
|
3
|
-
|
|
1
|
+
.block-editor-hooks__border-controls {
|
|
2
|
+
.block-editor-hooks__border-controls-row {
|
|
3
|
+
display: flex;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
|
|
6
|
+
> * {
|
|
7
|
+
width: calc(50% - #{ $grid-unit-10 });
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.components-unit-control-wrapper {
|
|
12
|
+
margin-bottom: $grid-unit-30;
|
|
13
|
+
|
|
14
|
+
&:last-child {
|
|
15
|
+
margin-bottom: $grid-unit-10;
|
|
16
|
+
}
|
|
4
17
|
}
|
|
5
18
|
}
|
|
19
|
+
|
package/src/hooks/color.js
CHANGED
|
@@ -32,8 +32,6 @@ import useSetting from '../components/use-setting';
|
|
|
32
32
|
|
|
33
33
|
export const COLOR_SUPPORT_KEY = 'color';
|
|
34
34
|
|
|
35
|
-
const EMPTY_OBJECT = {};
|
|
36
|
-
|
|
37
35
|
const hasColorSupport = ( blockType ) => {
|
|
38
36
|
const colorSupport = getBlockSupport( blockType, COLOR_SUPPORT_KEY );
|
|
39
37
|
return (
|
|
@@ -232,7 +230,17 @@ export function ColorEdit( props ) {
|
|
|
232
230
|
],
|
|
233
231
|
[ userPalette, themePalette, defaultPalette ]
|
|
234
232
|
);
|
|
235
|
-
const
|
|
233
|
+
const userGradientPalette = useSetting( 'color.gradients.custom' );
|
|
234
|
+
const themeGradientPalette = useSetting( 'color.gradients.theme' );
|
|
235
|
+
const defaultGradientPalette = useSetting( 'color.gradients.default' );
|
|
236
|
+
const allGradients = useMemo(
|
|
237
|
+
() => [
|
|
238
|
+
...( userGradientPalette || [] ),
|
|
239
|
+
...( themeGradientPalette || [] ),
|
|
240
|
+
...( defaultGradientPalette || [] ),
|
|
241
|
+
],
|
|
242
|
+
[ userGradientPalette, themeGradientPalette, defaultGradientPalette ]
|
|
243
|
+
);
|
|
236
244
|
const areCustomSolidsEnabled = useSetting( 'color.custom' );
|
|
237
245
|
const areCustomGradientsEnabled = useSetting( 'color.customGradient' );
|
|
238
246
|
const isBackgroundEnabled = useSetting( 'color.background' );
|
|
@@ -244,17 +252,8 @@ export function ColorEdit( props ) {
|
|
|
244
252
|
|
|
245
253
|
const gradientsEnabled =
|
|
246
254
|
areCustomGradientsEnabled ||
|
|
247
|
-
!
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
const allGradients = useMemo(
|
|
251
|
-
() => [
|
|
252
|
-
...( gradientsPerOrigin?.custom || [] ),
|
|
253
|
-
...( gradientsPerOrigin?.theme || [] ),
|
|
254
|
-
...( gradientsPerOrigin?.default || [] ),
|
|
255
|
-
],
|
|
256
|
-
[ gradientsPerOrigin ]
|
|
257
|
-
);
|
|
255
|
+
! themeGradientPalette ||
|
|
256
|
+
themeGradientPalette?.length > 0;
|
|
258
257
|
|
|
259
258
|
// Shouldn't be needed but right now the ColorGradientsPanel
|
|
260
259
|
// can trigger both onChangeColor and onChangeBackground
|
package/src/hooks/layout.js
CHANGED
package/src/hooks/style.js
CHANGED
|
@@ -74,6 +74,7 @@ function compileStyleValue( uncompiledValue ) {
|
|
|
74
74
|
* @return {Object} Flattened CSS variables declaration.
|
|
75
75
|
*/
|
|
76
76
|
export function getInlineStyles( styles = {} ) {
|
|
77
|
+
const ignoredStyles = [ 'spacing.blockGap' ];
|
|
77
78
|
const output = {};
|
|
78
79
|
Object.keys( STYLE_PROPERTY ).forEach( ( propKey ) => {
|
|
79
80
|
const path = STYLE_PROPERTY[ propKey ].value;
|
|
@@ -93,7 +94,7 @@ export function getInlineStyles( styles = {} ) {
|
|
|
93
94
|
output[ name ] = compileStyleValue( value );
|
|
94
95
|
}
|
|
95
96
|
} );
|
|
96
|
-
} else {
|
|
97
|
+
} else if ( ! ignoredStyles.includes( path.join( '.' ) ) ) {
|
|
97
98
|
output[ propKey ] = compileStyleValue( get( styles, path ) );
|
|
98
99
|
}
|
|
99
100
|
}
|
package/src/hooks/test/style.js
CHANGED
|
@@ -30,7 +30,6 @@ describe( 'getInlineStyles', () => {
|
|
|
30
30
|
},
|
|
31
31
|
} )
|
|
32
32
|
).toEqual( {
|
|
33
|
-
'--wp--style--block-gap': '1em',
|
|
34
33
|
backgroundColor: 'black',
|
|
35
34
|
borderColor: '#21759b',
|
|
36
35
|
borderRadius: '10px',
|
|
@@ -104,7 +103,6 @@ describe( 'getInlineStyles', () => {
|
|
|
104
103
|
},
|
|
105
104
|
} )
|
|
106
105
|
).toEqual( {
|
|
107
|
-
'--wp--style--block-gap': '1em',
|
|
108
106
|
margin: '10px',
|
|
109
107
|
padding: '20px',
|
|
110
108
|
} );
|
package/src/hooks/typography.js
CHANGED
|
@@ -218,7 +218,7 @@ export function TypographyPanel( props ) {
|
|
|
218
218
|
<ToolsPanelItem
|
|
219
219
|
className="single-column"
|
|
220
220
|
hasValue={ () => hasLetterSpacingValue( props ) }
|
|
221
|
-
label={ __( 'Letter
|
|
221
|
+
label={ __( 'Letter-spacing' ) }
|
|
222
222
|
onDeselect={ () => resetLetterSpacing( props ) }
|
|
223
223
|
isShownByDefault={ defaultControls?.letterSpacing }
|
|
224
224
|
resetAllFilter={ createResetAllFilter( 'letterSpacing' ) }
|
package/src/layouts/flex.js
CHANGED
|
@@ -84,58 +84,35 @@ export default {
|
|
|
84
84
|
</BlockControls>
|
|
85
85
|
);
|
|
86
86
|
},
|
|
87
|
-
save: function FlexLayoutStyle( { selector, layout } ) {
|
|
88
|
-
const {
|
|
89
|
-
orientation = 'horizontal',
|
|
90
|
-
setCascadingProperties = false,
|
|
91
|
-
} = layout;
|
|
87
|
+
save: function FlexLayoutStyle( { selector, layout, style } ) {
|
|
88
|
+
const { orientation = 'horizontal' } = layout;
|
|
92
89
|
const blockGapSupport = useSetting( 'spacing.blockGap' );
|
|
93
90
|
const hasBlockGapStylesSupport = blockGapSupport !== null;
|
|
91
|
+
const blockGapValue =
|
|
92
|
+
style?.spacing?.blockGap ?? 'var( --wp--style--block-gap, 0.5em )';
|
|
94
93
|
const justifyContent =
|
|
95
94
|
justifyContentMap[ layout.justifyContent ] ||
|
|
96
95
|
justifyContentMap.left;
|
|
97
96
|
const flexWrap = flexWrapOptions.includes( layout.flexWrap )
|
|
98
97
|
? layout.flexWrap
|
|
99
98
|
: 'wrap';
|
|
100
|
-
|
|
99
|
+
const rowOrientation = `
|
|
101
100
|
flex-direction: row;
|
|
102
101
|
align-items: center;
|
|
103
102
|
justify-content: ${ justifyContent };
|
|
104
103
|
`;
|
|
105
|
-
if ( setCascadingProperties ) {
|
|
106
|
-
// --layout-justification-setting allows children to inherit the value
|
|
107
|
-
// regardless or row or column direction.
|
|
108
|
-
rowOrientation += `
|
|
109
|
-
--layout-justification-setting: ${ justifyContent };
|
|
110
|
-
--layout-direction: row;
|
|
111
|
-
--layout-wrap: ${ flexWrap };
|
|
112
|
-
--layout-justify: ${ justifyContent };
|
|
113
|
-
--layout-align: center;
|
|
114
|
-
`;
|
|
115
|
-
}
|
|
116
104
|
const alignItems =
|
|
117
105
|
alignItemsMap[ layout.justifyContent ] || alignItemsMap.left;
|
|
118
|
-
|
|
106
|
+
const columnOrientation = `
|
|
119
107
|
flex-direction: column;
|
|
120
108
|
align-items: ${ alignItems };
|
|
121
109
|
`;
|
|
122
|
-
|
|
123
|
-
columnOrientation += `
|
|
124
|
-
--layout-justification-setting: ${ alignItems };
|
|
125
|
-
--layout-direction: column;
|
|
126
|
-
--layout-justify: initial;
|
|
127
|
-
--layout-align: ${ alignItems };
|
|
128
|
-
`;
|
|
129
|
-
}
|
|
110
|
+
|
|
130
111
|
return (
|
|
131
112
|
<style>{ `
|
|
132
113
|
${ appendSelectors( selector ) } {
|
|
133
114
|
display: flex;
|
|
134
|
-
gap: ${
|
|
135
|
-
hasBlockGapStylesSupport
|
|
136
|
-
? 'var( --wp--style--block-gap, 0.5em )'
|
|
137
|
-
: '0.5em'
|
|
138
|
-
};
|
|
115
|
+
gap: ${ hasBlockGapStylesSupport ? blockGapValue : '0.5em' };
|
|
139
116
|
flex-wrap: ${ flexWrap };
|
|
140
117
|
${ orientation === 'horizontal' ? rowOrientation : columnOrientation }
|
|
141
118
|
}
|
package/src/layouts/flow.js
CHANGED
|
@@ -105,12 +105,14 @@ export default {
|
|
|
105
105
|
toolBarControls: function DefaultLayoutToolbarControls() {
|
|
106
106
|
return null;
|
|
107
107
|
},
|
|
108
|
-
save: function DefaultLayoutStyle( { selector, layout = {} } ) {
|
|
108
|
+
save: function DefaultLayoutStyle( { selector, layout = {}, style } ) {
|
|
109
109
|
const { contentSize, wideSize } = layout;
|
|
110
110
|
const blockGapSupport = useSetting( 'spacing.blockGap' );
|
|
111
111
|
const hasBlockGapStylesSupport = blockGapSupport !== null;
|
|
112
|
+
const blockGapValue =
|
|
113
|
+
style?.spacing?.blockGap ?? 'var( --wp--style--block-gap )';
|
|
112
114
|
|
|
113
|
-
let
|
|
115
|
+
let output =
|
|
114
116
|
!! contentSize || !! wideSize
|
|
115
117
|
? `
|
|
116
118
|
${ appendSelectors( selector, '> *' ) } {
|
|
@@ -129,7 +131,7 @@ export default {
|
|
|
129
131
|
`
|
|
130
132
|
: '';
|
|
131
133
|
|
|
132
|
-
|
|
134
|
+
output += `
|
|
133
135
|
${ appendSelectors( selector, '> [data-align="left"]' ) } {
|
|
134
136
|
float: left;
|
|
135
137
|
margin-right: 2em;
|
|
@@ -143,18 +145,18 @@ export default {
|
|
|
143
145
|
`;
|
|
144
146
|
|
|
145
147
|
if ( hasBlockGapStylesSupport ) {
|
|
146
|
-
|
|
148
|
+
output += `
|
|
147
149
|
${ appendSelectors( selector, '> *' ) } {
|
|
148
150
|
margin-top: 0;
|
|
149
151
|
margin-bottom: 0;
|
|
150
152
|
}
|
|
151
153
|
${ appendSelectors( selector, '> * + *' ) } {
|
|
152
|
-
margin-top:
|
|
154
|
+
margin-top: ${ blockGapValue };
|
|
153
155
|
}
|
|
154
156
|
`;
|
|
155
157
|
}
|
|
156
158
|
|
|
157
|
-
return <style>{
|
|
159
|
+
return <style>{ output }</style>;
|
|
158
160
|
},
|
|
159
161
|
getOrientation() {
|
|
160
162
|
return 'vertical';
|
package/src/store/actions.js
CHANGED
|
@@ -555,7 +555,8 @@ export const insertBlocks = (
|
|
|
555
555
|
meta = initialPosition;
|
|
556
556
|
initialPosition = 0;
|
|
557
557
|
deprecated( "meta argument in wp.data.dispatch('core/block-editor')", {
|
|
558
|
-
since: '
|
|
558
|
+
since: '10.1',
|
|
559
|
+
plugin: 'Gutenberg',
|
|
559
560
|
hint: 'The meta argument is now the 6th argument of the function',
|
|
560
561
|
} );
|
|
561
562
|
}
|
|
@@ -1169,8 +1170,7 @@ export const duplicateBlocks = ( clientIds, updateSelection = true ) => ( {
|
|
|
1169
1170
|
|
|
1170
1171
|
const rootClientId = select.getBlockRootClientId( clientIds[ 0 ] );
|
|
1171
1172
|
const lastSelectedIndex = select.getBlockIndex(
|
|
1172
|
-
last( castArray( clientIds ) )
|
|
1173
|
-
rootClientId
|
|
1173
|
+
last( castArray( clientIds ) )
|
|
1174
1174
|
);
|
|
1175
1175
|
const clonedBlocks = blocks.map( ( block ) =>
|
|
1176
1176
|
__experimentalCloneSanitizedBlock( block )
|
|
@@ -1205,7 +1205,7 @@ export const insertBeforeBlock = ( clientId ) => ( { select, dispatch } ) => {
|
|
|
1205
1205
|
return;
|
|
1206
1206
|
}
|
|
1207
1207
|
|
|
1208
|
-
const firstSelectedIndex = select.getBlockIndex( clientId
|
|
1208
|
+
const firstSelectedIndex = select.getBlockIndex( clientId );
|
|
1209
1209
|
return dispatch.insertDefaultBlock( {}, rootClientId, firstSelectedIndex );
|
|
1210
1210
|
};
|
|
1211
1211
|
|
|
@@ -1224,7 +1224,7 @@ export const insertAfterBlock = ( clientId ) => ( { select, dispatch } ) => {
|
|
|
1224
1224
|
return;
|
|
1225
1225
|
}
|
|
1226
1226
|
|
|
1227
|
-
const firstSelectedIndex = select.getBlockIndex( clientId
|
|
1227
|
+
const firstSelectedIndex = select.getBlockIndex( clientId );
|
|
1228
1228
|
return dispatch.insertDefaultBlock(
|
|
1229
1229
|
{},
|
|
1230
1230
|
rootClientId,
|
package/src/store/defaults.js
CHANGED
package/src/store/reducer.js
CHANGED
|
@@ -737,6 +737,27 @@ const withSaveReusableBlock = ( reducer ) => ( state, action ) => {
|
|
|
737
737
|
|
|
738
738
|
return reducer( state, action );
|
|
739
739
|
};
|
|
740
|
+
/**
|
|
741
|
+
* Higher-order reducer which removes blocks from state when switching parent block controlled state.
|
|
742
|
+
*
|
|
743
|
+
* @param {Function} reducer Original reducer function.
|
|
744
|
+
*
|
|
745
|
+
* @return {Function} Enhanced reducer function.
|
|
746
|
+
*/
|
|
747
|
+
const withResetControlledBlocks = ( reducer ) => ( state, action ) => {
|
|
748
|
+
if ( action.type === 'SET_HAS_CONTROLLED_INNER_BLOCKS' ) {
|
|
749
|
+
// when switching a block from controlled to uncontrolled or inverse,
|
|
750
|
+
// we need to remove its content first.
|
|
751
|
+
const tempState = reducer( state, {
|
|
752
|
+
type: 'REPLACE_INNER_BLOCKS',
|
|
753
|
+
rootClientId: action.clientId,
|
|
754
|
+
blocks: [],
|
|
755
|
+
} );
|
|
756
|
+
return reducer( tempState, action );
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
return reducer( state, action );
|
|
760
|
+
};
|
|
740
761
|
|
|
741
762
|
/**
|
|
742
763
|
* Reducer returning the blocks state.
|
|
@@ -754,7 +775,8 @@ export const blocks = flow(
|
|
|
754
775
|
withReplaceInnerBlocks, // needs to be after withInnerBlocksRemoveCascade
|
|
755
776
|
withBlockReset,
|
|
756
777
|
withPersistentBlockChange,
|
|
757
|
-
withIgnoredBlockChange
|
|
778
|
+
withIgnoredBlockChange,
|
|
779
|
+
withResetControlledBlocks
|
|
758
780
|
)( {
|
|
759
781
|
byClientId( state = {}, action ) {
|
|
760
782
|
switch ( action.type ) {
|
package/src/store/selectors.js
CHANGED
|
@@ -892,11 +892,11 @@ export function getBlockOrder( state, rootClientId ) {
|
|
|
892
892
|
*
|
|
893
893
|
* @param {Object} state Editor state.
|
|
894
894
|
* @param {string} clientId Block client ID.
|
|
895
|
-
* @param {?string} rootClientId Optional root client ID of block list.
|
|
896
895
|
*
|
|
897
896
|
* @return {number} Index at which block exists in order.
|
|
898
897
|
*/
|
|
899
|
-
export function getBlockIndex( state, clientId
|
|
898
|
+
export function getBlockIndex( state, clientId ) {
|
|
899
|
+
const rootClientId = getBlockRootClientId( state, clientId );
|
|
900
900
|
return getBlockOrder( state, rootClientId ).indexOf( clientId );
|
|
901
901
|
}
|
|
902
902
|
|
|
@@ -2050,6 +2050,41 @@ describe( 'state', () => {
|
|
|
2050
2050
|
expect( state.isIgnoredChange ).toBe( true );
|
|
2051
2051
|
} );
|
|
2052
2052
|
} );
|
|
2053
|
+
|
|
2054
|
+
describe( 'controlledInnerBlocks', () => {
|
|
2055
|
+
it( 'should remove the content of the block if it switches from controlled to uncontrolled or opposite', () => {
|
|
2056
|
+
const original = blocks( undefined, {
|
|
2057
|
+
type: 'RESET_BLOCKS',
|
|
2058
|
+
blocks: [
|
|
2059
|
+
{
|
|
2060
|
+
clientId: 'chicken',
|
|
2061
|
+
name: 'core/test-block',
|
|
2062
|
+
attributes: {},
|
|
2063
|
+
innerBlocks: [
|
|
2064
|
+
{
|
|
2065
|
+
clientId: 'child',
|
|
2066
|
+
name: 'core/test-block',
|
|
2067
|
+
attributes: {},
|
|
2068
|
+
innerBlocks: [],
|
|
2069
|
+
},
|
|
2070
|
+
],
|
|
2071
|
+
},
|
|
2072
|
+
],
|
|
2073
|
+
} );
|
|
2074
|
+
|
|
2075
|
+
const state = blocks( original, {
|
|
2076
|
+
type: 'SET_HAS_CONTROLLED_INNER_BLOCKS',
|
|
2077
|
+
clientId: 'chicken',
|
|
2078
|
+
hasControlledInnerBlocks: true,
|
|
2079
|
+
} );
|
|
2080
|
+
|
|
2081
|
+
expect( state.controlledInnerBlocks.chicken ).toBe( true );
|
|
2082
|
+
// The previous content of the block should be removed
|
|
2083
|
+
expect( state.byClientId.child ).toBeUndefined();
|
|
2084
|
+
expect( state.tree.child ).toBeUndefined();
|
|
2085
|
+
expect( state.tree.chicken.innerBlocks ).toEqual( [] );
|
|
2086
|
+
} );
|
|
2087
|
+
} );
|
|
2053
2088
|
} );
|
|
2054
2089
|
} );
|
|
2055
2090
|
|
package/src/style.scss
CHANGED
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
@import "./components/default-block-appender/style.scss";
|
|
33
33
|
@import "./components/duotone-control/style.scss";
|
|
34
34
|
@import "./components/font-appearance-control/style.scss";
|
|
35
|
+
@import "./components/justify-content-control/style.scss";
|
|
36
|
+
@import "./components/link-control/style.scss";
|
|
37
|
+
@import "./components/line-height-control/style.scss";
|
|
35
38
|
@import "./components/image-size-control/style.scss";
|
|
36
39
|
@import "./components/inner-blocks/style.scss";
|
|
37
40
|
@import "./components/inserter-list-item/style.scss";
|
|
38
|
-
@import "./components/justify-content-control/style.scss";
|
|
39
|
-
@import "./components/line-height-control/style.scss";
|
|
40
|
-
@import "./components/link-control/style.scss";
|
|
41
41
|
@import "./components/list-view/style.scss";
|
|
42
42
|
@import "./components/media-replace-flow/style.scss";
|
|
43
43
|
@import "./components/media-placeholder/style.scss";
|
|
@@ -55,7 +55,6 @@
|
|
|
55
55
|
@import "./hooks/anchor.scss";
|
|
56
56
|
@import "./hooks/layout.scss";
|
|
57
57
|
@import "./hooks/border.scss";
|
|
58
|
-
@import "./hooks/dimensions.scss";
|
|
59
58
|
@import "./hooks/typography.scss";
|
|
60
59
|
|
|
61
60
|
@import "./components/block-toolbar/style.scss";
|
|
@@ -27,7 +27,7 @@ export function getPasteEventData( { clipboardData } ) {
|
|
|
27
27
|
|
|
28
28
|
const files = getFilesFromDataTransfer(
|
|
29
29
|
clipboardData
|
|
30
|
-
).filter( ( { type } ) => /^image\/(?:jpe?g|png|gif
|
|
30
|
+
).filter( ( { type } ) => /^image\/(?:jpe?g|png|gif)$/.test( type ) );
|
|
31
31
|
|
|
32
32
|
// Only process files if no HTML is present.
|
|
33
33
|
// A pasted file may have the URL as plain text.
|
|
@@ -8,7 +8,7 @@ function parseUnit( cssUnit ) {
|
|
|
8
8
|
const match = cssUnit
|
|
9
9
|
?.trim()
|
|
10
10
|
.match(
|
|
11
|
-
/^(0?[-.]?\d
|
|
11
|
+
/^(0?[-.]?\d+)(r?e[m|x]|v[h|w|min|max]+|p[x|t|c]|[c|m]m|%|in|ch|Q|lh)$/
|
|
12
12
|
);
|
|
13
13
|
if ( ! isNaN( cssUnit ) && ! isNaN( parseFloat( cssUnit ) ) ) {
|
|
14
14
|
return { value: parseFloat( cssUnit ), unit: 'px' };
|