@wordpress/block-editor 14.3.4 → 14.4.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 +2 -0
- package/README.md +4 -0
- package/build/autocompleters/link.js +2 -1
- package/build/autocompleters/link.js.map +1 -1
- package/build/components/block-actions/index.js +1 -13
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-inspector/index.js +56 -75
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block.js +5 -19
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/index.js +5 -8
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +3 -11
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +9 -12
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +5 -3
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list/zoom-out-separator.js +14 -6
- package/build/components/block-list/zoom-out-separator.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +2 -4
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-parent-selector/index.js +13 -10
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +10 -20
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-patterns-paging/index.js +11 -13
- package/build/components/block-patterns-paging/index.js.map +1 -1
- package/build/components/block-quick-navigation/index.js +2 -4
- package/build/components/block-quick-navigation/index.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +79 -76
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +1 -6
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-switcher/index.js +17 -14
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +16 -19
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/use-has-block-toolbar.js +3 -5
- package/build/components/block-toolbar/use-has-block-toolbar.js.map +1 -1
- package/build/components/block-tools/index.js +8 -11
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +1 -4
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +2 -5
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserter-button.js +1 -12
- package/build/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +14 -17
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-toolbar.js +2 -12
- package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build/components/block-variation-picker/index.js +2 -4
- package/build/components/block-variation-picker/index.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +3 -4
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/button-block-appender/index.js +2 -4
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +2 -4
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/global-styles/border-panel.js +1 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +2 -4
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +3 -3
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +2 -4
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/shadow-panel-components.js +24 -29
- package/build/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build/components/inner-blocks/index.js +1 -9
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/block-types-tab.js +1 -1
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +24 -5
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js +22 -12
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +23 -10
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +35 -13
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/menu.js +2 -2
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js +5 -5
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +4 -4
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inspector-controls-tabs/index.js +11 -8
- package/build/components/inspector-controls-tabs/index.js.map +1 -1
- package/build/components/inspector-popover-header/index.js +4 -8
- package/build/components/inspector-popover-header/index.js.map +1 -1
- package/build/components/link-control/index.js +5 -10
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/settings-drawer.js +2 -4
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/list-view/block-contents.js +1 -25
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block-select-button.js +1 -4
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/media-placeholder/index.js +12 -24
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js +2 -4
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/tool-selector/index.js +13 -12
- package/build/components/tool-selector/index.js.map +1 -1
- package/build/components/url-input/button.js +14 -16
- package/build/components/url-input/button.js.map +1 -1
- package/build/components/url-input/index.js +2 -4
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-commands/index.js +0 -61
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +2 -25
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/duotone.js +4 -1
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/layout-child.js +3 -1
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/position.js +3 -2
- package/build/hooks/position.js.map +1 -1
- package/build/layouts/flex.js +6 -38
- package/build/layouts/flex.js.map +1 -1
- package/build/store/actions.js +13 -14
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +15 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +104 -7
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +22 -26
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +127 -56
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +4 -3
- package/build/store/utils.js.map +1 -1
- package/build/utils/block-bindings.js +2 -0
- package/build/utils/block-bindings.js.map +1 -1
- package/build-module/autocompleters/link.js +2 -1
- package/build-module/autocompleters/link.js.map +1 -1
- package/build-module/components/block-actions/index.js +1 -13
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +57 -76
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block.js +5 -19
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/index.js +5 -8
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +3 -11
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +9 -12
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +5 -3
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list/zoom-out-separator.js +14 -6
- package/build-module/components/block-list/zoom-out-separator.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +2 -4
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +13 -10
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +10 -20
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-patterns-paging/index.js +11 -13
- package/build-module/components/block-patterns-paging/index.js.map +1 -1
- package/build-module/components/block-quick-navigation/index.js +2 -4
- package/build-module/components/block-quick-navigation/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +79 -76
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +2 -7
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +17 -14
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +17 -20
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/use-has-block-toolbar.js +3 -5
- package/build-module/components/block-toolbar/use-has-block-toolbar.js.map +1 -1
- package/build-module/components/block-tools/index.js +8 -11
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +1 -4
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +2 -5
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserter-button.js +1 -12
- package/build-module/components/block-tools/zoom-out-mode-inserter-button.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +14 -17
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js +2 -12
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build-module/components/block-variation-picker/index.js +2 -4
- package/build-module/components/block-variation-picker/index.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +3 -4
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/button-block-appender/index.js +2 -4
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +2 -4
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +1 -1
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +2 -4
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +1 -1
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +2 -4
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel-components.js +25 -30
- package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +1 -9
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.js +1 -1
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js +27 -8
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js +22 -12
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +23 -10
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +35 -13
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/menu.js +2 -2
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +6 -6
- package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +4 -4
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +12 -9
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/inspector-popover-header/index.js +4 -8
- package/build-module/components/inspector-popover-header/index.js.map +1 -1
- package/build-module/components/link-control/index.js +5 -10
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +2 -4
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +1 -25
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +2 -5
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +12 -24
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js +2 -4
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/tool-selector/index.js +13 -12
- package/build-module/components/tool-selector/index.js.map +1 -1
- package/build-module/components/url-input/button.js +15 -17
- package/build-module/components/url-input/button.js.map +1 -1
- package/build-module/components/url-input/index.js +2 -4
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +1 -62
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +3 -26
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/duotone.js +4 -1
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/layout-child.js +4 -1
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/position.js +4 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/layouts/flex.js +7 -39
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/store/actions.js +12 -12
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +14 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +98 -7
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +21 -25
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +129 -58
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +3 -2
- package/build-module/store/utils.js.map +1 -1
- package/build-module/utils/block-bindings.js +2 -0
- package/build-module/utils/block-bindings.js.map +1 -1
- package/build-style/content-rtl.css +14 -56
- package/build-style/content.css +14 -56
- package/build-style/default-editor-styles-rtl.css +10 -1
- package/build-style/default-editor-styles.css +10 -1
- package/build-style/style-rtl.css +51 -149
- package/build-style/style.css +51 -149
- package/package.json +32 -32
- package/src/autocompleters/link.js +2 -1
- package/src/components/block-actions/index.js +1 -13
- package/src/components/block-draggable/style.scss +2 -2
- package/src/components/block-inspector/index.js +79 -95
- package/src/components/block-inspector/style.scss +2 -0
- package/src/components/block-list/block.js +7 -28
- package/src/components/block-list/content.scss +1 -61
- package/src/components/block-list/index.js +21 -29
- package/src/components/block-list/use-block-props/index.js +3 -10
- package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +19 -11
- package/src/components/block-list/use-in-between-inserter.js +5 -2
- package/src/components/block-list/zoom-out-separator.js +24 -8
- package/src/components/block-navigation/dropdown.js +1 -2
- package/src/components/block-parent-selector/index.js +13 -10
- package/src/components/block-pattern-setup/setup-toolbar.js +5 -10
- package/src/components/block-patterns-paging/index.js +8 -7
- package/src/components/block-patterns-paging/style.scss +10 -27
- package/src/components/block-quick-navigation/index.js +1 -2
- package/src/components/block-settings-menu/block-settings-dropdown.js +120 -106
- package/src/components/block-settings-menu-controls/index.js +0 -15
- package/src/components/block-switcher/index.js +37 -30
- package/src/components/block-toolbar/index.js +22 -34
- package/src/components/block-toolbar/style.scss +10 -1
- package/src/components/block-toolbar/use-has-block-toolbar.js +19 -31
- package/src/components/block-tools/index.js +7 -16
- package/src/components/block-tools/insertion-point.js +1 -4
- package/src/components/block-tools/style.scss +3 -88
- package/src/components/block-tools/use-show-block-tools.js +2 -12
- package/src/components/block-tools/zoom-out-mode-inserter-button.js +2 -17
- package/src/components/block-tools/zoom-out-mode-inserters.js +11 -19
- package/src/components/block-tools/zoom-out-toolbar.js +2 -13
- package/src/components/block-variation-picker/index.js +1 -2
- package/src/components/block-variation-transforms/index.js +2 -2
- package/src/components/button-block-appender/content.scss +0 -5
- package/src/components/button-block-appender/index.js +1 -2
- package/src/components/colors-gradients/dropdown.js +1 -5
- package/src/components/font-family/README.md +5 -1
- package/src/components/global-styles/border-panel.js +1 -1
- package/src/components/global-styles/color-panel.js +1 -5
- package/src/components/global-styles/dimensions-panel.js +1 -1
- package/src/components/global-styles/filters-panel.js +1 -2
- package/src/components/global-styles/shadow-panel-components.js +28 -33
- package/src/components/global-styles/style.scss +5 -0
- package/src/components/inner-blocks/index.js +1 -16
- package/src/components/inserter/block-types-tab.js +1 -1
- package/src/components/inserter/hooks/use-block-types-state.js +34 -14
- package/src/components/inserter/hooks/use-insertion-point.js +35 -13
- package/src/components/inserter/hooks/use-patterns-state.js +46 -9
- package/src/components/inserter/media-tab/media-preview.js +38 -12
- package/src/components/inserter/menu.js +2 -2
- package/src/components/inserter/mobile-tab-navigation.js +10 -13
- package/src/components/inserter/quick-inserter.js +5 -4
- package/src/components/inserter/style.scss +0 -28
- package/src/components/inspector-controls-tabs/index.js +21 -20
- package/src/components/inspector-controls-tabs/style.scss +2 -6
- package/src/components/inspector-popover-header/index.js +2 -4
- package/src/components/inspector-popover-header/style.scss +0 -13
- package/src/components/link-control/index.js +2 -5
- package/src/components/link-control/settings-drawer.js +1 -2
- package/src/components/list-view/block-contents.js +1 -28
- package/src/components/list-view/block-select-button.js +2 -5
- package/src/components/list-view/style.scss +18 -14
- package/src/components/media-placeholder/index.js +6 -12
- package/src/components/skip-to-selected-block/index.js +1 -2
- package/src/components/skip-to-selected-block/style.scss +0 -9
- package/src/components/tool-selector/index.js +14 -9
- package/src/components/tool-selector/style.scss +5 -0
- package/src/components/url-input/button.js +16 -12
- package/src/components/url-input/index.js +1 -2
- package/src/components/url-input/style.scss +0 -6
- package/src/components/use-block-commands/index.js +0 -58
- package/src/components/writing-flow/use-tab-nav.js +4 -36
- package/src/content.scss +0 -1
- package/src/hooks/duotone.js +4 -1
- package/src/hooks/layout-child.js +4 -1
- package/src/hooks/position.js +4 -1
- package/src/layouts/flex.js +10 -53
- package/src/store/actions.js +14 -13
- package/src/store/private-actions.js +14 -0
- package/src/store/private-selectors.js +120 -16
- package/src/store/reducer.js +22 -28
- package/src/store/selectors.js +203 -114
- package/src/store/test/private-actions.js +15 -0
- package/src/store/test/private-selectors.js +34 -0
- package/src/store/test/reducer.js +40 -4
- package/src/store/test/selectors.js +183 -20
- package/src/store/utils.js +4 -2
- package/src/utils/block-bindings.js +2 -0
- package/build/components/block-controls/use-has-block-controls.js +0 -43
- package/build/components/block-controls/use-has-block-controls.js.map +0 -1
- package/build/components/block-list/use-block-props/use-nav-mode-exit.js +0 -54
- package/build/components/block-list/use-block-props/use-nav-mode-exit.js.map +0 -1
- package/build/components/block-tools/block-selection-button.js +0 -259
- package/build/components/block-tools/block-selection-button.js.map +0 -1
- package/build/components/block-tools/block-toolbar-breadcrumb.js +0 -57
- package/build/components/block-tools/block-toolbar-breadcrumb.js.map +0 -1
- package/build/components/inserter/tabs.js +0 -78
- package/build/components/inserter/tabs.js.map +0 -1
- package/build-module/components/block-controls/use-has-block-controls.js +0 -34
- package/build-module/components/block-controls/use-has-block-controls.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-nav-mode-exit.js +0 -48
- package/build-module/components/block-list/use-block-props/use-nav-mode-exit.js.map +0 -1
- package/build-module/components/block-tools/block-selection-button.js +0 -254
- package/build-module/components/block-tools/block-selection-button.js.map +0 -1
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js +0 -49
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +0 -1
- package/build-module/components/inserter/tabs.js +0 -72
- package/build-module/components/inserter/tabs.js.map +0 -1
- package/src/components/block-controls/use-has-block-controls.js +0 -35
- package/src/components/block-list/use-block-props/use-nav-mode-exit.js +0 -46
- package/src/components/block-tools/block-selection-button.js +0 -302
- package/src/components/block-tools/block-toolbar-breadcrumb.js +0 -51
- package/src/components/inner-blocks/content.scss +0 -13
- package/src/components/inserter/tabs.js +0 -78
- package/src/components/inserter/test/block-types-tab.native.js +0 -67
|
@@ -12,27 +12,24 @@ import { unlock } from '../../../lock-unlock';
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Allows Zoom Out mode to be exited by double clicking in the selected block.
|
|
15
|
-
*
|
|
16
|
-
* @param {string} clientId Block client ID.
|
|
17
15
|
*/
|
|
18
|
-
export function useZoomOutModeExit({
|
|
19
|
-
editorMode
|
|
20
|
-
}) {
|
|
16
|
+
export function useZoomOutModeExit() {
|
|
21
17
|
const {
|
|
22
18
|
getSettings,
|
|
23
|
-
isZoomOut
|
|
19
|
+
isZoomOut,
|
|
20
|
+
__unstableGetEditorMode
|
|
24
21
|
} = unlock(useSelect(blockEditorStore));
|
|
25
22
|
const {
|
|
26
23
|
__unstableSetEditorMode,
|
|
27
24
|
resetZoomLevel
|
|
28
25
|
} = unlock(useDispatch(blockEditorStore));
|
|
29
26
|
return useRefEffect(node => {
|
|
30
|
-
// In "compose" mode.
|
|
31
|
-
const composeMode = editorMode === 'zoom-out' && isZoomOut();
|
|
32
|
-
if (!composeMode) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
27
|
function onDoubleClick(event) {
|
|
28
|
+
// In "compose" mode.
|
|
29
|
+
const composeMode = __unstableGetEditorMode() === 'zoom-out' && isZoomOut();
|
|
30
|
+
if (!composeMode) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
36
33
|
if (!event.defaultPrevented) {
|
|
37
34
|
event.preventDefault();
|
|
38
35
|
const {
|
|
@@ -49,6 +46,6 @@ export function useZoomOutModeExit({
|
|
|
49
46
|
return () => {
|
|
50
47
|
node.removeEventListener('dblclick', onDoubleClick);
|
|
51
48
|
};
|
|
52
|
-
}, [
|
|
49
|
+
}, [getSettings, __unstableSetEditorMode, __unstableGetEditorMode, isZoomOut, resetZoomLevel]);
|
|
53
50
|
}
|
|
54
51
|
//# sourceMappingURL=use-zoom-out-mode-exit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useDispatch","useRefEffect","store","blockEditorStore","unlock","useZoomOutModeExit","
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","useRefEffect","store","blockEditorStore","unlock","useZoomOutModeExit","getSettings","isZoomOut","__unstableGetEditorMode","__unstableSetEditorMode","resetZoomLevel","node","onDoubleClick","event","composeMode","defaultPrevented","preventDefault","__experimentalSetIsInserterOpened","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\n/**\n * Allows Zoom Out mode to be exited by double clicking in the selected block.\n */\nexport function useZoomOutModeExit() {\n\tconst { getSettings, isZoomOut, __unstableGetEditorMode } = unlock(\n\t\tuseSelect( blockEditorStore )\n\t);\n\n\tconst { __unstableSetEditorMode, resetZoomLevel } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tfunction onDoubleClick( event ) {\n\t\t\t\t// In \"compose\" mode.\n\t\t\t\tconst composeMode =\n\t\t\t\t\t__unstableGetEditorMode() === 'zoom-out' && isZoomOut();\n\n\t\t\t\tif ( ! composeMode ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( ! event.defaultPrevented ) {\n\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\tconst { __experimentalSetIsInserterOpened } = getSettings();\n\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof __experimentalSetIsInserterOpened === 'function'\n\t\t\t\t\t) {\n\t\t\t\t\t\t__experimentalSetIsInserterOpened( false );\n\t\t\t\t\t}\n\t\t\t\t\t__unstableSetEditorMode( 'edit' );\n\t\t\t\t\tresetZoomLevel();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'dblclick', onDoubleClick );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'dblclick', onDoubleClick );\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tgetSettings,\n\t\t\t__unstableSetEditorMode,\n\t\t\t__unstableGetEditorMode,\n\t\t\tisZoomOut,\n\t\t\tresetZoomLevel,\n\t\t]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,oBAAoB;;AAEjD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,gBAAgB;AAC1D,SAASC,MAAM,QAAQ,sBAAsB;;AAE7C;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAAA,EAAG;EACpC,MAAM;IAAEC,WAAW;IAAEC,SAAS;IAAEC;EAAwB,CAAC,GAAGJ,MAAM,CACjEL,SAAS,CAAEI,gBAAiB,CAC7B,CAAC;EAED,MAAM;IAAEM,uBAAuB;IAAEC;EAAe,CAAC,GAAGN,MAAM,CACzDJ,WAAW,CAAEG,gBAAiB,CAC/B,CAAC;EAED,OAAOF,YAAY,CAChBU,IAAI,IAAM;IACX,SAASC,aAAaA,CAAEC,KAAK,EAAG;MAC/B;MACA,MAAMC,WAAW,GAChBN,uBAAuB,CAAC,CAAC,KAAK,UAAU,IAAID,SAAS,CAAC,CAAC;MAExD,IAAK,CAAEO,WAAW,EAAG;QACpB;MACD;MAEA,IAAK,CAAED,KAAK,CAACE,gBAAgB,EAAG;QAC/BF,KAAK,CAACG,cAAc,CAAC,CAAC;QAEtB,MAAM;UAAEC;QAAkC,CAAC,GAAGX,WAAW,CAAC,CAAC;QAE3D,IACC,OAAOW,iCAAiC,KAAK,UAAU,EACtD;UACDA,iCAAiC,CAAE,KAAM,CAAC;QAC3C;QACAR,uBAAuB,CAAE,MAAO,CAAC;QACjCC,cAAc,CAAC,CAAC;MACjB;IACD;IAEAC,IAAI,CAACO,gBAAgB,CAAE,UAAU,EAAEN,aAAc,CAAC;IAElD,OAAO,MAAM;MACZD,IAAI,CAACQ,mBAAmB,CAAE,UAAU,EAAEP,aAAc,CAAC;IACtD,CAAC;EACF,CAAC,EACD,CACCN,WAAW,EACXG,uBAAuB,EACvBD,uBAAuB,EACvBD,SAAS,EACTG,cAAc,CAEhB,CAAC;AACF","ignoreList":[]}
|
|
@@ -11,6 +11,7 @@ import { isRTL } from '@wordpress/i18n';
|
|
|
11
11
|
*/
|
|
12
12
|
import { store as blockEditorStore } from '../../store';
|
|
13
13
|
import { InsertionPointOpenRef } from '../block-tools/insertion-point';
|
|
14
|
+
import { unlock } from '../../lock-unlock';
|
|
14
15
|
export function useInBetweenInserter() {
|
|
15
16
|
const openRef = useContext(InsertionPointOpenRef);
|
|
16
17
|
const isInBetweenInserterDisabled = useSelect(select => select(blockEditorStore).getSettings().isDistractionFree || select(blockEditorStore).__unstableGetEditorMode() === 'zoom-out', []);
|
|
@@ -24,8 +25,9 @@ export function useInBetweenInserter() {
|
|
|
24
25
|
__unstableIsWithinBlockOverlay,
|
|
25
26
|
getBlockEditingMode,
|
|
26
27
|
getBlockName,
|
|
27
|
-
getBlockAttributes
|
|
28
|
-
|
|
28
|
+
getBlockAttributes,
|
|
29
|
+
getParentSectionBlock
|
|
30
|
+
} = unlock(useSelect(blockEditorStore));
|
|
29
31
|
const {
|
|
30
32
|
showInsertionPoint,
|
|
31
33
|
hideInsertionPoint
|
|
@@ -88,7 +90,7 @@ export function useInBetweenInserter() {
|
|
|
88
90
|
// Don't show the insertion point if a parent block has an "overlay"
|
|
89
91
|
// See https://github.com/WordPress/gutenberg/pull/34012#pullrequestreview-727762337
|
|
90
92
|
const clientId = element.id.slice('block-'.length);
|
|
91
|
-
if (!clientId || __unstableIsWithinBlockOverlay(clientId)) {
|
|
93
|
+
if (!clientId || __unstableIsWithinBlockOverlay(clientId) || !!getParentSectionBlock(clientId)) {
|
|
92
94
|
return;
|
|
93
95
|
}
|
|
94
96
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRefEffect","useSelect","useDispatch","useContext","isRTL","store","blockEditorStore","InsertionPointOpenRef","useInBetweenInserter","openRef","isInBetweenInserterDisabled","select","getSettings","isDistractionFree","__unstableGetEditorMode","getBlockListSettings","getBlockIndex","isMultiSelecting","getSelectedBlockClientIds","getTemplateLock","__unstableIsWithinBlockOverlay","getBlockEditingMode","getBlockName","getBlockAttributes","showInsertionPoint","hideInsertionPoint","node","onMouseMove","event","undefined","current","target","nodeType","TEXT_NODE","classList","contains","rootClientId","blockElement","getAttribute","closest","layout","isManualPlacement","blockListSettings","orientation","captureToolbars","__experimentalCaptureToolbars","offsetTop","clientY","offsetLeft","clientX","children","Array","from","element","find","blockEl","blockElRect","getBoundingClientRect","top","right","left","id","firstElementChild","clientId","slice","length","includes","hasFixedToolbar","elementRect","bottom","index","__unstableWithInserter","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/block-list/use-in-between-inserter.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useContext } from '@wordpress/element';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { InsertionPointOpenRef } from '../block-tools/insertion-point';\n\nexport function useInBetweenInserter() {\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst isInBetweenInserterDisabled = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().isDistractionFree ||\n\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() === 'zoom-out',\n\t\t[]\n\t);\n\tconst {\n\t\tgetBlockListSettings,\n\t\tgetBlockIndex,\n\t\tisMultiSelecting,\n\t\tgetSelectedBlockClientIds,\n\t\tgetSettings,\n\t\tgetTemplateLock,\n\t\t__unstableIsWithinBlockOverlay,\n\t\tgetBlockEditingMode,\n\t\tgetBlockName,\n\t\tgetBlockAttributes,\n\t} = useSelect( blockEditorStore );\n\tconst { showInsertionPoint, hideInsertionPoint } =\n\t\tuseDispatch( blockEditorStore );\n\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tif ( isInBetweenInserterDisabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfunction onMouseMove( event ) {\n\t\t\t\t// openRef is the reference to the insertion point between blocks.\n\t\t\t\t// If the reference is not set or the insertion point is already open, return.\n\t\t\t\tif ( openRef === undefined || openRef.current ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Ignore text nodes sometimes detected in FireFox.\n\t\t\t\tif ( event.target.nodeType === event.target.TEXT_NODE ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( isMultiSelecting() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t! event.target.classList.contains(\n\t\t\t\t\t\t'block-editor-block-list__layout'\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet rootClientId;\n\t\t\t\tif (\n\t\t\t\t\t! event.target.classList.contains( 'is-root-container' )\n\t\t\t\t) {\n\t\t\t\t\tconst blockElement = !! event.target.getAttribute(\n\t\t\t\t\t\t'data-block'\n\t\t\t\t\t)\n\t\t\t\t\t\t? event.target\n\t\t\t\t\t\t: event.target.closest( '[data-block]' );\n\t\t\t\t\trootClientId = blockElement.getAttribute( 'data-block' );\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tgetTemplateLock( rootClientId ) ||\n\t\t\t\t\tgetBlockEditingMode( rootClientId ) === 'disabled' ||\n\t\t\t\t\tgetBlockName( rootClientId ) === 'core/block' ||\n\t\t\t\t\t( rootClientId &&\n\t\t\t\t\t\tgetBlockAttributes( rootClientId ).layout\n\t\t\t\t\t\t\t?.isManualPlacement )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst blockListSettings = getBlockListSettings( rootClientId );\n\t\t\t\tconst orientation =\n\t\t\t\t\tblockListSettings?.orientation || 'vertical';\n\t\t\t\tconst captureToolbars =\n\t\t\t\t\t!! blockListSettings?.__experimentalCaptureToolbars;\n\t\t\t\tconst offsetTop = event.clientY;\n\t\t\t\tconst offsetLeft = event.clientX;\n\n\t\t\t\tconst children = Array.from( event.target.children );\n\t\t\t\tlet element = children.find( ( blockEl ) => {\n\t\t\t\t\tconst blockElRect = blockEl.getBoundingClientRect();\n\t\t\t\t\treturn (\n\t\t\t\t\t\t( blockEl.classList.contains( 'wp-block' ) &&\n\t\t\t\t\t\t\torientation === 'vertical' &&\n\t\t\t\t\t\t\tblockElRect.top > offsetTop ) ||\n\t\t\t\t\t\t( blockEl.classList.contains( 'wp-block' ) &&\n\t\t\t\t\t\t\torientation === 'horizontal' &&\n\t\t\t\t\t\t\t( isRTL()\n\t\t\t\t\t\t\t\t? blockElRect.right < offsetLeft\n\t\t\t\t\t\t\t\t: blockElRect.left > offsetLeft ) )\n\t\t\t\t\t);\n\t\t\t\t} );\n\n\t\t\t\tif ( ! element ) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// The block may be in an alignment wrapper, so check the first direct\n\t\t\t\t// child if the element has no ID.\n\t\t\t\tif ( ! element.id ) {\n\t\t\t\t\telement = element.firstElementChild;\n\n\t\t\t\t\tif ( ! element ) {\n\t\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Don't show the insertion point if a parent block has an \"overlay\"\n\t\t\t\t// See https://github.com/WordPress/gutenberg/pull/34012#pullrequestreview-727762337\n\t\t\t\tconst clientId = element.id.slice( 'block-'.length );\n\t\t\t\tif (\n\t\t\t\t\t! clientId ||\n\t\t\t\t\t__unstableIsWithinBlockOverlay( clientId )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Don't show the inserter if the following conditions are met,\n\t\t\t\t// as it conflicts with the block toolbar:\n\t\t\t\t// 1. when hovering above or inside selected block(s)\n\t\t\t\t// 2. when the orientation is vertical\n\t\t\t\t// 3. when the __experimentalCaptureToolbars is not enabled\n\t\t\t\t// 4. when the Top Toolbar is not disabled\n\t\t\t\tif (\n\t\t\t\t\tgetSelectedBlockClientIds().includes( clientId ) &&\n\t\t\t\t\torientation === 'vertical' &&\n\t\t\t\t\t! captureToolbars &&\n\t\t\t\t\t! getSettings().hasFixedToolbar\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst elementRect = element.getBoundingClientRect();\n\n\t\t\t\tif (\n\t\t\t\t\t( orientation === 'horizontal' &&\n\t\t\t\t\t\t( event.clientY > elementRect.bottom ||\n\t\t\t\t\t\t\tevent.clientY < elementRect.top ) ) ||\n\t\t\t\t\t( orientation === 'vertical' &&\n\t\t\t\t\t\t( event.clientX > elementRect.right ||\n\t\t\t\t\t\t\tevent.clientX < elementRect.left ) )\n\t\t\t\t) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst index = getBlockIndex( clientId );\n\n\t\t\t\t// Don't show the in-between inserter before the first block in\n\t\t\t\t// the list (preserves the original behaviour).\n\t\t\t\tif ( index === 0 ) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tshowInsertionPoint( rootClientId, index, {\n\t\t\t\t\t__unstableWithInserter: true,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'mousemove', onMouseMove );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'mousemove', onMouseMove );\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\topenRef,\n\t\t\tgetBlockListSettings,\n\t\t\tgetBlockIndex,\n\t\t\tisMultiSelecting,\n\t\t\tshowInsertionPoint,\n\t\t\thideInsertionPoint,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisInBetweenInserterDisabled,\n\t\t]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,oBAAoB;AACjD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,KAAK,QAAQ,iBAAiB;;AAEvC;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,qBAAqB,QAAQ,gCAAgC;AAEtE,OAAO,SAASC,oBAAoBA,CAAA,EAAG;EACtC,MAAMC,OAAO,GAAGN,UAAU,CAAEI,qBAAsB,CAAC;EACnD,MAAMG,2BAA2B,GAAGT,SAAS,CAC1CU,MAAM,IACPA,MAAM,CAAEL,gBAAiB,CAAC,CAACM,WAAW,CAAC,CAAC,CAACC,iBAAiB,IAC1DF,MAAM,CAAEL,gBAAiB,CAAC,CAACQ,uBAAuB,CAAC,CAAC,KAAK,UAAU,EACpE,EACD,CAAC;EACD,MAAM;IACLC,oBAAoB;IACpBC,aAAa;IACbC,gBAAgB;IAChBC,yBAAyB;IACzBN,WAAW;IACXO,eAAe;IACfC,8BAA8B;IAC9BC,mBAAmB;IACnBC,YAAY;IACZC;EACD,CAAC,GAAGtB,SAAS,CAAEK,gBAAiB,CAAC;EACjC,MAAM;IAAEkB,kBAAkB;IAAEC;EAAmB,CAAC,GAC/CvB,WAAW,CAAEI,gBAAiB,CAAC;EAEhC,OAAON,YAAY,CAChB0B,IAAI,IAAM;IACX,IAAKhB,2BAA2B,EAAG;MAClC;IACD;IAEA,SAASiB,WAAWA,CAAEC,KAAK,EAAG;MAC7B;MACA;MACA,IAAKnB,OAAO,KAAKoB,SAAS,IAAIpB,OAAO,CAACqB,OAAO,EAAG;QA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IACnCzC,KAAK,CAACmB,OAAO,GAAGqB,WAAW,CAACV,GAAG,CAAE,IACjCf,WAAW,KAAK,UAAU,KACzBf,KAAK,CAACqB,OAAO,GAAGmB,WAAW,CAACT,KAAK,IAClC/B,KAAK,CAACqB,OAAO,GAAGmB,WAAW,CAACR,IAAI,CAAI,EACrC;QACDnC,kBAAkB,CAAC,CAAC;QACpB;MACD;MAEA,MAAM6C,KAAK,GAAGtD,aAAa,CAAE+C,QAAS,CAAC;;MAEvC;MACA;MACA,IAAKO,KAAK,KAAK,CAAC,EAAG;QAClB7C,kBAAkB,CAAC,CAAC;QACpB;MACD;MAEAD,kBAAkB,CAAEY,YAAY,EAAEkC,KAAK,EAAE;QACxCC,sBAAsB,EAAE;MACzB,CAAE,CAAC;IACJ;IAEA7C,IAAI,CAAC8C,gBAAgB,CAAE,WAAW,EAAE7C,WAAY,CAAC;IAEjD,OAAO,MAAM;MACZD,IAAI,CAAC+C,mBAAmB,CAAE,WAAW,EAAE9C,WAAY,CAAC;IACrD,CAAC;EACF,CAAC,EACD,CACClB,OAAO,EACPM,oBAAoB,EACpBC,aAAa,EACbC,gBAAgB,EAChBO,kBAAkB,EAClBC,kBAAkB,EAClBP,yBAAyB,EACzBR,2BAA2B,CAE7B,CAAC;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useRefEffect","useSelect","useDispatch","useContext","isRTL","store","blockEditorStore","InsertionPointOpenRef","unlock","useInBetweenInserter","openRef","isInBetweenInserterDisabled","select","getSettings","isDistractionFree","__unstableGetEditorMode","getBlockListSettings","getBlockIndex","isMultiSelecting","getSelectedBlockClientIds","getTemplateLock","__unstableIsWithinBlockOverlay","getBlockEditingMode","getBlockName","getBlockAttributes","getParentSectionBlock","showInsertionPoint","hideInsertionPoint","node","onMouseMove","event","undefined","current","target","nodeType","TEXT_NODE","classList","contains","rootClientId","blockElement","getAttribute","closest","layout","isManualPlacement","blockListSettings","orientation","captureToolbars","__experimentalCaptureToolbars","offsetTop","clientY","offsetLeft","clientX","children","Array","from","element","find","blockEl","blockElRect","getBoundingClientRect","top","right","left","id","firstElementChild","clientId","slice","length","includes","hasFixedToolbar","elementRect","bottom","index","__unstableWithInserter","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/block-list/use-in-between-inserter.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useContext } from '@wordpress/element';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { InsertionPointOpenRef } from '../block-tools/insertion-point';\nimport { unlock } from '../../lock-unlock';\n\nexport function useInBetweenInserter() {\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst isInBetweenInserterDisabled = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().isDistractionFree ||\n\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() === 'zoom-out',\n\t\t[]\n\t);\n\tconst {\n\t\tgetBlockListSettings,\n\t\tgetBlockIndex,\n\t\tisMultiSelecting,\n\t\tgetSelectedBlockClientIds,\n\t\tgetSettings,\n\t\tgetTemplateLock,\n\t\t__unstableIsWithinBlockOverlay,\n\t\tgetBlockEditingMode,\n\t\tgetBlockName,\n\t\tgetBlockAttributes,\n\t\tgetParentSectionBlock,\n\t} = unlock( useSelect( blockEditorStore ) );\n\tconst { showInsertionPoint, hideInsertionPoint } =\n\t\tuseDispatch( blockEditorStore );\n\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tif ( isInBetweenInserterDisabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfunction onMouseMove( event ) {\n\t\t\t\t// openRef is the reference to the insertion point between blocks.\n\t\t\t\t// If the reference is not set or the insertion point is already open, return.\n\t\t\t\tif ( openRef === undefined || openRef.current ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Ignore text nodes sometimes detected in FireFox.\n\t\t\t\tif ( event.target.nodeType === event.target.TEXT_NODE ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( isMultiSelecting() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t! event.target.classList.contains(\n\t\t\t\t\t\t'block-editor-block-list__layout'\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet rootClientId;\n\t\t\t\tif (\n\t\t\t\t\t! event.target.classList.contains( 'is-root-container' )\n\t\t\t\t) {\n\t\t\t\t\tconst blockElement = !! event.target.getAttribute(\n\t\t\t\t\t\t'data-block'\n\t\t\t\t\t)\n\t\t\t\t\t\t? event.target\n\t\t\t\t\t\t: event.target.closest( '[data-block]' );\n\t\t\t\t\trootClientId = blockElement.getAttribute( 'data-block' );\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tgetTemplateLock( rootClientId ) ||\n\t\t\t\t\tgetBlockEditingMode( rootClientId ) === 'disabled' ||\n\t\t\t\t\tgetBlockName( rootClientId ) === 'core/block' ||\n\t\t\t\t\t( rootClientId &&\n\t\t\t\t\t\tgetBlockAttributes( rootClientId ).layout\n\t\t\t\t\t\t\t?.isManualPlacement )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst blockListSettings = getBlockListSettings( rootClientId );\n\t\t\t\tconst orientation =\n\t\t\t\t\tblockListSettings?.orientation || 'vertical';\n\t\t\t\tconst captureToolbars =\n\t\t\t\t\t!! blockListSettings?.__experimentalCaptureToolbars;\n\t\t\t\tconst offsetTop = event.clientY;\n\t\t\t\tconst offsetLeft = event.clientX;\n\n\t\t\t\tconst children = Array.from( event.target.children );\n\t\t\t\tlet element = children.find( ( blockEl ) => {\n\t\t\t\t\tconst blockElRect = blockEl.getBoundingClientRect();\n\t\t\t\t\treturn (\n\t\t\t\t\t\t( blockEl.classList.contains( 'wp-block' ) &&\n\t\t\t\t\t\t\torientation === 'vertical' &&\n\t\t\t\t\t\t\tblockElRect.top > offsetTop ) ||\n\t\t\t\t\t\t( blockEl.classList.contains( 'wp-block' ) &&\n\t\t\t\t\t\t\torientation === 'horizontal' &&\n\t\t\t\t\t\t\t( isRTL()\n\t\t\t\t\t\t\t\t? blockElRect.right < offsetLeft\n\t\t\t\t\t\t\t\t: blockElRect.left > offsetLeft ) )\n\t\t\t\t\t);\n\t\t\t\t} );\n\n\t\t\t\tif ( ! element ) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// The block may be in an alignment wrapper, so check the first direct\n\t\t\t\t// child if the element has no ID.\n\t\t\t\tif ( ! element.id ) {\n\t\t\t\t\telement = element.firstElementChild;\n\n\t\t\t\t\tif ( ! element ) {\n\t\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Don't show the insertion point if a parent block has an \"overlay\"\n\t\t\t\t// See https://github.com/WordPress/gutenberg/pull/34012#pullrequestreview-727762337\n\t\t\t\tconst clientId = element.id.slice( 'block-'.length );\n\t\t\t\tif (\n\t\t\t\t\t! clientId ||\n\t\t\t\t\t__unstableIsWithinBlockOverlay( clientId ) ||\n\t\t\t\t\t!! getParentSectionBlock( clientId )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Don't show the inserter if the following conditions are met,\n\t\t\t\t// as it conflicts with the block toolbar:\n\t\t\t\t// 1. when hovering above or inside selected block(s)\n\t\t\t\t// 2. when the orientation is vertical\n\t\t\t\t// 3. when the __experimentalCaptureToolbars is not enabled\n\t\t\t\t// 4. when the Top Toolbar is not disabled\n\t\t\t\tif (\n\t\t\t\t\tgetSelectedBlockClientIds().includes( clientId ) &&\n\t\t\t\t\torientation === 'vertical' &&\n\t\t\t\t\t! captureToolbars &&\n\t\t\t\t\t! getSettings().hasFixedToolbar\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst elementRect = element.getBoundingClientRect();\n\n\t\t\t\tif (\n\t\t\t\t\t( orientation === 'horizontal' &&\n\t\t\t\t\t\t( event.clientY > elementRect.bottom ||\n\t\t\t\t\t\t\tevent.clientY < elementRect.top ) ) ||\n\t\t\t\t\t( orientation === 'vertical' &&\n\t\t\t\t\t\t( event.clientX > elementRect.right ||\n\t\t\t\t\t\t\tevent.clientX < elementRect.left ) )\n\t\t\t\t) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst index = getBlockIndex( clientId );\n\n\t\t\t\t// Don't show the in-between inserter before the first block in\n\t\t\t\t// the list (preserves the original behaviour).\n\t\t\t\tif ( index === 0 ) {\n\t\t\t\t\thideInsertionPoint();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tshowInsertionPoint( rootClientId, index, {\n\t\t\t\t\t__unstableWithInserter: true,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'mousemove', onMouseMove );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'mousemove', onMouseMove );\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\topenRef,\n\t\t\tgetBlockListSettings,\n\t\t\tgetBlockIndex,\n\t\t\tisMultiSelecting,\n\t\t\tshowInsertionPoint,\n\t\t\thideInsertionPoint,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisInBetweenInserterDisabled,\n\t\t]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,oBAAoB;AACjD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,KAAK,QAAQ,iBAAiB;;AAEvC;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBA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aAAa,CAAEgD,QAAS,CAAC;;MAEvC;MACA;MACA,IAAKO,KAAK,KAAK,CAAC,EAAG;QAClB7C,kBAAkB,CAAC,CAAC;QACpB;MACD;MAEAD,kBAAkB,CAAEY,YAAY,EAAEkC,KAAK,EAAE;QACxCC,sBAAsB,EAAE;MACzB,CAAE,CAAC;IACJ;IAEA7C,IAAI,CAAC8C,gBAAgB,CAAE,WAAW,EAAE7C,WAAY,CAAC;IAEjD,OAAO,MAAM;MACZD,IAAI,CAAC+C,mBAAmB,CAAE,WAAW,EAAE9C,WAAY,CAAC;IACrD,CAAC;EACF,CAAC,EACD,CACCnB,OAAO,EACPM,oBAAoB,EACpBC,aAAa,EACbC,gBAAgB,EAChBQ,kBAAkB,EAClBC,kBAAkB,EAClBR,yBAAyB,EACzBR,2BAA2B,CAE7B,CAAC;AACF","ignoreList":[]}
|
|
@@ -27,14 +27,16 @@ export function ZoomOutSeparator({
|
|
|
27
27
|
const {
|
|
28
28
|
sectionRootClientId,
|
|
29
29
|
sectionClientIds,
|
|
30
|
-
|
|
31
|
-
blockInsertionPointVisible
|
|
30
|
+
insertionPoint,
|
|
31
|
+
blockInsertionPointVisible,
|
|
32
|
+
blockInsertionPoint
|
|
32
33
|
} = useSelect(select => {
|
|
33
34
|
const {
|
|
34
|
-
|
|
35
|
+
getInsertionPoint,
|
|
35
36
|
getBlockOrder,
|
|
37
|
+
getSectionRootClientId,
|
|
36
38
|
isBlockInsertionPointVisible,
|
|
37
|
-
|
|
39
|
+
getBlockInsertionPoint
|
|
38
40
|
} = unlock(select(blockEditorStore));
|
|
39
41
|
const root = getSectionRootClientId();
|
|
40
42
|
const sectionRootClientIds = getBlockOrder(root);
|
|
@@ -42,6 +44,7 @@ export function ZoomOutSeparator({
|
|
|
42
44
|
sectionRootClientId: root,
|
|
43
45
|
sectionClientIds: sectionRootClientIds,
|
|
44
46
|
blockOrder: getBlockOrder(root),
|
|
47
|
+
insertionPoint: getInsertionPoint(),
|
|
45
48
|
blockInsertionPoint: getBlockInsertionPoint(),
|
|
46
49
|
blockInsertionPointVisible: isBlockInsertionPointVisible()
|
|
47
50
|
};
|
|
@@ -55,11 +58,16 @@ export function ZoomOutSeparator({
|
|
|
55
58
|
if (!isSectionBlock) {
|
|
56
59
|
return null;
|
|
57
60
|
}
|
|
61
|
+
const hasTopInsertionPoint = insertionPoint?.index === 0 && clientId === sectionClientIds[insertionPoint.index];
|
|
62
|
+
const hasBottomInsertionPoint = insertionPoint && insertionPoint.hasOwnProperty('index') && clientId === sectionClientIds[insertionPoint.index - 1];
|
|
63
|
+
// We want to show the zoom out separator in either of these conditions:
|
|
64
|
+
// 1. If the inserter has an insertion index set
|
|
65
|
+
// 2. We are dragging a pattern over an insertion point
|
|
58
66
|
if (position === 'top') {
|
|
59
|
-
isVisible = blockInsertionPointVisible && blockInsertionPoint.index === 0 && clientId === sectionClientIds[blockInsertionPoint.index];
|
|
67
|
+
isVisible = hasTopInsertionPoint || blockInsertionPointVisible && blockInsertionPoint.index === 0 && clientId === sectionClientIds[blockInsertionPoint.index];
|
|
60
68
|
}
|
|
61
69
|
if (position === 'bottom') {
|
|
62
|
-
isVisible = blockInsertionPointVisible && clientId === sectionClientIds[blockInsertionPoint.index - 1];
|
|
70
|
+
isVisible = hasBottomInsertionPoint || blockInsertionPointVisible && clientId === sectionClientIds[blockInsertionPoint.index - 1];
|
|
63
71
|
}
|
|
64
72
|
return /*#__PURE__*/_jsx(AnimatePresence, {
|
|
65
73
|
children: isVisible && /*#__PURE__*/_jsx(motion.div, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","useReducedMotion","useSelect","useState","__","store","blockEditorStore","unlock","jsx","_jsx","ZoomOutSeparator","clientId","rootClientId","position","isDraggedOver","setIsDraggedOver","sectionRootClientId","sectionClientIds","
|
|
1
|
+
{"version":3,"names":["clsx","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","useReducedMotion","useSelect","useState","__","store","blockEditorStore","unlock","jsx","_jsx","ZoomOutSeparator","clientId","rootClientId","position","isDraggedOver","setIsDraggedOver","sectionRootClientId","sectionClientIds","insertionPoint","blockInsertionPointVisible","blockInsertionPoint","select","getInsertionPoint","getBlockOrder","getSectionRootClientId","isBlockInsertionPointVisible","getBlockInsertionPoint","root","sectionRootClientIds","blockOrder","isReducedMotion","isVisible","isSectionBlock","includes","hasTopInsertionPoint","index","hasBottomInsertionPoint","hasOwnProperty","children","div","as","layout","initial","height","animate","exit","transition","type","duration","ease","className","onDragOver","onDragLeave","opacity"],"sources":["@wordpress/block-editor/src/components/block-list/zoom-out-separator.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport function ZoomOutSeparator( {\n\tclientId,\n\trootClientId = '',\n\tposition = 'top',\n} ) {\n\tconst [ isDraggedOver, setIsDraggedOver ] = useState( false );\n\tconst {\n\t\tsectionRootClientId,\n\t\tsectionClientIds,\n\t\tinsertionPoint,\n\t\tblockInsertionPointVisible,\n\t\tblockInsertionPoint,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetInsertionPoint,\n\t\t\tgetBlockOrder,\n\t\t\tgetSectionRootClientId,\n\t\t\tisBlockInsertionPointVisible,\n\t\t\tgetBlockInsertionPoint,\n\t\t} = unlock( select( blockEditorStore ) );\n\n\t\tconst root = getSectionRootClientId();\n\t\tconst sectionRootClientIds = getBlockOrder( root );\n\t\treturn {\n\t\t\tsectionRootClientId: root,\n\t\t\tsectionClientIds: sectionRootClientIds,\n\t\t\tblockOrder: getBlockOrder( root ),\n\t\t\tinsertionPoint: getInsertionPoint(),\n\t\t\tblockInsertionPoint: getBlockInsertionPoint(),\n\t\t\tblockInsertionPointVisible: isBlockInsertionPointVisible(),\n\t\t};\n\t}, [] );\n\n\tconst isReducedMotion = useReducedMotion();\n\n\tif ( ! clientId ) {\n\t\treturn;\n\t}\n\n\tlet isVisible = false;\n\n\tconst isSectionBlock =\n\t\trootClientId === sectionRootClientId &&\n\t\tsectionClientIds &&\n\t\tsectionClientIds.includes( clientId );\n\n\tif ( ! isSectionBlock ) {\n\t\treturn null;\n\t}\n\n\tconst hasTopInsertionPoint =\n\t\tinsertionPoint?.index === 0 &&\n\t\tclientId === sectionClientIds[ insertionPoint.index ];\n\tconst hasBottomInsertionPoint =\n\t\tinsertionPoint &&\n\t\tinsertionPoint.hasOwnProperty( 'index' ) &&\n\t\tclientId === sectionClientIds[ insertionPoint.index - 1 ];\n\t// We want to show the zoom out separator in either of these conditions:\n\t// 1. If the inserter has an insertion index set\n\t// 2. We are dragging a pattern over an insertion point\n\tif ( position === 'top' ) {\n\t\tisVisible =\n\t\t\thasTopInsertionPoint ||\n\t\t\t( blockInsertionPointVisible &&\n\t\t\t\tblockInsertionPoint.index === 0 &&\n\t\t\t\tclientId === sectionClientIds[ blockInsertionPoint.index ] );\n\t}\n\n\tif ( position === 'bottom' ) {\n\t\tisVisible =\n\t\t\thasBottomInsertionPoint ||\n\t\t\t( blockInsertionPointVisible &&\n\t\t\t\tclientId ===\n\t\t\t\t\tsectionClientIds[ blockInsertionPoint.index - 1 ] );\n\t}\n\n\treturn (\n\t\t<AnimatePresence>\n\t\t\t{ isVisible && (\n\t\t\t\t<motion.div\n\t\t\t\t\tas=\"button\"\n\t\t\t\t\tlayout={ ! isReducedMotion }\n\t\t\t\t\tinitial={ { height: 0 } }\n\t\t\t\t\tanimate={ { height: '120px' } }\n\t\t\t\t\texit={ { height: 0 } }\n\t\t\t\t\ttransition={ {\n\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\tduration: 0.2,\n\t\t\t\t\t\tease: [ 0.6, 0, 0.4, 1 ],\n\t\t\t\t\t} }\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'block-editor-block-list__zoom-out-separator',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-dragged-over': isDraggedOver,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tdata-is-insertion-point=\"true\"\n\t\t\t\t\tonDragOver={ () => setIsDraggedOver( true ) }\n\t\t\t\t\tonDragLeave={ () => setIsDraggedOver( false ) }\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tinitial={ { opacity: 0 } }\n\t\t\t\t\t\tanimate={ { opacity: 1 } }\n\t\t\t\t\t\texit={ { opacity: 0 } }\n\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\tduration: 0.1,\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Drop pattern.' ) }\n\t\t\t\t\t</motion.div>\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t</AnimatePresence>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,gBAAgB,IAAIC,MAAM,EAC1BC,yBAAyB,IAAIC,eAAe,QACtC,uBAAuB;AAC9B,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3C,OAAO,SAASC,gBAAgBA,CAAE;EACjCC,QAAQ;EACRC,YAAY,GAAG,E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ACX,MAAM,CAACyC,GAAG;QACVG,OAAO,EAAG;UAAEW,OAAO,EAAE;QAAE,CAAG;QAC1BT,OAAO,EAAG;UAAES,OAAO,EAAE;QAAE,CAAG;QAC1BR,IAAI,EAAG;UAAEQ,OAAO,EAAE;QAAE,CAAG;QACvBP,UAAU,EAAG;UACZC,IAAI,EAAE,OAAO;UACbC,QAAQ,EAAE;QACX,CAAG;QAAAV,QAAA,EAEDlC,EAAE,CAAE,eAAgB;MAAC,CACZ;IAAC,CACF;EACZ,CACe,CAAC;AAEpB","ignoreList":[]}
|
|
@@ -26,10 +26,8 @@ function BlockNavigationDropdownToggle({
|
|
|
26
26
|
innerRef,
|
|
27
27
|
...props
|
|
28
28
|
}) {
|
|
29
|
-
return /*#__PURE__*/_jsx(Button
|
|
30
|
-
|
|
31
|
-
, {
|
|
32
|
-
__next40pxDefaultSize: false,
|
|
29
|
+
return /*#__PURE__*/_jsx(Button, {
|
|
30
|
+
__next40pxDefaultSize: true,
|
|
33
31
|
...props,
|
|
34
32
|
ref: innerRef,
|
|
35
33
|
icon: listView,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["deprecated","Button","Dropdown","__","useSelect","forwardRef","listView","ListView","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","BlockNavigationDropdownToggle","isEnabled","onToggle","isOpen","innerRef","props","__next40pxDefaultSize","ref","icon","onClick","undefined","label","className","BlockNavigationDropdown","isDisabled","since","alternative","hasBlocks","select","getBlockCount","contentClassName","popoverProps","placement","renderToggle","renderContent","children"],"sources":["@wordpress/block-editor/src/components/block-navigation/dropdown.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Dropdown } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\nimport { listView } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport ListView from '../list-view';\nimport { store as blockEditorStore } from '../../store';\n\nfunction BlockNavigationDropdownToggle( {\n\tisEnabled,\n\tonToggle,\n\tisOpen,\n\tinnerRef,\n\t...props\n} ) {\n\treturn (\n\t\t<Button\n\t\t\
|
|
1
|
+
{"version":3,"names":["deprecated","Button","Dropdown","__","useSelect","forwardRef","listView","ListView","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","BlockNavigationDropdownToggle","isEnabled","onToggle","isOpen","innerRef","props","__next40pxDefaultSize","ref","icon","onClick","undefined","label","className","BlockNavigationDropdown","isDisabled","since","alternative","hasBlocks","select","getBlockCount","contentClassName","popoverProps","placement","renderToggle","renderContent","children"],"sources":["@wordpress/block-editor/src/components/block-navigation/dropdown.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Dropdown } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\nimport { listView } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport ListView from '../list-view';\nimport { store as blockEditorStore } from '../../store';\n\nfunction BlockNavigationDropdownToggle( {\n\tisEnabled,\n\tonToggle,\n\tisOpen,\n\tinnerRef,\n\t...props\n} ) {\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\t{ ...props }\n\t\t\tref={ innerRef }\n\t\t\ticon={ listView }\n\t\t\taria-expanded={ isOpen }\n\t\t\taria-haspopup=\"true\"\n\t\t\tonClick={ isEnabled ? onToggle : undefined }\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\tlabel={ __( 'List view' ) }\n\t\t\tclassName=\"block-editor-block-navigation\"\n\t\t\taria-disabled={ ! isEnabled }\n\t\t/>\n\t);\n}\n\nfunction BlockNavigationDropdown( { isDisabled, ...props }, ref ) {\n\tdeprecated( 'wp.blockEditor.BlockNavigationDropdown', {\n\t\tsince: '6.1',\n\t\talternative: 'wp.components.Dropdown and wp.blockEditor.ListView',\n\t} );\n\n\tconst hasBlocks = useSelect(\n\t\t( select ) => !! select( blockEditorStore ).getBlockCount(),\n\t\t[]\n\t);\n\tconst isEnabled = hasBlocks && ! isDisabled;\n\n\treturn (\n\t\t<Dropdown\n\t\t\tcontentClassName=\"block-editor-block-navigation__popover\"\n\t\t\tpopoverProps={ { placement: 'bottom-start' } }\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<BlockNavigationDropdownToggle\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tinnerRef={ ref }\n\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\tonToggle={ onToggle }\n\t\t\t\t\tisEnabled={ isEnabled }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\trenderContent={ () => (\n\t\t\t\t<div className=\"block-editor-block-navigation__container\">\n\t\t\t\t\t<p className=\"block-editor-block-navigation__label\">\n\t\t\t\t\t\t{ __( 'List view' ) }\n\t\t\t\t\t</p>\n\n\t\t\t\t\t<ListView />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( BlockNavigationDropdown );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,MAAM,EAAEC,QAAQ,QAAQ,uBAAuB;AACxD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,QAAQ,QAAQ,kBAAkB;;AAE3C;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,cAAc;AACnC,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAExD,SAASC,6BAA6BA,CAAE;EACvCC,SAAS;EACTC,QAAQ;EACRC,MAAM;EAC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A,EAChDpC,EAAE,CAAE,WAAY;MAAC,CACjB,CAAC,eAEJQ,IAAA,CAACJ,QAAQ,IAAE,CAAC;IAAA,CACR;EACH,CACH,CAAC;AAEJ;AAEA,eAAeF,UAAU,CAAEsB,uBAAwB,CAAC","ignoreList":[]}
|
|
@@ -14,6 +14,7 @@ import useBlockDisplayInformation from '../use-block-display-information';
|
|
|
14
14
|
import BlockIcon from '../block-icon';
|
|
15
15
|
import { useShowHoveredOrFocusedGestures } from '../block-toolbar/utils';
|
|
16
16
|
import { store as blockEditorStore } from '../../store';
|
|
17
|
+
import { unlock } from '../../lock-unlock';
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Block parent selector component, displaying the hierarchy of the
|
|
@@ -27,29 +28,31 @@ export default function BlockParentSelector() {
|
|
|
27
28
|
selectBlock
|
|
28
29
|
} = useDispatch(blockEditorStore);
|
|
29
30
|
const {
|
|
30
|
-
|
|
31
|
+
parentClientId,
|
|
31
32
|
isVisible
|
|
32
33
|
} = useSelect(select => {
|
|
33
34
|
const {
|
|
34
35
|
getBlockName,
|
|
35
36
|
getBlockParents,
|
|
36
37
|
getSelectedBlockClientId,
|
|
37
|
-
getBlockEditingMode
|
|
38
|
-
|
|
38
|
+
getBlockEditingMode,
|
|
39
|
+
getParentSectionBlock
|
|
40
|
+
} = unlock(select(blockEditorStore));
|
|
39
41
|
const {
|
|
40
42
|
hasBlockSupport
|
|
41
43
|
} = select(blocksStore);
|
|
42
44
|
const selectedBlockClientId = getSelectedBlockClientId();
|
|
45
|
+
const parentSection = getParentSectionBlock(selectedBlockClientId);
|
|
43
46
|
const parents = getBlockParents(selectedBlockClientId);
|
|
44
|
-
const
|
|
45
|
-
const parentBlockName = getBlockName(
|
|
47
|
+
const _parentClientId = parentSection !== null && parentSection !== void 0 ? parentSection : parents[parents.length - 1];
|
|
48
|
+
const parentBlockName = getBlockName(_parentClientId);
|
|
46
49
|
const _parentBlockType = getBlockType(parentBlockName);
|
|
47
50
|
return {
|
|
48
|
-
|
|
49
|
-
isVisible:
|
|
51
|
+
parentClientId: _parentClientId,
|
|
52
|
+
isVisible: _parentClientId && getBlockEditingMode(_parentClientId) !== 'disabled' && hasBlockSupport(_parentBlockType, '__experimentalParentSelector', true)
|
|
50
53
|
};
|
|
51
54
|
}, []);
|
|
52
|
-
const blockInformation = useBlockDisplayInformation(
|
|
55
|
+
const blockInformation = useBlockDisplayInformation(parentClientId);
|
|
53
56
|
|
|
54
57
|
// Allows highlighting the parent block outline when focusing or hovering
|
|
55
58
|
// the parent block selector within the child.
|
|
@@ -67,7 +70,7 @@ export default function BlockParentSelector() {
|
|
|
67
70
|
...showHoveredOrFocusedGestures,
|
|
68
71
|
children: /*#__PURE__*/_jsx(ToolbarButton, {
|
|
69
72
|
className: "block-editor-block-parent-selector__button",
|
|
70
|
-
onClick: () => selectBlock(
|
|
73
|
+
onClick: () => selectBlock(parentClientId),
|
|
71
74
|
label: sprintf( /* translators: %s: Name of the block's parent. */
|
|
72
75
|
__('Select parent block: %s'), blockInformation?.title),
|
|
73
76
|
showTooltip: true,
|
|
@@ -75,6 +78,6 @@ export default function BlockParentSelector() {
|
|
|
75
78
|
icon: blockInformation?.icon
|
|
76
79
|
})
|
|
77
80
|
})
|
|
78
|
-
},
|
|
81
|
+
}, parentClientId);
|
|
79
82
|
}
|
|
80
83
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getBlockType","store","blocksStore","ToolbarButton","useSelect","useDispatch","__","sprintf","useRef","useBlockDisplayInformation","BlockIcon","useShowHoveredOrFocusedGestures","blockEditorStore","jsx","_jsx","BlockParentSelector","selectBlock","
|
|
1
|
+
{"version":3,"names":["getBlockType","store","blocksStore","ToolbarButton","useSelect","useDispatch","__","sprintf","useRef","useBlockDisplayInformation","BlockIcon","useShowHoveredOrFocusedGestures","blockEditorStore","unlock","jsx","_jsx","BlockParentSelector","selectBlock","parentClientId","isVisible","select","getBlockName","getBlockParents","getSelectedBlockClientId","getBlockEditingMode","getParentSectionBlock","hasBlockSupport","selectedBlockClientId","parentSection","parents","_parentClientId","length","parentBlockName","_parentBlockType","blockInformation","nodeRef","showHoveredOrFocusedGestures","ref","highlightParent","className","children","onClick","label","title","showTooltip","icon"],"sources":["@wordpress/block-editor/src/components/block-parent-selector/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockType, store as blocksStore } from '@wordpress/blocks';\nimport { ToolbarButton } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport BlockIcon from '../block-icon';\nimport { useShowHoveredOrFocusedGestures } from '../block-toolbar/utils';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Block parent selector component, displaying the hierarchy of the\n * current block selection as a single icon to \"go up\" a level.\n *\n * @return {Component} Parent block selector.\n */\nexport default function BlockParentSelector() {\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst { parentClientId, isVisible } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockName,\n\t\t\tgetBlockParents,\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetBlockEditingMode,\n\t\t\tgetParentSectionBlock,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst { hasBlockSupport } = select( blocksStore );\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\tconst parentSection = getParentSectionBlock( selectedBlockClientId );\n\t\tconst parents = getBlockParents( selectedBlockClientId );\n\t\tconst _parentClientId = parentSection ?? parents[ parents.length - 1 ];\n\t\tconst parentBlockName = getBlockName( _parentClientId );\n\t\tconst _parentBlockType = getBlockType( parentBlockName );\n\t\treturn {\n\t\t\tparentClientId: _parentClientId,\n\t\t\tisVisible:\n\t\t\t\t_parentClientId &&\n\t\t\t\tgetBlockEditingMode( _parentClientId ) !== 'disabled' &&\n\t\t\t\thasBlockSupport(\n\t\t\t\t\t_parentBlockType,\n\t\t\t\t\t'__experimentalParentSelector',\n\t\t\t\t\ttrue\n\t\t\t\t),\n\t\t};\n\t}, [] );\n\tconst blockInformation = useBlockDisplayInformation( parentClientId );\n\n\t// Allows highlighting the parent block outline when focusing or hovering\n\t// the parent block selector within the child.\n\tconst nodeRef = useRef();\n\tconst showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures( {\n\t\tref: nodeRef,\n\t\thighlightParent: true,\n\t} );\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"block-editor-block-parent-selector\"\n\t\t\tkey={ parentClientId }\n\t\t\tref={ nodeRef }\n\t\t\t{ ...showHoveredOrFocusedGestures }\n\t\t>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName=\"block-editor-block-parent-selector__button\"\n\t\t\t\tonClick={ () => selectBlock( parentClientId ) }\n\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t/* translators: %s: Name of the block's parent. */\n\t\t\t\t\t__( 'Select parent block: %s' ),\n\t\t\t\t\tblockInformation?.title\n\t\t\t\t) }\n\t\t\t\tshowTooltip\n\t\t\t\ticon={ <BlockIcon icon={ blockInformation?.icon } /> }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,EAAEC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACtE,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,MAAM,QAAQ,oBAAoB;;AAE3C;AACA;AACA;AACA,OAAOC,0BAA0B,MAAM,kCAAkC;AACzE,OAAOC,SAAS,MAAM,eAAe;AACrC,SAASC,+BAA+B,QAAQ,wBAAwB;AACxE,SAASV,KAAK,IAAIW,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AA4B,GAAGzB,+BAA+B,CAAE;IACrE0B,GAAG,EAAEF,OAAO;IACZG,eAAe,EAAE;EAClB,CAAE,CAAC;EAEH,IAAK,CAAEnB,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,oBACCJ,IAAA;IACCwB,SAAS,EAAC,oCAAoC;IAE9CF,GAAG,EAAGF,OAAS;IAAA,GACVC,4BAA4B;IAAAI,QAAA,eAEjCzB,IAAA,CAACZ,aAAa;MACboC,SAAS,EAAC,4CAA4C;MACtDE,OAAO,EAAGA,CAAA,KAAMxB,WAAW,CAAEC,cAAe,CAAG;MAC/CwB,KAAK,EAAGnC,OAAO,EACd;MACAD,EAAE,CAAE,yBAA0B,CAAC,EAC/B4B,gBAAgB,EAAES,KACnB,CAAG;MACHC,WAAW;MACXC,IAAI,eAAG9B,IAAA,CAACL,SAAS;QAACmC,IAAI,EAAGX,gBAAgB,EAAEW;MAAM,CAAE;IAAG,CACtD;EAAC,GAdI3B,cAeF,CAAC;AAER","ignoreList":[]}
|
|
@@ -15,10 +15,8 @@ const Actions = ({
|
|
|
15
15
|
onBlockPatternSelect
|
|
16
16
|
}) => /*#__PURE__*/_jsx("div", {
|
|
17
17
|
className: "block-editor-block-pattern-setup__actions",
|
|
18
|
-
children: /*#__PURE__*/_jsx(Button
|
|
19
|
-
|
|
20
|
-
, {
|
|
21
|
-
__next40pxDefaultSize: false,
|
|
18
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
19
|
+
__next40pxDefaultSize: true,
|
|
22
20
|
variant: "primary",
|
|
23
21
|
onClick: onBlockPatternSelect,
|
|
24
22
|
children: __('Choose')
|
|
@@ -31,19 +29,15 @@ const CarouselNavigation = ({
|
|
|
31
29
|
totalSlides
|
|
32
30
|
}) => /*#__PURE__*/_jsxs("div", {
|
|
33
31
|
className: "block-editor-block-pattern-setup__navigation",
|
|
34
|
-
children: [/*#__PURE__*/_jsx(Button
|
|
35
|
-
|
|
36
|
-
, {
|
|
37
|
-
__next40pxDefaultSize: false,
|
|
32
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
33
|
+
size: "compact",
|
|
38
34
|
icon: isRTL() ? chevronRight : chevronLeft,
|
|
39
35
|
label: __('Previous pattern'),
|
|
40
36
|
onClick: handlePrevious,
|
|
41
37
|
disabled: activeSlide === 0,
|
|
42
38
|
accessibleWhenDisabled: true
|
|
43
|
-
}), /*#__PURE__*/_jsx(Button
|
|
44
|
-
|
|
45
|
-
, {
|
|
46
|
-
__next40pxDefaultSize: false,
|
|
39
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
40
|
+
size: "compact",
|
|
47
41
|
icon: isRTL() ? chevronLeft : chevronRight,
|
|
48
42
|
label: __('Next pattern'),
|
|
49
43
|
onClick: handleNext,
|
|
@@ -63,18 +57,14 @@ const SetupToolbar = ({
|
|
|
63
57
|
const isCarouselView = viewMode === VIEWMODES.carousel;
|
|
64
58
|
const displayControls = /*#__PURE__*/_jsxs("div", {
|
|
65
59
|
className: "block-editor-block-pattern-setup__display-controls",
|
|
66
|
-
children: [/*#__PURE__*/_jsx(Button
|
|
67
|
-
|
|
68
|
-
, {
|
|
69
|
-
__next40pxDefaultSize: false,
|
|
60
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
61
|
+
size: "compact",
|
|
70
62
|
icon: stretchFullWidth,
|
|
71
63
|
label: __('Carousel view'),
|
|
72
64
|
onClick: () => setViewMode(VIEWMODES.carousel),
|
|
73
65
|
isPressed: isCarouselView
|
|
74
|
-
}), /*#__PURE__*/_jsx(Button
|
|
75
|
-
|
|
76
|
-
, {
|
|
77
|
-
__next40pxDefaultSize: false,
|
|
66
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
67
|
+
size: "compact",
|
|
78
68
|
icon: grid,
|
|
79
69
|
label: __('Grid view'),
|
|
80
70
|
onClick: () => setViewMode(VIEWMODES.grid),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","isRTL","Button","chevronRight","chevronLeft","grid","stretchFullWidth","VIEWMODES","jsx","_jsx","jsxs","_jsxs","Actions","onBlockPatternSelect","className","children","__next40pxDefaultSize","variant","onClick","CarouselNavigation","handlePrevious","handleNext","activeSlide","totalSlides","icon","label","disabled","accessibleWhenDisabled","SetupToolbar","viewMode","setViewMode","isCarouselView","carousel","displayControls","isPressed"],"sources":["@wordpress/block-editor/src/components/block-pattern-setup/setup-toolbar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport {\n\tchevronRight,\n\tchevronLeft,\n\tgrid,\n\tstretchFullWidth,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { VIEWMODES } from './constants';\n\nconst Actions = ( { onBlockPatternSelect } ) => (\n\t<div className=\"block-editor-block-pattern-setup__actions\">\n\t\t<Button\n\t\t\
|
|
1
|
+
{"version":3,"names":["__","isRTL","Button","chevronRight","chevronLeft","grid","stretchFullWidth","VIEWMODES","jsx","_jsx","jsxs","_jsxs","Actions","onBlockPatternSelect","className","children","__next40pxDefaultSize","variant","onClick","CarouselNavigation","handlePrevious","handleNext","activeSlide","totalSlides","size","icon","label","disabled","accessibleWhenDisabled","SetupToolbar","viewMode","setViewMode","isCarouselView","carousel","displayControls","isPressed"],"sources":["@wordpress/block-editor/src/components/block-pattern-setup/setup-toolbar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport {\n\tchevronRight,\n\tchevronLeft,\n\tgrid,\n\tstretchFullWidth,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { VIEWMODES } from './constants';\n\nconst Actions = ( { onBlockPatternSelect } ) => (\n\t<div className=\"block-editor-block-pattern-setup__actions\">\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tvariant=\"primary\"\n\t\t\tonClick={ onBlockPatternSelect }\n\t\t>\n\t\t\t{ __( 'Choose' ) }\n\t\t</Button>\n\t</div>\n);\n\nconst CarouselNavigation = ( {\n\thandlePrevious,\n\thandleNext,\n\tactiveSlide,\n\ttotalSlides,\n} ) => (\n\t<div className=\"block-editor-block-pattern-setup__navigation\">\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\tlabel={ __( 'Previous pattern' ) }\n\t\t\tonClick={ handlePrevious }\n\t\t\tdisabled={ activeSlide === 0 }\n\t\t\taccessibleWhenDisabled\n\t\t/>\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\ticon={ isRTL() ? chevronLeft : chevronRight }\n\t\t\tlabel={ __( 'Next pattern' ) }\n\t\t\tonClick={ handleNext }\n\t\t\tdisabled={ activeSlide === totalSlides - 1 }\n\t\t\taccessibleWhenDisabled\n\t\t/>\n\t</div>\n);\n\nconst SetupToolbar = ( {\n\tviewMode,\n\tsetViewMode,\n\thandlePrevious,\n\thandleNext,\n\tactiveSlide,\n\ttotalSlides,\n\tonBlockPatternSelect,\n} ) => {\n\tconst isCarouselView = viewMode === VIEWMODES.carousel;\n\tconst displayControls = (\n\t\t<div className=\"block-editor-block-pattern-setup__display-controls\">\n\t\t\t<Button\n\t\t\t\tsize=\"compact\"\n\t\t\t\ticon={ stretchFullWidth }\n\t\t\t\tlabel={ __( 'Carousel view' ) }\n\t\t\t\tonClick={ () => setViewMode( VIEWMODES.carousel ) }\n\t\t\t\tisPressed={ isCarouselView }\n\t\t\t/>\n\t\t\t<Button\n\t\t\t\tsize=\"compact\"\n\t\t\t\ticon={ grid }\n\t\t\t\tlabel={ __( 'Grid view' ) }\n\t\t\t\tonClick={ () => setViewMode( VIEWMODES.grid ) }\n\t\t\t\tisPressed={ viewMode === VIEWMODES.grid }\n\t\t\t/>\n\t\t</div>\n\t);\n\treturn (\n\t\t<div className=\"block-editor-block-pattern-setup__toolbar\">\n\t\t\t{ isCarouselView && (\n\t\t\t\t<CarouselNavigation\n\t\t\t\t\thandlePrevious={ handlePrevious }\n\t\t\t\t\thandleNext={ handleNext }\n\t\t\t\t\tactiveSlide={ activeSlide }\n\t\t\t\t\ttotalSlides={ totalSlides }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ displayControls }\n\t\t\t{ isCarouselView && (\n\t\t\t\t<Actions onBlockPatternSelect={ onBlockPatternSelect } />\n\t\t\t) }\n\t\t</div>\n\t);\n};\n\nexport default SetupToolbar;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SACCC,YAAY,EACZC,WAAW,EACXC,IAAI,EACJC,gBAAgB,QACV,kBAAkB;;AAEzB;AACA;AACA;AACA,SAASC,SAAS,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAExC,MAAMC,OAAO,GAAGA,CAAE;EAAEC;AAAqB,CAAC,kBACzCJ,IAAA;EAAKK,SAAS,EAAC,2CAA2C;EAAAC,QAAA,eACzDN,IAAA,CAACP,MAAM;IACNc,qBAAqB;IACrBC,OAAO,EAAC,SAAS;IACjBC,OAAO,EAAGL,oBAAsB;IAAAE,QAAA,EAE9Bf,EAAE,CAAE,QAAS;EAAC,CACT;AAAC,CACL,CACL;AAED,MAAMmB,kBAAkB,GAAGA,CAAE;EAC5BC,cAAc;EACdC,UAAU;EACVC,WAAW;EACXC;AACD,CAAC,kBACAZ,KAAA;EAAKG,SAAS,EAAC,8CAA8C;EAAAC,QAAA,gBAC5DN,IAAA,CAACP,MAAM;IACNsB,IAAI,EAAC,SAAS;IACdC,IAAI,EAAGxB,KAAK,CAAC,CAAC,GAAGE,YAAY,GAAGC,WAAa;IAC7CsB,KAAK,EAAG1B,EAAE,CAAE,kBAAmB,CAAG;IAClCkB,OAAO,EAAGE,cAAgB;IAC1BO,QAAQ,EAAGL,WAAW,KAAK,CAAG;IAC9BM,sBAAsB;EAA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B;MACjCC,UAAU,EAAGA,UAAY;MACzBC,WAAW,EAAGA,WAAa;MAC3BC,WAAW,EAAGA;IAAa,CAC3B,CACD,EACCW,eAAe,EACfF,cAAc,iBACfvB,IAAA,CAACG,OAAO;MAACC,oBAAoB,EAAGA;IAAsB,CAAE,CACxD;EAAA,CACG,CAAC;AAER,CAAC;AAED,eAAegB,YAAY","ignoreList":[]}
|
|
@@ -27,27 +27,25 @@ export default function Pagination({
|
|
|
27
27
|
expanded: false,
|
|
28
28
|
spacing: 1,
|
|
29
29
|
className: "block-editor-patterns__grid-pagination-previous",
|
|
30
|
-
children: [/*#__PURE__*/_jsx(Button
|
|
31
|
-
// TODO: Switch to `true` (40px size) if possible
|
|
32
|
-
, {
|
|
33
|
-
__next40pxDefaultSize: false,
|
|
30
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
34
31
|
variant: "tertiary",
|
|
35
32
|
onClick: () => changePage(1),
|
|
36
33
|
disabled: currentPage === 1,
|
|
37
34
|
"aria-label": __('First page'),
|
|
35
|
+
size: "compact",
|
|
38
36
|
accessibleWhenDisabled: true,
|
|
37
|
+
className: "block-editor-patterns__grid-pagination-button",
|
|
39
38
|
children: /*#__PURE__*/_jsx("span", {
|
|
40
39
|
children: "\xAB"
|
|
41
40
|
})
|
|
42
|
-
}), /*#__PURE__*/_jsx(Button
|
|
43
|
-
// TODO: Switch to `true` (40px size) if possible
|
|
44
|
-
, {
|
|
45
|
-
__next40pxDefaultSize: false,
|
|
41
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
46
42
|
variant: "tertiary",
|
|
47
43
|
onClick: () => changePage(currentPage - 1),
|
|
48
44
|
disabled: currentPage === 1,
|
|
49
45
|
"aria-label": __('Previous page'),
|
|
46
|
+
size: "compact",
|
|
50
47
|
accessibleWhenDisabled: true,
|
|
48
|
+
className: "block-editor-patterns__grid-pagination-button",
|
|
51
49
|
children: /*#__PURE__*/_jsx("span", {
|
|
52
50
|
children: "\u2039"
|
|
53
51
|
})
|
|
@@ -61,15 +59,14 @@ export default function Pagination({
|
|
|
61
59
|
expanded: false,
|
|
62
60
|
spacing: 1,
|
|
63
61
|
className: "block-editor-patterns__grid-pagination-next",
|
|
64
|
-
children: [/*#__PURE__*/_jsx(Button
|
|
65
|
-
// TODO: Switch to `true` (40px size) if possible
|
|
66
|
-
, {
|
|
67
|
-
__next40pxDefaultSize: false,
|
|
62
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
68
63
|
variant: "tertiary",
|
|
69
64
|
onClick: () => changePage(currentPage + 1),
|
|
70
65
|
disabled: currentPage === numPages,
|
|
71
66
|
"aria-label": __('Next page'),
|
|
67
|
+
size: "compact",
|
|
72
68
|
accessibleWhenDisabled: true,
|
|
69
|
+
className: "block-editor-patterns__grid-pagination-button",
|
|
73
70
|
children: /*#__PURE__*/_jsx("span", {
|
|
74
71
|
children: "\u203A"
|
|
75
72
|
})
|
|
@@ -78,8 +75,9 @@ export default function Pagination({
|
|
|
78
75
|
onClick: () => changePage(numPages),
|
|
79
76
|
disabled: currentPage === numPages,
|
|
80
77
|
"aria-label": __('Last page'),
|
|
81
|
-
size: "
|
|
78
|
+
size: "compact",
|
|
82
79
|
accessibleWhenDisabled: true,
|
|
80
|
+
className: "block-editor-patterns__grid-pagination-button",
|
|
83
81
|
children: /*#__PURE__*/_jsx("span", {
|
|
84
82
|
children: "\xBB"
|
|
85
83
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalVStack","VStack","__experimentalHStack","HStack","__experimentalText","Text","Button","__","_x","_n","sprintf","jsx","_jsx","jsxs","_jsxs","Pagination","currentPage","numPages","changePage","totalItems","className","children","variant","expanded","spacing","justify","
|
|
1
|
+
{"version":3,"names":["__experimentalVStack","VStack","__experimentalHStack","HStack","__experimentalText","Text","Button","__","_x","_n","sprintf","jsx","_jsx","jsxs","_jsxs","Pagination","currentPage","numPages","changePage","totalItems","className","children","variant","expanded","spacing","justify","onClick","disabled","size","accessibleWhenDisabled"],"sources":["@wordpress/block-editor/src/components/block-patterns-paging/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n\tButton,\n} from '@wordpress/components';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\n\nexport default function Pagination( {\n\tcurrentPage,\n\tnumPages,\n\tchangePage,\n\ttotalItems,\n} ) {\n\treturn (\n\t\t<VStack className=\"block-editor-patterns__grid-pagination-wrapper\">\n\t\t\t<Text variant=\"muted\">\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: %s: Total number of patterns.\n\t\t\t\t\t_n( '%s item', '%s items', totalItems ),\n\t\t\t\t\ttotalItems\n\t\t\t\t) }\n\t\t\t</Text>\n\n\t\t\t{ numPages > 1 && (\n\t\t\t\t<HStack\n\t\t\t\t\texpanded={ false }\n\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination\"\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-previous\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\t\t\taria-label={ __( 'First page' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>«</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( currentPage - 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\t\t\taria-label={ __( 'Previous page' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>‹</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %1$s: Current page number, %2$s: Total number of pages.\n\t\t\t\t\t\t\t_x( '%1$s of %2$s', 'paging' ),\n\t\t\t\t\t\t\tcurrentPage,\n\t\t\t\t\t\t\tnumPages\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-next\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( currentPage + 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === numPages }\n\t\t\t\t\t\t\taria-label={ __( 'Next page' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>›</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( numPages ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === numPages }\n\t\t\t\t\t\t\taria-label={ __( 'Last page' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>»</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,kBAAkB,IAAIC,IAAI,EAC1BC,MAAM,QACA,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEtD,eAAe,SAASC,UAAUA,CAAE;EACnCC,WAAW;EACXC,QAAQ;EACRC,UAAU;EACVC;AACD,CAAC,EAAG;EACH,oBACCL,KAAA,CAACb,MAAM;IAACmB,SAAS,EAAC,gDAAgD;IAAAC,QAAA,gBACjET,IAAA,CAACP,IAAI;MAACiB,OAAO,EAAC,OAAO;MAAAD,QAAA,EAClBX,OAAO;MACR;MACAD,EAAE,CAAE,SAAS,EAAE,UAAU,EAAEU,UAAW,CAAC,EACvCA,UACD;IAAC,CACI,CAAC,EAELF,QAAQ,GAAG,CAAC,iBACbH,KAAA,CAACX,MAAM;MACNoB,QAAQ,EAAG,KAAO;MAClBC,OAAO,EAAG,CAAG;MACbC,OAAO,EAAC,YAAY;MACpBL,SAAS,EAAC,wCAAwC;MAAAC,QAAA,gBAElDP,KAAA,CAACX,MAAM;QACNoB,QAAQ,EAAG,KAAO;QAClBC,OAAO,EAAG,CAAG;QACbJ,SAAS,EAAC,iDAAiD;QAAAC,QAAA,gBAE3DT,IAAA,CAACN,MAAM;UACNgB,OAAO,EAAC,UAAU;UAClBI,OAAO,EAAGA,CAAA,KAAMR,UAAU,CAAE,CAAE,CAAG;UACjCS,QA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NgB,OAAO,EAAC,UAAU;UAClBI,OAAO,EAAGA,CAAA,KAAMR,UAAU,CAAED,QAAS,CAAG;UACxCU,QAAQ,EAAGX,WAAW,KAAKC,QAAU;UACrC,cAAaV,EAAE,CAAE,WAAY,CAAG;UAChCqB,IAAI,EAAC,SAAS;UACdC,sBAAsB;UACtBT,SAAS,EAAC,+CAA+C;UAAAC,QAAA,eAEzDT,IAAA;YAAAS,QAAA,EAAM;UAAC,CAAM;QAAC,CACP,CAAC;MAAA,CACF,CAAC;IAAA,CACF,CACR;EAAA,CACM,CAAC;AAEX","ignoreList":[]}
|
|
@@ -51,10 +51,8 @@ function BlockQuickNavigationItem({
|
|
|
51
51
|
const {
|
|
52
52
|
selectBlock
|
|
53
53
|
} = useDispatch(blockEditorStore);
|
|
54
|
-
return /*#__PURE__*/_jsx(Button
|
|
55
|
-
|
|
56
|
-
, {
|
|
57
|
-
__next40pxDefaultSize: false,
|
|
54
|
+
return /*#__PURE__*/_jsx(Button, {
|
|
55
|
+
__next40pxDefaultSize: true,
|
|
58
56
|
isPressed: isSelected,
|
|
59
57
|
onClick: async () => {
|
|
60
58
|
await selectBlock(clientId);
|