@wordpress/block-editor 12.13.0 → 12.15.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 +4 -0
- package/README.md +1 -1
- package/build/components/block-heading-level-dropdown/index.js +1 -1
- package/build/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build/components/block-list/block.native.js +2 -0
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +2 -9
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list-appender/index.js +16 -3
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-parent-selector/index.js +1 -1
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +25 -16
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +4 -2
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-patterns-list/index.js +36 -19
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-quick-navigation/index.js +6 -4
- package/build/components/block-quick-navigation/index.js.map +1 -1
- package/build/components/block-rename/index.js +28 -0
- package/build/components/block-rename/index.js.map +1 -0
- package/build/components/block-rename/is-empty-string.js +10 -0
- package/build/components/block-rename/is-empty-string.js.map +1 -0
- package/build/components/block-rename/modal.js +87 -0
- package/build/components/block-rename/modal.js.map +1 -0
- package/build/components/block-rename/rename-control.js +74 -0
- package/build/components/block-rename/rename-control.js.map +1 -0
- package/build/components/block-rename/use-block-rename.js +17 -0
- package/build/components/block-rename/use-block-rename.js.map +1 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js +33 -20
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +7 -0
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-styles/index.js +0 -8
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +18 -14
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build/components/block-tools/back-compat.js +2 -2
- package/build/components/block-tools/back-compat.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +11 -81
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/empty-block-inserter.js +56 -0
- package/build/components/block-tools/empty-block-inserter.js.map +1 -0
- package/build/components/block-tools/index.js +48 -9
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/selected-block-tools.js +113 -0
- package/build/components/block-tools/selected-block-tools.js.map +1 -0
- package/build/components/block-tools/use-selected-block-tool-props.js +56 -0
- package/build/components/block-tools/use-selected-block-tool-props.js.map +1 -0
- package/build/components/block-types-list/index.js +6 -2
- package/build/components/block-types-list/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +8 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/editable-text/index.js +1 -2
- package/build/components/editable-text/index.js.map +1 -1
- package/build/components/global-styles/advanced-panel.js +1 -1
- package/build/components/global-styles/advanced-panel.js.map +1 -1
- package/build/components/iframe/index.js +4 -3
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-size-control/index.js +0 -5
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +3 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/warning-max-depth-exceeded.native.js +29 -31
- package/build/components/inner-blocks/warning-max-depth-exceeded.native.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/{explorer.js → index.js} +7 -7
- package/build/components/inserter/block-patterns-explorer/index.js.map +1 -0
- package/build/components/inserter/block-patterns-explorer/{sidebar.js → pattern-explorer-sidebar.js} +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -0
- package/build/components/inserter/block-patterns-explorer/{patterns-list.js → pattern-list.js} +4 -4
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -0
- package/build/components/inserter/block-patterns-tab/index.js +75 -0
- package/build/components/inserter/block-patterns-tab/index.js.map +1 -0
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +48 -0
- package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -0
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +108 -0
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -0
- package/build/components/inserter/{block-patterns-filter.js → block-patterns-tab/patterns-filter.js} +18 -34
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -0
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +55 -0
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -0
- package/build/components/inserter/block-patterns-tab/utils.js +69 -0
- package/build/components/inserter/block-patterns-tab/utils.js.map +1 -0
- package/build/components/inserter/hooks/use-patterns-state.js +2 -1
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/media-tab/media-list.js +9 -5
- package/build/components/inserter/media-tab/media-list.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +15 -12
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/menu.js +3 -4
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter-listbox/index.js +11 -6
- package/build/components/inserter-listbox/index.js.map +1 -1
- package/build/components/inserter-listbox/item.js +24 -23
- package/build/components/inserter-listbox/item.js.map +1 -1
- package/build/components/inserter-listbox/row.js +5 -5
- package/build/components/inserter-listbox/row.js.map +1 -1
- package/build/components/link-control/index.js +6 -5
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +39 -0
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +16 -3
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/index.js +3 -2
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-list-view-expand-selected-item.js +2 -3
- package/build/components/list-view/use-list-view-expand-selected-item.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +69 -18
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/preview-options/index.js +4 -2
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +1 -14
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/index.js +0 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +4 -2
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/native/format-edit.js +45 -0
- package/build/components/rich-text/native/format-edit.js.map +1 -0
- package/build/components/rich-text/native/get-format-colors.native.js +41 -0
- package/build/components/rich-text/native/get-format-colors.native.js.map +1 -0
- package/build/components/rich-text/native/index.js +9 -0
- package/build/components/rich-text/native/index.js.map +1 -0
- package/build/components/rich-text/native/index.native.js +1189 -0
- package/build/components/rich-text/native/index.native.js.map +1 -0
- package/build/components/rich-text/native/toolbar-button-with-options.native.js +58 -0
- package/build/components/rich-text/native/toolbar-button-with-options.native.js.map +1 -0
- package/build/components/rich-text/native/use-format-types.js +111 -0
- package/build/components/rich-text/native/use-format-types.js.map +1 -0
- package/build/components/rich-text/use-input-rules.js +30 -1
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +2 -5
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +2 -1
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +4 -1
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +2 -1
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-settings/index.js +2 -2
- package/build/components/use-settings/index.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +7 -3
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js +10 -10
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/align.native.js +2 -2
- package/build/hooks/align.native.js.map +1 -1
- package/build/hooks/anchor.js +7 -6
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/background.js +16 -4
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-hooks.js +7 -8
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-renaming.js +42 -0
- package/build/hooks/block-renaming.js.map +1 -1
- package/build/hooks/content-lock-ui.js +5 -5
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/custom-class-name.js +8 -7
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/custom-fields.js +57 -52
- package/build/hooks/custom-fields.js.map +1 -1
- package/build/hooks/duotone.js +9 -20
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.js +0 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +103 -93
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +10 -9
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +10 -13
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/utils.js +30 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/constrained.js +4 -3
- package/build/layouts/constrained.js.map +1 -1
- package/build/private-apis.js +3 -0
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +30 -37
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +18 -0
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +18 -13
- package/build/store/selectors.js.map +1 -1
- package/build/utils/transform-styles/index.js +26 -6
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.js +1 -1
- package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build-module/components/block-list/block.native.js +2 -0
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +3 -10
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +16 -3
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +1 -1
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +24 -15
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +4 -2
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +36 -19
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-quick-navigation/index.js +7 -5
- package/build-module/components/block-quick-navigation/index.js.map +1 -1
- package/build-module/components/block-rename/index.js +4 -0
- package/build-module/components/block-rename/index.js.map +1 -0
- package/build-module/components/block-rename/is-empty-string.js +4 -0
- package/build-module/components/block-rename/is-empty-string.js.map +1 -0
- package/build-module/components/block-rename/modal.js +79 -0
- package/build-module/components/block-rename/modal.js.map +1 -0
- package/build-module/components/block-rename/rename-control.js +66 -0
- package/build-module/components/block-rename/rename-control.js.map +1 -0
- package/build-module/components/block-rename/use-block-rename.js +10 -0
- package/build-module/components/block-rename/use-block-rename.js.map +1 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +34 -21
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +7 -0
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +0 -8
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +17 -13
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build-module/components/block-tools/back-compat.js +1 -1
- package/build-module/components/block-tools/back-compat.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +11 -80
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/empty-block-inserter.js +48 -0
- package/build-module/components/block-tools/empty-block-inserter.js.map +1 -0
- package/build-module/components/block-tools/index.js +48 -9
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/selected-block-tools.js +105 -0
- package/build-module/components/block-tools/selected-block-tools.js.map +1 -0
- package/build-module/components/block-tools/use-selected-block-tool-props.js +50 -0
- package/build-module/components/block-tools/use-selected-block-tool-props.js.map +1 -0
- package/build-module/components/block-types-list/index.js +6 -2
- package/build-module/components/block-types-list/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +8 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/editable-text/index.js +1 -2
- package/build-module/components/editable-text/index.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +1 -1
- package/build-module/components/global-styles/advanced-panel.js.map +1 -1
- package/build-module/components/iframe/index.js +4 -3
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-size-control/index.js +0 -5
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +3 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js +30 -32
- package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/{explorer.js → index.js} +5 -5
- package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -0
- package/build-module/components/inserter/block-patterns-explorer/{sidebar.js → pattern-explorer-sidebar.js} +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -0
- package/build-module/components/inserter/block-patterns-explorer/{patterns-list.js → pattern-list.js} +3 -3
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab/index.js +66 -0
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +42 -0
- package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +100 -0
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -0
- package/build-module/components/inserter/{block-patterns-filter.js → block-patterns-tab/patterns-filter.js} +7 -20
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +47 -0
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab/utils.js +57 -0
- package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -0
- package/build-module/components/inserter/hooks/use-patterns-state.js +2 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-list.js +9 -5
- package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +15 -12
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/menu.js +4 -3
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter-listbox/index.js +13 -8
- package/build-module/components/inserter-listbox/index.js.map +1 -1
- package/build-module/components/inserter-listbox/item.js +25 -23
- package/build-module/components/inserter-listbox/item.js.map +1 -1
- package/build-module/components/inserter-listbox/row.js +6 -5
- package/build-module/components/inserter-listbox/row.js.map +1 -1
- package/build-module/components/link-control/index.js +7 -6
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +39 -0
- package/build-module/components/list-view/block-select-button.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/index.js +3 -2
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-list-view-expand-selected-item.js +2 -3
- package/build-module/components/list-view/use-list-view-expand-selected-item.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +69 -17
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/preview-options/index.js +4 -2
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +1 -14
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/index.js +0 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +4 -2
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/format-edit.js +38 -0
- package/build-module/components/rich-text/native/format-edit.js.map +1 -0
- package/build-module/components/rich-text/native/get-format-colors.native.js +34 -0
- package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -0
- package/build-module/components/rich-text/native/index.js +2 -0
- package/build-module/components/rich-text/native/index.js.map +1 -0
- package/build-module/components/rich-text/native/index.native.js +1179 -0
- package/build-module/components/rich-text/native/index.native.js.map +1 -0
- package/build-module/components/rich-text/native/toolbar-button-with-options.native.js +51 -0
- package/build-module/components/rich-text/native/toolbar-button-with-options.native.js.map +1 -0
- package/build-module/components/rich-text/native/use-format-types.js +104 -0
- package/build-module/components/rich-text/native/use-format-types.js.map +1 -0
- package/build-module/components/rich-text/use-input-rules.js +31 -2
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +2 -5
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +2 -1
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +4 -1
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +2 -1
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-settings/index.js +2 -2
- package/build-module/components/use-settings/index.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +7 -3
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js +8 -8
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/align.native.js +2 -2
- package/build-module/hooks/align.native.js.map +1 -1
- package/build-module/hooks/anchor.js +5 -4
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/background.js +17 -5
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-hooks.js +5 -6
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-renaming.js +40 -0
- package/build-module/hooks/block-renaming.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +3 -3
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +6 -5
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/custom-fields.js +57 -52
- package/build-module/hooks/custom-fields.js.map +1 -1
- package/build-module/hooks/duotone.js +10 -21
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.js +0 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +103 -93
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +11 -10
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +10 -13
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/utils.js +30 -1
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/constrained.js +4 -3
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/private-apis.js +4 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +29 -37
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +17 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +17 -13
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +24 -7
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/content-rtl.css +6 -6
- package/build-style/content.css +6 -6
- package/build-style/style-rtl.css +26 -20
- package/build-style/style.css +26 -20
- package/package.json +31 -31
- package/src/components/block-heading-level-dropdown/index.js +1 -1
- package/src/components/block-list/block.native.js +2 -0
- package/src/components/block-list/index.js +4 -18
- package/src/components/block-list-appender/index.js +20 -4
- package/src/components/block-parent-selector/index.js +1 -1
- package/src/components/block-pattern-setup/index.js +38 -22
- package/src/components/block-pattern-setup/setup-toolbar.js +2 -0
- package/src/components/block-pattern-setup/style.scss +4 -1
- package/src/components/block-patterns-list/README.md +4 -4
- package/src/components/block-patterns-list/index.js +60 -34
- package/src/components/block-patterns-list/style.scss +7 -0
- package/src/components/block-quick-navigation/index.js +11 -5
- package/src/components/block-rename/index.js +3 -0
- package/src/components/block-rename/is-empty-string.js +3 -0
- package/src/components/block-rename/modal.js +115 -0
- package/src/components/block-rename/rename-control.js +80 -0
- package/src/components/block-rename/use-block-rename.js +10 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +38 -34
- package/src/components/block-settings-menu-controls/index.js +9 -0
- package/src/components/block-styles/index.js +0 -10
- package/src/components/block-switcher/pattern-transformations-menu.js +20 -14
- package/src/components/block-toolbar/block-toolbar-menu.native.js +1 -4
- package/src/components/block-toolbar/style.scss +8 -0
- package/src/components/block-tools/back-compat.js +1 -1
- package/src/components/block-tools/block-contextual-toolbar.js +11 -134
- package/src/components/block-tools/empty-block-inserter.js +56 -0
- package/src/components/block-tools/index.js +72 -16
- package/src/components/block-tools/selected-block-tools.js +127 -0
- package/src/components/block-tools/style.scss +0 -10
- package/src/components/block-tools/use-selected-block-tool-props.js +66 -0
- package/src/components/block-types-list/index.js +5 -4
- package/src/components/button-block-appender/content.scss +2 -2
- package/src/components/date-format-picker/index.js +7 -0
- package/src/components/editable-text/README.md +0 -36
- package/src/components/editable-text/index.js +1 -8
- package/src/components/global-styles/advanced-panel.js +1 -1
- package/src/components/iframe/index.js +4 -3
- package/src/components/image-size-control/index.js +0 -6
- package/src/components/inner-blocks/index.js +6 -2
- package/src/components/inner-blocks/warning-max-depth-exceeded.native.js +57 -33
- package/src/components/inserter/block-patterns-explorer/{explorer.js → index.js} +4 -4
- package/src/components/inserter/block-patterns-explorer/{patterns-list.js → pattern-list.js} +9 -2
- package/src/components/inserter/block-patterns-tab/index.js +118 -0
- package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +48 -0
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +179 -0
- package/src/components/inserter/{block-patterns-filter.js → block-patterns-tab/patterns-filter.js} +15 -21
- package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +101 -0
- package/src/components/inserter/block-patterns-tab/utils.js +78 -0
- package/src/components/inserter/hooks/use-patterns-state.js +3 -1
- package/src/components/inserter/media-tab/media-list.js +7 -7
- package/src/components/inserter/media-tab/media-preview.js +27 -22
- package/src/components/inserter/menu.js +4 -5
- package/src/components/inserter-listbox/index.js +11 -7
- package/src/components/inserter-listbox/item.js +11 -12
- package/src/components/inserter-listbox/row.js +6 -12
- package/src/components/link-control/README.md +2 -2
- package/src/components/link-control/index.js +15 -6
- package/src/components/link-control/style.scss +8 -5
- package/src/components/list-view/block-select-button.js +44 -1
- package/src/components/list-view/block.js +11 -11
- package/src/components/list-view/index.js +2 -0
- package/src/components/list-view/use-list-view-expand-selected-item.js +7 -8
- package/src/components/media-replace-flow/style.scss +2 -2
- package/src/components/navigable-toolbar/index.js +71 -25
- package/src/components/plain-text/README.md +2 -30
- package/src/components/preview-options/index.js +2 -0
- package/src/components/provider/use-block-sync.js +2 -21
- package/src/components/rich-text/README.md +6 -63
- package/src/components/rich-text/index.js +0 -1
- package/src/components/rich-text/index.native.js +4 -2
- package/src/components/rich-text/native/format-edit.js +44 -0
- package/src/components/rich-text/native/get-format-colors.native.js +54 -0
- package/src/components/rich-text/native/index.js +1 -0
- package/src/components/rich-text/native/index.native.js +1406 -0
- package/src/components/rich-text/native/style.native.scss +28 -0
- package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +79 -0
- package/src/components/rich-text/native/test/index.native.js +278 -0
- package/src/components/rich-text/native/test/performance/rich-text.native.js +44 -0
- package/src/components/rich-text/native/toolbar-button-with-options.native.js +61 -0
- package/src/components/rich-text/native/use-format-types.js +146 -0
- package/src/components/rich-text/use-input-rules.js +30 -2
- package/src/components/rich-text/use-paste-handler.js +1 -6
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/src/components/url-input/README.md +1 -74
- package/src/components/url-popover/image-url-input-ui.js +1 -0
- package/src/components/use-block-drop-zone/index.js +4 -1
- package/src/components/use-moving-animation/index.js +1 -1
- package/src/components/use-settings/index.js +2 -2
- package/src/components/use-settings/test/index.js +1 -1
- package/src/components/writing-flow/use-tab-nav.js +8 -3
- package/src/hooks/align.js +8 -8
- package/src/hooks/align.native.js +2 -2
- package/src/hooks/anchor.js +21 -23
- package/src/hooks/background.js +28 -6
- package/src/hooks/block-hooks.js +20 -16
- package/src/hooks/block-renaming.js +47 -0
- package/src/hooks/content-lock-ui.js +3 -3
- package/src/hooks/custom-class-name.js +7 -6
- package/src/hooks/custom-fields.js +73 -70
- package/src/hooks/duotone.js +23 -33
- package/src/hooks/index.js +0 -1
- package/src/hooks/layout.js +126 -113
- package/src/hooks/position.js +8 -21
- package/src/hooks/style.js +17 -31
- package/src/hooks/test/__snapshots__/align.native.js.snap +5 -5
- package/src/hooks/test/align.js +4 -4
- package/src/hooks/utils.js +33 -1
- package/src/layouts/constrained.js +57 -50
- package/src/private-apis.js +4 -1
- package/src/store/actions.js +26 -72
- package/src/store/reducer.js +19 -0
- package/src/store/selectors.js +15 -19
- package/src/style.scss +1 -1
- package/src/utils/test/transform-styles.js +49 -0
- package/src/utils/transform-styles/index.js +39 -13
- package/build/components/block-tools/selected-block-popover.js +0 -221
- package/build/components/block-tools/selected-block-popover.js.map +0 -1
- package/build/components/inserter/block-patterns-explorer/explorer.js.map +0 -1
- package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +0 -1
- package/build/components/inserter/block-patterns-explorer/sidebar.js.map +0 -1
- package/build/components/inserter/block-patterns-filter.js.map +0 -1
- package/build/components/inserter/block-patterns-tab.js +0 -270
- package/build/components/inserter/block-patterns-tab.js.map +0 -1
- package/build/hooks/block-rename-ui.js +0 -165
- package/build/hooks/block-rename-ui.js.map +0 -1
- package/build/store/utils.js +0 -22
- package/build/store/utils.js.map +0 -1
- package/build-module/components/block-tools/selected-block-popover.js +0 -213
- package/build-module/components/block-tools/selected-block-popover.js.map +0 -1
- package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +0 -1
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +0 -1
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +0 -1
- package/build-module/components/inserter/block-patterns-filter.js.map +0 -1
- package/build-module/components/inserter/block-patterns-tab.js +0 -254
- package/build-module/components/inserter/block-patterns-tab.js.map +0 -1
- package/build-module/hooks/block-rename-ui.js +0 -157
- package/build-module/hooks/block-rename-ui.js.map +0 -1
- package/build-module/store/utils.js +0 -16
- package/build-module/store/utils.js.map +0 -1
- package/src/components/block-tools/selected-block-popover.js +0 -265
- package/src/components/inserter/block-patterns-tab.js +0 -448
- package/src/hooks/block-rename-ui.js +0 -226
- package/src/store/utils.js +0 -12
- /package/src/{hooks/block-rename-ui.scss → components/block-rename/style.scss} +0 -0
- /package/src/components/inserter/block-patterns-explorer/{sidebar.js → pattern-explorer-sidebar.js} +0 -0
package/src/hooks/position.js
CHANGED
|
@@ -14,22 +14,16 @@ import {
|
|
|
14
14
|
} from '@wordpress/components';
|
|
15
15
|
import { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';
|
|
16
16
|
import { useSelect } from '@wordpress/data';
|
|
17
|
-
import {
|
|
18
|
-
useContext,
|
|
19
|
-
useMemo,
|
|
20
|
-
createPortal,
|
|
21
|
-
Platform,
|
|
22
|
-
} from '@wordpress/element';
|
|
17
|
+
import { useMemo, Platform } from '@wordpress/element';
|
|
23
18
|
import { addFilter } from '@wordpress/hooks';
|
|
24
19
|
|
|
25
20
|
/**
|
|
26
21
|
* Internal dependencies
|
|
27
22
|
*/
|
|
28
|
-
import BlockList from '../components/block-list';
|
|
29
23
|
import { useSettings } from '../components/use-settings';
|
|
30
24
|
import InspectorControls from '../components/inspector-controls';
|
|
31
25
|
import useBlockDisplayInformation from '../components/use-block-display-information';
|
|
32
|
-
import { cleanEmptyObject } from './utils';
|
|
26
|
+
import { cleanEmptyObject, useStyleOverride } from './utils';
|
|
33
27
|
import { unlock } from '../lock-unlock';
|
|
34
28
|
import { store as blockEditorStore } from '../store';
|
|
35
29
|
|
|
@@ -329,7 +323,7 @@ export function PositionPanel( props ) {
|
|
|
329
323
|
*
|
|
330
324
|
* @return {Function} Wrapped component.
|
|
331
325
|
*/
|
|
332
|
-
export const
|
|
326
|
+
export const withPositionControls = createHigherOrderComponent(
|
|
333
327
|
( BlockEdit ) => ( props ) => {
|
|
334
328
|
const { name: blockName } = props;
|
|
335
329
|
const positionSupport = hasBlockSupport(
|
|
@@ -346,7 +340,7 @@ export const withInspectorControls = createHigherOrderComponent(
|
|
|
346
340
|
<BlockEdit key="edit" { ...props } />,
|
|
347
341
|
];
|
|
348
342
|
},
|
|
349
|
-
'
|
|
343
|
+
'withPositionControls'
|
|
350
344
|
);
|
|
351
345
|
|
|
352
346
|
/**
|
|
@@ -368,7 +362,6 @@ export const withPositionStyles = createHigherOrderComponent(
|
|
|
368
362
|
hasPositionBlockSupport && ! isPositionDisabled;
|
|
369
363
|
|
|
370
364
|
const id = useInstanceId( BlockListBlock );
|
|
371
|
-
const element = useContext( BlockList.__unstableElementContext );
|
|
372
365
|
|
|
373
366
|
// Higher specificity to override defaults in editor UI.
|
|
374
367
|
const positionSelector = `.wp-container-${ id }.wp-container-${ id }`;
|
|
@@ -392,15 +385,9 @@ export const withPositionStyles = createHigherOrderComponent(
|
|
|
392
385
|
!! attributes?.style?.position?.type,
|
|
393
386
|
} );
|
|
394
387
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
element &&
|
|
399
|
-
!! css &&
|
|
400
|
-
createPortal( <style>{ css }</style>, element ) }
|
|
401
|
-
<BlockListBlock { ...props } className={ className } />
|
|
402
|
-
</>
|
|
403
|
-
);
|
|
388
|
+
useStyleOverride( { css } );
|
|
389
|
+
|
|
390
|
+
return <BlockListBlock { ...props } className={ className } />;
|
|
404
391
|
},
|
|
405
392
|
'withPositionStyles'
|
|
406
393
|
);
|
|
@@ -413,5 +400,5 @@ addFilter(
|
|
|
413
400
|
addFilter(
|
|
414
401
|
'editor.BlockEdit',
|
|
415
402
|
'core/editor/position/with-inspector-controls',
|
|
416
|
-
|
|
403
|
+
withPositionControls
|
|
417
404
|
);
|
package/src/hooks/style.js
CHANGED
|
@@ -6,7 +6,7 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import { useMemo } from '@wordpress/element';
|
|
10
10
|
import { addFilter } from '@wordpress/hooks';
|
|
11
11
|
import {
|
|
12
12
|
getBlockSupport,
|
|
@@ -19,7 +19,6 @@ import { getCSSRules, compileCSS } from '@wordpress/style-engine';
|
|
|
19
19
|
/**
|
|
20
20
|
* Internal dependencies
|
|
21
21
|
*/
|
|
22
|
-
import BlockList from '../components/block-list';
|
|
23
22
|
import { BACKGROUND_SUPPORT_KEY, BackgroundImagePanel } from './background';
|
|
24
23
|
import { BORDER_SUPPORT_KEY, BorderPanel } from './border';
|
|
25
24
|
import { COLOR_SUPPORT_KEY, ColorEdit } from './color';
|
|
@@ -34,7 +33,7 @@ import {
|
|
|
34
33
|
DimensionsPanel,
|
|
35
34
|
} from './dimensions';
|
|
36
35
|
import useDisplayBlockControls from '../components/use-display-block-controls';
|
|
37
|
-
import { shouldSkipSerialization } from './utils';
|
|
36
|
+
import { shouldSkipSerialization, useStyleOverride } from './utils';
|
|
38
37
|
import { scopeSelector } from '../components/global-styles/utils';
|
|
39
38
|
import { useBlockEditingMode } from '../components/block-editing-mode';
|
|
40
39
|
|
|
@@ -354,7 +353,7 @@ export function addEditProps( settings ) {
|
|
|
354
353
|
*
|
|
355
354
|
* @return {Function} Wrapped component.
|
|
356
355
|
*/
|
|
357
|
-
export const
|
|
356
|
+
export const withBlockStyleControls = createHigherOrderComponent(
|
|
358
357
|
( BlockEdit ) => ( props ) => {
|
|
359
358
|
if ( ! hasStyleSupport( props.name ) ) {
|
|
360
359
|
return <BlockEdit key="edit" { ...props } />;
|
|
@@ -378,7 +377,7 @@ export const withBlockControls = createHigherOrderComponent(
|
|
|
378
377
|
</>
|
|
379
378
|
);
|
|
380
379
|
},
|
|
381
|
-
'
|
|
380
|
+
'withBlockStyleControls'
|
|
382
381
|
);
|
|
383
382
|
|
|
384
383
|
// Defines which element types are supported, including their hover styles or
|
|
@@ -484,33 +483,20 @@ const withElementsStyles = createHigherOrderComponent(
|
|
|
484
483
|
: undefined;
|
|
485
484
|
}, [ baseElementSelector, blockElementStyles, props.name ] );
|
|
486
485
|
|
|
487
|
-
|
|
486
|
+
useStyleOverride( { css: styles } );
|
|
488
487
|
|
|
489
488
|
return (
|
|
490
|
-
|
|
491
|
-
{
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
<BlockListBlock
|
|
503
|
-
{ ...props }
|
|
504
|
-
className={
|
|
505
|
-
props.attributes.style?.elements
|
|
506
|
-
? classnames(
|
|
507
|
-
props.className,
|
|
508
|
-
blockElementsContainerIdentifier
|
|
509
|
-
)
|
|
510
|
-
: props.className
|
|
511
|
-
}
|
|
512
|
-
/>
|
|
513
|
-
</>
|
|
489
|
+
<BlockListBlock
|
|
490
|
+
{ ...props }
|
|
491
|
+
className={
|
|
492
|
+
props.attributes.style?.elements
|
|
493
|
+
? classnames(
|
|
494
|
+
props.className,
|
|
495
|
+
blockElementsContainerIdentifier
|
|
496
|
+
)
|
|
497
|
+
: props.className
|
|
498
|
+
}
|
|
499
|
+
/>
|
|
514
500
|
);
|
|
515
501
|
},
|
|
516
502
|
'withElementsStyles'
|
|
@@ -537,7 +523,7 @@ addFilter(
|
|
|
537
523
|
addFilter(
|
|
538
524
|
'editor.BlockEdit',
|
|
539
525
|
'core/style/with-block-controls',
|
|
540
|
-
|
|
526
|
+
withBlockStyleControls
|
|
541
527
|
);
|
|
542
528
|
|
|
543
529
|
addFilter(
|
|
@@ -19,25 +19,25 @@ exports[`Align options for group block sets Wide width option 1`] = `
|
|
|
19
19
|
`;
|
|
20
20
|
|
|
21
21
|
exports[`Align options for media block sets Align center option 1`] = `
|
|
22
|
-
"<!-- wp:image {"
|
|
22
|
+
"<!-- wp:image {"id":1,"sizeSlug":"large","linkDestination":"none","align":"center"} -->
|
|
23
23
|
<figure class="wp-block-image aligncenter size-large"><img src="https://test-site.files.wordpress.com/local-image-1.jpeg" alt="" class="wp-image-1"/></figure>
|
|
24
24
|
<!-- /wp:image -->"
|
|
25
25
|
`;
|
|
26
26
|
|
|
27
27
|
exports[`Align options for media block sets Align left option 1`] = `
|
|
28
|
-
"<!-- wp:image {"
|
|
28
|
+
"<!-- wp:image {"id":1,"sizeSlug":"large","linkDestination":"none","align":"left"} -->
|
|
29
29
|
<figure class="wp-block-image alignleft size-large"><img src="https://test-site.files.wordpress.com/local-image-1.jpeg" alt="" class="wp-image-1"/></figure>
|
|
30
30
|
<!-- /wp:image -->"
|
|
31
31
|
`;
|
|
32
32
|
|
|
33
33
|
exports[`Align options for media block sets Align right option 1`] = `
|
|
34
|
-
"<!-- wp:image {"
|
|
34
|
+
"<!-- wp:image {"id":1,"sizeSlug":"large","linkDestination":"none","align":"right"} -->
|
|
35
35
|
<figure class="wp-block-image alignright size-large"><img src="https://test-site.files.wordpress.com/local-image-1.jpeg" alt="" class="wp-image-1"/></figure>
|
|
36
36
|
<!-- /wp:image -->"
|
|
37
37
|
`;
|
|
38
38
|
|
|
39
39
|
exports[`Align options for media block sets Full width option 1`] = `
|
|
40
|
-
"<!-- wp:image {"
|
|
40
|
+
"<!-- wp:image {"id":1,"sizeSlug":"large","linkDestination":"none","align":"full"} -->
|
|
41
41
|
<figure class="wp-block-image alignfull size-large"><img src="https://test-site.files.wordpress.com/local-image-1.jpeg" alt="" class="wp-image-1"/></figure>
|
|
42
42
|
<!-- /wp:image -->"
|
|
43
43
|
`;
|
|
@@ -49,7 +49,7 @@ exports[`Align options for media block sets None option 1`] = `
|
|
|
49
49
|
`;
|
|
50
50
|
|
|
51
51
|
exports[`Align options for media block sets Wide width option 1`] = `
|
|
52
|
-
"<!-- wp:image {"
|
|
52
|
+
"<!-- wp:image {"id":1,"sizeSlug":"large","linkDestination":"none","align":"wide"} -->
|
|
53
53
|
<figure class="wp-block-image alignwide size-large"><img src="https://test-site.files.wordpress.com/local-image-1.jpeg" alt="" class="wp-image-1"/></figure>
|
|
54
54
|
<!-- /wp:image -->"
|
|
55
55
|
`;
|
package/src/hooks/test/align.js
CHANGED
|
@@ -22,7 +22,7 @@ import BlockEdit from '../../components/block-edit';
|
|
|
22
22
|
import BlockEditorProvider from '../../components/provider';
|
|
23
23
|
import {
|
|
24
24
|
getValidAlignments,
|
|
25
|
-
|
|
25
|
+
withAlignmentControls,
|
|
26
26
|
withDataAlign,
|
|
27
27
|
addAssignedAlign,
|
|
28
28
|
} from '../align';
|
|
@@ -157,7 +157,7 @@ describe( 'align', () => {
|
|
|
157
157
|
} );
|
|
158
158
|
} );
|
|
159
159
|
|
|
160
|
-
describe( '
|
|
160
|
+
describe( 'withAlignControls', () => {
|
|
161
161
|
const componentProps = {
|
|
162
162
|
name: 'core/foo',
|
|
163
163
|
attributes: {},
|
|
@@ -167,7 +167,7 @@ describe( 'align', () => {
|
|
|
167
167
|
it( 'should do nothing if no valid alignments', () => {
|
|
168
168
|
registerBlockType( 'core/foo', blockSettings );
|
|
169
169
|
|
|
170
|
-
const EnhancedComponent =
|
|
170
|
+
const EnhancedComponent = withAlignmentControls(
|
|
171
171
|
( { wrapperProps } ) => <div { ...wrapperProps } />
|
|
172
172
|
);
|
|
173
173
|
|
|
@@ -197,7 +197,7 @@ describe( 'align', () => {
|
|
|
197
197
|
},
|
|
198
198
|
} );
|
|
199
199
|
|
|
200
|
-
const EnhancedComponent =
|
|
200
|
+
const EnhancedComponent = withAlignmentControls(
|
|
201
201
|
( { wrapperProps } ) => <div { ...wrapperProps } />
|
|
202
202
|
);
|
|
203
203
|
|
package/src/hooks/utils.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { getBlockSupport } from '@wordpress/blocks';
|
|
5
|
-
import { useMemo } from '@wordpress/element';
|
|
5
|
+
import { useMemo, useEffect, useId } from '@wordpress/element';
|
|
6
|
+
import { useDispatch } from '@wordpress/data';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
@@ -10,6 +11,8 @@ import { useMemo } from '@wordpress/element';
|
|
|
10
11
|
import { useSettings } from '../components';
|
|
11
12
|
import { useSettingsForBlockElement } from '../components/global-styles/hooks';
|
|
12
13
|
import { getValueFromObjectPath, setImmutably } from '../utils/object';
|
|
14
|
+
import { store as blockEditorStore } from '../store';
|
|
15
|
+
import { unlock } from '../lock-unlock';
|
|
13
16
|
|
|
14
17
|
/**
|
|
15
18
|
* Removed falsy values from nested object.
|
|
@@ -115,6 +118,35 @@ export function shouldSkipSerialization( blockType, featureSet, feature ) {
|
|
|
115
118
|
return skipSerialization;
|
|
116
119
|
}
|
|
117
120
|
|
|
121
|
+
export function useStyleOverride( { id, css, assets, __unstableType } = {} ) {
|
|
122
|
+
const { setStyleOverride, deleteStyleOverride } = unlock(
|
|
123
|
+
useDispatch( blockEditorStore )
|
|
124
|
+
);
|
|
125
|
+
const fallbackId = useId();
|
|
126
|
+
useEffect( () => {
|
|
127
|
+
// Unmount if there is CSS and assets are empty.
|
|
128
|
+
if ( ! css && ! assets ) return;
|
|
129
|
+
const _id = id || fallbackId;
|
|
130
|
+
setStyleOverride( _id, {
|
|
131
|
+
id,
|
|
132
|
+
css,
|
|
133
|
+
assets,
|
|
134
|
+
__unstableType,
|
|
135
|
+
} );
|
|
136
|
+
return () => {
|
|
137
|
+
deleteStyleOverride( _id );
|
|
138
|
+
};
|
|
139
|
+
}, [
|
|
140
|
+
id,
|
|
141
|
+
css,
|
|
142
|
+
assets,
|
|
143
|
+
__unstableType,
|
|
144
|
+
fallbackId,
|
|
145
|
+
setStyleOverride,
|
|
146
|
+
deleteStyleOverride,
|
|
147
|
+
] );
|
|
148
|
+
}
|
|
149
|
+
|
|
118
150
|
/**
|
|
119
151
|
* Based on the block and its context, returns an object of all the block settings.
|
|
120
152
|
* This object can be passed as a prop to all the Styles UI components
|
|
@@ -36,7 +36,10 @@ export default {
|
|
|
36
36
|
layoutBlockSupport = {},
|
|
37
37
|
} ) {
|
|
38
38
|
const { wideSize, contentSize, justifyContent = 'center' } = layout;
|
|
39
|
-
const {
|
|
39
|
+
const {
|
|
40
|
+
allowJustification = true,
|
|
41
|
+
allowCustomContentAndWideSize = true,
|
|
42
|
+
} = layoutBlockSupport;
|
|
40
43
|
const onJustificationChange = ( value ) => {
|
|
41
44
|
onChange( {
|
|
42
45
|
...layout,
|
|
@@ -66,55 +69,59 @@ export default {
|
|
|
66
69
|
} );
|
|
67
70
|
return (
|
|
68
71
|
<>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
<
|
|
72
|
-
className="block-editor-hooks__layout-controls-unit
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
className="block-editor-hooks__layout-controls-unit
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
72
|
+
{ allowCustomContentAndWideSize && (
|
|
73
|
+
<>
|
|
74
|
+
<div className="block-editor-hooks__layout-controls">
|
|
75
|
+
<div className="block-editor-hooks__layout-controls-unit">
|
|
76
|
+
<UnitControl
|
|
77
|
+
className="block-editor-hooks__layout-controls-unit-input"
|
|
78
|
+
label={ __( 'Content' ) }
|
|
79
|
+
labelPosition="top"
|
|
80
|
+
__unstableInputWidth="80px"
|
|
81
|
+
value={ contentSize || wideSize || '' }
|
|
82
|
+
onChange={ ( nextWidth ) => {
|
|
83
|
+
nextWidth =
|
|
84
|
+
0 > parseFloat( nextWidth )
|
|
85
|
+
? '0'
|
|
86
|
+
: nextWidth;
|
|
87
|
+
onChange( {
|
|
88
|
+
...layout,
|
|
89
|
+
contentSize: nextWidth,
|
|
90
|
+
} );
|
|
91
|
+
} }
|
|
92
|
+
units={ units }
|
|
93
|
+
/>
|
|
94
|
+
<Icon icon={ positionCenter } />
|
|
95
|
+
</div>
|
|
96
|
+
<div className="block-editor-hooks__layout-controls-unit">
|
|
97
|
+
<UnitControl
|
|
98
|
+
className="block-editor-hooks__layout-controls-unit-input"
|
|
99
|
+
label={ __( 'Wide' ) }
|
|
100
|
+
labelPosition="top"
|
|
101
|
+
__unstableInputWidth="80px"
|
|
102
|
+
value={ wideSize || contentSize || '' }
|
|
103
|
+
onChange={ ( nextWidth ) => {
|
|
104
|
+
nextWidth =
|
|
105
|
+
0 > parseFloat( nextWidth )
|
|
106
|
+
? '0'
|
|
107
|
+
: nextWidth;
|
|
108
|
+
onChange( {
|
|
109
|
+
...layout,
|
|
110
|
+
wideSize: nextWidth,
|
|
111
|
+
} );
|
|
112
|
+
} }
|
|
113
|
+
units={ units }
|
|
114
|
+
/>
|
|
115
|
+
<Icon icon={ stretchWide } />
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
<p className="block-editor-hooks__layout-controls-helptext">
|
|
119
|
+
{ __(
|
|
120
|
+
'Customize the width for all elements that are assigned to the center or wide columns.'
|
|
121
|
+
) }
|
|
122
|
+
</p>
|
|
123
|
+
</>
|
|
124
|
+
) }
|
|
118
125
|
{ allowJustification && (
|
|
119
126
|
<ToggleGroupControl
|
|
120
127
|
__nextHasNoMarginBottom
|
package/src/private-apis.js
CHANGED
|
@@ -10,8 +10,9 @@ import ResizableBoxPopover from './components/resizable-box-popover';
|
|
|
10
10
|
import { ComposedPrivateInserter as PrivateInserter } from './components/inserter';
|
|
11
11
|
import { PrivateListView } from './components/list-view';
|
|
12
12
|
import BlockInfo from './components/block-info-slot-fill';
|
|
13
|
+
import BlockContextualToolbar from './components/block-tools/block-contextual-toolbar';
|
|
13
14
|
import { useShouldContextualToolbarShow } from './utils/use-should-contextual-toolbar-show';
|
|
14
|
-
import { cleanEmptyObject } from './hooks/utils';
|
|
15
|
+
import { cleanEmptyObject, useStyleOverride } from './hooks/utils';
|
|
15
16
|
import BlockQuickNavigation from './components/block-quick-navigation';
|
|
16
17
|
import { LayoutStyle } from './components/block-list/layout';
|
|
17
18
|
import { BlockRemovalWarningModal } from './components/block-removal-warning-modal';
|
|
@@ -41,8 +42,10 @@ lock( privateApis, {
|
|
|
41
42
|
PrivateListView,
|
|
42
43
|
ResizableBoxPopover,
|
|
43
44
|
BlockInfo,
|
|
45
|
+
BlockContextualToolbar,
|
|
44
46
|
useShouldContextualToolbarShow,
|
|
45
47
|
cleanEmptyObject,
|
|
48
|
+
useStyleOverride,
|
|
46
49
|
BlockQuickNavigation,
|
|
47
50
|
LayoutStyle,
|
|
48
51
|
BlockRemovalWarningModal,
|
package/src/store/actions.js
CHANGED
|
@@ -23,7 +23,6 @@ import deprecated from '@wordpress/deprecated';
|
|
|
23
23
|
/**
|
|
24
24
|
* Internal dependencies
|
|
25
25
|
*/
|
|
26
|
-
import { mapRichTextSettings } from './utils';
|
|
27
26
|
import {
|
|
28
27
|
retrieveSelectedAttribute,
|
|
29
28
|
START_OF_SELECTED_AREA,
|
|
@@ -759,43 +758,23 @@ export const __unstableDeleteSelection =
|
|
|
759
758
|
const selectionB = selectionEnd;
|
|
760
759
|
|
|
761
760
|
const blockA = select.getBlock( selectionA.clientId );
|
|
762
|
-
const blockAType = getBlockType( blockA.name );
|
|
763
|
-
|
|
764
761
|
const blockB = select.getBlock( selectionB.clientId );
|
|
765
|
-
const blockBType = getBlockType( blockB.name );
|
|
766
762
|
|
|
767
763
|
const htmlA = blockA.attributes[ selectionA.attributeKey ];
|
|
768
764
|
const htmlB = blockB.attributes[ selectionB.attributeKey ];
|
|
769
765
|
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
const attributeDefinitionB =
|
|
773
|
-
blockBType.attributes[ selectionB.attributeKey ];
|
|
774
|
-
|
|
775
|
-
let valueA = create( {
|
|
776
|
-
html: htmlA,
|
|
777
|
-
...mapRichTextSettings( attributeDefinitionA ),
|
|
778
|
-
} );
|
|
779
|
-
let valueB = create( {
|
|
780
|
-
html: htmlB,
|
|
781
|
-
...mapRichTextSettings( attributeDefinitionB ),
|
|
782
|
-
} );
|
|
766
|
+
let valueA = create( { html: htmlA } );
|
|
767
|
+
let valueB = create( { html: htmlB } );
|
|
783
768
|
|
|
784
769
|
valueA = remove( valueA, selectionA.offset, valueA.text.length );
|
|
785
770
|
valueB = insert( valueB, START_OF_SELECTED_AREA, 0, selectionB.offset );
|
|
786
771
|
|
|
787
772
|
// Clone the blocks so we don't manipulate the original.
|
|
788
773
|
const cloneA = cloneBlock( blockA, {
|
|
789
|
-
[ selectionA.attributeKey ]: toHTMLString( {
|
|
790
|
-
value: valueA,
|
|
791
|
-
...mapRichTextSettings( attributeDefinitionA ),
|
|
792
|
-
} ),
|
|
774
|
+
[ selectionA.attributeKey ]: toHTMLString( { value: valueA } ),
|
|
793
775
|
} );
|
|
794
776
|
const cloneB = cloneBlock( blockB, {
|
|
795
|
-
[ selectionB.attributeKey ]: toHTMLString( {
|
|
796
|
-
value: valueB,
|
|
797
|
-
...mapRichTextSettings( attributeDefinitionB ),
|
|
798
|
-
} ),
|
|
777
|
+
[ selectionB.attributeKey ]: toHTMLString( { value: valueB } ),
|
|
799
778
|
} );
|
|
800
779
|
|
|
801
780
|
const followingBlock = isForward ? cloneA : cloneB;
|
|
@@ -831,20 +810,10 @@ export const __unstableDeleteSelection =
|
|
|
831
810
|
const newAttributeKey = retrieveSelectedAttribute( updatedAttributes );
|
|
832
811
|
|
|
833
812
|
const convertedHtml = updatedAttributes[ newAttributeKey ];
|
|
834
|
-
const convertedValue = create( {
|
|
835
|
-
html: convertedHtml,
|
|
836
|
-
...mapRichTextSettings(
|
|
837
|
-
targetBlockType.attributes[ newAttributeKey ]
|
|
838
|
-
),
|
|
839
|
-
} );
|
|
813
|
+
const convertedValue = create( { html: convertedHtml } );
|
|
840
814
|
const newOffset = convertedValue.text.indexOf( START_OF_SELECTED_AREA );
|
|
841
815
|
const newValue = remove( convertedValue, newOffset, newOffset + 1 );
|
|
842
|
-
const newHtml = toHTMLString( {
|
|
843
|
-
value: newValue,
|
|
844
|
-
...mapRichTextSettings(
|
|
845
|
-
targetBlockType.attributes[ newAttributeKey ]
|
|
846
|
-
),
|
|
847
|
-
} );
|
|
816
|
+
const newHtml = toHTMLString( { value: newValue } );
|
|
848
817
|
|
|
849
818
|
updatedAttributes[ newAttributeKey ] = newHtml;
|
|
850
819
|
|
|
@@ -931,27 +900,13 @@ export const __unstableSplitSelection =
|
|
|
931
900
|
const selectionB = selectionEnd;
|
|
932
901
|
|
|
933
902
|
const blockA = select.getBlock( selectionA.clientId );
|
|
934
|
-
const blockAType = getBlockType( blockA.name );
|
|
935
|
-
|
|
936
903
|
const blockB = select.getBlock( selectionB.clientId );
|
|
937
|
-
const blockBType = getBlockType( blockB.name );
|
|
938
904
|
|
|
939
905
|
const htmlA = blockA.attributes[ selectionA.attributeKey ];
|
|
940
906
|
const htmlB = blockB.attributes[ selectionB.attributeKey ];
|
|
941
907
|
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
const attributeDefinitionB =
|
|
945
|
-
blockBType.attributes[ selectionB.attributeKey ];
|
|
946
|
-
|
|
947
|
-
let valueA = create( {
|
|
948
|
-
html: htmlA,
|
|
949
|
-
...mapRichTextSettings( attributeDefinitionA ),
|
|
950
|
-
} );
|
|
951
|
-
let valueB = create( {
|
|
952
|
-
html: htmlB,
|
|
953
|
-
...mapRichTextSettings( attributeDefinitionB ),
|
|
954
|
-
} );
|
|
908
|
+
let valueA = create( { html: htmlA } );
|
|
909
|
+
let valueB = create( { html: htmlB } );
|
|
955
910
|
|
|
956
911
|
valueA = remove( valueA, selectionA.offset, valueA.text.length );
|
|
957
912
|
valueB = remove( valueB, 0, selectionB.offset );
|
|
@@ -964,7 +919,6 @@ export const __unstableSplitSelection =
|
|
|
964
919
|
...blockA.attributes,
|
|
965
920
|
[ selectionA.attributeKey ]: toHTMLString( {
|
|
966
921
|
value: valueA,
|
|
967
|
-
...mapRichTextSettings( attributeDefinitionA ),
|
|
968
922
|
} ),
|
|
969
923
|
},
|
|
970
924
|
},
|
|
@@ -975,7 +929,6 @@ export const __unstableSplitSelection =
|
|
|
975
929
|
...blockB.attributes,
|
|
976
930
|
[ selectionB.attributeKey ]: toHTMLString( {
|
|
977
931
|
value: valueB,
|
|
978
|
-
...mapRichTextSettings( attributeDefinitionB ),
|
|
979
932
|
} ),
|
|
980
933
|
},
|
|
981
934
|
},
|
|
@@ -1143,10 +1096,7 @@ export const mergeBlocks =
|
|
|
1143
1096
|
const selectedBlock = clientId === clientIdA ? cloneA : cloneB;
|
|
1144
1097
|
const html = selectedBlock.attributes[ attributeKey ];
|
|
1145
1098
|
const value = insert(
|
|
1146
|
-
create( {
|
|
1147
|
-
html,
|
|
1148
|
-
...mapRichTextSettings( attributeDefinition ),
|
|
1149
|
-
} ),
|
|
1099
|
+
create( { html } ),
|
|
1150
1100
|
START_OF_SELECTED_AREA,
|
|
1151
1101
|
offset,
|
|
1152
1102
|
offset
|
|
@@ -1154,7 +1104,6 @@ export const mergeBlocks =
|
|
|
1154
1104
|
|
|
1155
1105
|
selectedBlock.attributes[ attributeKey ] = toHTMLString( {
|
|
1156
1106
|
value,
|
|
1157
|
-
...mapRichTextSettings( attributeDefinition ),
|
|
1158
1107
|
} );
|
|
1159
1108
|
}
|
|
1160
1109
|
|
|
@@ -1180,22 +1129,12 @@ export const mergeBlocks =
|
|
|
1180
1129
|
const newAttributeKey =
|
|
1181
1130
|
retrieveSelectedAttribute( updatedAttributes );
|
|
1182
1131
|
const convertedHtml = updatedAttributes[ newAttributeKey ];
|
|
1183
|
-
const convertedValue = create( {
|
|
1184
|
-
html: convertedHtml,
|
|
1185
|
-
...mapRichTextSettings(
|
|
1186
|
-
blockAType.attributes[ newAttributeKey ]
|
|
1187
|
-
),
|
|
1188
|
-
} );
|
|
1132
|
+
const convertedValue = create( { html: convertedHtml } );
|
|
1189
1133
|
const newOffset = convertedValue.text.indexOf(
|
|
1190
1134
|
START_OF_SELECTED_AREA
|
|
1191
1135
|
);
|
|
1192
1136
|
const newValue = remove( convertedValue, newOffset, newOffset + 1 );
|
|
1193
|
-
const newHtml = toHTMLString( {
|
|
1194
|
-
value: newValue,
|
|
1195
|
-
...mapRichTextSettings(
|
|
1196
|
-
blockAType.attributes[ newAttributeKey ]
|
|
1197
|
-
),
|
|
1198
|
-
} );
|
|
1137
|
+
const newHtml = toHTMLString( { value: newValue } );
|
|
1199
1138
|
|
|
1200
1139
|
updatedAttributes[ newAttributeKey ] = newHtml;
|
|
1201
1140
|
|
|
@@ -1980,3 +1919,18 @@ export function unsetBlockEditingMode( clientId = '' ) {
|
|
|
1980
1919
|
clientId,
|
|
1981
1920
|
};
|
|
1982
1921
|
}
|
|
1922
|
+
|
|
1923
|
+
/**
|
|
1924
|
+
* Action that sets the element that had focus when focus leaves the editor canvas.
|
|
1925
|
+
*
|
|
1926
|
+
* @param {Object} lastFocus The last focused element.
|
|
1927
|
+
*
|
|
1928
|
+
*
|
|
1929
|
+
* @return {Object} Action object.
|
|
1930
|
+
*/
|
|
1931
|
+
export function setLastFocus( lastFocus = null ) {
|
|
1932
|
+
return {
|
|
1933
|
+
type: 'LAST_FOCUS',
|
|
1934
|
+
lastFocus,
|
|
1935
|
+
};
|
|
1936
|
+
}
|
package/src/store/reducer.js
CHANGED
|
@@ -1962,6 +1962,24 @@ export function registeredInserterMediaCategories( state = [], action ) {
|
|
|
1962
1962
|
case 'REGISTER_INSERTER_MEDIA_CATEGORY':
|
|
1963
1963
|
return [ ...state, action.category ];
|
|
1964
1964
|
}
|
|
1965
|
+
|
|
1966
|
+
return state;
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
/**
|
|
1970
|
+
* Reducer setting last focused element
|
|
1971
|
+
*
|
|
1972
|
+
* @param {boolean} state Current state.
|
|
1973
|
+
* @param {Object} action Dispatched action.
|
|
1974
|
+
*
|
|
1975
|
+
* @return {boolean} Updated state.
|
|
1976
|
+
*/
|
|
1977
|
+
export function lastFocus( state = false, action ) {
|
|
1978
|
+
switch ( action.type ) {
|
|
1979
|
+
case 'LAST_FOCUS':
|
|
1980
|
+
return action.lastFocus;
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1965
1983
|
return state;
|
|
1966
1984
|
}
|
|
1967
1985
|
|
|
@@ -1981,6 +1999,7 @@ const combinedReducers = combineReducers( {
|
|
|
1981
1999
|
settings,
|
|
1982
2000
|
preferences,
|
|
1983
2001
|
lastBlockAttributesChange,
|
|
2002
|
+
lastFocus,
|
|
1984
2003
|
editorMode,
|
|
1985
2004
|
hasBlockMovingClientId,
|
|
1986
2005
|
highlightedBlock,
|