@wordpress/block-editor 8.0.17 → 8.1.2-next.f435e9e01b.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 +8 -0
- package/LICENSE.md +1 -1
- package/README.md +19 -6
- package/build/components/block-caption/index.native.js +14 -3
- package/build/components/block-caption/index.native.js.map +1 -1
- package/build/components/block-edit/index.js +9 -0
- package/build/components/block-edit/index.js.map +1 -1
- package/build/components/block-inspector/index.js +14 -19
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list-appender/index.js +3 -11
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-media-update-progress/index.native.js +2 -1
- package/build/components/block-media-update-progress/index.native.js.map +1 -1
- package/build/components/block-preview/auto.js +10 -2
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings/container.native.js +2 -1
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-styles/index.js +110 -134
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/menu-items.js +63 -0
- package/build/components/block-styles/menu-items.js.map +1 -0
- package/build/components/block-styles/preview-panel.js +45 -0
- package/build/components/block-styles/preview-panel.js.map +1 -0
- package/build/components/block-styles/preview.native.js +2 -2
- package/build/components/block-styles/preview.native.js.map +1 -1
- package/build/components/block-styles/use-styles-for-block.js +119 -0
- package/build/components/block-styles/use-styles-for-block.js.map +1 -0
- package/build/components/block-styles/utils.js +39 -0
- package/build/components/block-styles/utils.js.map +1 -1
- package/build/components/block-switcher/block-styles-menu.js +3 -23
- package/build/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build/components/block-tools/back-compat.js +2 -1
- package/build/components/block-tools/back-compat.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +5 -1
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +11 -1
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-types-list/index.native.js +2 -2
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/button-block-appender/index.js +2 -1
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +1 -1
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.native.js +6 -3
- package/build/components/colors-gradients/panel-color-gradient-settings.native.js.map +1 -1
- package/build/components/colors-gradients/tools-panel-color-dropdown.js +89 -0
- package/build/components/colors-gradients/tools-panel-color-dropdown.js.map +1 -0
- package/build/components/contrast-checker/index.js +80 -44
- package/build/components/contrast-checker/index.js.map +1 -1
- package/build/components/contrast-checker/index.native.js +108 -0
- package/build/components/contrast-checker/index.native.js.map +1 -0
- package/build/components/default-block-appender/index.js +16 -19
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/default-style-picker/index.js +18 -3
- package/build/components/default-style-picker/index.js.map +1 -1
- package/build/components/iframe/index.js +4 -5
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/index.js +18 -18
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +18 -0
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/default-block-appender.js +2 -4
- package/build/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +16 -14
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/index.js +61 -3
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +1 -1
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/library.js +5 -3
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/menu.js +11 -3
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/search-items.js +3 -1
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter/tabs.native.js +7 -4
- package/build/components/inserter/tabs.native.js.map +1 -1
- package/build/components/inspector-controls/block-support-slot-container.js +2 -1
- package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +14 -44
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +3 -5
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls/groups.js +4 -0
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls/slot.js +1 -3
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +6 -6
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/line-height-control/index.native.js +3 -2
- package/build/components/line-height-control/index.native.js.map +1 -1
- package/build/components/link-control/link-preview.js +1 -1
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-item.js +11 -1
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/link-control/search-results.js +2 -1
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/use-search-handler.js +18 -5
- package/build/components/link-control/use-search-handler.js.map +1 -1
- package/build/components/list-view/block-contents.js +3 -1
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block-select-button.js +26 -4
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +10 -1
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/media-placeholder/index.js +3 -11
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +32 -6
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/media-replace-flow/index.native.js +13 -0
- package/build/components/media-replace-flow/index.native.js.map +1 -0
- package/build/components/media-upload-progress/index.native.js +2 -1
- package/build/components/media-upload-progress/index.native.js.map +1 -1
- package/build/components/panel-color-settings/index.js +7 -3
- package/build/components/panel-color-settings/index.js.map +1 -1
- package/build/components/provider/block-refs-provider.js +4 -1
- package/build/components/provider/block-refs-provider.js.map +1 -1
- package/build/components/rich-text/file-paste-handler.js +1 -1
- package/build/components/rich-text/file-paste-handler.js.map +1 -1
- package/build/components/rich-text/index.js +2 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +2 -1
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/prevent-event-discovery.js +33 -0
- package/build/components/rich-text/prevent-event-discovery.js.map +1 -0
- package/build/components/rich-text/use-input-rules.js +3 -1
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +14 -5
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/rich-text/utils.js +2 -1
- package/build/components/rich-text/utils.js.map +1 -1
- package/build/components/selection-scroll-into-view/index.js +2 -1
- package/build/components/selection-scroll-into-view/index.js.map +1 -1
- package/build/components/use-display-block-controls/index.native.js +45 -0
- package/build/components/use-display-block-controls/index.native.js.map +1 -0
- package/build/components/use-on-block-drop/index.js +7 -3
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/writing-flow/use-multi-selection.js +3 -1
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/hooks/border-color.js +63 -5
- package/build/hooks/border-color.js.map +1 -1
- package/build/hooks/border-radius.js +47 -0
- package/build/hooks/border-radius.js.map +1 -1
- package/build/hooks/border-style.js +41 -0
- package/build/hooks/border-style.js.map +1 -1
- package/build/hooks/border-width.js +70 -31
- package/build/hooks/border-width.js.map +1 -1
- package/build/hooks/border.js +81 -11
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color-panel.js +25 -16
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color-panel.native.js +77 -0
- package/build/hooks/color-panel.native.js.map +1 -0
- package/build/hooks/color.js +179 -12
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/font-size.js +14 -0
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.native.js +2 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout.native.js +20 -0
- package/build/hooks/layout.native.js.map +1 -0
- package/build/hooks/letter-spacing.js +1 -1
- package/build/hooks/letter-spacing.js.map +1 -1
- package/build/hooks/typography.js +1 -1
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/typography.native.js +2 -4
- package/build/hooks/typography.native.js.map +1 -1
- package/build/hooks/utils.js +55 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/store/actions.js +1 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +5 -2
- package/build/store/defaults.js.map +1 -1
- package/build/store/defaults.native.js +2 -6
- package/build/store/defaults.native.js.map +1 -1
- package/build/store/selectors.js +10 -5
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-paste-event-data.js +1 -1
- package/build/utils/get-paste-event-data.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +1 -1
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/components/block-caption/index.native.js +13 -3
- package/build-module/components/block-caption/index.native.js.map +1 -1
- package/build-module/components/block-edit/index.js +9 -0
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +14 -19
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +3 -10
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-media-update-progress/index.native.js +2 -1
- package/build-module/components/block-media-update-progress/index.native.js.map +1 -1
- package/build-module/components/block-preview/auto.js +10 -2
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +2 -1
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-styles/index.js +112 -133
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/menu-items.js +50 -0
- package/build-module/components/block-styles/menu-items.js.map +1 -0
- package/build-module/components/block-styles/preview-panel.js +35 -0
- package/build-module/components/block-styles/preview-panel.js.map +1 -0
- package/build-module/components/block-styles/preview.native.js +2 -2
- package/build-module/components/block-styles/preview.native.js.map +1 -1
- package/build-module/components/block-styles/use-styles-for-block.js +107 -0
- package/build-module/components/block-styles/use-styles-for-block.js.map +1 -0
- package/build-module/components/block-styles/utils.js +34 -0
- package/build-module/components/block-styles/utils.js.map +1 -1
- package/build-module/components/block-switcher/block-styles-menu.js +3 -21
- package/build-module/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build-module/components/block-tools/back-compat.js +2 -1
- package/build-module/components/block-tools/back-compat.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +5 -1
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +11 -1
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +2 -2
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/button-block-appender/index.js +2 -1
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +1 -1
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.native.js +7 -4
- package/build-module/components/colors-gradients/panel-color-gradient-settings.native.js.map +1 -1
- package/build-module/components/colors-gradients/tools-panel-color-dropdown.js +75 -0
- package/build-module/components/colors-gradients/tools-panel-color-dropdown.js.map +1 -0
- package/build-module/components/contrast-checker/index.js +80 -45
- package/build-module/components/contrast-checker/index.js.map +1 -1
- package/build-module/components/contrast-checker/index.native.js +90 -0
- package/build-module/components/contrast-checker/index.native.js.map +1 -0
- package/build-module/components/default-block-appender/index.js +15 -18
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/default-style-picker/index.js +17 -3
- package/build-module/components/default-style-picker/index.js.map +1 -1
- package/build-module/components/iframe/index.js +4 -5
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/index.js +2 -2
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +2 -0
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/default-block-appender.js +2 -4
- package/build-module/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +16 -14
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/index.js +61 -3
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +2 -2
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/library.js +5 -3
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/menu.js +11 -4
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/search-items.js +3 -1
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter/tabs.native.js +7 -4
- package/build-module/components/inserter/tabs.native.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-slot-container.js +2 -1
- package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +15 -44
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +3 -5
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +4 -0
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +1 -3
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +6 -6
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/line-height-control/index.native.js +3 -2
- package/build-module/components/line-height-control/index.native.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +1 -1
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-item.js +11 -1
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/link-control/search-results.js +2 -1
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/use-search-handler.js +18 -5
- package/build-module/components/link-control/use-search-handler.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +3 -1
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +25 -4
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +8 -1
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +3 -10
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +32 -6
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.native.js +4 -0
- package/build-module/components/media-replace-flow/index.native.js.map +1 -0
- package/build-module/components/media-upload-progress/index.native.js +2 -1
- package/build-module/components/media-upload-progress/index.native.js.map +1 -1
- package/build-module/components/panel-color-settings/index.js +7 -3
- package/build-module/components/panel-color-settings/index.js.map +1 -1
- package/build-module/components/provider/block-refs-provider.js +4 -1
- package/build-module/components/provider/block-refs-provider.js.map +1 -1
- package/build-module/components/rich-text/file-paste-handler.js +1 -1
- package/build-module/components/rich-text/file-paste-handler.js.map +1 -1
- package/build-module/components/rich-text/index.js +2 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +2 -1
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/prevent-event-discovery.js +25 -0
- package/build-module/components/rich-text/prevent-event-discovery.js.map +1 -0
- package/build-module/components/rich-text/use-input-rules.js +2 -1
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +14 -5
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/rich-text/utils.js +2 -1
- package/build-module/components/rich-text/utils.js.map +1 -1
- package/build-module/components/selection-scroll-into-view/index.js +2 -1
- package/build-module/components/selection-scroll-into-view/index.js.map +1 -1
- package/build-module/components/use-display-block-controls/index.native.js +34 -0
- package/build-module/components/use-display-block-controls/index.native.js.map +1 -0
- package/build-module/components/use-on-block-drop/index.js +7 -3
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/writing-flow/use-multi-selection.js +3 -4
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/hooks/border-color.js +61 -7
- package/build-module/hooks/border-color.js.map +1 -1
- package/build-module/hooks/border-radius.js +42 -0
- package/build-module/hooks/border-radius.js.map +1 -1
- package/build-module/hooks/border-style.js +36 -0
- package/build-module/hooks/border-style.js.map +1 -1
- package/build-module/hooks/border-width.js +66 -32
- package/build-module/hooks/border-width.js.map +1 -1
- package/build-module/hooks/border.js +80 -12
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color-panel.js +24 -14
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color-panel.native.js +62 -0
- package/build-module/hooks/color-panel.native.js.map +1 -0
- package/build-module/hooks/color.js +177 -13
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/font-size.js +12 -1
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.native.js +1 -0
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout.native.js +16 -0
- package/build-module/hooks/layout.native.js.map +1 -0
- package/build-module/hooks/letter-spacing.js +1 -1
- package/build-module/hooks/letter-spacing.js.map +1 -1
- package/build-module/hooks/typography.js +1 -1
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/typography.native.js +2 -4
- package/build-module/hooks/typography.native.js.map +1 -1
- package/build-module/hooks/utils.js +52 -1
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/store/actions.js +1 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +5 -2
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/defaults.native.js +2 -5
- package/build-module/store/defaults.native.js.map +1 -1
- package/build-module/store/selectors.js +10 -5
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-paste-event-data.js +1 -1
- package/build-module/utils/get-paste-event-data.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +1 -1
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-style/style-rtl.css +256 -191
- package/build-style/style.css +256 -191
- package/package.json +30 -30
- package/src/components/block-caption/index.native.js +22 -4
- package/src/components/block-card/README.md +1 -1
- package/src/components/block-edit/index.js +8 -0
- package/src/components/block-edit/test/edit.native.js +10 -9
- package/src/components/block-inspector/index.js +18 -16
- package/src/components/block-list-appender/index.js +5 -21
- package/src/components/block-media-update-progress/index.native.js +1 -1
- package/src/components/block-media-update-progress/test/index.native.js +136 -93
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +108 -47
- package/src/components/block-mover/test/index.native.js +5 -5
- package/src/components/block-preview/README.md +14 -26
- package/src/components/block-preview/auto.js +7 -2
- package/src/components/block-preview/test/index.js +2 -0
- package/src/components/block-settings/container.native.js +1 -0
- package/src/components/block-styles/index.js +125 -145
- package/src/components/block-styles/menu-items.js +49 -0
- package/src/components/block-styles/preview-panel.js +36 -0
- package/src/components/block-styles/preview.native.js +5 -2
- package/src/components/block-styles/style.scss +59 -51
- package/src/components/block-styles/test/{index.js → utils.js} +60 -1
- package/src/components/block-styles/use-styles-for-block.js +99 -0
- package/src/components/block-styles/utils.js +39 -0
- package/src/components/block-switcher/block-styles-menu.js +3 -38
- package/src/components/block-tools/back-compat.js +1 -0
- package/src/components/block-tools/block-selection-button.js +7 -1
- package/src/components/block-tools/insertion-point.js +10 -1
- package/src/components/block-types-list/index.native.js +5 -2
- package/src/components/border-radius-control/style.scss +1 -1
- package/src/components/border-style-control/style.scss +0 -1
- package/src/components/button-block-appender/index.js +1 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +9 -5
- package/src/components/colors-gradients/dropdown.js +48 -43
- package/src/components/colors-gradients/panel-color-gradient-settings.native.js +13 -2
- package/src/components/colors-gradients/style.scss +10 -5
- package/src/components/colors-gradients/tools-panel-color-dropdown.js +85 -0
- package/src/components/contrast-checker/README.md +3 -1
- package/src/components/contrast-checker/index.js +107 -64
- package/src/components/contrast-checker/index.native.js +113 -0
- package/src/components/contrast-checker/style.native.scss +26 -0
- package/src/components/contrast-checker/test/index.js +236 -2
- package/src/components/default-block-appender/index.js +17 -24
- package/src/components/default-block-appender/style.scss +4 -0
- package/src/components/default-block-appender/test/__snapshots__/index.js.snap +12 -24
- package/src/components/default-block-appender/test/index.js +4 -14
- package/src/components/default-style-picker/index.js +18 -6
- package/src/components/iframe/index.js +7 -3
- package/src/components/index.js +2 -2
- package/src/components/index.native.js +2 -0
- package/src/components/inner-blocks/README.md +2 -0
- package/src/components/inner-blocks/default-block-appender.js +2 -7
- package/src/components/inner-blocks/use-nested-settings-update.js +16 -14
- package/src/components/inserter/index.js +77 -5
- package/src/components/inserter/index.native.js +2 -2
- package/src/components/inserter/library.js +17 -12
- package/src/components/inserter/menu.js +31 -13
- package/src/components/inserter/search-items.js +3 -1
- package/src/components/inserter/tabs.native.js +5 -4
- package/src/components/inserter/test/block-types-tab.native.js +9 -10
- package/src/components/inserter/test/index.native.js +3 -7
- package/src/components/inserter/test/reusable-blocks-tab.native.js +8 -10
- package/src/components/inspector-controls/block-support-slot-container.js +3 -1
- package/src/components/inspector-controls/block-support-tools-panel.js +41 -58
- package/src/components/inspector-controls/fill.native.js +4 -3
- package/src/components/inspector-controls/groups.js +4 -0
- package/src/components/inspector-controls/slot.js +2 -7
- package/src/components/letter-spacing-control/index.js +6 -6
- package/src/components/line-height-control/index.native.js +2 -1
- package/src/components/link-control/README.md +1 -1
- package/src/components/link-control/link-preview.js +1 -1
- package/src/components/link-control/search-item.js +11 -2
- package/src/components/link-control/search-results.js +1 -0
- package/src/components/link-control/style.scss +5 -10
- package/src/components/link-control/test/index.js +4 -0
- package/src/components/link-control/use-search-handler.js +25 -4
- package/src/components/list-view/block-contents.js +2 -0
- package/src/components/list-view/block-select-button.js +22 -1
- package/src/components/list-view/block.js +11 -0
- package/src/components/media-placeholder/index.js +3 -10
- package/src/components/media-replace-flow/index.js +35 -5
- package/src/components/media-replace-flow/index.native.js +3 -0
- package/src/components/media-upload/test/index.native.js +28 -47
- package/src/components/media-upload-progress/index.native.js +1 -0
- package/src/components/media-upload-progress/test/index.native.js +60 -47
- package/src/components/panel-color-settings/index.js +8 -4
- package/src/components/provider/block-refs-provider.js +4 -1
- package/src/components/rich-text/file-paste-handler.js +3 -1
- package/src/components/rich-text/index.js +1 -0
- package/src/components/rich-text/index.native.js +1 -0
- package/src/components/rich-text/prevent-event-discovery.js +23 -0
- package/src/components/rich-text/use-input-rules.js +2 -1
- package/src/components/rich-text/use-paste-handler.js +16 -3
- package/src/components/rich-text/utils.js +1 -0
- package/src/components/selection-scroll-into-view/index.js +1 -0
- package/src/components/url-input/README.md +5 -0
- package/src/components/use-display-block-controls/index.native.js +38 -0
- package/src/components/use-on-block-drop/index.js +7 -3
- package/src/components/writing-flow/test/use-multi-selection.js +36 -0
- package/src/components/writing-flow/use-multi-selection.js +12 -9
- package/src/hooks/border-color.js +55 -3
- package/src/hooks/border-radius.js +32 -0
- package/src/hooks/border-style.js +26 -0
- package/src/hooks/border-width.js +56 -32
- package/src/hooks/border.js +115 -20
- package/src/hooks/border.scss +3 -17
- package/src/hooks/color-panel.js +25 -19
- package/src/hooks/color-panel.native.js +63 -0
- package/src/hooks/color.js +182 -12
- package/src/hooks/color.scss +85 -0
- package/src/hooks/font-size.js +29 -1
- package/src/hooks/index.native.js +1 -0
- package/src/hooks/layout.native.js +23 -0
- package/src/hooks/letter-spacing.js +1 -1
- package/src/hooks/typography.js +1 -1
- package/src/hooks/typography.native.js +1 -3
- package/src/hooks/utils.js +69 -1
- package/src/store/actions.js +1 -2
- package/src/store/defaults.js +2 -1
- package/src/store/defaults.native.js +2 -6
- package/src/store/selectors.js +10 -5
- package/src/style.scss +4 -3
- package/src/utils/get-paste-event-data.js +1 -1
- package/src/utils/parse-css-unit-to-px.js +1 -1
- package/src/utils/test/parse-css-unit-to-px.js +3 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/preserve-scroll-in-reorder/index.js +0 -22
- package/build/components/preserve-scroll-in-reorder/index.js.map +0 -1
- package/build/components/use-canvas-click-redirect/index.js +0 -66
- package/build/components/use-canvas-click-redirect/index.js.map +0 -1
- package/build-module/components/preserve-scroll-in-reorder/index.js +0 -12
- package/build-module/components/preserve-scroll-in-reorder/index.js.map +0 -1
- package/build-module/components/use-canvas-click-redirect/index.js +0 -54
- package/build-module/components/use-canvas-click-redirect/index.js.map +0 -1
- package/src/components/preserve-scroll-in-reorder/index.js +0 -12
- package/src/components/use-canvas-click-redirect/index.js +0 -57
|
@@ -8,9 +8,9 @@ import classnames from 'classnames';
|
|
|
8
8
|
*/
|
|
9
9
|
import { __ } from '@wordpress/i18n';
|
|
10
10
|
import { compose } from '@wordpress/compose';
|
|
11
|
-
import { getDefaultBlockName } from '@wordpress/blocks';
|
|
12
11
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
13
12
|
import { withSelect, withDispatch } from '@wordpress/data';
|
|
13
|
+
import { ENTER, SPACE } from '@wordpress/keycodes';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Internal dependencies
|
|
@@ -26,13 +26,12 @@ export const ZWNBSP = '\ufeff';
|
|
|
26
26
|
|
|
27
27
|
export function DefaultBlockAppender( {
|
|
28
28
|
isLocked,
|
|
29
|
-
isVisible,
|
|
30
29
|
onAppend,
|
|
31
30
|
showPrompt,
|
|
32
31
|
placeholder,
|
|
33
32
|
rootClientId,
|
|
34
33
|
} ) {
|
|
35
|
-
if ( isLocked
|
|
34
|
+
if ( isLocked ) {
|
|
36
35
|
return null;
|
|
37
36
|
}
|
|
38
37
|
|
|
@@ -48,20 +47,23 @@ export function DefaultBlockAppender( {
|
|
|
48
47
|
>
|
|
49
48
|
<p
|
|
50
49
|
tabIndex="0"
|
|
51
|
-
// Only necessary for `useCanvasClickRedirect` to consider it
|
|
52
|
-
// as a target. Ideally it should consider any tabbable target,
|
|
53
|
-
// but the inserter is rendered in place while it should be
|
|
54
|
-
// rendered in a popover, just like it does for an empty
|
|
55
|
-
// paragraph block.
|
|
56
|
-
contentEditable
|
|
57
|
-
suppressContentEditableWarning
|
|
58
50
|
// We want this element to be styled as a paragraph by themes.
|
|
59
51
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
|
|
60
52
|
role="button"
|
|
61
|
-
aria-label={ __( 'Add block' ) }
|
|
53
|
+
aria-label={ __( 'Add default block' ) }
|
|
62
54
|
// A wrapping container for this one already has the wp-block className.
|
|
63
55
|
className="block-editor-default-block-appender__content"
|
|
64
|
-
|
|
56
|
+
onKeyDown={ ( event ) => {
|
|
57
|
+
if ( ENTER === event.keyCode || SPACE === event.keyCode ) {
|
|
58
|
+
onAppend();
|
|
59
|
+
}
|
|
60
|
+
} }
|
|
61
|
+
onClick={ () => onAppend() }
|
|
62
|
+
onFocus={ () => {
|
|
63
|
+
if ( showPrompt ) {
|
|
64
|
+
onAppend();
|
|
65
|
+
}
|
|
66
|
+
} }
|
|
65
67
|
>
|
|
66
68
|
{ showPrompt ? value : ZWNBSP }
|
|
67
69
|
</p>
|
|
@@ -77,23 +79,14 @@ export function DefaultBlockAppender( {
|
|
|
77
79
|
|
|
78
80
|
export default compose(
|
|
79
81
|
withSelect( ( select, ownProps ) => {
|
|
80
|
-
const {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
isBlockValid,
|
|
84
|
-
getSettings,
|
|
85
|
-
getTemplateLock,
|
|
86
|
-
} = select( blockEditorStore );
|
|
82
|
+
const { getBlockCount, getSettings, getTemplateLock } = select(
|
|
83
|
+
blockEditorStore
|
|
84
|
+
);
|
|
87
85
|
|
|
88
86
|
const isEmpty = ! getBlockCount( ownProps.rootClientId );
|
|
89
|
-
const isLastBlockDefault =
|
|
90
|
-
getBlockName( ownProps.lastBlockClientId ) ===
|
|
91
|
-
getDefaultBlockName();
|
|
92
|
-
const isLastBlockValid = isBlockValid( ownProps.lastBlockClientId );
|
|
93
87
|
const { bodyPlaceholder } = getSettings();
|
|
94
88
|
|
|
95
89
|
return {
|
|
96
|
-
isVisible: isEmpty || ! isLastBlockDefault || ! isLastBlockValid,
|
|
97
90
|
showPrompt: isEmpty,
|
|
98
91
|
isLocked: !! getTemplateLock( ownProps.rootClientId ),
|
|
99
92
|
placeholder: bodyPlaceholder,
|
|
@@ -6,24 +6,12 @@ exports[`DefaultBlockAppender should append a default block when input focused 1
|
|
|
6
6
|
data-root-client-id=""
|
|
7
7
|
>
|
|
8
8
|
<p
|
|
9
|
-
aria-label="Add block"
|
|
9
|
+
aria-label="Add default block"
|
|
10
10
|
className="block-editor-default-block-appender__content"
|
|
11
|
-
|
|
12
|
-
onFocus={
|
|
13
|
-
|
|
14
|
-
"calls": Array [
|
|
15
|
-
Array [],
|
|
16
|
-
],
|
|
17
|
-
"results": Array [
|
|
18
|
-
Object {
|
|
19
|
-
"type": "return",
|
|
20
|
-
"value": undefined,
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
}
|
|
24
|
-
}
|
|
11
|
+
onClick={[Function]}
|
|
12
|
+
onFocus={[Function]}
|
|
13
|
+
onKeyDown={[Function]}
|
|
25
14
|
role="button"
|
|
26
|
-
suppressContentEditableWarning={true}
|
|
27
15
|
tabIndex="0"
|
|
28
16
|
>
|
|
29
17
|
Type / to choose a block
|
|
@@ -42,12 +30,12 @@ exports[`DefaultBlockAppender should match snapshot 1`] = `
|
|
|
42
30
|
data-root-client-id=""
|
|
43
31
|
>
|
|
44
32
|
<p
|
|
45
|
-
aria-label="Add block"
|
|
33
|
+
aria-label="Add default block"
|
|
46
34
|
className="block-editor-default-block-appender__content"
|
|
47
|
-
|
|
48
|
-
onFocus={[
|
|
35
|
+
onClick={[Function]}
|
|
36
|
+
onFocus={[Function]}
|
|
37
|
+
onKeyDown={[Function]}
|
|
49
38
|
role="button"
|
|
50
|
-
suppressContentEditableWarning={true}
|
|
51
39
|
tabIndex="0"
|
|
52
40
|
>
|
|
53
41
|
Type / to choose a block
|
|
@@ -66,12 +54,12 @@ exports[`DefaultBlockAppender should optionally show without prompt 1`] = `
|
|
|
66
54
|
data-root-client-id=""
|
|
67
55
|
>
|
|
68
56
|
<p
|
|
69
|
-
aria-label="Add block"
|
|
57
|
+
aria-label="Add default block"
|
|
70
58
|
className="block-editor-default-block-appender__content"
|
|
71
|
-
|
|
72
|
-
onFocus={[
|
|
59
|
+
onClick={[Function]}
|
|
60
|
+
onFocus={[Function]}
|
|
61
|
+
onKeyDown={[Function]}
|
|
73
62
|
role="button"
|
|
74
|
-
suppressContentEditableWarning={true}
|
|
75
63
|
tabIndex="0"
|
|
76
64
|
>
|
|
77
65
|
|
|
@@ -14,16 +14,10 @@ describe( 'DefaultBlockAppender', () => {
|
|
|
14
14
|
expect( onAppend ).toHaveBeenCalledWith();
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
it( 'should render nothing if not visible', () => {
|
|
18
|
-
const wrapper = shallow( <DefaultBlockAppender /> );
|
|
19
|
-
|
|
20
|
-
expect( wrapper.type() ).toBe( null );
|
|
21
|
-
} );
|
|
22
|
-
|
|
23
17
|
it( 'should match snapshot', () => {
|
|
24
18
|
const onAppend = jest.fn();
|
|
25
19
|
const wrapper = shallow(
|
|
26
|
-
<DefaultBlockAppender
|
|
20
|
+
<DefaultBlockAppender onAppend={ onAppend } showPrompt />
|
|
27
21
|
);
|
|
28
22
|
|
|
29
23
|
expect( wrapper ).toMatchSnapshot();
|
|
@@ -32,10 +26,10 @@ describe( 'DefaultBlockAppender', () => {
|
|
|
32
26
|
it( 'should append a default block when input focused', () => {
|
|
33
27
|
const onAppend = jest.fn();
|
|
34
28
|
const wrapper = shallow(
|
|
35
|
-
<DefaultBlockAppender
|
|
29
|
+
<DefaultBlockAppender onAppend={ onAppend } showPrompt />
|
|
36
30
|
);
|
|
37
31
|
|
|
38
|
-
wrapper.find( 'p' ).simulate( '
|
|
32
|
+
wrapper.find( 'p' ).simulate( 'click' );
|
|
39
33
|
|
|
40
34
|
expect( wrapper ).toMatchSnapshot();
|
|
41
35
|
|
|
@@ -45,11 +39,7 @@ describe( 'DefaultBlockAppender', () => {
|
|
|
45
39
|
it( 'should optionally show without prompt', () => {
|
|
46
40
|
const onAppend = jest.fn();
|
|
47
41
|
const wrapper = shallow(
|
|
48
|
-
<DefaultBlockAppender
|
|
49
|
-
isVisible
|
|
50
|
-
onAppend={ onAppend }
|
|
51
|
-
showPrompt={ false }
|
|
52
|
-
/>
|
|
42
|
+
<DefaultBlockAppender onAppend={ onAppend } showPrompt={ false } />
|
|
53
43
|
);
|
|
54
44
|
const input = wrapper.find( 'p' );
|
|
55
45
|
|
|
@@ -11,6 +11,7 @@ import { useSelect } from '@wordpress/data';
|
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
13
|
import { store as blockEditorStore } from '../../store';
|
|
14
|
+
import { getDefaultStyle } from '../block-styles/utils';
|
|
14
15
|
|
|
15
16
|
export default function DefaultStylePicker( { blockName } ) {
|
|
16
17
|
const {
|
|
@@ -38,6 +39,9 @@ export default function DefaultStylePicker( { blockName } ) {
|
|
|
38
39
|
],
|
|
39
40
|
[ styles ]
|
|
40
41
|
);
|
|
42
|
+
const defaultStyleName = useMemo( () => getDefaultStyle( styles )?.name, [
|
|
43
|
+
styles,
|
|
44
|
+
] );
|
|
41
45
|
const selectOnChange = useCallback(
|
|
42
46
|
( blockStyle ) => {
|
|
43
47
|
onUpdatePreferredStyleVariations( blockName, blockStyle );
|
|
@@ -45,14 +49,22 @@ export default function DefaultStylePicker( { blockName } ) {
|
|
|
45
49
|
[ blockName, onUpdatePreferredStyleVariations ]
|
|
46
50
|
);
|
|
47
51
|
|
|
52
|
+
// Until the functionality is migrated to global styles,
|
|
53
|
+
// only show the default style picker if a non-default style has already been selected.
|
|
54
|
+
if ( ! preferredStyle || preferredStyle === defaultStyleName ) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
48
58
|
return (
|
|
49
59
|
onUpdatePreferredStyleVariations && (
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
<div className="default-style-picker__default-switcher">
|
|
61
|
+
<SelectControl
|
|
62
|
+
options={ selectOptions }
|
|
63
|
+
value={ preferredStyle || '' }
|
|
64
|
+
label={ __( 'Default Style' ) }
|
|
65
|
+
onChange={ selectOnChange }
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
56
68
|
)
|
|
57
69
|
);
|
|
58
70
|
}
|
|
@@ -160,12 +160,15 @@ async function loadScript( head, { id, src } ) {
|
|
|
160
160
|
} );
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
function Iframe(
|
|
163
|
+
function Iframe(
|
|
164
|
+
{ contentRef, children, head, tabIndex = 0, assets, ...props },
|
|
165
|
+
ref
|
|
166
|
+
) {
|
|
164
167
|
const [ , forceRender ] = useReducer( () => ( {} ) );
|
|
165
168
|
const [ iframeDocument, setIframeDocument ] = useState();
|
|
166
169
|
const [ bodyClasses, setBodyClasses ] = useState( [] );
|
|
167
|
-
const styles = useParsedAssets(
|
|
168
|
-
const scripts = useParsedAssets(
|
|
170
|
+
const styles = useParsedAssets( assets?.styles );
|
|
171
|
+
const scripts = useParsedAssets( assets?.scripts );
|
|
169
172
|
const clearerRef = useBlockSelectionClearer();
|
|
170
173
|
const [ before, writingFlowRef, after ] = useWritingFlow();
|
|
171
174
|
const setRef = useRefEffect( ( node ) => {
|
|
@@ -188,6 +191,7 @@ function Iframe( { contentRef, children, head, tabIndex = 0, ...props }, ref ) {
|
|
|
188
191
|
Array.from( ownerDocument.body.classList ).filter(
|
|
189
192
|
( name ) =>
|
|
190
193
|
name.startsWith( 'admin-color-' ) ||
|
|
194
|
+
name.startsWith( 'post-type-' ) ||
|
|
191
195
|
name === 'wp-embed-responsive'
|
|
192
196
|
)
|
|
193
197
|
);
|
package/src/components/index.js
CHANGED
|
@@ -24,6 +24,7 @@ export { default as BlockColorsStyleSelector } from './color-style-selector';
|
|
|
24
24
|
export { default as BlockEdit, useBlockEditContext } from './block-edit';
|
|
25
25
|
export { default as BlockIcon } from './block-icon';
|
|
26
26
|
export { default as BlockNavigationDropdown } from './block-navigation/dropdown';
|
|
27
|
+
export { default as BlockStyles } from './block-styles';
|
|
27
28
|
export { default as __experimentalBlockVariationPicker } from './block-variation-picker';
|
|
28
29
|
export { default as __experimentalBlockPatternSetup } from './block-pattern-setup';
|
|
29
30
|
export { default as __experimentalBlockVariationTransforms } from './block-variation-transforms';
|
|
@@ -50,6 +51,7 @@ export { default as __experimentalTextTransformControl } from './text-transform-
|
|
|
50
51
|
export { default as __experimentalColorGradientControl } from './colors-gradients/control';
|
|
51
52
|
export { default as __experimentalColorGradientSettingsDropdown } from './colors-gradients/dropdown';
|
|
52
53
|
export { default as __experimentalPanelColorGradientSettings } from './colors-gradients/panel-color-gradient-settings';
|
|
54
|
+
export { default as __experimentalToolsPanelColorDropdown } from './colors-gradients/tools-panel-color-dropdown';
|
|
53
55
|
export {
|
|
54
56
|
default as __experimentalImageEditor,
|
|
55
57
|
ImageEditingProvider as __experimentalImageEditingProvider,
|
|
@@ -133,7 +135,6 @@ export {
|
|
|
133
135
|
useTypingObserver as __unstableUseTypingObserver,
|
|
134
136
|
useMouseMoveTypingReset as __unstableUseMouseMoveTypingReset,
|
|
135
137
|
} from './observe-typing';
|
|
136
|
-
export { default as PreserveScrollInReorder } from './preserve-scroll-in-reorder';
|
|
137
138
|
export { default as SkipToSelectedBlock } from './skip-to-selected-block';
|
|
138
139
|
export {
|
|
139
140
|
default as Typewriter,
|
|
@@ -141,7 +142,6 @@ export {
|
|
|
141
142
|
} from './typewriter';
|
|
142
143
|
export { default as Warning } from './warning';
|
|
143
144
|
export { default as WritingFlow } from './writing-flow';
|
|
144
|
-
export { useCanvasClickRedirect as __unstableUseCanvasClickRedirect } from './use-canvas-click-redirect';
|
|
145
145
|
export { default as useBlockDisplayInformation } from './use-block-display-information';
|
|
146
146
|
export { default as __unstableIframe } from './iframe';
|
|
147
147
|
export { default as __experimentalUseNoRecursiveRenders } from './use-no-recursive-renders';
|
|
@@ -35,6 +35,7 @@ export {
|
|
|
35
35
|
RichTextToolbarButton,
|
|
36
36
|
__unstableRichTextInputEvent,
|
|
37
37
|
} from './rich-text';
|
|
38
|
+
export { default as MediaReplaceFlow } from './media-replace-flow';
|
|
38
39
|
export { default as MediaPlaceholder } from './media-placeholder';
|
|
39
40
|
export {
|
|
40
41
|
default as MediaUpload,
|
|
@@ -54,6 +55,7 @@ export { default as __experimentalPanelColorGradientSettings } from './colors-gr
|
|
|
54
55
|
export { default as useSetting } from './use-setting';
|
|
55
56
|
export { default as __experimentalUseNoRecursiveRenders } from './use-no-recursive-renders';
|
|
56
57
|
export { default as Warning } from './warning';
|
|
58
|
+
export { default as ContrastChecker } from './contrast-checker';
|
|
57
59
|
|
|
58
60
|
export {
|
|
59
61
|
BottomSheetSettings,
|
|
@@ -41,6 +41,8 @@ _Note:_ A block can render at most a single `InnerBlocks` and `InnerBlocks.Conte
|
|
|
41
41
|
|
|
42
42
|
_Note:_ Because the save step will automatically apply props to the element returned by `save`, it is important to include the wrapping `div` in the above simple example even though we are applying no props of our own. In a real-world example, you may have your own attributes to apply to the saved markup, or sibling content adjacent to the rendered nested blocks.
|
|
43
43
|
|
|
44
|
+
_Note:_ Inner blocks, by default, are not visible inside a WordPress excerpt. If you wish your block to appear then it needs to be returned from the `excerpt_allowed_wrapper_blocks` filter. More details can be found on the [filter reference page](https://developer.wordpress.org/reference/hooks/excerpt_allowed_wrapper_blocks/) page, as well as the [excerpt_remove_blocks](https://developer.wordpress.org/reference/functions/excerpt_remove_blocks/) page.
|
|
45
|
+
|
|
44
46
|
## Props
|
|
45
47
|
|
|
46
48
|
### `allowedBlocks`
|
|
@@ -16,13 +16,8 @@ import BaseDefaultBlockAppender from '../default-block-appender';
|
|
|
16
16
|
import withClientId from './with-client-id';
|
|
17
17
|
import { store as blockEditorStore } from '../../store';
|
|
18
18
|
|
|
19
|
-
export const DefaultBlockAppender = ( { clientId
|
|
20
|
-
return
|
|
21
|
-
<BaseDefaultBlockAppender
|
|
22
|
-
rootClientId={ clientId }
|
|
23
|
-
lastBlockClientId={ lastBlockClientId }
|
|
24
|
-
/>
|
|
25
|
-
);
|
|
19
|
+
export const DefaultBlockAppender = ( { clientId } ) => {
|
|
20
|
+
return <BaseDefaultBlockAppender rootClientId={ clientId } />;
|
|
26
21
|
};
|
|
27
22
|
|
|
28
23
|
export default compose( [
|
|
@@ -11,6 +11,8 @@ import isShallowEqual from '@wordpress/is-shallow-equal';
|
|
|
11
11
|
import { store as blockEditorStore } from '../../store';
|
|
12
12
|
import { getLayoutType } from '../../layouts';
|
|
13
13
|
|
|
14
|
+
/** @typedef {import('../../selectors').WPDirectInsertBlock } WPDirectInsertBlock */
|
|
15
|
+
|
|
14
16
|
/**
|
|
15
17
|
* This hook is a side effect which updates the block-editor store when changes
|
|
16
18
|
* happen to inner block settings. The given props are transformed into a
|
|
@@ -18,20 +20,20 @@ import { getLayoutType } from '../../layouts';
|
|
|
18
20
|
* the block-editor store, then the store is updated with the new settings which
|
|
19
21
|
* came from props.
|
|
20
22
|
*
|
|
21
|
-
* @param {string}
|
|
22
|
-
* @param {string[]}
|
|
23
|
-
*
|
|
24
|
-
* @param {?
|
|
25
|
-
* @param {?Function|boolean}
|
|
26
|
-
*
|
|
27
|
-
* @param {string}
|
|
28
|
-
*
|
|
29
|
-
* @param {boolean}
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @param {string}
|
|
33
|
-
*
|
|
34
|
-
* @param {Object}
|
|
23
|
+
* @param {string} clientId The client ID of the block to update.
|
|
24
|
+
* @param {string[]} allowedBlocks An array of block names which are permitted
|
|
25
|
+
* in inner blocks.
|
|
26
|
+
* @param {?WPDirectInsertBlock} __experimentalDefaultBlock The default block to insert: [ blockName, { blockAttributes } ].
|
|
27
|
+
* @param {?Function|boolean} __experimentalDirectInsert If a default block should be inserted directly by the
|
|
28
|
+
* appender.
|
|
29
|
+
* @param {string} [templateLock] The template lock specified for the inner
|
|
30
|
+
* blocks component. (e.g. "all")
|
|
31
|
+
* @param {boolean} captureToolbars Whether or children toolbars should be shown
|
|
32
|
+
* in the inner blocks component rather than on
|
|
33
|
+
* the child block.
|
|
34
|
+
* @param {string} orientation The direction in which the block
|
|
35
|
+
* should face.
|
|
36
|
+
* @param {Object} layout The layout object for the block container.
|
|
35
37
|
*/
|
|
36
38
|
export default function useNestedSettingsUpdate(
|
|
37
39
|
clientId,
|
|
@@ -176,7 +176,7 @@ class Inserter extends Component {
|
|
|
176
176
|
onSelectOrClose,
|
|
177
177
|
} = this.props;
|
|
178
178
|
|
|
179
|
-
if ( hasSingleBlockType || directInsertBlock
|
|
179
|
+
if ( hasSingleBlockType || directInsertBlock ) {
|
|
180
180
|
return this.renderToggle( { onToggle: insertOnlyAllowedBlock } );
|
|
181
181
|
}
|
|
182
182
|
|
|
@@ -251,10 +251,68 @@ export default compose( [
|
|
|
251
251
|
onSelectOrClose,
|
|
252
252
|
} = ownProps;
|
|
253
253
|
|
|
254
|
-
if ( ! hasSingleBlockType && ! directInsertBlock
|
|
254
|
+
if ( ! hasSingleBlockType && ! directInsertBlock ) {
|
|
255
255
|
return;
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
+
function getAdjacentBlockAttributes( attributesToCopy ) {
|
|
259
|
+
const { getBlock, getPreviousBlockClientId } = select(
|
|
260
|
+
blockEditorStore
|
|
261
|
+
);
|
|
262
|
+
|
|
263
|
+
if (
|
|
264
|
+
! attributesToCopy ||
|
|
265
|
+
( ! clientId && ! rootClientId )
|
|
266
|
+
) {
|
|
267
|
+
return {};
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const result = {};
|
|
271
|
+
let adjacentAttributes = {};
|
|
272
|
+
|
|
273
|
+
// If there is no clientId, then attempt to get attributes
|
|
274
|
+
// from the last block within innerBlocks of the root block.
|
|
275
|
+
if ( ! clientId ) {
|
|
276
|
+
const parentBlock = getBlock( rootClientId );
|
|
277
|
+
|
|
278
|
+
if ( parentBlock?.innerBlocks?.length ) {
|
|
279
|
+
const lastInnerBlock =
|
|
280
|
+
parentBlock.innerBlocks[
|
|
281
|
+
parentBlock.innerBlocks.length - 1
|
|
282
|
+
];
|
|
283
|
+
|
|
284
|
+
if (
|
|
285
|
+
directInsertBlock &&
|
|
286
|
+
directInsertBlock?.name === lastInnerBlock.name
|
|
287
|
+
) {
|
|
288
|
+
adjacentAttributes = lastInnerBlock.attributes;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
} else {
|
|
292
|
+
// Otherwise, attempt to get attributes from the
|
|
293
|
+
// previous block relative to the current clientId.
|
|
294
|
+
const currentBlock = getBlock( clientId );
|
|
295
|
+
const previousBlock = getBlock(
|
|
296
|
+
getPreviousBlockClientId( clientId )
|
|
297
|
+
);
|
|
298
|
+
|
|
299
|
+
if ( currentBlock?.name === previousBlock?.name ) {
|
|
300
|
+
adjacentAttributes =
|
|
301
|
+
previousBlock?.attributes || {};
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// Copy over only those attributes flagged to be copied.
|
|
306
|
+
attributesToCopy.forEach( ( attribute ) => {
|
|
307
|
+
if ( adjacentAttributes.hasOwnProperty( attribute ) ) {
|
|
308
|
+
result[ attribute ] =
|
|
309
|
+
adjacentAttributes[ attribute ];
|
|
310
|
+
}
|
|
311
|
+
} );
|
|
312
|
+
|
|
313
|
+
return result;
|
|
314
|
+
}
|
|
315
|
+
|
|
258
316
|
function getInsertionIndex() {
|
|
259
317
|
const {
|
|
260
318
|
getBlockIndex,
|
|
@@ -284,9 +342,23 @@ export default compose( [
|
|
|
284
342
|
|
|
285
343
|
const { insertBlock } = dispatch( blockEditorStore );
|
|
286
344
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
345
|
+
let blockToInsert;
|
|
346
|
+
|
|
347
|
+
// Attempt to augment the directInsertBlock with attributes from an adjacent block.
|
|
348
|
+
// This ensures styling from nearby blocks is preserved in the newly inserted block.
|
|
349
|
+
// See: https://github.com/WordPress/gutenberg/issues/37904
|
|
350
|
+
if ( directInsertBlock ) {
|
|
351
|
+
const newAttributes = getAdjacentBlockAttributes(
|
|
352
|
+
directInsertBlock.attributesToCopy
|
|
353
|
+
);
|
|
354
|
+
|
|
355
|
+
blockToInsert = createBlock( directInsertBlock.name, {
|
|
356
|
+
...( directInsertBlock.attributes || {} ),
|
|
357
|
+
...newAttributes,
|
|
358
|
+
} );
|
|
359
|
+
} else {
|
|
360
|
+
blockToInsert = createBlock( allowedBlockType.name );
|
|
361
|
+
}
|
|
290
362
|
|
|
291
363
|
insertBlock( blockToInsert, getInsertionIndex(), rootClientId );
|
|
292
364
|
|
|
@@ -7,7 +7,7 @@ import { delay } from 'lodash';
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
|
-
import { __ } from '@wordpress/i18n';
|
|
10
|
+
import { __, _x } from '@wordpress/i18n';
|
|
11
11
|
import { Dropdown, ToolbarButton, Picker } from '@wordpress/components';
|
|
12
12
|
import { Component } from '@wordpress/element';
|
|
13
13
|
import { withDispatch, withSelect } from '@wordpress/data';
|
|
@@ -34,7 +34,7 @@ const VOICE_OVER_ANNOUNCEMENT_DELAY = 1000;
|
|
|
34
34
|
|
|
35
35
|
const defaultRenderToggle = ( { onToggle, disabled, style, onLongPress } ) => (
|
|
36
36
|
<ToolbarButton
|
|
37
|
-
title={
|
|
37
|
+
title={ _x( 'Add block', 'Generic label for block inserter button' ) }
|
|
38
38
|
icon={
|
|
39
39
|
<Icon
|
|
40
40
|
icon={ plusCircleFilled }
|
|
@@ -7,6 +7,7 @@ import { noop } from 'lodash';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { useSelect } from '@wordpress/data';
|
|
10
|
+
import { forwardRef } from '@wordpress/element';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Internal dependencies
|
|
@@ -14,17 +15,20 @@ import { useSelect } from '@wordpress/data';
|
|
|
14
15
|
import InserterMenu from './menu';
|
|
15
16
|
import { store as blockEditorStore } from '../../store';
|
|
16
17
|
|
|
17
|
-
function InserterLibrary(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
function InserterLibrary(
|
|
19
|
+
{
|
|
20
|
+
rootClientId,
|
|
21
|
+
clientId,
|
|
22
|
+
isAppender,
|
|
23
|
+
showInserterHelpPanel,
|
|
24
|
+
showMostUsedBlocks = false,
|
|
25
|
+
__experimentalInsertionIndex,
|
|
26
|
+
__experimentalFilterValue,
|
|
27
|
+
onSelect = noop,
|
|
28
|
+
shouldFocusBlock = false,
|
|
29
|
+
},
|
|
30
|
+
ref
|
|
31
|
+
) {
|
|
28
32
|
const destinationRootClientId = useSelect(
|
|
29
33
|
( select ) => {
|
|
30
34
|
const { getBlockRootClientId } = select( blockEditorStore );
|
|
@@ -47,8 +51,9 @@ function InserterLibrary( {
|
|
|
47
51
|
__experimentalInsertionIndex={ __experimentalInsertionIndex }
|
|
48
52
|
__experimentalFilterValue={ __experimentalFilterValue }
|
|
49
53
|
shouldFocusBlock={ shouldFocusBlock }
|
|
54
|
+
ref={ ref }
|
|
50
55
|
/>
|
|
51
56
|
);
|
|
52
57
|
}
|
|
53
58
|
|
|
54
|
-
export default InserterLibrary;
|
|
59
|
+
export default forwardRef( InserterLibrary );
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
forwardRef,
|
|
6
|
+
useState,
|
|
7
|
+
useCallback,
|
|
8
|
+
useMemo,
|
|
9
|
+
useImperativeHandle,
|
|
10
|
+
useRef,
|
|
11
|
+
} from '@wordpress/element';
|
|
5
12
|
import { VisuallyHidden, SearchControl } from '@wordpress/components';
|
|
6
13
|
import { __ } from '@wordpress/i18n';
|
|
7
14
|
import { useSelect } from '@wordpress/data';
|
|
@@ -19,17 +26,20 @@ import useInsertionPoint from './hooks/use-insertion-point';
|
|
|
19
26
|
import InserterTabs from './tabs';
|
|
20
27
|
import { store as blockEditorStore } from '../../store';
|
|
21
28
|
|
|
22
|
-
function InserterMenu(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
function InserterMenu(
|
|
30
|
+
{
|
|
31
|
+
rootClientId,
|
|
32
|
+
clientId,
|
|
33
|
+
isAppender,
|
|
34
|
+
__experimentalInsertionIndex,
|
|
35
|
+
onSelect,
|
|
36
|
+
showInserterHelpPanel,
|
|
37
|
+
showMostUsedBlocks,
|
|
38
|
+
__experimentalFilterValue = '',
|
|
39
|
+
shouldFocusBlock = true,
|
|
40
|
+
},
|
|
41
|
+
ref
|
|
42
|
+
) {
|
|
33
43
|
const [ filterValue, setFilterValue ] = useState(
|
|
34
44
|
__experimentalFilterValue
|
|
35
45
|
);
|
|
@@ -168,6 +178,13 @@ function InserterMenu( {
|
|
|
168
178
|
[ blocksTab, patternsTab, reusableBlocksTab ]
|
|
169
179
|
);
|
|
170
180
|
|
|
181
|
+
const searchRef = useRef();
|
|
182
|
+
useImperativeHandle( ref, () => ( {
|
|
183
|
+
focusSearch: () => {
|
|
184
|
+
searchRef.current.focus();
|
|
185
|
+
},
|
|
186
|
+
} ) );
|
|
187
|
+
|
|
171
188
|
return (
|
|
172
189
|
<div className="block-editor-inserter__menu">
|
|
173
190
|
<div className="block-editor-inserter__main-area">
|
|
@@ -182,6 +199,7 @@ function InserterMenu( {
|
|
|
182
199
|
value={ filterValue }
|
|
183
200
|
label={ __( 'Search for blocks and patterns' ) }
|
|
184
201
|
placeholder={ __( 'Search' ) }
|
|
202
|
+
ref={ searchRef }
|
|
185
203
|
/>
|
|
186
204
|
{ !! filterValue && (
|
|
187
205
|
<InserterSearchResults
|
|
@@ -219,4 +237,4 @@ function InserterMenu( {
|
|
|
219
237
|
);
|
|
220
238
|
}
|
|
221
239
|
|
|
222
|
-
export default InserterMenu;
|
|
240
|
+
export default forwardRef( InserterMenu );
|
|
@@ -163,7 +163,9 @@ export function getItemSearchRank( item, searchTerm, config = {} ) {
|
|
|
163
163
|
|
|
164
164
|
// Give a better rank to "core" namespaced items.
|
|
165
165
|
if ( rank !== 0 && name.startsWith( 'core/' ) ) {
|
|
166
|
-
|
|
166
|
+
const isCoreBlockVariation = name !== item.id;
|
|
167
|
+
// Give a bit better rank to "core" blocks over "core" block variations.
|
|
168
|
+
rank += isCoreBlockVariation ? 1 : 2;
|
|
167
169
|
}
|
|
168
170
|
|
|
169
171
|
return rank;
|