@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
|
@@ -9,9 +9,16 @@ import {
|
|
|
9
9
|
useEffect,
|
|
10
10
|
useCallback,
|
|
11
11
|
} from '@wordpress/element';
|
|
12
|
+
import { useSelect } from '@wordpress/data';
|
|
12
13
|
import deprecated from '@wordpress/deprecated';
|
|
13
14
|
import { focus } from '@wordpress/dom';
|
|
14
15
|
import { useShortcut } from '@wordpress/keyboard-shortcuts';
|
|
16
|
+
import { ESCAPE } from '@wordpress/keycodes';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Internal dependencies
|
|
20
|
+
*/
|
|
21
|
+
import { store as blockEditorStore } from '../../store';
|
|
15
22
|
|
|
16
23
|
function hasOnlyToolbarItem( elements ) {
|
|
17
24
|
const dataProp = 'toolbarItem';
|
|
@@ -28,6 +35,7 @@ function hasFocusWithin( container ) {
|
|
|
28
35
|
|
|
29
36
|
function focusFirstTabbableIn( container ) {
|
|
30
37
|
const [ firstTabbable ] = focus.tabbable.find( container );
|
|
38
|
+
|
|
31
39
|
if ( firstTabbable ) {
|
|
32
40
|
firstTabbable.focus( {
|
|
33
41
|
// When focusing newly mounted toolbars,
|
|
@@ -38,7 +46,7 @@ function focusFirstTabbableIn( container ) {
|
|
|
38
46
|
}
|
|
39
47
|
}
|
|
40
48
|
|
|
41
|
-
function useIsAccessibleToolbar(
|
|
49
|
+
function useIsAccessibleToolbar( toolbarRef ) {
|
|
42
50
|
/*
|
|
43
51
|
* By default, we'll assume the starting accessible state of the Toolbar
|
|
44
52
|
* is true, as it seems to be the most common case.
|
|
@@ -62,7 +70,7 @@ function useIsAccessibleToolbar( ref ) {
|
|
|
62
70
|
);
|
|
63
71
|
|
|
64
72
|
const determineIsAccessibleToolbar = useCallback( () => {
|
|
65
|
-
const tabbables = focus.tabbable.find(
|
|
73
|
+
const tabbables = focus.tabbable.find( toolbarRef.current );
|
|
66
74
|
const onlyToolbarItem = hasOnlyToolbarItem( tabbables );
|
|
67
75
|
if ( ! onlyToolbarItem ) {
|
|
68
76
|
deprecated( 'Using custom components as toolbar controls', {
|
|
@@ -73,7 +81,7 @@ function useIsAccessibleToolbar( ref ) {
|
|
|
73
81
|
} );
|
|
74
82
|
}
|
|
75
83
|
setIsAccessibleToolbar( onlyToolbarItem );
|
|
76
|
-
}, [] );
|
|
84
|
+
}, [ toolbarRef ] );
|
|
77
85
|
|
|
78
86
|
useLayoutEffect( () => {
|
|
79
87
|
// Toolbar buttons may be rendered asynchronously, so we use
|
|
@@ -81,28 +89,32 @@ function useIsAccessibleToolbar( ref ) {
|
|
|
81
89
|
const observer = new window.MutationObserver(
|
|
82
90
|
determineIsAccessibleToolbar
|
|
83
91
|
);
|
|
84
|
-
observer.observe(
|
|
92
|
+
observer.observe( toolbarRef.current, {
|
|
93
|
+
childList: true,
|
|
94
|
+
subtree: true,
|
|
95
|
+
} );
|
|
85
96
|
return () => observer.disconnect();
|
|
86
|
-
}, [ isAccessibleToolbar ] );
|
|
97
|
+
}, [ determineIsAccessibleToolbar, isAccessibleToolbar, toolbarRef ] );
|
|
87
98
|
|
|
88
99
|
return isAccessibleToolbar;
|
|
89
100
|
}
|
|
90
101
|
|
|
91
|
-
function useToolbarFocus(
|
|
92
|
-
|
|
102
|
+
function useToolbarFocus( {
|
|
103
|
+
toolbarRef,
|
|
93
104
|
focusOnMount,
|
|
94
105
|
isAccessibleToolbar,
|
|
95
106
|
defaultIndex,
|
|
96
107
|
onIndexChange,
|
|
97
|
-
shouldUseKeyboardFocusShortcut
|
|
98
|
-
|
|
108
|
+
shouldUseKeyboardFocusShortcut,
|
|
109
|
+
focusEditorOnEscape,
|
|
110
|
+
} ) {
|
|
99
111
|
// Make sure we don't use modified versions of this prop.
|
|
100
112
|
const [ initialFocusOnMount ] = useState( focusOnMount );
|
|
101
113
|
const [ initialIndex ] = useState( defaultIndex );
|
|
102
114
|
|
|
103
115
|
const focusToolbar = useCallback( () => {
|
|
104
|
-
focusFirstTabbableIn(
|
|
105
|
-
}, [] );
|
|
116
|
+
focusFirstTabbableIn( toolbarRef.current );
|
|
117
|
+
}, [ toolbarRef ] );
|
|
106
118
|
|
|
107
119
|
const focusToolbarViaShortcut = () => {
|
|
108
120
|
if ( shouldUseKeyboardFocusShortcut ) {
|
|
@@ -121,7 +133,7 @@ function useToolbarFocus(
|
|
|
121
133
|
|
|
122
134
|
useEffect( () => {
|
|
123
135
|
// Store ref so we have access on useEffect cleanup: https://legacy.reactjs.org/blog/2020/08/10/react-v17-rc.html#effect-cleanup-timing
|
|
124
|
-
const navigableToolbarRef =
|
|
136
|
+
const navigableToolbarRef = toolbarRef.current;
|
|
125
137
|
// If initialIndex is passed, we focus on that toolbar item when the
|
|
126
138
|
// toolbar gets mounted and initial focus is not forced.
|
|
127
139
|
// We have to wait for the next browser paint because block controls aren't
|
|
@@ -150,32 +162,68 @@ function useToolbarFocus(
|
|
|
150
162
|
const index = items.findIndex( ( item ) => item.tabIndex === 0 );
|
|
151
163
|
onIndexChange( index );
|
|
152
164
|
};
|
|
153
|
-
}, [ initialIndex, initialFocusOnMount ] );
|
|
165
|
+
}, [ initialIndex, initialFocusOnMount, toolbarRef ] );
|
|
166
|
+
|
|
167
|
+
const { lastFocus } = useSelect( ( select ) => {
|
|
168
|
+
const { getLastFocus } = select( blockEditorStore );
|
|
169
|
+
return {
|
|
170
|
+
lastFocus: getLastFocus(),
|
|
171
|
+
};
|
|
172
|
+
}, [] );
|
|
173
|
+
/**
|
|
174
|
+
* Handles returning focus to the block editor canvas when pressing escape.
|
|
175
|
+
*/
|
|
176
|
+
useEffect( () => {
|
|
177
|
+
const navigableToolbarRef = toolbarRef.current;
|
|
178
|
+
|
|
179
|
+
if ( focusEditorOnEscape ) {
|
|
180
|
+
const handleKeyDown = ( event ) => {
|
|
181
|
+
if ( event.keyCode === ESCAPE && lastFocus?.current ) {
|
|
182
|
+
// Focus the last focused element when pressing escape.
|
|
183
|
+
event.preventDefault();
|
|
184
|
+
lastFocus.current.focus();
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
navigableToolbarRef.addEventListener( 'keydown', handleKeyDown );
|
|
188
|
+
return () => {
|
|
189
|
+
navigableToolbarRef.removeEventListener(
|
|
190
|
+
'keydown',
|
|
191
|
+
handleKeyDown
|
|
192
|
+
);
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
}, [ focusEditorOnEscape, lastFocus, toolbarRef ] );
|
|
154
196
|
}
|
|
155
197
|
|
|
156
|
-
function NavigableToolbar( {
|
|
198
|
+
export default function NavigableToolbar( {
|
|
157
199
|
children,
|
|
158
200
|
focusOnMount,
|
|
201
|
+
focusEditorOnEscape = false,
|
|
159
202
|
shouldUseKeyboardFocusShortcut = true,
|
|
160
203
|
__experimentalInitialIndex: initialIndex,
|
|
161
204
|
__experimentalOnIndexChange: onIndexChange,
|
|
162
205
|
...props
|
|
163
206
|
} ) {
|
|
164
|
-
const
|
|
165
|
-
const isAccessibleToolbar = useIsAccessibleToolbar(
|
|
207
|
+
const toolbarRef = useRef();
|
|
208
|
+
const isAccessibleToolbar = useIsAccessibleToolbar( toolbarRef );
|
|
166
209
|
|
|
167
|
-
useToolbarFocus(
|
|
168
|
-
|
|
210
|
+
useToolbarFocus( {
|
|
211
|
+
toolbarRef,
|
|
169
212
|
focusOnMount,
|
|
170
213
|
isAccessibleToolbar,
|
|
171
|
-
initialIndex,
|
|
214
|
+
defaultIndex: initialIndex,
|
|
172
215
|
onIndexChange,
|
|
173
|
-
shouldUseKeyboardFocusShortcut
|
|
174
|
-
|
|
216
|
+
shouldUseKeyboardFocusShortcut,
|
|
217
|
+
focusEditorOnEscape,
|
|
218
|
+
} );
|
|
175
219
|
|
|
176
220
|
if ( isAccessibleToolbar ) {
|
|
177
221
|
return (
|
|
178
|
-
<Toolbar
|
|
222
|
+
<Toolbar
|
|
223
|
+
label={ props[ 'aria-label' ] }
|
|
224
|
+
ref={ toolbarRef }
|
|
225
|
+
{ ...props }
|
|
226
|
+
>
|
|
179
227
|
{ children }
|
|
180
228
|
</Toolbar>
|
|
181
229
|
);
|
|
@@ -185,12 +233,10 @@ function NavigableToolbar( {
|
|
|
185
233
|
<NavigableMenu
|
|
186
234
|
orientation="horizontal"
|
|
187
235
|
role="toolbar"
|
|
188
|
-
ref={
|
|
236
|
+
ref={ toolbarRef }
|
|
189
237
|
{ ...props }
|
|
190
238
|
>
|
|
191
239
|
{ children }
|
|
192
240
|
</NavigableMenu>
|
|
193
241
|
);
|
|
194
242
|
}
|
|
195
|
-
|
|
196
|
-
export default NavigableToolbar;
|
|
@@ -20,36 +20,9 @@ _Optional._ The component forwards the `ref` property to the `TextareaAutosize`
|
|
|
20
20
|
|
|
21
21
|
## Example
|
|
22
22
|
|
|
23
|
-
{% codetabs %}
|
|
24
|
-
{% ES5 %}
|
|
25
|
-
|
|
26
|
-
```js
|
|
27
|
-
wp.blocks.registerBlockType( /* ... */, {
|
|
28
|
-
// ...
|
|
29
|
-
|
|
30
|
-
attributes: {
|
|
31
|
-
content: {
|
|
32
|
-
type: 'string',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
edit: function( props ) {
|
|
37
|
-
return React.createElement( wp.editor.PlainText, {
|
|
38
|
-
className: props.className,
|
|
39
|
-
value: props.attributes.content,
|
|
40
|
-
onChange: function( content ) {
|
|
41
|
-
props.setAttributes( { content: content } );
|
|
42
|
-
},
|
|
43
|
-
} );
|
|
44
|
-
},
|
|
45
|
-
} );
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
{% ESNext %}
|
|
49
|
-
|
|
50
23
|
```js
|
|
51
|
-
|
|
52
|
-
|
|
24
|
+
import { registerBlockType } from '@wordpress/blocks';
|
|
25
|
+
import { PlainText } from '@wordpress/block-editor';
|
|
53
26
|
|
|
54
27
|
registerBlockType( /* ... */, {
|
|
55
28
|
// ...
|
|
@@ -72,4 +45,3 @@ registerBlockType( /* ... */, {
|
|
|
72
45
|
} );
|
|
73
46
|
```
|
|
74
47
|
|
|
75
|
-
{% end %}
|
|
@@ -19,6 +19,7 @@ export default function PreviewOptions( {
|
|
|
19
19
|
deviceType,
|
|
20
20
|
setDeviceType,
|
|
21
21
|
label,
|
|
22
|
+
showIconLabels,
|
|
22
23
|
} ) {
|
|
23
24
|
const isMobile = useViewportMatch( 'small', '<' );
|
|
24
25
|
if ( isMobile ) return null;
|
|
@@ -35,6 +36,7 @@ export default function PreviewOptions( {
|
|
|
35
36
|
disabled: ! isEnabled,
|
|
36
37
|
__experimentalIsFocusable: ! isEnabled,
|
|
37
38
|
children: viewLabel,
|
|
39
|
+
showTooltip: ! showIconLabels,
|
|
38
40
|
};
|
|
39
41
|
const menuProps = {
|
|
40
42
|
'aria-label': __( 'View options' ),
|
|
@@ -76,18 +76,11 @@ export default function useBlockSync( {
|
|
|
76
76
|
resetBlocks,
|
|
77
77
|
resetSelection,
|
|
78
78
|
replaceInnerBlocks,
|
|
79
|
-
selectBlock,
|
|
80
79
|
setHasControlledInnerBlocks,
|
|
81
80
|
__unstableMarkNextChangeAsNotPersistent,
|
|
82
81
|
} = registry.dispatch( blockEditorStore );
|
|
83
|
-
const {
|
|
84
|
-
|
|
85
|
-
getBlockName,
|
|
86
|
-
getBlocks,
|
|
87
|
-
getSelectionStart,
|
|
88
|
-
getSelectionEnd,
|
|
89
|
-
getBlock,
|
|
90
|
-
} = registry.select( blockEditorStore );
|
|
82
|
+
const { getBlockName, getBlocks, getSelectionStart, getSelectionEnd } =
|
|
83
|
+
registry.select( blockEditorStore );
|
|
91
84
|
const isControlled = useSelect(
|
|
92
85
|
( select ) => {
|
|
93
86
|
return (
|
|
@@ -180,9 +173,6 @@ export default function useBlockSync( {
|
|
|
180
173
|
// bound sync, unset the outbound value to avoid considering it in
|
|
181
174
|
// subsequent renders.
|
|
182
175
|
pendingChanges.current.outgoing = [];
|
|
183
|
-
const hadSelection = hasSelectedBlock();
|
|
184
|
-
const selectionAnchor = getSelectionStart();
|
|
185
|
-
const selectionFocus = getSelectionEnd();
|
|
186
176
|
setControlledBlocks();
|
|
187
177
|
|
|
188
178
|
if ( controlledSelection ) {
|
|
@@ -191,15 +181,6 @@ export default function useBlockSync( {
|
|
|
191
181
|
controlledSelection.selectionEnd,
|
|
192
182
|
controlledSelection.initialPosition
|
|
193
183
|
);
|
|
194
|
-
} else {
|
|
195
|
-
const selectionStillExists = getBlock(
|
|
196
|
-
selectionAnchor.clientId
|
|
197
|
-
);
|
|
198
|
-
if ( hadSelection && ! selectionStillExists ) {
|
|
199
|
-
selectBlock( clientId );
|
|
200
|
-
} else {
|
|
201
|
-
resetSelection( selectionAnchor, selectionFocus );
|
|
202
|
-
}
|
|
203
184
|
}
|
|
204
185
|
}
|
|
205
186
|
}, [ controlledBlocks, clientId ] );
|
|
@@ -71,7 +71,8 @@ _Optional._ A list of autocompleters to use instead of the default.
|
|
|
71
71
|
|
|
72
72
|
### `preserveWhiteSpace: Boolean`
|
|
73
73
|
|
|
74
|
-
_Optional._ Whether or not to preserve white space characters in the `value`. Normally tab, newline and space characters are collapsed to a single space
|
|
74
|
+
_Optional._ Whether or not to preserve white space characters in the `value`. Normally tab, newline and space characters are collapsed to a single space or
|
|
75
|
+
trimmed.
|
|
75
76
|
|
|
76
77
|
## RichText.Content
|
|
77
78
|
|
|
@@ -79,44 +80,9 @@ _Optional._ Whether or not to preserve white space characters in the `value`. No
|
|
|
79
80
|
|
|
80
81
|
## Example
|
|
81
82
|
|
|
82
|
-
{% codetabs %}
|
|
83
|
-
{% ES5 %}
|
|
84
|
-
|
|
85
83
|
```js
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
attributes: {
|
|
90
|
-
content: {
|
|
91
|
-
source: 'html',
|
|
92
|
-
selector: 'h2',
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
edit: function( props ) {
|
|
97
|
-
return React.createElement( wp.editor.RichText, {
|
|
98
|
-
tagName: 'h2',
|
|
99
|
-
className: props.className,
|
|
100
|
-
value: props.attributes.content,
|
|
101
|
-
onChange: function( content ) {
|
|
102
|
-
props.setAttributes( { content: content } );
|
|
103
|
-
}
|
|
104
|
-
} );
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
save: function( props ) {
|
|
108
|
-
return React.createElement( wp.editor.RichText.Content, {
|
|
109
|
-
tagName: 'h2', value: props.attributes.content
|
|
110
|
-
} );
|
|
111
|
-
}
|
|
112
|
-
} );
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
{% ESNext %}
|
|
116
|
-
|
|
117
|
-
```js
|
|
118
|
-
const { registerBlockType } = wp.blocks;
|
|
119
|
-
const { RichText } = wp.editor;
|
|
84
|
+
import { registerBlockType } from '@wordpress/blocks';
|
|
85
|
+
import { RichText } from '@wordpress/block-editor';
|
|
120
86
|
|
|
121
87
|
registerBlockType( /* ... */, {
|
|
122
88
|
// ...
|
|
@@ -145,7 +111,6 @@ registerBlockType( /* ... */, {
|
|
|
145
111
|
} );
|
|
146
112
|
```
|
|
147
113
|
|
|
148
|
-
{% end %}
|
|
149
114
|
|
|
150
115
|
## RichTextToolbarButton
|
|
151
116
|
|
|
@@ -153,30 +118,10 @@ Slot to extend the format toolbar. Use it in the edit function of a `registerFor
|
|
|
153
118
|
|
|
154
119
|
### Example
|
|
155
120
|
|
|
156
|
-
{% codetabs %}
|
|
157
|
-
{% ES5 %}
|
|
158
|
-
|
|
159
|
-
```js
|
|
160
|
-
wp.richText.registerFormatType( /* ... */, {
|
|
161
|
-
/* ... */
|
|
162
|
-
edit: function( props ) {
|
|
163
|
-
return React.createElement(
|
|
164
|
-
wp.editor.RichTextToolbarButton, {
|
|
165
|
-
icon: 'editor-code',
|
|
166
|
-
title: 'My formatting button',
|
|
167
|
-
onClick: function() { /* ... */ }
|
|
168
|
-
isActive: props.isActive,
|
|
169
|
-
} );
|
|
170
|
-
},
|
|
171
|
-
/* ... */
|
|
172
|
-
} );
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
{% ESNext %}
|
|
176
121
|
|
|
177
122
|
```js
|
|
178
|
-
import { registerFormatType } from '
|
|
179
|
-
import {
|
|
123
|
+
import { registerFormatType } from '@wordpress/rich-text';
|
|
124
|
+
import { RichTextToolbarButton } from '@wordpress/block-editor';
|
|
180
125
|
|
|
181
126
|
registerFormatType( /* ... */, {
|
|
182
127
|
/* ... */
|
|
@@ -193,5 +138,3 @@ registerFormatType( /* ... */, {
|
|
|
193
138
|
/* ... */
|
|
194
139
|
} );
|
|
195
140
|
```
|
|
196
|
-
|
|
197
|
-
{% end %}
|
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
} from '@wordpress/blocks';
|
|
18
18
|
import { useInstanceId, useMergeRefs } from '@wordpress/compose';
|
|
19
19
|
import {
|
|
20
|
-
__experimentalRichText as RichText,
|
|
21
20
|
__unstableCreateElement,
|
|
22
21
|
isEmpty,
|
|
23
22
|
insert,
|
|
@@ -46,6 +45,7 @@ import {
|
|
|
46
45
|
} from './utils';
|
|
47
46
|
import EmbedHandlerPicker from './embed-handler-picker';
|
|
48
47
|
import { Content } from './content';
|
|
48
|
+
import RichText from './native';
|
|
49
49
|
|
|
50
50
|
const classes = 'block-editor-rich-text__editable';
|
|
51
51
|
|
|
@@ -223,7 +223,7 @@ function RichTextWrapper(
|
|
|
223
223
|
// an intentional user interaction distinguishing between Backspace and
|
|
224
224
|
// Delete to remove the empty field, but also to avoid merge & remove
|
|
225
225
|
// causing destruction of two fields (merge, then removed merged).
|
|
226
|
-
if ( onRemove && isEmpty( value ) && isReverse ) {
|
|
226
|
+
else if ( onRemove && isEmpty( value ) && isReverse ) {
|
|
227
227
|
onRemove( ! isReverse );
|
|
228
228
|
}
|
|
229
229
|
},
|
|
@@ -688,6 +688,8 @@ ForwardedRichTextContainer.Content.defaultProps = {
|
|
|
688
688
|
value: '',
|
|
689
689
|
};
|
|
690
690
|
|
|
691
|
+
ForwardedRichTextContainer.Raw = RichText;
|
|
692
|
+
|
|
691
693
|
/**
|
|
692
694
|
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/rich-text/README.md
|
|
693
695
|
*/
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { getActiveFormat, getActiveObject } from '@wordpress/rich-text';
|
|
5
|
+
|
|
6
|
+
export default function FormatEdit( {
|
|
7
|
+
formatTypes,
|
|
8
|
+
onChange,
|
|
9
|
+
onFocus,
|
|
10
|
+
value,
|
|
11
|
+
forwardedRef,
|
|
12
|
+
} ) {
|
|
13
|
+
return formatTypes.map( ( settings ) => {
|
|
14
|
+
const { name, edit: Edit } = settings;
|
|
15
|
+
|
|
16
|
+
if ( ! Edit ) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const activeFormat = getActiveFormat( value, name );
|
|
21
|
+
const isActive = activeFormat !== undefined;
|
|
22
|
+
const activeObject = getActiveObject( value );
|
|
23
|
+
const isObjectActive =
|
|
24
|
+
activeObject !== undefined && activeObject.type === name;
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<Edit
|
|
28
|
+
key={ name }
|
|
29
|
+
isActive={ isActive }
|
|
30
|
+
activeAttributes={
|
|
31
|
+
isActive ? activeFormat.attributes || {} : {}
|
|
32
|
+
}
|
|
33
|
+
isObjectActive={ isObjectActive }
|
|
34
|
+
activeObjectAttributes={
|
|
35
|
+
isObjectActive ? activeObject.attributes || {} : {}
|
|
36
|
+
}
|
|
37
|
+
value={ value }
|
|
38
|
+
onChange={ onChange }
|
|
39
|
+
onFocus={ onFocus }
|
|
40
|
+
contentRef={ forwardedRef }
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
43
|
+
} );
|
|
44
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { getColorObjectByAttributeValues } from '../../../components/colors';
|
|
5
|
+
|
|
6
|
+
const FORMAT_TYPE = 'core/text-color';
|
|
7
|
+
const REGEX_TO_MATCH = /^has-(.*)-color$/;
|
|
8
|
+
const TAGS_TO_SEARCH = /\<mark/;
|
|
9
|
+
|
|
10
|
+
export function getFormatColors( value, formats, colors ) {
|
|
11
|
+
if ( value?.search( TAGS_TO_SEARCH ) !== -1 ) {
|
|
12
|
+
const newFormats = formats.slice();
|
|
13
|
+
|
|
14
|
+
newFormats.forEach( ( format ) => {
|
|
15
|
+
format.forEach( ( currentFormat ) => {
|
|
16
|
+
if ( currentFormat?.type === FORMAT_TYPE ) {
|
|
17
|
+
const className = currentFormat?.attributes?.class;
|
|
18
|
+
currentFormat.attributes.style =
|
|
19
|
+
currentFormat.attributes.style.replace( / /g, '' );
|
|
20
|
+
|
|
21
|
+
className?.split( ' ' ).forEach( ( currentClass ) => {
|
|
22
|
+
const match = currentClass.match( REGEX_TO_MATCH );
|
|
23
|
+
if ( match ) {
|
|
24
|
+
const [ , colorSlug ] =
|
|
25
|
+
currentClass.match( REGEX_TO_MATCH );
|
|
26
|
+
const colorObject = getColorObjectByAttributeValues(
|
|
27
|
+
colors,
|
|
28
|
+
colorSlug
|
|
29
|
+
);
|
|
30
|
+
const currentStyles =
|
|
31
|
+
currentFormat?.attributes?.style;
|
|
32
|
+
if (
|
|
33
|
+
colorObject &&
|
|
34
|
+
( ! currentStyles ||
|
|
35
|
+
currentStyles?.indexOf(
|
|
36
|
+
colorObject.color
|
|
37
|
+
) === -1 )
|
|
38
|
+
) {
|
|
39
|
+
currentFormat.attributes.style = [
|
|
40
|
+
`color: ${ colorObject.color }`,
|
|
41
|
+
currentStyles,
|
|
42
|
+
].join( ';' );
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
} );
|
|
46
|
+
}
|
|
47
|
+
} );
|
|
48
|
+
} );
|
|
49
|
+
|
|
50
|
+
return newFormats;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return formats;
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default () => {};
|