@wordpress/block-editor 12.16.0 → 12.17.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 +3 -6
- package/build/components/block-canvas/index.js +0 -2
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-card/index.js +1 -1
- package/build/components/block-card/index.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-editing-mode/index.js +2 -3
- package/build/components/block-editing-mode/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 +245 -102
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +46 -20
- 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 +33 -96
- package/build/components/block-list/use-block-props/index.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 +15 -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 +4 -4
- package/build/components/block-patterns-list/index.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 +1 -2
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-toolbar-popover.js +0 -2
- package/build/components/block-tools/block-toolbar-popover.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/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 +2 -1
- 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 +1 -4
- 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 +1 -1
- 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 +2 -1
- 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-size-control/index.js +2 -2
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.native.js +6 -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/menu.js +14 -28
- package/build/components/inserter/menu.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-draggable-blocks/index.js +1 -1
- 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-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 +9 -14
- 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/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/index.js +17 -7
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +16 -24
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/use-input-rules.js +2 -2
- 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/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 +51 -22
- 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 +8 -11
- package/build/components/use-on-block-drop/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 +1 -1
- 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/aria-label.js +9 -1
- package/build/hooks/aria-label.js.map +1 -1
- package/build/hooks/background.js +185 -20
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/border.js +5 -10
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +13 -11
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/custom-class-name.js +1 -1
- 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 +4 -9
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/font-family.js +7 -3
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +1 -1
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +4 -3
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +5 -3
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout.js +10 -4
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/style.js +1 -1
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/typography.js +4 -9
- 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 +44 -4
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +2 -4
- 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 +51 -5
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +12 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +14 -6
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +1 -13
- 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 +1 -1
- package/build/store/utils.js.map +1 -1
- 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 +0 -38
- package/build/utils/object.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 +0 -2
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-card/index.js +1 -1
- package/build-module/components/block-card/index.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-editing-mode/index.js +3 -4
- package/build-module/components/block-editing-mode/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 +249 -106
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +48 -22
- 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 +34 -97
- package/build-module/components/block-list/use-block-props/index.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 +16 -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 +5 -5
- package/build-module/components/block-patterns-list/index.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 +1 -2
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-popover.js +0 -2
- package/build-module/components/block-tools/block-toolbar-popover.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/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 +3 -2
- 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 +2 -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 +1 -1
- 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 +3 -2
- 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-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 +2 -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/menu.js +14 -28
- package/build-module/components/inserter/menu.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-draggable-blocks/index.js +2 -2
- 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-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 +9 -14
- 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/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/index.js +17 -7
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +16 -23
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-input-rules.js +2 -2
- 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/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 +51 -23
- 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 +8 -11
- package/build-module/components/use-on-block-drop/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 +1 -1
- 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/aria-label.js +7 -1
- package/build-module/hooks/aria-label.js.map +1 -1
- package/build-module/hooks/background.js +181 -19
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/border.js +2 -8
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +11 -9
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +1 -1
- 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 +1 -7
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/font-family.js +6 -2
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +1 -1
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.js +5 -4
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +6 -4
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/layout.js +9 -3
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/style.js +1 -1
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/typography.js +1 -7
- 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 +43 -4
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +2 -4
- 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 +49 -4
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +11 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +14 -6
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +1 -12
- 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 +2 -2
- package/build-module/store/utils.js.map +1 -1
- 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 +0 -37
- package/build-module/utils/object.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 +51 -8
- package/build-style/style.css +51 -8
- 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 +0 -2
- package/src/components/block-canvas/style.scss +6 -0
- package/src/components/block-caption/README.md +0 -5
- package/src/components/block-card/README.md +0 -5
- package/src/components/block-card/index.js +1 -1
- 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-editing-mode/index.js +3 -3
- package/src/components/block-icon/README.md +0 -5
- package/src/components/block-inspector/README.md +0 -5
- package/src/components/block-inspector/index.js +3 -1
- package/src/components/block-list/block-list-item-cell.native.js +5 -1
- package/src/components/block-list/block.js +290 -119
- package/src/components/block-list/block.native.js +55 -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 +32 -128
- 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 +15 -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 +8 -5
- package/src/components/block-switcher/index.js +49 -59
- package/src/components/block-toolbar/README.md +0 -5
- package/src/components/block-toolbar/index.js +1 -2
- package/src/components/block-tools/block-toolbar-popover.js +4 -10
- package/src/components/block-types-list/README.md +0 -5
- package/src/components/block-variation-picker/README.md +0 -5
- 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/contrast-checker/README.md +0 -4
- package/src/components/copy-handler/README.md +0 -10
- 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 +2 -1
- 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 +2 -5
- package/src/components/global-styles/get-global-styles-changes.js +210 -0
- package/src/components/global-styles/hooks.js +3 -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 +2 -1
- 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-size-control/index.js +5 -2
- package/src/components/index.native.js +2 -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/menu.js +13 -31
- package/src/components/inserter/style.scss +6 -4
- package/src/components/inserter/tabs.js +34 -25
- package/src/components/inserter-draggable-blocks/index.js +2 -2
- 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-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/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/index.js +13 -11
- package/src/components/plain-text/index.native.js +6 -1
- 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/index.js +18 -6
- package/src/components/rich-text/native/index.native.js +16 -24
- 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 +2 -2
- package/src/components/rich-text/use-mark-persistent.js +1 -2
- 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 +85 -34
- package/src/components/use-moving-animation/index.js +107 -103
- package/src/components/use-on-block-drop/index.js +7 -23
- package/src/components/use-on-block-drop/test/index.js +12 -26
- package/src/components/use-resize-canvas/README.md +0 -4
- package/src/components/use-settings/README.md +0 -4
- 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 +1 -5
- package/src/hooks/anchor.js +1 -5
- package/src/hooks/aria-label.js +8 -5
- package/src/hooks/background.js +253 -21
- package/src/hooks/border.js +2 -13
- package/src/hooks/color.js +19 -14
- package/src/hooks/custom-class-name.js +1 -5
- package/src/hooks/custom-class-name.native.js +8 -5
- package/src/hooks/dimensions.js +1 -7
- package/src/hooks/font-family.js +4 -7
- package/src/hooks/font-size.js +1 -6
- package/src/hooks/index.js +19 -3
- package/src/hooks/index.native.js +17 -4
- package/src/hooks/layout.js +5 -2
- package/src/hooks/style.js +1 -6
- 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 +1 -7
- package/src/hooks/typography.native.js +31 -33
- package/src/hooks/use-typography-props.js +7 -1
- package/src/hooks/utils.js +60 -2
- package/src/private-apis.js +2 -4
- package/src/private-apis.native.js +0 -2
- package/src/store/actions.js +0 -15
- package/src/store/private-actions.js +44 -4
- package/src/store/private-selectors.js +11 -0
- package/src/store/reducer.js +16 -5
- package/src/store/selectors.js +5 -13
- package/src/store/undo-ignore.js +4 -0
- package/src/store/utils.js +2 -2
- package/src/style.scss +1 -0
- package/src/utils/get-px-from-css-unit.js +8 -0
- package/src/utils/index.js +1 -1
- package/src/utils/object.js +0 -35
- 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/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/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/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
|
@@ -263,13 +263,13 @@ describe( 'useBlockSync hook', () => {
|
|
|
263
263
|
|
|
264
264
|
expect( onInput ).toHaveBeenCalledWith(
|
|
265
265
|
[ { clientId: 'a', innerBlocks: [], attributes: { foo: 2 } } ],
|
|
266
|
-
{
|
|
266
|
+
expect.objectContaining( {
|
|
267
267
|
selection: {
|
|
268
268
|
selectionEnd: {},
|
|
269
269
|
selectionStart: {},
|
|
270
270
|
initialPosition: null,
|
|
271
271
|
},
|
|
272
|
-
}
|
|
272
|
+
} )
|
|
273
273
|
);
|
|
274
274
|
expect( onChange ).not.toHaveBeenCalled();
|
|
275
275
|
} );
|
|
@@ -303,13 +303,13 @@ describe( 'useBlockSync hook', () => {
|
|
|
303
303
|
|
|
304
304
|
expect( onChange ).toHaveBeenCalledWith(
|
|
305
305
|
[ { clientId: 'a', innerBlocks: [], attributes: { foo: 2 } } ],
|
|
306
|
-
{
|
|
306
|
+
expect.objectContaining( {
|
|
307
307
|
selection: {
|
|
308
308
|
selectionEnd: {},
|
|
309
309
|
selectionStart: {},
|
|
310
310
|
initialPosition: null,
|
|
311
311
|
},
|
|
312
|
-
}
|
|
312
|
+
} )
|
|
313
313
|
);
|
|
314
314
|
expect( onInput ).not.toHaveBeenCalled();
|
|
315
315
|
} );
|
|
@@ -406,13 +406,13 @@ describe( 'useBlockSync hook', () => {
|
|
|
406
406
|
attributes: { foo: 2 },
|
|
407
407
|
},
|
|
408
408
|
],
|
|
409
|
-
{
|
|
409
|
+
expect.objectContaining( {
|
|
410
410
|
selection: {
|
|
411
411
|
selectionEnd: {},
|
|
412
412
|
selectionStart: {},
|
|
413
413
|
initialPosition: null,
|
|
414
414
|
},
|
|
415
|
-
}
|
|
415
|
+
} )
|
|
416
416
|
);
|
|
417
417
|
expect( onInput ).not.toHaveBeenCalled();
|
|
418
418
|
} );
|
|
@@ -447,13 +447,16 @@ describe( 'useBlockSync hook', () => {
|
|
|
447
447
|
{ clientId: 'a', innerBlocks: [], attributes: { foo: 2 } },
|
|
448
448
|
];
|
|
449
449
|
|
|
450
|
-
expect( onChange1 ).toHaveBeenCalledWith(
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
450
|
+
expect( onChange1 ).toHaveBeenCalledWith(
|
|
451
|
+
updatedBlocks1,
|
|
452
|
+
expect.objectContaining( {
|
|
453
|
+
selection: {
|
|
454
|
+
initialPosition: null,
|
|
455
|
+
selectionEnd: {},
|
|
456
|
+
selectionStart: {},
|
|
457
|
+
},
|
|
458
|
+
} )
|
|
459
|
+
);
|
|
457
460
|
|
|
458
461
|
const newBlocks = [
|
|
459
462
|
{ clientId: 'b', innerBlocks: [], attributes: { foo: 1 } },
|
|
@@ -485,13 +488,13 @@ describe( 'useBlockSync hook', () => {
|
|
|
485
488
|
// The second callback should be called with the new change.
|
|
486
489
|
expect( onChange2 ).toHaveBeenCalledWith(
|
|
487
490
|
[ { clientId: 'b', innerBlocks: [], attributes: { foo: 3 } } ],
|
|
488
|
-
{
|
|
491
|
+
expect.objectContaining( {
|
|
489
492
|
selection: {
|
|
490
493
|
selectionEnd: {},
|
|
491
494
|
selectionStart: {},
|
|
492
495
|
initialPosition: null,
|
|
493
496
|
},
|
|
494
|
-
}
|
|
497
|
+
} )
|
|
495
498
|
);
|
|
496
499
|
} );
|
|
497
500
|
|
|
@@ -544,13 +547,13 @@ describe( 'useBlockSync hook', () => {
|
|
|
544
547
|
// Only the new callback should be called.
|
|
545
548
|
expect( onChange2 ).toHaveBeenCalledWith(
|
|
546
549
|
[ { clientId: 'b', innerBlocks: [], attributes: { foo: 3 } } ],
|
|
547
|
-
{
|
|
550
|
+
expect.objectContaining( {
|
|
548
551
|
selection: {
|
|
549
552
|
selectionEnd: {},
|
|
550
553
|
selectionStart: {},
|
|
551
554
|
initialPosition: null,
|
|
552
555
|
},
|
|
553
|
-
}
|
|
556
|
+
} )
|
|
554
557
|
);
|
|
555
558
|
} );
|
|
556
559
|
} );
|
|
@@ -9,6 +9,7 @@ import { cloneBlock } from '@wordpress/blocks';
|
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
11
|
import { store as blockEditorStore } from '../../store';
|
|
12
|
+
import { undoIgnoreBlocks } from '../../store/undo-ignore';
|
|
12
13
|
|
|
13
14
|
const noop = () => {};
|
|
14
15
|
|
|
@@ -264,6 +265,10 @@ export default function useBlockSync( {
|
|
|
264
265
|
const updateParent = isPersistent
|
|
265
266
|
? onChangeRef.current
|
|
266
267
|
: onInputRef.current;
|
|
268
|
+
const undoIgnore = undoIgnoreBlocks.has( blocks );
|
|
269
|
+
if ( undoIgnore ) {
|
|
270
|
+
undoIgnoreBlocks.delete( blocks );
|
|
271
|
+
}
|
|
267
272
|
updateParent( blocks, {
|
|
268
273
|
selection: {
|
|
269
274
|
selectionStart: getSelectionStart(),
|
|
@@ -271,6 +276,7 @@ export default function useBlockSync( {
|
|
|
271
276
|
initialPosition:
|
|
272
277
|
getSelectedBlocksInitialCaretPosition(),
|
|
273
278
|
},
|
|
279
|
+
undoIgnore,
|
|
274
280
|
} );
|
|
275
281
|
}
|
|
276
282
|
previousAreBlocksDifferent = areBlocksDifferent;
|
|
@@ -113,8 +113,14 @@ export function RichTextWrapper(
|
|
|
113
113
|
props = removeNativeProps( props );
|
|
114
114
|
|
|
115
115
|
const anchorRef = useRef();
|
|
116
|
-
const { clientId } = useBlockEditContext();
|
|
116
|
+
const { clientId, isSelected: isBlockSelected } = useBlockEditContext();
|
|
117
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
|
+
|
|
118
124
|
const { getSelectionStart, getSelectionEnd } =
|
|
119
125
|
select( blockEditorStore );
|
|
120
126
|
const selectionStart = getSelectionStart();
|
|
@@ -137,10 +143,12 @@ export function RichTextWrapper(
|
|
|
137
143
|
isSelected,
|
|
138
144
|
};
|
|
139
145
|
};
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
146
|
+
const { selectionStart, selectionEnd, isSelected } = useSelect( selector, [
|
|
147
|
+
clientId,
|
|
148
|
+
identifier,
|
|
149
|
+
originalIsSelected,
|
|
150
|
+
isBlockSelected,
|
|
151
|
+
] );
|
|
144
152
|
const { getSelectionStart, getSelectionEnd, getBlockRootClientId } =
|
|
145
153
|
useSelect( blockEditorStore );
|
|
146
154
|
const { selectionChange } = useDispatch( blockEditorStore );
|
|
@@ -317,10 +325,13 @@ export function RichTextWrapper(
|
|
|
317
325
|
{ ...props }
|
|
318
326
|
{ ...autocompleteProps }
|
|
319
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,
|
|
320
332
|
forwardedRef,
|
|
321
333
|
autocompleteProps.ref,
|
|
322
334
|
props.ref,
|
|
323
|
-
richTextRef,
|
|
324
335
|
useBeforeInputRules( { value, onChange } ),
|
|
325
336
|
useInputRules( {
|
|
326
337
|
getValue,
|
|
@@ -379,6 +390,7 @@ export function RichTextWrapper(
|
|
|
379
390
|
// tabIndex because Safari will focus the element. However,
|
|
380
391
|
// Safari will correctly ignore nested contentEditable elements.
|
|
381
392
|
tabIndex={ props.tabIndex === 0 ? null : props.tabIndex }
|
|
393
|
+
data-wp-block-attribute-key={ identifier }
|
|
382
394
|
/>
|
|
383
395
|
</>
|
|
384
396
|
);
|
|
@@ -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.
|
|
@@ -267,7 +264,7 @@ export class RichText extends Component {
|
|
|
267
264
|
onCreateUndoLevel() {
|
|
268
265
|
const { __unstableOnCreateUndoLevel: onCreateUndoLevel } = this.props;
|
|
269
266
|
// If the content is the same, no level needs to be created.
|
|
270
|
-
if ( this.lastHistoryValue === this.value ) {
|
|
267
|
+
if ( this.lastHistoryValue.toString() === this.value.toString() ) {
|
|
271
268
|
return;
|
|
272
269
|
}
|
|
273
270
|
|
|
@@ -317,10 +314,10 @@ export class RichText extends Component {
|
|
|
317
314
|
}
|
|
318
315
|
|
|
319
316
|
const contentWithoutRootTag = this.removeRootTagsProducedByAztec(
|
|
320
|
-
|
|
317
|
+
event.nativeEvent.text
|
|
321
318
|
);
|
|
322
319
|
// On iOS, onChange can be triggered after selection changes, even though there are no content changes.
|
|
323
|
-
if ( contentWithoutRootTag === this.value ) {
|
|
320
|
+
if ( contentWithoutRootTag === this.value.toString() ) {
|
|
324
321
|
return;
|
|
325
322
|
}
|
|
326
323
|
this.lastEventCount = event.nativeEvent.eventCount;
|
|
@@ -332,11 +329,11 @@ export class RichText extends Component {
|
|
|
332
329
|
|
|
333
330
|
onTextUpdate( event ) {
|
|
334
331
|
const contentWithoutRootTag = this.removeRootTagsProducedByAztec(
|
|
335
|
-
|
|
332
|
+
event.nativeEvent.text
|
|
336
333
|
);
|
|
337
334
|
|
|
338
335
|
this.debounceCreateUndoLevel();
|
|
339
|
-
const refresh = this.value !== contentWithoutRootTag;
|
|
336
|
+
const refresh = this.value.toString() !== contentWithoutRootTag;
|
|
340
337
|
this.value = contentWithoutRootTag;
|
|
341
338
|
|
|
342
339
|
// We don't want to refresh if our goal is just to create a record.
|
|
@@ -567,7 +564,7 @@ export class RichText extends Component {
|
|
|
567
564
|
// Check if value is up to date with latest state of native AztecView.
|
|
568
565
|
if (
|
|
569
566
|
event.nativeEvent.text &&
|
|
570
|
-
event.nativeEvent.text !== this.props.value
|
|
567
|
+
event.nativeEvent.text !== this.props.value.toString()
|
|
571
568
|
) {
|
|
572
569
|
this.onTextUpdate( event );
|
|
573
570
|
}
|
|
@@ -592,7 +589,7 @@ export class RichText extends Component {
|
|
|
592
589
|
// this approach is not perfectly reliable.
|
|
593
590
|
const isManual =
|
|
594
591
|
this.lastAztecEventType !== 'input' &&
|
|
595
|
-
this.props.value === this.value;
|
|
592
|
+
this.props.value.toString() === this.value.toString();
|
|
596
593
|
if ( hasChanged && isManual ) {
|
|
597
594
|
const value = this.createRecord();
|
|
598
595
|
const activeFormats = getActiveFormats( value );
|
|
@@ -659,10 +656,10 @@ export class RichText extends Component {
|
|
|
659
656
|
|
|
660
657
|
// Check and dicsard stray event, where the text and selection is equal to the ones already cached.
|
|
661
658
|
const contentWithoutRootTag = this.removeRootTagsProducedByAztec(
|
|
662
|
-
|
|
659
|
+
event.nativeEvent.text
|
|
663
660
|
);
|
|
664
661
|
if (
|
|
665
|
-
contentWithoutRootTag === this.value &&
|
|
662
|
+
contentWithoutRootTag === this.value.toString() &&
|
|
666
663
|
realStart === this.selectionStart &&
|
|
667
664
|
realEnd === this.selectionEnd
|
|
668
665
|
) {
|
|
@@ -759,7 +756,7 @@ export class RichText extends Component {
|
|
|
759
756
|
typeof nextProps.value !== 'undefined' &&
|
|
760
757
|
typeof this.props.value !== 'undefined' &&
|
|
761
758
|
( ! this.comesFromAztec || ! this.firedAfterTextChanged ) &&
|
|
762
|
-
nextProps.value !== this.props.value
|
|
759
|
+
nextProps.value.toString() !== this.props.value.toString()
|
|
763
760
|
) {
|
|
764
761
|
// Gutenberg seems to try to mirror the caret state even on events that only change the content so,
|
|
765
762
|
// let's force caret update if state has selection set.
|
|
@@ -823,17 +820,11 @@ export class RichText extends Component {
|
|
|
823
820
|
}
|
|
824
821
|
}
|
|
825
822
|
|
|
826
|
-
componentWillUnmount() {
|
|
827
|
-
if ( this._editor.isFocused() ) {
|
|
828
|
-
this._editor.blur();
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
|
|
832
823
|
componentDidUpdate( prevProps ) {
|
|
833
824
|
const { style, tagName } = this.props;
|
|
834
825
|
const { currentFontSize } = this.state;
|
|
835
826
|
|
|
836
|
-
if ( this.props.value !== this.value ) {
|
|
827
|
+
if ( this.props.value.toString() !== this.value.toString() ) {
|
|
837
828
|
this.value = this.props.value;
|
|
838
829
|
}
|
|
839
830
|
const { __unstableIsSelected: prevIsSelected } = prevProps;
|
|
@@ -851,7 +842,7 @@ export class RichText extends Component {
|
|
|
851
842
|
// Since this is happening when merging blocks, the selection should be at the last character position.
|
|
852
843
|
// As a fallback the internal selectionEnd value is used.
|
|
853
844
|
const lastCharacterPosition =
|
|
854
|
-
this.value?.length ?? this.selectionEnd;
|
|
845
|
+
this.value?.toString().length ?? this.selectionEnd;
|
|
855
846
|
this._editor.focus();
|
|
856
847
|
this.props.onSelectionChange(
|
|
857
848
|
lastCharacterPosition,
|
|
@@ -893,7 +884,8 @@ export class RichText extends Component {
|
|
|
893
884
|
// On android if content is empty we need to send no content or else the placeholder will not show.
|
|
894
885
|
if (
|
|
895
886
|
! this.isIOS &&
|
|
896
|
-
( value === '' ||
|
|
887
|
+
( value.toString() === '' ||
|
|
888
|
+
value.toString() === EMPTY_PARAGRAPH_TAGS )
|
|
897
889
|
) {
|
|
898
890
|
return '';
|
|
899
891
|
}
|
|
@@ -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
|
[
|
|
@@ -2,13 +2,23 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { Dimensions } from 'react-native';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
fireEvent,
|
|
7
|
+
getEditorHtml,
|
|
8
|
+
initializeEditor,
|
|
9
|
+
render,
|
|
10
|
+
screen,
|
|
11
|
+
} from 'test/helpers';
|
|
6
12
|
|
|
7
13
|
/**
|
|
8
14
|
* WordPress dependencies
|
|
9
15
|
*/
|
|
10
16
|
import { select } from '@wordpress/data';
|
|
11
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
store as richTextStore,
|
|
19
|
+
RichTextData,
|
|
20
|
+
__unstableCreateElement,
|
|
21
|
+
} from '@wordpress/rich-text';
|
|
12
22
|
import { coreBlocks } from '@wordpress/block-library';
|
|
13
23
|
import {
|
|
14
24
|
getBlockTypes,
|
|
@@ -78,7 +88,64 @@ describe( '<RichText/>', () => {
|
|
|
78
88
|
} );
|
|
79
89
|
} );
|
|
80
90
|
|
|
81
|
-
describe( '
|
|
91
|
+
describe( 'when the value changes', () => {
|
|
92
|
+
it( 'should avoid updating attributes when values are equal', async () => {
|
|
93
|
+
const handleChange = jest.fn();
|
|
94
|
+
const defaultEmptyValue = RichTextData.empty();
|
|
95
|
+
render(
|
|
96
|
+
<RichText
|
|
97
|
+
onChange={ handleChange }
|
|
98
|
+
value={ defaultEmptyValue }
|
|
99
|
+
/>
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
// Simulate an empty string from Aztec
|
|
103
|
+
fireEvent( screen.getByLabelText( 'Text input. Empty' ), 'change', {
|
|
104
|
+
nativeEvent: { text: '' },
|
|
105
|
+
} );
|
|
106
|
+
|
|
107
|
+
expect( handleChange ).not.toHaveBeenCalled();
|
|
108
|
+
} );
|
|
109
|
+
|
|
110
|
+
it( 'should preserve non-breaking space HTML entity', () => {
|
|
111
|
+
const onChange = jest.fn();
|
|
112
|
+
const onSelectionChange = jest.fn();
|
|
113
|
+
// The initial value is created using an HTML element to preserve
|
|
114
|
+
// the HTML entity.
|
|
115
|
+
const initialValue = RichTextData.fromHTMLElement(
|
|
116
|
+
__unstableCreateElement( document, ' ' )
|
|
117
|
+
);
|
|
118
|
+
render(
|
|
119
|
+
<RichText
|
|
120
|
+
onChange={ onChange }
|
|
121
|
+
onSelectionChange={ onSelectionChange }
|
|
122
|
+
value={ initialValue }
|
|
123
|
+
__unstableIsSelected
|
|
124
|
+
/>
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
// Trigger selection event with same text value as initial.
|
|
128
|
+
fireEvent(
|
|
129
|
+
screen.getByLabelText( /Text input/ ),
|
|
130
|
+
'onSelectionChange',
|
|
131
|
+
0,
|
|
132
|
+
0,
|
|
133
|
+
initialValue.toString(),
|
|
134
|
+
{
|
|
135
|
+
nativeEvent: {
|
|
136
|
+
eventCount: 0,
|
|
137
|
+
target: undefined,
|
|
138
|
+
text: initialValue.toString(),
|
|
139
|
+
},
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
expect( onChange ).not.toHaveBeenCalled();
|
|
144
|
+
expect( onSelectionChange ).toHaveBeenCalled();
|
|
145
|
+
} );
|
|
146
|
+
} );
|
|
147
|
+
|
|
148
|
+
describe( 'when applying the font size', () => {
|
|
82
149
|
it( 'should display rich text at the DEFAULT font size.', () => {
|
|
83
150
|
// Arrange.
|
|
84
151
|
const expectedFontSize = 16;
|
|
@@ -234,7 +301,7 @@ describe( '<RichText/>', () => {
|
|
|
234
301
|
const fontSize = '10';
|
|
235
302
|
const style = { fontSize: '12' };
|
|
236
303
|
// Act.
|
|
237
|
-
|
|
304
|
+
render( <RichText fontSize={ fontSize } /> );
|
|
238
305
|
screen.update( <RichText fontSize={ fontSize } style={ style } /> );
|
|
239
306
|
// Assert.
|
|
240
307
|
expect( screen.toJSON() ).toMatchSnapshot();
|
|
@@ -256,7 +323,7 @@ describe( '<RichText/>', () => {
|
|
|
256
323
|
const fontSize = '10';
|
|
257
324
|
const style = { fontSize: '12.56px' };
|
|
258
325
|
// Act.
|
|
259
|
-
|
|
326
|
+
render( <RichText fontSize={ fontSize } /> );
|
|
260
327
|
screen.update( <RichText fontSize={ fontSize } style={ style } /> );
|
|
261
328
|
// Assert.
|
|
262
329
|
expect( screen.toJSON() ).toMatchSnapshot();
|
|
@@ -142,8 +142,8 @@ export function useInputRules( props ) {
|
|
|
142
142
|
return;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
if ( __unstableAllowPrefixTransformations && inputRule ) {
|
|
146
|
-
|
|
145
|
+
if ( __unstableAllowPrefixTransformations && inputRule() ) {
|
|
146
|
+
return;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
const value = getValue();
|
|
@@ -11,8 +11,7 @@ import { store as blockEditorStore } from '../../store';
|
|
|
11
11
|
|
|
12
12
|
export function useMarkPersistent( { html, value } ) {
|
|
13
13
|
const previousText = useRef();
|
|
14
|
-
const hasActiveFormats =
|
|
15
|
-
value.activeFormats && !! value.activeFormats.length;
|
|
14
|
+
const hasActiveFormats = !! value.activeFormats?.length;
|
|
16
15
|
const { __unstableMarkLastChangeAsPersistent } =
|
|
17
16
|
useDispatch( blockEditorStore );
|
|
18
17
|
|
|
@@ -317,7 +317,7 @@ export default function SpacingInputControl( {
|
|
|
317
317
|
setShowCustomValueControl( ! showCustomValueControl );
|
|
318
318
|
} }
|
|
319
319
|
isPressed={ showCustomValueControl }
|
|
320
|
-
|
|
320
|
+
size="small"
|
|
321
321
|
className="spacing-sizes-control__custom-toggle"
|
|
322
322
|
iconSize={ 24 }
|
|
323
323
|
/>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# TextDecorationControl
|
|
2
|
+
|
|
3
|
+
<div class="callout callout-alert">
|
|
4
|
+
This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
|
|
5
|
+
</div>
|
|
6
|
+
<br />
|
|
7
|
+
|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```jsx
|
|
14
|
+
import { __experimentalTextDecorationControl as TextDecorationControl } from '@wordpress/block-editor';
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Then, you can use the component in your block editor UI:
|
|
18
|
+
|
|
19
|
+
```jsx
|
|
20
|
+
<TextDecorationControl
|
|
21
|
+
value={textDecorationValue}
|
|
22
|
+
onChange={(newValue) => setAttributes({ textDecoration: newValue })}
|
|
23
|
+
/>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Props
|
|
27
|
+
|
|
28
|
+
### `value`
|
|
29
|
+
|
|
30
|
+
- **Type:** `String`
|
|
31
|
+
- **Default:** `none`
|
|
32
|
+
- **Options:** `none`, `underline`, `line-through`
|
|
33
|
+
|
|
34
|
+
The current value of the Text Decoration setting. You may only choose from the `Options` listed above.
|
|
35
|
+
|
|
36
|
+
### `onChange`
|
|
37
|
+
|
|
38
|
+
- **Type:** `Function`
|
|
39
|
+
|
|
40
|
+
A callback function invoked when the Text Decoration value is changed via an interaction with any of the buttons. Called with the Text Decoration value (`none`, `underline`, `line-through`) as the only argument.
|
|
@@ -4,10 +4,6 @@ The `TextTransformControl` component is responsible for rendering a control elem
|
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
## Table of contents
|
|
8
|
-
|
|
9
|
-
1. [Development guidelines](#development-guidelines)
|
|
10
|
-
|
|
11
7
|
## Development guidelines
|
|
12
8
|
|
|
13
9
|
### Usage
|
|
@@ -6,11 +6,6 @@ This only happens in the mobile WordPress apps.
|
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|
|
|
9
|
-
## Table of contents
|
|
10
|
-
|
|
11
|
-
1. [Development guidelines](#development-guidelines)
|
|
12
|
-
2. [Related components](#related-components)
|
|
13
|
-
|
|
14
9
|
## Development guidelines
|
|
15
10
|
|
|
16
11
|
### Usage
|
|
@@ -66,7 +66,6 @@ class URLInput extends Component {
|
|
|
66
66
|
this.state = {
|
|
67
67
|
suggestions: [],
|
|
68
68
|
showSuggestions: false,
|
|
69
|
-
isUpdatingSuggestions: false,
|
|
70
69
|
suggestionsValue: null,
|
|
71
70
|
selectedSuggestion: null,
|
|
72
71
|
suggestionsListboxId: '',
|
|
@@ -102,11 +101,7 @@ class URLInput extends Component {
|
|
|
102
101
|
}
|
|
103
102
|
|
|
104
103
|
// Update suggestions when the value changes.
|
|
105
|
-
if (
|
|
106
|
-
prevProps.value !== value &&
|
|
107
|
-
! this.props.disableSuggestions &&
|
|
108
|
-
! this.state.isUpdatingSuggestions
|
|
109
|
-
) {
|
|
104
|
+
if ( prevProps.value !== value && ! this.props.disableSuggestions ) {
|
|
110
105
|
if ( value?.length ) {
|
|
111
106
|
// If the new value is not empty we need to update with suggestions for it.
|
|
112
107
|
this.updateSuggestions( value );
|
|
@@ -183,7 +178,6 @@ class URLInput extends Component {
|
|
|
183
178
|
}
|
|
184
179
|
|
|
185
180
|
this.setState( {
|
|
186
|
-
isUpdatingSuggestions: true,
|
|
187
181
|
selectedSuggestion: null,
|
|
188
182
|
loading: true,
|
|
189
183
|
} );
|
|
@@ -203,7 +197,6 @@ class URLInput extends Component {
|
|
|
203
197
|
|
|
204
198
|
this.setState( {
|
|
205
199
|
suggestions,
|
|
206
|
-
isUpdatingSuggestions: false,
|
|
207
200
|
suggestionsValue: value,
|
|
208
201
|
loading: false,
|
|
209
202
|
showSuggestions: !! suggestions.length,
|
|
@@ -235,9 +228,15 @@ class URLInput extends Component {
|
|
|
235
228
|
}
|
|
236
229
|
|
|
237
230
|
this.setState( {
|
|
238
|
-
isUpdatingSuggestions: false,
|
|
239
231
|
loading: false,
|
|
240
232
|
} );
|
|
233
|
+
} )
|
|
234
|
+
.finally( () => {
|
|
235
|
+
// If this is the current promise then reset the reference
|
|
236
|
+
// to allow for checking if a new request is made.
|
|
237
|
+
if ( this.suggestionsRequest === request ) {
|
|
238
|
+
this.suggestionsRequest = null;
|
|
239
|
+
}
|
|
241
240
|
} );
|
|
242
241
|
|
|
243
242
|
// Note that this assignment is handled *before* the async search request
|
|
@@ -255,11 +254,12 @@ class URLInput extends Component {
|
|
|
255
254
|
|
|
256
255
|
// When opening the link editor, if there's a value present, we want to load the suggestions pane with the results for this input search value
|
|
257
256
|
// Don't re-run the suggestions on focus if there are already suggestions present (prevents searching again when tabbing between the input and buttons)
|
|
257
|
+
// or there is already a request in progress.
|
|
258
258
|
if (
|
|
259
259
|
value &&
|
|
260
260
|
! disableSuggestions &&
|
|
261
|
-
!
|
|
262
|
-
|
|
261
|
+
! ( suggestions && suggestions.length ) &&
|
|
262
|
+
this.suggestionsRequest === null
|
|
263
263
|
) {
|
|
264
264
|
// Ensure the suggestions are updated with the current input value.
|
|
265
265
|
this.updateSuggestions( value );
|