@wordpress/editor 14.40.2-next.v.202602241322.0 → 14.40.2
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 +6 -0
- package/build/components/collab-sidebar/index.cjs +7 -4
- package/build/components/collab-sidebar/index.cjs.map +2 -2
- package/build/components/collab-sidebar/utils.cjs +13 -15
- package/build/components/collab-sidebar/utils.cjs.map +2 -2
- package/build/components/collaborators-overlay/avatar-iframe-styles.cjs +141 -0
- package/build/components/collaborators-overlay/avatar-iframe-styles.cjs.map +7 -0
- package/build/components/collaborators-overlay/collaborator-styles.cjs +38 -2
- package/build/components/collaborators-overlay/collaborator-styles.cjs.map +2 -2
- package/build/components/collaborators-overlay/compute-selection.cjs +185 -0
- package/build/components/collaborators-overlay/compute-selection.cjs.map +7 -0
- package/build/components/collaborators-overlay/cursor-dom-utils.cjs +243 -0
- package/build/components/collaborators-overlay/cursor-dom-utils.cjs.map +7 -0
- package/build/components/collaborators-overlay/cursor-registry.cjs +86 -0
- package/build/components/collaborators-overlay/cursor-registry.cjs.map +7 -0
- package/build/components/collaborators-overlay/index.cjs +7 -2
- package/build/components/collaborators-overlay/index.cjs.map +2 -2
- package/build/components/collaborators-overlay/overlay-iframe-styles.cjs +148 -0
- package/build/components/collaborators-overlay/overlay-iframe-styles.cjs.map +7 -0
- package/build/components/collaborators-overlay/overlay.cjs +146 -236
- package/build/components/collaborators-overlay/overlay.cjs.map +3 -3
- package/build/components/collaborators-overlay/timing-utils.cjs +46 -0
- package/build/components/collaborators-overlay/timing-utils.cjs.map +7 -0
- package/build/components/collaborators-overlay/use-block-highlighting.cjs +91 -42
- package/build/components/collaborators-overlay/use-block-highlighting.cjs.map +2 -2
- package/build/components/collaborators-overlay/use-debounced-recompute.cjs +49 -0
- package/build/components/collaborators-overlay/use-debounced-recompute.cjs.map +7 -0
- package/build/components/collaborators-overlay/use-render-cursors.cjs +82 -172
- package/build/components/collaborators-overlay/use-render-cursors.cjs.map +3 -3
- package/build/components/collaborators-presence/avatar/component.cjs +121 -0
- package/build/components/collaborators-presence/avatar/component.cjs.map +7 -0
- package/build/components/collaborators-presence/avatar/index.cjs +37 -0
- package/build/components/collaborators-presence/avatar/index.cjs.map +7 -0
- package/build/components/collaborators-presence/avatar/types.cjs +19 -0
- package/build/components/collaborators-presence/avatar/types.cjs.map +7 -0
- package/build/components/collaborators-presence/avatar/use-image-loading-status.cjs +44 -0
- package/build/components/collaborators-presence/avatar/use-image-loading-status.cjs.map +7 -0
- package/build/components/collaborators-presence/avatar-group/component.cjs +78 -0
- package/build/components/collaborators-presence/avatar-group/component.cjs.map +7 -0
- package/build/components/collaborators-presence/avatar-group/index.cjs +37 -0
- package/build/components/collaborators-presence/avatar-group/index.cjs.map +7 -0
- package/build/components/collaborators-presence/avatar-group/types.cjs +19 -0
- package/build/components/collaborators-presence/avatar-group/types.cjs.map +7 -0
- package/build/components/collaborators-presence/index.cjs +66 -19
- package/build/components/collaborators-presence/index.cjs.map +3 -3
- package/build/components/collaborators-presence/list.cjs +60 -38
- package/build/components/collaborators-presence/list.cjs.map +3 -3
- package/build/components/collaborators-presence/use-collaborator-notifications.cjs +149 -0
- package/build/components/collaborators-presence/use-collaborator-notifications.cjs.map +7 -0
- package/build/components/editor-interface/index.cjs +11 -6
- package/build/components/editor-interface/index.cjs.map +2 -2
- package/build/components/inserter-sidebar/index.cjs +2 -1
- package/build/components/inserter-sidebar/index.cjs.map +2 -2
- package/build/components/post-last-revision/index.cjs +27 -6
- package/build/components/post-last-revision/index.cjs.map +2 -2
- package/build/components/post-locked-modal/index.cjs +49 -17
- package/build/components/post-locked-modal/index.cjs.map +3 -3
- package/build/components/post-revisions-preview/block-diff.cjs +130 -34
- package/build/components/post-revisions-preview/block-diff.cjs.map +2 -2
- package/build/components/post-revisions-preview/diff-markers.cjs +6 -5
- package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
- package/build/components/post-revisions-preview/revisions-canvas.cjs +16 -60
- package/build/components/post-revisions-preview/revisions-canvas.cjs.map +3 -3
- package/build/components/post-revisions-preview/revisions-header.cjs +33 -26
- package/build/components/post-revisions-preview/revisions-header.cjs.map +3 -3
- package/build/components/post-revisions-preview/revisions-slider.cjs +104 -39
- package/build/components/post-revisions-preview/revisions-slider.cjs.map +3 -3
- package/build/components/preferences-modal/index.cjs +36 -4
- package/build/components/preferences-modal/index.cjs.map +2 -2
- package/build/components/provider/disable-non-page-content-blocks.cjs +31 -28
- package/build/components/provider/disable-non-page-content-blocks.cjs.map +3 -3
- package/build/components/provider/index.cjs +17 -5
- package/build/components/provider/index.cjs.map +2 -2
- package/build/components/provider/use-block-editor-settings.cjs +20 -4
- package/build/components/provider/use-block-editor-settings.cjs.map +3 -3
- package/build/components/provider/{use-post-content-blocks.cjs → use-post-content-block-types.cjs} +8 -19
- package/build/components/provider/use-post-content-block-types.cjs.map +7 -0
- package/build/components/provider/use-revision-blocks.cjs +106 -0
- package/build/components/provider/use-revision-blocks.cjs.map +7 -0
- package/build/components/revision-block-diff/index.cjs +61 -0
- package/build/components/revision-block-diff/index.cjs.map +7 -0
- package/build/components/revision-diff-panel/index.cjs +68 -0
- package/build/components/revision-diff-panel/index.cjs.map +7 -0
- package/build/components/revision-fields-diff/index.cjs +96 -0
- package/build/components/revision-fields-diff/index.cjs.map +7 -0
- package/build/components/sidebar/header.cjs +1 -1
- package/build/components/sidebar/header.cjs.map +2 -2
- package/build/components/sidebar/index.cjs +7 -1
- package/build/components/sidebar/index.cjs.map +3 -3
- package/build/components/style-book/index.cjs +4 -3
- package/build/components/style-book/index.cjs.map +2 -2
- package/build/components/sync-connection-error-modal/index.cjs +187 -0
- package/build/components/sync-connection-error-modal/index.cjs.map +7 -0
- package/build/components/sync-connection-error-modal/use-retry-countdown.cjs +84 -0
- package/build/components/sync-connection-error-modal/use-retry-countdown.cjs.map +7 -0
- package/build/components/template-content-panel/index.cjs +35 -31
- package/build/components/template-content-panel/index.cjs.map +3 -3
- package/build/components/template-part-menu-items/convert-to-regular.cjs +54 -11
- package/build/components/template-part-menu-items/convert-to-regular.cjs.map +3 -3
- package/build/components/visual-editor/index.cjs +6 -15
- package/build/components/visual-editor/index.cjs.map +2 -2
- package/build/store/private-actions.cjs +46 -2
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +156 -21
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +27 -0
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +0 -14
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/media-finalize/index.cjs +43 -0
- package/build/utils/media-finalize/index.cjs.map +7 -0
- package/build/utils/media-upload/on-success.cjs +46 -0
- package/build/utils/media-upload/on-success.cjs.map +7 -0
- package/build/utils/sync-error-messages.cjs +32 -15
- package/build/utils/sync-error-messages.cjs.map +3 -3
- package/build-module/components/collab-sidebar/index.mjs +7 -4
- package/build-module/components/collab-sidebar/index.mjs.map +2 -2
- package/build-module/components/collab-sidebar/utils.mjs +13 -15
- package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/avatar-iframe-styles.mjs +128 -0
- package/build-module/components/collaborators-overlay/avatar-iframe-styles.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/collaborator-styles.mjs +25 -1
- package/build-module/components/collaborators-overlay/collaborator-styles.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/compute-selection.mjs +166 -0
- package/build-module/components/collaborators-overlay/compute-selection.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/cursor-dom-utils.mjs +213 -0
- package/build-module/components/collaborators-overlay/cursor-dom-utils.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/cursor-registry.mjs +61 -0
- package/build-module/components/collaborators-overlay/cursor-registry.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/index.mjs +7 -2
- package/build-module/components/collaborators-overlay/index.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs +130 -0
- package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/overlay.mjs +137 -237
- package/build-module/components/collaborators-overlay/overlay.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/timing-utils.mjs +21 -0
- package/build-module/components/collaborators-overlay/timing-utils.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/use-block-highlighting.mjs +93 -45
- package/build-module/components/collaborators-overlay/use-block-highlighting.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/use-debounced-recompute.mjs +24 -0
- package/build-module/components/collaborators-overlay/use-debounced-recompute.mjs.map +7 -0
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs +83 -176
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs.map +2 -2
- package/build-module/components/collaborators-presence/avatar/component.mjs +90 -0
- package/build-module/components/collaborators-presence/avatar/component.mjs.map +7 -0
- package/build-module/components/collaborators-presence/avatar/index.mjs +6 -0
- package/build-module/components/collaborators-presence/avatar/index.mjs.map +7 -0
- package/build-module/components/collaborators-presence/avatar/types.mjs +1 -0
- package/build-module/components/collaborators-presence/avatar/types.mjs.map +7 -0
- package/build-module/components/collaborators-presence/avatar/use-image-loading-status.mjs +19 -0
- package/build-module/components/collaborators-presence/avatar/use-image-loading-status.mjs.map +7 -0
- package/build-module/components/collaborators-presence/avatar-group/component.mjs +47 -0
- package/build-module/components/collaborators-presence/avatar-group/component.mjs.map +7 -0
- package/build-module/components/collaborators-presence/avatar-group/index.mjs +6 -0
- package/build-module/components/collaborators-presence/avatar-group/index.mjs.map +7 -0
- package/build-module/components/collaborators-presence/avatar-group/types.mjs +1 -0
- package/build-module/components/collaborators-presence/avatar-group/types.mjs.map +7 -0
- package/build-module/components/collaborators-presence/index.mjs +57 -23
- package/build-module/components/collaborators-presence/index.mjs.map +2 -2
- package/build-module/components/collaborators-presence/list.mjs +52 -44
- package/build-module/components/collaborators-presence/list.mjs.map +2 -2
- package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs +126 -0
- package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs.map +7 -0
- package/build-module/components/editor-interface/index.mjs +12 -7
- package/build-module/components/editor-interface/index.mjs.map +2 -2
- package/build-module/components/inserter-sidebar/index.mjs +2 -1
- package/build-module/components/inserter-sidebar/index.mjs.map +2 -2
- package/build-module/components/post-last-revision/index.mjs +27 -6
- package/build-module/components/post-last-revision/index.mjs.map +2 -2
- package/build-module/components/post-locked-modal/index.mjs +49 -17
- package/build-module/components/post-locked-modal/index.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/block-diff.mjs +130 -34
- package/build-module/components/post-revisions-preview/block-diff.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/diff-markers.mjs +6 -5
- package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-canvas.mjs +18 -65
- package/build-module/components/post-revisions-preview/revisions-canvas.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-header.mjs +36 -33
- package/build-module/components/post-revisions-preview/revisions-header.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-slider.mjs +112 -42
- package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
- package/build-module/components/preferences-modal/index.mjs +36 -4
- package/build-module/components/preferences-modal/index.mjs.map +2 -2
- package/build-module/components/provider/disable-non-page-content-blocks.mjs +31 -28
- package/build-module/components/provider/disable-non-page-content-blocks.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +17 -5
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/use-block-editor-settings.mjs +20 -4
- package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
- package/build-module/components/provider/use-post-content-block-types.mjs +23 -0
- package/build-module/components/provider/use-post-content-block-types.mjs.map +7 -0
- package/build-module/components/provider/use-revision-blocks.mjs +81 -0
- package/build-module/components/provider/use-revision-blocks.mjs.map +7 -0
- package/build-module/components/revision-block-diff/index.mjs +30 -0
- package/build-module/components/revision-block-diff/index.mjs.map +7 -0
- package/build-module/components/revision-diff-panel/index.mjs +37 -0
- package/build-module/components/revision-diff-panel/index.mjs.map +7 -0
- package/build-module/components/revision-fields-diff/index.mjs +65 -0
- package/build-module/components/revision-fields-diff/index.mjs.map +7 -0
- package/build-module/components/sidebar/header.mjs +1 -1
- package/build-module/components/sidebar/header.mjs.map +2 -2
- package/build-module/components/sidebar/index.mjs +7 -1
- package/build-module/components/sidebar/index.mjs.map +2 -2
- package/build-module/components/style-book/index.mjs +4 -3
- package/build-module/components/style-book/index.mjs.map +2 -2
- package/build-module/components/sync-connection-error-modal/index.mjs +170 -0
- package/build-module/components/sync-connection-error-modal/index.mjs.map +7 -0
- package/build-module/components/sync-connection-error-modal/use-retry-countdown.mjs +59 -0
- package/build-module/components/sync-connection-error-modal/use-retry-countdown.mjs.map +7 -0
- package/build-module/components/template-content-panel/index.mjs +25 -31
- package/build-module/components/template-content-panel/index.mjs.map +2 -2
- package/build-module/components/template-part-menu-items/convert-to-regular.mjs +60 -14
- package/build-module/components/template-part-menu-items/convert-to-regular.mjs.map +2 -2
- package/build-module/components/visual-editor/index.mjs +6 -15
- package/build-module/components/visual-editor/index.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +44 -2
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +155 -21
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +25 -0
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +0 -13
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/media-finalize/index.mjs +12 -0
- package/build-module/utils/media-finalize/index.mjs.map +7 -0
- package/build-module/utils/media-upload/on-success.mjs +25 -0
- package/build-module/utils/media-upload/on-success.mjs.map +7 -0
- package/build-module/utils/sync-error-messages.mjs +27 -15
- package/build-module/utils/sync-error-messages.mjs.map +3 -3
- package/build-style/style-rtl.css +388 -132
- package/build-style/style.css +388 -132
- package/build-types/components/autocompleters/link.d.ts +8 -0
- package/build-types/components/autocompleters/link.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/add-note-menu-item.d.ts +5 -0
- package/build-types/components/collab-sidebar/add-note-menu-item.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/add-note.d.ts +6 -0
- package/build-types/components/collab-sidebar/add-note.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/board-store.d.ts +9 -0
- package/build-types/components/collab-sidebar/board-store.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/floating-container.d.ts +8 -0
- package/build-types/components/collab-sidebar/floating-container.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/note-byline.d.ts +10 -0
- package/build-types/components/collab-sidebar/note-byline.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note-card.d.ts +8 -0
- package/build-types/components/collab-sidebar/note-card.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note-form.d.ts +7 -0
- package/build-types/components/collab-sidebar/note-form.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts +5 -0
- package/build-types/components/collab-sidebar/note-indicator-toolbar.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note-thread.d.ts +11 -0
- package/build-types/components/collab-sidebar/note-thread.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/note.d.ts +9 -0
- package/build-types/components/collab-sidebar/note.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/notes.d.ts +7 -0
- package/build-types/components/collab-sidebar/notes.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/utils.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/avatar-iframe-styles.d.ts +11 -0
- package/build-types/components/collaborators-overlay/avatar-iframe-styles.d.ts.map +1 -0
- package/build-types/components/collaborators-overlay/collaborator-styles.d.ts +17 -2
- package/build-types/components/collaborators-overlay/collaborator-styles.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/compute-selection.d.ts +24 -0
- package/build-types/components/collaborators-overlay/compute-selection.d.ts.map +1 -0
- package/build-types/components/collaborators-overlay/cursor-dom-utils.d.ts +72 -0
- package/build-types/components/collaborators-overlay/cursor-dom-utils.d.ts.map +1 -0
- package/build-types/components/collaborators-overlay/cursor-registry.d.ts +36 -0
- package/build-types/components/collaborators-overlay/cursor-registry.d.ts.map +1 -0
- package/build-types/components/collaborators-overlay/index.d.ts +7 -4
- package/build-types/components/collaborators-overlay/index.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/overlay-iframe-styles.d.ts +6 -0
- package/build-types/components/collaborators-overlay/overlay-iframe-styles.d.ts.map +1 -0
- package/build-types/components/collaborators-overlay/overlay.d.ts +4 -1
- package/build-types/components/collaborators-overlay/overlay.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/timing-utils.d.ts +11 -0
- package/build-types/components/collaborators-overlay/timing-utils.d.ts.map +1 -0
- package/build-types/components/collaborators-overlay/use-block-highlighting.d.ts +21 -5
- package/build-types/components/collaborators-overlay/use-block-highlighting.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/use-debounced-recompute.d.ts +10 -0
- package/build-types/components/collaborators-overlay/use-debounced-recompute.d.ts.map +1 -0
- package/build-types/components/collaborators-overlay/use-render-cursors.d.ts +6 -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 +7 -0
- package/build-types/components/collaborators-presence/avatar/component.d.ts.map +1 -0
- package/build-types/components/collaborators-presence/avatar/index.d.ts +3 -0
- package/build-types/components/collaborators-presence/avatar/index.d.ts.map +1 -0
- package/build-types/components/collaborators-presence/avatar/types.d.ts +66 -0
- package/build-types/components/collaborators-presence/avatar/types.d.ts.map +1 -0
- package/build-types/components/collaborators-presence/avatar/use-image-loading-status.d.ts +17 -0
- package/build-types/components/collaborators-presence/avatar/use-image-loading-status.d.ts.map +1 -0
- package/build-types/components/collaborators-presence/avatar-group/component.d.ts +7 -0
- package/build-types/components/collaborators-presence/avatar-group/component.d.ts.map +1 -0
- package/build-types/components/collaborators-presence/avatar-group/index.d.ts +3 -0
- package/build-types/components/collaborators-presence/avatar-group/index.d.ts.map +1 -0
- package/build-types/components/collaborators-presence/avatar-group/types.d.ts +14 -0
- package/build-types/components/collaborators-presence/avatar-group/types.d.ts.map +1 -0
- package/build-types/components/collaborators-presence/index.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/list.d.ts +6 -2
- package/build-types/components/collaborators-presence/list.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/use-collaborator-notifications.d.ts +9 -0
- package/build-types/components/collaborators-presence/use-collaborator-notifications.d.ts.map +1 -0
- package/build-types/components/editor-interface/index.d.ts.map +1 -1
- package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
- package/build-types/components/media/media-editor-modal.d.ts +15 -0
- package/build-types/components/media/media-editor-modal.d.ts.map +1 -0
- package/build-types/components/post-last-revision/index.d.ts.map +1 -1
- package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
- package/build-types/components/post-revisions-panel/index.d.ts +2 -0
- package/build-types/components/post-revisions-panel/index.d.ts.map +1 -0
- package/build-types/components/post-revisions-preview/block-diff.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 +2 -5
- package/build-types/components/post-revisions-preview/revisions-canvas.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/revisions-header.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/revisions-slider.d.ts +1 -1
- package/build-types/components/post-revisions-preview/revisions-slider.d.ts.map +1 -1
- package/build-types/components/post-text-editor/utils.d.ts +29 -0
- package/build-types/components/post-text-editor/utils.d.ts.map +1 -0
- package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
- package/build-types/components/provider/use-network-reconnect.d.ts +8 -0
- package/build-types/components/provider/use-network-reconnect.d.ts.map +1 -0
- package/build-types/components/provider/use-post-content-block-types.d.ts +9 -0
- package/build-types/components/provider/use-post-content-block-types.d.ts.map +1 -0
- package/build-types/components/provider/use-revision-blocks.d.ts +10 -0
- package/build-types/components/provider/use-revision-blocks.d.ts.map +1 -0
- package/build-types/components/revision-block-diff/index.d.ts +6 -0
- package/build-types/components/revision-block-diff/index.d.ts.map +1 -0
- package/build-types/components/revision-diff-panel/index.d.ts +14 -0
- package/build-types/components/revision-diff-panel/index.d.ts.map +1 -0
- package/build-types/components/revision-fields-diff/index.d.ts +6 -0
- package/build-types/components/revision-fields-diff/index.d.ts.map +1 -0
- package/build-types/components/sidebar/dataform-post-summary.d.ts +4 -0
- package/build-types/components/sidebar/dataform-post-summary.d.ts.map +1 -0
- package/build-types/components/sidebar/index.d.ts.map +1 -1
- package/build-types/components/sidebar/post-revision-summary.d.ts +2 -0
- package/build-types/components/sidebar/post-revision-summary.d.ts.map +1 -0
- package/build-types/components/style-book/index.d.ts +2 -1
- package/build-types/components/style-book/index.d.ts.map +1 -1
- package/build-types/components/sync-connection-error-modal/index.d.ts +8 -0
- package/build-types/components/sync-connection-error-modal/index.d.ts.map +1 -0
- package/build-types/components/sync-connection-error-modal/use-retry-countdown.d.ts +11 -0
- package/build-types/components/sync-connection-error-modal/use-retry-countdown.d.ts.map +1 -0
- package/build-types/components/template-actions-panel/block-theme-content.d.ts +2 -0
- package/build-types/components/template-actions-panel/block-theme-content.d.ts.map +1 -0
- package/build-types/components/template-actions-panel/classic-theme-content.d.ts +2 -0
- package/build-types/components/template-actions-panel/classic-theme-content.d.ts.map +1 -0
- package/build-types/components/template-actions-panel/index.d.ts +2 -0
- package/build-types/components/template-actions-panel/index.d.ts.map +1 -0
- package/build-types/components/template-content-panel/index.d.ts.map +1 -1
- package/build-types/components/template-part-menu-items/convert-to-regular.d.ts.map +1 -1
- package/build-types/components/upload-progress-snackbar/index.d.ts +19 -0
- package/build-types/components/upload-progress-snackbar/index.d.ts.map +1 -0
- package/build-types/components/upload-progress-snackbar/stories/index.story.d.ts +28 -0
- package/build-types/components/upload-progress-snackbar/stories/index.story.d.ts.map +1 -0
- package/build-types/components/upload-progress-snackbar/tracker.d.ts +41 -0
- package/build-types/components/upload-progress-snackbar/tracker.d.ts.map +1 -0
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts +12 -0
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +45 -0
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +21 -0
- package/build-types/store/reducer.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/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 +2 -0
- package/build-types/utils/media-finalize/index.d.ts.map +1 -0
- package/build-types/utils/media-upload/on-success.d.ts +9 -0
- package/build-types/utils/media-upload/on-success.d.ts.map +1 -0
- package/build-types/utils/sync-error-messages.d.ts +17 -3
- package/build-types/utils/sync-error-messages.d.ts.map +1 -1
- package/package.json +45 -44
- package/src/components/collab-sidebar/index.js +7 -4
- package/src/components/collab-sidebar/utils.js +9 -10
- package/src/components/collaborators-overlay/avatar-iframe-styles.ts +134 -0
- package/src/components/collaborators-overlay/collaborator-styles.ts +43 -2
- package/src/components/collaborators-overlay/compute-selection.ts +315 -0
- package/src/components/collaborators-overlay/cursor-dom-utils.ts +382 -0
- package/src/components/collaborators-overlay/cursor-registry.ts +96 -0
- package/src/components/collaborators-overlay/index.tsx +12 -4
- package/src/components/collaborators-overlay/overlay-iframe-styles.ts +131 -0
- package/src/components/collaborators-overlay/overlay.tsx +145 -229
- package/src/components/collaborators-overlay/timing-utils.ts +30 -0
- package/src/components/collaborators-overlay/use-block-highlighting.ts +152 -64
- package/src/components/collaborators-overlay/use-debounced-recompute.ts +32 -0
- package/src/components/collaborators-overlay/use-render-cursors.ts +120 -282
- package/src/components/collaborators-presence/avatar/component.tsx +123 -0
- package/src/components/collaborators-presence/avatar/index.ts +2 -0
- package/src/components/collaborators-presence/avatar/styles.scss +184 -0
- package/src/components/collaborators-presence/avatar/test/index.tsx +389 -0
- package/src/components/collaborators-presence/avatar/types.ts +66 -0
- package/src/components/collaborators-presence/avatar/use-image-loading-status.ts +36 -0
- package/src/components/collaborators-presence/avatar-group/component.tsx +55 -0
- package/src/components/collaborators-presence/avatar-group/index.ts +2 -0
- package/src/components/collaborators-presence/avatar-group/styles.scss +33 -0
- package/src/components/collaborators-presence/avatar-group/test/index.tsx +139 -0
- package/src/components/collaborators-presence/avatar-group/types.ts +13 -0
- package/src/components/collaborators-presence/index.tsx +43 -12
- package/src/components/collaborators-presence/list.tsx +68 -40
- package/src/components/collaborators-presence/styles/collaborators-list.scss +26 -19
- package/src/components/collaborators-presence/styles/collaborators-presence.scss +6 -2
- package/src/components/collaborators-presence/test/use-collaborator-notifications.ts +397 -0
- package/src/components/collaborators-presence/use-collaborator-notifications.ts +203 -0
- package/src/components/document-bar/style.scss +1 -1
- package/src/components/editor-interface/index.js +13 -6
- package/src/components/inserter-sidebar/index.js +4 -1
- package/src/components/post-last-revision/index.js +35 -6
- package/src/components/post-last-revision/style.scss +0 -3
- package/src/components/post-locked-modal/index.js +69 -25
- package/src/components/post-panel-row/style.scss +1 -0
- package/src/components/post-revisions-preview/block-diff.js +224 -61
- package/src/components/post-revisions-preview/diff-markers.js +15 -12
- package/src/components/post-revisions-preview/revisions-canvas.js +23 -86
- package/src/components/post-revisions-preview/revisions-header.js +35 -37
- package/src/components/post-revisions-preview/revisions-slider.js +138 -62
- package/src/components/post-revisions-preview/style.scss +3 -3
- package/src/components/post-revisions-preview/test/block-diff.js +202 -35
- package/src/components/preferences-modal/index.js +37 -7
- package/src/components/provider/disable-non-page-content-blocks.js +42 -40
- package/src/components/provider/index.js +20 -2
- package/src/components/provider/use-block-editor-settings.js +21 -1
- package/src/components/provider/use-post-content-block-types.js +30 -0
- package/src/components/provider/use-revision-blocks.js +105 -0
- package/src/components/revision-block-diff/index.js +39 -0
- package/src/components/revision-diff-panel/index.js +59 -0
- package/src/components/revision-diff-panel/style.scss +13 -0
- package/src/components/revision-fields-diff/index.js +91 -0
- package/src/components/sidebar/header.js +1 -1
- package/src/components/sidebar/index.js +4 -0
- package/src/components/style-book/index.js +4 -2
- package/src/components/sync-connection-error-modal/index.tsx +253 -0
- package/src/components/sync-connection-error-modal/style.scss +14 -0
- package/src/components/sync-connection-error-modal/use-retry-countdown.ts +93 -0
- package/src/components/template-content-panel/index.js +30 -38
- package/src/components/template-part-menu-items/convert-to-regular.js +74 -12
- package/src/components/visual-editor/index.js +6 -23
- package/src/store/private-actions.js +70 -1
- package/src/store/private-selectors.js +216 -28
- package/src/store/reducer.js +41 -0
- package/src/store/selectors.js +0 -19
- package/src/style.scss +4 -1
- package/src/utils/media-finalize/index.js +11 -0
- package/src/utils/media-finalize/test/index.js +34 -0
- package/src/utils/media-upload/on-success.js +34 -0
- package/src/utils/sync-error-messages.ts +72 -0
- package/src/utils/test/sync-error-messages.js +34 -0
- package/build/components/provider/use-post-content-blocks.cjs.map +0 -7
- package/build/components/sync-connection-modal/index.cjs +0 -130
- package/build/components/sync-connection-modal/index.cjs.map +0 -7
- package/build-module/components/provider/use-post-content-blocks.mjs +0 -34
- package/build-module/components/provider/use-post-content-blocks.mjs.map +0 -7
- package/build-module/components/sync-connection-modal/index.mjs +0 -114
- package/build-module/components/sync-connection-modal/index.mjs.map +0 -7
- package/build-types/components/provider/use-post-content-blocks.d.ts +0 -2
- package/build-types/components/provider/use-post-content-blocks.d.ts.map +0 -1
- package/build-types/components/sync-connection-modal/index.d.ts +0 -8
- package/build-types/components/sync-connection-modal/index.d.ts.map +0 -1
- package/src/components/provider/use-post-content-blocks.js +0 -42
- package/src/components/sync-connection-modal/index.js +0 -140
- package/src/components/sync-connection-modal/style.scss +0 -11
- package/src/utils/sync-error-messages.js +0 -53
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
// packages/editor/src/components/post-revisions-preview/revisions-canvas.js
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import { Spinner } from "@wordpress/components";
|
|
4
|
-
import {
|
|
5
|
-
privateApis as blockEditorPrivateApis,
|
|
6
|
-
store as blockEditorStore
|
|
7
|
-
} from "@wordpress/block-editor";
|
|
8
|
-
import { createBlock, parse } from "@wordpress/blocks";
|
|
4
|
+
import { privateApis as blockEditorPrivateApis } from "@wordpress/block-editor";
|
|
9
5
|
import { useSelect } from "@wordpress/data";
|
|
10
|
-
import { useEffect
|
|
6
|
+
import { useEffect } from "@wordpress/element";
|
|
11
7
|
import { addFilter } from "@wordpress/hooks";
|
|
12
8
|
import { unlock } from "../../lock-unlock.mjs";
|
|
13
9
|
import { store as editorStore } from "../../store/index.mjs";
|
|
@@ -17,12 +13,8 @@ import {
|
|
|
17
13
|
unregisterDiffFormatTypes
|
|
18
14
|
} from "./diff-format-types.mjs";
|
|
19
15
|
import { useDiffMarkers } from "./diff-markers.mjs";
|
|
20
|
-
import { preserveClientIds } from "./preserve-client-ids.mjs";
|
|
21
|
-
import { diffRevisionContent } from "./block-diff.mjs";
|
|
22
16
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
-
var {
|
|
24
|
-
blockEditorPrivateApis
|
|
25
|
-
);
|
|
17
|
+
var { usePrivateStyleOverride } = unlock(blockEditorPrivateApis);
|
|
26
18
|
var REVISION_REMOVED_FILTER_SVG = `
|
|
27
19
|
<svg
|
|
28
20
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -49,14 +41,20 @@ var REVISION_REMOVED_FILTER_SVG = `
|
|
|
49
41
|
var REVISION_DIFF_STYLES = `
|
|
50
42
|
.is-revision-added {
|
|
51
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;
|
|
52
46
|
}
|
|
53
47
|
.is-revision-removed,
|
|
54
48
|
.revision-diff-removed {
|
|
55
49
|
text-decoration: line-through;
|
|
56
50
|
filter: url(#revision-removed-filter);
|
|
57
51
|
}
|
|
52
|
+
.is-revision-removed {
|
|
53
|
+
outline: 3px dashed #d63638;
|
|
54
|
+
outline-offset: 2px;
|
|
55
|
+
}
|
|
58
56
|
.is-revision-modified {
|
|
59
|
-
outline:
|
|
57
|
+
outline: 3px dotted #9a7000 !important;
|
|
60
58
|
outline-offset: 2px;
|
|
61
59
|
}
|
|
62
60
|
.revision-diff-added {
|
|
@@ -79,7 +77,7 @@ var REVISION_DIFF_STYLES = `
|
|
|
79
77
|
function withRevisionDiffClasses(BlockListBlock) {
|
|
80
78
|
return (props) => {
|
|
81
79
|
const { block, className } = props;
|
|
82
|
-
const diffStatus = block?.__revisionDiffStatus;
|
|
80
|
+
const diffStatus = block?.__revisionDiffStatus?.status;
|
|
83
81
|
const enhancedClassName = clsx(className, {
|
|
84
82
|
"is-revision-added": diffStatus === "added",
|
|
85
83
|
"is-revision-removed": diffStatus === "removed",
|
|
@@ -107,68 +105,23 @@ function CanvasContent({ showDiff }) {
|
|
|
107
105
|
showDiff && diffMarkers
|
|
108
106
|
] });
|
|
109
107
|
}
|
|
110
|
-
function RevisionsCanvas(
|
|
108
|
+
function RevisionsCanvas() {
|
|
111
109
|
useEffect(() => {
|
|
112
110
|
registerDiffFormatTypes();
|
|
113
111
|
return () => {
|
|
114
112
|
unregisterDiffFormatTypes();
|
|
115
113
|
};
|
|
116
114
|
}, []);
|
|
117
|
-
const { revision,
|
|
118
|
-
const {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
getCurrentPostType
|
|
122
|
-
} = unlock(select(editorStore));
|
|
115
|
+
const { revision, showDiff } = useSelect((select) => {
|
|
116
|
+
const { getCurrentRevision, isShowingRevisionDiff } = unlock(
|
|
117
|
+
select(editorStore)
|
|
118
|
+
);
|
|
123
119
|
return {
|
|
124
120
|
revision: getCurrentRevision(),
|
|
125
|
-
|
|
126
|
-
postType: getCurrentPostType(),
|
|
127
|
-
blockEditorSettings: select(blockEditorStore).getSettings()
|
|
121
|
+
showDiff: isShowingRevisionDiff()
|
|
128
122
|
};
|
|
129
123
|
}, []);
|
|
130
|
-
|
|
131
|
-
const blocks = useMemo(() => {
|
|
132
|
-
const currentContent = revision?.content?.raw ?? "";
|
|
133
|
-
let parsedBlocks;
|
|
134
|
-
if (showDiff) {
|
|
135
|
-
const previousContent = previousRevision?.content?.raw || "";
|
|
136
|
-
parsedBlocks = diffRevisionContent(
|
|
137
|
-
currentContent,
|
|
138
|
-
previousContent
|
|
139
|
-
);
|
|
140
|
-
} else {
|
|
141
|
-
parsedBlocks = parse(currentContent);
|
|
142
|
-
}
|
|
143
|
-
if (postType === "wp_navigation") {
|
|
144
|
-
parsedBlocks = [
|
|
145
|
-
createBlock(
|
|
146
|
-
"core/navigation",
|
|
147
|
-
{ templateLock: false },
|
|
148
|
-
parsedBlocks
|
|
149
|
-
)
|
|
150
|
-
];
|
|
151
|
-
}
|
|
152
|
-
const blocksWithStableIds = preserveClientIds(
|
|
153
|
-
parsedBlocks,
|
|
154
|
-
previousBlocksRef.current
|
|
155
|
-
);
|
|
156
|
-
previousBlocksRef.current = blocksWithStableIds;
|
|
157
|
-
return blocksWithStableIds;
|
|
158
|
-
}, [
|
|
159
|
-
revision?.content?.raw,
|
|
160
|
-
previousRevision?.content?.raw,
|
|
161
|
-
postType,
|
|
162
|
-
showDiff
|
|
163
|
-
]);
|
|
164
|
-
const settings = useMemo(
|
|
165
|
-
() => ({
|
|
166
|
-
...blockEditorSettings,
|
|
167
|
-
isPreviewMode: true
|
|
168
|
-
}),
|
|
169
|
-
[blockEditorSettings]
|
|
170
|
-
);
|
|
171
|
-
return revision ? /* @__PURE__ */ jsxs(ExperimentalBlockEditorProvider, { value: blocks, settings, children: [
|
|
124
|
+
return revision ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
172
125
|
/* @__PURE__ */ jsx(DiffStyleOverrides, { showDiff }),
|
|
173
126
|
/* @__PURE__ */ jsx("div", { className: "editor-revisions-canvas__content", children: /* @__PURE__ */ jsx(CanvasContent, { showDiff }) })
|
|
174
127
|
] }) : /* @__PURE__ */ jsx("div", { className: "editor-revisions-canvas__loading", children: /* @__PURE__ */ jsx(Spinner, {}) });
|
|
@@ -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 {
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,eAAe;AACxB
|
|
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) : (\n\t\t<div className=\"editor-revisions-canvas__loading\">\n\t\t\t<Spinner />\n\t\t</div>\n\t);\n}\n"],
|
|
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;AAuFtB,SA8BP,UA9BO,KA8BP,YA9BO;AArFT,IAAM,EAAE,wBAAwB,IAAI,OAAQ,sBAAuB;AAGnE,IAAM,8BAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4BpC,IAAM,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2C7B,SAAS,wBAAyB,gBAAiB;AAClD,SAAO,CAAE,UAAW;AACnB,UAAM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
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,48 +1,32 @@
|
|
|
1
1
|
// packages/editor/src/components/post-revisions-preview/revisions-header.js
|
|
2
2
|
import { useSelect, useDispatch } from "@wordpress/data";
|
|
3
|
-
import { useViewportMatch } from "@wordpress/compose";
|
|
4
3
|
import { Button } from "@wordpress/components";
|
|
5
|
-
import { store as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { seen } from "@wordpress/icons";
|
|
4
|
+
import { store as interfaceStore } from "@wordpress/interface";
|
|
5
|
+
import { __, _x, isRTL } from "@wordpress/i18n";
|
|
6
|
+
import { drawerLeft, drawerRight, seen } from "@wordpress/icons";
|
|
9
7
|
import HeaderSkeleton from "../header/header-skeleton.mjs";
|
|
10
8
|
import MoreMenu from "../more-menu/index.mjs";
|
|
11
9
|
import PostPreviewButton from "../post-preview-button/index.mjs";
|
|
12
|
-
import PreviewDropdown from "../preview-dropdown/index.mjs";
|
|
13
10
|
import RevisionsSlider from "./revisions-slider.mjs";
|
|
14
11
|
import { store as editorStore } from "../../store/index.mjs";
|
|
15
|
-
import {
|
|
16
|
-
TEMPLATE_PART_POST_TYPE,
|
|
17
|
-
PATTERN_POST_TYPE,
|
|
18
|
-
NAVIGATION_POST_TYPE
|
|
19
|
-
} from "../../store/constants.mjs";
|
|
12
|
+
import { sidebars } from "../sidebar/constants.mjs";
|
|
20
13
|
import { unlock } from "../../lock-unlock.mjs";
|
|
21
14
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
22
15
|
function RevisionsHeader({ showDiff, onToggleDiff }) {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
).getCurrentRevisionId()
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
[]
|
|
37
|
-
);
|
|
16
|
+
const { currentRevisionId, sidebarIsOpened } = useSelect((select) => {
|
|
17
|
+
return {
|
|
18
|
+
currentRevisionId: unlock(
|
|
19
|
+
select(editorStore)
|
|
20
|
+
).getCurrentRevisionId(),
|
|
21
|
+
sidebarIsOpened: !!select(interfaceStore).getActiveComplementaryArea(
|
|
22
|
+
"core"
|
|
23
|
+
)
|
|
24
|
+
};
|
|
25
|
+
}, []);
|
|
38
26
|
const { setCurrentRevisionId, restoreRevision } = unlock(
|
|
39
27
|
useDispatch(editorStore)
|
|
40
28
|
);
|
|
41
|
-
const
|
|
42
|
-
NAVIGATION_POST_TYPE,
|
|
43
|
-
TEMPLATE_PART_POST_TYPE,
|
|
44
|
-
PATTERN_POST_TYPE
|
|
45
|
-
].includes(postType);
|
|
29
|
+
const { enableComplementaryArea, disableComplementaryArea } = useDispatch(interfaceStore);
|
|
46
30
|
const canRestore = !!currentRevisionId;
|
|
47
31
|
const handleRestore = () => {
|
|
48
32
|
if (currentRevisionId) {
|
|
@@ -66,9 +50,28 @@ function RevisionsHeader({ showDiff, onToggleDiff }) {
|
|
|
66
50
|
),
|
|
67
51
|
center: /* @__PURE__ */ jsx(RevisionsSlider, {}),
|
|
68
52
|
settings: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
69
|
-
/* @__PURE__ */ jsx(PreviewDropdown, { disabled: disablePreviewOption }),
|
|
70
53
|
/* @__PURE__ */ jsx(PostPreviewButton, { className: "editor-header__post-preview-button" }),
|
|
71
|
-
|
|
54
|
+
/* @__PURE__ */ jsx(
|
|
55
|
+
Button,
|
|
56
|
+
{
|
|
57
|
+
__next40pxDefaultSize: true,
|
|
58
|
+
icon: isRTL() ? drawerLeft : drawerRight,
|
|
59
|
+
label: _x("Settings", "panel button label"),
|
|
60
|
+
isPressed: sidebarIsOpened,
|
|
61
|
+
"aria-expanded": sidebarIsOpened,
|
|
62
|
+
onClick: () => {
|
|
63
|
+
if (sidebarIsOpened) {
|
|
64
|
+
disableComplementaryArea("core");
|
|
65
|
+
} else {
|
|
66
|
+
enableComplementaryArea(
|
|
67
|
+
"core",
|
|
68
|
+
sidebars.document
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
size: "compact"
|
|
73
|
+
}
|
|
74
|
+
),
|
|
72
75
|
/* @__PURE__ */ jsx(
|
|
73
76
|
Button,
|
|
74
77
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/post-revisions-preview/revisions-header.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {
|
|
5
|
-
"mappings": ";AAGA,SAAS,WAAW,mBAAmB;AACvC,SAAS,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { __, _x, isRTL } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight, seen } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport HeaderSkeleton from '../header/header-skeleton';\nimport MoreMenu from '../more-menu';\nimport PostPreviewButton from '../post-preview-button';\nimport RevisionsSlider from './revisions-slider';\nimport { store as editorStore } from '../../store';\nimport { sidebars } from '../sidebar/constants';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Header component for revisions preview mode.\n *\n * @param {Object} props Component props.\n * @param {boolean} props.showDiff Whether diff highlighting is enabled.\n * @param {Function} props.onToggleDiff Callback to toggle diff highlighting.\n * @return {React.JSX.Element} The revisions header component.\n */\nfunction RevisionsHeader( { showDiff, onToggleDiff } ) {\n\tconst { currentRevisionId, sidebarIsOpened } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tcurrentRevisionId: unlock(\n\t\t\t\tselect( editorStore )\n\t\t\t).getCurrentRevisionId(),\n\t\t\tsidebarIsOpened:\n\t\t\t\t!! select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t\t'core'\n\t\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst { setCurrentRevisionId, restoreRevision } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\n\tconst { enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\n\tconst canRestore = !! currentRevisionId;\n\n\tconst handleRestore = () => {\n\t\tif ( currentRevisionId ) {\n\t\t\trestoreRevision( currentRevisionId );\n\t\t}\n\t};\n\n\treturn (\n\t\t<HeaderSkeleton\n\t\t\tclassName=\"editor-revisions-header\"\n\t\t\ttoolbar={\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\ticon={ seen }\n\t\t\t\t\tlabel={ _x( 'Show changes', 'revisions' ) }\n\t\t\t\t\tisPressed={ showDiff }\n\t\t\t\t\tonClick={ onToggleDiff }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tcenter={ <RevisionsSlider /> }\n\t\t\tsettings={\n\t\t\t\t<>\n\t\t\t\t\t<PostPreviewButton className=\"editor-header__post-preview-button\" />\n\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\t\t\t\tlabel={ _x( 'Settings', 'panel button label' ) }\n\t\t\t\t\t\tisPressed={ sidebarIsOpened }\n\t\t\t\t\t\taria-expanded={ sidebarIsOpened }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( sidebarIsOpened ) {\n\t\t\t\t\t\t\t\tdisableComplementaryArea( 'core' );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tenableComplementaryArea(\n\t\t\t\t\t\t\t\t\t'core',\n\t\t\t\t\t\t\t\t\tsidebars.document\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tonClick={ () => setCurrentRevisionId( null ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Exit' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tclassName=\"editor-revisions-header__restore-button\"\n\t\t\t\t\t\tdisabled={ ! canRestore }\n\t\t\t\t\t\tonClick={ handleRestore }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Restore' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<MoreMenu disabled />\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n\nexport default RevisionsHeader;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,WAAW,mBAAmB;AACvC,SAAS,cAAc;AACvB,SAAS,SAAS,sBAAsB;AACxC,SAAS,IAAI,IAAI,aAAa;AAC9B,SAAS,YAAY,aAAa,YAAY;AAK9C,OAAO,oBAAoB;AAC3B,OAAO,cAAc;AACrB,OAAO,uBAAuB;AAC9B,OAAO,qBAAqB;AAC5B,SAAS,SAAS,mBAAmB;AACrC,SAAS,gBAAgB;AACzB,SAAS,cAAc;AA0CnB,SAWA,UAXA,KAWA,YAXA;AAhCJ,SAAS,gBAAiB,EAAE,UAAU,aAAa,GAAI;AACtD,QAAM,EAAE,mBAAmB,gBAAgB,IAAI,UAAW,CAAE,WAAY;AACvE,WAAO;AAAA,MACN,mBAAmB;AAAA,QAClB,OAAQ,WAAY;AAAA,MACrB,EAAE,qBAAqB;AAAA,MACvB,iBACC,CAAC,CAAE,OAAQ,cAAe,EAAE;AAAA,QAC3B;AAAA,MACD;AAAA,IACF;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ACL,WAAU;AAAA,YACV,UAAW,CAAE;AAAA,YACb,SAAU;AAAA,YAER,aAAI,SAAU;AAAA;AAAA,QACjB;AAAA,QACA,oBAAC,YAAS,UAAQ,MAAC;AAAA,SACpB;AAAA;AAAA,EAEF;AAEF;AAEA,IAAO,2BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,77 +1,108 @@
|
|
|
1
1
|
// packages/editor/src/components/post-revisions-preview/revisions-slider.js
|
|
2
|
-
import { useMemo } from "@wordpress/element";
|
|
3
2
|
import { useSelect, useDispatch } from "@wordpress/data";
|
|
4
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
RangeControl,
|
|
5
|
+
Spinner,
|
|
6
|
+
Button,
|
|
7
|
+
__experimentalHStack as HStack
|
|
8
|
+
} from "@wordpress/components";
|
|
5
9
|
import { store as coreStore } from "@wordpress/core-data";
|
|
6
|
-
import { __ } from "@wordpress/i18n";
|
|
10
|
+
import { __, sprintf } from "@wordpress/i18n";
|
|
7
11
|
import { dateI18n, getSettings as getDateSettings } from "@wordpress/date";
|
|
12
|
+
import { useMemo } from "@wordpress/element";
|
|
13
|
+
import { chevronLeft, chevronRight } from "@wordpress/icons";
|
|
8
14
|
import { store as editorStore } from "../../store/index.mjs";
|
|
9
15
|
import { unlock } from "../../lock-unlock.mjs";
|
|
10
|
-
import { jsx } from "react/jsx-runtime";
|
|
16
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
17
|
function RevisionsSlider() {
|
|
12
|
-
const {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
18
|
+
const {
|
|
19
|
+
revisions: rawRevisions,
|
|
20
|
+
perPage,
|
|
21
|
+
currentRevisionId,
|
|
22
|
+
revisionKey,
|
|
23
|
+
revisionPage,
|
|
24
|
+
totalRevisions
|
|
25
|
+
} = useSelect((select) => {
|
|
26
|
+
const {
|
|
27
|
+
getCurrentRevisionId,
|
|
28
|
+
getRevisionPage,
|
|
29
|
+
getPageRevisions,
|
|
30
|
+
getRevisionsPerPage
|
|
31
|
+
} = unlock(select(editorStore));
|
|
32
|
+
const postType = select(editorStore).getCurrentPostType();
|
|
33
|
+
if (!postType) {
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
const entityConfig = select(coreStore).getEntityConfig(
|
|
37
|
+
"postType",
|
|
38
|
+
postType
|
|
39
|
+
);
|
|
40
|
+
const _revisionKey = entityConfig?.revisionKey || "id";
|
|
41
|
+
const _revisionPage = getRevisionPage();
|
|
42
|
+
return {
|
|
43
|
+
revisions: getPageRevisions(_revisionPage),
|
|
44
|
+
perPage: getRevisionsPerPage(),
|
|
45
|
+
currentRevisionId: getCurrentRevisionId(),
|
|
46
|
+
revisionKey: _revisionKey,
|
|
47
|
+
revisionPage: _revisionPage,
|
|
48
|
+
totalRevisions: select(editorStore).getCurrentPostRevisionsCount()
|
|
49
|
+
};
|
|
50
|
+
}, []);
|
|
51
|
+
const { setCurrentRevisionId, setRevisionPage } = unlock(
|
|
52
|
+
useDispatch(editorStore)
|
|
53
|
+
);
|
|
54
|
+
const isLoading = !rawRevisions;
|
|
55
|
+
const totalPages = Math.ceil(totalRevisions / perPage) || 1;
|
|
56
|
+
const revisions = useMemo(
|
|
57
|
+
() => rawRevisions && [...rawRevisions].reverse(),
|
|
58
|
+
[rawRevisions]
|
|
36
59
|
);
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
return revisions?.slice().sort((a, b) => new Date(a.date) - new Date(b.date)) ?? [];
|
|
40
|
-
}, [revisions]);
|
|
41
|
-
const selectedIndex = sortedRevisions.findIndex(
|
|
42
|
-
(r) => r.id === currentRevisionId
|
|
60
|
+
const selectedIndex = revisions?.findIndex(
|
|
61
|
+
(r) => r[revisionKey] === currentRevisionId
|
|
43
62
|
);
|
|
44
63
|
const handleSliderChange = (index) => {
|
|
45
|
-
const revision =
|
|
64
|
+
const revision = revisions?.[index];
|
|
46
65
|
if (revision) {
|
|
47
|
-
setCurrentRevisionId(revision
|
|
66
|
+
setCurrentRevisionId(revision[revisionKey]);
|
|
48
67
|
}
|
|
49
68
|
};
|
|
50
69
|
const dateSettings = getDateSettings();
|
|
51
70
|
const renderTooltipContent = (index) => {
|
|
52
|
-
const revision =
|
|
71
|
+
const revision = revisions?.[index];
|
|
53
72
|
if (!revision) {
|
|
54
73
|
return index;
|
|
55
74
|
}
|
|
56
75
|
return dateI18n(dateSettings.formats.datetime, revision.date);
|
|
57
76
|
};
|
|
58
|
-
|
|
77
|
+
const showPagination = totalPages > 1;
|
|
78
|
+
if (isLoading && !showPagination) {
|
|
59
79
|
return /* @__PURE__ */ jsx(Spinner, {});
|
|
60
80
|
}
|
|
61
|
-
if (!
|
|
81
|
+
if (!isLoading && !revisions?.length) {
|
|
62
82
|
return /* @__PURE__ */ jsx("span", { className: "editor-revisions-header__no-revisions", children: __("No revisions found.") });
|
|
63
83
|
}
|
|
64
|
-
if (
|
|
84
|
+
if (totalRevisions <= 1) {
|
|
65
85
|
return /* @__PURE__ */ jsx("span", { className: "editor-revisions-header__no-revisions", children: __("Only one revision found.") });
|
|
66
86
|
}
|
|
67
|
-
|
|
87
|
+
const getPageRangeLabel = (page) => {
|
|
88
|
+
const end = totalRevisions - (page - 1) * perPage;
|
|
89
|
+
const start = Math.max(1, end - perPage + 1);
|
|
90
|
+
return sprintf(
|
|
91
|
+
/* translators: 1: first revision number, 2: last revision number */
|
|
92
|
+
__("Revisions %1$s\u2013%2$s"),
|
|
93
|
+
start,
|
|
94
|
+
end
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
const sliderOrSpinner = isLoading || selectedIndex === -1 ? /* @__PURE__ */ jsx(Spinner, {}) : /* @__PURE__ */ jsx(
|
|
68
98
|
RangeControl,
|
|
69
99
|
{
|
|
70
100
|
__next40pxDefaultSize: true,
|
|
101
|
+
"aria-valuetext": renderTooltipContent(selectedIndex),
|
|
71
102
|
className: "editor-revisions-header__slider",
|
|
72
103
|
hideLabelFromVision: true,
|
|
73
104
|
label: __("Revision"),
|
|
74
|
-
max:
|
|
105
|
+
max: revisions?.length - 1,
|
|
75
106
|
min: 0,
|
|
76
107
|
marks: true,
|
|
77
108
|
onChange: handleSliderChange,
|
|
@@ -80,6 +111,45 @@ function RevisionsSlider() {
|
|
|
80
111
|
withInputField: false
|
|
81
112
|
}
|
|
82
113
|
);
|
|
114
|
+
if (!showPagination) {
|
|
115
|
+
return sliderOrSpinner;
|
|
116
|
+
}
|
|
117
|
+
return /* @__PURE__ */ jsxs(HStack, { spacing: 2, expanded: true, wrap: false, children: [
|
|
118
|
+
/* @__PURE__ */ jsx(
|
|
119
|
+
Button,
|
|
120
|
+
{
|
|
121
|
+
icon: chevronLeft,
|
|
122
|
+
label: revisionPage < totalPages ? getPageRangeLabel(revisionPage + 1) : __("No older revisions"),
|
|
123
|
+
onClick: () => setRevisionPage(revisionPage + 1),
|
|
124
|
+
disabled: isLoading || revisionPage >= totalPages,
|
|
125
|
+
size: "compact",
|
|
126
|
+
accessibleWhenDisabled: true
|
|
127
|
+
}
|
|
128
|
+
),
|
|
129
|
+
/* @__PURE__ */ jsx(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
style: {
|
|
133
|
+
flex: 1,
|
|
134
|
+
minWidth: 0,
|
|
135
|
+
display: "flex",
|
|
136
|
+
justifyContent: "center"
|
|
137
|
+
},
|
|
138
|
+
children: sliderOrSpinner
|
|
139
|
+
}
|
|
140
|
+
),
|
|
141
|
+
/* @__PURE__ */ jsx(
|
|
142
|
+
Button,
|
|
143
|
+
{
|
|
144
|
+
icon: chevronRight,
|
|
145
|
+
label: revisionPage > 1 ? getPageRangeLabel(revisionPage - 1) : __("No newer revisions"),
|
|
146
|
+
onClick: () => setRevisionPage(revisionPage - 1),
|
|
147
|
+
disabled: isLoading || revisionPage <= 1,
|
|
148
|
+
size: "compact",
|
|
149
|
+
accessibleWhenDisabled: true
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
] });
|
|
83
153
|
}
|
|
84
154
|
var revisions_slider_default = RevisionsSlider;
|
|
85
155
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/post-revisions-preview/revisions-slider.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {
|
|
5
|
-
"mappings": ";AAGA,SAAS,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tRangeControl,\n\tSpinner,\n\tButton,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { dateI18n, getSettings as getDateSettings } from '@wordpress/date';\nimport { useMemo } from '@wordpress/element';\nimport { chevronLeft, chevronRight } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n/**\n * Slider component for navigating revisions with pagination.\n *\n * @return {React.JSX.Element} The revisions slider component.\n */\nfunction RevisionsSlider() {\n\tconst {\n\t\trevisions: rawRevisions,\n\t\tperPage,\n\t\tcurrentRevisionId,\n\t\trevisionKey,\n\t\trevisionPage,\n\t\ttotalRevisions,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentRevisionId,\n\t\t\tgetRevisionPage,\n\t\t\tgetPageRevisions,\n\t\t\tgetRevisionsPerPage,\n\t\t} = unlock( select( editorStore ) );\n\n\t\tconst postType = select( editorStore ).getCurrentPostType();\n\t\tif ( ! postType ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst entityConfig = select( coreStore ).getEntityConfig(\n\t\t\t'postType',\n\t\t\tpostType\n\t\t);\n\t\tconst _revisionKey = entityConfig?.revisionKey || 'id';\n\t\tconst _revisionPage = getRevisionPage();\n\n\t\treturn {\n\t\t\trevisions: getPageRevisions( _revisionPage ),\n\t\t\tperPage: getRevisionsPerPage(),\n\t\t\tcurrentRevisionId: getCurrentRevisionId(),\n\t\t\trevisionKey: _revisionKey,\n\t\t\trevisionPage: _revisionPage,\n\t\t\ttotalRevisions:\n\t\t\t\tselect( editorStore ).getCurrentPostRevisionsCount(),\n\t\t};\n\t}, [] );\n\n\tconst { setCurrentRevisionId, setRevisionPage } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\n\tconst isLoading = ! rawRevisions;\n\tconst totalPages = Math.ceil( totalRevisions / perPage ) || 1;\n\n\t// Reverse desc\u2192asc so the slider reads oldest (left) \u2192 newest (right).\n\tconst revisions = useMemo(\n\t\t() => rawRevisions && [ ...rawRevisions ].reverse(),\n\t\t[ rawRevisions ]\n\t);\n\n\tconst selectedIndex = revisions?.findIndex(\n\t\t( r ) => r[ revisionKey ] === currentRevisionId\n\t);\n\n\tconst handleSliderChange = ( index ) => {\n\t\tconst revision = revisions?.[ index ];\n\t\tif ( revision ) {\n\t\t\tsetCurrentRevisionId( revision[ revisionKey ] );\n\t\t}\n\t};\n\n\t// Format date for tooltip.\n\tconst dateSettings = getDateSettings();\n\tconst renderTooltipContent = ( index ) => {\n\t\tconst revision = revisions?.[ index ];\n\t\tif ( ! revision ) {\n\t\t\treturn index;\n\t\t}\n\t\treturn dateI18n( dateSettings.formats.datetime, revision.date );\n\t};\n\n\tconst showPagination = totalPages > 1;\n\n\tif ( isLoading && ! showPagination ) {\n\t\treturn <Spinner />;\n\t}\n\n\tif ( ! isLoading && ! revisions?.length ) {\n\t\treturn (\n\t\t\t<span className=\"editor-revisions-header__no-revisions\">\n\t\t\t\t{ __( 'No revisions found.' ) }\n\t\t\t</span>\n\t\t);\n\t}\n\n\tif ( totalRevisions <= 1 ) {\n\t\treturn (\n\t\t\t<span className=\"editor-revisions-header__no-revisions\">\n\t\t\t\t{ __( 'Only one revision found.' ) }\n\t\t\t</span>\n\t\t);\n\t}\n\n\tconst getPageRangeLabel = ( page ) => {\n\t\tconst end = totalRevisions - ( page - 1 ) * perPage;\n\t\tconst start = Math.max( 1, end - perPage + 1 );\n\t\treturn sprintf(\n\t\t\t/* translators: 1: first revision number, 2: last revision number */\n\t\t\t__( 'Revisions %1$s\u2013%2$s' ),\n\t\t\tstart,\n\t\t\tend\n\t\t);\n\t};\n\n\tconst sliderOrSpinner =\n\t\tisLoading || selectedIndex === -1 ? (\n\t\t\t<Spinner />\n\t\t) : (\n\t\t\t<RangeControl\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\taria-valuetext={ renderTooltipContent( selectedIndex ) }\n\t\t\t\tclassName=\"editor-revisions-header__slider\"\n\t\t\t\thideLabelFromVision\n\t\t\t\tlabel={ __( 'Revision' ) }\n\t\t\t\tmax={ revisions?.length - 1 }\n\t\t\t\tmin={ 0 }\n\t\t\t\tmarks\n\t\t\t\tonChange={ handleSliderChange }\n\t\t\t\trenderTooltipContent={ renderTooltipContent }\n\t\t\t\tvalue={ selectedIndex }\n\t\t\t\twithInputField={ false }\n\t\t\t/>\n\t\t);\n\n\tif ( ! showPagination ) {\n\t\treturn sliderOrSpinner;\n\t}\n\n\treturn (\n\t\t<HStack spacing={ 2 } expanded wrap={ false }>\n\t\t\t<Button\n\t\t\t\ticon={ chevronLeft }\n\t\t\t\tlabel={\n\t\t\t\t\trevisionPage < totalPages\n\t\t\t\t\t\t? getPageRangeLabel( revisionPage + 1 )\n\t\t\t\t\t\t: __( 'No older revisions' )\n\t\t\t\t}\n\t\t\t\tonClick={ () => setRevisionPage( revisionPage + 1 ) }\n\t\t\t\tdisabled={ isLoading || revisionPage >= totalPages }\n\t\t\t\tsize=\"compact\"\n\t\t\t\taccessibleWhenDisabled\n\t\t\t/>\n\t\t\t<div\n\t\t\t\tstyle={ {\n\t\t\t\t\tflex: 1,\n\t\t\t\t\tminWidth: 0,\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ sliderOrSpinner }\n\t\t\t</div>\n\t\t\t<Button\n\t\t\t\ticon={ chevronRight }\n\t\t\t\tlabel={\n\t\t\t\t\trevisionPage > 1\n\t\t\t\t\t\t? getPageRangeLabel( revisionPage - 1 )\n\t\t\t\t\t\t: __( 'No newer revisions' )\n\t\t\t\t}\n\t\t\t\tonClick={ () => setRevisionPage( revisionPage - 1 ) }\n\t\t\t\tdisabled={ isLoading || revisionPage <= 1 }\n\t\t\t\tsize=\"compact\"\n\t\t\t\taccessibleWhenDisabled\n\t\t\t/>\n\t\t</HStack>\n\t);\n}\n\nexport default RevisionsSlider;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,WAAW,mBAAmB;AACvC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,OAClB;AACP,SAAS,SAAS,iBAAiB;AACnC,SAAS,IAAI,eAAe;AAC5B,SAAS,UAAU,eAAe,uBAAuB;AACzD,SAAS,eAAe;AACxB,SAAS,aAAa,oBAAoB;AAK1C,SAAS,SAAS,mBAAmB;AACrC,SAAS,cAAc;AAmFd,cAuDP,YAvDO;AA5ET,SAAS,kBAAkB;AAC1B,QAAM;AAAA,IACL,WAAW;AAAA,IACX;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,IACD,IAAI,OAAQ,OAAQ,WAAY,CAAE;AAElC,UAAM,WAAW,OAAQ,WAAY,EAAE,mBAAmB;AAC1D,QAAK,CAAE,UAAW;AACjB,aAAO,CAAC;AAAA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,MAAO;AAAA,QACP,OACC,eAAe,IACZ,kBAAmB,eAAe,CAAE,IACpC,GAAI,oBAAqB;AAAA,QAE7B,SAAU,MAAM,gBAAiB,eAAe,CAAE;AAAA,QAClD,UAAW,aAAa,gBAAgB;AAAA,QACxC,MAAK;AAAA,QACL,wBAAsB;AAAA;AAAA,IACvB;AAAA,KACD;AAEF;AAEA,IAAO,2BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -38,13 +38,16 @@ function EditorPreferencesModal({ extraSections = {} }) {
|
|
|
38
38
|
}
|
|
39
39
|
function PreferencesModalContents({ extraSections = {} }) {
|
|
40
40
|
const isLargeViewport = useViewportMatch("medium");
|
|
41
|
-
const showBlockBreadcrumbsOption = useSelect(
|
|
41
|
+
const { showBlockBreadcrumbsOption, showCollaborationOptions } = useSelect(
|
|
42
42
|
(select) => {
|
|
43
|
-
const { getEditorSettings } = select(editorStore);
|
|
43
|
+
const { getEditorSettings, isCollaborationEnabledForCurrentPost } = unlock(select(editorStore));
|
|
44
44
|
const { get } = select(preferencesStore);
|
|
45
45
|
const isRichEditingEnabled = getEditorSettings().richEditingEnabled;
|
|
46
46
|
const isDistractionFreeEnabled = get("core", "distractionFree");
|
|
47
|
-
return
|
|
47
|
+
return {
|
|
48
|
+
showBlockBreadcrumbsOption: !isDistractionFreeEnabled && isLargeViewport && isRichEditingEnabled,
|
|
49
|
+
showCollaborationOptions: isCollaborationEnabledForCurrentPost()
|
|
50
|
+
};
|
|
48
51
|
},
|
|
49
52
|
[isLargeViewport]
|
|
50
53
|
);
|
|
@@ -106,7 +109,35 @@ function PreferencesModalContents({ extraSections = {} }) {
|
|
|
106
109
|
),
|
|
107
110
|
label: __("Show starter patterns")
|
|
108
111
|
}
|
|
109
|
-
)
|
|
112
|
+
),
|
|
113
|
+
showCollaborationOptions && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
114
|
+
/* @__PURE__ */ jsx(
|
|
115
|
+
PreferenceToggleControl,
|
|
116
|
+
{
|
|
117
|
+
scope: "core",
|
|
118
|
+
featureName: "showCollaborationCursor",
|
|
119
|
+
help: __(
|
|
120
|
+
"Show your own avatar inside blocks during collaborative editing sessions."
|
|
121
|
+
),
|
|
122
|
+
label: __(
|
|
123
|
+
"Show avatar in blocks"
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
/* @__PURE__ */ jsx(
|
|
128
|
+
PreferenceToggleControl,
|
|
129
|
+
{
|
|
130
|
+
scope: "core",
|
|
131
|
+
featureName: "showCollaborationNotifications",
|
|
132
|
+
help: __(
|
|
133
|
+
"Show notifications when collaborators join, leave, or save the post."
|
|
134
|
+
),
|
|
135
|
+
label: __(
|
|
136
|
+
"Show collaboration notifications"
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
] })
|
|
110
141
|
]
|
|
111
142
|
}
|
|
112
143
|
),
|
|
@@ -363,6 +394,7 @@ function PreferencesModalContents({ extraSections = {} }) {
|
|
|
363
394
|
].filter(Boolean),
|
|
364
395
|
[
|
|
365
396
|
showBlockBreadcrumbsOption,
|
|
397
|
+
showCollaborationOptions,
|
|
366
398
|
extraSections,
|
|
367
399
|
setIsInserterOpened,
|
|
368
400
|
setIsListViewOpened,
|