@wordpress/editor 14.45.2-next.v.202605131032.0 → 14.47.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 +12 -1
- package/build/components/collab-sidebar/add-note.cjs +6 -0
- package/build/components/collab-sidebar/add-note.cjs.map +2 -2
- package/build/components/collab-sidebar/hooks.cjs +36 -24
- package/build/components/collab-sidebar/hooks.cjs.map +2 -2
- package/build/components/collab-sidebar/index.cjs +19 -10
- package/build/components/collab-sidebar/index.cjs.map +2 -2
- package/build/components/collab-sidebar/note-byline.cjs +16 -9
- package/build/components/collab-sidebar/note-byline.cjs.map +2 -2
- package/build/components/collab-sidebar/notes.cjs +20 -11
- package/build/components/collab-sidebar/notes.cjs.map +2 -2
- package/build/components/collab-sidebar/utils.cjs +42 -2
- package/build/components/collab-sidebar/utils.cjs.map +2 -2
- package/build/components/collaborators-overlay/compute-selection.cjs +39 -15
- package/build/components/collaborators-overlay/compute-selection.cjs.map +3 -3
- package/build/components/collaborators-overlay/use-block-highlighting.cjs +10 -2
- package/build/components/collaborators-overlay/use-block-highlighting.cjs.map +3 -3
- package/build/components/collaborators-overlay/use-render-cursors.cjs +15 -7
- package/build/components/collaborators-overlay/use-render-cursors.cjs.map +3 -3
- package/build/components/collaborators-presence/avatar/component.cjs +5 -1
- package/build/components/collaborators-presence/avatar/component.cjs.map +3 -3
- package/build/components/collaborators-presence/use-collaborator-notifications.cjs +6 -3
- package/build/components/collaborators-presence/use-collaborator-notifications.cjs.map +2 -2
- package/build/components/editor-interface/index.cjs +17 -16
- package/build/components/editor-interface/index.cjs.map +3 -3
- package/build/components/editor-notices/index.cjs +6 -1
- package/build/components/editor-notices/index.cjs.map +3 -3
- package/build/components/global-styles/hooks.cjs +12 -1
- package/build/components/global-styles/hooks.cjs.map +2 -2
- package/build/components/header/index.cjs +11 -6
- package/build/components/header/index.cjs.map +2 -2
- package/build/components/media/media-editor-modal.cjs +14 -1
- package/build/components/media/media-editor-modal.cjs.map +2 -2
- package/build/components/post-card-panel/index.cjs +7 -1
- package/build/components/post-card-panel/index.cjs.map +3 -3
- package/build/components/post-last-revision/index.cjs +28 -8
- package/build/components/post-last-revision/index.cjs.map +2 -2
- package/build/components/post-locked-modal/index.cjs +9 -6
- package/build/components/post-locked-modal/index.cjs.map +2 -2
- package/build/components/post-publish-button/label.cjs +0 -7
- package/build/components/post-publish-button/label.cjs.map +2 -2
- package/build/components/post-publish-panel/prepublish.cjs +8 -1
- package/build/components/post-publish-panel/prepublish.cjs.map +3 -3
- package/build/components/post-revisions-panel/index.cjs +7 -0
- package/build/components/post-revisions-panel/index.cjs.map +2 -2
- package/build/components/post-revisions-preview/diff-markers.cjs +21 -13
- package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
- package/build/components/post-revisions-preview/revisions-canvas.cjs +7 -1
- package/build/components/post-revisions-preview/revisions-canvas.cjs.map +2 -2
- package/build/components/post-taxonomies/check.cjs +1 -2
- package/build/components/post-taxonomies/check.cjs.map +2 -2
- package/build/components/post-taxonomies/index.cjs +1 -2
- package/build/components/post-taxonomies/index.cjs.map +2 -2
- package/build/components/preferences-modal/index.cjs +1 -1
- package/build/components/preferences-modal/index.cjs.map +2 -2
- package/build/components/preview-dropdown/index.cjs.map +3 -3
- package/build/components/provider/index.cjs +5 -21
- package/build/components/provider/index.cjs.map +3 -3
- package/build/components/provider/use-block-editor-settings.cjs +16 -9
- package/build/components/provider/use-block-editor-settings.cjs.map +3 -3
- package/build/components/resizable-editor/resize-handle.cjs +24 -16
- package/build/components/resizable-editor/resize-handle.cjs.map +2 -2
- package/build/components/sidebar/header.cjs +16 -21
- package/build/components/sidebar/header.cjs.map +3 -3
- package/build/components/sidebar/index.cjs +2 -6
- package/build/components/sidebar/index.cjs.map +2 -2
- package/build/components/start-page-options/index.cjs +14 -4
- package/build/components/start-page-options/index.cjs.map +2 -2
- package/build/components/start-template-options/index.cjs +8 -6
- package/build/components/start-template-options/index.cjs.map +2 -2
- package/build/components/styles-canvas/style-book.cjs +59 -2
- package/build/components/styles-canvas/style-book.cjs.map +2 -2
- package/build/components/sync-connection-error-modal/index.cjs +10 -7
- package/build/components/sync-connection-error-modal/index.cjs.map +3 -3
- package/build/components/template-actions-panel/block-theme-content.cjs +21 -12
- package/build/components/template-actions-panel/block-theme-content.cjs.map +2 -2
- package/build/dataviews/store/private-actions.cjs.map +2 -2
- package/build/store/private-actions.cjs +17 -1
- package/build/store/private-actions.cjs.map +3 -3
- package/build/store/private-selectors.cjs +18 -0
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/selectors.cjs +0 -17
- package/build/store/selectors.cjs.map +2 -2
- package/build/{components/media → utils/media-delete}/index.cjs +12 -13
- package/build/utils/media-delete/index.cjs.map +7 -0
- package/build/utils/media-finalize/index.cjs +3 -1
- package/build/utils/media-finalize/index.cjs.map +2 -2
- package/build/utils/sync-error-messages.cjs +9 -0
- package/build/utils/sync-error-messages.cjs.map +2 -2
- package/build-module/components/collab-sidebar/add-note.mjs +6 -0
- package/build-module/components/collab-sidebar/add-note.mjs.map +2 -2
- package/build-module/components/collab-sidebar/hooks.mjs +42 -25
- package/build-module/components/collab-sidebar/hooks.mjs.map +2 -2
- package/build-module/components/collab-sidebar/index.mjs +19 -10
- package/build-module/components/collab-sidebar/index.mjs.map +2 -2
- package/build-module/components/collab-sidebar/note-byline.mjs +17 -10
- package/build-module/components/collab-sidebar/note-byline.mjs.map +2 -2
- package/build-module/components/collab-sidebar/notes.mjs +26 -13
- package/build-module/components/collab-sidebar/notes.mjs.map +2 -2
- package/build-module/components/collab-sidebar/utils.mjs +38 -2
- package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/compute-selection.mjs +36 -12
- package/build-module/components/collaborators-overlay/compute-selection.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/use-block-highlighting.mjs +10 -3
- package/build-module/components/collaborators-overlay/use-block-highlighting.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs +11 -6
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs.map +2 -2
- package/build-module/components/collaborators-presence/avatar/component.mjs +7 -3
- package/build-module/components/collaborators-presence/avatar/component.mjs.map +2 -2
- package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs +6 -3
- package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs.map +2 -2
- package/build-module/components/editor-interface/index.mjs +22 -17
- package/build-module/components/editor-interface/index.mjs.map +2 -2
- package/build-module/components/editor-notices/index.mjs +6 -1
- package/build-module/components/editor-notices/index.mjs.map +2 -2
- package/build-module/components/global-styles/hooks.mjs +12 -1
- package/build-module/components/global-styles/hooks.mjs.map +2 -2
- package/build-module/components/header/index.mjs +11 -6
- package/build-module/components/header/index.mjs.map +2 -2
- package/build-module/components/media/media-editor-modal.mjs +14 -1
- package/build-module/components/media/media-editor-modal.mjs.map +2 -2
- package/build-module/components/post-card-panel/index.mjs +8 -2
- package/build-module/components/post-card-panel/index.mjs.map +2 -2
- package/build-module/components/post-last-revision/index.mjs +29 -9
- package/build-module/components/post-last-revision/index.mjs.map +2 -2
- package/build-module/components/post-locked-modal/index.mjs +9 -6
- package/build-module/components/post-locked-modal/index.mjs.map +2 -2
- package/build-module/components/post-publish-button/label.mjs +0 -7
- package/build-module/components/post-publish-button/label.mjs.map +2 -2
- package/build-module/components/post-publish-panel/prepublish.mjs +9 -2
- package/build-module/components/post-publish-panel/prepublish.mjs.map +2 -2
- package/build-module/components/post-revisions-panel/index.mjs +7 -0
- package/build-module/components/post-revisions-panel/index.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/diff-markers.mjs +22 -14
- package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-canvas.mjs +7 -1
- package/build-module/components/post-revisions-preview/revisions-canvas.mjs.map +2 -2
- package/build-module/components/post-taxonomies/check.mjs +1 -2
- package/build-module/components/post-taxonomies/check.mjs.map +2 -2
- package/build-module/components/post-taxonomies/index.mjs +1 -2
- package/build-module/components/post-taxonomies/index.mjs.map +2 -2
- package/build-module/components/preferences-modal/index.mjs +1 -1
- package/build-module/components/preferences-modal/index.mjs.map +2 -2
- package/build-module/components/preview-dropdown/index.mjs +2 -2
- package/build-module/components/preview-dropdown/index.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +6 -22
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/use-block-editor-settings.mjs +16 -9
- package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
- package/build-module/components/resizable-editor/resize-handle.mjs +26 -18
- package/build-module/components/resizable-editor/resize-handle.mjs.map +2 -2
- package/build-module/components/sidebar/header.mjs +11 -16
- package/build-module/components/sidebar/header.mjs.map +2 -2
- package/build-module/components/sidebar/index.mjs +2 -7
- package/build-module/components/sidebar/index.mjs.map +2 -2
- package/build-module/components/start-page-options/index.mjs +14 -4
- package/build-module/components/start-page-options/index.mjs.map +2 -2
- package/build-module/components/start-template-options/index.mjs +8 -6
- package/build-module/components/start-template-options/index.mjs.map +2 -2
- package/build-module/components/styles-canvas/style-book.mjs +60 -3
- package/build-module/components/styles-canvas/style-book.mjs.map +2 -2
- package/build-module/components/sync-connection-error-modal/index.mjs +14 -8
- package/build-module/components/sync-connection-error-modal/index.mjs.map +2 -2
- package/build-module/components/template-actions-panel/block-theme-content.mjs +21 -13
- package/build-module/components/template-actions-panel/block-theme-content.mjs.map +2 -2
- package/build-module/dataviews/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +16 -1
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +18 -0
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/selectors.mjs +0 -16
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/media-delete/index.mjs +12 -0
- package/build-module/utils/media-delete/index.mjs.map +7 -0
- package/build-module/utils/media-finalize/index.mjs +3 -1
- package/build-module/utils/media-finalize/index.mjs.map +2 -2
- package/build-module/utils/sync-error-messages.mjs +8 -0
- package/build-module/utils/sync-error-messages.mjs.map +2 -2
- package/build-style/style-rtl.css +462 -408
- package/build-style/style.css +462 -408
- package/build-types/components/collab-sidebar/add-note.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/hooks.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/note-byline.d.ts +3 -0
- package/build-types/components/collab-sidebar/note-byline.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/notes.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/utils.d.ts +33 -0
- package/build-types/components/collab-sidebar/utils.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/compute-selection.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/use-block-highlighting.d.ts +3 -0
- package/build-types/components/collaborators-overlay/use-block-highlighting.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/use-render-cursors.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/avatar/component.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/use-collaborator-notifications.d.ts.map +1 -1
- package/build-types/components/editor-interface/index.d.ts.map +1 -1
- package/build-types/components/editor-notices/index.d.ts.map +1 -1
- package/build-types/components/global-styles/hooks.d.ts.map +1 -1
- package/build-types/components/media/media-editor-modal.d.ts +6 -2
- package/build-types/components/media/media-editor-modal.d.ts.map +1 -1
- package/build-types/components/post-card-panel/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 +1 -6
- package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
- package/build-types/components/post-publish-button/label.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/prepublish.d.ts.map +1 -1
- package/build-types/components/post-revisions-panel/index.d.ts +1 -1
- package/build-types/components/post-revisions-panel/index.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/diff-markers.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/revisions-canvas.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/check.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts +1 -6
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts +1 -6
- package/build-types/components/post-taxonomies/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/resizable-editor/resize-handle.d.ts.map +1 -1
- package/build-types/components/sidebar/index.d.ts.map +1 -1
- 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/styles-canvas/style-book.d.ts.map +1 -1
- package/build-types/components/sync-connection-error-modal/index.d.ts.map +1 -1
- package/build-types/components/template-actions-panel/block-theme-content.d.ts.map +1 -1
- package/build-types/dataviews/store/private-actions.d.ts +0 -1
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts +15 -0
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +10 -0
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +0 -10
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/utils/get-template-part-icon.d.ts.map +1 -1
- package/build-types/utils/media-delete/index.d.ts +2 -0
- package/build-types/utils/media-delete/index.d.ts.map +1 -0
- package/build-types/utils/media-finalize/index.d.ts +1 -1
- package/build-types/utils/media-finalize/index.d.ts.map +1 -1
- package/build-types/utils/sync-error-messages.d.ts +1 -0
- package/build-types/utils/sync-error-messages.d.ts.map +1 -1
- package/package.json +48 -48
- package/src/components/collab-sidebar/add-note.js +9 -0
- package/src/components/collab-sidebar/hooks.js +53 -29
- package/src/components/collab-sidebar/index.js +28 -14
- package/src/components/collab-sidebar/note-byline.js +15 -10
- package/src/components/collab-sidebar/notes.js +36 -14
- package/src/components/collab-sidebar/test/utils.js +375 -1
- package/src/components/collab-sidebar/utils.js +70 -1
- package/src/components/collaborators-overlay/compute-selection.ts +67 -19
- package/src/components/collaborators-overlay/use-block-highlighting.ts +14 -1
- package/src/components/collaborators-overlay/use-render-cursors.ts +15 -4
- package/src/components/collaborators-presence/avatar/component.tsx +10 -3
- package/src/components/collaborators-presence/avatar/test/index.tsx +50 -18
- package/src/components/collaborators-presence/styles/collaborators-presence.scss +4 -1
- package/src/components/collaborators-presence/test/use-collaborator-notifications.ts +2 -1
- package/src/components/collaborators-presence/use-collaborator-notifications.ts +6 -4
- package/src/components/editor-help/help-topic-row.native.js +2 -2
- package/src/components/editor-interface/index.js +22 -23
- package/src/components/editor-interface/style.scss +4 -0
- package/src/components/editor-notices/index.js +7 -1
- package/src/components/error-boundary/index.native.js +2 -2
- package/src/components/global-styles/hooks.js +26 -0
- package/src/components/global-styles-sidebar/style.scss +0 -9
- package/src/components/header/index.js +12 -12
- package/src/components/media/media-editor-modal.js +20 -2
- package/src/components/offline-status/index.native.js +2 -2
- package/src/components/post-card-panel/index.js +5 -2
- package/src/components/post-last-revision/index.js +37 -9
- package/src/components/post-last-revision/style.scss +0 -3
- package/src/components/post-locked-modal/index.js +8 -5
- package/src/components/post-panel-row/style.scss +1 -0
- package/src/components/post-publish-button/label.js +0 -11
- package/src/components/post-publish-panel/prepublish.js +6 -2
- package/src/components/post-revisions-panel/index.js +8 -0
- package/src/components/post-revisions-preview/diff-markers.js +17 -11
- package/src/components/post-revisions-preview/revisions-canvas.js +7 -1
- package/src/components/post-revisions-preview/style.scss +4 -4
- package/src/components/post-taxonomies/check.js +1 -2
- package/src/components/post-taxonomies/index.js +1 -2
- package/src/components/preferences-modal/index.js +1 -1
- package/src/components/preview-dropdown/index.js +2 -2
- package/src/components/provider/index.js +10 -31
- package/src/components/provider/use-block-editor-settings.js +19 -12
- package/src/components/resizable-editor/resize-handle.js +22 -16
- package/src/components/sidebar/header.js +18 -28
- package/src/components/sidebar/index.js +5 -14
- package/src/components/start-page-options/index.js +19 -4
- package/src/components/start-template-options/index.js +13 -6
- package/src/components/styles-canvas/style-book.js +75 -13
- package/src/components/sync-connection-error-modal/index.tsx +25 -11
- package/src/components/template-actions-panel/block-theme-content.js +19 -13
- package/src/components/text-editor/style.scss +2 -2
- package/src/dataviews/store/private-actions.ts +0 -1
- package/src/store/private-actions.js +27 -0
- package/src/store/private-selectors.js +26 -0
- package/src/store/selectors.js +0 -24
- package/src/store/test/actions.js +34 -0
- package/src/utils/media-delete/index.js +11 -0
- package/src/utils/media-finalize/index.js +6 -1
- package/src/utils/media-finalize/test/index.js +32 -2
- package/src/utils/sync-error-messages.ts +8 -0
- package/src/utils/test/sync-error-messages.js +1 -0
- package/build/components/global-styles-provider/index.cjs +0 -181
- package/build/components/global-styles-provider/index.cjs.map +0 -7
- package/build/components/media/index.cjs.map +0 -7
- package/build/components/media/metadata-panel.cjs +0 -96
- package/build/components/media/metadata-panel.cjs.map +0 -7
- package/build/components/media/preview.cjs +0 -39
- package/build/components/media/preview.cjs.map +0 -7
- package/build-module/components/global-styles-provider/index.mjs +0 -156
- package/build-module/components/global-styles-provider/index.mjs.map +0 -7
- package/build-module/components/media/index.mjs +0 -8
- package/build-module/components/media/index.mjs.map +0 -7
- package/build-module/components/media/metadata-panel.mjs +0 -65
- package/build-module/components/media/metadata-panel.mjs.map +0 -7
- package/build-module/components/media/preview.mjs +0 -21
- package/build-module/components/media/preview.mjs.map +0 -7
- package/build-types/components/global-styles-provider/index.d.ts +0 -16
- package/build-types/components/global-styles-provider/index.d.ts.map +0 -1
- package/build-types/components/media/index.d.ts +0 -3
- package/build-types/components/media/index.d.ts.map +0 -1
- package/build-types/components/media/metadata-panel.d.ts +0 -12
- package/build-types/components/media/metadata-panel.d.ts.map +0 -1
- package/build-types/components/media/preview.d.ts +0 -9
- package/build-types/components/media/preview.d.ts.map +0 -1
- package/src/components/global-styles-provider/index.js +0 -207
- package/src/components/media/index.js +0 -2
- package/src/components/media/metadata-panel.js +0 -77
- package/src/components/media/preview.js +0 -35
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// packages/editor/src/components/post-last-revision/index.js
|
|
2
|
-
import { sprintf, __ } from "@wordpress/i18n";
|
|
2
|
+
import { sprintf, __, _n } from "@wordpress/i18n";
|
|
3
3
|
import { Button } from "@wordpress/components";
|
|
4
4
|
import { useSelect, useDispatch } from "@wordpress/data";
|
|
5
5
|
import { backup } from "@wordpress/icons";
|
|
6
|
+
import { addQueryArgs } from "@wordpress/url";
|
|
6
7
|
import PostLastRevisionCheck from "./check.mjs";
|
|
7
8
|
import PostPanelRow from "../post-panel-row/index.mjs";
|
|
8
9
|
import { store as editorStore } from "../../store/index.mjs";
|
|
@@ -10,21 +11,31 @@ import { unlock } from "../../lock-unlock.mjs";
|
|
|
10
11
|
import { jsx } from "react/jsx-runtime";
|
|
11
12
|
function usePostLastRevisionInfo() {
|
|
12
13
|
return useSelect((select) => {
|
|
13
|
-
const {
|
|
14
|
+
const {
|
|
15
|
+
getCurrentPostLastRevisionId,
|
|
16
|
+
getCurrentPostRevisionsCount,
|
|
17
|
+
getEditorSettings
|
|
18
|
+
} = select(editorStore);
|
|
14
19
|
return {
|
|
15
20
|
lastRevisionId: getCurrentPostLastRevisionId(),
|
|
16
|
-
revisionsCount: getCurrentPostRevisionsCount()
|
|
21
|
+
revisionsCount: getCurrentPostRevisionsCount(),
|
|
22
|
+
disableVisualRevisions: !!getEditorSettings().disableVisualRevisions
|
|
17
23
|
};
|
|
18
24
|
}, []);
|
|
19
25
|
}
|
|
20
26
|
function PostLastRevision() {
|
|
21
|
-
const { lastRevisionId, revisionsCount } = usePostLastRevisionInfo();
|
|
27
|
+
const { lastRevisionId, revisionsCount, disableVisualRevisions } = usePostLastRevisionInfo();
|
|
22
28
|
const { setCurrentRevisionId } = unlock(useDispatch(editorStore));
|
|
29
|
+
const buttonProps = disableVisualRevisions ? {
|
|
30
|
+
href: addQueryArgs("revision.php", {
|
|
31
|
+
revision: lastRevisionId
|
|
32
|
+
})
|
|
33
|
+
} : { onClick: () => setCurrentRevisionId(lastRevisionId) };
|
|
23
34
|
return /* @__PURE__ */ jsx(PostLastRevisionCheck, { children: /* @__PURE__ */ jsx(
|
|
24
35
|
Button,
|
|
25
36
|
{
|
|
26
37
|
__next40pxDefaultSize: true,
|
|
27
|
-
|
|
38
|
+
...buttonProps,
|
|
28
39
|
className: "editor-post-last-revision__title",
|
|
29
40
|
icon: backup,
|
|
30
41
|
iconPosition: "right",
|
|
@@ -37,17 +48,26 @@ function PostLastRevision() {
|
|
|
37
48
|
) });
|
|
38
49
|
}
|
|
39
50
|
function PrivatePostLastRevision() {
|
|
40
|
-
const { lastRevisionId, revisionsCount } = usePostLastRevisionInfo();
|
|
51
|
+
const { lastRevisionId, revisionsCount, disableVisualRevisions } = usePostLastRevisionInfo();
|
|
41
52
|
const { setCurrentRevisionId } = unlock(useDispatch(editorStore));
|
|
53
|
+
const buttonProps = disableVisualRevisions ? {
|
|
54
|
+
href: addQueryArgs("revision.php", {
|
|
55
|
+
revision: lastRevisionId
|
|
56
|
+
})
|
|
57
|
+
} : { onClick: () => setCurrentRevisionId(lastRevisionId) };
|
|
42
58
|
return /* @__PURE__ */ jsx(PostLastRevisionCheck, { children: /* @__PURE__ */ jsx(PostPanelRow, { label: __("Revisions"), children: /* @__PURE__ */ jsx(
|
|
43
59
|
Button,
|
|
44
60
|
{
|
|
45
|
-
|
|
61
|
+
...buttonProps,
|
|
46
62
|
className: "editor-private-post-last-revision__button",
|
|
47
63
|
text: revisionsCount,
|
|
48
64
|
"aria-label": sprintf(
|
|
49
|
-
/* translators: %
|
|
50
|
-
|
|
65
|
+
/* translators: %d: number of revisions. */
|
|
66
|
+
_n(
|
|
67
|
+
"Open revisions screen: %d revision",
|
|
68
|
+
"Open revisions screen: %d revisions",
|
|
69
|
+
revisionsCount
|
|
70
|
+
),
|
|
51
71
|
revisionsCount
|
|
52
72
|
),
|
|
53
73
|
variant: "tertiary",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/post-last-revision/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { backup } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport PostLastRevisionCheck from './check';\nimport PostPanelRow from '../post-panel-row';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction usePostLastRevisionInfo() {\n\treturn useSelect( ( select ) => {\n\t\tconst {
|
|
5
|
-
"mappings": ";AAGA,SAAS,SAAS,UAAU;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { sprintf, __, _n } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { backup } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport PostLastRevisionCheck from './check';\nimport PostPanelRow from '../post-panel-row';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction usePostLastRevisionInfo() {\n\treturn useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentPostLastRevisionId,\n\t\t\tgetCurrentPostRevisionsCount,\n\t\t\tgetEditorSettings,\n\t\t} = select( editorStore );\n\t\treturn {\n\t\t\tlastRevisionId: getCurrentPostLastRevisionId(),\n\t\t\trevisionsCount: getCurrentPostRevisionsCount(),\n\t\t\tdisableVisualRevisions:\n\t\t\t\t!! getEditorSettings().disableVisualRevisions,\n\t\t};\n\t}, [] );\n}\n\n/**\n * Renders the component for displaying the last revision of a post.\n *\n * @return {React.ReactNode} The rendered component.\n */\nfunction PostLastRevision() {\n\tconst { lastRevisionId, revisionsCount, disableVisualRevisions } =\n\t\tusePostLastRevisionInfo();\n\tconst { setCurrentRevisionId } = unlock( useDispatch( editorStore ) );\n\n\tconst buttonProps = disableVisualRevisions\n\t\t? {\n\t\t\t\thref: addQueryArgs( 'revision.php', {\n\t\t\t\t\trevision: lastRevisionId,\n\t\t\t\t} ),\n\t\t }\n\t\t: { onClick: () => setCurrentRevisionId( lastRevisionId ) };\n\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\t{ ...buttonProps }\n\t\t\t\tclassName=\"editor-post-last-revision__title\"\n\t\t\t\ticon={ backup }\n\t\t\t\ticonPosition=\"right\"\n\t\t\t\ttext={ sprintf(\n\t\t\t\t\t/* translators: %s: number of revisions. */\n\t\t\t\t\t__( 'Revisions (%s)' ),\n\t\t\t\t\trevisionsCount\n\t\t\t\t) }\n\t\t\t/>\n\t\t</PostLastRevisionCheck>\n\t);\n}\n\nexport function PrivatePostLastRevision() {\n\tconst { lastRevisionId, revisionsCount, disableVisualRevisions } =\n\t\tusePostLastRevisionInfo();\n\tconst { setCurrentRevisionId } = unlock( useDispatch( editorStore ) );\n\n\tconst buttonProps = disableVisualRevisions\n\t\t? {\n\t\t\t\thref: addQueryArgs( 'revision.php', {\n\t\t\t\t\trevision: lastRevisionId,\n\t\t\t\t} ),\n\t\t }\n\t\t: { onClick: () => setCurrentRevisionId( lastRevisionId ) };\n\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<PostPanelRow label={ __( 'Revisions' ) }>\n\t\t\t\t<Button\n\t\t\t\t\t{ ...buttonProps }\n\t\t\t\t\tclassName=\"editor-private-post-last-revision__button\"\n\t\t\t\t\ttext={ revisionsCount }\n\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t/* translators: %d: number of revisions. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'Open revisions screen: %d revision',\n\t\t\t\t\t\t\t'Open revisions screen: %d revisions',\n\t\t\t\t\t\t\trevisionsCount\n\t\t\t\t\t\t),\n\t\t\t\t\t\trevisionsCount\n\t\t\t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gBAAgB,uBAAuB,IAC9D,wBAAwB;AACzB,QAAM,EAAE,qBAAqB,IAAI,OAAQ,YAAa,WAAY,CAAE;AAEpE,QAAM,cAAc,yBACjB;AAAA,IACA,MAAM,aAAc,gBAAgB;AAAA,MACnC,UAAU;AAAA,IACX,CAAE;AAAA,EACF,IACA,EAAE,SAAS,MAAM,qBAAsB,cAAe,EAAE;AAE3D,SACC,oBAAC,yBACA,8BAAC,gBAAa,OAAQ,GAAI,WAAY,GACrC;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACL,WAAU;AAAA,MACV,MAAO;AAAA,MACP,cAAa;AAAA;AAAA,QAEZ;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,QACD;AAAA,QACA;AAAA,MACD;AAAA,MACA,SAAQ;AAAA,MACR,MAAK;AAAA;AAAA,EACN,GACD,GACD;AAEF;AAEA,IAAO,6BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -20,10 +20,13 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
20
20
|
function CollaborationContext() {
|
|
21
21
|
const { isCollaborationSupported, syncConnectionStatus } = useSelect(
|
|
22
22
|
(select) => {
|
|
23
|
-
const
|
|
23
|
+
const {
|
|
24
|
+
isCollaborationSupported: isSupported,
|
|
25
|
+
getSyncConnectionStatus
|
|
26
|
+
} = unlock(select(coreStore));
|
|
24
27
|
return {
|
|
25
|
-
isCollaborationSupported:
|
|
26
|
-
syncConnectionStatus:
|
|
28
|
+
isCollaborationSupported: isSupported(),
|
|
29
|
+
syncConnectionStatus: getSyncConnectionStatus()
|
|
27
30
|
};
|
|
28
31
|
},
|
|
29
32
|
[]
|
|
@@ -56,7 +59,6 @@ function PostLockedModal() {
|
|
|
56
59
|
previewLink
|
|
57
60
|
} = useSelect((select) => {
|
|
58
61
|
const {
|
|
59
|
-
isCollaborationEnabledForCurrentPost,
|
|
60
62
|
isPostLocked,
|
|
61
63
|
isPostLockTakeover,
|
|
62
64
|
getPostLockUser,
|
|
@@ -64,8 +66,9 @@ function PostLockedModal() {
|
|
|
64
66
|
getActivePostLock,
|
|
65
67
|
getEditedPostAttribute,
|
|
66
68
|
getEditedPostPreviewLink,
|
|
67
|
-
getEditorSettings
|
|
68
|
-
|
|
69
|
+
getEditorSettings,
|
|
70
|
+
isCollaborationEnabledForCurrentPost
|
|
71
|
+
} = unlock(select(editorStore));
|
|
69
72
|
const { getPostType } = select(coreStore);
|
|
70
73
|
return {
|
|
71
74
|
isCollaborationEnabled: isCollaborationEnabledForCurrentPost(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/post-locked-modal/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tModal,\n\tButton,\n\tExternalLink,\n\t__experimentalHStack as HStack,\n\twithFilters,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useEffect, createInterpolateElement } from '@wordpress/element';\nimport { addAction, removeAction } from '@wordpress/hooks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { unlock } from '../../lock-unlock';\nimport { DOCUMENT_SIZE_LIMIT_EXCEEDED } from '../../utils/sync-error-messages';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction CollaborationContext() {\n\tconst { isCollaborationSupported, syncConnectionStatus } = useSelect(\n\t\t( select ) => {\n\t\t\tconst selectors = unlock( select( coreStore ) );\n\t\t\treturn {\n\t\t\t\tisCollaborationSupported: selectors.isCollaborationSupported(),\n\t\t\t\tsyncConnectionStatus: selectors.getSyncConnectionStatus(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tif ( isCollaborationSupported ) {\n\t\treturn null;\n\t}\n\n\tif ( DOCUMENT_SIZE_LIMIT_EXCEEDED === syncConnectionStatus?.error?.code ) {\n\t\treturn (\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Because this post is too large for real-time collaboration, only one person can edit at a time.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t);\n\t}\n\n\treturn (\n\t\t<p>\n\t\t\t{ __(\n\t\t\t\t'Because this post uses plugins that aren\u2019t compatible with real-time collaboration, only one person can edit at a time.'\n\t\t\t) }\n\t\t</p>\n\t);\n}\n\nfunction PostLockedModal() {\n\tconst instanceId = useInstanceId( PostLockedModal );\n\tconst hookName = 'core/editor/post-locked-modal-' + instanceId;\n\tconst { autosave, updatePostLock } = useDispatch( editorStore );\n\tconst {\n\t\tisCollaborationEnabled,\n\t\tisLocked,\n\t\tisTakeover,\n\t\tuser,\n\t\tpostId,\n\t\tpostLockUtils,\n\t\tactivePostLock,\n\t\tpostType,\n\t\tpreviewLink,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisCollaborationEnabledForCurrentPost,\n\t\t\tisPostLocked,\n\t\t\tisPostLockTakeover,\n\t\t\tgetPostLockUser,\n\t\t\tgetCurrentPostId,\n\t\t\tgetActivePostLock,\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetEditedPostPreviewLink,\n\t\t\tgetEditorSettings,\n\t\t} = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\treturn {\n\t\t\tisCollaborationEnabled: isCollaborationEnabledForCurrentPost(),\n\t\t\tisLocked: isPostLocked(),\n\t\t\tisTakeover: isPostLockTakeover(),\n\t\t\tuser: getPostLockUser(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostLockUtils: getEditorSettings().postLockUtils,\n\t\t\tactivePostLock: getActivePostLock(),\n\t\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\t\tpreviewLink: getEditedPostPreviewLink(),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t/**\n\t\t * Keep the lock refreshed.\n\t\t *\n\t\t * When the user does not send a heartbeat in a heartbeat-tick\n\t\t * the user is no longer editing and another user can start editing.\n\t\t *\n\t\t * @param {Object} data Data to send in the heartbeat request.\n\t\t */\n\t\tfunction sendPostLock( data ) {\n\t\t\tif ( isLocked ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdata[ 'wp-refresh-post-lock' ] = {\n\t\t\t\tlock: activePostLock,\n\t\t\t\tpost_id: postId,\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Refresh post locks: update the lock string or show the dialog if somebody has taken over editing.\n\t\t *\n\t\t * @param {Object} data Data received in the heartbeat request\n\t\t */\n\t\tfunction receivePostLock( data ) {\n\t\t\tif ( ! data[ 'wp-refresh-post-lock' ] ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst received = data[ 'wp-refresh-post-lock' ];\n\t\t\tif ( received.lock_error ) {\n\t\t\t\t// Auto save and display the takeover modal.\n\t\t\t\tautosave();\n\t\t\t\tupdatePostLock( {\n\t\t\t\t\tisLocked: true,\n\t\t\t\t\tisTakeover: true,\n\t\t\t\t\tuser: {\n\t\t\t\t\t\tname: received.lock_error.name,\n\t\t\t\t\t\tavatar: received.lock_error.avatar_src_2x,\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t} else if ( received.new_lock ) {\n\t\t\t\tupdatePostLock( {\n\t\t\t\t\tisLocked: false,\n\t\t\t\t\tactivePostLock: received.new_lock,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Unlock the post before the window is exited.\n\t\t */\n\t\tfunction releasePostLock() {\n\t\t\tif ( isLocked || ! activePostLock ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst data = new window.FormData();\n\t\t\tdata.append( 'action', 'wp-remove-post-lock' );\n\t\t\tdata.append( '_wpnonce', postLockUtils.unlockNonce );\n\t\t\tdata.append( 'post_ID', postId );\n\t\t\tdata.append( 'active_post_lock', activePostLock );\n\n\t\t\tif ( window.navigator.sendBeacon ) {\n\t\t\t\twindow.navigator.sendBeacon( postLockUtils.ajaxUrl, data );\n\t\t\t} else {\n\t\t\t\tconst xhr = new window.XMLHttpRequest();\n\t\t\t\txhr.open( 'POST', postLockUtils.ajaxUrl, false );\n\t\t\t\txhr.send( data );\n\t\t\t}\n\t\t}\n\n\t\t// Details on these events on the Heartbeat API docs\n\t\t// https://developer.wordpress.org/plugins/javascript/heartbeat-api/\n\t\taddAction( 'heartbeat.send', hookName, sendPostLock );\n\t\taddAction( 'heartbeat.tick', hookName, receivePostLock );\n\t\twindow.addEventListener( 'beforeunload', releasePostLock );\n\n\t\treturn () => {\n\t\t\tremoveAction( 'heartbeat.send', hookName );\n\t\t\tremoveAction( 'heartbeat.tick', hookName );\n\t\t\twindow.removeEventListener( 'beforeunload', releasePostLock );\n\t\t};\n\t}, [] );\n\n\tif ( ! isLocked ) {\n\t\treturn null;\n\t}\n\n\t// Avoid sending the modal if sync is supported, but retain functionality around locks etc.\n\tif ( isCollaborationEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst userDisplayName = user.name;\n\tconst userAvatar = user.avatar;\n\n\tconst unlockUrl = addQueryArgs( 'post.php', {\n\t\t'get-post-lock': '1',\n\t\tlockKey: true,\n\t\tpost: postId,\n\t\taction: 'edit',\n\t\t_wpnonce: postLockUtils.nonce,\n\t} );\n\tconst allPostsUrl = addQueryArgs( 'edit.php', {\n\t\tpost_type: postType?.slug,\n\t} );\n\tconst allPostsLabel = __( 'Exit editor' );\n\treturn (\n\t\t<Modal\n\t\t\ttitle={\n\t\t\t\tisTakeover\n\t\t\t\t\t? __( 'Someone else has taken over this post' )\n\t\t\t\t\t: __( 'This post is already being edited' )\n\t\t\t}\n\t\t\tfocusOnMount\n\t\t\tshouldCloseOnClickOutside={ false }\n\t\t\tshouldCloseOnEsc={ false }\n\t\t\tisDismissible={ false }\n\t\t\t// Do not remove this class, as this class is used by third party plugins.\n\t\t\tclassName=\"editor-post-locked-modal\"\n\t\t\tsize=\"medium\"\n\t\t>\n\t\t\t<HStack alignment=\"top\" spacing={ 6 }>\n\t\t\t\t{ !! userAvatar && (\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc={ userAvatar }\n\t\t\t\t\t\talt={ __( 'Avatar' ) }\n\t\t\t\t\t\tclassName=\"editor-post-locked-modal__avatar\"\n\t\t\t\t\t\twidth={ 64 }\n\t\t\t\t\t\theight={ 64 }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<div>\n\t\t\t\t\t{ !! isTakeover && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: user's display name */\n\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don\u2019t worry, your changes up to this moment have been saved.'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Another user now has editing control of this post (<PreviewLink />). Don\u2019t worry, your changes up to this moment have been saved.'\n\t\t\t\t\t\t\t\t\t\t ),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tstrong: <strong />,\n\t\t\t\t\t\t\t\t\t\tPreviewLink: (\n\t\t\t\t\t\t\t\t\t\t\t<ExternalLink href={ previewLink }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'preview' ) }\n\t\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<CollaborationContext />\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isTakeover && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: user's display name */\n\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'\n\t\t\t\t\t\t\t\t\t\t ),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tstrong: <strong />,\n\t\t\t\t\t\t\t\t\t\tPreviewLink: (\n\t\t\t\t\t\t\t\t\t\t\t<ExternalLink href={ previewLink }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'preview' ) }\n\t\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<CollaborationContext />\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'If you take over, the other user will lose editing control to the post, but their changes will be saved.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tclassName=\"editor-post-locked-modal__buttons\"\n\t\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! isTakeover && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\thref={ unlockUrl }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Take over' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\thref={ allPostsUrl }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ allPostsLabel }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</div>\n\t\t\t</HStack>\n\t\t</Modal>\n\t);\n}\n\n/**\n * A modal component that is displayed when a post is locked for editing by another user.\n * The modal provides information about the lock status and options to take over or exit the editor.\n *\n * @return {React.ReactNode} The rendered PostLockedModal component.\n */\nexport default globalThis.IS_GUTENBERG_PLUGIN\n\t? withFilters( 'editor.PostLockedModal' )( PostLockedModal )\n\t: PostLockedModal;\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,IAAI,eAAe;AAC5B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB;AAAA,OACM;AACP,SAAS,WAAW,mBAAmB;AACvC,SAAS,oBAAoB;AAC7B,SAAS,WAAW,gCAAgC;AACpD,SAAS,WAAW,oBAAoB;AACxC,SAAS,qBAAqB;AAC9B,SAAS,SAAS,iBAAiB;AACnC,SAAS,cAAc;AACvB,SAAS,oCAAoC;AAK7C,SAAS,SAAS,mBAAmB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tModal,\n\tButton,\n\tExternalLink,\n\t__experimentalHStack as HStack,\n\twithFilters,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useEffect, createInterpolateElement } from '@wordpress/element';\nimport { addAction, removeAction } from '@wordpress/hooks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { unlock } from '../../lock-unlock';\nimport { DOCUMENT_SIZE_LIMIT_EXCEEDED } from '../../utils/sync-error-messages';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nfunction CollaborationContext() {\n\tconst { isCollaborationSupported, syncConnectionStatus } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisCollaborationSupported: isSupported,\n\t\t\t\tgetSyncConnectionStatus,\n\t\t\t} = unlock( select( coreStore ) );\n\t\t\treturn {\n\t\t\t\tisCollaborationSupported: isSupported(),\n\t\t\t\tsyncConnectionStatus: getSyncConnectionStatus(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tif ( isCollaborationSupported ) {\n\t\treturn null;\n\t}\n\n\tif ( DOCUMENT_SIZE_LIMIT_EXCEEDED === syncConnectionStatus?.error?.code ) {\n\t\treturn (\n\t\t\t<p>\n\t\t\t\t{ __(\n\t\t\t\t\t'Because this post is too large for real-time collaboration, only one person can edit at a time.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t);\n\t}\n\n\treturn (\n\t\t<p>\n\t\t\t{ __(\n\t\t\t\t'Because this post uses plugins that aren\u2019t compatible with real-time collaboration, only one person can edit at a time.'\n\t\t\t) }\n\t\t</p>\n\t);\n}\n\nfunction PostLockedModal() {\n\tconst instanceId = useInstanceId( PostLockedModal );\n\tconst hookName = 'core/editor/post-locked-modal-' + instanceId;\n\tconst { autosave, updatePostLock } = useDispatch( editorStore );\n\tconst {\n\t\tisCollaborationEnabled,\n\t\tisLocked,\n\t\tisTakeover,\n\t\tuser,\n\t\tpostId,\n\t\tpostLockUtils,\n\t\tactivePostLock,\n\t\tpostType,\n\t\tpreviewLink,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisPostLocked,\n\t\t\tisPostLockTakeover,\n\t\t\tgetPostLockUser,\n\t\t\tgetCurrentPostId,\n\t\t\tgetActivePostLock,\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetEditedPostPreviewLink,\n\t\t\tgetEditorSettings,\n\t\t\tisCollaborationEnabledForCurrentPost,\n\t\t} = unlock( select( editorStore ) );\n\t\tconst { getPostType } = select( coreStore );\n\t\treturn {\n\t\t\tisCollaborationEnabled: isCollaborationEnabledForCurrentPost(),\n\t\t\tisLocked: isPostLocked(),\n\t\t\tisTakeover: isPostLockTakeover(),\n\t\t\tuser: getPostLockUser(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostLockUtils: getEditorSettings().postLockUtils,\n\t\t\tactivePostLock: getActivePostLock(),\n\t\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\t\tpreviewLink: getEditedPostPreviewLink(),\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t/**\n\t\t * Keep the lock refreshed.\n\t\t *\n\t\t * When the user does not send a heartbeat in a heartbeat-tick\n\t\t * the user is no longer editing and another user can start editing.\n\t\t *\n\t\t * @param {Object} data Data to send in the heartbeat request.\n\t\t */\n\t\tfunction sendPostLock( data ) {\n\t\t\tif ( isLocked ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdata[ 'wp-refresh-post-lock' ] = {\n\t\t\t\tlock: activePostLock,\n\t\t\t\tpost_id: postId,\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Refresh post locks: update the lock string or show the dialog if somebody has taken over editing.\n\t\t *\n\t\t * @param {Object} data Data received in the heartbeat request\n\t\t */\n\t\tfunction receivePostLock( data ) {\n\t\t\tif ( ! data[ 'wp-refresh-post-lock' ] ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst received = data[ 'wp-refresh-post-lock' ];\n\t\t\tif ( received.lock_error ) {\n\t\t\t\t// Auto save and display the takeover modal.\n\t\t\t\tautosave();\n\t\t\t\tupdatePostLock( {\n\t\t\t\t\tisLocked: true,\n\t\t\t\t\tisTakeover: true,\n\t\t\t\t\tuser: {\n\t\t\t\t\t\tname: received.lock_error.name,\n\t\t\t\t\t\tavatar: received.lock_error.avatar_src_2x,\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t} else if ( received.new_lock ) {\n\t\t\t\tupdatePostLock( {\n\t\t\t\t\tisLocked: false,\n\t\t\t\t\tactivePostLock: received.new_lock,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Unlock the post before the window is exited.\n\t\t */\n\t\tfunction releasePostLock() {\n\t\t\tif ( isLocked || ! activePostLock ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst data = new window.FormData();\n\t\t\tdata.append( 'action', 'wp-remove-post-lock' );\n\t\t\tdata.append( '_wpnonce', postLockUtils.unlockNonce );\n\t\t\tdata.append( 'post_ID', postId );\n\t\t\tdata.append( 'active_post_lock', activePostLock );\n\n\t\t\tif ( window.navigator.sendBeacon ) {\n\t\t\t\twindow.navigator.sendBeacon( postLockUtils.ajaxUrl, data );\n\t\t\t} else {\n\t\t\t\tconst xhr = new window.XMLHttpRequest();\n\t\t\t\txhr.open( 'POST', postLockUtils.ajaxUrl, false );\n\t\t\t\txhr.send( data );\n\t\t\t}\n\t\t}\n\n\t\t// Details on these events on the Heartbeat API docs\n\t\t// https://developer.wordpress.org/plugins/javascript/heartbeat-api/\n\t\taddAction( 'heartbeat.send', hookName, sendPostLock );\n\t\taddAction( 'heartbeat.tick', hookName, receivePostLock );\n\t\twindow.addEventListener( 'beforeunload', releasePostLock );\n\n\t\treturn () => {\n\t\t\tremoveAction( 'heartbeat.send', hookName );\n\t\t\tremoveAction( 'heartbeat.tick', hookName );\n\t\t\twindow.removeEventListener( 'beforeunload', releasePostLock );\n\t\t};\n\t}, [] );\n\n\tif ( ! isLocked ) {\n\t\treturn null;\n\t}\n\n\t// Avoid sending the modal if sync is supported, but retain functionality around locks etc.\n\tif ( isCollaborationEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst userDisplayName = user.name;\n\tconst userAvatar = user.avatar;\n\n\tconst unlockUrl = addQueryArgs( 'post.php', {\n\t\t'get-post-lock': '1',\n\t\tlockKey: true,\n\t\tpost: postId,\n\t\taction: 'edit',\n\t\t_wpnonce: postLockUtils.nonce,\n\t} );\n\tconst allPostsUrl = addQueryArgs( 'edit.php', {\n\t\tpost_type: postType?.slug,\n\t} );\n\tconst allPostsLabel = __( 'Exit editor' );\n\treturn (\n\t\t<Modal\n\t\t\ttitle={\n\t\t\t\tisTakeover\n\t\t\t\t\t? __( 'Someone else has taken over this post' )\n\t\t\t\t\t: __( 'This post is already being edited' )\n\t\t\t}\n\t\t\tfocusOnMount\n\t\t\tshouldCloseOnClickOutside={ false }\n\t\t\tshouldCloseOnEsc={ false }\n\t\t\tisDismissible={ false }\n\t\t\t// Do not remove this class, as this class is used by third party plugins.\n\t\t\tclassName=\"editor-post-locked-modal\"\n\t\t\tsize=\"medium\"\n\t\t>\n\t\t\t<HStack alignment=\"top\" spacing={ 6 }>\n\t\t\t\t{ !! userAvatar && (\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc={ userAvatar }\n\t\t\t\t\t\talt={ __( 'Avatar' ) }\n\t\t\t\t\t\tclassName=\"editor-post-locked-modal__avatar\"\n\t\t\t\t\t\twidth={ 64 }\n\t\t\t\t\t\theight={ 64 }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<div>\n\t\t\t\t\t{ !! isTakeover && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: user's display name */\n\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don\u2019t worry, your changes up to this moment have been saved.'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Another user now has editing control of this post (<PreviewLink />). Don\u2019t worry, your changes up to this moment have been saved.'\n\t\t\t\t\t\t\t\t\t\t ),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tstrong: <strong />,\n\t\t\t\t\t\t\t\t\t\tPreviewLink: (\n\t\t\t\t\t\t\t\t\t\t\t<ExternalLink href={ previewLink }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'preview' ) }\n\t\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<CollaborationContext />\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isTakeover && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: user's display name */\n\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\tuserDisplayName\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'\n\t\t\t\t\t\t\t\t\t\t ),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tstrong: <strong />,\n\t\t\t\t\t\t\t\t\t\tPreviewLink: (\n\t\t\t\t\t\t\t\t\t\t\t<ExternalLink href={ previewLink }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'preview' ) }\n\t\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<CollaborationContext />\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'If you take over, the other user will lose editing control to the post, but their changes will be saved.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tclassName=\"editor-post-locked-modal__buttons\"\n\t\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! isTakeover && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\thref={ unlockUrl }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Take over' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\thref={ allPostsUrl }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ allPostsLabel }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</div>\n\t\t\t</HStack>\n\t\t</Modal>\n\t);\n}\n\n/**\n * A modal component that is displayed when a post is locked for editing by another user.\n * The modal provides information about the lock status and options to take over or exit the editor.\n *\n * @return {React.ReactNode} The rendered PostLockedModal component.\n */\nexport default globalThis.IS_GUTENBERG_PLUGIN\n\t? withFilters( 'editor.PostLockedModal' )( PostLockedModal )\n\t: PostLockedModal;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,IAAI,eAAe;AAC5B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB;AAAA,OACM;AACP,SAAS,WAAW,mBAAmB;AACvC,SAAS,oBAAoB;AAC7B,SAAS,WAAW,gCAAgC;AACpD,SAAS,WAAW,oBAAoB;AACxC,SAAS,qBAAqB;AAC9B,SAAS,SAAS,iBAAiB;AACnC,SAAS,cAAc;AACvB,SAAS,oCAAoC;AAK7C,SAAS,SAAS,mBAAmB;AAuBlC,SAiMG,UAjMH,KAiMG,YAjMH;AArBH,SAAS,uBAAuB;AAC/B,QAAM,EAAE,0BAA0B,qBAAqB,IAAI;AAAA,IAC1D,CAAE,WAAY;AACb,YAAM;AAAA,QACL,0BAA0B;AAAA,QAC1B;AAAA,MACD,IAAI,OAAQ,OAAQ,SAAU,CAAE;AAChC,aAAO;AAAA,QACN,0BAA0B,YAAY;AAAA,QACtC,sBAAsB,wBAAwB;AAAA,MAC/C;AAAA,IACD;AAAA,IACA,CAAC;AAAA,EACF;AAEA,MAAK,0BAA2B;AAC/B,WAAO;AAAA,EACR;AAEA,MAAK,iCAAiC,sBAAsB,OAAO,MAAO;AACzE,WACC,oBAAC,OACE;AAAA,MACD;AAAA,IACD,GACD;AAAA,EAEF;AAEA,SACC,oBAAC,OACE;AAAA,IACD;AAAA,EACD,GACD;AAEF;AAEA,SAAS,kBAAkB;AAC1B,QAAM,aAAa,cAAe,eAAgB;AAClD,QAAM,WAAW,mCAAmC;AACpD,Q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A,oBACrB,SAAQ;AAAA,oBACR,MAAO;AAAA,oBAEL,aAAI,WAAY;AAAA;AAAA,gBACnB;AAAA,gBAED;AAAA,kBAAC;AAAA;AAAA,oBACA,uBAAqB;AAAA,oBACrB,SAAQ;AAAA,oBACR,MAAO;AAAA,oBAEL;AAAA;AAAA,gBACH;AAAA;AAAA;AAAA,UACD;AAAA,WACD;AAAA,SACD;AAAA;AAAA,EACD;AAEF;AAQA,IAAO,4BAAQ,WAAW,sBACvB,YAAa,wBAAyB,EAAG,eAAgB,IACzD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,7 +3,6 @@ import { __ } from "@wordpress/i18n";
|
|
|
3
3
|
import { useSelect } from "@wordpress/data";
|
|
4
4
|
import { useViewportMatch } from "@wordpress/compose";
|
|
5
5
|
import { store as editorStore } from "../../store/index.mjs";
|
|
6
|
-
import { ATTACHMENT_POST_TYPE } from "../../store/constants.mjs";
|
|
7
6
|
function PublishButtonLabel() {
|
|
8
7
|
const isSmallerThanMediumViewport = useViewportMatch("medium", "<");
|
|
9
8
|
const {
|
|
@@ -16,7 +15,6 @@ function PublishButtonLabel() {
|
|
|
16
15
|
hasNonPostEntityChanges,
|
|
17
16
|
postStatusHasChanged,
|
|
18
17
|
postStatus,
|
|
19
|
-
postType,
|
|
20
18
|
isPostSavingLocked
|
|
21
19
|
} = useSelect((select) => {
|
|
22
20
|
const {
|
|
@@ -25,7 +23,6 @@ function PublishButtonLabel() {
|
|
|
25
23
|
isSavingPost,
|
|
26
24
|
isPublishingPost,
|
|
27
25
|
getCurrentPost,
|
|
28
|
-
getCurrentPostType,
|
|
29
26
|
isAutosavingPost,
|
|
30
27
|
getPostEdits,
|
|
31
28
|
getEditedPostAttribute
|
|
@@ -36,7 +33,6 @@ function PublishButtonLabel() {
|
|
|
36
33
|
isSaving: isSavingPost(),
|
|
37
34
|
isPublishing: isPublishingPost(),
|
|
38
35
|
hasPublishAction: getCurrentPost()._links?.["wp:action-publish"] ?? false,
|
|
39
|
-
postType: getCurrentPostType(),
|
|
40
36
|
isAutosaving: isAutosavingPost(),
|
|
41
37
|
hasNonPostEntityChanges: select(editorStore).hasNonPostEntityChanges(),
|
|
42
38
|
isPostSavingLocked: select(editorStore).isPostSavingLocked(),
|
|
@@ -50,9 +46,6 @@ function PublishButtonLabel() {
|
|
|
50
46
|
return __("Saving\u2026");
|
|
51
47
|
}
|
|
52
48
|
if (!hasPublishAction) {
|
|
53
|
-
if (postType === ATTACHMENT_POST_TYPE && window?.__experimentalMediaEditor) {
|
|
54
|
-
return __("Save");
|
|
55
|
-
}
|
|
56
49
|
return isSmallerThanMediumViewport ? __("Publish") : __("Submit for Review");
|
|
57
50
|
}
|
|
58
51
|
if (hasNonPostEntityChanges && !isPostSavingLocked || isPublished || postStatusHasChanged && !["future", "publish"].includes(postStatus) || !postStatusHasChanged && postStatus === "future") {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/post-publish-button/label.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\
|
|
5
|
-
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB;AAKjC,SAAS,SAAS,mBAAmB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders the label for the publish button.\n *\n * @return {string} The label for the publish button.\n */\nexport default function PublishButtonLabel() {\n\tconst isSmallerThanMediumViewport = useViewportMatch( 'medium', '<' );\n\tconst {\n\t\tisPublished,\n\t\tisBeingScheduled,\n\t\tisSaving,\n\t\tisPublishing,\n\t\thasPublishAction,\n\t\tisAutosaving,\n\t\thasNonPostEntityChanges,\n\t\tpostStatusHasChanged,\n\t\tpostStatus,\n\t\tisPostSavingLocked,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisCurrentPostPublished,\n\t\t\tisEditedPostBeingScheduled,\n\t\t\tisSavingPost,\n\t\t\tisPublishingPost,\n\t\t\tgetCurrentPost,\n\t\t\tisAutosavingPost,\n\t\t\tgetPostEdits,\n\t\t\tgetEditedPostAttribute,\n\t\t} = select( editorStore );\n\t\treturn {\n\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\tisBeingScheduled: isEditedPostBeingScheduled(),\n\t\t\tisSaving: isSavingPost(),\n\t\t\tisPublishing: isPublishingPost(),\n\t\t\thasPublishAction:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\tisAutosaving: isAutosavingPost(),\n\t\t\thasNonPostEntityChanges:\n\t\t\t\tselect( editorStore ).hasNonPostEntityChanges(),\n\t\t\tisPostSavingLocked: select( editorStore ).isPostSavingLocked(),\n\t\t\tpostStatusHasChanged: !! getPostEdits()?.status,\n\t\t\tpostStatus: getEditedPostAttribute( 'status' ),\n\t\t};\n\t}, [] );\n\tif ( isPublishing ) {\n\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\treturn __( 'Publishing\u2026' );\n\t} else if (\n\t\t( isPublished || isBeingScheduled ) &&\n\t\tisSaving &&\n\t\t! isAutosaving\n\t) {\n\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\treturn __( 'Saving\u2026' );\n\t}\n\tif ( ! hasPublishAction ) {\n\t\t// TODO: this is because \"Submit for review\" string is too long in some languages.\n\t\t// @see https://github.com/WordPress/gutenberg/issues/10475\n\t\treturn isSmallerThanMediumViewport\n\t\t\t? __( 'Publish' )\n\t\t\t: __( 'Submit for Review' );\n\t}\n\tif (\n\t\t( hasNonPostEntityChanges && ! isPostSavingLocked ) ||\n\t\tisPublished ||\n\t\t( postStatusHasChanged &&\n\t\t\t! [ 'future', 'publish' ].includes( postStatus ) ) ||\n\t\t( ! postStatusHasChanged && postStatus === 'future' )\n\t) {\n\t\treturn __( 'Save' );\n\t}\n\tif ( isBeingScheduled ) {\n\t\treturn __( 'Schedule' );\n\t}\n\treturn __( 'Publish' );\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAC1B,SAAS,wBAAwB;AAKjC,SAAS,SAAS,mBAAmB;AAOtB,SAAR,qBAAsC;AAC5C,QAAM,8BAA8B,iBAAkB,UAAU,GAAI;AACpE,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI,UAAW,CAAE,WAAY;AAC5B,UAAM;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD,IAAI,OAAQ,WAAY;AACxB,WAAO;AAAA,MACN,aAAa,uBAAuB;AAAA,MACpC,kBAAkB,2BAA2B;AAAA,MAC7C,UAAU,aAAa;AAAA,MACvB,cAAc,iBAAiB;AAAA,MAC/B,kBACC,eAAe,EAAE,SAAU,mBAAoB,KAAK;AAAA,MACrD,cAAc,iBAAiB;AAAA,MAC/B,yBACC,OAAQ,WAAY,EAAE,wBAAwB;AAAA,MAC/C,oBAAoB,OAAQ,WAAY,EAAE,mBAAmB;AAAA,MAC7D,sBAAsB,CAAC,CAAE,aAAa,GAAG;AAAA,MACzC,YAAY,uBAAwB,QAAS;AAAA,IAC9C;AAAA,EACD,GAAG,CAAC,CAAE;AACN,MAAK,cAAe;AAEnB,WAAO,GAAI,kBAAc;AAAA,EAC1B,YACG,eAAe,qBACjB,YACA,CAAE,cACD;AAED,WAAO,GAAI,cAAU;AAAA,EACtB;AACA,MAAK,CAAE,kBAAmB;AAGzB,WAAO,8BACJ,GAAI,SAAU,IACd,GAAI,mBAAoB;AAAA,EAC5B;AACA,MACG,2BAA2B,CAAE,sBAC/B,eACE,wBACD,CAAE,CAAE,UAAU,SAAU,EAAE,SAAU,UAAW,KAC9C,CAAE,wBAAwB,eAAe,UAC1C;AACD,WAAO,GAAI,MAAO;AAAA,EACnB;AACA,MAAK,kBAAmB;AACvB,WAAO,GAAI,UAAW;AAAA,EACvB;AACA,SAAO,GAAI,SAAU;AACtB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// packages/editor/src/components/post-publish-panel/prepublish.js
|
|
2
2
|
import { __ } from "@wordpress/i18n";
|
|
3
|
-
import { Icon, PanelBody } from "@wordpress/components";
|
|
3
|
+
import { Icon as WCIcon, PanelBody } from "@wordpress/components";
|
|
4
4
|
import { useSelect } from "@wordpress/data";
|
|
5
5
|
import { wordpress } from "@wordpress/icons";
|
|
6
6
|
import { filterURLForDisplay } from "@wordpress/url";
|
|
@@ -41,7 +41,14 @@ function PostPublishPanelPrepublish({ children }) {
|
|
|
41
41
|
siteHome: siteData.home && filterURLForDisplay(siteData.home)
|
|
42
42
|
};
|
|
43
43
|
}, []);
|
|
44
|
-
let siteIcon = /* @__PURE__ */ jsx(
|
|
44
|
+
let siteIcon = /* @__PURE__ */ jsx(
|
|
45
|
+
WCIcon,
|
|
46
|
+
{
|
|
47
|
+
className: "components-site-icon",
|
|
48
|
+
size: "36px",
|
|
49
|
+
icon: wordpress
|
|
50
|
+
}
|
|
51
|
+
);
|
|
45
52
|
if (siteIconUrl) {
|
|
46
53
|
siteIcon = /* @__PURE__ */ jsx(
|
|
47
54
|
"img",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/post-publish-panel/prepublish.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, PanelBody } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { wordpress } from '@wordpress/icons';\nimport { filterURLForDisplay } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport PostVisibility from '../post-visibility';\nimport PostVisibilityLabel from '../post-visibility/label';\nimport PostSchedule from '../post-schedule';\nimport PostScheduleLabel from '../post-schedule/label';\nimport MaybeTagsPanel from './maybe-tags-panel';\nimport MaybePostFormatPanel from './maybe-post-format-panel';\nimport { store as editorStore } from '../../store';\nimport MaybeCategoryPanel from './maybe-category-panel';\nimport MaybeUploadMedia from './maybe-upload-media';\n\nfunction PostPublishPanelPrepublish( { children } ) {\n\tconst {\n\t\tisBeingScheduled,\n\t\tisRequestingSiteIcon,\n\t\thasPublishAction,\n\t\tsiteIconUrl,\n\t\tsiteTitle,\n\t\tsiteHome,\n\t} = useSelect( ( select ) => {\n\t\tconst { getCurrentPost, isEditedPostBeingScheduled } =\n\t\t\tselect( editorStore );\n\t\tconst { getEntityRecord, isResolving } = select( coreStore );\n\t\tconst siteData =\n\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\treturn {\n\t\t\thasPublishAction:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\tisBeingScheduled: isEditedPostBeingScheduled(),\n\t\t\tisRequestingSiteIcon: isResolving( 'getEntityRecord', [\n\t\t\t\t'root',\n\t\t\t\t'__unstableBase',\n\t\t\t\tundefined,\n\t\t\t] ),\n\t\t\tsiteIconUrl: siteData.site_icon_url,\n\t\t\tsiteTitle: siteData.name,\n\t\t\tsiteHome: siteData.home && filterURLForDisplay( siteData.home ),\n\t\t};\n\t}, [] );\n\n\tlet siteIcon = (\n\t\t<
|
|
5
|
-
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon as WCIcon, PanelBody } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { wordpress } from '@wordpress/icons';\nimport { filterURLForDisplay } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport PostVisibility from '../post-visibility';\nimport PostVisibilityLabel from '../post-visibility/label';\nimport PostSchedule from '../post-schedule';\nimport PostScheduleLabel from '../post-schedule/label';\nimport MaybeTagsPanel from './maybe-tags-panel';\nimport MaybePostFormatPanel from './maybe-post-format-panel';\nimport { store as editorStore } from '../../store';\nimport MaybeCategoryPanel from './maybe-category-panel';\nimport MaybeUploadMedia from './maybe-upload-media';\n\nfunction PostPublishPanelPrepublish( { children } ) {\n\tconst {\n\t\tisBeingScheduled,\n\t\tisRequestingSiteIcon,\n\t\thasPublishAction,\n\t\tsiteIconUrl,\n\t\tsiteTitle,\n\t\tsiteHome,\n\t} = useSelect( ( select ) => {\n\t\tconst { getCurrentPost, isEditedPostBeingScheduled } =\n\t\t\tselect( editorStore );\n\t\tconst { getEntityRecord, isResolving } = select( coreStore );\n\t\tconst siteData =\n\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\treturn {\n\t\t\thasPublishAction:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\tisBeingScheduled: isEditedPostBeingScheduled(),\n\t\t\tisRequestingSiteIcon: isResolving( 'getEntityRecord', [\n\t\t\t\t'root',\n\t\t\t\t'__unstableBase',\n\t\t\t\tundefined,\n\t\t\t] ),\n\t\t\tsiteIconUrl: siteData.site_icon_url,\n\t\t\tsiteTitle: siteData.name,\n\t\t\tsiteHome: siteData.home && filterURLForDisplay( siteData.home ),\n\t\t};\n\t}, [] );\n\n\tlet siteIcon = (\n\t\t<WCIcon\n\t\t\tclassName=\"components-site-icon\"\n\t\t\tsize=\"36px\"\n\t\t\ticon={ wordpress }\n\t\t/>\n\t);\n\n\tif ( siteIconUrl ) {\n\t\tsiteIcon = (\n\t\t\t<img\n\t\t\t\talt={ __( 'Site Icon' ) }\n\t\t\t\tclassName=\"components-site-icon\"\n\t\t\t\tsrc={ siteIconUrl }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isRequestingSiteIcon ) {\n\t\tsiteIcon = null;\n\t}\n\n\tlet prePublishTitle, prePublishBodyText;\n\n\tif ( ! hasPublishAction ) {\n\t\tprePublishTitle = __( 'Are you ready to submit for review?' );\n\t\tprePublishBodyText = __(\n\t\t\t'Your work will be reviewed and then approved.'\n\t\t);\n\t} else if ( isBeingScheduled ) {\n\t\tprePublishTitle = __( 'Are you ready to schedule?' );\n\t\tprePublishBodyText = __(\n\t\t\t'Your work will be published at the specified date and time.'\n\t\t);\n\t} else {\n\t\tprePublishTitle = __( 'Are you ready to publish?' );\n\t\tprePublishBodyText = __(\n\t\t\t'Double-check your settings before publishing.'\n\t\t);\n\t}\n\n\treturn (\n\t\t<div className=\"editor-post-publish-panel__prepublish\">\n\t\t\t<div>\n\t\t\t\t<strong>{ prePublishTitle }</strong>\n\t\t\t</div>\n\t\t\t<p>{ prePublishBodyText }</p>\n\t\t\t<div className=\"components-site-card\">\n\t\t\t\t{ siteIcon }\n\t\t\t\t<div className=\"components-site-info\">\n\t\t\t\t\t<span className=\"components-site-name\">\n\t\t\t\t\t\t{ decodeEntities( siteTitle ) || __( '(Untitled)' ) }\n\t\t\t\t\t</span>\n\t\t\t\t\t<span className=\"components-site-home\">{ siteHome }</span>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<MaybeUploadMedia />\n\t\t\t{ hasPublishAction && (\n\t\t\t\t<>\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tinitialOpen={ false }\n\t\t\t\t\t\ttitle={ [\n\t\t\t\t\t\t\t__( 'Visibility:' ),\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tclassName=\"editor-post-publish-panel__link\"\n\t\t\t\t\t\t\t\tkey=\"label\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostVisibilityLabel />\n\t\t\t\t\t\t\t</span>,\n\t\t\t\t\t\t] }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PostVisibility />\n\t\t\t\t\t</PanelBody>\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tinitialOpen={ false }\n\t\t\t\t\t\ttitle={ [\n\t\t\t\t\t\t\t__( 'Publish:' ),\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tclassName=\"editor-post-publish-panel__link\"\n\t\t\t\t\t\t\t\tkey=\"label\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostScheduleLabel />\n\t\t\t\t\t\t\t</span>,\n\t\t\t\t\t\t] }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PostSchedule />\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<MaybePostFormatPanel />\n\t\t\t<MaybeTagsPanel />\n\t\t\t<MaybeCategoryPanel />\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\nexport default PostPublishPanelPrepublish;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,QAAQ,QAAQ,iBAAiB;AAC1C,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,2BAA2B;AACpC,SAAS,SAAS,iBAAiB;AACnC,SAAS,sBAAsB;AAK/B,OAAO,oBAAoB;AAC3B,OAAO,yBAAyB;AAChC,OAAO,kBAAkB;AACzB,OAAO,uBAAuB;AAC9B,OAAO,oBAAoB;AAC3B,OAAO,0BAA0B;AACjC,SAAS,SAAS,mBAAmB;AACrC,OAAO,wBAAwB;AAC/B,OAAO,sBAAsB;AAiC3B,SAyDE,UAzDF,KAgDE,YAhDF;AA/BF,SAAS,2BAA4B,EAAE,S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AAAA,wBAAC,SACA,8BAAC,YAAS,2BAAiB,GAC5B;AAAA,IACA,oBAAC,OAAI,8BAAoB;AAAA,IACzB,qBAAC,SAAI,WAAU,wBACZ;AAAA;AAAA,MACF,qBAAC,SAAI,WAAU,wBACd;AAAA,4BAAC,UAAK,WAAU,wBACb,yBAAgB,SAAU,KAAK,GAAI,YAAa,GACnD;AAAA,QACA,oBAAC,UAAK,WAAU,wBAAyB,oBAAU;AAAA,SACpD;AAAA,OACD;AAAA,IACA,oBAAC,oBAAiB;AAAA,IAChB,oBACD,iCACC;AAAA;AAAA,QAAC;AAAA;AAAA,UACA,aAAc;AAAA,UACd,OAAQ;AAAA,YACP,GAAI,aAAc;AAAA,YAClB;AAAA,cAAC;AAAA;AAAA,gBACA,WAAU;AAAA,gBAGV,8BAAC,uBAAoB;AAAA;AAAA,cAFjB;AAAA,YAGL;AAAA,UACD;AAAA,UAEA,8BAAC,kBAAe;AAAA;AAAA,MACjB;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACA,aAAc;AAAA,UACd,OAAQ;AAAA,YACP,GAAI,UAAW;AAAA,YACf;AAAA,cAAC;AAAA;AAAA,gBACA,WAAU;AAAA,gBAGV,8BAAC,qBAAkB;AAAA;AAAA,cAFf;AAAA,YAGL;AAAA,UACD;AAAA,UAEA,8BAAC,gBAAa;AAAA;AAAA,MACf;AAAA,OACD;AAAA,IAED,oBAAC,wBAAqB;AAAA,IACtB,oBAAC,kBAAe;AAAA,IAChB,oBAAC,sBAAmB;AAAA,IAClB;AAAA,KACH;AAEF;AAEA,IAAO,qBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -133,6 +133,13 @@ function PostRevisionsPanelContent() {
|
|
|
133
133
|
);
|
|
134
134
|
}
|
|
135
135
|
function PostRevisionsPanel() {
|
|
136
|
+
const disableVisualRevisions = useSelect(
|
|
137
|
+
(select) => !!select(editorStore).getEditorSettings().disableVisualRevisions,
|
|
138
|
+
[]
|
|
139
|
+
);
|
|
140
|
+
if (disableVisualRevisions) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
136
143
|
return /* @__PURE__ */ jsx(PostLastRevisionCheck, { children: /* @__PURE__ */ jsx(PostRevisionsPanelContent, {}) });
|
|
137
144
|
}
|
|
138
145
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/post-revisions-panel/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tPanelBody,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { DataViews } from '@wordpress/dataviews';\nimport { dateI18n, getDate, humanTimeDiff, getSettings } from '@wordpress/date';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { authorField } from '@wordpress/fields';\n\n/**\n * Internal dependencies\n */\nimport PostLastRevisionCheck from '../post-last-revision/check';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Badge: WCBadge } = unlock( componentsPrivateApis );\nconst DAY_IN_MILLISECONDS = 86400000;\nconst EMPTY_ARRAY = [];\nconst defaultLayouts = { activity: true };\nconst noop = () => {};\nconst paginationInfo = {};\nconst view = {\n\ttype: 'activity',\n\ttitleField: 'date',\n\tfields: [ 'author' ],\n\tlayout: { density: 'compact' },\n};\nconst fields = [\n\t{\n\t\tid: 'date',\n\t\tlabel: __( 'Date' ),\n\t\trender: ( { item, field } ) => {\n\t\t\tconst dateNowInMs = getDate( null ).getTime();\n\t\t\tconst _value = field.getValue( { item } );\n\t\t\tconst date = getDate( _value ?? null );\n\t\t\tconst displayDate =\n\t\t\t\tdateNowInMs - date.getTime() > DAY_IN_MILLISECONDS\n\t\t\t\t\t? dateI18n(\n\t\t\t\t\t\t\tgetSettings().formats.datetimeAbbreviated,\n\t\t\t\t\t\t\tdate\n\t\t\t\t\t )\n\t\t\t\t\t: humanTimeDiff( date );\n\t\t\treturn (\n\t\t\t\t<time\n\t\t\t\t\tclassName=\"editor-post-revisions-panel__revision-date\"\n\t\t\t\t\tdateTime={ _value }\n\t\t\t\t>\n\t\t\t\t\t{ displayDate }\n\t\t\t\t</time>\n\t\t\t);\n\t\t},\n\t\tenableSorting: false,\n\t\tenableHiding: false,\n\t},\n\tauthorField,\n];\n\nfunction PostRevisionsPanelContent() {\n\tconst { setCurrentRevisionId } = unlock( useDispatch( editorStore ) );\n\tconst {\n\t\trevisionsCount,\n\t\trevisions,\n\t\trevisionKey,\n\t\tisLoading,\n\t\tlastRevisionId,\n\t} = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\tconst { getCurrentPostRevisionsCount, getCurrentPostLastRevisionId } =\n\t\t\tselect( editorStore );\n\t\tconst { getRevisions, getEntityConfig, isResolving } =\n\t\t\tselect( coreStore );\n\t\tconst _postType = getCurrentPostType();\n\t\tconst entityConfig = getEntityConfig( 'postType', _postType );\n\t\tconst _revisionKey = entityConfig?.revisionKey || 'id';\n\t\tconst revisionsQuery = {\n\t\t\tper_page: 3,\n\t\t\torderby: 'date',\n\t\t\torder: 'desc',\n\t\t\t_fields: `${ _revisionKey },date,author`,\n\t\t};\n\t\tconst query = [\n\t\t\t'postType',\n\t\t\t_postType,\n\t\t\tgetCurrentPostId(),\n\t\t\trevisionsQuery,\n\t\t];\n\t\tconst _revisions = getRevisions( ...query );\n\t\treturn {\n\t\t\trevisionsCount: getCurrentPostRevisionsCount(),\n\t\t\tlastRevisionId: getCurrentPostLastRevisionId(),\n\t\t\trevisions: _revisions,\n\t\t\trevisionKey: _revisionKey,\n\t\t\tisLoading: isResolving( 'getRevisions', query ),\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<PanelBody\n\t\t\ttitle={\n\t\t\t\t<HStack justify=\"space-between\" align=\"center\" as=\"span\">\n\t\t\t\t\t<span>{ __( 'Revisions' ) }</span>\n\t\t\t\t\t<WCBadge className=\"editor-post-revisions-panel__revisions-count\">\n\t\t\t\t\t\t{ revisionsCount }\n\t\t\t\t\t</WCBadge>\n\t\t\t\t</HStack>\n\t\t\t}\n\t\t\tinitialOpen={ false }\n\t\t>\n\t\t\t<VStack className=\"editor-post-revisions-panel\">\n\t\t\t\t<DataViews\n\t\t\t\t\tview={ view }\n\t\t\t\t\tonChangeView={ noop }\n\t\t\t\t\tfields={ fields }\n\t\t\t\t\tdata={ revisions || EMPTY_ARRAY }\n\t\t\t\t\tisLoading={ isLoading }\n\t\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\t\tdefaultLayouts={ defaultLayouts }\n\t\t\t\t\tgetItemId={ ( item ) => item[ revisionKey ] }\n\t\t\t\t\tisItemClickable={ () => true }\n\t\t\t\t\tonClickItem={ ( item ) => {\n\t\t\t\t\t\tsetCurrentRevisionId( item[ revisionKey ] );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<DataViews.Layout />\n\t\t\t\t</DataViews>\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"editor-post-revisions-panel__view-all\"\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tonClick={ () => setCurrentRevisionId( lastRevisionId ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'View all revisions' ) }\n\t\t\t\t</Button>\n\t\t\t</VStack>\n\t\t</PanelBody>\n\t);\n}\n\nexport default function PostRevisionsPanel() {\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<PostRevisionsPanelContent />\n\t\t</PostLastRevisionCheck>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB,eAAe;AAAA,OACT;AACP,SAAS,SAAS,iBAAiB;AACnC,SAAS,iBAAiB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B;AAAA;AAAA,QACnB;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACA,WAAU;AAAA,YACV,uBAAqB;AAAA,YACrB,SAAQ;AAAA,YACR,SAAU,MAAM,qBAAsB,cAAe;AAAA,YAEnD,aAAI,oBAAqB;AAAA;AAAA,QAC5B;AAAA,SACD;AAAA;AAAA,EACD;AAEF;AAEe,SAAR,qBAAsC;AAC5C,SACC,oBAAC,yBACA,8BAAC,6BAA0B,GAC5B;AAEF;",
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tPanelBody,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { DataViews } from '@wordpress/dataviews';\nimport { dateI18n, getDate, humanTimeDiff, getSettings } from '@wordpress/date';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { authorField } from '@wordpress/fields';\n\n/**\n * Internal dependencies\n */\nimport PostLastRevisionCheck from '../post-last-revision/check';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Badge: WCBadge } = unlock( componentsPrivateApis );\nconst DAY_IN_MILLISECONDS = 86400000;\nconst EMPTY_ARRAY = [];\nconst defaultLayouts = { activity: true };\nconst noop = () => {};\nconst paginationInfo = {};\nconst view = {\n\ttype: 'activity',\n\ttitleField: 'date',\n\tfields: [ 'author' ],\n\tlayout: { density: 'compact' },\n};\nconst fields = [\n\t{\n\t\tid: 'date',\n\t\tlabel: __( 'Date' ),\n\t\trender: ( { item, field } ) => {\n\t\t\tconst dateNowInMs = getDate( null ).getTime();\n\t\t\tconst _value = field.getValue( { item } );\n\t\t\tconst date = getDate( _value ?? null );\n\t\t\tconst displayDate =\n\t\t\t\tdateNowInMs - date.getTime() > DAY_IN_MILLISECONDS\n\t\t\t\t\t? dateI18n(\n\t\t\t\t\t\t\tgetSettings().formats.datetimeAbbreviated,\n\t\t\t\t\t\t\tdate\n\t\t\t\t\t )\n\t\t\t\t\t: humanTimeDiff( date );\n\t\t\treturn (\n\t\t\t\t<time\n\t\t\t\t\tclassName=\"editor-post-revisions-panel__revision-date\"\n\t\t\t\t\tdateTime={ _value }\n\t\t\t\t>\n\t\t\t\t\t{ displayDate }\n\t\t\t\t</time>\n\t\t\t);\n\t\t},\n\t\tenableSorting: false,\n\t\tenableHiding: false,\n\t},\n\tauthorField,\n];\n\nfunction PostRevisionsPanelContent() {\n\tconst { setCurrentRevisionId } = unlock( useDispatch( editorStore ) );\n\tconst {\n\t\trevisionsCount,\n\t\trevisions,\n\t\trevisionKey,\n\t\tisLoading,\n\t\tlastRevisionId,\n\t} = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\tconst { getCurrentPostRevisionsCount, getCurrentPostLastRevisionId } =\n\t\t\tselect( editorStore );\n\t\tconst { getRevisions, getEntityConfig, isResolving } =\n\t\t\tselect( coreStore );\n\t\tconst _postType = getCurrentPostType();\n\t\tconst entityConfig = getEntityConfig( 'postType', _postType );\n\t\tconst _revisionKey = entityConfig?.revisionKey || 'id';\n\t\tconst revisionsQuery = {\n\t\t\tper_page: 3,\n\t\t\torderby: 'date',\n\t\t\torder: 'desc',\n\t\t\t_fields: `${ _revisionKey },date,author`,\n\t\t};\n\t\tconst query = [\n\t\t\t'postType',\n\t\t\t_postType,\n\t\t\tgetCurrentPostId(),\n\t\t\trevisionsQuery,\n\t\t];\n\t\tconst _revisions = getRevisions( ...query );\n\t\treturn {\n\t\t\trevisionsCount: getCurrentPostRevisionsCount(),\n\t\t\tlastRevisionId: getCurrentPostLastRevisionId(),\n\t\t\trevisions: _revisions,\n\t\t\trevisionKey: _revisionKey,\n\t\t\tisLoading: isResolving( 'getRevisions', query ),\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<PanelBody\n\t\t\ttitle={\n\t\t\t\t<HStack justify=\"space-between\" align=\"center\" as=\"span\">\n\t\t\t\t\t<span>{ __( 'Revisions' ) }</span>\n\t\t\t\t\t<WCBadge className=\"editor-post-revisions-panel__revisions-count\">\n\t\t\t\t\t\t{ revisionsCount }\n\t\t\t\t\t</WCBadge>\n\t\t\t\t</HStack>\n\t\t\t}\n\t\t\tinitialOpen={ false }\n\t\t>\n\t\t\t<VStack className=\"editor-post-revisions-panel\">\n\t\t\t\t<DataViews\n\t\t\t\t\tview={ view }\n\t\t\t\t\tonChangeView={ noop }\n\t\t\t\t\tfields={ fields }\n\t\t\t\t\tdata={ revisions || EMPTY_ARRAY }\n\t\t\t\t\tisLoading={ isLoading }\n\t\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\t\tdefaultLayouts={ defaultLayouts }\n\t\t\t\t\tgetItemId={ ( item ) => item[ revisionKey ] }\n\t\t\t\t\tisItemClickable={ () => true }\n\t\t\t\t\tonClickItem={ ( item ) => {\n\t\t\t\t\t\tsetCurrentRevisionId( item[ revisionKey ] );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<DataViews.Layout />\n\t\t\t\t</DataViews>\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"editor-post-revisions-panel__view-all\"\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tonClick={ () => setCurrentRevisionId( lastRevisionId ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'View all revisions' ) }\n\t\t\t\t</Button>\n\t\t\t</VStack>\n\t\t</PanelBody>\n\t);\n}\n\nexport default function PostRevisionsPanel() {\n\tconst disableVisualRevisions = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( editorStore ).getEditorSettings().disableVisualRevisions,\n\t\t[]\n\t);\n\tif ( disableVisualRevisions ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<PostLastRevisionCheck>\n\t\t\t<PostRevisionsPanelContent />\n\t\t</PostLastRevisionCheck>\n\t);\n}\n"],
|
|
5
|
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KAAM,WAAY;AAAA,YAC1C,iBAAkB,MAAM;AAAA,YACxB,aAAc,CAAE,SAAU;AACzB,mCAAsB,KAAM,WAAY,CAAE;AAAA,YAC3C;AAAA,YAEA,8BAAC,UAAU,QAAV,EAAiB;AAAA;AAAA,QACnB;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACA,WAAU;AAAA,YACV,uBAAqB;AAAA,YACrB,SAAQ;AAAA,YACR,SAAU,MAAM,qBAAsB,cAAe;AAAA,YAEnD,aAAI,oBAAqB;AAAA;AAAA,QAC5B;AAAA,SACD;AAAA;AAAA,EACD;AAEF;AAEe,SAAR,qBAAsC;AAC5C,QAAM,yBAAyB;AAAA,IAC9B,CAAE,WACD,CAAC,CAAE,OAAQ,WAAY,EAAE,kBAAkB,EAAE;AAAA,IAC9C,CAAC;AAAA,EACF;AACA,MAAK,wBAAyB;AAC7B,WAAO;AAAA,EACR;AACA,SACC,oBAAC,yBACA,8BAAC,6BAA0B,GAC5B;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -13,9 +13,9 @@ import {
|
|
|
13
13
|
store as blockEditorStore
|
|
14
14
|
} from "@wordpress/block-editor";
|
|
15
15
|
import { __ } from "@wordpress/i18n";
|
|
16
|
-
import { Tooltip } from "@wordpress/
|
|
16
|
+
import { Tooltip } from "@wordpress/ui";
|
|
17
17
|
import { unlock } from "../../lock-unlock.mjs";
|
|
18
|
-
import { jsx } from "react/jsx-runtime";
|
|
18
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
19
|
var { useBlockElementRef } = unlock(blockEditorPrivateApis);
|
|
20
20
|
function collectDiffBlocks(blocks) {
|
|
21
21
|
const result = [];
|
|
@@ -68,18 +68,26 @@ function DiffMarkerButton({ clientId, status, subscribe }) {
|
|
|
68
68
|
if (!position) {
|
|
69
69
|
return null;
|
|
70
70
|
}
|
|
71
|
-
return /* @__PURE__ */
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
71
|
+
return /* @__PURE__ */ jsxs(Tooltip.Root, { children: [
|
|
72
|
+
/* @__PURE__ */ jsx(
|
|
73
|
+
Tooltip.Trigger,
|
|
74
|
+
{
|
|
75
|
+
render: /* @__PURE__ */ jsx(
|
|
76
|
+
"button",
|
|
77
|
+
{
|
|
78
|
+
className: `revision-diff-marker is-${status}`,
|
|
79
|
+
style: {
|
|
80
|
+
top: `${position.top}%`,
|
|
81
|
+
height: `${Math.max(position.height, 0.5)}%`
|
|
82
|
+
},
|
|
83
|
+
onClick: () => blockRef.current?.focus(),
|
|
84
|
+
"aria-label": STATUS_LABELS[status]
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ jsx(Tooltip.Popup, { children: STATUS_LABELS[status] })
|
|
90
|
+
] });
|
|
83
91
|
}
|
|
84
92
|
function useDiffMarkers() {
|
|
85
93
|
const [isMounted, setIsMounted] = useState(false);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/post-revisions-preview/diff-markers.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tuseMemo,\n\tuseRef,\n\tuseCallback,\n\tuseEffect,\n} from '@wordpress/element';\nimport { useRefEffect, useMergeRefs } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { Tooltip } from '@wordpress/
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,cAAc,oBAAoB;AAC3C,SAAS,iBAAiB;AAC1B;AAAA,EACC,eAAe;AAAA,EACf,SAAS;AAAA,OACH;AACP,SAAS,UAAU;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tuseMemo,\n\tuseRef,\n\tuseCallback,\n\tuseEffect,\n} from '@wordpress/element';\nimport { useRefEffect, useMergeRefs } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n// eslint-disable-next-line @wordpress/use-recommended-components -- `Tooltip` is not yet on the recommended `@wordpress/ui` allow-list; landing as a migration step ahead of the wider rollout.\nimport { Tooltip } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useBlockElementRef } = unlock( blockEditorPrivateApis );\n\n/**\n * Recursively collect blocks with diff status.\n *\n * @param {Array} blocks The blocks to search.\n * @return {Array} Blocks with __revisionDiffStatus.\n */\nfunction collectDiffBlocks( blocks ) {\n\tconst result = [];\n\tfor ( const block of blocks ) {\n\t\tif ( block.__revisionDiffStatus?.status ) {\n\t\t\tresult.push( {\n\t\t\t\tclientId: block.clientId,\n\t\t\t\tstatus: block.__revisionDiffStatus.status,\n\t\t\t} );\n\t\t}\n\t\tif ( block.innerBlocks?.length ) {\n\t\t\tresult.push( ...collectDiffBlocks( block.innerBlocks ) );\n\t\t}\n\t}\n\treturn result;\n}\n\nconst STATUS_LABELS = {\n\tadded: __( 'Go to added block' ),\n\tremoved: __( 'Go to removed block' ),\n\tmodified: __( 'Go to modified block' ),\n};\n\nfunction calculatePosition( el ) {\n\tif ( ! el ) {\n\t\treturn null;\n\t}\n\tconst doc = el.ownerDocument;\n\tconst scrollHeight = doc.documentElement.scrollHeight;\n\tconst rect = el.getBoundingClientRect();\n\tconst scrollTop = doc.documentElement.scrollTop;\n\tconst top = rect.top + scrollTop;\n\treturn {\n\t\ttop: ( top / scrollHeight ) * 100,\n\t\theight: ( rect.height / scrollHeight ) * 100,\n\t};\n}\n\n/**\n * Button component for a single diff marker.\n *\n * @param {Object} props Component props.\n * @param {string} props.clientId The block client ID.\n * @param {string} props.status The diff status (added/removed/modified).\n * @param {Function} props.subscribe Function to subscribe to position updates.\n * @return {React.JSX.Element} The diff marker button or null if position not calculated.\n */\nfunction DiffMarkerButton( { clientId, status, subscribe } ) {\n\tconst blockRef = useRef();\n\tuseBlockElementRef( clientId, blockRef );\n\tconst [ position, setPosition ] = useState( () =>\n\t\tcalculatePosition( blockRef.current )\n\t);\n\n\tuseEffect( () => {\n\t\treturn subscribe( () => {\n\t\t\tsetPosition( calculatePosition( blockRef.current ) );\n\t\t} );\n\t}, [ subscribe ] );\n\n\tuseEffect( () => {\n\t\tsetPosition( calculatePosition( blockRef.current ) );\n\t}, [ status ] );\n\n\tif ( ! position ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Tooltip.Root>\n\t\t\t<Tooltip.Trigger\n\t\t\t\trender={\n\t\t\t\t\t<button\n\t\t\t\t\t\tclassName={ `revision-diff-marker is-${ status }` }\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\ttop: `${ position.top }%`,\n\t\t\t\t\t\t\theight: `${ Math.max( position.height, 0.5 ) }%`,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonClick={ () => blockRef.current?.focus() }\n\t\t\t\t\t\taria-label={ STATUS_LABELS[ status ] }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<Tooltip.Popup>{ STATUS_LABELS[ status ] }</Tooltip.Popup>\n\t\t</Tooltip.Root>\n\t);\n}\n\n/**\n * Hook that provides diff markers functionality.\n * Returns a ref callback for the content element and a DiffMarkers component.\n * Must be used inside a BlockEditorProvider context.\n *\n * @return {Array} Tuple of [contentRef, DiffMarkersComponent].\n */\nexport function useDiffMarkers() {\n\tconst [ isMounted, setIsMounted ] = useState( false );\n\tconst subscribersRef = useRef( new Set() );\n\tconst blocks = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlocks(),\n\t\t[]\n\t);\n\tconst diffBlocks = useMemo( () => collectDiffBlocks( blocks ), [ blocks ] );\n\tconst subscribe = useCallback( ( callback ) => {\n\t\tsubscribersRef.current.add( callback );\n\t\treturn () => subscribersRef.current.delete( callback );\n\t}, [] );\n\tconst contentRef = useRefEffect( ( element ) => {\n\t\tconst { ownerDocument } = element;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst resizeObserver = new defaultView.ResizeObserver( () => {\n\t\t\tsubscribersRef.current.forEach( ( cb ) => cb() );\n\t\t} );\n\t\tresizeObserver.observe( ownerDocument.body );\n\t\treturn () => {\n\t\t\tresizeObserver.disconnect();\n\t\t};\n\t}, [] );\n\treturn [\n\t\tuseMergeRefs( [ contentRef, setIsMounted ] ),\n\t\t<div\n\t\t\tkey=\"diff-markers\"\n\t\t\tclassName=\"revision-diff-markers\"\n\t\t\trole=\"navigation\"\n\t\t\taria-label={ __( 'Document changes' ) }\n\t\t>\n\t\t\t{ isMounted &&\n\t\t\t\tdiffBlocks.map( ( { clientId, status } ) => (\n\t\t\t\t\t<DiffMarkerButton\n\t\t\t\t\t\tkey={ clientId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tstatus={ status }\n\t\t\t\t\t\tsubscribe={ subscribe }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t</div>,\n\t];\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,cAAc,oBAAoB;AAC3C,SAAS,iBAAiB;AAC1B;AAAA,EACC,eAAe;AAAA,EACf,SAAS;AAAA,OACH;AACP,SAAS,UAAU;AAEnB,SAAS,eAAe;AAKxB,SAAS,cAAc;AA8ErB,SAGG,KAHH;AA5EF,IAAM,EAAE,mBAAmB,IAAI,OAAQ,sBAAuB;AAQ9D,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N,aAAc,CAAE,YAAY,YAAa,CAAE;AAAA,IAC3C;AAAA,MAAC;AAAA;AAAA,QAEA,WAAU;AAAA,QACV,MAAK;AAAA,QACL,cAAa,GAAI,kBAAmB;AAAA,QAElC,uBACD,WAAW,IAAK,CAAE,EAAE,UAAU,OAAO,MACpC;AAAA,UAAC;AAAA;AAAA,YAEA;AAAA,YACA;AAAA,YACA;AAAA;AAAA,UAHM;AAAA,QAIP,CACC;AAAA;AAAA,MAbC;AAAA,IAcL;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -41,14 +41,20 @@ var REVISION_REMOVED_FILTER_SVG = `
|
|
|
41
41
|
var REVISION_DIFF_STYLES = `
|
|
42
42
|
.is-revision-added {
|
|
43
43
|
box-shadow: inset 0 0 0 9999px color-mix(in srgb, currentColor 5%, #00a32a 15%), 0 0 0 4px color-mix(in srgb, currentColor 5%, #00a32a 15%);
|
|
44
|
+
outline: 3px solid #00a32a;
|
|
45
|
+
outline-offset: 2px;
|
|
44
46
|
}
|
|
45
47
|
.is-revision-removed,
|
|
46
48
|
.revision-diff-removed {
|
|
47
49
|
text-decoration: line-through;
|
|
48
50
|
filter: url(#revision-removed-filter);
|
|
49
51
|
}
|
|
52
|
+
.is-revision-removed {
|
|
53
|
+
outline: 3px dashed #d63638;
|
|
54
|
+
outline-offset: 2px;
|
|
55
|
+
}
|
|
50
56
|
.is-revision-modified {
|
|
51
|
-
outline:
|
|
57
|
+
outline: 3px dotted #9a7000 !important;
|
|
52
58
|
outline-offset: 2px;
|
|
53
59
|
}
|
|
54
60
|
.revision-diff-added {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/post-revisions-preview/revisions-canvas.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Spinner } from '@wordpress/components';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport VisualEditor from '../visual-editor';\nimport {\n\tregisterDiffFormatTypes,\n\tunregisterDiffFormatTypes,\n} from './diff-format-types';\nimport { useDiffMarkers } from './diff-markers';\n\nconst { usePrivateStyleOverride } = unlock( blockEditorPrivateApis );\n\n// SVG filter for removed blocks: grayscale + red tint\nconst REVISION_REMOVED_FILTER_SVG = `\n<svg\n\txmlns=\"http://www.w3.org/2000/svg\"\n\tviewBox=\"0 0 0 0\"\n\twidth=\"0\"\n\theight=\"0\"\n\tfocusable=\"false\"\n\trole=\"none\"\n\taria-hidden=\"true\"\n\tstyle=\"visibility: hidden; position: absolute; left: -9999px; overflow: hidden;\"\n>\n\t<defs>\n\t\t<filter id=\"revision-removed-filter\" x=\"0\" y=\"0\" width=\"100%\" height=\"100%\">\n\t\t\t<!-- Desaturate and add red tint -->\n\t\t\t<feColorMatrix type=\"matrix\"\n\t\t\t\tvalues=\"0.5 0.3 0.2 0 0.15\n\t\t\t\t 0.2 0.2 0.1 0 0\n\t\t\t\t 0.2 0.2 0.1 0 0\n\t\t\t\t 0 0 0 0.8 0\"/>\n\t\t</filter>\n\t</defs>\n</svg>\n`;\n\n/**\n * CSS for revision diff indicators, injected into the iframe.\n * Uses color-mix() to blend diff colors with currentColor for better integration.\n */\nconst REVISION_DIFF_STYLES = `\n\t.is-revision-added {\n\t\tbox-shadow: inset 0 0 0 9999px color-mix(in srgb, currentColor 5%, #00a32a 15%), 0 0 0 4px color-mix(in srgb, currentColor 5%, #00a32a 15%);\n\t}\n\t.is-revision-removed,\n\t.revision-diff-removed {\n\t\ttext-decoration: line-through;\n\t\tfilter: url(#revision-removed-filter);\n\t}\n\t.is-revision-
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,eAAe;AACxB,SAAS,eAAe,8BAA8B;AACtD,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAK1B,SAAS,cAAc;AACvB,SAAS,SAAS,mBAAmB;AACrC,OAAO,kBAAkB;AACzB;AAAA,EACC;AAAA,EACA;AAAA,OACM;AACP,SAAS,sBAAsB;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Spinner } from '@wordpress/components';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport VisualEditor from '../visual-editor';\nimport {\n\tregisterDiffFormatTypes,\n\tunregisterDiffFormatTypes,\n} from './diff-format-types';\nimport { useDiffMarkers } from './diff-markers';\n\nconst { usePrivateStyleOverride } = unlock( blockEditorPrivateApis );\n\n// SVG filter for removed blocks: grayscale + red tint\nconst REVISION_REMOVED_FILTER_SVG = `\n<svg\n\txmlns=\"http://www.w3.org/2000/svg\"\n\tviewBox=\"0 0 0 0\"\n\twidth=\"0\"\n\theight=\"0\"\n\tfocusable=\"false\"\n\trole=\"none\"\n\taria-hidden=\"true\"\n\tstyle=\"visibility: hidden; position: absolute; left: -9999px; overflow: hidden;\"\n>\n\t<defs>\n\t\t<filter id=\"revision-removed-filter\" x=\"0\" y=\"0\" width=\"100%\" height=\"100%\">\n\t\t\t<!-- Desaturate and add red tint -->\n\t\t\t<feColorMatrix type=\"matrix\"\n\t\t\t\tvalues=\"0.5 0.3 0.2 0 0.15\n\t\t\t\t 0.2 0.2 0.1 0 0\n\t\t\t\t 0.2 0.2 0.1 0 0\n\t\t\t\t 0 0 0 0.8 0\"/>\n\t\t</filter>\n\t</defs>\n</svg>\n`;\n\n/**\n * CSS for revision diff indicators, injected into the iframe.\n * Uses color-mix() to blend diff colors with currentColor for better integration.\n */\nconst REVISION_DIFF_STYLES = `\n\t.is-revision-added {\n\t\tbox-shadow: inset 0 0 0 9999px color-mix(in srgb, currentColor 5%, #00a32a 15%), 0 0 0 4px color-mix(in srgb, currentColor 5%, #00a32a 15%);\n\t\toutline: 3px solid #00a32a;\n\t\toutline-offset: 2px;\n\t}\n\t.is-revision-removed,\n\t.revision-diff-removed {\n\t\ttext-decoration: line-through;\n\t\tfilter: url(#revision-removed-filter);\n\t}\n\t.is-revision-removed {\n\t\toutline: 3px dashed #d63638;\n\t\toutline-offset: 2px;\n\t}\n\t.is-revision-modified {\n\t\toutline: 3px dotted #9a7000 !important;\n\t\toutline-offset: 2px;\n\t}\n\t.revision-diff-added {\n\t\tbackground-color: color-mix(in srgb, currentColor 5%, #00a32a 15%);\n\t\ttext-decoration: none;\n\t}\n\t.revision-diff-format-added {\n\t\ttext-decoration: underline wavy color-mix(in srgb, currentColor 30%, #00a32a 70%);\n\t\ttext-decoration-thickness: 2px;\n\t}\n\t.revision-diff-format-removed {\n\t\ttext-decoration: underline wavy color-mix(in srgb, currentColor 20%, #d63638 80%);\n\t\ttext-decoration-thickness: 2px;\n\t}\n\t.revision-diff-format-changed {\n\t\ttext-decoration: underline wavy color-mix(in srgb, currentColor 30%, #dba617 70%);\n\t\ttext-decoration-thickness: 2px;\n\t}\n`;\n\n/**\n * Filter to add diff status CSS classes to blocks.\n *\n * @param {Object} BlockListBlock The original block list block component.\n * @return {Function} Enhanced component with diff status classes.\n */\nfunction withRevisionDiffClasses( BlockListBlock ) {\n\treturn ( props ) => {\n\t\tconst { block, className } = props;\n\t\tconst diffStatus = block?.__revisionDiffStatus?.status;\n\n\t\tconst enhancedClassName = clsx( className, {\n\t\t\t'is-revision-added': diffStatus === 'added',\n\t\t\t'is-revision-removed': diffStatus === 'removed',\n\t\t\t'is-revision-modified': diffStatus === 'modified',\n\t\t} );\n\n\t\treturn <BlockListBlock { ...props } className={ enhancedClassName } />;\n\t};\n}\n\nconst FILTER_NAME = 'editor/revisions-canvas/withRevisionDiffClasses';\n\n// Register the filter at module level to ensure it's available before first render.\naddFilter( 'editor.BlockListBlock', FILTER_NAME, withRevisionDiffClasses );\n\n/**\n * Component to inject diff styles via style overrides.\n * Must be rendered inside ExperimentalBlockEditorProvider.\n *\n * @param {Object} props Component props.\n * @param {boolean} props.showDiff Whether to show diff highlighting.\n */\nfunction DiffStyleOverrides( { showDiff } ) {\n\tusePrivateStyleOverride( {\n\t\tcss: showDiff ? REVISION_DIFF_STYLES : '',\n\t} );\n\tusePrivateStyleOverride( {\n\t\tassets: showDiff ? REVISION_REMOVED_FILTER_SVG : '',\n\t\t__unstableType: 'svgs',\n\t} );\n\treturn null;\n}\n\nfunction CanvasContent( { showDiff } ) {\n\tconst [ contentRef, diffMarkers ] = useDiffMarkers();\n\treturn (\n\t\t<>\n\t\t\t<VisualEditor contentRef={ contentRef } />\n\t\t\t{ showDiff && diffMarkers }\n\t\t</>\n\t);\n}\n\n/**\n * Canvas component that renders a post revision in read-only mode.\n * Block preparation and settings are handled by the parent EditorProvider.\n *\n * @return {React.JSX.Element} The revisions canvas component.\n */\nexport default function RevisionsCanvas() {\n\tuseEffect( () => {\n\t\tregisterDiffFormatTypes();\n\t\treturn () => {\n\t\t\tunregisterDiffFormatTypes();\n\t\t};\n\t}, [] );\n\n\tconst { revision, showDiff } = useSelect( ( select ) => {\n\t\tconst { getCurrentRevision, isShowingRevisionDiff } = unlock(\n\t\t\tselect( editorStore )\n\t\t);\n\t\treturn {\n\t\t\trevision: getCurrentRevision(),\n\t\t\tshowDiff: isShowingRevisionDiff(),\n\t\t};\n\t}, [] );\n\n\treturn revision ? (\n\t\t<>\n\t\t\t<DiffStyleOverrides showDiff={ showDiff } />\n\t\t\t<div className=\"editor-revisions-canvas__content\">\n\t\t\t\t<CanvasContent showDiff={ showDiff } />\n\t\t\t</div>\n\t\t</>\n\t)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,SAAS,GAAI;AAC3C,0BAAyB;AAAA,IACxB,KAAK,WAAW,uBAAuB;AAAA,EACxC,CAAE;AACF,0BAAyB;AAAA,IACxB,QAAQ,WAAW,8BAA8B;AAAA,IACjD,gBAAgB;AAAA,EACjB,CAAE;AACF,SAAO;AACR;AAEA,SAAS,cAAe,EAAE,SAAS,GAAI;AACtC,QAAM,CAAE,YAAY,WAAY,IAAI,eAAe;AACnD,SACC,iCACC;AAAA,wBAAC,gBAAa,YAA0B;AAAA,IACtC,YAAY;AAAA,KACf;AAEF;AAQe,SAAR,kBAAmC;AACzC,YAAW,MAAM;AAChB,4BAAwB;AACxB,WAAO,MAAM;AACZ,gCAA0B;AAAA,IAC3B;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,QAAM,EAAE,UAAU,SAAS,IAAI,UAAW,CAAE,WAAY;AACvD,UAAM,EAAE,oBAAoB,sBAAsB,IAAI;AAAA,MACrD,OAAQ,WAAY;AAAA,IACrB;AACA,WAAO;AAAA,MACN,UAAU,mBAAmB;AAAA,MAC7B,UAAU,sBAAsB;AAAA,IACjC;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,SAAO,WACN,iCACC;AAAA,wBAAC,sBAAmB,UAAsB;AAAA,IAC1C,oBAAC,SAAI,WAAU,oCACd,8BAAC,iBAAc,UAAsB,GACtC;AAAA,KACD,IAEA,oBAAC,SAAI,WAAU,oCACd,8BAAC,WAAQ,GACV;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -7,8 +7,7 @@ function PostTaxonomiesCheck({ children }) {
|
|
|
7
7
|
const postType = select(editorStore).getCurrentPostType();
|
|
8
8
|
const taxonomies = select(coreStore).getEntityRecords(
|
|
9
9
|
"root",
|
|
10
|
-
"taxonomy"
|
|
11
|
-
{ per_page: -1 }
|
|
10
|
+
"taxonomy"
|
|
12
11
|
);
|
|
13
12
|
return taxonomies?.some(
|
|
14
13
|
(taxonomy) => taxonomy.types.includes(postType)
|