@wordpress/block-editor 12.15.0 → 12.16.1-next.79a6196f.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/LICENSE.md +1 -1
- package/README.md +12 -10
- package/build/components/block-canvas/index.js +21 -7
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-card/index.js +2 -2
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-controls/hook.js +3 -23
- package/build/components/block-controls/hook.js.map +1 -1
- package/build/components/block-draggable/draggable-chip.js +6 -1
- package/build/components/block-draggable/draggable-chip.js.map +1 -1
- package/build/components/block-draggable/index.js +76 -6
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/index.native.js +0 -6
- package/build/components/block-draggable/index.native.js.map +1 -1
- package/build/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
- package/build/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
- package/build/components/block-edit/context.js +5 -1
- package/build/components/block-edit/context.js.map +1 -1
- package/build/components/block-edit/index.js +18 -9
- package/build/components/block-edit/index.js.map +1 -1
- package/build/components/block-editing-mode/index.js +2 -3
- package/build/components/block-editing-mode/index.js.map +1 -1
- package/build/components/block-info-slot-fill/index.js +3 -4
- package/build/components/block-info-slot-fill/index.js.map +1 -1
- package/build/components/block-inspector/index.js +1 -1
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-list-item-cell.native.js +1 -0
- package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build/components/block-list/block.js +257 -95
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +58 -23
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +3 -5
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/private-block-context.js +14 -0
- package/build/components/block-list/private-block-context.js.map +1 -0
- package/build/components/block-list/use-block-props/index.js +49 -69
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -29
- package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build/components/block-list/use-block-props/use-is-hovered.js +4 -14
- package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +3 -2
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list/use-scroll-upon-insertion.native.js +41 -0
- package/build/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
- package/build/components/block-lock/toolbar.js +21 -27
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-mover/index.js +2 -1
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +5 -5
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +2 -9
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-rename/modal.js +3 -0
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-settings/container.native.js +6 -4
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-styles/index.js +1 -1
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/index.native.js +3 -2
- package/build/components/block-styles/index.native.js.map +1 -1
- package/build/components/block-switcher/index.js +4 -4
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +90 -29
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-toolbar-breadcrumb.js +49 -0
- package/build/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
- package/build/components/block-tools/block-toolbar-popover.js +84 -0
- package/build/components/block-tools/block-toolbar-popover.js.map +1 -0
- package/build/components/block-tools/index.js +27 -24
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-types-list/index.native.js +4 -3
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/block-variation-picker/index.native.js +2 -1
- package/build/components/block-variation-picker/index.native.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +29 -2
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/border-radius-control/linked-button.js +1 -1
- package/build/components/border-radius-control/linked-button.js.map +1 -1
- package/build/components/colors/utils.js +10 -2
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors/with-colors.js +6 -2
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/colors-gradients/control.js +28 -17
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/duotone-control/index.js +1 -4
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/font-sizes/utils.js +10 -2
- package/build/components/font-sizes/utils.js.map +1 -1
- package/build/components/global-styles/border-panel.js +2 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +24 -21
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +4 -3
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/effects-panel.js +2 -1
- package/build/components/global-styles/effects-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +6 -3
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +192 -0
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -0
- package/build/components/global-styles/hooks.js +3 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +7 -1
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/index.js +7 -0
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +43 -36
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +22 -8
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +8 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/height-control/index.js +6 -2
- package/build/components/height-control/index.js.map +1 -1
- package/build/components/image-link-destinations/index.native.js +118 -0
- package/build/components/image-link-destinations/index.native.js.map +1 -0
- package/build/components/image-size-control/index.js +2 -2
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.native.js +14 -5
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/index.js +61 -22
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +18 -4
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +5 -6
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +5 -9
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +10 -9
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js +10 -10
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +9 -9
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/utils.js +10 -14
- package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +4 -14
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/index.js +1 -2
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/library.js +3 -7
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/media-tab/media-panel.js +2 -2
- package/build/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build/components/inserter/menu.js +26 -33
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/preview-panel.js +2 -2
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter/tabs.js +21 -21
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inserter-button/index.native.js +98 -0
- package/build/components/inserter-button/index.native.js.map +1 -0
- package/build/components/inserter-button/sparkles.js +23 -0
- package/build/components/inserter-button/sparkles.js.map +1 -0
- package/build/components/inserter-draggable-blocks/index.js +8 -4
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inserter-list-item/index.js +2 -4
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +3 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls/fill.js +3 -3
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +3 -3
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls-tabs/index.js +34 -23
- package/build/components/inspector-controls-tabs/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +4 -0
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +57 -3
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/media-upload-progress/constants.js +19 -0
- package/build/components/media-upload-progress/constants.js.map +1 -0
- package/build/components/media-upload-progress/index.native.js +42 -17
- package/build/components/media-upload-progress/index.native.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +11 -16
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/plain-text/index.native.js +8 -3
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/preview-options/index.js +6 -62
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/provider/index.js +3 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +7 -1
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/content.js +26 -23
- package/build/components/rich-text/content.js.map +1 -1
- package/build/components/rich-text/get-rich-text-values.js +2 -1
- package/build/components/rich-text/get-rich-text-values.js.map +1 -1
- package/build/components/rich-text/index.js +19 -37
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +9 -16
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/native/get-format-colors.native.js +22 -24
- package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +22 -57
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/use-input-rules.js +7 -3
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/rich-text/use-mark-persistent.js +1 -1
- package/build/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build/components/rich-text/with-deprecations.js +50 -0
- package/build/components/rich-text/with-deprecations.js.map +1 -0
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-input/index.js +9 -6
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-commands/index.js +14 -18
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +108 -17
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +100 -92
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +9 -12
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +4 -1
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/use-settings/index.js +14 -0
- package/build/components/use-settings/index.js.map +1 -1
- package/build/components/writing-flow/index.js +0 -1
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-drag-selection.js +15 -4
- package/build/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +73 -27
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +7 -4
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js +21 -69
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/align.native.js +11 -1
- package/build/hooks/align.native.js.map +1 -1
- package/build/hooks/anchor.js +14 -30
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/aria-label.js +9 -1
- package/build/hooks/aria-label.js.map +1 -1
- package/build/hooks/background.js +198 -36
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js +24 -32
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-renaming.js +18 -22
- package/build/hooks/block-renaming.js.map +1 -1
- package/build/hooks/border.js +53 -80
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +79 -90
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +29 -29
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/custom-class-name.js +13 -30
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/custom-class-name.native.js +9 -1
- package/build/hooks/custom-class-name.native.js.map +1 -1
- package/build/hooks/dimensions.js +13 -14
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +31 -61
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-family.js +23 -28
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +52 -120
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +27 -16
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +15 -6
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout-child.js +68 -0
- package/build/hooks/layout-child.js.map +1 -0
- package/build/hooks/layout.js +25 -104
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/padding.js +2 -2
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/position.js +40 -62
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +52 -89
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/typography.js +25 -10
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/typography.native.js +43 -18
- package/build/hooks/typography.native.js.map +1 -1
- package/build/hooks/use-typography-props.js +10 -2
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/hooks/utils.js +200 -10
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +2 -6
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +0 -2
- package/build/private-apis.native.js.map +1 -1
- package/build/store/actions.js +0 -16
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +54 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +46 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +18 -2
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +11 -73
- package/build/store/selectors.js.map +1 -1
- package/build/store/undo-ignore.js +12 -0
- package/build/store/undo-ignore.js.map +1 -0
- package/build/store/utils.js +66 -0
- package/build/store/utils.js.map +1 -0
- package/build/utils/get-px-from-css-unit.js +16 -0
- package/build/utils/get-px-from-css-unit.js.map +1 -0
- package/build/utils/index.js +2 -2
- package/build/utils/index.js.map +1 -1
- package/build/utils/object.js +38 -99
- package/build/utils/object.js.map +1 -1
- package/build/utils/selection.js +9 -1
- package/build/utils/selection.js.map +1 -1
- package/build/utils/use-can-block-toolbar-be-focused.js +46 -0
- package/build/utils/use-can-block-toolbar-be-focused.js.map +1 -0
- package/build-module/components/block-canvas/index.js +22 -8
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-card/index.js +2 -2
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-controls/hook.js +4 -24
- package/build-module/components/block-controls/hook.js.map +1 -1
- package/build-module/components/block-draggable/draggable-chip.js +6 -1
- package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
- package/build-module/components/block-draggable/index.js +76 -6
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +1 -7
- package/build-module/components/block-draggable/index.native.js.map +1 -1
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
- package/build-module/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
- package/build-module/components/block-edit/context.js +2 -0
- package/build-module/components/block-edit/context.js.map +1 -1
- package/build-module/components/block-edit/index.js +19 -10
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-editing-mode/index.js +3 -4
- package/build-module/components/block-editing-mode/index.js.map +1 -1
- package/build-module/components/block-info-slot-fill/index.js +3 -3
- package/build-module/components/block-info-slot-fill/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +1 -1
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-list-item-cell.native.js +1 -0
- package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
- package/build-module/components/block-list/block.js +261 -99
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +60 -25
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +3 -5
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/private-block-context.js +6 -0
- package/build-module/components/block-list/private-block-context.js.map +1 -0
- package/build-module/components/block-list/use-block-props/index.js +50 -70
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +4 -29
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-is-hovered.js +4 -14
- package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +4 -2
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +3 -2
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list/use-scroll-upon-insertion.native.js +33 -0
- package/build-module/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
- package/build-module/components/block-lock/toolbar.js +22 -28
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-mover/index.js +2 -1
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +6 -6
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +3 -10
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js +3 -0
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +4 -2
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-styles/index.js +1 -1
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/index.native.js +3 -2
- package/build-module/components/block-styles/index.native.js.map +1 -1
- package/build-module/components/block-switcher/index.js +4 -4
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +89 -27
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js +41 -0
- package/build-module/components/block-tools/block-toolbar-breadcrumb.js.map +1 -0
- package/build-module/components/block-tools/block-toolbar-popover.js +74 -0
- package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -0
- package/build-module/components/block-tools/index.js +27 -24
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +2 -1
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/block-variation-picker/index.native.js +2 -1
- package/build-module/components/block-variation-picker/index.native.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +30 -3
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/border-radius-control/linked-button.js +1 -1
- package/build-module/components/border-radius-control/linked-button.js.map +1 -1
- package/build-module/components/colors/utils.js +9 -1
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors/with-colors.js +5 -1
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +29 -18
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/duotone-control/index.js +1 -4
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/font-sizes/utils.js +9 -1
- package/build-module/components/font-sizes/utils.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +3 -2
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +26 -23
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +5 -4
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/effects-panel.js +3 -2
- package/build-module/components/global-styles/effects-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +8 -5
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +184 -0
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +3 -2
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +7 -1
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/index.js +1 -0
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +45 -38
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +15 -1
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +7 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/height-control/index.js +6 -2
- package/build-module/components/height-control/index.js.map +1 -1
- package/build-module/components/image-link-destinations/index.native.js +109 -0
- package/build-module/components/image-link-destinations/index.native.js.map +1 -0
- package/build-module/components/image-size-control/index.js +2 -2
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.native.js +3 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +62 -23
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +18 -4
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +5 -6
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +6 -10
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +11 -10
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +11 -11
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +11 -11
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/utils.js +7 -11
- package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js +4 -14
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +2 -2
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/index.js +1 -2
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/library.js +3 -7
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js +1 -1
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
- package/build-module/components/inserter/menu.js +26 -33
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +2 -2
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter/tabs.js +22 -22
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inserter-button/index.native.js +89 -0
- package/build-module/components/inserter-button/index.native.js.map +1 -0
- package/build-module/components/inserter-button/sparkles.js +15 -0
- package/build-module/components/inserter-button/sparkles.js.map +1 -0
- package/build-module/components/inserter-draggable-blocks/index.js +9 -5
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +2 -4
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +3 -3
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +3 -3
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +35 -24
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +4 -0
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +58 -4
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/media-upload-progress/constants.js +7 -0
- package/build-module/components/media-upload-progress/constants.js.map +1 -0
- package/build-module/components/media-upload-progress/index.native.js +37 -8
- package/build-module/components/media-upload-progress/index.native.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +11 -16
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/plain-text/index.native.js +6 -1
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/preview-options/index.js +6 -62
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/provider/index.js +3 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +7 -1
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/content.js +25 -21
- package/build-module/components/rich-text/content.js.map +1 -1
- package/build-module/components/rich-text/get-rich-text-values.js +2 -1
- package/build-module/components/rich-text/get-rich-text-values.js.map +1 -1
- package/build-module/components/rich-text/index.js +21 -39
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +10 -18
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/get-format-colors.native.js +22 -24
- package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +22 -56
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-input-rules.js +7 -3
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/rich-text/use-mark-persistent.js +1 -1
- package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
- package/build-module/components/rich-text/with-deprecations.js +42 -0
- package/build-module/components/rich-text/with-deprecations.js.map +1 -0
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-input/index.js +9 -6
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +14 -18
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +107 -18
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +102 -94
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +9 -12
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +4 -1
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/use-settings/index.js +13 -1
- package/build-module/components/use-settings/index.js.map +1 -1
- package/build-module/components/writing-flow/index.js +0 -1
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-drag-selection.js +15 -4
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +73 -27
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +7 -4
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js +20 -67
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/align.native.js +1 -0
- package/build-module/hooks/align.native.js.map +1 -1
- package/build-module/hooks/anchor.js +12 -27
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/aria-label.js +7 -1
- package/build-module/hooks/aria-label.js.map +1 -1
- package/build-module/hooks/background.js +197 -37
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js +22 -30
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-renaming.js +17 -21
- package/build-module/hooks/block-renaming.js.map +1 -1
- package/build-module/hooks/border.js +52 -79
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +78 -88
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +27 -27
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +12 -28
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/custom-class-name.native.js +7 -1
- package/build-module/hooks/custom-class-name.native.js.map +1 -1
- package/build-module/hooks/dimensions.js +15 -16
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +30 -61
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-family.js +20 -25
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +50 -120
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.js +20 -16
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +10 -6
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout-child.js +60 -0
- package/build-module/hooks/layout-child.js.map +1 -0
- package/build-module/hooks/layout.js +21 -100
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/padding.js +2 -2
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/position.js +38 -59
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +52 -85
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/typography.js +26 -11
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/typography.native.js +43 -17
- package/build-module/hooks/typography.native.js.map +1 -1
- package/build-module/hooks/use-typography-props.js +9 -1
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/hooks/utils.js +194 -9
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +2 -6
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +0 -2
- package/build-module/private-apis.native.js.map +1 -1
- package/build-module/store/actions.js +0 -15
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +52 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +44 -1
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +18 -2
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +4 -65
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/undo-ignore.js +5 -0
- package/build-module/store/undo-ignore.js.map +1 -0
- package/build-module/store/utils.js +56 -0
- package/build-module/store/utils.js.map +1 -0
- package/build-module/utils/get-px-from-css-unit.js +9 -0
- package/build-module/utils/get-px-from-css-unit.js.map +1 -0
- package/build-module/utils/index.js +1 -1
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/object.js +37 -97
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/selection.js +9 -1
- package/build-module/utils/selection.js.map +1 -1
- package/build-module/utils/use-can-block-toolbar-be-focused.js +40 -0
- package/build-module/utils/use-can-block-toolbar-be-focused.js.map +1 -0
- package/build-style/content-rtl.css +7 -6
- package/build-style/content.css +7 -6
- package/build-style/style-rtl.css +164 -301
- package/build-style/style.css +164 -301
- package/package.json +31 -31
- package/src/components/alignment-control/README.md +0 -5
- package/src/components/block-alignment-control/README.md +0 -5
- package/src/components/block-alignment-matrix-control/README.md +0 -10
- package/src/components/block-breadcrumb/README.md +0 -5
- package/src/components/block-canvas/index.js +29 -17
- package/src/components/block-canvas/style.scss +6 -0
- package/src/components/block-caption/README.md +2 -7
- package/src/components/block-card/README.md +0 -5
- package/src/components/block-card/index.js +6 -4
- package/src/components/block-card/style.scss +7 -3
- package/src/components/block-controls/hook.js +8 -30
- package/src/components/block-controls/test/index.js +3 -3
- package/src/components/block-draggable/draggable-chip.js +11 -1
- package/src/components/block-draggable/index.js +116 -4
- package/src/components/block-draggable/index.native.js +0 -5
- package/src/components/block-draggable/style.scss +35 -0
- package/src/components/block-draggable/test/helpers.native.js +8 -7
- package/src/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
- package/src/components/block-edit/context.js +3 -0
- package/src/components/block-edit/index.js +36 -10
- package/src/components/block-editing-mode/index.js +3 -3
- package/src/components/block-icon/README.md +0 -5
- package/src/components/block-info-slot-fill/index.js +6 -3
- package/src/components/block-inspector/README.md +0 -5
- package/src/components/block-inspector/index.js +3 -1
- package/src/components/block-inspector/style.scss +0 -4
- package/src/components/block-list/block-list-item-cell.native.js +5 -1
- package/src/components/block-list/block.js +309 -104
- package/src/components/block-list/block.native.js +69 -21
- package/src/components/block-list/content.scss +14 -10
- package/src/components/block-list/index.native.js +3 -5
- package/src/components/block-list/{block-list-block-context.js → private-block-context.js} +1 -1
- package/src/components/block-list/use-block-props/index.js +43 -86
- package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -34
- package/src/components/block-list/use-block-props/use-is-hovered.js +2 -13
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +1 -5
- package/src/components/block-list/use-in-between-inserter.js +4 -1
- package/src/components/block-list/use-scroll-upon-insertion.native.js +52 -0
- package/src/components/block-lock/toolbar.js +23 -34
- package/src/components/block-mover/README.md +0 -5
- package/src/components/block-mover/index.js +1 -1
- package/src/components/block-parent-selector/README.md +0 -5
- package/src/components/block-patterns-list/README.md +0 -5
- package/src/components/block-patterns-list/index.js +9 -6
- package/src/components/block-removal-warning-modal/index.js +7 -14
- package/src/components/block-rename/modal.js +7 -1
- package/src/components/block-settings/container.native.js +3 -5
- package/src/components/block-styles/index.js +1 -1
- package/src/components/block-styles/index.native.js +4 -2
- package/src/components/block-styles/style.scss +0 -11
- package/src/components/block-switcher/index.js +49 -59
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +3 -1
- package/src/components/block-toolbar/README.md +0 -5
- package/src/components/block-toolbar/index.js +179 -95
- package/src/components/block-toolbar/style.scss +50 -66
- package/src/components/block-tools/block-toolbar-breadcrumb.js +46 -0
- package/src/components/block-tools/block-toolbar-popover.js +84 -0
- package/src/components/block-tools/index.js +42 -29
- package/src/components/block-tools/style.scss +60 -172
- package/src/components/block-types-list/README.md +0 -5
- package/src/components/block-types-list/index.native.js +2 -1
- package/src/components/block-variation-picker/README.md +0 -5
- package/src/components/block-variation-picker/index.native.js +1 -1
- package/src/components/block-variation-transforms/README.md +0 -5
- package/src/components/block-variation-transforms/index.js +49 -3
- package/src/components/border-radius-control/linked-button.js +1 -1
- package/src/components/caption/README.md +0 -5
- package/src/components/color-palette/test/__snapshots__/control.js.snap +0 -1
- package/src/components/colors/utils.js +8 -1
- package/src/components/colors/with-colors.js +3 -1
- package/src/components/colors-gradients/control.js +49 -30
- package/src/components/colors-gradients/style.scss +0 -7
- package/src/components/contrast-checker/README.md +0 -4
- package/src/components/copy-handler/README.md +0 -10
- package/src/components/duotone-control/index.js +2 -5
- package/src/components/duotone-control/style.scss +1 -6
- package/src/components/font-sizes/utils.js +7 -1
- package/src/components/global-styles/border-panel.js +2 -1
- package/src/components/global-styles/color-panel.js +36 -26
- package/src/components/global-styles/dimensions-panel.js +4 -3
- package/src/components/global-styles/effects-panel.js +2 -1
- package/src/components/global-styles/filters-panel.js +6 -5
- package/src/components/global-styles/get-global-styles-changes.js +210 -0
- package/src/components/global-styles/hooks.js +5 -0
- package/src/components/global-styles/image-settings-panel.js +6 -0
- package/src/components/global-styles/index.js +1 -0
- package/src/components/global-styles/test/get-global-styles-changes.js +234 -0
- package/src/components/global-styles/typography-panel.js +60 -47
- package/src/components/global-styles/use-global-styles-output.js +9 -5
- package/src/components/global-styles/utils.js +7 -0
- package/src/components/height-control/README.md +2 -7
- package/src/components/height-control/index.js +4 -0
- package/src/components/image-link-destinations/index.native.js +152 -0
- package/src/components/image-link-destinations/style.native.scss +16 -0
- package/src/components/image-size-control/index.js +5 -2
- package/src/components/index.native.js +3 -2
- package/src/components/inner-blocks/README.md +13 -2
- package/src/components/inner-blocks/index.js +68 -29
- package/src/components/inner-blocks/index.native.js +19 -7
- package/src/components/inner-blocks/use-inner-block-template-sync.js +5 -7
- package/src/components/inner-blocks/use-nested-settings-update.js +6 -13
- package/src/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +15 -15
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +15 -13
- package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +15 -18
- package/src/components/inserter/block-patterns-tab/utils.js +11 -12
- package/src/components/inserter/hooks/use-block-types-state.js +9 -11
- package/src/components/inserter/hooks/use-patterns-state.js +2 -2
- package/src/components/inserter/index.js +0 -1
- package/src/components/inserter/library.js +2 -8
- package/src/components/inserter/media-tab/media-panel.js +1 -1
- package/src/components/inserter/menu.js +26 -36
- package/src/components/inserter/preview-panel.js +2 -2
- package/src/components/inserter/style.scss +21 -21
- package/src/components/inserter/tabs.js +34 -25
- package/src/components/inserter-button/README.md +62 -0
- package/src/components/inserter-button/index.native.js +116 -0
- package/src/components/inserter-button/sparkles.js +15 -0
- package/src/components/inserter-button/style.native.scss +72 -0
- package/src/components/inserter-draggable-blocks/index.js +18 -5
- package/src/components/inserter-list-item/index.js +6 -6
- package/src/components/inspector-controls/block-support-tools-panel.js +2 -0
- package/src/components/inspector-controls/fill.js +6 -3
- package/src/components/inspector-controls/fill.native.js +6 -3
- package/src/components/inspector-controls-tabs/index.js +39 -28
- package/src/components/inspector-controls-tabs/style.scss +3 -2
- package/src/components/letter-spacing-control/README.md +0 -5
- package/src/components/line-height-control/README.md +0 -5
- package/src/components/link-control/style.scss +1 -1
- package/src/components/link-control/test/index.js +1 -1
- package/src/components/list-view/README.md +0 -5
- package/src/components/list-view/block-select-button.js +4 -0
- package/src/components/list-view/block.js +73 -2
- package/src/components/list-view/style.scss +6 -0
- package/src/components/media-upload-progress/constants.js +6 -0
- package/src/components/media-upload-progress/index.native.js +66 -14
- package/src/components/media-upload-progress/test/index.native.js +2 -2
- package/src/components/multi-selection-inspector/README.md +0 -5
- package/src/components/navigable-toolbar/README.md +2 -0
- package/src/components/navigable-toolbar/index.js +15 -13
- package/src/components/plain-text/index.native.js +6 -1
- package/src/components/preview-options/index.js +6 -86
- package/src/components/provider/index.js +1 -1
- package/src/components/provider/test/use-block-sync.js +20 -17
- package/src/components/provider/use-block-sync.js +6 -0
- package/src/components/rich-text/content.js +27 -20
- package/src/components/rich-text/get-rich-text-values.js +6 -1
- package/src/components/rich-text/index.js +23 -52
- package/src/components/rich-text/index.native.js +8 -25
- package/src/components/rich-text/native/get-format-colors.native.js +33 -40
- package/src/components/rich-text/native/index.native.js +22 -71
- package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +3 -3
- package/src/components/rich-text/native/test/index.native.js +72 -5
- package/src/components/rich-text/use-input-rules.js +8 -3
- package/src/components/rich-text/use-mark-persistent.js +1 -2
- package/src/components/rich-text/with-deprecations.js +51 -0
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/src/components/text-decoration-control/README.md +40 -0
- package/src/components/text-transform-control/README.md +0 -4
- package/src/components/ungroup-button/README.md +0 -5
- package/src/components/unit-control/README.md +0 -4
- package/src/components/url-input/index.js +11 -11
- package/src/components/use-block-commands/index.js +18 -21
- package/src/components/use-block-drop-zone/index.js +181 -30
- package/src/components/use-moving-animation/index.js +107 -103
- package/src/components/use-on-block-drop/index.js +9 -24
- package/src/components/use-on-block-drop/test/index.js +12 -26
- package/src/components/use-resize-canvas/README.md +3 -7
- package/src/components/use-resize-canvas/index.js +4 -1
- package/src/components/use-settings/README.md +0 -4
- package/src/components/use-settings/index.js +15 -1
- package/src/components/writing-flow/index.js +0 -1
- package/src/components/writing-flow/use-drag-selection.js +18 -4
- package/src/components/writing-flow/use-selection-observer.js +99 -37
- package/src/components/writing-flow/use-tab-nav.js +7 -7
- package/src/hooks/align.js +16 -81
- package/src/hooks/align.native.js +1 -0
- package/src/hooks/anchor.js +14 -38
- package/src/hooks/aria-label.js +8 -5
- package/src/hooks/background.js +269 -32
- package/src/hooks/block-hooks.js +22 -51
- package/src/hooks/block-renaming.js +23 -37
- package/src/hooks/border.js +62 -124
- package/src/hooks/color.js +111 -138
- package/src/hooks/content-lock-ui.js +110 -122
- package/src/hooks/custom-class-name.js +9 -45
- package/src/hooks/custom-class-name.native.js +8 -5
- package/src/hooks/dimensions.js +14 -16
- package/src/hooks/duotone.js +70 -127
- package/src/hooks/font-family.js +14 -36
- package/src/hooks/font-size.js +67 -168
- package/src/hooks/index.js +58 -16
- package/src/hooks/index.native.js +22 -6
- package/src/hooks/layout-child.js +53 -0
- package/src/hooks/layout.js +17 -103
- package/src/hooks/padding.js +2 -2
- package/src/hooks/position.js +50 -90
- package/src/hooks/style.js +118 -193
- package/src/hooks/test/align.js +1 -178
- package/src/hooks/test/anchor.js +4 -9
- package/src/hooks/test/custom-class-name.js +3 -8
- package/src/hooks/test/style.js +4 -14
- package/src/hooks/typography.js +14 -16
- package/src/hooks/typography.native.js +31 -33
- package/src/hooks/use-typography-props.js +7 -1
- package/src/hooks/utils.js +261 -10
- package/src/private-apis.js +2 -6
- package/src/private-apis.native.js +0 -2
- package/src/store/actions.js +0 -15
- package/src/store/private-actions.js +48 -0
- package/src/store/private-selectors.js +56 -0
- package/src/store/reducer.js +20 -1
- package/src/store/selectors.js +10 -82
- package/src/store/undo-ignore.js +4 -0
- package/src/store/utils.js +74 -0
- package/src/style.scss +1 -2
- package/src/utils/get-px-from-css-unit.js +8 -0
- package/src/utils/index.js +1 -1
- package/src/utils/object.js +34 -104
- package/src/utils/selection.js +9 -2
- package/src/utils/test/object.js +1 -96
- package/src/utils/use-can-block-toolbar-be-focused.js +48 -0
- package/build/components/block-list/block-list-block-context.js +0 -14
- package/build/components/block-list/block-list-block-context.js.map +0 -1
- package/build/components/block-list/use-block-props/use-block-class-names.js +0 -67
- package/build/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js +0 -46
- package/build/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
- package/build/components/block-list/use-block-props/use-block-default-class-name.js +0 -37
- package/build/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
- package/build/components/block-tools/back-compat.js +0 -45
- package/build/components/block-tools/back-compat.js.map +0 -1
- package/build/components/block-tools/block-contextual-toolbar.js +0 -91
- package/build/components/block-tools/block-contextual-toolbar.js.map +0 -1
- package/build/components/block-tools/selected-block-tools.js +0 -113
- package/build/components/block-tools/selected-block-tools.js.map +0 -1
- package/build/components/inserter/hooks/use-debounced-input.js +0 -22
- package/build/components/inserter/hooks/use-debounced-input.js.map +0 -1
- package/build/components/use-display-block-controls/index.js +0 -39
- package/build/components/use-display-block-controls/index.js.map +0 -1
- package/build/components/use-display-block-controls/index.native.js +0 -39
- package/build/components/use-display-block-controls/index.native.js.map +0 -1
- package/build/hooks/custom-fields.js +0 -120
- package/build/hooks/custom-fields.js.map +0 -1
- package/build/utils/parse-css-unit-to-px.js +0 -302
- package/build/utils/parse-css-unit-to-px.js.map +0 -1
- package/build/utils/use-should-contextual-toolbar-show.js +0 -63
- package/build/utils/use-should-contextual-toolbar-show.js.map +0 -1
- package/build-module/components/block-list/block-list-block-context.js +0 -6
- package/build-module/components/block-list/block-list-block-context.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-class-names.js +0 -60
- package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js +0 -40
- package/build-module/components/block-list/use-block-props/use-block-custom-class-name.js.map +0 -1
- package/build-module/components/block-list/use-block-props/use-block-default-class-name.js +0 -31
- package/build-module/components/block-list/use-block-props/use-block-default-class-name.js.map +0 -1
- package/build-module/components/block-tools/back-compat.js +0 -35
- package/build-module/components/block-tools/back-compat.js.map +0 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +0 -83
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +0 -1
- package/build-module/components/block-tools/selected-block-tools.js +0 -105
- package/build-module/components/block-tools/selected-block-tools.js.map +0 -1
- package/build-module/components/inserter/hooks/use-debounced-input.js +0 -15
- package/build-module/components/inserter/hooks/use-debounced-input.js.map +0 -1
- package/build-module/components/use-display-block-controls/index.js +0 -32
- package/build-module/components/use-display-block-controls/index.js.map +0 -1
- package/build-module/components/use-display-block-controls/index.native.js +0 -32
- package/build-module/components/use-display-block-controls/index.native.js.map +0 -1
- package/build-module/hooks/custom-fields.js +0 -118
- package/build-module/hooks/custom-fields.js.map +0 -1
- package/build-module/utils/parse-css-unit-to-px.js +0 -294
- package/build-module/utils/parse-css-unit-to-px.js.map +0 -1
- package/build-module/utils/use-should-contextual-toolbar-show.js +0 -57
- package/build-module/utils/use-should-contextual-toolbar-show.js.map +0 -1
- package/src/components/block-list/use-block-props/use-block-class-names.js +0 -66
- package/src/components/block-list/use-block-props/use-block-custom-class-name.js +0 -44
- package/src/components/block-list/use-block-props/use-block-default-class-name.js +0 -35
- package/src/components/block-parent-selector/style.scss +0 -11
- package/src/components/block-tools/back-compat.js +0 -35
- package/src/components/block-tools/block-contextual-toolbar.js +0 -100
- package/src/components/block-tools/selected-block-tools.js +0 -127
- package/src/components/inserter/hooks/use-debounced-input.js +0 -18
- package/src/components/preview-options/README.md +0 -94
- package/src/components/preview-options/style.scss +0 -64
- package/src/components/use-display-block-controls/index.js +0 -36
- package/src/components/use-display-block-controls/index.native.js +0 -37
- package/src/hooks/custom-fields.js +0 -142
- package/src/hooks/test/color.js +0 -112
- package/src/utils/parse-css-unit-to-px.js +0 -329
- package/src/utils/test/parse-css-unit-to-px.js +0 -172
- package/src/utils/use-should-contextual-toolbar-show.js +0 -85
|
@@ -13,14 +13,11 @@ import {
|
|
|
13
13
|
createContext,
|
|
14
14
|
} from '@wordpress/element';
|
|
15
15
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
16
|
-
import {
|
|
17
|
-
import { useInstanceId, useMergeRefs } from '@wordpress/compose';
|
|
16
|
+
import { useMergeRefs } from '@wordpress/compose';
|
|
18
17
|
import {
|
|
19
18
|
__unstableUseRichText as useRichText,
|
|
20
|
-
__unstableCreateElement,
|
|
21
19
|
removeFormat,
|
|
22
20
|
} from '@wordpress/rich-text';
|
|
23
|
-
import deprecated from '@wordpress/deprecated';
|
|
24
21
|
import { Popover } from '@wordpress/components';
|
|
25
22
|
|
|
26
23
|
/**
|
|
@@ -46,7 +43,7 @@ import { useFirefoxCompat } from './use-firefox-compat';
|
|
|
46
43
|
import FormatEdit from './format-edit';
|
|
47
44
|
import { getAllowedFormats } from './utils';
|
|
48
45
|
import { Content } from './content';
|
|
49
|
-
import
|
|
46
|
+
import { withDeprecations } from './with-deprecations';
|
|
50
47
|
|
|
51
48
|
export const keyboardShortcutContext = createContext();
|
|
52
49
|
export const inputEventContext = createContext();
|
|
@@ -116,8 +113,14 @@ export function RichTextWrapper(
|
|
|
116
113
|
props = removeNativeProps( props );
|
|
117
114
|
|
|
118
115
|
const anchorRef = useRef();
|
|
119
|
-
const { clientId } = useBlockEditContext();
|
|
116
|
+
const { clientId, isSelected: isBlockSelected } = useBlockEditContext();
|
|
120
117
|
const selector = ( select ) => {
|
|
118
|
+
// Avoid subscribing to the block editor store if the block is not
|
|
119
|
+
// selected.
|
|
120
|
+
if ( ! isBlockSelected ) {
|
|
121
|
+
return { isSelected: false };
|
|
122
|
+
}
|
|
123
|
+
|
|
121
124
|
const { getSelectionStart, getSelectionEnd } =
|
|
122
125
|
select( blockEditorStore );
|
|
123
126
|
const selectionStart = getSelectionStart();
|
|
@@ -140,10 +143,12 @@ export function RichTextWrapper(
|
|
|
140
143
|
isSelected,
|
|
141
144
|
};
|
|
142
145
|
};
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
146
|
+
const { selectionStart, selectionEnd, isSelected } = useSelect( selector, [
|
|
147
|
+
clientId,
|
|
148
|
+
identifier,
|
|
149
|
+
originalIsSelected,
|
|
150
|
+
isBlockSelected,
|
|
151
|
+
] );
|
|
147
152
|
const { getSelectionStart, getSelectionEnd, getBlockRootClientId } =
|
|
148
153
|
useSelect( blockEditorStore );
|
|
149
154
|
const { selectionChange } = useDispatch( blockEditorStore );
|
|
@@ -320,10 +325,13 @@ export function RichTextWrapper(
|
|
|
320
325
|
{ ...props }
|
|
321
326
|
{ ...autocompleteProps }
|
|
322
327
|
ref={ useMergeRefs( [
|
|
328
|
+
// Rich text ref must be first because its focus listener
|
|
329
|
+
// must be set up before any other ref calls .focus() on
|
|
330
|
+
// mount.
|
|
331
|
+
richTextRef,
|
|
323
332
|
forwardedRef,
|
|
324
333
|
autocompleteProps.ref,
|
|
325
334
|
props.ref,
|
|
326
|
-
richTextRef,
|
|
327
335
|
useBeforeInputRules( { value, onChange } ),
|
|
328
336
|
useInputRules( {
|
|
329
337
|
getValue,
|
|
@@ -382,52 +390,15 @@ export function RichTextWrapper(
|
|
|
382
390
|
// tabIndex because Safari will focus the element. However,
|
|
383
391
|
// Safari will correctly ignore nested contentEditable elements.
|
|
384
392
|
tabIndex={ props.tabIndex === 0 ? null : props.tabIndex }
|
|
393
|
+
data-wp-block-attribute-key={ identifier }
|
|
385
394
|
/>
|
|
386
395
|
</>
|
|
387
396
|
);
|
|
388
397
|
}
|
|
389
398
|
|
|
390
|
-
const
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
let value = props.value;
|
|
394
|
-
let onChange = props.onChange;
|
|
395
|
-
|
|
396
|
-
// Handle deprecated format.
|
|
397
|
-
if ( Array.isArray( value ) ) {
|
|
398
|
-
deprecated( 'wp.blockEditor.RichText value prop as children type', {
|
|
399
|
-
since: '6.1',
|
|
400
|
-
version: '6.3',
|
|
401
|
-
alternative: 'value prop as string',
|
|
402
|
-
link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/',
|
|
403
|
-
} );
|
|
404
|
-
|
|
405
|
-
value = childrenSource.toHTML( props.value );
|
|
406
|
-
onChange = ( newValue ) =>
|
|
407
|
-
props.onChange(
|
|
408
|
-
childrenSource.fromDOM(
|
|
409
|
-
__unstableCreateElement( document, newValue ).childNodes
|
|
410
|
-
)
|
|
411
|
-
);
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
const Component = props.multiline
|
|
415
|
-
? RichTextMultiline
|
|
416
|
-
: ForwardedRichTextWrapper;
|
|
417
|
-
const instanceId = useInstanceId( RichTextSwitcher );
|
|
418
|
-
|
|
419
|
-
return (
|
|
420
|
-
<Component
|
|
421
|
-
{ ...props }
|
|
422
|
-
identifier={ props.identifier || instanceId }
|
|
423
|
-
value={ value }
|
|
424
|
-
onChange={ onChange }
|
|
425
|
-
ref={ ref }
|
|
426
|
-
/>
|
|
427
|
-
);
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
const ForwardedRichTextContainer = forwardRef( RichTextSwitcher );
|
|
399
|
+
const ForwardedRichTextContainer = withDeprecations(
|
|
400
|
+
forwardRef( RichTextWrapper )
|
|
401
|
+
);
|
|
431
402
|
|
|
432
403
|
ForwardedRichTextContainer.Content = Content;
|
|
433
404
|
ForwardedRichTextContainer.isEmpty = ( value ) => {
|
|
@@ -39,17 +39,17 @@ import FormatToolbarContainer from './format-toolbar-container';
|
|
|
39
39
|
import { store as blockEditorStore } from '../../store';
|
|
40
40
|
import {
|
|
41
41
|
addActiveFormats,
|
|
42
|
-
getMultilineTag,
|
|
43
42
|
getAllowedFormats,
|
|
44
43
|
createLinkInParagraph,
|
|
45
44
|
} from './utils';
|
|
46
45
|
import EmbedHandlerPicker from './embed-handler-picker';
|
|
47
46
|
import { Content } from './content';
|
|
48
47
|
import RichText from './native';
|
|
48
|
+
import { withDeprecations } from './with-deprecations';
|
|
49
49
|
|
|
50
50
|
const classes = 'block-editor-rich-text__editable';
|
|
51
51
|
|
|
52
|
-
function RichTextWrapper(
|
|
52
|
+
export function RichTextWrapper(
|
|
53
53
|
{
|
|
54
54
|
children,
|
|
55
55
|
tagName,
|
|
@@ -58,7 +58,6 @@ function RichTextWrapper(
|
|
|
58
58
|
value: originalValue,
|
|
59
59
|
onChange: originalOnChange,
|
|
60
60
|
isSelected: originalIsSelected,
|
|
61
|
-
multiline,
|
|
62
61
|
inlineToolbar,
|
|
63
62
|
wrapperClassName,
|
|
64
63
|
autocompleters,
|
|
@@ -80,7 +79,6 @@ function RichTextWrapper(
|
|
|
80
79
|
disableLineBreaks,
|
|
81
80
|
unstableOnFocus,
|
|
82
81
|
__unstableAllowPrefixTransformations,
|
|
83
|
-
__unstableMultilineRootTag,
|
|
84
82
|
// Native props.
|
|
85
83
|
__unstableMobileNoFocusOnMount,
|
|
86
84
|
deleteEnter,
|
|
@@ -179,7 +177,6 @@ function RichTextWrapper(
|
|
|
179
177
|
selectionChange,
|
|
180
178
|
__unstableMarkAutomaticChange,
|
|
181
179
|
} = useDispatch( blockEditorStore );
|
|
182
|
-
const multilineTag = getMultilineTag( multiline );
|
|
183
180
|
const adjustedAllowedFormats = getAllowedFormats( {
|
|
184
181
|
allowedFormats,
|
|
185
182
|
disableFormats,
|
|
@@ -261,10 +258,7 @@ function RichTextWrapper(
|
|
|
261
258
|
if ( ! hasPastedBlocks || ! isEmpty( before ) ) {
|
|
262
259
|
blocks.push(
|
|
263
260
|
onSplit(
|
|
264
|
-
toHTMLString( {
|
|
265
|
-
value: before,
|
|
266
|
-
multilineTag,
|
|
267
|
-
} ),
|
|
261
|
+
toHTMLString( { value: before } ),
|
|
268
262
|
! isAfterOriginal
|
|
269
263
|
)
|
|
270
264
|
);
|
|
@@ -288,13 +282,7 @@ function RichTextWrapper(
|
|
|
288
282
|
: ! onSplitMiddle || ! isEmpty( after )
|
|
289
283
|
) {
|
|
290
284
|
blocks.push(
|
|
291
|
-
onSplit(
|
|
292
|
-
toHTMLString( {
|
|
293
|
-
value: after,
|
|
294
|
-
multilineTag,
|
|
295
|
-
} ),
|
|
296
|
-
isAfterOriginal
|
|
297
|
-
)
|
|
285
|
+
onSplit( toHTMLString( { value: after } ), isAfterOriginal )
|
|
298
286
|
);
|
|
299
287
|
}
|
|
300
288
|
|
|
@@ -308,7 +296,7 @@ function RichTextWrapper(
|
|
|
308
296
|
|
|
309
297
|
onReplace( blocks, indexToSelect, initialPosition );
|
|
310
298
|
},
|
|
311
|
-
[ onReplace, onSplit,
|
|
299
|
+
[ onReplace, onSplit, onSplitMiddle ]
|
|
312
300
|
);
|
|
313
301
|
|
|
314
302
|
const onEnter = useCallback(
|
|
@@ -370,7 +358,6 @@ function RichTextWrapper(
|
|
|
370
358
|
onReplace,
|
|
371
359
|
onSplit,
|
|
372
360
|
__unstableMarkAutomaticChange,
|
|
373
|
-
multiline,
|
|
374
361
|
splitValue,
|
|
375
362
|
onSplitAtEnd,
|
|
376
363
|
]
|
|
@@ -392,9 +379,6 @@ function RichTextWrapper(
|
|
|
392
379
|
if ( isInternal ) {
|
|
393
380
|
const pastedValue = create( {
|
|
394
381
|
html,
|
|
395
|
-
multilineTag,
|
|
396
|
-
multilineWrapperTags:
|
|
397
|
-
multilineTag === 'li' ? [ 'ul', 'ol' ] : undefined,
|
|
398
382
|
preserveWhiteSpace,
|
|
399
383
|
} );
|
|
400
384
|
addActiveFormats( pastedValue, activeFormats );
|
|
@@ -496,7 +480,6 @@ function RichTextWrapper(
|
|
|
496
480
|
onSplit,
|
|
497
481
|
splitValue,
|
|
498
482
|
__unstableEmbedURLOnPaste,
|
|
499
|
-
multilineTag,
|
|
500
483
|
preserveWhiteSpace,
|
|
501
484
|
pastePlainText,
|
|
502
485
|
]
|
|
@@ -568,7 +551,6 @@ function RichTextWrapper(
|
|
|
568
551
|
onPaste={ onPaste }
|
|
569
552
|
__unstableIsSelected={ isSelected }
|
|
570
553
|
__unstableInputRule={ inputRule }
|
|
571
|
-
__unstableMultilineTag={ multilineTag }
|
|
572
554
|
__unstableOnEnterFormattedText={ enterFormattedText }
|
|
573
555
|
__unstableOnExitFormattedText={ exitFormattedText }
|
|
574
556
|
__unstableOnCreateUndoLevel={ __unstableMarkLastChangeAsPersistent }
|
|
@@ -582,7 +564,6 @@ function RichTextWrapper(
|
|
|
582
564
|
__unstableAllowPrefixTransformations={
|
|
583
565
|
__unstableAllowPrefixTransformations
|
|
584
566
|
}
|
|
585
|
-
__unstableMultilineRootTag={ __unstableMultilineRootTag }
|
|
586
567
|
// Native props.
|
|
587
568
|
blockIsSelected={
|
|
588
569
|
originalIsSelected !== undefined
|
|
@@ -675,7 +656,9 @@ function RichTextWrapper(
|
|
|
675
656
|
);
|
|
676
657
|
}
|
|
677
658
|
|
|
678
|
-
const ForwardedRichTextContainer =
|
|
659
|
+
const ForwardedRichTextContainer = withDeprecations(
|
|
660
|
+
forwardRef( RichTextWrapper )
|
|
661
|
+
);
|
|
679
662
|
|
|
680
663
|
ForwardedRichTextContainer.Content = Content;
|
|
681
664
|
|
|
@@ -5,50 +5,43 @@ import { getColorObjectByAttributeValues } from '../../../components/colors';
|
|
|
5
5
|
|
|
6
6
|
const FORMAT_TYPE = 'core/text-color';
|
|
7
7
|
const REGEX_TO_MATCH = /^has-(.*)-color$/;
|
|
8
|
-
const TAGS_TO_SEARCH = /\<mark/;
|
|
9
8
|
|
|
10
|
-
export function getFormatColors(
|
|
11
|
-
|
|
12
|
-
const newFormats = formats.slice();
|
|
9
|
+
export function getFormatColors( formats, colors ) {
|
|
10
|
+
const newFormats = formats.slice();
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
// We are looping through a sparse array where empty indices will be
|
|
13
|
+
// skipped.
|
|
14
|
+
newFormats.forEach( ( format ) => {
|
|
15
|
+
format.forEach( ( currentFormat ) => {
|
|
16
|
+
if ( currentFormat?.type === FORMAT_TYPE ) {
|
|
17
|
+
const className = currentFormat?.attributes?.class;
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
currentStyles,
|
|
42
|
-
].join( ';' );
|
|
43
|
-
}
|
|
19
|
+
className?.split( ' ' ).forEach( ( currentClass ) => {
|
|
20
|
+
const match = currentClass.match( REGEX_TO_MATCH );
|
|
21
|
+
if ( match ) {
|
|
22
|
+
const [ , colorSlug ] =
|
|
23
|
+
currentClass.match( REGEX_TO_MATCH );
|
|
24
|
+
const colorObject = getColorObjectByAttributeValues(
|
|
25
|
+
colors,
|
|
26
|
+
colorSlug
|
|
27
|
+
);
|
|
28
|
+
const currentStyles = currentFormat?.attributes?.style;
|
|
29
|
+
if (
|
|
30
|
+
colorObject &&
|
|
31
|
+
( ! currentStyles ||
|
|
32
|
+
currentStyles?.indexOf( colorObject.color ) ===
|
|
33
|
+
-1 )
|
|
34
|
+
) {
|
|
35
|
+
currentFormat.attributes.style = [
|
|
36
|
+
`color: ${ colorObject.color }`,
|
|
37
|
+
currentStyles,
|
|
38
|
+
].join( ';' );
|
|
44
39
|
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
40
|
+
}
|
|
41
|
+
} );
|
|
42
|
+
}
|
|
48
43
|
} );
|
|
44
|
+
} );
|
|
49
45
|
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return formats;
|
|
46
|
+
return newFormats;
|
|
54
47
|
}
|
|
@@ -15,7 +15,8 @@ import {
|
|
|
15
15
|
showUserSuggestions,
|
|
16
16
|
showXpostSuggestions,
|
|
17
17
|
} from '@wordpress/react-native-bridge';
|
|
18
|
-
import { BlockFormatControls
|
|
18
|
+
import { BlockFormatControls } from '@wordpress/block-editor';
|
|
19
|
+
import { getPxFromCssUnit } from '@wordpress/components';
|
|
19
20
|
import { Component } from '@wordpress/element';
|
|
20
21
|
import {
|
|
21
22
|
compose,
|
|
@@ -51,10 +52,6 @@ import { getFormatColors } from './get-format-colors';
|
|
|
51
52
|
import styles from './style.scss';
|
|
52
53
|
import ToolbarButtonWithOptions from './toolbar-button-with-options';
|
|
53
54
|
|
|
54
|
-
const unescapeSpaces = ( text ) => {
|
|
55
|
-
return text.replace( / | /gi, ' ' );
|
|
56
|
-
};
|
|
57
|
-
|
|
58
55
|
// The flattened color palettes array is memoized to ensure that the same array instance is
|
|
59
56
|
// returned for the colors palettes. This value might be used as a prop, so having the same
|
|
60
57
|
// instance will prevent unnecessary re-renders of the RichText component.
|
|
@@ -105,27 +102,11 @@ const DEFAULT_FONT_SIZE = 16;
|
|
|
105
102
|
const MIN_LINE_HEIGHT = 1;
|
|
106
103
|
|
|
107
104
|
export class RichText extends Component {
|
|
108
|
-
constructor( {
|
|
109
|
-
value,
|
|
110
|
-
selectionStart,
|
|
111
|
-
selectionEnd,
|
|
112
|
-
__unstableMultilineTag: multiline,
|
|
113
|
-
} ) {
|
|
105
|
+
constructor( { value, selectionStart, selectionEnd } ) {
|
|
114
106
|
super( ...arguments );
|
|
115
107
|
|
|
116
|
-
this.isMultiline = false;
|
|
117
|
-
if ( multiline === true || multiline === 'p' || multiline === 'li' ) {
|
|
118
|
-
this.multilineTag = multiline === true ? 'p' : multiline;
|
|
119
|
-
this.isMultiline = true;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if ( this.multilineTag === 'li' ) {
|
|
123
|
-
this.multilineWrapperTags = [ 'ul', 'ol' ];
|
|
124
|
-
}
|
|
125
|
-
|
|
126
108
|
this.isIOS = Platform.OS === 'ios';
|
|
127
109
|
this.createRecord = this.createRecord.bind( this );
|
|
128
|
-
this.restoreParagraphTags = this.restoreParagraphTags.bind( this );
|
|
129
110
|
this.onChangeFromAztec = this.onChangeFromAztec.bind( this );
|
|
130
111
|
this.onKeyDown = this.onKeyDown.bind( this );
|
|
131
112
|
this.handleEnter = this.handleEnter.bind( this );
|
|
@@ -196,7 +177,7 @@ export class RichText extends Component {
|
|
|
196
177
|
|
|
197
178
|
const { formats, replacements, text } = currentValue;
|
|
198
179
|
const { activeFormats } = this.state;
|
|
199
|
-
const newFormats = getFormatColors(
|
|
180
|
+
const newFormats = getFormatColors( formats, colorPalette );
|
|
200
181
|
|
|
201
182
|
return {
|
|
202
183
|
formats: newFormats,
|
|
@@ -223,8 +204,6 @@ export class RichText extends Component {
|
|
|
223
204
|
...create( {
|
|
224
205
|
html: this.value,
|
|
225
206
|
range: null,
|
|
226
|
-
multilineTag: this.multilineTag,
|
|
227
|
-
multilineWrapperTags: this.multilineWrapperTags,
|
|
228
207
|
preserveWhiteSpace,
|
|
229
208
|
} ),
|
|
230
209
|
};
|
|
@@ -235,12 +214,7 @@ export class RichText extends Component {
|
|
|
235
214
|
|
|
236
215
|
valueToFormat( value ) {
|
|
237
216
|
// Remove the outer root tags.
|
|
238
|
-
return this.removeRootTagsProducedByAztec(
|
|
239
|
-
toHTMLString( {
|
|
240
|
-
value,
|
|
241
|
-
multilineTag: this.multilineTag,
|
|
242
|
-
} )
|
|
243
|
-
);
|
|
217
|
+
return this.removeRootTagsProducedByAztec( toHTMLString( { value } ) );
|
|
244
218
|
}
|
|
245
219
|
|
|
246
220
|
getActiveFormatNames( record ) {
|
|
@@ -290,7 +264,7 @@ export class RichText extends Component {
|
|
|
290
264
|
onCreateUndoLevel() {
|
|
291
265
|
const { __unstableOnCreateUndoLevel: onCreateUndoLevel } = this.props;
|
|
292
266
|
// If the content is the same, no level needs to be created.
|
|
293
|
-
if ( this.lastHistoryValue === this.value ) {
|
|
267
|
+
if ( this.lastHistoryValue.toString() === this.value.toString() ) {
|
|
294
268
|
return;
|
|
295
269
|
}
|
|
296
270
|
|
|
@@ -340,10 +314,10 @@ export class RichText extends Component {
|
|
|
340
314
|
}
|
|
341
315
|
|
|
342
316
|
const contentWithoutRootTag = this.removeRootTagsProducedByAztec(
|
|
343
|
-
|
|
317
|
+
event.nativeEvent.text
|
|
344
318
|
);
|
|
345
319
|
// On iOS, onChange can be triggered after selection changes, even though there are no content changes.
|
|
346
|
-
if ( contentWithoutRootTag === this.value ) {
|
|
320
|
+
if ( contentWithoutRootTag === this.value.toString() ) {
|
|
347
321
|
return;
|
|
348
322
|
}
|
|
349
323
|
this.lastEventCount = event.nativeEvent.eventCount;
|
|
@@ -355,33 +329,19 @@ export class RichText extends Component {
|
|
|
355
329
|
|
|
356
330
|
onTextUpdate( event ) {
|
|
357
331
|
const contentWithoutRootTag = this.removeRootTagsProducedByAztec(
|
|
358
|
-
|
|
332
|
+
event.nativeEvent.text
|
|
359
333
|
);
|
|
360
|
-
let formattedContent = contentWithoutRootTag;
|
|
361
|
-
if ( ! this.isIOS ) {
|
|
362
|
-
formattedContent = this.restoreParagraphTags(
|
|
363
|
-
contentWithoutRootTag,
|
|
364
|
-
this.multilineTag
|
|
365
|
-
);
|
|
366
|
-
}
|
|
367
334
|
|
|
368
335
|
this.debounceCreateUndoLevel();
|
|
369
|
-
const refresh = this.value !==
|
|
370
|
-
this.value =
|
|
336
|
+
const refresh = this.value.toString() !== contentWithoutRootTag;
|
|
337
|
+
this.value = contentWithoutRootTag;
|
|
371
338
|
|
|
372
339
|
// We don't want to refresh if our goal is just to create a record.
|
|
373
340
|
if ( refresh ) {
|
|
374
|
-
this.props.onChange(
|
|
341
|
+
this.props.onChange( contentWithoutRootTag );
|
|
375
342
|
}
|
|
376
343
|
}
|
|
377
344
|
|
|
378
|
-
restoreParagraphTags( value, tag ) {
|
|
379
|
-
if ( tag === 'p' && ( ! value || ! value.startsWith( '<p>' ) ) ) {
|
|
380
|
-
return '<p>' + value + '</p>';
|
|
381
|
-
}
|
|
382
|
-
return value;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
345
|
/*
|
|
386
346
|
* Handles any case where the content of the AztecRN instance has changed in size
|
|
387
347
|
*/
|
|
@@ -604,7 +564,7 @@ export class RichText extends Component {
|
|
|
604
564
|
// Check if value is up to date with latest state of native AztecView.
|
|
605
565
|
if (
|
|
606
566
|
event.nativeEvent.text &&
|
|
607
|
-
event.nativeEvent.text !== this.props.value
|
|
567
|
+
event.nativeEvent.text !== this.props.value.toString()
|
|
608
568
|
) {
|
|
609
569
|
this.onTextUpdate( event );
|
|
610
570
|
}
|
|
@@ -629,7 +589,7 @@ export class RichText extends Component {
|
|
|
629
589
|
// this approach is not perfectly reliable.
|
|
630
590
|
const isManual =
|
|
631
591
|
this.lastAztecEventType !== 'input' &&
|
|
632
|
-
this.props.value === this.value;
|
|
592
|
+
this.props.value.toString() === this.value.toString();
|
|
633
593
|
if ( hasChanged && isManual ) {
|
|
634
594
|
const value = this.createRecord();
|
|
635
595
|
const activeFormats = getActiveFormats( value );
|
|
@@ -696,10 +656,10 @@ export class RichText extends Component {
|
|
|
696
656
|
|
|
697
657
|
// Check and dicsard stray event, where the text and selection is equal to the ones already cached.
|
|
698
658
|
const contentWithoutRootTag = this.removeRootTagsProducedByAztec(
|
|
699
|
-
|
|
659
|
+
event.nativeEvent.text
|
|
700
660
|
);
|
|
701
661
|
if (
|
|
702
|
-
contentWithoutRootTag === this.value &&
|
|
662
|
+
contentWithoutRootTag === this.value.toString() &&
|
|
703
663
|
realStart === this.selectionStart &&
|
|
704
664
|
realEnd === this.selectionEnd
|
|
705
665
|
) {
|
|
@@ -739,8 +699,6 @@ export class RichText extends Component {
|
|
|
739
699
|
if ( Array.isArray( value ) ) {
|
|
740
700
|
return create( {
|
|
741
701
|
html: childrenBlock.toHTML( value ),
|
|
742
|
-
multilineTag: this.multilineTag,
|
|
743
|
-
multilineWrapperTags: this.multilineWrapperTags,
|
|
744
702
|
preserveWhiteSpace,
|
|
745
703
|
} );
|
|
746
704
|
}
|
|
@@ -748,8 +706,6 @@ export class RichText extends Component {
|
|
|
748
706
|
if ( this.props.format === 'string' ) {
|
|
749
707
|
return create( {
|
|
750
708
|
html: value,
|
|
751
|
-
multilineTag: this.multilineTag,
|
|
752
|
-
multilineWrapperTags: this.multilineWrapperTags,
|
|
753
709
|
preserveWhiteSpace,
|
|
754
710
|
} );
|
|
755
711
|
}
|
|
@@ -800,7 +756,7 @@ export class RichText extends Component {
|
|
|
800
756
|
typeof nextProps.value !== 'undefined' &&
|
|
801
757
|
typeof this.props.value !== 'undefined' &&
|
|
802
758
|
( ! this.comesFromAztec || ! this.firedAfterTextChanged ) &&
|
|
803
|
-
nextProps.value !== this.props.value
|
|
759
|
+
nextProps.value.toString() !== this.props.value.toString()
|
|
804
760
|
) {
|
|
805
761
|
// Gutenberg seems to try to mirror the caret state even on events that only change the content so,
|
|
806
762
|
// let's force caret update if state has selection set.
|
|
@@ -864,17 +820,11 @@ export class RichText extends Component {
|
|
|
864
820
|
}
|
|
865
821
|
}
|
|
866
822
|
|
|
867
|
-
componentWillUnmount() {
|
|
868
|
-
if ( this._editor.isFocused() ) {
|
|
869
|
-
this._editor.blur();
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
|
|
873
823
|
componentDidUpdate( prevProps ) {
|
|
874
824
|
const { style, tagName } = this.props;
|
|
875
825
|
const { currentFontSize } = this.state;
|
|
876
826
|
|
|
877
|
-
if ( this.props.value !== this.value ) {
|
|
827
|
+
if ( this.props.value.toString() !== this.value.toString() ) {
|
|
878
828
|
this.value = this.props.value;
|
|
879
829
|
}
|
|
880
830
|
const { __unstableIsSelected: prevIsSelected } = prevProps;
|
|
@@ -892,7 +842,7 @@ export class RichText extends Component {
|
|
|
892
842
|
// Since this is happening when merging blocks, the selection should be at the last character position.
|
|
893
843
|
// As a fallback the internal selectionEnd value is used.
|
|
894
844
|
const lastCharacterPosition =
|
|
895
|
-
this.value?.length ?? this.selectionEnd;
|
|
845
|
+
this.value?.toString().length ?? this.selectionEnd;
|
|
896
846
|
this._editor.focus();
|
|
897
847
|
this.props.onSelectionChange(
|
|
898
848
|
lastCharacterPosition,
|
|
@@ -934,7 +884,8 @@ export class RichText extends Component {
|
|
|
934
884
|
// On android if content is empty we need to send no content or else the placeholder will not show.
|
|
935
885
|
if (
|
|
936
886
|
! this.isIOS &&
|
|
937
|
-
( value === '' ||
|
|
887
|
+
( value.toString() === '' ||
|
|
888
|
+
value.toString() === EMPTY_PARAGRAPH_TAGS )
|
|
938
889
|
) {
|
|
939
890
|
return '';
|
|
940
891
|
}
|
|
@@ -1323,7 +1274,7 @@ export class RichText extends Component {
|
|
|
1323
1274
|
fontWeight={ this.props.fontWeight }
|
|
1324
1275
|
fontStyle={ this.props.fontStyle }
|
|
1325
1276
|
disableEditingMenu={ disableEditingMenu }
|
|
1326
|
-
isMultiline={
|
|
1277
|
+
isMultiline={ false }
|
|
1327
1278
|
textAlign={ this.props.textAlign }
|
|
1328
1279
|
{ ...( this.isIOS ? { maxWidth } : {} ) }
|
|
1329
1280
|
minWidth={ minWidth }
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`<RichText/>
|
|
3
|
+
exports[`<RichText/> when applying the font size renders component with style and font size 1`] = `
|
|
4
4
|
"<!-- wp:paragraph {"style":{"color":{"text":"#fcb900"},"typography":{"fontSize":35.56}}} -->
|
|
5
5
|
<p class="has-text-color" style="color:#fcb900;font-size:35.56px">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed imperdiet ut nibh vitae ornare. Sed auctor nec augue at blandit.</p>
|
|
6
6
|
<!-- /wp:paragraph -->"
|
|
7
7
|
`;
|
|
8
8
|
|
|
9
|
-
exports[`<RichText/>
|
|
9
|
+
exports[`<RichText/> when applying the font size should update the font size when style prop with font size property is provided 1`] = `
|
|
10
10
|
<View
|
|
11
11
|
style={
|
|
12
12
|
[
|
|
@@ -42,7 +42,7 @@ exports[`<RichText/> Font Size should update the font size when style prop with
|
|
|
42
42
|
</View>
|
|
43
43
|
`;
|
|
44
44
|
|
|
45
|
-
exports[`<RichText/>
|
|
45
|
+
exports[`<RichText/> when applying the font size should update the font size with decimals when style prop with font size property is provided 1`] = `
|
|
46
46
|
<View
|
|
47
47
|
style={
|
|
48
48
|
[
|