@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
|
@@ -35,7 +35,6 @@ export function usePasteHandler( props ) {
|
|
|
35
35
|
onReplace,
|
|
36
36
|
onSplit,
|
|
37
37
|
__unstableEmbedURLOnPaste,
|
|
38
|
-
preserveWhiteSpace,
|
|
39
38
|
pastePlainText,
|
|
40
39
|
} = propsRef.current;
|
|
41
40
|
|
|
@@ -63,10 +62,7 @@ export function usePasteHandler( props ) {
|
|
|
63
62
|
// without filtering the data. The filters are only meant for externally
|
|
64
63
|
// pasted content and remove inline styles.
|
|
65
64
|
if ( isInternal ) {
|
|
66
|
-
const pastedValue = create( {
|
|
67
|
-
html,
|
|
68
|
-
preserveWhiteSpace,
|
|
69
|
-
} );
|
|
65
|
+
const pastedValue = create( { html } );
|
|
70
66
|
addActiveFormats( pastedValue, value.activeFormats );
|
|
71
67
|
onChange( insert( value, pastedValue ) );
|
|
72
68
|
return;
|
|
@@ -136,7 +132,6 @@ export function usePasteHandler( props ) {
|
|
|
136
132
|
plainText,
|
|
137
133
|
mode,
|
|
138
134
|
tagName,
|
|
139
|
-
preserveWhiteSpace,
|
|
140
135
|
} );
|
|
141
136
|
|
|
142
137
|
if ( typeof content === 'string' ) {
|
|
@@ -139,7 +139,7 @@ export default function SpacingInputControl( {
|
|
|
139
139
|
useMemo(
|
|
140
140
|
() => parseQuantityAndUnitFromRawValue( currentValue ),
|
|
141
141
|
[ currentValue ]
|
|
142
|
-
)[ 1 ] || units[ 0 ]
|
|
142
|
+
)[ 1 ] || units[ 0 ]?.value;
|
|
143
143
|
|
|
144
144
|
const setInitialValue = () => {
|
|
145
145
|
if ( value === undefined ) {
|
|
@@ -36,41 +36,6 @@ This prop is passed directly to the `URLInput` component.
|
|
|
36
36
|
|
|
37
37
|
## Example
|
|
38
38
|
|
|
39
|
-
{% codetabs %}
|
|
40
|
-
{% ES5 %}
|
|
41
|
-
|
|
42
|
-
```js
|
|
43
|
-
wp.blocks.registerBlockType( /* ... */, {
|
|
44
|
-
// ...
|
|
45
|
-
|
|
46
|
-
attributes: {
|
|
47
|
-
url: {
|
|
48
|
-
type: 'string'
|
|
49
|
-
},
|
|
50
|
-
text: {
|
|
51
|
-
type: 'string'
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
edit: function( props ) {
|
|
56
|
-
return React.createElement( wp.blockEditor.URLInputButton, {
|
|
57
|
-
className: props.className,
|
|
58
|
-
url: props.attributes.url,
|
|
59
|
-
onChange: function( url, post ) {
|
|
60
|
-
props.setAttributes( { url: url, text: (post && post.title) || 'Click here' } );
|
|
61
|
-
}
|
|
62
|
-
} );
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
save: function( props ) {
|
|
66
|
-
return React.createElement( 'a', {
|
|
67
|
-
href: props.attributes.url,
|
|
68
|
-
}, props.attributes.text );
|
|
69
|
-
}
|
|
70
|
-
} );
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
{% ESNext %}
|
|
74
39
|
|
|
75
40
|
```js
|
|
76
41
|
import { registerBlockType } from '@wordpress/blocks';
|
|
@@ -103,7 +68,6 @@ registerBlockType( /* ... */, {
|
|
|
103
68
|
} );
|
|
104
69
|
```
|
|
105
70
|
|
|
106
|
-
{% end %}
|
|
107
71
|
|
|
108
72
|
# `URLInput`
|
|
109
73
|
|
|
@@ -139,7 +103,7 @@ _Required._ Called when the value changes. The second parameter is `null` unless
|
|
|
139
103
|
}
|
|
140
104
|
```
|
|
141
105
|
|
|
142
|
-
### `
|
|
106
|
+
### `onKeyDown`: `( event: KeyboardEvent ) => void`
|
|
143
107
|
|
|
144
108
|
A callback invoked on the keydown event.
|
|
145
109
|
|
|
@@ -172,41 +136,6 @@ Start opting into the new margin-free styles that will become the default in a f
|
|
|
172
136
|
|
|
173
137
|
## Example
|
|
174
138
|
|
|
175
|
-
{% codetabs %}
|
|
176
|
-
{% ES5 %}
|
|
177
|
-
|
|
178
|
-
```js
|
|
179
|
-
wp.blocks.registerBlockType( /* ... */, {
|
|
180
|
-
// ...
|
|
181
|
-
|
|
182
|
-
attributes: {
|
|
183
|
-
url: {
|
|
184
|
-
type: 'string'
|
|
185
|
-
},
|
|
186
|
-
text: {
|
|
187
|
-
type: 'string'
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
edit: function( props ) {
|
|
192
|
-
return React.createElement( wp.blockEditor.URLInput, {
|
|
193
|
-
className: props.className,
|
|
194
|
-
value: props.attributes.url,
|
|
195
|
-
onChange: function( url, post ) {
|
|
196
|
-
props.setAttributes( { url: url, text: (post && post.title) || 'Click here' } );
|
|
197
|
-
}
|
|
198
|
-
} );
|
|
199
|
-
},
|
|
200
|
-
|
|
201
|
-
save: function( props ) {
|
|
202
|
-
return React.createElement( 'a', {
|
|
203
|
-
href: props.attributes.url,
|
|
204
|
-
}, props.attributes.text );
|
|
205
|
-
}
|
|
206
|
-
} );
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
{% ESNext %}
|
|
210
139
|
|
|
211
140
|
```js
|
|
212
141
|
import { registerBlockType } from '@wordpress/blocks';
|
|
@@ -240,5 +169,3 @@ registerBlockType( /* ... */, {
|
|
|
240
169
|
}
|
|
241
170
|
} );
|
|
242
171
|
```
|
|
243
|
-
|
|
244
|
-
{% end %}
|
|
@@ -127,7 +127,8 @@ export function getDropTargetPosition(
|
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
129
|
* @typedef {Object} WPBlockDropZoneConfig
|
|
130
|
-
* @property {
|
|
130
|
+
* @property {?HTMLElement} dropZoneElement Optional element to be used as the drop zone.
|
|
131
|
+
* @property {string} rootClientId The root client id for the block list.
|
|
131
132
|
*/
|
|
132
133
|
|
|
133
134
|
/**
|
|
@@ -136,6 +137,7 @@ export function getDropTargetPosition(
|
|
|
136
137
|
* @param {WPBlockDropZoneConfig} dropZoneConfig configuration data for the drop zone.
|
|
137
138
|
*/
|
|
138
139
|
export default function useBlockDropZone( {
|
|
140
|
+
dropZoneElement,
|
|
139
141
|
// An undefined value represents a top-level block. Default to an empty
|
|
140
142
|
// string for this so that `targetRootClientId` can be easily compared to
|
|
141
143
|
// values returned by the `getRootBlockClientId` selector, which also uses
|
|
@@ -235,6 +237,7 @@ export default function useBlockDropZone( {
|
|
|
235
237
|
);
|
|
236
238
|
|
|
237
239
|
return useDropZone( {
|
|
240
|
+
dropZoneElement,
|
|
238
241
|
isDisabled,
|
|
239
242
|
onDrop: onBlockDrop,
|
|
240
243
|
onDragOver( event ) {
|
|
@@ -129,7 +129,7 @@ function useMovingAnimation( {
|
|
|
129
129
|
const finishedMoving = x === 0 && y === 0;
|
|
130
130
|
ref.current.style.transformOrigin = 'center center';
|
|
131
131
|
ref.current.style.transform = finishedMoving
|
|
132
|
-
?
|
|
132
|
+
? null // Set to `null` to explicitly remove the transform.
|
|
133
133
|
: `translate3d(${ x }px,${ y }px,0)`;
|
|
134
134
|
ref.current.style.zIndex = isSelected ? '1' : '';
|
|
135
135
|
|
|
@@ -254,7 +254,7 @@ export function useSettings( ...paths ) {
|
|
|
254
254
|
*
|
|
255
255
|
* @param {string} path The path to the setting.
|
|
256
256
|
* @return {any} Returns the value defined for the setting.
|
|
257
|
-
* @deprecated 6.
|
|
257
|
+
* @deprecated 6.5.0 Use useSettings instead.
|
|
258
258
|
* @example
|
|
259
259
|
* ```js
|
|
260
260
|
* const isEnabled = useSetting( 'typography.dropCap' );
|
|
@@ -262,7 +262,7 @@ export function useSettings( ...paths ) {
|
|
|
262
262
|
*/
|
|
263
263
|
export function useSetting( path ) {
|
|
264
264
|
deprecated( 'wp.blockEditor.useSetting', {
|
|
265
|
-
since: '6.
|
|
265
|
+
since: '6.5',
|
|
266
266
|
alternative: 'wp.blockEditor.useSettings',
|
|
267
267
|
note: 'The new useSettings function can retrieve multiple settings at once, with better performance.',
|
|
268
268
|
} );
|
|
@@ -135,7 +135,7 @@ describe( 'useSettings', () => {
|
|
|
135
135
|
const result = runHook( () => useSetting( 'layout.contentSize' ) );
|
|
136
136
|
expect( result ).toBe( '840px' );
|
|
137
137
|
expect( console ).toHaveWarnedWith(
|
|
138
|
-
'wp.blockEditor.useSetting is deprecated since version 6.
|
|
138
|
+
'wp.blockEditor.useSetting is deprecated since version 6.5. Please use wp.blockEditor.useSettings instead.'
|
|
139
139
|
);
|
|
140
140
|
} );
|
|
141
141
|
} );
|
|
@@ -17,15 +17,20 @@ export default function useTabNav() {
|
|
|
17
17
|
const container = useRef();
|
|
18
18
|
const focusCaptureBeforeRef = useRef();
|
|
19
19
|
const focusCaptureAfterRef = useRef();
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
const { hasMultiSelection, getSelectedBlockClientId, getBlockCount } =
|
|
22
22
|
useSelect( blockEditorStore );
|
|
23
|
-
const { setNavigationMode } = useDispatch( blockEditorStore );
|
|
23
|
+
const { setNavigationMode, setLastFocus } = useDispatch( blockEditorStore );
|
|
24
24
|
const isNavigationMode = useSelect(
|
|
25
25
|
( select ) => select( blockEditorStore ).isNavigationMode(),
|
|
26
26
|
[]
|
|
27
27
|
);
|
|
28
28
|
|
|
29
|
+
const lastFocus = useSelect(
|
|
30
|
+
( select ) => select( blockEditorStore ).getLastFocus(),
|
|
31
|
+
[]
|
|
32
|
+
);
|
|
33
|
+
|
|
29
34
|
// Don't allow tabbing to this element in Navigation mode.
|
|
30
35
|
const focusCaptureTabIndex = ! isNavigationMode ? '0' : undefined;
|
|
31
36
|
|
|
@@ -158,7 +163,7 @@ export default function useTabNav() {
|
|
|
158
163
|
}
|
|
159
164
|
|
|
160
165
|
function onFocusOut( event ) {
|
|
161
|
-
lastFocus
|
|
166
|
+
setLastFocus( { ...lastFocus, current: event.target } );
|
|
162
167
|
|
|
163
168
|
const { ownerDocument } = node;
|
|
164
169
|
|
package/src/hooks/align.js
CHANGED
|
@@ -98,8 +98,8 @@ export function addAttribute( settings ) {
|
|
|
98
98
|
...settings.attributes,
|
|
99
99
|
align: {
|
|
100
100
|
type: 'string',
|
|
101
|
-
// Allow for '' since it is used by updateAlignment function
|
|
102
|
-
// in
|
|
101
|
+
// Allow for '' since it is used by the `updateAlignment` function
|
|
102
|
+
// in toolbar controls for special cases with defined default values.
|
|
103
103
|
enum: [ ...ALL_ALIGNMENTS, '' ],
|
|
104
104
|
},
|
|
105
105
|
};
|
|
@@ -115,7 +115,7 @@ function BlockEditAlignmentToolbarControls( {
|
|
|
115
115
|
} ) {
|
|
116
116
|
// Compute the block valid alignments by taking into account,
|
|
117
117
|
// if the theme supports wide alignments or not and the layout's
|
|
118
|
-
//
|
|
118
|
+
// available alignments. We do that for conditionally rendering
|
|
119
119
|
// Slot.
|
|
120
120
|
const blockAllowedAlignments = getValidAlignments(
|
|
121
121
|
getBlockSupport( blockName, 'align' ),
|
|
@@ -160,7 +160,7 @@ function BlockEditAlignmentToolbarControls( {
|
|
|
160
160
|
*
|
|
161
161
|
* @return {Function} Wrapped component.
|
|
162
162
|
*/
|
|
163
|
-
export const
|
|
163
|
+
export const withAlignmentControls = createHigherOrderComponent(
|
|
164
164
|
( BlockEdit ) => ( props ) => {
|
|
165
165
|
const hasAlignmentSupport = hasBlockSupport(
|
|
166
166
|
props.name,
|
|
@@ -181,7 +181,7 @@ export const withToolbarControls = createHigherOrderComponent(
|
|
|
181
181
|
</>
|
|
182
182
|
);
|
|
183
183
|
},
|
|
184
|
-
'
|
|
184
|
+
'withAlignmentControls'
|
|
185
185
|
);
|
|
186
186
|
|
|
187
187
|
function BlockListBlockWithDataAlign( { block: BlockListBlock, props } ) {
|
|
@@ -257,7 +257,7 @@ export function addAssignedAlign( props, blockType, attributes ) {
|
|
|
257
257
|
|
|
258
258
|
addFilter(
|
|
259
259
|
'blocks.registerBlockType',
|
|
260
|
-
'core/align/addAttribute',
|
|
260
|
+
'core/editor/align/addAttribute',
|
|
261
261
|
addAttribute
|
|
262
262
|
);
|
|
263
263
|
addFilter(
|
|
@@ -268,10 +268,10 @@ addFilter(
|
|
|
268
268
|
addFilter(
|
|
269
269
|
'editor.BlockEdit',
|
|
270
270
|
'core/editor/align/with-toolbar-controls',
|
|
271
|
-
|
|
271
|
+
withAlignmentControls
|
|
272
272
|
);
|
|
273
273
|
addFilter(
|
|
274
274
|
'blocks.getSaveContent.extraProps',
|
|
275
|
-
'core/align/addAssignedAlign',
|
|
275
|
+
'core/editor/align/addAssignedAlign',
|
|
276
276
|
addAssignedAlign
|
|
277
277
|
);
|
|
@@ -36,8 +36,8 @@ addFilter(
|
|
|
36
36
|
...settings.attributes,
|
|
37
37
|
align: {
|
|
38
38
|
type: 'string',
|
|
39
|
-
// Allow for '' since it is used by updateAlignment function
|
|
40
|
-
// in
|
|
39
|
+
// Allow for '' since it is used by the `updateAlignment` function
|
|
40
|
+
// in toolbar controls for special cases with defined default values.
|
|
41
41
|
enum: [ ...ALIGNMENTS, '' ],
|
|
42
42
|
},
|
|
43
43
|
};
|
package/src/hooks/anchor.js
CHANGED
|
@@ -59,6 +59,7 @@ function BlockEditAnchorControl( { blockName, attributes, setAttributes } ) {
|
|
|
59
59
|
const textControl = (
|
|
60
60
|
<TextControl
|
|
61
61
|
__nextHasNoMarginBottom
|
|
62
|
+
__next40pxDefaultSize
|
|
62
63
|
className="html-anchor-control"
|
|
63
64
|
label={ __( 'HTML anchor' ) }
|
|
64
65
|
help={
|
|
@@ -123,26 +124,23 @@ function BlockEditAnchorControl( { blockName, attributes, setAttributes } ) {
|
|
|
123
124
|
*
|
|
124
125
|
* @return {Component} Wrapped component.
|
|
125
126
|
*/
|
|
126
|
-
export const
|
|
127
|
-
(
|
|
128
|
-
return (
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
},
|
|
144
|
-
'withInspectorControl'
|
|
145
|
-
);
|
|
127
|
+
export const withAnchorControls = createHigherOrderComponent( ( BlockEdit ) => {
|
|
128
|
+
return ( props ) => {
|
|
129
|
+
return (
|
|
130
|
+
<>
|
|
131
|
+
<BlockEdit { ...props } />
|
|
132
|
+
{ props.isSelected &&
|
|
133
|
+
hasBlockSupport( props.name, 'anchor' ) && (
|
|
134
|
+
<BlockEditAnchorControl
|
|
135
|
+
blockName={ props.name }
|
|
136
|
+
attributes={ props.attributes }
|
|
137
|
+
setAttributes={ props.setAttributes }
|
|
138
|
+
/>
|
|
139
|
+
) }
|
|
140
|
+
</>
|
|
141
|
+
);
|
|
142
|
+
};
|
|
143
|
+
}, 'withAnchorControls' );
|
|
146
144
|
|
|
147
145
|
/**
|
|
148
146
|
* Override props assigned to save component to inject anchor ID, if block
|
|
@@ -166,11 +164,11 @@ export function addSaveProps( extraProps, blockType, attributes ) {
|
|
|
166
164
|
addFilter( 'blocks.registerBlockType', 'core/anchor/attribute', addAttribute );
|
|
167
165
|
addFilter(
|
|
168
166
|
'editor.BlockEdit',
|
|
169
|
-
'core/editor/anchor/with-inspector-
|
|
170
|
-
|
|
167
|
+
'core/editor/anchor/with-inspector-controls',
|
|
168
|
+
withAnchorControls
|
|
171
169
|
);
|
|
172
170
|
addFilter(
|
|
173
171
|
'blocks.getSaveContent.extraProps',
|
|
174
|
-
'core/anchor/save-props',
|
|
172
|
+
'core/editor/anchor/save-props',
|
|
175
173
|
addSaveProps
|
|
176
174
|
);
|
package/src/hooks/background.js
CHANGED
|
@@ -8,6 +8,7 @@ import classnames from 'classnames';
|
|
|
8
8
|
*/
|
|
9
9
|
import { isBlobURL } from '@wordpress/blob';
|
|
10
10
|
import { getBlockSupport } from '@wordpress/blocks';
|
|
11
|
+
import { focus } from '@wordpress/dom';
|
|
11
12
|
import {
|
|
12
13
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
13
14
|
DropZone,
|
|
@@ -19,7 +20,7 @@ import {
|
|
|
19
20
|
__experimentalTruncate as Truncate,
|
|
20
21
|
} from '@wordpress/components';
|
|
21
22
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
22
|
-
import { Platform, useCallback } from '@wordpress/element';
|
|
23
|
+
import { Platform, useCallback, useRef } from '@wordpress/element';
|
|
23
24
|
import { __, sprintf } from '@wordpress/i18n';
|
|
24
25
|
import { store as noticesStore } from '@wordpress/notices';
|
|
25
26
|
import { getFilename } from '@wordpress/url';
|
|
@@ -150,6 +151,8 @@ function BackgroundImagePanelItem( props ) {
|
|
|
150
151
|
const { id, title, url } =
|
|
151
152
|
attributes.style?.background?.backgroundImage || {};
|
|
152
153
|
|
|
154
|
+
const replaceContainerRef = useRef();
|
|
155
|
+
|
|
153
156
|
const { mediaUpload } = useSelect( ( select ) => {
|
|
154
157
|
return {
|
|
155
158
|
mediaUpload: select( blockEditorStore ).getSettings().mediaUpload,
|
|
@@ -241,17 +244,22 @@ function BackgroundImagePanelItem( props ) {
|
|
|
241
244
|
};
|
|
242
245
|
}, [] );
|
|
243
246
|
|
|
247
|
+
const hasValue = hasBackgroundImageValue( props );
|
|
248
|
+
|
|
244
249
|
return (
|
|
245
250
|
<ToolsPanelItem
|
|
246
251
|
className="single-column"
|
|
247
|
-
hasValue={ () =>
|
|
252
|
+
hasValue={ () => hasValue }
|
|
248
253
|
label={ __( 'Background image' ) }
|
|
249
254
|
onDeselect={ () => resetBackgroundImage( props ) }
|
|
250
255
|
isShownByDefault={ true }
|
|
251
256
|
resetAllFilter={ resetAllFilter }
|
|
252
257
|
panelId={ clientId }
|
|
253
258
|
>
|
|
254
|
-
<div
|
|
259
|
+
<div
|
|
260
|
+
className="block-editor-hooks__background__inspector-media-replace-container"
|
|
261
|
+
ref={ replaceContainerRef }
|
|
262
|
+
>
|
|
255
263
|
<MediaReplaceFlow
|
|
256
264
|
mediaId={ id }
|
|
257
265
|
mediaURL={ url }
|
|
@@ -267,9 +275,23 @@ function BackgroundImagePanelItem( props ) {
|
|
|
267
275
|
}
|
|
268
276
|
variant="secondary"
|
|
269
277
|
>
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
278
|
+
{ hasValue && (
|
|
279
|
+
<MenuItem
|
|
280
|
+
onClick={ () => {
|
|
281
|
+
const [ toggleButton ] = focus.tabbable.find(
|
|
282
|
+
replaceContainerRef.current
|
|
283
|
+
);
|
|
284
|
+
// Focus the toggle button and close the dropdown menu.
|
|
285
|
+
// This ensures similar behaviour as to selecting an image, where the dropdown is
|
|
286
|
+
// closed and focus is redirected to the dropdown toggle button.
|
|
287
|
+
toggleButton?.focus();
|
|
288
|
+
toggleButton?.click();
|
|
289
|
+
resetBackgroundImage( props );
|
|
290
|
+
} }
|
|
291
|
+
>
|
|
292
|
+
{ __( 'Reset ' ) }
|
|
293
|
+
</MenuItem>
|
|
294
|
+
) }
|
|
273
295
|
</MediaReplaceFlow>
|
|
274
296
|
<DropZone
|
|
275
297
|
onFilesDrop={ onFilesDrop }
|
package/src/hooks/block-hooks.js
CHANGED
|
@@ -235,23 +235,27 @@ function BlockHooksControl( props ) {
|
|
|
235
235
|
);
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
export const
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
238
|
+
export const withBlockHooksControls = createHigherOrderComponent(
|
|
239
|
+
( BlockEdit ) => {
|
|
240
|
+
return ( props ) => {
|
|
241
|
+
return (
|
|
242
|
+
<>
|
|
243
|
+
<BlockEdit key="edit" { ...props } />
|
|
244
|
+
{ props.isSelected && (
|
|
245
|
+
<BlockHooksControl
|
|
246
|
+
blockName={ props.name }
|
|
247
|
+
clientId={ props.clientId }
|
|
248
|
+
/>
|
|
249
|
+
) }
|
|
250
|
+
</>
|
|
251
|
+
);
|
|
252
|
+
};
|
|
253
|
+
},
|
|
254
|
+
'withBlockHooksControls'
|
|
255
|
+
);
|
|
252
256
|
|
|
253
257
|
addFilter(
|
|
254
258
|
'editor.BlockEdit',
|
|
255
|
-
'core/block-hooks/with-inspector-
|
|
256
|
-
|
|
259
|
+
'core/editor/block-hooks/with-inspector-controls',
|
|
260
|
+
withBlockHooksControls
|
|
257
261
|
);
|
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { addFilter } from '@wordpress/hooks';
|
|
5
5
|
import { hasBlockSupport } from '@wordpress/blocks';
|
|
6
|
+
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
7
|
+
import { __ } from '@wordpress/i18n';
|
|
8
|
+
import { TextControl } from '@wordpress/components';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import { InspectorControls } from '../components';
|
|
14
|
+
import { useBlockRename } from '../components/block-rename';
|
|
6
15
|
|
|
7
16
|
/**
|
|
8
17
|
* Filters registered block settings, adding an `__experimentalLabel` callback if one does not already exist.
|
|
@@ -38,6 +47,44 @@ export function addLabelCallback( settings ) {
|
|
|
38
47
|
return settings;
|
|
39
48
|
}
|
|
40
49
|
|
|
50
|
+
export const withBlockRenameControl = createHigherOrderComponent(
|
|
51
|
+
( BlockEdit ) => ( props ) => {
|
|
52
|
+
const { name, attributes, setAttributes, isSelected } = props;
|
|
53
|
+
|
|
54
|
+
const { canRename } = useBlockRename( name );
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<>
|
|
58
|
+
{ isSelected && canRename && (
|
|
59
|
+
<InspectorControls group="advanced">
|
|
60
|
+
<TextControl
|
|
61
|
+
__nextHasNoMarginBottom
|
|
62
|
+
label={ __( 'Block name' ) }
|
|
63
|
+
value={ attributes?.metadata?.name || '' }
|
|
64
|
+
onChange={ ( newName ) => {
|
|
65
|
+
setAttributes( {
|
|
66
|
+
metadata: {
|
|
67
|
+
...attributes?.metadata,
|
|
68
|
+
name: newName,
|
|
69
|
+
},
|
|
70
|
+
} );
|
|
71
|
+
} }
|
|
72
|
+
/>
|
|
73
|
+
</InspectorControls>
|
|
74
|
+
) }
|
|
75
|
+
<BlockEdit key="edit" { ...props } />
|
|
76
|
+
</>
|
|
77
|
+
);
|
|
78
|
+
},
|
|
79
|
+
'withToolbarControls'
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
addFilter(
|
|
83
|
+
'editor.BlockEdit',
|
|
84
|
+
'core/block-rename-ui/with-block-rename-control',
|
|
85
|
+
withBlockRenameControl
|
|
86
|
+
);
|
|
87
|
+
|
|
41
88
|
addFilter(
|
|
42
89
|
'blocks.registerBlockType',
|
|
43
90
|
'core/metadata/addLabelCallback',
|
|
@@ -37,7 +37,7 @@ function StopEditingAsBlocksOnOutsideSelect( {
|
|
|
37
37
|
return null;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
export const
|
|
40
|
+
export const withContentLockControls = createHigherOrderComponent(
|
|
41
41
|
( BlockEdit ) => ( props ) => {
|
|
42
42
|
const { getBlockListSettings, getSettings } =
|
|
43
43
|
useSelect( blockEditorStore );
|
|
@@ -155,11 +155,11 @@ export const withBlockControls = createHigherOrderComponent(
|
|
|
155
155
|
</>
|
|
156
156
|
);
|
|
157
157
|
},
|
|
158
|
-
'
|
|
158
|
+
'withContentLockControls'
|
|
159
159
|
);
|
|
160
160
|
|
|
161
161
|
addFilter(
|
|
162
162
|
'editor.BlockEdit',
|
|
163
163
|
'core/content-lock-ui/with-block-controls',
|
|
164
|
-
|
|
164
|
+
withContentLockControls
|
|
165
165
|
);
|
|
@@ -49,6 +49,7 @@ function CustomClassNameControls( { attributes, setAttributes } ) {
|
|
|
49
49
|
<InspectorControls group="advanced">
|
|
50
50
|
<TextControl
|
|
51
51
|
__nextHasNoMarginBottom
|
|
52
|
+
__next40pxDefaultSize
|
|
52
53
|
autoComplete="off"
|
|
53
54
|
label={ __( 'Additional CSS class(es)' ) }
|
|
54
55
|
value={ attributes.className || '' }
|
|
@@ -72,7 +73,7 @@ function CustomClassNameControls( { attributes, setAttributes } ) {
|
|
|
72
73
|
*
|
|
73
74
|
* @return {Component} Wrapped component.
|
|
74
75
|
*/
|
|
75
|
-
export const
|
|
76
|
+
export const withCustomClassNameControls = createHigherOrderComponent(
|
|
76
77
|
( BlockEdit ) => {
|
|
77
78
|
return ( props ) => {
|
|
78
79
|
const hasCustomClassName = hasBlockSupport(
|
|
@@ -94,7 +95,7 @@ export const withInspectorControl = createHigherOrderComponent(
|
|
|
94
95
|
);
|
|
95
96
|
};
|
|
96
97
|
},
|
|
97
|
-
'
|
|
98
|
+
'withCustomClassNameControls'
|
|
98
99
|
);
|
|
99
100
|
|
|
100
101
|
/**
|
|
@@ -163,17 +164,17 @@ export function addTransforms( result, source, index, results ) {
|
|
|
163
164
|
|
|
164
165
|
addFilter(
|
|
165
166
|
'blocks.registerBlockType',
|
|
166
|
-
'core/custom-class-name/attribute',
|
|
167
|
+
'core/editor/custom-class-name/attribute',
|
|
167
168
|
addAttribute
|
|
168
169
|
);
|
|
169
170
|
addFilter(
|
|
170
171
|
'editor.BlockEdit',
|
|
171
|
-
'core/editor/custom-class-name/with-inspector-
|
|
172
|
-
|
|
172
|
+
'core/editor/custom-class-name/with-inspector-controls',
|
|
173
|
+
withCustomClassNameControls
|
|
173
174
|
);
|
|
174
175
|
addFilter(
|
|
175
176
|
'blocks.getSaveContent.extraProps',
|
|
176
|
-
'core/custom-class-name/save-props',
|
|
177
|
+
'core/editor/custom-class-name/save-props',
|
|
177
178
|
addSaveProps
|
|
178
179
|
);
|
|
179
180
|
|