@wordpress/block-editor 16.0.1-next.v.202607070741.0 → 16.1.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 +27 -1
- package/README.md +8 -0
- package/build/components/alignment-control/ui.cjs +2 -4
- package/build/components/alignment-control/ui.cjs.map +2 -2
- package/build/components/background-image-control/index.cjs +40 -10
- package/build/components/background-image-control/index.cjs.map +2 -2
- package/build/components/block-alignment-control/ui.cjs +5 -3
- package/build/components/block-alignment-control/ui.cjs.map +2 -2
- package/build/components/block-canvas/index.cjs +6 -1
- package/build/components/block-canvas/index.cjs.map +2 -2
- package/build/components/block-controls/groups.cjs +3 -1
- package/build/components/block-controls/groups.cjs.map +2 -2
- package/build/components/block-edit/edit.cjs +10 -18
- package/build/components/block-edit/edit.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +73 -46
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/block-list/block-html.cjs +4 -1
- package/build/components/block-list/block-html.cjs.map +2 -2
- package/build/components/block-list/block.cjs +9 -3
- package/build/components/block-list/block.cjs.map +3 -3
- package/build/components/block-list/index.cjs +1 -3
- package/build/components/block-list/index.cjs.map +2 -2
- package/build/components/block-list/use-block-props/index.cjs +7 -2
- package/build/components/block-list/use-block-props/index.cjs.map +2 -2
- package/build/components/block-list/use-block-props/use-focus-first-element.cjs +9 -4
- package/build/components/block-list/use-block-props/use-focus-first-element.cjs.map +2 -2
- package/build/components/block-list/use-block-props/use-focus-handler.cjs +11 -4
- package/build/components/block-list/use-block-props/use-focus-handler.cjs.map +2 -2
- package/build/components/block-list/use-block-props/use-register-block-event-handlers.cjs +48 -0
- package/build/components/block-list/use-block-props/use-register-block-event-handlers.cjs.map +7 -0
- package/build/components/block-parent-selector/index.cjs +2 -2
- package/build/components/block-parent-selector/index.cjs.map +2 -2
- package/build/components/block-toolbar/index.cjs +43 -24
- package/build/components/block-toolbar/index.cjs.map +2 -2
- package/build/components/block-toolbar/switch-section-style.cjs +4 -2
- package/build/components/block-toolbar/switch-section-style.cjs.map +3 -3
- package/build/components/block-tools/empty-block-inserter.cjs +2 -7
- package/build/components/block-tools/empty-block-inserter.cjs.map +2 -2
- package/build/components/block-tools/index.cjs +7 -2
- package/build/components/block-tools/index.cjs.map +2 -2
- package/build/components/block-vertical-alignment-control/ui.cjs +3 -5
- package/build/components/block-vertical-alignment-control/ui.cjs.map +2 -2
- package/build/components/block-visibility/modal.cjs +20 -6
- package/build/components/block-visibility/modal.cjs.map +2 -2
- package/build/components/block-visibility/use-block-visibility.cjs +16 -6
- package/build/components/block-visibility/use-block-visibility.cjs.map +3 -3
- package/build/components/block-visibility/utils.cjs +15 -2
- package/build/components/block-visibility/utils.cjs.map +3 -3
- package/build/components/block-visibility/viewport-menu-item.cjs +7 -1
- package/build/components/block-visibility/viewport-menu-item.cjs.map +2 -2
- package/build/components/block-visibility/viewport-toolbar.cjs +5 -0
- package/build/components/block-visibility/viewport-toolbar.cjs.map +2 -2
- package/build/components/block-visibility/viewport-visibility-info.cjs +5 -1
- package/build/components/block-visibility/viewport-visibility-info.cjs.map +2 -2
- package/build/components/border-radius-control/utils.cjs +8 -58
- package/build/components/border-radius-control/utils.cjs.map +2 -2
- package/build/components/child-layout-control/index.cjs +0 -4
- package/build/components/child-layout-control/index.cjs.map +2 -2
- package/build/components/colors-gradients/control.cjs +5 -3
- package/build/components/colors-gradients/control.cjs.map +2 -2
- package/build/components/dimension-control/index.cjs +30 -20
- package/build/components/dimension-control/index.cjs.map +3 -3
- package/build/components/dimensions-tool/aspect-ratio-tool.cjs +9 -2
- package/build/components/dimensions-tool/aspect-ratio-tool.cjs.map +3 -3
- package/build/components/editor-styles/index.cjs +9 -1
- package/build/components/editor-styles/index.cjs.map +2 -2
- package/build/components/global-styles/background-panel.cjs +66 -25
- package/build/components/global-styles/background-panel.cjs.map +3 -3
- package/build/components/global-styles/border-panel.cjs +153 -55
- package/build/components/global-styles/border-panel.cjs.map +3 -3
- package/build/components/global-styles/color-gradient-dropdown-item.cjs +46 -14
- package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +3 -3
- package/build/components/global-styles/color-panel.cjs +63 -17
- package/build/components/global-styles/color-panel.cjs.map +2 -2
- package/build/components/global-styles/dimensions-panel.cjs +242 -64
- package/build/components/global-styles/dimensions-panel.cjs.map +3 -3
- package/build/components/global-styles/filters-panel.cjs +59 -20
- package/build/components/global-styles/filters-panel.cjs.map +3 -3
- package/build/components/global-styles/hooks.cjs +4 -1
- package/build/components/global-styles/hooks.cjs.map +2 -2
- package/build/components/global-styles/inheritance/index.cjs +142 -0
- package/build/components/global-styles/inheritance/index.cjs.map +7 -0
- package/build/components/global-styles/inherited-value-context.cjs +173 -0
- package/build/components/global-styles/inherited-value-context.cjs.map +7 -0
- package/build/components/global-styles/shadow-panel-components.cjs +38 -20
- package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
- package/build/components/global-styles/state-control-badges.cjs +39 -3
- package/build/components/global-styles/state-control-badges.cjs.map +2 -2
- package/build/components/global-styles/state-control.cjs +1 -1
- package/build/components/global-styles/state-control.cjs.map +2 -2
- package/build/components/global-styles/typography-panel.cjs +271 -79
- package/build/components/global-styles/typography-panel.cjs.map +3 -3
- package/build/components/image-size-control/index.cjs +2 -4
- package/build/components/image-size-control/index.cjs.map +2 -2
- package/build/components/inserter/media-tab/hooks.cjs +33 -6
- package/build/components/inserter/media-tab/hooks.cjs.map +2 -2
- package/build/components/inserter/media-tab/media-panel.cjs +78 -16
- package/build/components/inserter/media-tab/media-panel.cjs.map +3 -3
- package/build/components/inspector-controls-tabs/styles-tab.cjs +10 -1
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
- package/build/components/keyboard-shortcuts/index.cjs +19 -11
- package/build/components/keyboard-shortcuts/index.cjs.map +2 -2
- package/build/components/line-height-control/index.cjs +1 -2
- package/build/components/line-height-control/index.cjs.map +2 -2
- package/build/components/link-control/index.cjs +3 -1
- package/build/components/link-control/index.cjs.map +2 -2
- package/build/components/list-view/block.cjs +13 -4
- package/build/components/list-view/block.cjs.map +2 -2
- package/build/components/media-placeholder/index.cjs +0 -1
- package/build/components/media-placeholder/index.cjs.map +2 -2
- package/build/components/preset-input-control/index.cjs +2 -1
- package/build/components/preset-input-control/index.cjs.map +2 -2
- package/build/components/provider/block-refs-provider.cjs +8 -2
- package/build/components/provider/block-refs-provider.cjs.map +2 -2
- package/build/components/provider/index.cjs +1 -1
- package/build/components/provider/index.cjs.map +2 -2
- package/build/components/provider/use-block-sync.cjs +18 -6
- package/build/components/provider/use-block-sync.cjs.map +2 -2
- package/build/components/provider/use-media-upload-settings.cjs +3 -1
- package/build/components/provider/use-media-upload-settings.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/before-input-rules.cjs +3 -4
- package/build/components/rich-text/event-listeners/before-input-rules.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/delete.cjs +2 -3
- package/build/components/rich-text/event-listeners/delete.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/enter.cjs +3 -2
- package/build/components/rich-text/event-listeners/enter.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/input-events.cjs +3 -3
- package/build/components/rich-text/event-listeners/input-events.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/input-rules.cjs +3 -4
- package/build/components/rich-text/event-listeners/input-rules.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/insert-replacement-text.cjs +3 -3
- package/build/components/rich-text/event-listeners/insert-replacement-text.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/paste-handler.cjs +2 -1
- package/build/components/rich-text/event-listeners/paste-handler.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/remove-browser-shortcuts.cjs +3 -3
- package/build/components/rich-text/event-listeners/remove-browser-shortcuts.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/shortcuts.cjs +3 -3
- package/build/components/rich-text/event-listeners/shortcuts.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/undo-automatic-change.cjs +3 -3
- package/build/components/rich-text/event-listeners/undo-automatic-change.cjs.map +3 -3
- package/build/components/rich-text/index.cjs +76 -17
- package/build/components/rich-text/index.cjs.map +2 -2
- package/build/components/spacing-sizes-control/utils.cjs +6 -19
- package/build/components/spacing-sizes-control/utils.cjs.map +2 -2
- package/build/components/text-indent-control/index.cjs +8 -2
- package/build/components/text-indent-control/index.cjs.map +2 -2
- package/build/components/typewriter/index.cjs +129 -136
- package/build/components/typewriter/index.cjs.map +3 -3
- package/build/components/url-input/index.cjs +303 -344
- package/build/components/url-input/index.cjs.map +3 -3
- package/build/components/use-block-commands/index.cjs +21 -17
- package/build/components/use-block-commands/index.cjs.map +2 -2
- package/build/components/use-on-block-drop/index.cjs +1 -1
- package/build/components/use-on-block-drop/index.cjs.map +2 -2
- package/build/components/writing-flow/index.cjs +14 -1
- package/build/components/writing-flow/index.cjs.map +3 -3
- package/build/components/writing-flow/use-arrow-nav.cjs +42 -6
- package/build/components/writing-flow/use-arrow-nav.cjs.map +2 -2
- package/build/components/writing-flow/use-click-selection.cjs +29 -3
- package/build/components/writing-flow/use-click-selection.cjs.map +2 -2
- package/build/components/writing-flow/use-clipboard-handler.cjs +4 -1
- package/build/components/writing-flow/use-clipboard-handler.cjs.map +2 -2
- package/build/components/writing-flow/use-drag-selection.cjs +3 -8
- package/build/components/writing-flow/use-drag-selection.cjs.map +2 -2
- package/build/components/writing-flow/use-editable-root-event-handlers.cjs +179 -0
- package/build/components/writing-flow/use-editable-root-event-handlers.cjs.map +7 -0
- package/build/components/writing-flow/use-editable-root.cjs +75 -0
- package/build/components/writing-flow/use-editable-root.cjs.map +7 -0
- package/build/components/writing-flow/use-home-end.cjs +64 -0
- package/build/components/writing-flow/use-home-end.cjs.map +7 -0
- package/build/components/writing-flow/use-input.cjs +15 -5
- package/build/components/writing-flow/use-input.cjs.map +2 -2
- package/build/components/writing-flow/use-multi-selection.cjs +2 -2
- package/build/components/writing-flow/use-multi-selection.cjs.map +2 -2
- package/build/components/writing-flow/use-select-all.cjs +14 -2
- package/build/components/writing-flow/use-select-all.cjs.map +2 -2
- package/build/components/writing-flow/use-selection-observer.cjs +132 -22
- package/build/components/writing-flow/use-selection-observer.cjs.map +3 -3
- package/build/components/writing-flow/utils.cjs +28 -2
- package/build/components/writing-flow/utils.cjs.map +2 -2
- package/build/hooks/background.cjs +14 -10
- package/build/hooks/background.cjs.map +2 -2
- package/build/hooks/block-fields/rich-text/index.cjs +2 -3
- package/build/hooks/block-fields/rich-text/index.cjs.map +3 -3
- package/build/hooks/block-style-variation.cjs +4 -45
- package/build/hooks/block-style-variation.cjs.map +3 -3
- package/build/hooks/border.cjs +19 -4
- package/build/hooks/border.cjs.map +2 -2
- package/build/hooks/custom-css.cjs +6 -2
- package/build/hooks/custom-css.cjs.map +2 -2
- package/build/hooks/dimensions.cjs +15 -4
- package/build/hooks/dimensions.cjs.map +2 -2
- package/build/hooks/duotone.cjs +26 -14
- package/build/hooks/duotone.cjs.map +3 -3
- package/build/hooks/elements.cjs +15 -5
- package/build/hooks/elements.cjs.map +2 -2
- package/build/hooks/grid-visualizer.cjs +5 -3
- package/build/hooks/grid-visualizer.cjs.map +2 -2
- package/build/hooks/layout-child.cjs +22 -12
- package/build/hooks/layout-child.cjs.map +3 -3
- package/build/hooks/layout.cjs +28 -13
- package/build/hooks/layout.cjs.map +3 -3
- package/build/hooks/line-height.cjs +1 -2
- package/build/hooks/line-height.cjs.map +2 -2
- package/build/hooks/states.cjs +27 -7
- package/build/hooks/states.cjs.map +3 -3
- package/build/hooks/style.cjs +31 -9
- package/build/hooks/style.cjs.map +3 -3
- package/build/hooks/text-align.cjs +36 -6
- package/build/hooks/text-align.cjs.map +3 -3
- package/build/hooks/typography.cjs +14 -5
- package/build/hooks/typography.cjs.map +2 -2
- package/build/layouts/constrained.cjs +14 -6
- package/build/layouts/constrained.cjs.map +2 -2
- package/build/layouts/flex.cjs +27 -19
- package/build/layouts/flex.cjs.map +2 -2
- package/build/layouts/grid.cjs +0 -2
- package/build/layouts/grid.cjs.map +2 -2
- package/build/private-apis.cjs +9 -5
- package/build/private-apis.cjs.map +3 -3
- package/build/store/actions.cjs +11 -6
- package/build/store/actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +41 -3
- package/build/store/private-selectors.cjs.map +3 -3
- package/build/store/reducer.cjs +6 -6
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +23 -0
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/block-bindings.cjs +29 -0
- package/build/utils/block-bindings.cjs.map +2 -2
- package/build/utils/dom.cjs +14 -0
- package/build/utils/dom.cjs.map +2 -2
- package/build/{components/rich-text/input-event.cjs → utils/native-undo.cjs} +29 -24
- package/build/utils/native-undo.cjs.map +7 -0
- package/build-module/components/alignment-control/ui.mjs +2 -4
- package/build-module/components/alignment-control/ui.mjs.map +2 -2
- package/build-module/components/background-image-control/index.mjs +43 -10
- package/build-module/components/background-image-control/index.mjs.map +2 -2
- package/build-module/components/block-alignment-control/ui.mjs +5 -3
- package/build-module/components/block-alignment-control/ui.mjs.map +2 -2
- package/build-module/components/block-canvas/index.mjs +7 -2
- package/build-module/components/block-canvas/index.mjs.map +2 -2
- package/build-module/components/block-controls/groups.mjs +3 -1
- package/build-module/components/block-controls/groups.mjs.map +2 -2
- package/build-module/components/block-edit/edit.mjs +11 -18
- package/build-module/components/block-edit/edit.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +74 -46
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-list/block-html.mjs +4 -1
- package/build-module/components/block-list/block-html.mjs.map +2 -2
- package/build-module/components/block-list/block.mjs +9 -3
- package/build-module/components/block-list/block.mjs.map +3 -3
- package/build-module/components/block-list/index.mjs +1 -3
- package/build-module/components/block-list/index.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/index.mjs +7 -2
- package/build-module/components/block-list/use-block-props/index.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-focus-first-element.mjs +9 -4
- package/build-module/components/block-list/use-block-props/use-focus-first-element.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-focus-handler.mjs +11 -4
- package/build-module/components/block-list/use-block-props/use-focus-handler.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-register-block-event-handlers.mjs +28 -0
- package/build-module/components/block-list/use-block-props/use-register-block-event-handlers.mjs.map +7 -0
- package/build-module/components/block-parent-selector/index.mjs +2 -2
- package/build-module/components/block-parent-selector/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/index.mjs +43 -24
- package/build-module/components/block-toolbar/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/switch-section-style.mjs +4 -2
- package/build-module/components/block-toolbar/switch-section-style.mjs.map +2 -2
- package/build-module/components/block-tools/empty-block-inserter.mjs +2 -7
- package/build-module/components/block-tools/empty-block-inserter.mjs.map +2 -2
- package/build-module/components/block-tools/index.mjs +7 -2
- package/build-module/components/block-tools/index.mjs.map +2 -2
- package/build-module/components/block-vertical-alignment-control/ui.mjs +4 -6
- package/build-module/components/block-vertical-alignment-control/ui.mjs.map +2 -2
- package/build-module/components/block-visibility/modal.mjs +22 -10
- package/build-module/components/block-visibility/modal.mjs.map +2 -2
- package/build-module/components/block-visibility/use-block-visibility.mjs +17 -7
- package/build-module/components/block-visibility/use-block-visibility.mjs.map +2 -2
- package/build-module/components/block-visibility/utils.mjs +18 -3
- package/build-module/components/block-visibility/utils.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-menu-item.mjs +7 -1
- package/build-module/components/block-visibility/viewport-menu-item.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-toolbar.mjs +5 -0
- package/build-module/components/block-visibility/viewport-toolbar.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-visibility-info.mjs +5 -1
- package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +2 -2
- package/build-module/components/border-radius-control/utils.mjs +11 -53
- package/build-module/components/border-radius-control/utils.mjs.map +2 -2
- package/build-module/components/child-layout-control/index.mjs +0 -4
- package/build-module/components/child-layout-control/index.mjs.map +2 -2
- package/build-module/components/colors-gradients/control.mjs +5 -3
- package/build-module/components/colors-gradients/control.mjs.map +2 -2
- package/build-module/components/dimension-control/index.mjs +30 -20
- package/build-module/components/dimension-control/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs +10 -6
- package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs.map +2 -2
- package/build-module/components/editor-styles/index.mjs +9 -1
- package/build-module/components/editor-styles/index.mjs.map +2 -2
- package/build-module/components/global-styles/background-panel.mjs +71 -29
- package/build-module/components/global-styles/background-panel.mjs.map +2 -2
- package/build-module/components/global-styles/border-panel.mjs +157 -56
- package/build-module/components/global-styles/border-panel.mjs.map +2 -2
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +51 -15
- package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +2 -2
- package/build-module/components/global-styles/color-panel.mjs +63 -17
- package/build-module/components/global-styles/color-panel.mjs.map +2 -2
- package/build-module/components/global-styles/dimensions-panel.mjs +248 -66
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/filters-panel.mjs +64 -21
- package/build-module/components/global-styles/filters-panel.mjs.map +2 -2
- package/build-module/components/global-styles/hooks.mjs +4 -1
- package/build-module/components/global-styles/hooks.mjs.map +2 -2
- package/build-module/components/global-styles/inheritance/index.mjs +108 -0
- package/build-module/components/global-styles/inheritance/index.mjs.map +7 -0
- package/build-module/components/global-styles/inherited-value-context.mjs +141 -0
- package/build-module/components/global-styles/inherited-value-context.mjs.map +7 -0
- package/build-module/components/global-styles/shadow-panel-components.mjs +38 -20
- package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
- package/build-module/components/global-styles/state-control-badges.mjs +41 -5
- package/build-module/components/global-styles/state-control-badges.mjs.map +2 -2
- package/build-module/components/global-styles/state-control.mjs +1 -1
- package/build-module/components/global-styles/state-control.mjs.map +2 -2
- package/build-module/components/global-styles/typography-panel.mjs +276 -80
- package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
- package/build-module/components/image-size-control/index.mjs +2 -4
- package/build-module/components/image-size-control/index.mjs.map +2 -2
- package/build-module/components/inserter/media-tab/hooks.mjs +33 -6
- package/build-module/components/inserter/media-tab/hooks.mjs.map +2 -2
- package/build-module/components/inserter/media-tab/media-panel.mjs +86 -18
- package/build-module/components/inserter/media-tab/media-panel.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +6 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/keyboard-shortcuts/index.mjs +19 -11
- package/build-module/components/keyboard-shortcuts/index.mjs.map +2 -2
- package/build-module/components/line-height-control/index.mjs +1 -2
- package/build-module/components/line-height-control/index.mjs.map +2 -2
- package/build-module/components/link-control/index.mjs +4 -2
- package/build-module/components/link-control/index.mjs.map +2 -2
- package/build-module/components/list-view/block.mjs +13 -4
- package/build-module/components/list-view/block.mjs.map +2 -2
- package/build-module/components/media-placeholder/index.mjs +0 -1
- package/build-module/components/media-placeholder/index.mjs.map +2 -2
- package/build-module/components/preset-input-control/index.mjs +2 -1
- package/build-module/components/preset-input-control/index.mjs.map +2 -2
- package/build-module/components/provider/block-refs-provider.mjs +8 -2
- package/build-module/components/provider/block-refs-provider.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +1 -1
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/use-block-sync.mjs +18 -6
- package/build-module/components/provider/use-block-sync.mjs.map +2 -2
- package/build-module/components/provider/use-media-upload-settings.mjs +3 -1
- package/build-module/components/provider/use-media-upload-settings.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs +8 -5
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/delete.mjs +7 -4
- package/build-module/components/rich-text/event-listeners/delete.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs +8 -3
- package/build-module/components/rich-text/event-listeners/enter.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/input-events.mjs +3 -3
- package/build-module/components/rich-text/event-listeners/input-events.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/input-rules.mjs +8 -5
- package/build-module/components/rich-text/event-listeners/input-rules.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.mjs +3 -3
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs +8 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.mjs +3 -3
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/shortcuts.mjs +3 -3
- package/build-module/components/rich-text/event-listeners/shortcuts.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs +3 -3
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs.map +2 -2
- package/build-module/components/rich-text/index.mjs +79 -14
- package/build-module/components/rich-text/index.mjs.map +2 -2
- package/build-module/components/spacing-sizes-control/utils.mjs +6 -18
- package/build-module/components/spacing-sizes-control/utils.mjs.map +2 -2
- package/build-module/components/text-indent-control/index.mjs +8 -2
- package/build-module/components/text-indent-control/index.mjs.map +2 -2
- package/build-module/components/typewriter/index.mjs +129 -136
- package/build-module/components/typewriter/index.mjs.map +2 -2
- package/build-module/components/url-input/index.mjs +306 -353
- package/build-module/components/url-input/index.mjs.map +2 -2
- package/build-module/components/use-block-commands/index.mjs +21 -17
- package/build-module/components/use-block-commands/index.mjs.map +2 -2
- package/build-module/components/use-on-block-drop/index.mjs +2 -2
- package/build-module/components/use-on-block-drop/index.mjs.map +2 -2
- package/build-module/components/writing-flow/index.mjs +14 -1
- package/build-module/components/writing-flow/index.mjs.map +2 -2
- package/build-module/components/writing-flow/use-arrow-nav.mjs +43 -7
- package/build-module/components/writing-flow/use-arrow-nav.mjs.map +2 -2
- package/build-module/components/writing-flow/use-click-selection.mjs +29 -3
- package/build-module/components/writing-flow/use-click-selection.mjs.map +2 -2
- package/build-module/components/writing-flow/use-clipboard-handler.mjs +5 -2
- package/build-module/components/writing-flow/use-clipboard-handler.mjs.map +2 -2
- package/build-module/components/writing-flow/use-drag-selection.mjs +1 -6
- package/build-module/components/writing-flow/use-drag-selection.mjs.map +2 -2
- package/build-module/components/writing-flow/use-editable-root-event-handlers.mjs +154 -0
- package/build-module/components/writing-flow/use-editable-root-event-handlers.mjs.map +7 -0
- package/build-module/components/writing-flow/use-editable-root.mjs +54 -0
- package/build-module/components/writing-flow/use-editable-root.mjs.map +7 -0
- package/build-module/components/writing-flow/use-home-end.mjs +43 -0
- package/build-module/components/writing-flow/use-home-end.mjs.map +7 -0
- package/build-module/components/writing-flow/use-input.mjs +15 -5
- package/build-module/components/writing-flow/use-input.mjs.map +2 -2
- package/build-module/components/writing-flow/use-multi-selection.mjs +2 -2
- package/build-module/components/writing-flow/use-multi-selection.mjs.map +2 -2
- package/build-module/components/writing-flow/use-select-all.mjs +19 -3
- package/build-module/components/writing-flow/use-select-all.mjs.map +2 -2
- package/build-module/components/writing-flow/use-selection-observer.mjs +134 -21
- package/build-module/components/writing-flow/use-selection-observer.mjs.map +2 -2
- package/build-module/components/writing-flow/utils.mjs +26 -1
- package/build-module/components/writing-flow/utils.mjs.map +2 -2
- package/build-module/hooks/background.mjs +14 -10
- package/build-module/hooks/background.mjs.map +2 -2
- package/build-module/hooks/block-fields/rich-text/index.mjs +2 -6
- package/build-module/hooks/block-fields/rich-text/index.mjs.map +2 -2
- package/build-module/hooks/block-style-variation.mjs +8 -44
- package/build-module/hooks/block-style-variation.mjs.map +2 -2
- package/build-module/hooks/border.mjs +19 -4
- package/build-module/hooks/border.mjs.map +2 -2
- package/build-module/hooks/custom-css.mjs +7 -3
- package/build-module/hooks/custom-css.mjs.map +2 -2
- package/build-module/hooks/dimensions.mjs +15 -4
- package/build-module/hooks/dimensions.mjs.map +2 -2
- package/build-module/hooks/duotone.mjs +20 -9
- package/build-module/hooks/duotone.mjs.map +2 -2
- package/build-module/hooks/elements.mjs +15 -5
- package/build-module/hooks/elements.mjs.map +2 -2
- package/build-module/hooks/grid-visualizer.mjs +5 -3
- package/build-module/hooks/grid-visualizer.mjs.map +2 -2
- package/build-module/hooks/layout-child.mjs +22 -12
- package/build-module/hooks/layout-child.mjs.map +2 -2
- package/build-module/hooks/layout.mjs +28 -13
- package/build-module/hooks/layout.mjs.map +2 -2
- package/build-module/hooks/line-height.mjs +1 -2
- package/build-module/hooks/line-height.mjs.map +2 -2
- package/build-module/hooks/states.mjs +27 -7
- package/build-module/hooks/states.mjs.map +2 -2
- package/build-module/hooks/style.mjs +40 -11
- package/build-module/hooks/style.mjs.map +2 -2
- package/build-module/hooks/text-align.mjs +39 -10
- package/build-module/hooks/text-align.mjs.map +2 -2
- package/build-module/hooks/typography.mjs +14 -5
- package/build-module/hooks/typography.mjs.map +2 -2
- package/build-module/layouts/constrained.mjs +14 -6
- package/build-module/layouts/constrained.mjs.map +2 -2
- package/build-module/layouts/flex.mjs +27 -19
- package/build-module/layouts/flex.mjs.map +2 -2
- package/build-module/layouts/grid.mjs +0 -2
- package/build-module/layouts/grid.mjs.map +2 -2
- package/build-module/private-apis.mjs +7 -3
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/actions.mjs +12 -7
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +42 -3
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +6 -6
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +23 -0
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/block-bindings.mjs +28 -0
- package/build-module/utils/block-bindings.mjs.map +2 -2
- package/build-module/utils/dom.mjs +13 -0
- package/build-module/utils/dom.mjs.map +2 -2
- package/build-module/utils/native-undo.mjs +29 -0
- package/build-module/utils/native-undo.mjs.map +7 -0
- package/build-style/content-rtl.css +14 -27
- package/build-style/content.css +14 -27
- package/build-style/default-editor-styles-rtl.css +1 -1
- package/build-style/default-editor-styles.css +1 -1
- package/build-style/style-rtl.css +191 -61
- package/build-style/style.css +191 -61
- package/build-types/components/block-context/index.d.ts +7 -0
- package/build-types/components/block-context/index.d.ts.map +1 -1
- package/build-types/utils/block-bindings.d.ts +19 -0
- package/build-types/utils/block-bindings.d.ts.map +1 -1
- package/build-types/utils/dom.d.ts +11 -0
- package/build-types/utils/dom.d.ts.map +1 -1
- package/build-types/utils/get-px-from-css-unit.d.ts +2 -2
- package/build-types/utils/get-px-from-css-unit.d.ts.map +1 -1
- package/build-types/utils/pasting.d.ts +1 -1
- package/build-types/utils/pasting.d.ts.map +1 -1
- package/package.json +43 -44
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +1 -1
- package/src/components/alignment-control/ui.js +2 -4
- package/src/components/background-image-control/index.js +74 -37
- package/src/components/background-image-control/style.scss +13 -4
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +3 -3
- package/src/components/block-alignment-control/test/index.js +1 -1
- package/src/components/block-alignment-control/ui.js +4 -2
- package/src/components/block-breadcrumb/test/__snapshots__/index.js.snap +1 -1
- package/src/components/block-canvas/index.js +9 -2
- package/src/components/block-card/style.scss +1 -1
- package/src/components/block-compare/test/__snapshots__/block-view.js.snap +1 -1
- package/src/components/block-controls/groups.js +2 -0
- package/src/components/block-edit/edit.js +13 -31
- package/src/components/block-icon/test/__snapshots__/index.js.snap +1 -1
- package/src/components/block-inspector/index.js +60 -31
- package/src/components/block-list/block-html.js +5 -0
- package/src/components/block-list/block.js +6 -0
- package/src/components/block-list/content.scss +1 -11
- package/src/components/block-list/index.js +0 -2
- package/src/components/block-list/use-block-props/index.js +7 -1
- package/src/components/block-list/use-block-props/use-focus-first-element.js +23 -4
- package/src/components/block-list/use-block-props/use-focus-handler.js +35 -9
- package/src/components/block-list/use-block-props/use-register-block-event-handlers.js +45 -0
- package/src/components/block-lock/style.scss +1 -1
- package/src/components/block-manager/style.scss +1 -1
- package/src/components/block-navigation/style.scss +1 -1
- package/src/components/block-parent-selector/index.js +5 -2
- package/src/components/block-quick-navigation/style.scss +1 -3
- package/src/components/block-styles/style.scss +2 -2
- package/src/components/block-toolbar/index.js +41 -18
- package/src/components/block-toolbar/switch-section-style.js +5 -2
- package/src/components/block-tools/empty-block-inserter.js +3 -7
- package/src/components/block-tools/index.js +7 -0
- package/src/components/block-types-list/style.scss +0 -1
- package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +3 -3
- package/src/components/block-vertical-alignment-control/test/index.js +18 -2
- package/src/components/block-vertical-alignment-control/ui.js +3 -5
- package/src/components/block-visibility/modal.js +24 -10
- package/src/components/block-visibility/style.scss +1 -1
- package/src/components/block-visibility/test/use-block-visibility.js +128 -35
- package/src/components/block-visibility/test/utils.js +11 -0
- package/src/components/block-visibility/use-block-visibility.js +33 -11
- package/src/components/block-visibility/utils.js +31 -6
- package/src/components/block-visibility/viewport-menu-item.js +10 -1
- package/src/components/block-visibility/viewport-toolbar.js +6 -0
- package/src/components/block-visibility/viewport-visibility-info.js +5 -1
- package/src/components/border-radius-control/test/utils.js +0 -41
- package/src/components/border-radius-control/utils.js +16 -107
- package/src/components/button-block-appender/content.scss +7 -9
- package/src/components/child-layout-control/index.js +0 -4
- package/src/components/color-palette/test/__snapshots__/control.js.snap +3 -3
- package/src/components/colors-gradients/control.js +6 -3
- package/src/components/default-block-appender/test/__snapshots__/index.js.snap +1 -1
- package/src/components/dimension-control/index.js +13 -1
- package/src/components/dimensions-tool/aspect-ratio-tool.js +13 -6
- package/src/components/editor-styles/index.js +16 -1
- package/src/components/font-family/stories/index.story.jsx +1 -1
- package/src/components/global-styles/background-panel.js +107 -34
- package/src/components/global-styles/border-panel.js +219 -48
- package/src/components/global-styles/color-gradient-dropdown-item.js +93 -28
- package/src/components/global-styles/color-panel.js +92 -11
- package/src/components/global-styles/dimensions-panel.js +422 -71
- package/src/components/global-styles/filters-panel.js +88 -28
- package/src/components/global-styles/hooks.js +8 -1
- package/src/components/global-styles/inheritance/index.js +204 -0
- package/src/components/global-styles/inheritance/style.scss +184 -0
- package/src/components/global-styles/inheritance/test/index.js +281 -0
- package/src/components/global-styles/inherited-value-context.js +271 -0
- package/src/components/global-styles/shadow-panel-components.js +48 -26
- package/src/components/global-styles/state-control-badges.js +45 -6
- package/src/components/global-styles/state-control.js +2 -2
- package/src/components/global-styles/style.scss +5 -0
- package/src/components/global-styles/test/background-panel.js +338 -1
- package/src/components/global-styles/test/border-panel.js +441 -0
- package/src/components/global-styles/test/color-panel.js +182 -2
- package/src/components/global-styles/test/dimensions-panel.js +753 -0
- package/src/components/global-styles/test/filters-panel.js +194 -0
- package/src/components/global-styles/test/inherited-value-context-core.js +98 -0
- package/src/components/global-styles/test/inherited-value-context.js +454 -0
- package/src/components/global-styles/test/state-control-badges.js +65 -0
- package/src/components/global-styles/test/typography-panel-core.js +185 -0
- package/src/components/global-styles/test/typography-panel.js +849 -12
- package/src/components/global-styles/typography-panel.js +449 -101
- package/src/components/image-editor/style.scss +33 -0
- package/src/components/image-size-control/index.js +0 -2
- package/src/components/inner-blocks/test/__snapshots__/index.js.snap +1 -1
- package/src/components/inserter/media-tab/hooks.js +55 -7
- package/src/components/inserter/media-tab/media-panel.js +117 -21
- package/src/components/inserter/media-tab/test/hooks.js +63 -0
- package/src/components/inserter/media-tab/test/media-panel.js +127 -0
- package/src/components/inserter/style.scss +19 -16
- package/src/components/inserter-list-item/style.scss +0 -15
- package/src/components/inspector-controls-tabs/styles-tab.js +5 -1
- package/src/components/keyboard-shortcuts/index.js +28 -11
- package/src/components/line-height-control/index.js +1 -2
- package/src/components/link-control/index.js +7 -2
- package/src/components/link-control/style.scss +2 -2
- package/src/components/link-control/test/index.js +6 -6
- package/src/components/link-picker/style.scss +1 -2
- package/src/components/list-view/block.js +13 -4
- package/src/components/list-view/style.scss +4 -5
- package/src/components/media-placeholder/index.js +0 -1
- package/src/components/multi-selection-inspector/style.scss +1 -1
- package/src/components/preset-input-control/index.js +4 -1
- package/src/components/provider/block-refs-provider.js +12 -2
- package/src/components/provider/index.js +2 -2
- package/src/components/provider/use-block-sync.js +18 -6
- package/src/components/provider/use-media-upload-settings.js +2 -0
- package/src/components/responsive-block-control/style.scss +1 -1
- package/src/components/rich-text/event-listeners/before-input-rules.js +8 -5
- package/src/components/rich-text/event-listeners/delete.js +7 -4
- package/src/components/rich-text/event-listeners/enter.js +10 -4
- package/src/components/rich-text/event-listeners/input-events.js +4 -3
- package/src/components/rich-text/event-listeners/input-rules.js +8 -5
- package/src/components/rich-text/event-listeners/insert-replacement-text.js +4 -3
- package/src/components/rich-text/event-listeners/paste-handler.js +15 -3
- package/src/components/rich-text/event-listeners/remove-browser-shortcuts.js +4 -3
- package/src/components/rich-text/event-listeners/shortcuts.js +4 -3
- package/src/components/rich-text/event-listeners/undo-automatic-change.js +4 -3
- package/src/components/rich-text/index.js +116 -26
- package/src/components/skip-to-selected-block/style.scss +1 -1
- package/src/components/spacing-sizes-control/test/utils.js +16 -5
- package/src/components/spacing-sizes-control/utils.js +11 -28
- package/src/components/text-indent-control/index.js +8 -0
- package/src/components/typewriter/index.js +228 -224
- package/src/components/url-input/index.js +363 -431
- package/src/components/url-input/test/index.js +592 -0
- package/src/components/use-block-commands/index.js +27 -17
- package/src/components/use-on-block-drop/index.js +2 -2
- package/src/components/warning/test/__snapshots__/index.js.snap +1 -1
- package/src/components/writing-flow/index.js +17 -1
- package/src/components/writing-flow/use-arrow-nav.js +90 -13
- package/src/components/writing-flow/use-click-selection.js +55 -5
- package/src/components/writing-flow/use-clipboard-handler.js +5 -2
- package/src/components/writing-flow/use-drag-selection.js +1 -14
- package/src/components/writing-flow/use-editable-root-event-handlers.js +266 -0
- package/src/components/writing-flow/use-editable-root.js +112 -0
- package/src/components/writing-flow/use-home-end.js +71 -0
- package/src/components/writing-flow/use-input.js +25 -8
- package/src/components/writing-flow/use-multi-selection.js +2 -3
- package/src/components/writing-flow/use-select-all.js +33 -3
- package/src/components/writing-flow/use-selection-observer.js +218 -42
- package/src/components/writing-flow/utils.js +62 -0
- package/src/hooks/background.js +27 -24
- package/src/hooks/block-fields/link/styles.scss +1 -6
- package/src/hooks/block-fields/media/styles.scss +1 -6
- package/src/hooks/block-fields/rich-text/index.js +6 -9
- package/src/hooks/block-fields/rich-text/styles.scss +1 -1
- package/src/hooks/block-style-variation.js +8 -74
- package/src/hooks/border.js +19 -4
- package/src/hooks/custom-css.js +15 -6
- package/src/hooks/dimensions.js +17 -4
- package/src/hooks/duotone.js +26 -8
- package/src/hooks/elements.js +14 -4
- package/src/hooks/grid-visualizer.js +40 -36
- package/src/hooks/layout-child.js +19 -9
- package/src/hooks/layout.js +48 -31
- package/src/hooks/line-height.js +0 -1
- package/src/hooks/states.js +38 -9
- package/src/hooks/style.js +67 -17
- package/src/hooks/test/inherited-value-wiring.js +411 -0
- package/src/hooks/test/preset-round-trip.js +456 -0
- package/src/hooks/test/style.js +29 -0
- package/src/hooks/test/text-align.js +34 -1
- package/src/hooks/text-align.js +41 -10
- package/src/hooks/typography.js +35 -24
- package/src/layouts/constrained.js +5 -1
- package/src/layouts/flex.js +5 -1
- package/src/layouts/grid.js +0 -2
- package/src/private-apis.js +11 -2
- package/src/store/actions.js +53 -19
- package/src/store/private-selectors.js +82 -6
- package/src/store/reducer.js +9 -9
- package/src/store/selectors.js +56 -8
- package/src/store/test/actions.js +1 -1
- package/src/store/test/private-selectors.js +271 -1
- package/src/style.scss +2 -0
- package/src/utils/block-bindings.ts +50 -0
- package/src/utils/dom.ts +33 -0
- package/src/utils/native-undo.js +56 -0
- package/src/utils/test/block-bindings.js +181 -0
- package/build/components/duotone/utils.cjs +0 -87
- package/build/components/duotone/utils.cjs.map +0 -7
- package/build/components/rich-text/input-event.cjs.map +0 -7
- package/build/components/rich-text/shortcut.cjs +0 -51
- package/build/components/rich-text/shortcut.cjs.map +0 -7
- package/build-module/components/duotone/utils.mjs +0 -59
- package/build-module/components/duotone/utils.mjs.map +0 -7
- package/build-module/components/rich-text/input-event.mjs +0 -25
- package/build-module/components/rich-text/input-event.mjs.map +0 -7
- package/build-module/components/rich-text/shortcut.mjs +0 -26
- package/build-module/components/rich-text/shortcut.mjs.map +0 -7
- package/src/components/duotone/utils.js +0 -90
- package/src/components/rich-text/input-event.js +0 -31
- package/src/components/rich-text/shortcut.js +0 -32
- package/src/hooks/test/get-variation-styles-with-ref-values.js +0 -91
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
import { privateApis as richTextPrivateApis } from '@wordpress/rich-text';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Internal dependencies
|
|
@@ -9,7 +10,7 @@ import { privateApis as composePrivateApis } from '@wordpress/compose';
|
|
|
9
10
|
import { store as blockEditorStore } from '../../../store';
|
|
10
11
|
import { unlock } from '../../../lock-unlock';
|
|
11
12
|
|
|
12
|
-
const {
|
|
13
|
+
const { subscribeOwnedListener } = unlock( richTextPrivateApis );
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* When the browser is about to auto correct, add an undo level so the user can
|
|
@@ -29,5 +30,5 @@ export default ( props ) => ( element ) => {
|
|
|
29
30
|
.__unstableMarkLastChangeAsPersistent();
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
return
|
|
33
|
+
return subscribeOwnedListener( element, 'beforeinput', onInput );
|
|
33
34
|
};
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { pasteHandler } from '@wordpress/blocks';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
isEmpty,
|
|
7
|
+
insert,
|
|
8
|
+
create,
|
|
9
|
+
privateApis as richTextPrivateApis,
|
|
10
|
+
} from '@wordpress/rich-text';
|
|
6
11
|
import { isURL } from '@wordpress/url';
|
|
7
12
|
import { privateApis as composePrivateApis } from '@wordpress/compose';
|
|
8
13
|
|
|
@@ -15,6 +20,7 @@ import { getPasteEventData } from '../../../utils/pasting';
|
|
|
15
20
|
import { unlock } from '../../../lock-unlock';
|
|
16
21
|
|
|
17
22
|
const { subscribeDelegatedListener } = unlock( composePrivateApis );
|
|
23
|
+
const { ownsSelection } = unlock( richTextPrivateApis );
|
|
18
24
|
|
|
19
25
|
/** @typedef {import('@wordpress/rich-text').RichTextValue} RichTextValue */
|
|
20
26
|
|
|
@@ -34,8 +40,14 @@ export default ( props ) => ( element ) => {
|
|
|
34
40
|
} = props.current;
|
|
35
41
|
|
|
36
42
|
// The event listener is attached to the window, so we need to check if
|
|
37
|
-
// the target is the element or inside the element.
|
|
38
|
-
|
|
43
|
+
// the target is the element or inside the element. When the editable
|
|
44
|
+
// wrapper holds focus (the selected block supports `editableRoot`),
|
|
45
|
+
// the event targets the wrapper instead; the element then owns the
|
|
46
|
+
// paste when it contains the selection.
|
|
47
|
+
if (
|
|
48
|
+
! element.contains( event.target ) &&
|
|
49
|
+
! ownsSelection( element )
|
|
50
|
+
) {
|
|
39
51
|
return;
|
|
40
52
|
}
|
|
41
53
|
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { isKeyboardEvent } from '@wordpress/keycodes';
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
import { privateApis as richTextPrivateApis } from '@wordpress/rich-text';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
9
10
|
*/
|
|
10
11
|
import { unlock } from '../../../lock-unlock';
|
|
11
12
|
|
|
12
|
-
const {
|
|
13
|
+
const { subscribeOwnedListener } = unlock( richTextPrivateApis );
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Hook to prevent default behaviors for key combinations otherwise handled
|
|
@@ -25,5 +26,5 @@ export default () => ( node ) => {
|
|
|
25
26
|
event.preventDefault();
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
|
-
return
|
|
29
|
+
return subscribeOwnedListener( node, 'keydown', onKeydown, true );
|
|
29
30
|
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
import { privateApis as richTextPrivateApis } from '@wordpress/rich-text';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Internal dependencies
|
|
8
9
|
*/
|
|
9
10
|
import { unlock } from '../../../lock-unlock';
|
|
10
11
|
|
|
11
|
-
const {
|
|
12
|
+
const { subscribeOwnedListener } = unlock( richTextPrivateApis );
|
|
12
13
|
|
|
13
14
|
export default ( props ) => ( element ) => {
|
|
14
15
|
const { keyboardShortcuts } = props.current;
|
|
@@ -18,5 +19,5 @@ export default ( props ) => ( element ) => {
|
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
return
|
|
22
|
+
return subscribeOwnedListener( element, 'keydown', onKeyDown, true );
|
|
22
23
|
};
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { BACKSPACE, ESCAPE } from '@wordpress/keycodes';
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
import { privateApis as richTextPrivateApis } from '@wordpress/rich-text';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
@@ -10,7 +11,7 @@ import { privateApis as composePrivateApis } from '@wordpress/compose';
|
|
|
10
11
|
import { store as blockEditorStore } from '../../../store';
|
|
11
12
|
import { unlock } from '../../../lock-unlock';
|
|
12
13
|
|
|
13
|
-
const {
|
|
14
|
+
const { subscribeOwnedListener } = unlock( richTextPrivateApis );
|
|
14
15
|
|
|
15
16
|
export default ( props ) => ( element ) => {
|
|
16
17
|
function onKeyDown( event ) {
|
|
@@ -42,5 +43,5 @@ export default ( props ) => ( element ) => {
|
|
|
42
43
|
__experimentalUndo();
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
return
|
|
46
|
+
return subscribeOwnedListener( element, 'keydown', onKeyDown );
|
|
46
47
|
};
|
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
useRef,
|
|
12
12
|
useState,
|
|
13
13
|
useCallback,
|
|
14
|
+
useEffect,
|
|
14
15
|
useMemo,
|
|
15
16
|
forwardRef,
|
|
16
|
-
createContext,
|
|
17
17
|
useContext,
|
|
18
18
|
} from '@wordpress/element';
|
|
19
19
|
import { useDispatch, useRegistry, useSelect } from '@wordpress/data';
|
|
@@ -29,7 +29,11 @@ import { __, sprintf } from '@wordpress/i18n';
|
|
|
29
29
|
*/
|
|
30
30
|
import { useBlockEditorAutocompleteProps } from '../autocomplete';
|
|
31
31
|
import { useBlockEditContext } from '../block-edit';
|
|
32
|
-
import {
|
|
32
|
+
import {
|
|
33
|
+
blockBindingsKey,
|
|
34
|
+
blockEditingModeKey,
|
|
35
|
+
isPreviewModeKey,
|
|
36
|
+
} from '../block-edit/context';
|
|
33
37
|
import FormatToolbarContainer from './format-toolbar-container';
|
|
34
38
|
import { store as blockEditorStore } from '../../store';
|
|
35
39
|
import { useMarkPersistent } from './use-mark-persistent';
|
|
@@ -41,13 +45,17 @@ import { withDeprecations } from './with-deprecations';
|
|
|
41
45
|
import BlockContext from '../block-context';
|
|
42
46
|
import { unlock } from '../../lock-unlock';
|
|
43
47
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
// `RichTextShortcut` and `RichTextInputEvent` now live in
|
|
49
|
+
// `@wordpress/rich-text` so they share the shortcut and input-event contexts
|
|
50
|
+
// with standalone rich text fields. Re-exported below for back-compat (e.g.
|
|
51
|
+
// `@wordpress/format-library` imports them from `@wordpress/block-editor`).
|
|
52
|
+
const {
|
|
53
|
+
useRichText,
|
|
54
|
+
KeyboardShortcutContext,
|
|
55
|
+
InputEventContext,
|
|
56
|
+
RichTextShortcut,
|
|
57
|
+
RichTextInputEvent,
|
|
58
|
+
} = unlock( richTextPrivateApis );
|
|
51
59
|
|
|
52
60
|
const instanceIdKey = Symbol( 'instanceId' );
|
|
53
61
|
|
|
@@ -96,6 +104,7 @@ export function RichTextWrapper(
|
|
|
96
104
|
const context = useBlockEditContext();
|
|
97
105
|
const { clientId, isSelected: isBlockSelected, name: blockName } = context;
|
|
98
106
|
const blockBindings = context[ blockBindingsKey ];
|
|
107
|
+
const hasDefaultEditingMode = context[ blockEditingModeKey ] === 'default';
|
|
99
108
|
const blockContext = useContext( BlockContext );
|
|
100
109
|
const registry = useRegistry();
|
|
101
110
|
const selector = ( select ) => {
|
|
@@ -238,6 +247,27 @@ export function RichTextWrapper(
|
|
|
238
247
|
const shouldDisableEditing =
|
|
239
248
|
readOnly || disableBoundBlock || shouldDisableForPattern;
|
|
240
249
|
|
|
250
|
+
// Whether the wrapper is the editing host, which depends on the selected
|
|
251
|
+
// block, not necessarily this one. Only the selected, default-mode block
|
|
252
|
+
// can be it, so others skip the subscription entirely.
|
|
253
|
+
const isEditingHost = useSelect(
|
|
254
|
+
( select ) => {
|
|
255
|
+
if (
|
|
256
|
+
shouldDisableEditing ||
|
|
257
|
+
! hasDefaultEditingMode ||
|
|
258
|
+
! isBlockSelected
|
|
259
|
+
) {
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
const { getSelectedBlockClientId, canHostEditableRoot } = unlock(
|
|
264
|
+
select( blockEditorStore )
|
|
265
|
+
);
|
|
266
|
+
return canHostEditableRoot( getSelectedBlockClientId() );
|
|
267
|
+
},
|
|
268
|
+
[ shouldDisableEditing, hasDefaultEditingMode, isBlockSelected ]
|
|
269
|
+
);
|
|
270
|
+
|
|
241
271
|
const { getSelectionStart, getSelectionEnd, getBlockRootClientId } =
|
|
242
272
|
useSelect( blockEditorStore );
|
|
243
273
|
const { selectionChange } = useDispatch( blockEditorStore );
|
|
@@ -341,6 +371,60 @@ export function RichTextWrapper(
|
|
|
341
371
|
onChange,
|
|
342
372
|
} );
|
|
343
373
|
|
|
374
|
+
// While a focused editing host owns the selection (the block supports
|
|
375
|
+
// `editableRoot`), ARIA attributes describing the autocomplete state must
|
|
376
|
+
// be mirrored onto the host: assistive technology resolves them relative
|
|
377
|
+
// to the focused element.
|
|
378
|
+
const {
|
|
379
|
+
'aria-autocomplete': ariaAutocomplete,
|
|
380
|
+
'aria-haspopup': ariaHasPopup,
|
|
381
|
+
'aria-controls': ariaControls,
|
|
382
|
+
'aria-owns': ariaOwns,
|
|
383
|
+
'aria-activedescendant': ariaActiveDescendant,
|
|
384
|
+
} = autocompleteProps;
|
|
385
|
+
useEffect( () => {
|
|
386
|
+
if ( ! isSelected ) {
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
const host = anchorRef.current?.parentElement?.closest(
|
|
391
|
+
'[contenteditable="true"]'
|
|
392
|
+
);
|
|
393
|
+
|
|
394
|
+
if ( ! host ) {
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
const attributes = {
|
|
399
|
+
'aria-autocomplete': ariaAutocomplete,
|
|
400
|
+
'aria-haspopup': ariaHasPopup,
|
|
401
|
+
'aria-controls': ariaControls,
|
|
402
|
+
'aria-owns': ariaOwns,
|
|
403
|
+
'aria-activedescendant': ariaActiveDescendant,
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
for ( const [ key, value_ ] of Object.entries( attributes ) ) {
|
|
407
|
+
if ( value_ === undefined ) {
|
|
408
|
+
host.removeAttribute( key );
|
|
409
|
+
} else {
|
|
410
|
+
host.setAttribute( key, value_ );
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
return () => {
|
|
415
|
+
for ( const key of Object.keys( attributes ) ) {
|
|
416
|
+
host.removeAttribute( key );
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
}, [
|
|
420
|
+
isSelected,
|
|
421
|
+
ariaAutocomplete,
|
|
422
|
+
ariaHasPopup,
|
|
423
|
+
ariaControls,
|
|
424
|
+
ariaOwns,
|
|
425
|
+
ariaActiveDescendant,
|
|
426
|
+
] );
|
|
427
|
+
|
|
344
428
|
useMarkPersistent( { html: adjustedValue, value } );
|
|
345
429
|
|
|
346
430
|
const keyboardShortcuts = useRef( new Set() );
|
|
@@ -350,12 +434,28 @@ export function RichTextWrapper(
|
|
|
350
434
|
anchorRef.current?.focus();
|
|
351
435
|
}
|
|
352
436
|
|
|
437
|
+
// Setting tabIndex to 0 is unnecessary, the element is already focusable
|
|
438
|
+
// because it's contentEditable. This also fixes a Safari bug where it's
|
|
439
|
+
// not possible to Shift+Click multi select blocks when Shift Clicking
|
|
440
|
+
// into an element with tabIndex because Safari will focus the element.
|
|
441
|
+
// However, Safari will correctly ignore nested contentEditable elements.
|
|
442
|
+
// While the writing flow wrapper is contentEditable (the selected block
|
|
443
|
+
// supports `editableRoot`), nested editable elements are no longer
|
|
444
|
+
// focusable areas on their own, so an explicit tabIndex restores their
|
|
445
|
+
// focusability.
|
|
446
|
+
let tabIndex = props.tabIndex;
|
|
447
|
+
if ( isEditingHost ) {
|
|
448
|
+
tabIndex = props.tabIndex ?? 0;
|
|
449
|
+
} else if ( ! shouldDisableEditing && props.tabIndex === 0 ) {
|
|
450
|
+
tabIndex = null;
|
|
451
|
+
}
|
|
452
|
+
|
|
353
453
|
const TagName = tagName;
|
|
354
454
|
return (
|
|
355
455
|
<>
|
|
356
456
|
{ isSelected && (
|
|
357
|
-
<
|
|
358
|
-
<
|
|
457
|
+
<KeyboardShortcutContext.Provider value={ keyboardShortcuts }>
|
|
458
|
+
<InputEventContext.Provider value={ inputEvents }>
|
|
359
459
|
<Popover.__unstableSlotNameProvider value="__unstable-block-tools-after">
|
|
360
460
|
{ children &&
|
|
361
461
|
children( { value, onChange, onFocus } ) }
|
|
@@ -368,8 +468,8 @@ export function RichTextWrapper(
|
|
|
368
468
|
forwardedRef={ anchorRef }
|
|
369
469
|
/>
|
|
370
470
|
</Popover.__unstableSlotNameProvider>
|
|
371
|
-
</
|
|
372
|
-
</
|
|
471
|
+
</InputEventContext.Provider>
|
|
472
|
+
</KeyboardShortcutContext.Provider>
|
|
373
473
|
) }
|
|
374
474
|
{ isSelected && hasFormats && (
|
|
375
475
|
<FormatToolbarContainer
|
|
@@ -433,17 +533,7 @@ export function RichTextWrapper(
|
|
|
433
533
|
props.className,
|
|
434
534
|
'rich-text'
|
|
435
535
|
) }
|
|
436
|
-
|
|
437
|
-
// focusable because it's contentEditable. This also fixes a
|
|
438
|
-
// Safari bug where it's not possible to Shift+Click multi
|
|
439
|
-
// select blocks when Shift Clicking into an element with
|
|
440
|
-
// tabIndex because Safari will focus the element. However,
|
|
441
|
-
// Safari will correctly ignore nested contentEditable elements.
|
|
442
|
-
tabIndex={
|
|
443
|
-
props.tabIndex === 0 && ! shouldDisableEditing
|
|
444
|
-
? null
|
|
445
|
-
: props.tabIndex
|
|
446
|
-
}
|
|
536
|
+
tabIndex={ tabIndex }
|
|
447
537
|
data-wp-block-attribute-key={ identifier }
|
|
448
538
|
/>
|
|
449
539
|
</>
|
|
@@ -521,6 +611,6 @@ PublicForwardedRichTextContainer.isEmpty = ( value ) => {
|
|
|
521
611
|
};
|
|
522
612
|
|
|
523
613
|
export default PublicForwardedRichTextContainer;
|
|
524
|
-
export { RichTextShortcut }
|
|
614
|
+
export { RichTextShortcut };
|
|
525
615
|
export { RichTextToolbarButton } from './toolbar-button';
|
|
526
|
-
export { RichTextInputEvent as __unstableRichTextInputEvent }
|
|
616
|
+
export { RichTextInputEvent as __unstableRichTextInputEvent };
|
|
@@ -8,12 +8,12 @@ import {
|
|
|
8
8
|
getPresetValueFromCustomValue,
|
|
9
9
|
getSliderValueFromPreset,
|
|
10
10
|
getSpacingPresetCssVar,
|
|
11
|
-
getSpacingPresetSlug,
|
|
12
11
|
hasAxisSupport,
|
|
13
12
|
hasBalancedSidesSupport,
|
|
14
13
|
isValueSpacingPreset,
|
|
15
14
|
VIEWS,
|
|
16
15
|
} from '../utils';
|
|
16
|
+
import { getPresetSlug } from '../../preset-input-control/utils';
|
|
17
17
|
|
|
18
18
|
describe( 'isValueSpacingPreset', () => {
|
|
19
19
|
it( 'should return true if value is string in spacing presets var format', () => {
|
|
@@ -82,15 +82,26 @@ describe( 'getSpacingPresetCssVar', () => {
|
|
|
82
82
|
'var(--wp--preset--spacing--20)'
|
|
83
83
|
);
|
|
84
84
|
} );
|
|
85
|
+
it( 'should return undefined for a malformed non-string value such as an array', () => {
|
|
86
|
+
// Malformed blockGap data, e.g. `{ top: [ '1rem' ] }`, would otherwise
|
|
87
|
+
// throw when `.match()` is called on the array.
|
|
88
|
+
expect( getSpacingPresetCssVar( [ '1rem' ] ) ).toBe( undefined );
|
|
89
|
+
} );
|
|
90
|
+
it( 'should return undefined for other non-string values', () => {
|
|
91
|
+
expect( getSpacingPresetCssVar( { top: '1rem' } ) ).toBe( undefined );
|
|
92
|
+
expect( getSpacingPresetCssVar( 20 ) ).toBe( undefined );
|
|
93
|
+
} );
|
|
85
94
|
} );
|
|
86
95
|
|
|
87
|
-
describe( '
|
|
96
|
+
describe( 'getPresetSlug', () => {
|
|
88
97
|
it( 'should return original value if 0 or default', () => {
|
|
89
|
-
expect(
|
|
90
|
-
expect(
|
|
98
|
+
expect( getPresetSlug( '0', 'spacing' ) ).toBe( '0' );
|
|
99
|
+
expect( getPresetSlug( 'default', 'spacing' ) ).toBe( 'default' );
|
|
91
100
|
} );
|
|
92
101
|
it( 'should return the int value of the slug portion of a valid preset var', () => {
|
|
93
|
-
expect(
|
|
102
|
+
expect( getPresetSlug( 'var:preset|spacing|20', 'spacing' ) ).toBe(
|
|
103
|
+
'20'
|
|
104
|
+
);
|
|
94
105
|
} );
|
|
95
106
|
} );
|
|
96
107
|
|
|
@@ -12,6 +12,13 @@ import {
|
|
|
12
12
|
sidesVertical,
|
|
13
13
|
} from '@wordpress/icons';
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
import { getPresetSlug, isValuePreset } from '../preset-input-control/utils';
|
|
19
|
+
|
|
20
|
+
const SPACING_PRESET_TYPE = 'spacing';
|
|
21
|
+
|
|
15
22
|
export const RANGE_CONTROL_MAX_SIZE = 8;
|
|
16
23
|
|
|
17
24
|
export const ALL_SIDES = [ 'top', 'bottom', 'left', 'right' ];
|
|
@@ -64,10 +71,7 @@ export const VIEWS = {
|
|
|
64
71
|
* @return {boolean} Return true if value is string in format var:preset|spacing|.
|
|
65
72
|
*/
|
|
66
73
|
export function isValueSpacingPreset( value ) {
|
|
67
|
-
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
return value === '0' || value.includes( 'var:preset|spacing|' );
|
|
74
|
+
return isValuePreset( value, SPACING_PRESET_TYPE );
|
|
71
75
|
}
|
|
72
76
|
|
|
73
77
|
/**
|
|
@@ -83,7 +87,7 @@ export function getCustomValueFromPreset( value, spacingSizes ) {
|
|
|
83
87
|
return value;
|
|
84
88
|
}
|
|
85
89
|
|
|
86
|
-
const slug =
|
|
90
|
+
const slug = getPresetSlug( value, SPACING_PRESET_TYPE );
|
|
87
91
|
const spacingSize = spacingSizes.find(
|
|
88
92
|
( size ) => String( size.slug ) === slug
|
|
89
93
|
);
|
|
@@ -126,7 +130,7 @@ export function getPresetValueFromCustomValue( value, spacingSizes ) {
|
|
|
126
130
|
* @return {string | undefined} CSS var string for given spacing preset value.
|
|
127
131
|
*/
|
|
128
132
|
export function getSpacingPresetCssVar( value ) {
|
|
129
|
-
if ( ! value ) {
|
|
133
|
+
if ( ! value || typeof value !== 'string' ) {
|
|
130
134
|
return;
|
|
131
135
|
}
|
|
132
136
|
|
|
@@ -139,27 +143,6 @@ export function getSpacingPresetCssVar( value ) {
|
|
|
139
143
|
return `var(--wp--preset--spacing--${ slug[ 1 ] })`;
|
|
140
144
|
}
|
|
141
145
|
|
|
142
|
-
/**
|
|
143
|
-
* Returns the slug section of the given spacing preset string.
|
|
144
|
-
*
|
|
145
|
-
* @param {string} value Value to extract slug from.
|
|
146
|
-
*
|
|
147
|
-
* @return {string|undefined} The int value of the slug from given spacing preset.
|
|
148
|
-
*/
|
|
149
|
-
export function getSpacingPresetSlug( value ) {
|
|
150
|
-
if ( ! value ) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
if ( value === '0' || value === 'default' ) {
|
|
155
|
-
return value;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
const slug = value.match( /var:preset\|spacing\|(.+)/ );
|
|
159
|
-
|
|
160
|
-
return slug ? slug[ 1 ] : undefined;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
146
|
/**
|
|
164
147
|
* Converts spacing preset value into a Range component value .
|
|
165
148
|
*
|
|
@@ -175,7 +158,7 @@ export function getSliderValueFromPreset( presetValue, spacingSizes ) {
|
|
|
175
158
|
const slug =
|
|
176
159
|
parseFloat( presetValue, 10 ) === 0
|
|
177
160
|
? '0'
|
|
178
|
-
:
|
|
161
|
+
: getPresetSlug( presetValue, SPACING_PRESET_TYPE );
|
|
179
162
|
const sliderValue = spacingSizes.findIndex( ( spacingSize ) => {
|
|
180
163
|
return String( spacingSize.slug ) === slug;
|
|
181
164
|
} );
|
|
@@ -29,6 +29,8 @@ import { useSettings } from '../../components/use-settings';
|
|
|
29
29
|
* @param {boolean} props.withSlider Whether to show the slider control.
|
|
30
30
|
* @param {boolean} props.hasBottomMargin Whether to add bottom margin below the control.
|
|
31
31
|
* @param {string} props.help Help text to display below the control.
|
|
32
|
+
* @param {string} props.className Class name to add to the inner UnitControl.
|
|
33
|
+
* @param {string} props.placeholder Placeholder for the inner UnitControl.
|
|
32
34
|
*
|
|
33
35
|
* @return {Element} Text indent control.
|
|
34
36
|
*/
|
|
@@ -39,6 +41,8 @@ export default function TextIndentControl( {
|
|
|
39
41
|
withSlider = false,
|
|
40
42
|
hasBottomMargin = false,
|
|
41
43
|
help,
|
|
44
|
+
className,
|
|
45
|
+
placeholder,
|
|
42
46
|
...otherProps
|
|
43
47
|
} ) {
|
|
44
48
|
const [ availableUnits ] = useSettings( 'spacing.units' );
|
|
@@ -73,6 +77,8 @@ export default function TextIndentControl( {
|
|
|
73
77
|
units={ units }
|
|
74
78
|
onChange={ onChange }
|
|
75
79
|
help={ help }
|
|
80
|
+
className={ className }
|
|
81
|
+
placeholder={ placeholder }
|
|
76
82
|
/>
|
|
77
83
|
);
|
|
78
84
|
}
|
|
@@ -93,6 +99,8 @@ export default function TextIndentControl( {
|
|
|
93
99
|
units={ units }
|
|
94
100
|
__unstableInputWidth={ __unstableInputWidth }
|
|
95
101
|
min={ 0 }
|
|
102
|
+
className={ className }
|
|
103
|
+
placeholder={ placeholder }
|
|
96
104
|
/>
|
|
97
105
|
</FlexItem>
|
|
98
106
|
{ withSlider && (
|