@wordpress/block-editor 17.1.0 → 17.2.1-next.v.202609171837.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 +32 -0
- package/README.md +214 -214
- package/build/autocompleters/block.cjs.map +2 -2
- package/build/components/alignment-control/ui.cjs.map +2 -2
- package/build/components/background-image-control/index.cjs +1 -1
- package/build/components/background-image-control/index.cjs.map +2 -2
- package/build/components/block-alignment-control/ui.cjs +21 -7
- package/build/components/block-alignment-control/ui.cjs.map +3 -3
- package/build/components/block-alignment-control/use-available-alignments.cjs +60 -13
- package/build/components/block-alignment-control/use-available-alignments.cjs.map +2 -2
- package/build/components/block-allowed-blocks/allowed-blocks-control.cjs.map +2 -2
- package/build/components/block-bindings/attribute-control.cjs +30 -30
- package/build/components/block-bindings/attribute-control.cjs.map +3 -3
- package/build/components/block-bindings/source-fields-list.cjs +27 -32
- package/build/components/block-bindings/source-fields-list.cjs.map +3 -3
- package/build/components/block-canvas/index.cjs.map +2 -2
- package/build/components/block-card/index.cjs +1 -2
- package/build/components/block-card/index.cjs.map +3 -3
- package/build/components/block-edit/edit.cjs.map +2 -2
- package/build/components/block-heading-level-dropdown/index.cjs.map +2 -2
- package/build/components/block-icon/index.cjs.map +2 -2
- package/build/components/block-inspector/edit-contents.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +27 -8
- package/build/components/block-inspector/index.cjs.map +3 -3
- package/build/components/block-keyboard-shortcuts/index.cjs.map +2 -2
- package/build/components/block-list/block-html.cjs +1 -12
- package/build/components/block-list/block-html.cjs.map +3 -3
- package/build/components/block-list/block.cjs +2 -4
- package/build/components/block-list/block.cjs.map +2 -2
- package/build/components/block-list/layout.cjs +1 -1
- package/build/components/block-list/layout.cjs.map +2 -2
- package/build/components/block-list/use-block-props/index.cjs.map +2 -2
- package/build/components/block-lock/modal.cjs +1 -3
- package/build/components/block-lock/modal.cjs.map +2 -2
- package/build/components/block-parent-selector/index.cjs +8 -5
- package/build/components/block-parent-selector/index.cjs.map +2 -2
- package/build/components/block-popover/index.cjs.map +2 -2
- package/build/components/block-rename/modal.cjs.map +2 -2
- package/build/components/block-settings-menu/block-settings-dropdown.cjs.map +2 -2
- package/build/components/block-styles/utils.cjs.map +2 -2
- package/build/components/block-switcher/index.cjs.map +2 -2
- package/build/components/block-toolbar/edit-section-button.cjs.map +2 -2
- package/build/components/block-toolbar/index.cjs +6 -4
- package/build/components/block-toolbar/index.cjs.map +2 -2
- package/build/components/block-toolbar/switch-section-style.cjs.map +2 -2
- package/build/components/block-variation-transforms/index.cjs +28 -18
- package/build/components/block-variation-transforms/index.cjs.map +3 -3
- package/build/components/block-visibility/modal.cjs.map +2 -2
- package/build/components/block-visibility/viewport-visibility-info.cjs.map +2 -2
- package/build/components/border-radius-control/index.cjs.map +2 -2
- package/build/components/color-palette/with-color-context.cjs.map +2 -2
- package/build/components/colors/with-colors.cjs.map +2 -2
- package/build/components/colors-gradients/control.cjs.map +2 -2
- package/build/components/contrast-checker/index.cjs.map +2 -2
- package/build/components/date-format-picker/index.cjs.map +2 -2
- package/build/components/dimensions-tool/aspect-ratio-tool.cjs.map +3 -3
- package/build/components/dimensions-tool/width-height-tool.cjs.map +2 -2
- package/build/components/font-sizes/with-font-sizes.cjs.map +2 -2
- package/build/components/global-styles/background-panel.cjs +1 -1
- package/build/components/global-styles/background-panel.cjs.map +2 -2
- package/build/components/global-styles/border-panel.cjs +1 -1
- package/build/components/global-styles/border-panel.cjs.map +2 -2
- package/build/components/global-styles/color-gradient-dropdown-item.cjs +1 -1
- package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +2 -2
- package/build/components/global-styles/color-panel.cjs +1 -1
- package/build/components/global-styles/color-panel.cjs.map +2 -2
- package/build/components/global-styles/dimensions-panel.cjs +1 -1
- package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
- package/build/components/global-styles/filters-panel.cjs +1 -1
- package/build/components/global-styles/filters-panel.cjs.map +2 -2
- package/build/components/global-styles/hooks.cjs +1 -0
- package/build/components/global-styles/hooks.cjs.map +2 -2
- package/build/components/global-styles/inheritance/index.cjs +3 -3
- package/build/components/global-styles/inheritance/index.cjs.map +2 -2
- package/build/components/global-styles/inherited-value-context.cjs +0 -5
- package/build/components/global-styles/inherited-value-context.cjs.map +2 -2
- package/build/components/global-styles/state-control-badges.cjs +0 -1
- package/build/components/global-styles/state-control-badges.cjs.map +2 -2
- package/build/components/global-styles/state-control.cjs +6 -4
- package/build/components/global-styles/state-control.cjs.map +2 -2
- package/build/components/global-styles/text-shadow-panel.cjs +254 -0
- package/build/components/global-styles/text-shadow-panel.cjs.map +7 -0
- package/build/components/global-styles/typography-panel.cjs +46 -5
- package/build/components/global-styles/typography-panel.cjs.map +2 -2
- package/build/components/global-styles/typography-utils.cjs.map +2 -2
- package/build/components/global-styles/utils.cjs.map +2 -2
- package/build/components/html-element-control/index.cjs.map +3 -3
- package/build/components/iframe/index.cjs.map +2 -2
- package/build/components/iframe/use-scale-canvas.cjs.map +2 -2
- package/build/components/image-size-control/index.cjs.map +3 -3
- package/build/components/inner-blocks/index.cjs +6 -1
- package/build/components/inner-blocks/index.cjs.map +2 -2
- package/build/components/inner-content/index.cjs.map +2 -2
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.cjs +4 -23
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.cjs.map +2 -2
- package/build/components/inserter/block-patterns-tab/utils.cjs +26 -0
- package/build/components/inserter/block-patterns-tab/utils.cjs.map +2 -2
- package/build/components/inserter/hooks/use-block-types-state.cjs.map +2 -2
- package/build/components/inserter/hooks/use-insertion-point.cjs.map +2 -2
- package/build/components/inserter/hooks/use-patterns-state.cjs.map +2 -2
- package/build/components/inserter/media-tab/media-panel.cjs.map +2 -2
- package/build/components/inserter/media-tab/media-preview.cjs.map +2 -2
- package/build/components/inserter-list-item/index.cjs.map +2 -2
- package/build/components/inspector-controls/list-view-content-popover.cjs.map +2 -2
- package/build/components/link-control/search-results.cjs.map +2 -2
- package/build/components/link-control/use-search-handler.cjs +3 -0
- package/build/components/link-control/use-search-handler.cjs.map +2 -2
- package/build/components/list-view/branch.cjs.map +2 -2
- package/build/components/list-view/drop-indicator.cjs.map +2 -2
- package/build/components/list-view/index.cjs.map +2 -2
- package/build/components/list-view/use-list-view-drop-zone.cjs.map +2 -2
- package/build/components/list-view/utils.cjs.map +2 -2
- package/build/components/media-replace-flow/index.cjs +4 -1
- package/build/components/media-replace-flow/index.cjs.map +2 -2
- package/build/components/plain-text/index.cjs +1 -2
- package/build/components/plain-text/index.cjs.map +3 -3
- package/build/components/preset-input-control/index.cjs.map +2 -2
- package/build/components/provider/index.cjs +3 -1
- package/build/components/provider/index.cjs.map +2 -2
- package/build/components/provider/use-block-sync.cjs.map +2 -2
- package/build/components/publish-date-time-picker/index.cjs.map +2 -2
- package/build/components/resizable-box-popover/index.cjs +1 -1
- package/build/components/resizable-box-popover/index.cjs.map +1 -1
- package/build/components/resolution-tool/index.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/enter.cjs +8 -22
- package/build/components/rich-text/event-listeners/enter.cjs.map +2 -2
- package/build/components/rich-text/format-edit.cjs.map +2 -2
- package/build/components/rich-text/index.cjs +20 -0
- package/build/components/rich-text/index.cjs.map +2 -2
- package/build/components/rich-text/multiline.cjs +10 -2
- package/build/components/rich-text/multiline.cjs.map +2 -2
- package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.cjs.map +2 -2
- package/build/components/typewriter/index.cjs.map +2 -2
- package/build/components/use-block-commands/index.cjs.map +2 -2
- package/build/components/writing-flow/index.cjs +3 -0
- package/build/components/writing-flow/index.cjs.map +2 -2
- package/build/components/writing-flow/use-clipboard-handler.cjs.map +2 -2
- package/build/components/writing-flow/use-selection-observer.cjs +5 -3
- package/build/components/writing-flow/use-selection-observer.cjs.map +2 -2
- package/build/hooks/align.cjs +3 -5
- package/build/hooks/align.cjs.map +2 -2
- package/build/hooks/background.cjs.map +2 -2
- package/build/hooks/block-bindings.cjs.map +2 -2
- package/build/hooks/border.cjs.map +2 -2
- package/build/hooks/contrast-checker.cjs.map +2 -2
- package/build/hooks/dimensions.cjs.map +2 -2
- package/build/hooks/duotone.cjs.map +2 -2
- package/build/hooks/elements.cjs.map +2 -2
- package/build/hooks/fit-text.cjs.map +2 -2
- package/build/hooks/gap.cjs +2 -1
- package/build/hooks/gap.cjs.map +3 -3
- package/build/hooks/index.cjs +4 -2
- package/build/hooks/index.cjs.map +3 -3
- package/build/hooks/layout-child.cjs.map +2 -2
- package/build/hooks/layout.cjs +15 -14
- package/build/hooks/layout.cjs.map +3 -3
- package/build/hooks/position.cjs +3 -31
- package/build/hooks/position.cjs.map +2 -2
- package/build/hooks/states.cjs +3 -2
- package/build/hooks/states.cjs.map +2 -2
- package/build/hooks/text-shadow.cjs +100 -0
- package/build/hooks/text-shadow.cjs.map +7 -0
- package/build/hooks/typography.cjs +30 -6
- package/build/hooks/typography.cjs.map +2 -2
- package/build/hooks/utils.cjs +24 -2
- package/build/hooks/utils.cjs.map +2 -2
- package/build/layouts/grid.cjs.map +2 -2
- package/build/layouts/utils.cjs +7 -2
- package/build/layouts/utils.cjs.map +2 -2
- package/build/private-apis.cjs +9 -6
- package/build/private-apis.cjs.map +2 -2
- package/build/store/actions.cjs +26 -4
- package/build/store/actions.cjs.map +3 -3
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/get-font-styles-and-weights.cjs.map +2 -2
- package/build/utils/transform-styles/index.cjs.map +1 -1
- package/build-module/autocompleters/block.mjs.map +2 -2
- package/build-module/components/alignment-control/ui.mjs.map +2 -2
- package/build-module/components/background-image-control/index.mjs +2 -2
- package/build-module/components/background-image-control/index.mjs.map +2 -2
- package/build-module/components/block-alignment-control/ui.mjs +21 -7
- package/build-module/components/block-alignment-control/ui.mjs.map +2 -2
- package/build-module/components/block-alignment-control/use-available-alignments.mjs +56 -13
- package/build-module/components/block-alignment-control/use-available-alignments.mjs.map +2 -2
- package/build-module/components/block-allowed-blocks/allowed-blocks-control.mjs.map +2 -2
- package/build-module/components/block-bindings/attribute-control.mjs +31 -32
- package/build-module/components/block-bindings/attribute-control.mjs.map +2 -2
- package/build-module/components/block-bindings/source-fields-list.mjs +25 -30
- package/build-module/components/block-bindings/source-fields-list.mjs.map +2 -2
- package/build-module/components/block-canvas/index.mjs.map +2 -2
- package/build-module/components/block-card/index.mjs +3 -8
- package/build-module/components/block-card/index.mjs.map +2 -2
- package/build-module/components/block-edit/edit.mjs.map +2 -2
- package/build-module/components/block-heading-level-dropdown/index.mjs.map +2 -2
- package/build-module/components/block-icon/index.mjs.map +2 -2
- package/build-module/components/block-inspector/edit-contents.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +29 -10
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-keyboard-shortcuts/index.mjs.map +2 -2
- package/build-module/components/block-list/block-html.mjs +1 -2
- package/build-module/components/block-list/block-html.mjs.map +2 -2
- package/build-module/components/block-list/block.mjs +2 -4
- package/build-module/components/block-list/block.mjs.map +2 -2
- package/build-module/components/block-list/layout.mjs +1 -1
- package/build-module/components/block-list/layout.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/index.mjs.map +2 -2
- package/build-module/components/block-lock/modal.mjs +1 -3
- package/build-module/components/block-lock/modal.mjs.map +2 -2
- package/build-module/components/block-parent-selector/index.mjs +8 -5
- package/build-module/components/block-parent-selector/index.mjs.map +2 -2
- package/build-module/components/block-popover/index.mjs.map +2 -2
- package/build-module/components/block-rename/modal.mjs.map +2 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.mjs.map +2 -2
- package/build-module/components/block-styles/utils.mjs.map +2 -2
- package/build-module/components/block-switcher/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/edit-section-button.mjs.map +2 -2
- package/build-module/components/block-toolbar/index.mjs +6 -4
- package/build-module/components/block-toolbar/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/switch-section-style.mjs.map +2 -2
- package/build-module/components/block-variation-transforms/index.mjs +30 -21
- package/build-module/components/block-variation-transforms/index.mjs.map +2 -2
- package/build-module/components/block-visibility/modal.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +2 -2
- package/build-module/components/border-radius-control/index.mjs.map +2 -2
- package/build-module/components/color-palette/with-color-context.mjs.map +2 -2
- package/build-module/components/colors/with-colors.mjs.map +2 -2
- package/build-module/components/colors-gradients/control.mjs.map +2 -2
- package/build-module/components/contrast-checker/index.mjs.map +2 -2
- package/build-module/components/date-format-picker/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs +2 -2
- package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs.map +2 -2
- package/build-module/components/dimensions-tool/width-height-tool.mjs.map +2 -2
- package/build-module/components/font-sizes/with-font-sizes.mjs.map +2 -2
- package/build-module/components/global-styles/background-panel.mjs +2 -2
- package/build-module/components/global-styles/background-panel.mjs.map +2 -2
- package/build-module/components/global-styles/border-panel.mjs +2 -2
- package/build-module/components/global-styles/border-panel.mjs.map +2 -2
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +2 -2
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +2 -2
- package/build-module/components/global-styles/color-panel.mjs +2 -2
- package/build-module/components/global-styles/color-panel.mjs.map +2 -2
- package/build-module/components/global-styles/dimensions-panel.mjs +2 -2
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/filters-panel.mjs +2 -2
- package/build-module/components/global-styles/filters-panel.mjs.map +2 -2
- package/build-module/components/global-styles/hooks.mjs +1 -0
- package/build-module/components/global-styles/hooks.mjs.map +2 -2
- package/build-module/components/global-styles/inheritance/index.mjs +2 -2
- package/build-module/components/global-styles/inheritance/index.mjs.map +2 -2
- package/build-module/components/global-styles/inherited-value-context.mjs +0 -5
- package/build-module/components/global-styles/inherited-value-context.mjs.map +2 -2
- package/build-module/components/global-styles/state-control-badges.mjs +0 -1
- package/build-module/components/global-styles/state-control-badges.mjs.map +2 -2
- package/build-module/components/global-styles/state-control.mjs +6 -4
- package/build-module/components/global-styles/state-control.mjs.map +2 -2
- package/build-module/components/global-styles/text-shadow-panel.mjs +224 -0
- package/build-module/components/global-styles/text-shadow-panel.mjs.map +7 -0
- package/build-module/components/global-styles/typography-panel.mjs +47 -6
- package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
- package/build-module/components/global-styles/typography-utils.mjs.map +2 -2
- package/build-module/components/global-styles/utils.mjs.map +2 -2
- package/build-module/components/html-element-control/index.mjs +2 -2
- package/build-module/components/html-element-control/index.mjs.map +2 -2
- package/build-module/components/iframe/index.mjs.map +2 -2
- package/build-module/components/iframe/use-scale-canvas.mjs.map +2 -2
- package/build-module/components/image-size-control/index.mjs +2 -2
- package/build-module/components/image-size-control/index.mjs.map +2 -2
- package/build-module/components/inner-blocks/index.mjs +6 -1
- package/build-module/components/inner-blocks/index.mjs.map +2 -2
- package/build-module/components/inner-content/index.mjs.map +2 -2
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.mjs +6 -24
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.mjs.map +2 -2
- package/build-module/components/inserter/block-patterns-tab/utils.mjs +25 -0
- package/build-module/components/inserter/block-patterns-tab/utils.mjs.map +2 -2
- package/build-module/components/inserter/hooks/use-block-types-state.mjs.map +2 -2
- package/build-module/components/inserter/hooks/use-insertion-point.mjs.map +2 -2
- package/build-module/components/inserter/hooks/use-patterns-state.mjs.map +2 -2
- package/build-module/components/inserter/media-tab/media-panel.mjs.map +2 -2
- package/build-module/components/inserter/media-tab/media-preview.mjs.map +2 -2
- package/build-module/components/inserter-list-item/index.mjs.map +2 -2
- package/build-module/components/inspector-controls/list-view-content-popover.mjs.map +2 -2
- package/build-module/components/link-control/search-results.mjs.map +2 -2
- package/build-module/components/link-control/use-search-handler.mjs +3 -0
- package/build-module/components/link-control/use-search-handler.mjs.map +2 -2
- package/build-module/components/list-view/branch.mjs.map +2 -2
- package/build-module/components/list-view/drop-indicator.mjs.map +2 -2
- package/build-module/components/list-view/index.mjs.map +2 -2
- package/build-module/components/list-view/use-list-view-drop-zone.mjs.map +2 -2
- package/build-module/components/list-view/utils.mjs.map +2 -2
- package/build-module/components/media-replace-flow/index.mjs +4 -1
- package/build-module/components/media-replace-flow/index.mjs.map +2 -2
- package/build-module/components/plain-text/index.mjs +1 -2
- package/build-module/components/plain-text/index.mjs.map +2 -2
- package/build-module/components/preset-input-control/index.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +3 -1
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/use-block-sync.mjs.map +2 -2
- package/build-module/components/publish-date-time-picker/index.mjs.map +2 -2
- package/build-module/components/resizable-box-popover/index.mjs +1 -1
- package/build-module/components/resizable-box-popover/index.mjs.map +1 -1
- package/build-module/components/resolution-tool/index.mjs +2 -2
- package/build-module/components/resolution-tool/index.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs +8 -22
- package/build-module/components/rich-text/event-listeners/enter.mjs.map +2 -2
- package/build-module/components/rich-text/format-edit.mjs.map +2 -2
- package/build-module/components/rich-text/index.mjs +21 -0
- package/build-module/components/rich-text/index.mjs.map +2 -2
- package/build-module/components/rich-text/multiline.mjs +11 -3
- package/build-module/components/rich-text/multiline.mjs.map +2 -2
- package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.mjs.map +2 -2
- package/build-module/components/typewriter/index.mjs.map +2 -2
- package/build-module/components/use-block-commands/index.mjs.map +2 -2
- package/build-module/components/writing-flow/index.mjs +3 -0
- package/build-module/components/writing-flow/index.mjs.map +2 -2
- package/build-module/components/writing-flow/use-clipboard-handler.mjs.map +2 -2
- package/build-module/components/writing-flow/use-selection-observer.mjs +5 -3
- package/build-module/components/writing-flow/use-selection-observer.mjs.map +2 -2
- package/build-module/hooks/align.mjs +6 -6
- package/build-module/hooks/align.mjs.map +2 -2
- package/build-module/hooks/background.mjs.map +2 -2
- package/build-module/hooks/block-bindings.mjs.map +2 -2
- package/build-module/hooks/border.mjs.map +2 -2
- package/build-module/hooks/contrast-checker.mjs.map +2 -2
- package/build-module/hooks/dimensions.mjs.map +2 -2
- package/build-module/hooks/duotone.mjs.map +2 -2
- package/build-module/hooks/elements.mjs.map +2 -2
- package/build-module/hooks/fit-text.mjs.map +2 -2
- package/build-module/hooks/gap.mjs +2 -1
- package/build-module/hooks/gap.mjs.map +2 -2
- package/build-module/hooks/index.mjs +4 -2
- package/build-module/hooks/index.mjs.map +2 -2
- package/build-module/hooks/layout-child.mjs.map +2 -2
- package/build-module/hooks/layout.mjs +6 -5
- package/build-module/hooks/layout.mjs.map +2 -2
- package/build-module/hooks/position.mjs +5 -33
- package/build-module/hooks/position.mjs.map +2 -2
- package/build-module/hooks/states.mjs +3 -2
- package/build-module/hooks/states.mjs.map +2 -2
- package/build-module/hooks/text-shadow.mjs +65 -0
- package/build-module/hooks/text-shadow.mjs.map +7 -0
- package/build-module/hooks/typography.mjs +30 -6
- package/build-module/hooks/typography.mjs.map +2 -2
- package/build-module/hooks/utils.mjs +24 -2
- package/build-module/hooks/utils.mjs.map +2 -2
- package/build-module/layouts/grid.mjs.map +2 -2
- package/build-module/layouts/utils.mjs +5 -1
- package/build-module/layouts/utils.mjs.map +2 -2
- package/build-module/private-apis.mjs +6 -2
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/actions.mjs +28 -5
- package/build-module/store/actions.mjs.map +3 -3
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/get-font-styles-and-weights.mjs.map +2 -2
- package/build-module/utils/transform-styles/index.mjs.map +1 -1
- package/build-style/content-rtl.css +7 -2
- package/build-style/content.css +7 -2
- package/build-style/style-rtl.css +90 -25
- package/build-style/style.css +92 -25
- package/package.json +42 -43
- package/src/autocompleters/block.jsx +4 -4
- package/src/components/alignment-control/ui.jsx +1 -1
- package/src/components/background-image-control/index.jsx +3 -3
- package/src/components/block-alignment-control/test/index.jsdom.test.jsx +267 -0
- package/src/components/block-alignment-control/ui.jsx +47 -9
- package/src/components/block-alignment-control/use-available-alignments.js +106 -20
- package/src/components/block-allowed-blocks/allowed-blocks-control.jsx +1 -1
- package/src/components/block-bindings/attribute-control.jsx +27 -29
- package/src/components/block-bindings/source-fields-list.jsx +22 -32
- package/src/components/block-bindings/test/attribute-control.jsdom.test.jsx +115 -0
- package/src/components/block-canvas/index.jsx +1 -1
- package/src/components/block-card/index.jsx +5 -11
- package/src/components/block-card/style.scss +1 -0
- package/src/components/block-edit/edit.jsx +1 -1
- package/src/components/block-heading-level-dropdown/index.jsx +1 -1
- package/src/components/block-icon/index.jsx +1 -1
- package/src/components/block-icon/test/index.browser.test.jsx +74 -0
- package/src/components/block-inspector/edit-contents.jsx +2 -2
- package/src/components/block-inspector/index.jsx +46 -15
- package/src/components/block-inspector/style.scss +16 -0
- package/src/components/block-keyboard-shortcuts/index.jsx +2 -2
- package/src/components/block-list/block-html.jsx +2 -3
- package/src/components/block-list/block.jsx +7 -5
- package/src/components/block-list/content.scss +3 -2
- package/src/components/block-list/layout.jsx +4 -1
- package/src/components/block-list/test/layout.jsdom.test.js +40 -0
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-lock/modal.jsx +2 -3
- package/src/components/block-lock/style.scss +1 -1
- package/src/components/block-mover/style.scss +0 -13
- package/src/components/block-parent-selector/index.jsx +12 -6
- package/src/components/block-patterns-list/style.scss +1 -1
- package/src/components/block-popover/index.jsx +1 -1
- package/src/components/block-rename/modal.jsx +3 -3
- package/src/components/block-settings-menu/block-settings-dropdown.jsx +1 -1
- package/src/components/block-styles/utils.js +1 -1
- package/src/components/block-switcher/index.jsx +3 -3
- package/src/components/block-toolbar/edit-section-button.jsx +2 -2
- package/src/components/block-toolbar/index.jsx +8 -4
- package/src/components/block-toolbar/switch-section-style.jsx +1 -1
- package/src/components/block-variation-transforms/index.jsx +24 -23
- package/src/components/block-variation-transforms/test/index.jsdom.test.jsx +93 -0
- package/src/components/block-visibility/modal.jsx +7 -7
- package/src/components/block-visibility/style.scss +1 -1
- package/src/components/block-visibility/viewport-visibility-info.jsx +5 -7
- package/src/components/border-radius-control/index.jsx +2 -2
- package/src/components/border-radius-control/test/index.jsdom.test.jsx +0 -22
- package/src/components/border-radius-control/test/select.browser.test.js +30 -0
- package/src/components/color-palette/with-color-context.jsx +1 -1
- package/src/components/colors/with-colors.jsx +1 -1
- package/src/components/colors-gradients/control.jsx +2 -2
- package/src/components/colors-gradients/test/{control.jsdom.test.jsx → control.browser.test.jsx} +6 -9
- package/src/components/contrast-checker/index.jsx +2 -2
- package/src/components/date-format-picker/index.jsx +2 -2
- package/src/components/dimensions-tool/aspect-ratio-tool.jsx +4 -4
- package/src/components/dimensions-tool/test/index.jsdom.test.jsx +17 -11
- package/src/components/dimensions-tool/width-height-tool.jsx +2 -2
- package/src/components/font-sizes/with-font-sizes.jsx +2 -3
- package/src/components/global-styles/background-panel.jsx +2 -2
- package/src/components/global-styles/border-panel.jsx +2 -2
- package/src/components/global-styles/color-gradient-dropdown-item.jsx +3 -3
- package/src/components/global-styles/color-panel.jsx +3 -3
- package/src/components/global-styles/dimensions-panel.jsx +6 -6
- package/src/components/global-styles/filters-panel.jsx +2 -2
- package/src/components/global-styles/hooks.js +1 -0
- package/src/components/global-styles/inheritance/index.jsx +9 -6
- package/src/components/global-styles/inheritance/test/{index.jsdom.test.jsx → index.browser.test.jsx} +34 -28
- package/src/components/global-styles/inherited-value-context.js +1 -9
- package/src/components/global-styles/state-control-badges.jsx +0 -1
- package/src/components/global-styles/state-control.jsx +12 -3
- package/src/components/global-styles/style.scss +68 -0
- package/src/components/global-styles/test/{color-panel.jsdom.test.jsx → color-panel.browser.test.jsx} +53 -54
- package/src/components/global-styles/test/inherited-value-context-core.jsdom.test.js +17 -26
- package/src/components/global-styles/test/{typography-panel-core.jsdom.test.jsx → typography-panel-core.browser.test.jsx} +84 -39
- package/src/components/global-styles/test/{typography-panel.jsdom.test.jsx → typography-panel.browser.test.jsx} +80 -122
- package/src/components/global-styles/text-shadow-panel.tsx +257 -0
- package/src/components/global-styles/typography-panel.jsx +52 -13
- package/src/components/global-styles/typography-utils.js +2 -2
- package/src/components/global-styles/utils.js +1 -1
- package/src/components/html-element-control/index.jsx +2 -2
- package/src/components/iframe/index.jsx +1 -1
- package/src/components/iframe/use-scale-canvas.js +1 -1
- package/src/components/image-size-control/index.jsx +2 -2
- package/src/components/inner-blocks/index.jsx +9 -1
- package/src/components/inner-content/index.jsx +1 -1
- package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +7 -33
- package/src/components/inserter/block-patterns-tab/utils.js +44 -0
- package/src/components/inserter/hooks/use-block-types-state.js +2 -2
- package/src/components/inserter/hooks/use-insertion-point.js +1 -1
- package/src/components/inserter/hooks/use-patterns-state.js +1 -1
- package/src/components/inserter/media-tab/media-panel.jsx +9 -9
- package/src/components/inserter/media-tab/media-preview.jsx +1 -1
- package/src/components/inserter-list-item/index.jsx +1 -1
- package/src/components/inserter-list-item/style.scss +2 -2
- package/src/components/inspector-controls/list-view-content-popover.jsx +1 -1
- package/src/components/link-control/search-results.jsx +1 -1
- package/src/components/link-control/style.scss +1 -1
- package/src/components/link-control/test/index.jsdom.test.jsx +38 -110
- package/src/components/link-control/test/keyboard-selection.browser.test.js +110 -0
- package/src/components/link-control/use-search-handler.js +8 -3
- package/src/components/list-view/branch.jsx +1 -1
- package/src/components/list-view/drop-indicator.jsx +3 -3
- package/src/components/list-view/index.jsx +1 -1
- package/src/components/list-view/style.scss +1 -9
- package/src/components/list-view/use-list-view-drop-zone.js +1 -1
- package/src/components/list-view/utils.js +1 -1
- package/src/components/media-replace-flow/index.jsx +4 -1
- package/src/components/navigable-toolbar/test/index.browser.test.js +6 -7
- package/src/components/plain-text/README.md +3 -2
- package/src/components/plain-text/content.scss +0 -1
- package/src/components/plain-text/index.jsx +2 -3
- package/src/components/plain-text/style.scss +4 -0
- package/src/components/preset-input-control/index.jsx +2 -2
- package/src/components/preset-input-control/test/index.jsdom.test.jsx +0 -56
- package/src/components/preset-input-control/test/interaction.browser.test.js +63 -0
- package/src/components/provider/index.jsx +5 -3
- package/src/components/provider/use-block-sync.js +5 -5
- package/src/components/publish-date-time-picker/index.jsx +1 -1
- package/src/components/resizable-box-popover/index.jsx +1 -1
- package/src/components/resolution-tool/index.jsx +2 -2
- package/src/components/responsive-block-control/style.scss +1 -2
- package/src/components/responsive-block-control/test/index.jsdom.test.jsx +2 -2
- package/src/components/rich-text/event-listeners/enter.js +16 -23
- package/src/components/rich-text/format-edit.jsx +1 -1
- package/src/components/rich-text/index.jsx +39 -2
- package/src/components/rich-text/multiline.jsx +11 -3
- package/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
- package/src/components/spacing-sizes-control/test/index.jsdom.test.jsx +0 -21
- package/src/components/spacing-sizes-control/test/select.browser.test.js +58 -0
- package/src/components/typewriter/index.jsx +1 -1
- package/src/components/url-input/test/fixtures/validated-input-control-deprecation.js +1 -1
- package/src/components/use-block-commands/index.js +1 -1
- package/src/components/use-block-drop-zone/test/index.js +2 -2
- package/src/components/writing-flow/index.jsx +8 -0
- package/src/components/writing-flow/use-clipboard-handler.js +1 -1
- package/src/components/writing-flow/use-selection-observer.js +15 -6
- package/src/content.scss +1 -0
- package/src/hooks/align.jsx +22 -6
- package/src/hooks/background.jsx +1 -1
- package/src/hooks/block-bindings.jsx +1 -1
- package/src/hooks/block-hooks.scss +0 -6
- package/src/hooks/border.jsx +2 -2
- package/src/hooks/contrast-checker.js +1 -1
- package/src/hooks/dimensions.jsx +2 -2
- package/src/hooks/duotone.jsx +3 -3
- package/src/hooks/elements.jsx +3 -3
- package/src/hooks/fit-text.jsx +1 -1
- package/src/hooks/gap.js +2 -4
- package/src/hooks/index.js +3 -1
- package/src/hooks/layout-child.jsx +3 -4
- package/src/hooks/layout.jsx +17 -18
- package/src/hooks/position.jsx +5 -36
- package/src/hooks/states.jsx +6 -2
- package/src/hooks/test/layout.jsdom.test.js +44 -1
- package/src/hooks/text-shadow.ts +105 -0
- package/src/hooks/typography.jsx +58 -30
- package/src/hooks/utils.jsx +23 -1
- package/src/layouts/grid.jsx +2 -2
- package/src/layouts/test/flex.jsdom.test.jsx +4 -3
- package/src/layouts/test/utils.js +48 -1
- package/src/layouts/utils.js +19 -0
- package/src/private-apis.js +4 -0
- package/src/store/actions.js +50 -10
- package/src/store/private-selectors.js +5 -5
- package/src/store/reducer.js +6 -6
- package/src/store/selectors.js +3 -3
- package/src/store/test/actions.jsdom.test.js +60 -0
- package/src/style.scss +1 -0
- package/src/utils/get-font-styles-and-weights.ts +1 -1
- package/src/utils/transform-styles/index.ts +1 -1
- package/build/hooks/cross-origin-isolation.cjs +0 -56
- package/build/hooks/cross-origin-isolation.cjs.map +0 -7
- package/build-module/hooks/cross-origin-isolation.mjs +0 -54
- package/build-module/hooks/cross-origin-isolation.mjs.map +0 -7
- package/src/components/block-icon/test/__snapshots__/index.jsdom.test.jsx.snap +0 -27
- package/src/components/block-icon/test/index.jsdom.test.jsx +0 -67
- package/src/hooks/cross-origin-isolation.js +0 -73
- package/src/hooks/test/cross-origin-isolation.jsdom.test.js +0 -173
|
@@ -5,7 +5,6 @@ import PresetInputControl from '../index';
|
|
|
5
5
|
|
|
6
6
|
globalThis.wpVitest.mockMatchMedia();
|
|
7
7
|
|
|
8
|
-
globalThis.wpVitest.mockVisibleElements();
|
|
9
8
|
globalThis.wpVitest.mockScrollIntoView();
|
|
10
9
|
|
|
11
10
|
describe( 'PresetInputControl', () => {
|
|
@@ -91,34 +90,6 @@ describe( 'PresetInputControl', () => {
|
|
|
91
90
|
expect( mockOnChange ).toHaveBeenCalledWith( '25px' );
|
|
92
91
|
} );
|
|
93
92
|
|
|
94
|
-
it( 'clears value with undefined when input is fully erased via backspace', () => {
|
|
95
|
-
render(
|
|
96
|
-
<PresetInputControl
|
|
97
|
-
{ ...defaultProps }
|
|
98
|
-
presets={ presets }
|
|
99
|
-
value="60px"
|
|
100
|
-
disableCustomValues={ false }
|
|
101
|
-
/>
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
const input = screen.getByRole( 'spinbutton' );
|
|
105
|
-
|
|
106
|
-
// Simulate the bug scenario: backspace through "60" one character
|
|
107
|
-
// at a time. fireEvent.change is used here (rather than userEvent
|
|
108
|
-
// keyboard interactions) because the controlled UnitControl input
|
|
109
|
-
// does not respond to synthesised key events in jsdom. The
|
|
110
|
-
// intermediate "6" forwarding is expected and correct; the bug
|
|
111
|
-
// was that the final clear silently failed to propagate, leaving
|
|
112
|
-
// the parent stuck on the partial value.
|
|
113
|
-
fireEvent.change( input, { target: { value: '6' } } );
|
|
114
|
-
fireEvent.change( input, { target: { value: '' } } );
|
|
115
|
-
|
|
116
|
-
// The final clear must propagate as undefined, not be swallowed,
|
|
117
|
-
// and never be persisted as an empty string.
|
|
118
|
-
expect( mockOnChange ).toHaveBeenLastCalledWith( undefined );
|
|
119
|
-
expect( mockOnChange ).not.toHaveBeenCalledWith( '' );
|
|
120
|
-
} );
|
|
121
|
-
|
|
122
93
|
it( 'clears value with undefined when input is cleared in one shot', async () => {
|
|
123
94
|
const user = userEvent.setup();
|
|
124
95
|
|
|
@@ -182,33 +153,6 @@ describe( 'PresetInputControl', () => {
|
|
|
182
153
|
} );
|
|
183
154
|
} );
|
|
184
155
|
|
|
185
|
-
it( 'can interact with select dropdown options', async () => {
|
|
186
|
-
const user = userEvent.setup();
|
|
187
|
-
const manyPresets = Array.from( { length: 12 }, ( _, i ) => ( {
|
|
188
|
-
name: `Preset ${ i + 1 }`,
|
|
189
|
-
slug: `preset-${ i + 1 }`,
|
|
190
|
-
size: `${ ( i + 1 ) * 5 }px`,
|
|
191
|
-
} ) );
|
|
192
|
-
|
|
193
|
-
render(
|
|
194
|
-
<PresetInputControl { ...defaultProps } presets={ manyPresets } />
|
|
195
|
-
);
|
|
196
|
-
|
|
197
|
-
// Wait for dropdown to render
|
|
198
|
-
await waitFor( () => {
|
|
199
|
-
expect( screen.getByRole( 'combobox' ) ).toBeInTheDocument();
|
|
200
|
-
} );
|
|
201
|
-
|
|
202
|
-
// Click on the dropdown to open it
|
|
203
|
-
const combobox = screen.getByRole( 'combobox' );
|
|
204
|
-
await user.click( combobox );
|
|
205
|
-
|
|
206
|
-
// Should be able to interact with the dropdown
|
|
207
|
-
await waitFor( () => {
|
|
208
|
-
expect( combobox ).toHaveAttribute( 'aria-expanded', 'true' );
|
|
209
|
-
} );
|
|
210
|
-
} );
|
|
211
|
-
|
|
212
156
|
it( 'supports mixed value states', () => {
|
|
213
157
|
render(
|
|
214
158
|
<PresetInputControl
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { page, userEvent } from 'vitest/browser';
|
|
3
|
+
import { render } from 'vitest-browser-react';
|
|
4
|
+
import { screen } from '@testing-library/react';
|
|
5
|
+
import { createElement } from '@wordpress/element';
|
|
6
|
+
import PresetInputControl from '../index';
|
|
7
|
+
|
|
8
|
+
const defaultProps = {
|
|
9
|
+
ariaLabel: 'Spacing control',
|
|
10
|
+
onChange: vi.fn(),
|
|
11
|
+
presetType: 'spacing',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
beforeEach( () => {
|
|
15
|
+
vi.clearAllMocks();
|
|
16
|
+
} );
|
|
17
|
+
|
|
18
|
+
describe( 'PresetInputControl browser interactions', () => {
|
|
19
|
+
it( 'clears value with undefined when input is fully erased via backspace', async () => {
|
|
20
|
+
const user = userEvent.setup();
|
|
21
|
+
await render(
|
|
22
|
+
createElement( PresetInputControl, {
|
|
23
|
+
...defaultProps,
|
|
24
|
+
presets: [
|
|
25
|
+
{ name: 'None', slug: '0', size: '0' },
|
|
26
|
+
{ name: 'Small', slug: 'small', size: '10px' },
|
|
27
|
+
],
|
|
28
|
+
value: '60px',
|
|
29
|
+
disableCustomValues: false,
|
|
30
|
+
} )
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const input = screen.getByRole( 'spinbutton' );
|
|
34
|
+
|
|
35
|
+
await user.click( input );
|
|
36
|
+
await user.keyboard( '{End}{Backspace}{Backspace}' );
|
|
37
|
+
|
|
38
|
+
expect( defaultProps.onChange ).toHaveBeenLastCalledWith( undefined );
|
|
39
|
+
expect( defaultProps.onChange ).not.toHaveBeenCalledWith( '' );
|
|
40
|
+
} );
|
|
41
|
+
|
|
42
|
+
it( 'can interact with select dropdown options', async () => {
|
|
43
|
+
const user = userEvent.setup();
|
|
44
|
+
const manyPresets = Array.from( { length: 12 }, ( _, index ) => ( {
|
|
45
|
+
name: `Preset ${ index + 1 }`,
|
|
46
|
+
slug: `preset-${ index + 1 }`,
|
|
47
|
+
size: `${ ( index + 1 ) * 5 }px`,
|
|
48
|
+
} ) );
|
|
49
|
+
|
|
50
|
+
await render(
|
|
51
|
+
createElement( PresetInputControl, {
|
|
52
|
+
...defaultProps,
|
|
53
|
+
presets: manyPresets,
|
|
54
|
+
} )
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
await user.click( screen.getByRole( 'combobox' ) );
|
|
58
|
+
|
|
59
|
+
await expect
|
|
60
|
+
.element( page.getByRole( 'combobox', { expanded: true } ) )
|
|
61
|
+
.toBeVisible();
|
|
62
|
+
} );
|
|
63
|
+
} );
|
|
@@ -197,7 +197,9 @@ function mediaUpload(
|
|
|
197
197
|
},
|
|
198
198
|
onBatchSuccess,
|
|
199
199
|
onError: ( error ) =>
|
|
200
|
-
onError(
|
|
200
|
+
onError(
|
|
201
|
+
typeof error === 'string' ? error : ( error?.message ?? '' )
|
|
202
|
+
),
|
|
201
203
|
additionalData,
|
|
202
204
|
allowedTypes,
|
|
203
205
|
} );
|
|
@@ -259,7 +261,7 @@ function heicMediaUpload(
|
|
|
259
261
|
if ( pathsRemaining <= 0 ) {
|
|
260
262
|
onBatchSuccess?.();
|
|
261
263
|
}
|
|
262
|
-
|
|
264
|
+
}
|
|
263
265
|
: onBatchSuccess;
|
|
264
266
|
|
|
265
267
|
// Route HEIC files through the upload-media pipeline.
|
|
@@ -274,7 +276,7 @@ function heicMediaUpload(
|
|
|
274
276
|
onBatchSuccess: coordinatedBatchSuccess,
|
|
275
277
|
onError: ( error ) =>
|
|
276
278
|
onError(
|
|
277
|
-
typeof error === 'string' ? error : error?.message ?? ''
|
|
279
|
+
typeof error === 'string' ? error : ( error?.message ?? '' )
|
|
278
280
|
),
|
|
279
281
|
additionalData,
|
|
280
282
|
allowedTypes,
|
|
@@ -441,7 +441,7 @@ export default function useBlockSync( {
|
|
|
441
441
|
? restoreSelectionIds(
|
|
442
442
|
selectionInfo,
|
|
443
443
|
idMappingRef.current
|
|
444
|
-
|
|
444
|
+
)
|
|
445
445
|
: selectionInfo;
|
|
446
446
|
|
|
447
447
|
pendingChangesRef.current.outgoing.push(
|
|
@@ -476,12 +476,12 @@ export default function useBlockSync( {
|
|
|
476
476
|
const isOurs = clientId
|
|
477
477
|
? idMappingRef.current.internalToExternal.has(
|
|
478
478
|
newSelectionStart.clientId
|
|
479
|
-
|
|
479
|
+
)
|
|
480
480
|
: ! getBlockParents(
|
|
481
481
|
newSelectionStart.clientId
|
|
482
|
-
|
|
482
|
+
).some( ( parentId ) =>
|
|
483
483
|
areInnerBlocksControlled( parentId )
|
|
484
|
-
|
|
484
|
+
);
|
|
485
485
|
|
|
486
486
|
if ( isOurs ) {
|
|
487
487
|
const selectionInfo = {
|
|
@@ -495,7 +495,7 @@ export default function useBlockSync( {
|
|
|
495
495
|
? restoreSelectionIds(
|
|
496
496
|
selectionInfo,
|
|
497
497
|
idMappingRef.current
|
|
498
|
-
|
|
498
|
+
)
|
|
499
499
|
: selectionInfo
|
|
500
500
|
);
|
|
501
501
|
}
|
|
@@ -9,7 +9,7 @@ export default function ResizableBoxPopover( {
|
|
|
9
9
|
return (
|
|
10
10
|
<BlockPopoverCover
|
|
11
11
|
clientId={ clientId }
|
|
12
|
-
__unstablePopoverSlot="block-
|
|
12
|
+
__unstablePopoverSlot="__unstable-block-tools-after"
|
|
13
13
|
{ ...props }
|
|
14
14
|
>
|
|
15
15
|
<ResizableBox { ...resizableBoxProps } />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
SelectControl,
|
|
2
|
+
SelectControl as WCSelectControl,
|
|
3
3
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
4
4
|
} from '@wordpress/components';
|
|
5
5
|
import { __, _x } from '@wordpress/i18n';
|
|
@@ -42,7 +42,7 @@ export default function ResolutionTool( {
|
|
|
42
42
|
panelId={ panelId }
|
|
43
43
|
resetAllFilter={ resetAllFilter }
|
|
44
44
|
>
|
|
45
|
-
<
|
|
45
|
+
<WCSelectControl
|
|
46
46
|
label={ __( 'Resolution' ) }
|
|
47
47
|
value={ displayValue }
|
|
48
48
|
options={ options }
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
padding: 0;
|
|
11
11
|
position: absolute;
|
|
12
12
|
width: 1px;
|
|
13
|
-
|
|
14
|
-
word-wrap: normal !important;
|
|
13
|
+
overflow-wrap: normal !important;
|
|
15
14
|
word-break: normal !important;
|
|
16
15
|
}
|
|
17
16
|
|
|
@@ -2,7 +2,7 @@ import { describe, expect, it, vi } from 'vitest';
|
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import userEvent from '@testing-library/user-event';
|
|
4
4
|
import { Fragment, useState } from '@wordpress/element';
|
|
5
|
-
import { SelectControl } from '@wordpress/components';
|
|
5
|
+
import { SelectControl as WCSelectControl } from '@wordpress/components';
|
|
6
6
|
import ResponsiveBlockControl from '../index';
|
|
7
7
|
|
|
8
8
|
globalThis.wpVitest.mockMatchMedia();
|
|
@@ -31,7 +31,7 @@ const sizeOptions = [
|
|
|
31
31
|
const renderTestDefaultControlComponent = ( labelComponent, device ) => {
|
|
32
32
|
return (
|
|
33
33
|
<>
|
|
34
|
-
<
|
|
34
|
+
<WCSelectControl label={ labelComponent } options={ sizeOptions } />
|
|
35
35
|
<p id={ device.id }>
|
|
36
36
|
{ device.label } is used here for testing purposes to ensure we
|
|
37
37
|
have access to details about the device.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ENTER } from '@wordpress/keycodes';
|
|
2
1
|
import {
|
|
3
2
|
insert,
|
|
4
3
|
remove,
|
|
@@ -11,8 +10,15 @@ const { subscribeOwnedListener, ownsSelection } = unlock( richTextPrivateApis );
|
|
|
11
10
|
const { subscribeDelegatedListener } = unlock( composePrivateApis );
|
|
12
11
|
|
|
13
12
|
export default ( props ) => ( element ) => {
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
// Enter is handled on beforeinput: the input type tells a paragraph
|
|
14
|
+
// break from a line break. The iOS keyboard sends Return with the
|
|
15
|
+
// shift key down while it shows capitals, so the key event cannot.
|
|
16
|
+
function onBeforeInput( event ) {
|
|
17
|
+
const { inputType } = event;
|
|
18
|
+
if (
|
|
19
|
+
inputType !== 'insertParagraph' &&
|
|
20
|
+
inputType !== 'insertLineBreak'
|
|
21
|
+
) {
|
|
16
22
|
return;
|
|
17
23
|
}
|
|
18
24
|
|
|
@@ -33,7 +39,12 @@ export default ( props ) => ( element ) => {
|
|
|
33
39
|
const value = getValue();
|
|
34
40
|
const { text, start, end } = value;
|
|
35
41
|
|
|
36
|
-
|
|
42
|
+
// Flagged for the writing flow, which handles the event otherwise.
|
|
43
|
+
if ( inputType === 'insertParagraph' && onReplace && onSplit ) {
|
|
44
|
+
event.__deprecatedOnSplit = true;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if ( inputType === 'insertLineBreak' ) {
|
|
37
48
|
if ( ! disableLineBreaks ) {
|
|
38
49
|
event.preventDefault();
|
|
39
50
|
onChange( insert( value, '\n' ) );
|
|
@@ -43,7 +54,6 @@ export default ( props ) => ( element ) => {
|
|
|
43
54
|
onSplitAtEnd();
|
|
44
55
|
} else if (
|
|
45
56
|
! supportsSplitting &&
|
|
46
|
-
// The deprecated onSplit is flagged on the beforeinput event.
|
|
47
57
|
! ( onReplace && onSplit ) &&
|
|
48
58
|
! disableLineBreaks &&
|
|
49
59
|
! event.defaultPrevented
|
|
@@ -70,16 +80,6 @@ export default ( props ) => ( element ) => {
|
|
|
70
80
|
}
|
|
71
81
|
}
|
|
72
82
|
|
|
73
|
-
function onBeforeInput( event ) {
|
|
74
|
-
if ( event.inputType !== 'insertParagraph' ) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
const { onReplace, onSplit } = props.current;
|
|
78
|
-
if ( onReplace && onSplit ) {
|
|
79
|
-
event.__deprecatedOnSplit = true;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
83
|
function onDefaultBeforeInput( event ) {
|
|
84
84
|
if (
|
|
85
85
|
event.defaultPrevented ||
|
|
@@ -109,13 +109,7 @@ export default ( props ) => ( element ) => {
|
|
|
109
109
|
onDefaultBeforeInput
|
|
110
110
|
);
|
|
111
111
|
// Capture phase so this runs before ancestor (writing flow) bubble
|
|
112
|
-
// handlers
|
|
113
|
-
const unsubscribeKeyDown = subscribeOwnedListener(
|
|
114
|
-
element,
|
|
115
|
-
'keydown',
|
|
116
|
-
onKeyDown,
|
|
117
|
-
true
|
|
118
|
-
);
|
|
112
|
+
// handlers.
|
|
119
113
|
const unsubscribeBeforeInput = subscribeOwnedListener(
|
|
120
114
|
element,
|
|
121
115
|
'beforeinput',
|
|
@@ -124,7 +118,6 @@ export default ( props ) => ( element ) => {
|
|
|
124
118
|
);
|
|
125
119
|
return () => {
|
|
126
120
|
unsubscribeDefaultBeforeInput();
|
|
127
|
-
unsubscribeKeyDown();
|
|
128
121
|
unsubscribeBeforeInput();
|
|
129
122
|
};
|
|
130
123
|
};
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
useState,
|
|
6
6
|
useCallback,
|
|
7
7
|
useEffect,
|
|
8
|
+
useLayoutEffect,
|
|
8
9
|
useMemo,
|
|
9
10
|
forwardRef,
|
|
10
11
|
useContext,
|
|
@@ -203,14 +204,14 @@ function RichTextWrapper(
|
|
|
203
204
|
/* translators: %s: connected field label or source label */
|
|
204
205
|
__( 'Add %s' ),
|
|
205
206
|
bindingKey
|
|
206
|
-
|
|
207
|
+
);
|
|
207
208
|
const _bindingsLabel = _disableBoundBlock
|
|
208
209
|
? relatedBinding?.args?.key || blockBindingsSource?.label
|
|
209
210
|
: sprintf(
|
|
210
211
|
/* translators: %s: source label or key */
|
|
211
212
|
__( 'Empty %s; start writing to edit its value' ),
|
|
212
213
|
relatedBinding?.args?.key || blockBindingsSource?.label
|
|
213
|
-
|
|
214
|
+
);
|
|
214
215
|
|
|
215
216
|
return {
|
|
216
217
|
disableBoundBlock: _disableBoundBlock,
|
|
@@ -355,6 +356,42 @@ function RichTextWrapper(
|
|
|
355
356
|
[ identifier, clientId ]
|
|
356
357
|
),
|
|
357
358
|
} );
|
|
359
|
+
// Focus follows the selection while focus is inside the canvas or was
|
|
360
|
+
// lost to the body. Focus placed elsewhere stays. Runs after
|
|
361
|
+
// `useRichText` applied the content, so the field is current when its
|
|
362
|
+
// focus handler applies the selection.
|
|
363
|
+
useLayoutEffect( () => {
|
|
364
|
+
const element = anchorRef.current;
|
|
365
|
+
|
|
366
|
+
// A pointer press outside the field makes it non editable until the
|
|
367
|
+
// release (see rich text's preventFocusCapture). Focusing it then
|
|
368
|
+
// makes the block focus handler drop the text selection.
|
|
369
|
+
if ( ! isSelected || element?.contentEditable !== 'true' ) {
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
const { ownerDocument } = element;
|
|
374
|
+
// Focus lost to the body of the parent document (a removed toolbar
|
|
375
|
+
// button) leaves the frame document without focus.
|
|
376
|
+
const focusedDocument = [
|
|
377
|
+
ownerDocument,
|
|
378
|
+
ownerDocument.defaultView.frameElement?.ownerDocument,
|
|
379
|
+
].find( ( doc ) => doc?.hasFocus() );
|
|
380
|
+
|
|
381
|
+
if ( ! focusedDocument ) {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
const { activeElement, body } = focusedDocument;
|
|
386
|
+
const canvas = element.parentElement?.closest( '[contenteditable]' );
|
|
387
|
+
// A field inside an editing host cannot hold focus.
|
|
388
|
+
const target = canvas?.isContentEditable ? canvas : element;
|
|
389
|
+
|
|
390
|
+
if ( activeElement === body || canvas?.contains( activeElement ) ) {
|
|
391
|
+
target.focus();
|
|
392
|
+
}
|
|
393
|
+
}, [ selectionStart, selectionEnd, isSelected ] );
|
|
394
|
+
|
|
358
395
|
const autocompleteProps = useBlockEditorAutocompleteProps( {
|
|
359
396
|
onReplace,
|
|
360
397
|
completers: autocompleters,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { forwardRef, useInsertionEffect, useRef } from '@wordpress/element';
|
|
2
2
|
import deprecated from '@wordpress/deprecated';
|
|
3
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
3
|
+
import { useDispatch, useRegistry, useSelect } from '@wordpress/data';
|
|
4
4
|
import { ENTER } from '@wordpress/keycodes';
|
|
5
5
|
import {
|
|
6
6
|
create,
|
|
@@ -18,6 +18,7 @@ import { unlock } from '../../lock-unlock';
|
|
|
18
18
|
const { subscribeOwnedListener } = unlock( richTextPrivateApis );
|
|
19
19
|
|
|
20
20
|
function useEnterRef( props ) {
|
|
21
|
+
const registry = useRegistry();
|
|
21
22
|
const { getSelectionStart, getSelectionEnd } =
|
|
22
23
|
useSelect( blockEditorStore );
|
|
23
24
|
const { selectionChange } = useDispatch( blockEditorStore );
|
|
@@ -49,8 +50,15 @@ function useEnterRef( props ) {
|
|
|
49
50
|
|
|
50
51
|
const newValues = values.slice();
|
|
51
52
|
newValues.splice( index, 1, ...array );
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
registry.batch( () => {
|
|
54
|
+
onChange( newValues );
|
|
55
|
+
selectionChange(
|
|
56
|
+
clientId,
|
|
57
|
+
`${ identifier }-${ index + 1 }`,
|
|
58
|
+
0,
|
|
59
|
+
0
|
|
60
|
+
);
|
|
61
|
+
} );
|
|
54
62
|
}
|
|
55
63
|
// Capture phase so this runs before the generic rich text enter
|
|
56
64
|
// listener, which skips events that already had their default
|
|
@@ -29,7 +29,6 @@ import useSpacingSizes from '../hooks/use-spacing-sizes';
|
|
|
29
29
|
|
|
30
30
|
globalThis.wpVitest.mockMatchMedia();
|
|
31
31
|
|
|
32
|
-
globalThis.wpVitest.mockVisibleElements();
|
|
33
32
|
globalThis.wpVitest.mockScrollIntoView();
|
|
34
33
|
|
|
35
34
|
// Mock useSelect
|
|
@@ -761,26 +760,6 @@ describe( 'SpacingSizesControl', () => {
|
|
|
761
760
|
expect( screen.getAllByRole( 'combobox' ) ).toHaveLength( 2 ); // Vertical and Horizontal
|
|
762
761
|
} );
|
|
763
762
|
} );
|
|
764
|
-
|
|
765
|
-
it( 'can interact with select dropdown options', async () => {
|
|
766
|
-
const user = userEvent.setup();
|
|
767
|
-
|
|
768
|
-
render(
|
|
769
|
-
<SpacingSizesControl { ...defaultProps } values={ undefined } />
|
|
770
|
-
);
|
|
771
|
-
|
|
772
|
-
// With large preset sets, should use select dropdowns instead of sliders
|
|
773
|
-
await waitFor( () => {
|
|
774
|
-
expect( screen.getAllByRole( 'combobox' ) ).toHaveLength( 2 );
|
|
775
|
-
} );
|
|
776
|
-
|
|
777
|
-
// Click on the first combobox to open dropdown
|
|
778
|
-
const comboboxes = screen.getAllByRole( 'combobox' );
|
|
779
|
-
await user.click( comboboxes[ 0 ] );
|
|
780
|
-
|
|
781
|
-
// Should be able to interact with the dropdown
|
|
782
|
-
expect( comboboxes[ 0 ] ).toHaveAttribute( 'aria-expanded' );
|
|
783
|
-
} );
|
|
784
763
|
} );
|
|
785
764
|
|
|
786
765
|
describe( 'Edge Cases and Error Handling', () => {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { page, userEvent } from 'vitest/browser';
|
|
3
|
+
import { render } from 'vitest-browser-react';
|
|
4
|
+
import { screen } from '@testing-library/react';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { createElement } from '@wordpress/element';
|
|
7
|
+
import SpacingSizesControl from '../index';
|
|
8
|
+
|
|
9
|
+
vi.mock( import( '@wordpress/data' ), { spy: true } );
|
|
10
|
+
|
|
11
|
+
vi.mocked( useSelect ).mockReturnValue( false );
|
|
12
|
+
|
|
13
|
+
vi.mock( import( '../hooks/use-spacing-sizes' ), () => ( {
|
|
14
|
+
__esModule: true,
|
|
15
|
+
default: vi.fn( () =>
|
|
16
|
+
Array.from( { length: 15 }, ( _, index ) => ( {
|
|
17
|
+
name: `Size ${ index }`,
|
|
18
|
+
slug: `${ index * 10 }`,
|
|
19
|
+
size: `${ index * 0.5 }rem`,
|
|
20
|
+
} ) )
|
|
21
|
+
),
|
|
22
|
+
} ) );
|
|
23
|
+
|
|
24
|
+
vi.mock( import( '../../use-settings' ), () => ( {
|
|
25
|
+
useSettings: vi.fn( ( ...keys ) => {
|
|
26
|
+
const defaults = {
|
|
27
|
+
'spacing.units': [ 'px', 'em', 'rem' ],
|
|
28
|
+
'spacing.spacingSizes.custom': [],
|
|
29
|
+
'spacing.spacingSizes.theme': [],
|
|
30
|
+
'spacing.spacingSizes.default': [],
|
|
31
|
+
'spacing.defaultSpacingSizes': true,
|
|
32
|
+
};
|
|
33
|
+
return keys.map( ( key ) => defaults[ key ] );
|
|
34
|
+
} ),
|
|
35
|
+
} ) );
|
|
36
|
+
|
|
37
|
+
describe( 'SpacingSizesControl large preset sets', () => {
|
|
38
|
+
it( 'can interact with select dropdown options', async () => {
|
|
39
|
+
const user = userEvent.setup();
|
|
40
|
+
|
|
41
|
+
await render(
|
|
42
|
+
createElement( SpacingSizesControl, {
|
|
43
|
+
label: 'Padding',
|
|
44
|
+
onChange: vi.fn(),
|
|
45
|
+
} )
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const comboboxes = screen.getAllByRole( 'combobox' );
|
|
49
|
+
expect( comboboxes ).toHaveLength( 2 );
|
|
50
|
+
expect( comboboxes[ 0 ] ).toBeVisible();
|
|
51
|
+
|
|
52
|
+
await user.click( comboboxes[ 0 ] );
|
|
53
|
+
|
|
54
|
+
await expect
|
|
55
|
+
.element( page.getByRole( 'combobox', { expanded: true } ) )
|
|
56
|
+
.toBeVisible();
|
|
57
|
+
} );
|
|
58
|
+
} );
|
|
@@ -98,7 +98,7 @@ export function useTypewriter() {
|
|
|
98
98
|
const relativeScrollPosition = windowScroll
|
|
99
99
|
? caretRect.top / defaultView.innerHeight
|
|
100
100
|
: ( caretRect.top - scrollContainerY ) /
|
|
101
|
-
|
|
101
|
+
( defaultView.innerHeight - scrollContainerY );
|
|
102
102
|
|
|
103
103
|
// If the scroll position is at the start, the active editable element
|
|
104
104
|
// is the last one, and the caret is positioned within the initial
|
|
@@ -16,7 +16,7 @@ export const VALIDATED_INPUT_CONTROL_DEPRECATION =
|
|
|
16
16
|
* private `ValidatedInputControl`. No-op when validation did not run.
|
|
17
17
|
*/
|
|
18
18
|
export function expectValidatedInputControlDeprecationIfCalled() {
|
|
19
|
-
// eslint-disable-next-line no-console --
|
|
19
|
+
// eslint-disable-next-line no-console -- Inspect expected console warnings.
|
|
20
20
|
const deprecationCalls = console.warn.mock.calls.filter(
|
|
21
21
|
( [ message ] ) => message === VALIDATED_INPUT_CONTROL_DEPRECATION
|
|
22
22
|
);
|
|
@@ -50,6 +50,14 @@ export function useWritingFlow() {
|
|
|
50
50
|
( node ) => {
|
|
51
51
|
node.tabIndex = 0;
|
|
52
52
|
node.dataset.hasMultiSelection = hasMultiSelection;
|
|
53
|
+
// The wrapper is the canvas root: an editing host while
|
|
54
|
+
// a selection spans blocks or the selected block
|
|
55
|
+
// supports `editableRoot`, explicitly not one otherwise,
|
|
56
|
+
// so it can always be found as the outermost editable
|
|
57
|
+
// ancestor of a field.
|
|
58
|
+
if ( ! node.hasAttribute( 'contenteditable' ) ) {
|
|
59
|
+
node.contentEditable = false;
|
|
60
|
+
}
|
|
53
61
|
|
|
54
62
|
if ( ! hasMultiSelection ) {
|
|
55
63
|
return () => {
|
|
@@ -105,7 +105,7 @@ export default function useClipboardHandler() {
|
|
|
105
105
|
event.type === 'copy' || event.type === 'cut'
|
|
106
106
|
? documentHasUncollapsedSelection( ownerDocument )
|
|
107
107
|
: documentHasSelection( ownerDocument ) &&
|
|
108
|
-
|
|
108
|
+
! ownerDocument.activeElement.isContentEditable;
|
|
109
109
|
|
|
110
110
|
// Let native copy behaviour take over in input fields.
|
|
111
111
|
if ( hasSelection && ! isWholeSingleBlockCopy ) {
|
|
@@ -206,12 +206,21 @@ export default function useSelectionObserver() {
|
|
|
206
206
|
! isMultiSelecting()
|
|
207
207
|
) {
|
|
208
208
|
setContentEditableWrapper( node, false );
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
209
|
+
// Only return focus to the field if the wrapper had
|
|
210
|
+
// it. If Escape moved focus to the canvas stop in the
|
|
211
|
+
// parent document, the wrapper is only the stale
|
|
212
|
+
// active element and focus must not come back.
|
|
213
|
+
if (
|
|
214
|
+
ownerDocument.activeElement === node &&
|
|
215
|
+
ownerDocument.hasFocus()
|
|
216
|
+
) {
|
|
217
|
+
let element =
|
|
218
|
+
startNode.nodeType === startNode.ELEMENT_NODE
|
|
219
|
+
? startNode
|
|
220
|
+
: startNode.parentElement;
|
|
221
|
+
element = element?.closest( '[contenteditable]' );
|
|
222
|
+
element?.focus();
|
|
223
|
+
}
|
|
215
224
|
}
|
|
216
225
|
return;
|
|
217
226
|
}
|