@wordpress/block-editor 15.11.0 → 15.12.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/build/components/block-breadcrumb/index.cjs +10 -2
- package/build/components/block-breadcrumb/index.cjs.map +2 -2
- package/build/components/block-controls/index.cjs +1 -1
- package/build/components/block-controls/index.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +8 -21
- package/build/components/block-inspector/index.cjs.map +3 -3
- package/build/components/block-list/block.cjs +6 -3
- package/build/components/block-list/block.cjs.map +3 -3
- package/build/components/block-list/index.cjs +26 -18
- package/build/components/block-list/index.cjs.map +2 -2
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.cjs +39 -19
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.cjs.map +2 -2
- package/build/components/block-list/use-in-between-inserter.cjs +4 -4
- package/build/components/block-list/use-in-between-inserter.cjs.map +2 -2
- package/build/components/block-settings-menu/block-settings-dropdown.cjs +10 -7
- package/build/components/block-settings-menu/block-settings-dropdown.cjs.map +2 -2
- package/build/components/block-settings-menu-controls/edit-section-menu-item.cjs +1 -1
- package/build/components/block-settings-menu-controls/edit-section-menu-item.cjs.map +2 -2
- package/build/components/block-settings-menu-controls/index.cjs +11 -16
- package/build/components/block-settings-menu-controls/index.cjs.map +2 -2
- package/build/components/block-toolbar/block-toolbar-icon.cjs +6 -4
- package/build/components/block-toolbar/block-toolbar-icon.cjs.map +2 -2
- package/build/components/block-toolbar/index.cjs +2 -2
- package/build/components/block-toolbar/index.cjs.map +2 -2
- package/build/components/block-tools/index.cjs +2 -26
- package/build/components/block-tools/index.cjs.map +2 -2
- package/build/components/block-variation-transforms/index.cjs +1 -2
- package/build/components/block-variation-transforms/index.cjs.map +2 -2
- package/build/components/block-visibility/index.cjs +7 -9
- package/build/components/block-visibility/index.cjs.map +3 -3
- package/build/components/block-visibility/modal.cjs +18 -103
- package/build/components/block-visibility/modal.cjs.map +2 -2
- package/build/components/block-visibility/use-block-visibility.cjs +1 -1
- package/build/components/block-visibility/use-block-visibility.cjs.map +2 -2
- package/build/components/block-visibility/utils.cjs +5 -1
- package/build/components/block-visibility/utils.cjs.map +2 -2
- package/build/components/block-visibility/viewport-menu-item.cjs +11 -4
- package/build/components/block-visibility/viewport-menu-item.cjs.map +2 -2
- package/build/components/block-visibility/viewport-toolbar.cjs +4 -6
- package/build/components/block-visibility/viewport-toolbar.cjs.map +2 -2
- package/build/components/block-visibility/viewport-visibility-info.cjs +121 -0
- package/build/components/block-visibility/viewport-visibility-info.cjs.map +7 -0
- package/build/components/color-palette/with-color-context.cjs +1 -1
- package/build/components/color-palette/with-color-context.cjs.map +2 -2
- package/build/components/color-style-selector/index.cjs +1 -1
- package/build/components/color-style-selector/index.cjs.map +2 -2
- package/build/components/colors/with-colors.cjs +5 -3
- package/build/components/colors/with-colors.cjs.map +2 -2
- package/build/components/colors-gradients/dropdown.cjs +1 -1
- package/build/components/colors-gradients/dropdown.cjs.map +2 -2
- package/build/components/editable-text/index.cjs +5 -1
- package/build/components/editable-text/index.cjs.map +2 -2
- package/build/components/font-sizes/with-font-sizes.cjs +5 -3
- package/build/components/font-sizes/with-font-sizes.cjs.map +2 -2
- package/build/components/global-styles/advanced-panel.cjs +26 -13
- package/build/components/global-styles/advanced-panel.cjs.map +2 -2
- package/build/components/global-styles/filters-panel.cjs +1 -1
- package/build/components/global-styles/filters-panel.cjs.map +2 -2
- package/build/components/global-styles/shadow-panel-components.cjs +1 -1
- package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
- package/build/components/gradients/with-gradient.cjs +1 -1
- package/build/components/gradients/with-gradient.cjs.map +2 -2
- package/build/components/inserter/index.cjs +1 -0
- package/build/components/inserter/index.cjs.map +2 -2
- package/build/components/inspector-controls/fill.cjs +12 -2
- package/build/components/inspector-controls/fill.cjs.map +2 -2
- package/build/components/inspector-controls/index.cjs +1 -1
- package/build/components/inspector-controls/index.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/index.cjs +3 -3
- package/build/components/inspector-controls-tabs/index.cjs.map +3 -3
- package/build/components/inspector-controls-tabs/styles-tab.cjs +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs +2 -2
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs.map +2 -2
- package/build/components/list-view/block-select-button.cjs +8 -16
- package/build/components/list-view/block-select-button.cjs.map +2 -2
- package/build/components/list-view/block.cjs +29 -34
- package/build/components/list-view/block.cjs.map +3 -3
- package/build/components/list-view/utils.cjs +3 -1
- package/build/components/list-view/utils.cjs.map +2 -2
- package/build/components/media-replace-flow/index.cjs +2 -2
- package/build/components/media-replace-flow/index.cjs.map +2 -2
- package/build/components/provider/index.cjs +7 -8
- package/build/components/provider/index.cjs.map +2 -2
- package/build/components/provider/with-registry-provider.cjs +1 -1
- package/build/components/provider/with-registry-provider.cjs.map +2 -2
- package/build/components/rich-text/index.cjs +1 -1
- package/build/components/rich-text/index.cjs.map +2 -2
- package/build/components/use-block-commands/index.cjs +2 -34
- package/build/components/use-block-commands/index.cjs.map +2 -2
- package/build/components/use-block-display-information/index.cjs +1 -1
- package/build/components/use-block-display-information/index.cjs.map +2 -2
- package/build/components/writing-flow/index.cjs +2 -0
- package/build/components/writing-flow/index.cjs.map +2 -2
- package/build/components/writing-flow/use-arrow-nav.cjs +3 -0
- package/build/components/writing-flow/use-arrow-nav.cjs.map +2 -2
- package/build/components/writing-flow/use-drag-selection.cjs +2 -1
- package/build/components/writing-flow/use-drag-selection.cjs.map +2 -2
- package/build/components/writing-flow/use-preview-mode-nav.cjs +92 -0
- package/build/components/writing-flow/use-preview-mode-nav.cjs.map +7 -0
- package/build/hooks/block-renaming.cjs +1 -1
- package/build/hooks/block-renaming.cjs.map +2 -2
- package/build/hooks/cross-origin-isolation.cjs +1 -1
- package/build/hooks/cross-origin-isolation.cjs.map +2 -2
- package/build/hooks/custom-css.cjs +141 -0
- package/build/hooks/custom-css.cjs.map +7 -0
- package/build/hooks/fit-text.cjs +14 -7
- package/build/hooks/fit-text.cjs.map +2 -2
- package/build/hooks/grid-visualizer.cjs +1 -1
- package/build/hooks/grid-visualizer.cjs.map +2 -2
- package/build/hooks/index.cjs +4 -2
- package/build/hooks/index.cjs.map +3 -3
- package/build/hooks/layout.cjs +10 -4
- package/build/hooks/layout.cjs.map +2 -2
- package/build/hooks/list-view.cjs +9 -5
- package/build/hooks/list-view.cjs.map +3 -3
- package/build/hooks/utils.cjs +2 -2
- package/build/hooks/utils.cjs.map +2 -2
- package/build/layouts/grid.cjs +12 -1
- package/build/layouts/grid.cjs.map +2 -2
- package/build/store/actions.cjs +5 -0
- package/build/store/actions.cjs.map +2 -2
- package/build/store/defaults.cjs +3 -0
- package/build/store/defaults.cjs.map +2 -2
- package/build/store/private-selectors.cjs +46 -38
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +5 -7
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +15 -0
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/fit-text-utils.cjs +18 -4
- package/build/utils/fit-text-utils.cjs.map +2 -2
- package/build-module/components/block-breadcrumb/index.mjs +10 -2
- package/build-module/components/block-breadcrumb/index.mjs.map +2 -2
- package/build-module/components/block-controls/index.mjs +1 -1
- package/build-module/components/block-controls/index.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +8 -21
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-list/block.mjs +6 -3
- package/build-module/components/block-list/block.mjs.map +3 -3
- package/build-module/components/block-list/index.mjs +26 -18
- package/build-module/components/block-list/index.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.mjs +39 -19
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.mjs.map +2 -2
- package/build-module/components/block-list/use-in-between-inserter.mjs +4 -4
- package/build-module/components/block-list/use-in-between-inserter.mjs.map +2 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.mjs +10 -7
- package/build-module/components/block-settings-menu/block-settings-dropdown.mjs.map +2 -2
- package/build-module/components/block-settings-menu-controls/edit-section-menu-item.mjs +1 -1
- package/build-module/components/block-settings-menu-controls/edit-section-menu-item.mjs.map +2 -2
- package/build-module/components/block-settings-menu-controls/index.mjs +12 -17
- package/build-module/components/block-settings-menu-controls/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/block-toolbar-icon.mjs +6 -4
- package/build-module/components/block-toolbar/block-toolbar-icon.mjs.map +2 -2
- package/build-module/components/block-toolbar/index.mjs +3 -3
- package/build-module/components/block-toolbar/index.mjs.map +2 -2
- package/build-module/components/block-tools/index.mjs +2 -26
- package/build-module/components/block-tools/index.mjs.map +2 -2
- package/build-module/components/block-variation-transforms/index.mjs +1 -2
- package/build-module/components/block-variation-transforms/index.mjs.map +2 -2
- package/build-module/components/block-visibility/index.mjs +6 -9
- package/build-module/components/block-visibility/index.mjs.map +2 -2
- package/build-module/components/block-visibility/modal.mjs +18 -103
- package/build-module/components/block-visibility/modal.mjs.map +2 -2
- package/build-module/components/block-visibility/use-block-visibility.mjs +1 -1
- package/build-module/components/block-visibility/use-block-visibility.mjs.map +2 -2
- package/build-module/components/block-visibility/utils.mjs +5 -1
- package/build-module/components/block-visibility/utils.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-menu-item.mjs +11 -4
- package/build-module/components/block-visibility/viewport-menu-item.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-toolbar.mjs +4 -6
- package/build-module/components/block-visibility/viewport-toolbar.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-visibility-info.mjs +95 -0
- package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +7 -0
- package/build-module/components/color-palette/with-color-context.mjs +1 -1
- package/build-module/components/color-palette/with-color-context.mjs.map +2 -2
- package/build-module/components/color-style-selector/index.mjs +1 -1
- package/build-module/components/color-style-selector/index.mjs.map +2 -2
- package/build-module/components/colors/with-colors.mjs +5 -3
- package/build-module/components/colors/with-colors.mjs.map +2 -2
- package/build-module/components/colors-gradients/dropdown.mjs +1 -1
- package/build-module/components/colors-gradients/dropdown.mjs.map +2 -2
- package/build-module/components/editable-text/index.mjs +5 -1
- package/build-module/components/editable-text/index.mjs.map +2 -2
- package/build-module/components/font-sizes/with-font-sizes.mjs +5 -3
- package/build-module/components/font-sizes/with-font-sizes.mjs.map +2 -2
- package/build-module/components/global-styles/advanced-panel.mjs +22 -13
- package/build-module/components/global-styles/advanced-panel.mjs.map +2 -2
- package/build-module/components/global-styles/filters-panel.mjs +1 -1
- package/build-module/components/global-styles/filters-panel.mjs.map +2 -2
- package/build-module/components/global-styles/shadow-panel-components.mjs +1 -1
- package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
- package/build-module/components/gradients/with-gradient.mjs +1 -1
- package/build-module/components/gradients/with-gradient.mjs.map +2 -2
- package/build-module/components/inserter/index.mjs +1 -0
- package/build-module/components/inserter/index.mjs.map +2 -2
- package/build-module/components/inspector-controls/fill.mjs +12 -2
- package/build-module/components/inspector-controls/fill.mjs.map +2 -2
- package/build-module/components/inspector-controls/index.mjs +1 -1
- package/build-module/components/inspector-controls/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/index.mjs +3 -3
- package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs +2 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs.map +2 -2
- package/build-module/components/list-view/block-select-button.mjs +8 -16
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/block.mjs +31 -36
- package/build-module/components/list-view/block.mjs.map +2 -2
- package/build-module/components/list-view/utils.mjs +3 -1
- package/build-module/components/list-view/utils.mjs.map +2 -2
- package/build-module/components/media-replace-flow/index.mjs +2 -2
- package/build-module/components/media-replace-flow/index.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +7 -8
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/with-registry-provider.mjs +1 -1
- package/build-module/components/provider/with-registry-provider.mjs.map +2 -2
- package/build-module/components/rich-text/index.mjs +1 -1
- package/build-module/components/rich-text/index.mjs.map +2 -2
- package/build-module/components/use-block-commands/index.mjs +3 -37
- package/build-module/components/use-block-commands/index.mjs.map +2 -2
- package/build-module/components/use-block-display-information/index.mjs +1 -1
- package/build-module/components/use-block-display-information/index.mjs.map +2 -2
- package/build-module/components/writing-flow/index.mjs +2 -0
- package/build-module/components/writing-flow/index.mjs.map +2 -2
- package/build-module/components/writing-flow/use-arrow-nav.mjs +3 -0
- package/build-module/components/writing-flow/use-arrow-nav.mjs.map +2 -2
- package/build-module/components/writing-flow/use-drag-selection.mjs +2 -1
- package/build-module/components/writing-flow/use-drag-selection.mjs.map +2 -2
- package/build-module/components/writing-flow/use-preview-mode-nav.mjs +67 -0
- package/build-module/components/writing-flow/use-preview-mode-nav.mjs.map +7 -0
- package/build-module/hooks/block-renaming.mjs +1 -1
- package/build-module/hooks/block-renaming.mjs.map +2 -2
- package/build-module/hooks/cross-origin-isolation.mjs +1 -1
- package/build-module/hooks/cross-origin-isolation.mjs.map +2 -2
- package/build-module/hooks/custom-css.mjs +112 -0
- package/build-module/hooks/custom-css.mjs.map +7 -0
- package/build-module/hooks/fit-text.mjs +14 -7
- package/build-module/hooks/fit-text.mjs.map +2 -2
- package/build-module/hooks/grid-visualizer.mjs +1 -1
- package/build-module/hooks/grid-visualizer.mjs.map +2 -2
- package/build-module/hooks/index.mjs +4 -2
- package/build-module/hooks/index.mjs.map +2 -2
- package/build-module/hooks/layout.mjs +10 -4
- package/build-module/hooks/layout.mjs.map +2 -2
- package/build-module/hooks/list-view.mjs +10 -6
- package/build-module/hooks/list-view.mjs.map +2 -2
- package/build-module/hooks/utils.mjs +2 -2
- package/build-module/hooks/utils.mjs.map +2 -2
- package/build-module/layouts/grid.mjs +12 -1
- package/build-module/layouts/grid.mjs.map +2 -2
- package/build-module/store/actions.mjs +5 -0
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/defaults.mjs +3 -0
- package/build-module/store/defaults.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +43 -41
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +5 -7
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +15 -0
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/fit-text-utils.mjs +18 -4
- package/build-module/utils/fit-text-utils.mjs.map +2 -2
- package/build-style/content-rtl.css +10 -0
- package/build-style/content.css +10 -0
- package/build-style/style-rtl.css +3 -0
- package/build-style/style.css +3 -0
- package/package.json +39 -39
- package/src/components/block-breadcrumb/index.js +6 -1
- package/src/components/block-controls/index.js +1 -1
- package/src/components/block-controls/test/index.js +1 -0
- package/src/components/block-edit/test/edit.js +10 -0
- package/src/components/block-inspector/index.js +15 -36
- package/src/components/block-list/block.js +5 -2
- package/src/components/block-list/content.scss +11 -0
- package/src/components/block-list/index.js +25 -17
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +51 -36
- package/src/components/block-list/use-in-between-inserter.js +8 -6
- package/src/components/block-preview/test/index.js +11 -7
- package/src/components/block-settings-menu/block-settings-dropdown.js +11 -6
- package/src/components/block-settings-menu-controls/edit-section-menu-item.js +1 -7
- package/src/components/block-settings-menu-controls/index.js +16 -18
- package/src/components/block-switcher/test/index.js +2 -0
- package/src/components/block-switcher/test/use-transformed.patterns.js +2 -0
- package/src/components/block-switcher/test/utils.js +2 -0
- package/src/components/block-toolbar/block-toolbar-icon.js +6 -10
- package/src/components/block-toolbar/index.js +3 -9
- package/src/components/block-tools/index.js +2 -29
- package/src/components/block-variation-transforms/index.js +1 -4
- package/src/components/block-visibility/index.js +3 -19
- package/src/components/block-visibility/modal.js +16 -14
- package/src/components/block-visibility/test/use-block-visibility.js +27 -25
- package/src/components/block-visibility/test/utils.js +24 -8
- package/src/components/block-visibility/use-block-visibility.js +1 -4
- package/src/components/block-visibility/utils.js +9 -1
- package/src/components/block-visibility/viewport-menu-item.js +11 -5
- package/src/components/block-visibility/viewport-toolbar.js +5 -6
- package/src/components/block-visibility/viewport-visibility-info.js +131 -0
- package/src/components/color-palette/with-color-context.js +1 -1
- package/src/components/color-style-selector/index.js +2 -3
- package/src/components/colors/with-colors.js +23 -20
- package/src/components/colors-gradients/dropdown.js +2 -3
- package/src/components/editable-text/index.js +5 -1
- package/src/components/font-sizes/with-font-sizes.js +13 -10
- package/src/components/global-styles/advanced-panel.js +35 -16
- package/src/components/global-styles/filters-panel.js +2 -3
- package/src/components/global-styles/shadow-panel-components.js +1 -1
- package/src/components/global-styles/style.scss +9 -5
- package/src/components/gradients/with-gradient.js +7 -4
- package/src/components/inner-blocks/test/index.js +2 -0
- package/src/components/inserter/index.js +1 -0
- package/src/components/inserter/stories/index.story.jsx +31 -24
- package/src/components/inspector-controls/fill.js +25 -5
- package/src/components/inspector-controls/index.js +1 -1
- package/src/components/inspector-controls-tabs/index.js +6 -2
- package/src/components/inspector-controls-tabs/styles-tab.js +7 -8
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -4
- package/src/components/link-control/test/index.js +6 -1
- package/src/components/list-view/block-select-button.js +16 -25
- package/src/components/list-view/block.js +38 -43
- package/src/components/list-view/utils.js +4 -2
- package/src/components/media-replace-flow/index.js +3 -3
- package/src/components/media-replace-flow/test/index.js +13 -11
- package/src/components/provider/index.js +11 -10
- package/src/components/provider/test/use-block-sync.js +1 -0
- package/src/components/provider/with-registry-provider.js +1 -1
- package/src/components/rich-text/index.js +1 -1
- package/src/components/use-block-commands/index.js +0 -41
- package/src/components/use-block-display-information/index.js +1 -5
- package/src/components/writing-flow/index.js +2 -0
- package/src/components/writing-flow/use-arrow-nav.js +5 -0
- package/src/components/writing-flow/use-drag-selection.js +7 -1
- package/src/components/writing-flow/use-preview-mode-nav.js +102 -0
- package/src/hooks/block-renaming.js +5 -2
- package/src/hooks/cross-origin-isolation.js +19 -18
- package/src/hooks/custom-css.js +176 -0
- package/src/hooks/fit-text.js +20 -5
- package/src/hooks/grid-visualizer.js +15 -14
- package/src/hooks/index.js +4 -2
- package/src/hooks/layout.js +55 -43
- package/src/hooks/list-view.js +10 -6
- package/src/hooks/test/align.js +1 -0
- package/src/hooks/test/allowed-blocks.js +8 -0
- package/src/hooks/test/auto-inspector-controls.js +4 -0
- package/src/hooks/test/font-size.js +1 -0
- package/src/hooks/test/metadata.js +4 -0
- package/src/hooks/test/text-align.js +1 -0
- package/src/hooks/utils.js +123 -119
- package/src/layouts/grid.js +19 -3
- package/src/layouts/test/grid.js +1 -1
- package/src/store/actions.js +7 -0
- package/src/store/defaults.js +4 -0
- package/src/store/private-selectors.js +94 -64
- package/src/store/reducer.js +11 -18
- package/src/store/selectors.js +25 -0
- package/src/store/test/actions.js +7 -0
- package/src/store/test/private-selectors.js +116 -119
- package/src/store/test/reducer.js +262 -266
- package/src/store/test/registry-selectors.js +2 -0
- package/src/store/test/selectors.js +19 -0
- package/src/utils/fit-text-utils.js +31 -5
- package/build/components/block-visibility/block-visibility-info.cjs +0 -63
- package/build/components/block-visibility/block-visibility-info.cjs.map +0 -7
- package/build/components/block-visibility/menu-item.cjs +0 -109
- package/build/components/block-visibility/menu-item.cjs.map +0 -7
- package/build/components/block-visibility/toolbar.cjs +0 -92
- package/build/components/block-visibility/toolbar.cjs.map +0 -7
- package/build/components/content-lock/index.cjs +0 -31
- package/build/components/content-lock/index.cjs.map +0 -7
- package/build/components/content-lock/modify-content-lock-menu-item.cjs +0 -70
- package/build/components/content-lock/modify-content-lock-menu-item.cjs.map +0 -7
- package/build/hooks/content-lock-ui.cjs +0 -68
- package/build/hooks/content-lock-ui.cjs.map +0 -7
- package/build-module/components/block-visibility/block-visibility-info.mjs +0 -47
- package/build-module/components/block-visibility/block-visibility-info.mjs.map +0 -7
- package/build-module/components/block-visibility/menu-item.mjs +0 -88
- package/build-module/components/block-visibility/menu-item.mjs.map +0 -7
- package/build-module/components/block-visibility/toolbar.mjs +0 -71
- package/build-module/components/block-visibility/toolbar.mjs.map +0 -7
- package/build-module/components/content-lock/index.mjs +0 -6
- package/build-module/components/content-lock/index.mjs.map +0 -7
- package/build-module/components/content-lock/modify-content-lock-menu-item.mjs +0 -45
- package/build-module/components/content-lock/modify-content-lock-menu-item.mjs.map +0 -7
- package/build-module/hooks/content-lock-ui.mjs +0 -47
- package/build-module/hooks/content-lock-ui.mjs.map +0 -7
- package/src/components/block-visibility/block-visibility-info.js +0 -62
- package/src/components/block-visibility/menu-item.js +0 -96
- package/src/components/block-visibility/toolbar.js +0 -88
- package/src/components/content-lock/index.js +0 -1
- package/src/components/content-lock/modify-content-lock-menu-item.js +0 -67
- package/src/hooks/content-lock-ui.js +0 -76
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
+
import { isReusableBlock, isTemplatePart } from '@wordpress/blocks';
|
|
4
5
|
import { isTextField } from '@wordpress/dom';
|
|
5
6
|
import { ENTER, BACKSPACE, DELETE } from '@wordpress/keycodes';
|
|
6
7
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
@@ -31,6 +32,7 @@ export function useEventHandlers( { clientId, isSelected } ) {
|
|
|
31
32
|
hasMultiSelection,
|
|
32
33
|
isSectionBlock,
|
|
33
34
|
editedContentOnlySection,
|
|
35
|
+
getBlock,
|
|
34
36
|
} = unlock( useSelect( blockEditorStore ) );
|
|
35
37
|
const {
|
|
36
38
|
insertAfterBlock,
|
|
@@ -128,15 +130,13 @@ export function useEventHandlers( { clientId, isSelected } ) {
|
|
|
128
130
|
|
|
129
131
|
const rect = node.getBoundingClientRect();
|
|
130
132
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
// Maybe remove the clone now that it's relative?
|
|
134
|
-
clone.style.display = 'none';
|
|
135
|
-
|
|
136
|
-
// Remove the id and leave it on the clone so that drop target
|
|
137
|
-
// calculations are correct.
|
|
133
|
+
// Remove the id and leave it on a shallow clone so that drop
|
|
134
|
+
// target calculations are correct.
|
|
138
135
|
const id = node.id;
|
|
136
|
+
const clone = node.cloneNode();
|
|
137
|
+
clone.style.display = 'none';
|
|
139
138
|
node.id = null;
|
|
139
|
+
node.after( clone );
|
|
140
140
|
|
|
141
141
|
let _scale = 1;
|
|
142
142
|
|
|
@@ -154,8 +154,6 @@ export function useEventHandlers( { clientId, isSelected } ) {
|
|
|
154
154
|
|
|
155
155
|
const inverted = 1 / _scale;
|
|
156
156
|
|
|
157
|
-
node.after( clone );
|
|
158
|
-
|
|
159
157
|
const originalNodeProperties = {};
|
|
160
158
|
for ( const property of [
|
|
161
159
|
'transform',
|
|
@@ -225,32 +223,41 @@ export function useEventHandlers( { clientId, isSelected } ) {
|
|
|
225
223
|
}
|
|
226
224
|
|
|
227
225
|
let hasStarted = false;
|
|
226
|
+
let lastClientX = originClientX;
|
|
227
|
+
let lastClientY = originClientY;
|
|
228
|
+
|
|
229
|
+
function dragOver( e ) {
|
|
230
|
+
// Only trigger `over` if the mouse has moved.
|
|
231
|
+
if (
|
|
232
|
+
e.clientX === lastClientX &&
|
|
233
|
+
e.clientY === lastClientY
|
|
234
|
+
) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
lastClientX = e.clientX;
|
|
238
|
+
lastClientY = e.clientY;
|
|
239
|
+
over();
|
|
240
|
+
}
|
|
228
241
|
|
|
229
|
-
function over(
|
|
242
|
+
function over() {
|
|
230
243
|
if ( ! hasStarted ) {
|
|
231
244
|
hasStarted = true;
|
|
232
245
|
node.style.pointerEvents = 'none';
|
|
233
246
|
}
|
|
247
|
+
const pointerYDelta = lastClientY - originClientY;
|
|
248
|
+
const pointerXDelta = lastClientX - originClientX;
|
|
234
249
|
const scrollTop = defaultView.scrollY;
|
|
235
250
|
const scrollLeft = defaultView.scrollX;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}px`;
|
|
243
|
-
node.style.left = `${
|
|
244
|
-
( e.clientX -
|
|
245
|
-
originClientX +
|
|
246
|
-
scrollLeft -
|
|
247
|
-
originScrollLeft ) *
|
|
248
|
-
inverted
|
|
249
|
-
}px`;
|
|
251
|
+
const scrollTopDelta = scrollTop - originScrollTop;
|
|
252
|
+
const scrollLeftDelta = scrollLeft - originScrollLeft;
|
|
253
|
+
const topDelta = pointerYDelta + scrollTopDelta;
|
|
254
|
+
const leftDelta = pointerXDelta + scrollLeftDelta;
|
|
255
|
+
node.style.top = `${ topDelta * inverted }px`;
|
|
256
|
+
node.style.left = `${ leftDelta * inverted }px`;
|
|
250
257
|
}
|
|
251
258
|
|
|
252
259
|
function end() {
|
|
253
|
-
ownerDocument.removeEventListener( 'dragover',
|
|
260
|
+
ownerDocument.removeEventListener( 'dragover', dragOver );
|
|
254
261
|
ownerDocument.removeEventListener( 'dragend', end );
|
|
255
262
|
ownerDocument.removeEventListener( 'drop', end );
|
|
256
263
|
ownerDocument.removeEventListener( 'scroll', over );
|
|
@@ -271,7 +278,7 @@ export function useEventHandlers( { clientId, isSelected } ) {
|
|
|
271
278
|
);
|
|
272
279
|
}
|
|
273
280
|
|
|
274
|
-
ownerDocument.addEventListener( 'dragover',
|
|
281
|
+
ownerDocument.addEventListener( 'dragover', dragOver );
|
|
275
282
|
ownerDocument.addEventListener( 'dragend', end );
|
|
276
283
|
ownerDocument.addEventListener( 'drop', end );
|
|
277
284
|
ownerDocument.addEventListener( 'scroll', over );
|
|
@@ -294,31 +301,39 @@ export function useEventHandlers( { clientId, isSelected } ) {
|
|
|
294
301
|
*/
|
|
295
302
|
function onDoubleClick( event ) {
|
|
296
303
|
const isSection = isSectionBlock( clientId );
|
|
304
|
+
const block = getBlock( clientId );
|
|
305
|
+
const isSyncedPattern = isReusableBlock( block );
|
|
306
|
+
const isTemplatePartBlock = isTemplatePart( block );
|
|
297
307
|
const isAlreadyEditing = editedContentOnlySection === clientId;
|
|
298
308
|
|
|
299
|
-
if (
|
|
300
|
-
|
|
301
|
-
|
|
309
|
+
if (
|
|
310
|
+
! isSection ||
|
|
311
|
+
isAlreadyEditing ||
|
|
312
|
+
isSyncedPattern ||
|
|
313
|
+
isTemplatePartBlock
|
|
314
|
+
) {
|
|
315
|
+
return;
|
|
302
316
|
}
|
|
303
|
-
}
|
|
304
317
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
node.addEventListener( 'dblclick', onDoubleClick );
|
|
318
|
+
event.preventDefault();
|
|
319
|
+
editContentOnlySection( clientId );
|
|
308
320
|
}
|
|
309
321
|
|
|
322
|
+
node.addEventListener( 'dblclick', onDoubleClick );
|
|
323
|
+
|
|
310
324
|
return () => {
|
|
311
325
|
node.removeEventListener( 'keydown', onKeyDown );
|
|
312
326
|
node.removeEventListener( 'dragstart', onDragStart );
|
|
313
|
-
|
|
314
|
-
node.removeEventListener( 'dblclick', onDoubleClick );
|
|
315
|
-
}
|
|
327
|
+
node.removeEventListener( 'dblclick', onDoubleClick );
|
|
316
328
|
};
|
|
317
329
|
},
|
|
318
330
|
[
|
|
319
331
|
clientId,
|
|
320
332
|
isSelected,
|
|
321
333
|
getBlockRootClientId,
|
|
334
|
+
getBlock,
|
|
335
|
+
isReusableBlock,
|
|
336
|
+
isTemplatePart,
|
|
322
337
|
insertAfterBlock,
|
|
323
338
|
removeBlock,
|
|
324
339
|
isZoomOut,
|
|
@@ -15,12 +15,14 @@ import { unlock } from '../../lock-unlock';
|
|
|
15
15
|
|
|
16
16
|
export function useInBetweenInserter() {
|
|
17
17
|
const openRef = useContext( InsertionPointOpenRef );
|
|
18
|
-
const isInBetweenInserterDisabled = useSelect(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
const isInBetweenInserterDisabled = useSelect( ( select ) => {
|
|
19
|
+
const settings = select( blockEditorStore ).getSettings();
|
|
20
|
+
return (
|
|
21
|
+
settings.isDistractionFree ||
|
|
22
|
+
settings.isPreviewMode ||
|
|
23
|
+
unlock( select( blockEditorStore ) ).isZoomOut()
|
|
24
|
+
);
|
|
25
|
+
}, [] );
|
|
24
26
|
const {
|
|
25
27
|
getBlockListSettings,
|
|
26
28
|
getBlockIndex,
|
|
@@ -16,22 +16,26 @@ import {
|
|
|
16
16
|
* Internal dependencies
|
|
17
17
|
*/
|
|
18
18
|
import { useBlockPreview } from '../';
|
|
19
|
+
import { useBlockProps } from '../../block-list/use-block-props';
|
|
19
20
|
|
|
20
21
|
describe( 'useBlockPreview', () => {
|
|
21
22
|
beforeAll( () => {
|
|
22
23
|
registerBlockType( 'core/test-block', {
|
|
24
|
+
apiVersion: 3,
|
|
23
25
|
save: () => (
|
|
24
|
-
<div>
|
|
26
|
+
<div { ...useBlockProps.save() }>
|
|
25
27
|
Test block save view
|
|
26
28
|
<button>Button</button>
|
|
27
29
|
</div>
|
|
28
30
|
),
|
|
29
|
-
edit: ()
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
edit: function Edit() {
|
|
32
|
+
return (
|
|
33
|
+
<div { ...useBlockProps() }>
|
|
34
|
+
Test block edit view
|
|
35
|
+
<button>Button</button>
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
},
|
|
35
39
|
category: 'text',
|
|
36
40
|
title: 'test block',
|
|
37
41
|
} );
|
|
@@ -87,6 +87,7 @@ export function BlockSettingsDropdown( {
|
|
|
87
87
|
selectedBlockClientIds,
|
|
88
88
|
isContentOnly,
|
|
89
89
|
isZoomOut,
|
|
90
|
+
canEdit,
|
|
90
91
|
} = useSelect(
|
|
91
92
|
( select ) => {
|
|
92
93
|
const {
|
|
@@ -97,6 +98,7 @@ export function BlockSettingsDropdown( {
|
|
|
97
98
|
getBlockAttributes,
|
|
98
99
|
getBlockEditingMode,
|
|
99
100
|
isZoomOut: _isZoomOut,
|
|
101
|
+
canEditBlock,
|
|
100
102
|
} = unlock( select( blockEditorStore ) );
|
|
101
103
|
|
|
102
104
|
const { getActiveBlockVariation } = select( blocksStore );
|
|
@@ -121,6 +123,7 @@ export function BlockSettingsDropdown( {
|
|
|
121
123
|
isContentOnly:
|
|
122
124
|
getBlockEditingMode( firstBlockClientId ) === 'contentOnly',
|
|
123
125
|
isZoomOut: _isZoomOut(),
|
|
126
|
+
canEdit: canEditBlock( firstBlockClientId ),
|
|
124
127
|
};
|
|
125
128
|
},
|
|
126
129
|
[ firstBlockClientId ]
|
|
@@ -240,7 +243,7 @@ export function BlockSettingsDropdown( {
|
|
|
240
243
|
parentBlockType={ parentBlockType }
|
|
241
244
|
/>
|
|
242
245
|
) }
|
|
243
|
-
{ count === 1 && (
|
|
246
|
+
{ canEdit && count === 1 && (
|
|
244
247
|
<BlockHTMLConvertButton
|
|
245
248
|
clientId={ firstBlockClientId }
|
|
246
249
|
/>
|
|
@@ -252,7 +255,7 @@ export function BlockSettingsDropdown( {
|
|
|
252
255
|
shortcut={ shortcuts.copy }
|
|
253
256
|
/>
|
|
254
257
|
) }
|
|
255
|
-
{ ! isContentOnly && (
|
|
258
|
+
{ canRemove && ! isContentOnly && (
|
|
256
259
|
<CopyMenuItem
|
|
257
260
|
clientIds={ clientIds }
|
|
258
261
|
label={ __( 'Cut' ) }
|
|
@@ -301,7 +304,7 @@ export function BlockSettingsDropdown( {
|
|
|
301
304
|
</MenuItem>
|
|
302
305
|
</>
|
|
303
306
|
) }
|
|
304
|
-
{ count === 1 && (
|
|
307
|
+
{ canEdit && count === 1 && (
|
|
305
308
|
<CommentIconSlotFill.Slot
|
|
306
309
|
fillProps={ {
|
|
307
310
|
clientId: firstBlockClientId,
|
|
@@ -318,9 +321,11 @@ export function BlockSettingsDropdown( {
|
|
|
318
321
|
label={ __( 'Copy styles' ) }
|
|
319
322
|
eventType="copyStyles"
|
|
320
323
|
/>
|
|
321
|
-
|
|
322
|
-
{
|
|
323
|
-
|
|
324
|
+
{ canEdit && (
|
|
325
|
+
<MenuItem onClick={ onPasteStyles }>
|
|
326
|
+
{ __( 'Paste styles' ) }
|
|
327
|
+
</MenuItem>
|
|
328
|
+
) }
|
|
324
329
|
</MenuGroup>
|
|
325
330
|
) }
|
|
326
331
|
{ ! isContentOnly && (
|
|
@@ -31,13 +31,7 @@ export function EditSectionMenuItem( { clientId, onClose } ) {
|
|
|
31
31
|
[ clientId ]
|
|
32
32
|
);
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
// and we're not already editing it
|
|
36
|
-
if (
|
|
37
|
-
! window?.__experimentalContentOnlyPatternInsertion ||
|
|
38
|
-
! isSectionBlock ||
|
|
39
|
-
isEditingContentOnlySection
|
|
40
|
-
) {
|
|
34
|
+
if ( ! isSectionBlock || isEditingContentOnlySection ) {
|
|
41
35
|
return null;
|
|
42
36
|
}
|
|
43
37
|
|
|
@@ -19,9 +19,8 @@ import {
|
|
|
19
19
|
import { BlockLockMenuItem, useBlockLock } from '../block-lock';
|
|
20
20
|
import { store as blockEditorStore } from '../../store';
|
|
21
21
|
import BlockModeToggle from '../block-settings-menu/block-mode-toggle';
|
|
22
|
-
import { ModifyContentOnlySectionMenuItem } from '../content-lock';
|
|
23
22
|
import { BlockRenameControl, useBlockRename } from '../block-rename';
|
|
24
|
-
import {
|
|
23
|
+
import { BlockVisibilityViewportMenuItem } from '../block-visibility';
|
|
25
24
|
import { EditSectionMenuItem } from './edit-section-menu-item';
|
|
26
25
|
|
|
27
26
|
const { Fill, Slot } = createSlotFill( 'BlockSettingsMenuControls' );
|
|
@@ -32,6 +31,7 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
|
|
|
32
31
|
selectedClientIds,
|
|
33
32
|
isContentOnly,
|
|
34
33
|
canToggleSelectedBlocksVisibility,
|
|
34
|
+
canEdit,
|
|
35
35
|
} = useSelect(
|
|
36
36
|
( select ) => {
|
|
37
37
|
const {
|
|
@@ -39,6 +39,7 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
|
|
|
39
39
|
getBlockNamesByClientId,
|
|
40
40
|
getSelectedBlockClientIds,
|
|
41
41
|
getBlockEditingMode,
|
|
42
|
+
canEditBlock,
|
|
42
43
|
} = select( blockEditorStore );
|
|
43
44
|
const ids =
|
|
44
45
|
clientIds !== null ? clientIds : getSelectedBlockClientIds();
|
|
@@ -52,6 +53,7 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
|
|
|
52
53
|
).every( ( block ) =>
|
|
53
54
|
hasBlockSupport( block.name, 'visibility', true )
|
|
54
55
|
),
|
|
56
|
+
canEdit: canEditBlock( ids[ 0 ] ),
|
|
55
57
|
};
|
|
56
58
|
},
|
|
57
59
|
[ clientIds ]
|
|
@@ -105,34 +107,30 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
|
|
|
105
107
|
onClose={ fillProps?.onClose }
|
|
106
108
|
/>
|
|
107
109
|
) }
|
|
108
|
-
{ showLockButton && (
|
|
110
|
+
{ canEdit && showLockButton && (
|
|
109
111
|
<BlockLockMenuItem
|
|
110
112
|
clientId={ selectedClientIds[ 0 ] }
|
|
111
113
|
/>
|
|
112
114
|
) }
|
|
113
|
-
{ showRenameButton && (
|
|
115
|
+
{ canEdit && showRenameButton && (
|
|
114
116
|
<BlockRenameControl
|
|
115
117
|
clientId={ selectedClientIds[ 0 ] }
|
|
116
118
|
/>
|
|
117
119
|
) }
|
|
118
|
-
{ showVisibilityButton && (
|
|
119
|
-
<
|
|
120
|
+
{ canEdit && showVisibilityButton && (
|
|
121
|
+
<BlockVisibilityViewportMenuItem
|
|
120
122
|
clientIds={ selectedClientIds }
|
|
121
123
|
/>
|
|
122
124
|
) }
|
|
123
125
|
{ fills }
|
|
124
|
-
{
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
clientId={ fillProps?.firstBlockClientId }
|
|
133
|
-
onToggle={ fillProps?.onClose }
|
|
134
|
-
/>
|
|
135
|
-
) }
|
|
126
|
+
{ canEdit &&
|
|
127
|
+
fillProps?.count === 1 &&
|
|
128
|
+
! isContentOnly && (
|
|
129
|
+
<BlockModeToggle
|
|
130
|
+
clientId={ fillProps?.firstBlockClientId }
|
|
131
|
+
onToggle={ fillProps?.onClose }
|
|
132
|
+
/>
|
|
133
|
+
) }
|
|
136
134
|
</MenuGroup>
|
|
137
135
|
);
|
|
138
136
|
} }
|
|
@@ -33,6 +33,7 @@ describe( 'BlockSwitcher', () => {
|
|
|
33
33
|
clientId: 'a1303fd6-3e60-4fff-a770-0e0ea656c5b9',
|
|
34
34
|
};
|
|
35
35
|
const headingBlockType = {
|
|
36
|
+
apiVersion: 3,
|
|
36
37
|
category: 'text',
|
|
37
38
|
title: 'Heading',
|
|
38
39
|
edit: () => {},
|
|
@@ -54,6 +55,7 @@ describe( 'BlockSwitcher', () => {
|
|
|
54
55
|
},
|
|
55
56
|
};
|
|
56
57
|
const paragraphBlockType = {
|
|
58
|
+
apiVersion: 3,
|
|
57
59
|
category: 'text',
|
|
58
60
|
title: 'Paragraph',
|
|
59
61
|
edit: () => {},
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
describe( 'use-transformed-patterns', () => {
|
|
15
15
|
beforeAll( () => {
|
|
16
16
|
registerBlockType( 'core/test-block-1', {
|
|
17
|
+
apiVersion: 3,
|
|
17
18
|
attributes: {
|
|
18
19
|
align: {
|
|
19
20
|
type: 'string',
|
|
@@ -36,6 +37,7 @@ describe( 'use-transformed-patterns', () => {
|
|
|
36
37
|
title: 'test block 1',
|
|
37
38
|
} );
|
|
38
39
|
registerBlockType( 'core/test-block-2', {
|
|
40
|
+
apiVersion: 3,
|
|
39
41
|
attributes: {
|
|
40
42
|
align: { type: 'string' },
|
|
41
43
|
content: { type: 'boolean' },
|
|
@@ -12,6 +12,7 @@ describe( 'BlockSwitcher - utils', () => {
|
|
|
12
12
|
describe( 'getRetainedBlockAttributes', () => {
|
|
13
13
|
beforeAll( () => {
|
|
14
14
|
registerBlockType( 'core/test-block-1', {
|
|
15
|
+
apiVersion: 3,
|
|
15
16
|
attributes: {
|
|
16
17
|
align: {
|
|
17
18
|
type: 'string',
|
|
@@ -34,6 +35,7 @@ describe( 'BlockSwitcher - utils', () => {
|
|
|
34
35
|
title: 'test block 1',
|
|
35
36
|
} );
|
|
36
37
|
registerBlockType( 'core/test-block-2', {
|
|
38
|
+
apiVersion: 3,
|
|
37
39
|
attributes: {
|
|
38
40
|
align: { type: 'string' },
|
|
39
41
|
content: { type: 'boolean' },
|
|
@@ -27,6 +27,7 @@ function getBlockIconVariant( { select, clientIds } ) {
|
|
|
27
27
|
canRemoveBlocks,
|
|
28
28
|
getTemplateLock,
|
|
29
29
|
getBlockEditingMode,
|
|
30
|
+
canEditBlock,
|
|
30
31
|
} = unlock( select( blockEditorStore ) );
|
|
31
32
|
const { getBlockStyles } = select( blocksStore );
|
|
32
33
|
|
|
@@ -53,17 +54,16 @@ function getBlockIconVariant( { select, clientIds } ) {
|
|
|
53
54
|
0
|
|
54
55
|
);
|
|
55
56
|
const canRemove = canRemoveBlocks( clientIds );
|
|
56
|
-
|
|
57
|
+
const canEdit = clientIds.every( ( clientId ) => canEditBlock( clientId ) );
|
|
57
58
|
const isDefaultEditingMode =
|
|
58
59
|
getBlockEditingMode( clientIds[ 0 ] ) === 'default';
|
|
59
|
-
const _hideTransformsForSections =
|
|
60
|
-
window?.__experimentalContentOnlyPatternInsertion &&
|
|
61
|
-
hasPatternNameInSelection;
|
|
60
|
+
const _hideTransformsForSections = hasPatternNameInSelection;
|
|
62
61
|
const _showBlockSwitcher =
|
|
63
62
|
! _hideTransformsForSections &&
|
|
64
63
|
isDefaultEditingMode &&
|
|
65
64
|
( hasBlockStyles || canRemove ) &&
|
|
66
|
-
! hasTemplateLock
|
|
65
|
+
! hasTemplateLock &&
|
|
66
|
+
canEdit;
|
|
67
67
|
|
|
68
68
|
const _showPatternOverrides = hasPatternOverrides && hasParentPattern;
|
|
69
69
|
|
|
@@ -84,11 +84,7 @@ function getBlockIcon( { select, clientIds } ) {
|
|
|
84
84
|
const _isSingleBlock = clientIds.length === 1;
|
|
85
85
|
const firstClientId = clientIds[ 0 ];
|
|
86
86
|
const blockAttributes = getBlockAttributes( firstClientId );
|
|
87
|
-
if (
|
|
88
|
-
_isSingleBlock &&
|
|
89
|
-
blockAttributes?.metadata?.patternName &&
|
|
90
|
-
window?.__experimentalContentOnlyPatternInsertion
|
|
91
|
-
) {
|
|
87
|
+
if ( _isSingleBlock && blockAttributes?.metadata?.patternName ) {
|
|
92
88
|
return symbol;
|
|
93
89
|
}
|
|
94
90
|
|
|
@@ -27,7 +27,7 @@ import BlockControls from '../block-controls';
|
|
|
27
27
|
import __unstableBlockToolbarLastItem from './block-toolbar-last-item';
|
|
28
28
|
import BlockSettingsMenu from '../block-settings-menu';
|
|
29
29
|
import { BlockLockToolbar } from '../block-lock';
|
|
30
|
-
import {
|
|
30
|
+
import { ViewportVisibilityToolbar } from '../block-visibility';
|
|
31
31
|
import { BlockGroupToolbar } from '../convert-to-group-buttons';
|
|
32
32
|
import BlockEditVisuallyButton from '../block-edit-visually-button';
|
|
33
33
|
import { useShowHoveredOrFocusedGestures } from './utils';
|
|
@@ -116,14 +116,8 @@ export function PrivateBlockToolbar( {
|
|
|
116
116
|
);
|
|
117
117
|
|
|
118
118
|
const _isZoomOut = isZoomOut();
|
|
119
|
-
|
|
120
119
|
const _isSectionBlock = isSectionBlock( selectedBlockClientId );
|
|
121
|
-
|
|
122
|
-
// The switch style button appears more prominently with the
|
|
123
|
-
// content only pattern experiment.
|
|
124
|
-
const _showSwitchSectionStyleButton =
|
|
125
|
-
window?.__experimentalContentOnlyPatternInsertion &&
|
|
126
|
-
( _isZoomOut || _isSectionBlock );
|
|
120
|
+
const _showSwitchSectionStyleButton = _isZoomOut || _isSectionBlock;
|
|
127
121
|
|
|
128
122
|
return {
|
|
129
123
|
blockClientId: selectedBlockClientId,
|
|
@@ -213,7 +207,7 @@ export function PrivateBlockToolbar( {
|
|
|
213
207
|
/>
|
|
214
208
|
{ isDefaultEditingMode &&
|
|
215
209
|
showBlockVisibilityButton && (
|
|
216
|
-
<
|
|
210
|
+
<ViewportVisibilityToolbar
|
|
217
211
|
clientIds={ blockClientIds }
|
|
218
212
|
/>
|
|
219
213
|
) }
|
|
@@ -35,7 +35,6 @@ import { useShowBlockTools } from './use-show-block-tools';
|
|
|
35
35
|
import { unlock } from '../../lock-unlock';
|
|
36
36
|
import usePasteStyles from '../use-paste-styles';
|
|
37
37
|
import { BlockVisibilityModal } from '../block-visibility';
|
|
38
|
-
import { cleanEmptyObject } from '../../hooks/utils';
|
|
39
38
|
|
|
40
39
|
function selector( select ) {
|
|
41
40
|
const {
|
|
@@ -101,7 +100,6 @@ export default function BlockTools( {
|
|
|
101
100
|
moveBlocksDown,
|
|
102
101
|
expandBlock,
|
|
103
102
|
stopEditingContentOnlySection,
|
|
104
|
-
updateBlockAttributes,
|
|
105
103
|
} = unlock( useDispatch( blockEditorStore ) );
|
|
106
104
|
|
|
107
105
|
function onKeyDown( event ) {
|
|
@@ -230,33 +228,8 @@ export default function BlockTools( {
|
|
|
230
228
|
return;
|
|
231
229
|
}
|
|
232
230
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
setVisibilityModalClientIds( clientIds );
|
|
236
|
-
} else {
|
|
237
|
-
const hasHiddenBlock = blocks.some(
|
|
238
|
-
( block ) =>
|
|
239
|
-
block.attributes.metadata?.blockVisibility === false
|
|
240
|
-
);
|
|
241
|
-
const attributesByClientId = Object.fromEntries(
|
|
242
|
-
blocks.map(
|
|
243
|
-
( { clientId: mapClientId, attributes } ) => [
|
|
244
|
-
mapClientId,
|
|
245
|
-
{
|
|
246
|
-
metadata: cleanEmptyObject( {
|
|
247
|
-
...attributes?.metadata,
|
|
248
|
-
blockVisibility: hasHiddenBlock
|
|
249
|
-
? undefined
|
|
250
|
-
: false,
|
|
251
|
-
} ),
|
|
252
|
-
},
|
|
253
|
-
]
|
|
254
|
-
)
|
|
255
|
-
);
|
|
256
|
-
updateBlockAttributes( clientIds, attributesByClientId, {
|
|
257
|
-
uniqueByBlock: true,
|
|
258
|
-
} );
|
|
259
|
-
}
|
|
231
|
+
// Open the visibility breakpoints modal.
|
|
232
|
+
setVisibilityModalClientIds( clientIds );
|
|
260
233
|
}
|
|
261
234
|
}
|
|
262
235
|
|
|
@@ -205,10 +205,7 @@ function __experimentalBlockVariationTransforms( { blockClientId } ) {
|
|
|
205
205
|
} );
|
|
206
206
|
};
|
|
207
207
|
|
|
208
|
-
|
|
209
|
-
window?.__experimentalContentOnlyPatternInsertion && isSection;
|
|
210
|
-
|
|
211
|
-
if ( ! variations?.length || isContentOnly || hideVariationsForSections ) {
|
|
208
|
+
if ( ! variations?.length || isContentOnly || isSection ) {
|
|
212
209
|
return null;
|
|
213
210
|
}
|
|
214
211
|
|
|
@@ -1,21 +1,5 @@
|
|
|
1
1
|
export { default as BlockVisibilityModal } from './modal';
|
|
2
2
|
export { default as useBlockVisibility } from './use-block-visibility';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import BlockVisibilityMenuItemDefault from './menu-item';
|
|
8
|
-
import BlockVisibilityViewportMenuItem from './viewport-menu-item';
|
|
9
|
-
|
|
10
|
-
const hasViewportVisibilityExperiment =
|
|
11
|
-
typeof window !== 'undefined' &&
|
|
12
|
-
window.__experimentalHideBlocksBasedOnScreenSize;
|
|
13
|
-
|
|
14
|
-
// Conditionally export the viewport versions when the experimental flag is enabled.
|
|
15
|
-
export const BlockVisibilityMenuItem = hasViewportVisibilityExperiment
|
|
16
|
-
? BlockVisibilityViewportMenuItem
|
|
17
|
-
: BlockVisibilityMenuItemDefault;
|
|
18
|
-
|
|
19
|
-
export const BlockVisibilityToolbar = hasViewportVisibilityExperiment
|
|
20
|
-
? BlockVisibilityViewportToolbar
|
|
21
|
-
: BlockVisibilityToolbarDefault;
|
|
3
|
+
export { default as ViewportVisibilityToolbar } from './viewport-toolbar';
|
|
4
|
+
export { default as BlockVisibilityViewportMenuItem } from './viewport-menu-item';
|
|
5
|
+
export { default as ViewportVisibilityInfo } from './viewport-visibility-info';
|
|
@@ -118,7 +118,7 @@ export default function BlockVisibilityModal( { clientIds, onClose } ) {
|
|
|
118
118
|
return sprintf(
|
|
119
119
|
// translators: %s: The shortcut key to access the List View.
|
|
120
120
|
__(
|
|
121
|
-
'Block visibility settings
|
|
121
|
+
'Block visibility settings updated. You can access them via the List View (%s).'
|
|
122
122
|
),
|
|
123
123
|
listViewShortcut
|
|
124
124
|
);
|
|
@@ -160,18 +160,20 @@ export default function BlockVisibilityModal( { clientIds, onClose } ) {
|
|
|
160
160
|
event.preventDefault();
|
|
161
161
|
const newVisibility = hideEverywhere
|
|
162
162
|
? false
|
|
163
|
-
:
|
|
164
|
-
(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
163
|
+
: {
|
|
164
|
+
viewport: BLOCK_VISIBILITY_VIEWPORT_ENTRIES.reduce(
|
|
165
|
+
( acc, [ , { key } ] ) => {
|
|
166
|
+
if ( viewportChecked[ key ] ) {
|
|
167
|
+
// Values are inverted to hide the block on the selected viewport.
|
|
168
|
+
// In the UI, the checkbox is checked (true) when the block is hidden on the selected viewport,
|
|
169
|
+
// so 'false' means hide the block on the selected viewport.
|
|
170
|
+
acc[ key ] = false;
|
|
171
|
+
}
|
|
172
|
+
return acc;
|
|
173
|
+
},
|
|
174
|
+
{}
|
|
175
|
+
),
|
|
176
|
+
};
|
|
175
177
|
const attributesByClientId = Object.fromEntries(
|
|
176
178
|
blocks.map( ( { clientId, attributes } ) => [
|
|
177
179
|
clientId,
|
|
@@ -190,7 +192,7 @@ export default function BlockVisibilityModal( { clientIds, onClose } ) {
|
|
|
190
192
|
createSuccessNotice( noticeMessage, {
|
|
191
193
|
id: hideEverywhere
|
|
192
194
|
? 'block-visibility-hidden'
|
|
193
|
-
: 'block-visibility-viewports-
|
|
195
|
+
: 'block-visibility-viewports-updated',
|
|
194
196
|
type: 'snackbar',
|
|
195
197
|
} );
|
|
196
198
|
onClose();
|