@wordpress/editor 14.41.1-next.v.202603102151.0 → 14.42.0
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/collaborators-overlay/avatar-iframe-styles.cjs +12 -4
- package/build/components/collaborators-overlay/avatar-iframe-styles.cjs.map +2 -2
- package/build/components/collaborators-overlay/compute-selection.cjs +181 -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/overlay-iframe-styles.cjs +6 -0
- package/build/components/collaborators-overlay/overlay-iframe-styles.cjs.map +2 -2
- package/build/components/collaborators-overlay/overlay.cjs +61 -37
- package/build/components/collaborators-overlay/overlay.cjs.map +2 -2
- 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 +5 -6
- package/build/components/collaborators-overlay/use-block-highlighting.cjs.map +2 -2
- package/build/components/collaborators-overlay/use-render-cursors.cjs +50 -140
- package/build/components/collaborators-overlay/use-render-cursors.cjs.map +3 -3
- package/build/components/collaborators-presence/index.cjs +38 -12
- package/build/components/collaborators-presence/index.cjs.map +2 -2
- package/build/components/collaborators-presence/list.cjs +27 -24
- package/build/components/collaborators-presence/list.cjs.map +2 -2
- package/build/components/collaborators-presence/use-collaborator-notifications.cjs +79 -107
- package/build/components/collaborators-presence/use-collaborator-notifications.cjs.map +3 -3
- package/build/components/editor-interface/index.cjs +9 -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/page-attributes/parent.cjs +1 -1
- package/build/components/page-attributes/parent.cjs.map +2 -2
- package/build/components/post-locked-modal/index.cjs +16 -3
- package/build/components/post-locked-modal/index.cjs.map +2 -2
- package/build/components/post-revisions-preview/block-diff.cjs +39 -11
- package/build/components/post-revisions-preview/block-diff.cjs.map +2 -2
- package/build/components/post-revisions-preview/diff-markers.cjs +2 -2
- package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
- package/build/components/post-revisions-preview/revisions-canvas.cjs +12 -75
- package/build/components/post-revisions-preview/revisions-canvas.cjs.map +3 -3
- package/build/components/post-revisions-preview/revisions-slider.cjs +5 -1
- package/build/components/post-revisions-preview/revisions-slider.cjs.map +2 -2
- package/build/components/post-template/block-theme.cjs +7 -4
- package/build/components/post-template/block-theme.cjs.map +2 -2
- package/build/components/post-template/hooks.cjs +39 -2
- package/build/components/post-template/hooks.cjs.map +2 -2
- package/build/components/post-template/panel.cjs +5 -42
- package/build/components/post-template/panel.cjs.map +3 -3
- package/build/components/preferences-modal/index.cjs +24 -0
- 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 +19 -5
- 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 +84 -0
- package/build/components/revision-block-diff/index.cjs.map +7 -0
- package/build/components/sidebar/dataform-post-summary.cjs +36 -6
- package/build/components/sidebar/dataform-post-summary.cjs.map +2 -2
- package/build/components/sidebar/header.cjs +1 -1
- package/build/components/sidebar/header.cjs.map +2 -2
- package/build/components/sidebar/index.cjs +5 -1
- package/build/components/sidebar/index.cjs.map +3 -3
- package/build/components/{sync-connection-modal → sync-connection-error-modal}/index.cjs +90 -78
- package/build/components/sync-connection-error-modal/index.cjs.map +7 -0
- package/build/components/{sync-connection-modal → sync-connection-error-modal}/use-retry-countdown.cjs +14 -27
- 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/visual-editor/index.cjs +2 -2
- package/build/components/visual-editor/index.cjs.map +2 -2
- package/build/store/actions.cjs +1 -3
- package/build/store/actions.cjs.map +2 -2
- package/build/store/private-actions.cjs +11 -2
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +52 -13
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +12 -0
- package/build/store/reducer.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/sync-error-messages.cjs +29 -16
- package/build/utils/sync-error-messages.cjs.map +3 -3
- package/build-module/components/collaborators-overlay/avatar-iframe-styles.mjs +12 -4
- package/build-module/components/collaborators-overlay/avatar-iframe-styles.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/compute-selection.mjs +162 -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/overlay-iframe-styles.mjs +6 -0
- package/build-module/components/collaborators-overlay/overlay-iframe-styles.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/overlay.mjs +61 -37
- 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 +5 -6
- package/build-module/components/collaborators-overlay/use-block-highlighting.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs +50 -140
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs.map +2 -2
- package/build-module/components/collaborators-presence/index.mjs +39 -13
- package/build-module/components/collaborators-presence/index.mjs.map +2 -2
- package/build-module/components/collaborators-presence/list.mjs +27 -24
- package/build-module/components/collaborators-presence/list.mjs.map +2 -2
- package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs +80 -108
- package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs.map +2 -2
- package/build-module/components/editor-interface/index.mjs +10 -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/page-attributes/parent.mjs +1 -1
- package/build-module/components/page-attributes/parent.mjs.map +2 -2
- package/build-module/components/post-locked-modal/index.mjs +16 -3
- package/build-module/components/post-locked-modal/index.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/block-diff.mjs +39 -11
- package/build-module/components/post-revisions-preview/block-diff.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/diff-markers.mjs +2 -2
- package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-canvas.mjs +14 -80
- package/build-module/components/post-revisions-preview/revisions-canvas.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-slider.mjs +5 -1
- package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
- package/build-module/components/post-template/block-theme.mjs +7 -4
- package/build-module/components/post-template/block-theme.mjs.map +2 -2
- package/build-module/components/post-template/hooks.mjs +37 -1
- package/build-module/components/post-template/hooks.mjs.map +2 -2
- package/build-module/components/post-template/panel.mjs +5 -42
- package/build-module/components/post-template/panel.mjs.map +2 -2
- package/build-module/components/preferences-modal/index.mjs +24 -0
- 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 +19 -5
- 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 +53 -0
- package/build-module/components/revision-block-diff/index.mjs.map +7 -0
- package/build-module/components/sidebar/dataform-post-summary.mjs +36 -6
- package/build-module/components/sidebar/dataform-post-summary.mjs.map +2 -2
- 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 +5 -1
- package/build-module/components/sidebar/index.mjs.map +2 -2
- package/build-module/components/sync-connection-error-modal/index.mjs +177 -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 +36 -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/visual-editor/index.mjs +2 -2
- package/build-module/components/visual-editor/index.mjs.map +2 -2
- package/build-module/store/actions.mjs +1 -3
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +10 -2
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +50 -12
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +11 -0
- package/build-module/store/reducer.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/sync-error-messages.mjs +24 -16
- package/build-module/utils/sync-error-messages.mjs.map +3 -3
- package/build-style/style-rtl.css +95 -16
- package/build-style/style.css +95 -16
- package/build-types/components/collaborators-overlay/avatar-iframe-styles.d.ts +1 -1
- package/build-types/components/collaborators-overlay/avatar-iframe-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/overlay-iframe-styles.d.ts +1 -1
- package/build-types/components/collaborators-overlay/overlay-iframe-styles.d.ts.map +1 -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.map +1 -1
- package/build-types/components/collaborators-overlay/use-render-cursors.d.ts +4 -0
- package/build-types/components/collaborators-overlay/use-render-cursors.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/index.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/list.d.ts +2 -1
- package/build-types/components/collaborators-presence/list.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/use-collaborator-notifications.d.ts.map +1 -1
- 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/post-locked-modal/index.d.ts +2 -2
- package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/block-diff.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/revisions-canvas.d.ts +2 -5
- package/build-types/components/post-revisions-preview/revisions-canvas.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/revisions-slider.d.ts.map +1 -1
- package/build-types/components/post-template/block-theme.d.ts +1 -3
- package/build-types/components/post-template/block-theme.d.ts.map +1 -1
- package/build-types/components/post-template/hooks.d.ts +1 -0
- package/build-types/components/post-template/hooks.d.ts.map +1 -1
- package/build-types/components/post-template/panel.d.ts.map +1 -1
- 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-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/sidebar/dataform-post-summary.d.ts.map +1 -1
- package/build-types/components/sidebar/index.d.ts.map +1 -1
- package/build-types/components/sync-connection-error-modal/index.d.ts +22 -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-content-panel/index.d.ts.map +1 -1
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts +7 -0
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +7 -0
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +14 -3
- package/build-types/store/reducer.d.ts.map +1 -1
- 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/sync-error-messages.d.ts +17 -3
- package/build-types/utils/sync-error-messages.d.ts.map +1 -1
- package/package.json +44 -44
- package/src/components/collaborators-overlay/avatar-iframe-styles.ts +12 -4
- package/src/components/collaborators-overlay/compute-selection.ts +307 -0
- package/src/components/collaborators-overlay/cursor-dom-utils.ts +382 -0
- package/src/components/collaborators-overlay/overlay-iframe-styles.ts +6 -0
- package/src/components/collaborators-overlay/overlay.tsx +59 -27
- package/src/components/collaborators-overlay/timing-utils.ts +30 -0
- package/src/components/collaborators-overlay/use-block-highlighting.ts +11 -10
- package/src/components/collaborators-overlay/use-render-cursors.ts +70 -242
- package/src/components/collaborators-presence/avatar/styles.scss +20 -4
- package/src/components/collaborators-presence/index.tsx +30 -5
- package/src/components/collaborators-presence/list.tsx +38 -24
- package/src/components/collaborators-presence/test/use-collaborator-notifications.ts +188 -246
- package/src/components/collaborators-presence/use-collaborator-notifications.ts +109 -166
- package/src/components/document-bar/style.scss +1 -1
- package/src/components/editor-interface/index.js +8 -6
- package/src/components/inserter-sidebar/index.js +4 -1
- package/src/components/page-attributes/parent.js +1 -1
- package/src/components/post-locked-modal/index.js +21 -3
- package/src/components/post-revisions-preview/block-diff.js +59 -20
- package/src/components/post-revisions-preview/diff-markers.js +2 -2
- package/src/components/post-revisions-preview/revisions-canvas.js +20 -98
- package/src/components/post-revisions-preview/revisions-slider.js +6 -1
- package/src/components/post-revisions-preview/test/block-diff.js +69 -31
- package/src/components/post-template/block-theme.js +4 -1
- package/src/components/post-template/hooks.js +42 -0
- package/src/components/post-template/panel.js +5 -59
- package/src/components/preferences-modal/index.js +18 -0
- 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 -8
- 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 +74 -0
- package/src/components/revision-block-diff/style.scss +13 -0
- package/src/components/sidebar/dataform-post-summary.js +61 -16
- package/src/components/sidebar/header.js +1 -1
- package/src/components/sidebar/index.js +2 -0
- package/src/components/sync-connection-error-modal/index.tsx +265 -0
- package/src/components/sync-connection-error-modal/style.scss +14 -0
- package/src/components/sync-connection-error-modal/use-retry-countdown.ts +57 -0
- package/src/components/template-content-panel/index.js +30 -38
- package/src/components/visual-editor/index.js +2 -2
- package/src/store/actions.js +1 -4
- package/src/store/private-actions.js +21 -2
- package/src/store/private-selectors.js +75 -10
- package/src/store/reducer.js +19 -0
- package/src/style.scss +2 -1
- package/src/utils/media-finalize/index.js +11 -0
- package/src/utils/media-finalize/test/index.js +34 -0
- package/src/utils/sync-error-messages.ts +72 -0
- package/src/utils/test/sync-error-messages.js +9 -32
- package/build/components/provider/use-post-content-blocks.cjs.map +0 -7
- package/build/components/sync-connection-modal/index.cjs.map +0 -7
- package/build/components/sync-connection-modal/use-retry-countdown.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 -167
- package/build-module/components/sync-connection-modal/index.mjs.map +0 -7
- package/build-module/components/sync-connection-modal/use-retry-countdown.mjs +0 -49
- package/build-module/components/sync-connection-modal/use-retry-countdown.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/build-types/components/sync-connection-modal/use-retry-countdown.d.ts +0 -9
- package/build-types/components/sync-connection-modal/use-retry-countdown.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 -200
- package/src/components/sync-connection-modal/style.scss +0 -9
- package/src/components/sync-connection-modal/use-retry-countdown.js +0 -70
- package/src/utils/sync-error-messages.js +0 -58
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/sidebar/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPlatform,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseRef,\n} from '@wordpress/element';\nimport { isRTL, __, _x } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport PatternOverridesPanel from '../pattern-overrides-panel';\nimport PluginDocumentSettingPanel from '../plugin-document-setting-panel';\nimport PluginSidebar from '../plugin-sidebar';\nimport PostSummary from './post-summary';\nimport PostTaxonomiesPanel from '../post-taxonomies/panel';\nimport PostTransformPanel from '../post-transform-panel';\nimport SidebarHeader from './header';\nimport TemplateContentPanel from '../template-content-panel';\nimport TemplatePartContentPanel from '../template-part-content-panel';\nimport { MediaMetadataPanel } from '../media';\nimport useAutoSwitchEditorSidebars from '../provider/use-auto-switch-editor-sidebars';\nimport { sidebars } from './constants';\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport {\n\tATTACHMENT_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n} from '../../store/constants';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\n\nconst SidebarContent = ( {\n\ttabName,\n\tkeyboardShortcut,\n\tonActionPerformed,\n\textraPanels,\n\tpostType,\n} ) => {\n\tconst tabListRef = useRef( null );\n\t// Because `PluginSidebar` renders a `ComplementaryArea`, we\n\t// need to forward the `Tabs` context so it can be passed through the\n\t// underlying slot/fill.\n\tconst tabsContextValue = useContext( Tabs.Context );\n\tconst isAttachment = postType === ATTACHMENT_POST_TYPE;\n\tconst isRevisionsMode = useSelect( ( select ) => {\n\t\treturn unlock( select( editorStore ) ).isRevisionsMode();\n\t} );\n\n\t// This effect addresses a race condition caused by tabbing from the last\n\t// block in the editor into the settings sidebar. Without this effect, the\n\t// selected tab and browser focus can become separated in an unexpected way\n\t// (e.g the \"block\" tab is focused, but the \"post\" tab is selected).\n\tuseEffect( () => {\n\t\tconst tabsElements = Array.from(\n\t\t\ttabListRef.current?.querySelectorAll( '[role=\"tab\"]' ) || []\n\t\t);\n\t\tconst selectedTabElement = tabsElements.find(\n\t\t\t// We are purposefully using a custom `data-tab-id` attribute here\n\t\t\t// because we don't want rely on any assumptions about `Tabs`\n\t\t\t// component internals.\n\t\t\t( element ) => element.getAttribute( 'data-tab-id' ) === tabName\n\t\t);\n\t\tconst activeElement = selectedTabElement?.ownerDocument.activeElement;\n\t\tconst tabsHasFocus = tabsElements.some( ( element ) => {\n\t\t\treturn activeElement && activeElement.id === element.id;\n\t\t} );\n\t\tif (\n\t\t\ttabsHasFocus &&\n\t\t\tselectedTabElement &&\n\t\t\tselectedTabElement.id !== activeElement?.id\n\t\t) {\n\t\t\tselectedTabElement?.focus();\n\t\t}\n\t}, [ tabName ] );\n\n\treturn (\n\t\t<PluginSidebar\n\t\t\tidentifier={ tabName }\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<SidebarHeader ref={ tabListRef } />\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t}\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\t// This classname is added so we can apply a corrective negative\n\t\t\t// margin to the panel.\n\t\t\t// see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049\n\t\t\tclassName=\"editor-sidebar__panel\"\n\t\t\theaderClassName=\"editor-sidebar__panel-tabs\"\n\t\t\ttitle={\n\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t_x( 'Settings', 'panel button label' )\n\t\t\t}\n\t\t\ttoggleShortcut={ keyboardShortcut }\n\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<Tabs.TabPanel tabId={ sidebars.document } focusable={ false }>\n\t\t\t\t\t{ isAttachment ? (\n\t\t\t\t\t\t<MediaMetadataPanel\n\t\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<PostSummary\n\t\t\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ ! isRevisionsMode && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<PluginDocumentSettingPanel.Slot />\n\t\t\t\t\t\t\t\t\t<TemplateContentPanel />\n\t\t\t\t\t\t\t\t\t<TemplatePartContentPanel />\n\t\t\t\t\t\t\t\t\t<PostTransformPanel />\n\t\t\t\t\t\t\t\t\t<PostTaxonomiesPanel />\n\t\t\t\t\t\t\t\t\t<PatternOverridesPanel />\n\t\t\t\t\t\t\t\t\t{ extraPanels }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t{ ! isAttachment && (\n\t\t\t\t\t<Tabs.TabPanel tabId={ sidebars.block } focusable={ false }>\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t) }\n\t\t\t</Tabs.Context.Provider>\n\t\t</PluginSidebar>\n\t);\n};\n\nconst Sidebar = ( { extraPanels, onActionPerformed } ) => {\n\tuseAutoSwitchEditorSidebars();\n\tconst { tabName, keyboardShortcut, showSummary, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst shortcut = select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation( 'core/editor/toggle-sidebar' );\n\n\t\t\tconst sidebar =\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea( 'core' );\n\t\t\tconst _isEditorSidebarOpened = [\n\t\t\t\tsidebars.block,\n\t\t\t\tsidebars.document,\n\t\t\t].includes( sidebar );\n\t\t\tlet _tabName = sidebar;\n\t\t\tif ( ! _isEditorSidebarOpened ) {\n\t\t\t\t_tabName = !! select(\n\t\t\t\t\tblockEditorStore\n\t\t\t\t).getBlockSelectionStart()\n\t\t\t\t\t? sidebars.block\n\t\t\t\t\t: sidebars.document;\n\t\t\t}\n\n\t\t\tconst _postType = select( editorStore ).getCurrentPostType();\n\n\t\t\treturn {\n\t\t\t\ttabName: _tabName,\n\t\t\t\tkeyboardShortcut: shortcut,\n\t\t\t\tshowSummary: ! [\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t\tNAVIGATION_POST_TYPE,\n\t\t\t\t].includes( _postType ),\n\t\t\t\tpostType: _postType,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea( 'core', newSelectedTabId );\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\tselectedTabId={ tabName }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<SidebarContent\n\t\t\t\ttabName={ tabName }\n\t\t\t\tkeyboardShortcut={ keyboardShortcut }\n\t\t\t\tshowSummary={ showSummary }\n\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\textraPanels={ extraPanels }\n\t\t\t\tpostType={ postType }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n};\n\nexport default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tD,CAAE;AACF,QACC,gBACA,sBACA,mBAAmB,OAAO,eAAe,IACxC;AACD,0BAAoB,MAAM;AAAA,IAC3B;AAAA,EACD,GAAG,CAAE,OAAQ,CAAE;AAEf,SACC;AAAA,IAAC,sBAAAC;AAAA,IAAA;AAAA,MACA,YAAa;AAAA,MACb,QACC,4CAAC,KAAK,QAAQ,UAAb,EAAsB,OAAQ,kBAC9B,sDAAC,cAAAC,SAAA,EAAc,KAAM,YAAa,GACnC;AAAA,MAED,gBAAa,gBAAI,gBAAiB;AAAA,MAIlC,WAAU;AAAA,MACV,iBAAgB;AAAA,MAChB;AAAA;AAAA,YAEC,gBAAI,YAAY,oBAAqB;AAAA;AAAA,MAEtC,gBAAiB;AAAA,MACjB,UAAO,mBAAM,IAAI,0BAAa;AAAA,MAC9B,mBAAoB;AAAA,MAEpB,uDAAC,KAAK,QAAQ,UAAb,EAAsB,OAAQ,kBAC9B;AAAA,oDAAC,KAAK,UAAL,EAAc,OAAQ,0BAAS,UAAW,WAAY,OACpD,yBACD;AAAA,UAAC;AAAA;AAAA,YACA;AAAA;AAAA,QACD,IAEA,4EACC;AAAA;AAAA,YAAC,oBAAAC;AAAA,YAAA;AAAA,cACA;AAAA;AAAA,UACD;AAAA,UACE,CAAE,mBACH,4EACC;AAAA,wDAAC,qCAAAC,QAA2B,MAA3B,EAAgC;AAAA,YACjC,4CAAC,8BAAAC,SAAA,EAAqB;AAAA,YACtB,4CAAC,mCAAAC,SAAA,EAAyB;AAAA,YAC1B,4CAAC,4BAAAC,SAAA,EAAmB;AAAA,YACpB,4CAAC,aAAAC,SAAA,EAAoB;AAAA,YACrB,4CAAC,+BAAAC,SAAA,EAAsB;AAAA,YACrB;AAAA,aACH;AAAA,WAEF,GAEF;AAAA,QACE,CAAE,gBACH,
|
|
6
|
-
"names": ["import_constants", "componentsPrivateApis", "editorStore", "PluginSidebar", "SidebarHeader", "PostSummary", "PluginDocumentSettingPanel", "TemplateContentPanel", "TemplatePartContentPanel", "PostTransformPanel", "PostTaxonomiesPanel", "PatternOverridesPanel", "useAutoSwitchEditorSidebars", "keyboardShortcutsStore", "interfaceStore", "blockEditorStore"]
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPlatform,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseRef,\n} from '@wordpress/element';\nimport { isRTL, __, _x } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport PatternOverridesPanel from '../pattern-overrides-panel';\nimport PluginDocumentSettingPanel from '../plugin-document-setting-panel';\nimport PluginSidebar from '../plugin-sidebar';\nimport PostSummary from './post-summary';\nimport PostTaxonomiesPanel from '../post-taxonomies/panel';\nimport PostTransformPanel from '../post-transform-panel';\nimport SidebarHeader from './header';\nimport TemplateContentPanel from '../template-content-panel';\nimport TemplatePartContentPanel from '../template-part-content-panel';\nimport { MediaMetadataPanel } from '../media';\nimport RevisionBlockDiffPanel from '../revision-block-diff';\nimport useAutoSwitchEditorSidebars from '../provider/use-auto-switch-editor-sidebars';\nimport { sidebars } from './constants';\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport {\n\tATTACHMENT_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n} from '../../store/constants';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\n\nconst SidebarContent = ( {\n\ttabName,\n\tkeyboardShortcut,\n\tonActionPerformed,\n\textraPanels,\n\tpostType,\n} ) => {\n\tconst tabListRef = useRef( null );\n\t// Because `PluginSidebar` renders a `ComplementaryArea`, we\n\t// need to forward the `Tabs` context so it can be passed through the\n\t// underlying slot/fill.\n\tconst tabsContextValue = useContext( Tabs.Context );\n\tconst isAttachment = postType === ATTACHMENT_POST_TYPE;\n\tconst isRevisionsMode = useSelect( ( select ) => {\n\t\treturn unlock( select( editorStore ) ).isRevisionsMode();\n\t} );\n\n\t// This effect addresses a race condition caused by tabbing from the last\n\t// block in the editor into the settings sidebar. Without this effect, the\n\t// selected tab and browser focus can become separated in an unexpected way\n\t// (e.g the \"block\" tab is focused, but the \"post\" tab is selected).\n\tuseEffect( () => {\n\t\tconst tabsElements = Array.from(\n\t\t\ttabListRef.current?.querySelectorAll( '[role=\"tab\"]' ) || []\n\t\t);\n\t\tconst selectedTabElement = tabsElements.find(\n\t\t\t// We are purposefully using a custom `data-tab-id` attribute here\n\t\t\t// because we don't want rely on any assumptions about `Tabs`\n\t\t\t// component internals.\n\t\t\t( element ) => element.getAttribute( 'data-tab-id' ) === tabName\n\t\t);\n\t\tconst activeElement = selectedTabElement?.ownerDocument.activeElement;\n\t\tconst tabsHasFocus = tabsElements.some( ( element ) => {\n\t\t\treturn activeElement && activeElement.id === element.id;\n\t\t} );\n\t\tif (\n\t\t\ttabsHasFocus &&\n\t\t\tselectedTabElement &&\n\t\t\tselectedTabElement.id !== activeElement?.id\n\t\t) {\n\t\t\tselectedTabElement?.focus();\n\t\t}\n\t}, [ tabName ] );\n\n\treturn (\n\t\t<PluginSidebar\n\t\t\tidentifier={ tabName }\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<SidebarHeader ref={ tabListRef } />\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t}\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\t// This classname is added so we can apply a corrective negative\n\t\t\t// margin to the panel.\n\t\t\t// see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049\n\t\t\tclassName=\"editor-sidebar__panel\"\n\t\t\theaderClassName=\"editor-sidebar__panel-tabs\"\n\t\t\ttitle={\n\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t_x( 'Settings', 'panel button label' )\n\t\t\t}\n\t\t\ttoggleShortcut={ keyboardShortcut }\n\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<Tabs.TabPanel tabId={ sidebars.document } focusable={ false }>\n\t\t\t\t\t{ isAttachment ? (\n\t\t\t\t\t\t<MediaMetadataPanel\n\t\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<PostSummary\n\t\t\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ ! isRevisionsMode && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<PluginDocumentSettingPanel.Slot />\n\t\t\t\t\t\t\t\t\t<TemplateContentPanel />\n\t\t\t\t\t\t\t\t\t<TemplatePartContentPanel />\n\t\t\t\t\t\t\t\t\t<PostTransformPanel />\n\t\t\t\t\t\t\t\t\t<PostTaxonomiesPanel />\n\t\t\t\t\t\t\t\t\t<PatternOverridesPanel />\n\t\t\t\t\t\t\t\t\t{ extraPanels }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t{ ! isAttachment && (\n\t\t\t\t\t<Tabs.TabPanel tabId={ sidebars.block } focusable={ false }>\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t\t{ isRevisionsMode && <RevisionBlockDiffPanel /> }\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t) }\n\t\t\t</Tabs.Context.Provider>\n\t\t</PluginSidebar>\n\t);\n};\n\nconst Sidebar = ( { extraPanels, onActionPerformed } ) => {\n\tuseAutoSwitchEditorSidebars();\n\tconst { tabName, keyboardShortcut, showSummary, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst shortcut = select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation( 'core/editor/toggle-sidebar' );\n\n\t\t\tconst sidebar =\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea( 'core' );\n\t\t\tconst _isEditorSidebarOpened = [\n\t\t\t\tsidebars.block,\n\t\t\t\tsidebars.document,\n\t\t\t].includes( sidebar );\n\t\t\tlet _tabName = sidebar;\n\t\t\tif ( ! _isEditorSidebarOpened ) {\n\t\t\t\t_tabName = !! select(\n\t\t\t\t\tblockEditorStore\n\t\t\t\t).getBlockSelectionStart()\n\t\t\t\t\t? sidebars.block\n\t\t\t\t\t: sidebars.document;\n\t\t\t}\n\n\t\t\tconst _postType = select( editorStore ).getCurrentPostType();\n\n\t\t\treturn {\n\t\t\t\ttabName: _tabName,\n\t\t\t\tkeyboardShortcut: shortcut,\n\t\t\t\tshowSummary: ! [\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t\tNAVIGATION_POST_TYPE,\n\t\t\t\t].includes( _postType ),\n\t\t\t\tpostType: _postType,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea( 'core', newSelectedTabId );\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\tselectedTabId={ tabName }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<SidebarContent\n\t\t\t\ttabName={ tabName }\n\t\t\t\tkeyboardShortcut={ keyboardShortcut }\n\t\t\t\tshowSummary={ showSummary }\n\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\textraPanels={ extraPanels }\n\t\t\t\tpostType={ postType }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n};\n\nexport default Sidebar;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAGO;AACP,kBAAuC;AACvC,qBAMO;AACP,kBAA8B;AAC9B,mBAAwC;AACxC,gCAAgD;AAChD,wBAAqD;AACrD,uBAAwC;AAKxC,qCAAkC;AAClC,2CAAuC;AACvC,4BAA0B;AAC1B,0BAAwB;AACxB,mBAAgC;AAChC,kCAA+B;AAC/B,oBAA0B;AAC1B,oCAAiC;AACjC,yCAAqC;AACrC,mBAAmC;AACnC,iCAAmC;AACnC,6CAAwC;AACxC,uBAAyB;AACzB,yBAAuB;AACvB,mBAAqC;AACrC,IAAAA,oBAKO;AA0DF;AAxDL,IAAM,EAAE,KAAK,QAAI,2BAAQ,kBAAAC,WAAsB;AAE/C,IAAM,4BAA4B,wBAAS,OAAQ;AAAA,EAClD,KAAK;AAAA,EACL,QAAQ;AACT,CAAE;AAEF,IAAM,iBAAiB,CAAE;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,MAAO;AACN,QAAM,iBAAa,uBAAQ,IAAK;AAIhC,QAAM,uBAAmB,2BAAY,KAAK,OAAQ;AAClD,QAAM,eAAe,aAAa;AAClC,QAAM,sBAAkB,uBAAW,CAAE,WAAY;AAChD,eAAO,2BAAQ,OAAQ,aAAAC,KAAY,CAAE,EAAE,gBAAgB;AAAA,EACxD,CAAE;AAMF,gCAAW,MAAM;AAChB,UAAM,eAAe,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,UAAK,CAAC,CAAE,kBAAmB;AAC1B,gCAAyB,QAAQ,gBAAiB;AAAA,MACnD;AAAA,IACD;AAAA,IACA,CAAE,uBAAwB;AAAA,EAC3B;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,eAAgB;AAAA,MAChB,UAAW;AAAA,MACX,cAAe;AAAA,MAEf;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;AAEA,IAAO,kBAAQ;",
|
|
6
|
+
"names": ["import_constants", "componentsPrivateApis", "editorStore", "PluginSidebar", "SidebarHeader", "PostSummary", "PluginDocumentSettingPanel", "TemplateContentPanel", "TemplatePartContentPanel", "PostTransformPanel", "PostTaxonomiesPanel", "PatternOverridesPanel", "RevisionBlockDiffPanel", "useAutoSwitchEditorSidebars", "keyboardShortcutsStore", "interfaceStore", "blockEditorStore"]
|
|
7
7
|
}
|
|
@@ -17,12 +17,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// packages/editor/src/components/sync-connection-modal/index.
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
23
|
-
|
|
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
24
|
});
|
|
25
|
-
module.exports = __toCommonJS(
|
|
25
|
+
module.exports = __toCommonJS(sync_connection_error_modal_exports);
|
|
26
26
|
var import_data = require("@wordpress/data");
|
|
27
27
|
var import_compose = require("@wordpress/compose");
|
|
28
28
|
var import_blocks = require("@wordpress/blocks");
|
|
@@ -39,95 +39,53 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
39
39
|
var { BlockCanvasCover } = (0, import_lock_unlock.unlock)(import_block_editor.privateApis);
|
|
40
40
|
var { retrySyncConnection } = (0, import_lock_unlock.unlock)(import_core_data.privateApis);
|
|
41
41
|
var INITIAL_DISCONNECTED_DEBOUNCE_MS = 5e3;
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}, []);
|
|
52
|
-
const { secondsRemaining, markRetrying } = (0, import_use_retry_countdown.useRetryCountdown)(
|
|
53
|
-
connectionState?.retryInMs,
|
|
54
|
-
connectionState?.status
|
|
55
|
-
);
|
|
42
|
+
var DISCONNECTED_DEBOUNCE_MS = 2e3;
|
|
43
|
+
function DefaultSyncConnectionErrorModal(props) {
|
|
44
|
+
const {
|
|
45
|
+
description,
|
|
46
|
+
manualRetry,
|
|
47
|
+
postType,
|
|
48
|
+
secondsRemainingUntilAutoRetry,
|
|
49
|
+
title
|
|
50
|
+
} = props;
|
|
56
51
|
const copyButtonRef = (0, import_compose.useCopyToClipboard)(() => {
|
|
57
52
|
const blocks = (0, import_data.select)(import_block_editor.store).getBlocks();
|
|
58
53
|
return (0, import_blocks.serialize)(blocks);
|
|
59
54
|
});
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const connectionStatus = connectionState?.status;
|
|
64
|
-
const connectionErrorCode = connectionState?.error?.code;
|
|
65
|
-
(0, import_element.useEffect)(() => {
|
|
66
|
-
if (debounceTimerRef.current) {
|
|
67
|
-
clearTimeout(debounceTimerRef.current);
|
|
68
|
-
debounceTimerRef.current = null;
|
|
69
|
-
}
|
|
70
|
-
if (connectionStatus === "connected") {
|
|
71
|
-
hasInitializedRef.current = true;
|
|
72
|
-
setSyncConnectionMessage(null);
|
|
73
|
-
} else if (connectionStatus === "disconnected") {
|
|
74
|
-
const showModal = () => {
|
|
75
|
-
hasInitializedRef.current = true;
|
|
76
|
-
setSyncConnectionMessage(
|
|
77
|
-
(0, import_sync_error_messages.getSyncErrorMessages)({ code: connectionErrorCode })
|
|
78
|
-
);
|
|
79
|
-
};
|
|
80
|
-
if (hasInitializedRef.current) {
|
|
81
|
-
showModal();
|
|
82
|
-
} else {
|
|
83
|
-
debounceTimerRef.current = setTimeout(
|
|
84
|
-
showModal,
|
|
85
|
-
INITIAL_DISCONNECTED_DEBOUNCE_MS
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return () => {
|
|
90
|
-
if (debounceTimerRef.current) {
|
|
91
|
-
clearTimeout(debounceTimerRef.current);
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
}, [connectionStatus, connectionErrorCode]);
|
|
95
|
-
if (!syncConnectionMessage) {
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
const { title, description, canRetry } = syncConnectionMessage;
|
|
99
|
-
let retryCountdownText;
|
|
100
|
-
if (secondsRemaining > 0) {
|
|
55
|
+
let retryCountdownText = "";
|
|
56
|
+
let isRetrying = false;
|
|
57
|
+
if (secondsRemainingUntilAutoRetry && secondsRemainingUntilAutoRetry > 0) {
|
|
101
58
|
retryCountdownText = (0, import_i18n.sprintf)(
|
|
102
59
|
/* translators: %d: number of seconds until retry */
|
|
103
60
|
(0, import_i18n._n)(
|
|
104
61
|
"Retrying connection in %d second\u2026",
|
|
105
62
|
"Retrying connection in %d seconds\u2026",
|
|
106
|
-
|
|
63
|
+
secondsRemainingUntilAutoRetry
|
|
107
64
|
),
|
|
108
|
-
|
|
65
|
+
secondsRemainingUntilAutoRetry
|
|
109
66
|
);
|
|
110
|
-
} else if (
|
|
67
|
+
} else if (0 === secondsRemainingUntilAutoRetry) {
|
|
68
|
+
isRetrying = true;
|
|
111
69
|
retryCountdownText = (0, import_i18n.__)("Retrying\u2026");
|
|
112
70
|
}
|
|
113
71
|
let editPostHref = "edit.php";
|
|
114
72
|
if (postType?.slug) {
|
|
115
73
|
editPostHref = `edit.php?post_type=${postType.slug}`;
|
|
116
74
|
}
|
|
117
|
-
|
|
118
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BlockCanvasCover.Fill, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
75
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
119
76
|
import_components.Modal,
|
|
120
77
|
{
|
|
121
|
-
|
|
78
|
+
overlayClassName: "editor-sync-connection-error-modal",
|
|
122
79
|
isDismissible: false,
|
|
123
|
-
onRequestClose:
|
|
80
|
+
onRequestClose: () => {
|
|
81
|
+
},
|
|
124
82
|
shouldCloseOnClickOutside: false,
|
|
125
83
|
shouldCloseOnEsc: false,
|
|
126
84
|
size: "medium",
|
|
127
85
|
title,
|
|
128
86
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalVStack, { spacing: 6, children: [
|
|
129
87
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: description }),
|
|
130
|
-
retryCountdownText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "editor-sync-connection-modal__retry-countdown", children: retryCountdownText }),
|
|
88
|
+
retryCountdownText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "editor-sync-connection-error-modal__retry-countdown", children: retryCountdownText }),
|
|
131
89
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalHStack, { justify: "right", children: [
|
|
132
90
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
133
91
|
import_components.Button,
|
|
@@ -148,34 +106,88 @@ function SyncConnectionModal() {
|
|
|
148
106
|
{
|
|
149
107
|
__next40pxDefaultSize: true,
|
|
150
108
|
ref: copyButtonRef,
|
|
151
|
-
variant:
|
|
109
|
+
variant: manualRetry ? "secondary" : "primary",
|
|
152
110
|
children: (0, import_i18n.__)("Copy Post Content")
|
|
153
111
|
}
|
|
154
112
|
),
|
|
155
|
-
|
|
113
|
+
manualRetry && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
156
114
|
import_components.Button,
|
|
157
115
|
{
|
|
158
116
|
__next40pxDefaultSize: true,
|
|
117
|
+
accessibleWhenDisabled: true,
|
|
159
118
|
"aria-disabled": isRetrying,
|
|
119
|
+
disabled: isRetrying,
|
|
160
120
|
isBusy: isRetrying,
|
|
161
121
|
variant: "primary",
|
|
162
|
-
onClick:
|
|
163
|
-
if (isRetrying) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
markRetrying();
|
|
167
|
-
retrySyncConnection();
|
|
168
|
-
},
|
|
122
|
+
onClick: manualRetry,
|
|
169
123
|
children: (0, import_i18n.__)("Retry")
|
|
170
124
|
}
|
|
171
125
|
)
|
|
172
126
|
] })
|
|
173
127
|
] })
|
|
174
128
|
}
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
var FilteredSyncConnectionErrorModal = globalThis.IS_GUTENBERG_PLUGIN ? (0, import_components.withFilters)("editor.SyncConnectionErrorModal")(
|
|
132
|
+
DefaultSyncConnectionErrorModal
|
|
133
|
+
) : DefaultSyncConnectionErrorModal;
|
|
134
|
+
function SyncConnectionErrorModal() {
|
|
135
|
+
const [hasInitialized, setHasInitialized] = (0, import_element.useState)(false);
|
|
136
|
+
const [showModal, setShowModal] = (0, import_element.useState)(false);
|
|
137
|
+
const { connectionStatus, isCollaborationEnabled, postType } = (0, import_data.useSelect)(
|
|
138
|
+
(selectFn) => {
|
|
139
|
+
const currentPostType = selectFn(import_store.store).getCurrentPostType();
|
|
140
|
+
return {
|
|
141
|
+
connectionStatus: selectFn(import_core_data.store).getSyncConnectionStatus() || null,
|
|
142
|
+
isCollaborationEnabled: selectFn(
|
|
143
|
+
import_store.store
|
|
144
|
+
).isCollaborationEnabledForCurrentPost(),
|
|
145
|
+
postType: currentPostType ? selectFn(import_core_data.store).getPostType(currentPostType) : null
|
|
146
|
+
};
|
|
147
|
+
},
|
|
148
|
+
[]
|
|
149
|
+
);
|
|
150
|
+
const { onManualRetry, secondsRemaining } = (0, import_use_retry_countdown.useRetryCountdown)(connectionStatus);
|
|
151
|
+
const isConnected = "connected" === connectionStatus?.status;
|
|
152
|
+
(0, import_element.useEffect)(() => {
|
|
153
|
+
const timeout = setTimeout(() => {
|
|
154
|
+
setHasInitialized(true);
|
|
155
|
+
}, INITIAL_DISCONNECTED_DEBOUNCE_MS);
|
|
156
|
+
return () => clearTimeout(timeout);
|
|
157
|
+
}, []);
|
|
158
|
+
(0, import_element.useEffect)(() => {
|
|
159
|
+
if (isConnected) {
|
|
160
|
+
setShowModal(false);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const timeout = setTimeout(() => {
|
|
164
|
+
setShowModal(true);
|
|
165
|
+
}, DISCONNECTED_DEBOUNCE_MS);
|
|
166
|
+
return () => clearTimeout(timeout);
|
|
167
|
+
}, [isConnected]);
|
|
168
|
+
if (!isCollaborationEnabled || !hasInitialized || !showModal) {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
const error = connectionStatus && "error" in connectionStatus ? connectionStatus?.error : void 0;
|
|
172
|
+
const manualRetry = connectionStatus && "canManuallyRetry" in connectionStatus && connectionStatus.canManuallyRetry ? () => {
|
|
173
|
+
onManualRetry();
|
|
174
|
+
retrySyncConnection();
|
|
175
|
+
} : void 0;
|
|
176
|
+
const messages = (0, import_sync_error_messages.getSyncErrorMessages)(error);
|
|
177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BlockCanvasCover.Fill, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
178
|
+
FilteredSyncConnectionErrorModal,
|
|
179
|
+
{
|
|
180
|
+
description: messages.description,
|
|
181
|
+
error,
|
|
182
|
+
manualRetry,
|
|
183
|
+
postType,
|
|
184
|
+
secondsRemainingUntilAutoRetry: secondsRemaining,
|
|
185
|
+
title: messages.title
|
|
186
|
+
}
|
|
175
187
|
) });
|
|
176
188
|
}
|
|
177
189
|
// Annotate the CommonJS export names for ESM import in node:
|
|
178
190
|
0 && (module.exports = {
|
|
179
|
-
|
|
191
|
+
SyncConnectionErrorModal
|
|
180
192
|
});
|
|
181
193
|
//# 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\ttype ConnectionError,\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\twithFilters,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\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 = 5000;\n\n// Debounce time for showing the disconnect dialog after the intial connection,\n// allowing brief network interruptions to resolve.\nconst DISCONNECTED_DEBOUNCE_MS = 2000;\n\nexport interface SyncConnectionErrorModalProps {\n\tdescription: string; // Modal description.\n\terror?: ConnectionError; // Error object with a `code` property.\n\tmanualRetry?: () => void; // Callback for when the retry button is clicked.\n\tpostType?: { slug?: string; labels?: { name?: string } } | null; // Current post type object.\n\tsecondsRemainingUntilAutoRetry?: number; // Seconds remaining until the next automatic retry attempt, if applicable.\n\ttitle: string; // Modal title.\n}\n\n/**\n * Default sync connection modal component.\n *\n * Can be replaced or wrapped via the `editor.SyncConnectionErrorModal` filter.\n *\n * @param props - SyncConnectionErrorModalProps.\n */\nfunction DefaultSyncConnectionErrorModal(\n\tprops: SyncConnectionErrorModalProps\n) {\n\tconst {\n\t\tdescription,\n\t\tmanualRetry,\n\t\tpostType,\n\t\tsecondsRemainingUntilAutoRetry,\n\t\ttitle,\n\t} = props;\n\tconst copyButtonRef = useCopyToClipboard( () => {\n\t\tconst blocks = select( blockEditorStore ).getBlocks();\n\t\treturn serialize( blocks );\n\t} );\n\n\tlet retryCountdownText: string = '';\n\tlet isRetrying = false;\n\tif (\n\t\tsecondsRemainingUntilAutoRetry &&\n\t\tsecondsRemainingUntilAutoRetry > 0\n\t) {\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\tsecondsRemainingUntilAutoRetry\n\t\t\t),\n\t\t\tsecondsRemainingUntilAutoRetry\n\t\t);\n\t} else if ( 0 === secondsRemainingUntilAutoRetry ) {\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<Modal\n\t\t\toverlayClassName=\"editor-sync-connection-error-modal\"\n\t\t\tisDismissible={ false }\n\t\t\tonRequestClose={ () => {} }\n\t\t\tshouldCloseOnClickOutside={ false }\n\t\t\tshouldCloseOnEsc={ false }\n\t\t\tsize=\"medium\"\n\t\t\ttitle={ title }\n\t\t>\n\t\t\t<VStack spacing={ 6 }>\n\t\t\t\t<p>{ description }</p>\n\t\t\t\t{ retryCountdownText && (\n\t\t\t\t\t<p className=\"editor-sync-connection-error-modal__retry-countdown\">\n\t\t\t\t\t\t{ retryCountdownText }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\thref={ editPostHref }\n\t\t\t\t\t\tisDestructive\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t/* translators: %s: Post type name (e.g., \"Posts\", \"Pages\"). */\n\t\t\t\t\t\t\t__( 'Back to %s' ),\n\t\t\t\t\t\t\tpostType?.labels?.name ?? __( 'Posts' )\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tref={ copyButtonRef }\n\t\t\t\t\t\tvariant={ manualRetry ? 'secondary' : 'primary' }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Copy Post Content' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t{ manualRetry && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\taria-disabled={ isRetrying }\n\t\t\t\t\t\t\tdisabled={ isRetrying }\n\t\t\t\t\t\t\tisBusy={ isRetrying }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tonClick={ manualRetry }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Retry' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</Modal>\n\t);\n}\n\n/**\n * Filtered version of the sync connection modal, allowing third-party\n * plugins to replace the default modal via:\n *\n * ```js\n * wp.hooks.addFilter(\n * 'editor.SyncConnectionErrorModal',\n * 'my-plugin/custom-sync-connection-error-modal',\n * ( OriginalComponent ) => ( props ) => {\n * // Return a custom component or wrap the original.\n * return <OriginalComponent { ...props } />;\n * }\n * );\n * ```\n */\n// @ts-ignore\nconst FilteredSyncConnectionErrorModal = globalThis.IS_GUTENBERG_PLUGIN\n\t? withFilters( 'editor.SyncConnectionErrorModal' )(\n\t\t\tDefaultSyncConnectionErrorModal\n\t )\n\t: DefaultSyncConnectionErrorModal;\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\n\tconst { connectionStatus, isCollaborationEnabled, postType } = useSelect(\n\t\t( selectFn ) => {\n\t\t\tconst currentPostType =\n\t\t\t\tselectFn( editorStore ).getCurrentPostType();\n\t\t\treturn {\n\t\t\t\tconnectionStatus:\n\t\t\t\t\tselectFn( coreDataStore ).getSyncConnectionStatus() || null,\n\t\t\t\tisCollaborationEnabled:\n\t\t\t\t\tselectFn(\n\t\t\t\t\t\teditorStore\n\t\t\t\t\t).isCollaborationEnabledForCurrentPost(),\n\t\t\t\tpostType: currentPostType\n\t\t\t\t\t? selectFn( coreDataStore ).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 isConnected = 'connected' === connectionStatus?.status;\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\tuseEffect( () => {\n\t\tif ( isConnected ) {\n\t\t\tsetShowModal( false );\n\t\t\treturn;\n\t\t}\n\n\t\tconst timeout = setTimeout( () => {\n\t\t\tsetShowModal( true );\n\t\t}, DISCONNECTED_DEBOUNCE_MS );\n\n\t\treturn () => clearTimeout( timeout );\n\t}, [ isConnected ] );\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\tconst manualRetry =\n\t\tconnectionStatus &&\n\t\t'canManuallyRetry' in connectionStatus &&\n\t\tconnectionStatus.canManuallyRetry\n\t\t\t? () => {\n\t\t\t\t\tonManualRetry();\n\t\t\t\t\tretrySyncConnection();\n\t\t\t }\n\t\t\t: undefined;\n\tconst messages = getSyncErrorMessages( error );\n\n\treturn (\n\t\t<BlockCanvasCover.Fill>\n\t\t\t<FilteredSyncConnectionErrorModal\n\t\t\t\tdescription={ messages.description }\n\t\t\t\terror={ error }\n\t\t\t\tmanualRetry={ manualRetry }\n\t\t\t\tpostType={ postType }\n\t\t\t\tsecondsRemainingUntilAutoRetry={ secondsRemaining }\n\t\t\t\ttitle={ messages.title }\n\t\t\t/>\n\t\t</BlockCanvasCover.Fill>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAkC;AAClC,qBAAmC;AAEnC,oBAA0B;AAC1B,uBAIO;AAGP,0BAAuD;AACvD,wBAMO;AACP,qBAAoC;AACpC,kBAAgC;AAKhC,iCAAqC;AACrC,mBAAqC;AACrC,yBAAuB;AACvB,iCAAkC;AA+E9B;AA7EJ,IAAM,EAAE,iBAAiB,QAAI,2BAAQ,+BAAY;AACjD,IAAM,EAAE,oBAAoB,QAAI,2BAAQ,iBAAAA,WAAoB;AAG5D,IAAM,mCAAmC;AAIzC,IAAM,2BAA2B;AAkBjC,SAAS,gCACR,OACC;AACD,QAAM;AAAA,I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IACpB,GAAG,wBAAyB;AAE5B,WAAO,MAAM,aAAc,OAAQ;AAAA,EACpC,GAAG,CAAE,WAAY,CAAE;AAEnB,MAAK,CAAE,0BAA0B,CAAE,kBAAkB,CAAE,WAAY;AAClE,WAAO;AAAA,EACR;AAEA,QAAM,QACL,oBAAoB,WAAW,mBAC5B,kBAAkB,QAClB;AACJ,QAAM,cACL,oBACA,sBAAsB,oBACtB,iBAAiB,mBACd,MAAM;AACN,kBAAc;AACd,wBAAoB;AAAA,EACpB,IACA;AACJ,QAAM,eAAW,iDAAsB,KAAM;AAE7C,SACC,4CAAC,iBAAiB,MAAjB,EACA;AAAA,IAAC;AAAA;AAAA,MACA,aAAc,SAAS;AAAA,MACvB;AAAA,MACA;AAAA,MACA;AAAA,MACA,gCAAiC;AAAA,MACjC,OAAQ,SAAS;AAAA;AAAA,EAClB,GACD;AAEF;",
|
|
6
|
+
"names": ["coreDataPrivateApis", "blockEditorStore", "VStack", "HStack", "editorStore", "coreDataStore"]
|
|
7
|
+
}
|
|
@@ -17,55 +17,42 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// packages/editor/src/components/sync-connection-modal/use-retry-countdown.
|
|
20
|
+
// packages/editor/src/components/sync-connection-error-modal/use-retry-countdown.ts
|
|
21
21
|
var use_retry_countdown_exports = {};
|
|
22
22
|
__export(use_retry_countdown_exports, {
|
|
23
23
|
useRetryCountdown: () => useRetryCountdown
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(use_retry_countdown_exports);
|
|
26
26
|
var import_element = require("@wordpress/element");
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const [secondsRemaining, setSecondsRemaining] = (0, import_element.useState)(null);
|
|
30
|
-
const [isRetrying, setIsRetrying] = (0, import_element.useState)(false);
|
|
31
|
-
const retryAtRef = (0, import_element.useRef)(null);
|
|
32
|
-
const markRetrying = () => setIsRetrying(true);
|
|
27
|
+
function useRetryCountdown(connectionStatus) {
|
|
28
|
+
const [secondsRemaining, setSecondsRemaining] = (0, import_element.useState)();
|
|
33
29
|
(0, import_element.useEffect)(() => {
|
|
34
|
-
if (!
|
|
30
|
+
if (!connectionStatus) {
|
|
35
31
|
return;
|
|
36
32
|
}
|
|
37
|
-
|
|
38
|
-
(
|
|
39
|
-
MIN_RETRYING_DISPLAY_MS
|
|
40
|
-
);
|
|
41
|
-
return () => clearTimeout(id);
|
|
42
|
-
}, [isRetrying]);
|
|
43
|
-
(0, import_element.useEffect)(() => {
|
|
44
|
-
if (status === "connected") {
|
|
45
|
-
setSecondsRemaining(null);
|
|
46
|
-
retryAtRef.current = null;
|
|
33
|
+
if ("connected" === connectionStatus.status) {
|
|
34
|
+
setSecondsRemaining(void 0);
|
|
47
35
|
return;
|
|
48
36
|
}
|
|
49
|
-
if (
|
|
37
|
+
if ("disconnected" !== connectionStatus.status || !connectionStatus.willAutoRetryInMs) {
|
|
50
38
|
return;
|
|
51
39
|
}
|
|
40
|
+
const { willAutoRetryInMs: retryInMs } = connectionStatus;
|
|
52
41
|
const retryAt = Date.now() + retryInMs;
|
|
53
|
-
retryAtRef.current = retryAt;
|
|
54
42
|
setSecondsRemaining(Math.ceil(retryInMs / 1e3));
|
|
55
43
|
const intervalId = setInterval(() => {
|
|
56
|
-
const remaining = Math.ceil(
|
|
57
|
-
(retryAtRef.current - Date.now()) / 1e3
|
|
58
|
-
);
|
|
44
|
+
const remaining = Math.ceil((retryAt - Date.now()) / 1e3);
|
|
59
45
|
setSecondsRemaining(Math.max(0, remaining));
|
|
60
46
|
if (remaining <= 0) {
|
|
61
47
|
clearInterval(intervalId);
|
|
62
|
-
setIsRetrying(true);
|
|
63
48
|
}
|
|
64
49
|
}, 1e3);
|
|
65
50
|
return () => clearInterval(intervalId);
|
|
66
|
-
}, [
|
|
67
|
-
|
|
68
|
-
|
|
51
|
+
}, [connectionStatus]);
|
|
52
|
+
return {
|
|
53
|
+
onManualRetry: () => setSecondsRemaining(0),
|
|
54
|
+
secondsRemaining
|
|
55
|
+
};
|
|
69
56
|
}
|
|
70
57
|
// Annotate the CommonJS export names for ESM import in node:
|
|
71
58
|
0 && (module.exports = {
|
|
@@ -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 } 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\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\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\t\tsetSecondsRemaining( Math.ceil( retryInMs / 1000 ) );\n\n\t\tconst intervalId = setInterval( () => {\n\t\t\tconst remaining = Math.ceil( ( retryAt - Date.now() ) / 1000 );\n\t\t\tsetSecondsRemaining( Math.max( 0, remaining ) );\n\t\t\tif ( remaining <= 0 ) {\n\t\t\t\tclearInterval( intervalId );\n\t\t\t}\n\t\t}, 1000 );\n\n\t\treturn () => clearInterval( intervalId );\n\t}, [ connectionStatus ] );\n\n\treturn {\n\t\tonManualRetry: () => setSecondsRemaining( 0 ),\n\t\tsecondsRemaining,\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,qBAAoC;AAO7B,SAAS,kBACf,kBAC0B;AAC1B,QAAM,CAAE,kBAAkB,mBAAoB,QAAI,yBAAmB;AAErE,gCAAW,MAAM;AAChB,QAAK,CAAE,kBAAmB;AACzB;AAAA,IACD;AAGA,QAAK,gBAAgB,iBAAiB,QAAS;AAC9C,0BAAqB,MAAU;AAC/B;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;AAC7B,wBAAqB,KAAK,KAAM,YAAY,GAAK,CAAE;AAEnD,UAAM,aAAa,YAAa,MAAM;AACrC,YAAM,YAAY,KAAK,MAAQ,UAAU,KAAK,IAAI,KAAM,GAAK;AAC7D,0BAAqB,KAAK,IAAK,GAAG,SAAU,CAAE;AAC9C,UAAK,aAAa,GAAI;AACrB,sBAAe,UAAW;AAAA,MAC3B;AAAA,IACD,GAAG,GAAK;AAER,WAAO,MAAM,cAAe,UAAW;AAAA,EACxC,GAAG,CAAE,gBAAiB,CAAE;AAExB,SAAO;AAAA,IACN,eAAe,MAAM,oBAAqB,CAAE;AAAA,IAC5C;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;A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faceStore"]
|
|
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,
|
|
@@ -323,7 +323,7 @@ function VisualEditor({
|
|
|
323
323
|
}
|
|
324
324
|
),
|
|
325
325
|
children: [
|
|
326
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
326
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sync_connection_error_modal.SyncConnectionErrorModal, {}),
|
|
327
327
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_resizable_editor.default, { enableResizing, height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
328
328
|
BlockCanvas,
|
|
329
329
|
{
|