@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
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect, select } from '@wordpress/data';
|
|
5
|
+
import { useCopyToClipboard } from '@wordpress/compose';
|
|
6
|
+
// @ts-ignore No exported types.
|
|
7
|
+
import { serialize } from '@wordpress/blocks';
|
|
8
|
+
import {
|
|
9
|
+
store as coreDataStore,
|
|
10
|
+
privateApis as coreDataPrivateApis,
|
|
11
|
+
} from '@wordpress/core-data';
|
|
12
|
+
// @ts-expect-error - No type declarations available for @wordpress/block-editor
|
|
13
|
+
// prettier-ignore
|
|
14
|
+
import { privateApis, store as blockEditorStore } from '@wordpress/block-editor';
|
|
15
|
+
import {
|
|
16
|
+
Button,
|
|
17
|
+
Modal,
|
|
18
|
+
__experimentalHStack as HStack,
|
|
19
|
+
__experimentalVStack as VStack,
|
|
20
|
+
} from '@wordpress/components';
|
|
21
|
+
import { applyFilters } from '@wordpress/hooks';
|
|
22
|
+
import { useState, useEffect } from '@wordpress/element';
|
|
23
|
+
import { __, sprintf, _n } from '@wordpress/i18n';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Internal dependencies
|
|
27
|
+
*/
|
|
28
|
+
import { getSyncErrorMessages } from '../../utils/sync-error-messages';
|
|
29
|
+
import { store as editorStore } from '../../store';
|
|
30
|
+
import { unlock } from '../../lock-unlock';
|
|
31
|
+
import { useRetryCountdown } from './use-retry-countdown';
|
|
32
|
+
|
|
33
|
+
const { BlockCanvasCover } = unlock( privateApis );
|
|
34
|
+
const { retrySyncConnection } = unlock( coreDataPrivateApis );
|
|
35
|
+
|
|
36
|
+
// Debounce time for initial disconnected status to allow connection to establish.
|
|
37
|
+
const INITIAL_DISCONNECTED_DEBOUNCE_MS = 20000;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Sync connection modal that displays when any entity reports a disconnection.
|
|
41
|
+
* Uses BlockCanvasCover.Fill to render in the block canvas.
|
|
42
|
+
*
|
|
43
|
+
* @return The modal component or null if not disconnected.
|
|
44
|
+
*/
|
|
45
|
+
export function SyncConnectionErrorModal() {
|
|
46
|
+
const [ hasInitialized, setHasInitialized ] = useState( false );
|
|
47
|
+
const [ showModal, setShowModal ] = useState( false );
|
|
48
|
+
const [ isManualRetryAvailable, setIsManualRetryAvailable ] =
|
|
49
|
+
useState( false );
|
|
50
|
+
|
|
51
|
+
const { connectionStatus, isCollaborationEnabled, postType } = useSelect(
|
|
52
|
+
( selectFn ) => {
|
|
53
|
+
const { getSyncConnectionStatus, getPostType } = unlock(
|
|
54
|
+
selectFn( coreDataStore )
|
|
55
|
+
);
|
|
56
|
+
const { getCurrentPostType, isCollaborationEnabledForCurrentPost } =
|
|
57
|
+
unlock( selectFn( editorStore ) );
|
|
58
|
+
const currentPostType = getCurrentPostType();
|
|
59
|
+
return {
|
|
60
|
+
connectionStatus: getSyncConnectionStatus() || null,
|
|
61
|
+
isCollaborationEnabled: isCollaborationEnabledForCurrentPost(),
|
|
62
|
+
postType: currentPostType
|
|
63
|
+
? getPostType( currentPostType )
|
|
64
|
+
: null,
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
[]
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const { onManualRetry, secondsRemaining } =
|
|
71
|
+
useRetryCountdown( connectionStatus );
|
|
72
|
+
|
|
73
|
+
const copyButtonRef = useCopyToClipboard( () => {
|
|
74
|
+
const blocks = select( blockEditorStore ).getBlocks();
|
|
75
|
+
return serialize( blocks );
|
|
76
|
+
} );
|
|
77
|
+
|
|
78
|
+
// Set hasInitialized after a debounce to give extra time on initial load.
|
|
79
|
+
useEffect( () => {
|
|
80
|
+
const timeout = setTimeout( () => {
|
|
81
|
+
setHasInitialized( true );
|
|
82
|
+
}, INITIAL_DISCONNECTED_DEBOUNCE_MS );
|
|
83
|
+
|
|
84
|
+
return () => clearTimeout( timeout );
|
|
85
|
+
}, [] );
|
|
86
|
+
|
|
87
|
+
// Track retry availability separately from the raw connection status.
|
|
88
|
+
// The polling manager briefly emits `{ status: 'connecting' }` without
|
|
89
|
+
// `canManuallyRetry` when a retry is kicked off, which would otherwise
|
|
90
|
+
// unmount the Retry button briefly.
|
|
91
|
+
useEffect( () => {
|
|
92
|
+
if ( 'connecting' === connectionStatus?.status ) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
setIsManualRetryAvailable(
|
|
97
|
+
connectionStatus !== null &&
|
|
98
|
+
'canManuallyRetry' in connectionStatus &&
|
|
99
|
+
connectionStatus.canManuallyRetry === true
|
|
100
|
+
);
|
|
101
|
+
}, [ connectionStatus ] );
|
|
102
|
+
|
|
103
|
+
// Show the modal when disconnected and either retries are exhausted or
|
|
104
|
+
// no retry is available (unrecoverable error). Hide on reconnect.
|
|
105
|
+
// The 'connecting' state is ignored so the modal preserves its current
|
|
106
|
+
// visibility during active retry attempts.
|
|
107
|
+
const canRetry =
|
|
108
|
+
connectionStatus &&
|
|
109
|
+
'disconnected' === connectionStatus.status &&
|
|
110
|
+
( connectionStatus.canManuallyRetry ||
|
|
111
|
+
connectionStatus.willAutoRetryInMs );
|
|
112
|
+
|
|
113
|
+
useEffect( () => {
|
|
114
|
+
if ( 'connected' === connectionStatus?.status ) {
|
|
115
|
+
setShowModal( false );
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (
|
|
120
|
+
connectionStatus?.status &&
|
|
121
|
+
'connecting' !== connectionStatus.status &&
|
|
122
|
+
( ! canRetry || connectionStatus.backgroundRetriesFailed )
|
|
123
|
+
) {
|
|
124
|
+
setShowModal( true );
|
|
125
|
+
}
|
|
126
|
+
}, [ connectionStatus, canRetry ] );
|
|
127
|
+
|
|
128
|
+
if ( ! isCollaborationEnabled || ! hasInitialized || ! showModal ) {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const error =
|
|
133
|
+
connectionStatus && 'error' in connectionStatus
|
|
134
|
+
? connectionStatus?.error
|
|
135
|
+
: undefined;
|
|
136
|
+
|
|
137
|
+
// For unrecoverable errors (no retry available), allow plugins to handle
|
|
138
|
+
// the error themselves. If a plugin returns a value other than false, it
|
|
139
|
+
// signals that it has taken over error display and the default modal is
|
|
140
|
+
// suppressed.
|
|
141
|
+
//
|
|
142
|
+
// @example
|
|
143
|
+
// ```js
|
|
144
|
+
// wp.hooks.addFilter(
|
|
145
|
+
// 'editor.isSyncConnectionErrorHandled',
|
|
146
|
+
// 'my-plugin/handle-sync-error',
|
|
147
|
+
// ( isHandled, errorCode ) => {
|
|
148
|
+
// if ( errorCode === 'connection-limit-exceeded' ) {
|
|
149
|
+
// return true; // Plugin handles this error via its own UI.
|
|
150
|
+
// }
|
|
151
|
+
// return isHandled;
|
|
152
|
+
// }
|
|
153
|
+
// );
|
|
154
|
+
// ```
|
|
155
|
+
if (
|
|
156
|
+
! canRetry &&
|
|
157
|
+
applyFilters(
|
|
158
|
+
'editor.isSyncConnectionErrorHandled',
|
|
159
|
+
false,
|
|
160
|
+
error?.code
|
|
161
|
+
) !== false
|
|
162
|
+
) {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const manualRetry = isManualRetryAvailable
|
|
167
|
+
? () => {
|
|
168
|
+
onManualRetry();
|
|
169
|
+
retrySyncConnection();
|
|
170
|
+
}
|
|
171
|
+
: undefined;
|
|
172
|
+
|
|
173
|
+
const messages = getSyncErrorMessages( error );
|
|
174
|
+
|
|
175
|
+
let retryCountdownText: string = '';
|
|
176
|
+
let isRetrying = false;
|
|
177
|
+
if ( secondsRemaining && secondsRemaining > 0 ) {
|
|
178
|
+
retryCountdownText = sprintf(
|
|
179
|
+
/* translators: %d: number of seconds until retry */
|
|
180
|
+
_n(
|
|
181
|
+
'Retrying connection in %d second\u2026',
|
|
182
|
+
'Retrying connection in %d seconds\u2026',
|
|
183
|
+
secondsRemaining
|
|
184
|
+
),
|
|
185
|
+
secondsRemaining
|
|
186
|
+
);
|
|
187
|
+
} else if ( 0 === secondsRemaining ) {
|
|
188
|
+
isRetrying = true;
|
|
189
|
+
retryCountdownText = __( 'Retrying\u2026' );
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
let editPostHref = 'edit.php';
|
|
193
|
+
if ( postType?.slug ) {
|
|
194
|
+
editPostHref = `edit.php?post_type=${ postType.slug }`;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return (
|
|
198
|
+
<BlockCanvasCover.Fill>
|
|
199
|
+
<Modal
|
|
200
|
+
overlayClassName="editor-sync-connection-error-modal"
|
|
201
|
+
isDismissible={ false }
|
|
202
|
+
onRequestClose={ () => {} }
|
|
203
|
+
shouldCloseOnClickOutside={ false }
|
|
204
|
+
shouldCloseOnEsc={ false }
|
|
205
|
+
size="medium"
|
|
206
|
+
title={ messages.title }
|
|
207
|
+
>
|
|
208
|
+
<VStack spacing={ 6 }>
|
|
209
|
+
<p>{ messages.description }</p>
|
|
210
|
+
{ retryCountdownText && (
|
|
211
|
+
<p className="editor-sync-connection-error-modal__retry-countdown">
|
|
212
|
+
{ retryCountdownText }
|
|
213
|
+
</p>
|
|
214
|
+
) }
|
|
215
|
+
<HStack justify="right">
|
|
216
|
+
<Button
|
|
217
|
+
__next40pxDefaultSize
|
|
218
|
+
href={ editPostHref }
|
|
219
|
+
isDestructive
|
|
220
|
+
variant="tertiary"
|
|
221
|
+
>
|
|
222
|
+
{ sprintf(
|
|
223
|
+
/* translators: %s: Post type name (e.g., "Posts", "Pages"). */
|
|
224
|
+
__( 'Back to %s' ),
|
|
225
|
+
postType?.labels?.name ?? __( 'Posts' )
|
|
226
|
+
) }
|
|
227
|
+
</Button>
|
|
228
|
+
<Button
|
|
229
|
+
__next40pxDefaultSize
|
|
230
|
+
ref={ copyButtonRef }
|
|
231
|
+
variant={ manualRetry ? 'secondary' : 'primary' }
|
|
232
|
+
>
|
|
233
|
+
{ __( 'Copy Post Content' ) }
|
|
234
|
+
</Button>
|
|
235
|
+
{ manualRetry && (
|
|
236
|
+
<Button
|
|
237
|
+
__next40pxDefaultSize
|
|
238
|
+
accessibleWhenDisabled
|
|
239
|
+
aria-disabled={ isRetrying }
|
|
240
|
+
disabled={ isRetrying }
|
|
241
|
+
isBusy={ isRetrying }
|
|
242
|
+
variant="primary"
|
|
243
|
+
onClick={ manualRetry }
|
|
244
|
+
>
|
|
245
|
+
{ __( 'Retry' ) }
|
|
246
|
+
</Button>
|
|
247
|
+
) }
|
|
248
|
+
</HStack>
|
|
249
|
+
</VStack>
|
|
250
|
+
</Modal>
|
|
251
|
+
</BlockCanvasCover.Fill>
|
|
252
|
+
);
|
|
253
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
@use "@wordpress/base-styles/colors" as *;
|
|
2
|
+
@use "@wordpress/base-styles/z-index" as *;
|
|
3
|
+
|
|
4
|
+
.editor-sync-connection-error-modal {
|
|
5
|
+
z-index: z-index(".editor-sync-connection-error-modal");
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.editor-sync-connection-error-modal p {
|
|
9
|
+
margin: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.editor-sync-connection-error-modal__retry-countdown {
|
|
13
|
+
color: $gray-700;
|
|
14
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ConnectionStatus } from '@wordpress/core-data';
|
|
5
|
+
import { useState, useEffect, useRef } from '@wordpress/element';
|
|
6
|
+
|
|
7
|
+
interface UseRetryCountdownResult {
|
|
8
|
+
onManualRetry: () => void;
|
|
9
|
+
secondsRemaining?: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function useRetryCountdown(
|
|
13
|
+
connectionStatus?: ConnectionStatus | null
|
|
14
|
+
): UseRetryCountdownResult {
|
|
15
|
+
const [ secondsRemaining, setSecondsRemaining ] = useState< number >();
|
|
16
|
+
const hasRetriedRef = useRef( false );
|
|
17
|
+
|
|
18
|
+
useEffect( () => {
|
|
19
|
+
if ( ! connectionStatus ) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Only clear countdown when explicitly connected.
|
|
24
|
+
if ( 'connected' === connectionStatus.status ) {
|
|
25
|
+
setSecondsRemaining( undefined );
|
|
26
|
+
hasRetriedRef.current = false;
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// For transient states (e.g. 'connecting' during a retry attempt)
|
|
31
|
+
// or when retryInMs is not yet available, keep the previous
|
|
32
|
+
// countdown value to avoid a brief flash.
|
|
33
|
+
if (
|
|
34
|
+
'disconnected' !== connectionStatus.status ||
|
|
35
|
+
! connectionStatus.willAutoRetryInMs
|
|
36
|
+
) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const { willAutoRetryInMs: retryInMs } = connectionStatus;
|
|
41
|
+
const retryAt = Date.now() + retryInMs;
|
|
42
|
+
|
|
43
|
+
// After a retry attempt (manual or automatic), show "Retrying..."
|
|
44
|
+
// for 500ms before starting the next countdown. Skip the delay on
|
|
45
|
+
// the very first disconnect so the countdown starts immediately.
|
|
46
|
+
const hasRetried = hasRetriedRef.current;
|
|
47
|
+
hasRetriedRef.current = true;
|
|
48
|
+
|
|
49
|
+
if ( hasRetried ) {
|
|
50
|
+
setSecondsRemaining( 0 );
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let countdownIntervalId: ReturnType< typeof setInterval > | null = null;
|
|
54
|
+
|
|
55
|
+
const startCountdown = () => {
|
|
56
|
+
setSecondsRemaining( Math.ceil( ( retryAt - Date.now() ) / 1000 ) );
|
|
57
|
+
|
|
58
|
+
countdownIntervalId = setInterval( () => {
|
|
59
|
+
const remaining = Math.ceil( ( retryAt - Date.now() ) / 1000 );
|
|
60
|
+
setSecondsRemaining( Math.max( 0, remaining ) );
|
|
61
|
+
|
|
62
|
+
if ( remaining <= 0 && countdownIntervalId ) {
|
|
63
|
+
clearInterval( countdownIntervalId );
|
|
64
|
+
}
|
|
65
|
+
}, 1000 );
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const retryingDelayId = hasRetried
|
|
69
|
+
? setTimeout( startCountdown, 500 )
|
|
70
|
+
: null;
|
|
71
|
+
|
|
72
|
+
if ( ! retryingDelayId ) {
|
|
73
|
+
startCountdown();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return () => {
|
|
77
|
+
if ( retryingDelayId ) {
|
|
78
|
+
clearTimeout( retryingDelayId );
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if ( countdownIntervalId ) {
|
|
82
|
+
clearInterval( countdownIntervalId );
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}, [ connectionStatus ] );
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
onManualRetry: () => {
|
|
89
|
+
setSecondsRemaining( 0 );
|
|
90
|
+
},
|
|
91
|
+
secondsRemaining,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
@@ -6,8 +6,6 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
|
6
6
|
import { PanelBody } from '@wordpress/components';
|
|
7
7
|
import { __ } from '@wordpress/i18n';
|
|
8
8
|
import { store as interfaceStore } from '@wordpress/interface';
|
|
9
|
-
import { applyFilters } from '@wordpress/hooks';
|
|
10
|
-
import { useMemo } from '@wordpress/element';
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
11
|
* Internal dependencies
|
|
@@ -15,54 +13,30 @@ import { useMemo } from '@wordpress/element';
|
|
|
15
13
|
import { unlock } from '../../lock-unlock';
|
|
16
14
|
import { TEMPLATE_POST_TYPE } from '../../store/constants';
|
|
17
15
|
import { store as editorStore } from '../../store';
|
|
16
|
+
import usePostContentBlockTypes from '../provider/use-post-content-block-types';
|
|
18
17
|
|
|
19
18
|
const { BlockQuickNavigation } = unlock( blockEditorPrivateApis );
|
|
20
19
|
|
|
21
|
-
const POST_CONTENT_BLOCK_TYPES = [
|
|
22
|
-
'core/post-title',
|
|
23
|
-
'core/post-featured-image',
|
|
24
|
-
'core/post-content',
|
|
25
|
-
];
|
|
26
|
-
|
|
27
20
|
const TEMPLATE_PART_BLOCK = 'core/template-part';
|
|
28
21
|
|
|
29
|
-
|
|
30
|
-
const postContentBlockTypes =
|
|
31
|
-
() =>
|
|
32
|
-
applyFilters(
|
|
33
|
-
'editor.postContentBlockTypes',
|
|
34
|
-
POST_CONTENT_BLOCK_TYPES
|
|
35
|
-
),
|
|
36
|
-
[]
|
|
37
|
-
);
|
|
22
|
+
function TemplateContentPanelInner( { postType } ) {
|
|
23
|
+
const postContentBlockTypes = usePostContentBlockTypes();
|
|
38
24
|
|
|
39
|
-
const
|
|
25
|
+
const clientIds = useSelect(
|
|
40
26
|
( select ) => {
|
|
41
|
-
const {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
postType: _postType,
|
|
49
|
-
clientIds: getPostBlocksByName(
|
|
50
|
-
TEMPLATE_POST_TYPE === _postType
|
|
51
|
-
? TEMPLATE_PART_BLOCK
|
|
52
|
-
: postContentBlockTypes
|
|
53
|
-
),
|
|
54
|
-
renderingMode: getRenderingMode(),
|
|
55
|
-
};
|
|
27
|
+
const { getPostBlocksByName } = unlock( select( editorStore ) );
|
|
28
|
+
return getPostBlocksByName(
|
|
29
|
+
TEMPLATE_POST_TYPE === postType
|
|
30
|
+
? TEMPLATE_PART_BLOCK
|
|
31
|
+
: postContentBlockTypes
|
|
32
|
+
);
|
|
56
33
|
},
|
|
57
|
-
[ postContentBlockTypes ]
|
|
34
|
+
[ postType, postContentBlockTypes ]
|
|
58
35
|
);
|
|
59
36
|
|
|
60
37
|
const { enableComplementaryArea } = useDispatch( interfaceStore );
|
|
61
38
|
|
|
62
|
-
if (
|
|
63
|
-
( renderingMode === 'post-only' && postType !== TEMPLATE_POST_TYPE ) ||
|
|
64
|
-
clientIds.length === 0
|
|
65
|
-
) {
|
|
39
|
+
if ( clientIds.length === 0 ) {
|
|
66
40
|
return null;
|
|
67
41
|
}
|
|
68
42
|
|
|
@@ -77,3 +51,21 @@ export default function TemplateContentPanel() {
|
|
|
77
51
|
</PanelBody>
|
|
78
52
|
);
|
|
79
53
|
}
|
|
54
|
+
|
|
55
|
+
export default function TemplateContentPanel() {
|
|
56
|
+
const { postType, renderingMode } = useSelect( ( select ) => {
|
|
57
|
+
const { getCurrentPostType, getRenderingMode } = unlock(
|
|
58
|
+
select( editorStore )
|
|
59
|
+
);
|
|
60
|
+
return {
|
|
61
|
+
postType: getCurrentPostType(),
|
|
62
|
+
renderingMode: getRenderingMode(),
|
|
63
|
+
};
|
|
64
|
+
}, [] );
|
|
65
|
+
|
|
66
|
+
if ( renderingMode === 'post-only' && postType !== TEMPLATE_POST_TYPE ) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return <TemplateContentPanelInner postType={ postType } />;
|
|
71
|
+
}
|
|
@@ -3,15 +3,46 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
5
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
+
import {
|
|
8
|
+
MenuItem,
|
|
9
|
+
__experimentalConfirmDialog as ConfirmDialog,
|
|
10
|
+
} from '@wordpress/components';
|
|
11
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
12
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
13
|
+
import { useState } from '@wordpress/element';
|
|
8
14
|
|
|
9
15
|
export default function ConvertToRegularBlocks( { clientId, onClose } ) {
|
|
16
|
+
const [ showConfirmDialog, setShowConfirmDialog ] = useState( false );
|
|
17
|
+
|
|
10
18
|
const { getBlocks } = useSelect( blockEditorStore );
|
|
11
19
|
const { replaceBlocks } = useDispatch( blockEditorStore );
|
|
12
20
|
|
|
13
|
-
const canRemove = useSelect(
|
|
14
|
-
( select ) =>
|
|
21
|
+
const { canRemove, templatePartTitle } = useSelect(
|
|
22
|
+
( select ) => {
|
|
23
|
+
const { canRemoveBlock, getBlock } = select( blockEditorStore );
|
|
24
|
+
const { getEntityRecord, getCurrentTheme } = select( coreStore );
|
|
25
|
+
|
|
26
|
+
const block = getBlock( clientId );
|
|
27
|
+
const { slug, theme } = block?.attributes ?? {};
|
|
28
|
+
const themeSlug = theme || getCurrentTheme()?.stylesheet;
|
|
29
|
+
const templatePartId =
|
|
30
|
+
themeSlug && slug ? `${ themeSlug }//${ slug }` : null;
|
|
31
|
+
const entity = templatePartId
|
|
32
|
+
? getEntityRecord(
|
|
33
|
+
'postType',
|
|
34
|
+
'wp_template_part',
|
|
35
|
+
templatePartId
|
|
36
|
+
)
|
|
37
|
+
: null;
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
canRemove: canRemoveBlock( clientId ),
|
|
41
|
+
templatePartTitle: entity?.title?.rendered
|
|
42
|
+
? decodeEntities( entity.title.rendered )
|
|
43
|
+
: null,
|
|
44
|
+
};
|
|
45
|
+
},
|
|
15
46
|
[ clientId ]
|
|
16
47
|
);
|
|
17
48
|
|
|
@@ -19,14 +50,45 @@ export default function ConvertToRegularBlocks( { clientId, onClose } ) {
|
|
|
19
50
|
return null;
|
|
20
51
|
}
|
|
21
52
|
|
|
53
|
+
const title = templatePartTitle
|
|
54
|
+
? sprintf(
|
|
55
|
+
/* translators: %s: template part title, e.g. "Header" */
|
|
56
|
+
__( 'Detach %s?' ),
|
|
57
|
+
templatePartTitle
|
|
58
|
+
)
|
|
59
|
+
: __( 'Detach template part?' );
|
|
60
|
+
|
|
61
|
+
const message = templatePartTitle
|
|
62
|
+
? sprintf(
|
|
63
|
+
/* translators: %s: template part title, e.g. "Header" */
|
|
64
|
+
__(
|
|
65
|
+
'The blocks will be separated from the original template part and will be fully editable. Future changes to the %s template part will not apply here.'
|
|
66
|
+
),
|
|
67
|
+
templatePartTitle
|
|
68
|
+
)
|
|
69
|
+
: __(
|
|
70
|
+
'The blocks will be separated from the original template part and will be fully editable. Future changes to the template part will not apply here.'
|
|
71
|
+
);
|
|
72
|
+
|
|
22
73
|
return (
|
|
23
|
-
|
|
24
|
-
onClick={ () =>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
74
|
+
<>
|
|
75
|
+
<MenuItem onClick={ () => setShowConfirmDialog( true ) }>
|
|
76
|
+
{ __( 'Detach' ) }
|
|
77
|
+
</MenuItem>
|
|
78
|
+
<ConfirmDialog
|
|
79
|
+
isOpen={ showConfirmDialog }
|
|
80
|
+
onConfirm={ () => {
|
|
81
|
+
replaceBlocks( clientId, getBlocks( clientId ) );
|
|
82
|
+
onClose();
|
|
83
|
+
} }
|
|
84
|
+
onCancel={ () => setShowConfirmDialog( false ) }
|
|
85
|
+
confirmButtonText={ __( 'Detach' ) }
|
|
86
|
+
size="medium"
|
|
87
|
+
title={ title }
|
|
88
|
+
__experimentalHideHeader={ false }
|
|
89
|
+
>
|
|
90
|
+
{ message }
|
|
91
|
+
</ConfirmDialog>
|
|
92
|
+
</>
|
|
31
93
|
);
|
|
32
94
|
}
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
import { useZoomOutModeExit } from './use-zoom-out-mode-exit';
|
|
42
42
|
import { usePaddingAppender } from './use-padding-appender';
|
|
43
43
|
import { useEditContentOnlySectionExit } from './use-edit-content-only-section-exit';
|
|
44
|
-
import {
|
|
44
|
+
import { SyncConnectionErrorModal } from '../sync-connection-error-modal';
|
|
45
45
|
|
|
46
46
|
const {
|
|
47
47
|
LayoutStyle,
|
|
@@ -334,8 +334,6 @@ function VisualEditor( {
|
|
|
334
334
|
// Disable resizing in zoomed-out mode.
|
|
335
335
|
! isZoomedOut;
|
|
336
336
|
|
|
337
|
-
const isNavigationPreview = postType === NAVIGATION_POST_TYPE && isPreview;
|
|
338
|
-
|
|
339
337
|
// Calculate the minimum height including scroll offset to fit all notes.
|
|
340
338
|
const calculatedMinHeight = useMemo( () => {
|
|
341
339
|
if ( ! localRef.current ) {
|
|
@@ -354,8 +352,6 @@ function VisualEditor( {
|
|
|
354
352
|
! isPreview && renderingMode === 'post-only' && ! isDesignPostType
|
|
355
353
|
);
|
|
356
354
|
|
|
357
|
-
const centerContentCSS = `display:flex;align-items:center;justify-content:center;`;
|
|
358
|
-
|
|
359
355
|
const iframeStyles = useMemo( () => {
|
|
360
356
|
return [
|
|
361
357
|
...( styles ?? [] ),
|
|
@@ -370,32 +366,19 @@ function VisualEditor( {
|
|
|
370
366
|
}}.is-root-container{display:flow-root;${
|
|
371
367
|
// Some themes will have `min-height: 100vh` for the root container,
|
|
372
368
|
// which isn't a requirement in auto resize mode.
|
|
373
|
-
enableResizing
|
|
374
|
-
? 'min-height:0!important;'
|
|
375
|
-
: ''
|
|
369
|
+
enableResizing ? 'min-height:0!important;' : ''
|
|
376
370
|
}}
|
|
377
371
|
${ paddingStyle ? paddingStyle : '' }
|
|
378
372
|
${
|
|
379
373
|
enableResizing
|
|
380
|
-
? `.block-editor-iframe__html{background:var(--wp-editor-canvas-background);min-height:100vh
|
|
381
|
-
: ''
|
|
382
|
-
}${
|
|
383
|
-
isNavigationPreview
|
|
384
|
-
? `.block-editor-iframe__body{${ centerContentCSS }}`
|
|
374
|
+
? `.block-editor-iframe__html{background:var(--wp-editor-canvas-background);display:flex;align-items:center;justify-content:center;min-height:100vh;}.block-editor-iframe__body{width:100%;}`
|
|
385
375
|
: ''
|
|
386
376
|
}`,
|
|
387
|
-
// The CSS
|
|
377
|
+
// The CSS above centers the body content vertically when resizing is enabled and applies a background
|
|
388
378
|
// color to the iframe HTML element to match the background color of the editor canvas.
|
|
389
|
-
// The CSS for isNavigationPreview centers the body content vertically and horizontally when the navigation is in preview mode.
|
|
390
379
|
},
|
|
391
380
|
];
|
|
392
|
-
}, [
|
|
393
|
-
styles,
|
|
394
|
-
enableResizing,
|
|
395
|
-
isNavigationPreview,
|
|
396
|
-
calculatedMinHeight,
|
|
397
|
-
paddingStyle,
|
|
398
|
-
] );
|
|
381
|
+
}, [ styles, enableResizing, calculatedMinHeight, paddingStyle ] );
|
|
399
382
|
|
|
400
383
|
const typewriterRef = useTypewriter();
|
|
401
384
|
contentRef = useMergeRefs( [
|
|
@@ -427,7 +410,7 @@ function VisualEditor( {
|
|
|
427
410
|
}
|
|
428
411
|
) }
|
|
429
412
|
>
|
|
430
|
-
<
|
|
413
|
+
<SyncConnectionErrorModal />
|
|
431
414
|
<ResizableEditor enableResizing={ enableResizing } height="100%">
|
|
432
415
|
<BlockCanvas
|
|
433
416
|
shouldIframe={ ! disableIframe }
|