@wordpress/block-editor 7.0.2 → 8.0.1
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 +11 -0
- package/README.md +45 -1
- package/build/components/autocomplete/index.js +1 -1
- package/build/components/autocomplete/index.js.map +1 -1
- package/build/components/block-actions/index.js +8 -4
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-alignment-control/ui.js +61 -14
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/use-available-alignments.js +25 -3
- package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build/components/block-controls/fill.js +2 -2
- package/build/components/block-controls/fill.js.map +1 -1
- package/build/components/block-controls/hook.js +3 -3
- package/build/components/block-controls/hook.js.map +1 -1
- package/build/components/block-icon/index.js +5 -1
- package/build/components/block-icon/index.js.map +1 -1
- package/build/components/block-icon/index.native.js +9 -11
- package/build/components/block-icon/index.native.js.map +1 -1
- package/build/components/block-inspector/index.js +8 -0
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-html.js +5 -0
- package/build/components/block-list/block-html.js.map +1 -1
- package/build/components/block-list/block.js +12 -5
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +4 -3
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +1 -1
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/use-multi-selection.js +21 -8
- package/build/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
- package/build/components/block-list-appender/index.js +9 -1
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-mover/index.js +4 -4
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-mover/index.native.js +4 -4
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +0 -1
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-patterns-list/index.js +1 -8
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-preview/auto.js +1 -1
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings/container.native.js +5 -2
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +26 -5
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +10 -3
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- 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-switcher/block-styles-menu.js +1 -1
- package/build/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build/components/block-switcher/index.js +10 -3
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-title/index.js +3 -2
- package/build/components/block-title/index.js.map +1 -1
- package/build/components/block-tools/block-popover.js +2 -4
- package/build/components/block-tools/block-popover.js.map +1 -1
- package/build/components/block-tools/index.js +4 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +96 -7
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/border-radius-control/utils.js +17 -8
- package/build/components/border-radius-control/utils.js.map +1 -1
- package/build/components/colors/utils.js +11 -3
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors-gradients/control.js +22 -57
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +83 -7
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/contrast-checker/index.js +18 -12
- package/build/components/contrast-checker/index.js.map +1 -1
- package/build/components/copy-handler/index.js +9 -3
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/default-block-appender/index.js +2 -2
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/duotone-control/index.js +41 -39
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/editor-styles/index.js +9 -3
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +32 -21
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/iframe/index.js +6 -4
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js +126 -0
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
- package/build/components/image-editor/constants.js +16 -0
- package/build/components/image-editor/constants.js.map +1 -0
- package/build/components/image-editor/context.js +59 -0
- package/build/components/image-editor/context.js.map +1 -0
- package/build/components/image-editor/cropper.js +83 -0
- package/build/components/image-editor/cropper.js.map +1 -0
- package/build/components/image-editor/form-controls.js +36 -0
- package/build/components/image-editor/form-controls.js.map +1 -0
- package/build/components/image-editor/index.js +60 -0
- package/build/components/image-editor/index.js.map +1 -0
- package/build/components/image-editor/rotation-button.js +37 -0
- package/build/components/image-editor/rotation-button.js.map +1 -0
- package/build/components/image-editor/use-save-image.js +84 -0
- package/build/components/image-editor/use-save-image.js.map +1 -0
- package/build/components/image-editor/use-transform-image.js +135 -0
- package/build/components/image-editor/use-transform-image.js.map +1 -0
- package/build/components/image-editor/zoom-dropdown.js +55 -0
- package/build/components/image-editor/zoom-dropdown.js.map +1 -0
- package/build/components/image-size-control/use-dimension-handler.js +14 -3
- package/build/components/image-size-control/use-dimension-handler.js.map +1 -1
- package/build/components/index.js +36 -20
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +2 -2
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/button-block-appender.js +11 -1
- package/build/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build/components/inner-blocks/index.js +8 -5
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +4 -3
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +24 -13
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/explorer.js +62 -0
- package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
- package/build/components/inserter/block-patterns-explorer/patterns-list.js +111 -0
- package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
- package/build/components/inserter/block-patterns-explorer/sidebar.js +78 -0
- package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
- package/build/components/inserter/block-patterns-tab.js +74 -35
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js +3 -11
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
- package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build/components/inserter/hooks/use-clipboard-block.native.js +5 -4
- package/build/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
- package/build/components/inserter/index.js +12 -4
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +1 -7
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/library.js +2 -0
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/menu.js +2 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/menu.native.js +11 -15
- package/build/components/inserter/menu.native.js.map +1 -1
- package/build/components/inserter/pattern-panel.js +19 -10
- package/build/components/inserter/pattern-panel.js.map +1 -1
- package/build/components/inserter/preview-panel.js +1 -1
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +5 -6
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inserter/search-results.native.js +6 -11
- package/build/components/inserter/search-results.native.js.map +1 -1
- package/build/components/inserter/utils.native.js +44 -0
- package/build/components/inserter/utils.native.js.map +1 -0
- package/build/components/inspector-controls/block-support-slot-container.js +28 -0
- package/build/components/inspector-controls/block-support-slot-container.js.map +1 -0
- package/build/components/inspector-controls/block-support-tools-panel.js +78 -0
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -0
- package/build/components/inspector-controls/fill.js +16 -1
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/groups.js +5 -1
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls/slot.js +15 -0
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +9 -6
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/link-control/index.js +93 -34
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/link-preview.js +45 -15
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-input.js +25 -7
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/block-contents.js +1 -20
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block.js +54 -69
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +102 -76
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +45 -20
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/leaf.js +2 -2
- package/build/components/list-view/leaf.js.map +1 -1
- package/build/components/list-view/list-item.js +3 -2
- package/build/components/list-view/list-item.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +13 -54
- package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build/components/media-placeholder/index.js +29 -20
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +5 -3
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +1 -4
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/observe-typing/index.js +1 -1
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/plain-text/index.native.js +30 -1
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/rich-text/embed-handler-picker.native.js +66 -0
- package/build/components/rich-text/embed-handler-picker.native.js.map +1 -0
- package/build/components/rich-text/format-edit.js +28 -2
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js +32 -11
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/index.js +5 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +41 -2
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +28 -9
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/rich-text/utils.js +22 -0
- package/build/components/rich-text/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/index.js +25 -11
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +13 -10
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +2 -1
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-setting/index.js +48 -9
- package/build/components/use-setting/index.js.map +1 -1
- package/build/components/writing-flow/use-multi-selection.js +6 -0
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +10 -1
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js +13 -10
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/anchor.js +1 -1
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border.js +5 -5
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color-panel.js +5 -2
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color.js +1 -1
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/dimensions.js +23 -27
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +60 -16
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-appearance.js +49 -6
- package/build/hooks/font-appearance.js.map +1 -1
- package/build/hooks/font-family.js +123 -32
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +51 -9
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/gap.js +2 -1
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/index.js +10 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +8 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/letter-spacing.js +44 -7
- package/build/hooks/letter-spacing.js.map +1 -1
- package/build/hooks/line-height.js +45 -8
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/lock.js +43 -0
- package/build/hooks/lock.js.map +1 -0
- package/build/hooks/margin.js +1 -1
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +1 -1
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/style.js +7 -4
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/text-decoration.js +42 -6
- package/build/hooks/text-decoration.js.map +1 -1
- package/build/hooks/text-transform.js +42 -6
- package/build/hooks/text-transform.js.map +1 -1
- package/build/hooks/typography.js +108 -8
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/use-cached-truthy.js +29 -0
- package/build/hooks/use-cached-truthy.js.map +1 -0
- package/build/index.js +7 -0
- package/build/index.js.map +1 -1
- package/build/layouts/flex.js +160 -34
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/flow.js +75 -8
- package/build/layouts/flow.js.map +1 -1
- package/build/store/actions.js +323 -265
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.native.js +13 -1
- package/build/store/defaults.native.js.map +1 -1
- package/build/store/index.js +1 -3
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +33 -22
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +172 -38
- package/build/store/selectors.js.map +1 -1
- package/build/utils/index.js +10 -1
- package/build/utils/index.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +51 -1
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build/utils/transform-styles/transforms/wrap.js +16 -0
- package/build/utils/transform-styles/transforms/wrap.js.map +1 -1
- package/build-module/components/autocomplete/index.js +2 -2
- package/build-module/components/autocomplete/index.js.map +1 -1
- package/build-module/components/block-actions/index.js +8 -4
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +64 -17
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js +25 -3
- package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build-module/components/block-controls/fill.js +2 -2
- package/build-module/components/block-controls/fill.js.map +1 -1
- package/build-module/components/block-controls/hook.js +3 -3
- package/build-module/components/block-controls/hook.js.map +1 -1
- package/build-module/components/block-icon/index.js +5 -1
- package/build-module/components/block-icon/index.js.map +1 -1
- package/build-module/components/block-icon/index.native.js +10 -11
- package/build-module/components/block-icon/index.native.js.map +1 -1
- package/build-module/components/block-inspector/index.js +8 -0
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-html.js +5 -0
- package/build-module/components/block-list/block-html.js.map +1 -1
- package/build-module/components/block-list/block.js +12 -5
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +4 -3
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +1 -1
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-multi-selection.js +21 -8
- package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +9 -1
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-mover/index.js +4 -4
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +4 -4
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +0 -1
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +1 -6
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +1 -1
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +6 -3
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +28 -7
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +10 -3
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- 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-switcher/block-styles-menu.js +1 -1
- package/build-module/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build-module/components/block-switcher/index.js +10 -3
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-title/index.js +3 -2
- package/build-module/components/block-title/index.js.map +1 -1
- package/build-module/components/block-tools/block-popover.js +3 -5
- package/build-module/components/block-tools/block-popover.js.map +1 -1
- package/build-module/components/block-tools/index.js +4 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +96 -8
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/utils.js +16 -9
- package/build-module/components/border-radius-control/utils.js.map +1 -1
- package/build-module/components/colors/utils.js +9 -3
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +26 -63
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +84 -7
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/contrast-checker/index.js +13 -10
- package/build-module/components/contrast-checker/index.js.map +1 -1
- package/build-module/components/copy-handler/index.js +9 -3
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +2 -2
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/duotone-control/index.js +43 -39
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/editor-styles/index.js +7 -3
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +28 -21
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/iframe/index.js +6 -4
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +115 -0
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
- package/build-module/components/image-editor/constants.js +7 -0
- package/build-module/components/image-editor/constants.js.map +1 -0
- package/build-module/components/image-editor/context.js +44 -0
- package/build-module/components/image-editor/context.js.map +1 -0
- package/build-module/components/image-editor/cropper.js +69 -0
- package/build-module/components/image-editor/cropper.js.map +1 -0
- package/build-module/components/image-editor/form-controls.js +26 -0
- package/build-module/components/image-editor/form-controls.js.map +1 -0
- package/build-module/components/image-editor/index.js +37 -0
- package/build-module/components/image-editor/index.js.map +1 -0
- package/build-module/components/image-editor/rotation-button.js +26 -0
- package/build-module/components/image-editor/rotation-button.js.map +1 -0
- package/build-module/components/image-editor/use-save-image.js +70 -0
- package/build-module/components/image-editor/use-save-image.js.map +1 -0
- package/build-module/components/image-editor/use-transform-image.js +127 -0
- package/build-module/components/image-editor/use-transform-image.js.map +1 -0
- package/build-module/components/image-editor/zoom-dropdown.js +43 -0
- package/build-module/components/image-editor/zoom-dropdown.js.map +1 -0
- package/build-module/components/image-size-control/use-dimension-handler.js +13 -2
- package/build-module/components/image-size-control/use-dimension-handler.js.map +1 -1
- package/build-module/components/index.js +4 -3
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/button-block-appender.js +10 -1
- package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +9 -6
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +5 -4
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +24 -13
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/explorer.js +50 -0
- package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +92 -0
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js +69 -0
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab.js +75 -36
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.native.js +2 -10
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build-module/components/inserter/hooks/use-clipboard-block.native.js +5 -4
- package/build-module/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
- package/build-module/components/inserter/index.js +12 -4
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +1 -7
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/library.js +2 -0
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/menu.js +2 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/menu.native.js +10 -15
- package/build-module/components/inserter/menu.native.js.map +1 -1
- package/build-module/components/inserter/pattern-panel.js +21 -13
- package/build-module/components/inserter/pattern-panel.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +1 -1
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -1
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +4 -5
- package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build-module/components/inserter/search-results.native.js +5 -10
- package/build-module/components/inserter/search-results.native.js.map +1 -1
- package/build-module/components/inserter/utils.native.js +35 -0
- package/build-module/components/inserter/utils.native.js.map +1 -0
- package/build-module/components/inspector-controls/block-support-slot-container.js +18 -0
- package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -0
- package/build-module/components/inspector-controls/block-support-tools-panel.js +67 -0
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -0
- package/build-module/components/inspector-controls/fill.js +16 -2
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +5 -1
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +13 -0
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +9 -6
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/link-control/index.js +93 -35
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +46 -17
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-input.js +24 -7
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +1 -18
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block.js +56 -71
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +102 -78
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +48 -23
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/leaf.js +2 -2
- package/build-module/components/list-view/leaf.js.map +1 -1
- package/build-module/components/list-view/list-item.js +3 -2
- package/build-module/components/list-view/list-item.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +13 -54
- package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +29 -20
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +5 -3
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +1 -4
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/observe-typing/index.js +1 -1
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/plain-text/index.native.js +29 -2
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/embed-handler-picker.native.js +54 -0
- package/build-module/components/rich-text/embed-handler-picker.native.js.map +1 -0
- package/build-module/components/rich-text/format-edit.js +28 -3
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js +29 -11
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +4 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +41 -3
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +28 -9
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/rich-text/utils.js +20 -0
- package/build-module/components/rich-text/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/index.js +25 -11
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +13 -10
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +3 -2
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-setting/index.js +48 -9
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/components/writing-flow/use-multi-selection.js +6 -0
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +10 -1
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js +13 -10
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/anchor.js +1 -1
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border.js +5 -5
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color-panel.js +6 -3
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color.js +1 -1
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/dimensions.js +24 -27
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +59 -16
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-appearance.js +45 -6
- package/build-module/hooks/font-appearance.js.map +1 -1
- package/build-module/hooks/font-family.js +117 -33
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +47 -9
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/gap.js +2 -1
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/index.js +2 -0
- package/build-module/hooks/index.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/letter-spacing.js +40 -7
- package/build-module/hooks/letter-spacing.js.map +1 -1
- package/build-module/hooks/line-height.js +41 -8
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/lock.js +33 -0
- package/build-module/hooks/lock.js.map +1 -0
- package/build-module/hooks/margin.js +1 -1
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +1 -1
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/style.js +7 -4
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/text-decoration.js +38 -6
- package/build-module/hooks/text-decoration.js.map +1 -1
- package/build-module/hooks/text-transform.js +38 -6
- package/build-module/hooks/text-transform.js.map +1 -1
- package/build-module/hooks/typography.js +117 -17
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/use-cached-truthy.js +21 -0
- package/build-module/hooks/use-cached-truthy.js.map +1 -0
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/flex.js +163 -38
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/flow.js +74 -8
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/store/actions.js +286 -241
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.native.js +12 -1
- package/build-module/store/defaults.native.js.map +1 -1
- package/build-module/store/index.js +1 -2
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +33 -22
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +160 -34
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/index.js +1 -0
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +48 -1
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/utils/transform-styles/transforms/wrap.js +16 -0
- package/build-module/utils/transform-styles/transforms/wrap.js.map +1 -1
- package/build-style/style-rtl.css +267 -144
- package/build-style/style.css +267 -144
- package/package.json +28 -27
- package/src/components/autocomplete/index.js +5 -2
- package/src/components/block-actions/index.js +9 -5
- package/src/components/block-alignment-control/style.scss +5 -0
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +15 -1
- package/src/components/block-alignment-control/test/index.native.js +37 -0
- package/src/components/block-alignment-control/ui.js +98 -27
- package/src/components/block-alignment-control/use-available-alignments.js +31 -10
- package/src/components/block-controls/fill.js +5 -2
- package/src/components/block-controls/hook.js +3 -3
- package/src/components/block-draggable/style.scss +19 -4
- package/src/components/block-icon/index.js +4 -1
- package/src/components/block-icon/index.native.js +10 -16
- package/src/components/block-inspector/index.js +10 -0
- package/src/components/block-list/block-html.js +5 -0
- package/src/components/block-list/block.js +11 -3
- package/src/components/block-list/block.native.js +5 -3
- package/src/components/block-list/index.native.js +1 -1
- package/src/components/block-list/style.scss +15 -0
- package/src/components/block-list/use-block-props/use-multi-selection.js +27 -7
- package/src/components/block-list-appender/index.js +8 -0
- package/src/components/block-mover/index.js +4 -4
- package/src/components/block-mover/index.native.js +4 -4
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +10 -6
- package/src/components/block-mover/test/index.native.js +26 -28
- package/src/components/block-navigation/dropdown.js +0 -1
- package/src/components/block-patterns-list/index.js +1 -8
- package/src/components/block-patterns-list/style.scss +22 -12
- package/src/components/block-preview/README.md +1 -1
- package/src/components/block-preview/auto.js +1 -1
- package/src/components/block-preview/style.scss +0 -17
- package/src/components/block-settings/container.native.js +7 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +26 -13
- package/src/components/block-settings-menu-controls/index.js +9 -6
- package/src/components/block-styles/preview.native.js +2 -2
- package/src/components/block-switcher/block-styles-menu.js +1 -1
- package/src/components/block-switcher/index.js +7 -3
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +1 -1
- package/src/components/block-switcher/test/index.js +3 -0
- package/src/components/block-title/index.js +5 -2
- package/src/components/block-tools/block-popover.js +3 -5
- package/src/components/block-tools/index.js +5 -2
- package/src/components/block-tools/insertion-point.js +97 -9
- package/src/components/block-tools/style.scss +4 -35
- package/src/components/block-types-list/style.scss +0 -3
- package/src/components/border-radius-control/index.js +1 -0
- package/src/components/border-radius-control/test/utils.js +216 -0
- package/src/components/border-radius-control/utils.js +18 -10
- package/src/components/color-palette/test/__snapshots__/control.js.snap +128 -71
- package/src/components/colors/test/utils.js +41 -0
- package/src/components/colors/utils.js +9 -5
- package/src/components/colors-gradients/control.js +70 -110
- package/src/components/colors-gradients/panel-color-gradient-settings.js +79 -7
- package/src/components/colors-gradients/style.scss +10 -18
- package/src/components/colors-gradients/test/control.js +41 -66
- package/src/components/contrast-checker/index.js +14 -10
- package/src/components/copy-handler/index.js +6 -1
- package/src/components/default-block-appender/index.js +2 -2
- package/src/components/default-block-appender/test/__snapshots__/index.js.snap +3 -3
- package/src/components/duotone-control/index.js +49 -41
- package/src/components/duotone-control/style.scss +27 -12
- package/src/components/editor-styles/index.js +7 -4
- package/src/components/font-appearance-control/index.js +41 -33
- package/src/components/font-appearance-control/style.scss +1 -1
- package/src/components/iframe/index.js +4 -4
- package/src/components/image-editor/aspect-ratio-dropdown.js +129 -0
- package/src/components/image-editor/constants.js +6 -0
- package/src/components/image-editor/context.js +56 -0
- package/src/components/image-editor/cropper.js +74 -0
- package/src/components/image-editor/form-controls.js +22 -0
- package/src/components/image-editor/index.js +52 -0
- package/src/components/image-editor/rotation-button.js +24 -0
- package/src/components/image-editor/use-save-image.js +97 -0
- package/src/components/image-editor/use-transform-image.js +162 -0
- package/src/components/image-editor/zoom-dropdown.js +40 -0
- package/src/components/image-size-control/use-dimension-handler.js +18 -1
- package/src/components/index.js +7 -6
- package/src/components/index.native.js +1 -4
- package/src/components/inner-blocks/button-block-appender.js +9 -0
- package/src/components/inner-blocks/index.js +8 -4
- package/src/components/inner-blocks/index.native.js +7 -4
- package/src/components/inner-blocks/use-nested-settings-update.js +26 -11
- package/src/components/inserter/block-patterns-explorer/explorer.js +50 -0
- package/src/components/inserter/block-patterns-explorer/patterns-list.js +122 -0
- package/src/components/inserter/block-patterns-explorer/sidebar.js +73 -0
- package/src/components/inserter/block-patterns-tab.js +107 -73
- package/src/components/inserter/block-types-tab.native.js +3 -15
- package/src/components/inserter/hooks/use-block-type-impressions.native.js +14 -21
- package/src/components/inserter/hooks/use-clipboard-block.native.js +3 -2
- package/src/components/inserter/index.js +15 -3
- package/src/components/inserter/index.native.js +2 -19
- package/src/components/inserter/library.js +2 -0
- package/src/components/inserter/menu.js +4 -1
- package/src/components/inserter/menu.native.js +9 -14
- package/src/components/inserter/pattern-panel.js +33 -16
- package/src/components/inserter/preview-panel.js +1 -1
- package/src/components/inserter/quick-inserter.js +1 -1
- package/src/components/inserter/reusable-blocks-tab.native.js +4 -6
- package/src/components/inserter/search-results.native.js +5 -15
- package/src/components/inserter/style.scss +80 -16
- package/src/components/inserter/test/block-types-tab.native.js +1 -1
- package/src/components/inserter/test/fixtures/index.native.js +12 -0
- package/src/components/inserter/utils.native.js +35 -0
- package/src/components/inserter-list-item/style.scss +4 -2
- package/src/components/inspector-controls/block-support-slot-container.js +10 -0
- package/src/components/inspector-controls/block-support-tools-panel.js +60 -0
- package/src/components/inspector-controls/fill.js +23 -2
- package/src/components/inspector-controls/groups.js +8 -0
- package/src/components/inspector-controls/slot.js +15 -0
- package/src/components/letter-spacing-control/index.js +12 -6
- package/src/components/link-control/README.md +47 -14
- package/src/components/link-control/index.js +102 -31
- package/src/components/link-control/link-preview.js +53 -20
- package/src/components/link-control/search-input.js +21 -7
- package/src/components/link-control/style.scss +66 -19
- package/src/components/link-control/test/index.js +311 -4
- package/src/components/list-view/block-contents.js +17 -38
- package/src/components/list-view/block.js +73 -84
- package/src/components/list-view/branch.js +123 -94
- package/src/components/list-view/index.js +82 -30
- package/src/components/list-view/leaf.js +2 -2
- package/src/components/list-view/list-item.js +5 -4
- package/src/components/list-view/style.scss +70 -33
- package/src/components/list-view/use-list-view-client-ids.js +9 -68
- package/src/components/media-placeholder/index.js +26 -19
- package/src/components/media-replace-flow/README.md +7 -0
- package/src/components/media-replace-flow/index.js +4 -1
- package/src/components/media-upload/README.md +1 -1
- package/src/components/navigable-toolbar/index.js +1 -4
- package/src/components/observe-typing/index.js +3 -2
- package/src/components/plain-text/index.native.js +26 -4
- package/src/components/rich-text/embed-handler-picker.native.js +68 -0
- package/src/components/rich-text/format-edit.js +36 -2
- package/src/components/rich-text/format-toolbar/index.js +25 -6
- package/src/components/rich-text/index.js +12 -8
- package/src/components/rich-text/index.native.js +35 -1
- package/src/components/rich-text/use-paste-handler.js +30 -12
- package/src/components/rich-text/utils.js +16 -0
- package/src/components/skip-to-selected-block/README.md +39 -0
- package/src/components/typewriter/index.js +3 -2
- package/src/components/url-input/index.js +26 -10
- package/src/components/use-moving-animation/index.js +9 -8
- package/src/components/use-on-block-drop/index.js +5 -1
- package/src/components/use-setting/index.js +49 -11
- package/src/components/writing-flow/use-multi-selection.js +6 -0
- package/src/components/writing-flow/use-tab-nav.js +17 -3
- package/src/hooks/align.js +19 -10
- package/src/hooks/anchor.js +2 -2
- package/src/hooks/border.js +8 -11
- package/src/hooks/color-panel.js +4 -1
- package/src/hooks/color.js +7 -4
- package/src/hooks/dimensions.js +48 -59
- package/src/hooks/duotone.js +68 -19
- package/src/hooks/font-appearance.js +38 -7
- package/src/hooks/font-family.js +129 -33
- package/src/hooks/font-size.js +42 -6
- package/src/hooks/gap.js +2 -1
- package/src/hooks/index.js +2 -0
- package/src/hooks/index.native.js +1 -0
- package/src/hooks/layout.scss +8 -0
- package/src/hooks/letter-spacing.js +35 -7
- package/src/hooks/line-height.js +37 -9
- package/src/hooks/lock.js +34 -0
- package/src/hooks/margin.js +1 -1
- package/src/hooks/padding.js +1 -1
- package/src/hooks/style.js +15 -11
- package/src/hooks/text-decoration.js +34 -6
- package/src/hooks/text-transform.js +34 -6
- package/src/hooks/typography.js +165 -15
- package/src/hooks/typography.scss +16 -0
- package/src/hooks/use-cached-truthy.js +20 -0
- package/src/index.js +1 -0
- package/src/layouts/flex.js +179 -50
- package/src/layouts/flow.js +54 -8
- package/src/store/actions.js +239 -377
- package/src/store/defaults.native.js +12 -0
- package/src/store/index.js +1 -2
- package/src/store/reducer.js +54 -18
- package/src/store/selectors.js +173 -47
- package/src/store/test/actions.js +407 -705
- package/src/store/test/reducer.js +22 -54
- package/src/store/test/selectors.js +79 -21
- package/src/style.scss +2 -1
- package/src/utils/index.js +1 -0
- package/src/utils/parse-css-unit-to-px.js +43 -1
- package/src/utils/test/parse-css-unit-to-px.js +148 -165
- package/src/utils/transform-styles/transforms/test/wrap.js +1 -1
- package/src/utils/transform-styles/transforms/wrap.js +16 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/duotone-control/duotone-picker-popover.js +0 -44
- package/build/components/duotone-control/duotone-picker-popover.js.map +0 -1
- package/build/components/list-view/block-slot.js +0 -121
- package/build/components/list-view/block-slot.js.map +0 -1
- package/build/components/list-view/editor.js +0 -35
- package/build/components/list-view/editor.js.map +0 -1
- package/build/components/text-decoration-and-transform/index.js +0 -39
- package/build/components/text-decoration-and-transform/index.js.map +0 -1
- package/build/store/controls.js +0 -44
- package/build/store/controls.js.map +0 -1
- package/build-module/components/duotone-control/duotone-picker-popover.js +0 -35
- package/build-module/components/duotone-control/duotone-picker-popover.js.map +0 -1
- package/build-module/components/list-view/block-slot.js +0 -96
- package/build-module/components/list-view/block-slot.js.map +0 -1
- package/build-module/components/list-view/editor.js +0 -25
- package/build-module/components/list-view/editor.js.map +0 -1
- package/build-module/components/text-decoration-and-transform/index.js +0 -30
- package/build-module/components/text-decoration-and-transform/index.js.map +0 -1
- package/build-module/store/controls.js +0 -32
- package/build-module/store/controls.js.map +0 -1
- package/src/components/duotone-control/duotone-picker-popover.js +0 -36
- package/src/components/list-view/block-slot.js +0 -120
- package/src/components/list-view/editor.js +0 -29
- package/src/components/text-decoration-and-transform/index.js +0 -36
- package/src/components/text-decoration-and-transform/style.scss +0 -3
- package/src/store/controls.js +0 -39
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { TextInput, Platform } from 'react-native';
|
|
4
|
+
import { TextInput, Platform, Dimensions } from 'react-native';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { Component } from '@wordpress/element';
|
|
10
|
+
import { getPxFromCssUnit } from '@wordpress/block-editor';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Internal dependencies
|
|
@@ -61,7 +62,30 @@ export default class PlainText extends Component {
|
|
|
61
62
|
this._input.blur();
|
|
62
63
|
}
|
|
63
64
|
|
|
65
|
+
getFontSize() {
|
|
66
|
+
const { style } = this.props;
|
|
67
|
+
|
|
68
|
+
if ( ! style?.fontSize ) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const { width, height } = Dimensions.get( 'window' );
|
|
73
|
+
const cssUnitOptions = { height, width };
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
fontSize: parseFloat(
|
|
77
|
+
getPxFromCssUnit( style.fontSize, cssUnitOptions )
|
|
78
|
+
),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
64
82
|
render() {
|
|
83
|
+
const { style } = this.props;
|
|
84
|
+
const textStyles = [
|
|
85
|
+
style || styles[ 'block-editor-plain-text' ],
|
|
86
|
+
this.getFontSize(),
|
|
87
|
+
];
|
|
88
|
+
|
|
65
89
|
return (
|
|
66
90
|
<TextInput
|
|
67
91
|
{ ...this.props }
|
|
@@ -75,9 +99,7 @@ export default class PlainText extends Component {
|
|
|
75
99
|
( this.props.style && this.props.style.fontFamily ) ||
|
|
76
100
|
styles[ 'block-editor-plain-text' ].fontFamily
|
|
77
101
|
}
|
|
78
|
-
style={
|
|
79
|
-
this.props.style || styles[ 'block-editor-plain-text' ]
|
|
80
|
-
}
|
|
102
|
+
style={ textStyles }
|
|
81
103
|
scrollEnabled={ false }
|
|
82
104
|
/>
|
|
83
105
|
);
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { noop } from 'lodash';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import {
|
|
10
|
+
forwardRef,
|
|
11
|
+
useRef,
|
|
12
|
+
useImperativeHandle,
|
|
13
|
+
memo,
|
|
14
|
+
useCallback,
|
|
15
|
+
} from '@wordpress/element';
|
|
16
|
+
import { Picker } from '@wordpress/components';
|
|
17
|
+
import { __ } from '@wordpress/i18n';
|
|
18
|
+
|
|
19
|
+
const DEFAULT_PICKER_OPTIONS = [
|
|
20
|
+
{
|
|
21
|
+
id: 'createEmbed',
|
|
22
|
+
label: __( 'Create embed' ),
|
|
23
|
+
value: 'createEmbed',
|
|
24
|
+
onSelect: noop,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 'createLink',
|
|
28
|
+
label: __( 'Create link' ),
|
|
29
|
+
value: 'createLink',
|
|
30
|
+
onSelect: noop,
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
const EmbedHandlerPicker = forwardRef( ( {}, ref ) => {
|
|
35
|
+
const pickerRef = useRef();
|
|
36
|
+
const pickerOptions = useRef( DEFAULT_PICKER_OPTIONS ).current;
|
|
37
|
+
|
|
38
|
+
const onPickerSelect = useCallback(
|
|
39
|
+
( value ) => {
|
|
40
|
+
const selectedItem = pickerOptions.find(
|
|
41
|
+
( item ) => item.value === value
|
|
42
|
+
);
|
|
43
|
+
selectedItem.onSelect();
|
|
44
|
+
},
|
|
45
|
+
[ pickerOptions ]
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
useImperativeHandle( ref, () => ( {
|
|
49
|
+
presentPicker: ( { createEmbed, createLink } ) => {
|
|
50
|
+
pickerOptions[ 0 ].onSelect = createEmbed;
|
|
51
|
+
pickerOptions[ 1 ].onSelect = createLink;
|
|
52
|
+
pickerRef.current?.presentPicker();
|
|
53
|
+
},
|
|
54
|
+
} ) );
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<Picker
|
|
58
|
+
ref={ pickerRef }
|
|
59
|
+
options={ pickerOptions }
|
|
60
|
+
onChange={ onPickerSelect }
|
|
61
|
+
testID="embed-handler-picker"
|
|
62
|
+
hideCancelButton
|
|
63
|
+
leftAlign
|
|
64
|
+
/>
|
|
65
|
+
);
|
|
66
|
+
} );
|
|
67
|
+
|
|
68
|
+
export default memo( EmbedHandlerPicker );
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
getActiveFormat,
|
|
6
|
+
getActiveObject,
|
|
7
|
+
isCollapsed,
|
|
8
|
+
} from '@wordpress/rich-text';
|
|
9
|
+
/**
|
|
10
|
+
* External dependencies
|
|
11
|
+
*/
|
|
12
|
+
import { find } from 'lodash';
|
|
5
13
|
|
|
6
14
|
export default function FormatEdit( {
|
|
7
15
|
formatTypes,
|
|
@@ -18,11 +26,37 @@ export default function FormatEdit( {
|
|
|
18
26
|
}
|
|
19
27
|
|
|
20
28
|
const activeFormat = getActiveFormat( value, name );
|
|
21
|
-
|
|
29
|
+
let isActive = activeFormat !== undefined;
|
|
22
30
|
const activeObject = getActiveObject( value );
|
|
23
31
|
const isObjectActive =
|
|
24
32
|
activeObject !== undefined && activeObject.type === name;
|
|
25
33
|
|
|
34
|
+
// Edge case: un-collapsed link formats.
|
|
35
|
+
// If there is a missing link format at either end of the selection
|
|
36
|
+
// then we shouldn't show the Edit UI because the selection has exceeded
|
|
37
|
+
// the bounds of the link format.
|
|
38
|
+
// Also if the format objects don't match then we're dealing with two separate
|
|
39
|
+
// links so we should not allow the link to be modified over the top.
|
|
40
|
+
if ( name === 'core/link' && ! isCollapsed( value ) ) {
|
|
41
|
+
const formats = value.formats;
|
|
42
|
+
|
|
43
|
+
const linkFormatAtStart = find( formats[ value.start ], {
|
|
44
|
+
type: 'core/link',
|
|
45
|
+
} );
|
|
46
|
+
|
|
47
|
+
const linkFormatAtEnd = find( formats[ value.end - 1 ], {
|
|
48
|
+
type: 'core/link',
|
|
49
|
+
} );
|
|
50
|
+
|
|
51
|
+
if (
|
|
52
|
+
! linkFormatAtStart ||
|
|
53
|
+
! linkFormatAtEnd ||
|
|
54
|
+
linkFormatAtStart !== linkFormatAtEnd
|
|
55
|
+
) {
|
|
56
|
+
isActive = false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
26
60
|
return (
|
|
27
61
|
<Edit
|
|
28
62
|
key={ name }
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { orderBy } from 'lodash';
|
|
6
|
+
import classnames from 'classnames';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* WordPress dependencies
|
|
@@ -20,22 +21,40 @@ const POPOVER_PROPS = {
|
|
|
20
21
|
const FormatToolbar = () => {
|
|
21
22
|
return (
|
|
22
23
|
<>
|
|
23
|
-
{ [ 'bold', 'italic', 'link'
|
|
24
|
+
{ [ 'bold', 'italic', 'link' ].map( ( format ) => (
|
|
24
25
|
<Slot
|
|
25
26
|
name={ `RichText.ToolbarControls.${ format }` }
|
|
26
27
|
key={ format }
|
|
27
28
|
/>
|
|
28
29
|
) ) }
|
|
29
30
|
<Slot name="RichText.ToolbarControls">
|
|
30
|
-
{ ( fills ) =>
|
|
31
|
-
fills.length
|
|
31
|
+
{ ( fills ) => {
|
|
32
|
+
if ( ! fills.length ) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const allProps = fills.map( ( [ { props } ] ) => props );
|
|
37
|
+
const hasActive = allProps.some(
|
|
38
|
+
( { isActive } ) => isActive
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
return (
|
|
32
42
|
<ToolbarItem>
|
|
33
43
|
{ ( toggleProps ) => (
|
|
34
44
|
<DropdownMenu
|
|
35
45
|
icon={ chevronDown }
|
|
36
46
|
/* translators: button label text should, if possible, be under 16 characters. */
|
|
37
47
|
label={ __( 'More' ) }
|
|
38
|
-
toggleProps={
|
|
48
|
+
toggleProps={ {
|
|
49
|
+
...toggleProps,
|
|
50
|
+
className: classnames(
|
|
51
|
+
toggleProps.className,
|
|
52
|
+
{ 'is-pressed': hasActive }
|
|
53
|
+
),
|
|
54
|
+
describedBy: __(
|
|
55
|
+
'Displays more block tools'
|
|
56
|
+
),
|
|
57
|
+
} }
|
|
39
58
|
controls={ orderBy(
|
|
40
59
|
fills.map( ( [ { props } ] ) => props ),
|
|
41
60
|
'title'
|
|
@@ -44,8 +63,8 @@ const FormatToolbar = () => {
|
|
|
44
63
|
/>
|
|
45
64
|
) }
|
|
46
65
|
</ToolbarItem>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
66
|
+
);
|
|
67
|
+
} }
|
|
49
68
|
</Slot>
|
|
50
69
|
</>
|
|
51
70
|
);
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
} from '@wordpress/rich-text';
|
|
27
27
|
import deprecated from '@wordpress/deprecated';
|
|
28
28
|
import { BACKSPACE, DELETE } from '@wordpress/keycodes';
|
|
29
|
+
import { Popover } from '@wordpress/components';
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* Internal dependencies
|
|
@@ -307,14 +308,17 @@ function RichTextWrapper(
|
|
|
307
308
|
{ isSelected && (
|
|
308
309
|
<keyboardShortcutContext.Provider value={ keyboardShortcuts }>
|
|
309
310
|
<inputEventContext.Provider value={ inputEvents }>
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
311
|
+
<Popover.__unstableSlotNameProvider value="__unstable-block-tools-after">
|
|
312
|
+
{ children &&
|
|
313
|
+
children( { value, onChange, onFocus } ) }
|
|
314
|
+
<FormatEdit
|
|
315
|
+
value={ value }
|
|
316
|
+
onChange={ onChange }
|
|
317
|
+
onFocus={ onFocus }
|
|
318
|
+
formatTypes={ formatTypes }
|
|
319
|
+
forwardedRef={ anchorRef }
|
|
320
|
+
/>
|
|
321
|
+
</Popover.__unstableSlotNameProvider>
|
|
318
322
|
</inputEventContext.Provider>
|
|
319
323
|
</keyboardShortcutContext.Provider>
|
|
320
324
|
) }
|
|
@@ -55,7 +55,9 @@ import {
|
|
|
55
55
|
getMultilineTag,
|
|
56
56
|
getAllowedFormats,
|
|
57
57
|
isShortcode,
|
|
58
|
+
createLinkInParagraph,
|
|
58
59
|
} from './utils';
|
|
60
|
+
import EmbedHandlerPicker from './embed-handler-picker';
|
|
59
61
|
|
|
60
62
|
const wrapperClasses = 'block-editor-rich-text';
|
|
61
63
|
const classes = 'block-editor-rich-text__editable';
|
|
@@ -118,6 +120,7 @@ function RichTextWrapper(
|
|
|
118
120
|
const fallbackRef = useRef();
|
|
119
121
|
const { clientId, isSelected: blockIsSelected } = useBlockEditContext();
|
|
120
122
|
const nativeProps = useNativeProps();
|
|
123
|
+
const embedHandlerPickerRef = useRef();
|
|
121
124
|
const selector = ( select ) => {
|
|
122
125
|
const {
|
|
123
126
|
isCaretWithinFormattedText,
|
|
@@ -439,10 +442,19 @@ function RichTextWrapper(
|
|
|
439
442
|
mode = 'BLOCKS';
|
|
440
443
|
}
|
|
441
444
|
|
|
445
|
+
const isPastedURL = isURL( plainText.trim() );
|
|
446
|
+
const presentEmbedHandlerPicker = () =>
|
|
447
|
+
embedHandlerPickerRef.current?.presentPicker( {
|
|
448
|
+
createEmbed: () =>
|
|
449
|
+
onReplace( content, content.length - 1, -1 ),
|
|
450
|
+
createLink: () =>
|
|
451
|
+
createLinkInParagraph( plainText.trim(), onReplace ),
|
|
452
|
+
} );
|
|
453
|
+
|
|
442
454
|
if (
|
|
443
455
|
__unstableEmbedURLOnPaste &&
|
|
444
456
|
isEmpty( value ) &&
|
|
445
|
-
|
|
457
|
+
isPastedURL
|
|
446
458
|
) {
|
|
447
459
|
mode = 'BLOCKS';
|
|
448
460
|
}
|
|
@@ -472,9 +484,30 @@ function RichTextWrapper(
|
|
|
472
484
|
|
|
473
485
|
onChange( insert( value, valueToInsert ) );
|
|
474
486
|
} else if ( content.length > 0 ) {
|
|
487
|
+
// When an URL is pasted in an empty paragraph then the EmbedHandlerPicker should showcase options allowing the transformation of that URL
|
|
488
|
+
// into either an Embed block or a link within the target paragraph. If the paragraph is non-empty, the URL is pasted as text.
|
|
489
|
+
const canPasteEmbed =
|
|
490
|
+
isPastedURL &&
|
|
491
|
+
content.length === 1 &&
|
|
492
|
+
content[ 0 ].name === 'core/embed';
|
|
475
493
|
if ( onReplace && isEmpty( value ) ) {
|
|
494
|
+
if ( canPasteEmbed ) {
|
|
495
|
+
onChange(
|
|
496
|
+
insert( value, create( { text: plainText } ) )
|
|
497
|
+
);
|
|
498
|
+
if ( __unstableEmbedURLOnPaste ) {
|
|
499
|
+
presentEmbedHandlerPicker();
|
|
500
|
+
}
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
476
503
|
onReplace( content, content.length - 1, -1 );
|
|
477
504
|
} else {
|
|
505
|
+
if ( canPasteEmbed ) {
|
|
506
|
+
onChange(
|
|
507
|
+
insert( value, create( { text: plainText } ) )
|
|
508
|
+
);
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
478
511
|
splitValue( value, content );
|
|
479
512
|
}
|
|
480
513
|
}
|
|
@@ -650,6 +683,7 @@ function RichTextWrapper(
|
|
|
650
683
|
/>
|
|
651
684
|
) }
|
|
652
685
|
</Autocomplete>
|
|
686
|
+
<EmbedHandlerPicker ref={ embedHandlerPickerRef } />
|
|
653
687
|
</>
|
|
654
688
|
) }
|
|
655
689
|
</RichText>
|
|
@@ -21,6 +21,25 @@ import { filePasteHandler } from './file-paste-handler';
|
|
|
21
21
|
import { addActiveFormats, isShortcode } from './utils';
|
|
22
22
|
import { splitValue } from './split-value';
|
|
23
23
|
|
|
24
|
+
/** @typedef {import('@wordpress/rich-text').RichTextValue} RichTextValue */
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Replaces line separators with line breaks if not multiline.
|
|
28
|
+
* Replaces line breaks with line separators if multiline.
|
|
29
|
+
*
|
|
30
|
+
* @param {RichTextValue} value Value to adjust.
|
|
31
|
+
* @param {boolean} isMultiline Whether to adjust to multiline or not.
|
|
32
|
+
*
|
|
33
|
+
* @return {RichTextValue} Adjusted value.
|
|
34
|
+
*/
|
|
35
|
+
function adjustLines( value, isMultiline ) {
|
|
36
|
+
if ( isMultiline ) {
|
|
37
|
+
return replace( value, /\n+/g, LINE_SEPARATOR );
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return replace( value, new RegExp( LINE_SEPARATOR, 'g' ), '\n' );
|
|
41
|
+
}
|
|
42
|
+
|
|
24
43
|
export function usePasteHandler( props ) {
|
|
25
44
|
const propsRef = useRef( props );
|
|
26
45
|
propsRef.current = props;
|
|
@@ -110,13 +129,19 @@ export function usePasteHandler( props ) {
|
|
|
110
129
|
// without filtering the data. The filters are only meant for externally
|
|
111
130
|
// pasted content and remove inline styles.
|
|
112
131
|
if ( isInternal ) {
|
|
113
|
-
const
|
|
132
|
+
const pastedMultilineTag =
|
|
133
|
+
clipboardData.getData( 'rich-text-multi-line-tag' ) ||
|
|
134
|
+
undefined;
|
|
135
|
+
let pastedValue = create( {
|
|
114
136
|
html,
|
|
115
|
-
multilineTag,
|
|
137
|
+
multilineTag: pastedMultilineTag,
|
|
116
138
|
multilineWrapperTags:
|
|
117
|
-
|
|
139
|
+
pastedMultilineTag === 'li'
|
|
140
|
+
? [ 'ul', 'ol' ]
|
|
141
|
+
: undefined,
|
|
118
142
|
preserveWhiteSpace,
|
|
119
143
|
} );
|
|
144
|
+
pastedValue = adjustLines( pastedValue, !! multilineTag );
|
|
120
145
|
addActiveFormats( pastedValue, value.activeFormats );
|
|
121
146
|
onChange( insert( value, pastedValue ) );
|
|
122
147
|
return;
|
|
@@ -190,18 +215,11 @@ export function usePasteHandler( props ) {
|
|
|
190
215
|
if ( typeof content === 'string' ) {
|
|
191
216
|
let valueToInsert = create( { html: content } );
|
|
192
217
|
|
|
193
|
-
addActiveFormats( valueToInsert, value.activeFormats );
|
|
194
|
-
|
|
195
218
|
// If the content should be multiline, we should process text
|
|
196
219
|
// separated by a line break as separate lines.
|
|
197
|
-
|
|
198
|
-
valueToInsert = replace(
|
|
199
|
-
valueToInsert,
|
|
200
|
-
/\n+/g,
|
|
201
|
-
LINE_SEPARATOR
|
|
202
|
-
);
|
|
203
|
-
}
|
|
220
|
+
valueToInsert = adjustLines( valueToInsert, !! multilineTag );
|
|
204
221
|
|
|
222
|
+
addActiveFormats( valueToInsert, value.activeFormats );
|
|
205
223
|
onChange( insert( value, valueToInsert ) );
|
|
206
224
|
} else if ( content.length > 0 ) {
|
|
207
225
|
if ( onReplace && isEmpty( value ) ) {
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { regexp } from '@wordpress/shortcode';
|
|
5
5
|
import deprecated from '@wordpress/deprecated';
|
|
6
|
+
import { renderToString } from '@wordpress/element';
|
|
7
|
+
import { createBlock } from '@wordpress/blocks';
|
|
6
8
|
|
|
7
9
|
export function addActiveFormats( value, activeFormats ) {
|
|
8
10
|
if ( activeFormats?.length ) {
|
|
@@ -60,3 +62,17 @@ export function getAllowedFormats( {
|
|
|
60
62
|
getAllowedFormats.EMPTY_ARRAY = [];
|
|
61
63
|
|
|
62
64
|
export const isShortcode = ( text ) => regexp( '.*' ).test( text );
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Creates a link from pasted URL.
|
|
68
|
+
* Creates a paragraph block containing a link to the URL, and calls `onReplace`.
|
|
69
|
+
*
|
|
70
|
+
* @param {string} url The URL that could not be embedded.
|
|
71
|
+
* @param {Function} onReplace Function to call with the created fallback block.
|
|
72
|
+
*/
|
|
73
|
+
export function createLinkInParagraph( url, onReplace ) {
|
|
74
|
+
const link = <a href={ url }>{ url }</a>;
|
|
75
|
+
onReplace(
|
|
76
|
+
createBlock( 'core/paragraph', { content: renderToString( link ) } )
|
|
77
|
+
);
|
|
78
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# SkipToSelectedBlock
|
|
2
|
+
|
|
3
|
+
`SkipToSelectedBlock` provides a way for keyboard and assistive technologies users to jump back to the currently selected block.
|
|
4
|
+
|
|
5
|
+
The component renders as a visually hidden, secondary button with the text, 'Skip to the selected block'. When clicked it will set [focus](https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus) on the currently selected block. This means that the currently selected block will now receive all keyboard and similar events by default until focus is moved elsewhere.
|
|
6
|
+
|
|
7
|
+
If there are multiple blocks selected, the focus will be set on the block that was selected first.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
Render a `<SkipToSelectedBlock />` component passing in the currently selected block's `clientId`.
|
|
12
|
+
|
|
13
|
+
```jsx
|
|
14
|
+
function render( { clientId } ) {
|
|
15
|
+
return (
|
|
16
|
+
<div>
|
|
17
|
+
<SkipToSelectedBlock selectedBlockClientId={ clientId } />
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
_Note:_
|
|
24
|
+
|
|
25
|
+
## Props
|
|
26
|
+
|
|
27
|
+
### `selectedBlockClientId`
|
|
28
|
+
|
|
29
|
+
- **Type:** `String`
|
|
30
|
+
- **Required** `true`
|
|
31
|
+
- **Default:** `undefined`
|
|
32
|
+
|
|
33
|
+
The `selectedBlockClientId` is passed to `useBlockRef` inside the component to correctly reference the currently selected block.
|
|
34
|
+
|
|
35
|
+
If a `clientId` is not provided, the component will return `null`.
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
|
|
39
|
+
This component is currently used in the [block inspector](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-editor/src/components/block-inspector) in the sidebar, at the bottom right corner of the screen.
|
|
@@ -16,8 +16,9 @@ const arrowKeyCodes = new Set( [ UP, DOWN, LEFT, RIGHT ] );
|
|
|
16
16
|
const initialTriggerPercentage = 0.75;
|
|
17
17
|
|
|
18
18
|
export function useTypewriter() {
|
|
19
|
-
const hasSelectedBlock = useSelect(
|
|
20
|
-
select( blockEditorStore ).hasSelectedBlock()
|
|
19
|
+
const hasSelectedBlock = useSelect(
|
|
20
|
+
( select ) => select( blockEditorStore ).hasSelectedBlock(),
|
|
21
|
+
[]
|
|
21
22
|
);
|
|
22
23
|
|
|
23
24
|
return useRefEffect(
|
|
@@ -60,7 +60,10 @@ class URLInput extends Component {
|
|
|
60
60
|
|
|
61
61
|
componentDidUpdate( prevProps ) {
|
|
62
62
|
const { showSuggestions, selectedSuggestion } = this.state;
|
|
63
|
-
const {
|
|
63
|
+
const {
|
|
64
|
+
value,
|
|
65
|
+
__experimentalShowInitialSuggestions = false,
|
|
66
|
+
} = this.props;
|
|
64
67
|
|
|
65
68
|
// only have to worry about scrolling selected suggestion into view
|
|
66
69
|
// when already expanded
|
|
@@ -84,12 +87,19 @@ class URLInput extends Component {
|
|
|
84
87
|
}, 100 );
|
|
85
88
|
}
|
|
86
89
|
|
|
87
|
-
//
|
|
90
|
+
// Update suggestions when the value changes
|
|
88
91
|
if (
|
|
89
92
|
prevProps.value !== value &&
|
|
90
|
-
this.
|
|
93
|
+
! this.props.disableSuggestions &&
|
|
94
|
+
! this.isUpdatingSuggestions
|
|
91
95
|
) {
|
|
92
|
-
|
|
96
|
+
if ( value?.length ) {
|
|
97
|
+
// If the new value is not empty we need to update with suggestions for it
|
|
98
|
+
this.updateSuggestions( value );
|
|
99
|
+
} else if ( __experimentalShowInitialSuggestions ) {
|
|
100
|
+
// If the new value is empty and we can show initial suggestions, then show initial suggestions
|
|
101
|
+
this.updateSuggestions();
|
|
102
|
+
}
|
|
93
103
|
}
|
|
94
104
|
}
|
|
95
105
|
|
|
@@ -134,7 +144,13 @@ class URLInput extends Component {
|
|
|
134
144
|
return;
|
|
135
145
|
}
|
|
136
146
|
|
|
137
|
-
|
|
147
|
+
// Initial suggestions may only show if there is no value
|
|
148
|
+
// (note: this includes whitespace).
|
|
149
|
+
const isInitialSuggestions = ! value?.length;
|
|
150
|
+
|
|
151
|
+
// Trim only now we've determined whether or not it originally had a "length"
|
|
152
|
+
// (even if that value was all whitespace).
|
|
153
|
+
value = value.trim();
|
|
138
154
|
|
|
139
155
|
// Allow a suggestions request if:
|
|
140
156
|
// - there are at least 2 characters in the search input (except manual searches where
|
|
@@ -219,7 +235,7 @@ class URLInput extends Component {
|
|
|
219
235
|
|
|
220
236
|
this.props.onChange( inputValue );
|
|
221
237
|
if ( ! this.props.disableSuggestions ) {
|
|
222
|
-
this.updateSuggestions( inputValue
|
|
238
|
+
this.updateSuggestions( inputValue );
|
|
223
239
|
}
|
|
224
240
|
}
|
|
225
241
|
|
|
@@ -236,7 +252,7 @@ class URLInput extends Component {
|
|
|
236
252
|
! ( suggestions && suggestions.length )
|
|
237
253
|
) {
|
|
238
254
|
// Ensure the suggestions are updated with the current input value
|
|
239
|
-
this.updateSuggestions( value
|
|
255
|
+
this.updateSuggestions( value );
|
|
240
256
|
}
|
|
241
257
|
}
|
|
242
258
|
|
|
@@ -288,7 +304,7 @@ class URLInput extends Component {
|
|
|
288
304
|
// Submitting while loading should trigger onSubmit
|
|
289
305
|
case ENTER: {
|
|
290
306
|
if ( this.props.onSubmit ) {
|
|
291
|
-
this.props.onSubmit();
|
|
307
|
+
this.props.onSubmit( null, event );
|
|
292
308
|
}
|
|
293
309
|
|
|
294
310
|
break;
|
|
@@ -338,10 +354,10 @@ class URLInput extends Component {
|
|
|
338
354
|
this.selectLink( suggestion );
|
|
339
355
|
|
|
340
356
|
if ( this.props.onSubmit ) {
|
|
341
|
-
this.props.onSubmit( suggestion );
|
|
357
|
+
this.props.onSubmit( suggestion, event );
|
|
342
358
|
}
|
|
343
359
|
} else if ( this.props.onSubmit ) {
|
|
344
|
-
this.props.onSubmit();
|
|
360
|
+
this.props.onSubmit( null, event );
|
|
345
361
|
}
|
|
346
362
|
|
|
347
363
|
break;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useSpring } from 'react-spring/web
|
|
4
|
+
import { useSpring } from '@react-spring/web';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -136,19 +136,20 @@ function useMovingAnimation( {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
// Called for every frame computed by useSpring.
|
|
139
|
-
function
|
|
139
|
+
function onChange( { value } ) {
|
|
140
|
+
let { x, y } = value;
|
|
140
141
|
x = Math.round( x );
|
|
141
142
|
y = Math.round( y );
|
|
142
143
|
|
|
143
|
-
if ( x !==
|
|
144
|
+
if ( x !== onChange.x || y !== onChange.y ) {
|
|
144
145
|
onFrameChange( { x, y } );
|
|
145
|
-
|
|
146
|
-
|
|
146
|
+
onChange.x = x;
|
|
147
|
+
onChange.y = y;
|
|
147
148
|
}
|
|
148
149
|
}
|
|
149
150
|
|
|
150
|
-
|
|
151
|
-
|
|
151
|
+
onChange.x = 0;
|
|
152
|
+
onChange.y = 0;
|
|
152
153
|
|
|
153
154
|
useSpring( {
|
|
154
155
|
from: {
|
|
@@ -162,7 +163,7 @@ function useMovingAnimation( {
|
|
|
162
163
|
reset: triggeredAnimation !== finishedAnimation,
|
|
163
164
|
config: { mass: 5, tension: 2000, friction: 200 },
|
|
164
165
|
immediate: prefersReducedMotion,
|
|
165
|
-
|
|
166
|
+
onChange,
|
|
166
167
|
} );
|
|
167
168
|
|
|
168
169
|
return ref;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
+
cloneBlock,
|
|
5
6
|
findTransform,
|
|
6
7
|
getBlockTransforms,
|
|
7
8
|
pasteHandler,
|
|
@@ -80,8 +81,11 @@ export function onBlockDrop(
|
|
|
80
81
|
// If the user is inserting a block
|
|
81
82
|
if ( dropType === 'inserter' ) {
|
|
82
83
|
clearSelectedBlock();
|
|
84
|
+
const blocksToInsert = blocks.map( ( block ) =>
|
|
85
|
+
cloneBlock( block )
|
|
86
|
+
);
|
|
83
87
|
insertBlocks(
|
|
84
|
-
|
|
88
|
+
blocksToInsert,
|
|
85
89
|
targetBlockIndex,
|
|
86
90
|
targetRootClientId,
|
|
87
91
|
true,
|