@wordpress/block-editor 11.0.0 → 11.2.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 +16 -1
- package/LICENSE.md +1 -1
- package/README.md +2 -1
- package/build/components/alignment-control/ui.js +1 -7
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/block-actions/index.js +9 -0
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-alignment-control/use-available-alignments.js +4 -3
- package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build/components/block-icon/index.js +4 -2
- package/build/components/block-icon/index.js.map +1 -1
- package/build/components/block-inspector/index.js +58 -5
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list-appender/index.js +46 -34
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-list-appender/index.native.js +39 -34
- package/build/components/block-list-appender/index.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +18 -18
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/index.native.js +1 -1
- package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +14 -7
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-preview/auto.js +1 -4
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +4 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/index.js +3 -1
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/index.native.js +1 -3
- package/build/components/block-styles/index.native.js.map +1 -1
- package/build/components/block-styles/utils.js +7 -10
- package/build/components/block-styles/utils.js.map +1 -1
- package/build/components/block-toolbar/index.native.js +6 -8
- package/build/components/block-toolbar/index.native.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +1 -3
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js +43 -10
- package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build/components/block-variation-picker/index.js +1 -1
- package/build/components/block-variation-picker/index.js.map +1 -1
- package/build/components/colors/utils.js +2 -6
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors-gradients/control.js +0 -3
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +0 -2
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +2 -19
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -3
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build/components/copy-handler/index.js +37 -9
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/default-style-picker/index.js +1 -0
- package/build/components/default-style-picker/index.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js +5 -2
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/font-sizes/utils.js +10 -4
- package/build/components/font-sizes/utils.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js +14 -12
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/gradients/use-gradient.js +2 -8
- package/build/components/gradients/use-gradient.js.map +1 -1
- package/build/components/iframe/index.js +48 -101
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/iframe/use-compatibility-styles.js +98 -0
- package/build/components/iframe/use-compatibility-styles.js.map +1 -0
- package/build/components/image-size-control/index.js +1 -0
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +6 -2
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +4 -4
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js +4 -3
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/index.js +16 -6
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +8 -5
- package/build/components/inserter/media-tab/hooks.js.map +1 -1
- package/build/components/inserter/menu.js +11 -5
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +6 -3
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-items.js +15 -14
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter/search-results.js +4 -2
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inspector-controls/groups.js +3 -1
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls-tabs/position-controls-panel.js +46 -0
- package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -0
- package/build/components/inspector-controls-tabs/settings-tab.js +3 -1
- package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +4 -11
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build/components/link-control/search-input.js +1 -0
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/block-select-button.js +1 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +3 -44
- package/build/components/off-canvas-editor/appender.js.map +1 -1
- package/build/components/off-canvas-editor/block-contents.js +38 -5
- package/build/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build/components/off-canvas-editor/block-select-button.js +3 -2
- package/build/components/off-canvas-editor/block-select-button.js.map +1 -1
- package/build/components/off-canvas-editor/block.js +51 -57
- package/build/components/off-canvas-editor/block.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +12 -5
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/off-canvas-editor/use-inserted-block.js +58 -0
- package/build/components/off-canvas-editor/use-inserted-block.js.map +1 -0
- package/build/components/provider/index.js +3 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/responsive-block-control/label.js.map +1 -1
- package/build/components/rich-text/format-edit.js +12 -10
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-enter.js +4 -5
- package/build/components/rich-text/use-enter.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +21 -12
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +0 -1
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +1 -1
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/typewriter/index.js +1 -1
- package/build/components/typewriter/index.js.map +1 -1
- package/build/components/url-input/button.js +1 -0
- package/build/components/url-input/button.js.map +1 -1
- package/build/components/url-input/index.js +15 -1
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +2 -2
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/url-popover/link-editor.js +1 -0
- package/build/components/url-popover/link-editor.js.map +1 -1
- package/build/components/use-paste-styles/index.js +188 -0
- package/build/components/use-paste-styles/index.js.map +1 -0
- package/build/components/writing-flow/index.js +1 -1
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +22 -29
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/hooks/border.js +0 -1
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color-panel.js +0 -1
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color.js +1 -2
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/font-family.js +4 -4
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +5 -3
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/metadata.js +1 -1
- package/build/hooks/metadata.js.map +1 -1
- package/build/hooks/position.js +376 -0
- package/build/hooks/position.js.map +1 -0
- package/build/hooks/supports.js +328 -0
- package/build/hooks/supports.js.map +1 -0
- package/build/hooks/use-typography-props.js +11 -8
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/store/reducer.js +27 -9
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +9 -7
- package/build/store/selectors.js.map +1 -1
- package/build/utils/pasting.js +6 -11
- package/build/utils/pasting.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +1 -6
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/block-actions/index.js +6 -0
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js +4 -3
- package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build-module/components/block-icon/index.js +4 -2
- package/build-module/components/block-icon/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +58 -6
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +46 -34
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.native.js +39 -32
- package/build-module/components/block-list-appender/index.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +18 -18
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +14 -7
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +1 -4
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +4 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/index.js +2 -1
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/index.native.js +1 -2
- package/build-module/components/block-styles/index.native.js.map +1 -1
- package/build-module/components/block-styles/utils.js +7 -9
- package/build-module/components/block-styles/utils.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js +6 -8
- package/build-module/components/block-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +1 -2
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js +42 -11
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build-module/components/block-variation-picker/index.js +1 -1
- package/build-module/components/block-variation-picker/index.js.map +1 -1
- package/build-module/components/colors/utils.js +3 -7
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +0 -3
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +0 -2
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +4 -19
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build-module/components/copy-handler/index.js +38 -10
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/default-style-picker/index.js +1 -0
- package/build-module/components/default-style-picker/index.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js +5 -2
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/font-sizes/utils.js +11 -5
- package/build-module/components/font-sizes/utils.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +14 -11
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/gradients/use-gradient.js +2 -7
- package/build-module/components/gradients/use-gradient.js.map +1 -1
- package/build-module/components/iframe/index.js +46 -102
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/iframe/use-compatibility-styles.js +90 -0
- package/build-module/components/iframe/use-compatibility-styles.js.map +1 -0
- package/build-module/components/image-size-control/index.js +1 -0
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +6 -2
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +4 -4
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js +4 -3
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/index.js +16 -6
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +8 -5
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
- package/build-module/components/inserter/menu.js +11 -5
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +6 -3
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-items.js +15 -13
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter/search-results.js +4 -2
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +3 -1
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js +33 -0
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/settings-tab.js +2 -1
- package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +4 -11
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build-module/components/link-control/search-input.js +1 -0
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +1 -1
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +5 -44
- package/build-module/components/off-canvas-editor/appender.js.map +1 -1
- package/build-module/components/off-canvas-editor/block-contents.js +37 -7
- package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build-module/components/off-canvas-editor/block-select-button.js +3 -2
- package/build-module/components/off-canvas-editor/block-select-button.js.map +1 -1
- package/build-module/components/off-canvas-editor/block.js +54 -60
- package/build-module/components/off-canvas-editor/block.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +12 -5
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/use-inserted-block.js +47 -0
- package/build-module/components/off-canvas-editor/use-inserted-block.js.map +1 -0
- package/build-module/components/provider/index.js +3 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/responsive-block-control/label.js +1 -2
- package/build-module/components/responsive-block-control/label.js.map +1 -1
- package/build-module/components/rich-text/format-edit.js +12 -9
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-enter.js +4 -5
- package/build-module/components/rich-text/use-enter.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +22 -12
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +0 -1
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +1 -1
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/typewriter/index.js +1 -1
- package/build-module/components/typewriter/index.js.map +1 -1
- package/build-module/components/url-input/button.js +1 -0
- package/build-module/components/url-input/button.js.map +1 -1
- package/build-module/components/url-input/index.js +14 -1
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +3 -3
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/url-popover/link-editor.js +1 -0
- package/build-module/components/url-popover/link-editor.js.map +1 -1
- package/build-module/components/use-paste-styles/index.js +174 -0
- package/build-module/components/use-paste-styles/index.js.map +1 -0
- package/build-module/components/writing-flow/index.js +1 -1
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +22 -29
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/hooks/border.js +0 -1
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color-panel.js +0 -1
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color.js +1 -2
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/font-family.js +5 -5
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +5 -3
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/metadata.js +1 -1
- package/build-module/hooks/metadata.js.map +1 -1
- package/build-module/hooks/position.js +337 -0
- package/build-module/hooks/position.js.map +1 -0
- package/build-module/hooks/supports.js +257 -0
- package/build-module/hooks/supports.js.map +1 -0
- package/build-module/hooks/use-typography-props.js +11 -8
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/store/reducer.js +27 -8
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +9 -7
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/pasting.js +6 -10
- package/build-module/utils/pasting.js.map +1 -1
- package/build-style/content-rtl.css +60 -3
- package/build-style/content.css +60 -3
- package/build-style/default-editor-styles-rtl.css +3 -3
- package/build-style/default-editor-styles.css +3 -3
- package/build-style/style-rtl.css +62 -69
- package/build-style/style.css +62 -69
- package/package.json +29 -29
- package/src/components/alignment-control/test/index.js +2 -0
- package/src/components/alignment-control/ui.js +1 -7
- package/src/components/block-actions/index.js +5 -0
- package/src/components/block-alignment-control/test/index.js +2 -0
- package/src/components/block-alignment-control/use-available-alignments.js +4 -3
- package/src/components/block-icon/index.js +4 -2
- package/src/components/block-icon/test/index.js +9 -5
- package/src/components/block-inspector/index.js +79 -4
- package/src/components/block-inspector/style.scss +7 -0
- package/src/components/block-list-appender/index.js +65 -54
- package/src/components/block-list-appender/index.native.js +45 -34
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +18 -22
- package/src/components/block-mobile-toolbar/index.native.js +1 -1
- package/src/components/block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap +125 -0
- package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +439 -0
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +42 -0
- package/src/components/block-mover/test/index.native.js +157 -1
- package/src/components/block-pattern-setup/index.js +15 -6
- package/src/components/block-pattern-setup/style.scss +29 -1
- package/src/components/block-preview/auto.js +2 -4
- package/src/components/block-settings-menu/block-settings-dropdown.js +4 -0
- package/src/components/block-styles/index.js +4 -1
- package/src/components/block-styles/index.native.js +1 -2
- package/src/components/block-styles/utils.js +5 -7
- package/src/components/block-switcher/test/index.js +3 -2
- package/src/components/block-toolbar/index.native.js +8 -11
- package/src/components/block-tools/selected-block-popover.js +1 -3
- package/src/components/block-tools/use-block-toolbar-popover-props.js +68 -12
- package/src/components/block-variation-picker/index.js +5 -1
- package/src/components/block-vertical-alignment-control/test/index.js +2 -0
- package/src/components/button-block-appender/{style.scss → content.scss} +0 -0
- package/src/components/colors/test/with-colors.js +2 -0
- package/src/components/colors/utils.js +5 -3
- package/src/components/colors-gradients/control.js +0 -7
- package/src/components/colors-gradients/dropdown.js +0 -2
- package/src/components/colors-gradients/panel-color-gradient-settings.js +4 -22
- package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
- package/src/components/copy-handler/index.js +53 -7
- package/src/components/default-block-appender/test/index.js +2 -0
- package/src/components/default-style-picker/index.js +1 -0
- package/src/components/font-sizes/fluid-utils.js +7 -1
- package/src/components/font-sizes/utils.js +5 -3
- package/src/components/font-sizes/with-font-sizes.js +36 -36
- package/src/components/gradients/use-gradient.js +2 -7
- package/src/components/iframe/index.js +60 -122
- package/src/components/iframe/use-compatibility-styles.js +101 -0
- package/src/components/image-size-control/index.js +1 -0
- package/src/components/image-size-control/test/index.js +147 -79
- package/src/components/inner-blocks/index.js +4 -2
- package/src/components/inserter/block-patterns-tab.js +7 -4
- package/src/components/inserter/hooks/use-insertion-point.js +3 -2
- package/src/components/inserter/index.js +61 -43
- package/src/components/inserter/media-tab/hooks.js +5 -4
- package/src/components/inserter/menu.js +8 -4
- package/src/components/inserter/quick-inserter.js +3 -0
- package/src/components/inserter/search-items.js +1 -2
- package/src/components/inserter/search-results.js +2 -0
- package/src/components/inserter/test/__snapshots__/index.native.js.snap +117 -0
- package/src/components/inserter/test/index.native.js +255 -1
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/position-controls-panel.js +37 -0
- package/src/components/inspector-controls-tabs/settings-tab.js +2 -0
- package/src/components/inspector-controls-tabs/style.scss +15 -0
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -8
- package/src/components/link-control/search-input.js +1 -0
- package/src/components/link-control/style.scss +1 -0
- package/src/components/link-control/test/index.js +18 -4
- package/src/components/list-view/block-select-button.js +1 -1
- package/src/components/list-view/style.scss +14 -10
- package/src/components/media-replace-flow/test/index.js +2 -0
- package/src/components/off-canvas-editor/appender.js +4 -49
- package/src/components/off-canvas-editor/block-contents.js +84 -23
- package/src/components/off-canvas-editor/block-select-button.js +6 -2
- package/src/components/off-canvas-editor/block.js +90 -105
- package/src/components/off-canvas-editor/index.js +21 -2
- package/src/components/off-canvas-editor/style.scss +5 -1
- package/src/components/off-canvas-editor/test/use-inserted-block.js +108 -0
- package/src/components/off-canvas-editor/use-inserted-block.js +47 -0
- package/src/components/provider/index.js +4 -1
- package/src/components/responsive-block-control/label.js +2 -3
- package/src/components/responsive-block-control/test/index.js +4 -2
- package/src/components/rich-text/format-edit.js +6 -10
- package/src/components/rich-text/index.js +1 -0
- package/src/components/rich-text/use-enter.js +4 -4
- package/src/components/rich-text/use-paste-handler.js +33 -14
- package/src/components/spacing-sizes-control/index.js +0 -1
- package/src/components/spacing-sizes-control/utils.js +1 -1
- package/src/components/typewriter/index.js +3 -1
- package/src/components/url-input/README.md +5 -0
- package/src/components/url-input/button.js +1 -0
- package/src/components/url-input/index.js +15 -1
- package/src/components/url-input/test/button.js +2 -0
- package/src/components/url-popover/image-url-input-ui.js +5 -4
- package/src/components/url-popover/link-editor.js +1 -0
- package/src/components/url-popover/test/index.js +21 -5
- package/src/components/use-paste-styles/index.js +230 -0
- package/src/components/warning/test/index.js +2 -0
- package/src/components/writing-flow/index.js +1 -1
- package/src/components/writing-flow/use-arrow-nav.js +20 -28
- package/src/content.scss +1 -0
- package/src/hooks/border.js +0 -1
- package/src/hooks/color-panel.js +0 -1
- package/src/hooks/color.js +0 -2
- package/src/hooks/font-family.js +3 -5
- package/src/hooks/font-size.js +13 -4
- package/src/hooks/index.js +1 -0
- package/src/hooks/metadata.js +1 -2
- package/src/hooks/position.js +375 -0
- package/src/hooks/position.scss +18 -0
- package/src/hooks/supports.js +302 -0
- package/src/hooks/test/__snapshots__/align.native.js.snap +73 -0
- package/src/hooks/test/align.native.js +133 -0
- package/src/hooks/test/use-typography-props.js +26 -0
- package/src/hooks/use-typography-props.js +15 -7
- package/src/store/reducer.js +20 -8
- package/src/store/selectors.js +7 -8
- package/src/store/test/reducer.js +45 -3
- package/src/store/test/selectors.js +12 -9
- package/src/style.scss +2 -1
- package/src/utils/pasting.js +3 -9
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/colors-gradients/use-common-single-multiple-selects.js +0 -21
- package/build/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
- package/build/components/rich-text/file-paste-handler.js +0 -21
- package/build/components/rich-text/file-paste-handler.js.map +0 -1
- package/build-module/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
- package/build-module/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
- package/build-module/components/rich-text/file-paste-handler.js +0 -13
- package/build-module/components/rich-text/file-paste-handler.js.map +0 -1
- package/src/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
- package/src/components/rich-text/file-paste-handler.js +0 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-preview/auto.js"],"names":["MemoizedBlockList","MAX_HEIGHT","ScaledBlockPreview","viewportWidth","containerWidth","__experimentalPadding","__experimentalMinHeight","__experimentalStyles","contentResizeListener","height","contentHeight","styles","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-preview/auto.js"],"names":["MemoizedBlockList","MAX_HEIGHT","ScaledBlockPreview","viewportWidth","containerWidth","__experimentalPadding","__experimentalMinHeight","__experimentalStyles","contentResizeListener","height","contentHeight","styles","duotone","select","settings","store","getSettings","__experimentalFeatures","color","editorStyles","css","__unstableType","svgFilters","default","theme","BlockList","scale","transform","maxHeight","undefined","minHeight","bodyElement","ownerDocument","documentElement","classList","add","style","position","width","padding","boxSizing","pointerEvents","map","preset","slug","AutoBlockPreview","props","containerResizeListener"],"mappings":";;;;;;;;;AAKA;;;;AAFA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAfA;AACA;AACA;;AAMA;AACA;AACA;AAOA;AACA,IAAIA,iBAAJ;AAEA,MAAMC,UAAU,GAAG,IAAnB;;AAEA,SAASC,kBAAT,OAMI;AAAA,MANyB;AAC5BC,IAAAA,aAD4B;AAE5BC,IAAAA,cAF4B;AAG5BC,IAAAA,qBAH4B;AAI5BC,IAAAA,uBAJ4B;AAK5BC,IAAAA;AAL4B,GAMzB;;AACH,MAAK,CAAEJ,aAAP,EAAuB;AACtBA,IAAAA,aAAa,GAAGC,cAAhB;AACA;;AAED,QAAM,CAAEI,qBAAF,EAAyB;AAAEC,IAAAA,MAAM,EAAEC;AAAV,GAAzB,IACL,iCADD;AAEA,QAAM;AAAEC,IAAAA,MAAF;AAAUC,IAAAA;AAAV,MAAsB,qBAAaC,MAAF,IAAc;AAAA;;AACpD,UAAMC,QAAQ,GAAGD,MAAM,CAAEE,YAAF,CAAN,CAAgBC,WAAhB,EAAjB;AACA,WAAO;AACNL,MAAAA,MAAM,EAAEG,QAAQ,C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iBAAD;AAAmB,IAAA,cAAc,EAAG;AAApC,IA5CD,CAVD,CADD;AA2DA;;AAEc,SAASC,gBAAT,CAA2BC,KAA3B,EAAmC;AACjD,QAAM,CAAEC,uBAAF,EAA2B;AAAET,IAAAA,KAAK,EAAElC;AAAT,GAA3B,IACL,iCADD;AAGA,SACC,qDACC;AAAK,IAAA,KAAK,EAAG;AAAEiC,MAAAA,QAAQ,EAAE,UAAZ;AAAwBC,MAAAA,KAAK,EAAE,MAA/B;AAAuC7B,MAAAA,MAAM,EAAE;AAA/C;AAAb,KACGsC,uBADH,CADD,EAIC;AAAK,IAAA,SAAS,EAAC;AAAf,KACG,CAAC,CAAE3C,cAAH,IACD,4BAAC,kBAAD,6BACM0C,KADN;AAEC,IAAA,cAAc,EAAG1C;AAFlB,KAFF,CAJD,CADD;AAeA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useResizeObserver, pure, useRefEffect } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { Disabled } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../block-list';\nimport Iframe from '../iframe';\nimport EditorStyles from '../editor-styles';\nimport { __unstablePresetDuotoneFilter as PresetDuotoneFilter } from '../../components/duotone';\nimport { store } from '../../store';\n\n// This is used to avoid rendering the block list if the sizes change.\nlet MemoizedBlockList;\n\nconst MAX_HEIGHT = 2000;\n\nfunction ScaledBlockPreview( {\n\tviewportWidth,\n\tcontainerWidth,\n\t__experimentalPadding,\n\t__experimentalMinHeight,\n\t__experimentalStyles,\n} ) {\n\tif ( ! viewportWidth ) {\n\t\tviewportWidth = containerWidth;\n\t}\n\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst { styles, duotone } = useSelect( ( select ) => {\n\t\tconst settings = select( store ).getSettings();\n\t\treturn {\n\t\t\tstyles: settings.styles,\n\t\t\tduotone: settings.__experimentalFeatures?.color?.duotone,\n\t\t};\n\t}, [] );\n\n\t// Avoid scrollbars for pattern previews.\n\tconst editorStyles = useMemo( () => {\n\t\tif ( styles ) {\n\t\t\treturn [\n\t\t\t\t...styles,\n\t\t\t\t...__experimentalStyles,\n\t\t\t\t{\n\t\t\t\t\tcss: 'body{height:auto;overflow:hidden;border:none;}',\n\t\t\t\t\t__unstableType: 'presets',\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\treturn styles;\n\t}, [ styles, __experimentalStyles ] );\n\n\tconst svgFilters = useMemo( () => {\n\t\treturn [ ...( duotone?.default ?? [] ), ...( duotone?.theme ?? [] ) ];\n\t}, [ duotone ] );\n\n\t// Initialize on render instead of module top level, to avoid circular dependency issues.\n\tMemoizedBlockList = MemoizedBlockList || pure( BlockList );\n\n\tconst scale = containerWidth / viewportWidth;\n\treturn (\n\t\t<Disabled\n\t\t\tclassName=\"block-editor-block-preview__content\"\n\t\t\tstyle={ {\n\t\t\t\ttransform: `scale(${ scale })`,\n\t\t\t\theight: contentHeight * scale,\n\t\t\t\tmaxHeight:\n\t\t\t\t\tcontentHeight > MAX_HEIGHT ? MAX_HEIGHT * scale : undefined,\n\t\t\t\tminHeight: __experimentalMinHeight,\n\t\t\t} }\n\t\t>\n\t\t\t<Iframe\n\t\t\t\thead={ <EditorStyles styles={ editorStyles } /> }\n\t\t\t\tcontentRef={ useRefEffect( ( bodyElement ) => {\n\t\t\t\t\tconst {\n\t\t\t\t\t\townerDocument: { documentElement },\n\t\t\t\t\t} = bodyElement;\n\t\t\t\t\tdocumentElement.classList.add(\n\t\t\t\t\t\t'block-editor-block-preview__content-iframe'\n\t\t\t\t\t);\n\t\t\t\t\tdocumentElement.style.position = 'absolute';\n\t\t\t\t\tdocumentElement.style.width = '100%';\n\t\t\t\t\tbodyElement.style.padding = __experimentalPadding + 'px';\n\n\t\t\t\t\t// Necessary for contentResizeListener to work.\n\t\t\t\t\tbodyElement.style.boxSizing = 'border-box';\n\t\t\t\t\tbodyElement.style.position = 'absolute';\n\t\t\t\t\tbodyElement.style.width = '100%';\n\t\t\t\t}, [] ) }\n\t\t\t\taria-hidden\n\t\t\t\ttabIndex={ -1 }\n\t\t\t\tstyle={ {\n\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\twidth: viewportWidth,\n\t\t\t\t\theight: contentHeight,\n\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t// This is a catch-all max-height for patterns.\n\t\t\t\t\t// See: https://github.com/WordPress/gutenberg/pull/38175.\n\t\t\t\t\tmaxHeight: MAX_HEIGHT,\n\t\t\t\t\tminHeight:\n\t\t\t\t\t\tscale !== 0 && scale < 1 && __experimentalMinHeight\n\t\t\t\t\t\t\t? __experimentalMinHeight / scale\n\t\t\t\t\t\t\t: __experimentalMinHeight,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ contentResizeListener }\n\t\t\t\t{\n\t\t\t\t\t/* Filters need to be rendered before children to avoid Safari rendering issues. */\n\t\t\t\t\tsvgFilters.map( ( preset ) => (\n\t\t\t\t\t\t<PresetDuotoneFilter\n\t\t\t\t\t\t\tpreset={ preset }\n\t\t\t\t\t\t\tkey={ preset.slug }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) )\n\t\t\t\t}\n\t\t\t\t<MemoizedBlockList renderAppender={ false } />\n\t\t\t</Iframe>\n\t\t</Disabled>\n\t);\n}\n\nexport default function AutoBlockPreview( props ) {\n\tconst [ containerResizeListener, { width: containerWidth } ] =\n\t\tuseResizeObserver();\n\n\treturn (\n\t\t<>\n\t\t\t<div style={ { position: 'relative', width: '100%', height: 0 } }>\n\t\t\t\t{ containerResizeListener }\n\t\t\t</div>\n\t\t\t<div className=\"block-editor-block-preview__container\">\n\t\t\t\t{ !! containerWidth && (\n\t\t\t\t\t<ScaledBlockPreview\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\tcontainerWidth={ containerWidth }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -194,6 +194,7 @@ function BlockSettingsDropdown(_ref2) {
|
|
|
194
194
|
onInsertBefore,
|
|
195
195
|
onRemove,
|
|
196
196
|
onCopy,
|
|
197
|
+
onPasteStyles,
|
|
197
198
|
onMoveTo,
|
|
198
199
|
blocks
|
|
199
200
|
} = _ref3;
|
|
@@ -224,7 +225,9 @@ function BlockSettingsDropdown(_ref2) {
|
|
|
224
225
|
}), (0, _element.createElement)(CopyMenuItem, {
|
|
225
226
|
blocks: blocks,
|
|
226
227
|
onCopy: onCopy
|
|
227
|
-
}),
|
|
228
|
+
}), (0, _element.createElement)(_components.MenuItem, {
|
|
229
|
+
onClick: onPasteStyles
|
|
230
|
+
}, (0, _i18n.__)('Paste styles')), canDuplicate && (0, _element.createElement)(_components.MenuItem, {
|
|
228
231
|
onClick: (0, _compose.pipe)(onClose, onDuplicate, updateSelectionAfterDuplicate),
|
|
229
232
|
shortcut: shortcuts.duplicate
|
|
230
233
|
}, (0, _i18n.__)('Duplicate')), canInsertDefaultBlock && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.MenuItem, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-settings-menu/block-settings-dropdown.js"],"names":["noop","POPOVER_PROPS","className","position","variant","CopyMenuItem","blocks","onCopy","ref","copyMenuItemLabel","length","BlockSettingsDropdown","clientIds","__experimentalSelectBlock","children","__unstableDisplayLocation","props","blockClientIds","Array","isArray","count","firstBlockClientId","firstParentClientId","isDistractionFree","onlyBlock","parentBlockType","previousBlockClientId","nextBlockClientId","selectedBlockClientIds","select","getBlockCount","getBlockName","getBlockRootClientId","getPreviousBlockClientId","getNextBlockClientId","getSelectedBlockClientIds","getSettings","getBlockAttributes","blockEditorStore","getActiveBlockVariation","blocksStore","_firstParentClientId","parentBlockName","shortcuts","getShortcutRepresentation","keyboardShortcutsStore","duplicate","remove","insertAfter","insertBefore","selectBlock","toggleBlockHighlight","updateSelectionAfterDuplicate","clientIdsPromise","ids","blockTitle","clientId","maximumLength","updateSelectionAfterRemove","blockToSelect","includes","label","removeBlockLabel","selectParentButtonRef","gestures","showParentOutlineGestures","onChange","isFocused","parentBlockIsSelected","canDuplicate","canInsertDefaultBlock","canMove","canRemove","onDuplicate","onInsertAfter","onInsertBefore","onRemove","onMoveTo","moreVertical","onClose","icon","title","Children","map","child"],"mappings":";;;;;;;;;;AAWA;;;;AARA;;AAKA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAhCA;AACA;AACA;;AAmBA;AACA;AACA;AAWA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AACA,MAAMC,aAAa,GAAG;AACrBC,EAAAA,SAAS,EAAE,2CADU;AAErBC,EAAAA,QAAQ,EAAE,cAFW;AAGrBC,EAAAA,OAAO,EAAE;AAHY,CAAtB;;AAMA,SAASC,YAAT,OAA4C;AAAA,MAArB;AAAEC,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAAqB;AAC3C,QAAMC,GAAG,GAAG,iCAAoB,MAAM,uBAAWF,MAAX,CAA1B,EAA+CC,MAA/C,CAAZ;AACA,QAAME,iBAAiB,GACtBH,MAAM,CAACI,MAAP,GAAgB,CAAhB,GAAoB,cAAI,aAAJ,CAApB,GAA0C,cAAI,YAAJ,CAD3C;AAEA,SAAO,4BAAC,oBAAD;AAAU,IAAA,GAAG,EAAGF;AAAhB,KAAwBC,iBAAxB,CAAP;AACA;;AAEM,SAASE,qBAAT,QAMH;AAAA,MANmC;AACtCC,IAAAA,SADsC;AAEtCC,IAAAA,yBAFsC;AAGtCC,IAAAA,QAHsC;AAItCC,IAAAA,yBAJsC;AAKtC,OAAGC;AALmC,GAMnC;AACH,QAAMC,cAAc,GAAGC,KAAK,CAACC,OAAN,CAAeP,SAAf,IACpBA,SADoB,GAEpB,CAAEA,SAAF,CAFH;AAGA,QAAMQ,KAAK,GAAGH,cAAc,CAACP,MAA7B;AAC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eF,QAAf;AADX,SAGG,cAAI,SAAJ,CAHH,CA3EF,EAiFGzD,KAAK,KAAK,CAAV,IACD,4BAAC,wBAAD;AACC,QAAA,QAAQ,EAAGC,kBADZ;AAEC,QAAA,QAAQ,EAAG0D;AAFZ,QAlFF,CADD,EAyFC,4BAAC,kCAAD,CAA2B,IAA3B;AACC,QAAA,SAAS,EAAG;AAAEA,UAAAA;AAAF,SADb;AAEC,QAAA,SAAS,EAAGnE,SAFb;AAGC,QAAA,yBAAyB,EACxBG;AAJF,QAzFD,EAgGG,OAAOD,QAAP,KAAoB,UAApB,GACCA,QAAQ,CAAE;AAAEiE,QAAAA;AAAF,OAAF,CADT,GAECG,kBAASC,GAAT,CAAgBC,KAAF,IACd,2BAAcA,KAAd,EAAqB;AAAEL,QAAAA;AAAF,OAArB,CADA,CAlGJ,EAqGGP,SAAS,IACV,4BAAC,qBAAD,QACC,4BAAC,oBAAD;AACC,QAAA,OAAO,EAAG,mBACTO,OADS,EAETH,QAFS,EAGTlB,0BAHS,CADX;AAMC,QAAA,QAAQ,EAAGf,SAAS,CAACI;AANtB,SAQGe,gBARH,CADD,CAtGF,CADC;AAAA,KARH,CAbC;AAAA,GAJH,CADD;AAoJA;;eAEcnD,qB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockType,\n\tserialize,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { moreVertical } from '@wordpress/icons';\nimport {\n\tChildren,\n\tcloneElement,\n\tuseCallback,\n\tuseRef,\n} from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { pipe, useCopyToClipboard } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockActions from '../block-actions';\nimport BlockIcon from '../block-icon';\nimport BlockModeToggle from './block-mode-toggle';\nimport BlockHTMLConvertButton from './block-html-convert-button';\nimport __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';\nimport BlockSettingsMenuControls from '../block-settings-menu-controls';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport { useShowMoversGestures } from '../block-toolbar/utils';\n\nconst noop = () => {};\nconst POPOVER_PROPS = {\n\tclassName: 'block-editor-block-settings-menu__popover',\n\tposition: 'bottom right',\n\tvariant: 'toolbar',\n};\n\nfunction CopyMenuItem( { blocks, onCopy } ) {\n\tconst ref = useCopyToClipboard( () => serialize( blocks ), onCopy );\n\tconst copyMenuItemLabel =\n\t\tblocks.length > 1 ? __( 'Copy blocks' ) : __( 'Copy block' );\n\treturn <MenuItem ref={ ref }>{ copyMenuItemLabel }</MenuItem>;\n}\n\nexport function BlockSettingsDropdown( {\n\tclientIds,\n\t__experimentalSelectBlock,\n\tchildren,\n\t__unstableDisplayLocation,\n\t...props\n} ) {\n\tconst blockClientIds = Array.isArray( clientIds )\n\t\t? clientIds\n\t\t: [ clientIds ];\n\tconst count = blockClientIds.length;\n\tconst firstBlockClientId = blockClientIds[ 0 ];\n\tconst {\n\t\tfirstParentClientId,\n\t\tisDistractionFree,\n\t\tonlyBlock,\n\t\tparentBlockType,\n\t\tpreviousBlockClientId,\n\t\tnextBlockClientId,\n\t\tselectedBlockClientIds,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\tgetNextBlockClientId,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tgetSettings,\n\t\t\t\tgetBlockAttributes,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst { getActiveBlockVariation } = select( blocksStore );\n\n\t\t\tconst _firstParentClientId =\n\t\t\t\tgetBlockRootClientId( firstBlockClientId );\n\t\t\tconst parentBlockName =\n\t\t\t\t_firstParentClientId && getBlockName( _firstParentClientId );\n\n\t\t\treturn {\n\t\t\t\tfirstParentClientId: _firstParentClientId,\n\t\t\t\tisDistractionFree: getSettings().isDistractionFree,\n\t\t\t\tonlyBlock: 1 === getBlockCount( _firstParentClientId ),\n\t\t\t\tparentBlockType:\n\t\t\t\t\t_firstParentClientId &&\n\t\t\t\t\t( getActiveBlockVariation(\n\t\t\t\t\t\tparentBlockName,\n\t\t\t\t\t\tgetBlockAttributes( _firstParentClientId )\n\t\t\t\t\t) ||\n\t\t\t\t\t\tgetBlockType( parentBlockName ) ),\n\t\t\t\tpreviousBlockClientId:\n\t\t\t\t\tgetPreviousBlockClientId( firstBlockClientId ),\n\t\t\t\tnextBlockClientId: getNextBlockClientId( firstBlockClientId ),\n\t\t\t\tselectedBlockClientIds: getSelectedBlockClientIds(),\n\t\t\t};\n\t\t},\n\t\t[ firstBlockClientId ]\n\t);\n\n\tconst shortcuts = useSelect( ( select ) => {\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\t\treturn {\n\t\t\tduplicate: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/duplicate'\n\t\t\t),\n\t\t\tremove: getShortcutRepresentation( 'core/block-editor/remove' ),\n\t\t\tinsertAfter: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/insert-after'\n\t\t\t),\n\t\t\tinsertBefore: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/insert-before'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst { selectBlock, toggleBlockHighlight } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst updateSelectionAfterDuplicate = useCallback(\n\t\t__experimentalSelectBlock\n\t\t\t? async ( clientIdsPromise ) => {\n\t\t\t\t\tconst ids = await clientIdsPromise;\n\t\t\t\t\tif ( ids && ids[ 0 ] ) {\n\t\t\t\t\t\t__experimentalSelectBlock( ids[ 0 ] );\n\t\t\t\t\t}\n\t\t\t }\n\t\t\t: noop,\n\t\t[ __experimentalSelectBlock ]\n\t);\n\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId: firstBlockClientId,\n\t\tmaximumLength: 25,\n\t} );\n\n\tconst updateSelectionAfterRemove = useCallback(\n\t\t__experimentalSelectBlock\n\t\t\t? () => {\n\t\t\t\t\tconst blockToSelect =\n\t\t\t\t\t\tpreviousBlockClientId || nextBlockClientId;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tblockToSelect &&\n\t\t\t\t\t\t// From the block options dropdown, it's possible to remove a block that is not selected,\n\t\t\t\t\t\t// in this case, it's not necessary to update the selection since the selected block wasn't removed.\n\t\t\t\t\t\tselectedBlockClientIds.includes( firstBlockClientId ) &&\n\t\t\t\t\t\t// Don't update selection when next/prev block also is in the selection ( and gets removed ),\n\t\t\t\t\t\t// In case someone selects all blocks and removes them at once.\n\t\t\t\t\t\t! selectedBlockClientIds.includes( blockToSelect )\n\t\t\t\t\t) {\n\t\t\t\t\t\t__experimentalSelectBlock( blockToSelect );\n\t\t\t\t\t}\n\t\t\t }\n\t\t\t: noop,\n\t\t[\n\t\t\t__experimentalSelectBlock,\n\t\t\tpreviousBlockClientId,\n\t\t\tnextBlockClientId,\n\t\t\tselectedBlockClientIds,\n\t\t]\n\t);\n\n\tconst label = sprintf(\n\t\t/* translators: %s: block name */\n\t\t__( 'Remove %s' ),\n\t\tblockTitle\n\t);\n\tconst removeBlockLabel = count === 1 ? label : __( 'Remove blocks' );\n\n\t// Allows highlighting the parent block outline when focusing or hovering\n\t// the parent block selector within the child.\n\tconst selectParentButtonRef = useRef();\n\tconst { gestures: showParentOutlineGestures } = useShowMoversGestures( {\n\t\tref: selectParentButtonRef,\n\t\tonChange( isFocused ) {\n\t\t\tif ( isFocused && isDistractionFree ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttoggleBlockHighlight( firstParentClientId, isFocused );\n\t\t},\n\t} );\n\n\t// This can occur when the selected block (the parent)\n\t// displays child blocks within a List View.\n\tconst parentBlockIsSelected =\n\t\tselectedBlockClientIds?.includes( firstParentClientId );\n\n\treturn (\n\t\t<BlockActions\n\t\t\tclientIds={ clientIds }\n\t\t\t__experimentalUpdateSelection={ ! __experimentalSelectBlock }\n\t\t>\n\t\t\t{ ( {\n\t\t\t\tcanDuplicate,\n\t\t\t\tcanInsertDefaultBlock,\n\t\t\t\tcanMove,\n\t\t\t\tcanRemove,\n\t\t\t\tonDuplicate,\n\t\t\t\tonInsertAfter,\n\t\t\t\tonInsertBefore,\n\t\t\t\tonRemove,\n\t\t\t\tonCopy,\n\t\t\t\tonMoveTo,\n\t\t\t\tblocks,\n\t\t\t} ) => (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\t\tclassName=\"block-editor-block-settings-menu\"\n\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t\tnoIcons\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<__unstableBlockSettingsMenuFirstItem.Slot\n\t\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ ! parentBlockIsSelected &&\n\t\t\t\t\t\t\t\t\t!! firstParentClientId && (\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\t{ ...showParentOutlineGestures }\n\t\t\t\t\t\t\t\t\t\t\tref={ selectParentButtonRef }\n\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\t<BlockIcon\n\t\t\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tparentBlockType.icon\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\t\tselectBlock(\n\t\t\t\t\t\t\t\t\t\t\t\t\tfirstParentClientId\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: Name of the block's parent. */\n\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Select parent block (%s)'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\tparentBlockType.title\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ count === 1 && (\n\t\t\t\t\t\t\t\t\t<BlockHTMLConvertButton\n\t\t\t\t\t\t\t\t\t\tclientId={ firstBlockClientId }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<CopyMenuItem\n\t\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\t\tonCopy={ onCopy }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ canDuplicate && (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\tonDuplicate,\n\t\t\t\t\t\t\t\t\t\t\tupdateSelectionAfterDuplicate\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.duplicate }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Duplicate' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ canInsertDefaultBlock && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\tonInsertBefore\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.insertBefore }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Insert before' ) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\tonInsertAfter\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.insertAfter }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Insert after' ) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ canMove && ! onlyBlock && (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ pipe( onClose, onMoveTo ) }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Move to' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ count === 1 && (\n\t\t\t\t\t\t\t\t\t<BlockModeToggle\n\t\t\t\t\t\t\t\t\t\tclientId={ firstBlockClientId }\n\t\t\t\t\t\t\t\t\t\tonToggle={ onClose }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t<BlockSettingsMenuControls.Slot\n\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t\t__unstableDisplayLocation={\n\t\t\t\t\t\t\t\t\t__unstableDisplayLocation\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ typeof children === 'function'\n\t\t\t\t\t\t\t\t? children( { onClose } )\n\t\t\t\t\t\t\t\t: Children.map( ( child ) =>\n\t\t\t\t\t\t\t\t\t\tcloneElement( child, { onClose } )\n\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t{ canRemove && (\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\tonRemove,\n\t\t\t\t\t\t\t\t\t\t\tupdateSelectionAfterRemove\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.remove }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ removeBlockLabel }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</DropdownMenu>\n\t\t\t) }\n\t\t</BlockActions>\n\t);\n}\n\nexport default BlockSettingsDropdown;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-settings-menu/block-settings-dropdown.js"],"names":["noop","POPOVER_PROPS","className","position","variant","CopyMenuItem","blocks","onCopy","ref","copyMenuItemLabel","length","BlockSettingsDropdown","clientIds","__experimentalSelectBlock","children","__unstableDisplayLocation","props","blockClientIds","Array","isArray","count","firstBlockClientId","firstParentClientId","isDistractionFree","onlyBlock","parentBlockType","previousBlockClientId","nextBlockClientId","selectedBlockClientIds","select","getBlockCount","getBlockName","getBlockRootClientId","getPreviousBlockClientId","getNextBlockClientId","getSelectedBlockClientIds","getSettings","getBlockAttributes","blockEditorStore","getActiveBlockVariation","blocksStore","_firstParentClientId","parentBlockName","shortcuts","getShortcutRepresentation","keyboardShortcutsStore","duplicate","remove","insertAfter","insertBefore","selectBlock","toggleBlockHighlight","updateSelectionAfterDuplicate","clientIdsPromise","ids","blockTitle","clientId","maximumLength","updateSelectionAfterRemove","blockToSelect","includes","label","removeBlockLabel","selectParentButtonRef","gestures","showParentOutlineGestures","onChange","isFocused","parentBlockIsSelected","canDuplicate","canInsertDefaultBlock","canMove","canRemove","onDuplicate","onInsertAfter","onInsertBefore","onRemove","onPasteStyles","onMoveTo","moreVertical","onClose","icon","title","Children","map","child"],"mappings":";;;;;;;;;;AAWA;;;;AARA;;AAKA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAhCA;AACA;AACA;;AAmBA;AACA;AACA;AAWA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AACA,MAAMC,aAAa,GAAG;AACrBC,EAAAA,SAAS,EAAE,2CADU;AAErBC,EAAAA,QAAQ,EAAE,cAFW;AAGrBC,EAAAA,OAAO,EAAE;AAHY,CAAtB;;AAMA,SAASC,YAAT,OAA4C;AAAA,MAArB;AAAEC,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAAqB;AAC3C,QAAMC,GAAG,GAAG,iCAAoB,MAAM,uBAAWF,MAAX,CAA1B,EAA+CC,MAA/C,CAAZ;AACA,QAAME,iBAAiB,GACtBH,MAAM,CAACI,MAAP,GAAgB,CAAhB,GAAoB,cAAI,aAAJ,CAApB,GAA0C,cAAI,YA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;AAAA,GAJH,CADD;AAwJA;;eAEcnD,qB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockType,\n\tserialize,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { moreVertical } from '@wordpress/icons';\nimport {\n\tChildren,\n\tcloneElement,\n\tuseCallback,\n\tuseRef,\n} from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { pipe, useCopyToClipboard } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockActions from '../block-actions';\nimport BlockIcon from '../block-icon';\nimport BlockModeToggle from './block-mode-toggle';\nimport BlockHTMLConvertButton from './block-html-convert-button';\nimport __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';\nimport BlockSettingsMenuControls from '../block-settings-menu-controls';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport { useShowMoversGestures } from '../block-toolbar/utils';\n\nconst noop = () => {};\nconst POPOVER_PROPS = {\n\tclassName: 'block-editor-block-settings-menu__popover',\n\tposition: 'bottom right',\n\tvariant: 'toolbar',\n};\n\nfunction CopyMenuItem( { blocks, onCopy } ) {\n\tconst ref = useCopyToClipboard( () => serialize( blocks ), onCopy );\n\tconst copyMenuItemLabel =\n\t\tblocks.length > 1 ? __( 'Copy blocks' ) : __( 'Copy block' );\n\treturn <MenuItem ref={ ref }>{ copyMenuItemLabel }</MenuItem>;\n}\n\nexport function BlockSettingsDropdown( {\n\tclientIds,\n\t__experimentalSelectBlock,\n\tchildren,\n\t__unstableDisplayLocation,\n\t...props\n} ) {\n\tconst blockClientIds = Array.isArray( clientIds )\n\t\t? clientIds\n\t\t: [ clientIds ];\n\tconst count = blockClientIds.length;\n\tconst firstBlockClientId = blockClientIds[ 0 ];\n\tconst {\n\t\tfirstParentClientId,\n\t\tisDistractionFree,\n\t\tonlyBlock,\n\t\tparentBlockType,\n\t\tpreviousBlockClientId,\n\t\tnextBlockClientId,\n\t\tselectedBlockClientIds,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\tgetNextBlockClientId,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tgetSettings,\n\t\t\t\tgetBlockAttributes,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst { getActiveBlockVariation } = select( blocksStore );\n\n\t\t\tconst _firstParentClientId =\n\t\t\t\tgetBlockRootClientId( firstBlockClientId );\n\t\t\tconst parentBlockName =\n\t\t\t\t_firstParentClientId && getBlockName( _firstParentClientId );\n\n\t\t\treturn {\n\t\t\t\tfirstParentClientId: _firstParentClientId,\n\t\t\t\tisDistractionFree: getSettings().isDistractionFree,\n\t\t\t\tonlyBlock: 1 === getBlockCount( _firstParentClientId ),\n\t\t\t\tparentBlockType:\n\t\t\t\t\t_firstParentClientId &&\n\t\t\t\t\t( getActiveBlockVariation(\n\t\t\t\t\t\tparentBlockName,\n\t\t\t\t\t\tgetBlockAttributes( _firstParentClientId )\n\t\t\t\t\t) ||\n\t\t\t\t\t\tgetBlockType( parentBlockName ) ),\n\t\t\t\tpreviousBlockClientId:\n\t\t\t\t\tgetPreviousBlockClientId( firstBlockClientId ),\n\t\t\t\tnextBlockClientId: getNextBlockClientId( firstBlockClientId ),\n\t\t\t\tselectedBlockClientIds: getSelectedBlockClientIds(),\n\t\t\t};\n\t\t},\n\t\t[ firstBlockClientId ]\n\t);\n\n\tconst shortcuts = useSelect( ( select ) => {\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\t\treturn {\n\t\t\tduplicate: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/duplicate'\n\t\t\t),\n\t\t\tremove: getShortcutRepresentation( 'core/block-editor/remove' ),\n\t\t\tinsertAfter: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/insert-after'\n\t\t\t),\n\t\t\tinsertBefore: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/insert-before'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst { selectBlock, toggleBlockHighlight } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst updateSelectionAfterDuplicate = useCallback(\n\t\t__experimentalSelectBlock\n\t\t\t? async ( clientIdsPromise ) => {\n\t\t\t\t\tconst ids = await clientIdsPromise;\n\t\t\t\t\tif ( ids && ids[ 0 ] ) {\n\t\t\t\t\t\t__experimentalSelectBlock( ids[ 0 ] );\n\t\t\t\t\t}\n\t\t\t }\n\t\t\t: noop,\n\t\t[ __experimentalSelectBlock ]\n\t);\n\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId: firstBlockClientId,\n\t\tmaximumLength: 25,\n\t} );\n\n\tconst updateSelectionAfterRemove = useCallback(\n\t\t__experimentalSelectBlock\n\t\t\t? () => {\n\t\t\t\t\tconst blockToSelect =\n\t\t\t\t\t\tpreviousBlockClientId || nextBlockClientId;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tblockToSelect &&\n\t\t\t\t\t\t// From the block options dropdown, it's possible to remove a block that is not selected,\n\t\t\t\t\t\t// in this case, it's not necessary to update the selection since the selected block wasn't removed.\n\t\t\t\t\t\tselectedBlockClientIds.includes( firstBlockClientId ) &&\n\t\t\t\t\t\t// Don't update selection when next/prev block also is in the selection ( and gets removed ),\n\t\t\t\t\t\t// In case someone selects all blocks and removes them at once.\n\t\t\t\t\t\t! selectedBlockClientIds.includes( blockToSelect )\n\t\t\t\t\t) {\n\t\t\t\t\t\t__experimentalSelectBlock( blockToSelect );\n\t\t\t\t\t}\n\t\t\t }\n\t\t\t: noop,\n\t\t[\n\t\t\t__experimentalSelectBlock,\n\t\t\tpreviousBlockClientId,\n\t\t\tnextBlockClientId,\n\t\t\tselectedBlockClientIds,\n\t\t]\n\t);\n\n\tconst label = sprintf(\n\t\t/* translators: %s: block name */\n\t\t__( 'Remove %s' ),\n\t\tblockTitle\n\t);\n\tconst removeBlockLabel = count === 1 ? label : __( 'Remove blocks' );\n\n\t// Allows highlighting the parent block outline when focusing or hovering\n\t// the parent block selector within the child.\n\tconst selectParentButtonRef = useRef();\n\tconst { gestures: showParentOutlineGestures } = useShowMoversGestures( {\n\t\tref: selectParentButtonRef,\n\t\tonChange( isFocused ) {\n\t\t\tif ( isFocused && isDistractionFree ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttoggleBlockHighlight( firstParentClientId, isFocused );\n\t\t},\n\t} );\n\n\t// This can occur when the selected block (the parent)\n\t// displays child blocks within a List View.\n\tconst parentBlockIsSelected =\n\t\tselectedBlockClientIds?.includes( firstParentClientId );\n\n\treturn (\n\t\t<BlockActions\n\t\t\tclientIds={ clientIds }\n\t\t\t__experimentalUpdateSelection={ ! __experimentalSelectBlock }\n\t\t>\n\t\t\t{ ( {\n\t\t\t\tcanDuplicate,\n\t\t\t\tcanInsertDefaultBlock,\n\t\t\t\tcanMove,\n\t\t\t\tcanRemove,\n\t\t\t\tonDuplicate,\n\t\t\t\tonInsertAfter,\n\t\t\t\tonInsertBefore,\n\t\t\t\tonRemove,\n\t\t\t\tonCopy,\n\t\t\t\tonPasteStyles,\n\t\t\t\tonMoveTo,\n\t\t\t\tblocks,\n\t\t\t} ) => (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\t\tclassName=\"block-editor-block-settings-menu\"\n\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t\tnoIcons\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<__unstableBlockSettingsMenuFirstItem.Slot\n\t\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ ! parentBlockIsSelected &&\n\t\t\t\t\t\t\t\t\t!! firstParentClientId && (\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\t{ ...showParentOutlineGestures }\n\t\t\t\t\t\t\t\t\t\t\tref={ selectParentButtonRef }\n\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\t<BlockIcon\n\t\t\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tparentBlockType.icon\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\t\tselectBlock(\n\t\t\t\t\t\t\t\t\t\t\t\t\tfirstParentClientId\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: Name of the block's parent. */\n\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Select parent block (%s)'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\tparentBlockType.title\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ count === 1 && (\n\t\t\t\t\t\t\t\t\t<BlockHTMLConvertButton\n\t\t\t\t\t\t\t\t\t\tclientId={ firstBlockClientId }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<CopyMenuItem\n\t\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\t\tonCopy={ onCopy }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<MenuItem onClick={ onPasteStyles }>\n\t\t\t\t\t\t\t\t\t{ __( 'Paste styles' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t{ canDuplicate && (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\tonDuplicate,\n\t\t\t\t\t\t\t\t\t\t\tupdateSelectionAfterDuplicate\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.duplicate }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Duplicate' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ canInsertDefaultBlock && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\tonInsertBefore\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.insertBefore }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Insert before' ) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\tonInsertAfter\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.insertAfter }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Insert after' ) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ canMove && ! onlyBlock && (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ pipe( onClose, onMoveTo ) }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Move to' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ count === 1 && (\n\t\t\t\t\t\t\t\t\t<BlockModeToggle\n\t\t\t\t\t\t\t\t\t\tclientId={ firstBlockClientId }\n\t\t\t\t\t\t\t\t\t\tonToggle={ onClose }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t<BlockSettingsMenuControls.Slot\n\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t\t__unstableDisplayLocation={\n\t\t\t\t\t\t\t\t\t__unstableDisplayLocation\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ typeof children === 'function'\n\t\t\t\t\t\t\t\t? children( { onClose } )\n\t\t\t\t\t\t\t\t: Children.map( ( child ) =>\n\t\t\t\t\t\t\t\t\t\tcloneElement( child, { onClose } )\n\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t{ canRemove && (\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\tonRemove,\n\t\t\t\t\t\t\t\t\t\t\tupdateSelectionAfterRemove\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.remove }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ removeBlockLabel }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</DropdownMenu>\n\t\t\t) }\n\t\t</BlockActions>\n\t);\n}\n\nexport default BlockSettingsDropdown;\n"]}
|
|
@@ -17,6 +17,8 @@ var _components = require("@wordpress/components");
|
|
|
17
17
|
|
|
18
18
|
var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
|
|
19
19
|
|
|
20
|
+
var _i18n = require("@wordpress/i18n");
|
|
21
|
+
|
|
20
22
|
var _previewPanel = _interopRequireDefault(require("./preview-panel"));
|
|
21
23
|
|
|
22
24
|
var _useStylesForBlock = _interopRequireDefault(require("./use-styles-for-block"));
|
|
@@ -84,7 +86,7 @@ function BlockStyles(_ref) {
|
|
|
84
86
|
}, (0, _element.createElement)("div", {
|
|
85
87
|
className: "block-editor-block-styles__variants"
|
|
86
88
|
}, stylesToRender.map(style => {
|
|
87
|
-
const buttonText = style.label || style.name;
|
|
89
|
+
const buttonText = style.isDefault ? (0, _i18n.__)('Default') : style.label || style.name;
|
|
88
90
|
return (0, _element.createElement)(_components.Button, {
|
|
89
91
|
className: (0, _classnames.default)('block-editor-block-styles__item', {
|
|
90
92
|
'is-active': activeStyle.name === style.name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-styles/index.js"],"names":["noop","BlockStyles","clientId","onSwitch","onHoverClassName","onSelect","stylesToRender","activeStyle","genericPreviewBlock","className","previewClassName","hoveredStyle","setHoveredStyle","isMobileViewport","length","debouncedSetHoveredStyle","onSelectStylePreview","style","cancel","styleItemHandler","item","name","map","buttonText","label","Slot","version","since"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AAKA;;AAKA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-styles/index.js"],"names":["noop","BlockStyles","clientId","onSwitch","onHoverClassName","onSelect","stylesToRender","activeStyle","genericPreviewBlock","className","previewClassName","hoveredStyle","setHoveredStyle","isMobileViewport","length","debouncedSetHoveredStyle","onSelectStylePreview","style","cancel","styleItemHandler","item","name","map","buttonText","isDefault","label","Slot","version","since"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AAKA;;AACA;;AAKA;;AACA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;AAIA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB,C,CAEA;;;AACA,SAASC,WAAT,OAA+E;AAAA,MAAzD;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,QAAQ,GAAGH,IAAvB;AAA6BI,IAAAA,gBAAgB,GAAGJ;AAAhD,GAAyD;AAC9E,QAAM;AACLK,IAAAA,QADK;AAELC,IAAAA,cAFK;AAGLC,IAAAA,WAHK;AAILC,IAAAA,mBAJK;AAKLC,IAAAA,SAAS,EAAEC;AALN,MAMF,gCAAoB;AACvBR,IAAAA,QADuB;AAEvBC,IAAAA;AAFuB,GAApB,CANJ;AAUA,QAAM,CAAEQ,YAAF,EAAgBC,eAAhB,IAAoC,uBAAU,IAAV,CAA1C;AACA,QAAMC,gBAAgB,GAAG,+BAAkB,QAAlB,EAA4B,GAA5B,CAAzB;;AAEA,MAAK,CAAEP,cAAF,IAAoBA,cAAc,CAACQ,MAAf,KAA0B,CAAnD,EAAuD;AACtD,WAAO,IAAP;AACA;;AAED,QAAMC,wBAAwB,GAAG,uBAAUH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CAAE,IAAF,CAdhC;AAeC,MAAA,OAAO,EAAG,MAAMH,oBAAoB,CAAEC,KAAF,CAfrC;AAgBC,sBAAeV,WAAW,CAACc,IAAZ,KAAqBJ,KAAK,CAACI;AAhB3C,OAkBC,4BAAC,kCAAD;AACC,MAAA,aAAa,EAAG,CADjB;AAEC,MAAA,SAAS,EAAC;AAFX,OAIGE,UAJH,CAlBD,CADD;AA2BA,GAhCC,CADH,CADD,EAoCGZ,YAAY,IAAI,CAAEE,gBAAlB,IACD,4BAAC,mBAAD;AAAS,IAAA,SAAS,EAAC,YAAnB;AAAgC,IAAA,MAAM,EAAG;AAAzC,KACC;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,YAAY,EAAG,MAAMM,gBAAgB,CAAE,IAAF;AAFtC,KAIC,4BAAC,qBAAD;AACC,IAAA,WAAW,EAAGZ,WADf;AAEC,IAAA,SAAS,EAAGG,gBAFb;AAGC,IAAA,mBAAmB,EAAGF,mBAHvB;AAIC,IAAA,KAAK,EAAGG;AAJT,IAJD,CADD,CArCF,CADD;AAsDA;;eAEcV,W;;;AAEfA,WAAW,CAACyB,IAAZ,GAAmB,MAAM;AACxB,2BAAY,kBAAZ,EAAgC;AAC/BC,IAAAA,OAAO,EAAE,KADsB;AAE/BC,IAAAA,KAAK,EAAE;AAFwB,GAAhC;AAKA,SAAO,IAAP;AACA,CAPD","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { debounce, useViewportMatch } from '@wordpress/compose';\nimport {\n\tButton,\n\t__experimentalTruncate as Truncate,\n\tPopover,\n} from '@wordpress/components';\nimport deprecated from '@wordpress/deprecated';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockStylesPreviewPanel from './preview-panel';\nimport useStylesForBlocks from './use-styles-for-block';\n\nconst noop = () => {};\n\n// Block Styles component for the Settings Sidebar.\nfunction BlockStyles( { clientId, onSwitch = noop, onHoverClassName = noop } ) {\n\tconst {\n\t\tonSelect,\n\t\tstylesToRender,\n\t\tactiveStyle,\n\t\tgenericPreviewBlock,\n\t\tclassName: previewClassName,\n\t} = useStylesForBlocks( {\n\t\tclientId,\n\t\tonSwitch,\n\t} );\n\tconst [ hoveredStyle, setHoveredStyle ] = useState( null );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\n\tif ( ! stylesToRender || stylesToRender.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst debouncedSetHoveredStyle = debounce( setHoveredStyle, 250 );\n\n\tconst onSelectStylePreview = ( style ) => {\n\t\tonSelect( style );\n\t\tonHoverClassName( null );\n\t\tsetHoveredStyle( null );\n\t\tdebouncedSetHoveredStyle.cancel();\n\t};\n\n\tconst styleItemHandler = ( item ) => {\n\t\tif ( hoveredStyle === item ) {\n\t\t\tdebouncedSetHoveredStyle.cancel();\n\t\t\treturn;\n\t\t}\n\t\tdebouncedSetHoveredStyle( item );\n\t\tonHoverClassName( item?.name ?? null );\n\t};\n\n\treturn (\n\t\t<div className=\"block-editor-block-styles\">\n\t\t\t<div className=\"block-editor-block-styles__variants\">\n\t\t\t\t{ stylesToRender.map( ( style ) => {\n\t\t\t\t\tconst buttonText = style.isDefault\n\t\t\t\t\t\t? __( 'Default' )\n\t\t\t\t\t\t: style.label || style.name;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-block-styles__item',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'is-active':\n\t\t\t\t\t\t\t\t\t\tactiveStyle.name === style.name,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tkey={ style.name }\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tlabel={ buttonText }\n\t\t\t\t\t\t\tonMouseEnter={ () => styleItemHandler( style ) }\n\t\t\t\t\t\t\tonFocus={ () => styleItemHandler( style ) }\n\t\t\t\t\t\t\tonMouseLeave={ () => styleItemHandler( null ) }\n\t\t\t\t\t\t\tonBlur={ () => styleItemHandler( null ) }\n\t\t\t\t\t\t\tonClick={ () => onSelectStylePreview( style ) }\n\t\t\t\t\t\t\taria-current={ activeStyle.name === style.name }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-block-styles__item-text\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ buttonText }\n\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t\t{ hoveredStyle && ! isMobileViewport && (\n\t\t\t\t<Popover placement=\"left-start\" offset={ 20 }>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"block-editor-block-styles__preview-panel\"\n\t\t\t\t\t\tonMouseLeave={ () => styleItemHandler( null ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockStylesPreviewPanel\n\t\t\t\t\t\t\tactiveStyle={ activeStyle }\n\t\t\t\t\t\t\tclassName={ previewClassName }\n\t\t\t\t\t\t\tgenericPreviewBlock={ genericPreviewBlock }\n\t\t\t\t\t\t\tstyle={ hoveredStyle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default BlockStyles;\n\nBlockStyles.Slot = () => {\n\tdeprecated( 'BlockStyles.Slot', {\n\t\tversion: '6.4',\n\t\tsince: '6.2',\n\t} );\n\n\treturn null;\n};\n"]}
|
|
@@ -11,8 +11,6 @@ var _element = require("@wordpress/element");
|
|
|
11
11
|
|
|
12
12
|
var _reactNative = require("react-native");
|
|
13
13
|
|
|
14
|
-
var _lodash = require("lodash");
|
|
15
|
-
|
|
16
14
|
var _blocks = require("@wordpress/blocks");
|
|
17
15
|
|
|
18
16
|
var _data = require("@wordpress/data");
|
|
@@ -65,7 +63,7 @@ function BlockStyles(_ref) {
|
|
|
65
63
|
const {
|
|
66
64
|
updateBlockAttributes
|
|
67
65
|
} = (0, _data.useDispatch)(_store.store);
|
|
68
|
-
const renderedStyles =
|
|
66
|
+
const renderedStyles = styles !== null && styles !== void 0 && styles.find(style => style.isDefault) ? styles : [{
|
|
69
67
|
name: 'default',
|
|
70
68
|
label: (0, _i18n._x)('Default', 'block style'),
|
|
71
69
|
isDefault: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-styles/index.native.js"],"names":["BlockStyles","clientId","url","selector","select","getBlock","blockEditorStore","getBlockStyles","blocksStore","block","styles","name","className","attributes","updateBlockAttributes","renderedStyles","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-styles/index.native.js"],"names":["BlockStyles","clientId","url","selector","select","getBlock","blockEditorStore","getBlockStyles","blocksStore","block","styles","name","className","attributes","updateBlockAttributes","renderedStyles","find","style","isDefault","label","mappedRenderedStyles","activeStyle","map","styleClassName","isActive","onStylePress","length","containerStyles","content"],"mappings":";;;;;;;;;AAUA;;AAPA;;AAKA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAMA,SAASA,WAAT,OAA0C;AAAA,MAApB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAoB;;AACzC,QAAMC,QAAQ,GAAKC,MAAF,IAAc;AAC9B,UAAM;AAAEC,MAAAA;AAAF,QAAeD,MAAM,CAAEE,YAAF,CAA3B;AACA,UAAM;AAAEC,MAAAA;AAAF,QAAqBH,MAAM,CAAEI,aAAF,CAAjC;AACA,UAAMC,KAAK,GAAGJ,QAAQ,CAAEJ,QAAF,CAAtB;AACA,WAAO;AACNS,MAAAA,MAAM,EAAEH,c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CAAP;AAwBA,GA3B4B,EA2B1B,CAAEa,cAAF,EAAkBH,SAAlB,EAA6BX,QAA7B,CA3B0B,CAA7B;;AA6BA,MAAK,CAAES,MAAF,IAAYA,MAAM,CAACgB,MAAP,KAAkB,CAAnC,EAAuC;AACtC,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,uBAAD;AACC,IAAA,UAAU,MADX;AAEC,IAAA,8BAA8B,EAAG,KAFlC;AAGC,IAAA,qBAAqB,EAAGC,eAAgBC;AAHzC,KAKGR,oBALH,CADD;AASA;;eAEcpB,W","sourcesContent":["/**\n * External dependencies\n */\nimport { ScrollView } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getActiveStyle, replaceActiveStyle } from './utils';\nimport StylePreview from './preview';\nimport containerStyles from './style.scss';\nimport { store as blockEditorStore } from '../../store';\n\nfunction BlockStyles( { clientId, url } ) {\n\tconst selector = ( select ) => {\n\t\tconst { getBlock } = select( blockEditorStore );\n\t\tconst { getBlockStyles } = select( blocksStore );\n\t\tconst block = getBlock( clientId );\n\t\treturn {\n\t\t\tstyles: getBlockStyles( block.name ),\n\t\t\tclassName: block.attributes.className || '',\n\t\t};\n\t};\n\n\tconst { styles, className } = useSelect( selector, [ clientId ] );\n\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst renderedStyles = styles?.find( ( style ) => style.isDefault )\n\t\t? styles\n\t\t: [\n\t\t\t\t{\n\t\t\t\t\tname: 'default',\n\t\t\t\t\tlabel: _x( 'Default', 'block style' ),\n\t\t\t\t\tisDefault: true,\n\t\t\t\t},\n\t\t\t\t...styles,\n\t\t ];\n\n\tconst mappedRenderedStyles = useMemo( () => {\n\t\tconst activeStyle = getActiveStyle( renderedStyles, className );\n\n\t\treturn renderedStyles.map( ( style ) => {\n\t\t\tconst styleClassName = replaceActiveStyle(\n\t\t\t\tclassName,\n\t\t\t\tactiveStyle,\n\t\t\t\tstyle\n\t\t\t);\n\t\t\tconst isActive = activeStyle === style;\n\n\t\t\tconst onStylePress = () => {\n\t\t\t\tupdateBlockAttributes( clientId, {\n\t\t\t\t\tclassName: styleClassName,\n\t\t\t\t} );\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\t<StylePreview\n\t\t\t\t\tonPress={ onStylePress }\n\t\t\t\t\tisActive={ isActive }\n\t\t\t\t\tkey={ style.name }\n\t\t\t\t\tstyle={ style }\n\t\t\t\t\turl={ url }\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\t}, [ renderedStyles, className, clientId ] );\n\n\tif ( ! styles || styles.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ScrollView\n\t\t\thorizontal\n\t\t\tshowsHorizontalScrollIndicator={ false }\n\t\t\tcontentContainerStyle={ containerStyles.content }\n\t\t>\n\t\t\t{ mappedRenderedStyles }\n\t\t</ScrollView>\n\t);\n}\n\nexport default BlockStyles;\n"]}
|
|
@@ -10,16 +10,10 @@ exports.getDefaultStyle = getDefaultStyle;
|
|
|
10
10
|
exports.getRenderedStyles = getRenderedStyles;
|
|
11
11
|
exports.replaceActiveStyle = replaceActiveStyle;
|
|
12
12
|
|
|
13
|
-
var _lodash = require("lodash");
|
|
14
|
-
|
|
15
13
|
var _tokenList = _interopRequireDefault(require("@wordpress/token-list"));
|
|
16
14
|
|
|
17
15
|
var _i18n = require("@wordpress/i18n");
|
|
18
16
|
|
|
19
|
-
/**
|
|
20
|
-
* External dependencies
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
17
|
/**
|
|
24
18
|
* WordPress dependencies
|
|
25
19
|
*/
|
|
@@ -39,8 +33,11 @@ function getActiveStyle(styles, className) {
|
|
|
39
33
|
}
|
|
40
34
|
|
|
41
35
|
const potentialStyleName = style.substring(9);
|
|
42
|
-
const activeStyle =
|
|
43
|
-
|
|
36
|
+
const activeStyle = styles === null || styles === void 0 ? void 0 : styles.find(_ref => {
|
|
37
|
+
let {
|
|
38
|
+
name
|
|
39
|
+
} = _ref;
|
|
40
|
+
return name === potentialStyleName;
|
|
44
41
|
});
|
|
45
42
|
|
|
46
43
|
if (activeStyle) {
|
|
@@ -48,7 +45,7 @@ function getActiveStyle(styles, className) {
|
|
|
48
45
|
}
|
|
49
46
|
}
|
|
50
47
|
|
|
51
|
-
return (
|
|
48
|
+
return getDefaultStyle(styles);
|
|
52
49
|
}
|
|
53
50
|
/**
|
|
54
51
|
* Replaces the active style in the block's className.
|
|
@@ -104,6 +101,6 @@ function getRenderedStyles(styles) {
|
|
|
104
101
|
|
|
105
102
|
|
|
106
103
|
function getDefaultStyle(styles) {
|
|
107
|
-
return
|
|
104
|
+
return styles === null || styles === void 0 ? void 0 : styles.find(style => style.isDefault);
|
|
108
105
|
}
|
|
109
106
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-styles/utils.js"],"names":["getActiveStyle","styles","className","style","TokenList","values","indexOf","potentialStyleName","substring","activeStyle","name","replaceActiveStyle","newStyle","list","remove","add","value","getRenderedStyles","length","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-styles/utils.js"],"names":["getActiveStyle","styles","className","style","TokenList","values","indexOf","potentialStyleName","substring","activeStyle","find","name","getDefaultStyle","replaceActiveStyle","newStyle","list","remove","add","value","getRenderedStyles","length","label","isDefault"],"mappings":";;;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAT,CAAyBC,MAAzB,EAAiCC,SAAjC,EAA6C;AACnD,OAAM,MAAMC,KAAZ,IAAqB,IAAIC,kBAAJ,CAAeF,SAAf,EAA2BG,MAA3B,EAArB,EAA2D;AAC1D,QAAKF,KAAK,CAACG,OAAN,CAAe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0BX,MAA1B,EAAmC;AACzC,SAAOA,MAAP,aAAOA,MAAP,uBAAOA,MAAM,CAAES,IAAR,CAAgBP,KAAF,IAAaA,KAAK,CAACmB,SAAjC,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport TokenList from '@wordpress/token-list';\nimport { _x } from '@wordpress/i18n';\n\n/**\n * Returns the active style from the given className.\n *\n * @param {Array} styles Block styles.\n * @param {string} className Class name\n *\n * @return {Object?} The active style.\n */\nexport function getActiveStyle( styles, className ) {\n\tfor ( const style of new TokenList( className ).values() ) {\n\t\tif ( style.indexOf( 'is-style-' ) === -1 ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst potentialStyleName = style.substring( 9 );\n\t\tconst activeStyle = styles?.find(\n\t\t\t( { name } ) => name === potentialStyleName\n\t\t);\n\t\tif ( activeStyle ) {\n\t\t\treturn activeStyle;\n\t\t}\n\t}\n\n\treturn getDefaultStyle( styles );\n}\n\n/**\n * Replaces the active style in the block's className.\n *\n * @param {string} className Class name.\n * @param {Object?} activeStyle The replaced style.\n * @param {Object} newStyle The replacing style.\n *\n * @return {string} The updated className.\n */\nexport function replaceActiveStyle( className, activeStyle, newStyle ) {\n\tconst list = new TokenList( className );\n\n\tif ( activeStyle ) {\n\t\tlist.remove( 'is-style-' + activeStyle.name );\n\t}\n\n\tlist.add( 'is-style-' + newStyle.name );\n\n\treturn list.value;\n}\n\n/**\n * Returns a collection of styles that can be represented on the frontend.\n * The function checks a style collection for a default style. If none is found, it adds one to\n * act as a fallback for when there is no active style applied to a block. The default item also serves\n * as a switch on the frontend to deactivate non-default styles.\n *\n * @param {Array} styles Block styles.\n *\n * @return {Array<Object?>} The style collection.\n */\nexport function getRenderedStyles( styles ) {\n\tif ( ! styles || styles.length === 0 ) {\n\t\treturn [];\n\t}\n\n\treturn getDefaultStyle( styles )\n\t\t? styles\n\t\t: [\n\t\t\t\t{\n\t\t\t\t\tname: 'default',\n\t\t\t\t\tlabel: _x( 'Default', 'block style' ),\n\t\t\t\t\tisDefault: true,\n\t\t\t\t},\n\t\t\t\t...styles,\n\t\t ];\n}\n\n/**\n * Returns a style object from a collection of styles where that style object is the default block style.\n *\n * @param {Array} styles Block styles.\n *\n * @return {Object?} The default style object, if found.\n */\nexport function getDefaultStyle( styles ) {\n\treturn styles?.find( ( style ) => style.isDefault );\n}\n"]}
|
|
@@ -26,9 +26,8 @@ var _store = require("../../store");
|
|
|
26
26
|
*/
|
|
27
27
|
function BlockToolbar() {
|
|
28
28
|
const {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
mode
|
|
29
|
+
isSelected,
|
|
30
|
+
isValidAndVisual
|
|
32
31
|
} = (0, _data.useSelect)(select => {
|
|
33
32
|
const {
|
|
34
33
|
getBlockMode,
|
|
@@ -37,17 +36,16 @@ function BlockToolbar() {
|
|
|
37
36
|
} = select(_store.store);
|
|
38
37
|
const selectedBlockClientIds = getSelectedBlockClientIds();
|
|
39
38
|
return {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
mode: selectedBlockClientIds.length === 1 ? getBlockMode(selectedBlockClientIds[0]) : null
|
|
39
|
+
isSelected: selectedBlockClientIds.length > 0,
|
|
40
|
+
isValidAndVisual: selectedBlockClientIds.length === 1 ? isBlockValid(selectedBlockClientIds[0]) && getBlockMode(selectedBlockClientIds[0]) === 'visual' : false
|
|
43
41
|
};
|
|
44
42
|
}, []);
|
|
45
43
|
|
|
46
|
-
if (
|
|
44
|
+
if (!isSelected) {
|
|
47
45
|
return null;
|
|
48
46
|
}
|
|
49
47
|
|
|
50
|
-
return (0, _element.createElement)(_element.Fragment, null,
|
|
48
|
+
return (0, _element.createElement)(_element.Fragment, null, isValidAndVisual && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_ungroupButton.default, null), (0, _element.createElement)(_blockControls.default.Slot, {
|
|
51
49
|
group: "block"
|
|
52
50
|
}), (0, _element.createElement)(_blockControls.default.Slot, null), (0, _element.createElement)(_blockControls.default.Slot, {
|
|
53
51
|
group: "inline"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-toolbar/index.native.js"],"names":["BlockToolbar","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-toolbar/index.native.js"],"names":["BlockToolbar","isSelected","isValidAndVisual","select","getBlockMode","getSelectedBlockClientIds","isBlockValid","blockEditorStore","selectedBlockClientIds","length"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;AAKe,SAASA,YAAT,GAAwB;AACtC,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAAmC,qBAAaC,MAAF,IAAc;AACjE,UAAM;AAAEC,MAAAA,YAAF;AAAgBC,MAAAA,yBAAhB;AAA2CC,MAAAA;AAA3C,QACLH,MAAM,CAAEI,YAAF,CADP;AAEA,UAAMC,sBAAsB,GAAGH,yBAAyB,EAAxD;AAEA,WAAO;AACNJ,MAAAA,UAAU,EAAEO,sBAAsB,CAACC,MAAvB,GAAgC,CADtC;AAENP,MAAAA,gBAAgB,EACfM,sBAAsB,CAACC,MAAvB,KAAkC,CAAlC,GACGH,YAAY,CAAEE,sBAAsB,CAAE,CAAF,CAAxB,CAAZ,IACAJ,YAAY,CAAEI,sBAAsB,CAAE,CAAF,CAAxB,CAAZ,KAAgD,QAFnD,GAGG;AANE,KAAP;AAQA,GAbwC,EAatC,EAbsC,CAAzC;;AAeA,MAAK,CAAEP,UAAP,EAAoB;AACnB,WAAO,IAAP;AACA;;AAED,SACC,qDACGC,gBAAgB,IACjB,qDACC,4BAAC,sBAAD,OADD,EAEC,4BAAC,sBAAD,CAAe,IAAf;AAAoB,IAAA,KAAK,EAAC;AAA1B,IAFD,EAGC,4BAAC,sBAAD,CAAe,IAAf,OAHD,EAIC,4BAAC,sBAAD,CAAe,IAAf;AAAoB,IAAA,KAAK,EAAC;AAA1B,IAJD,EAKC,4BAAC,sBAAD,CAAe,IAAf;AAAoB,IAAA,KAAK,EAAC;AAA1B,IALD,CAFF,CADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockControls from '../block-controls';\nimport UngroupButton from '../ungroup-button';\nimport { store as blockEditorStore } from '../../store';\n\nexport default function BlockToolbar() {\n\tconst { isSelected, isValidAndVisual } = useSelect( ( select ) => {\n\t\tconst { getBlockMode, getSelectedBlockClientIds, isBlockValid } =\n\t\t\tselect( blockEditorStore );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\n\t\treturn {\n\t\t\tisSelected: selectedBlockClientIds.length > 0,\n\t\t\tisValidAndVisual:\n\t\t\t\tselectedBlockClientIds.length === 1\n\t\t\t\t\t? isBlockValid( selectedBlockClientIds[ 0 ] ) &&\n\t\t\t\t\t getBlockMode( selectedBlockClientIds[ 0 ] ) === 'visual'\n\t\t\t\t\t: false,\n\t\t};\n\t}, [] );\n\n\tif ( ! isSelected ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ isValidAndVisual && (\n\t\t\t\t<>\n\t\t\t\t\t<UngroupButton />\n\t\t\t\t\t<BlockControls.Slot group=\"block\" />\n\t\t\t\t\t<BlockControls.Slot />\n\t\t\t\t\t<BlockControls.Slot group=\"inline\" />\n\t\t\t\t\t<BlockControls.Slot group=\"other\" />\n\t\t\t\t</>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -11,8 +11,6 @@ var _element = require("@wordpress/element");
|
|
|
11
11
|
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
13
|
|
|
14
|
-
var _lodash = require("lodash");
|
|
15
|
-
|
|
16
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
15
|
|
|
18
16
|
var _blocks = require("@wordpress/blocks");
|
|
@@ -202,7 +200,7 @@ function wrapperSelector(select) {
|
|
|
202
200
|
const parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(blockParentsClientIds); // Get the clientId of the topmost parent with the capture toolbars setting.
|
|
203
201
|
|
|
204
202
|
|
|
205
|
-
const capturingClientId =
|
|
203
|
+
const capturingClientId = blockParentsClientIds.find(parentClientId => {
|
|
206
204
|
var _parentBlockListSetti;
|
|
207
205
|
|
|
208
206
|
return (_parentBlockListSetti = parentBlockListSettings[parentClientId]) === null || _parentBlockListSetti === void 0 ? void 0 : _parentBlockListSetti.__experimentalCaptureToolbars;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/selected-block-popover.js"],"names":["selector","select","__unstableGetEditorMode","isMultiSelecting","hasMultiSelection","isTyping","__experimentalIsBlockInterfaceHidden","isBlockInterfaceHidden","getSettings","getLastMultiSelectedBlockClientId","blockEditorStore","editorMode","hasFixedToolbar","isDistractionFree","lastClientId","SelectedBlockPopover","clientId","rootClientId","isEmptyDefaultBlock","showContents","capturingClientId","__unstablePopoverSlot","__unstableContentRef","isInsertionPointVisible","isBlockInsertionPointVisible","getBlockInsertionPoint","getBlockOrder","insertionPoint","order","index","isLargeViewport","isToolbarForced","stopTyping","showEmptyBlockSideInserter","shouldShowBreadcrumb","shouldShowContextualToolbar","canFocusHiddenToolbar","current","isDisabled","initialToolbarItemIndexRef","popoverProps","contentElement","wrapperSelector","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getBlockRootClientId","getBlock","getBlockParents","isNavigationMode","_isNavigationMode","__experimentalGetBlockListSettingsForBlocks","name","attributes","blockParentsClientIds","parentBlockListSettings","parentClientId","__experimentalCaptureToolbars","settings","WrappedBlockPopover","selected"],"mappings":";;;;;;;;;AASA;;;;AANA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvBA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AACA;AACA;AAQA,SAASA,QAAT,CAAmBC,MAAnB,EAA4B;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mC,IAAAA,gBAAgB,EAAEC,iBAAiB,EAL7B;AAMN/B,IAAAA,mBAAmB,EAClBiC,IAAI,IAAI,sCAA0B;AAAEA,MAAAA,IAAF;AAAQC,MAAAA;AAAR,KAA1B,CAPH;AAQNhC,IAAAA;AARM,GAAP;AAUA;;AAEc,SAASsC,mBAAT,QAGX;AAAA,MAHyC;AAC5CrC,IAAAA,qBAD4C;AAE5CC,IAAAA;AAF4C,GAGzC;AACH,QAAMqC,QAAQ,GAAG,qBAAWjB,eAAX,EAA4B,EAA5B,CAAjB;;AAEA,MAAK,CAAEiB,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,QAAM;AACL3C,IAAAA,QADK;AAELC,IAAAA,YAFK;AAGLkC,IAAAA,IAHK;AAILjC,IAAAA,mBAJK;AAKLE,IAAAA,iBALK;AAMLP,IAAAA,iBANK;AAOLmC,IAAAA;AAPK,MAQFW,QARJ;;AAUA,MAAK,CAAER,IAAP,EAAc;AACb,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,oBAAD;AACC,IAAA,QAAQ,EAAGnC,QADZ;AAEC,IAAA,YAAY,EAAGC,YAFhB;AAGC,IAAA,mBAAmB,EAAGC,mBAHvB;AAIC,IAAA,YAAY,EAAG,CAAEL,iBAAF,IAAuBmC,gBAJvC;AAKC,IAAA,iBAAiB,EAAG5B,iBALrB;AAMC,IAAA,qBAAqB,EAAGC,qBANzB;AAOC,IAAA,oBAAoB,EAAGC;AAPxB,IADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport { find } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockSelectionButton from './block-selection-button';\nimport BlockContextualToolbar from './block-contextual-toolbar';\nimport { store as blockEditorStore } from '../../store';\nimport BlockPopover from '../block-popover';\nimport useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';\nimport Inserter from '../inserter';\n\nfunction selector( select ) {\n\tconst {\n\t\t__unstableGetEditorMode,\n\t\tisMultiSelecting,\n\t\thasMultiSelection,\n\t\tisTyping,\n\t\t__experimentalIsBlockInterfaceHidden: isBlockInterfaceHidden,\n\t\tgetSettings,\n\t\tgetLastMultiSelectedBlockClientId,\n\t} = select( blockEditorStore );\n\n\treturn {\n\t\teditorMode: __unstableGetEditorMode(),\n\t\tisMultiSelecting: isMultiSelecting(),\n\t\tisTyping: isTyping(),\n\t\tisBlockInterfaceHidden: isBlockInterfaceHidden(),\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tisDistractionFree: getSettings().isDistractionFree,\n\t\tlastClientId: hasMultiSelection()\n\t\t\t? getLastMultiSelectedBlockClientId()\n\t\t\t: null,\n\t};\n}\n\nfunction SelectedBlockPopover( {\n\tclientId,\n\trootClientId,\n\tisEmptyDefaultBlock,\n\tshowContents, // we may need to mount an empty popover because we reuse\n\tcapturingClientId,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst {\n\t\teditorMode,\n\t\tisMultiSelecting,\n\t\tisTyping,\n\t\tisBlockInterfaceHidden,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tlastClientId,\n\t} = useSelect( selector, [] );\n\tconst isInsertionPointVisible = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tgetBlockOrder,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tif ( ! isBlockInsertionPointVisible() ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\t\t\treturn order[ insertionPoint.index ] === clientId;\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isToolbarForced = useRef( false );\n\tconst { stopTyping } = useDispatch( blockEditorStore );\n\n\tconst showEmptyBlockSideInserter =\n\t\t! isTyping && editorMode === 'edit' && isEmptyDefaultBlock;\n\tconst shouldShowBreadcrumb =\n\t\teditorMode === 'navigation' || editorMode === 'zoom-out';\n\tconst shouldShowContextualToolbar =\n\t\teditorMode === 'edit' &&\n\t\t! hasFixedToolbar &&\n\t\tisLargeViewport &&\n\t\t! isMultiSelecting &&\n\t\t! showEmptyBlockSideInserter &&\n\t\t! isTyping &&\n\t\t! isBlockInterfaceHidden;\n\tconst canFocusHiddenToolbar =\n\t\teditorMode === 'edit' &&\n\t\t! shouldShowContextualToolbar &&\n\t\t! hasFixedToolbar &&\n\t\t! isDistractionFree &&\n\t\t! isEmptyDefaultBlock;\n\n\tuseShortcut(\n\t\t'core/block-editor/focus-toolbar',\n\t\t() => {\n\t\t\tisToolbarForced.current = true;\n\t\t\tstopTyping( true );\n\t\t},\n\t\t{\n\t\t\tisDisabled: ! canFocusHiddenToolbar,\n\t\t}\n\t);\n\n\tuseEffect( () => {\n\t\tisToolbarForced.current = false;\n\t} );\n\n\t// Stores the active toolbar item index so the block toolbar can return focus\n\t// to it when re-mounting.\n\tconst initialToolbarItemIndexRef = useRef();\n\n\tconst popoverProps = useBlockToolbarPopoverProps( {\n\t\tcontentElement: __unstableContentRef?.current,\n\t\tclientId,\n\t} );\n\n\tif (\n\t\t! shouldShowBreadcrumb &&\n\t\t! shouldShowContextualToolbar &&\n\t\t! showEmptyBlockSideInserter\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ showEmptyBlockSideInserter && (\n\t\t\t\t<BlockPopover\n\t\t\t\t\tclientId={ capturingClientId || clientId }\n\t\t\t\t\t__unstableCoverTarget\n\t\t\t\t\tbottomClientId={ lastClientId }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'block-editor-block-list__block-side-inserter-popover',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-insertion-point-visible':\n\t\t\t\t\t\t\t\tisInsertionPointVisible,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\tresize={ false }\n\t\t\t\t\tshift={ false }\n\t\t\t\t\t{ ...popoverProps }\n\t\t\t\t>\n\t\t\t\t\t<div className=\"block-editor-block-list__empty-block-inserter\">\n\t\t\t\t\t\t<Inserter\n\t\t\t\t\t\t\tposition=\"bottom right\"\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</BlockPopover>\n\t\t\t) }\n\t\t\t{ ( shouldShowBreadcrumb || shouldShowContextualToolbar ) && (\n\t\t\t\t<BlockPopover\n\t\t\t\t\tclientId={ capturingClientId || clientId }\n\t\t\t\t\tbottomClientId={ lastClientId }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'block-editor-block-list__block-popover',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-insertion-point-visible':\n\t\t\t\t\t\t\t\tisInsertionPointVisible,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\tresize={ false }\n\t\t\t\t\t{ ...popoverProps }\n\t\t\t\t>\n\t\t\t\t\t{ shouldShowContextualToolbar && showContents && (\n\t\t\t\t\t\t<BlockContextualToolbar\n\t\t\t\t\t\t\t// If the toolbar is being shown because of being forced\n\t\t\t\t\t\t\t// it should focus the toolbar right after the mount.\n\t\t\t\t\t\t\tfocusOnMount={ isToolbarForced.current }\n\t\t\t\t\t\t\t__experimentalInitialIndex={\n\t\t\t\t\t\t\t\tinitialToolbarItemIndexRef.current\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t__experimentalOnIndexChange={ ( index ) => {\n\t\t\t\t\t\t\t\tinitialToolbarItemIndexRef.current = index;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t// Resets the index whenever the active block changes so\n\t\t\t\t\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\t\t\t\t\tkey={ clientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ shouldShowBreadcrumb && (\n\t\t\t\t\t\t<BlockSelectionButton\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockPopover>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction wrapperSelector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetBlockRootClientId,\n\t\tgetBlock,\n\t\tgetBlockParents,\n\t\tgetSettings,\n\t\tisNavigationMode: _isNavigationMode,\n\t\t__experimentalGetBlockListSettingsForBlocks,\n\t} = select( blockEditorStore );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\tif ( ! clientId ) {\n\t\treturn;\n\t}\n\n\tconst { name, attributes = {} } = getBlock( clientId ) || {};\n\tconst blockParentsClientIds = getBlockParents( clientId );\n\n\t// Get Block List Settings for all ancestors of the current Block clientId.\n\tconst parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(\n\t\tblockParentsClientIds\n\t);\n\n\t// Get the clientId of the topmost parent with the capture toolbars setting.\n\tconst capturingClientId = find(\n\t\tblockParentsClientIds,\n\t\t( parentClientId ) =>\n\t\t\tparentBlockListSettings[ parentClientId ]\n\t\t\t\t?.__experimentalCaptureToolbars\n\t);\n\n\tconst settings = getSettings();\n\n\treturn {\n\t\tclientId,\n\t\trootClientId: getBlockRootClientId( clientId ),\n\t\tname,\n\t\tisDistractionFree: settings.isDistractionFree,\n\t\tisNavigationMode: _isNavigationMode(),\n\t\tisEmptyDefaultBlock:\n\t\t\tname && isUnmodifiedDefaultBlock( { name, attributes } ),\n\t\tcapturingClientId,\n\t};\n}\n\nexport default function WrappedBlockPopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst selected = useSelect( wrapperSelector, [] );\n\n\tif ( ! selected ) {\n\t\treturn null;\n\t}\n\n\tconst {\n\t\tclientId,\n\t\trootClientId,\n\t\tname,\n\t\tisEmptyDefaultBlock,\n\t\tcapturingClientId,\n\t\tisDistractionFree,\n\t\tisNavigationMode,\n\t} = selected;\n\n\tif ( ! name ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SelectedBlockPopover\n\t\t\tclientId={ clientId }\n\t\t\trootClientId={ rootClientId }\n\t\t\tisEmptyDefaultBlock={ isEmptyDefaultBlock }\n\t\t\tshowContents={ ! isDistractionFree || isNavigationMode }\n\t\t\tcapturingClientId={ capturingClientId }\n\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t/>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/selected-block-popover.js"],"names":["selector","select","__unstableGetEditorMode","isMultiSelecting","hasMultiSelection","isTyping","__experimentalIsBlockInterfaceHidden","isBlockInterfaceHidden","getSettings","getLastMultiSelectedBlockClientId","blockEditorStore","editorMode","hasFixedToolbar","isDistractionFree","lastClientId","SelectedBlockPopover","clientId","rootClientId","isEmptyDefaultBlock","showContents","capturingClientId","__unstablePopoverSlot","__unstableContentRef","isInsertionPointVisible","isBlockInsertionPointVisible","getBlockInsertionPoint","getBlockOrder","insertionPoint","order","index","isLargeViewport","isToolbarForced","stopTyping","showEmptyBlockSideInserter","shouldShowBreadcrumb","shouldShowContextualToolbar","canFocusHiddenToolbar","current","isDisabled","initialToolbarItemIndexRef","popoverProps","contentElement","wrapperSelector","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getBlockRootClientId","getBlock","getBlockParents","isNavigationMode","_isNavigationMode","__experimentalGetBlockListSettingsForBlocks","name","attributes","blockParentsClientIds","parentBlockListSettings","find","parentClientId","__experimentalCaptureToolbars","settings","WrappedBlockPopover","selected"],"mappings":";;;;;;;;;AAQA;;;;AALA;;AAMA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAQA,SAASA,QAAT,CAAmBC,MAAnB,EAA4B;AAC3B,QAAM;AACLC,IAAAA,uBADK;AAELC,IAAAA,gBAFK;AAGLC,IAAAA,iBAHK;AAILC,IAAAA,QAJK;AAKLC,IAAAA,oCAAoC,EAAEC,sBALjC;AAMLC,IAAAA,WANK;AAOLC,IAAAA;AAPK,MAQFR,MAAM,CAAES,YAAF,CARV;AAUA,SAAO;AACNC,IAAAA,UAAU,EAAET,uBAAuB,EAD7B;AAENC,IAAAA,gBAAgB,EAAEA,gBAAgB,EAF5B;AAGNE,IAAAA,QAAQ,EAAEA,QAAQ,EAHZ;AAINE,IAAAA,sBAAsB,EAAEA,sBAAsB,EAJxC;AAKNK,IAAAA,eAAe,EAAEJ,WAAW,GAAGI,eALzB;AAMNC,IAAAA,iBAAiB,EAAEL,WAAW,GAAGK,iBAN3B;AAONC,IAAAA,YAAY,EAAEV,iBAAiB,KAC5BK,iCAAiC,EADL,GAE5B;AATG,GAAP;AAWA;;AAED,SAASM,oBAAT,OAQI;AAAA,MAR2B;AAC9BC,IAAAA,QAD8B;AAE9BC,IAAAA,YAF8B;AAG9BC,IAAAA,mBAH8B;AAI9BC,IAAAA,YAJ8B;AAIhB;AACdC,IAAAA,iBAL8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AA,mBAAmB,EAAGC,mBAHvB;AAIC,IAAA,YAAY,EAAG,CAAEL,iBAAF,IAAuBmC,gBAJvC;AAKC,IAAA,iBAAiB,EAAG5B,iBALrB;AAMC,IAAA,qBAAqB,EAAGC,qBANzB;AAOC,IAAA,oBAAoB,EAAGC;AAPxB,IADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockSelectionButton from './block-selection-button';\nimport BlockContextualToolbar from './block-contextual-toolbar';\nimport { store as blockEditorStore } from '../../store';\nimport BlockPopover from '../block-popover';\nimport useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';\nimport Inserter from '../inserter';\n\nfunction selector( select ) {\n\tconst {\n\t\t__unstableGetEditorMode,\n\t\tisMultiSelecting,\n\t\thasMultiSelection,\n\t\tisTyping,\n\t\t__experimentalIsBlockInterfaceHidden: isBlockInterfaceHidden,\n\t\tgetSettings,\n\t\tgetLastMultiSelectedBlockClientId,\n\t} = select( blockEditorStore );\n\n\treturn {\n\t\teditorMode: __unstableGetEditorMode(),\n\t\tisMultiSelecting: isMultiSelecting(),\n\t\tisTyping: isTyping(),\n\t\tisBlockInterfaceHidden: isBlockInterfaceHidden(),\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tisDistractionFree: getSettings().isDistractionFree,\n\t\tlastClientId: hasMultiSelection()\n\t\t\t? getLastMultiSelectedBlockClientId()\n\t\t\t: null,\n\t};\n}\n\nfunction SelectedBlockPopover( {\n\tclientId,\n\trootClientId,\n\tisEmptyDefaultBlock,\n\tshowContents, // we may need to mount an empty popover because we reuse\n\tcapturingClientId,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst {\n\t\teditorMode,\n\t\tisMultiSelecting,\n\t\tisTyping,\n\t\tisBlockInterfaceHidden,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tlastClientId,\n\t} = useSelect( selector, [] );\n\tconst isInsertionPointVisible = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tgetBlockOrder,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tif ( ! isBlockInsertionPointVisible() ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\t\t\treturn order[ insertionPoint.index ] === clientId;\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isToolbarForced = useRef( false );\n\tconst { stopTyping } = useDispatch( blockEditorStore );\n\n\tconst showEmptyBlockSideInserter =\n\t\t! isTyping && editorMode === 'edit' && isEmptyDefaultBlock;\n\tconst shouldShowBreadcrumb =\n\t\teditorMode === 'navigation' || editorMode === 'zoom-out';\n\tconst shouldShowContextualToolbar =\n\t\teditorMode === 'edit' &&\n\t\t! hasFixedToolbar &&\n\t\tisLargeViewport &&\n\t\t! isMultiSelecting &&\n\t\t! showEmptyBlockSideInserter &&\n\t\t! isTyping &&\n\t\t! isBlockInterfaceHidden;\n\tconst canFocusHiddenToolbar =\n\t\teditorMode === 'edit' &&\n\t\t! shouldShowContextualToolbar &&\n\t\t! hasFixedToolbar &&\n\t\t! isDistractionFree &&\n\t\t! isEmptyDefaultBlock;\n\n\tuseShortcut(\n\t\t'core/block-editor/focus-toolbar',\n\t\t() => {\n\t\t\tisToolbarForced.current = true;\n\t\t\tstopTyping( true );\n\t\t},\n\t\t{\n\t\t\tisDisabled: ! canFocusHiddenToolbar,\n\t\t}\n\t);\n\n\tuseEffect( () => {\n\t\tisToolbarForced.current = false;\n\t} );\n\n\t// Stores the active toolbar item index so the block toolbar can return focus\n\t// to it when re-mounting.\n\tconst initialToolbarItemIndexRef = useRef();\n\n\tconst popoverProps = useBlockToolbarPopoverProps( {\n\t\tcontentElement: __unstableContentRef?.current,\n\t\tclientId,\n\t} );\n\n\tif (\n\t\t! shouldShowBreadcrumb &&\n\t\t! shouldShowContextualToolbar &&\n\t\t! showEmptyBlockSideInserter\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ showEmptyBlockSideInserter && (\n\t\t\t\t<BlockPopover\n\t\t\t\t\tclientId={ capturingClientId || clientId }\n\t\t\t\t\t__unstableCoverTarget\n\t\t\t\t\tbottomClientId={ lastClientId }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'block-editor-block-list__block-side-inserter-popover',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-insertion-point-visible':\n\t\t\t\t\t\t\t\tisInsertionPointVisible,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\tresize={ false }\n\t\t\t\t\tshift={ false }\n\t\t\t\t\t{ ...popoverProps }\n\t\t\t\t>\n\t\t\t\t\t<div className=\"block-editor-block-list__empty-block-inserter\">\n\t\t\t\t\t\t<Inserter\n\t\t\t\t\t\t\tposition=\"bottom right\"\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</BlockPopover>\n\t\t\t) }\n\t\t\t{ ( shouldShowBreadcrumb || shouldShowContextualToolbar ) && (\n\t\t\t\t<BlockPopover\n\t\t\t\t\tclientId={ capturingClientId || clientId }\n\t\t\t\t\tbottomClientId={ lastClientId }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'block-editor-block-list__block-popover',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-insertion-point-visible':\n\t\t\t\t\t\t\t\tisInsertionPointVisible,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\tresize={ false }\n\t\t\t\t\t{ ...popoverProps }\n\t\t\t\t>\n\t\t\t\t\t{ shouldShowContextualToolbar && showContents && (\n\t\t\t\t\t\t<BlockContextualToolbar\n\t\t\t\t\t\t\t// If the toolbar is being shown because of being forced\n\t\t\t\t\t\t\t// it should focus the toolbar right after the mount.\n\t\t\t\t\t\t\tfocusOnMount={ isToolbarForced.current }\n\t\t\t\t\t\t\t__experimentalInitialIndex={\n\t\t\t\t\t\t\t\tinitialToolbarItemIndexRef.current\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t__experimentalOnIndexChange={ ( index ) => {\n\t\t\t\t\t\t\t\tinitialToolbarItemIndexRef.current = index;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t// Resets the index whenever the active block changes so\n\t\t\t\t\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\t\t\t\t\tkey={ clientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ shouldShowBreadcrumb && (\n\t\t\t\t\t\t<BlockSelectionButton\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockPopover>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction wrapperSelector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetBlockRootClientId,\n\t\tgetBlock,\n\t\tgetBlockParents,\n\t\tgetSettings,\n\t\tisNavigationMode: _isNavigationMode,\n\t\t__experimentalGetBlockListSettingsForBlocks,\n\t} = select( blockEditorStore );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\tif ( ! clientId ) {\n\t\treturn;\n\t}\n\n\tconst { name, attributes = {} } = getBlock( clientId ) || {};\n\tconst blockParentsClientIds = getBlockParents( clientId );\n\n\t// Get Block List Settings for all ancestors of the current Block clientId.\n\tconst parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(\n\t\tblockParentsClientIds\n\t);\n\n\t// Get the clientId of the topmost parent with the capture toolbars setting.\n\tconst capturingClientId = blockParentsClientIds.find(\n\t\t( parentClientId ) =>\n\t\t\tparentBlockListSettings[ parentClientId ]\n\t\t\t\t?.__experimentalCaptureToolbars\n\t);\n\n\tconst settings = getSettings();\n\n\treturn {\n\t\tclientId,\n\t\trootClientId: getBlockRootClientId( clientId ),\n\t\tname,\n\t\tisDistractionFree: settings.isDistractionFree,\n\t\tisNavigationMode: _isNavigationMode(),\n\t\tisEmptyDefaultBlock:\n\t\t\tname && isUnmodifiedDefaultBlock( { name, attributes } ),\n\t\tcapturingClientId,\n\t};\n}\n\nexport default function WrappedBlockPopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst selected = useSelect( wrapperSelector, [] );\n\n\tif ( ! selected ) {\n\t\treturn null;\n\t}\n\n\tconst {\n\t\tclientId,\n\t\trootClientId,\n\t\tname,\n\t\tisEmptyDefaultBlock,\n\t\tcapturingClientId,\n\t\tisDistractionFree,\n\t\tisNavigationMode,\n\t} = selected;\n\n\tif ( ! name ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SelectedBlockPopover\n\t\t\tclientId={ clientId }\n\t\t\trootClientId={ rootClientId }\n\t\t\tisEmptyDefaultBlock={ isEmptyDefaultBlock }\n\t\t\tshowContents={ ! isDistractionFree || isNavigationMode }\n\t\t\tcapturingClientId={ capturingClientId }\n\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -9,12 +9,16 @@ var _compose = require("@wordpress/compose");
|
|
|
9
9
|
|
|
10
10
|
var _data = require("@wordpress/data");
|
|
11
11
|
|
|
12
|
+
var _dom = require("@wordpress/dom");
|
|
13
|
+
|
|
12
14
|
var _element = require("@wordpress/element");
|
|
13
15
|
|
|
14
16
|
var _store = require("../../store");
|
|
15
17
|
|
|
16
18
|
var _useBlockRefs = require("../block-list/use-block-props/use-block-refs");
|
|
17
19
|
|
|
20
|
+
var _position = require("../../hooks/position");
|
|
21
|
+
|
|
18
22
|
/**
|
|
19
23
|
* WordPress dependencies
|
|
20
24
|
*/
|
|
@@ -46,24 +50,34 @@ const RESTRICTED_HEIGHT_PROPS = { ...COMMON_PROPS,
|
|
|
46
50
|
*
|
|
47
51
|
* @param {Element} contentElement The DOM element that represents the editor content or canvas.
|
|
48
52
|
* @param {Element} selectedBlockElement The outer DOM element of the first selected block.
|
|
53
|
+
* @param {Element} scrollContainer The scrollable container for the contentElement.
|
|
49
54
|
* @param {number} toolbarHeight The height of the toolbar in pixels.
|
|
55
|
+
* @param {boolean} isSticky Whether or not the selected block is sticky or fixed.
|
|
50
56
|
*
|
|
51
57
|
* @return {Object} The popover props used to determine the position of the toolbar.
|
|
52
58
|
*/
|
|
53
59
|
|
|
54
|
-
function getProps(contentElement, selectedBlockElement, toolbarHeight) {
|
|
60
|
+
function getProps(contentElement, selectedBlockElement, scrollContainer, toolbarHeight, isSticky) {
|
|
55
61
|
if (!contentElement || !selectedBlockElement) {
|
|
56
62
|
return DEFAULT_PROPS;
|
|
57
|
-
}
|
|
63
|
+
} // Get how far the content area has been scrolled.
|
|
58
64
|
|
|
65
|
+
|
|
66
|
+
const scrollTop = (scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.scrollTop) || 0;
|
|
59
67
|
const blockRect = selectedBlockElement.getBoundingClientRect();
|
|
60
|
-
const contentRect = contentElement.getBoundingClientRect(); //
|
|
68
|
+
const contentRect = contentElement.getBoundingClientRect(); // Get the vertical position of top of the visible content area.
|
|
69
|
+
|
|
70
|
+
const topOfContentElementInViewport = scrollTop + contentRect.top; // The document element's clientHeight represents the viewport height.
|
|
61
71
|
|
|
62
|
-
const viewportHeight = contentElement.ownerDocument.documentElement.clientHeight;
|
|
63
|
-
|
|
64
|
-
|
|
72
|
+
const viewportHeight = contentElement.ownerDocument.documentElement.clientHeight; // The restricted height area is calculated as the sum of the
|
|
73
|
+
// vertical position of the visible content area, plus the height
|
|
74
|
+
// of the block toolbar.
|
|
65
75
|
|
|
66
|
-
|
|
76
|
+
const restrictedTopArea = topOfContentElementInViewport + toolbarHeight;
|
|
77
|
+
const hasSpaceForToolbarAbove = blockRect.top > restrictedTopArea;
|
|
78
|
+
const isBlockTallerThanViewport = blockRect.height > viewportHeight - toolbarHeight; // Sticky blocks are treated as if they will never have enough space for the toolbar above.
|
|
79
|
+
|
|
80
|
+
if (!isSticky && (hasSpaceForToolbarAbove || isBlockTallerThanViewport)) {
|
|
67
81
|
return DEFAULT_PROPS;
|
|
68
82
|
}
|
|
69
83
|
|
|
@@ -87,12 +101,31 @@ function useBlockToolbarPopoverProps(_ref) {
|
|
|
87
101
|
} = _ref;
|
|
88
102
|
const selectedBlockElement = (0, _useBlockRefs.__unstableUseBlockElement)(clientId);
|
|
89
103
|
const [toolbarHeight, setToolbarHeight] = (0, _element.useState)(0);
|
|
90
|
-
const
|
|
91
|
-
|
|
104
|
+
const {
|
|
105
|
+
blockIndex,
|
|
106
|
+
isSticky
|
|
107
|
+
} = (0, _data.useSelect)(select => {
|
|
108
|
+
const {
|
|
109
|
+
getBlockIndex,
|
|
110
|
+
getBlockAttributes
|
|
111
|
+
} = select(_store.store);
|
|
112
|
+
return {
|
|
113
|
+
blockIndex: getBlockIndex(clientId),
|
|
114
|
+
isSticky: (0, _position.hasStickyOrFixedPositionValue)(getBlockAttributes(clientId))
|
|
115
|
+
};
|
|
116
|
+
}, [clientId]);
|
|
117
|
+
const scrollContainer = (0, _element.useMemo)(() => {
|
|
118
|
+
if (!contentElement) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return (0, _dom.getScrollContainer)(contentElement);
|
|
123
|
+
}, [contentElement]);
|
|
124
|
+
const [props, setProps] = (0, _element.useState)(() => getProps(contentElement, selectedBlockElement, scrollContainer, toolbarHeight, isSticky));
|
|
92
125
|
const popoverRef = (0, _compose.useRefEffect)(popoverNode => {
|
|
93
126
|
setToolbarHeight(popoverNode.offsetHeight);
|
|
94
127
|
}, []);
|
|
95
|
-
const updateProps = (0, _element.useCallback)(() => setProps(getProps(contentElement, selectedBlockElement, toolbarHeight)), [contentElement, selectedBlockElement, toolbarHeight]); // Update props when the block is moved. This also ensures the props are
|
|
128
|
+
const updateProps = (0, _element.useCallback)(() => setProps(getProps(contentElement, selectedBlockElement, scrollContainer, toolbarHeight, isSticky)), [contentElement, selectedBlockElement, scrollContainer, toolbarHeight]); // Update props when the block is moved. This also ensures the props are
|
|
96
129
|
// correct on initial mount, and when the selected block or content element
|
|
97
130
|
// changes (since the callback ref will update).
|
|
98
131
|
|