@wordpress/block-editor 12.21.0 → 12.23.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 +4 -0
- package/README.md +4 -0
- package/build/components/block-actions/index.js +2 -4
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.js +5 -5
- package/build/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.native.js +5 -4
- package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
- package/build/components/block-list/block-crash-boundary.native.js +49 -0
- package/build/components/block-list/block-crash-boundary.native.js.map +1 -0
- package/build/components/block-list/block-crash-warning.native.js +24 -0
- package/build/components/block-list/block-crash-warning.native.js.map +1 -0
- package/build/components/block-list/block.js +11 -3
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +7 -2
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-mover/button.js +4 -1
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +5 -1
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +4 -1
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-settings/container.native.js +2 -1
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +36 -32
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +1 -3
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-switcher/index.js +4 -3
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +8 -5
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/shuffle.js +19 -10
- package/build/components/block-toolbar/shuffle.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +48 -8
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js +14 -2
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/child-layout-control/index.js +108 -11
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/toolbar.js +11 -0
- package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build/components/global-styles/advanced-panel.js +9 -2
- package/build/components/global-styles/advanced-panel.js.map +1 -1
- package/build/components/global-styles/background-panel.js +444 -0
- package/build/components/global-styles/background-panel.js.map +1 -0
- package/build/components/global-styles/color-panel.js +2 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +8 -33
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +3 -0
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build/components/global-styles/hooks.js +1 -1
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +13 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +16 -15
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +2 -3
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +43 -34
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/index.js +3 -6
- package/build/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +5 -0
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
- package/build/components/inserter/library.js +2 -0
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/menu.js +11 -11
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js +1 -1
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build/components/inserter/search-items.js +36 -15
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter/search-results.js +2 -3
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +1 -2
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js +36 -0
- package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
- package/build/components/keyboard-shortcuts/index.js +11 -0
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +18 -12
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +4 -11
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/index.js +17 -2
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-list-view-collapse-items.js +47 -0
- package/build/components/list-view/use-list-view-collapse-items.js.map +1 -0
- package/build/components/list-view/utils.js +5 -3
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/rich-text/index.js +14 -11
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +17 -11
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/native/get-format-colors.native.js +1 -1
- package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +2 -2
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/with-deprecations.js +0 -3
- package/build/components/rich-text/with-deprecations.js.map +1 -1
- package/build/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
- package/build/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +50 -36
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/use-block-display-information/index.js +4 -6
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +4 -0
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/warning/index.native.js +9 -4
- package/build/components/warning/index.native.js.map +1 -1
- package/build/hooks/anchor.js +9 -10
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/background.js +85 -402
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/index.js +9 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout-child.js +28 -6
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/layout.js +21 -10
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +1 -1
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/use-zoom-out.js +47 -0
- package/build/hooks/use-zoom-out.js.map +1 -0
- package/build/index.js +7 -0
- package/build/index.js.map +1 -1
- package/build/private-apis.js +6 -1
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +5 -1
- package/build/private-apis.native.js.map +1 -1
- package/build/store/private-actions.js +13 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-keys.js +2 -1
- package/build/store/private-keys.js.map +1 -1
- package/build/store/private-selectors.js +24 -3
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +53 -26
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +34 -32
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +7 -1
- package/build/store/utils.js.map +1 -1
- package/build/utils/transform-styles/index.js +2 -1
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/components/block-actions/index.js +2 -4
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.js +5 -5
- package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.native.js +5 -4
- package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
- package/build-module/components/block-list/block-crash-boundary.native.js +42 -0
- package/build-module/components/block-list/block-crash-boundary.native.js.map +1 -0
- package/build-module/components/block-list/block-crash-warning.native.js +15 -0
- package/build-module/components/block-list/block-crash-warning.native.js.map +1 -0
- package/build-module/components/block-list/block.js +11 -3
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +7 -2
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-mover/button.js +4 -1
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +5 -1
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +4 -1
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +3 -2
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +37 -33
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +1 -3
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +4 -3
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +8 -5
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/shuffle.js +19 -10
- package/build-module/components/block-toolbar/shuffle.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +50 -10
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js +14 -2
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +109 -12
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js +12 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +9 -2
- package/build-module/components/global-styles/advanced-panel.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +430 -0
- package/build-module/components/global-styles/background-panel.js.map +1 -0
- package/build-module/components/global-styles/color-panel.js +2 -1
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +9 -34
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +3 -0
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +1 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +1 -0
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +17 -16
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +1 -2
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +43 -34
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/index.js +3 -6
- package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +5 -0
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -1
- package/build-module/components/inserter/library.js +2 -0
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/menu.js +11 -11
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build-module/components/inserter/search-items.js +33 -15
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter/search-results.js +2 -3
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +1 -2
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js +28 -0
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/index.js +11 -0
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +19 -13
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +6 -13
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/index.js +17 -2
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-list-view-collapse-items.js +40 -0
- package/build-module/components/list-view/use-list-view-collapse-items.js.map +1 -0
- package/build-module/components/list-view/utils.js +2 -1
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/rich-text/index.js +15 -12
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +16 -11
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/get-format-colors.native.js +1 -1
- package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +2 -2
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/with-deprecations.js +0 -3
- package/build-module/components/rich-text/with-deprecations.js.map +1 -1
- package/build-module/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
- package/build-module/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +50 -36
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +5 -7
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +4 -0
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/warning/index.native.js +9 -4
- package/build-module/components/warning/index.native.js.map +1 -1
- package/build-module/hooks/anchor.js +10 -11
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/background.js +82 -397
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/index.js +3 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout-child.js +28 -6
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/layout.js +21 -10
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +1 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/use-zoom-out.js +41 -0
- package/build-module/hooks/use-zoom-out.js.map +1 -0
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/private-apis.js +7 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +5 -1
- package/build-module/private-apis.native.js.map +1 -1
- package/build-module/store/private-actions.js +12 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-keys.js +1 -0
- package/build-module/store/private-keys.js.map +1 -1
- package/build-module/store/private-selectors.js +22 -4
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +52 -26
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +35 -33
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +6 -1
- package/build-module/store/utils.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +2 -1
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/content-rtl.css +18 -1
- package/build-style/content.css +18 -1
- package/build-style/style-rtl.css +92 -99
- package/build-style/style.css +92 -99
- package/package.json +31 -31
- package/src/components/block-actions/index.js +2 -8
- package/src/components/block-bindings-toolbar-indicator/style.scss +10 -8
- package/src/components/block-heading-level-dropdown/README.md +5 -5
- package/src/components/block-heading-level-dropdown/index.js +5 -5
- package/src/components/block-heading-level-dropdown/index.native.js +5 -4
- package/src/components/block-list/block-crash-boundary.native.js +43 -0
- package/src/components/block-list/block-crash-warning.native.js +19 -0
- package/src/components/block-list/block.js +19 -3
- package/src/components/block-list/block.native.js +14 -7
- package/src/components/block-list/content.scss +16 -0
- package/src/components/block-mover/button.js +4 -1
- package/src/components/block-mover/index.js +8 -1
- package/src/components/block-patterns-list/index.js +22 -17
- package/src/components/block-preview/style.scss +28 -0
- package/src/components/block-settings/container.native.js +5 -1
- package/src/components/block-settings-menu/block-settings-dropdown.js +49 -58
- package/src/components/block-settings-menu-controls/README.md +0 -9
- package/src/components/block-settings-menu-controls/index.js +1 -6
- package/src/components/block-switcher/index.js +5 -3
- package/src/components/block-switcher/style.scss +1 -1
- package/src/components/block-toolbar/index.js +25 -20
- package/src/components/block-toolbar/shuffle.js +20 -14
- package/src/components/block-toolbar/style.scss +1 -1
- package/src/components/block-toolbar/test/index.native.js +1 -7
- package/src/components/block-tools/block-selection-button.js +66 -9
- package/src/components/block-tools/index.js +18 -1
- package/src/components/button-block-appender/content.scss +5 -1
- package/src/components/child-layout-control/index.js +147 -35
- package/src/components/convert-to-group-buttons/toolbar.js +13 -1
- package/src/components/default-block-appender/content.scss +2 -2
- package/src/components/global-styles/advanced-panel.js +8 -2
- package/src/components/global-styles/background-panel.js +591 -0
- package/src/components/global-styles/color-panel.js +2 -1
- package/src/components/global-styles/dimensions-panel.js +9 -34
- package/src/components/global-styles/get-global-styles-changes.js +3 -0
- package/src/components/global-styles/hooks.js +1 -0
- package/src/components/global-styles/index.js +4 -0
- package/src/components/global-styles/style.scss +78 -1
- package/src/{hooks/test/background.js → components/global-styles/test/background-panel.js} +36 -1
- package/src/components/global-styles/test/get-global-styles-changes.js +22 -3
- package/src/components/global-styles/test/use-global-styles-output.js +40 -9
- package/src/components/global-styles/use-global-styles-output.js +30 -17
- package/src/components/global-styles/utils.js +1 -18
- package/src/components/iframe/index.js +79 -53
- package/src/components/inserter/block-patterns-explorer/index.js +2 -9
- package/src/components/inserter/block-patterns-explorer/pattern-list.js +7 -1
- package/src/components/inserter/block-patterns-tab/index.js +1 -0
- package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +5 -0
- package/src/components/inserter/library.js +4 -0
- package/src/components/inserter/menu.js +12 -11
- package/src/components/inserter/mobile-tab-navigation.js +1 -1
- package/src/components/inserter/search-items.js +37 -15
- package/src/components/inserter/search-results.js +1 -2
- package/src/components/inserter/style.scss +6 -12
- package/src/components/inserter/tabs.js +1 -2
- package/src/components/inspector-controls-tabs/advanced-controls-panel.native.js +31 -0
- package/src/components/keyboard-shortcuts/index.js +11 -0
- package/src/components/link-control/style.scss +0 -5
- package/src/components/list-view/block-select-button.js +15 -19
- package/src/components/list-view/block.js +12 -21
- package/src/components/list-view/index.js +18 -1
- package/src/components/list-view/style.scss +38 -28
- package/src/components/list-view/use-list-view-collapse-items.js +33 -0
- package/src/components/list-view/utils.js +4 -1
- package/src/components/rich-text/README.md +6 -0
- package/src/components/rich-text/index.js +30 -13
- package/src/components/rich-text/index.native.js +14 -11
- package/src/components/rich-text/native/get-format-colors.native.js +1 -1
- package/src/components/rich-text/native/index.native.js +2 -2
- package/src/components/rich-text/with-deprecations.js +0 -3
- package/src/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
- package/src/components/url-popover/image-url-input-ui.js +68 -51
- package/src/components/use-block-display-information/index.js +8 -10
- package/src/components/use-moving-animation/index.js +1 -0
- package/src/components/warning/index.native.js +19 -15
- package/src/hooks/anchor.js +43 -61
- package/src/hooks/background.js +100 -516
- package/src/hooks/index.js +3 -0
- package/src/hooks/layout-child.js +44 -8
- package/src/hooks/layout.js +22 -18
- package/src/hooks/position.js +1 -1
- package/src/hooks/test/__snapshots__/anchor.native.js.snap +7 -0
- package/src/hooks/test/anchor.native.js +32 -0
- package/src/hooks/use-zoom-out.js +36 -0
- package/src/index.js +1 -0
- package/src/private-apis.js +13 -1
- package/src/private-apis.native.js +4 -0
- package/src/store/private-actions.js +12 -0
- package/src/store/private-keys.js +1 -0
- package/src/store/private-selectors.js +54 -27
- package/src/store/reducer.js +63 -41
- package/src/store/selectors.js +195 -180
- package/src/store/test/private-actions.js +10 -0
- package/src/store/test/private-selectors.js +13 -0
- package/src/store/test/reducer.js +26 -0
- package/src/store/test/selectors.js +90 -199
- package/src/store/utils.js +13 -0
- package/src/style.scss +0 -2
- package/src/utils/transform-styles/index.js +2 -1
- package/tsconfig.json +1 -0
- package/build/utils/calculate-scale.js +0 -17
- package/build/utils/calculate-scale.js.map +0 -1
- package/build-module/utils/calculate-scale.js +0 -11
- package/build-module/utils/calculate-scale.js.map +0 -1
- package/src/hooks/anchor.scss +0 -4
- package/src/hooks/background.scss +0 -75
- package/src/utils/calculate-scale.js +0 -20
|
@@ -17,7 +17,14 @@ function useBlockPropsChildLayoutStyles( { style } ) {
|
|
|
17
17
|
return ! select( blockEditorStore ).getSettings().disableLayoutStyles;
|
|
18
18
|
} );
|
|
19
19
|
const layout = style?.layout ?? {};
|
|
20
|
-
const {
|
|
20
|
+
const {
|
|
21
|
+
selfStretch,
|
|
22
|
+
flexSize,
|
|
23
|
+
columnStart,
|
|
24
|
+
rowStart,
|
|
25
|
+
columnSpan,
|
|
26
|
+
rowSpan,
|
|
27
|
+
} = layout;
|
|
21
28
|
const parentLayout = useLayout() || {};
|
|
22
29
|
const { columnCount, minimumColumnWidth } = parentLayout;
|
|
23
30
|
const id = useInstanceId( useBlockPropsChildLayoutStyles );
|
|
@@ -34,6 +41,14 @@ function useBlockPropsChildLayoutStyles( { style } ) {
|
|
|
34
41
|
css = `${ selector } {
|
|
35
42
|
flex-grow: 1;
|
|
36
43
|
}`;
|
|
44
|
+
} else if ( columnStart && columnSpan ) {
|
|
45
|
+
css = `${ selector } {
|
|
46
|
+
grid-column: ${ columnStart } / span ${ columnSpan };
|
|
47
|
+
}`;
|
|
48
|
+
} else if ( columnStart ) {
|
|
49
|
+
css = `${ selector } {
|
|
50
|
+
grid-column: ${ columnStart };
|
|
51
|
+
}`;
|
|
37
52
|
} else if ( columnSpan ) {
|
|
38
53
|
css = `${ selector } {
|
|
39
54
|
grid-column: span ${ columnSpan };
|
|
@@ -44,9 +59,20 @@ function useBlockPropsChildLayoutStyles( { style } ) {
|
|
|
44
59
|
* columnCount is set, the grid is responsive so a
|
|
45
60
|
* container query is needed for the span to resize.
|
|
46
61
|
*/
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
|
|
62
|
+
if (
|
|
63
|
+
( columnSpan || columnStart ) &&
|
|
64
|
+
( minimumColumnWidth || ! columnCount )
|
|
65
|
+
) {
|
|
66
|
+
// Check if columnSpan and columnStart are numbers so Math.max doesn't break.
|
|
67
|
+
const columnSpanNumber = columnSpan ? parseInt( columnSpan ) : null;
|
|
68
|
+
const columnStartNumber = columnStart
|
|
69
|
+
? parseInt( columnStart )
|
|
70
|
+
: null;
|
|
71
|
+
const highestNumber = Math.max(
|
|
72
|
+
columnSpanNumber,
|
|
73
|
+
columnStartNumber
|
|
74
|
+
);
|
|
75
|
+
|
|
50
76
|
let parentColumnValue = parseFloat( minimumColumnWidth );
|
|
51
77
|
/**
|
|
52
78
|
* 12rem is the default minimumColumnWidth value.
|
|
@@ -70,16 +96,26 @@ function useBlockPropsChildLayoutStyles( { style } ) {
|
|
|
70
96
|
|
|
71
97
|
const defaultGapValue = parentColumnUnit === 'px' ? 24 : 1.5;
|
|
72
98
|
const containerQueryValue =
|
|
73
|
-
|
|
74
|
-
(
|
|
99
|
+
highestNumber * parentColumnValue +
|
|
100
|
+
( highestNumber - 1 ) * defaultGapValue;
|
|
101
|
+
// If a span is set we want to preserve it as long as possible, otherwise we just reset the value.
|
|
102
|
+
const gridColumnValue = columnSpan ? '1/-1' : 'auto';
|
|
75
103
|
|
|
76
104
|
css += `@container (max-width: ${ containerQueryValue }${ parentColumnUnit }) {
|
|
77
105
|
${ selector } {
|
|
78
|
-
grid-column:
|
|
106
|
+
grid-column: ${ gridColumnValue };
|
|
79
107
|
}
|
|
80
108
|
}`;
|
|
81
109
|
}
|
|
82
|
-
if ( rowSpan ) {
|
|
110
|
+
if ( rowStart && rowSpan ) {
|
|
111
|
+
css += `${ selector } {
|
|
112
|
+
grid-row: ${ rowStart } / span ${ rowSpan };
|
|
113
|
+
}`;
|
|
114
|
+
} else if ( rowStart ) {
|
|
115
|
+
css += `${ selector } {
|
|
116
|
+
grid-row: ${ rowStart };
|
|
117
|
+
}`;
|
|
118
|
+
} else if ( rowSpan ) {
|
|
83
119
|
css += `${ selector } {
|
|
84
120
|
grid-row: span ${ rowSpan };
|
|
85
121
|
}`;
|
package/src/hooks/layout.js
CHANGED
|
@@ -125,14 +125,13 @@ export function useLayoutStyles( blockAttributes = {}, blockName, selector ) {
|
|
|
125
125
|
const fullLayoutType = getLayoutType( usedLayout?.type || 'default' );
|
|
126
126
|
const [ blockGapSupport ] = useSettings( 'spacing.blockGap' );
|
|
127
127
|
const hasBlockGapSupport = blockGapSupport !== null;
|
|
128
|
-
|
|
128
|
+
return fullLayoutType?.getLayoutStyle?.( {
|
|
129
129
|
blockName,
|
|
130
130
|
selector,
|
|
131
131
|
layout,
|
|
132
132
|
style,
|
|
133
133
|
hasBlockGapSupport,
|
|
134
134
|
} );
|
|
135
|
-
return css;
|
|
136
135
|
}
|
|
137
136
|
|
|
138
137
|
function LayoutPanelPure( {
|
|
@@ -144,8 +143,6 @@ function LayoutPanelPure( {
|
|
|
144
143
|
const settings = useBlockSettings( blockName );
|
|
145
144
|
// Block settings come from theme.json under settings.[blockName].
|
|
146
145
|
const { layout: layoutSettings } = settings;
|
|
147
|
-
// Layout comes from block attributes.
|
|
148
|
-
const [ defaultThemeLayout ] = useSettings( 'layout' );
|
|
149
146
|
const { themeSupportsLayout } = useSelect( ( select ) => {
|
|
150
147
|
const { getSettings } = select( blockEditorStore );
|
|
151
148
|
return {
|
|
@@ -179,36 +176,43 @@ function LayoutPanelPure( {
|
|
|
179
176
|
return null;
|
|
180
177
|
}
|
|
181
178
|
|
|
179
|
+
/*
|
|
180
|
+
* Try to find the layout type from either the
|
|
181
|
+
* block's layout settings or any saved layout config.
|
|
182
|
+
*/
|
|
183
|
+
const blockSupportAndLayout = {
|
|
184
|
+
...layoutBlockSupport,
|
|
185
|
+
...layout,
|
|
186
|
+
};
|
|
187
|
+
const { type, default: { type: defaultType = 'default' } = {} } =
|
|
188
|
+
blockSupportAndLayout;
|
|
189
|
+
const blockLayoutType = type || defaultType;
|
|
190
|
+
|
|
182
191
|
// Only show the inherit toggle if it's supported,
|
|
183
|
-
// a default theme layout is set (e.g. one that provides `contentSize` and/or `wideSize` values),
|
|
184
192
|
// and either the default / flow or the constrained layout type is in use, as the toggle switches from one to the other.
|
|
185
193
|
const showInheritToggle = !! (
|
|
186
194
|
allowInheriting &&
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
layout?.inherit )
|
|
195
|
+
( ! blockLayoutType ||
|
|
196
|
+
blockLayoutType === 'default' ||
|
|
197
|
+
blockLayoutType === 'constrained' ||
|
|
198
|
+
blockSupportAndLayout.inherit )
|
|
192
199
|
);
|
|
193
200
|
|
|
194
201
|
const usedLayout = layout || defaultBlockLayout || {};
|
|
195
|
-
const {
|
|
196
|
-
inherit = false,
|
|
197
|
-
type = 'default',
|
|
198
|
-
contentSize = null,
|
|
199
|
-
} = usedLayout;
|
|
202
|
+
const { inherit = false, contentSize = null } = usedLayout;
|
|
200
203
|
/**
|
|
201
204
|
* `themeSupportsLayout` is only relevant to the `default/flow` or
|
|
202
205
|
* `constrained` layouts and it should not be taken into account when other
|
|
203
206
|
* `layout` types are used.
|
|
204
207
|
*/
|
|
205
208
|
if (
|
|
206
|
-
(
|
|
209
|
+
( blockLayoutType === 'default' ||
|
|
210
|
+
blockLayoutType === 'constrained' ) &&
|
|
207
211
|
! themeSupportsLayout
|
|
208
212
|
) {
|
|
209
213
|
return null;
|
|
210
214
|
}
|
|
211
|
-
const layoutType = getLayoutType(
|
|
215
|
+
const layoutType = getLayoutType( blockLayoutType );
|
|
212
216
|
const constrainedType = getLayoutType( 'constrained' );
|
|
213
217
|
const displayControlsForLegacyLayouts =
|
|
214
218
|
! usedLayout.type && ( contentSize || inherit );
|
|
@@ -261,7 +265,7 @@ function LayoutPanelPure( {
|
|
|
261
265
|
|
|
262
266
|
{ ! inherit && allowSwitching && (
|
|
263
267
|
<LayoutTypeSwitcher
|
|
264
|
-
type={
|
|
268
|
+
type={ blockLayoutType }
|
|
265
269
|
onChange={ onChangeType }
|
|
266
270
|
/>
|
|
267
271
|
) }
|
package/src/hooks/position.js
CHANGED
|
@@ -152,7 +152,7 @@ export function hasPositionValue( props ) {
|
|
|
152
152
|
* @return {boolean} Whether or not the block is set to a sticky or fixed position.
|
|
153
153
|
*/
|
|
154
154
|
export function hasStickyOrFixedPositionValue( attributes ) {
|
|
155
|
-
const positionType = attributes
|
|
155
|
+
const positionType = attributes?.style?.position?.type;
|
|
156
156
|
return positionType === 'sticky' || positionType === 'fixed';
|
|
157
157
|
}
|
|
158
158
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
addBlock,
|
|
6
|
+
changeTextOfTextInput,
|
|
7
|
+
getEditorHtml,
|
|
8
|
+
initializeEditor,
|
|
9
|
+
openBlockSettings,
|
|
10
|
+
screen,
|
|
11
|
+
setupCoreBlocks,
|
|
12
|
+
} from 'test/helpers';
|
|
13
|
+
|
|
14
|
+
setupCoreBlocks( [ 'core/paragraph' ] );
|
|
15
|
+
|
|
16
|
+
describe( 'anchor', () => {
|
|
17
|
+
it( 'should set the ID attribute on the block', async () => {
|
|
18
|
+
// Arrange
|
|
19
|
+
await initializeEditor();
|
|
20
|
+
const block = await addBlock( screen, 'Paragraph' );
|
|
21
|
+
await openBlockSettings( screen, block );
|
|
22
|
+
|
|
23
|
+
// Act
|
|
24
|
+
await changeTextOfTextInput(
|
|
25
|
+
await screen.getByPlaceholderText( 'Add an anchor' ),
|
|
26
|
+
'my-anchor'
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
// Assert
|
|
30
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
31
|
+
} );
|
|
32
|
+
} );
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
|
+
import { useEffect } from '@wordpress/element';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { store as blockEditorStore } from '../store';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A hook used to set the editor mode to zoomed out mode, invoking the hook sets the mode.
|
|
14
|
+
*/
|
|
15
|
+
export function useZoomOut() {
|
|
16
|
+
const { __unstableSetEditorMode } = useDispatch( blockEditorStore );
|
|
17
|
+
const { mode } = useSelect( ( select ) => {
|
|
18
|
+
return {
|
|
19
|
+
mode: select( blockEditorStore ).__unstableGetEditorMode(),
|
|
20
|
+
};
|
|
21
|
+
}, [] );
|
|
22
|
+
|
|
23
|
+
// Intentionality left without any dependency.
|
|
24
|
+
// This effect should only run when the component is rendered and unmounted.
|
|
25
|
+
// The effect opens the zoom-out view if it is not open before when applying a style variation.
|
|
26
|
+
useEffect( () => {
|
|
27
|
+
if ( mode !== 'zoom-out' ) {
|
|
28
|
+
__unstableSetEditorMode( 'zoom-out' );
|
|
29
|
+
return () => {
|
|
30
|
+
// Revert to original mode
|
|
31
|
+
__unstableSetEditorMode( mode );
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
+
}, [] );
|
|
36
|
+
}
|
package/src/index.js
CHANGED
package/src/private-apis.js
CHANGED
|
@@ -8,6 +8,11 @@ import { getRichTextValues } from './components/rich-text/get-rich-text-values';
|
|
|
8
8
|
import ResizableBoxPopover from './components/resizable-box-popover';
|
|
9
9
|
import { ComposedPrivateInserter as PrivateInserter } from './components/inserter';
|
|
10
10
|
import { default as PrivateQuickInserter } from './components/inserter/quick-inserter';
|
|
11
|
+
import {
|
|
12
|
+
extractWords,
|
|
13
|
+
getNormalizedSearchTerms,
|
|
14
|
+
normalizeString,
|
|
15
|
+
} from './components/inserter/search-items';
|
|
11
16
|
import { PrivateListView } from './components/list-view';
|
|
12
17
|
import BlockInfo from './components/block-info-slot-fill';
|
|
13
18
|
import { useShowBlockTools } from './components/block-tools/use-show-block-tools';
|
|
@@ -26,7 +31,10 @@ import { usesContextKey } from './components/rich-text/format-edit';
|
|
|
26
31
|
import { ExperimentalBlockCanvas } from './components/block-canvas';
|
|
27
32
|
import { getDuotoneFilter } from './components/duotone/utils';
|
|
28
33
|
import { useFlashEditableBlocks } from './components/use-flash-editable-blocks';
|
|
29
|
-
import {
|
|
34
|
+
import {
|
|
35
|
+
selectBlockPatternsKey,
|
|
36
|
+
reusableBlocksSelectKey,
|
|
37
|
+
} from './store/private-keys';
|
|
30
38
|
import { requiresWrapperOnCopy } from './components/writing-flow/utils';
|
|
31
39
|
import { PrivateRichText } from './components/rich-text/';
|
|
32
40
|
|
|
@@ -42,6 +50,9 @@ lock( privateApis, {
|
|
|
42
50
|
getRichTextValues,
|
|
43
51
|
PrivateInserter,
|
|
44
52
|
PrivateQuickInserter,
|
|
53
|
+
extractWords,
|
|
54
|
+
getNormalizedSearchTerms,
|
|
55
|
+
normalizeString,
|
|
45
56
|
PrivateListView,
|
|
46
57
|
ResizableBoxPopover,
|
|
47
58
|
BlockInfo,
|
|
@@ -62,4 +73,5 @@ lock( privateApis, {
|
|
|
62
73
|
selectBlockPatternsKey,
|
|
63
74
|
requiresWrapperOnCopy,
|
|
64
75
|
PrivateRichText,
|
|
76
|
+
reusableBlocksSelectKey,
|
|
65
77
|
} );
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as globalStyles from './components/global-styles';
|
|
5
5
|
import { ExperimentalBlockEditorProvider } from './components/provider';
|
|
6
|
+
import { getRichTextValues } from './components/rich-text/get-rich-text-values';
|
|
6
7
|
import { lock } from './lock-unlock';
|
|
8
|
+
import { PrivateRichText } from './components/rich-text/';
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* Private @wordpress/block-editor APIs.
|
|
@@ -12,4 +14,6 @@ export const privateApis = {};
|
|
|
12
14
|
lock( privateApis, {
|
|
13
15
|
...globalStyles,
|
|
14
16
|
ExperimentalBlockEditorProvider,
|
|
17
|
+
getRichTextValues,
|
|
18
|
+
PrivateRichText,
|
|
15
19
|
} );
|
|
@@ -376,3 +376,15 @@ export function stopDragging() {
|
|
|
376
376
|
type: 'STOP_DRAGGING',
|
|
377
377
|
};
|
|
378
378
|
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* @param {string|null} clientId The block's clientId, or `null` to clear.
|
|
382
|
+
*
|
|
383
|
+
* @return {Object} Action object.
|
|
384
|
+
*/
|
|
385
|
+
export function expandBlock( clientId ) {
|
|
386
|
+
return {
|
|
387
|
+
type: 'SET_BLOCK_EXPANDED_IN_LIST_VIEW',
|
|
388
|
+
clientId,
|
|
389
|
+
};
|
|
390
|
+
}
|
|
@@ -18,11 +18,18 @@ import {
|
|
|
18
18
|
getSettings,
|
|
19
19
|
canInsertBlockType,
|
|
20
20
|
} from './selectors';
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
checkAllowListRecursive,
|
|
23
|
+
getAllPatternsDependants,
|
|
24
|
+
getInsertBlockTypeDependants,
|
|
25
|
+
} from './utils';
|
|
22
26
|
import { INSERTER_PATTERN_TYPES } from '../components/inserter/block-patterns-tab/utils';
|
|
23
27
|
import { STORE_NAME } from './constants';
|
|
24
28
|
import { unlock } from '../lock-unlock';
|
|
25
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
selectBlockPatternsKey,
|
|
31
|
+
reusableBlocksSelectKey,
|
|
32
|
+
} from './private-keys';
|
|
26
33
|
|
|
27
34
|
export { getBlockSettings } from './get-block-settings';
|
|
28
35
|
|
|
@@ -282,11 +289,8 @@ export const hasAllowedPatterns = createRegistrySelector( ( select ) =>
|
|
|
282
289
|
} );
|
|
283
290
|
},
|
|
284
291
|
( state, rootClientId ) => [
|
|
285
|
-
getAllPatternsDependants( select )( state ),
|
|
286
|
-
state
|
|
287
|
-
state.settings.templateLock,
|
|
288
|
-
state.blockListSettings[ rootClientId ],
|
|
289
|
-
state.blocks.byClientId.get( rootClientId ),
|
|
292
|
+
...getAllPatternsDependants( select )( state ),
|
|
293
|
+
...getInsertBlockTypeDependants( state, rootClientId ),
|
|
290
294
|
]
|
|
291
295
|
)
|
|
292
296
|
);
|
|
@@ -299,26 +303,27 @@ export const getAllPatterns = createRegistrySelector( ( select ) =>
|
|
|
299
303
|
__experimentalUserPatternCategories = [],
|
|
300
304
|
__experimentalReusableBlocks = [],
|
|
301
305
|
} = state.settings;
|
|
302
|
-
const
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
)
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
306
|
+
const reusableBlocksSelect = state.settings[ reusableBlocksSelectKey ];
|
|
307
|
+
const userPatterns = (
|
|
308
|
+
reusableBlocksSelect
|
|
309
|
+
? reusableBlocksSelect( select )
|
|
310
|
+
: __experimentalReusableBlocks ?? []
|
|
311
|
+
).map( ( userPattern ) => {
|
|
312
|
+
return {
|
|
313
|
+
name: `core/block/${ userPattern.id }`,
|
|
314
|
+
id: userPattern.id,
|
|
315
|
+
type: INSERTER_PATTERN_TYPES.user,
|
|
316
|
+
title: userPattern.title.raw,
|
|
317
|
+
categories: userPattern.wp_pattern_category.map( ( catId ) => {
|
|
318
|
+
const category = (
|
|
319
|
+
__experimentalUserPatternCategories ?? []
|
|
320
|
+
).find( ( { id } ) => id === catId );
|
|
321
|
+
return category ? category.slug : catId;
|
|
322
|
+
} ),
|
|
323
|
+
content: userPattern.content.raw,
|
|
324
|
+
syncStatus: userPattern.wp_pattern_sync_status,
|
|
325
|
+
};
|
|
326
|
+
} );
|
|
322
327
|
return [
|
|
323
328
|
...userPatterns,
|
|
324
329
|
...__experimentalBlockPatterns,
|
|
@@ -330,6 +335,17 @@ export const getAllPatterns = createRegistrySelector( ( select ) =>
|
|
|
330
335
|
}, getAllPatternsDependants( select ) )
|
|
331
336
|
);
|
|
332
337
|
|
|
338
|
+
const EMPTY_ARRAY = [];
|
|
339
|
+
|
|
340
|
+
export const getReusableBlocks = createRegistrySelector(
|
|
341
|
+
( select ) => ( state ) => {
|
|
342
|
+
const reusableBlocksSelect = state.settings[ reusableBlocksSelectKey ];
|
|
343
|
+
return reusableBlocksSelect
|
|
344
|
+
? reusableBlocksSelect( select )
|
|
345
|
+
: state.settings.__experimentalReusableBlocks ?? EMPTY_ARRAY;
|
|
346
|
+
}
|
|
347
|
+
);
|
|
348
|
+
|
|
333
349
|
/**
|
|
334
350
|
* Returns the element of the last element that had focus when focus left the editor canvas.
|
|
335
351
|
*
|
|
@@ -353,3 +369,14 @@ export function getLastFocus( state ) {
|
|
|
353
369
|
export function isDragging( state ) {
|
|
354
370
|
return state.isDragging;
|
|
355
371
|
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Retrieves the expanded block from the state.
|
|
375
|
+
*
|
|
376
|
+
* @param {Object} state Block editor state.
|
|
377
|
+
*
|
|
378
|
+
* @return {string|null} The client ID of the expanded block, if set.
|
|
379
|
+
*/
|
|
380
|
+
export function getExpandedBlock( state ) {
|
|
381
|
+
return state.expandedBlock;
|
|
382
|
+
}
|
package/src/store/reducer.js
CHANGED
|
@@ -329,16 +329,13 @@ const withBlockTree =
|
|
|
329
329
|
// If there are no replaced blocks, it means we're removing blocks so we need to update their parent.
|
|
330
330
|
const parentsOfRemovedBlocks = [];
|
|
331
331
|
for ( const clientId of action.clientIds ) {
|
|
332
|
+
const parentId = state.parents.get( clientId );
|
|
332
333
|
if (
|
|
333
|
-
|
|
334
|
-
(
|
|
335
|
-
newState.byClientId.get(
|
|
336
|
-
state.parents.get( clientId )
|
|
337
|
-
) )
|
|
334
|
+
parentId !== undefined &&
|
|
335
|
+
( parentId === '' ||
|
|
336
|
+
newState.byClientId.get( parentId ) )
|
|
338
337
|
) {
|
|
339
|
-
parentsOfRemovedBlocks.push(
|
|
340
|
-
state.parents.get( clientId )
|
|
341
|
-
);
|
|
338
|
+
parentsOfRemovedBlocks.push( parentId );
|
|
342
339
|
}
|
|
343
340
|
}
|
|
344
341
|
updateParentInnerBlocksInTree(
|
|
@@ -351,16 +348,13 @@ const withBlockTree =
|
|
|
351
348
|
case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
|
|
352
349
|
const parentsOfRemovedBlocks = [];
|
|
353
350
|
for ( const clientId of action.clientIds ) {
|
|
351
|
+
const parentId = state.parents.get( clientId );
|
|
354
352
|
if (
|
|
355
|
-
|
|
356
|
-
(
|
|
357
|
-
newState.byClientId.get(
|
|
358
|
-
state.parents.get( clientId )
|
|
359
|
-
) )
|
|
353
|
+
parentId !== undefined &&
|
|
354
|
+
( parentId === '' ||
|
|
355
|
+
newState.byClientId.get( parentId ) )
|
|
360
356
|
) {
|
|
361
|
-
parentsOfRemovedBlocks.push(
|
|
362
|
-
state.parents.get( clientId )
|
|
363
|
-
);
|
|
357
|
+
parentsOfRemovedBlocks.push( parentId );
|
|
364
358
|
}
|
|
365
359
|
}
|
|
366
360
|
newState.tree = new Map( newState.tree );
|
|
@@ -1703,36 +1697,42 @@ export function settings( state = SETTINGS_DEFAULTS, action ) {
|
|
|
1703
1697
|
export function preferences( state = PREFERENCES_DEFAULTS, action ) {
|
|
1704
1698
|
switch ( action.type ) {
|
|
1705
1699
|
case 'INSERT_BLOCKS':
|
|
1706
|
-
case 'REPLACE_BLOCKS':
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1700
|
+
case 'REPLACE_BLOCKS': {
|
|
1701
|
+
const nextInsertUsage = action.blocks.reduce(
|
|
1702
|
+
( prevUsage, block ) => {
|
|
1703
|
+
const { attributes, name: blockName } = block;
|
|
1704
|
+
let id = blockName;
|
|
1705
|
+
// If a block variation match is found change the name to be the same with the
|
|
1706
|
+
// one that is used for block variations in the Inserter (`getItemFromVariation`).
|
|
1707
|
+
const match = select( blocksStore ).getActiveBlockVariation(
|
|
1708
|
+
blockName,
|
|
1709
|
+
attributes
|
|
1710
|
+
);
|
|
1711
|
+
if ( match?.name ) {
|
|
1712
|
+
id += '/' + match.name;
|
|
1713
|
+
}
|
|
1714
|
+
if ( blockName === 'core/block' ) {
|
|
1715
|
+
id += '/' + attributes.ref;
|
|
1716
|
+
}
|
|
1722
1717
|
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
insertUsage: {
|
|
1726
|
-
...prevState.insertUsage,
|
|
1718
|
+
return {
|
|
1719
|
+
...prevUsage,
|
|
1727
1720
|
[ id ]: {
|
|
1728
1721
|
time: action.time,
|
|
1729
|
-
count:
|
|
1730
|
-
?
|
|
1722
|
+
count: prevUsage[ id ]
|
|
1723
|
+
? prevUsage[ id ].count + 1
|
|
1731
1724
|
: 1,
|
|
1732
1725
|
},
|
|
1733
|
-
}
|
|
1734
|
-
}
|
|
1735
|
-
|
|
1726
|
+
};
|
|
1727
|
+
},
|
|
1728
|
+
state.insertUsage
|
|
1729
|
+
);
|
|
1730
|
+
|
|
1731
|
+
return {
|
|
1732
|
+
...state,
|
|
1733
|
+
insertUsage: nextInsertUsage,
|
|
1734
|
+
};
|
|
1735
|
+
}
|
|
1736
1736
|
}
|
|
1737
1737
|
|
|
1738
1738
|
return state;
|
|
@@ -1889,6 +1889,27 @@ export function highlightedBlock( state, action ) {
|
|
|
1889
1889
|
return state;
|
|
1890
1890
|
}
|
|
1891
1891
|
|
|
1892
|
+
/**
|
|
1893
|
+
* Reducer returning current expanded block in the list view.
|
|
1894
|
+
*
|
|
1895
|
+
* @param {string|null} state Current expanded block.
|
|
1896
|
+
* @param {Object} action Dispatched action.
|
|
1897
|
+
*
|
|
1898
|
+
* @return {string|null} Updated state.
|
|
1899
|
+
*/
|
|
1900
|
+
export function expandedBlock( state = null, action ) {
|
|
1901
|
+
switch ( action.type ) {
|
|
1902
|
+
case 'SET_BLOCK_EXPANDED_IN_LIST_VIEW':
|
|
1903
|
+
return action.clientId;
|
|
1904
|
+
case 'SELECT_BLOCK':
|
|
1905
|
+
if ( action.clientId !== state ) {
|
|
1906
|
+
return null;
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
return state;
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1892
1913
|
/**
|
|
1893
1914
|
* Reducer returning the block insertion event list state.
|
|
1894
1915
|
*
|
|
@@ -2064,6 +2085,7 @@ const combinedReducers = combineReducers( {
|
|
|
2064
2085
|
lastFocus,
|
|
2065
2086
|
editorMode,
|
|
2066
2087
|
hasBlockMovingClientId,
|
|
2088
|
+
expandedBlock,
|
|
2067
2089
|
highlightedBlock,
|
|
2068
2090
|
lastBlockInserted,
|
|
2069
2091
|
temporarilyEditingAsBlocks,
|