@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
|
@@ -5,17 +5,31 @@ function findOptimalFontSize(textElement, applyFontSize) {
|
|
|
5
5
|
let maxSize = 2400;
|
|
6
6
|
let bestSize = minSize;
|
|
7
7
|
const computedStyle = window.getComputedStyle(textElement);
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
let paddingLeft = parseFloat(computedStyle.paddingLeft) || 0;
|
|
9
|
+
let paddingRight = parseFloat(computedStyle.paddingRight) || 0;
|
|
10
10
|
const range = document.createRange();
|
|
11
11
|
range.selectNodeContents(textElement);
|
|
12
|
+
let referenceElement = textElement;
|
|
13
|
+
const parentElement = textElement.parentElement;
|
|
14
|
+
if (parentElement) {
|
|
15
|
+
const parentElementComputedStyle = window.getComputedStyle(parentElement);
|
|
16
|
+
if (parentElementComputedStyle?.display === "flex") {
|
|
17
|
+
referenceElement = parentElement;
|
|
18
|
+
paddingLeft += parseFloat(parentElementComputedStyle.paddingLeft) || 0;
|
|
19
|
+
paddingRight += parseFloat(parentElementComputedStyle.paddingRight) || 0;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
let maxclientHeight = referenceElement.clientHeight;
|
|
12
23
|
while (minSize <= maxSize) {
|
|
13
24
|
const midSize = Math.floor((minSize + maxSize) / 2);
|
|
14
25
|
applyFontSize(midSize);
|
|
15
26
|
const rect = range.getBoundingClientRect();
|
|
16
27
|
const textWidth = rect.width;
|
|
17
|
-
const fitsWidth = textElement.scrollWidth <=
|
|
18
|
-
const fitsHeight = alreadyHasScrollableHeight || textElement.scrollHeight <= textElement.
|
|
28
|
+
const fitsWidth = textElement.scrollWidth <= referenceElement.clientWidth && textWidth <= referenceElement.clientWidth - paddingLeft - paddingRight;
|
|
29
|
+
const fitsHeight = alreadyHasScrollableHeight || textElement.scrollHeight <= referenceElement.clientHeight || textElement.scrollHeight <= maxclientHeight;
|
|
30
|
+
if (referenceElement.clientHeight > maxclientHeight) {
|
|
31
|
+
maxclientHeight = referenceElement.clientHeight;
|
|
32
|
+
}
|
|
19
33
|
if (fitsWidth && fitsHeight) {
|
|
20
34
|
bestSize = midSize;
|
|
21
35
|
minSize = midSize + 1;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/fit-text-utils.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Shared utility functions for fit text functionality.\n * Uses callback-based approach for maximum code reuse between editor and frontend.\n */\n\n/**\n * Find optimal font size using simple binary search between 0-2400px.\n *\n * @param {HTMLElement} textElement The text element\n * @param {Function} applyFontSize Function that receives font size in pixels\n * @return {number} Optimal font size\n */\nfunction findOptimalFontSize( textElement, applyFontSize ) {\n\tconst alreadyHasScrollableHeight =\n\t\ttextElement.scrollHeight > textElement.clientHeight;\n\tlet minSize = 0;\n\tlet maxSize = 2400;\n\tlet bestSize = minSize;\n\n\tconst computedStyle = window.getComputedStyle( textElement );\n\
|
|
5
|
-
"mappings": ";AAYA,SAAS,oBAAqB,aAAa,eAAgB;AAC1D,QAAM,6BACL,YAAY,eAAe,YAAY;AACxC,MAAI,UAAU;AACd,MAAI,UAAU;AACd,MAAI,WAAW;AAEf,QAAM,gBAAgB,OAAO,iBAAkB,WAAY;AAC3D,
|
|
4
|
+
"sourcesContent": ["/**\n * Shared utility functions for fit text functionality.\n * Uses callback-based approach for maximum code reuse between editor and frontend.\n */\n\n/**\n * Find optimal font size using simple binary search between 0-2400px.\n *\n * @param {HTMLElement} textElement The text element\n * @param {Function} applyFontSize Function that receives font size in pixels\n * @return {number} Optimal font size\n */\nfunction findOptimalFontSize( textElement, applyFontSize ) {\n\tconst alreadyHasScrollableHeight =\n\t\ttextElement.scrollHeight > textElement.clientHeight;\n\tlet minSize = 0;\n\tlet maxSize = 2400;\n\tlet bestSize = minSize;\n\n\tconst computedStyle = window.getComputedStyle( textElement );\n\tlet paddingLeft = parseFloat( computedStyle.paddingLeft ) || 0;\n\tlet paddingRight = parseFloat( computedStyle.paddingRight ) || 0;\n\tconst range = document.createRange();\n\trange.selectNodeContents( textElement );\n\n\tlet referenceElement = textElement;\n\tconst parentElement = textElement.parentElement;\n\tif ( parentElement ) {\n\t\tconst parentElementComputedStyle =\n\t\t\twindow.getComputedStyle( parentElement );\n\t\tif ( parentElementComputedStyle?.display === 'flex' ) {\n\t\t\treferenceElement = parentElement;\n\t\t\tpaddingLeft +=\n\t\t\t\tparseFloat( parentElementComputedStyle.paddingLeft ) || 0;\n\t\t\tpaddingRight +=\n\t\t\t\tparseFloat( parentElementComputedStyle.paddingRight ) || 0;\n\t\t}\n\t}\n\tlet maxclientHeight = referenceElement.clientHeight;\n\n\twhile ( minSize <= maxSize ) {\n\t\tconst midSize = Math.floor( ( minSize + maxSize ) / 2 );\n\t\tapplyFontSize( midSize );\n\n\t\t// When there is padding if the text overflows to the\n\t\t// padding area, it should be considered overflowing.\n\t\t// Use Range API to measure actual text content dimensions.\n\t\tconst rect = range.getBoundingClientRect();\n\t\tconst textWidth = rect.width;\n\n\t\t// Check if text fits within the element's width and is not\n\t\t// overflowing into the padding area.\n\t\tconst fitsWidth =\n\t\t\ttextElement.scrollWidth <= referenceElement.clientWidth &&\n\t\t\ttextWidth <=\n\t\t\t\treferenceElement.clientWidth - paddingLeft - paddingRight;\n\t\t// Check if text fits within the element's height.\n\t\tconst fitsHeight =\n\t\t\talreadyHasScrollableHeight ||\n\t\t\ttextElement.scrollHeight <= referenceElement.clientHeight ||\n\t\t\ttextElement.scrollHeight <= maxclientHeight;\n\n\t\t// When there are calculated line heights, text may jump in height\n\t\t// the available space may decrease while the font size decreases,\n\t\t// making text not fit.\n\t\t// We store a maximum reference height: the maximum reference element height that was observed\n\t\t// during the loop to avoid issues with such jumps.\n\t\tif ( referenceElement.clientHeight > maxclientHeight ) {\n\t\t\tmaxclientHeight = referenceElement.clientHeight;\n\t\t}\n\n\t\tif ( fitsWidth && fitsHeight ) {\n\t\t\tbestSize = midSize;\n\t\t\tminSize = midSize + 1;\n\t\t} else {\n\t\t\tmaxSize = midSize - 1;\n\t\t}\n\t}\n\trange.detach();\n\n\treturn bestSize;\n}\n\n/**\n * Complete fit text optimization for a single text element.\n * Handles the full flow using callbacks for font size application.\n *\n * @param {HTMLElement} textElement The text element (paragraph, heading, etc.)\n * @param {Function} applyFontSize Function that receives font size in pixels (0 to clear, >0 to apply)\n */\nexport function optimizeFitText( textElement, applyFontSize ) {\n\tif ( ! textElement ) {\n\t\treturn;\n\t}\n\n\tapplyFontSize( 0 );\n\n\tconst optimalSize = findOptimalFontSize( textElement, applyFontSize );\n\n\tapplyFontSize( optimalSize );\n\treturn optimalSize;\n}\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,oBAAqB,aAAa,eAAgB;AAC1D,QAAM,6BACL,YAAY,eAAe,YAAY;AACxC,MAAI,UAAU;AACd,MAAI,UAAU;AACd,MAAI,WAAW;AAEf,QAAM,gBAAgB,OAAO,iBAAkB,WAAY;AAC3D,MAAI,cAAc,WAAY,cAAc,WAAY,KAAK;AAC7D,MAAI,eAAe,WAAY,cAAc,YAAa,KAAK;AAC/D,QAAM,QAAQ,SAAS,YAAY;AACnC,QAAM,mBAAoB,WAAY;AAEtC,MAAI,mBAAmB;AACvB,QAAM,gBAAgB,YAAY;AAClC,MAAK,eAAgB;AACpB,UAAM,6BACL,OAAO,iBAAkB,aAAc;AACxC,QAAK,4BAA4B,YAAY,QAAS;AACrD,yBAAmB;AACnB,qBACC,WAAY,2BAA2B,WAAY,KAAK;AACzD,sBACC,WAAY,2BAA2B,YAAa,KAAK;AAAA,IAC3D;AAAA,EACD;AACA,MAAI,kBAAkB,iBAAiB;AAEvC,SAAQ,WAAW,SAAU;AAC5B,UAAM,UAAU,KAAK,OAAS,UAAU,WAAY,CAAE;AACtD,kBAAe,OAAQ;AAKvB,UAAM,OAAO,MAAM,sBAAsB;AACzC,UAAM,YAAY,KAAK;AAIvB,UAAM,YACL,YAAY,eAAe,iBAAiB,eAC5C,aACC,iBAAiB,cAAc,cAAc;AAE/C,UAAM,aACL,8BACA,YAAY,gBAAgB,iBAAiB,gBAC7C,YAAY,gBAAgB;AAO7B,QAAK,iBAAiB,eAAe,iBAAkB;AACtD,wBAAkB,iBAAiB;AAAA,IACpC;AAEA,QAAK,aAAa,YAAa;AAC9B,iBAAW;AACX,gBAAU,UAAU;AAAA,IACrB,OAAO;AACN,gBAAU,UAAU;AAAA,IACrB;AAAA,EACD;AACA,QAAM,OAAO;AAEb,SAAO;AACR;AASO,SAAS,gBAAiB,aAAa,eAAgB;AAC7D,MAAK,CAAE,aAAc;AACpB;AAAA,EACD;AAEA,gBAAe,CAAE;AAEjB,QAAM,cAAc,oBAAqB,aAAa,aAAc;AAEpE,gBAAe,WAAY;AAC3B,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -503,6 +503,16 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection=true] .blo
|
|
|
503
503
|
cursor: grabbing;
|
|
504
504
|
}
|
|
505
505
|
|
|
506
|
+
.is-preview-mode {
|
|
507
|
+
pointer-events: none;
|
|
508
|
+
}
|
|
509
|
+
.is-preview-mode .block-editor-block-list__block {
|
|
510
|
+
pointer-events: auto;
|
|
511
|
+
}
|
|
512
|
+
.is-preview-mode .block-editor-block-list__block > *:not(.block-editor-block-list__block) {
|
|
513
|
+
pointer-events: none;
|
|
514
|
+
}
|
|
515
|
+
|
|
506
516
|
.is-vertical .block-list-appender {
|
|
507
517
|
width: 24px;
|
|
508
518
|
margin-left: auto;
|
package/build-style/content.css
CHANGED
|
@@ -503,6 +503,16 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection=true] .blo
|
|
|
503
503
|
cursor: grabbing;
|
|
504
504
|
}
|
|
505
505
|
|
|
506
|
+
.is-preview-mode {
|
|
507
|
+
pointer-events: none;
|
|
508
|
+
}
|
|
509
|
+
.is-preview-mode .block-editor-block-list__block {
|
|
510
|
+
pointer-events: auto;
|
|
511
|
+
}
|
|
512
|
+
.is-preview-mode .block-editor-block-list__block > *:not(.block-editor-block-list__block) {
|
|
513
|
+
pointer-events: none;
|
|
514
|
+
}
|
|
515
|
+
|
|
506
516
|
.is-vertical .block-list-appender {
|
|
507
517
|
width: 24px;
|
|
508
518
|
margin-right: auto;
|
|
@@ -1760,6 +1760,9 @@ iframe[name=editor-canvas] {
|
|
|
1760
1760
|
background: linear-gradient(45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%);
|
|
1761
1761
|
}
|
|
1762
1762
|
|
|
1763
|
+
.block-editor-global-styles-advanced-panel__custom-css-input {
|
|
1764
|
+
margin-bottom: 16px;
|
|
1765
|
+
}
|
|
1763
1766
|
.block-editor-global-styles-advanced-panel__custom-css-input textarea {
|
|
1764
1767
|
font-family: Menlo, Consolas, monaco, monospace;
|
|
1765
1768
|
direction: ltr;
|
package/build-style/style.css
CHANGED
|
@@ -1760,6 +1760,9 @@ iframe[name=editor-canvas] {
|
|
|
1760
1760
|
background: linear-gradient(-45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%);
|
|
1761
1761
|
}
|
|
1762
1762
|
|
|
1763
|
+
.block-editor-global-styles-advanced-panel__custom-css-input {
|
|
1764
|
+
margin-bottom: 16px;
|
|
1765
|
+
}
|
|
1763
1766
|
.block-editor-global-styles-advanced-panel__custom-css-input textarea {
|
|
1764
1767
|
font-family: Menlo, Consolas, monaco, monospace;
|
|
1765
1768
|
/*rtl:ignore*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.12.0",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -61,43 +61,43 @@
|
|
|
61
61
|
],
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@react-spring/web": "^9.4.5",
|
|
64
|
-
"@wordpress/a11y": "^4.
|
|
65
|
-
"@wordpress/api-fetch": "^7.
|
|
66
|
-
"@wordpress/base-styles": "^6.
|
|
67
|
-
"@wordpress/blob": "^4.
|
|
68
|
-
"@wordpress/block-serialization-default-parser": "^5.
|
|
69
|
-
"@wordpress/blocks": "^15.
|
|
70
|
-
"@wordpress/commands": "^1.
|
|
71
|
-
"@wordpress/components": "^32.
|
|
72
|
-
"@wordpress/compose": "^7.
|
|
73
|
-
"@wordpress/data": "^10.
|
|
74
|
-
"@wordpress/dataviews": "^11.
|
|
75
|
-
"@wordpress/date": "^5.
|
|
76
|
-
"@wordpress/deprecated": "^4.
|
|
77
|
-
"@wordpress/dom": "^4.
|
|
78
|
-
"@wordpress/element": "^6.
|
|
79
|
-
"@wordpress/escape-html": "^3.
|
|
80
|
-
"@wordpress/global-styles-engine": "^1.
|
|
81
|
-
"@wordpress/hooks": "^4.
|
|
82
|
-
"@wordpress/html-entities": "^4.
|
|
83
|
-
"@wordpress/i18n": "^6.
|
|
84
|
-
"@wordpress/icons": "^11.
|
|
85
|
-
"@wordpress/image-cropper": "^1.
|
|
86
|
-
"@wordpress/interactivity": "^6.
|
|
87
|
-
"@wordpress/is-shallow-equal": "^5.
|
|
88
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
89
|
-
"@wordpress/keycodes": "^4.
|
|
90
|
-
"@wordpress/notices": "^5.
|
|
91
|
-
"@wordpress/preferences": "^4.
|
|
92
|
-
"@wordpress/priority-queue": "^3.
|
|
93
|
-
"@wordpress/private-apis": "^1.
|
|
94
|
-
"@wordpress/rich-text": "^7.
|
|
95
|
-
"@wordpress/style-engine": "^2.
|
|
96
|
-
"@wordpress/token-list": "^3.
|
|
97
|
-
"@wordpress/upload-media": "^0.
|
|
98
|
-
"@wordpress/url": "^4.
|
|
99
|
-
"@wordpress/warning": "^3.
|
|
100
|
-
"@wordpress/wordcount": "^4.
|
|
64
|
+
"@wordpress/a11y": "^4.39.0",
|
|
65
|
+
"@wordpress/api-fetch": "^7.39.0",
|
|
66
|
+
"@wordpress/base-styles": "^6.15.0",
|
|
67
|
+
"@wordpress/blob": "^4.39.0",
|
|
68
|
+
"@wordpress/block-serialization-default-parser": "^5.39.0",
|
|
69
|
+
"@wordpress/blocks": "^15.12.0",
|
|
70
|
+
"@wordpress/commands": "^1.39.0",
|
|
71
|
+
"@wordpress/components": "^32.1.0",
|
|
72
|
+
"@wordpress/compose": "^7.39.0",
|
|
73
|
+
"@wordpress/data": "^10.39.0",
|
|
74
|
+
"@wordpress/dataviews": "^11.3.0",
|
|
75
|
+
"@wordpress/date": "^5.39.0",
|
|
76
|
+
"@wordpress/deprecated": "^4.39.0",
|
|
77
|
+
"@wordpress/dom": "^4.39.0",
|
|
78
|
+
"@wordpress/element": "^6.39.0",
|
|
79
|
+
"@wordpress/escape-html": "^3.39.0",
|
|
80
|
+
"@wordpress/global-styles-engine": "^1.6.0",
|
|
81
|
+
"@wordpress/hooks": "^4.39.0",
|
|
82
|
+
"@wordpress/html-entities": "^4.39.0",
|
|
83
|
+
"@wordpress/i18n": "^6.12.0",
|
|
84
|
+
"@wordpress/icons": "^11.6.0",
|
|
85
|
+
"@wordpress/image-cropper": "^1.3.0",
|
|
86
|
+
"@wordpress/interactivity": "^6.39.0",
|
|
87
|
+
"@wordpress/is-shallow-equal": "^5.39.0",
|
|
88
|
+
"@wordpress/keyboard-shortcuts": "^5.39.0",
|
|
89
|
+
"@wordpress/keycodes": "^4.39.0",
|
|
90
|
+
"@wordpress/notices": "^5.39.0",
|
|
91
|
+
"@wordpress/preferences": "^4.39.0",
|
|
92
|
+
"@wordpress/priority-queue": "^3.39.0",
|
|
93
|
+
"@wordpress/private-apis": "^1.39.0",
|
|
94
|
+
"@wordpress/rich-text": "^7.39.0",
|
|
95
|
+
"@wordpress/style-engine": "^2.39.0",
|
|
96
|
+
"@wordpress/token-list": "^3.39.0",
|
|
97
|
+
"@wordpress/upload-media": "^0.24.0",
|
|
98
|
+
"@wordpress/url": "^4.39.0",
|
|
99
|
+
"@wordpress/warning": "^3.39.0",
|
|
100
|
+
"@wordpress/wordcount": "^4.39.0",
|
|
101
101
|
"change-case": "^4.1.2",
|
|
102
102
|
"clsx": "^2.1.1",
|
|
103
103
|
"colord": "^2.7.0",
|
|
@@ -124,5 +124,5 @@
|
|
|
124
124
|
"publishConfig": {
|
|
125
125
|
"access": "public"
|
|
126
126
|
},
|
|
127
|
-
"gitHead": "
|
|
127
|
+
"gitHead": "eee1cfb1472f11183e40fb77465a5f13145df7ad"
|
|
128
128
|
}
|
|
@@ -103,6 +103,7 @@ function BlockBreadcrumb( { rootLabelText } ) {
|
|
|
103
103
|
<BlockTitle
|
|
104
104
|
clientId={ parentClientId }
|
|
105
105
|
maximumLength={ 35 }
|
|
106
|
+
context="breadcrumb"
|
|
106
107
|
/>
|
|
107
108
|
</Button>
|
|
108
109
|
<Icon
|
|
@@ -116,7 +117,11 @@ function BlockBreadcrumb( { rootLabelText } ) {
|
|
|
116
117
|
className="block-editor-block-breadcrumb__current"
|
|
117
118
|
aria-current="true"
|
|
118
119
|
>
|
|
119
|
-
<BlockTitle
|
|
120
|
+
<BlockTitle
|
|
121
|
+
clientId={ clientId }
|
|
122
|
+
maximumLength={ 35 }
|
|
123
|
+
context="breadcrumb"
|
|
124
|
+
/>
|
|
120
125
|
</li>
|
|
121
126
|
) }
|
|
122
127
|
</ul>
|
|
@@ -12,7 +12,7 @@ BlockControls.Slot = BlockControlsSlot;
|
|
|
12
12
|
export const BlockFormatControls = ( props ) => {
|
|
13
13
|
return <BlockControlsFill group="inline" { ...props } />;
|
|
14
14
|
};
|
|
15
|
-
BlockFormatControls.Slot = ( props )
|
|
15
|
+
BlockFormatControls.Slot = function Slot( props ) {
|
|
16
16
|
return <BlockControlsSlot group="inline" { ...props } />;
|
|
17
17
|
};
|
|
18
18
|
|
|
@@ -37,6 +37,7 @@ describe( 'Edit', () => {
|
|
|
37
37
|
const edit = () => <div data-testid="foo-bar" />;
|
|
38
38
|
|
|
39
39
|
registerBlockType( 'core/test-block', {
|
|
40
|
+
apiVersion: 3,
|
|
40
41
|
save: noop,
|
|
41
42
|
category: 'text',
|
|
42
43
|
title: 'block title',
|
|
@@ -52,6 +53,7 @@ describe( 'Edit', () => {
|
|
|
52
53
|
const save = () => <div data-testid="foo-bar" />;
|
|
53
54
|
|
|
54
55
|
registerBlockType( 'core/test-block', {
|
|
56
|
+
apiVersion: 3,
|
|
55
57
|
save,
|
|
56
58
|
category: 'text',
|
|
57
59
|
title: 'block title',
|
|
@@ -79,6 +81,13 @@ describe( 'Edit', () => {
|
|
|
79
81
|
|
|
80
82
|
render( <Edit name="core/test-block" attributes={ attributes } /> );
|
|
81
83
|
|
|
84
|
+
// This test is for API version 1 blocks, so the console warning is intentional.
|
|
85
|
+
// API version 1 blocks automatically receive the default block class name,
|
|
86
|
+
// while API version 2+ blocks require useBlockProps() to be used explicitly.
|
|
87
|
+
expect( console ).toHaveWarnedWith(
|
|
88
|
+
'Block with API version 2 or lower is deprecated since version 6.9. See: https://developer.wordpress.org/block-editor/reference-guides/block-api/block-api-versions/block-migration-for-iframe-editor-compatibility/ Note: The block "core/test-block" is registered with API version 1. This means that the post editor may work as a non-iframe editor. Since all editors are planned to work as iframes in the future, set the `apiVersion` field to 3 and test the block inside the iframe editor.'
|
|
89
|
+
);
|
|
90
|
+
|
|
82
91
|
const editElement = screen.getByTestId( 'foo-bar' );
|
|
83
92
|
expect( editElement ).toHaveClass( 'wp-block-test-block' );
|
|
84
93
|
expect( editElement ).toHaveClass( 'my-class' );
|
|
@@ -87,6 +96,7 @@ describe( 'Edit', () => {
|
|
|
87
96
|
it( 'should assign context', () => {
|
|
88
97
|
const edit = ( { context } ) => context.value;
|
|
89
98
|
registerBlockType( 'core/test-block', {
|
|
99
|
+
apiVersion: 3,
|
|
90
100
|
category: 'text',
|
|
91
101
|
title: 'block title',
|
|
92
102
|
usesContext: [ 'value' ],
|
|
@@ -29,7 +29,7 @@ import PositionControls from '../inspector-controls-tabs/position-controls-panel
|
|
|
29
29
|
import useBlockInspectorAnimationSettings from './useBlockInspectorAnimationSettings';
|
|
30
30
|
import { useBorderPanelLabel } from '../../hooks/border';
|
|
31
31
|
import ContentTab from '../inspector-controls-tabs/content-tab';
|
|
32
|
-
import
|
|
32
|
+
import ViewportVisibilityInfo from '../block-visibility/viewport-visibility-info';
|
|
33
33
|
import { unlock } from '../../lock-unlock';
|
|
34
34
|
|
|
35
35
|
function StyleInspectorSlots( {
|
|
@@ -77,7 +77,6 @@ function StyleInspectorSlots( {
|
|
|
77
77
|
function BlockInspector() {
|
|
78
78
|
const {
|
|
79
79
|
selectedBlockCount,
|
|
80
|
-
selectedBlockClientId,
|
|
81
80
|
renderedBlockName,
|
|
82
81
|
renderedBlockClientId,
|
|
83
82
|
blockType,
|
|
@@ -119,7 +118,6 @@ function BlockInspector() {
|
|
|
119
118
|
|
|
120
119
|
return {
|
|
121
120
|
selectedBlockCount: getSelectedBlockCount(),
|
|
122
|
-
selectedBlockClientId: _selectedBlockClientId,
|
|
123
121
|
renderedBlockClientId: _renderedBlockClientId,
|
|
124
122
|
renderedBlockName: _renderedBlockName,
|
|
125
123
|
blockType: _blockType,
|
|
@@ -257,7 +255,6 @@ function BlockInspector() {
|
|
|
257
255
|
>
|
|
258
256
|
<BlockInspectorSingleBlock
|
|
259
257
|
renderedBlockClientId={ renderedBlockClientId }
|
|
260
|
-
selectedBlockClientId={ selectedBlockClientId }
|
|
261
258
|
blockName={ blockType.name }
|
|
262
259
|
isSectionBlock={ isSectionBlock }
|
|
263
260
|
availableTabs={ availableTabs }
|
|
@@ -309,10 +306,6 @@ const BlockInspectorSingleBlock = ( {
|
|
|
309
306
|
// The block that is displayed in the inspector. This is the block whose
|
|
310
307
|
// controls and information are shown to the user.
|
|
311
308
|
renderedBlockClientId,
|
|
312
|
-
// The actual block that is selected in the editor. This may or may not
|
|
313
|
-
// be the same as the rendered block (e.g., when a child block is selected
|
|
314
|
-
// but its parent section block is the main one rendered in the inspector).
|
|
315
|
-
selectedBlockClientId,
|
|
316
309
|
blockName,
|
|
317
310
|
isSectionBlock,
|
|
318
311
|
availableTabs,
|
|
@@ -322,7 +315,6 @@ const BlockInspectorSingleBlock = ( {
|
|
|
322
315
|
} ) => {
|
|
323
316
|
const hasMultipleTabs = availableTabs?.length > 1;
|
|
324
317
|
const hasParentChildBlockCards =
|
|
325
|
-
window?.__experimentalContentOnlyPatternInsertion &&
|
|
326
318
|
editedContentOnlySection &&
|
|
327
319
|
editedContentOnlySection !== renderedBlockClientId;
|
|
328
320
|
const parentBlockInformation = useBlockDisplayInformation(
|
|
@@ -332,10 +324,6 @@ const BlockInspectorSingleBlock = ( {
|
|
|
332
324
|
renderedBlockClientId
|
|
333
325
|
);
|
|
334
326
|
const isBlockSynced = blockInformation.isSynced;
|
|
335
|
-
const shouldShowTabs = ! isBlockSynced && hasMultipleTabs;
|
|
336
|
-
const isSectionBlockSelected =
|
|
337
|
-
window?.__experimentalContentOnlyPatternInsertion &&
|
|
338
|
-
selectedBlockClientId === renderedBlockClientId;
|
|
339
327
|
|
|
340
328
|
return (
|
|
341
329
|
<div className="block-editor-block-inspector">
|
|
@@ -353,22 +341,22 @@ const BlockInspectorSingleBlock = ( {
|
|
|
353
341
|
isChild={ hasParentChildBlockCards }
|
|
354
342
|
clientId={ renderedBlockClientId }
|
|
355
343
|
/>
|
|
356
|
-
<
|
|
357
|
-
{
|
|
358
|
-
<EditContents clientId={ renderedBlockClientId } />
|
|
359
|
-
) }
|
|
344
|
+
<ViewportVisibilityInfo clientId={ renderedBlockClientId } />
|
|
345
|
+
<EditContents clientId={ renderedBlockClientId } />
|
|
360
346
|
<BlockVariationTransforms blockClientId={ renderedBlockClientId } />
|
|
361
|
-
{
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
347
|
+
{ hasMultipleTabs && (
|
|
348
|
+
<>
|
|
349
|
+
<InspectorControlsTabs
|
|
350
|
+
hasBlockStyles={ hasBlockStyles }
|
|
351
|
+
clientId={ renderedBlockClientId }
|
|
352
|
+
blockName={ blockName }
|
|
353
|
+
tabs={ availableTabs }
|
|
354
|
+
isSectionBlock={ isSectionBlock }
|
|
355
|
+
contentClientIds={ contentClientIds }
|
|
356
|
+
/>
|
|
357
|
+
</>
|
|
370
358
|
) }
|
|
371
|
-
{ !
|
|
359
|
+
{ ! hasMultipleTabs && (
|
|
372
360
|
<>
|
|
373
361
|
{ hasBlockStyles && (
|
|
374
362
|
<BlockStyles clientId={ renderedBlockClientId } />
|
|
@@ -379,15 +367,6 @@ const BlockInspectorSingleBlock = ( {
|
|
|
379
367
|
{ ! isSectionBlock && (
|
|
380
368
|
<StyleInspectorSlots blockName={ blockName } />
|
|
381
369
|
) }
|
|
382
|
-
{ isSectionBlock &&
|
|
383
|
-
isBlockSynced &&
|
|
384
|
-
isSectionBlockSelected && (
|
|
385
|
-
<>
|
|
386
|
-
<InspectorControls.Slot />
|
|
387
|
-
{ /* Allow AdvancedControls so users can adjust local attributes (e.g. additional CSS classes, HTML element). */ }
|
|
388
|
-
<AdvancedControls />
|
|
389
|
-
</>
|
|
390
|
-
) }
|
|
391
370
|
</>
|
|
392
371
|
) }
|
|
393
372
|
<SkipToSelectedBlock key="back" />
|
|
@@ -624,6 +624,8 @@ function BlockListBlockProvider( props ) {
|
|
|
624
624
|
settings?.[ deviceTypeKey ]?.toLowerCase() || 'desktop';
|
|
625
625
|
|
|
626
626
|
const hasLightBlockWrapper = blockType?.apiVersion > 1;
|
|
627
|
+
const isMultiSelected = isBlockMultiSelected( clientId );
|
|
628
|
+
const blockEditingMode = getBlockEditingMode( clientId );
|
|
627
629
|
const previewContext = {
|
|
628
630
|
isPreviewMode,
|
|
629
631
|
blockWithoutAttributes,
|
|
@@ -643,6 +645,9 @@ function BlockListBlockProvider( props ) {
|
|
|
643
645
|
bindableAttributes,
|
|
644
646
|
blockVisibility,
|
|
645
647
|
deviceType,
|
|
648
|
+
isMultiSelected,
|
|
649
|
+
blockEditingMode,
|
|
650
|
+
isEditingDisabled: blockEditingMode === 'disabled',
|
|
646
651
|
};
|
|
647
652
|
|
|
648
653
|
// When in preview mode, we can avoid a lot of selection and
|
|
@@ -654,13 +659,11 @@ function BlockListBlockProvider( props ) {
|
|
|
654
659
|
const canRemove = canRemoveBlock( clientId );
|
|
655
660
|
const canMove = canMoveBlock( clientId );
|
|
656
661
|
const match = getActiveBlockVariation( blockName, attributes );
|
|
657
|
-
const isMultiSelected = isBlockMultiSelected( clientId );
|
|
658
662
|
const checkDeep = true;
|
|
659
663
|
const isAncestorOfSelectedBlock = hasSelectedInnerBlock(
|
|
660
664
|
clientId,
|
|
661
665
|
checkDeep
|
|
662
666
|
);
|
|
663
|
-
const blockEditingMode = getBlockEditingMode( clientId );
|
|
664
667
|
const sectionBlockClientId = _isSectionBlock( clientId )
|
|
665
668
|
? clientId
|
|
666
669
|
: getParentSectionBlock( clientId );
|
|
@@ -476,3 +476,14 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection="true"] .b
|
|
|
476
476
|
cursor: grabbing;
|
|
477
477
|
}
|
|
478
478
|
|
|
479
|
+
.is-preview-mode {
|
|
480
|
+
pointer-events: none;
|
|
481
|
+
|
|
482
|
+
.block-editor-block-list__block {
|
|
483
|
+
pointer-events: auto;
|
|
484
|
+
|
|
485
|
+
> *:not(.block-editor-block-list__block) {
|
|
486
|
+
pointer-events: none;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
@@ -48,23 +48,30 @@ const delayedBlockVisibilityDebounceOptions = {
|
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
function Root( { className, ...settings } ) {
|
|
51
|
-
const {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
51
|
+
const {
|
|
52
|
+
isOutlineMode,
|
|
53
|
+
isFocusMode,
|
|
54
|
+
isPreviewMode,
|
|
55
|
+
editedContentOnlySection,
|
|
56
|
+
} = useSelect( ( select ) => {
|
|
57
|
+
const {
|
|
58
|
+
getSettings,
|
|
59
|
+
isTyping,
|
|
60
|
+
hasBlockSpotlight,
|
|
61
|
+
getEditedContentOnlySection,
|
|
62
|
+
} = unlock( select( blockEditorStore ) );
|
|
63
|
+
const {
|
|
64
|
+
outlineMode,
|
|
65
|
+
focusMode,
|
|
66
|
+
isPreviewMode: _isPreviewMode,
|
|
67
|
+
} = getSettings();
|
|
68
|
+
return {
|
|
69
|
+
isOutlineMode: outlineMode && ! isTyping(),
|
|
70
|
+
isFocusMode: focusMode || hasBlockSpotlight(),
|
|
71
|
+
isPreviewMode: _isPreviewMode,
|
|
72
|
+
editedContentOnlySection: getEditedContentOnlySection(),
|
|
73
|
+
};
|
|
74
|
+
}, [] );
|
|
68
75
|
const registry = useRegistry();
|
|
69
76
|
const { setBlockVisibility } = useDispatch( blockEditorStore );
|
|
70
77
|
|
|
@@ -111,6 +118,7 @@ function Root( { className, ...settings } ) {
|
|
|
111
118
|
className: clsx( 'is-root-container', className, {
|
|
112
119
|
'is-outline-mode': isOutlineMode,
|
|
113
120
|
'is-focus-mode': isFocusMode,
|
|
121
|
+
'is-preview-mode': isPreviewMode,
|
|
114
122
|
} ),
|
|
115
123
|
},
|
|
116
124
|
settings
|