@wordpress/editor 14.6.0 → 14.7.1-next.1f6eadc42.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 +2 -0
- package/README.md +41 -0
- package/build/bindings/post-meta.js +11 -8
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/block-manager/index.js +1 -0
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/block-settings-menu/content-only-settings-menu.js +5 -8
- package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build/components/document-bar/index.js +4 -4
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/editor/index.js +2 -2
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-history/redo.js +1 -0
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/editor-history/undo.js +1 -0
- package/build/components/editor-history/undo.js.map +1 -1
- package/build/components/editor-interface/index.js +2 -3
- package/build/components/editor-interface/index.js.map +1 -1
- package/build/components/error-boundary/index.js +1 -0
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/global-styles-provider/index.js +3 -4
- package/build/components/global-styles-provider/index.js.map +1 -1
- package/build/components/header/index.js +6 -4
- package/build/components/header/index.js.map +1 -1
- package/build/components/index.js +8 -0
- package/build/components/index.js.map +1 -1
- package/build/components/inserter-sidebar/index.js +5 -10
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/local-autosave-monitor/index.js +5 -5
- package/build/components/local-autosave-monitor/index.js.map +1 -1
- package/build/components/page-attributes/parent.js +4 -1
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/plugin-preview-menu-item/index.js +57 -0
- package/build/components/plugin-preview-menu-item/index.js.map +1 -0
- package/build/components/post-actions/index.js +5 -8
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-excerpt/panel.js +1 -1
- package/build/components/post-excerpt/panel.js.map +1 -1
- package/build/components/post-featured-image/index.js +3 -0
- package/build/components/post-featured-image/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-last-revision/index.js +1 -0
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-locked-modal/index.js +6 -1
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-publish-panel/index.js +1 -0
- package/build/components/post-publish-panel/index.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 +156 -33
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build/components/post-publish-panel/media-util.js +79 -0
- package/build/components/post-publish-panel/media-util.js.map +1 -0
- package/build/components/post-status/index.js +4 -2
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +4 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js +4 -1
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-template/block-theme.js +13 -4
- package/build/components/post-template/block-theme.js.map +1 -1
- package/build/components/post-template/classic-theme.js +4 -1
- package/build/components/post-template/classic-theme.js.map +1 -1
- package/build/components/post-title/index.js +32 -46
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-trash/check.js +2 -1
- package/build/components/post-trash/check.js.map +1 -1
- package/build/components/post-trash/index.js +22 -8
- package/build/components/post-trash/index.js.map +1 -1
- package/build/components/post-url/index.js +4 -1
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +28 -1
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js +11 -51
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/index.js +34 -8
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +14 -10
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/save-publish-panels/index.js +8 -2
- package/build/components/save-publish-panels/index.js.map +1 -1
- package/build/components/sidebar/post-summary.js +3 -0
- package/build/components/sidebar/post-summary.js.map +1 -1
- package/build/components/start-page-options/index.js +16 -19
- 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/table-of-contents/index.js +1 -0
- package/build/components/table-of-contents/index.js.map +1 -1
- package/build/components/text-editor/index.js +1 -0
- package/build/components/text-editor/index.js.map +1 -1
- package/build/components/visual-editor/edit-template-blocks-notification.js +1 -1
- package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
- package/build/components/visual-editor/index.js +1 -6
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/components/zoom-out-toggle/index.js +38 -0
- package/build/components/zoom-out-toggle/index.js.map +1 -0
- package/build/dataviews/actions/reset-post.js +2 -0
- package/build/dataviews/actions/reset-post.js.map +1 -1
- package/build/dataviews/actions/trash-post.js +2 -0
- package/build/dataviews/actions/trash-post.js.map +1 -1
- package/build/dataviews/store/private-actions.js +4 -10
- package/build/dataviews/store/private-actions.js.map +1 -1
- package/build/private-apis.js +0 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/private-actions.js +1 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/selectors.js +7 -3
- package/build/store/selectors.js.map +1 -1
- package/build-module/bindings/post-meta.js +11 -8
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/block-manager/index.js +1 -0
- package/build-module/components/block-manager/index.js.map +1 -1
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +6 -9
- package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build-module/components/document-bar/index.js +4 -4
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/editor/index.js +2 -2
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-history/redo.js +1 -0
- package/build-module/components/editor-history/redo.js.map +1 -1
- package/build-module/components/editor-history/undo.js +1 -0
- package/build-module/components/editor-history/undo.js.map +1 -1
- package/build-module/components/editor-interface/index.js +2 -3
- package/build-module/components/editor-interface/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +1 -0
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/global-styles-provider/index.js +3 -4
- package/build-module/components/global-styles-provider/index.js.map +1 -1
- package/build-module/components/header/index.js +6 -4
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/index.js +1 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js +5 -10
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/local-autosave-monitor/index.js +5 -5
- package/build-module/components/local-autosave-monitor/index.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +4 -1
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/plugin-preview-menu-item/index.js +52 -0
- package/build-module/components/plugin-preview-menu-item/index.js.map +1 -0
- package/build-module/components/post-actions/index.js +5 -8
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +1 -1
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +3 -0
- package/build-module/components/post-featured-image/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-last-revision/index.js +1 -0
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js +6 -1
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +1 -0
- package/build-module/components/post-publish-panel/index.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 +155 -32
- package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build-module/components/post-publish-panel/media-util.js +72 -0
- package/build-module/components/post-publish-panel/media-util.js.map +1 -0
- package/build-module/components/post-status/index.js +4 -2
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +4 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js +4 -1
- package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build-module/components/post-template/block-theme.js +13 -4
- package/build-module/components/post-template/block-theme.js.map +1 -1
- package/build-module/components/post-template/classic-theme.js +4 -1
- package/build-module/components/post-template/classic-theme.js.map +1 -1
- package/build-module/components/post-title/index.js +33 -47
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-trash/check.js +2 -1
- package/build-module/components/post-trash/check.js.map +1 -1
- package/build-module/components/post-trash/index.js +23 -11
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/post-url/index.js +4 -1
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +28 -1
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +11 -51
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/index.js +35 -9
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +15 -11
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/save-publish-panels/index.js +8 -2
- package/build-module/components/save-publish-panels/index.js.map +1 -1
- package/build-module/components/sidebar/post-summary.js +3 -0
- package/build-module/components/sidebar/post-summary.js.map +1 -1
- package/build-module/components/start-page-options/index.js +17 -21
- 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/table-of-contents/index.js +1 -0
- package/build-module/components/table-of-contents/index.js.map +1 -1
- package/build-module/components/text-editor/index.js +1 -0
- package/build-module/components/text-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/edit-template-blocks-notification.js +1 -1
- package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
- package/build-module/components/visual-editor/index.js +1 -6
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/components/zoom-out-toggle/index.js +31 -0
- package/build-module/components/zoom-out-toggle/index.js.map +1 -0
- package/build-module/dataviews/actions/reset-post.js +2 -0
- package/build-module/dataviews/actions/reset-post.js.map +1 -1
- package/build-module/dataviews/actions/trash-post.js +2 -0
- package/build-module/dataviews/actions/trash-post.js.map +1 -1
- package/build-module/dataviews/store/private-actions.js +2 -8
- package/build-module/dataviews/store/private-actions.js.map +1 -1
- package/build-module/private-apis.js +0 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/private-actions.js +1 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/selectors.js +6 -2
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +14 -13
- package/build-style/style.css +14 -13
- package/build-types/bindings/post-meta.d.ts +0 -3
- package/build-types/bindings/post-meta.d.ts.map +1 -1
- package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts.map +1 -1
- package/build-types/components/editor-history/redo.d.ts.map +1 -1
- package/build-types/components/editor-history/undo.d.ts.map +1 -1
- package/build-types/components/editor-interface/index.d.ts.map +1 -1
- package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
- package/build-types/components/header/back-button.d.ts.map +1 -1
- package/build-types/components/header/index.d.ts.map +1 -1
- package/build-types/components/index.d.ts +1 -0
- package/build-types/components/index.d.ts.map +1 -1
- package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
- package/build-types/components/more-menu/tools-more-menu-group.d.ts.map +1 -1
- package/build-types/components/more-menu/view-more-menu-group.d.ts.map +1 -1
- package/build-types/components/page-attributes/parent.d.ts.map +1 -1
- package/build-types/components/plugin-document-setting-panel/index.d.ts.map +1 -1
- package/build-types/components/plugin-post-publish-panel/index.d.ts.map +1 -1
- package/build-types/components/plugin-post-status-info/index.d.ts.map +1 -1
- package/build-types/components/plugin-pre-publish-panel/index.d.ts.map +1 -1
- package/build-types/components/plugin-preview-menu-item/index.d.ts +3 -0
- package/build-types/components/plugin-preview-menu-item/index.d.ts.map +1 -0
- package/build-types/components/post-actions/index.d.ts.map +1 -1
- package/build-types/components/post-excerpt/plugin.d.ts.map +1 -1
- package/build-types/components/post-format/index.d.ts.map +1 -1
- package/build-types/components/post-last-revision/index.d.ts.map +1 -1
- package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/index.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/maybe-post-format-panel.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/maybe-upload-media.d.ts +1 -1
- package/build-types/components/post-publish-panel/maybe-upload-media.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/media-util.d.ts +20 -0
- package/build-types/components/post-publish-panel/media-util.d.ts.map +1 -0
- package/build-types/components/post-status/index.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/most-used-terms.d.ts.map +1 -1
- package/build-types/components/post-template/block-theme.d.ts.map +1 -1
- package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
- package/build-types/components/post-trash/check.d.ts.map +1 -1
- package/build-types/components/post-trash/index.d.ts +4 -1
- package/build-types/components/post-trash/index.d.ts.map +1 -1
- package/build-types/components/post-url/index.d.ts.map +1 -1
- package/build-types/components/preferences-modal/enable-plugin-document-setting-panel.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/index.d.ts.map +1 -1
- package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
- package/build-types/components/save-publish-panels/index.d.ts.map +1 -1
- package/build-types/components/sidebar/post-summary.d.ts.map +1 -1
- package/build-types/components/start-page-options/index.d.ts +1 -0
- package/build-types/components/start-page-options/index.d.ts.map +1 -1
- package/build-types/components/start-template-options/index.d.ts.map +1 -1
- package/build-types/components/text-editor/index.d.ts.map +1 -1
- package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts.map +1 -1
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/components/zoom-out-toggle/index.d.ts +3 -0
- package/build-types/components/zoom-out-toggle/index.d.ts.map +1 -0
- package/build-types/dataviews/actions/reset-post.d.ts.map +1 -1
- package/build-types/dataviews/actions/trash-post.d.ts.map +1 -1
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +8 -8
- package/build-types/store/selectors.d.ts.map +1 -1
- package/package.json +37 -36
- package/src/bindings/post-meta.js +12 -6
- package/src/components/block-manager/index.js +1 -0
- package/src/components/block-settings-menu/content-only-settings-menu.js +5 -9
- package/src/components/create-template-part-modal/style.scss +1 -1
- package/src/components/document-bar/index.js +4 -4
- package/src/components/document-outline/style.scss +1 -1
- package/src/components/editor/index.js +1 -1
- package/src/components/editor-history/redo.js +1 -0
- package/src/components/editor-history/undo.js +1 -0
- package/src/components/editor-interface/index.js +2 -4
- package/src/components/error-boundary/index.js +1 -1
- package/src/components/global-styles-provider/index.js +11 -7
- package/src/components/header/index.js +12 -3
- package/src/components/header/style.scss +6 -3
- package/src/components/index.js +1 -0
- package/src/components/inserter-sidebar/index.js +6 -8
- package/src/components/local-autosave-monitor/index.js +6 -6
- package/src/components/page-attributes/parent.js +5 -4
- package/src/components/plugin-preview-menu-item/index.js +52 -0
- package/src/components/post-actions/index.js +8 -14
- package/src/components/post-card-panel/style.scss +1 -1
- package/src/components/post-excerpt/panel.js +1 -1
- package/src/components/post-featured-image/index.js +3 -0
- package/src/components/post-featured-image/style.scss +2 -7
- package/src/components/post-format/index.js +1 -0
- package/src/components/post-last-revision/index.js +1 -0
- package/src/components/post-locked-modal/index.js +12 -2
- package/src/components/post-locked-modal/style.scss +1 -1
- package/src/components/post-publish-panel/index.js +1 -0
- package/src/components/post-publish-panel/maybe-post-format-panel.js +1 -0
- package/src/components/post-publish-panel/maybe-upload-media.js +144 -36
- package/src/components/post-publish-panel/media-util.js +87 -0
- package/src/components/post-publish-panel/style.scss +3 -1
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +2 -2
- package/src/components/post-publish-panel/test/media-util.js +118 -0
- package/src/components/post-status/index.js +3 -2
- package/src/components/post-taxonomies/hierarchical-term-selector.js +2 -0
- package/src/components/post-taxonomies/most-used-terms.js +2 -0
- package/src/components/post-template/block-theme.js +15 -9
- package/src/components/post-template/classic-theme.js +2 -0
- package/src/components/post-title/index.js +30 -41
- package/src/components/post-trash/check.js +5 -2
- package/src/components/post-trash/index.js +23 -12
- package/src/components/post-url/index.js +2 -0
- package/src/components/preferences-modal/index.js +227 -172
- package/src/components/preview-dropdown/index.js +22 -72
- package/src/components/provider/index.js +42 -10
- package/src/components/provider/use-block-editor-settings.js +16 -11
- package/src/components/resizable-editor/style.scss +2 -2
- package/src/components/save-publish-panels/index.js +4 -0
- package/src/components/sidebar/post-summary.js +4 -0
- package/src/components/start-page-options/index.js +28 -26
- package/src/components/start-template-options/index.js +5 -1
- package/src/components/table-of-contents/index.js +1 -0
- package/src/components/text-editor/index.js +1 -0
- package/src/components/text-editor/style.scss +1 -1
- package/src/components/visual-editor/edit-template-blocks-notification.js +4 -1
- package/src/components/visual-editor/index.js +2 -9
- package/src/components/zoom-out-toggle/index.js +34 -0
- package/src/dataviews/actions/reset-post.tsx +2 -0
- package/src/dataviews/actions/trash-post.tsx +2 -0
- package/src/dataviews/store/private-actions.ts +10 -8
- package/src/private-apis.js +0 -2
- package/src/store/private-actions.js +3 -1
- package/src/store/selectors.js +9 -3
- package/tsconfig.json +2 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/dataviews/actions/duplicate-pattern.js +0 -48
- package/build/dataviews/actions/duplicate-pattern.js.map +0 -1
- package/build/dataviews/actions/duplicate-post.js +0 -146
- package/build/dataviews/actions/duplicate-post.js.map +0 -1
- package/build/dataviews/actions/duplicate-post.native.js +0 -9
- package/build/dataviews/actions/duplicate-post.native.js.map +0 -1
- package/build/dataviews/actions/export-pattern.js +0 -55
- package/build/dataviews/actions/export-pattern.js.map +0 -1
- package/build/dataviews/actions/export-pattern.native.js +0 -9
- package/build/dataviews/actions/export-pattern.native.js.map +0 -1
- package/build/dataviews/actions/permanently-delete-post.js +0 -107
- package/build/dataviews/actions/permanently-delete-post.js.map +0 -1
- package/build/dataviews/actions/reorder-page.js +0 -116
- package/build/dataviews/actions/reorder-page.js.map +0 -1
- package/build/dataviews/actions/reorder-page.native.js +0 -9
- package/build/dataviews/actions/reorder-page.native.js.map +0 -1
- package/build/dataviews/actions/view-post-revisions.js +0 -49
- package/build/dataviews/actions/view-post-revisions.js.map +0 -1
- package/build/dataviews/actions/view-post.js +0 -36
- package/build/dataviews/actions/view-post.js.map +0 -1
- package/build-module/dataviews/actions/duplicate-pattern.js +0 -39
- package/build-module/dataviews/actions/duplicate-pattern.js.map +0 -1
- package/build-module/dataviews/actions/duplicate-post.js +0 -139
- package/build-module/dataviews/actions/duplicate-post.js.map +0 -1
- package/build-module/dataviews/actions/duplicate-post.native.js +0 -3
- package/build-module/dataviews/actions/duplicate-post.native.js.map +0 -1
- package/build-module/dataviews/actions/export-pattern.js +0 -49
- package/build-module/dataviews/actions/export-pattern.js.map +0 -1
- package/build-module/dataviews/actions/export-pattern.native.js +0 -3
- package/build-module/dataviews/actions/export-pattern.native.js.map +0 -1
- package/build-module/dataviews/actions/permanently-delete-post.js +0 -99
- package/build-module/dataviews/actions/permanently-delete-post.js.map +0 -1
- package/build-module/dataviews/actions/reorder-page.js +0 -111
- package/build-module/dataviews/actions/reorder-page.js.map +0 -1
- package/build-module/dataviews/actions/reorder-page.native.js +0 -3
- package/build-module/dataviews/actions/reorder-page.native.js.map +0 -1
- package/build-module/dataviews/actions/view-post-revisions.js +0 -43
- package/build-module/dataviews/actions/view-post-revisions.js.map +0 -1
- package/build-module/dataviews/actions/view-post.js +0 -30
- package/build-module/dataviews/actions/view-post.js.map +0 -1
- package/build-types/dataviews/actions/duplicate-pattern.d.ts +0 -5
- package/build-types/dataviews/actions/duplicate-pattern.d.ts.map +0 -1
- package/build-types/dataviews/actions/duplicate-post.d.ts +0 -5
- package/build-types/dataviews/actions/duplicate-post.d.ts.map +0 -1
- package/build-types/dataviews/actions/duplicate-post.native.d.ts +0 -3
- package/build-types/dataviews/actions/duplicate-post.native.d.ts.map +0 -1
- package/build-types/dataviews/actions/export-pattern.d.ts +0 -8
- package/build-types/dataviews/actions/export-pattern.d.ts.map +0 -1
- package/build-types/dataviews/actions/export-pattern.native.d.ts +0 -3
- package/build-types/dataviews/actions/export-pattern.native.d.ts.map +0 -1
- package/build-types/dataviews/actions/permanently-delete-post.d.ts +0 -5
- package/build-types/dataviews/actions/permanently-delete-post.d.ts.map +0 -1
- package/build-types/dataviews/actions/reorder-page.d.ts +0 -8
- package/build-types/dataviews/actions/reorder-page.d.ts.map +0 -1
- package/build-types/dataviews/actions/reorder-page.native.d.ts +0 -3
- package/build-types/dataviews/actions/reorder-page.native.d.ts.map +0 -1
- package/build-types/dataviews/actions/view-post-revisions.d.ts +0 -8
- package/build-types/dataviews/actions/view-post-revisions.d.ts.map +0 -1
- package/build-types/dataviews/actions/view-post.d.ts +0 -8
- package/build-types/dataviews/actions/view-post.d.ts.map +0 -1
- package/src/dataviews/actions/duplicate-pattern.tsx +0 -40
- package/src/dataviews/actions/duplicate-post.native.tsx +0 -3
- package/src/dataviews/actions/duplicate-post.tsx +0 -174
- package/src/dataviews/actions/export-pattern.native.tsx +0 -3
- package/src/dataviews/actions/export-pattern.tsx +0 -74
- package/src/dataviews/actions/permanently-delete-post.tsx +0 -116
- package/src/dataviews/actions/reorder-page.native.tsx +0 -3
- package/src/dataviews/actions/reorder-page.tsx +0 -125
- package/src/dataviews/actions/view-post-revisions.tsx +0 -47
- package/src/dataviews/actions/view-post.tsx +0 -30
|
@@ -17,7 +17,7 @@ import { isBlobURL } from '@wordpress/blob';
|
|
|
17
17
|
/**
|
|
18
18
|
* Internal dependencies
|
|
19
19
|
*/
|
|
20
|
-
import {
|
|
20
|
+
import { fetchMedia } from './media-util';
|
|
21
21
|
|
|
22
22
|
function flattenBlocks( blocks ) {
|
|
23
23
|
const result = [];
|
|
@@ -30,7 +30,53 @@ function flattenBlocks( blocks ) {
|
|
|
30
30
|
return result;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Determine whether a block has external media.
|
|
35
|
+
*
|
|
36
|
+
* Different blocks use different attribute names (and potentially
|
|
37
|
+
* different logic as well) in determining whether the media is
|
|
38
|
+
* present, and whether it's external.
|
|
39
|
+
*
|
|
40
|
+
* @param {{name: string, attributes: Object}} block The block.
|
|
41
|
+
* @return {boolean?} Whether the block has external media
|
|
42
|
+
*/
|
|
43
|
+
function hasExternalMedia( block ) {
|
|
44
|
+
if ( block.name === 'core/image' || block.name === 'core/cover' ) {
|
|
45
|
+
return block.attributes.url && ! block.attributes.id;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if ( block.name === 'core/media-text' ) {
|
|
49
|
+
return block.attributes.mediaUrl && ! block.attributes.mediaId;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Retrieve media info from a block.
|
|
57
|
+
*
|
|
58
|
+
* Different blocks use different attribute names, so we need this
|
|
59
|
+
* function to normalize things into a consistent naming scheme.
|
|
60
|
+
*
|
|
61
|
+
* @param {{name: string, attributes: Object}} block The block.
|
|
62
|
+
* @return {{url: ?string, alt: ?string, id: ?number}} The media info for the block.
|
|
63
|
+
*/
|
|
64
|
+
function getMediaInfo( block ) {
|
|
65
|
+
if ( block.name === 'core/image' || block.name === 'core/cover' ) {
|
|
66
|
+
const { url, alt, id } = block.attributes;
|
|
67
|
+
return { url, alt, id };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if ( block.name === 'core/media-text' ) {
|
|
71
|
+
const { mediaUrl: url, mediaAlt: alt, mediaId: id } = block.attributes;
|
|
72
|
+
return { url, alt, id };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return {};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Image component to represent a single image in the upload dialog.
|
|
79
|
+
function Image( { clientId, alt, url } ) {
|
|
34
80
|
const { selectBlock } = useDispatch( blockEditorStore );
|
|
35
81
|
return (
|
|
36
82
|
<motion.img
|
|
@@ -38,17 +84,17 @@ function Image( block ) {
|
|
|
38
84
|
role="button"
|
|
39
85
|
aria-label={ __( 'Select image block.' ) }
|
|
40
86
|
onClick={ () => {
|
|
41
|
-
selectBlock(
|
|
87
|
+
selectBlock( clientId );
|
|
42
88
|
} }
|
|
43
89
|
onKeyDown={ ( event ) => {
|
|
44
90
|
if ( event.key === 'Enter' || event.key === ' ' ) {
|
|
45
|
-
selectBlock(
|
|
91
|
+
selectBlock( clientId );
|
|
46
92
|
event.preventDefault();
|
|
47
93
|
}
|
|
48
94
|
} }
|
|
49
|
-
key={
|
|
50
|
-
alt={
|
|
51
|
-
src={
|
|
95
|
+
key={ clientId }
|
|
96
|
+
alt={ alt }
|
|
97
|
+
src={ url }
|
|
52
98
|
animate={ { opacity: 1 } }
|
|
53
99
|
exit={ { opacity: 0, scale: 0 } }
|
|
54
100
|
style={ {
|
|
@@ -63,24 +109,25 @@ function Image( block ) {
|
|
|
63
109
|
);
|
|
64
110
|
}
|
|
65
111
|
|
|
66
|
-
export default function
|
|
112
|
+
export default function MaybeUploadMediaPanel() {
|
|
67
113
|
const [ isUploading, setIsUploading ] = useState( false );
|
|
114
|
+
const [ isAnimating, setIsAnimating ] = useState( false );
|
|
115
|
+
const [ hadUploadError, setHadUploadError ] = useState( false );
|
|
68
116
|
const { editorBlocks, mediaUpload } = useSelect(
|
|
69
117
|
( select ) => ( {
|
|
70
|
-
editorBlocks: select(
|
|
118
|
+
editorBlocks: select( blockEditorStore ).getBlocks(),
|
|
71
119
|
mediaUpload: select( blockEditorStore ).getSettings().mediaUpload,
|
|
72
120
|
} ),
|
|
73
121
|
[]
|
|
74
122
|
);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
! block.attributes.id
|
|
123
|
+
|
|
124
|
+
// Get a list of blocks with external media.
|
|
125
|
+
const blocksWithExternalMedia = flattenBlocks( editorBlocks ).filter(
|
|
126
|
+
( block ) => hasExternalMedia( block )
|
|
80
127
|
);
|
|
81
128
|
const { updateBlockAttributes } = useDispatch( blockEditorStore );
|
|
82
129
|
|
|
83
|
-
if ( ! mediaUpload || !
|
|
130
|
+
if ( ! mediaUpload || ! blocksWithExternalMedia.length ) {
|
|
84
131
|
return null;
|
|
85
132
|
}
|
|
86
133
|
|
|
@@ -91,18 +138,51 @@ export default function PostFormatPanel() {
|
|
|
91
138
|
</span>,
|
|
92
139
|
];
|
|
93
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Update an individual block to point to newly-added library media.
|
|
143
|
+
*
|
|
144
|
+
* Different blocks use different attribute names, so we need this
|
|
145
|
+
* function to ensure we modify the correct attributes for each type.
|
|
146
|
+
*
|
|
147
|
+
* @param {{name: string, attributes: Object}} block The block.
|
|
148
|
+
* @param {{id: number, url: string}} media Media library file info.
|
|
149
|
+
*/
|
|
150
|
+
function updateBlockWithUploadedMedia( block, media ) {
|
|
151
|
+
if ( block.name === 'core/image' || block.name === 'core/cover' ) {
|
|
152
|
+
updateBlockAttributes( block.clientId, {
|
|
153
|
+
id: media.id,
|
|
154
|
+
url: media.url,
|
|
155
|
+
} );
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if ( block.name === 'core/media-text' ) {
|
|
159
|
+
updateBlockAttributes( block.clientId, {
|
|
160
|
+
mediaId: media.id,
|
|
161
|
+
mediaUrl: media.url,
|
|
162
|
+
} );
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Handle fetching and uploading all external media in the post.
|
|
94
167
|
function uploadImages() {
|
|
95
168
|
setIsUploading( true );
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
169
|
+
setHadUploadError( false );
|
|
170
|
+
|
|
171
|
+
// Multiple blocks can be using the same URL, so we
|
|
172
|
+
// should ensure we only fetch and upload each of them once.
|
|
173
|
+
const mediaUrls = new Set(
|
|
174
|
+
blocksWithExternalMedia.map( ( block ) => {
|
|
175
|
+
const { url } = getMediaInfo( block );
|
|
176
|
+
return url;
|
|
177
|
+
} )
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
// Create an upload promise for each URL, that we can wait for in all
|
|
181
|
+
// blocks that make use of that media.
|
|
182
|
+
const uploadPromises = Object.fromEntries(
|
|
183
|
+
Object.entries( fetchMedia( [ ...mediaUrls ] ) ).map(
|
|
184
|
+
( [ url, filePromise ] ) => {
|
|
185
|
+
const uploadPromise = filePromise.then(
|
|
106
186
|
( blob ) =>
|
|
107
187
|
new Promise( ( resolve, reject ) => {
|
|
108
188
|
mediaUpload( {
|
|
@@ -112,19 +192,32 @@ export default function PostFormatPanel() {
|
|
|
112
192
|
return;
|
|
113
193
|
}
|
|
114
194
|
|
|
115
|
-
|
|
116
|
-
id: media.id,
|
|
117
|
-
url: media.url,
|
|
118
|
-
} );
|
|
119
|
-
resolve();
|
|
195
|
+
resolve( media );
|
|
120
196
|
},
|
|
121
197
|
onError() {
|
|
122
198
|
reject();
|
|
123
199
|
},
|
|
124
200
|
} );
|
|
125
201
|
} )
|
|
126
|
-
)
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
return [ url, uploadPromise ];
|
|
205
|
+
}
|
|
127
206
|
)
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
// Wait for all blocks to be updated with library media.
|
|
210
|
+
Promise.allSettled(
|
|
211
|
+
blocksWithExternalMedia.map( ( block ) => {
|
|
212
|
+
const { url } = getMediaInfo( block );
|
|
213
|
+
|
|
214
|
+
return uploadPromises[ url ]
|
|
215
|
+
.then( ( media ) =>
|
|
216
|
+
updateBlockWithUploadedMedia( block, media )
|
|
217
|
+
)
|
|
218
|
+
.then( () => setIsAnimating( true ) )
|
|
219
|
+
.catch( () => setHadUploadError( true ) );
|
|
220
|
+
} )
|
|
128
221
|
).finally( () => {
|
|
129
222
|
setIsUploading( false );
|
|
130
223
|
} );
|
|
@@ -144,19 +237,34 @@ export default function PostFormatPanel() {
|
|
|
144
237
|
gap: '8px',
|
|
145
238
|
} }
|
|
146
239
|
>
|
|
147
|
-
<AnimatePresence
|
|
148
|
-
{
|
|
149
|
-
|
|
240
|
+
<AnimatePresence
|
|
241
|
+
onExitComplete={ () => setIsAnimating( false ) }
|
|
242
|
+
>
|
|
243
|
+
{ blocksWithExternalMedia.map( ( block ) => {
|
|
244
|
+
const { url, alt } = getMediaInfo( block );
|
|
245
|
+
return (
|
|
246
|
+
<Image
|
|
247
|
+
key={ block.clientId }
|
|
248
|
+
clientId={ block.clientId }
|
|
249
|
+
url={ url }
|
|
250
|
+
alt={ alt }
|
|
251
|
+
/>
|
|
252
|
+
);
|
|
150
253
|
} ) }
|
|
151
254
|
</AnimatePresence>
|
|
152
|
-
{ isUploading ? (
|
|
255
|
+
{ isUploading || isAnimating ? (
|
|
153
256
|
<Spinner />
|
|
154
257
|
) : (
|
|
155
|
-
<Button
|
|
258
|
+
<Button
|
|
259
|
+
__next40pxDefaultSize
|
|
260
|
+
variant="primary"
|
|
261
|
+
onClick={ uploadImages }
|
|
262
|
+
>
|
|
156
263
|
{ __( 'Upload' ) }
|
|
157
264
|
</Button>
|
|
158
265
|
) }
|
|
159
266
|
</div>
|
|
267
|
+
{ hadUploadError && <p>{ __( 'Upload failed, try again.' ) }</p> }
|
|
160
268
|
</PanelBody>
|
|
161
269
|
);
|
|
162
270
|
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { v4 as uuid } from 'uuid';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { getFilename } from '@wordpress/url';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Generate a list of unique basenames given a list of URLs.
|
|
13
|
+
*
|
|
14
|
+
* We want all basenames to be unique, since sometimes the extension
|
|
15
|
+
* doesn't reflect the mime type, and may end up getting changed by
|
|
16
|
+
* the server, on upload.
|
|
17
|
+
*
|
|
18
|
+
* @param {string[]} urls The list of URLs
|
|
19
|
+
* @return {Record< string, string >} A URL => basename record.
|
|
20
|
+
*/
|
|
21
|
+
export function generateUniqueBasenames( urls ) {
|
|
22
|
+
const basenames = new Set();
|
|
23
|
+
|
|
24
|
+
return Object.fromEntries(
|
|
25
|
+
urls.map( ( url ) => {
|
|
26
|
+
// We prefer to match the remote filename, if possible.
|
|
27
|
+
const filename = getFilename( url );
|
|
28
|
+
let basename = '';
|
|
29
|
+
|
|
30
|
+
if ( filename ) {
|
|
31
|
+
const parts = filename.split( '.' );
|
|
32
|
+
if ( parts.length > 1 ) {
|
|
33
|
+
// Assume the last part is the extension.
|
|
34
|
+
parts.pop();
|
|
35
|
+
}
|
|
36
|
+
basename = parts.join( '.' );
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if ( ! basename ) {
|
|
40
|
+
// It looks like we don't have a basename, so let's use a UUID.
|
|
41
|
+
basename = uuid();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if ( basenames.has( basename ) ) {
|
|
45
|
+
// Append a UUID to deduplicate the basename.
|
|
46
|
+
// The server will try to deduplicate on its own if we don't do this,
|
|
47
|
+
// but it may run into a race condition
|
|
48
|
+
// (see https://github.com/WordPress/gutenberg/issues/64899).
|
|
49
|
+
// Deduplicating the filenames before uploading is safer.
|
|
50
|
+
basename = `${ basename }-${ uuid() }`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
basenames.add( basename );
|
|
54
|
+
|
|
55
|
+
return [ url, basename ];
|
|
56
|
+
} )
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Fetch a list of URLs, turning those into promises for files with
|
|
62
|
+
* unique filenames.
|
|
63
|
+
*
|
|
64
|
+
* @param {string[]} urls The list of URLs
|
|
65
|
+
* @return {Record< string, Promise< File > >} A URL => File promise record.
|
|
66
|
+
*/
|
|
67
|
+
export function fetchMedia( urls ) {
|
|
68
|
+
return Object.fromEntries(
|
|
69
|
+
Object.entries( generateUniqueBasenames( urls ) ).map(
|
|
70
|
+
( [ url, basename ] ) => {
|
|
71
|
+
const filePromise = window
|
|
72
|
+
.fetch( url.includes( '?' ) ? url : url + '?' )
|
|
73
|
+
.then( ( response ) => response.blob() )
|
|
74
|
+
.then( ( blob ) => {
|
|
75
|
+
// The server will reject the upload if it doesn't have an extension,
|
|
76
|
+
// even though it'll rewrite the file name to match the mime type.
|
|
77
|
+
// Here we provide it with a safe extension to get it past that check.
|
|
78
|
+
return new File( [ blob ], `${ basename }.png`, {
|
|
79
|
+
type: blob.type,
|
|
80
|
+
} );
|
|
81
|
+
} );
|
|
82
|
+
|
|
83
|
+
return [ url, filePromise ];
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
);
|
|
87
|
+
}
|
|
@@ -37,8 +37,9 @@
|
|
|
37
37
|
|
|
38
38
|
.components-site-icon {
|
|
39
39
|
border: none;
|
|
40
|
-
border-radius: $radius-
|
|
40
|
+
border-radius: $radius-small;
|
|
41
41
|
margin-right: $grid-unit-15;
|
|
42
|
+
flex-shrink: 0;
|
|
42
43
|
|
|
43
44
|
// Same size as in the Site menu.
|
|
44
45
|
height: 36px;
|
|
@@ -54,6 +55,7 @@
|
|
|
54
55
|
display: block;
|
|
55
56
|
color: $gray-700;
|
|
56
57
|
font-size: $helptext-font-size;
|
|
58
|
+
word-break: break-word;
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
.editor-post-publish-panel__header-publish-button,
|
|
@@ -60,7 +60,7 @@ exports[`PostPublishPanel should render the post-publish panel if the post is pu
|
|
|
60
60
|
>
|
|
61
61
|
<button
|
|
62
62
|
aria-label="Close panel"
|
|
63
|
-
class="components-button has-icon"
|
|
63
|
+
class="components-button is-compact has-icon"
|
|
64
64
|
type="button"
|
|
65
65
|
>
|
|
66
66
|
<svg
|
|
@@ -252,7 +252,7 @@ exports[`PostPublishPanel should render the post-publish panel if the post is sc
|
|
|
252
252
|
>
|
|
253
253
|
<button
|
|
254
254
|
aria-label="Close panel"
|
|
255
|
-
class="components-button has-icon"
|
|
255
|
+
class="components-button is-compact has-icon"
|
|
256
256
|
type="button"
|
|
257
257
|
>
|
|
258
258
|
<svg
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { generateUniqueBasenames } from '../media-util';
|
|
5
|
+
|
|
6
|
+
describe( 'generateUniqueBasenames', () => {
|
|
7
|
+
it( 'should prefer the original basenames', () => {
|
|
8
|
+
const urls = [
|
|
9
|
+
'https://example.com/images/image1.jpg',
|
|
10
|
+
'https://example.com/images/image2.jpg',
|
|
11
|
+
'https://example.com/images/image3.jpg',
|
|
12
|
+
'https://example.com/images/image4.jpg',
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
expect( generateUniqueBasenames( urls ) ).toEqual( {
|
|
16
|
+
'https://example.com/images/image1.jpg': 'image1',
|
|
17
|
+
'https://example.com/images/image2.jpg': 'image2',
|
|
18
|
+
'https://example.com/images/image3.jpg': 'image3',
|
|
19
|
+
'https://example.com/images/image4.jpg': 'image4',
|
|
20
|
+
} );
|
|
21
|
+
} );
|
|
22
|
+
|
|
23
|
+
it( 'should handle filenames with no extensions', () => {
|
|
24
|
+
const urls = [
|
|
25
|
+
'https://example.com/images/image1',
|
|
26
|
+
'https://example.com/images/image2',
|
|
27
|
+
'https://example.com/images/image3',
|
|
28
|
+
'https://example.com/images/image4',
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
expect( generateUniqueBasenames( urls ) ).toEqual( {
|
|
32
|
+
'https://example.com/images/image1': 'image1',
|
|
33
|
+
'https://example.com/images/image2': 'image2',
|
|
34
|
+
'https://example.com/images/image3': 'image3',
|
|
35
|
+
'https://example.com/images/image4': 'image4',
|
|
36
|
+
} );
|
|
37
|
+
} );
|
|
38
|
+
|
|
39
|
+
it( 'should handle query parameters correctly', () => {
|
|
40
|
+
const urls = [
|
|
41
|
+
'https://example.com/images/image1.jpg?a=notafile.npg',
|
|
42
|
+
'https://example.com/images/image2.jpg?a=notafile.npg',
|
|
43
|
+
'https://example.com/images/image3.jpg?a=notafile.npg',
|
|
44
|
+
'https://example.com/images/image4.jpg?a=notafile.npg',
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
expect( generateUniqueBasenames( urls ) ).toEqual( {
|
|
48
|
+
'https://example.com/images/image1.jpg?a=notafile.npg': 'image1',
|
|
49
|
+
'https://example.com/images/image2.jpg?a=notafile.npg': 'image2',
|
|
50
|
+
'https://example.com/images/image3.jpg?a=notafile.npg': 'image3',
|
|
51
|
+
'https://example.com/images/image4.jpg?a=notafile.npg': 'image4',
|
|
52
|
+
} );
|
|
53
|
+
} );
|
|
54
|
+
|
|
55
|
+
it( 'should deduplicate identical filenames', () => {
|
|
56
|
+
const urls = [
|
|
57
|
+
'https://example.com/image1/image.jpg',
|
|
58
|
+
'https://example.com/image2/image.jpg',
|
|
59
|
+
'https://example.com/image3/image.jpg',
|
|
60
|
+
'https://example.com/image4/image.jpg',
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
const results = generateUniqueBasenames( urls );
|
|
64
|
+
const resultLength = Object.entries( results ).length;
|
|
65
|
+
expect( resultLength ).toBe( urls.length );
|
|
66
|
+
|
|
67
|
+
const basenames = new Set( Object.values( results ) );
|
|
68
|
+
expect( basenames.size ).toBe( resultLength );
|
|
69
|
+
} );
|
|
70
|
+
|
|
71
|
+
it( 'should deduplicate identical basenames', () => {
|
|
72
|
+
const urls = [
|
|
73
|
+
'https://example.com/images/image.jpg',
|
|
74
|
+
'https://example.com/images/image.png',
|
|
75
|
+
'https://example.com/images/image.webp',
|
|
76
|
+
'https://example.com/images/image.avif',
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
const results = generateUniqueBasenames( urls );
|
|
80
|
+
const resultLength = Object.entries( results ).length;
|
|
81
|
+
expect( resultLength ).toBe( urls.length );
|
|
82
|
+
|
|
83
|
+
const basenames = new Set( Object.values( results ) );
|
|
84
|
+
expect( basenames.size ).toBe( resultLength );
|
|
85
|
+
} );
|
|
86
|
+
|
|
87
|
+
it( 'should deduplicate filenames without extensions', () => {
|
|
88
|
+
const urls = [
|
|
89
|
+
'https://example.com/image1/image',
|
|
90
|
+
'https://example.com/image2/image',
|
|
91
|
+
'https://example.com/image3/image',
|
|
92
|
+
'https://example.com/image4/image',
|
|
93
|
+
];
|
|
94
|
+
|
|
95
|
+
const results = generateUniqueBasenames( urls );
|
|
96
|
+
const resultLength = Object.entries( results ).length;
|
|
97
|
+
expect( resultLength ).toBe( urls.length );
|
|
98
|
+
|
|
99
|
+
const basenames = new Set( Object.values( results ) );
|
|
100
|
+
expect( basenames.size ).toBe( resultLength );
|
|
101
|
+
} );
|
|
102
|
+
|
|
103
|
+
it( 'should deduplicate paths with no filename', () => {
|
|
104
|
+
const urls = [
|
|
105
|
+
'https://example.com/image1/dir/',
|
|
106
|
+
'https://example.com/image2/dir/',
|
|
107
|
+
'https://example.com/image3/dir/',
|
|
108
|
+
'https://example.com/image4/dir/',
|
|
109
|
+
];
|
|
110
|
+
|
|
111
|
+
const results = generateUniqueBasenames( urls );
|
|
112
|
+
const resultLength = Object.entries( results ).length;
|
|
113
|
+
expect( resultLength ).toBe( urls.length );
|
|
114
|
+
|
|
115
|
+
const basenames = new Set( Object.values( results ) );
|
|
116
|
+
expect( basenames.size ).toBe( resultLength );
|
|
117
|
+
} );
|
|
118
|
+
} );
|
|
@@ -171,7 +171,7 @@ export default function PostStatus() {
|
|
|
171
171
|
contentClassName="editor-change-status__content"
|
|
172
172
|
popoverProps={ popoverProps }
|
|
173
173
|
focusOnMount
|
|
174
|
-
renderToggle={ ( { onToggle } ) => (
|
|
174
|
+
renderToggle={ ( { onToggle, isOpen } ) => (
|
|
175
175
|
<Button
|
|
176
176
|
variant="tertiary"
|
|
177
177
|
size="compact"
|
|
@@ -179,9 +179,10 @@ export default function PostStatus() {
|
|
|
179
179
|
icon={ postStatusesInfo[ status ]?.icon }
|
|
180
180
|
aria-label={ sprintf(
|
|
181
181
|
// translators: %s: Current post status.
|
|
182
|
-
__( 'Change
|
|
182
|
+
__( 'Change status: %s' ),
|
|
183
183
|
postStatusesInfo[ status ]?.label
|
|
184
184
|
) }
|
|
185
|
+
aria-expanded={ isOpen }
|
|
185
186
|
>
|
|
186
187
|
{ postStatusesInfo[ status ]?.label }
|
|
187
188
|
</Button>
|
|
@@ -428,6 +428,8 @@ export function HierarchicalTermSelector( { slug } ) {
|
|
|
428
428
|
{ ! loading && hasCreateAction && (
|
|
429
429
|
<FlexItem>
|
|
430
430
|
<Button
|
|
431
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
432
|
+
__next40pxDefaultSize={ false }
|
|
431
433
|
onClick={ onToggleForm }
|
|
432
434
|
className="editor-post-taxonomies__hierarchical-terms-add"
|
|
433
435
|
aria-expanded={ showForm }
|
|
@@ -62,6 +62,8 @@ export default function MostUsedTerms( { onSelect, taxonomy } ) {
|
|
|
62
62
|
{ terms.map( ( term ) => (
|
|
63
63
|
<li key={ term.id }>
|
|
64
64
|
<Button
|
|
65
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
66
|
+
__next40pxDefaultSize={ false }
|
|
65
67
|
variant="link"
|
|
66
68
|
onClick={ () => onSelect( term ) }
|
|
67
69
|
>
|
|
@@ -8,6 +8,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
8
8
|
import { useEntityRecord, store as coreStore } from '@wordpress/core-data';
|
|
9
9
|
import { check } from '@wordpress/icons';
|
|
10
10
|
import { store as noticesStore } from '@wordpress/notices';
|
|
11
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Internal dependencies
|
|
@@ -43,6 +44,8 @@ export default function BlockThemeControl( { id } ) {
|
|
|
43
44
|
};
|
|
44
45
|
}, [] );
|
|
45
46
|
|
|
47
|
+
const { get: getPreference } = useSelect( preferencesStore );
|
|
48
|
+
|
|
46
49
|
const { editedRecord: template, hasResolved } = useEntityRecord(
|
|
47
50
|
'postType',
|
|
48
51
|
'wp_template',
|
|
@@ -75,6 +78,17 @@ export default function BlockThemeControl( { id } ) {
|
|
|
75
78
|
},
|
|
76
79
|
]
|
|
77
80
|
: undefined;
|
|
81
|
+
|
|
82
|
+
const mayShowTemplateEditNotice = () => {
|
|
83
|
+
if ( ! getPreference( 'core/edit-site', 'welcomeGuideTemplate' ) ) {
|
|
84
|
+
createSuccessNotice(
|
|
85
|
+
__(
|
|
86
|
+
'Editing template. Changes made here affect all posts and pages that use the template.'
|
|
87
|
+
),
|
|
88
|
+
{ type: 'snackbar', actions: notificationAction }
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
78
92
|
return (
|
|
79
93
|
<DropdownMenu
|
|
80
94
|
popoverProps={ POPOVER_PROPS }
|
|
@@ -99,15 +113,7 @@ export default function BlockThemeControl( { id } ) {
|
|
|
99
113
|
postType: 'wp_template',
|
|
100
114
|
} );
|
|
101
115
|
onClose();
|
|
102
|
-
|
|
103
|
-
__(
|
|
104
|
-
'Editing template. Changes made here affect all posts and pages that use the template.'
|
|
105
|
-
),
|
|
106
|
-
{
|
|
107
|
-
type: 'snackbar',
|
|
108
|
-
actions: notificationAction,
|
|
109
|
-
}
|
|
110
|
-
);
|
|
116
|
+
mayShowTemplateEditNotice();
|
|
111
117
|
} }
|
|
112
118
|
>
|
|
113
119
|
{ __( 'Edit template' ) }
|
|
@@ -177,6 +177,8 @@ function PostTemplateDropdownContent( { onClose } ) {
|
|
|
177
177
|
{ canEdit && onNavigateToEntityRecord && (
|
|
178
178
|
<p>
|
|
179
179
|
<Button
|
|
180
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
181
|
+
__next40pxDefaultSize={ false }
|
|
180
182
|
variant="link"
|
|
181
183
|
onClick={ () => {
|
|
182
184
|
onNavigateToEntityRecord( {
|