@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
|
@@ -16,8 +16,6 @@ import {
|
|
|
16
16
|
plus as add,
|
|
17
17
|
group,
|
|
18
18
|
ungroup,
|
|
19
|
-
seen,
|
|
20
|
-
unseen,
|
|
21
19
|
} from '@wordpress/icons';
|
|
22
20
|
|
|
23
21
|
/**
|
|
@@ -25,7 +23,6 @@ import {
|
|
|
25
23
|
*/
|
|
26
24
|
import BlockIcon from '../block-icon';
|
|
27
25
|
import { store as blockEditorStore } from '../../store';
|
|
28
|
-
import { cleanEmptyObject } from '../../hooks/utils';
|
|
29
26
|
|
|
30
27
|
const getTransformCommands = () =>
|
|
31
28
|
function useTransformCommands() {
|
|
@@ -160,7 +157,6 @@ const getQuickActionsCommands = () =>
|
|
|
160
157
|
getBlockRootClientId,
|
|
161
158
|
getBlocksByClientId,
|
|
162
159
|
canRemoveBlocks,
|
|
163
|
-
getBlockName,
|
|
164
160
|
} = useSelect( blockEditorStore );
|
|
165
161
|
const { getDefaultBlockName, getGroupingBlockName } =
|
|
166
162
|
useSelect( blocksStore );
|
|
@@ -173,7 +169,6 @@ const getQuickActionsCommands = () =>
|
|
|
173
169
|
duplicateBlocks,
|
|
174
170
|
insertAfterBlock,
|
|
175
171
|
insertBeforeBlock,
|
|
176
|
-
updateBlockAttributes,
|
|
177
172
|
} = useDispatch( blockEditorStore );
|
|
178
173
|
|
|
179
174
|
const onGroup = () => {
|
|
@@ -223,11 +218,6 @@ const getQuickActionsCommands = () =>
|
|
|
223
218
|
} );
|
|
224
219
|
const canRemove = canRemoveBlocks( clientIds );
|
|
225
220
|
|
|
226
|
-
const canToggleBlockVisibility =
|
|
227
|
-
blocks.every( ( { clientId } ) =>
|
|
228
|
-
hasBlockSupport( getBlockName( clientId ), 'visibility', true )
|
|
229
|
-
) && ! window.__experimentalHideBlocksBasedOnScreenSize;
|
|
230
|
-
|
|
231
221
|
const commands = [];
|
|
232
222
|
|
|
233
223
|
if ( canDuplicate ) {
|
|
@@ -293,37 +283,6 @@ const getQuickActionsCommands = () =>
|
|
|
293
283
|
} );
|
|
294
284
|
}
|
|
295
285
|
|
|
296
|
-
if ( canToggleBlockVisibility ) {
|
|
297
|
-
const hasHiddenBlock = blocks.some(
|
|
298
|
-
( block ) =>
|
|
299
|
-
block.attributes.metadata?.blockVisibility === false
|
|
300
|
-
);
|
|
301
|
-
|
|
302
|
-
commands.push( {
|
|
303
|
-
name: 'core/toggle-block-visibility',
|
|
304
|
-
label: hasHiddenBlock ? __( 'Show' ) : __( 'Hide' ),
|
|
305
|
-
callback: () => {
|
|
306
|
-
const attributesByClientId = Object.fromEntries(
|
|
307
|
-
blocks?.map( ( { clientId, attributes } ) => [
|
|
308
|
-
clientId,
|
|
309
|
-
{
|
|
310
|
-
metadata: cleanEmptyObject( {
|
|
311
|
-
...attributes?.metadata,
|
|
312
|
-
blockVisibility: hasHiddenBlock
|
|
313
|
-
? undefined
|
|
314
|
-
: false,
|
|
315
|
-
} ),
|
|
316
|
-
},
|
|
317
|
-
] )
|
|
318
|
-
);
|
|
319
|
-
updateBlockAttributes( clientIds, attributesByClientId, {
|
|
320
|
-
uniqueByBlock: true,
|
|
321
|
-
} );
|
|
322
|
-
},
|
|
323
|
-
icon: hasHiddenBlock ? seen : unseen,
|
|
324
|
-
} );
|
|
325
|
-
}
|
|
326
|
-
|
|
327
286
|
return {
|
|
328
287
|
isLoading: false,
|
|
329
288
|
commands: commands.map( ( command ) => ( {
|
|
@@ -89,12 +89,8 @@ export default function useBlockDisplayInformation( clientId ) {
|
|
|
89
89
|
// Check if this block is a pattern
|
|
90
90
|
const patternName = attributes?.metadata?.patternName;
|
|
91
91
|
|
|
92
|
-
if (
|
|
93
|
-
patternName &&
|
|
94
|
-
window?.__experimentalContentOnlyPatternInsertion
|
|
95
|
-
) {
|
|
92
|
+
if ( patternName ) {
|
|
96
93
|
const pattern = __experimentalGetParsedPattern( patternName );
|
|
97
|
-
|
|
98
94
|
const positionLabel = getPositionTypeLabel( attributes );
|
|
99
95
|
return {
|
|
100
96
|
isSynced: false,
|
|
@@ -17,6 +17,7 @@ import { forwardRef } from '@wordpress/element';
|
|
|
17
17
|
import useMultiSelection from './use-multi-selection';
|
|
18
18
|
import useTabNav from './use-tab-nav';
|
|
19
19
|
import useArrowNav from './use-arrow-nav';
|
|
20
|
+
import { usePreviewModeNav } from './use-preview-mode-nav';
|
|
20
21
|
import useSelectAll from './use-select-all';
|
|
21
22
|
import useDragSelection from './use-drag-selection';
|
|
22
23
|
import useSelectionObserver from './use-selection-observer';
|
|
@@ -44,6 +45,7 @@ export function useWritingFlow() {
|
|
|
44
45
|
useMultiSelection(),
|
|
45
46
|
useSelectAll(),
|
|
46
47
|
useArrowNav(),
|
|
48
|
+
usePreviewModeNav(),
|
|
47
49
|
useRefEffect(
|
|
48
50
|
( node ) => {
|
|
49
51
|
node.tabIndex = 0;
|
|
@@ -209,6 +209,11 @@ export default function useArrowNav() {
|
|
|
209
209
|
return;
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
+
// In preview mode, navigation is handled by useSelectableBlocksNav.
|
|
213
|
+
if ( getSettings().isPreviewMode ) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
|
|
212
217
|
// If there is a multi-selection, the arrow keys should collapse the
|
|
213
218
|
// selection to the start or end of the selection.
|
|
214
219
|
if ( hasMultiSelection() ) {
|
|
@@ -30,6 +30,7 @@ export default function useDragSelection() {
|
|
|
30
30
|
const { startMultiSelect, stopMultiSelect } =
|
|
31
31
|
useDispatch( blockEditorStore );
|
|
32
32
|
const {
|
|
33
|
+
getSettings,
|
|
33
34
|
isSelectionEnabled,
|
|
34
35
|
hasSelectedBlock,
|
|
35
36
|
isDraggingBlocks,
|
|
@@ -123,7 +124,12 @@ export default function useDragSelection() {
|
|
|
123
124
|
// child elements of the content editable wrapper are editable
|
|
124
125
|
// and return true for this property. We only want to start
|
|
125
126
|
// multi selecting when the mouse leaves the wrapper.
|
|
126
|
-
|
|
127
|
+
// In preview mode, allow drag selection from blocks since they
|
|
128
|
+
// are not contenteditable.
|
|
129
|
+
if (
|
|
130
|
+
target.getAttribute( 'contenteditable' ) !== 'true' &&
|
|
131
|
+
! getSettings().isPreviewMode
|
|
132
|
+
) {
|
|
127
133
|
return;
|
|
128
134
|
}
|
|
129
135
|
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useRefEffect } from '@wordpress/compose';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { TAB, UP, DOWN, LEFT, RIGHT } from '@wordpress/keycodes';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import { store as blockEditorStore } from '../../store';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* In preview mode, handles Tab and arrow key navigation to move only between
|
|
15
|
+
* block elements, skipping all other focusable content.
|
|
16
|
+
*
|
|
17
|
+
* @return {Function} Ref callback.
|
|
18
|
+
*/
|
|
19
|
+
export function usePreviewModeNav() {
|
|
20
|
+
const isPreviewMode = useSelect(
|
|
21
|
+
( select ) => select( blockEditorStore ).getSettings().isPreviewMode,
|
|
22
|
+
[]
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return useRefEffect(
|
|
26
|
+
( node ) => {
|
|
27
|
+
if ( ! isPreviewMode ) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function onKeyDown( event ) {
|
|
32
|
+
const { keyCode, shiftKey, target } = event;
|
|
33
|
+
|
|
34
|
+
const isTab = keyCode === TAB;
|
|
35
|
+
const isUp = keyCode === UP;
|
|
36
|
+
const isDown = keyCode === DOWN;
|
|
37
|
+
const isLeft = keyCode === LEFT;
|
|
38
|
+
const isRight = keyCode === RIGHT;
|
|
39
|
+
const isArrow = isUp || isDown || isLeft || isRight;
|
|
40
|
+
|
|
41
|
+
if ( ! isTab && ! isArrow ) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const isReverse = isTab ? shiftKey : isUp || isLeft;
|
|
46
|
+
|
|
47
|
+
const blocks = Array.from(
|
|
48
|
+
node.querySelectorAll( '[data-block]' )
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
if ( ! blocks.length ) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const currentBlock = target.closest( '[data-block]' );
|
|
56
|
+
const currentIndex = currentBlock
|
|
57
|
+
? blocks.indexOf( currentBlock )
|
|
58
|
+
: -1;
|
|
59
|
+
|
|
60
|
+
// If focus is not on a block, don't intercept navigation.
|
|
61
|
+
if ( currentIndex === -1 ) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// For Tab navigation, allow escaping the block list at boundaries.
|
|
66
|
+
// For arrow keys, wrap around.
|
|
67
|
+
if ( isTab ) {
|
|
68
|
+
if ( isReverse && currentIndex === 0 ) {
|
|
69
|
+
// At first block, Shift+Tab should exit the block list.
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if ( ! isReverse && currentIndex === blocks.length - 1 ) {
|
|
73
|
+
// At last block, Tab should exit the block list.
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
let nextIndex;
|
|
79
|
+
if ( isReverse ) {
|
|
80
|
+
nextIndex =
|
|
81
|
+
currentIndex <= 0
|
|
82
|
+
? blocks.length - 1
|
|
83
|
+
: currentIndex - 1;
|
|
84
|
+
} else {
|
|
85
|
+
nextIndex =
|
|
86
|
+
currentIndex === -1 || currentIndex >= blocks.length - 1
|
|
87
|
+
? 0
|
|
88
|
+
: currentIndex + 1;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
event.preventDefault();
|
|
92
|
+
blocks[ nextIndex ].focus();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
node.addEventListener( 'keydown', onKeyDown );
|
|
96
|
+
return () => {
|
|
97
|
+
node.removeEventListener( 'keydown', onKeyDown );
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
[ isPreviewMode ]
|
|
101
|
+
);
|
|
102
|
+
}
|
|
@@ -28,8 +28,11 @@ export function addLabelCallback( settings ) {
|
|
|
28
28
|
settings.__experimentalLabel = ( attributes, { context } ) => {
|
|
29
29
|
const { metadata } = attributes;
|
|
30
30
|
|
|
31
|
-
// In the list view, use the block's name attribute as the label.
|
|
32
|
-
if (
|
|
31
|
+
// In the list view and breadcrumb, use the block's name attribute as the label.
|
|
32
|
+
if (
|
|
33
|
+
( context === 'list-view' || context === 'breadcrumb' ) &&
|
|
34
|
+
metadata?.name
|
|
35
|
+
) {
|
|
33
36
|
return metadata.name;
|
|
34
37
|
}
|
|
35
38
|
};
|
|
@@ -113,25 +113,26 @@ if ( window.crossOriginIsolated ) {
|
|
|
113
113
|
'credentialless' in window.HTMLIFrameElement.prototype;
|
|
114
114
|
|
|
115
115
|
const disableEmbedPreviews = createHigherOrderComponent(
|
|
116
|
-
( BlockEdit ) =>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
116
|
+
( BlockEdit ) =>
|
|
117
|
+
function DisableEmbedPreviews( props ) {
|
|
118
|
+
if ( 'core/embed' !== props.name ) {
|
|
119
|
+
return <BlockEdit { ...props } />;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// List of embeds that do not support a preview is from packages/block-library/src/embed/variations.js.
|
|
123
|
+
const previewable =
|
|
124
|
+
supportsCredentialless &&
|
|
125
|
+
! [ 'facebook', 'smugmug' ].includes(
|
|
126
|
+
props.attributes.providerNameSlug
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<BlockEdit
|
|
131
|
+
{ ...props }
|
|
132
|
+
attributes={ { ...props.attributes, previewable } }
|
|
133
|
+
/>
|
|
126
134
|
);
|
|
127
|
-
|
|
128
|
-
return (
|
|
129
|
-
<BlockEdit
|
|
130
|
-
{ ...props }
|
|
131
|
-
attributes={ { ...props.attributes, previewable } }
|
|
132
|
-
/>
|
|
133
|
-
);
|
|
134
|
-
},
|
|
135
|
+
},
|
|
135
136
|
'withDisabledEmbedPreview'
|
|
136
137
|
);
|
|
137
138
|
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useMemo } from '@wordpress/element';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { useInstanceId } from '@wordpress/compose';
|
|
7
|
+
import { getBlockType, hasBlockSupport } from '@wordpress/blocks';
|
|
8
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
9
|
+
import { processCSSNesting } from '@wordpress/global-styles-engine';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import InspectorControls from '../components/inspector-controls';
|
|
15
|
+
import AdvancedPanel, {
|
|
16
|
+
validateCSS,
|
|
17
|
+
} from '../components/global-styles/advanced-panel';
|
|
18
|
+
import { cleanEmptyObject, useStyleOverride } from './utils';
|
|
19
|
+
import { store as blockEditorStore } from '../store';
|
|
20
|
+
|
|
21
|
+
// Stable reference for useInstanceId.
|
|
22
|
+
const CUSTOM_CSS_INSTANCE_REFERENCE = {};
|
|
23
|
+
|
|
24
|
+
// Stable empty object reference for useSelect.
|
|
25
|
+
const EMPTY_STYLE = {};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Inspector control for custom CSS.
|
|
29
|
+
*
|
|
30
|
+
* @param {Object} props Component props.
|
|
31
|
+
* @param {string} props.blockName Block name.
|
|
32
|
+
* @param {Function} props.setAttributes Function to set block attributes.
|
|
33
|
+
* @param {Object} props.style Block style attribute.
|
|
34
|
+
*/
|
|
35
|
+
function CustomCSSControl( { blockName, setAttributes, style } ) {
|
|
36
|
+
const blockType = getBlockType( blockName );
|
|
37
|
+
|
|
38
|
+
function onChange( newStyle ) {
|
|
39
|
+
// Normalize whitespace-only CSS to undefined so it gets cleaned up.
|
|
40
|
+
const css = newStyle?.css?.trim() ? newStyle.css : undefined;
|
|
41
|
+
setAttributes( {
|
|
42
|
+
style: cleanEmptyObject( { ...newStyle, css } ),
|
|
43
|
+
} );
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const cssHelpText = sprintf(
|
|
47
|
+
// translators: %s: is the name of a block e.g., 'Image' or 'Quote'.
|
|
48
|
+
__(
|
|
49
|
+
'Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value, e.g. color: red;.'
|
|
50
|
+
),
|
|
51
|
+
blockType?.title
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<InspectorControls group="advanced">
|
|
56
|
+
<AdvancedPanel
|
|
57
|
+
value={ style }
|
|
58
|
+
onChange={ onChange }
|
|
59
|
+
inheritedValue={ style }
|
|
60
|
+
help={ cssHelpText }
|
|
61
|
+
/>
|
|
62
|
+
</InspectorControls>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function CustomCSSEdit( { clientId, name, setAttributes } ) {
|
|
67
|
+
const { style, canEditCSS } = useSelect(
|
|
68
|
+
( select ) => {
|
|
69
|
+
const { getBlockAttributes, getSettings } =
|
|
70
|
+
select( blockEditorStore );
|
|
71
|
+
return {
|
|
72
|
+
style: getBlockAttributes( clientId )?.style || EMPTY_STYLE,
|
|
73
|
+
canEditCSS: getSettings().canEditCSS,
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
[ clientId ]
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
// Don't render the panel if user lacks edit_css capability.
|
|
80
|
+
if ( ! canEditCSS ) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<CustomCSSControl
|
|
86
|
+
blockName={ name }
|
|
87
|
+
setAttributes={ setAttributes }
|
|
88
|
+
style={ style }
|
|
89
|
+
/>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Hook to handle custom CSS for a block in the editor.
|
|
95
|
+
* Generates a unique class and applies scoped CSS via style override.
|
|
96
|
+
*
|
|
97
|
+
* @param {Object} props Block props.
|
|
98
|
+
* @param {Object} props.style Block style attribute.
|
|
99
|
+
* @return {Object} Block props including className for custom CSS scoping.
|
|
100
|
+
*/
|
|
101
|
+
function useBlockProps( { style } ) {
|
|
102
|
+
const customCSS = style?.css;
|
|
103
|
+
|
|
104
|
+
// Validate CSS is non-empty and passes validation checks.
|
|
105
|
+
const isValidCSS =
|
|
106
|
+
typeof customCSS === 'string' &&
|
|
107
|
+
customCSS.trim().length > 0 &&
|
|
108
|
+
validateCSS( customCSS );
|
|
109
|
+
|
|
110
|
+
const customCSSIdentifier = useInstanceId(
|
|
111
|
+
CUSTOM_CSS_INSTANCE_REFERENCE,
|
|
112
|
+
'wp-custom-css'
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
const customCSSSelector = `.${ customCSSIdentifier }`;
|
|
116
|
+
|
|
117
|
+
// Transform the custom CSS using the same logic as global styles.
|
|
118
|
+
// Only process if CSS is valid (doesn't contain HTML markup).
|
|
119
|
+
const transformedCSS = useMemo( () => {
|
|
120
|
+
if ( ! isValidCSS ) {
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
return processCSSNesting( customCSS, customCSSSelector );
|
|
124
|
+
}, [ customCSS, customCSSSelector, isValidCSS ] );
|
|
125
|
+
|
|
126
|
+
// Inject the CSS via style override.
|
|
127
|
+
useStyleOverride( { css: transformedCSS } );
|
|
128
|
+
|
|
129
|
+
// Only add the class if there's valid custom CSS.
|
|
130
|
+
if ( ! isValidCSS ) {
|
|
131
|
+
return {};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return {
|
|
135
|
+
className: `has-custom-css ${ customCSSIdentifier }`,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Adds a marker class to blocks with custom CSS for server-side rendering.
|
|
141
|
+
*
|
|
142
|
+
* @param {Object} props Additional props applied to save element.
|
|
143
|
+
* @param {Object} blockType Block type definition.
|
|
144
|
+
* @param {Object} attributes Block's attributes.
|
|
145
|
+
* @return {Object} Filtered props applied to save element.
|
|
146
|
+
*/
|
|
147
|
+
function addSaveProps( props, blockType, attributes ) {
|
|
148
|
+
if ( ! hasBlockSupport( blockType, 'customCSS', true ) ) {
|
|
149
|
+
return props;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if ( ! attributes?.style?.css?.trim() ) {
|
|
153
|
+
return props;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Add a class to indicate this block has custom CSS.
|
|
157
|
+
// The actual CSS is rendered server-side using the render_block filter.
|
|
158
|
+
const className = props.className
|
|
159
|
+
? `${ props.className } has-custom-css`
|
|
160
|
+
: 'has-custom-css';
|
|
161
|
+
|
|
162
|
+
return {
|
|
163
|
+
...props,
|
|
164
|
+
className,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export default {
|
|
169
|
+
edit: CustomCSSEdit,
|
|
170
|
+
useBlockProps,
|
|
171
|
+
addSaveProps,
|
|
172
|
+
attributeKeys: [ 'style' ],
|
|
173
|
+
hasSupport( name ) {
|
|
174
|
+
return hasBlockSupport( name, 'customCSS', true );
|
|
175
|
+
},
|
|
176
|
+
};
|
package/src/hooks/fit-text.js
CHANGED
|
@@ -68,18 +68,25 @@ function useFitText( { fitText, name, clientId } ) {
|
|
|
68
68
|
const hasFitTextSupport = hasBlockSupport( name, FIT_TEXT_SUPPORT_KEY );
|
|
69
69
|
const blockElement = useBlockElement( clientId );
|
|
70
70
|
|
|
71
|
-
// Monitor block attribute changes, and
|
|
71
|
+
// Monitor block attribute changes, parent changes, and block mode.
|
|
72
72
|
// Any attribute or parent change may change the available space.
|
|
73
|
-
|
|
73
|
+
// Block mode is needed to disable fit text when in HTML editing mode.
|
|
74
|
+
const { blockAttributes, parentId, blockMode } = useSelect(
|
|
74
75
|
( select ) => {
|
|
75
76
|
if ( ! clientId || ! hasFitTextSupport || ! fitText ) {
|
|
76
77
|
return EMPTY_OBJECT;
|
|
77
78
|
}
|
|
79
|
+
const _blockMode =
|
|
80
|
+
select( blockEditorStore ).getBlockMode( clientId );
|
|
81
|
+
if ( _blockMode === 'html' ) {
|
|
82
|
+
return { blockMode: _blockMode };
|
|
83
|
+
}
|
|
78
84
|
return {
|
|
79
85
|
blockAttributes:
|
|
80
86
|
select( blockEditorStore ).getBlockAttributes( clientId ),
|
|
81
87
|
parentId:
|
|
82
88
|
select( blockEditorStore ).getBlockRootClientId( clientId ),
|
|
89
|
+
blockMode: _blockMode,
|
|
83
90
|
};
|
|
84
91
|
},
|
|
85
92
|
[ clientId, hasFitTextSupport, fitText ]
|
|
@@ -118,7 +125,8 @@ function useFitText( { fitText, name, clientId } ) {
|
|
|
118
125
|
! fitText ||
|
|
119
126
|
! blockElement ||
|
|
120
127
|
! clientId ||
|
|
121
|
-
! hasFitTextSupport
|
|
128
|
+
! hasFitTextSupport ||
|
|
129
|
+
blockMode === 'html'
|
|
122
130
|
) {
|
|
123
131
|
return;
|
|
124
132
|
}
|
|
@@ -189,11 +197,17 @@ function useFitText( { fitText, name, clientId } ) {
|
|
|
189
197
|
applyFitText,
|
|
190
198
|
blockElement,
|
|
191
199
|
hasFitTextSupport,
|
|
200
|
+
blockMode,
|
|
192
201
|
] );
|
|
193
202
|
|
|
194
203
|
// Trigger fit text recalculation when content changes
|
|
195
204
|
useEffect( () => {
|
|
196
|
-
if (
|
|
205
|
+
if (
|
|
206
|
+
fitText &&
|
|
207
|
+
blockElement &&
|
|
208
|
+
hasFitTextSupport &&
|
|
209
|
+
blockMode !== 'html'
|
|
210
|
+
) {
|
|
197
211
|
// Wait for next frame to ensure DOM has updated after content changes
|
|
198
212
|
const frameId = window.requestAnimationFrame( () => {
|
|
199
213
|
if ( blockElement ) {
|
|
@@ -209,6 +223,7 @@ function useFitText( { fitText, name, clientId } ) {
|
|
|
209
223
|
applyFitText,
|
|
210
224
|
blockElement,
|
|
211
225
|
hasFitTextSupport,
|
|
226
|
+
blockMode,
|
|
212
227
|
] );
|
|
213
228
|
|
|
214
229
|
return { fontSize };
|
|
@@ -360,7 +375,7 @@ function WithFitTextFontSize( { fitText, name, clientId, children } ) {
|
|
|
360
375
|
* `editor.BlockEdit` filter.
|
|
361
376
|
*/
|
|
362
377
|
const addFitTextControl = createHigherOrderComponent( ( BlockEdit ) => {
|
|
363
|
-
return ( props )
|
|
378
|
+
return function AddFitTextControl( props ) {
|
|
364
379
|
const { name, attributes, clientId, isSelected, setAttributes } = props;
|
|
365
380
|
const { fitText } = attributes;
|
|
366
381
|
const supportsFitText = hasBlockSupport( name, FIT_TEXT_SUPPORT_KEY );
|
|
@@ -51,21 +51,22 @@ function GridTools( { clientId, layout } ) {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
const addGridVisualizerToBlockEdit = createHigherOrderComponent(
|
|
54
|
-
( BlockEdit ) =>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
( BlockEdit ) =>
|
|
55
|
+
function AddGridVisualizerToBlockEdit( props ) {
|
|
56
|
+
if ( props.attributes.layout?.type !== 'grid' ) {
|
|
57
|
+
return <BlockEdit key="edit" { ...props } />;
|
|
58
|
+
}
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
return (
|
|
61
|
+
<>
|
|
62
|
+
<GridTools
|
|
63
|
+
clientId={ props.clientId }
|
|
64
|
+
layout={ props.attributes.layout }
|
|
65
|
+
/>
|
|
66
|
+
<BlockEdit key="edit" { ...props } />
|
|
67
|
+
</>
|
|
68
|
+
);
|
|
69
|
+
},
|
|
69
70
|
'addGridVisualizerToBlockEdit'
|
|
70
71
|
);
|
|
71
72
|
|
package/src/hooks/index.js
CHANGED
|
@@ -27,11 +27,11 @@ import fontSize from './font-size';
|
|
|
27
27
|
import textAlign from './text-align';
|
|
28
28
|
import fitText from './fit-text';
|
|
29
29
|
import border from './border';
|
|
30
|
+
import customCSS from './custom-css';
|
|
30
31
|
import position from './position';
|
|
31
32
|
import blockStyleVariation from './block-style-variation';
|
|
32
33
|
import layout from './layout';
|
|
33
34
|
import childLayout from './layout-child';
|
|
34
|
-
import contentLockUI from './content-lock-ui';
|
|
35
35
|
import './metadata';
|
|
36
36
|
import blockHooks from './block-hooks';
|
|
37
37
|
import blockBindingsPanel from './block-bindings';
|
|
@@ -47,11 +47,11 @@ createBlockEditFilter(
|
|
|
47
47
|
anchor,
|
|
48
48
|
customClassName,
|
|
49
49
|
style,
|
|
50
|
+
customCSS,
|
|
50
51
|
duotone,
|
|
51
52
|
fitText,
|
|
52
53
|
position,
|
|
53
54
|
layout,
|
|
54
|
-
contentLockUI,
|
|
55
55
|
blockHooks,
|
|
56
56
|
blockBindingsPanel,
|
|
57
57
|
childLayout,
|
|
@@ -73,6 +73,7 @@ createBlockListBlockFilter( [
|
|
|
73
73
|
fontSize,
|
|
74
74
|
fitText,
|
|
75
75
|
border,
|
|
76
|
+
customCSS,
|
|
76
77
|
position,
|
|
77
78
|
blockStyleVariation,
|
|
78
79
|
childLayout,
|
|
@@ -84,6 +85,7 @@ createBlockSaveFilter( [
|
|
|
84
85
|
ariaLabel,
|
|
85
86
|
customClassName,
|
|
86
87
|
border,
|
|
88
|
+
customCSS,
|
|
87
89
|
fitText,
|
|
88
90
|
color,
|
|
89
91
|
style,
|