@wordpress/block-editor 8.6.0 → 9.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/README.md +5 -2
- package/build/components/block-alignment-control/constants.js +48 -0
- package/build/components/block-alignment-control/constants.js.map +1 -0
- package/build/components/block-alignment-control/ui.js +9 -40
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/ui.native.js +92 -0
- package/build/components/block-alignment-control/ui.native.js.map +1 -0
- package/build/components/block-alignment-matrix-control/index.js +1 -6
- package/build/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build/components/block-content-overlay/index.js +4 -82
- package/build/components/block-content-overlay/index.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.native.js +65 -0
- package/build/components/block-draggable/draggable-chip.native.js.map +1 -0
- package/build/components/block-draggable/dropping-insertion-point.native.js +157 -0
- package/build/components/block-draggable/dropping-insertion-point.native.js.map +1 -0
- package/build/components/block-draggable/index.native.js +488 -0
- package/build/components/block-draggable/index.native.js.map +1 -0
- package/build/components/block-draggable/use-scroll-when-dragging.native.js +130 -0
- package/build/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -0
- package/build/components/block-list/block-list-context.native.js +195 -0
- package/build/components/block-list/block-list-context.native.js.map +1 -0
- package/build/components/block-list/block-list-item-cell.native.js +67 -0
- package/build/components/block-list/block-list-item-cell.native.js.map +1 -0
- package/build/components/block-list/block-list-item.native.js +12 -9
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block.native.js +27 -5
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +34 -32
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/index.native.js +75 -23
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +8 -4
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-class-names.js +1 -7
- package/build/components/block-list/use-block-props/use-block-class-names.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-mobile-toolbar/index.native.js +10 -3
- package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build/components/block-mover/index.native.js +17 -4
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +11 -5
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-popover/inbetween.js +19 -8
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +20 -16
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/index.js +1 -1
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +1 -0
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +1 -29
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +16 -2
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/border-radius-control/input-controls.js +10 -3
- package/build/components/border-radius-control/input-controls.js.map +1 -1
- package/build/components/color-style-selector/index.js +9 -0
- package/build/components/color-style-selector/index.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +122 -41
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +35 -60
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/convert-to-group-buttons/toolbar.js +22 -5
- package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build/components/iframe/index.js +51 -50
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +3 -1
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/index.js +14 -23
- package/build/components/index.js.map +1 -1
- package/build/components/inserter/index.js +21 -7
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +2 -2
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +4 -5
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/link-control/constants.js +11 -1
- package/build/components/link-control/constants.js.map +1 -1
- package/build/components/link-control/search-results.js +4 -3
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/use-search-handler.js +4 -4
- package/build/components/link-control/use-search-handler.js.map +1 -1
- package/build/components/list-view/block.js +15 -15
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +9 -13
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/context.js +1 -4
- package/build/components/list-view/context.js.map +1 -1
- package/build/components/list-view/drop-indicator.js +0 -1
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js +15 -32
- package/build/components/list-view/index.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/media-upload/index.native.js +10 -4
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +12 -2
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/plain-text/index.native.js +62 -7
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/publish-date-time-picker/index.js +55 -0
- package/build/components/publish-date-time-picker/index.js.map +1 -0
- package/build/components/rich-text/format-toolbar-container.js +0 -1
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/index.js +2 -2
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +5 -1
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/url-input/index.js +11 -4
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.native.js +167 -0
- package/build/components/use-block-drop-zone/index.native.js.map +1 -0
- package/build/components/use-on-block-drop/index.native.js +95 -0
- package/build/components/use-on-block-drop/index.native.js.map +1 -0
- package/build/components/use-setting/index.js +42 -18
- package/build/components/use-setting/index.js.map +1 -1
- package/build/components/warning/index.js +6 -1
- package/build/components/warning/index.js.map +1 -1
- package/build/components/writing-flow/use-click-selection.js +1 -3
- package/build/components/writing-flow/use-click-selection.js.map +1 -1
- package/build/components/writing-flow/use-input.js +15 -0
- package/build/components/writing-flow/use-input.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +49 -8
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/elements/index.js +9 -0
- package/build/elements/index.js.map +1 -0
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border.js +2 -7
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color-panel.js +14 -7
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color.js +8 -88
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/dimensions.js +16 -6
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/margin.js +64 -12
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +60 -12
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/settings.js +32 -0
- package/build/hooks/settings.js.map +1 -0
- package/build/hooks/style.js +14 -13
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/typography.js +6 -2
- package/build/hooks/typography.js.map +1 -1
- package/build/index.js +14 -0
- package/build/index.js.map +1 -1
- package/build/layouts/flex.js +5 -2
- package/build/layouts/flex.js.map +1 -1
- package/build/store/actions.js +14 -0
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +0 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +17 -2
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +43 -13
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-alignment-control/constants.js +36 -0
- package/build-module/components/block-alignment-control/constants.js.map +1 -0
- package/build-module/components/block-alignment-control/ui.js +4 -35
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.native.js +78 -0
- package/build-module/components/block-alignment-control/ui.native.js.map +1 -0
- package/build-module/components/block-alignment-matrix-control/index.js +1 -6
- package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build-module/components/block-content-overlay/index.js +3 -78
- package/build-module/components/block-content-overlay/index.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.native.js +51 -0
- package/build-module/components/block-draggable/draggable-chip.native.js.map +1 -0
- package/build-module/components/block-draggable/dropping-insertion-point.native.js +137 -0
- package/build-module/components/block-draggable/dropping-insertion-point.native.js.map +1 -0
- package/build-module/components/block-draggable/index.native.js +453 -0
- package/build-module/components/block-draggable/index.native.js.map +1 -0
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js +120 -0
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -0
- package/build-module/components/block-list/block-list-context.native.js +179 -0
- package/build-module/components/block-list/block-list-context.native.js.map +1 -0
- package/build-module/components/block-list/block-list-item-cell.native.js +59 -0
- package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -0
- package/build-module/components/block-list/block-list-item.native.js +12 -9
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block.native.js +26 -5
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +35 -33
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/index.native.js +72 -23
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +9 -5
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-class-names.js +1 -7
- package/build-module/components/block-list/use-block-props/use-block-class-names.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-mobile-toolbar/index.native.js +9 -3
- package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +18 -5
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +10 -5
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +19 -8
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +21 -15
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/index.js +1 -1
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +1 -0
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +2 -29
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +13 -2
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/border-radius-control/input-controls.js +11 -4
- package/build-module/components/border-radius-control/input-controls.js.map +1 -1
- package/build-module/components/color-style-selector/index.js +6 -0
- package/build-module/components/color-style-selector/index.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +124 -43
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +36 -64
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js +23 -6
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build-module/components/iframe/index.js +52 -51
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +2 -1
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/index.js +2 -3
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter/index.js +21 -7
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +2 -2
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +4 -5
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/link-control/constants.js +5 -0
- package/build-module/components/link-control/constants.js.map +1 -1
- package/build-module/components/link-control/search-results.js +3 -4
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/use-search-handler.js +5 -5
- package/build-module/components/link-control/use-search-handler.js.map +1 -1
- package/build-module/components/list-view/block.js +15 -16
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +9 -13
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/context.js +1 -4
- package/build-module/components/list-view/context.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js +0 -1
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js +15 -31
- package/build-module/components/list-view/index.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/media-upload/index.native.js +8 -3
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +12 -2
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/plain-text/index.native.js +63 -8
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/publish-date-time-picker/index.js +42 -0
- package/build-module/components/publish-date-time-picker/index.js.map +1 -0
- package/build-module/components/rich-text/format-toolbar-container.js +0 -1
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/index.js +2 -2
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +5 -1
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/url-input/index.js +11 -4
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.native.js +148 -0
- package/build-module/components/use-block-drop-zone/index.native.js.map +1 -0
- package/build-module/components/use-on-block-drop/index.native.js +83 -0
- package/build-module/components/use-on-block-drop/index.native.js.map +1 -0
- package/build-module/components/use-setting/index.js +43 -19
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/components/warning/index.js +6 -1
- package/build-module/components/warning/index.js.map +1 -1
- package/build-module/components/writing-flow/use-click-selection.js +1 -3
- package/build-module/components/writing-flow/use-click-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-input.js +15 -0
- package/build-module/components/writing-flow/use-input.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +49 -8
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/elements/index.js +2 -0
- package/build-module/elements/index.js.map +1 -0
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border.js +2 -7
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color-panel.js +11 -6
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color.js +8 -88
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/dimensions.js +19 -9
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/margin.js +61 -13
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +57 -13
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/settings.js +29 -0
- package/build-module/hooks/settings.js.map +1 -0
- package/build-module/hooks/style.js +15 -14
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/typography.js +6 -2
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/flex.js +4 -2
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/store/actions.js +12 -0
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +0 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +17 -2
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +37 -12
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +100 -225
- package/build-style/style.css +100 -225
- package/package.json +30 -30
- package/src/components/block-alignment-control/constants.js +45 -0
- package/src/components/block-alignment-control/ui.js +69 -109
- package/src/components/block-alignment-control/ui.native.js +86 -0
- package/src/components/block-alignment-matrix-control/index.js +1 -5
- package/src/components/block-content-overlay/index.js +8 -95
- package/src/components/block-content-overlay/style.scss +2 -12
- package/src/components/block-draggable/draggable-chip.native.js +49 -0
- package/src/components/block-draggable/dropping-insertion-point.native.js +181 -0
- package/src/components/block-draggable/dropping-insertion-point.native.scss +8 -0
- package/src/components/block-draggable/index.native.js +462 -0
- package/src/components/block-draggable/style.native.scss +19 -0
- package/src/components/block-draggable/test/__snapshots__/index.native.js.snap +73 -0
- package/src/components/block-draggable/test/helpers.native.js +183 -0
- package/src/components/block-draggable/test/index.native.js +496 -0
- package/src/components/block-draggable/use-scroll-when-dragging.native.js +135 -0
- package/src/components/block-list/block-list-context.native.js +175 -0
- package/src/components/block-list/block-list-item-cell.native.js +49 -0
- package/src/components/block-list/block-list-item.native.js +7 -11
- package/src/components/block-list/block.native.js +37 -8
- package/src/components/block-list/index.js +44 -44
- package/src/components/block-list/index.native.js +54 -13
- package/src/components/block-list/style.scss +7 -18
- package/src/components/block-list/test/block-list-context.native.js +253 -0
- package/src/components/block-list/test/fixtures/block-list-context.native.js +79 -0
- package/src/components/block-list/use-block-props/index.js +10 -5
- package/src/components/block-list/use-block-props/use-block-class-names.js +1 -11
- package/src/components/block-list/use-in-between-inserter.js +1 -1
- package/src/components/block-mobile-toolbar/index.native.js +9 -1
- package/src/components/block-mover/index.native.js +22 -6
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +10 -0
- package/src/components/block-navigation/dropdown.js +12 -8
- package/src/components/block-popover/inbetween.js +21 -8
- package/src/components/block-popover/index.js +18 -15
- package/src/components/block-popover/style.scss +4 -0
- package/src/components/block-preview/index.js +1 -4
- package/src/components/block-switcher/style.scss +2 -39
- package/src/components/block-tools/block-selection-button.js +1 -0
- package/src/components/block-tools/selected-block-popover.js +1 -36
- package/src/components/block-tools/style.scss +1 -12
- package/src/components/block-variation-transforms/index.js +6 -2
- package/src/components/border-radius-control/input-controls.js +16 -8
- package/src/components/border-radius-control/style.scss +3 -2
- package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
- package/src/components/color-style-selector/index.js +18 -9
- package/src/components/colors-gradients/dropdown.js +130 -62
- package/src/components/colors-gradients/panel-color-gradient-settings.js +30 -76
- package/src/components/colors-gradients/style.scss +52 -50
- package/src/components/convert-to-group-buttons/toolbar.js +30 -13
- package/src/components/duotone-control/style.scss +1 -7
- package/src/components/iframe/index.js +62 -54
- package/src/components/image-editor/use-save-image.js +2 -1
- package/src/components/image-size-control/README.md +1 -1
- package/src/components/index.js +2 -3
- package/src/components/inserter/index.js +20 -0
- package/src/components/inserter/index.native.js +2 -2
- package/src/components/inserter/quick-inserter.js +3 -11
- package/src/components/inserter/style.native.scss +1 -0
- package/src/components/inserter/style.scss +2 -1
- package/src/components/link-control/constants.js +11 -0
- package/src/components/link-control/search-results.js +4 -5
- package/src/components/link-control/use-search-handler.js +11 -5
- package/src/components/list-view/block.js +24 -34
- package/src/components/list-view/branch.js +10 -20
- package/src/components/list-view/context.js +1 -4
- package/src/components/list-view/drop-indicator.js +0 -1
- package/src/components/list-view/index.js +11 -41
- package/src/components/list-view/style.scss +2 -1
- package/src/components/media-placeholder/index.js +0 -2
- package/src/components/media-replace-flow/index.js +0 -2
- package/src/components/media-upload/index.native.js +6 -2
- package/src/components/media-upload/test/index.native.js +31 -6
- package/src/components/navigable-toolbar/index.js +12 -2
- package/src/components/plain-text/index.native.js +64 -8
- package/src/components/preview-options/style.scss +0 -4
- package/src/components/publish-date-time-picker/README.md +52 -0
- package/src/components/publish-date-time-picker/index.js +50 -0
- package/src/components/publish-date-time-picker/style.scss +20 -0
- package/src/components/rich-text/format-toolbar-container.js +0 -1
- package/src/components/rich-text/index.js +3 -1
- package/src/components/rich-text/index.native.js +4 -0
- package/src/components/rich-text/style.scss +2 -8
- package/src/components/url-input/index.js +9 -4
- package/src/components/use-block-drop-zone/index.native.js +173 -0
- package/src/components/use-on-block-drop/index.native.js +119 -0
- package/src/components/use-setting/index.js +57 -21
- package/src/components/warning/index.js +47 -42
- package/src/components/warning/test/__snapshots__/index.js.snap +15 -6
- package/src/components/warning/test/index.js +1 -1
- package/src/components/writing-flow/use-click-selection.js +1 -4
- package/src/components/writing-flow/use-input.js +12 -0
- package/src/components/writing-flow/use-selection-observer.js +55 -10
- package/src/elements/index.js +1 -0
- package/src/hooks/anchor.js +1 -1
- package/src/hooks/border.js +2 -11
- package/src/hooks/border.scss +0 -48
- package/src/hooks/color-panel.js +13 -9
- package/src/hooks/color.js +5 -74
- package/src/hooks/color.scss +5 -58
- package/src/hooks/dimensions.js +55 -41
- package/src/hooks/index.js +1 -0
- package/src/hooks/margin.js +64 -15
- package/src/hooks/padding.js +60 -15
- package/src/hooks/padding.scss +12 -0
- package/src/hooks/settings.js +32 -0
- package/src/hooks/style.js +25 -39
- package/src/hooks/test/settings.js +48 -0
- package/src/hooks/typography.js +2 -0
- package/src/index.js +1 -0
- package/src/layouts/flex.js +11 -3
- package/src/store/actions.js +12 -0
- package/src/store/defaults.js +0 -1
- package/src/store/reducer.js +14 -1
- package/src/store/selectors.js +42 -12
- package/src/store/test/reducer.js +5 -0
- package/src/store/test/selectors.js +17 -0
- package/src/style.scss +2 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/border-style-control/index.js +0 -60
- package/build/components/border-style-control/index.js.map +0 -1
- package/build/components/colors/color-panel.js +0 -82
- package/build/components/colors/color-panel.js.map +0 -1
- package/build/components/colors/color-panel.native.js +0 -11
- package/build/components/colors/color-panel.native.js.map +0 -1
- package/build/components/colors-gradients/tools-panel-color-dropdown.js +0 -89
- package/build/components/colors-gradients/tools-panel-color-dropdown.js.map +0 -1
- package/build-module/components/border-style-control/index.js +0 -50
- package/build-module/components/border-style-control/index.js.map +0 -1
- package/build-module/components/colors/color-panel.js +0 -70
- package/build-module/components/colors/color-panel.js.map +0 -1
- package/build-module/components/colors/color-panel.native.js +0 -4
- package/build-module/components/colors/color-panel.native.js.map +0 -1
- package/build-module/components/colors-gradients/tools-panel-color-dropdown.js +0 -75
- package/build-module/components/colors-gradients/tools-panel-color-dropdown.js.map +0 -1
- package/src/components/block-alignment-matrix-control/style.scss +0 -10
- package/src/components/border-style-control/index.js +0 -47
- package/src/components/border-style-control/style.scss +0 -18
- package/src/components/colors/color-panel.js +0 -91
- package/src/components/colors/color-panel.native.js +0 -3
- package/src/components/colors-gradients/tools-panel-color-dropdown.js +0 -85
package/src/hooks/padding.js
CHANGED
|
@@ -2,12 +2,19 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
Platform,
|
|
7
|
+
useState,
|
|
8
|
+
useRef,
|
|
9
|
+
useEffect,
|
|
10
|
+
useMemo,
|
|
11
|
+
} from '@wordpress/element';
|
|
6
12
|
import { getBlockSupport } from '@wordpress/blocks';
|
|
7
13
|
import {
|
|
8
14
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
9
15
|
__experimentalBoxControl as BoxControl,
|
|
10
16
|
} from '@wordpress/components';
|
|
17
|
+
import isShallowEqual from '@wordpress/is-shallow-equal';
|
|
11
18
|
|
|
12
19
|
/**
|
|
13
20
|
* Internal dependencies
|
|
@@ -20,6 +27,7 @@ import {
|
|
|
20
27
|
useIsDimensionsSupportValid,
|
|
21
28
|
} from './dimensions';
|
|
22
29
|
import { cleanEmptyObject } from './utils';
|
|
30
|
+
import BlockPopover from '../components/block-popover';
|
|
23
31
|
|
|
24
32
|
/**
|
|
25
33
|
* Determines if there is padding support.
|
|
@@ -124,26 +132,12 @@ export function PaddingEdit( props ) {
|
|
|
124
132
|
} );
|
|
125
133
|
};
|
|
126
134
|
|
|
127
|
-
const onChangeShowVisualizer = ( next ) => {
|
|
128
|
-
const newStyle = {
|
|
129
|
-
...style,
|
|
130
|
-
visualizers: {
|
|
131
|
-
padding: next,
|
|
132
|
-
},
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
setAttributes( {
|
|
136
|
-
style: cleanEmptyObject( newStyle ),
|
|
137
|
-
} );
|
|
138
|
-
};
|
|
139
|
-
|
|
140
135
|
return Platform.select( {
|
|
141
136
|
web: (
|
|
142
137
|
<>
|
|
143
138
|
<BoxControl
|
|
144
139
|
values={ style?.spacing?.padding }
|
|
145
140
|
onChange={ onChange }
|
|
146
|
-
onChangeShowVisualizer={ onChangeShowVisualizer }
|
|
147
141
|
label={ __( 'Padding' ) }
|
|
148
142
|
sides={ sides }
|
|
149
143
|
units={ units }
|
|
@@ -155,3 +149,54 @@ export function PaddingEdit( props ) {
|
|
|
155
149
|
native: null,
|
|
156
150
|
} );
|
|
157
151
|
}
|
|
152
|
+
|
|
153
|
+
export function PaddingVisualizer( { clientId, attributes } ) {
|
|
154
|
+
const padding = attributes?.style?.spacing?.padding;
|
|
155
|
+
const style = useMemo( () => {
|
|
156
|
+
return {
|
|
157
|
+
borderTopWidth: padding?.top ?? 0,
|
|
158
|
+
borderRightWidth: padding?.right ?? 0,
|
|
159
|
+
borderBottomWidth: padding?.bottom ?? 0,
|
|
160
|
+
borderLeftWidth: padding?.left ?? 0,
|
|
161
|
+
};
|
|
162
|
+
}, [ padding ] );
|
|
163
|
+
|
|
164
|
+
const [ isActive, setIsActive ] = useState( false );
|
|
165
|
+
const valueRef = useRef( padding );
|
|
166
|
+
const timeoutRef = useRef();
|
|
167
|
+
|
|
168
|
+
const clearTimer = () => {
|
|
169
|
+
if ( timeoutRef.current ) {
|
|
170
|
+
window.clearTimeout( timeoutRef.current );
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
useEffect( () => {
|
|
175
|
+
if ( ! isShallowEqual( padding, valueRef.current ) ) {
|
|
176
|
+
setIsActive( true );
|
|
177
|
+
valueRef.current = padding;
|
|
178
|
+
|
|
179
|
+
clearTimer();
|
|
180
|
+
|
|
181
|
+
timeoutRef.current = setTimeout( () => {
|
|
182
|
+
setIsActive( false );
|
|
183
|
+
}, 400 );
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return () => clearTimer();
|
|
187
|
+
}, [ padding ] );
|
|
188
|
+
|
|
189
|
+
if ( ! isActive ) {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return (
|
|
194
|
+
<BlockPopover
|
|
195
|
+
clientId={ clientId }
|
|
196
|
+
__unstableCoverTarget
|
|
197
|
+
__unstableRefreshSize={ padding }
|
|
198
|
+
>
|
|
199
|
+
<div className="block-editor__padding-visualizer" style={ style } />
|
|
200
|
+
</BlockPopover>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { addFilter } from '@wordpress/hooks';
|
|
5
|
+
import { hasBlockSupport } from '@wordpress/blocks';
|
|
6
|
+
|
|
7
|
+
const hasSettingsSupport = ( blockType ) =>
|
|
8
|
+
hasBlockSupport( blockType, '__experimentalSettings', false );
|
|
9
|
+
|
|
10
|
+
function addAttribute( settings ) {
|
|
11
|
+
if ( ! hasSettingsSupport( settings ) ) {
|
|
12
|
+
return settings;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Allow blocks to specify their own attribute definition with default values if needed.
|
|
16
|
+
if ( ! settings?.attributes?.settings ) {
|
|
17
|
+
settings.attributes = {
|
|
18
|
+
...settings.attributes,
|
|
19
|
+
settings: {
|
|
20
|
+
type: 'object',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return settings;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
addFilter(
|
|
29
|
+
'blocks.registerBlockType',
|
|
30
|
+
'core/settings/addAttribute',
|
|
31
|
+
addAttribute
|
|
32
|
+
);
|
package/src/hooks/style.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
first,
|
|
6
|
-
forEach,
|
|
7
|
-
get,
|
|
8
|
-
has,
|
|
9
|
-
isEmpty,
|
|
10
|
-
isString,
|
|
11
|
-
kebabCase,
|
|
12
|
-
map,
|
|
13
|
-
omit,
|
|
14
|
-
startsWith,
|
|
15
|
-
} from 'lodash';
|
|
4
|
+
import { get, has, isEmpty, kebabCase, omit } from 'lodash';
|
|
16
5
|
import classnames from 'classnames';
|
|
17
6
|
|
|
18
7
|
/**
|
|
@@ -58,7 +47,7 @@ const VARIABLE_REFERENCE_PREFIX = 'var:';
|
|
|
58
47
|
const VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';
|
|
59
48
|
const VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';
|
|
60
49
|
function compileStyleValue( uncompiledValue ) {
|
|
61
|
-
if ( startsWith(
|
|
50
|
+
if ( uncompiledValue?.startsWith?.( VARIABLE_REFERENCE_PREFIX ) ) {
|
|
62
51
|
const variable = uncompiledValue
|
|
63
52
|
.slice( VARIABLE_REFERENCE_PREFIX.length )
|
|
64
53
|
.split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )
|
|
@@ -82,13 +71,13 @@ export function getInlineStyles( styles = {} ) {
|
|
|
82
71
|
const path = STYLE_PROPERTY[ propKey ].value;
|
|
83
72
|
const subPaths = STYLE_PROPERTY[ propKey ].properties;
|
|
84
73
|
// Ignore styles on elements because they are handled on the server.
|
|
85
|
-
if ( has( styles, path ) && 'elements' !==
|
|
74
|
+
if ( has( styles, path ) && 'elements' !== path?.[ 0 ] ) {
|
|
86
75
|
// Checking if style value is a string allows for shorthand css
|
|
87
76
|
// option and backwards compatibility for border radius support.
|
|
88
77
|
const styleValue = get( styles, path );
|
|
89
78
|
|
|
90
79
|
if ( ! STYLE_PROPERTY[ propKey ].useEngine ) {
|
|
91
|
-
if ( !! subPaths &&
|
|
80
|
+
if ( !! subPaths && typeof styleValue !== 'string' ) {
|
|
92
81
|
Object.entries( subPaths ).forEach( ( entry ) => {
|
|
93
82
|
const [ name, subPath ] = entry;
|
|
94
83
|
const value = get( styleValue, [ subPath ] );
|
|
@@ -108,11 +97,8 @@ export function getInlineStyles( styles = {} ) {
|
|
|
108
97
|
|
|
109
98
|
// The goal is to move everything to server side generated engine styles
|
|
110
99
|
// This is temporary as we absorb more and more styles into the engine.
|
|
111
|
-
const extraRules = getCSSRules( styles
|
|
100
|
+
const extraRules = getCSSRules( styles );
|
|
112
101
|
extraRules.forEach( ( rule ) => {
|
|
113
|
-
if ( rule.selector !== 'self' ) {
|
|
114
|
-
throw "This style can't be added as inline style";
|
|
115
|
-
}
|
|
116
102
|
output[ rule.key ] = rule.value;
|
|
117
103
|
} );
|
|
118
104
|
|
|
@@ -120,24 +106,25 @@ export function getInlineStyles( styles = {} ) {
|
|
|
120
106
|
}
|
|
121
107
|
|
|
122
108
|
function compileElementsStyles( selector, elements = {} ) {
|
|
123
|
-
return
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
elementStyles
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
109
|
+
return Object.entries( elements )
|
|
110
|
+
.map( ( [ element, styles ] ) => {
|
|
111
|
+
const elementStyles = getInlineStyles( styles );
|
|
112
|
+
if ( ! isEmpty( elementStyles ) ) {
|
|
113
|
+
// The .editor-styles-wrapper selector is required on elements styles. As it is
|
|
114
|
+
// added to all other editor styles, not providing it causes reset and global
|
|
115
|
+
// styles to override element styles because of higher specificity.
|
|
116
|
+
return [
|
|
117
|
+
`.editor-styles-wrapper .${ selector } ${ ELEMENTS[ element ] }{`,
|
|
118
|
+
...Object.entries( elementStyles ).map(
|
|
119
|
+
( [ cssProperty, value ] ) =>
|
|
120
|
+
`\t${ kebabCase( cssProperty ) }: ${ value };`
|
|
121
|
+
),
|
|
122
|
+
'}',
|
|
123
|
+
].join( '\n' );
|
|
124
|
+
}
|
|
125
|
+
return '';
|
|
126
|
+
} )
|
|
127
|
+
.join( '\n' );
|
|
141
128
|
}
|
|
142
129
|
|
|
143
130
|
/**
|
|
@@ -235,8 +222,7 @@ export function addSaveProps(
|
|
|
235
222
|
}
|
|
236
223
|
|
|
237
224
|
let { style } = attributes;
|
|
238
|
-
|
|
239
|
-
forEach( skipPaths, ( path, indicator ) => {
|
|
225
|
+
Object.entries( skipPaths ).forEach( ( [ indicator, path ] ) => {
|
|
240
226
|
const skipSerialization = getBlockSupport( blockType, indicator );
|
|
241
227
|
|
|
242
228
|
if ( skipSerialization === true ) {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { applyFilters } from '@wordpress/hooks';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import '../settings';
|
|
10
|
+
|
|
11
|
+
describe( 'with settings', () => {
|
|
12
|
+
const blockSettings = {
|
|
13
|
+
save: () => <div className="default" />,
|
|
14
|
+
category: 'text',
|
|
15
|
+
title: 'block title',
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
describe( 'addAttribute', () => {
|
|
19
|
+
const addAttribute = applyFilters.bind(
|
|
20
|
+
null,
|
|
21
|
+
'blocks.registerBlockType'
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
it( 'does not have settings att if settings block support is not enabled', () => {
|
|
25
|
+
const settings = addAttribute( {
|
|
26
|
+
...blockSettings,
|
|
27
|
+
supports: {
|
|
28
|
+
__experimentalSettings: false,
|
|
29
|
+
},
|
|
30
|
+
} );
|
|
31
|
+
|
|
32
|
+
expect( settings.attributes ).toBe( undefined );
|
|
33
|
+
} );
|
|
34
|
+
|
|
35
|
+
it( 'has settings att if settings block supports is enabled', () => {
|
|
36
|
+
const settings = addAttribute( {
|
|
37
|
+
...blockSettings,
|
|
38
|
+
supports: {
|
|
39
|
+
__experimentalSettings: true,
|
|
40
|
+
},
|
|
41
|
+
} );
|
|
42
|
+
|
|
43
|
+
expect( settings.attributes ).toStrictEqual( {
|
|
44
|
+
settings: { type: 'object' },
|
|
45
|
+
} );
|
|
46
|
+
} );
|
|
47
|
+
} );
|
|
48
|
+
} );
|
package/src/hooks/typography.js
CHANGED
|
@@ -130,6 +130,7 @@ export function TypographyPanel( props ) {
|
|
|
130
130
|
{ ! isFontSizeDisabled && (
|
|
131
131
|
<ToolsPanelItem
|
|
132
132
|
hasValue={ () => hasFontSizeValue( props ) }
|
|
133
|
+
/* translators: Ensure translation is distinct from "Letter case" */
|
|
133
134
|
label={ __( 'Font size' ) }
|
|
134
135
|
onDeselect={ () => resetFontSize( props ) }
|
|
135
136
|
isShownByDefault={ defaultControls?.fontSize }
|
|
@@ -205,6 +206,7 @@ export function TypographyPanel( props ) {
|
|
|
205
206
|
<ToolsPanelItem
|
|
206
207
|
className="single-column"
|
|
207
208
|
hasValue={ () => hasTextTransformValue( props ) }
|
|
209
|
+
/* translators: Ensure translation is distinct from "Font size" */
|
|
208
210
|
label={ __( 'Letter case' ) }
|
|
209
211
|
onDeselect={ () => resetTextTransform( props ) }
|
|
210
212
|
isShownByDefault={ defaultControls?.textTransform }
|
package/src/index.js
CHANGED
package/src/layouts/flex.js
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
arrowDown,
|
|
12
12
|
} from '@wordpress/icons';
|
|
13
13
|
import { Button, ToggleControl, Flex, FlexItem } from '@wordpress/components';
|
|
14
|
+
import { getBlockSupport } from '@wordpress/blocks';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Internal dependencies
|
|
@@ -109,14 +110,21 @@ export default {
|
|
|
109
110
|
save: function FlexLayoutStyle( { selector, layout, style, blockName } ) {
|
|
110
111
|
const { orientation = 'horizontal' } = layout;
|
|
111
112
|
const blockGapSupport = useSetting( 'spacing.blockGap' );
|
|
113
|
+
const fallbackValue =
|
|
114
|
+
getBlockSupport( blockName, [
|
|
115
|
+
'spacing',
|
|
116
|
+
'blockGap',
|
|
117
|
+
'__experimentalDefault',
|
|
118
|
+
] ) || '0.5em';
|
|
119
|
+
|
|
112
120
|
const hasBlockGapStylesSupport = blockGapSupport !== null;
|
|
113
121
|
// If a block's block.json skips serialization for spacing or spacing.blockGap,
|
|
114
122
|
// don't apply the user-defined value to the styles.
|
|
115
123
|
const blockGapValue =
|
|
116
124
|
style?.spacing?.blockGap &&
|
|
117
125
|
! shouldSkipSerialization( blockName, 'spacing', 'blockGap' )
|
|
118
|
-
? getGapCSSValue( style?.spacing?.blockGap,
|
|
119
|
-
:
|
|
126
|
+
? getGapCSSValue( style?.spacing?.blockGap, fallbackValue )
|
|
127
|
+
: `var( --wp--style--block-gap, ${ fallbackValue } )`;
|
|
120
128
|
const justifyContent =
|
|
121
129
|
justifyContentMap[ layout.justifyContent ] ||
|
|
122
130
|
justifyContentMap.left;
|
|
@@ -143,7 +151,7 @@ export default {
|
|
|
143
151
|
${ appendSelectors( selector ) } {
|
|
144
152
|
display: flex;
|
|
145
153
|
flex-wrap: ${ flexWrap };
|
|
146
|
-
gap: ${ hasBlockGapStylesSupport ? blockGapValue :
|
|
154
|
+
gap: ${ hasBlockGapStylesSupport ? blockGapValue : fallbackValue };
|
|
147
155
|
${ orientation === 'horizontal' ? rowOrientation : columnOrientation }
|
|
148
156
|
}
|
|
149
157
|
|
package/src/store/actions.js
CHANGED
|
@@ -1603,3 +1603,15 @@ export function setHasControlledInnerBlocks(
|
|
|
1603
1603
|
clientId,
|
|
1604
1604
|
};
|
|
1605
1605
|
}
|
|
1606
|
+
|
|
1607
|
+
/**
|
|
1608
|
+
* Action that sets whether given blocks are visible on the canvas.
|
|
1609
|
+
*
|
|
1610
|
+
* @param {Record<string,boolean>} updates For each block's clientId, its new visibility setting.
|
|
1611
|
+
*/
|
|
1612
|
+
export function setBlockVisibility( updates ) {
|
|
1613
|
+
return {
|
|
1614
|
+
type: 'SET_BLOCK_VISIBILITY',
|
|
1615
|
+
updates,
|
|
1616
|
+
};
|
|
1617
|
+
}
|
package/src/store/defaults.js
CHANGED
|
@@ -160,7 +160,6 @@ export const SETTINGS_DEFAULTS = {
|
|
|
160
160
|
__mobileEnablePageTemplates: false,
|
|
161
161
|
__experimentalBlockPatterns: [],
|
|
162
162
|
__experimentalBlockPatternCategories: [],
|
|
163
|
-
__experimentalSpotlightEntityBlocks: [],
|
|
164
163
|
__unstableGalleryWithImageBlocks: false,
|
|
165
164
|
|
|
166
165
|
generateAnchors: false,
|
package/src/store/reducer.js
CHANGED
|
@@ -606,6 +606,7 @@ const withBlockReset = ( reducer ) => ( state, action ) => {
|
|
|
606
606
|
order: mapBlockOrder( action.blocks ),
|
|
607
607
|
parents: mapBlockParents( action.blocks ),
|
|
608
608
|
controlledInnerBlocks: {},
|
|
609
|
+
visibility: {},
|
|
609
610
|
};
|
|
610
611
|
|
|
611
612
|
const subTree = buildBlockTree( newState, action.blocks );
|
|
@@ -1139,6 +1140,17 @@ export const blocks = flow(
|
|
|
1139
1140
|
}
|
|
1140
1141
|
return state;
|
|
1141
1142
|
},
|
|
1143
|
+
|
|
1144
|
+
visibility( state = {}, action ) {
|
|
1145
|
+
if ( action.type === 'SET_BLOCK_VISIBILITY' ) {
|
|
1146
|
+
return {
|
|
1147
|
+
...state,
|
|
1148
|
+
...action.updates,
|
|
1149
|
+
};
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
return state;
|
|
1153
|
+
},
|
|
1142
1154
|
} );
|
|
1143
1155
|
|
|
1144
1156
|
/**
|
|
@@ -1678,7 +1690,8 @@ export function automaticChangeStatus( state, action ) {
|
|
|
1678
1690
|
|
|
1679
1691
|
return;
|
|
1680
1692
|
// Undoing an automatic change should still be possible after mouse
|
|
1681
|
-
// move.
|
|
1693
|
+
// move or after visibility change.
|
|
1694
|
+
case 'SET_BLOCK_VISIBILITY':
|
|
1682
1695
|
case 'START_TYPING':
|
|
1683
1696
|
case 'STOP_TYPING':
|
|
1684
1697
|
return state;
|
package/src/store/selectors.js
CHANGED
|
@@ -2050,23 +2050,25 @@ export const getInserterItems = createSelector(
|
|
|
2050
2050
|
*
|
|
2051
2051
|
* Items are returned ordered descendingly by their 'frecency'.
|
|
2052
2052
|
*
|
|
2053
|
-
* @param {Object}
|
|
2054
|
-
* @param {
|
|
2053
|
+
* @param {Object} state Editor state.
|
|
2054
|
+
* @param {Object|Object[]} blocks Block object or array objects.
|
|
2055
|
+
* @param {?string} rootClientId Optional root client ID of block list.
|
|
2055
2056
|
*
|
|
2056
2057
|
* @return {WPEditorTransformItem[]} Items that appear in inserter.
|
|
2057
2058
|
*
|
|
2058
2059
|
* @typedef {Object} WPEditorTransformItem
|
|
2059
|
-
* @property {string}
|
|
2060
|
-
* @property {string}
|
|
2061
|
-
* @property {string}
|
|
2062
|
-
* @property {string}
|
|
2063
|
-
* @property {boolean}
|
|
2064
|
-
*
|
|
2065
|
-
* @property {number}
|
|
2060
|
+
* @property {string} id Unique identifier for the item.
|
|
2061
|
+
* @property {string} name The type of block to create.
|
|
2062
|
+
* @property {string} title Title of the item, as it appears in the inserter.
|
|
2063
|
+
* @property {string} icon Dashicon for the item, as it appears in the inserter.
|
|
2064
|
+
* @property {boolean} isDisabled Whether or not the user should be prevented from inserting
|
|
2065
|
+
* this item.
|
|
2066
|
+
* @property {number} frecency Heuristic that combines frequency and recency.
|
|
2066
2067
|
*/
|
|
2067
2068
|
export const getBlockTransformItems = createSelector(
|
|
2068
2069
|
( state, blocks, rootClientId = null ) => {
|
|
2069
|
-
const
|
|
2070
|
+
const normalizedBlocks = castArray( blocks );
|
|
2071
|
+
const [ sourceBlock ] = normalizedBlocks;
|
|
2070
2072
|
const buildBlockTypeTransformItem = buildBlockTypeItem( state, {
|
|
2071
2073
|
buildScope: 'transform',
|
|
2072
2074
|
} );
|
|
@@ -2088,11 +2090,11 @@ export const getBlockTransformItems = createSelector(
|
|
|
2088
2090
|
isDisabled: false,
|
|
2089
2091
|
name: '*',
|
|
2090
2092
|
title: __( 'Unwrap' ),
|
|
2091
|
-
icon: itemsByName[ sourceBlock
|
|
2093
|
+
icon: itemsByName[ sourceBlock?.name ]?.icon,
|
|
2092
2094
|
};
|
|
2093
2095
|
|
|
2094
2096
|
const possibleTransforms = getPossibleBlockTransformations(
|
|
2095
|
-
|
|
2097
|
+
normalizedBlocks
|
|
2096
2098
|
).reduce( ( accumulator, block ) => {
|
|
2097
2099
|
if ( block === '*' ) {
|
|
2098
2100
|
accumulator.push( itemsByName[ '*' ] );
|
|
@@ -2649,3 +2651,31 @@ export function wasBlockJustInserted( state, clientId, source ) {
|
|
|
2649
2651
|
lastBlockInserted.source === source
|
|
2650
2652
|
);
|
|
2651
2653
|
}
|
|
2654
|
+
|
|
2655
|
+
/**
|
|
2656
|
+
* Tells if the block is visible on the canvas or not.
|
|
2657
|
+
*
|
|
2658
|
+
* @param {Object} state Global application state.
|
|
2659
|
+
* @param {Object} clientId Client Id of the block.
|
|
2660
|
+
* @return {boolean} True if the block is visible.
|
|
2661
|
+
*/
|
|
2662
|
+
export function isBlockVisible( state, clientId ) {
|
|
2663
|
+
return state.blocks.visibility?.[ clientId ] ?? true;
|
|
2664
|
+
}
|
|
2665
|
+
|
|
2666
|
+
/**
|
|
2667
|
+
* Returns the list of all hidden blocks.
|
|
2668
|
+
*
|
|
2669
|
+
* @param {Object} state Global application state.
|
|
2670
|
+
* @return {[string]} List of hidden blocks.
|
|
2671
|
+
*/
|
|
2672
|
+
export const __unstableGetVisibleBlocks = createSelector(
|
|
2673
|
+
( state ) => {
|
|
2674
|
+
return new Set(
|
|
2675
|
+
Object.keys( state.blocks.visibility ).filter(
|
|
2676
|
+
( key ) => state.blocks.visibility[ key ]
|
|
2677
|
+
)
|
|
2678
|
+
);
|
|
2679
|
+
},
|
|
2680
|
+
( state ) => [ state.blocks.visibility ]
|
|
2681
|
+
);
|
|
@@ -290,6 +290,7 @@ describe( 'state', () => {
|
|
|
290
290
|
chicken: '',
|
|
291
291
|
},
|
|
292
292
|
controlledInnerBlocks: {},
|
|
293
|
+
visibility: {},
|
|
293
294
|
} );
|
|
294
295
|
expect( state.tree.chicken ).not.toBe(
|
|
295
296
|
existingState.tree.chicken
|
|
@@ -371,6 +372,7 @@ describe( 'state', () => {
|
|
|
371
372
|
chicken: '',
|
|
372
373
|
},
|
|
373
374
|
controlledInnerBlocks: {},
|
|
375
|
+
visibility: {},
|
|
374
376
|
} );
|
|
375
377
|
expect( state.tree.chicken ).not.toBe(
|
|
376
378
|
existingState.tree.chicken
|
|
@@ -519,6 +521,7 @@ describe( 'state', () => {
|
|
|
519
521
|
[ newChildBlockId3 ]: 'chicken',
|
|
520
522
|
},
|
|
521
523
|
controlledInnerBlocks: {},
|
|
524
|
+
visibility: {},
|
|
522
525
|
} );
|
|
523
526
|
|
|
524
527
|
expect( state.tree[ '' ].innerBlocks[ 0 ] ).toBe(
|
|
@@ -627,6 +630,7 @@ describe( 'state', () => {
|
|
|
627
630
|
[ newChildBlockId ]: 'chicken',
|
|
628
631
|
},
|
|
629
632
|
controlledInnerBlocks: {},
|
|
633
|
+
visibility: {},
|
|
630
634
|
} );
|
|
631
635
|
|
|
632
636
|
// The block object of the parent should be updated.
|
|
@@ -648,6 +652,7 @@ describe( 'state', () => {
|
|
|
648
652
|
isIgnoredChange: false,
|
|
649
653
|
tree: {},
|
|
650
654
|
controlledInnerBlocks: {},
|
|
655
|
+
visibility: {},
|
|
651
656
|
} );
|
|
652
657
|
} );
|
|
653
658
|
|
|
@@ -3093,6 +3093,23 @@ describe( 'selectors', () => {
|
|
|
3093
3093
|
] )
|
|
3094
3094
|
);
|
|
3095
3095
|
} );
|
|
3096
|
+
it( 'should support single block object', () => {
|
|
3097
|
+
const state = {
|
|
3098
|
+
blocks: {
|
|
3099
|
+
byClientId: {},
|
|
3100
|
+
attributes: {},
|
|
3101
|
+
order: {},
|
|
3102
|
+
parents: {},
|
|
3103
|
+
cache: {},
|
|
3104
|
+
},
|
|
3105
|
+
settings: {},
|
|
3106
|
+
preferences: {},
|
|
3107
|
+
blockListSettings: {},
|
|
3108
|
+
};
|
|
3109
|
+
const block = { name: 'core/with-tranforms-a' };
|
|
3110
|
+
const items = getBlockTransformItems( state, block );
|
|
3111
|
+
expect( items ).toHaveLength( 2 );
|
|
3112
|
+
} );
|
|
3096
3113
|
it( 'should return only eligible blocks for transformation - `allowedBlocks`', () => {
|
|
3097
3114
|
const state = {
|
|
3098
3115
|
blocks: {
|
package/src/style.scss
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
@import "./autocompleters/style.scss";
|
|
2
2
|
@import "./components/block-alignment-control/style.scss";
|
|
3
|
-
@import "./components/block-alignment-matrix-control/style.scss";
|
|
4
3
|
@import "./components/block-icon/style.scss";
|
|
5
4
|
@import "./components/block-inspector/style.scss";
|
|
6
5
|
@import "./components/block-list/style.scss";
|
|
@@ -26,7 +25,6 @@
|
|
|
26
25
|
@import "./components/block-pattern-setup/style.scss";
|
|
27
26
|
@import "./components/block-variation-transforms/style.scss";
|
|
28
27
|
@import "./components/border-radius-control/style.scss";
|
|
29
|
-
@import "./components/border-style-control/style.scss";
|
|
30
28
|
@import "./components/button-block-appender/style.scss";
|
|
31
29
|
@import "./components/colors-gradients/style.scss";
|
|
32
30
|
@import "./components/contrast-checker/style.scss";
|
|
@@ -44,6 +42,7 @@
|
|
|
44
42
|
@import "./components/media-placeholder/style.scss";
|
|
45
43
|
@import "./components/multi-selection-inspector/style.scss";
|
|
46
44
|
@import "./components/plain-text/style.scss";
|
|
45
|
+
@import "./components/publish-date-time-picker/style.scss";
|
|
47
46
|
@import "./components/responsive-block-control/style.scss";
|
|
48
47
|
@import "./components/rich-text/style.scss";
|
|
49
48
|
@import "./components/skip-to-selected-block/style.scss";
|
|
@@ -59,6 +58,7 @@
|
|
|
59
58
|
@import "./hooks/dimensions.scss";
|
|
60
59
|
@import "./hooks/typography.scss";
|
|
61
60
|
@import "./hooks/color.scss";
|
|
61
|
+
@import "./hooks/padding.scss";
|
|
62
62
|
|
|
63
63
|
@import "./components/block-toolbar/style.scss";
|
|
64
64
|
@import "./components/inserter/style.scss";
|