@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,187 @@
|
|
|
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-error-modal/index.tsx
|
|
21
|
+
var sync_connection_error_modal_exports = {};
|
|
22
|
+
__export(sync_connection_error_modal_exports, {
|
|
23
|
+
SyncConnectionErrorModal: () => SyncConnectionErrorModal
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(sync_connection_error_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_hooks = require("@wordpress/hooks");
|
|
33
|
+
var import_element = require("@wordpress/element");
|
|
34
|
+
var import_i18n = require("@wordpress/i18n");
|
|
35
|
+
var import_sync_error_messages = require("../../utils/sync-error-messages.cjs");
|
|
36
|
+
var import_store = require("../../store/index.cjs");
|
|
37
|
+
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
38
|
+
var import_use_retry_countdown = require("./use-retry-countdown.cjs");
|
|
39
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
+
var { BlockCanvasCover } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
|
|
41
|
+
var { retrySyncConnection } = (0, import_lock_unlock.unlock)(import_core_data.privateApis);
|
|
42
|
+
var INITIAL_DISCONNECTED_DEBOUNCE_MS = 2e4;
|
|
43
|
+
function SyncConnectionErrorModal() {
|
|
44
|
+
const [hasInitialized, setHasInitialized] = (0, import_element.useState)(false);
|
|
45
|
+
const [showModal, setShowModal] = (0, import_element.useState)(false);
|
|
46
|
+
const [isManualRetryAvailable, setIsManualRetryAvailable] = (0, import_element.useState)(false);
|
|
47
|
+
const { connectionStatus, isCollaborationEnabled, postType } = (0, import_data.useSelect)(
|
|
48
|
+
(selectFn) => {
|
|
49
|
+
const { getSyncConnectionStatus, getPostType } = (0, import_lock_unlock.unlock)(
|
|
50
|
+
selectFn(import_core_data.store)
|
|
51
|
+
);
|
|
52
|
+
const { getCurrentPostType, isCollaborationEnabledForCurrentPost } = (0, import_lock_unlock.unlock)(selectFn(import_store.store));
|
|
53
|
+
const currentPostType = getCurrentPostType();
|
|
54
|
+
return {
|
|
55
|
+
connectionStatus: getSyncConnectionStatus() || null,
|
|
56
|
+
isCollaborationEnabled: isCollaborationEnabledForCurrentPost(),
|
|
57
|
+
postType: currentPostType ? getPostType(currentPostType) : null
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
[]
|
|
61
|
+
);
|
|
62
|
+
const { onManualRetry, secondsRemaining } = (0, import_use_retry_countdown.useRetryCountdown)(connectionStatus);
|
|
63
|
+
const copyButtonRef = (0, import_compose.useCopyToClipboard)(() => {
|
|
64
|
+
const blocks = (0, import_data.select)(import_block_editor.store).getBlocks();
|
|
65
|
+
return (0, import_blocks.serialize)(blocks);
|
|
66
|
+
});
|
|
67
|
+
(0, import_element.useEffect)(() => {
|
|
68
|
+
const timeout = setTimeout(() => {
|
|
69
|
+
setHasInitialized(true);
|
|
70
|
+
}, INITIAL_DISCONNECTED_DEBOUNCE_MS);
|
|
71
|
+
return () => clearTimeout(timeout);
|
|
72
|
+
}, []);
|
|
73
|
+
(0, import_element.useEffect)(() => {
|
|
74
|
+
if ("connecting" === connectionStatus?.status) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
setIsManualRetryAvailable(
|
|
78
|
+
connectionStatus !== null && "canManuallyRetry" in connectionStatus && connectionStatus.canManuallyRetry === true
|
|
79
|
+
);
|
|
80
|
+
}, [connectionStatus]);
|
|
81
|
+
const canRetry = connectionStatus && "disconnected" === connectionStatus.status && (connectionStatus.canManuallyRetry || connectionStatus.willAutoRetryInMs);
|
|
82
|
+
(0, import_element.useEffect)(() => {
|
|
83
|
+
if ("connected" === connectionStatus?.status) {
|
|
84
|
+
setShowModal(false);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (connectionStatus?.status && "connecting" !== connectionStatus.status && (!canRetry || connectionStatus.backgroundRetriesFailed)) {
|
|
88
|
+
setShowModal(true);
|
|
89
|
+
}
|
|
90
|
+
}, [connectionStatus, canRetry]);
|
|
91
|
+
if (!isCollaborationEnabled || !hasInitialized || !showModal) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
const error = connectionStatus && "error" in connectionStatus ? connectionStatus?.error : void 0;
|
|
95
|
+
if (!canRetry && (0, import_hooks.applyFilters)(
|
|
96
|
+
"editor.isSyncConnectionErrorHandled",
|
|
97
|
+
false,
|
|
98
|
+
error?.code
|
|
99
|
+
) !== false) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
const manualRetry = isManualRetryAvailable ? () => {
|
|
103
|
+
onManualRetry();
|
|
104
|
+
retrySyncConnection();
|
|
105
|
+
} : void 0;
|
|
106
|
+
const messages = (0, import_sync_error_messages.getSyncErrorMessages)(error);
|
|
107
|
+
let retryCountdownText = "";
|
|
108
|
+
let isRetrying = false;
|
|
109
|
+
if (secondsRemaining && secondsRemaining > 0) {
|
|
110
|
+
retryCountdownText = (0, import_i18n.sprintf)(
|
|
111
|
+
/* translators: %d: number of seconds until retry */
|
|
112
|
+
(0, import_i18n._n)(
|
|
113
|
+
"Retrying connection in %d second\u2026",
|
|
114
|
+
"Retrying connection in %d seconds\u2026",
|
|
115
|
+
secondsRemaining
|
|
116
|
+
),
|
|
117
|
+
secondsRemaining
|
|
118
|
+
);
|
|
119
|
+
} else if (0 === secondsRemaining) {
|
|
120
|
+
isRetrying = true;
|
|
121
|
+
retryCountdownText = (0, import_i18n.__)("Retrying\u2026");
|
|
122
|
+
}
|
|
123
|
+
let editPostHref = "edit.php";
|
|
124
|
+
if (postType?.slug) {
|
|
125
|
+
editPostHref = `edit.php?post_type=${postType.slug}`;
|
|
126
|
+
}
|
|
127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BlockCanvasCover.Fill, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
128
|
+
import_components.Modal,
|
|
129
|
+
{
|
|
130
|
+
overlayClassName: "editor-sync-connection-error-modal",
|
|
131
|
+
isDismissible: false,
|
|
132
|
+
onRequestClose: () => {
|
|
133
|
+
},
|
|
134
|
+
shouldCloseOnClickOutside: false,
|
|
135
|
+
shouldCloseOnEsc: false,
|
|
136
|
+
size: "medium",
|
|
137
|
+
title: messages.title,
|
|
138
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalVStack, { spacing: 6, children: [
|
|
139
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: messages.description }),
|
|
140
|
+
retryCountdownText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "editor-sync-connection-error-modal__retry-countdown", children: retryCountdownText }),
|
|
141
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalHStack, { justify: "right", children: [
|
|
142
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
143
|
+
import_components.Button,
|
|
144
|
+
{
|
|
145
|
+
__next40pxDefaultSize: true,
|
|
146
|
+
href: editPostHref,
|
|
147
|
+
isDestructive: true,
|
|
148
|
+
variant: "tertiary",
|
|
149
|
+
children: (0, import_i18n.sprintf)(
|
|
150
|
+
/* translators: %s: Post type name (e.g., "Posts", "Pages"). */
|
|
151
|
+
(0, import_i18n.__)("Back to %s"),
|
|
152
|
+
postType?.labels?.name ?? (0, import_i18n.__)("Posts")
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
),
|
|
156
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
157
|
+
import_components.Button,
|
|
158
|
+
{
|
|
159
|
+
__next40pxDefaultSize: true,
|
|
160
|
+
ref: copyButtonRef,
|
|
161
|
+
variant: manualRetry ? "secondary" : "primary",
|
|
162
|
+
children: (0, import_i18n.__)("Copy Post Content")
|
|
163
|
+
}
|
|
164
|
+
),
|
|
165
|
+
manualRetry && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
166
|
+
import_components.Button,
|
|
167
|
+
{
|
|
168
|
+
__next40pxDefaultSize: true,
|
|
169
|
+
accessibleWhenDisabled: true,
|
|
170
|
+
"aria-disabled": isRetrying,
|
|
171
|
+
disabled: isRetrying,
|
|
172
|
+
isBusy: isRetrying,
|
|
173
|
+
variant: "primary",
|
|
174
|
+
onClick: manualRetry,
|
|
175
|
+
children: (0, import_i18n.__)("Retry")
|
|
176
|
+
}
|
|
177
|
+
)
|
|
178
|
+
] })
|
|
179
|
+
] })
|
|
180
|
+
}
|
|
181
|
+
) });
|
|
182
|
+
}
|
|
183
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
184
|
+
0 && (module.exports = {
|
|
185
|
+
SyncConnectionErrorModal
|
|
186
|
+
});
|
|
187
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/sync-connection-error-modal/index.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, select } from '@wordpress/data';\nimport { useCopyToClipboard } from '@wordpress/compose';\n// @ts-ignore No exported types.\nimport { serialize } from '@wordpress/blocks';\nimport {\n\tstore as coreDataStore,\n\tprivateApis as coreDataPrivateApis,\n} from '@wordpress/core-data';\n// @ts-expect-error - No type declarations available for @wordpress/block-editor\n// prettier-ignore\nimport { privateApis, store as blockEditorStore } from '@wordpress/block-editor';\nimport {\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { applyFilters } from '@wordpress/hooks';\nimport { useState, useEffect } from '@wordpress/element';\nimport { __, sprintf, _n } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getSyncErrorMessages } from '../../utils/sync-error-messages';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useRetryCountdown } from './use-retry-countdown';\n\nconst { BlockCanvasCover } = unlock( privateApis );\nconst { retrySyncConnection } = unlock( coreDataPrivateApis );\n\n// Debounce time for initial disconnected status to allow connection to establish.\nconst INITIAL_DISCONNECTED_DEBOUNCE_MS = 20000;\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 The modal component or null if not disconnected.\n */\nexport function SyncConnectionErrorModal() {\n\tconst [ hasInitialized, setHasInitialized ] = useState( false );\n\tconst [ showModal, setShowModal ] = useState( false );\n\tconst [ isManualRetryAvailable, setIsManualRetryAvailable ] =\n\t\tuseState( false );\n\n\tconst { connectionStatus, isCollaborationEnabled, postType } = useSelect(\n\t\t( selectFn ) => {\n\t\t\tconst { getSyncConnectionStatus, getPostType } = unlock(\n\t\t\t\tselectFn( coreDataStore )\n\t\t\t);\n\t\t\tconst { getCurrentPostType, isCollaborationEnabledForCurrentPost } =\n\t\t\t\tunlock( selectFn( editorStore ) );\n\t\t\tconst currentPostType = getCurrentPostType();\n\t\t\treturn {\n\t\t\t\tconnectionStatus: getSyncConnectionStatus() || null,\n\t\t\t\tisCollaborationEnabled: isCollaborationEnabledForCurrentPost(),\n\t\t\t\tpostType: currentPostType\n\t\t\t\t\t? getPostType( currentPostType )\n\t\t\t\t\t: null,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { onManualRetry, secondsRemaining } =\n\t\tuseRetryCountdown( connectionStatus );\n\n\tconst copyButtonRef = useCopyToClipboard( () => {\n\t\tconst blocks = select( blockEditorStore ).getBlocks();\n\t\treturn serialize( blocks );\n\t} );\n\n\t// Set hasInitialized after a debounce to give extra time on initial load.\n\tuseEffect( () => {\n\t\tconst timeout = setTimeout( () => {\n\t\t\tsetHasInitialized( true );\n\t\t}, INITIAL_DISCONNECTED_DEBOUNCE_MS );\n\n\t\treturn () => clearTimeout( timeout );\n\t}, [] );\n\n\t// Track retry availability separately from the raw connection status.\n\t// The polling manager briefly emits `{ status: 'connecting' }` without\n\t// `canManuallyRetry` when a retry is kicked off, which would otherwise\n\t// unmount the Retry button briefly.\n\tuseEffect( () => {\n\t\tif ( 'connecting' === connectionStatus?.status ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsManualRetryAvailable(\n\t\t\tconnectionStatus !== null &&\n\t\t\t\t'canManuallyRetry' in connectionStatus &&\n\t\t\t\tconnectionStatus.canManuallyRetry === true\n\t\t);\n\t}, [ connectionStatus ] );\n\n\t// Show the modal when disconnected and either retries are exhausted or\n\t// no retry is available (unrecoverable error). Hide on reconnect.\n\t// The 'connecting' state is ignored so the modal preserves its current\n\t// visibility during active retry attempts.\n\tconst canRetry =\n\t\tconnectionStatus &&\n\t\t'disconnected' === connectionStatus.status &&\n\t\t( connectionStatus.canManuallyRetry ||\n\t\t\tconnectionStatus.willAutoRetryInMs );\n\n\tuseEffect( () => {\n\t\tif ( 'connected' === connectionStatus?.status ) {\n\t\t\tsetShowModal( false );\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tconnectionStatus?.status &&\n\t\t\t'connecting' !== connectionStatus.status &&\n\t\t\t( ! canRetry || connectionStatus.backgroundRetriesFailed )\n\t\t) {\n\t\t\tsetShowModal( true );\n\t\t}\n\t}, [ connectionStatus, canRetry ] );\n\n\tif ( ! isCollaborationEnabled || ! hasInitialized || ! showModal ) {\n\t\treturn null;\n\t}\n\n\tconst error =\n\t\tconnectionStatus && 'error' in connectionStatus\n\t\t\t? connectionStatus?.error\n\t\t\t: undefined;\n\n\t// For unrecoverable errors (no retry available), allow plugins to handle\n\t// the error themselves. If a plugin returns a value other than false, it\n\t// signals that it has taken over error display and the default modal is\n\t// suppressed.\n\t//\n\t// @example\n\t// ```js\n\t// wp.hooks.addFilter(\n\t// 'editor.isSyncConnectionErrorHandled',\n\t// 'my-plugin/handle-sync-error',\n\t// ( isHandled, errorCode ) => {\n\t// if ( errorCode === 'connection-limit-exceeded' ) {\n\t// return true; // Plugin handles this error via its own UI.\n\t// }\n\t// return isHandled;\n\t// }\n\t// );\n\t// ```\n\tif (\n\t\t! canRetry &&\n\t\tapplyFilters(\n\t\t\t'editor.isSyncConnectionErrorHandled',\n\t\t\tfalse,\n\t\t\terror?.code\n\t\t) !== false\n\t) {\n\t\treturn null;\n\t}\n\n\tconst manualRetry = isManualRetryAvailable\n\t\t? () => {\n\t\t\t\tonManualRetry();\n\t\t\t\tretrySyncConnection();\n\t\t }\n\t\t: undefined;\n\n\tconst messages = getSyncErrorMessages( error );\n\n\tlet retryCountdownText: string = '';\n\tlet isRetrying = false;\n\tif ( secondsRemaining && secondsRemaining > 0 ) {\n\t\tretryCountdownText = sprintf(\n\t\t\t/* translators: %d: number of seconds until retry */\n\t\t\t_n(\n\t\t\t\t'Retrying connection in %d second\\u2026',\n\t\t\t\t'Retrying connection in %d seconds\\u2026',\n\t\t\t\tsecondsRemaining\n\t\t\t),\n\t\t\tsecondsRemaining\n\t\t);\n\t} else if ( 0 === secondsRemaining ) {\n\t\tisRetrying = true;\n\t\tretryCountdownText = __( 'Retrying\\u2026' );\n\t}\n\n\tlet editPostHref = 'edit.php';\n\tif ( postType?.slug ) {\n\t\teditPostHref = `edit.php?post_type=${ postType.slug }`;\n\t}\n\n\treturn (\n\t\t<BlockCanvasCover.Fill>\n\t\t\t<Modal\n\t\t\t\toverlayClassName=\"editor-sync-connection-error-modal\"\n\t\t\t\tisDismissible={ false }\n\t\t\t\tonRequestClose={ () => {} }\n\t\t\t\tshouldCloseOnClickOutside={ false }\n\t\t\t\tshouldCloseOnEsc={ false }\n\t\t\t\tsize=\"medium\"\n\t\t\t\ttitle={ messages.title }\n\t\t\t>\n\t\t\t\t<VStack spacing={ 6 }>\n\t\t\t\t\t<p>{ messages.description }</p>\n\t\t\t\t\t{ retryCountdownText && (\n\t\t\t\t\t\t<p className=\"editor-sync-connection-error-modal__retry-countdown\">\n\t\t\t\t\t\t\t{ retryCountdownText }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) }\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\thref={ editPostHref }\n\t\t\t\t\t\t\tisDestructive\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: Post type name (e.g., \"Posts\", \"Pages\"). */\n\t\t\t\t\t\t\t\t__( 'Back to %s' ),\n\t\t\t\t\t\t\t\tpostType?.labels?.name ?? __( 'Posts' )\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tref={ copyButtonRef }\n\t\t\t\t\t\t\tvariant={ manualRetry ? 'secondary' : 'primary' }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Copy Post Content' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t{ manualRetry && (\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\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\taria-disabled={ isRetrying }\n\t\t\t\t\t\t\t\tdisabled={ isRetrying }\n\t\t\t\t\t\t\t\tisBusy={ isRetrying }\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tonClick={ manualRetry }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Retry' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\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;AAEnC,oBAA0B;AAC1B,uBAGO;AAGP,0BAAuD;AACvD,wBAKO;AACP,mBAA6B;AAC7B,qBAAoC;AACpC,kBAAgC;AAKhC,iCAAqC;AACrC,mBAAqC;AACrC,yBAAuB;AACvB,iCAAkC;AAkL7B;AAhLL,IAAM,EAAE,iBAAiB,QAAI,2BAAQ,+BAAY;AACjD,IAAM,EAAE,oBAAoB,QAAI,2BAAQ,iBAAAA,WAAoB;AAG5D,IAAM,mCAAmC;AAQlC,SAAS,2BAA2B;AAC1C,QAAM,CAAE,gBAAgB,iBAAkB,QAAI,yBAAU,KAAM;AAC9D,QAAM,CAAE,WAAW,YAAa,QAAI,yBAAU,KAAM;AACpD,QAAM,CAAE,wBAAwB,yBAA0B,QACzD,yBAAU,KAAM;AAEjB,QAAM,EAAE,kBAAkB,wBAAwB,SAAS,QAAI;AAAA,IAC9D,CAAE,aAAc;AACf,YAAM,EAAE,yBAAyB,YAAY,QAAI;AAAA,QAChD,SAAU,iBAAAC,KAAc;AAAA,MACzB;AACA,YAAM,EAAE,oBAAoB,qCAAqC,QAChE,2BAAQ,SAAU,aAAAC,KAAY,CAAE;AACjC,YAAM,kBAAkB,mBAAmB;AAC3C,aAAO;AAAA,QACN,kBAAkB,wBAAwB,KAAK;AAAA,QAC/C,wBAAwB,qCAAqC;AAAA,QAC7D,UAAU,kBACP,YAAa,eAAgB,IAC7B;AAAA,MACJ;AAAA,IACD;AAAA,IACA,CAAC;AAAA,EACF;AAEA,QAAM,EAAE,eAAe,iBAAiB,QACvC,8CAAmB,gBAAiB;AAErC,QAAM,oBAAgB,mCAAoB,MAAM;AAC/C,UAAM,aAAS,oBAAQ,oBAAAC,KAAiB,EAAE,UAAU;AACpD,eAAO,yBAAW,MAAO;AAAA,EAC1B,CAAE;AAGF,gCAAW,MAAM;AAChB,UAAM,UAAU,WAAY,MAAM;AACjC,wBAAmB,IAAK;AAAA,IACzB,GAAG,gCAAiC;AAEpC,WAAO,MAAM,aAAc,OAAQ;AAAA,EACpC,GAAG,CAAC,CAAE;AAMN,gCAAW,MAAM;AAChB,QAAK,iBAAiB,kBAAkB,QAAS;AAChD;AAAA,IACD;AAEA;AAAA,MACC,qBAAqB,QACpB,sBAAsB,oBACtB,iBAAiB,qBAAqB;AAAA,IACxC;AAAA,EACD,GAAG,CAAE,gBAAiB,CAAE;AAMxB,QAAM,WACL,oBACA,mBAAmB,iBAAiB,WAClC,iBAAiB,oBAClB,iBAAiB;AAEnB,gCAAW,MAAM;AAChB,QAAK,gBAAgB,kBAAkB,QAAS;AAC/C,mBAAc,KAAM;AACpB;AAAA,IACD;AAEA,QACC,kBAAkB,UAClB,iBAAiB,iBAAiB,WAChC,CAAE,YAAY,iBAAiB,0BAChC;AACD,mBAAc,IAAK;AAAA,IACpB;AAAA,EACD,GAAG,CAAE,kBAAkB,QAAS,CAAE;AAElC,MAAK,CAAE,0BAA0B,CAAE,kBAAkB,CAAE,WAAY;AAClE,WAAO;AAAA,EACR;AAEA,QAAM,QACL,oBAAoB,WAAW,mBAC5B,kBAAkB,QAClB;AAoBJ,MACC,CAAE,gBACF;AAAA,IACC;AAAA,IACA;AAAA,IACA,OAAO;AAAA,EACR,MAAM,OACL;AACD,WAAO;AAAA,EACR;AAEA,QAAM,cAAc,yBACjB,MAAM;AACN,kBAAc;AACd,wBAAoB;AAAA,EACpB,IACA;AAEH,QAAM,eAAW,iDAAsB,KAAM;AAE7C,MAAI,qBAA6B;AACjC,MAAI,aAAa;AACjB,MAAK,oBAAoB,mBAAmB,GAAI;AAC/C,6BAAqB;AAAA;AAAA,UAEpB;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAAA,MACA;AAAA,IACD;AAAA,EACD,WAAY,MAAM,kBAAmB;AACpC,iBAAa;AACb,6BAAqB,gBAAI,gBAAiB;AAAA,EAC3C;AAEA,MAAI,eAAe;AACnB,MAAK,UAAU,MAAO;AACrB,mBAAe,sBAAuB,SAAS,IAAK;AAAA,EACrD;AAEA,SACC,4CAAC,iBAAiB,MAAjB,EACA;AAAA,IAAC;AAAA;AAAA,MACA,kBAAiB;AAAA,MACjB,eAAgB;AAAA,MAChB,gBAAiB,MAAM;AAAA,MAAC;AAAA,MACxB,2BAA4B;AAAA,MAC5B,kBAAmB;AAAA,MACnB,MAAK;AAAA,MACL,OAAQ,SAAS;AAAA,MAEjB,uDAAC,kBAAAC,sBAAA,EAAO,SAAU,GACjB;AAAA,oDAAC,OAAI,mBAAS,aAAa;AAAA,QACzB,sBACD,4CAAC,OAAE,WAAU,uDACV,8BACH;AAAA,QAED,6CAAC,kBAAAC,sBAAA,EAAO,SAAQ,SACf;AAAA;AAAA,YAAC;AAAA;AAAA,cACA,uBAAqB;AAAA,cACrB,MAAO;AAAA,cACP,eAAa;AAAA,cACb,SAAQ;AAAA,cAEN;AAAA;AAAA,oBAED,gBAAI,YAAa;AAAA,gBACjB,UAAU,QAAQ,YAAQ,gBAAI,OAAQ;AAAA,cACvC;AAAA;AAAA,UACD;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACA,uBAAqB;AAAA,cACrB,KAAM;AAAA,cACN,SAAU,cAAc,cAAc;AAAA,cAEpC,8BAAI,mBAAoB;AAAA;AAAA,UAC3B;AAAA,UACE,eACD;AAAA,YAAC;AAAA;AAAA,cACA,uBAAqB;AAAA,cACrB,wBAAsB;AAAA,cACtB,iBAAgB;AAAA,cAChB,UAAW;AAAA,cACX,QAAS;AAAA,cACT,SAAQ;AAAA,cACR,SAAU;AAAA,cAER,8BAAI,OAAQ;AAAA;AAAA,UACf;AAAA,WAEF;AAAA,SACD;AAAA;AAAA,EACD,GACD;AAEF;",
|
|
6
|
+
"names": ["coreDataPrivateApis", "coreDataStore", "editorStore", "blockEditorStore", "VStack", "HStack"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
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-error-modal/use-retry-countdown.ts
|
|
21
|
+
var use_retry_countdown_exports = {};
|
|
22
|
+
__export(use_retry_countdown_exports, {
|
|
23
|
+
useRetryCountdown: () => useRetryCountdown
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(use_retry_countdown_exports);
|
|
26
|
+
var import_element = require("@wordpress/element");
|
|
27
|
+
function useRetryCountdown(connectionStatus) {
|
|
28
|
+
const [secondsRemaining, setSecondsRemaining] = (0, import_element.useState)();
|
|
29
|
+
const hasRetriedRef = (0, import_element.useRef)(false);
|
|
30
|
+
(0, import_element.useEffect)(() => {
|
|
31
|
+
if (!connectionStatus) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if ("connected" === connectionStatus.status) {
|
|
35
|
+
setSecondsRemaining(void 0);
|
|
36
|
+
hasRetriedRef.current = false;
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if ("disconnected" !== connectionStatus.status || !connectionStatus.willAutoRetryInMs) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const { willAutoRetryInMs: retryInMs } = connectionStatus;
|
|
43
|
+
const retryAt = Date.now() + retryInMs;
|
|
44
|
+
const hasRetried = hasRetriedRef.current;
|
|
45
|
+
hasRetriedRef.current = true;
|
|
46
|
+
if (hasRetried) {
|
|
47
|
+
setSecondsRemaining(0);
|
|
48
|
+
}
|
|
49
|
+
let countdownIntervalId = null;
|
|
50
|
+
const startCountdown = () => {
|
|
51
|
+
setSecondsRemaining(Math.ceil((retryAt - Date.now()) / 1e3));
|
|
52
|
+
countdownIntervalId = setInterval(() => {
|
|
53
|
+
const remaining = Math.ceil((retryAt - Date.now()) / 1e3);
|
|
54
|
+
setSecondsRemaining(Math.max(0, remaining));
|
|
55
|
+
if (remaining <= 0 && countdownIntervalId) {
|
|
56
|
+
clearInterval(countdownIntervalId);
|
|
57
|
+
}
|
|
58
|
+
}, 1e3);
|
|
59
|
+
};
|
|
60
|
+
const retryingDelayId = hasRetried ? setTimeout(startCountdown, 500) : null;
|
|
61
|
+
if (!retryingDelayId) {
|
|
62
|
+
startCountdown();
|
|
63
|
+
}
|
|
64
|
+
return () => {
|
|
65
|
+
if (retryingDelayId) {
|
|
66
|
+
clearTimeout(retryingDelayId);
|
|
67
|
+
}
|
|
68
|
+
if (countdownIntervalId) {
|
|
69
|
+
clearInterval(countdownIntervalId);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}, [connectionStatus]);
|
|
73
|
+
return {
|
|
74
|
+
onManualRetry: () => {
|
|
75
|
+
setSecondsRemaining(0);
|
|
76
|
+
},
|
|
77
|
+
secondsRemaining
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
81
|
+
0 && (module.exports = {
|
|
82
|
+
useRetryCountdown
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=use-retry-countdown.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/sync-connection-error-modal/use-retry-countdown.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { ConnectionStatus } from '@wordpress/core-data';\nimport { useState, useEffect, useRef } from '@wordpress/element';\n\ninterface UseRetryCountdownResult {\n\tonManualRetry: () => void;\n\tsecondsRemaining?: number;\n}\n\nexport function useRetryCountdown(\n\tconnectionStatus?: ConnectionStatus | null\n): UseRetryCountdownResult {\n\tconst [ secondsRemaining, setSecondsRemaining ] = useState< number >();\n\tconst hasRetriedRef = useRef( false );\n\n\tuseEffect( () => {\n\t\tif ( ! connectionStatus ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Only clear countdown when explicitly connected.\n\t\tif ( 'connected' === connectionStatus.status ) {\n\t\t\tsetSecondsRemaining( undefined );\n\t\t\thasRetriedRef.current = false;\n\t\t\treturn;\n\t\t}\n\n\t\t// For transient states (e.g. 'connecting' during a retry attempt)\n\t\t// or when retryInMs is not yet available, keep the previous\n\t\t// countdown value to avoid a brief flash.\n\t\tif (\n\t\t\t'disconnected' !== connectionStatus.status ||\n\t\t\t! connectionStatus.willAutoRetryInMs\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { willAutoRetryInMs: retryInMs } = connectionStatus;\n\t\tconst retryAt = Date.now() + retryInMs;\n\n\t\t// After a retry attempt (manual or automatic), show \"Retrying...\"\n\t\t// for 500ms before starting the next countdown. Skip the delay on\n\t\t// the very first disconnect so the countdown starts immediately.\n\t\tconst hasRetried = hasRetriedRef.current;\n\t\thasRetriedRef.current = true;\n\n\t\tif ( hasRetried ) {\n\t\t\tsetSecondsRemaining( 0 );\n\t\t}\n\n\t\tlet countdownIntervalId: ReturnType< typeof setInterval > | null = null;\n\n\t\tconst startCountdown = () => {\n\t\t\tsetSecondsRemaining( Math.ceil( ( retryAt - Date.now() ) / 1000 ) );\n\n\t\t\tcountdownIntervalId = setInterval( () => {\n\t\t\t\tconst remaining = Math.ceil( ( retryAt - Date.now() ) / 1000 );\n\t\t\t\tsetSecondsRemaining( Math.max( 0, remaining ) );\n\n\t\t\t\tif ( remaining <= 0 && countdownIntervalId ) {\n\t\t\t\t\tclearInterval( countdownIntervalId );\n\t\t\t\t}\n\t\t\t}, 1000 );\n\t\t};\n\n\t\tconst retryingDelayId = hasRetried\n\t\t\t? setTimeout( startCountdown, 500 )\n\t\t\t: null;\n\n\t\tif ( ! retryingDelayId ) {\n\t\t\tstartCountdown();\n\t\t}\n\n\t\treturn () => {\n\t\t\tif ( retryingDelayId ) {\n\t\t\t\tclearTimeout( retryingDelayId );\n\t\t\t}\n\n\t\t\tif ( countdownIntervalId ) {\n\t\t\t\tclearInterval( countdownIntervalId );\n\t\t\t}\n\t\t};\n\t}, [ connectionStatus ] );\n\n\treturn {\n\t\tonManualRetry: () => {\n\t\t\tsetSecondsRemaining( 0 );\n\t\t},\n\t\tsecondsRemaining,\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,qBAA4C;AAOrC,SAAS,kBACf,kBAC0B;AAC1B,QAAM,CAAE,kBAAkB,mBAAoB,QAAI,yBAAmB;AACrE,QAAM,oBAAgB,uBAAQ,KAAM;AAEpC,gCAAW,MAAM;AAChB,QAAK,CAAE,kBAAmB;AACzB;AAAA,IACD;AAGA,QAAK,gBAAgB,iBAAiB,QAAS;AAC9C,0BAAqB,MAAU;AAC/B,oBAAc,UAAU;AACxB;AAAA,IACD;AAKA,QACC,mBAAmB,iBAAiB,UACpC,CAAE,iBAAiB,mBAClB;AACD;AAAA,IACD;AAEA,UAAM,EAAE,mBAAmB,UAAU,IAAI;AACzC,UAAM,UAAU,KAAK,IAAI,IAAI;AAK7B,UAAM,aAAa,cAAc;AACjC,kBAAc,UAAU;AAExB,QAAK,YAAa;AACjB,0BAAqB,CAAE;AAAA,IACxB;AAEA,QAAI,sBAA+D;AAEnE,UAAM,iBAAiB,MAAM;AAC5B,0BAAqB,KAAK,MAAQ,UAAU,KAAK,IAAI,KAAM,GAAK,CAAE;AAElE,4BAAsB,YAAa,MAAM;AACxC,cAAM,YAAY,KAAK,MAAQ,UAAU,KAAK,IAAI,KAAM,GAAK;AAC7D,4BAAqB,KAAK,IAAK,GAAG,SAAU,CAAE;AAE9C,YAAK,aAAa,KAAK,qBAAsB;AAC5C,wBAAe,mBAAoB;AAAA,QACpC;AAAA,MACD,GAAG,GAAK;AAAA,IACT;AAEA,UAAM,kBAAkB,aACrB,WAAY,gBAAgB,GAAI,IAChC;AAEH,QAAK,CAAE,iBAAkB;AACxB,qBAAe;AAAA,IAChB;AAEA,WAAO,MAAM;AACZ,UAAK,iBAAkB;AACtB,qBAAc,eAAgB;AAAA,MAC/B;AAEA,UAAK,qBAAsB;AAC1B,sBAAe,mBAAoB;AAAA,MACpC;AAAA,IACD;AAAA,EACD,GAAG,CAAE,gBAAiB,CAAE;AAExB,SAAO;AAAA,IACN,eAAe,MAAM;AACpB,0BAAqB,CAAE;AAAA,IACxB;AAAA,IACA;AAAA,EACD;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// packages/editor/src/components/template-content-panel/index.js
|
|
@@ -28,47 +38,26 @@ var import_block_editor = require("@wordpress/block-editor");
|
|
|
28
38
|
var import_components = require("@wordpress/components");
|
|
29
39
|
var import_i18n = require("@wordpress/i18n");
|
|
30
40
|
var import_interface = require("@wordpress/interface");
|
|
31
|
-
var import_hooks = require("@wordpress/hooks");
|
|
32
|
-
var import_element = require("@wordpress/element");
|
|
33
41
|
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
34
42
|
var import_constants = require("../../store/constants.cjs");
|
|
35
43
|
var import_store = require("../../store/index.cjs");
|
|
44
|
+
var import_use_post_content_block_types = __toESM(require("../provider/use-post-content-block-types.cjs"));
|
|
36
45
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
46
|
var { BlockQuickNavigation } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
|
|
38
|
-
var POST_CONTENT_BLOCK_TYPES = [
|
|
39
|
-
"core/post-title",
|
|
40
|
-
"core/post-featured-image",
|
|
41
|
-
"core/post-content"
|
|
42
|
-
];
|
|
43
47
|
var TEMPLATE_PART_BLOCK = "core/template-part";
|
|
44
|
-
function
|
|
45
|
-
const postContentBlockTypes = (0,
|
|
46
|
-
|
|
47
|
-
"editor.postContentBlockTypes",
|
|
48
|
-
POST_CONTENT_BLOCK_TYPES
|
|
49
|
-
),
|
|
50
|
-
[]
|
|
51
|
-
);
|
|
52
|
-
const { clientIds, postType, renderingMode } = (0, import_data.useSelect)(
|
|
48
|
+
function TemplateContentPanelInner({ postType }) {
|
|
49
|
+
const postContentBlockTypes = (0, import_use_post_content_block_types.default)();
|
|
50
|
+
const clientIds = (0, import_data.useSelect)(
|
|
53
51
|
(select) => {
|
|
54
|
-
const {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
} = (0, import_lock_unlock.unlock)(select(import_store.store));
|
|
59
|
-
const _postType = getCurrentPostType();
|
|
60
|
-
return {
|
|
61
|
-
postType: _postType,
|
|
62
|
-
clientIds: getPostBlocksByName(
|
|
63
|
-
import_constants.TEMPLATE_POST_TYPE === _postType ? TEMPLATE_PART_BLOCK : postContentBlockTypes
|
|
64
|
-
),
|
|
65
|
-
renderingMode: getRenderingMode()
|
|
66
|
-
};
|
|
52
|
+
const { getPostBlocksByName } = (0, import_lock_unlock.unlock)(select(import_store.store));
|
|
53
|
+
return getPostBlocksByName(
|
|
54
|
+
import_constants.TEMPLATE_POST_TYPE === postType ? TEMPLATE_PART_BLOCK : postContentBlockTypes
|
|
55
|
+
);
|
|
67
56
|
},
|
|
68
|
-
[postContentBlockTypes]
|
|
57
|
+
[postType, postContentBlockTypes]
|
|
69
58
|
);
|
|
70
59
|
const { enableComplementaryArea } = (0, import_data.useDispatch)(import_interface.store);
|
|
71
|
-
if (
|
|
60
|
+
if (clientIds.length === 0) {
|
|
72
61
|
return null;
|
|
73
62
|
}
|
|
74
63
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.PanelBody, { title: (0, import_i18n.__)("Content"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -81,4 +70,19 @@ function TemplateContentPanel() {
|
|
|
81
70
|
}
|
|
82
71
|
) });
|
|
83
72
|
}
|
|
73
|
+
function TemplateContentPanel() {
|
|
74
|
+
const { postType, renderingMode } = (0, import_data.useSelect)((select) => {
|
|
75
|
+
const { getCurrentPostType, getRenderingMode } = (0, import_lock_unlock.unlock)(
|
|
76
|
+
select(import_store.store)
|
|
77
|
+
);
|
|
78
|
+
return {
|
|
79
|
+
postType: getCurrentPostType(),
|
|
80
|
+
renderingMode: getRenderingMode()
|
|
81
|
+
};
|
|
82
|
+
}, []);
|
|
83
|
+
if (renderingMode === "post-only" && postType !== import_constants.TEMPLATE_POST_TYPE) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TemplateContentPanelInner, { postType });
|
|
87
|
+
}
|
|
84
88
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/template-content-panel/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { PanelBody } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as interfaceStore } from '@wordpress/interface';\
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["blockEditorPrivateApis", "editorStore", "interfaceStore"]
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { PanelBody } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport usePostContentBlockTypes from '../provider/use-post-content-block-types';\n\nconst { BlockQuickNavigation } = unlock( blockEditorPrivateApis );\n\nconst TEMPLATE_PART_BLOCK = 'core/template-part';\n\nfunction TemplateContentPanelInner( { postType } ) {\n\tconst postContentBlockTypes = usePostContentBlockTypes();\n\n\tconst clientIds = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostBlocksByName } = unlock( select( editorStore ) );\n\t\t\treturn getPostBlocksByName(\n\t\t\t\tTEMPLATE_POST_TYPE === postType\n\t\t\t\t\t? TEMPLATE_PART_BLOCK\n\t\t\t\t\t: postContentBlockTypes\n\t\t\t);\n\t\t},\n\t\t[ postType, postContentBlockTypes ]\n\t);\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tif ( clientIds.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody title={ __( 'Content' ) }>\n\t\t\t<BlockQuickNavigation\n\t\t\t\tclientIds={ clientIds }\n\t\t\t\tonSelect={ () => {\n\t\t\t\t\tenableComplementaryArea( 'core', 'edit-post/document' );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</PanelBody>\n\t);\n}\n\nexport default function TemplateContentPanel() {\n\tconst { postType, renderingMode } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getRenderingMode } = unlock(\n\t\t\tselect( editorStore )\n\t\t);\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t\trenderingMode: getRenderingMode(),\n\t\t};\n\t}, [] );\n\n\tif ( renderingMode === 'post-only' && postType !== TEMPLATE_POST_TYPE ) {\n\t\treturn null;\n\t}\n\n\treturn <TemplateContentPanelInner postType={ postType } />;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuC;AACvC,0BAAsD;AACtD,wBAA0B;AAC1B,kBAAmB;AACnB,uBAAwC;AAKxC,yBAAuB;AACvB,uBAAmC;AACnC,mBAAqC;AACrC,0CAAqC;AA6BlC;AA3BH,IAAM,EAAE,qBAAqB,QAAI,2BAAQ,oBAAAA,WAAuB;AAEhE,IAAM,sBAAsB;AAE5B,SAAS,0BAA2B,EAAE,SAAS,GAAI;AAClD,QAAM,4BAAwB,oCAAAC,SAAyB;AAEvD,QAAM,gBAAY;AAAA,IACjB,CAAE,WAAY;AACb,YAAM,EAAE,oBAAoB,QAAI,2BAAQ,OAAQ,aAAAC,KAAY,CAAE;AAC9D,aAAO;AAAA,QACN,wCAAuB,WACpB,sBACA;AAAA,MACJ;AAAA,IACD;AAAA,IACA,CAAE,UAAU,qBAAsB;AAAA,EACnC;AAEA,QAAM,EAAE,wBAAwB,QAAI,yBAAa,iBAAAC,KAAe;AAEhE,MAAK,UAAU,WAAW,GAAI;AAC7B,WAAO;AAAA,EACR;AAEA,SACC,4CAAC,+BAAU,WAAQ,gBAAI,SAAU,GAChC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,UAAW,MAAM;AAChB,gCAAyB,QAAQ,oBAAqB;AAAA,MACvD;AAAA;AAAA,EACD,GACD;AAEF;AAEe,SAAR,uBAAwC;AAC9C,QAAM,EAAE,UAAU,cAAc,QAAI,uBAAW,CAAE,WAAY;AAC5D,UAAM,EAAE,oBAAoB,iBAAiB,QAAI;AAAA,MAChD,OAAQ,aAAAD,KAAY;AAAA,IACrB;AACA,WAAO;AAAA,MACN,UAAU,mBAAmB;AAAA,MAC7B,eAAe,iBAAiB;AAAA,IACjC;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,MAAK,kBAAkB,eAAe,aAAa,qCAAqB;AACvE,WAAO;AAAA,EACR;AAEA,SAAO,4CAAC,6BAA0B,UAAsB;AACzD;",
|
|
6
|
+
"names": ["blockEditorPrivateApis", "usePostContentBlockTypes", "editorStore", "interfaceStore"]
|
|
7
7
|
}
|
|
@@ -25,28 +25,71 @@ __export(convert_to_regular_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(convert_to_regular_exports);
|
|
26
26
|
var import_data = require("@wordpress/data");
|
|
27
27
|
var import_block_editor = require("@wordpress/block-editor");
|
|
28
|
+
var import_core_data = require("@wordpress/core-data");
|
|
28
29
|
var import_components = require("@wordpress/components");
|
|
29
30
|
var import_i18n = require("@wordpress/i18n");
|
|
31
|
+
var import_html_entities = require("@wordpress/html-entities");
|
|
32
|
+
var import_element = require("@wordpress/element");
|
|
30
33
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
34
|
function ConvertToRegularBlocks({ clientId, onClose }) {
|
|
35
|
+
const [showConfirmDialog, setShowConfirmDialog] = (0, import_element.useState)(false);
|
|
32
36
|
const { getBlocks } = (0, import_data.useSelect)(import_block_editor.store);
|
|
33
37
|
const { replaceBlocks } = (0, import_data.useDispatch)(import_block_editor.store);
|
|
34
|
-
const canRemove = (0, import_data.useSelect)(
|
|
35
|
-
(select) =>
|
|
38
|
+
const { canRemove, templatePartTitle } = (0, import_data.useSelect)(
|
|
39
|
+
(select) => {
|
|
40
|
+
const { canRemoveBlock, getBlock } = select(import_block_editor.store);
|
|
41
|
+
const { getEntityRecord, getCurrentTheme } = select(import_core_data.store);
|
|
42
|
+
const block = getBlock(clientId);
|
|
43
|
+
const { slug, theme } = block?.attributes ?? {};
|
|
44
|
+
const themeSlug = theme || getCurrentTheme()?.stylesheet;
|
|
45
|
+
const templatePartId = themeSlug && slug ? `${themeSlug}//${slug}` : null;
|
|
46
|
+
const entity = templatePartId ? getEntityRecord(
|
|
47
|
+
"postType",
|
|
48
|
+
"wp_template_part",
|
|
49
|
+
templatePartId
|
|
50
|
+
) : null;
|
|
51
|
+
return {
|
|
52
|
+
canRemove: canRemoveBlock(clientId),
|
|
53
|
+
templatePartTitle: entity?.title?.rendered ? (0, import_html_entities.decodeEntities)(entity.title.rendered) : null
|
|
54
|
+
};
|
|
55
|
+
},
|
|
36
56
|
[clientId]
|
|
37
57
|
);
|
|
38
58
|
if (!canRemove) {
|
|
39
59
|
return null;
|
|
40
60
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
61
|
+
const title = templatePartTitle ? (0, import_i18n.sprintf)(
|
|
62
|
+
/* translators: %s: template part title, e.g. "Header" */
|
|
63
|
+
(0, import_i18n.__)("Detach %s?"),
|
|
64
|
+
templatePartTitle
|
|
65
|
+
) : (0, import_i18n.__)("Detach template part?");
|
|
66
|
+
const message = templatePartTitle ? (0, import_i18n.sprintf)(
|
|
67
|
+
/* translators: %s: template part title, e.g. "Header" */
|
|
68
|
+
(0, import_i18n.__)(
|
|
69
|
+
"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."
|
|
70
|
+
),
|
|
71
|
+
templatePartTitle
|
|
72
|
+
) : (0, import_i18n.__)(
|
|
73
|
+
"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."
|
|
50
74
|
);
|
|
75
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
76
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.MenuItem, { onClick: () => setShowConfirmDialog(true), children: (0, import_i18n.__)("Detach") }),
|
|
77
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
78
|
+
import_components.__experimentalConfirmDialog,
|
|
79
|
+
{
|
|
80
|
+
isOpen: showConfirmDialog,
|
|
81
|
+
onConfirm: () => {
|
|
82
|
+
replaceBlocks(clientId, getBlocks(clientId));
|
|
83
|
+
onClose();
|
|
84
|
+
},
|
|
85
|
+
onCancel: () => setShowConfirmDialog(false),
|
|
86
|
+
confirmButtonText: (0, import_i18n.__)("Detach"),
|
|
87
|
+
size: "medium",
|
|
88
|
+
title,
|
|
89
|
+
__experimentalHideHeader: false,
|
|
90
|
+
children: message
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
] });
|
|
51
94
|
}
|
|
52
95
|
//# sourceMappingURL=convert-to-regular.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/template-part-menu-items/convert-to-regular.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuC;AACvC,0BAA0C;AAC1C,
|
|
6
|
-
"names": ["blockEditorStore"]
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tMenuItem,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useState } from '@wordpress/element';\n\nexport default function ConvertToRegularBlocks( { clientId, onClose } ) {\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\n\tconst { getBlocks } = useSelect( blockEditorStore );\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\n\tconst { canRemove, templatePartTitle } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canRemoveBlock, getBlock } = select( blockEditorStore );\n\t\t\tconst { getEntityRecord, getCurrentTheme } = select( coreStore );\n\n\t\t\tconst block = getBlock( clientId );\n\t\t\tconst { slug, theme } = block?.attributes ?? {};\n\t\t\tconst themeSlug = theme || getCurrentTheme()?.stylesheet;\n\t\t\tconst templatePartId =\n\t\t\t\tthemeSlug && slug ? `${ themeSlug }//${ slug }` : null;\n\t\t\tconst entity = templatePartId\n\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'wp_template_part',\n\t\t\t\t\t\ttemplatePartId\n\t\t\t\t )\n\t\t\t\t: null;\n\n\t\t\treturn {\n\t\t\t\tcanRemove: canRemoveBlock( clientId ),\n\t\t\t\ttemplatePartTitle: entity?.title?.rendered\n\t\t\t\t\t? decodeEntities( entity.title.rendered )\n\t\t\t\t\t: null,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tif ( ! canRemove ) {\n\t\treturn null;\n\t}\n\n\tconst title = templatePartTitle\n\t\t? sprintf(\n\t\t\t\t/* translators: %s: template part title, e.g. \"Header\" */\n\t\t\t\t__( 'Detach %s?' ),\n\t\t\t\ttemplatePartTitle\n\t\t )\n\t\t: __( 'Detach template part?' );\n\n\tconst message = templatePartTitle\n\t\t? sprintf(\n\t\t\t\t/* translators: %s: template part title, e.g. \"Header\" */\n\t\t\t\t__(\n\t\t\t\t\t'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.'\n\t\t\t\t),\n\t\t\t\ttemplatePartTitle\n\t\t )\n\t\t: __(\n\t\t\t\t'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.'\n\t\t );\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem onClick={ () => setShowConfirmDialog( true ) }>\n\t\t\t\t{ __( 'Detach' ) }\n\t\t\t</MenuItem>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ showConfirmDialog }\n\t\t\t\tonConfirm={ () => {\n\t\t\t\t\treplaceBlocks( clientId, getBlocks( clientId ) );\n\t\t\t\t\tonClose();\n\t\t\t\t} }\n\t\t\t\tonCancel={ () => setShowConfirmDialog( false ) }\n\t\t\t\tconfirmButtonText={ __( 'Detach' ) }\n\t\t\t\tsize=\"medium\"\n\t\t\t\ttitle={ title }\n\t\t\t\t__experimentalHideHeader={ false }\n\t\t\t>\n\t\t\t\t{ message }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuC;AACvC,0BAA0C;AAC1C,uBAAmC;AACnC,wBAGO;AACP,kBAA4B;AAC5B,2BAA+B;AAC/B,qBAAyB;AA6DvB;AA3Da,SAAR,uBAAyC,EAAE,UAAU,QAAQ,GAAI;AACvE,QAAM,CAAE,mBAAmB,oBAAqB,QAAI,yBAAU,KAAM;AAEpE,QAAM,EAAE,UAAU,QAAI,uBAAW,oBAAAA,KAAiB;AAClD,QAAM,EAAE,cAAc,QAAI,yBAAa,oBAAAA,KAAiB;AAExD,QAAM,EAAE,WAAW,kBAAkB,QAAI;AAAA,IACxC,CAAE,WAAY;AACb,YAAM,EAAE,gBAAgB,SAAS,IAAI,OAAQ,oBAAAA,KAAiB;AAC9D,YAAM,EAAE,iBAAiB,gBAAgB,IAAI,OAAQ,iBAAAC,KAAU;AAE/D,YAAM,QAAQ,SAAU,QAAS;AACjC,YAAM,EAAE,MAAM,MAAM,IAAI,OAAO,cAAc,CAAC;AAC9C,YAAM,YAAY,SAAS,gBAAgB,GAAG;AAC9C,YAAM,iBACL,aAAa,OAAO,GAAI,SAAU,KAAM,IAAK,KAAK;AACnD,YAAM,SAAS,iBACZ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACA,IACA;AAEH,aAAO;AAAA,QACN,WAAW,eAAgB,QAAS;AAAA,QACpC,mBAAmB,QAAQ,OAAO,eAC/B,qCAAgB,OAAO,MAAM,QAAS,IACtC;AAAA,MACJ;AAAA,IACD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AAEA,MAAK,CAAE,WAAY;AAClB,WAAO;AAAA,EACR;AAEA,QAAM,QAAQ,wBACX;AAAA;AAAA,QAEA,gBAAI,YAAa;AAAA,IACjB;AAAA,EACA,QACA,gBAAI,uBAAwB;AAE/B,QAAM,UAAU,wBACb;AAAA;AAAA,QAEA;AAAA,MACC;AAAA,IACD;AAAA,IACA;AAAA,EACA,QACA;AAAA,IACA;AAAA,EACA;AAEH,SACC,4EACC;AAAA,gDAAC,8BAAS,SAAU,MAAM,qBAAsB,IAAK,GAClD,8BAAI,QAAS,GAChB;AAAA,IACA;AAAA,MAAC,kBAAAC;AAAA,MAAA;AAAA,QACA,QAAS;AAAA,QACT,WAAY,MAAM;AACjB,wBAAe,UAAU,UAAW,QAAS,CAAE;AAC/C,kBAAQ;AAAA,QACT;AAAA,QACA,UAAW,MAAM,qBAAsB,KAAM;AAAA,QAC7C,uBAAoB,gBAAI,QAAS;AAAA,QACjC,MAAK;AAAA,QACL;AAAA,QACA,0BAA2B;AAAA,QAEzB;AAAA;AAAA,IACH;AAAA,KACD;AAEF;",
|
|
6
|
+
"names": ["blockEditorStore", "coreStore", "ConfirmDialog"]
|
|
7
7
|
}
|
|
@@ -50,7 +50,7 @@ var import_constants = require("../../store/constants.cjs");
|
|
|
50
50
|
var import_use_zoom_out_mode_exit = require("./use-zoom-out-mode-exit.cjs");
|
|
51
51
|
var import_use_padding_appender = require("./use-padding-appender.cjs");
|
|
52
52
|
var import_use_edit_content_only_section_exit = require("./use-edit-content-only-section-exit.cjs");
|
|
53
|
-
var
|
|
53
|
+
var import_sync_connection_error_modal = require("../sync-connection-error-modal/index.cjs");
|
|
54
54
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
55
55
|
var {
|
|
56
56
|
LayoutStyle,
|
|
@@ -256,7 +256,6 @@ function VisualEditor({
|
|
|
256
256
|
!isPreview && // Disable resizing in mobile viewport.
|
|
257
257
|
!isMobileViewport && // Disable resizing in zoomed-out mode.
|
|
258
258
|
!isZoomedOut;
|
|
259
|
-
const isNavigationPreview = postType === import_constants.NAVIGATION_POST_TYPE && isPreview;
|
|
260
259
|
const calculatedMinHeight = (0, import_element.useMemo)(() => {
|
|
261
260
|
if (!localRef.current) {
|
|
262
261
|
return canvasMinHeight;
|
|
@@ -268,7 +267,6 @@ function VisualEditor({
|
|
|
268
267
|
const [paddingAppenderRef, paddingStyle] = (0, import_use_padding_appender.usePaddingAppender)(
|
|
269
268
|
!isPreview && renderingMode === "post-only" && !isDesignPostType
|
|
270
269
|
);
|
|
271
|
-
const centerContentCSS = `display:flex;align-items:center;justify-content:center;`;
|
|
272
270
|
const iframeStyles = (0, import_element.useMemo)(() => {
|
|
273
271
|
return [
|
|
274
272
|
...styles ?? [],
|
|
@@ -278,21 +276,14 @@ function VisualEditor({
|
|
|
278
276
|
// important mostly for post-only views yet conceivably an issue in templated views too.
|
|
279
277
|
css: `:where(.block-editor-iframe__body){display:flow-root;${calculatedMinHeight ? `min-height:${calculatedMinHeight}px;` : ""}}.is-root-container{display:flow-root;${// Some themes will have `min-height: 100vh` for the root container,
|
|
280
278
|
// which isn't a requirement in auto resize mode.
|
|
281
|
-
enableResizing
|
|
279
|
+
enableResizing ? "min-height:0!important;" : ""}}
|
|
282
280
|
${paddingStyle ? paddingStyle : ""}
|
|
283
|
-
${enableResizing ? `.block-editor-iframe__html{background:var(--wp-editor-canvas-background);min-height:100vh
|
|
284
|
-
// The CSS
|
|
281
|
+
${enableResizing ? `.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%;}` : ""}`
|
|
282
|
+
// The CSS above centers the body content vertically when resizing is enabled and applies a background
|
|
285
283
|
// color to the iframe HTML element to match the background color of the editor canvas.
|
|
286
|
-
// The CSS for isNavigationPreview centers the body content vertically and horizontally when the navigation is in preview mode.
|
|
287
284
|
}
|
|
288
285
|
];
|
|
289
|
-
}, [
|
|
290
|
-
styles,
|
|
291
|
-
enableResizing,
|
|
292
|
-
isNavigationPreview,
|
|
293
|
-
calculatedMinHeight,
|
|
294
|
-
paddingStyle
|
|
295
|
-
]);
|
|
286
|
+
}, [styles, enableResizing, calculatedMinHeight, paddingStyle]);
|
|
296
287
|
const typewriterRef = (0, import_block_editor.__unstableUseTypewriter)();
|
|
297
288
|
contentRef = (0, import_compose.useMergeRefs)([
|
|
298
289
|
localRef,
|
|
@@ -323,7 +314,7 @@ function VisualEditor({
|
|
|
323
314
|
}
|
|
324
315
|
),
|
|
325
316
|
children: [
|
|
326
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
317
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sync_connection_error_modal.SyncConnectionErrorModal, {}),
|
|
327
318
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_resizable_editor.default, { enableResizing, height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
328
319
|
BlockCanvas,
|
|
329
320
|
{
|