@wordpress/block-editor 11.4.0 → 11.6.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 +8 -0
- package/build/components/block-inspector/index.js +11 -10
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-inspector/useBlockInspectorAnimationSettings.js +46 -0
- package/build/components/block-inspector/useBlockInspectorAnimationSettings.js.map +1 -0
- package/build/components/block-list/block-invalid-warning.js +63 -80
- package/build/components/block-list/block-invalid-warning.js.map +1 -1
- package/build/components/block-lock/modal.js +1 -0
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +1 -1
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/index.js +2 -1
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.native.js +1 -0
- package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build/components/child-layout-control/index.js +107 -0
- package/build/components/child-layout-control/index.js.map +1 -0
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +6 -3
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build/components/date-format-picker/index.js +3 -3
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +306 -0
- package/build/components/global-styles/border-panel.js.map +1 -0
- package/build/components/global-styles/dimensions-panel.js +594 -0
- package/build/components/global-styles/dimensions-panel.js.map +1 -0
- package/build/components/global-styles/hooks.js +127 -37
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +36 -2
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +87 -27
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +21 -14
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +2 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/index.native.js +23 -0
- package/build/components/index.native.js.map +1 -1
- package/build/components/inserter/index.js +29 -17
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +10 -11
- package/build/components/inserter/media-tab/hooks.js.map +1 -1
- package/build/components/inserter/media-tab/media-list.js +5 -108
- package/build/components/inserter/media-tab/media-list.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +242 -0
- package/build/components/inserter/media-tab/media-preview.js.map +1 -0
- package/build/components/inserter/menu.js +1 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +4 -2
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-results.js +10 -3
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +1 -1
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls/fill.js +38 -9
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/link-control/index.js +1 -1
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-item.js +5 -2
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/link-control/settings-drawer.js +1 -1
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/link-control/settings.js +1 -0
- package/build/components/link-control/settings.js.map +1 -1
- package/build/components/list-view/block.js +17 -3
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +2 -2
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/expander.js +2 -1
- package/build/components/list-view/expander.js.map +1 -1
- package/build/components/list-view/leaf.js +10 -6
- package/build/components/list-view/leaf.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +1 -2
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/list-view/use-list-view-scroll-into-view.js +51 -0
- package/build/components/list-view/use-list-view-scroll-into-view.js.map +1 -0
- package/build/components/off-canvas-editor/appender.js +33 -13
- package/build/components/off-canvas-editor/appender.js.map +1 -1
- package/build/components/off-canvas-editor/branch.js +6 -3
- package/build/components/off-canvas-editor/branch.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +8 -2
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/off-canvas-editor/leaf-more-menu.js +34 -4
- package/build/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
- package/build/components/provider/use-block-sync.js +17 -3
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/responsive-block-control/index.js +1 -0
- package/build/components/responsive-block-control/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +0 -3
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/index.js +9 -43
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-delete.js +73 -0
- package/build/components/rich-text/use-delete.js.map +1 -0
- package/build/components/rich-text/use-input-rules.js +14 -6
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +4 -1
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/hooks/align.js +3 -1
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/border.js +91 -240
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/custom-class-name.js +4 -4
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/custom-class-name.native.js +3 -4
- package/build/hooks/custom-class-name.native.js.map +1 -1
- package/build/hooks/dimensions.js +72 -190
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +94 -25
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/gap.js +0 -202
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/layout.js +33 -27
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/margin.js +7 -163
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +7 -163
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/supports.js +7 -1
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/typography.js +52 -66
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +101 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/constrained.js +6 -2
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/flex.js +1 -0
- package/build/layouts/flex.js.map +1 -1
- package/build/private-apis.js +4 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +28 -14
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +28 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +53 -47
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +24 -4
- package/build/store/selectors.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +49 -10
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/components/block-inspector/index.js +9 -9
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-inspector/useBlockInspectorAnimationSettings.js +37 -0
- package/build-module/components/block-inspector/useBlockInspectorAnimationSettings.js.map +1 -0
- package/build-module/components/block-list/block-invalid-warning.js +66 -78
- package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
- package/build-module/components/block-lock/modal.js +1 -0
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +1 -1
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +2 -1
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.native.js +1 -0
- package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +98 -0
- package/build-module/components/child-layout-control/index.js.map +1 -0
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +6 -3
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +4 -4
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +291 -0
- package/build-module/components/global-styles/border-panel.js.map +1 -0
- package/build-module/components/global-styles/dimensions-panel.js +574 -0
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +123 -34
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +3 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +88 -27
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +21 -14
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +2 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/index.native.js +2 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inserter/index.js +28 -16
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +10 -11
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-list.js +6 -105
- package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +222 -0
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -0
- package/build-module/components/inserter/menu.js +1 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +4 -2
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-results.js +10 -3
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +1 -1
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +39 -9
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/link-control/index.js +1 -1
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-item.js +4 -2
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +1 -1
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/link-control/settings.js +1 -0
- package/build-module/components/link-control/settings.js.map +1 -1
- package/build-module/components/list-view/block.js +16 -3
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +2 -2
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/expander.js +2 -1
- package/build-module/components/list-view/expander.js.map +1 -1
- package/build-module/components/list-view/leaf.js +8 -4
- package/build-module/components/list-view/leaf.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +1 -2
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/list-view/use-list-view-scroll-into-view.js +42 -0
- package/build-module/components/list-view/use-list-view-scroll-into-view.js.map +1 -0
- package/build-module/components/off-canvas-editor/appender.js +33 -14
- package/build-module/components/off-canvas-editor/appender.js.map +1 -1
- package/build-module/components/off-canvas-editor/branch.js +6 -3
- package/build-module/components/off-canvas-editor/branch.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +8 -2
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/leaf-more-menu.js +36 -7
- package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +17 -3
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/responsive-block-control/index.js +1 -0
- package/build-module/components/responsive-block-control/index.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js +0 -3
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/index.js +9 -43
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-delete.js +62 -0
- package/build-module/components/rich-text/use-delete.js.map +1 -0
- package/build-module/components/rich-text/use-input-rules.js +14 -6
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +4 -1
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/hooks/align.js +3 -1
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/border.js +93 -240
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +4 -4
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/custom-class-name.native.js +3 -4
- package/build-module/hooks/custom-class-name.native.js.map +1 -1
- package/build-module/hooks/dimensions.js +75 -187
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +86 -24
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/gap.js +0 -183
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/layout.js +33 -27
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/margin.js +4 -143
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +4 -143
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/supports.js +7 -1
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/typography.js +54 -66
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +96 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/constrained.js +6 -2
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/flex.js +1 -0
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/private-apis.js +3 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +28 -14
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +28 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +53 -45
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +22 -4
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +49 -10
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-style/style-rtl.css +39 -27
- package/build-style/style.css +39 -27
- package/package.json +31 -31
- package/src/components/block-draggable/test/__snapshots__/index.native.js.snap +24 -24
- package/src/components/block-inspector/index.js +11 -14
- package/src/components/block-inspector/style.scss +3 -0
- package/src/components/block-inspector/useBlockInspectorAnimationSettings.js +53 -0
- package/src/components/block-list/block-invalid-warning.js +72 -64
- package/src/components/block-lock/modal.js +1 -0
- package/src/components/block-lock/style.scss +0 -9
- package/src/components/block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap +20 -20
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +35 -17
- package/src/components/block-preview/test/index.js +0 -2
- package/src/components/block-settings-menu/block-settings-dropdown.js +4 -1
- package/src/components/block-settings-menu-controls/index.js +2 -1
- package/src/components/block-styles/index.js +5 -1
- package/src/components/block-styles/style.scss +2 -2
- package/src/components/block-switcher/block-transformations-menu.native.js +1 -0
- package/src/components/child-layout-control/index.js +106 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +17 -15
- package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +48 -38
- package/src/components/date-format-picker/index.js +6 -8
- package/src/components/date-format-picker/style.scss +0 -5
- package/src/components/global-styles/border-panel.js +285 -0
- package/src/components/global-styles/dimensions-panel.js +627 -0
- package/src/components/global-styles/hooks.js +160 -44
- package/src/components/global-styles/index.js +7 -1
- package/src/components/global-styles/test/use-global-styles-output.js +1 -1
- package/src/components/global-styles/typography-panel.js +81 -9
- package/src/components/global-styles/use-global-styles-output.js +17 -16
- package/src/components/global-styles/utils.js +2 -0
- package/src/components/index.native.js +5 -0
- package/src/components/inner-blocks/test/__snapshots__/index.js.snap +1 -1
- package/src/components/inserter/index.js +30 -11
- package/src/components/inserter/media-tab/hooks.js +9 -8
- package/src/components/inserter/media-tab/media-list.js +3 -122
- package/src/components/inserter/media-tab/media-preview.js +268 -0
- package/src/components/inserter/menu.js +0 -1
- package/src/components/inserter/quick-inserter.js +2 -0
- package/src/components/inserter/search-results.js +7 -1
- package/src/components/inserter/style.scss +25 -0
- package/src/components/inserter/tabs.js +1 -9
- package/src/components/inserter/test/__snapshots__/index.native.js.snap +15 -15
- package/src/components/inspector-controls/block-support-tools-panel.js +0 -1
- package/src/components/inspector-controls/fill.js +32 -8
- package/src/components/link-control/index.js +1 -1
- package/src/components/link-control/search-item.js +3 -1
- package/src/components/link-control/settings-drawer.js +2 -1
- package/src/components/link-control/settings.js +1 -0
- package/src/components/link-control/style.scss +18 -12
- package/src/components/link-control/test/index.js +3 -5
- package/src/components/list-view/block.js +19 -1
- package/src/components/list-view/branch.js +1 -2
- package/src/components/list-view/expander.js +1 -0
- package/src/components/list-view/leaf.js +43 -29
- package/src/components/list-view/use-block-selection.js +0 -2
- package/src/components/list-view/use-list-view-scroll-into-view.js +48 -0
- package/src/components/media-replace-flow/style.scss +7 -9
- package/src/components/off-canvas-editor/appender.js +44 -21
- package/src/components/off-canvas-editor/branch.js +4 -1
- package/src/components/off-canvas-editor/index.js +7 -1
- package/src/components/off-canvas-editor/leaf-more-menu.js +57 -15
- package/src/components/provider/use-block-sync.js +21 -4
- package/src/components/responsive-block-control/index.js +1 -0
- package/src/components/rich-text/format-toolbar-container.js +1 -7
- package/src/components/rich-text/index.js +8 -44
- package/src/components/rich-text/use-delete.js +59 -0
- package/src/components/rich-text/use-input-rules.js +13 -5
- package/src/components/spacing-sizes-control/style.scss +1 -1
- package/src/components/url-popover/stories/index.js +1 -0
- package/src/components/url-popover/test/index.js +0 -2
- package/src/components/writing-flow/use-selection-observer.js +5 -1
- package/src/hooks/align.js +1 -1
- package/src/hooks/border.js +94 -225
- package/src/hooks/custom-class-name.js +4 -4
- package/src/hooks/custom-class-name.native.js +3 -4
- package/src/hooks/dimensions.js +85 -269
- package/src/hooks/duotone.js +100 -30
- package/src/hooks/gap.js +0 -208
- package/src/hooks/layout.js +38 -22
- package/src/hooks/margin.js +1 -164
- package/src/hooks/padding.js +1 -163
- package/src/hooks/supports.js +6 -0
- package/src/hooks/test/__snapshots__/align.native.js.snap +24 -24
- package/src/hooks/test/duotone.js +102 -0
- package/src/hooks/test/style.js +2 -1
- package/src/hooks/test/use-typography-props.js +2 -0
- package/src/hooks/typography.js +68 -88
- package/src/hooks/utils.js +126 -0
- package/src/layouts/constrained.js +23 -17
- package/src/layouts/flex.js +1 -0
- package/src/private-apis.js +2 -0
- package/src/store/actions.js +16 -6
- package/src/store/defaults.js +14 -1
- package/src/store/reducer.js +68 -43
- package/src/store/selectors.js +28 -4
- package/src/store/test/actions.js +4 -2
- package/src/utils/parse-css-unit-to-px.js +48 -13
- package/src/utils/test/parse-css-unit-to-px.js +13 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build/hooks/border-radius.js +0 -100
- package/build/hooks/border-radius.js.map +0 -1
- package/build/hooks/child-layout.js +0 -213
- package/build/hooks/child-layout.js.map +0 -1
- package/build/hooks/min-height.js +0 -139
- package/build/hooks/min-height.js.map +0 -1
- package/build-module/hooks/border-radius.js +0 -84
- package/build-module/hooks/border-radius.js.map +0 -1
- package/build-module/hooks/child-layout.js +0 -193
- package/build-module/hooks/child-layout.js.map +0 -1
- package/build-module/hooks/min-height.js +0 -116
- package/build-module/hooks/min-height.js.map +0 -1
- package/src/hooks/border-radius.js +0 -70
- package/src/hooks/child-layout.js +0 -195
- package/src/hooks/min-height.js +0 -104
|
@@ -56,20 +56,24 @@ export const BLOCK_LIST_ITEM_HEIGHT = 36;
|
|
|
56
56
|
*
|
|
57
57
|
* @param {Object} props Components props.
|
|
58
58
|
* @param {string} props.id An HTML element id for the root element of ListView.
|
|
59
|
+
* @param {string} props.parentClientId The client id of the parent block.
|
|
59
60
|
* @param {Array} props.blocks Custom subset of block client IDs to be used instead of the default hierarchy.
|
|
60
61
|
* @param {boolean} props.showBlockMovers Flag to enable block movers
|
|
61
62
|
* @param {boolean} props.isExpanded Flag to determine whether nested levels are expanded by default.
|
|
62
63
|
* @param {Object} props.LeafMoreMenu Optional more menu substitution.
|
|
63
64
|
* @param {string} props.description Optional accessible description for the tree grid component.
|
|
64
65
|
* @param {string} props.onSelect Optional callback to be invoked when a block is selected.
|
|
66
|
+
* @param {string} props.showAppender Flag to show or hide the block appender.
|
|
65
67
|
* @param {Object} ref Forwarded ref
|
|
66
68
|
*/
|
|
67
69
|
function OffCanvasEditor(
|
|
68
70
|
{
|
|
69
71
|
id,
|
|
72
|
+
parentClientId,
|
|
70
73
|
blocks,
|
|
71
74
|
showBlockMovers = false,
|
|
72
75
|
isExpanded = false,
|
|
76
|
+
showAppender = true,
|
|
73
77
|
LeafMoreMenu,
|
|
74
78
|
description = __( 'Block navigation structure' ),
|
|
75
79
|
onSelect,
|
|
@@ -96,7 +100,7 @@ function OffCanvasEditor(
|
|
|
96
100
|
shouldShowInnerBlocks: __unstableGetEditorMode() !== 'zoom-out',
|
|
97
101
|
};
|
|
98
102
|
},
|
|
99
|
-
[ draggedClientIds ]
|
|
103
|
+
[ draggedClientIds, blocks ]
|
|
100
104
|
);
|
|
101
105
|
|
|
102
106
|
const { updateBlockSelection } = useBlockSelection();
|
|
@@ -227,6 +231,7 @@ function OffCanvasEditor(
|
|
|
227
231
|
>
|
|
228
232
|
<ListViewContext.Provider value={ contextValue }>
|
|
229
233
|
<ListViewBranch
|
|
234
|
+
parentId={ parentClientId }
|
|
230
235
|
blocks={ clientIdsTree }
|
|
231
236
|
selectBlock={ selectEditorBlock }
|
|
232
237
|
showBlockMovers={ showBlockMovers }
|
|
@@ -234,6 +239,7 @@ function OffCanvasEditor(
|
|
|
234
239
|
selectedClientIds={ selectedClientIds }
|
|
235
240
|
isExpanded={ isExpanded }
|
|
236
241
|
shouldShowInnerBlocks={ shouldShowInnerBlocks }
|
|
242
|
+
showAppender={ showAppender }
|
|
237
243
|
/>
|
|
238
244
|
<TreeGridRow
|
|
239
245
|
level={ 1 }
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { createBlock } from '@wordpress/blocks';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
addSubmenu,
|
|
7
|
+
chevronUp,
|
|
8
|
+
chevronDown,
|
|
9
|
+
moreVertical,
|
|
10
|
+
} from '@wordpress/icons';
|
|
6
11
|
import { DropdownMenu, MenuItem, MenuGroup } from '@wordpress/components';
|
|
7
|
-
import { useDispatch } from '@wordpress/data';
|
|
12
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
13
|
import { __, sprintf } from '@wordpress/i18n';
|
|
9
14
|
|
|
10
15
|
/**
|
|
@@ -12,6 +17,7 @@ import { __, sprintf } from '@wordpress/i18n';
|
|
|
12
17
|
*/
|
|
13
18
|
import { store as blockEditorStore } from '../../store';
|
|
14
19
|
import BlockTitle from '../block-title';
|
|
20
|
+
import { useListViewContext } from './context';
|
|
15
21
|
|
|
16
22
|
const POPOVER_PROPS = {
|
|
17
23
|
className: 'block-editor-block-settings-menu__popover',
|
|
@@ -25,6 +31,7 @@ const BLOCKS_THAT_CAN_BE_CONVERTED_TO_SUBMENU = [
|
|
|
25
31
|
];
|
|
26
32
|
|
|
27
33
|
function AddSubmenuItem( { block, onClose } ) {
|
|
34
|
+
const { expandedState, expand } = useListViewContext();
|
|
28
35
|
const { insertBlock, replaceBlock, replaceInnerBlocks } =
|
|
29
36
|
useDispatch( blockEditorStore );
|
|
30
37
|
|
|
@@ -69,6 +76,9 @@ function AddSubmenuItem( { block, onClose } ) {
|
|
|
69
76
|
updateSelectionOnInsert
|
|
70
77
|
);
|
|
71
78
|
}
|
|
79
|
+
if ( ! expandedState[ block.clientId ] ) {
|
|
80
|
+
expand( block.clientId );
|
|
81
|
+
}
|
|
72
82
|
onClose();
|
|
73
83
|
} }
|
|
74
84
|
>
|
|
@@ -80,14 +90,24 @@ function AddSubmenuItem( { block, onClose } ) {
|
|
|
80
90
|
export default function LeafMoreMenu( props ) {
|
|
81
91
|
const { clientId, block } = props;
|
|
82
92
|
|
|
83
|
-
const { removeBlocks } =
|
|
93
|
+
const { moveBlocksDown, moveBlocksUp, removeBlocks } =
|
|
94
|
+
useDispatch( blockEditorStore );
|
|
84
95
|
|
|
85
|
-
const
|
|
96
|
+
const removeLabel = sprintf(
|
|
86
97
|
/* translators: %s: block name */
|
|
87
98
|
__( 'Remove %s' ),
|
|
88
99
|
BlockTitle( { clientId, maximumLength: 25 } )
|
|
89
100
|
);
|
|
90
101
|
|
|
102
|
+
const rootClientId = useSelect(
|
|
103
|
+
( select ) => {
|
|
104
|
+
const { getBlockRootClientId } = select( blockEditorStore );
|
|
105
|
+
|
|
106
|
+
return getBlockRootClientId( clientId );
|
|
107
|
+
},
|
|
108
|
+
[ clientId ]
|
|
109
|
+
);
|
|
110
|
+
|
|
91
111
|
return (
|
|
92
112
|
<DropdownMenu
|
|
93
113
|
icon={ moreVertical }
|
|
@@ -98,17 +118,39 @@ export default function LeafMoreMenu( props ) {
|
|
|
98
118
|
{ ...props }
|
|
99
119
|
>
|
|
100
120
|
{ ( { onClose } ) => (
|
|
101
|
-
|
|
102
|
-
<
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
121
|
+
<>
|
|
122
|
+
<MenuGroup>
|
|
123
|
+
<MenuItem
|
|
124
|
+
icon={ chevronUp }
|
|
125
|
+
onClick={ () => {
|
|
126
|
+
moveBlocksUp( [ clientId ], rootClientId );
|
|
127
|
+
onClose();
|
|
128
|
+
} }
|
|
129
|
+
>
|
|
130
|
+
{ __( 'Move up' ) }
|
|
131
|
+
</MenuItem>
|
|
132
|
+
<MenuItem
|
|
133
|
+
icon={ chevronDown }
|
|
134
|
+
onClick={ () => {
|
|
135
|
+
moveBlocksDown( [ clientId ], rootClientId );
|
|
136
|
+
onClose();
|
|
137
|
+
} }
|
|
138
|
+
>
|
|
139
|
+
{ __( 'Move down' ) }
|
|
140
|
+
</MenuItem>
|
|
141
|
+
<AddSubmenuItem block={ block } onClose={ onClose } />
|
|
142
|
+
</MenuGroup>
|
|
143
|
+
<MenuGroup>
|
|
144
|
+
<MenuItem
|
|
145
|
+
onClick={ () => {
|
|
146
|
+
removeBlocks( [ clientId ], false );
|
|
147
|
+
onClose();
|
|
148
|
+
} }
|
|
149
|
+
>
|
|
150
|
+
{ removeLabel }
|
|
151
|
+
</MenuItem>
|
|
152
|
+
</MenuGroup>
|
|
153
|
+
</>
|
|
112
154
|
) }
|
|
113
155
|
</DropdownMenu>
|
|
114
156
|
);
|
|
@@ -76,10 +76,18 @@ export default function useBlockSync( {
|
|
|
76
76
|
resetBlocks,
|
|
77
77
|
resetSelection,
|
|
78
78
|
replaceInnerBlocks,
|
|
79
|
+
selectBlock,
|
|
79
80
|
setHasControlledInnerBlocks,
|
|
80
81
|
__unstableMarkNextChangeAsNotPersistent,
|
|
81
82
|
} = registry.dispatch( blockEditorStore );
|
|
82
|
-
const {
|
|
83
|
+
const {
|
|
84
|
+
hasSelectedBlock,
|
|
85
|
+
getBlockName,
|
|
86
|
+
getBlocks,
|
|
87
|
+
getSelectionStart,
|
|
88
|
+
getSelectionEnd,
|
|
89
|
+
getBlock,
|
|
90
|
+
} = registry.select( blockEditorStore );
|
|
83
91
|
const isControlled = useSelect(
|
|
84
92
|
( select ) => {
|
|
85
93
|
return (
|
|
@@ -159,6 +167,9 @@ export default function useBlockSync( {
|
|
|
159
167
|
// bound sync, unset the outbound value to avoid considering it in
|
|
160
168
|
// subsequent renders.
|
|
161
169
|
pendingChanges.current.outgoing = [];
|
|
170
|
+
const hadSelecton = hasSelectedBlock();
|
|
171
|
+
const selectionAnchor = getSelectionStart();
|
|
172
|
+
const selectionFocus = getSelectionEnd();
|
|
162
173
|
setControlledBlocks();
|
|
163
174
|
|
|
164
175
|
if ( controlledSelection ) {
|
|
@@ -167,6 +178,15 @@ export default function useBlockSync( {
|
|
|
167
178
|
controlledSelection.selectionEnd,
|
|
168
179
|
controlledSelection.initialPosition
|
|
169
180
|
);
|
|
181
|
+
} else {
|
|
182
|
+
const selectionStillExists = getBlock(
|
|
183
|
+
selectionAnchor.clientId
|
|
184
|
+
);
|
|
185
|
+
if ( hadSelecton && ! selectionStillExists ) {
|
|
186
|
+
selectBlock( clientId );
|
|
187
|
+
} else {
|
|
188
|
+
resetSelection( selectionAnchor, selectionFocus );
|
|
189
|
+
}
|
|
170
190
|
}
|
|
171
191
|
}
|
|
172
192
|
}, [ controlledBlocks, clientId ] );
|
|
@@ -182,8 +202,6 @@ export default function useBlockSync( {
|
|
|
182
202
|
|
|
183
203
|
useEffect( () => {
|
|
184
204
|
const {
|
|
185
|
-
getSelectionStart,
|
|
186
|
-
getSelectionEnd,
|
|
187
205
|
getSelectedBlocksInitialCaretPosition,
|
|
188
206
|
isLastBlockChangePersistent,
|
|
189
207
|
__unstableIsLastBlockChangeIgnored,
|
|
@@ -220,7 +238,6 @@ export default function useBlockSync( {
|
|
|
220
238
|
const newBlocks = getBlocks( clientId );
|
|
221
239
|
const areBlocksDifferent = newBlocks !== blocks;
|
|
222
240
|
blocks = newBlocks;
|
|
223
|
-
|
|
224
241
|
if (
|
|
225
242
|
areBlocksDifferent &&
|
|
226
243
|
( pendingChanges.current.incoming ||
|
|
@@ -92,6 +92,7 @@ function ResponsiveBlockControl( props ) {
|
|
|
92
92
|
|
|
93
93
|
<div className="block-editor-responsive-block-control__inner">
|
|
94
94
|
<ToggleControl
|
|
95
|
+
__nextHasNoMarginBottom
|
|
95
96
|
className="block-editor-responsive-block-control__toggle"
|
|
96
97
|
label={ toggleControlLabel }
|
|
97
98
|
checked={ ! isResponsive }
|
|
@@ -19,11 +19,7 @@ import FormatToolbar from './format-toolbar';
|
|
|
19
19
|
import NavigableToolbar from '../navigable-toolbar';
|
|
20
20
|
import { store as blockEditorStore } from '../../store';
|
|
21
21
|
|
|
22
|
-
function InlineSelectionToolbar( {
|
|
23
|
-
value,
|
|
24
|
-
editableContentElement,
|
|
25
|
-
activeFormats,
|
|
26
|
-
} ) {
|
|
22
|
+
function InlineSelectionToolbar( { editableContentElement, activeFormats } ) {
|
|
27
23
|
const lastFormat = activeFormats[ activeFormats.length - 1 ];
|
|
28
24
|
const lastFormatType = lastFormat?.type;
|
|
29
25
|
const settings = useSelect(
|
|
@@ -32,7 +28,6 @@ function InlineSelectionToolbar( {
|
|
|
32
28
|
);
|
|
33
29
|
const popoverAnchor = useAnchor( {
|
|
34
30
|
editableContentElement,
|
|
35
|
-
value,
|
|
36
31
|
settings,
|
|
37
32
|
} );
|
|
38
33
|
|
|
@@ -85,7 +80,6 @@ const FormatToolbarContainer = ( {
|
|
|
85
80
|
return (
|
|
86
81
|
<InlineSelectionToolbar
|
|
87
82
|
editableContentElement={ editableContentElement }
|
|
88
|
-
value={ value }
|
|
89
83
|
activeFormats={ activeFormats }
|
|
90
84
|
/>
|
|
91
85
|
);
|
|
@@ -19,12 +19,9 @@ import { useInstanceId, useMergeRefs } from '@wordpress/compose';
|
|
|
19
19
|
import {
|
|
20
20
|
__unstableUseRichText as useRichText,
|
|
21
21
|
__unstableCreateElement,
|
|
22
|
-
isEmpty,
|
|
23
|
-
isCollapsed,
|
|
24
22
|
removeFormat,
|
|
25
23
|
} from '@wordpress/rich-text';
|
|
26
24
|
import deprecated from '@wordpress/deprecated';
|
|
27
|
-
import { BACKSPACE, DELETE } from '@wordpress/keycodes';
|
|
28
25
|
import { Popover } from '@wordpress/components';
|
|
29
26
|
|
|
30
27
|
/**
|
|
@@ -39,6 +36,7 @@ import { useMarkPersistent } from './use-mark-persistent';
|
|
|
39
36
|
import { usePasteHandler } from './use-paste-handler';
|
|
40
37
|
import { useBeforeInputRules } from './use-before-input-rules';
|
|
41
38
|
import { useInputRules } from './use-input-rules';
|
|
39
|
+
import { useDelete } from './use-delete';
|
|
42
40
|
import { useEnter } from './use-enter';
|
|
43
41
|
import { useFormatTypes } from './use-format-types';
|
|
44
42
|
import { useRemoveBrowserShortcuts } from './use-remove-browser-shortcuts';
|
|
@@ -280,6 +278,7 @@ function RichTextWrapper(
|
|
|
280
278
|
|
|
281
279
|
const {
|
|
282
280
|
value,
|
|
281
|
+
getValue,
|
|
283
282
|
onChange,
|
|
284
283
|
ref: richTextRef,
|
|
285
284
|
} = useRichText( {
|
|
@@ -315,45 +314,6 @@ function RichTextWrapper(
|
|
|
315
314
|
const keyboardShortcuts = useRef( new Set() );
|
|
316
315
|
const inputEvents = useRef( new Set() );
|
|
317
316
|
|
|
318
|
-
function onKeyDown( event ) {
|
|
319
|
-
const { keyCode } = event;
|
|
320
|
-
|
|
321
|
-
if ( event.defaultPrevented ) {
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
if ( keyCode === DELETE || keyCode === BACKSPACE ) {
|
|
326
|
-
const { start, end, text } = value;
|
|
327
|
-
const isReverse = keyCode === BACKSPACE;
|
|
328
|
-
const hasActiveFormats =
|
|
329
|
-
value.activeFormats && !! value.activeFormats.length;
|
|
330
|
-
|
|
331
|
-
// Only process delete if the key press occurs at an uncollapsed edge.
|
|
332
|
-
if (
|
|
333
|
-
! isCollapsed( value ) ||
|
|
334
|
-
hasActiveFormats ||
|
|
335
|
-
( isReverse && start !== 0 ) ||
|
|
336
|
-
( ! isReverse && end !== text.length )
|
|
337
|
-
) {
|
|
338
|
-
return;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
if ( onMerge ) {
|
|
342
|
-
onMerge( ! isReverse );
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
// Only handle remove on Backspace. This serves dual-purpose of being
|
|
346
|
-
// an intentional user interaction distinguishing between Backspace and
|
|
347
|
-
// Delete to remove the empty field, but also to avoid merge & remove
|
|
348
|
-
// causing destruction of two fields (merge, then removed merged).
|
|
349
|
-
if ( onRemove && isEmpty( value ) && isReverse ) {
|
|
350
|
-
onRemove( ! isReverse );
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
event.preventDefault();
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
|
|
357
317
|
function onFocus() {
|
|
358
318
|
anchorRef.current?.focus();
|
|
359
319
|
}
|
|
@@ -400,7 +360,7 @@ function RichTextWrapper(
|
|
|
400
360
|
richTextRef,
|
|
401
361
|
useBeforeInputRules( { value, onChange } ),
|
|
402
362
|
useInputRules( {
|
|
403
|
-
|
|
363
|
+
getValue,
|
|
404
364
|
onChange,
|
|
405
365
|
__unstableAllowPrefixTransformations,
|
|
406
366
|
formatTypes,
|
|
@@ -427,6 +387,11 @@ function RichTextWrapper(
|
|
|
427
387
|
preserveWhiteSpace,
|
|
428
388
|
pastePlainText,
|
|
429
389
|
} ),
|
|
390
|
+
useDelete( {
|
|
391
|
+
value,
|
|
392
|
+
onMerge,
|
|
393
|
+
onRemove,
|
|
394
|
+
} ),
|
|
430
395
|
useEnter( {
|
|
431
396
|
removeEditorOnlyFormats,
|
|
432
397
|
value,
|
|
@@ -448,7 +413,6 @@ function RichTextWrapper(
|
|
|
448
413
|
props.className,
|
|
449
414
|
'rich-text'
|
|
450
415
|
) }
|
|
451
|
-
onKeyDown={ onKeyDown }
|
|
452
416
|
/>
|
|
453
417
|
</>
|
|
454
418
|
);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useRef } from '@wordpress/element';
|
|
5
|
+
import { useRefEffect } from '@wordpress/compose';
|
|
6
|
+
import { DELETE, BACKSPACE } from '@wordpress/keycodes';
|
|
7
|
+
import { isCollapsed, isEmpty } from '@wordpress/rich-text';
|
|
8
|
+
|
|
9
|
+
export function useDelete( props ) {
|
|
10
|
+
const propsRef = useRef( props );
|
|
11
|
+
propsRef.current = props;
|
|
12
|
+
return useRefEffect( ( element ) => {
|
|
13
|
+
function onKeyDown( event ) {
|
|
14
|
+
const { keyCode } = event;
|
|
15
|
+
|
|
16
|
+
if ( event.defaultPrevented ) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const { value, onMerge, onRemove } = propsRef.current;
|
|
21
|
+
|
|
22
|
+
if ( keyCode === DELETE || keyCode === BACKSPACE ) {
|
|
23
|
+
const { start, end, text } = value;
|
|
24
|
+
const isReverse = keyCode === BACKSPACE;
|
|
25
|
+
const hasActiveFormats =
|
|
26
|
+
value.activeFormats && !! value.activeFormats.length;
|
|
27
|
+
|
|
28
|
+
// Only process delete if the key press occurs at an uncollapsed edge.
|
|
29
|
+
if (
|
|
30
|
+
! isCollapsed( value ) ||
|
|
31
|
+
hasActiveFormats ||
|
|
32
|
+
( isReverse && start !== 0 ) ||
|
|
33
|
+
( ! isReverse && end !== text.length )
|
|
34
|
+
) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if ( onMerge ) {
|
|
39
|
+
onMerge( ! isReverse );
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Only handle remove on Backspace. This serves dual-purpose of being
|
|
43
|
+
// an intentional user interaction distinguishing between Backspace and
|
|
44
|
+
// Delete to remove the empty field, but also to avoid merge & remove
|
|
45
|
+
// causing destruction of two fields (merge, then removed merged).
|
|
46
|
+
if ( onRemove && isEmpty( value ) && isReverse ) {
|
|
47
|
+
onRemove( ! isReverse );
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
element.addEventListener( 'keydown', onKeyDown );
|
|
55
|
+
return () => {
|
|
56
|
+
element.removeEventListener( 'keydown', onKeyDown );
|
|
57
|
+
};
|
|
58
|
+
}, [] );
|
|
59
|
+
}
|
|
@@ -29,7 +29,7 @@ function findSelection( blocks ) {
|
|
|
29
29
|
blocks[ i ].attributes[ attributeKey ] = blocks[ i ].attributes[
|
|
30
30
|
attributeKey
|
|
31
31
|
].replace( START_OF_SELECTED_AREA, '' );
|
|
32
|
-
return blocks[ i ].clientId;
|
|
32
|
+
return [ blocks[ i ].clientId, attributeKey, 0, 0 ];
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
const nestedSelection = findSelection( blocks[ i ].innerBlocks );
|
|
@@ -38,6 +38,8 @@ function findSelection( blocks ) {
|
|
|
38
38
|
return nestedSelection;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
+
|
|
42
|
+
return [];
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
export function useInputRules( props ) {
|
|
@@ -49,12 +51,15 @@ export function useInputRules( props ) {
|
|
|
49
51
|
propsRef.current = props;
|
|
50
52
|
return useRefEffect( ( element ) => {
|
|
51
53
|
function inputRule() {
|
|
52
|
-
const {
|
|
54
|
+
const { getValue, onReplace, selectionChange } = propsRef.current;
|
|
53
55
|
|
|
54
56
|
if ( ! onReplace ) {
|
|
55
57
|
return;
|
|
56
58
|
}
|
|
57
59
|
|
|
60
|
+
// We must use getValue() here because value may be update
|
|
61
|
+
// asynchronously.
|
|
62
|
+
const value = getValue();
|
|
58
63
|
const { start, text } = value;
|
|
59
64
|
const characterBefore = text.slice( start - 1, start );
|
|
60
65
|
|
|
@@ -83,15 +88,17 @@ export function useInputRules( props ) {
|
|
|
83
88
|
} );
|
|
84
89
|
const block = transformation.transform( content );
|
|
85
90
|
|
|
86
|
-
selectionChange( findSelection( [ block ] ) );
|
|
91
|
+
selectionChange( ...findSelection( [ block ] ) );
|
|
87
92
|
onReplace( [ block ] );
|
|
88
93
|
__unstableMarkAutomaticChange();
|
|
94
|
+
|
|
95
|
+
return true;
|
|
89
96
|
}
|
|
90
97
|
|
|
91
98
|
function onInput( event ) {
|
|
92
99
|
const { inputType, type } = event;
|
|
93
100
|
const {
|
|
94
|
-
|
|
101
|
+
getValue,
|
|
95
102
|
onChange,
|
|
96
103
|
__unstableAllowPrefixTransformations,
|
|
97
104
|
formatTypes,
|
|
@@ -103,9 +110,10 @@ export function useInputRules( props ) {
|
|
|
103
110
|
}
|
|
104
111
|
|
|
105
112
|
if ( __unstableAllowPrefixTransformations && inputRule ) {
|
|
106
|
-
inputRule();
|
|
113
|
+
if ( inputRule() ) return;
|
|
107
114
|
}
|
|
108
115
|
|
|
116
|
+
const value = getValue();
|
|
109
117
|
const transformed = formatTypes.reduce(
|
|
110
118
|
( accumlator, { __unstableInputRule } ) => {
|
|
111
119
|
if ( __unstableInputRule ) {
|
|
@@ -72,7 +72,11 @@ function findDepth( a, b ) {
|
|
|
72
72
|
* @param {boolean} value `contentEditable` value (true or false)
|
|
73
73
|
*/
|
|
74
74
|
function setContentEditableWrapper( node, value ) {
|
|
75
|
-
|
|
75
|
+
// Since we are calling this on every selection change, check if the value
|
|
76
|
+
// needs to be updated first because it trigger the browser to recalculate
|
|
77
|
+
// style.
|
|
78
|
+
if ( node.contentEditable !== String( value ) )
|
|
79
|
+
node.contentEditable = value;
|
|
76
80
|
// Firefox doesn't automatically move focus.
|
|
77
81
|
if ( value ) node.focus();
|
|
78
82
|
}
|
package/src/hooks/align.js
CHANGED
|
@@ -119,7 +119,7 @@ export function addAttribute( settings ) {
|
|
|
119
119
|
*/
|
|
120
120
|
export const withToolbarControls = createHigherOrderComponent(
|
|
121
121
|
( BlockEdit ) => ( props ) => {
|
|
122
|
-
const blockEdit = <BlockEdit { ...props } />;
|
|
122
|
+
const blockEdit = <BlockEdit key="edit" { ...props } />;
|
|
123
123
|
const { name: blockName } = props;
|
|
124
124
|
// Compute the block valid alignments by taking into account,
|
|
125
125
|
// if the theme supports wide alignments or not and the layout's
|