@wordpress/editor 14.13.1-next.cd6172eb0.0 → 14.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/LICENSE.md +1 -1
- package/README.md +1 -0
- package/build/bindings/pattern-overrides.js +1 -0
- package/build/bindings/pattern-overrides.js.map +1 -1
- package/build/bindings/post-meta.js +1 -0
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/autocompleters/user.js +1 -0
- package/build/components/autocompleters/user.js.map +1 -1
- package/build/components/block-removal-warnings/index.js +1 -0
- package/build/components/block-removal-warnings/index.js.map +1 -1
- package/build/components/block-settings-menu/content-only-settings-menu.js +1 -0
- package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +1 -0
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
- package/build/components/collab-sidebar/add-comment.js +1 -1
- package/build/components/collab-sidebar/add-comment.js.map +1 -1
- package/build/components/collab-sidebar/comment-button.js +7 -2
- package/build/components/collab-sidebar/comment-button.js.map +1 -1
- package/build/components/collab-sidebar/comment-form.js +4 -1
- package/build/components/collab-sidebar/comment-form.js.map +1 -1
- package/build/components/collab-sidebar/comments.js +199 -185
- package/build/components/collab-sidebar/comments.js.map +1 -1
- package/build/components/collab-sidebar/index.js +11 -4
- package/build/components/collab-sidebar/index.js.map +1 -1
- package/build/components/collab-sidebar/utils.js +1 -0
- package/build/components/collab-sidebar/utils.js.map +1 -1
- package/build/components/commands/index.js +28 -0
- package/build/components/commands/index.js.map +1 -1
- package/build/components/deprecated.js +1 -0
- package/build/components/deprecated.js.map +1 -1
- package/build/components/document-bar/index.js +5 -2
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/document-outline/index.js +1 -0
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-tools/index.js +3 -6
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-help/index.native.js +1 -0
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/editor-help/intro-to-blocks.native.js +1 -1
- package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
- package/build/components/editor-notices/index.js +1 -0
- package/build/components/editor-notices/index.js.map +1 -1
- package/build/components/editor-snackbars/index.js +1 -0
- package/build/components/editor-snackbars/index.js.map +1 -1
- package/build/components/entities-saved-states/entity-type-list.js +1 -0
- package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build/components/entities-saved-states/hooks/use-is-dirty.js +1 -0
- package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
- package/build/components/entities-saved-states/index.js +3 -1
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/error-boundary/index.js +26 -13
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/error-boundary/index.native.js +1 -1
- package/build/components/error-boundary/index.native.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +1 -0
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -0
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/list-view-sidebar/index.js +1 -0
- package/build/components/list-view-sidebar/index.js.map +1 -1
- package/build/components/local-autosave-monitor/index.js +1 -0
- package/build/components/local-autosave-monitor/index.js.map +1 -1
- package/build/components/mode-switcher/index.js +1 -0
- package/build/components/mode-switcher/index.js.map +1 -1
- package/build/components/more-menu/index.js +0 -1
- package/build/components/more-menu/index.js.map +1 -1
- package/build/components/page-attributes/parent.js +1 -0
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-actions/actions.js +10 -4
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/index.js +80 -91
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-actions/set-as-homepage.js +23 -34
- package/build/components/post-actions/set-as-homepage.js.map +1 -1
- package/build/components/post-actions/set-as-posts-page.js +154 -0
- package/build/components/post-actions/set-as-posts-page.js.map +1 -0
- package/build/components/post-author/hook.js +1 -0
- package/build/components/post-author/hook.js.map +1 -1
- package/build/components/post-card-panel/index.js +64 -24
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-fields/index.js +1 -0
- package/build/components/post-fields/index.js.map +1 -1
- package/build/components/post-format/index.js +1 -0
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-format/panel.js +1 -0
- package/build/components/post-format/panel.js.map +1 -1
- package/build/components/post-publish-button/index.js +1 -0
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js +1 -0
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +1 -0
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js +2 -1
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build/components/post-publish-panel/media-util.js +1 -0
- package/build/components/post-publish-panel/media-util.js.map +1 -1
- package/build/components/post-publish-panel/prepublish.js +1 -1
- package/build/components/post-publish-panel/prepublish.js.map +1 -1
- package/build/components/post-saved-state/index.js +1 -0
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/index.js +1 -0
- package/build/components/post-schedule/index.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +1 -0
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +1 -0
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +1 -0
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js +1 -0
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-template/classic-theme.js +1 -0
- package/build/components/post-template/classic-theme.js.map +1 -1
- package/build/components/post-template/swap-template-button.js +1 -0
- package/build/components/post-template/swap-template-button.js.map +1 -1
- package/build/components/post-transform-panel/hooks.js +1 -0
- package/build/components/post-transform-panel/hooks.js.map +1 -1
- package/build/components/post-type-support-check/index.js +1 -0
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/preferences-modal/block-visibility.js +1 -0
- package/build/components/preferences-modal/block-visibility.js.map +1 -1
- package/build/components/preferences-modal/index.js +3 -4
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js +0 -1
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/disable-non-page-content-blocks.js +66 -13
- package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/provider/index.js +9 -13
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +1 -0
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +4 -1
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/sidebar/index.js +1 -0
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/start-page-options/index.js +20 -106
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/start-template-options/index.js +1 -0
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/template-part-content-panel/index.js +1 -0
- package/build/components/template-part-content-panel/index.js.map +1 -1
- package/build/components/template-part-menu-items/index.js +2 -10
- package/build/components/template-part-menu-items/index.js.map +1 -1
- package/build/components/theme-support-check/index.js +1 -0
- package/build/components/theme-support-check/index.js.map +1 -1
- package/build/components/visual-editor/use-select-nearest-editable-block.js +1 -0
- package/build/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
- package/build/dataviews/store/private-actions.js +16 -2
- package/build/dataviews/store/private-actions.js.map +1 -1
- package/build/dataviews/store/reducer.js +1 -0
- package/build/dataviews/store/reducer.js.map +1 -1
- package/build/hooks/custom-sources-backwards-compatibility.js +1 -0
- package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build/hooks/pattern-overrides.js +1 -0
- package/build/hooks/pattern-overrides.js.map +1 -1
- package/build/store/actions.js +1 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +1 -3
- package/build/store/constants.js.map +1 -1
- package/build/store/private-actions.js +2 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +1 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +1 -0
- package/build/store/reducer.js.map +1 -1
- package/build/store/reducer.native.js +1 -0
- package/build/store/reducer.native.js.map +1 -1
- package/build/store/selectors.js +1 -0
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils/notice-builder.js +3 -8
- package/build/store/utils/notice-builder.js.map +1 -1
- package/build/utils/get-item-title.js +32 -0
- package/build/utils/get-item-title.js.map +1 -0
- package/build/utils/get-template-info.js +1 -0
- package/build/utils/get-template-info.js.map +1 -1
- package/build/utils/media-sideload/index.js +21 -0
- package/build/utils/media-sideload/index.js.map +1 -0
- package/build/utils/media-sideload/index.native.js +8 -0
- package/build/utils/media-sideload/index.native.js.map +1 -0
- package/build/utils/media-upload/index.js +5 -2
- package/build/utils/media-upload/index.js.map +1 -1
- package/build/utils/pageTypeBadge.js +6 -12
- package/build/utils/pageTypeBadge.js.map +1 -1
- package/build/utils/terms.js +1 -0
- package/build/utils/terms.js.map +1 -1
- package/build-module/bindings/pattern-overrides.js +1 -0
- package/build-module/bindings/pattern-overrides.js.map +1 -1
- package/build-module/bindings/post-meta.js +1 -0
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/autocompleters/user.js +1 -0
- package/build-module/components/autocompleters/user.js.map +1 -1
- package/build-module/components/block-removal-warnings/index.js +1 -0
- package/build-module/components/block-removal-warnings/index.js.map +1 -1
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +1 -0
- package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +1 -0
- package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
- package/build-module/components/collab-sidebar/add-comment.js +1 -1
- package/build-module/components/collab-sidebar/add-comment.js.map +1 -1
- package/build-module/components/collab-sidebar/comment-button.js +7 -2
- package/build-module/components/collab-sidebar/comment-button.js.map +1 -1
- package/build-module/components/collab-sidebar/comment-form.js +4 -1
- package/build-module/components/collab-sidebar/comment-form.js.map +1 -1
- package/build-module/components/collab-sidebar/comments.js +201 -187
- package/build-module/components/collab-sidebar/comments.js.map +1 -1
- package/build-module/components/collab-sidebar/index.js +11 -4
- package/build-module/components/collab-sidebar/index.js.map +1 -1
- package/build-module/components/collab-sidebar/utils.js +1 -0
- package/build-module/components/collab-sidebar/utils.js.map +1 -1
- package/build-module/components/commands/index.js +28 -0
- package/build-module/components/commands/index.js.map +1 -1
- package/build-module/components/deprecated.js +1 -0
- package/build-module/components/deprecated.js.map +1 -1
- package/build-module/components/document-bar/index.js +5 -2
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/document-outline/index.js +1 -0
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/document-tools/index.js +4 -7
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor-help/index.native.js +1 -0
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/editor-help/intro-to-blocks.native.js +1 -1
- package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
- package/build-module/components/editor-notices/index.js +1 -0
- package/build-module/components/editor-notices/index.js.map +1 -1
- package/build-module/components/editor-snackbars/index.js +1 -0
- package/build-module/components/editor-snackbars/index.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-type-list.js +1 -0
- package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build-module/components/entities-saved-states/hooks/use-is-dirty.js +1 -0
- package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +3 -1
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +28 -15
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/error-boundary/index.native.js +2 -2
- package/build-module/components/error-boundary/index.native.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/list-view-sidebar/index.js +1 -0
- package/build-module/components/list-view-sidebar/index.js.map +1 -1
- package/build-module/components/local-autosave-monitor/index.js +1 -0
- package/build-module/components/local-autosave-monitor/index.js.map +1 -1
- package/build-module/components/mode-switcher/index.js +1 -0
- package/build-module/components/mode-switcher/index.js.map +1 -1
- package/build-module/components/more-menu/index.js +0 -1
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +1 -0
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-actions/actions.js +10 -4
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/index.js +81 -93
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-actions/set-as-homepage.js +22 -33
- package/build-module/components/post-actions/set-as-homepage.js.map +1 -1
- package/build-module/components/post-actions/set-as-posts-page.js +146 -0
- package/build-module/components/post-actions/set-as-posts-page.js.map +1 -0
- package/build-module/components/post-author/hook.js +1 -0
- package/build-module/components/post-author/hook.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +66 -26
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-fields/index.js +1 -0
- package/build-module/components/post-fields/index.js.map +1 -1
- package/build-module/components/post-format/index.js +1 -0
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-format/panel.js +1 -0
- package/build-module/components/post-format/panel.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +1 -0
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +1 -0
- package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js +1 -0
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-upload-media.js +3 -2
- package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build-module/components/post-publish-panel/media-util.js +1 -0
- package/build-module/components/post-publish-panel/media-util.js.map +1 -1
- package/build-module/components/post-publish-panel/prepublish.js +1 -1
- package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +1 -0
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/index.js +1 -0
- package/build-module/components/post-schedule/index.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +1 -0
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +1 -0
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +1 -0
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js +1 -0
- package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build-module/components/post-template/classic-theme.js +1 -0
- package/build-module/components/post-template/classic-theme.js.map +1 -1
- package/build-module/components/post-template/swap-template-button.js +1 -0
- package/build-module/components/post-template/swap-template-button.js.map +1 -1
- package/build-module/components/post-transform-panel/hooks.js +1 -0
- package/build-module/components/post-transform-panel/hooks.js.map +1 -1
- package/build-module/components/post-type-support-check/index.js +1 -0
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/preferences-modal/block-visibility.js +1 -0
- package/build-module/components/preferences-modal/block-visibility.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +3 -4
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +0 -1
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/disable-non-page-content-blocks.js +66 -13
- package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/provider/index.js +10 -14
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +1 -0
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +4 -1
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/sidebar/index.js +1 -0
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/start-page-options/index.js +21 -106
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +1 -0
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/template-part-content-panel/index.js +1 -0
- package/build-module/components/template-part-content-panel/index.js.map +1 -1
- package/build-module/components/template-part-menu-items/index.js +2 -10
- package/build-module/components/template-part-menu-items/index.js.map +1 -1
- package/build-module/components/theme-support-check/index.js +1 -0
- package/build-module/components/theme-support-check/index.js.map +1 -1
- package/build-module/components/visual-editor/use-select-nearest-editable-block.js +1 -0
- package/build-module/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
- package/build-module/dataviews/store/private-actions.js +16 -2
- package/build-module/dataviews/store/private-actions.js.map +1 -1
- package/build-module/dataviews/store/reducer.js +1 -0
- package/build-module/dataviews/store/reducer.js.map +1 -1
- package/build-module/hooks/custom-sources-backwards-compatibility.js +1 -0
- package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build-module/hooks/pattern-overrides.js +1 -0
- package/build-module/hooks/pattern-overrides.js.map +1 -1
- package/build-module/store/actions.js +1 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js +0 -2
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/private-actions.js +2 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +1 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +1 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/reducer.native.js +1 -0
- package/build-module/store/reducer.native.js.map +1 -1
- package/build-module/store/selectors.js +1 -0
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils/notice-builder.js +3 -8
- package/build-module/store/utils/notice-builder.js.map +1 -1
- package/build-module/utils/get-item-title.js +26 -0
- package/build-module/utils/get-item-title.js.map +1 -0
- package/build-module/utils/get-template-info.js +1 -0
- package/build-module/utils/get-template-info.js.map +1 -1
- package/build-module/utils/media-sideload/index.js +14 -0
- package/build-module/utils/media-sideload/index.js.map +1 -0
- package/build-module/utils/media-sideload/index.native.js +2 -0
- package/build-module/utils/media-sideload/index.native.js.map +1 -0
- package/build-module/utils/media-upload/index.js +5 -2
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/build-module/utils/pageTypeBadge.js +6 -12
- package/build-module/utils/pageTypeBadge.js.map +1 -1
- package/build-module/utils/terms.js +1 -0
- package/build-module/utils/terms.js.map +1 -1
- package/build-style/style-rtl.css +26 -27
- package/build-style/style.css +26 -27
- package/build-types/components/autocompleters/user.d.ts +7 -1
- package/build-types/components/autocompleters/user.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/comment-button.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/comment-form.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/comments.d.ts +11 -7
- package/build-types/components/collab-sidebar/comments.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/constants.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
- package/build-types/components/commands/index.d.ts.map +1 -1
- package/build-types/components/document-bar/index.d.ts.map +1 -1
- package/build-types/components/document-tools/index.d.ts.map +1 -1
- package/build-types/components/entities-saved-states/index.d.ts.map +1 -1
- package/build-types/components/error-boundary/index.d.ts.map +1 -1
- package/build-types/components/keyboard-shortcut-help-modal/shortcut.d.ts +1 -1
- package/build-types/components/media-categories/index.d.ts.map +1 -1
- package/build-types/components/more-menu/index.d.ts.map +1 -1
- package/build-types/components/pattern-duplicate-modal/index.d.ts.map +1 -1
- package/build-types/components/pattern-rename-modal/index.d.ts.map +1 -1
- package/build-types/components/post-actions/actions.d.ts.map +1 -1
- package/build-types/components/post-actions/index.d.ts +5 -0
- package/build-types/components/post-actions/index.d.ts.map +1 -1
- package/build-types/components/post-actions/set-as-homepage.d.ts.map +1 -1
- package/build-types/components/post-actions/set-as-posts-page.d.ts +10 -0
- package/build-types/components/post-actions/set-as-posts-page.d.ts.map +1 -0
- package/build-types/components/post-card-panel/index.d.ts +13 -4
- package/build-types/components/post-card-panel/index.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts +4 -4
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts +4 -4
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
- package/build-types/components/post-title/constants.d.ts.map +1 -1
- package/build-types/components/preferences-modal/index.d.ts.map +1 -1
- package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
- package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
- package/build-types/components/start-page-options/index.d.ts +1 -2
- package/build-types/components/start-page-options/index.d.ts.map +1 -1
- package/build-types/dataviews/api.d.ts.map +1 -1
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- package/build-types/dataviews/store/reducer.d.ts +1 -1
- package/build-types/hooks/custom-sources-backwards-compatibility.d.ts.map +1 -1
- package/build-types/hooks/pattern-overrides.d.ts.map +1 -1
- package/build-types/store/actions.d.ts +7 -9
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/constants.d.ts +0 -2
- package/build-types/store/constants.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts +1 -1
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +20 -4
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +1 -1
- package/build-types/store/selectors.d.ts +376 -76
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/store/utils/notice-builder.d.ts.map +1 -1
- package/build-types/utils/get-item-title.d.ts +10 -0
- package/build-types/utils/get-item-title.d.ts.map +1 -0
- package/build-types/utils/media-sideload/index.d.ts +3 -0
- package/build-types/utils/media-sideload/index.d.ts.map +1 -0
- package/build-types/utils/media-upload/index.d.ts +3 -1
- package/build-types/utils/media-upload/index.d.ts.map +1 -1
- package/build-types/utils/pageTypeBadge.d.ts +3 -1
- package/build-types/utils/pageTypeBadge.d.ts.map +1 -1
- package/package.json +37 -37
- package/src/components/collab-sidebar/add-comment.js +1 -1
- package/src/components/collab-sidebar/comment-button.js +12 -7
- package/src/components/collab-sidebar/comment-form.js +4 -1
- package/src/components/collab-sidebar/comments.js +260 -243
- package/src/components/collab-sidebar/index.js +10 -2
- package/src/components/collab-sidebar/style.scss +10 -1
- package/src/components/commands/index.js +29 -0
- package/src/components/document-bar/index.js +5 -2
- package/src/components/document-tools/index.js +3 -6
- package/src/components/document-tools/style.scss +0 -6
- package/src/components/editor-help/intro-to-blocks.native.js +1 -1
- package/src/components/entities-saved-states/index.js +5 -1
- package/src/components/error-boundary/index.js +30 -16
- package/src/components/error-boundary/index.native.js +2 -2
- package/src/components/error-boundary/style.scss +5 -1
- package/src/components/more-menu/index.js +0 -1
- package/src/components/post-actions/actions.js +12 -4
- package/src/components/post-actions/index.js +90 -94
- package/src/components/post-actions/set-as-homepage.js +29 -45
- package/src/components/post-actions/set-as-posts-page.js +164 -0
- package/src/components/post-card-panel/index.js +71 -33
- package/src/components/post-card-panel/style.scss +8 -12
- package/src/components/post-publish-panel/maybe-upload-media.js +2 -2
- package/src/components/post-publish-panel/prepublish.js +1 -1
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +2 -2
- package/src/components/preferences-modal/index.js +8 -13
- package/src/components/preview-dropdown/index.js +0 -1
- package/src/components/provider/disable-non-page-content-blocks.js +64 -13
- package/src/components/provider/index.js +13 -27
- package/src/components/provider/use-block-editor-settings.js +3 -0
- package/src/components/start-page-options/index.js +28 -119
- package/src/components/template-part-menu-items/index.js +2 -11
- package/src/dataviews/store/private-actions.ts +23 -8
- package/src/store/actions.js +0 -2
- package/src/store/constants.ts +0 -2
- package/src/store/private-actions.js +1 -1
- package/src/store/utils/notice-builder.js +3 -8
- package/src/store/utils/test/notice-builder.js +3 -4
- package/src/utils/get-item-title.js +25 -0
- package/src/utils/media-sideload/index.js +13 -0
- package/src/utils/media-sideload/index.native.js +1 -0
- package/src/utils/media-upload/index.js +4 -1
- package/src/utils/pageTypeBadge.js +7 -10
- package/tsconfig.json +1 -4
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { useState, useMemo } from '@wordpress/element';
|
|
7
|
-
import {
|
|
8
|
-
store as blockEditorStore,
|
|
9
|
-
__experimentalBlockPatternsList as BlockPatternsList,
|
|
10
|
-
} from '@wordpress/block-editor';
|
|
4
|
+
import { useEffect } from '@wordpress/element';
|
|
11
5
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
12
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
13
|
-
import { __unstableSerializeAndClean } from '@wordpress/blocks';
|
|
14
6
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
15
7
|
import { store as interfaceStore } from '@wordpress/interface';
|
|
16
8
|
|
|
@@ -18,124 +10,41 @@ import { store as interfaceStore } from '@wordpress/interface';
|
|
|
18
10
|
* Internal dependencies
|
|
19
11
|
*/
|
|
20
12
|
import { store as editorStore } from '../../store';
|
|
21
|
-
import { TEMPLATE_POST_TYPE } from '../../store/constants';
|
|
22
|
-
|
|
23
|
-
export function useStartPatterns() {
|
|
24
|
-
// A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,
|
|
25
|
-
// and it has no postTypes declared and the current post type is page or if
|
|
26
|
-
// the current post type is part of the postTypes declared.
|
|
27
|
-
const { blockPatternsWithPostContentBlockType, postType } = useSelect(
|
|
28
|
-
( select ) => {
|
|
29
|
-
const { getPatternsByBlockTypes, getBlocksByName } =
|
|
30
|
-
select( blockEditorStore );
|
|
31
|
-
const { getCurrentPostType, getRenderingMode } =
|
|
32
|
-
select( editorStore );
|
|
33
|
-
const rootClientId =
|
|
34
|
-
getRenderingMode() === 'post-only'
|
|
35
|
-
? ''
|
|
36
|
-
: getBlocksByName( 'core/post-content' )?.[ 0 ];
|
|
37
|
-
return {
|
|
38
|
-
blockPatternsWithPostContentBlockType: getPatternsByBlockTypes(
|
|
39
|
-
'core/post-content',
|
|
40
|
-
rootClientId
|
|
41
|
-
),
|
|
42
|
-
postType: getCurrentPostType(),
|
|
43
|
-
};
|
|
44
|
-
},
|
|
45
|
-
[]
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
return useMemo( () => {
|
|
49
|
-
if ( ! blockPatternsWithPostContentBlockType?.length ) {
|
|
50
|
-
return [];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/*
|
|
54
|
-
* Filter patterns without postTypes declared if the current postType is page
|
|
55
|
-
* or patterns that declare the current postType in its post type array.
|
|
56
|
-
*/
|
|
57
|
-
return blockPatternsWithPostContentBlockType.filter( ( pattern ) => {
|
|
58
|
-
return (
|
|
59
|
-
( postType === 'page' && ! pattern.postTypes ) ||
|
|
60
|
-
( Array.isArray( pattern.postTypes ) &&
|
|
61
|
-
pattern.postTypes.includes( postType ) )
|
|
62
|
-
);
|
|
63
|
-
} );
|
|
64
|
-
}, [ postType, blockPatternsWithPostContentBlockType ] );
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function PatternSelection( { blockPatterns, onChoosePattern } ) {
|
|
68
|
-
const { editEntityRecord } = useDispatch( coreStore );
|
|
69
|
-
const { postType, postId } = useSelect( ( select ) => {
|
|
70
|
-
const { getCurrentPostType, getCurrentPostId } = select( editorStore );
|
|
71
|
-
|
|
72
|
-
return {
|
|
73
|
-
postType: getCurrentPostType(),
|
|
74
|
-
postId: getCurrentPostId(),
|
|
75
|
-
};
|
|
76
|
-
}, [] );
|
|
77
|
-
return (
|
|
78
|
-
<BlockPatternsList
|
|
79
|
-
blockPatterns={ blockPatterns }
|
|
80
|
-
onClickPattern={ ( _pattern, blocks ) => {
|
|
81
|
-
editEntityRecord( 'postType', postType, postId, {
|
|
82
|
-
blocks,
|
|
83
|
-
content: ( { blocks: blocksForSerialization = [] } ) =>
|
|
84
|
-
__unstableSerializeAndClean( blocksForSerialization ),
|
|
85
|
-
} );
|
|
86
|
-
onChoosePattern();
|
|
87
|
-
} }
|
|
88
|
-
/>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function StartPageOptionsModal( { onClose } ) {
|
|
93
|
-
const startPatterns = useStartPatterns();
|
|
94
|
-
const hasStartPattern = startPatterns.length > 0;
|
|
95
|
-
|
|
96
|
-
if ( ! hasStartPattern ) {
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return (
|
|
101
|
-
<Modal
|
|
102
|
-
title={ __( 'Choose a pattern' ) }
|
|
103
|
-
isFullScreen
|
|
104
|
-
onRequestClose={ onClose }
|
|
105
|
-
>
|
|
106
|
-
<div className="editor-start-page-options__modal-content">
|
|
107
|
-
<PatternSelection
|
|
108
|
-
blockPatterns={ startPatterns }
|
|
109
|
-
onChoosePattern={ onClose }
|
|
110
|
-
/>
|
|
111
|
-
</div>
|
|
112
|
-
</Modal>
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
13
|
|
|
116
14
|
export default function StartPageOptions() {
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
15
|
+
const { postId, shouldEnable } = useSelect( ( select ) => {
|
|
16
|
+
const {
|
|
17
|
+
isEditedPostDirty,
|
|
18
|
+
isEditedPostEmpty,
|
|
19
|
+
getCurrentPostId,
|
|
20
|
+
getCurrentPostType,
|
|
21
|
+
} = select( editorStore );
|
|
121
22
|
const preferencesModalActive =
|
|
122
23
|
select( interfaceStore ).isModalActive( 'editor/preferences' );
|
|
123
24
|
const choosePatternModalEnabled = select( preferencesStore ).get(
|
|
124
25
|
'core',
|
|
125
26
|
'enableChoosePatternModal'
|
|
126
27
|
);
|
|
127
|
-
return
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
28
|
+
return {
|
|
29
|
+
postId: getCurrentPostId(),
|
|
30
|
+
shouldEnable:
|
|
31
|
+
choosePatternModalEnabled &&
|
|
32
|
+
! preferencesModalActive &&
|
|
33
|
+
! isEditedPostDirty() &&
|
|
34
|
+
isEditedPostEmpty() &&
|
|
35
|
+
'page' === getCurrentPostType(),
|
|
36
|
+
};
|
|
134
37
|
}, [] );
|
|
38
|
+
const { setIsInserterOpened } = useDispatch( editorStore );
|
|
39
|
+
|
|
40
|
+
useEffect( () => {
|
|
41
|
+
if ( shouldEnable ) {
|
|
42
|
+
setIsInserterOpened( {
|
|
43
|
+
tab: 'patterns',
|
|
44
|
+
category: 'core/starter-content',
|
|
45
|
+
} );
|
|
46
|
+
}
|
|
47
|
+
}, [ postId, shouldEnable, setIsInserterOpened ] );
|
|
135
48
|
|
|
136
|
-
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
return <StartPageOptionsModal onClose={ () => setIsClosed( true ) } />;
|
|
49
|
+
return null;
|
|
141
50
|
}
|
|
@@ -27,25 +27,16 @@ export default function TemplatePartMenuItems() {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
function TemplatePartConverterMenuItem( { clientIds, onClose } ) {
|
|
30
|
-
const {
|
|
30
|
+
const { blocks } = useSelect(
|
|
31
31
|
( select ) => {
|
|
32
|
-
const { getBlocksByClientId
|
|
33
|
-
select( blockEditorStore );
|
|
32
|
+
const { getBlocksByClientId } = select( blockEditorStore );
|
|
34
33
|
return {
|
|
35
34
|
blocks: getBlocksByClientId( clientIds ),
|
|
36
|
-
isContentOnly:
|
|
37
|
-
clientIds.length === 1 &&
|
|
38
|
-
getBlockEditingMode( clientIds[ 0 ] ) === 'contentOnly',
|
|
39
35
|
};
|
|
40
36
|
},
|
|
41
37
|
[ clientIds ]
|
|
42
38
|
);
|
|
43
39
|
|
|
44
|
-
// Do not show the convert button if the block is in content-only mode.
|
|
45
|
-
if ( isContentOnly ) {
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
40
|
// Allow converting a single template part to standard blocks.
|
|
50
41
|
if ( blocks.length === 1 && blocks[ 0 ]?.name === 'core/template-part' ) {
|
|
51
42
|
return (
|
|
@@ -4,12 +4,6 @@
|
|
|
4
4
|
import { store as coreStore } from '@wordpress/core-data';
|
|
5
5
|
import type { Action, Field } from '@wordpress/dataviews';
|
|
6
6
|
import { doAction } from '@wordpress/hooks';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
import { store as editorStore } from '../../store';
|
|
12
|
-
import { unlock } from '../../lock-unlock';
|
|
13
7
|
import type { PostType } from '@wordpress/fields';
|
|
14
8
|
import {
|
|
15
9
|
viewPost,
|
|
@@ -35,8 +29,17 @@ import {
|
|
|
35
29
|
authorField,
|
|
36
30
|
titleField,
|
|
37
31
|
templateField,
|
|
32
|
+
templateTitleField,
|
|
33
|
+
pageTitleField,
|
|
34
|
+
patternTitleField,
|
|
38
35
|
} from '@wordpress/fields';
|
|
39
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Internal dependencies
|
|
39
|
+
*/
|
|
40
|
+
import { store as editorStore } from '../../store';
|
|
41
|
+
import { unlock } from '../../lock-unlock';
|
|
42
|
+
|
|
40
43
|
export function registerEntityAction< Item >(
|
|
41
44
|
kind: string,
|
|
42
45
|
name: string,
|
|
@@ -164,16 +167,28 @@ export const registerPostTypeSchema =
|
|
|
164
167
|
postTypeConfig.supports?.thumbnail &&
|
|
165
168
|
currentTheme?.theme_supports?.[ 'post-thumbnails' ] &&
|
|
166
169
|
featuredImageField,
|
|
167
|
-
titleField,
|
|
168
170
|
postTypeConfig.supports?.author && authorField,
|
|
169
171
|
statusField,
|
|
170
172
|
dateField,
|
|
171
173
|
slugField,
|
|
172
174
|
postTypeConfig.supports?.[ 'page-attributes' ] && parentField,
|
|
173
175
|
postTypeConfig.supports?.comments && commentStatusField,
|
|
174
|
-
passwordField,
|
|
175
176
|
templateField,
|
|
177
|
+
passwordField,
|
|
176
178
|
].filter( Boolean );
|
|
179
|
+
if ( postTypeConfig.supports?.title ) {
|
|
180
|
+
let _titleField;
|
|
181
|
+
if ( postType === 'page' ) {
|
|
182
|
+
_titleField = pageTitleField;
|
|
183
|
+
} else if ( postType === 'wp_template' ) {
|
|
184
|
+
_titleField = templateTitleField;
|
|
185
|
+
} else if ( postType === 'wp_block' ) {
|
|
186
|
+
_titleField = patternTitleField;
|
|
187
|
+
} else {
|
|
188
|
+
_titleField = titleField;
|
|
189
|
+
}
|
|
190
|
+
fields.push( _titleField );
|
|
191
|
+
}
|
|
177
192
|
|
|
178
193
|
registry.batch( () => {
|
|
179
194
|
actions.forEach( ( action ) => {
|
package/src/store/actions.js
CHANGED
|
@@ -23,7 +23,6 @@ import { __ } from '@wordpress/i18n';
|
|
|
23
23
|
/**
|
|
24
24
|
* Internal dependencies
|
|
25
25
|
*/
|
|
26
|
-
import { TRASH_POST_NOTICE_ID } from './constants';
|
|
27
26
|
import { localAutosaveSet } from './local-autosave';
|
|
28
27
|
import {
|
|
29
28
|
getNotificationArgumentsForSaveSuccess,
|
|
@@ -347,7 +346,6 @@ export const trashPost =
|
|
|
347
346
|
const postType = await registry
|
|
348
347
|
.resolveSelect( coreStore )
|
|
349
348
|
.getPostType( postTypeSlug );
|
|
350
|
-
registry.dispatch( noticesStore ).removeNotice( TRASH_POST_NOTICE_ID );
|
|
351
349
|
const { rest_base: restBase, rest_namespace: restNamespace = 'wp/v2' } =
|
|
352
350
|
postType;
|
|
353
351
|
dispatch( { type: 'REQUEST_POST_DELETE_START' } );
|
package/src/store/constants.ts
CHANGED
|
@@ -11,8 +11,6 @@ export const EDIT_MERGE_PROPERTIES = new Set( [ 'meta' ] );
|
|
|
11
11
|
*/
|
|
12
12
|
export const STORE_NAME = 'core/editor';
|
|
13
13
|
|
|
14
|
-
export const SAVE_POST_NOTICE_ID = 'SAVE_POST_NOTICE_ID';
|
|
15
|
-
export const TRASH_POST_NOTICE_ID = 'TRASH_POST_NOTICE_ID';
|
|
16
14
|
export const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/;
|
|
17
15
|
export const ONE_MINUTE_IN_MS = 60 * 1000;
|
|
18
16
|
export const AUTOSAVE_PROPERTIES = [ 'title', 'excerpt', 'content' ];
|
|
@@ -34,7 +34,7 @@ export function setCurrentTemplateId( id ) {
|
|
|
34
34
|
/**
|
|
35
35
|
* Create a block based template.
|
|
36
36
|
*
|
|
37
|
-
* @param {Object
|
|
37
|
+
* @param {?Object} template Template to create and assign.
|
|
38
38
|
*/
|
|
39
39
|
export const createTemplate =
|
|
40
40
|
( template ) =>
|
|
@@ -3,11 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { SAVE_POST_NOTICE_ID, TRASH_POST_NOTICE_ID } from '../constants';
|
|
10
|
-
|
|
11
6
|
/**
|
|
12
7
|
* Builds the arguments for a success notification dispatch.
|
|
13
8
|
*
|
|
@@ -68,7 +63,7 @@ export function getNotificationArgumentsForSaveSuccess( data ) {
|
|
|
68
63
|
return [
|
|
69
64
|
noticeMessage,
|
|
70
65
|
{
|
|
71
|
-
id:
|
|
66
|
+
id: 'editor-save',
|
|
72
67
|
type: 'snackbar',
|
|
73
68
|
actions,
|
|
74
69
|
},
|
|
@@ -113,7 +108,7 @@ export function getNotificationArgumentsForSaveFail( data ) {
|
|
|
113
108
|
return [
|
|
114
109
|
noticeMessage,
|
|
115
110
|
{
|
|
116
|
-
id:
|
|
111
|
+
id: 'editor-save',
|
|
117
112
|
},
|
|
118
113
|
];
|
|
119
114
|
}
|
|
@@ -131,7 +126,7 @@ export function getNotificationArgumentsForTrashFail( data ) {
|
|
|
131
126
|
? data.error.message
|
|
132
127
|
: __( 'Trashing failed' ),
|
|
133
128
|
{
|
|
134
|
-
id:
|
|
129
|
+
id: 'editor-trash-fail',
|
|
135
130
|
},
|
|
136
131
|
];
|
|
137
132
|
}
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
getNotificationArgumentsForSaveFail,
|
|
7
7
|
getNotificationArgumentsForTrashFail,
|
|
8
8
|
} from '../notice-builder';
|
|
9
|
-
import { SAVE_POST_NOTICE_ID, TRASH_POST_NOTICE_ID } from '../../constants';
|
|
10
9
|
|
|
11
10
|
describe( 'getNotificationArgumentsForSaveSuccess()', () => {
|
|
12
11
|
const postType = {
|
|
@@ -27,7 +26,7 @@ describe( 'getNotificationArgumentsForSaveSuccess()', () => {
|
|
|
27
26
|
};
|
|
28
27
|
const post = { ...previousPost };
|
|
29
28
|
const defaultExpectedAction = {
|
|
30
|
-
id:
|
|
29
|
+
id: 'editor-save',
|
|
31
30
|
actions: [],
|
|
32
31
|
type: 'snackbar',
|
|
33
32
|
};
|
|
@@ -106,7 +105,7 @@ describe( 'getNotificationArgumentsForSaveFail()', () => {
|
|
|
106
105
|
const error = { code: '42', message: 'Something went wrong.' };
|
|
107
106
|
const post = { status: 'publish' };
|
|
108
107
|
const edits = { status: 'publish' };
|
|
109
|
-
const defaultExpectedAction = { id:
|
|
108
|
+
const defaultExpectedAction = { id: 'editor-save' };
|
|
110
109
|
[
|
|
111
110
|
[
|
|
112
111
|
'when error code is `rest_autosave_no_changes`',
|
|
@@ -190,7 +189,7 @@ describe( 'getNotificationArgumentsForTrashFail()', () => {
|
|
|
190
189
|
].forEach( ( [ description, error, message ] ) => {
|
|
191
190
|
// eslint-disable-next-line jest/valid-title
|
|
192
191
|
it( description, () => {
|
|
193
|
-
const expectedValue = [ message, { id:
|
|
192
|
+
const expectedValue = [ message, { id: 'editor-trash-fail' } ];
|
|
194
193
|
expect( getNotificationArgumentsForTrashFail( { error } ) ).toEqual(
|
|
195
194
|
expectedValue
|
|
196
195
|
);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Helper function to get the title of a post item.
|
|
8
|
+
* This is duplicated from the `@wordpress/fields` package.
|
|
9
|
+
* `packages/fields/src/actions/utils.ts`
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} item The post item.
|
|
12
|
+
* @return {string} The title of the item, or an empty string if the title is not found.
|
|
13
|
+
*/
|
|
14
|
+
export function getItemTitle( item ) {
|
|
15
|
+
if ( typeof item.title === 'string' ) {
|
|
16
|
+
return decodeEntities( item.title );
|
|
17
|
+
}
|
|
18
|
+
if ( item.title && 'rendered' in item.title ) {
|
|
19
|
+
return decodeEntities( item.title.rendered );
|
|
20
|
+
}
|
|
21
|
+
if ( item.title && 'raw' in item.title ) {
|
|
22
|
+
return decodeEntities( item.title.raw );
|
|
23
|
+
}
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { privateApis } from '@wordpress/media-utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { unlock } from '../../lock-unlock';
|
|
10
|
+
|
|
11
|
+
const { sideloadMedia: mediaSideload } = unlock( privateApis );
|
|
12
|
+
|
|
13
|
+
export default mediaSideload;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function mediaSideload() {}
|
|
@@ -27,6 +27,7 @@ const noop = () => {};
|
|
|
27
27
|
* @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site.
|
|
28
28
|
* @param {Function} $0.onError Function called when an error happens.
|
|
29
29
|
* @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available.
|
|
30
|
+
* @param {Function} $0.onSuccess Function called after the final representation of the file is available.
|
|
30
31
|
*/
|
|
31
32
|
export default function mediaUpload( {
|
|
32
33
|
additionalData = {},
|
|
@@ -35,6 +36,7 @@ export default function mediaUpload( {
|
|
|
35
36
|
maxUploadFileSize,
|
|
36
37
|
onError = noop,
|
|
37
38
|
onFileChange,
|
|
39
|
+
onSuccess,
|
|
38
40
|
} ) {
|
|
39
41
|
const { getCurrentPost, getEditorSettings } = select( editorStore );
|
|
40
42
|
const {
|
|
@@ -77,8 +79,9 @@ export default function mediaUpload( {
|
|
|
77
79
|
} else {
|
|
78
80
|
clearSaveLock();
|
|
79
81
|
}
|
|
80
|
-
onFileChange( file );
|
|
82
|
+
onFileChange?.( file );
|
|
81
83
|
},
|
|
84
|
+
onSuccess,
|
|
82
85
|
additionalData: {
|
|
83
86
|
...postData,
|
|
84
87
|
...additionalData,
|
|
@@ -5,19 +5,14 @@ import { __ } from '@wordpress/i18n';
|
|
|
5
5
|
import { useSelect } from '@wordpress/data';
|
|
6
6
|
import { store as coreStore } from '@wordpress/core-data';
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
import { store as editorStore } from '../store';
|
|
12
|
-
|
|
13
8
|
/**
|
|
14
9
|
* Custom hook to get the page type badge for the current post on edit site view.
|
|
10
|
+
*
|
|
11
|
+
* @param {number|string} postId postId of the current post being edited.
|
|
15
12
|
*/
|
|
16
|
-
export default function usePageTypeBadge() {
|
|
13
|
+
export default function usePageTypeBadge( postId ) {
|
|
17
14
|
const { isFrontPage, isPostsPage } = useSelect( ( select ) => {
|
|
18
|
-
const { getCurrentPostId } = select( editorStore );
|
|
19
15
|
const { canUser, getEditedEntityRecord } = select( coreStore );
|
|
20
|
-
const postId = getCurrentPostId();
|
|
21
16
|
const siteSettings = canUser( 'read', {
|
|
22
17
|
kind: 'root',
|
|
23
18
|
name: 'site',
|
|
@@ -25,9 +20,11 @@ export default function usePageTypeBadge() {
|
|
|
25
20
|
? getEditedEntityRecord( 'root', 'site' )
|
|
26
21
|
: undefined;
|
|
27
22
|
|
|
23
|
+
const _postId = parseInt( postId, 10 );
|
|
24
|
+
|
|
28
25
|
return {
|
|
29
|
-
isFrontPage: siteSettings?.page_on_front ===
|
|
30
|
-
isPostsPage: siteSettings?.page_for_posts ===
|
|
26
|
+
isFrontPage: siteSettings?.page_on_front === _postId,
|
|
27
|
+
isPostsPage: siteSettings?.page_for_posts === _postId,
|
|
31
28
|
};
|
|
32
29
|
} );
|
|
33
30
|
|
package/tsconfig.json
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
"$schema": "https://json.schemastore.org/tsconfig.json",
|
|
3
3
|
"extends": "../../tsconfig.base.json",
|
|
4
4
|
"compilerOptions": {
|
|
5
|
-
"rootDir": "src",
|
|
6
|
-
"declarationDir": "build-types",
|
|
7
5
|
"checkJs": false
|
|
8
6
|
},
|
|
9
7
|
"references": [
|
|
@@ -34,6 +32,5 @@
|
|
|
34
32
|
{ "path": "../url" },
|
|
35
33
|
{ "path": "../warning" },
|
|
36
34
|
{ "path": "../wordcount" }
|
|
37
|
-
]
|
|
38
|
-
"include": [ "src" ]
|
|
35
|
+
]
|
|
39
36
|
}
|