@wordpress/editor 14.40.2-next.v.202602271551.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/add-comment.cjs +0 -3
- package/build/components/collab-sidebar/add-comment.cjs.map +2 -2
- package/build/components/collab-sidebar/comments.cjs +0 -3
- package/build/components/collab-sidebar/comments.cjs.map +2 -2
- 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 +141 -229
- 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/more-menu/copy-content-menu-item.cjs +19 -2
- package/build/components/more-menu/copy-content-menu-item.cjs.map +3 -3
- 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-slider.cjs +102 -39
- package/build/components/post-revisions-preview/revisions-slider.cjs.map +3 -3
- package/build/components/post-text-editor/index.cjs +20 -5
- package/build/components/post-text-editor/index.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 +154 -29
- 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/add-comment.mjs +0 -3
- package/build-module/components/collab-sidebar/add-comment.mjs.map +2 -2
- package/build-module/components/collab-sidebar/comments.mjs +0 -3
- package/build-module/components/collab-sidebar/comments.mjs.map +2 -2
- 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 +132 -230
- 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/more-menu/copy-content-menu-item.mjs +19 -2
- package/build-module/components/more-menu/copy-content-menu-item.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-slider.mjs +110 -42
- package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
- package/build-module/components/post-text-editor/index.mjs +20 -5
- package/build-module/components/post-text-editor/index.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 +153 -29
- 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 +296 -121
- package/build-style/style.css +296 -121
- 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-comment.d.ts.map +1 -1
- 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/more-menu/copy-content-menu-item.d.ts.map +1 -1
- package/build-types/components/post-last-revision/index.d.ts.map +1 -1
- package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
- package/build-types/components/post-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-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/index.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/add-comment.js +0 -4
- package/src/components/collab-sidebar/comments.js +0 -5
- 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 -223
- 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/more-menu/copy-content-menu-item.js +20 -2
- 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-slider.js +136 -63
- 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/post-text-editor/index.js +25 -6
- 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 +215 -37
- 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
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { getSyncErrorMessages } from '../sync-error-messages';
|
|
5
|
+
|
|
6
|
+
describe( 'getSyncErrorMessages', () => {
|
|
7
|
+
it.each( [
|
|
8
|
+
'authentication-failed',
|
|
9
|
+
'connection-expired',
|
|
10
|
+
'connection-limit-exceeded',
|
|
11
|
+
'document-size-limit-exceeded',
|
|
12
|
+
'unknown-error',
|
|
13
|
+
] )( 'should return title and description for "%s"', ( code ) => {
|
|
14
|
+
const result = getSyncErrorMessages( { code } );
|
|
15
|
+
expect( result ).toEqual(
|
|
16
|
+
expect.objectContaining( {
|
|
17
|
+
title: expect.any( String ),
|
|
18
|
+
description: expect.any( String ),
|
|
19
|
+
} )
|
|
20
|
+
);
|
|
21
|
+
} );
|
|
22
|
+
|
|
23
|
+
it( 'should fall back to unknown-error for unrecognized codes', () => {
|
|
24
|
+
const result = getSyncErrorMessages( { code: 'some-new-error' } );
|
|
25
|
+
const unknownResult = getSyncErrorMessages( { code: 'unknown-error' } );
|
|
26
|
+
expect( result ).toBe( unknownResult );
|
|
27
|
+
} );
|
|
28
|
+
|
|
29
|
+
it( 'should fall back to unknown-error when error is undefined', () => {
|
|
30
|
+
const result = getSyncErrorMessages( undefined );
|
|
31
|
+
const unknownResult = getSyncErrorMessages( { code: 'unknown-error' } );
|
|
32
|
+
expect( result ).toBe( unknownResult );
|
|
33
|
+
} );
|
|
34
|
+
} );
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/provider/use-post-content-blocks.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { applyFilters } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst POST_CONTENT_BLOCK_TYPES = [\n\t'core/post-title',\n\t'core/post-featured-image',\n\t'core/post-content',\n];\n\nexport default function usePostContentBlocks() {\n\tconst contentOnlyBlockTypes = useMemo(\n\t\t() => [\n\t\t\t...applyFilters(\n\t\t\t\t'editor.postContentBlockTypes',\n\t\t\t\tPOST_CONTENT_BLOCK_TYPES\n\t\t\t),\n\t\t],\n\t\t[]\n\t);\n\n\t// Note that there are two separate subscriptions because the result for each\n\t// returns a new array.\n\tconst contentOnlyIds = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostBlocksByName } = unlock( select( editorStore ) );\n\t\t\treturn getPostBlocksByName( contentOnlyBlockTypes );\n\t\t},\n\t\t[ contentOnlyBlockTypes ]\n\t);\n\n\treturn contentOnlyIds;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,qBAAwB;AACxB,mBAA6B;AAK7B,mBAAqC;AACrC,yBAAuB;AAEvB,IAAM,2BAA2B;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AACD;AAEe,SAAR,uBAAwC;AAC9C,QAAM,4BAAwB;AAAA,IAC7B,MAAM;AAAA,MACL,OAAG;AAAA,QACF;AAAA,QACA;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAC;AAAA,EACF;AAIA,QAAM,qBAAiB;AAAA,IACtB,CAAE,WAAY;AACb,YAAM,EAAE,oBAAoB,QAAI,2BAAQ,OAAQ,aAAAA,KAAY,CAAE;AAC9D,aAAO,oBAAqB,qBAAsB;AAAA,IACnD;AAAA,IACA,CAAE,qBAAsB;AAAA,EACzB;AAEA,SAAO;AACR;",
|
|
6
|
-
"names": ["editorStore"]
|
|
7
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/editor/src/components/sync-connection-modal/index.js
|
|
21
|
-
var sync_connection_modal_exports = {};
|
|
22
|
-
__export(sync_connection_modal_exports, {
|
|
23
|
-
SyncConnectionModal: () => SyncConnectionModal
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(sync_connection_modal_exports);
|
|
26
|
-
var import_data = require("@wordpress/data");
|
|
27
|
-
var import_compose = require("@wordpress/compose");
|
|
28
|
-
var import_blocks = require("@wordpress/blocks");
|
|
29
|
-
var import_core_data = require("@wordpress/core-data");
|
|
30
|
-
var import_block_editor = require("@wordpress/block-editor");
|
|
31
|
-
var import_components = require("@wordpress/components");
|
|
32
|
-
var import_element = require("@wordpress/element");
|
|
33
|
-
var import_i18n = require("@wordpress/i18n");
|
|
34
|
-
var import_icons = require("@wordpress/icons");
|
|
35
|
-
var import_sync_error_messages = require("../../utils/sync-error-messages.cjs");
|
|
36
|
-
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
37
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
-
var { BlockCanvasCover } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
|
|
39
|
-
var INITIAL_DISCONNECTED_DEBOUNCE_MS = 5e3;
|
|
40
|
-
function SyncConnectionModal() {
|
|
41
|
-
const connectionState = (0, import_data.useSelect)((selectFn) => {
|
|
42
|
-
return selectFn(import_core_data.store).getSyncConnectionStatus() || null;
|
|
43
|
-
}, []);
|
|
44
|
-
const copyButtonRef = (0, import_compose.useCopyToClipboard)(() => {
|
|
45
|
-
const blocks = (0, import_data.select)(import_block_editor.store).getBlocks();
|
|
46
|
-
return (0, import_blocks.serialize)(blocks);
|
|
47
|
-
});
|
|
48
|
-
const [syncConnectionMessage, setSyncConnectionMessage] = (0, import_element.useState)(null);
|
|
49
|
-
const debounceTimerRef = (0, import_element.useRef)(null);
|
|
50
|
-
const hasInitializedRef = (0, import_element.useRef)(false);
|
|
51
|
-
(0, import_element.useEffect)(() => {
|
|
52
|
-
const status = connectionState?.status;
|
|
53
|
-
if (debounceTimerRef.current) {
|
|
54
|
-
clearTimeout(debounceTimerRef.current);
|
|
55
|
-
debounceTimerRef.current = null;
|
|
56
|
-
}
|
|
57
|
-
if (status === "connected") {
|
|
58
|
-
hasInitializedRef.current = true;
|
|
59
|
-
setSyncConnectionMessage(null);
|
|
60
|
-
} else if (status === "disconnected") {
|
|
61
|
-
const showModal = () => {
|
|
62
|
-
hasInitializedRef.current = true;
|
|
63
|
-
setSyncConnectionMessage(
|
|
64
|
-
(0, import_sync_error_messages.getSyncErrorMessages)(connectionState.error ?? {})
|
|
65
|
-
);
|
|
66
|
-
};
|
|
67
|
-
if (hasInitializedRef.current) {
|
|
68
|
-
showModal();
|
|
69
|
-
} else {
|
|
70
|
-
debounceTimerRef.current = setTimeout(
|
|
71
|
-
showModal,
|
|
72
|
-
INITIAL_DISCONNECTED_DEBOUNCE_MS
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return () => {
|
|
77
|
-
if (debounceTimerRef.current) {
|
|
78
|
-
clearTimeout(debounceTimerRef.current);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
}, [connectionState]);
|
|
82
|
-
if (!syncConnectionMessage) {
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
const { title, description } = syncConnectionMessage;
|
|
86
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BlockCanvasCover.Fill, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
87
|
-
import_components.Modal,
|
|
88
|
-
{
|
|
89
|
-
__experimentalHideHeader: true,
|
|
90
|
-
icon: import_icons.error,
|
|
91
|
-
isDismissible: false,
|
|
92
|
-
isFullScreen: false,
|
|
93
|
-
onRequestClose: () => {
|
|
94
|
-
},
|
|
95
|
-
shouldCloseOnClickOutside: false,
|
|
96
|
-
shouldCloseOnEsc: false,
|
|
97
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "editor-sync-connection-modal__container", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalVStack, { alignment: "center", justify: "center", spacing: 2, children: [
|
|
98
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Icon, { fill: "#ccc", icon: import_icons.error, size: 64 }),
|
|
99
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { children: title }),
|
|
100
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "editor-sync-connection-modal__description", children: description }),
|
|
101
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalHStack, { spacing: 2, justify: "center", children: [
|
|
102
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
103
|
-
import_components.Button,
|
|
104
|
-
{
|
|
105
|
-
__next40pxDefaultSize: true,
|
|
106
|
-
ref: copyButtonRef,
|
|
107
|
-
variant: "primary",
|
|
108
|
-
children: (0, import_i18n.__)("Copy post content")
|
|
109
|
-
}
|
|
110
|
-
),
|
|
111
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
112
|
-
import_components.Button,
|
|
113
|
-
{
|
|
114
|
-
__next40pxDefaultSize: true,
|
|
115
|
-
href: "edit.php",
|
|
116
|
-
isDestructive: true,
|
|
117
|
-
variant: "secondary",
|
|
118
|
-
children: (0, import_i18n.__)("Edit another post")
|
|
119
|
-
}
|
|
120
|
-
)
|
|
121
|
-
] })
|
|
122
|
-
] }) })
|
|
123
|
-
}
|
|
124
|
-
) });
|
|
125
|
-
}
|
|
126
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
127
|
-
0 && (module.exports = {
|
|
128
|
-
SyncConnectionModal
|
|
129
|
-
});
|
|
130
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/sync-connection-modal/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, select } from '@wordpress/data';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { serialize } from '@wordpress/blocks';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport {\n\tprivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tButton,\n\tModal,\n\tIcon,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { error as errorIcon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { getSyncErrorMessages } from '../../utils/sync-error-messages';\nimport { unlock } from '../../lock-unlock';\n\nconst { BlockCanvasCover } = unlock( privateApis );\n\n// Debounce time for initial disconnected status to allow connection to establish.\nconst INITIAL_DISCONNECTED_DEBOUNCE_MS = 5000;\n\n/**\n * Sync connection modal that displays when any entity reports a disconnection.\n * Uses BlockCanvasCover.Fill to render in the block canvas.\n *\n * @return {Element|null} The modal component or null if not disconnected.\n */\nexport function SyncConnectionModal() {\n\tconst connectionState = useSelect( ( selectFn ) => {\n\t\treturn selectFn( coreDataStore ).getSyncConnectionStatus() || null;\n\t}, [] );\n\n\tconst copyButtonRef = useCopyToClipboard( () => {\n\t\tconst blocks = select( blockEditorStore ).getBlocks();\n\t\treturn serialize( blocks );\n\t} );\n\tconst [ syncConnectionMessage, setSyncConnectionMessage ] =\n\t\tuseState( null );\n\tconst debounceTimerRef = useRef( null );\n\t// Track whether we've passed the initial load phase.\n\t// Once true, disconnected status will show immediately without debounce.\n\tconst hasInitializedRef = useRef( false );\n\n\tuseEffect( () => {\n\t\tconst status = connectionState?.status;\n\n\t\t// Clear any pending debounce timer when status changes.\n\t\tif ( debounceTimerRef.current ) {\n\t\t\tclearTimeout( debounceTimerRef.current );\n\t\t\tdebounceTimerRef.current = null;\n\t\t}\n\n\t\tif ( status === 'connected' ) {\n\t\t\thasInitializedRef.current = true;\n\t\t\tsetSyncConnectionMessage( null );\n\t\t} else if ( status === 'disconnected' ) {\n\t\t\tconst showModal = () => {\n\t\t\t\thasInitializedRef.current = true;\n\t\t\t\tsetSyncConnectionMessage(\n\t\t\t\t\tgetSyncErrorMessages( connectionState.error ?? {} )\n\t\t\t\t);\n\t\t\t};\n\n\t\t\t// Debounce only on first load to allow connection to establish.\n\t\t\tif ( hasInitializedRef.current ) {\n\t\t\t\tshowModal();\n\t\t\t} else {\n\t\t\t\tdebounceTimerRef.current = setTimeout(\n\t\t\t\t\tshowModal,\n\t\t\t\t\tINITIAL_DISCONNECTED_DEBOUNCE_MS\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn () => {\n\t\t\tif ( debounceTimerRef.current ) {\n\t\t\t\tclearTimeout( debounceTimerRef.current );\n\t\t\t}\n\t\t};\n\t}, [ connectionState ] );\n\n\tif ( ! syncConnectionMessage ) {\n\t\treturn null;\n\t}\n\n\tconst { title, description } = syncConnectionMessage;\n\n\treturn (\n\t\t<BlockCanvasCover.Fill>\n\t\t\t<Modal\n\t\t\t\t__experimentalHideHeader\n\t\t\t\ticon={ errorIcon }\n\t\t\t\tisDismissible={ false }\n\t\t\t\tisFullScreen={ false }\n\t\t\t\tonRequestClose={ () => {} }\n\t\t\t\tshouldCloseOnClickOutside={ false }\n\t\t\t\tshouldCloseOnEsc={ false }\n\t\t\t>\n\t\t\t\t<div className=\"editor-sync-connection-modal__container\">\n\t\t\t\t\t<VStack alignment=\"center\" justify=\"center\" spacing={ 2 }>\n\t\t\t\t\t\t<Icon fill=\"#ccc\" icon={ errorIcon } size={ 64 } />\n\t\t\t\t\t\t<h1>{ title }</h1>\n\t\t\t\t\t\t<p className=\"editor-sync-connection-modal__description\">\n\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<HStack spacing={ 2 } justify=\"center\">\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tref={ copyButtonRef }\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Copy post content' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\thref=\"edit.php\"\n\t\t\t\t\t\t\t\tisDestructive\n\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Edit another post' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</VStack>\n\t\t\t\t</div>\n\t\t\t</Modal>\n\t\t</BlockCanvasCover.Fill>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAkC;AAClC,qBAAmC;AACnC,oBAA0B;AAC1B,uBAAuC;AACvC,0BAGO;AACP,wBAMO;AACP,qBAA4C;AAC5C,kBAAmB;AACnB,mBAAmC;AAKnC,iCAAqC;AACrC,yBAAuB;AAsFjB;AApFN,IAAM,EAAE,iBAAiB,QAAI,2BAAQ,+BAAY;AAGjD,IAAM,mCAAmC;AAQlC,SAAS,sBAAsB;AACrC,QAAM,sBAAkB,uBAAW,CAAE,aAAc;AAClD,WAAO,SAAU,iBAAAA,KAAc,EAAE,wBAAwB,KAAK;AAAA,EAC/D,GAAG,CAAC,CAAE;AAEN,QAAM,oBAAgB,mCAAoB,MAAM;AAC/C,UAAM,aAAS,oBAAQ,oBAAAC,KAAiB,EAAE,UAAU;AACpD,eAAO,yBAAW,MAAO;AAAA,EAC1B,CAAE;AACF,QAAM,CAAE,uBAAuB,wBAAyB,QACvD,yBAAU,IAAK;AAChB,QAAM,uBAAmB,uBAAQ,IAAK;AAGtC,QAAM,wBAAoB,uBAAQ,KAAM;AAExC,gCAAW,MAAM;AAChB,UAAM,SAAS,iBAAiB;AAGhC,QAAK,iBAAiB,SAAU;AAC/B,mBAAc,iBAAiB,OAAQ;AACvC,uBAAiB,UAAU;AAAA,IAC5B;AAEA,QAAK,WAAW,aAAc;AAC7B,wBAAkB,UAAU;AAC5B,+BAA0B,IAAK;AAAA,IAChC,WAAY,WAAW,gBAAiB;AACvC,YAAM,YAAY,MAAM;AACvB,0BAAkB,UAAU;AAC5B;AAAA,cACC,iDAAsB,gBAAgB,SAAS,CAAC,CAAE;AAAA,QACnD;AAAA,MACD;AAGA,UAAK,kBAAkB,SAAU;AAChC,kBAAU;AAAA,MACX,OAAO;AACN,yBAAiB,UAAU;AAAA,UAC1B;AAAA,UACA;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAEA,WAAO,MAAM;AACZ,UAAK,iBAAiB,SAAU;AAC/B,qBAAc,iBAAiB,OAAQ;AAAA,MACxC;AAAA,IACD;AAAA,EACD,GAAG,CAAE,eAAgB,CAAE;AAEvB,MAAK,CAAE,uBAAwB;AAC9B,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,OAAO,YAAY,IAAI;AAE/B,SACC,4CAAC,iBAAiB,MAAjB,EACA;AAAA,IAAC;AAAA;AAAA,MACA,0BAAwB;AAAA,MACxB,MAAO,aAAAC;AAAA,MACP,eAAgB;AAAA,MAChB,cAAe;AAAA,MACf,gBAAiB,MAAM;AAAA,MAAC;AAAA,MACxB,2BAA4B;AAAA,MAC5B,kBAAmB;AAAA,MAEnB,sDAAC,SAAI,WAAU,2CACd,uDAAC,kBAAAC,sBAAA,EAAO,WAAU,UAAS,SAAQ,UAAS,SAAU,GACrD;AAAA,oDAAC,0BAAK,MAAK,QAAO,MAAO,aAAAD,OAAY,MAAO,IAAK;AAAA,QACjD,4CAAC,QAAK,iBAAO;AAAA,QACb,4CAAC,OAAE,WAAU,6CACV,uBACH;AAAA,QACA,6CAAC,kBAAAE,sBAAA,EAAO,SAAU,GAAI,SAAQ,UAC7B;AAAA;AAAA,YAAC;AAAA;AAAA,cACA,uBAAqB;AAAA,cACrB,KAAM;AAAA,cACN,SAAQ;AAAA,cAEN,8BAAI,mBAAoB;AAAA;AAAA,UAC3B;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACA,uBAAqB;AAAA,cACrB,MAAK;AAAA,cACL,eAAa;AAAA,cACb,SAAQ;AAAA,cAEN,8BAAI,mBAAoB;AAAA;AAAA,UAC3B;AAAA,WACD;AAAA,SACD,GACD;AAAA;AAAA,EACD,GACD;AAEF;",
|
|
6
|
-
"names": ["coreDataStore", "blockEditorStore", "errorIcon", "VStack", "HStack"]
|
|
7
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// packages/editor/src/components/provider/use-post-content-blocks.js
|
|
2
|
-
import { useSelect } from "@wordpress/data";
|
|
3
|
-
import { useMemo } from "@wordpress/element";
|
|
4
|
-
import { applyFilters } from "@wordpress/hooks";
|
|
5
|
-
import { store as editorStore } from "../../store/index.mjs";
|
|
6
|
-
import { unlock } from "../../lock-unlock.mjs";
|
|
7
|
-
var POST_CONTENT_BLOCK_TYPES = [
|
|
8
|
-
"core/post-title",
|
|
9
|
-
"core/post-featured-image",
|
|
10
|
-
"core/post-content"
|
|
11
|
-
];
|
|
12
|
-
function usePostContentBlocks() {
|
|
13
|
-
const contentOnlyBlockTypes = useMemo(
|
|
14
|
-
() => [
|
|
15
|
-
...applyFilters(
|
|
16
|
-
"editor.postContentBlockTypes",
|
|
17
|
-
POST_CONTENT_BLOCK_TYPES
|
|
18
|
-
)
|
|
19
|
-
],
|
|
20
|
-
[]
|
|
21
|
-
);
|
|
22
|
-
const contentOnlyIds = useSelect(
|
|
23
|
-
(select) => {
|
|
24
|
-
const { getPostBlocksByName } = unlock(select(editorStore));
|
|
25
|
-
return getPostBlocksByName(contentOnlyBlockTypes);
|
|
26
|
-
},
|
|
27
|
-
[contentOnlyBlockTypes]
|
|
28
|
-
);
|
|
29
|
-
return contentOnlyIds;
|
|
30
|
-
}
|
|
31
|
-
export {
|
|
32
|
-
usePostContentBlocks as default
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=use-post-content-blocks.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/provider/use-post-content-blocks.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { applyFilters } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst POST_CONTENT_BLOCK_TYPES = [\n\t'core/post-title',\n\t'core/post-featured-image',\n\t'core/post-content',\n];\n\nexport default function usePostContentBlocks() {\n\tconst contentOnlyBlockTypes = useMemo(\n\t\t() => [\n\t\t\t...applyFilters(\n\t\t\t\t'editor.postContentBlockTypes',\n\t\t\t\tPOST_CONTENT_BLOCK_TYPES\n\t\t\t),\n\t\t],\n\t\t[]\n\t);\n\n\t// Note that there are two separate subscriptions because the result for each\n\t// returns a new array.\n\tconst contentOnlyIds = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostBlocksByName } = unlock( select( editorStore ) );\n\t\t\treturn getPostBlocksByName( contentOnlyBlockTypes );\n\t\t},\n\t\t[ contentOnlyBlockTypes ]\n\t);\n\n\treturn contentOnlyIds;\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,oBAAoB;AAK7B,SAAS,SAAS,mBAAmB;AACrC,SAAS,cAAc;AAEvB,IAAM,2BAA2B;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AACD;AAEe,SAAR,uBAAwC;AAC9C,QAAM,wBAAwB;AAAA,IAC7B,MAAM;AAAA,MACL,GAAG;AAAA,QACF;AAAA,QACA;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAC;AAAA,EACF;AAIA,QAAM,iBAAiB;AAAA,IACtB,CAAE,WAAY;AACb,YAAM,EAAE,oBAAoB,IAAI,OAAQ,OAAQ,WAAY,CAAE;AAC9D,aAAO,oBAAqB,qBAAsB;AAAA,IACnD;AAAA,IACA,CAAE,qBAAsB;AAAA,EACzB;AAEA,SAAO;AACR;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
// packages/editor/src/components/sync-connection-modal/index.js
|
|
2
|
-
import { useSelect, select } from "@wordpress/data";
|
|
3
|
-
import { useCopyToClipboard } from "@wordpress/compose";
|
|
4
|
-
import { serialize } from "@wordpress/blocks";
|
|
5
|
-
import { store as coreDataStore } from "@wordpress/core-data";
|
|
6
|
-
import {
|
|
7
|
-
privateApis,
|
|
8
|
-
store as blockEditorStore
|
|
9
|
-
} from "@wordpress/block-editor";
|
|
10
|
-
import {
|
|
11
|
-
Button,
|
|
12
|
-
Modal,
|
|
13
|
-
Icon,
|
|
14
|
-
__experimentalHStack as HStack,
|
|
15
|
-
__experimentalVStack as VStack
|
|
16
|
-
} from "@wordpress/components";
|
|
17
|
-
import { useState, useEffect, useRef } from "@wordpress/element";
|
|
18
|
-
import { __ } from "@wordpress/i18n";
|
|
19
|
-
import { error as errorIcon } from "@wordpress/icons";
|
|
20
|
-
import { getSyncErrorMessages } from "../../utils/sync-error-messages.mjs";
|
|
21
|
-
import { unlock } from "../../lock-unlock.mjs";
|
|
22
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
-
var { BlockCanvasCover } = unlock(privateApis);
|
|
24
|
-
var INITIAL_DISCONNECTED_DEBOUNCE_MS = 5e3;
|
|
25
|
-
function SyncConnectionModal() {
|
|
26
|
-
const connectionState = useSelect((selectFn) => {
|
|
27
|
-
return selectFn(coreDataStore).getSyncConnectionStatus() || null;
|
|
28
|
-
}, []);
|
|
29
|
-
const copyButtonRef = useCopyToClipboard(() => {
|
|
30
|
-
const blocks = select(blockEditorStore).getBlocks();
|
|
31
|
-
return serialize(blocks);
|
|
32
|
-
});
|
|
33
|
-
const [syncConnectionMessage, setSyncConnectionMessage] = useState(null);
|
|
34
|
-
const debounceTimerRef = useRef(null);
|
|
35
|
-
const hasInitializedRef = useRef(false);
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
const status = connectionState?.status;
|
|
38
|
-
if (debounceTimerRef.current) {
|
|
39
|
-
clearTimeout(debounceTimerRef.current);
|
|
40
|
-
debounceTimerRef.current = null;
|
|
41
|
-
}
|
|
42
|
-
if (status === "connected") {
|
|
43
|
-
hasInitializedRef.current = true;
|
|
44
|
-
setSyncConnectionMessage(null);
|
|
45
|
-
} else if (status === "disconnected") {
|
|
46
|
-
const showModal = () => {
|
|
47
|
-
hasInitializedRef.current = true;
|
|
48
|
-
setSyncConnectionMessage(
|
|
49
|
-
getSyncErrorMessages(connectionState.error ?? {})
|
|
50
|
-
);
|
|
51
|
-
};
|
|
52
|
-
if (hasInitializedRef.current) {
|
|
53
|
-
showModal();
|
|
54
|
-
} else {
|
|
55
|
-
debounceTimerRef.current = setTimeout(
|
|
56
|
-
showModal,
|
|
57
|
-
INITIAL_DISCONNECTED_DEBOUNCE_MS
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return () => {
|
|
62
|
-
if (debounceTimerRef.current) {
|
|
63
|
-
clearTimeout(debounceTimerRef.current);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
}, [connectionState]);
|
|
67
|
-
if (!syncConnectionMessage) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
const { title, description } = syncConnectionMessage;
|
|
71
|
-
return /* @__PURE__ */ jsx(BlockCanvasCover.Fill, { children: /* @__PURE__ */ jsx(
|
|
72
|
-
Modal,
|
|
73
|
-
{
|
|
74
|
-
__experimentalHideHeader: true,
|
|
75
|
-
icon: errorIcon,
|
|
76
|
-
isDismissible: false,
|
|
77
|
-
isFullScreen: false,
|
|
78
|
-
onRequestClose: () => {
|
|
79
|
-
},
|
|
80
|
-
shouldCloseOnClickOutside: false,
|
|
81
|
-
shouldCloseOnEsc: false,
|
|
82
|
-
children: /* @__PURE__ */ jsx("div", { className: "editor-sync-connection-modal__container", children: /* @__PURE__ */ jsxs(VStack, { alignment: "center", justify: "center", spacing: 2, children: [
|
|
83
|
-
/* @__PURE__ */ jsx(Icon, { fill: "#ccc", icon: errorIcon, size: 64 }),
|
|
84
|
-
/* @__PURE__ */ jsx("h1", { children: title }),
|
|
85
|
-
/* @__PURE__ */ jsx("p", { className: "editor-sync-connection-modal__description", children: description }),
|
|
86
|
-
/* @__PURE__ */ jsxs(HStack, { spacing: 2, justify: "center", children: [
|
|
87
|
-
/* @__PURE__ */ jsx(
|
|
88
|
-
Button,
|
|
89
|
-
{
|
|
90
|
-
__next40pxDefaultSize: true,
|
|
91
|
-
ref: copyButtonRef,
|
|
92
|
-
variant: "primary",
|
|
93
|
-
children: __("Copy post content")
|
|
94
|
-
}
|
|
95
|
-
),
|
|
96
|
-
/* @__PURE__ */ jsx(
|
|
97
|
-
Button,
|
|
98
|
-
{
|
|
99
|
-
__next40pxDefaultSize: true,
|
|
100
|
-
href: "edit.php",
|
|
101
|
-
isDestructive: true,
|
|
102
|
-
variant: "secondary",
|
|
103
|
-
children: __("Edit another post")
|
|
104
|
-
}
|
|
105
|
-
)
|
|
106
|
-
] })
|
|
107
|
-
] }) })
|
|
108
|
-
}
|
|
109
|
-
) });
|
|
110
|
-
}
|
|
111
|
-
export {
|
|
112
|
-
SyncConnectionModal
|
|
113
|
-
};
|
|
114
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/sync-connection-modal/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, select } from '@wordpress/data';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { serialize } from '@wordpress/blocks';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport {\n\tprivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tButton,\n\tModal,\n\tIcon,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { error as errorIcon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { getSyncErrorMessages } from '../../utils/sync-error-messages';\nimport { unlock } from '../../lock-unlock';\n\nconst { BlockCanvasCover } = unlock( privateApis );\n\n// Debounce time for initial disconnected status to allow connection to establish.\nconst INITIAL_DISCONNECTED_DEBOUNCE_MS = 5000;\n\n/**\n * Sync connection modal that displays when any entity reports a disconnection.\n * Uses BlockCanvasCover.Fill to render in the block canvas.\n *\n * @return {Element|null} The modal component or null if not disconnected.\n */\nexport function SyncConnectionModal() {\n\tconst connectionState = useSelect( ( selectFn ) => {\n\t\treturn selectFn( coreDataStore ).getSyncConnectionStatus() || null;\n\t}, [] );\n\n\tconst copyButtonRef = useCopyToClipboard( () => {\n\t\tconst blocks = select( blockEditorStore ).getBlocks();\n\t\treturn serialize( blocks );\n\t} );\n\tconst [ syncConnectionMessage, setSyncConnectionMessage ] =\n\t\tuseState( null );\n\tconst debounceTimerRef = useRef( null );\n\t// Track whether we've passed the initial load phase.\n\t// Once true, disconnected status will show immediately without debounce.\n\tconst hasInitializedRef = useRef( false );\n\n\tuseEffect( () => {\n\t\tconst status = connectionState?.status;\n\n\t\t// Clear any pending debounce timer when status changes.\n\t\tif ( debounceTimerRef.current ) {\n\t\t\tclearTimeout( debounceTimerRef.current );\n\t\t\tdebounceTimerRef.current = null;\n\t\t}\n\n\t\tif ( status === 'connected' ) {\n\t\t\thasInitializedRef.current = true;\n\t\t\tsetSyncConnectionMessage( null );\n\t\t} else if ( status === 'disconnected' ) {\n\t\t\tconst showModal = () => {\n\t\t\t\thasInitializedRef.current = true;\n\t\t\t\tsetSyncConnectionMessage(\n\t\t\t\t\tgetSyncErrorMessages( connectionState.error ?? {} )\n\t\t\t\t);\n\t\t\t};\n\n\t\t\t// Debounce only on first load to allow connection to establish.\n\t\t\tif ( hasInitializedRef.current ) {\n\t\t\t\tshowModal();\n\t\t\t} else {\n\t\t\t\tdebounceTimerRef.current = setTimeout(\n\t\t\t\t\tshowModal,\n\t\t\t\t\tINITIAL_DISCONNECTED_DEBOUNCE_MS\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn () => {\n\t\t\tif ( debounceTimerRef.current ) {\n\t\t\t\tclearTimeout( debounceTimerRef.current );\n\t\t\t}\n\t\t};\n\t}, [ connectionState ] );\n\n\tif ( ! syncConnectionMessage ) {\n\t\treturn null;\n\t}\n\n\tconst { title, description } = syncConnectionMessage;\n\n\treturn (\n\t\t<BlockCanvasCover.Fill>\n\t\t\t<Modal\n\t\t\t\t__experimentalHideHeader\n\t\t\t\ticon={ errorIcon }\n\t\t\t\tisDismissible={ false }\n\t\t\t\tisFullScreen={ false }\n\t\t\t\tonRequestClose={ () => {} }\n\t\t\t\tshouldCloseOnClickOutside={ false }\n\t\t\t\tshouldCloseOnEsc={ false }\n\t\t\t>\n\t\t\t\t<div className=\"editor-sync-connection-modal__container\">\n\t\t\t\t\t<VStack alignment=\"center\" justify=\"center\" spacing={ 2 }>\n\t\t\t\t\t\t<Icon fill=\"#ccc\" icon={ errorIcon } size={ 64 } />\n\t\t\t\t\t\t<h1>{ title }</h1>\n\t\t\t\t\t\t<p className=\"editor-sync-connection-modal__description\">\n\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<HStack spacing={ 2 } justify=\"center\">\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tref={ copyButtonRef }\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Copy post content' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\thref=\"edit.php\"\n\t\t\t\t\t\t\t\tisDestructive\n\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Edit another post' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</VStack>\n\t\t\t\t</div>\n\t\t\t</Modal>\n\t\t</BlockCanvasCover.Fill>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,WAAW,cAAc;AAClC,SAAS,0BAA0B;AACnC,SAAS,iBAAiB;AAC1B,SAAS,SAAS,qBAAqB;AACvC;AAAA,EACC;AAAA,EACA,SAAS;AAAA,OACH;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,OAClB;AACP,SAAS,UAAU,WAAW,cAAc;AAC5C,SAAS,UAAU;AACnB,SAAS,SAAS,iBAAiB;AAKnC,SAAS,4BAA4B;AACrC,SAAS,cAAc;AAsFjB,cAKA,YALA;AApFN,IAAM,EAAE,iBAAiB,IAAI,OAAQ,WAAY;AAGjD,IAAM,mCAAmC;AAQlC,SAAS,sBAAsB;AACrC,QAAM,kBAAkB,UAAW,CAAE,aAAc;AAClD,WAAO,SAAU,aAAc,EAAE,wBAAwB,KAAK;AAAA,EAC/D,GAAG,CAAC,CAAE;AAEN,QAAM,gBAAgB,mBAAoB,MAAM;AAC/C,UAAM,SAAS,OAAQ,gBAAiB,EAAE,UAAU;AACpD,WAAO,UAAW,MAAO;AAAA,EAC1B,CAAE;AACF,QAAM,CAAE,uBAAuB,wBAAyB,IACvD,SAAU,IAAK;AAChB,QAAM,mBAAmB,OAAQ,IAAK;AAGtC,QAAM,oBAAoB,OAAQ,KAAM;AAExC,YAAW,MAAM;AAChB,UAAM,SAAS,iBAAiB;AAGhC,QAAK,iBAAiB,SAAU;AAC/B,mBAAc,iBAAiB,OAAQ;AACvC,uBAAiB,UAAU;AAAA,IAC5B;AAEA,QAAK,WAAW,aAAc;AAC7B,wBAAkB,UAAU;AAC5B,+BAA0B,IAAK;AAAA,IAChC,WAAY,WAAW,gBAAiB;AACvC,YAAM,YAAY,MAAM;AACvB,0BAAkB,UAAU;AAC5B;AAAA,UACC,qBAAsB,gBAAgB,SAAS,CAAC,CAAE;AAAA,QACnD;AAAA,MACD;AAGA,UAAK,kBAAkB,SAAU;AAChC,kBAAU;AAAA,MACX,OAAO;AACN,yBAAiB,UAAU;AAAA,UAC1B;AAAA,UACA;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAEA,WAAO,MAAM;AACZ,UAAK,iBAAiB,SAAU;AAC/B,qBAAc,iBAAiB,OAAQ;AAAA,MACxC;AAAA,IACD;AAAA,EACD,GAAG,CAAE,eAAgB,CAAE;AAEvB,MAAK,CAAE,uBAAwB;AAC9B,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,OAAO,YAAY,IAAI;AAE/B,SACC,oBAAC,iBAAiB,MAAjB,EACA;AAAA,IAAC;AAAA;AAAA,MACA,0BAAwB;AAAA,MACxB,MAAO;AAAA,MACP,eAAgB;AAAA,MAChB,cAAe;AAAA,MACf,gBAAiB,MAAM;AAAA,MAAC;AAAA,MACxB,2BAA4B;AAAA,MAC5B,kBAAmB;AAAA,MAEnB,8BAAC,SAAI,WAAU,2CACd,+BAAC,UAAO,WAAU,UAAS,SAAQ,UAAS,SAAU,GACrD;AAAA,4BAAC,QAAK,MAAK,QAAO,MAAO,WAAY,MAAO,IAAK;AAAA,QACjD,oBAAC,QAAK,iBAAO;AAAA,QACb,oBAAC,OAAE,WAAU,6CACV,uBACH;AAAA,QACA,qBAAC,UAAO,SAAU,GAAI,SAAQ,UAC7B;AAAA;AAAA,YAAC;AAAA;AAAA,cACA,uBAAqB;AAAA,cACrB,KAAM;AAAA,cACN,SAAQ;AAAA,cAEN,aAAI,mBAAoB;AAAA;AAAA,UAC3B;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACA,uBAAqB;AAAA,cACrB,MAAK;AAAA,cACL,eAAa;AAAA,cACb,SAAQ;AAAA,cAEN,aAAI,mBAAoB;AAAA;AAAA,UAC3B;AAAA,WACD;AAAA,SACD,GACD;AAAA;AAAA,EACD,GACD;AAEF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-post-content-blocks.d.ts","sourceRoot":"","sources":["../../../src/components/provider/use-post-content-blocks.js"],"names":[],"mappings":"AAmBA,oDAsBC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sync connection modal that displays when any entity reports a disconnection.
|
|
3
|
-
* Uses BlockCanvasCover.Fill to render in the block canvas.
|
|
4
|
-
*
|
|
5
|
-
* @return {Element|null} The modal component or null if not disconnected.
|
|
6
|
-
*/
|
|
7
|
-
export function SyncConnectionModal(): Element | null;
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/sync-connection-modal/index.js"],"names":[],"mappings":"AAiCA;;;;;GAKG;AACH,uCAFY,OAAO,GAAC,IAAI,CAsGvB"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useSelect } from '@wordpress/data';
|
|
5
|
-
import { useMemo } from '@wordpress/element';
|
|
6
|
-
import { applyFilters } from '@wordpress/hooks';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
import { store as editorStore } from '../../store';
|
|
12
|
-
import { unlock } from '../../lock-unlock';
|
|
13
|
-
|
|
14
|
-
const POST_CONTENT_BLOCK_TYPES = [
|
|
15
|
-
'core/post-title',
|
|
16
|
-
'core/post-featured-image',
|
|
17
|
-
'core/post-content',
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
export default function usePostContentBlocks() {
|
|
21
|
-
const contentOnlyBlockTypes = useMemo(
|
|
22
|
-
() => [
|
|
23
|
-
...applyFilters(
|
|
24
|
-
'editor.postContentBlockTypes',
|
|
25
|
-
POST_CONTENT_BLOCK_TYPES
|
|
26
|
-
),
|
|
27
|
-
],
|
|
28
|
-
[]
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
// Note that there are two separate subscriptions because the result for each
|
|
32
|
-
// returns a new array.
|
|
33
|
-
const contentOnlyIds = useSelect(
|
|
34
|
-
( select ) => {
|
|
35
|
-
const { getPostBlocksByName } = unlock( select( editorStore ) );
|
|
36
|
-
return getPostBlocksByName( contentOnlyBlockTypes );
|
|
37
|
-
},
|
|
38
|
-
[ contentOnlyBlockTypes ]
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
return contentOnlyIds;
|
|
42
|
-
}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useSelect, select } from '@wordpress/data';
|
|
5
|
-
import { useCopyToClipboard } from '@wordpress/compose';
|
|
6
|
-
import { serialize } from '@wordpress/blocks';
|
|
7
|
-
import { store as coreDataStore } from '@wordpress/core-data';
|
|
8
|
-
import {
|
|
9
|
-
privateApis,
|
|
10
|
-
store as blockEditorStore,
|
|
11
|
-
} from '@wordpress/block-editor';
|
|
12
|
-
import {
|
|
13
|
-
Button,
|
|
14
|
-
Modal,
|
|
15
|
-
Icon,
|
|
16
|
-
__experimentalHStack as HStack,
|
|
17
|
-
__experimentalVStack as VStack,
|
|
18
|
-
} from '@wordpress/components';
|
|
19
|
-
import { useState, useEffect, useRef } from '@wordpress/element';
|
|
20
|
-
import { __ } from '@wordpress/i18n';
|
|
21
|
-
import { error as errorIcon } from '@wordpress/icons';
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Internal dependencies
|
|
25
|
-
*/
|
|
26
|
-
import { getSyncErrorMessages } from '../../utils/sync-error-messages';
|
|
27
|
-
import { unlock } from '../../lock-unlock';
|
|
28
|
-
|
|
29
|
-
const { BlockCanvasCover } = unlock( privateApis );
|
|
30
|
-
|
|
31
|
-
// Debounce time for initial disconnected status to allow connection to establish.
|
|
32
|
-
const INITIAL_DISCONNECTED_DEBOUNCE_MS = 5000;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Sync connection modal that displays when any entity reports a disconnection.
|
|
36
|
-
* Uses BlockCanvasCover.Fill to render in the block canvas.
|
|
37
|
-
*
|
|
38
|
-
* @return {Element|null} The modal component or null if not disconnected.
|
|
39
|
-
*/
|
|
40
|
-
export function SyncConnectionModal() {
|
|
41
|
-
const connectionState = useSelect( ( selectFn ) => {
|
|
42
|
-
return selectFn( coreDataStore ).getSyncConnectionStatus() || null;
|
|
43
|
-
}, [] );
|
|
44
|
-
|
|
45
|
-
const copyButtonRef = useCopyToClipboard( () => {
|
|
46
|
-
const blocks = select( blockEditorStore ).getBlocks();
|
|
47
|
-
return serialize( blocks );
|
|
48
|
-
} );
|
|
49
|
-
const [ syncConnectionMessage, setSyncConnectionMessage ] =
|
|
50
|
-
useState( null );
|
|
51
|
-
const debounceTimerRef = useRef( null );
|
|
52
|
-
// Track whether we've passed the initial load phase.
|
|
53
|
-
// Once true, disconnected status will show immediately without debounce.
|
|
54
|
-
const hasInitializedRef = useRef( false );
|
|
55
|
-
|
|
56
|
-
useEffect( () => {
|
|
57
|
-
const status = connectionState?.status;
|
|
58
|
-
|
|
59
|
-
// Clear any pending debounce timer when status changes.
|
|
60
|
-
if ( debounceTimerRef.current ) {
|
|
61
|
-
clearTimeout( debounceTimerRef.current );
|
|
62
|
-
debounceTimerRef.current = null;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if ( status === 'connected' ) {
|
|
66
|
-
hasInitializedRef.current = true;
|
|
67
|
-
setSyncConnectionMessage( null );
|
|
68
|
-
} else if ( status === 'disconnected' ) {
|
|
69
|
-
const showModal = () => {
|
|
70
|
-
hasInitializedRef.current = true;
|
|
71
|
-
setSyncConnectionMessage(
|
|
72
|
-
getSyncErrorMessages( connectionState.error ?? {} )
|
|
73
|
-
);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
// Debounce only on first load to allow connection to establish.
|
|
77
|
-
if ( hasInitializedRef.current ) {
|
|
78
|
-
showModal();
|
|
79
|
-
} else {
|
|
80
|
-
debounceTimerRef.current = setTimeout(
|
|
81
|
-
showModal,
|
|
82
|
-
INITIAL_DISCONNECTED_DEBOUNCE_MS
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return () => {
|
|
88
|
-
if ( debounceTimerRef.current ) {
|
|
89
|
-
clearTimeout( debounceTimerRef.current );
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
}, [ connectionState ] );
|
|
93
|
-
|
|
94
|
-
if ( ! syncConnectionMessage ) {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const { title, description } = syncConnectionMessage;
|
|
99
|
-
|
|
100
|
-
return (
|
|
101
|
-
<BlockCanvasCover.Fill>
|
|
102
|
-
<Modal
|
|
103
|
-
__experimentalHideHeader
|
|
104
|
-
icon={ errorIcon }
|
|
105
|
-
isDismissible={ false }
|
|
106
|
-
isFullScreen={ false }
|
|
107
|
-
onRequestClose={ () => {} }
|
|
108
|
-
shouldCloseOnClickOutside={ false }
|
|
109
|
-
shouldCloseOnEsc={ false }
|
|
110
|
-
>
|
|
111
|
-
<div className="editor-sync-connection-modal__container">
|
|
112
|
-
<VStack alignment="center" justify="center" spacing={ 2 }>
|
|
113
|
-
<Icon fill="#ccc" icon={ errorIcon } size={ 64 } />
|
|
114
|
-
<h1>{ title }</h1>
|
|
115
|
-
<p className="editor-sync-connection-modal__description">
|
|
116
|
-
{ description }
|
|
117
|
-
</p>
|
|
118
|
-
<HStack spacing={ 2 } justify="center">
|
|
119
|
-
<Button
|
|
120
|
-
__next40pxDefaultSize
|
|
121
|
-
ref={ copyButtonRef }
|
|
122
|
-
variant="primary"
|
|
123
|
-
>
|
|
124
|
-
{ __( 'Copy post content' ) }
|
|
125
|
-
</Button>
|
|
126
|
-
<Button
|
|
127
|
-
__next40pxDefaultSize
|
|
128
|
-
href="edit.php"
|
|
129
|
-
isDestructive
|
|
130
|
-
variant="secondary"
|
|
131
|
-
>
|
|
132
|
-
{ __( 'Edit another post' ) }
|
|
133
|
-
</Button>
|
|
134
|
-
</HStack>
|
|
135
|
-
</VStack>
|
|
136
|
-
</div>
|
|
137
|
-
</Modal>
|
|
138
|
-
</BlockCanvasCover.Fill>
|
|
139
|
-
);
|
|
140
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Default error messages for known error codes.
|
|
8
|
-
*/
|
|
9
|
-
const ERROR_MESSAGES = {
|
|
10
|
-
'authentication-failed': {
|
|
11
|
-
title: __( 'Authentication Failed' ),
|
|
12
|
-
description: __(
|
|
13
|
-
'Authentication with the collaborative editing server failed. ' +
|
|
14
|
-
'Please verify that you have the necessary permissions.'
|
|
15
|
-
),
|
|
16
|
-
},
|
|
17
|
-
'connection-expired': {
|
|
18
|
-
title: __( 'Connection Expired' ),
|
|
19
|
-
description: __(
|
|
20
|
-
'The connection to the collaborative editing server has expired.'
|
|
21
|
-
),
|
|
22
|
-
},
|
|
23
|
-
'connection-limit-exceeded': {
|
|
24
|
-
title: __( 'Connection Limit Exceeded' ),
|
|
25
|
-
description: __(
|
|
26
|
-
'The collaborative editing server has reached its maximum connection capacity. ' +
|
|
27
|
-
'Please try again later or contact your site administrator.'
|
|
28
|
-
),
|
|
29
|
-
},
|
|
30
|
-
'unknown-error': {
|
|
31
|
-
title: __( 'Disconnected' ),
|
|
32
|
-
description: __(
|
|
33
|
-
'You are currently disconnected from the collaborative editing server. ' +
|
|
34
|
-
'Editing is temporarily disabled to prevent conflicts.'
|
|
35
|
-
),
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Get user-facing title and description from a sync connection error.
|
|
41
|
-
*
|
|
42
|
-
* Provides default messages based on error.code.
|
|
43
|
-
*
|
|
44
|
-
* @param {Object} error - Connection error object.
|
|
45
|
-
* @return {Object} Object with title and description strings.
|
|
46
|
-
*/
|
|
47
|
-
export function getSyncErrorMessages( error ) {
|
|
48
|
-
if ( ERROR_MESSAGES[ error?.code ] ) {
|
|
49
|
-
return ERROR_MESSAGES[ error.code ];
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return ERROR_MESSAGES[ 'unknown-error' ];
|
|
53
|
-
}
|