@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
|
@@ -85,6 +85,7 @@ describe( 'selectors', () => {
|
|
|
85
85
|
|
|
86
86
|
beforeEach( () => {
|
|
87
87
|
registerBlockType( 'core/block', {
|
|
88
|
+
apiVersion: 3,
|
|
88
89
|
save: () => null,
|
|
89
90
|
category: 'reusable',
|
|
90
91
|
title: 'Reusable Block Stub',
|
|
@@ -94,6 +95,7 @@ describe( 'selectors', () => {
|
|
|
94
95
|
} );
|
|
95
96
|
|
|
96
97
|
registerBlockType( 'core/test-block-a', {
|
|
98
|
+
apiVersion: 3,
|
|
97
99
|
save: ( props ) => props.attributes.text,
|
|
98
100
|
category: 'design',
|
|
99
101
|
title: 'Test Block A',
|
|
@@ -102,6 +104,7 @@ describe( 'selectors', () => {
|
|
|
102
104
|
} );
|
|
103
105
|
|
|
104
106
|
registerBlockType( 'core/test-block-b', {
|
|
107
|
+
apiVersion: 3,
|
|
105
108
|
save: ( props ) => props.attributes.text,
|
|
106
109
|
category: 'text',
|
|
107
110
|
title: 'Test Block B',
|
|
@@ -113,6 +116,7 @@ describe( 'selectors', () => {
|
|
|
113
116
|
} );
|
|
114
117
|
|
|
115
118
|
registerBlockType( 'core/test-block-c', {
|
|
119
|
+
apiVersion: 3,
|
|
116
120
|
save: ( props ) => props.attributes.text,
|
|
117
121
|
category: 'text',
|
|
118
122
|
title: 'Test Block C',
|
|
@@ -122,6 +126,7 @@ describe( 'selectors', () => {
|
|
|
122
126
|
} );
|
|
123
127
|
|
|
124
128
|
registerBlockType( 'core/freeform', {
|
|
129
|
+
apiVersion: 3,
|
|
125
130
|
save: ( props ) => <RawHTML>{ props.attributes.content }</RawHTML>,
|
|
126
131
|
category: 'text',
|
|
127
132
|
title: 'Test Freeform Content Handler',
|
|
@@ -134,6 +139,7 @@ describe( 'selectors', () => {
|
|
|
134
139
|
} );
|
|
135
140
|
|
|
136
141
|
registerBlockType( 'core/post-content-child', {
|
|
142
|
+
apiVersion: 3,
|
|
137
143
|
save: () => null,
|
|
138
144
|
category: 'text',
|
|
139
145
|
title: 'Test Block Post Content Child',
|
|
@@ -143,6 +149,7 @@ describe( 'selectors', () => {
|
|
|
143
149
|
} );
|
|
144
150
|
|
|
145
151
|
registerBlockType( 'core/test-block-ancestor', {
|
|
152
|
+
apiVersion: 3,
|
|
146
153
|
save: ( props ) => props.attributes.text,
|
|
147
154
|
category: 'text',
|
|
148
155
|
title: 'Test Block required as ancestor',
|
|
@@ -151,6 +158,7 @@ describe( 'selectors', () => {
|
|
|
151
158
|
} );
|
|
152
159
|
|
|
153
160
|
registerBlockType( 'core/test-block-parent', {
|
|
161
|
+
apiVersion: 3,
|
|
154
162
|
save: ( props ) => props.attributes.text,
|
|
155
163
|
category: 'text',
|
|
156
164
|
title: 'Test Block required as parent',
|
|
@@ -159,6 +167,7 @@ describe( 'selectors', () => {
|
|
|
159
167
|
} );
|
|
160
168
|
|
|
161
169
|
registerBlockType( 'core/test-block-requires-ancestor', {
|
|
170
|
+
apiVersion: 3,
|
|
162
171
|
save: ( props ) => props.attributes.text,
|
|
163
172
|
category: 'text',
|
|
164
173
|
title: 'Test Block that requires ancestor',
|
|
@@ -168,6 +177,7 @@ describe( 'selectors', () => {
|
|
|
168
177
|
} );
|
|
169
178
|
|
|
170
179
|
registerBlockType( 'core/test-block-requires-ancestor-parent', {
|
|
180
|
+
apiVersion: 3,
|
|
171
181
|
save: ( props ) => props.attributes.text,
|
|
172
182
|
category: 'text',
|
|
173
183
|
title: 'Test Block that requires both ancestor and parent',
|
|
@@ -3548,6 +3558,7 @@ describe( 'selectors', () => {
|
|
|
3548
3558
|
describe( 'getBlockTransformItems', () => {
|
|
3549
3559
|
beforeAll( () => {
|
|
3550
3560
|
registerBlockType( 'core/with-tranforms-a', {
|
|
3561
|
+
apiVersion: 3,
|
|
3551
3562
|
category: 'text',
|
|
3552
3563
|
title: 'Transforms a',
|
|
3553
3564
|
edit: () => {},
|
|
@@ -3577,6 +3588,7 @@ describe( 'selectors', () => {
|
|
|
3577
3588
|
},
|
|
3578
3589
|
} );
|
|
3579
3590
|
registerBlockType( 'core/with-tranforms-b', {
|
|
3591
|
+
apiVersion: 3,
|
|
3580
3592
|
category: 'text',
|
|
3581
3593
|
title: 'Transforms b',
|
|
3582
3594
|
edit: () => {},
|
|
@@ -3592,6 +3604,7 @@ describe( 'selectors', () => {
|
|
|
3592
3604
|
},
|
|
3593
3605
|
} );
|
|
3594
3606
|
registerBlockType( 'core/with-tranforms-c', {
|
|
3607
|
+
apiVersion: 3,
|
|
3595
3608
|
category: 'text',
|
|
3596
3609
|
title: 'Transforms c',
|
|
3597
3610
|
edit: () => {},
|
|
@@ -4259,18 +4272,21 @@ describe( 'getInserterItems with core blocks prioritization', () => {
|
|
|
4259
4272
|
// the core blocks (usually by using the `init` action), thus affecting the display order.
|
|
4260
4273
|
beforeEach( () => {
|
|
4261
4274
|
registerBlockType( 'plugin/block-a', {
|
|
4275
|
+
apiVersion: 3,
|
|
4262
4276
|
save() {},
|
|
4263
4277
|
category: 'text',
|
|
4264
4278
|
title: 'Plugin Block A',
|
|
4265
4279
|
icon: 'test',
|
|
4266
4280
|
} );
|
|
4267
4281
|
registerBlockType( 'another-plugin/block-b', {
|
|
4282
|
+
apiVersion: 3,
|
|
4268
4283
|
save() {},
|
|
4269
4284
|
category: 'text',
|
|
4270
4285
|
title: 'Another Plugin Block B',
|
|
4271
4286
|
icon: 'test',
|
|
4272
4287
|
} );
|
|
4273
4288
|
registerBlockType( 'plugin/block-c-with-variations', {
|
|
4289
|
+
apiVersion: 3,
|
|
4274
4290
|
save() {},
|
|
4275
4291
|
category: 'text',
|
|
4276
4292
|
title: 'Plugin Block C with variations',
|
|
@@ -4278,11 +4294,13 @@ describe( 'getInserterItems with core blocks prioritization', () => {
|
|
|
4278
4294
|
variations: [ { name: 'variation-a' }, { name: 'variation-b' } ],
|
|
4279
4295
|
} );
|
|
4280
4296
|
registerBlockType( 'core/block', {
|
|
4297
|
+
apiVersion: 3,
|
|
4281
4298
|
save() {},
|
|
4282
4299
|
category: 'text',
|
|
4283
4300
|
title: 'Core Block A',
|
|
4284
4301
|
} );
|
|
4285
4302
|
registerBlockType( 'core/test-block-a', {
|
|
4303
|
+
apiVersion: 3,
|
|
4286
4304
|
save: ( props ) => props.attributes.text,
|
|
4287
4305
|
category: 'design',
|
|
4288
4306
|
title: 'Core Block B',
|
|
@@ -4290,6 +4308,7 @@ describe( 'getInserterItems with core blocks prioritization', () => {
|
|
|
4290
4308
|
keywords: [ 'testing' ],
|
|
4291
4309
|
} );
|
|
4292
4310
|
registerBlockType( 'core/test-block-with-variations', {
|
|
4311
|
+
apiVersion: 3,
|
|
4293
4312
|
save() {},
|
|
4294
4313
|
category: 'text',
|
|
4295
4314
|
title: 'Core Block C with variations',
|
|
@@ -18,11 +18,26 @@ function findOptimalFontSize( textElement, applyFontSize ) {
|
|
|
18
18
|
let bestSize = minSize;
|
|
19
19
|
|
|
20
20
|
const computedStyle = window.getComputedStyle( textElement );
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
let paddingLeft = parseFloat( computedStyle.paddingLeft ) || 0;
|
|
22
|
+
let paddingRight = parseFloat( computedStyle.paddingRight ) || 0;
|
|
23
23
|
const range = document.createRange();
|
|
24
24
|
range.selectNodeContents( textElement );
|
|
25
25
|
|
|
26
|
+
let referenceElement = textElement;
|
|
27
|
+
const parentElement = textElement.parentElement;
|
|
28
|
+
if ( parentElement ) {
|
|
29
|
+
const parentElementComputedStyle =
|
|
30
|
+
window.getComputedStyle( parentElement );
|
|
31
|
+
if ( parentElementComputedStyle?.display === 'flex' ) {
|
|
32
|
+
referenceElement = parentElement;
|
|
33
|
+
paddingLeft +=
|
|
34
|
+
parseFloat( parentElementComputedStyle.paddingLeft ) || 0;
|
|
35
|
+
paddingRight +=
|
|
36
|
+
parseFloat( parentElementComputedStyle.paddingRight ) || 0;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
let maxclientHeight = referenceElement.clientHeight;
|
|
40
|
+
|
|
26
41
|
while ( minSize <= maxSize ) {
|
|
27
42
|
const midSize = Math.floor( ( minSize + maxSize ) / 2 );
|
|
28
43
|
applyFontSize( midSize );
|
|
@@ -36,12 +51,23 @@ function findOptimalFontSize( textElement, applyFontSize ) {
|
|
|
36
51
|
// Check if text fits within the element's width and is not
|
|
37
52
|
// overflowing into the padding area.
|
|
38
53
|
const fitsWidth =
|
|
39
|
-
textElement.scrollWidth <=
|
|
40
|
-
textWidth <=
|
|
54
|
+
textElement.scrollWidth <= referenceElement.clientWidth &&
|
|
55
|
+
textWidth <=
|
|
56
|
+
referenceElement.clientWidth - paddingLeft - paddingRight;
|
|
41
57
|
// Check if text fits within the element's height.
|
|
42
58
|
const fitsHeight =
|
|
43
59
|
alreadyHasScrollableHeight ||
|
|
44
|
-
textElement.scrollHeight <=
|
|
60
|
+
textElement.scrollHeight <= referenceElement.clientHeight ||
|
|
61
|
+
textElement.scrollHeight <= maxclientHeight;
|
|
62
|
+
|
|
63
|
+
// When there are calculated line heights, text may jump in height
|
|
64
|
+
// the available space may decrease while the font size decreases,
|
|
65
|
+
// making text not fit.
|
|
66
|
+
// We store a maximum reference height: the maximum reference element height that was observed
|
|
67
|
+
// during the loop to avoid issues with such jumps.
|
|
68
|
+
if ( referenceElement.clientHeight > maxclientHeight ) {
|
|
69
|
+
maxclientHeight = referenceElement.clientHeight;
|
|
70
|
+
}
|
|
45
71
|
|
|
46
72
|
if ( fitsWidth && fitsHeight ) {
|
|
47
73
|
bestSize = midSize;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/block-editor/src/components/block-visibility/block-visibility-info.js
|
|
21
|
-
var block_visibility_info_exports = {};
|
|
22
|
-
__export(block_visibility_info_exports, {
|
|
23
|
-
default: () => BlockVisibilityInfo
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(block_visibility_info_exports);
|
|
26
|
-
var import_components = require("@wordpress/components");
|
|
27
|
-
var import_data = require("@wordpress/data");
|
|
28
|
-
var import_i18n = require("@wordpress/i18n");
|
|
29
|
-
var import_icons = require("@wordpress/icons");
|
|
30
|
-
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
31
|
-
var import_store = require("../../store/index.cjs");
|
|
32
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
33
|
-
var { Badge } = (0, import_lock_unlock.unlock)(import_components.privateApis);
|
|
34
|
-
function BlockVisibilityInfo({ clientId }) {
|
|
35
|
-
const { isBlockHidden, hasHiddenParent } = (0, import_data.useSelect)(
|
|
36
|
-
(select) => {
|
|
37
|
-
if (!clientId) {
|
|
38
|
-
return { isBlockHidden: false, hasHiddenParent: false };
|
|
39
|
-
}
|
|
40
|
-
const { isBlockHidden: _isBlockHidden, getBlockParents } = (0, import_lock_unlock.unlock)(
|
|
41
|
-
select(import_store.store)
|
|
42
|
-
);
|
|
43
|
-
const blockHidden = _isBlockHidden(clientId);
|
|
44
|
-
const parents = getBlockParents(clientId);
|
|
45
|
-
const parentHidden = parents.some(
|
|
46
|
-
(parentId) => _isBlockHidden(parentId)
|
|
47
|
-
);
|
|
48
|
-
return {
|
|
49
|
-
isBlockHidden: blockHidden,
|
|
50
|
-
hasHiddenParent: parentHidden
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
[clientId]
|
|
54
|
-
);
|
|
55
|
-
if (!(isBlockHidden || hasHiddenParent)) {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { className: "block-editor-block-visibility-info", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalHStack, { spacing: 2, justify: "start", children: [
|
|
59
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Icon, { icon: import_icons.unseen }),
|
|
60
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalText, { children: isBlockHidden ? (0, import_i18n.__)("Block is hidden") : (0, import_i18n.__)("Parent block is hidden") })
|
|
61
|
-
] }) });
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=block-visibility-info.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/block-visibility/block-visibility-info.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { unseen } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as blockEditorStore } from '../../store';\n\nconst { Badge } = unlock( componentsPrivateApis );\n\nexport default function BlockVisibilityInfo( { clientId } ) {\n\tconst { isBlockHidden, hasHiddenParent } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn { isBlockHidden: false, hasHiddenParent: false };\n\t\t\t}\n\t\t\tconst { isBlockHidden: _isBlockHidden, getBlockParents } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\n\t\t\tconst blockHidden = _isBlockHidden( clientId );\n\t\t\tconst parents = getBlockParents( clientId );\n\t\t\tconst parentHidden = parents.some( ( parentId ) =>\n\t\t\t\t_isBlockHidden( parentId )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tisBlockHidden: blockHidden,\n\t\t\t\thasHiddenParent: parentHidden,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tif ( ! ( isBlockHidden || hasHiddenParent ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Badge className=\"block-editor-block-visibility-info\">\n\t\t\t<HStack spacing={ 2 } justify=\"start\">\n\t\t\t\t<Icon icon={ unseen } />\n\t\t\t\t<Text>\n\t\t\t\t\t{ isBlockHidden\n\t\t\t\t\t\t? __( 'Block is hidden' )\n\t\t\t\t\t\t: __( 'Parent block is hidden' ) }\n\t\t\t\t</Text>\n\t\t\t</HStack>\n\t\t</Badge>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAKO;AACP,kBAA0B;AAC1B,kBAAmB;AACnB,mBAAuB;AAKvB,yBAAuB;AACvB,mBAA0C;AAkCvC;AAhCH,IAAM,EAAE,MAAM,QAAI,2BAAQ,kBAAAA,WAAsB;AAEjC,SAAR,oBAAsC,EAAE,SAAS,GAAI;AAC3D,QAAM,EAAE,eAAe,gBAAgB,QAAI;AAAA,IAC1C,CAAE,WAAY;AACb,UAAK,CAAE,UAAW;AACjB,eAAO,EAAE,eAAe,OAAO,iBAAiB,MAAM;AAAA,MACvD;AACA,YAAM,EAAE,eAAe,gBAAgB,gBAAgB,QAAI;AAAA,QAC1D,OAAQ,aAAAC,KAAiB;AAAA,MAC1B;AAEA,YAAM,cAAc,eAAgB,QAAS;AAC7C,YAAM,UAAU,gBAAiB,QAAS;AAC1C,YAAM,eAAe,QAAQ;AAAA,QAAM,CAAE,aACpC,eAAgB,QAAS;AAAA,MAC1B;AAEA,aAAO;AAAA,QACN,eAAe;AAAA,QACf,iBAAiB;AAAA,MAClB;AAAA,IACD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AAEA,MAAK,EAAI,iBAAiB,kBAAoB;AAC7C,WAAO;AAAA,EACR;AAEA,SACC,4CAAC,SAAM,WAAU,sCAChB,uDAAC,kBAAAC,sBAAA,EAAO,SAAU,GAAI,SAAQ,SAC7B;AAAA,gDAAC,0BAAK,MAAO,qBAAS;AAAA,IACtB,4CAAC,kBAAAC,oBAAA,EACE,8BACC,gBAAI,iBAAkB,QACtB,gBAAI,wBAAyB,GACjC;AAAA,KACD,GACD;AAEF;",
|
|
6
|
-
"names": ["componentsPrivateApis", "blockEditorStore", "HStack", "Text"]
|
|
7
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/block-editor/src/components/block-visibility/menu-item.js
|
|
21
|
-
var menu_item_exports = {};
|
|
22
|
-
__export(menu_item_exports, {
|
|
23
|
-
default: () => BlockVisibilityMenuItem
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(menu_item_exports);
|
|
26
|
-
var import_i18n = require("@wordpress/i18n");
|
|
27
|
-
var import_components = require("@wordpress/components");
|
|
28
|
-
var import_icons = require("@wordpress/icons");
|
|
29
|
-
var import_data = require("@wordpress/data");
|
|
30
|
-
var import_notices = require("@wordpress/notices");
|
|
31
|
-
var import_keyboard_shortcuts = require("@wordpress/keyboard-shortcuts");
|
|
32
|
-
var import_utils = require("../../hooks/utils.cjs");
|
|
33
|
-
var import_store = require("../../store/index.cjs");
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
-
function BlockVisibilityMenuItem({ clientIds }) {
|
|
36
|
-
const { updateBlockAttributes } = (0, import_data.useDispatch)(import_store.store);
|
|
37
|
-
const { createSuccessNotice } = (0, import_data.useDispatch)(import_notices.store);
|
|
38
|
-
const blocks = (0, import_data.useSelect)(
|
|
39
|
-
(select) => {
|
|
40
|
-
return select(import_store.store).getBlocksByClientId(clientIds);
|
|
41
|
-
},
|
|
42
|
-
[clientIds]
|
|
43
|
-
);
|
|
44
|
-
const listViewShortcut = (0, import_data.useSelect)((select) => {
|
|
45
|
-
return select(import_keyboard_shortcuts.store).getShortcutRepresentation(
|
|
46
|
-
"core/editor/toggle-list-view"
|
|
47
|
-
);
|
|
48
|
-
}, []);
|
|
49
|
-
const hasHiddenBlock = blocks.some(
|
|
50
|
-
(block) => block.attributes.metadata?.blockVisibility === false
|
|
51
|
-
);
|
|
52
|
-
const toggleBlockVisibility = () => {
|
|
53
|
-
const isHiding = !hasHiddenBlock;
|
|
54
|
-
const attributesByClientId = Object.fromEntries(
|
|
55
|
-
blocks?.map(({ clientId, attributes }) => [
|
|
56
|
-
clientId,
|
|
57
|
-
{
|
|
58
|
-
metadata: (0, import_utils.cleanEmptyObject)({
|
|
59
|
-
...attributes?.metadata,
|
|
60
|
-
blockVisibility: isHiding ? false : void 0
|
|
61
|
-
})
|
|
62
|
-
}
|
|
63
|
-
])
|
|
64
|
-
);
|
|
65
|
-
updateBlockAttributes(clientIds, attributesByClientId, {
|
|
66
|
-
uniqueByBlock: true
|
|
67
|
-
});
|
|
68
|
-
if (isHiding) {
|
|
69
|
-
if (blocks.length > 1) {
|
|
70
|
-
createSuccessNotice(
|
|
71
|
-
(0, import_i18n.sprintf)(
|
|
72
|
-
// translators: %s: The shortcut key to access the List View.
|
|
73
|
-
(0, import_i18n.__)(
|
|
74
|
-
"Blocks hidden. You can access them via the List View (%s)."
|
|
75
|
-
),
|
|
76
|
-
listViewShortcut
|
|
77
|
-
),
|
|
78
|
-
{
|
|
79
|
-
id: "block-visibility-hidden",
|
|
80
|
-
type: "snackbar"
|
|
81
|
-
}
|
|
82
|
-
);
|
|
83
|
-
} else {
|
|
84
|
-
createSuccessNotice(
|
|
85
|
-
(0, import_i18n.sprintf)(
|
|
86
|
-
// translators: %s: The shortcut key to access the List View.
|
|
87
|
-
(0, import_i18n.__)(
|
|
88
|
-
"Block hidden. You can access it via the List View (%s)."
|
|
89
|
-
),
|
|
90
|
-
listViewShortcut
|
|
91
|
-
),
|
|
92
|
-
{
|
|
93
|
-
id: "block-visibility-hidden",
|
|
94
|
-
type: "snackbar"
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
101
|
-
import_components.MenuItem,
|
|
102
|
-
{
|
|
103
|
-
icon: hasHiddenBlock ? import_icons.seen : import_icons.unseen,
|
|
104
|
-
onClick: toggleBlockVisibility,
|
|
105
|
-
children: hasHiddenBlock ? (0, import_i18n.__)("Show") : (0, import_i18n.__)("Hide")
|
|
106
|
-
}
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
//# sourceMappingURL=menu-item.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/block-visibility/menu-item.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport { seen, unseen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport { cleanEmptyObject } from '../../hooks/utils';\nimport { store as blockEditorStore } from '../../store';\n\nexport default function BlockVisibilityMenuItem( { clientIds } ) {\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst blocks = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( blockEditorStore ).getBlocksByClientId( clientIds );\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\tconst listViewShortcut = useSelect( ( select ) => {\n\t\treturn select( keyboardShortcutsStore ).getShortcutRepresentation(\n\t\t\t'core/editor/toggle-list-view'\n\t\t);\n\t}, [] );\n\n\tconst hasHiddenBlock = blocks.some(\n\t\t( block ) => block.attributes.metadata?.blockVisibility === false\n\t);\n\n\tconst toggleBlockVisibility = () => {\n\t\tconst isHiding = ! hasHiddenBlock;\n\n\t\tconst attributesByClientId = Object.fromEntries(\n\t\t\tblocks?.map( ( { clientId, attributes } ) => [\n\t\t\t\tclientId,\n\t\t\t\t{\n\t\t\t\t\tmetadata: cleanEmptyObject( {\n\t\t\t\t\t\t...attributes?.metadata,\n\t\t\t\t\t\tblockVisibility: isHiding ? false : undefined,\n\t\t\t\t\t} ),\n\t\t\t\t},\n\t\t\t] )\n\t\t);\n\t\tupdateBlockAttributes( clientIds, attributesByClientId, {\n\t\t\tuniqueByBlock: true,\n\t\t} );\n\n\t\tif ( isHiding ) {\n\t\t\tif ( blocks.length > 1 ) {\n\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t// translators: %s: The shortcut key to access the List View.\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Blocks hidden. You can access them via the List View (%s).'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tlistViewShortcut\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'block-visibility-hidden',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t// translators: %s: The shortcut key to access the List View.\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Block hidden. You can access it via the List View (%s).'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tlistViewShortcut\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'block-visibility-hidden',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t};\n\n\treturn (\n\t\t<MenuItem\n\t\t\ticon={ hasHiddenBlock ? seen : unseen }\n\t\t\tonClick={ toggleBlockVisibility }\n\t\t>\n\t\t\t{ hasHiddenBlock ? __( 'Show' ) : __( 'Hide' ) }\n\t\t</MenuItem>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA4B;AAC5B,wBAAyB;AACzB,mBAA6B;AAC7B,kBAAuC;AACvC,qBAAsC;AACtC,gCAAgD;AAKhD,mBAAiC;AACjC,mBAA0C;AA0ExC;AAxEa,SAAR,wBAA0C,EAAE,UAAU,GAAI;AAChE,QAAM,EAAE,sBAAsB,QAAI,yBAAa,aAAAA,KAAiB;AAChE,QAAM,EAAE,oBAAoB,QAAI,yBAAa,eAAAC,KAAa;AAC1D,QAAM,aAAS;AAAA,IACd,CAAE,WAAY;AACb,aAAO,OAAQ,aAAAD,KAAiB,EAAE,oBAAqB,SAAU;AAAA,IAClE;AAAA,IACA,CAAE,SAAU;AAAA,EACb;AAEA,QAAM,uBAAmB,uBAAW,CAAE,WAAY;AACjD,WAAO,OAAQ,0BAAAE,KAAuB,EAAE;AAAA,MACvC;AAAA,IACD;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,QAAM,iBAAiB,OAAO;AAAA,IAC7B,CAAE,UAAW,MAAM,WAAW,UAAU,oBAAoB;AAAA,EAC7D;AAEA,QAAM,wBAAwB,MAAM;AACnC,UAAM,WAAW,CAAE;AAEnB,UAAM,uBAAuB,OAAO;AAAA,MACnC,QAAQ,IAAK,CAAE,EAAE,UAAU,WAAW,MAAO;AAAA,QAC5C;AAAA,QACA;AAAA,UACC,cAAU,+BAAkB;AAAA,YAC3B,GAAG,YAAY;AAAA,YACf,iBAAiB,WAAW,QAAQ;AAAA,UACrC,CAAE;AAAA,QACH;AAAA,MACD,CAAE;AAAA,IACH;AACA,0BAAuB,WAAW,sBAAsB;AAAA,MACvD,eAAe;AAAA,IAChB,CAAE;AAEF,QAAK,UAAW;AACf,UAAK,OAAO,SAAS,GAAI;AACxB;AAAA,cACC;AAAA;AAAA,gBAEC;AAAA,cACC;AAAA,YACD;AAAA,YACA;AAAA,UACD;AAAA,UACA;AAAA,YACC,IAAI;AAAA,YACJ,MAAM;AAAA,UACP;AAAA,QACD;AAAA,MACD,OAAO;AACN;AAAA,cACC;AAAA;AAAA,gBAEC;AAAA,cACC;AAAA,YACD;AAAA,YACA;AAAA,UACD;AAAA,UACA;AAAA,YACC,IAAI;AAAA,YACJ,MAAM;AAAA,UACP;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,MAAO,iBAAiB,oBAAO;AAAA,MAC/B,SAAU;AAAA,MAER,+BAAiB,gBAAI,MAAO,QAAI,gBAAI,MAAO;AAAA;AAAA,EAC9C;AAEF;",
|
|
6
|
-
"names": ["blockEditorStore", "noticesStore", "keyboardShortcutsStore"]
|
|
7
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/block-editor/src/components/block-visibility/toolbar.js
|
|
21
|
-
var toolbar_exports = {};
|
|
22
|
-
__export(toolbar_exports, {
|
|
23
|
-
default: () => BlockVisibilityToolbar
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(toolbar_exports);
|
|
26
|
-
var import_i18n = require("@wordpress/i18n");
|
|
27
|
-
var import_components = require("@wordpress/components");
|
|
28
|
-
var import_element = require("@wordpress/element");
|
|
29
|
-
var import_icons = require("@wordpress/icons");
|
|
30
|
-
var import_data = require("@wordpress/data");
|
|
31
|
-
var import_blocks = require("@wordpress/blocks");
|
|
32
|
-
var import_store = require("../../store/index.cjs");
|
|
33
|
-
var import_utils = require("../../hooks/utils.cjs");
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
-
function BlockVisibilityToolbar({ clientIds }) {
|
|
36
|
-
const { blocks, canToggleBlockVisibility } = (0, import_data.useSelect)(
|
|
37
|
-
(select) => {
|
|
38
|
-
const { getBlockName, getBlocksByClientId } = select(import_store.store);
|
|
39
|
-
const _blocks = getBlocksByClientId(clientIds);
|
|
40
|
-
return {
|
|
41
|
-
blocks: _blocks,
|
|
42
|
-
canToggleBlockVisibility: _blocks.every(
|
|
43
|
-
({ clientId }) => (0, import_blocks.hasBlockSupport)(
|
|
44
|
-
getBlockName(clientId),
|
|
45
|
-
"visibility",
|
|
46
|
-
true
|
|
47
|
-
)
|
|
48
|
-
)
|
|
49
|
-
};
|
|
50
|
-
},
|
|
51
|
-
[clientIds]
|
|
52
|
-
);
|
|
53
|
-
const hasHiddenBlock = blocks.some(
|
|
54
|
-
(block) => block.attributes.metadata?.blockVisibility === false
|
|
55
|
-
);
|
|
56
|
-
const hasBlockVisibilityButtonShownRef = (0, import_element.useRef)(false);
|
|
57
|
-
const { updateBlockAttributes } = (0, import_data.useDispatch)(import_store.store);
|
|
58
|
-
(0, import_element.useEffect)(() => {
|
|
59
|
-
if (hasHiddenBlock) {
|
|
60
|
-
hasBlockVisibilityButtonShownRef.current = true;
|
|
61
|
-
}
|
|
62
|
-
}, [hasHiddenBlock]);
|
|
63
|
-
if (!hasHiddenBlock && !hasBlockVisibilityButtonShownRef.current) {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
const toggleBlockVisibility = () => {
|
|
67
|
-
const attributesByClientId = Object.fromEntries(
|
|
68
|
-
blocks?.map(({ clientId, attributes }) => [
|
|
69
|
-
clientId,
|
|
70
|
-
{
|
|
71
|
-
metadata: (0, import_utils.cleanEmptyObject)({
|
|
72
|
-
...attributes?.metadata,
|
|
73
|
-
blockVisibility: hasHiddenBlock ? void 0 : false
|
|
74
|
-
})
|
|
75
|
-
}
|
|
76
|
-
])
|
|
77
|
-
);
|
|
78
|
-
updateBlockAttributes(clientIds, attributesByClientId, {
|
|
79
|
-
uniqueByBlock: true
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
83
|
-
import_components.ToolbarButton,
|
|
84
|
-
{
|
|
85
|
-
disabled: !canToggleBlockVisibility,
|
|
86
|
-
icon: hasHiddenBlock ? import_icons.unseen : import_icons.seen,
|
|
87
|
-
label: hasHiddenBlock ? (0, import_i18n.__)("Hidden") : (0, import_i18n.__)("Visible"),
|
|
88
|
-
onClick: toggleBlockVisibility
|
|
89
|
-
}
|
|
90
|
-
) }) });
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=toolbar.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/block-visibility/toolbar.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { seen, unseen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { cleanEmptyObject } from '../../hooks/utils';\n\nexport default function BlockVisibilityToolbar( { clientIds } ) {\n\tconst { blocks, canToggleBlockVisibility } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockName, getBlocksByClientId } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst _blocks = getBlocksByClientId( clientIds );\n\t\t\treturn {\n\t\t\t\tblocks: _blocks,\n\t\t\t\tcanToggleBlockVisibility: _blocks.every( ( { clientId } ) =>\n\t\t\t\t\thasBlockSupport(\n\t\t\t\t\t\tgetBlockName( clientId ),\n\t\t\t\t\t\t'visibility',\n\t\t\t\t\t\ttrue\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\tconst hasHiddenBlock = blocks.some(\n\t\t( block ) => block.attributes.metadata?.blockVisibility === false\n\t);\n\n\tconst hasBlockVisibilityButtonShownRef = useRef( false );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\t// If the block visibility button has been shown, we don't want to\n\t// remove it from the toolbar until the toolbar is rendered again\n\t// without it. Removing it beforehand can cause focus loss issues.\n\t// It needs to return focus from whence it came, and to do that,\n\t// we need to leave the button in the toolbar.\n\tuseEffect( () => {\n\t\tif ( hasHiddenBlock ) {\n\t\t\thasBlockVisibilityButtonShownRef.current = true;\n\t\t}\n\t}, [ hasHiddenBlock ] );\n\n\tif ( ! hasHiddenBlock && ! hasBlockVisibilityButtonShownRef.current ) {\n\t\treturn null;\n\t}\n\n\tconst toggleBlockVisibility = () => {\n\t\tconst attributesByClientId = Object.fromEntries(\n\t\t\tblocks?.map( ( { clientId, attributes } ) => [\n\t\t\t\tclientId,\n\t\t\t\t{\n\t\t\t\t\tmetadata: cleanEmptyObject( {\n\t\t\t\t\t\t...attributes?.metadata,\n\t\t\t\t\t\tblockVisibility: hasHiddenBlock ? undefined : false,\n\t\t\t\t\t} ),\n\t\t\t\t},\n\t\t\t] )\n\t\t);\n\t\tupdateBlockAttributes( clientIds, attributesByClientId, {\n\t\t\tuniqueByBlock: true,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tdisabled={ ! canToggleBlockVisibility }\n\t\t\t\t\ticon={ hasHiddenBlock ? unseen : seen }\n\t\t\t\t\tlabel={ hasHiddenBlock ? __( 'Hidden' ) : __( 'Visible' ) }\n\t\t\t\t\tonClick={ toggleBlockVisibility }\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,wBAA4C;AAC5C,qBAAkC;AAClC,mBAA6B;AAC7B,kBAAuC;AACvC,oBAAgC;AAKhC,mBAA0C;AAC1C,mBAAiC;AA8D/B;AA5Da,SAAR,uBAAyC,EAAE,UAAU,GAAI;AAC/D,QAAM,EAAE,QAAQ,yBAAyB,QAAI;AAAA,IAC5C,CAAE,WAAY;AACb,YAAM,EAAE,cAAc,oBAAoB,IACzC,OAAQ,aAAAA,KAAiB;AAC1B,YAAM,UAAU,oBAAqB,SAAU;AAC/C,aAAO;AAAA,QACN,QAAQ;AAAA,QACR,0BAA0B,QAAQ;AAAA,UAAO,CAAE,EAAE,SAAS,UACrD;AAAA,YACC,aAAc,QAAS;AAAA,YACvB;AAAA,YACA;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAE,SAAU;AAAA,EACb;AAEA,QAAM,iBAAiB,OAAO;AAAA,IAC7B,CAAE,UAAW,MAAM,WAAW,UAAU,oBAAoB;AAAA,EAC7D;AAEA,QAAM,uCAAmC,uBAAQ,KAAM;AACvD,QAAM,EAAE,sBAAsB,QAAI,yBAAa,aAAAA,KAAiB;AAOhE,gCAAW,MAAM;AAChB,QAAK,gBAAiB;AACrB,uCAAiC,UAAU;AAAA,IAC5C;AAAA,EACD,GAAG,CAAE,cAAe,CAAE;AAEtB,MAAK,CAAE,kBAAkB,CAAE,iCAAiC,SAAU;AACrE,WAAO;AAAA,EACR;AAEA,QAAM,wBAAwB,MAAM;AACnC,UAAM,uBAAuB,OAAO;AAAA,MACnC,QAAQ,IAAK,CAAE,EAAE,UAAU,WAAW,MAAO;AAAA,QAC5C;AAAA,QACA;AAAA,UACC,cAAU,+BAAkB;AAAA,YAC3B,GAAG,YAAY;AAAA,YACf,iBAAiB,iBAAiB,SAAY;AAAA,UAC/C,CAAE;AAAA,QACH;AAAA,MACD,CAAE;AAAA,IACH;AACA,0BAAuB,WAAW,sBAAsB;AAAA,MACvD,eAAe;AAAA,IAChB,CAAE;AAAA,EACH;AAEA,SACC,2EACC,sDAAC,kCACA;AAAA,IAAC;AAAA;AAAA,MACA,UAAW,CAAE;AAAA,MACb,MAAO,iBAAiB,sBAAS;AAAA,MACjC,OAAQ,qBAAiB,gBAAI,QAAS,QAAI,gBAAI,SAAU;AAAA,MACxD,SAAU;AAAA;AAAA,EACX,GACD,GACD;AAEF;",
|
|
6
|
-
"names": ["blockEditorStore"]
|
|
7
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/block-editor/src/components/content-lock/index.js
|
|
21
|
-
var content_lock_exports = {};
|
|
22
|
-
__export(content_lock_exports, {
|
|
23
|
-
ModifyContentOnlySectionMenuItem: () => import_modify_content_lock_menu_item.ModifyContentOnlySectionMenuItem
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(content_lock_exports);
|
|
26
|
-
var import_modify_content_lock_menu_item = require("./modify-content-lock-menu-item.cjs");
|
|
27
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
-
0 && (module.exports = {
|
|
29
|
-
ModifyContentOnlySectionMenuItem
|
|
30
|
-
});
|
|
31
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/content-lock/index.js"],
|
|
4
|
-
"sourcesContent": ["export { ModifyContentOnlySectionMenuItem } from './modify-content-lock-menu-item';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2CAAiD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/block-editor/src/components/content-lock/modify-content-lock-menu-item.js
|
|
21
|
-
var modify_content_lock_menu_item_exports = {};
|
|
22
|
-
__export(modify_content_lock_menu_item_exports, {
|
|
23
|
-
ModifyContentOnlySectionMenuItem: () => ModifyContentOnlySectionMenuItem
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(modify_content_lock_menu_item_exports);
|
|
26
|
-
var import_components = require("@wordpress/components");
|
|
27
|
-
var import_data = require("@wordpress/data");
|
|
28
|
-
var import_i18n = require("@wordpress/i18n");
|
|
29
|
-
var import_store = require("../../store/index.cjs");
|
|
30
|
-
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
31
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
-
function ModifyContentOnlySectionMenuItem({ clientId, onClose }) {
|
|
33
|
-
const { templateLock, isLockedByParent, isEditingContentOnlySection } = (0, import_data.useSelect)(
|
|
34
|
-
(select) => {
|
|
35
|
-
const {
|
|
36
|
-
getContentLockingParent,
|
|
37
|
-
getTemplateLock,
|
|
38
|
-
getEditedContentOnlySection
|
|
39
|
-
} = (0, import_lock_unlock.unlock)(select(import_store.store));
|
|
40
|
-
return {
|
|
41
|
-
templateLock: getTemplateLock(clientId),
|
|
42
|
-
isLockedByParent: !!getContentLockingParent(clientId),
|
|
43
|
-
isEditingContentOnlySection: getEditedContentOnlySection() === clientId
|
|
44
|
-
};
|
|
45
|
-
},
|
|
46
|
-
[clientId]
|
|
47
|
-
);
|
|
48
|
-
const blockEditorActions = (0, import_data.useDispatch)(import_store.store);
|
|
49
|
-
const isContentLocked = !isLockedByParent && templateLock === "contentOnly";
|
|
50
|
-
if (window?.__experimentalContentOnlyPatternInsertion || !isContentLocked && !isEditingContentOnlySection) {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
const { editContentOnlySection } = (0, import_lock_unlock.unlock)(blockEditorActions);
|
|
54
|
-
const showContentOnlyModifyButton = !isEditingContentOnlySection && isContentLocked;
|
|
55
|
-
return showContentOnlyModifyButton && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
56
|
-
import_components.MenuItem,
|
|
57
|
-
{
|
|
58
|
-
onClick: () => {
|
|
59
|
-
editContentOnlySection(clientId);
|
|
60
|
-
onClose();
|
|
61
|
-
},
|
|
62
|
-
children: (0, import_i18n._x)("Modify", "Unlock content locked blocks")
|
|
63
|
-
}
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
-
0 && (module.exports = {
|
|
68
|
-
ModifyContentOnlySectionMenuItem
|
|
69
|
-
});
|
|
70
|
-
//# sourceMappingURL=modify-content-lock-menu-item.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/content-lock/modify-content-lock-menu-item.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n// The implementation of content locking is mainly in this file, although the mechanism\n// to stop editing a content only section when an outside block is selected is in the component\n// `StopEditingContentOnlySectionOnOutsideSelect` at block-editor/src/components/block-list/index.js.\n// Besides the components on this file and the file referenced above the implementation\n// also includes artifacts on the store (actions, reducers, and selector).\n\nexport function ModifyContentOnlySectionMenuItem( { clientId, onClose } ) {\n\tconst { templateLock, isLockedByParent, isEditingContentOnlySection } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetContentLockingParent,\n\t\t\t\t\tgetTemplateLock,\n\t\t\t\t\tgetEditedContentOnlySection,\n\t\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\t\treturn {\n\t\t\t\t\ttemplateLock: getTemplateLock( clientId ),\n\t\t\t\t\tisLockedByParent: !! getContentLockingParent( clientId ),\n\t\t\t\t\tisEditingContentOnlySection:\n\t\t\t\t\t\tgetEditedContentOnlySection() === clientId,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\tconst blockEditorActions = useDispatch( blockEditorStore );\n\tconst isContentLocked =\n\t\t! isLockedByParent && templateLock === 'contentOnly';\n\n\t// Hide the Modify button when the content only pattern insertion experiment is active.\n\t// This is replaced by an alternative UI in the experiment.\n\tif (\n\t\twindow?.__experimentalContentOnlyPatternInsertion ||\n\t\t( ! isContentLocked && ! isEditingContentOnlySection )\n\t) {\n\t\treturn null;\n\t}\n\n\tconst { editContentOnlySection } = unlock( blockEditorActions );\n\tconst showContentOnlyModifyButton =\n\t\t! isEditingContentOnlySection && isContentLocked;\n\n\treturn (\n\t\tshowContentOnlyModifyButton && (\n\t\t\t<MenuItem\n\t\t\t\tonClick={ () => {\n\t\t\t\t\teditContentOnlySection( clientId );\n\t\t\t\t\tonClose();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ _x( 'Modify', 'Unlock content locked blocks' ) }\n\t\t\t</MenuItem>\n\t\t)\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAyB;AACzB,kBAAuC;AACvC,kBAAmB;AAKnB,mBAA0C;AAC1C,yBAAuB;AA6CpB;AArCI,SAAS,iCAAkC,EAAE,UAAU,QAAQ,GAAI;AACzE,QAAM,EAAE,cAAc,kBAAkB,4BAA4B,QACnE;AAAA,IACC,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACD,QAAI,2BAAQ,OAAQ,aAAAA,KAAiB,CAAE;AACvC,aAAO;AAAA,QACN,cAAc,gBAAiB,QAAS;AAAA,QACxC,kBAAkB,CAAC,CAAE,wBAAyB,QAAS;AAAA,QACvD,6BACC,4BAA4B,MAAM;AAAA,MACpC;AAAA,IACD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AACD,QAAM,yBAAqB,yBAAa,aAAAA,KAAiB;AACzD,QAAM,kBACL,CAAE,oBAAoB,iBAAiB;AAIxC,MACC,QAAQ,6CACN,CAAE,mBAAmB,CAAE,6BACxB;AACD,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,uBAAuB,QAAI,2BAAQ,kBAAmB;AAC9D,QAAM,8BACL,CAAE,+BAA+B;AAElC,SACC,+BACC;AAAA,IAAC;AAAA;AAAA,MACA,SAAU,MAAM;AACf,+BAAwB,QAAS;AACjC,gBAAQ;AAAA,MACT;AAAA,MAEE,8BAAI,UAAU,8BAA+B;AAAA;AAAA,EAChD;AAGH;",
|
|
6
|
-
"names": ["blockEditorStore"]
|
|
7
|
-
}
|