@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
|
@@ -34,6 +34,7 @@ import { unlock } from '../../lock-unlock';
|
|
|
34
34
|
import DisableNonPageContentBlocks from './disable-non-page-content-blocks';
|
|
35
35
|
import NavigationBlockEditingMode from './navigation-block-editing-mode';
|
|
36
36
|
import { useHideBlocksFromInserter } from './use-hide-blocks-from-inserter';
|
|
37
|
+
import { useRevisionBlocks } from './use-revision-blocks';
|
|
37
38
|
import useCommands from '../commands';
|
|
38
39
|
import useUploadSaveLock from './use-upload-save-lock';
|
|
39
40
|
import BlockRemovalWarnings from '../block-removal-warnings';
|
|
@@ -78,6 +79,7 @@ const NON_CONTEXTUAL_POST_TYPES = [
|
|
|
78
79
|
* @return {Array} Block editor props.
|
|
79
80
|
*/
|
|
80
81
|
function useBlockEditorProps( post, template, mode ) {
|
|
82
|
+
const revisionBlocks = useRevisionBlocks();
|
|
81
83
|
const rootLevelPost = mode === 'template-locked' ? 'template' : 'post';
|
|
82
84
|
const [ postBlocks, onInput, onChange ] = useEntityBlockEditor(
|
|
83
85
|
'postType',
|
|
@@ -116,6 +118,11 @@ function useBlockEditorProps( post, template, mode ) {
|
|
|
116
118
|
return postBlocks;
|
|
117
119
|
}, [ maybeNavigationBlocks, rootLevelPost, templateBlocks, postBlocks ] );
|
|
118
120
|
|
|
121
|
+
// In revisions mode, use the revision blocks and disable editing.
|
|
122
|
+
if ( revisionBlocks !== null ) {
|
|
123
|
+
return [ revisionBlocks, noop, noop ];
|
|
124
|
+
}
|
|
125
|
+
|
|
119
126
|
// Handle fallback to postBlocks outside of the above useMemo, to ensure
|
|
120
127
|
// that constructed block templates that call `createBlock` are not generated
|
|
121
128
|
// too frequently. This ensures that clientIds are stable.
|
|
@@ -177,6 +184,8 @@ export const ExperimentalEditorProvider = withRegistryProvider(
|
|
|
177
184
|
mode,
|
|
178
185
|
defaultMode,
|
|
179
186
|
postTypeEntities,
|
|
187
|
+
isInRevisionsMode,
|
|
188
|
+
currentRevisionId,
|
|
180
189
|
} = useSelect(
|
|
181
190
|
( select ) => {
|
|
182
191
|
const {
|
|
@@ -184,6 +193,8 @@ export const ExperimentalEditorProvider = withRegistryProvider(
|
|
|
184
193
|
getRenderingMode,
|
|
185
194
|
__unstableIsEditorReady,
|
|
186
195
|
getDefaultRenderingMode,
|
|
196
|
+
isRevisionsMode: _isRevisionsMode,
|
|
197
|
+
getCurrentRevisionId: _getCurrentRevisionId,
|
|
187
198
|
} = unlock( select( editorStore ) );
|
|
188
199
|
const { getEntitiesConfig, getEntityRecordEdits } =
|
|
189
200
|
select( coreStore );
|
|
@@ -224,6 +235,8 @@ export const ExperimentalEditorProvider = withRegistryProvider(
|
|
|
224
235
|
post.type === 'wp_template'
|
|
225
236
|
? getEntitiesConfig( 'postType' )
|
|
226
237
|
: null,
|
|
238
|
+
isInRevisionsMode: _isRevisionsMode(),
|
|
239
|
+
currentRevisionId: _getCurrentRevisionId(),
|
|
227
240
|
};
|
|
228
241
|
},
|
|
229
242
|
[ post.type, post.id, hasTemplate ]
|
|
@@ -418,14 +431,19 @@ export const ExperimentalEditorProvider = withRegistryProvider(
|
|
|
418
431
|
kind="postType"
|
|
419
432
|
type={ post.type }
|
|
420
433
|
id={ post.id }
|
|
434
|
+
revisionId={ currentRevisionId ?? undefined }
|
|
421
435
|
>
|
|
422
436
|
<BlockContextProvider value={ defaultBlockContext }>
|
|
423
437
|
<BlockEditorProviderComponent
|
|
424
438
|
value={ blocks }
|
|
425
439
|
onChange={ onChange }
|
|
426
440
|
onInput={ onInput }
|
|
427
|
-
selection={
|
|
428
|
-
|
|
441
|
+
selection={
|
|
442
|
+
isInRevisionsMode ? undefined : selection
|
|
443
|
+
}
|
|
444
|
+
onChangeSelection={
|
|
445
|
+
isInRevisionsMode ? noop : onChangeSelection
|
|
446
|
+
}
|
|
429
447
|
settings={ blockEditorSettings }
|
|
430
448
|
useSubRegistry={ false }
|
|
431
449
|
>
|
|
@@ -23,7 +23,9 @@ import {
|
|
|
23
23
|
*/
|
|
24
24
|
import inserterMediaCategories from '../media-categories';
|
|
25
25
|
import { mediaUpload } from '../../utils';
|
|
26
|
+
import mediaUploadOnSuccess from '../../utils/media-upload/on-success';
|
|
26
27
|
import { default as mediaSideload } from '../../utils/media-sideload';
|
|
28
|
+
import { default as mediaFinalize } from '../../utils/media-finalize';
|
|
27
29
|
import { store as editorStore } from '../../store';
|
|
28
30
|
import { unlock } from '../../lock-unlock';
|
|
29
31
|
import { useGlobalStylesContext } from '../global-styles-provider';
|
|
@@ -103,6 +105,7 @@ const {
|
|
|
103
105
|
isIsolatedEditorKey,
|
|
104
106
|
deviceTypeKey,
|
|
105
107
|
isNavigationOverlayContextKey,
|
|
108
|
+
mediaUploadOnSuccessKey,
|
|
106
109
|
} = unlock( privateApis );
|
|
107
110
|
|
|
108
111
|
/**
|
|
@@ -137,6 +140,7 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
|
|
|
137
140
|
sectionRootClientId,
|
|
138
141
|
deviceType,
|
|
139
142
|
isNavigationOverlayContext,
|
|
143
|
+
isRevisionsMode,
|
|
140
144
|
} = useSelect(
|
|
141
145
|
( select ) => {
|
|
142
146
|
const {
|
|
@@ -148,7 +152,9 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
|
|
|
148
152
|
} = select( coreStore );
|
|
149
153
|
const { get } = select( preferencesStore );
|
|
150
154
|
const { getBlockTypes } = select( blocksStore );
|
|
151
|
-
const { getDeviceType } = unlock(
|
|
155
|
+
const { getDeviceType, isRevisionsMode: _isRevisionsMode } = unlock(
|
|
156
|
+
select( editorStore )
|
|
157
|
+
);
|
|
152
158
|
const { getBlocksByName, getBlockAttributes } =
|
|
153
159
|
select( blockEditorStore );
|
|
154
160
|
const siteSettings = canUser( 'read', {
|
|
@@ -216,6 +222,7 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
|
|
|
216
222
|
postId
|
|
217
223
|
)?.area === 'navigation-overlay'
|
|
218
224
|
: false,
|
|
225
|
+
isRevisionsMode: _isRevisionsMode(),
|
|
219
226
|
};
|
|
220
227
|
},
|
|
221
228
|
[ postType, postId, isLargeViewport, renderingMode ]
|
|
@@ -336,7 +343,11 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
|
|
|
336
343
|
? editMediaEntity
|
|
337
344
|
: undefined,
|
|
338
345
|
mediaUpload: hasUploadPermissions ? mediaUpload : undefined,
|
|
346
|
+
[ mediaUploadOnSuccessKey ]: hasUploadPermissions
|
|
347
|
+
? mediaUploadOnSuccess
|
|
348
|
+
: undefined,
|
|
339
349
|
mediaSideload: hasUploadPermissions ? mediaSideload : undefined,
|
|
350
|
+
mediaFinalize: hasUploadPermissions ? mediaFinalize : undefined,
|
|
340
351
|
__experimentalBlockPatterns: blockPatterns,
|
|
341
352
|
[ selectBlockPatternsKey ]: ( select ) => {
|
|
342
353
|
const { hasFinishedResolution, getBlockPatternsForPostType } =
|
|
@@ -386,12 +397,21 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
|
|
|
386
397
|
'wp_block',
|
|
387
398
|
'wp_navigation',
|
|
388
399
|
].includes( postType ),
|
|
400
|
+
// When in template-locked mode (e.g., "Show Template" in the post editor),
|
|
401
|
+
// don't treat template parts as contentOnly sections.
|
|
402
|
+
disableContentOnlyForTemplateParts:
|
|
403
|
+
renderingMode === 'template-locked',
|
|
389
404
|
...( deviceType ? { [ deviceTypeKey ]: deviceType } : {} ),
|
|
390
405
|
[ isNavigationOverlayContextKey ]: isNavigationOverlayContext,
|
|
391
406
|
};
|
|
392
407
|
|
|
408
|
+
if ( isRevisionsMode ) {
|
|
409
|
+
blockEditorSettings.isPreviewMode = true;
|
|
410
|
+
}
|
|
411
|
+
|
|
393
412
|
return blockEditorSettings;
|
|
394
413
|
}, [
|
|
414
|
+
isRevisionsMode,
|
|
395
415
|
allowedBlockTypes,
|
|
396
416
|
allowRightClickOverrides,
|
|
397
417
|
focusMode,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useMemo } from '@wordpress/element';
|
|
5
|
+
import { applyFilters } from '@wordpress/hooks';
|
|
6
|
+
|
|
7
|
+
const POST_CONTENT_BLOCK_TYPES = [
|
|
8
|
+
'core/post-title',
|
|
9
|
+
'core/post-featured-image',
|
|
10
|
+
'core/post-content',
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Returns the list of post content block types, including any added via the
|
|
15
|
+
* `editor.postContentBlockTypes` filter. The result is memoized so it can be
|
|
16
|
+
* used as a stable dependency in `useSelect` calls.
|
|
17
|
+
*
|
|
18
|
+
* @return {string[]} Block type names considered post content.
|
|
19
|
+
*/
|
|
20
|
+
export default function usePostContentBlockTypes() {
|
|
21
|
+
return useMemo(
|
|
22
|
+
() => [
|
|
23
|
+
...applyFilters(
|
|
24
|
+
'editor.postContentBlockTypes',
|
|
25
|
+
POST_CONTENT_BLOCK_TYPES
|
|
26
|
+
),
|
|
27
|
+
],
|
|
28
|
+
[]
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
|
+
import { useMemo, useRef } from '@wordpress/element';
|
|
6
|
+
import { createBlock, parse } from '@wordpress/blocks';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import { store as editorStore } from '../../store';
|
|
12
|
+
import { unlock } from '../../lock-unlock';
|
|
13
|
+
import { diffRevisionContent } from '../post-revisions-preview/block-diff';
|
|
14
|
+
import { preserveClientIds } from '../post-revisions-preview/preserve-client-ids';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Hook that computes revision blocks when in revisions mode.
|
|
18
|
+
*
|
|
19
|
+
* Returns `null` when not in revisions mode, `[]` when loading,
|
|
20
|
+
* or the computed blocks array when ready.
|
|
21
|
+
*
|
|
22
|
+
* @return {Array|null} The revision blocks, or null if not in revisions mode.
|
|
23
|
+
*/
|
|
24
|
+
export function useRevisionBlocks() {
|
|
25
|
+
const {
|
|
26
|
+
isInRevisionsMode,
|
|
27
|
+
showDiff,
|
|
28
|
+
revision,
|
|
29
|
+
previousRevision,
|
|
30
|
+
postType,
|
|
31
|
+
} = useSelect( ( select ) => {
|
|
32
|
+
const {
|
|
33
|
+
isRevisionsMode,
|
|
34
|
+
isShowingRevisionDiff,
|
|
35
|
+
getCurrentRevision,
|
|
36
|
+
getPreviousRevision,
|
|
37
|
+
} = unlock( select( editorStore ) );
|
|
38
|
+
const { getCurrentPostType } = select( editorStore );
|
|
39
|
+
|
|
40
|
+
const inRevisions = isRevisionsMode();
|
|
41
|
+
return {
|
|
42
|
+
isInRevisionsMode: inRevisions,
|
|
43
|
+
showDiff: isShowingRevisionDiff(),
|
|
44
|
+
revision: inRevisions ? getCurrentRevision() : undefined,
|
|
45
|
+
previousRevision: inRevisions ? getPreviousRevision() : undefined,
|
|
46
|
+
postType: getCurrentPostType(),
|
|
47
|
+
};
|
|
48
|
+
}, [] );
|
|
49
|
+
|
|
50
|
+
// Track previously rendered blocks to preserve clientIds between renders.
|
|
51
|
+
const previousBlocksRef = useRef( [] );
|
|
52
|
+
|
|
53
|
+
const blocks = useMemo( () => {
|
|
54
|
+
if ( ! isInRevisionsMode ) {
|
|
55
|
+
// Clear the ref when exiting revisions mode.
|
|
56
|
+
previousBlocksRef.current = [];
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Revision not loaded yet.
|
|
61
|
+
if ( ! revision ) {
|
|
62
|
+
return [];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const currentContent = revision?.content?.raw ?? '';
|
|
66
|
+
|
|
67
|
+
let parsedBlocks;
|
|
68
|
+
if ( showDiff ) {
|
|
69
|
+
const previousContent = previousRevision?.content?.raw || '';
|
|
70
|
+
parsedBlocks = diffRevisionContent(
|
|
71
|
+
currentContent,
|
|
72
|
+
previousContent
|
|
73
|
+
);
|
|
74
|
+
} else {
|
|
75
|
+
parsedBlocks = parse( currentContent );
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if ( postType === 'wp_navigation' ) {
|
|
79
|
+
parsedBlocks = [
|
|
80
|
+
createBlock(
|
|
81
|
+
'core/navigation',
|
|
82
|
+
{ templateLock: false },
|
|
83
|
+
parsedBlocks
|
|
84
|
+
),
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const blocksWithStableIds = preserveClientIds(
|
|
89
|
+
parsedBlocks,
|
|
90
|
+
previousBlocksRef.current
|
|
91
|
+
);
|
|
92
|
+
previousBlocksRef.current = blocksWithStableIds;
|
|
93
|
+
|
|
94
|
+
return blocksWithStableIds;
|
|
95
|
+
}, [
|
|
96
|
+
isInRevisionsMode,
|
|
97
|
+
revision,
|
|
98
|
+
revision?.content?.raw,
|
|
99
|
+
previousRevision?.content?.raw,
|
|
100
|
+
postType,
|
|
101
|
+
showDiff,
|
|
102
|
+
] );
|
|
103
|
+
|
|
104
|
+
return blocks;
|
|
105
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import RevisionDiffPanel from '../revision-diff-panel';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Panel that shows changed block attributes for the selected block
|
|
15
|
+
* when viewing revisions.
|
|
16
|
+
*/
|
|
17
|
+
export default function RevisionBlockDiffPanel() {
|
|
18
|
+
const { block } = useSelect( ( select ) => {
|
|
19
|
+
const { getSelectedBlock } = select( blockEditorStore );
|
|
20
|
+
return {
|
|
21
|
+
block: getSelectedBlock(),
|
|
22
|
+
};
|
|
23
|
+
}, [] );
|
|
24
|
+
|
|
25
|
+
if ( ! block ) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const changedAttributes =
|
|
30
|
+
block.attributes?.__revisionDiffStatus?.changedAttributes;
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<RevisionDiffPanel
|
|
34
|
+
title={ __( 'Changed attributes' ) }
|
|
35
|
+
entries={ changedAttributes }
|
|
36
|
+
initialOpen
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { PanelBody } from '@wordpress/components';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import PostPanelRow from '../post-panel-row';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Renders a panel of word-level diffs.
|
|
13
|
+
*
|
|
14
|
+
* @param {Object} props
|
|
15
|
+
* @param {string} props.title Panel title.
|
|
16
|
+
* @param {Object} props.entries Map of key → diffWords parts arrays.
|
|
17
|
+
* @param {boolean} props.initialOpen Whether the panel starts open.
|
|
18
|
+
*/
|
|
19
|
+
export default function RevisionDiffPanel( { title, entries, initialOpen } ) {
|
|
20
|
+
if ( ! entries ) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const fields = Object.entries( entries ).map( ( [ key, parts ] ) => (
|
|
25
|
+
<PostPanelRow key={ key } label={ key }>
|
|
26
|
+
<span className="editor-revision-fields-diff__value">
|
|
27
|
+
{ parts.map( ( part, index ) => {
|
|
28
|
+
if ( part.added ) {
|
|
29
|
+
return (
|
|
30
|
+
<ins
|
|
31
|
+
key={ index }
|
|
32
|
+
className="editor-revision-fields-diff__added"
|
|
33
|
+
>
|
|
34
|
+
{ part.value }
|
|
35
|
+
</ins>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
if ( part.removed ) {
|
|
39
|
+
return (
|
|
40
|
+
<del
|
|
41
|
+
key={ index }
|
|
42
|
+
className="editor-revision-fields-diff__removed"
|
|
43
|
+
>
|
|
44
|
+
{ part.value }
|
|
45
|
+
</del>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
return <span key={ index }>{ part.value }</span>;
|
|
49
|
+
} ) }
|
|
50
|
+
</span>
|
|
51
|
+
</PostPanelRow>
|
|
52
|
+
) );
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<PanelBody title={ title } initialOpen={ initialOpen }>
|
|
56
|
+
{ fields }
|
|
57
|
+
</PanelBody>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
.editor-revision-fields-diff__value {
|
|
2
|
+
word-break: break-word;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.editor-revision-fields-diff__added {
|
|
6
|
+
background-color: color-mix(in srgb, currentColor 5%, #00a32a 15%);
|
|
7
|
+
text-decoration: none;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.editor-revision-fields-diff__removed {
|
|
11
|
+
text-decoration: line-through;
|
|
12
|
+
color: #d63638;
|
|
13
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { diffWords } from 'diff/lib/diff/word';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { useSelect } from '@wordpress/data';
|
|
10
|
+
import { useMemo } from '@wordpress/element';
|
|
11
|
+
import { __ } from '@wordpress/i18n';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
import RevisionDiffPanel from '../revision-diff-panel';
|
|
17
|
+
import { store as editorStore } from '../../store';
|
|
18
|
+
import { unlock } from '../../lock-unlock';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Safely stringifies a value for display and comparison.
|
|
22
|
+
*
|
|
23
|
+
* @param {*} value The value to stringify.
|
|
24
|
+
* @return {string} The stringified value.
|
|
25
|
+
*/
|
|
26
|
+
function stringifyValue( value ) {
|
|
27
|
+
if ( value === null || value === undefined ) {
|
|
28
|
+
return '';
|
|
29
|
+
}
|
|
30
|
+
if ( typeof value === 'object' ) {
|
|
31
|
+
return JSON.stringify( value, null, 2 );
|
|
32
|
+
}
|
|
33
|
+
return String( value );
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Panel that shows meta field diffs between the current revision and
|
|
38
|
+
* the previous revision in the document sidebar during revision mode.
|
|
39
|
+
*/
|
|
40
|
+
export default function RevisionFieldsDiffPanel() {
|
|
41
|
+
const { revision, previousRevision } = useSelect( ( select ) => {
|
|
42
|
+
const { getCurrentRevision, getPreviousRevision } = unlock(
|
|
43
|
+
select( editorStore )
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
revision: getCurrentRevision(),
|
|
48
|
+
previousRevision: getPreviousRevision(),
|
|
49
|
+
};
|
|
50
|
+
}, [] );
|
|
51
|
+
|
|
52
|
+
const entries = useMemo( () => {
|
|
53
|
+
if ( ! revision ) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const revisionMeta = revision.meta ?? {};
|
|
58
|
+
const previousMeta = previousRevision?.meta ?? {};
|
|
59
|
+
const allMetaKeys = new Set( [
|
|
60
|
+
...Object.keys( revisionMeta ),
|
|
61
|
+
...Object.keys( previousMeta ),
|
|
62
|
+
] );
|
|
63
|
+
|
|
64
|
+
const result = {};
|
|
65
|
+
|
|
66
|
+
for ( const key of allMetaKeys ) {
|
|
67
|
+
const revStr = stringifyValue( revisionMeta[ key ] );
|
|
68
|
+
const prevStr = stringifyValue( previousMeta[ key ] );
|
|
69
|
+
|
|
70
|
+
if ( ! revStr && ! prevStr ) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
result[ key ] = diffWords( prevStr, revStr );
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if ( Object.keys( result ).length === 0 ) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return result;
|
|
82
|
+
}, [ revision, previousRevision ] );
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<RevisionDiffPanel
|
|
86
|
+
title={ __( 'Meta' ) }
|
|
87
|
+
entries={ entries }
|
|
88
|
+
initialOpen={ false }
|
|
89
|
+
/>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
@@ -27,11 +27,13 @@ import PluginDocumentSettingPanel from '../plugin-document-setting-panel';
|
|
|
27
27
|
import PluginSidebar from '../plugin-sidebar';
|
|
28
28
|
import PostSummary from './post-summary';
|
|
29
29
|
import PostTaxonomiesPanel from '../post-taxonomies/panel';
|
|
30
|
+
import RevisionFieldsDiffPanel from '../revision-fields-diff';
|
|
30
31
|
import PostTransformPanel from '../post-transform-panel';
|
|
31
32
|
import SidebarHeader from './header';
|
|
32
33
|
import TemplateContentPanel from '../template-content-panel';
|
|
33
34
|
import TemplatePartContentPanel from '../template-part-content-panel';
|
|
34
35
|
import { MediaMetadataPanel } from '../media';
|
|
36
|
+
import RevisionBlockDiffPanel from '../revision-block-diff';
|
|
35
37
|
import useAutoSwitchEditorSidebars from '../provider/use-auto-switch-editor-sidebars';
|
|
36
38
|
import { sidebars } from './constants';
|
|
37
39
|
import { unlock } from '../../lock-unlock';
|
|
@@ -127,6 +129,7 @@ const SidebarContent = ( {
|
|
|
127
129
|
<PostSummary
|
|
128
130
|
onActionPerformed={ onActionPerformed }
|
|
129
131
|
/>
|
|
132
|
+
{ isRevisionsMode && <RevisionFieldsDiffPanel /> }
|
|
130
133
|
{ ! isRevisionsMode && (
|
|
131
134
|
<>
|
|
132
135
|
<PluginDocumentSettingPanel.Slot />
|
|
@@ -144,6 +147,7 @@ const SidebarContent = ( {
|
|
|
144
147
|
{ ! isAttachment && (
|
|
145
148
|
<Tabs.TabPanel tabId={ sidebars.block } focusable={ false }>
|
|
146
149
|
<BlockInspector />
|
|
150
|
+
{ isRevisionsMode && <RevisionBlockDiffPanel /> }
|
|
147
151
|
</Tabs.TabPanel>
|
|
148
152
|
) }
|
|
149
153
|
</Tabs.Context.Provider>
|
|
@@ -375,6 +375,7 @@ function StyleBook(
|
|
|
375
375
|
* @param {Function} props.onPathChange Callback when the path changes.
|
|
376
376
|
* @param {Object} props.userConfig User configuration.
|
|
377
377
|
* @param {boolean} props.isStatic Whether the stylebook is static or clickable.
|
|
378
|
+
* @param {Object} props.settings Optional editor settings to use instead of the editor store settings.
|
|
378
379
|
* @return {Object} Style Book Preview component.
|
|
379
380
|
*/
|
|
380
381
|
export const StyleBookPreview = ( {
|
|
@@ -382,10 +383,11 @@ export const StyleBookPreview = ( {
|
|
|
382
383
|
isStatic = false,
|
|
383
384
|
path,
|
|
384
385
|
onPathChange,
|
|
386
|
+
settings: settingsProp,
|
|
385
387
|
} ) => {
|
|
386
388
|
const editorSettings = useSelect(
|
|
387
|
-
( select ) => select( editorStore ).getEditorSettings(),
|
|
388
|
-
[]
|
|
389
|
+
( select ) => settingsProp ?? select( editorStore ).getEditorSettings(),
|
|
390
|
+
[ settingsProp ]
|
|
389
391
|
);
|
|
390
392
|
|
|
391
393
|
const canUserUploadMedia = useSelect(
|