@wordpress/block-editor 14.3.3 → 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 +46 -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 +29 -43
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/rich-text/index.js +4 -8
- package/build/components/rich-text/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/block-bindings.js +6 -13
- package/build/hooks/block-bindings.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/hooks/use-bindings-attributes.js +5 -4
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/layouts/flex.js +6 -38
- package/build/layouts/flex.js.map +1 -1
- package/build/private-apis.js +0 -2
- package/build/private-apis.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 +50 -0
- package/build/utils/block-bindings.js.map +1 -1
- package/build/utils/index.js +7 -0
- package/build/utils/index.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 +30 -44
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +4 -8
- package/build-module/components/rich-text/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/block-bindings.js +6 -13
- package/build-module/hooks/block-bindings.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/hooks/use-bindings-attributes.js +5 -4
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/layouts/flex.js +7 -39
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/private-apis.js +0 -2
- package/build-module/private-apis.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 +50 -0
- package/build-module/utils/block-bindings.js.map +1 -1
- package/build-module/utils/index.js +1 -0
- package/build-module/utils/index.js.map +1 -1
- package/build-style/content-rtl.css +16 -70
- package/build-style/content.css +16 -70
- 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/content.scss +3 -19
- package/src/components/media-placeholder/index.js +23 -29
- package/src/components/rich-text/index.js +4 -13
- 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/block-bindings.js +9 -10
- package/src/hooks/duotone.js +4 -1
- package/src/hooks/layout-child.js +4 -1
- package/src/hooks/position.js +4 -1
- package/src/hooks/use-bindings-attributes.js +66 -63
- package/src/layouts/flex.js +10 -53
- package/src/private-apis.js +0 -2
- 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 +49 -0
- package/src/utils/index.js +1 -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
|
@@ -15,6 +15,7 @@ import { select, dispatch } from '@wordpress/data';
|
|
|
15
15
|
*/
|
|
16
16
|
import * as selectors from '../selectors';
|
|
17
17
|
import { store } from '../';
|
|
18
|
+
import { sectionRootClientIdKey } from '../private-keys';
|
|
18
19
|
import { lock } from '../../lock-unlock';
|
|
19
20
|
|
|
20
21
|
const {
|
|
@@ -2424,7 +2425,7 @@ describe( 'selectors', () => {
|
|
|
2424
2425
|
} )
|
|
2425
2426
|
),
|
|
2426
2427
|
},
|
|
2427
|
-
|
|
2428
|
+
insertionCue: {
|
|
2428
2429
|
rootClientId: undefined,
|
|
2429
2430
|
index: 0,
|
|
2430
2431
|
},
|
|
@@ -2465,7 +2466,7 @@ describe( 'selectors', () => {
|
|
|
2465
2466
|
} )
|
|
2466
2467
|
),
|
|
2467
2468
|
},
|
|
2468
|
-
|
|
2469
|
+
insertionCue: null,
|
|
2469
2470
|
};
|
|
2470
2471
|
|
|
2471
2472
|
expect( getBlockInsertionPoint( state ) ).toEqual( {
|
|
@@ -2503,7 +2504,7 @@ describe( 'selectors', () => {
|
|
|
2503
2504
|
} )
|
|
2504
2505
|
),
|
|
2505
2506
|
},
|
|
2506
|
-
|
|
2507
|
+
insertionCue: null,
|
|
2507
2508
|
};
|
|
2508
2509
|
|
|
2509
2510
|
const insertionPoint1 = getBlockInsertionPoint( state );
|
|
@@ -2545,7 +2546,7 @@ describe( 'selectors', () => {
|
|
|
2545
2546
|
} )
|
|
2546
2547
|
),
|
|
2547
2548
|
},
|
|
2548
|
-
|
|
2549
|
+
insertionCue: null,
|
|
2549
2550
|
};
|
|
2550
2551
|
|
|
2551
2552
|
expect( getBlockInsertionPoint( state ) ).toEqual( {
|
|
@@ -2587,7 +2588,7 @@ describe( 'selectors', () => {
|
|
|
2587
2588
|
} )
|
|
2588
2589
|
),
|
|
2589
2590
|
},
|
|
2590
|
-
|
|
2591
|
+
insertionCue: null,
|
|
2591
2592
|
};
|
|
2592
2593
|
|
|
2593
2594
|
expect( getBlockInsertionPoint( state ) ).toEqual( {
|
|
@@ -2629,7 +2630,7 @@ describe( 'selectors', () => {
|
|
|
2629
2630
|
} )
|
|
2630
2631
|
),
|
|
2631
2632
|
},
|
|
2632
|
-
|
|
2633
|
+
insertionCue: null,
|
|
2633
2634
|
};
|
|
2634
2635
|
|
|
2635
2636
|
expect( getBlockInsertionPoint( state ) ).toEqual( {
|
|
@@ -2642,7 +2643,7 @@ describe( 'selectors', () => {
|
|
|
2642
2643
|
describe( 'isBlockInsertionPointVisible', () => {
|
|
2643
2644
|
it( 'should return false if no assigned insertion point', () => {
|
|
2644
2645
|
const state = {
|
|
2645
|
-
|
|
2646
|
+
insertionCue: null,
|
|
2646
2647
|
};
|
|
2647
2648
|
|
|
2648
2649
|
expect( isBlockInsertionPointVisible( state ) ).toBe( false );
|
|
@@ -2650,7 +2651,7 @@ describe( 'selectors', () => {
|
|
|
2650
2651
|
|
|
2651
2652
|
it( 'should return true if assigned insertion point', () => {
|
|
2652
2653
|
const state = {
|
|
2653
|
-
|
|
2654
|
+
insertionCue: {
|
|
2654
2655
|
rootClientId: undefined,
|
|
2655
2656
|
index: 5,
|
|
2656
2657
|
},
|
|
@@ -2695,6 +2696,7 @@ describe( 'selectors', () => {
|
|
|
2695
2696
|
byClientId: new Map(),
|
|
2696
2697
|
attributes: new Map(),
|
|
2697
2698
|
parents: new Map(),
|
|
2699
|
+
order: new Map(),
|
|
2698
2700
|
},
|
|
2699
2701
|
blockListSettings: {},
|
|
2700
2702
|
settings: {
|
|
@@ -2712,6 +2714,7 @@ describe( 'selectors', () => {
|
|
|
2712
2714
|
blocks: {
|
|
2713
2715
|
byClientId: new Map(),
|
|
2714
2716
|
attributes: new Map(),
|
|
2717
|
+
order: new Map(),
|
|
2715
2718
|
},
|
|
2716
2719
|
blockListSettings: {},
|
|
2717
2720
|
settings: {
|
|
@@ -2729,6 +2732,7 @@ describe( 'selectors', () => {
|
|
|
2729
2732
|
byClientId: new Map(),
|
|
2730
2733
|
attributes: new Map(),
|
|
2731
2734
|
parents: new Map(),
|
|
2735
|
+
order: new Map(),
|
|
2732
2736
|
},
|
|
2733
2737
|
blockListSettings: {},
|
|
2734
2738
|
settings: {},
|
|
@@ -2749,6 +2753,7 @@ describe( 'selectors', () => {
|
|
|
2749
2753
|
byClientId: new Map(),
|
|
2750
2754
|
attributes: new Map(),
|
|
2751
2755
|
parents: new Map(),
|
|
2756
|
+
order: new Map(),
|
|
2752
2757
|
},
|
|
2753
2758
|
blockListSettings: {},
|
|
2754
2759
|
settings: {},
|
|
@@ -2773,6 +2778,7 @@ describe( 'selectors', () => {
|
|
|
2773
2778
|
} )
|
|
2774
2779
|
),
|
|
2775
2780
|
parents: new Map(),
|
|
2781
|
+
order: new Map(),
|
|
2776
2782
|
},
|
|
2777
2783
|
blockListSettings: {},
|
|
2778
2784
|
settings: {},
|
|
@@ -2797,6 +2803,7 @@ describe( 'selectors', () => {
|
|
|
2797
2803
|
} )
|
|
2798
2804
|
),
|
|
2799
2805
|
parents: new Map(),
|
|
2806
|
+
order: new Map(),
|
|
2800
2807
|
},
|
|
2801
2808
|
blockListSettings: {
|
|
2802
2809
|
block1: {},
|
|
@@ -2823,6 +2830,7 @@ describe( 'selectors', () => {
|
|
|
2823
2830
|
} )
|
|
2824
2831
|
),
|
|
2825
2832
|
parents: new Map(),
|
|
2833
|
+
order: new Map(),
|
|
2826
2834
|
},
|
|
2827
2835
|
blockListSettings: {
|
|
2828
2836
|
block1: {},
|
|
@@ -2849,6 +2857,7 @@ describe( 'selectors', () => {
|
|
|
2849
2857
|
} )
|
|
2850
2858
|
),
|
|
2851
2859
|
parents: new Map(),
|
|
2860
|
+
order: new Map(),
|
|
2852
2861
|
},
|
|
2853
2862
|
blockListSettings: {
|
|
2854
2863
|
block1: {
|
|
@@ -2877,6 +2886,7 @@ describe( 'selectors', () => {
|
|
|
2877
2886
|
} )
|
|
2878
2887
|
),
|
|
2879
2888
|
parents: new Map(),
|
|
2889
|
+
order: new Map(),
|
|
2880
2890
|
},
|
|
2881
2891
|
blockListSettings: {
|
|
2882
2892
|
block1: {
|
|
@@ -2905,6 +2915,7 @@ describe( 'selectors', () => {
|
|
|
2905
2915
|
} )
|
|
2906
2916
|
),
|
|
2907
2917
|
parents: new Map(),
|
|
2918
|
+
order: new Map(),
|
|
2908
2919
|
},
|
|
2909
2920
|
blockListSettings: {},
|
|
2910
2921
|
settings: {},
|
|
@@ -2933,6 +2944,7 @@ describe( 'selectors', () => {
|
|
|
2933
2944
|
} )
|
|
2934
2945
|
),
|
|
2935
2946
|
parents: new Map(),
|
|
2947
|
+
order: new Map(),
|
|
2936
2948
|
},
|
|
2937
2949
|
blockListSettings: {
|
|
2938
2950
|
block1: {
|
|
@@ -2961,6 +2973,7 @@ describe( 'selectors', () => {
|
|
|
2961
2973
|
} )
|
|
2962
2974
|
),
|
|
2963
2975
|
parents: new Map(),
|
|
2976
|
+
order: new Map(),
|
|
2964
2977
|
},
|
|
2965
2978
|
blockListSettings: {},
|
|
2966
2979
|
settings: {},
|
|
@@ -2977,6 +2990,7 @@ describe( 'selectors', () => {
|
|
|
2977
2990
|
byClientId: new Map(),
|
|
2978
2991
|
attributes: new Map(),
|
|
2979
2992
|
parents: new Map(),
|
|
2993
|
+
order: new Map(),
|
|
2980
2994
|
},
|
|
2981
2995
|
blockListSettings: {},
|
|
2982
2996
|
settings: {},
|
|
@@ -2993,7 +3007,7 @@ describe( 'selectors', () => {
|
|
|
2993
3007
|
byClientId: new Map(
|
|
2994
3008
|
Object.entries( {
|
|
2995
3009
|
block1: { name: 'core/test-block-ancestor' },
|
|
2996
|
-
block2: { name: 'core/
|
|
3010
|
+
block2: { name: 'core/block1' },
|
|
2997
3011
|
} )
|
|
2998
3012
|
),
|
|
2999
3013
|
attributes: new Map(
|
|
@@ -3007,6 +3021,10 @@ describe( 'selectors', () => {
|
|
|
3007
3021
|
block2: 'block1',
|
|
3008
3022
|
} )
|
|
3009
3023
|
),
|
|
3024
|
+
order: new Map( [
|
|
3025
|
+
[ '', [ 'block1' ] ],
|
|
3026
|
+
[ 'block1', [ 'block2' ] ],
|
|
3027
|
+
] ),
|
|
3010
3028
|
},
|
|
3011
3029
|
blockListSettings: {
|
|
3012
3030
|
block1: {},
|
|
@@ -3024,6 +3042,37 @@ describe( 'selectors', () => {
|
|
|
3024
3042
|
).toBe( true );
|
|
3025
3043
|
} );
|
|
3026
3044
|
|
|
3045
|
+
it( 'should prevent blocks from being inserted within sections', () => {
|
|
3046
|
+
const state = {
|
|
3047
|
+
blocks: {
|
|
3048
|
+
byClientId: new Map(
|
|
3049
|
+
Object.entries( {
|
|
3050
|
+
block1: { name: 'core/block' }, // reusable blocks are always sections.
|
|
3051
|
+
} )
|
|
3052
|
+
),
|
|
3053
|
+
attributes: new Map(
|
|
3054
|
+
Object.entries( {
|
|
3055
|
+
block1: {},
|
|
3056
|
+
} )
|
|
3057
|
+
),
|
|
3058
|
+
parents: new Map(
|
|
3059
|
+
Object.entries( {
|
|
3060
|
+
block1: '',
|
|
3061
|
+
} )
|
|
3062
|
+
),
|
|
3063
|
+
order: new Map( [ [ '', [ 'block1' ] ] ] ),
|
|
3064
|
+
},
|
|
3065
|
+
blockListSettings: {
|
|
3066
|
+
block1: {},
|
|
3067
|
+
},
|
|
3068
|
+
settings: {},
|
|
3069
|
+
blockEditingModes: new Map(),
|
|
3070
|
+
};
|
|
3071
|
+
expect(
|
|
3072
|
+
canInsertBlockType( state, 'core/test-block-a', 'block1' )
|
|
3073
|
+
).toBe( false );
|
|
3074
|
+
} );
|
|
3075
|
+
|
|
3027
3076
|
it( 'should allow blocks to be inserted if both parent and ancestor restrictions are met', () => {
|
|
3028
3077
|
const state = {
|
|
3029
3078
|
blocks: {
|
|
@@ -3047,6 +3096,11 @@ describe( 'selectors', () => {
|
|
|
3047
3096
|
block3: 'block2',
|
|
3048
3097
|
} )
|
|
3049
3098
|
),
|
|
3099
|
+
order: new Map( [
|
|
3100
|
+
[ '', [ 'block1' ] ],
|
|
3101
|
+
[ 'block1', [ 'block2' ] ],
|
|
3102
|
+
[ 'block2', [ 'block3' ] ],
|
|
3103
|
+
] ),
|
|
3050
3104
|
},
|
|
3051
3105
|
blockListSettings: {
|
|
3052
3106
|
block1: {},
|
|
@@ -3087,6 +3141,11 @@ describe( 'selectors', () => {
|
|
|
3087
3141
|
block3: 'block2',
|
|
3088
3142
|
} )
|
|
3089
3143
|
),
|
|
3144
|
+
order: new Map( [
|
|
3145
|
+
[ '', [ 'block1' ] ],
|
|
3146
|
+
[ 'block1', [ 'block2' ] ],
|
|
3147
|
+
[ 'block2', [ 'block3' ] ],
|
|
3148
|
+
] ),
|
|
3090
3149
|
},
|
|
3091
3150
|
blockListSettings: {
|
|
3092
3151
|
block1: {},
|
|
@@ -3127,6 +3186,11 @@ describe( 'selectors', () => {
|
|
|
3127
3186
|
block3: 'block2',
|
|
3128
3187
|
} )
|
|
3129
3188
|
),
|
|
3189
|
+
order: new Map( [
|
|
3190
|
+
[ '', [ 'block1' ] ],
|
|
3191
|
+
[ 'block1', [ 'block2' ] ],
|
|
3192
|
+
[ 'block2', [ 'block3' ] ],
|
|
3193
|
+
] ),
|
|
3130
3194
|
},
|
|
3131
3195
|
blockListSettings: {
|
|
3132
3196
|
block1: {},
|
|
@@ -3160,11 +3224,14 @@ describe( 'selectors', () => {
|
|
|
3160
3224
|
block2: {},
|
|
3161
3225
|
} )
|
|
3162
3226
|
),
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3227
|
+
order: new Map( [
|
|
3228
|
+
[ '', [ 'block1' ] ],
|
|
3229
|
+
[ 'block1', [ 'block2' ] ],
|
|
3230
|
+
] ),
|
|
3231
|
+
parents: new Map( [
|
|
3232
|
+
[ 'block2', 'block1' ],
|
|
3233
|
+
[ 'block1', '' ],
|
|
3234
|
+
] ),
|
|
3168
3235
|
},
|
|
3169
3236
|
blockListSettings: {
|
|
3170
3237
|
block1: {},
|
|
@@ -3204,6 +3271,10 @@ describe( 'selectors', () => {
|
|
|
3204
3271
|
block2: 'block1',
|
|
3205
3272
|
} )
|
|
3206
3273
|
),
|
|
3274
|
+
order: new Map( [
|
|
3275
|
+
[ '', [ 'block1' ] ],
|
|
3276
|
+
[ 'block1', [ 'block2' ] ],
|
|
3277
|
+
] ),
|
|
3207
3278
|
},
|
|
3208
3279
|
blockListSettings: {
|
|
3209
3280
|
block1: {},
|
|
@@ -3241,6 +3312,7 @@ describe( 'selectors', () => {
|
|
|
3241
3312
|
} )
|
|
3242
3313
|
),
|
|
3243
3314
|
parents: new Map(),
|
|
3315
|
+
order: new Map(),
|
|
3244
3316
|
},
|
|
3245
3317
|
blockListSettings: {
|
|
3246
3318
|
1: {
|
|
@@ -3274,6 +3346,7 @@ describe( 'selectors', () => {
|
|
|
3274
3346
|
} )
|
|
3275
3347
|
),
|
|
3276
3348
|
parents: new Map(),
|
|
3349
|
+
order: new Map(),
|
|
3277
3350
|
},
|
|
3278
3351
|
blockListSettings: {
|
|
3279
3352
|
1: {
|
|
@@ -4311,12 +4384,28 @@ describe( 'getBlockEditingMode', () => {
|
|
|
4311
4384
|
settings: {},
|
|
4312
4385
|
blocks: {
|
|
4313
4386
|
byClientId: new Map( [
|
|
4314
|
-
[
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
[
|
|
4319
|
-
|
|
4387
|
+
[
|
|
4388
|
+
'6cf70164-9097-4460-bcbf-200560546988',
|
|
4389
|
+
{ name: 'core/template-part' },
|
|
4390
|
+
], // Header
|
|
4391
|
+
[
|
|
4392
|
+
'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337',
|
|
4393
|
+
{ name: 'core/group' },
|
|
4394
|
+
], // Group
|
|
4395
|
+
[
|
|
4396
|
+
'b26fc763-417d-4f01-b81c-2ec61e14a972',
|
|
4397
|
+
{ name: 'core/post-title' },
|
|
4398
|
+
], // | Post Title
|
|
4399
|
+
[
|
|
4400
|
+
'9b9c5c3f-2e46-4f02-9e14-9fe9515b958f',
|
|
4401
|
+
{ name: 'core/group' },
|
|
4402
|
+
], // | Group
|
|
4403
|
+
[ 'b3247f75-fd94-4fef-97f9-5bfd162cc416', { name: 'core/p' } ], // | | Paragraph
|
|
4404
|
+
[ 'e178812d-ce5e-48c7-a945-8ae4ffcbbb7c', { name: 'core/p' } ], // | | Paragraph
|
|
4405
|
+
[
|
|
4406
|
+
'9b9c5c3f-2e46-4f02-9e14-9fed515b958s',
|
|
4407
|
+
{ name: 'core/group' },
|
|
4408
|
+
], // | | Group
|
|
4320
4409
|
] ),
|
|
4321
4410
|
order: new Map( [
|
|
4322
4411
|
[
|
|
@@ -4340,10 +4429,12 @@ describe( 'getBlockEditingMode', () => {
|
|
|
4340
4429
|
[
|
|
4341
4430
|
'b3247f75-fd94-4fef-97f9-5bfd162cc416',
|
|
4342
4431
|
'e178812d-ce5e-48c7-a945-8ae4ffcbbb7c',
|
|
4432
|
+
'9b9c5c3f-2e46-4f02-9e14-9fed515b958s',
|
|
4343
4433
|
],
|
|
4344
4434
|
],
|
|
4345
4435
|
[ 'b3247f75-fd94-4fef-97f9-5bfd162cc416', [] ],
|
|
4346
4436
|
[ 'e178812d-ce5e-48c7-a945-8ae4ffcbbb7c', [] ],
|
|
4437
|
+
[ '9b9c5c3f-2e46-4f02-9e14-9fed515b958s', [] ],
|
|
4347
4438
|
] ),
|
|
4348
4439
|
parents: new Map( [
|
|
4349
4440
|
[ '6cf70164-9097-4460-bcbf-200560546988', '' ],
|
|
@@ -4364,6 +4455,10 @@ describe( 'getBlockEditingMode', () => {
|
|
|
4364
4455
|
'e178812d-ce5e-48c7-a945-8ae4ffcbbb7c',
|
|
4365
4456
|
'9b9c5c3f-2e46-4f02-9e14-9fe9515b958f',
|
|
4366
4457
|
],
|
|
4458
|
+
[
|
|
4459
|
+
'9b9c5c3f-2e46-4f02-9e14-9fed515b958s',
|
|
4460
|
+
'9b9c5c3f-2e46-4f02-9e14-9fe9515b958f',
|
|
4461
|
+
],
|
|
4367
4462
|
] ),
|
|
4368
4463
|
},
|
|
4369
4464
|
blockListSettings: {
|
|
@@ -4373,6 +4468,14 @@ describe( 'getBlockEditingMode', () => {
|
|
|
4373
4468
|
blockEditingModes: new Map( [] ),
|
|
4374
4469
|
};
|
|
4375
4470
|
|
|
4471
|
+
const navigationModeStateWithRootSection = {
|
|
4472
|
+
...baseState,
|
|
4473
|
+
editorMode: 'navigation',
|
|
4474
|
+
settings: {
|
|
4475
|
+
[ sectionRootClientIdKey ]: 'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337', // The group is the "main" container
|
|
4476
|
+
},
|
|
4477
|
+
};
|
|
4478
|
+
|
|
4376
4479
|
const hasContentRoleAttribute = jest.fn( () => false );
|
|
4377
4480
|
|
|
4378
4481
|
const fauxPrivateAPIs = {};
|
|
@@ -4505,4 +4608,64 @@ describe( 'getBlockEditingMode', () => {
|
|
|
4505
4608
|
getBlockEditingMode( state, 'b3247f75-fd94-4fef-97f9-5bfd162cc416' )
|
|
4506
4609
|
).toBe( 'contentOnly' );
|
|
4507
4610
|
} );
|
|
4611
|
+
|
|
4612
|
+
it( 'in navigation mode, the root section container is default', () => {
|
|
4613
|
+
expect(
|
|
4614
|
+
getBlockEditingMode(
|
|
4615
|
+
navigationModeStateWithRootSection,
|
|
4616
|
+
'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337'
|
|
4617
|
+
)
|
|
4618
|
+
).toBe( 'default' );
|
|
4619
|
+
} );
|
|
4620
|
+
|
|
4621
|
+
it( 'in navigation mode, anything outside the section container is disabled', () => {
|
|
4622
|
+
expect(
|
|
4623
|
+
getBlockEditingMode(
|
|
4624
|
+
navigationModeStateWithRootSection,
|
|
4625
|
+
'6cf70164-9097-4460-bcbf-200560546988'
|
|
4626
|
+
)
|
|
4627
|
+
).toBe( 'disabled' );
|
|
4628
|
+
} );
|
|
4629
|
+
|
|
4630
|
+
it( 'in navigation mode, sections are contentOnly', () => {
|
|
4631
|
+
expect(
|
|
4632
|
+
getBlockEditingMode(
|
|
4633
|
+
navigationModeStateWithRootSection,
|
|
4634
|
+
'b26fc763-417d-4f01-b81c-2ec61e14a972'
|
|
4635
|
+
)
|
|
4636
|
+
).toBe( 'contentOnly' );
|
|
4637
|
+
expect(
|
|
4638
|
+
getBlockEditingMode(
|
|
4639
|
+
navigationModeStateWithRootSection,
|
|
4640
|
+
'9b9c5c3f-2e46-4f02-9e14-9fe9515b958f'
|
|
4641
|
+
)
|
|
4642
|
+
).toBe( 'contentOnly' );
|
|
4643
|
+
} );
|
|
4644
|
+
|
|
4645
|
+
it( 'in navigation mode, blocks with content attributes within sections are contentOnly', () => {
|
|
4646
|
+
hasContentRoleAttribute.mockReturnValueOnce( true );
|
|
4647
|
+
expect(
|
|
4648
|
+
getBlockEditingMode(
|
|
4649
|
+
navigationModeStateWithRootSection,
|
|
4650
|
+
'b3247f75-fd94-4fef-97f9-5bfd162cc416'
|
|
4651
|
+
)
|
|
4652
|
+
).toBe( 'contentOnly' );
|
|
4653
|
+
|
|
4654
|
+
hasContentRoleAttribute.mockReturnValueOnce( true );
|
|
4655
|
+
expect(
|
|
4656
|
+
getBlockEditingMode(
|
|
4657
|
+
navigationModeStateWithRootSection,
|
|
4658
|
+
'e178812d-ce5e-48c7-a945-8ae4ffcbbb7c'
|
|
4659
|
+
)
|
|
4660
|
+
).toBe( 'contentOnly' );
|
|
4661
|
+
} );
|
|
4662
|
+
|
|
4663
|
+
it( 'in navigation mode, blocks without content attributes within sections are disabled', () => {
|
|
4664
|
+
expect(
|
|
4665
|
+
getBlockEditingMode(
|
|
4666
|
+
navigationModeStateWithRootSection,
|
|
4667
|
+
'9b9c5c3f-2e46-4f02-9e14-9fed515b958s'
|
|
4668
|
+
)
|
|
4669
|
+
).toBe( 'disabled' );
|
|
4670
|
+
} );
|
|
4508
4671
|
} );
|
package/src/store/utils.js
CHANGED
|
@@ -10,9 +10,9 @@ import { parse as grammarParse } from '@wordpress/block-serialization-default-pa
|
|
|
10
10
|
import { selectBlockPatternsKey } from './private-keys';
|
|
11
11
|
import { unlock } from '../lock-unlock';
|
|
12
12
|
import { STORE_NAME } from './constants';
|
|
13
|
+
import { getSectionRootClientId } from './private-selectors';
|
|
13
14
|
|
|
14
|
-
export const
|
|
15
|
-
|
|
15
|
+
export const isFiltered = Symbol( 'isFiltered' );
|
|
16
16
|
const parsedPatternCache = new WeakMap();
|
|
17
17
|
const grammarMapCache = new WeakMap();
|
|
18
18
|
|
|
@@ -117,5 +117,7 @@ export function getInsertBlockTypeDependants( state, rootClientId ) {
|
|
|
117
117
|
state.settings.allowedBlockTypes,
|
|
118
118
|
state.settings.templateLock,
|
|
119
119
|
state.blockEditingModes,
|
|
120
|
+
state.editorMode,
|
|
121
|
+
getSectionRootClientId( state ),
|
|
120
122
|
];
|
|
121
123
|
}
|
|
@@ -13,6 +13,55 @@ function isObjectEmpty( object ) {
|
|
|
13
13
|
return ! object || Object.keys( object ).length === 0;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Contains utils to update the block `bindings` metadata.
|
|
18
|
+
*
|
|
19
|
+
* @typedef {Object} WPBlockBindingsUtils
|
|
20
|
+
*
|
|
21
|
+
* @property {Function} updateBlockBindings Updates the value of the bindings connected to block attributes.
|
|
22
|
+
* @property {Function} removeAllBlockBindings Removes the bindings property of the `metadata` attribute.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Retrieves the existing utils needed to update the block `bindings` metadata.
|
|
27
|
+
* They can be used to create, modify, or remove connections from the existing block attributes.
|
|
28
|
+
*
|
|
29
|
+
* It contains the following utils:
|
|
30
|
+
* - `updateBlockBindings`: Updates the value of the bindings connected to block attributes. It can be used to remove a specific binding by setting the value to `undefined`.
|
|
31
|
+
* - `removeAllBlockBindings`: Removes the bindings property of the `metadata` attribute.
|
|
32
|
+
*
|
|
33
|
+
* @since 6.7.0 Introduced in WordPress core.
|
|
34
|
+
*
|
|
35
|
+
* @return {?WPBlockBindingsUtils} Object containing the block bindings utils.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```js
|
|
39
|
+
* import { useBlockBindingsUtils } from '@wordpress/block-editor'
|
|
40
|
+
* const { updateBlockBindings, removeAllBlockBindings } = useBlockBindingsUtils();
|
|
41
|
+
*
|
|
42
|
+
* // Update url and alt attributes.
|
|
43
|
+
* updateBlockBindings( {
|
|
44
|
+
* url: {
|
|
45
|
+
* source: 'core/post-meta',
|
|
46
|
+
* args: {
|
|
47
|
+
* key: 'url_custom_field',
|
|
48
|
+
* },
|
|
49
|
+
* },
|
|
50
|
+
* alt: {
|
|
51
|
+
* source: 'core/post-meta',
|
|
52
|
+
* args: {
|
|
53
|
+
* key: 'text_custom_field',
|
|
54
|
+
* },
|
|
55
|
+
* },
|
|
56
|
+
* } );
|
|
57
|
+
*
|
|
58
|
+
* // Remove binding from url attribute.
|
|
59
|
+
* updateBlockBindings( { url: undefined } );
|
|
60
|
+
*
|
|
61
|
+
* // Remove bindings from all attributes.
|
|
62
|
+
* removeAllBlockBindings();
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
16
65
|
export function useBlockBindingsUtils() {
|
|
17
66
|
const { clientId } = useBlockEditContext();
|
|
18
67
|
const { updateBlockAttributes } = useDispatch( blockEditorStore );
|
package/src/utils/index.js
CHANGED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.useHasAnyBlockControls = useHasAnyBlockControls;
|
|
8
|
-
exports.useHasBlockControls = useHasBlockControls;
|
|
9
|
-
var _components = require("@wordpress/components");
|
|
10
|
-
var _warning = _interopRequireDefault(require("@wordpress/warning"));
|
|
11
|
-
var _groups = _interopRequireDefault(require("./groups"));
|
|
12
|
-
/**
|
|
13
|
-
* WordPress dependencies
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Internal dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
function useHasAnyBlockControls() {
|
|
21
|
-
let hasAnyBlockControls = false;
|
|
22
|
-
for (const group in _groups.default) {
|
|
23
|
-
// It is safe to violate the rules of hooks here as the `groups` object
|
|
24
|
-
// is static and will not change length between renders. Do not return
|
|
25
|
-
// early as that will cause the hook to be called a different number of
|
|
26
|
-
// times between renders.
|
|
27
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
28
|
-
if (useHasBlockControls(group)) {
|
|
29
|
-
hasAnyBlockControls = true;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return hasAnyBlockControls;
|
|
33
|
-
}
|
|
34
|
-
function useHasBlockControls(group = 'default') {
|
|
35
|
-
const Slot = _groups.default[group]?.Slot;
|
|
36
|
-
const fills = (0, _components.__experimentalUseSlotFills)(Slot?.__unstableName);
|
|
37
|
-
if (!Slot) {
|
|
38
|
-
globalThis.SCRIPT_DEBUG === true ? (0, _warning.default)(`Unknown BlockControls group "${group}" provided.`) : void 0;
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
return !!fills?.length;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=use-has-block-controls.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_warning","_interopRequireDefault","_groups","useHasAnyBlockControls","hasAnyBlockControls","group","groups","useHasBlockControls","Slot","fills","useSlotFills","__unstableName","globalThis","SCRIPT_DEBUG","warning","length"],"sources":["@wordpress/block-editor/src/components/block-controls/use-has-block-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalUseSlotFills as useSlotFills } from '@wordpress/components';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport groups from './groups';\n\nexport function useHasAnyBlockControls() {\n\tlet hasAnyBlockControls = false;\n\tfor ( const group in groups ) {\n\t\t// It is safe to violate the rules of hooks here as the `groups` object\n\t\t// is static and will not change length between renders. Do not return\n\t\t// early as that will cause the hook to be called a different number of\n\t\t// times between renders.\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tif ( useHasBlockControls( group ) ) {\n\t\t\thasAnyBlockControls = true;\n\t\t}\n\t}\n\treturn hasAnyBlockControls;\n}\n\nexport function useHasBlockControls( group = 'default' ) {\n\tconst Slot = groups[ group ]?.Slot;\n\tconst fills = useSlotFills( Slot?.__unstableName );\n\tif ( ! Slot ) {\n\t\twarning( `Unknown BlockControls group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\treturn !! fills?.length;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGO,SAASI,sBAAsBA,CAAA,EAAG;EACxC,IAAIC,mBAAmB,GAAG,KAAK;EAC/B,KAAM,MAAMC,KAAK,IAAIC,eAAM,EAAG;IAC7B;IACA;IACA;IACA;IACA;IACA,IAAKC,mBAAmB,CAAEF,KAAM,CAAC,EAAG;MACnCD,mBAAmB,GAAG,IAAI;IAC3B;EACD;EACA,OAAOA,mBAAmB;AAC3B;AAEO,SAASG,mBAAmBA,CAAEF,KAAK,GAAG,SAAS,EAAG;EACxD,MAAMG,IAAI,GAAGF,eAAM,CAAED,KAAK,CAAE,EAAEG,IAAI;EAClC,MAAMC,KAAK,GAAG,IAAAC,sCAAY,EAAEF,IAAI,EAAEG,cAAe,CAAC;EAClD,IAAK,CAAEH,IAAI,EAAG;IACbI,UAAA,CAAAC,YAAA,gBAAAC,gBAAO,EAAG,gCAAgCT,KAAO,aAAa,CAAC;IAC/D,OAAO,IAAI;EACZ;EACA,OAAO,CAAC,CAAEI,KAAK,EAAEM,MAAM;AACxB","ignoreList":[]}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useNavModeExit = useNavModeExit;
|
|
7
|
-
var _data = require("@wordpress/data");
|
|
8
|
-
var _compose = require("@wordpress/compose");
|
|
9
|
-
var _store = require("../../../store");
|
|
10
|
-
/**
|
|
11
|
-
* WordPress dependencies
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Internal dependencies
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Allows navigation mode to be exited by clicking in the selected block.
|
|
20
|
-
*
|
|
21
|
-
* @param {string} clientId Block client ID.
|
|
22
|
-
*/
|
|
23
|
-
function useNavModeExit(clientId) {
|
|
24
|
-
const {
|
|
25
|
-
isNavigationMode,
|
|
26
|
-
isBlockSelected
|
|
27
|
-
} = (0, _data.useSelect)(_store.store);
|
|
28
|
-
const {
|
|
29
|
-
setNavigationMode,
|
|
30
|
-
selectBlock
|
|
31
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
32
|
-
return (0, _compose.useRefEffect)(node => {
|
|
33
|
-
function onMouseDown(event) {
|
|
34
|
-
// Don't select a block if it's already handled by a child
|
|
35
|
-
// block.
|
|
36
|
-
if (isNavigationMode() && !event.defaultPrevented) {
|
|
37
|
-
// Prevent focus from moving to the block.
|
|
38
|
-
event.preventDefault();
|
|
39
|
-
|
|
40
|
-
// When clicking on a selected block, exit navigation mode.
|
|
41
|
-
if (isBlockSelected(clientId)) {
|
|
42
|
-
setNavigationMode(false);
|
|
43
|
-
} else {
|
|
44
|
-
selectBlock(clientId);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
node.addEventListener('mousedown', onMouseDown);
|
|
49
|
-
return () => {
|
|
50
|
-
node.removeEventListener('mousedown', onMouseDown);
|
|
51
|
-
};
|
|
52
|
-
}, [clientId, isNavigationMode, isBlockSelected, setNavigationMode]);
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=use-nav-mode-exit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_compose","_store","useNavModeExit","clientId","isNavigationMode","isBlockSelected","useSelect","blockEditorStore","setNavigationMode","selectBlock","useDispatch","useRefEffect","node","onMouseDown","event","defaultPrevented","preventDefault","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-nav-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';\n\n/**\n * Allows navigation mode to be exited by clicking in the selected block.\n *\n * @param {string} clientId Block client ID.\n */\nexport function useNavModeExit( clientId ) {\n\tconst { isNavigationMode, isBlockSelected } = useSelect( blockEditorStore );\n\tconst { setNavigationMode, selectBlock } = useDispatch( blockEditorStore );\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tfunction onMouseDown( event ) {\n\t\t\t\t// Don't select a block if it's already handled by a child\n\t\t\t\t// block.\n\t\t\t\tif ( isNavigationMode() && ! event.defaultPrevented ) {\n\t\t\t\t\t// Prevent focus from moving to the block.\n\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t// When clicking on a selected block, exit navigation mode.\n\t\t\t\t\tif ( isBlockSelected( clientId ) ) {\n\t\t\t\t\t\tsetNavigationMode( false );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tselectBlock( clientId );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'mousedown', onMouseDown );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'mousedown', onMouseDown );\n\t\t\t};\n\t\t},\n\t\t[ clientId, isNavigationMode, isBlockSelected, setNavigationMode ]\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACO,SAASG,cAAcA,CAAEC,QAAQ,EAAG;EAC1C,MAAM;IAAEC,gBAAgB;IAAEC;EAAgB,CAAC,GAAG,IAAAC,eAAS,EAAEC,YAAiB,CAAC;EAC3E,MAAM;IAAEC,iBAAiB;IAAEC;EAAY,CAAC,GAAG,IAAAC,iBAAW,EAAEH,YAAiB,CAAC;EAC1E,OAAO,IAAAI,qBAAY,EAChBC,IAAI,IAAM;IACX,SAASC,WAAWA,CAAEC,KAAK,EAAG;MAC7B;MACA;MACA,IAAKV,gBAAgB,CAAC,CAAC,IAAI,CAAEU,KAAK,CAACC,gBAAgB,EAAG;QACrD;QACAD,KAAK,CAACE,cAAc,CAAC,CAAC;;QAEtB;QACA,IAAKX,eAAe,CAAEF,QAAS,CAAC,EAAG;UAClCK,iBAAiB,CAAE,KAAM,CAAC;QAC3B,CAAC,MAAM;UACNC,WAAW,CAAEN,QAAS,CAAC;QACxB;MACD;IACD;IAEAS,IAAI,CAACK,gBAAgB,CAAE,WAAW,EAAEJ,WAAY,CAAC;IAEjD,OAAO,MAAM;MACZD,IAAI,CAACM,mBAAmB,CAAE,WAAW,EAAEL,WAAY,CAAC;IACrD,CAAC;EACF,CAAC,EACD,CAAEV,QAAQ,EAAEC,gBAAgB,EAAEC,eAAe,EAAEG,iBAAiB,CACjE,CAAC;AACF","ignoreList":[]}
|