@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
|
@@ -46,30 +46,33 @@ function CollaboratorsList({
|
|
|
46
46
|
}
|
|
47
47
|
) })
|
|
48
48
|
] }),
|
|
49
|
-
/* @__PURE__ */ jsx("div", { className: "editor-collaborators-presence__list-items", children: activeCollaborators.map((collaboratorState) =>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
collaboratorState.collaboratorInfo.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
49
|
+
/* @__PURE__ */ jsx("div", { className: "editor-collaborators-presence__list-items", children: activeCollaborators.map((collaboratorState) => {
|
|
50
|
+
const isCurrentUser = collaboratorState.isMe;
|
|
51
|
+
return /* @__PURE__ */ jsxs(
|
|
52
|
+
"button",
|
|
53
|
+
{
|
|
54
|
+
className: "editor-collaborators-presence__list-item",
|
|
55
|
+
disabled: true,
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ jsx(
|
|
58
|
+
Avatar,
|
|
59
|
+
{
|
|
60
|
+
src: getAvatarUrl(
|
|
61
|
+
collaboratorState.collaboratorInfo.avatar_urls
|
|
62
|
+
),
|
|
63
|
+
name: collaboratorState.collaboratorInfo.name,
|
|
64
|
+
borderColor: isCurrentUser ? "var(--wp-admin-theme-color)" : getAvatarBorderColor(
|
|
65
|
+
collaboratorState.collaboratorInfo.id
|
|
66
|
+
),
|
|
67
|
+
dimmed: !collaboratorState.isConnected
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
/* @__PURE__ */ jsx("div", { className: "editor-collaborators-presence__list-item-info", children: /* @__PURE__ */ jsx("div", { className: "editor-collaborators-presence__list-item-name", children: isCurrentUser ? __("You") : collaboratorState.collaboratorInfo.name }) })
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
collaboratorState.clientId
|
|
74
|
+
);
|
|
75
|
+
}) })
|
|
73
76
|
] })
|
|
74
77
|
}
|
|
75
78
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/collaborators-presence/list.tsx", "../../../src/components/collaborators-presence/styles/collaborators-list.scss"],
|
|
4
|
-
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { Popover, Button } from '@wordpress/components';\nimport { closeSmall } from '@wordpress/icons';\nimport { type PostEditorAwarenessState } from '@wordpress/core-data';\n\nimport Avatar from './avatar';\nimport { getAvatarUrl } from '../collaborators-overlay/get-avatar-url';\nimport { getAvatarBorderColor } from '../collab-sidebar/utils';\n\nimport './styles/collaborators-list.scss';\n\ninterface CollaboratorsListProps {\n\tactiveCollaborators: PostEditorAwarenessState[];\n\tpopoverAnchor?: HTMLElement | null;\n\tsetIsPopoverVisible: ( isVisible: boolean ) => void;\n}\n\n/**\n * Renders a list showing all active collaborators with their details.\n *
|
|
5
|
-
"mappings": ";AAAA,SAAS,UAAU;AACnB,SAAS,SAAS,cAAc;AAChC,SAAS,kBAAkB;AAG3B,OAAO,YAAY;AACnB,SAAS,oBAAoB;AAC7B,SAAS,4BAA4B;;;ACPrC,IAAI,OAAO,aAAa,eAAe,QAAQ,IAAI,aAAa,UAAU,CAAC,SAAS,KAAK,cAAc,kCAAkC,GAAG;AAC3I,QAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,QAAM,aAAa,gBAAgB,YAAY;AAC/C,QAAM,YAAY,SAAS,eAAe,yhFAAyhF,CAAC;AACpkF,WAAS,KAAK,YAAY,KAAK;AAChC;;;
|
|
4
|
+
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { Popover, Button } from '@wordpress/components';\nimport { closeSmall } from '@wordpress/icons';\nimport { type PostEditorAwarenessState } from '@wordpress/core-data';\n\nimport Avatar from './avatar';\nimport { getAvatarUrl } from '../collaborators-overlay/get-avatar-url';\nimport { getAvatarBorderColor } from '../collab-sidebar/utils';\n\nimport './styles/collaborators-list.scss';\n\ninterface CollaboratorsListProps {\n\tactiveCollaborators: PostEditorAwarenessState[];\n\tpopoverAnchor?: HTMLElement | null;\n\tsetIsPopoverVisible: ( isVisible: boolean ) => void;\n}\n\n/**\n * Renders a list showing all active collaborators with their details.\n * When the showCollaborationCursor preference is enabled, the current user\n * is included and expected to be first in the list.\n * @param props Component props\n * @param props.activeCollaborators List of active collaborators\n * @param props.popoverAnchor Anchor element for the popover\n * @param props.setIsPopoverVisible Callback to set the visibility of the popover\n */\nexport function CollaboratorsList( {\n\tactiveCollaborators,\n\tpopoverAnchor,\n\tsetIsPopoverVisible,\n}: CollaboratorsListProps ) {\n\treturn (\n\t\t<Popover\n\t\t\tanchor={ popoverAnchor }\n\t\t\tplacement=\"bottom\"\n\t\t\toffset={ 8 }\n\t\t\tclassName=\"editor-collaborators-presence__list\"\n\t\t\tonClose={ () => setIsPopoverVisible( false ) }\n\t\t>\n\t\t\t<div className=\"editor-collaborators-presence__list-content\">\n\t\t\t\t<div className=\"editor-collaborators-presence__list-header\">\n\t\t\t\t\t<div className=\"editor-collaborators-presence__list-header-title\">\n\t\t\t\t\t\t{ __( 'Collaborators' ) }\n\t\t\t\t\t\t<span>{ activeCollaborators.length }</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"editor-collaborators-presence__list-header-action\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t\t\t\tlabel={ __( 'Close Collaborators List' ) }\n\t\t\t\t\t\t\tonClick={ () => setIsPopoverVisible( false ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"editor-collaborators-presence__list-items\">\n\t\t\t\t\t{ activeCollaborators.map( ( collaboratorState ) => {\n\t\t\t\t\t\tconst isCurrentUser = collaboratorState.isMe;\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tkey={ collaboratorState.clientId }\n\t\t\t\t\t\t\t\tclassName=\"editor-collaborators-presence__list-item\"\n\t\t\t\t\t\t\t\tdisabled\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Avatar\n\t\t\t\t\t\t\t\t\tsrc={ getAvatarUrl(\n\t\t\t\t\t\t\t\t\t\tcollaboratorState.collaboratorInfo\n\t\t\t\t\t\t\t\t\t\t\t.avatar_urls\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tname={\n\t\t\t\t\t\t\t\t\t\tcollaboratorState.collaboratorInfo.name\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tborderColor={\n\t\t\t\t\t\t\t\t\t\tisCurrentUser\n\t\t\t\t\t\t\t\t\t\t\t? 'var(--wp-admin-theme-color)'\n\t\t\t\t\t\t\t\t\t\t\t: getAvatarBorderColor(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcollaboratorState\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.collaboratorInfo.id\n\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdimmed={ ! collaboratorState.isConnected }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<div className=\"editor-collaborators-presence__list-item-info\">\n\t\t\t\t\t\t\t\t\t<div className=\"editor-collaborators-presence__list-item-name\">\n\t\t\t\t\t\t\t\t\t\t{ isCurrentUser\n\t\t\t\t\t\t\t\t\t\t\t? __( 'You' )\n\t\t\t\t\t\t\t\t\t\t\t: collaboratorState.collaboratorInfo\n\t\t\t\t\t\t\t\t\t\t\t\t\t.name }\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</Popover>\n\t);\n}\n", "if (typeof document !== 'undefined' && process.env.NODE_ENV !== 'test' && !document.head.querySelector(\"style[data-wp-hash='9537a5e604']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"9537a5e604\");\n\tstyle.appendChild(document.createTextNode(\".editor-collaborators-presence__list.components-popover .components-popover__content{background:#fff;border:1px solid #ddd;border-radius:8px;border-width:1px 0 0 1px;box-shadow:0 1px 2px #0000000d,0 2px 3px #0000000a,0 6px 6px #00000008,0 8px 8px #00000005}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-content{min-width:280px}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-header{align-items:center;display:flex;justify-content:space-between;padding:8px 16px}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-header-title{display:flex;font-size:13px;font-weight:499;gap:4px;line-height:20px}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-header-title span{color:#757575}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-header-action{padding:0}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-header-action button{color:#1e1e1e;height:32px;padding:0;width:32px}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-items{display:flex;flex-direction:column;padding-bottom:16px}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-item{all:unset;align-items:center;box-sizing:border-box;cursor:pointer;display:flex;gap:8px;padding:12px 16px;transition:background-color .2s ease;width:100%}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-item:hover:not(:disabled){background-color:rgba(var(--wp-admin-theme-color--rgb),.04)}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-item:active:not(:disabled){background-color:rgba(var(--wp-admin-theme-color--rgb),.08)}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-item:focus-visible{outline:2px solid var(--wp-admin-theme-color,#3858e9);outline-offset:-2px}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-item:disabled{cursor:default}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-item-info{display:flex;flex:1;flex-direction:column;min-width:0}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-item-name{color:#1e1e1e;font-size:13px;font-weight:499;line-height:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\"));\n\tdocument.head.appendChild(style);\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,UAAU;AACnB,SAAS,SAAS,cAAc;AAChC,SAAS,kBAAkB;AAG3B,OAAO,YAAY;AACnB,SAAS,oBAAoB;AAC7B,SAAS,4BAA4B;;;ACPrC,IAAI,OAAO,aAAa,eAAe,QAAQ,IAAI,aAAa,UAAU,CAAC,SAAS,KAAK,cAAc,kCAAkC,GAAG;AAC3I,QAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,QAAM,aAAa,gBAAgB,YAAY;AAC/C,QAAM,YAAY,SAAS,eAAe,yhFAAyhF,CAAC;AACpkF,WAAS,KAAK,YAAY,KAAK;AAChC;;;ADoCK,SAEC,KAFD;AAfE,SAAS,kBAAmB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AACD,GAA4B;AAC3B,SACC;AAAA,IAAC;AAAA;AAAA,MACA,QAAS;AAAA,MACT,WAAU;AAAA,MACV,QAAS;AAAA,MACT,WAAU;AAAA,MACV,SAAU,MAAM,oBAAqB,KAAM;AAAA,MAE3C,+BAAC,SAAI,WAAU,+CACd;AAAA,6BAAC,SAAI,WAAU,8CACd;AAAA,+BAAC,SAAI,WAAU,oDACZ;AAAA,eAAI,eAAgB;AAAA,YACtB,oBAAC,UAAO,8BAAoB,QAAQ;AAAA,aACrC;AAAA,UACA,oBAAC,SAAI,WAAU,qDACd;AAAA,YAAC;AAAA;AAAA,cACA,uBAAqB;AAAA,cACrB,MAAO;AAAA,cACP,UAAW;AAAA,cACX,OAAQ,GAAI,0BAA2B;AAAA,cACvC,SAAU,MAAM,oBAAqB,KAAM;AAAA;AAAA,UAC5C,GACD;AAAA,WACD;AAAA,QACA,oBAAC,SAAI,WAAU,6CACZ,8BAAoB,IAAK,CAAE,sBAAuB;AACnD,gBAAM,gBAAgB,kBAAkB;AACxC,iBACC;AAAA,YAAC;AAAA;AAAA,cAEA,WAAU;AAAA,cACV,UAAQ;AAAA,cAER;AAAA;AAAA,kBAAC;AAAA;AAAA,oBACA,KAAM;AAAA,sBACL,kBAAkB,iBAChB;AAAA,oBACH;AAAA,oBACA,MACC,kBAAkB,iBAAiB;AAAA,oBAEpC,aACC,gBACG,gCACA;AAAA,sBACA,kBACE,iBAAiB;AAAA,oBACnB;AAAA,oBAEJ,QAAS,CAAE,kBAAkB;AAAA;AAAA,gBAC9B;AAAA,gBACA,oBAAC,SAAI,WAAU,iDACd,8BAAC,SAAI,WAAU,iDACZ,0BACC,GAAI,KAAM,IACV,kBAAkB,iBACjB,MACL,GACD;AAAA;AAAA;AAAA,YA7BM,kBAAkB;AAAA,UA8BzB;AAAA,QAEF,CAAE,GACH;AAAA,SACD;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
// packages/editor/src/components/collaborators-presence/use-collaborator-notifications.ts
|
|
2
|
-
import { usePrevious } from "@wordpress/compose";
|
|
3
2
|
import { useDispatch, useSelect } from "@wordpress/data";
|
|
4
|
-
import {
|
|
3
|
+
import { useCallback } from "@wordpress/element";
|
|
5
4
|
import { __, sprintf } from "@wordpress/i18n";
|
|
6
5
|
import { store as noticesStore } from "@wordpress/notices";
|
|
7
6
|
import {
|
|
8
7
|
privateApis
|
|
9
8
|
} from "@wordpress/core-data";
|
|
9
|
+
import { store as preferencesStore } from "@wordpress/preferences";
|
|
10
10
|
import { unlock } from "../../lock-unlock.mjs";
|
|
11
11
|
import { store as editorStore } from "../../store/index.mjs";
|
|
12
|
-
var {
|
|
12
|
+
var { useOnCollaboratorJoin, useOnCollaboratorLeave, useOnPostSave } = unlock(privateApis);
|
|
13
13
|
var NOTIFICATION_TYPE = {
|
|
14
14
|
COLLAB_POST_UPDATED: "collab-post-updated",
|
|
15
15
|
COLLAB_USER_ENTERED: "collab-user-entered",
|
|
16
16
|
COLLAB_USER_EXITED: "collab-user-exited"
|
|
17
17
|
};
|
|
18
|
-
var NOTIFICATIONS_CONFIG = {
|
|
19
|
-
userEntered: true,
|
|
20
|
-
userExited: true,
|
|
21
|
-
postUpdated: true
|
|
22
|
-
};
|
|
23
18
|
var PUBLISHED_STATUSES = ["publish", "private", "future"];
|
|
24
19
|
function getPostUpdatedMessage(name, status, isFirstPublish) {
|
|
25
20
|
if (isFirstPublish) {
|
|
@@ -31,119 +26,96 @@ function getPostUpdatedMessage(name, status, isFirstPublish) {
|
|
|
31
26
|
return sprintf(__("Draft saved by %s."), name);
|
|
32
27
|
}
|
|
33
28
|
function useCollaboratorNotifications(postId, postType) {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
const { postStatus, isCollaborationEnabled, showNotifications } = useSelect(
|
|
30
|
+
(select) => {
|
|
31
|
+
const editorSel = select(editorStore);
|
|
32
|
+
return {
|
|
33
|
+
postStatus: editorSel.getCurrentPostAttribute("status"),
|
|
34
|
+
isCollaborationEnabled: editorSel.isCollaborationEnabledForCurrentPost(),
|
|
35
|
+
showNotifications: select(preferencesStore).get(
|
|
36
|
+
"core",
|
|
37
|
+
"showCollaborationNotifications"
|
|
38
|
+
) ?? true
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
[]
|
|
37
42
|
);
|
|
38
|
-
const lastPostSave = useLastPostSave(postId, postType);
|
|
39
|
-
const { postStatus, isCollaborationEnabled } = useSelect((select) => {
|
|
40
|
-
const editorSel = select(editorStore);
|
|
41
|
-
return {
|
|
42
|
-
postStatus: editorSel.getCurrentPostAttribute("status"),
|
|
43
|
-
isCollaborationEnabled: editorSel.isCollaborationEnabledForCurrentPost()
|
|
44
|
-
};
|
|
45
|
-
}, []);
|
|
46
43
|
const { createNotice } = useDispatch(noticesStore);
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
function notify(noticeId, message) {
|
|
57
|
-
void createNotice("info", message, {
|
|
58
|
-
id: noticeId,
|
|
59
|
-
type: "snackbar",
|
|
60
|
-
isDismissible: false
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
const prevMap = new Map(
|
|
64
|
-
prevCollaborators.map((c) => [c.clientId, c])
|
|
65
|
-
);
|
|
66
|
-
const newMap = new Map(
|
|
67
|
-
activeCollaborators.map((c) => [c.clientId, c])
|
|
68
|
-
);
|
|
69
|
-
if (NOTIFICATIONS_CONFIG.userEntered) {
|
|
70
|
-
const me = activeCollaborators.find((c) => c.isMe);
|
|
71
|
-
for (const [clientId, collaborator] of newMap) {
|
|
72
|
-
if (prevMap.has(clientId) || collaborator.isMe) {
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
44
|
+
const shouldSubscribe = isCollaborationEnabled && showNotifications;
|
|
45
|
+
const effectivePostId = shouldSubscribe ? postId : null;
|
|
46
|
+
const effectivePostType = shouldSubscribe ? postType : null;
|
|
47
|
+
useOnCollaboratorJoin(
|
|
48
|
+
effectivePostId,
|
|
49
|
+
effectivePostType,
|
|
50
|
+
useCallback(
|
|
51
|
+
(collaborator, me) => {
|
|
75
52
|
if (me && collaborator.collaboratorInfo.enteredAt < me.collaboratorInfo.enteredAt) {
|
|
76
|
-
|
|
53
|
+
return;
|
|
77
54
|
}
|
|
78
|
-
|
|
79
|
-
|
|
55
|
+
void createNotice(
|
|
56
|
+
"info",
|
|
80
57
|
sprintf(
|
|
81
58
|
/* translators: %s: collaborator display name */
|
|
82
59
|
__("%s has joined the post."),
|
|
83
60
|
collaborator.collaboratorInfo.name
|
|
84
|
-
)
|
|
61
|
+
),
|
|
62
|
+
{
|
|
63
|
+
id: `${NOTIFICATION_TYPE.COLLAB_USER_ENTERED}-${collaborator.collaboratorInfo.id}`,
|
|
64
|
+
type: "snackbar",
|
|
65
|
+
isDismissible: false
|
|
66
|
+
}
|
|
85
67
|
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
notify(
|
|
98
|
-
`${NOTIFICATION_TYPE.COLLAB_USER_EXITED}-${prevCollab.collaboratorInfo.id}`,
|
|
68
|
+
},
|
|
69
|
+
[createNotice]
|
|
70
|
+
)
|
|
71
|
+
);
|
|
72
|
+
useOnCollaboratorLeave(
|
|
73
|
+
effectivePostId,
|
|
74
|
+
effectivePostType,
|
|
75
|
+
useCallback(
|
|
76
|
+
(collaborator) => {
|
|
77
|
+
void createNotice(
|
|
78
|
+
"info",
|
|
99
79
|
sprintf(
|
|
100
80
|
/* translators: %s: collaborator display name */
|
|
101
81
|
__("%s has left the post."),
|
|
102
|
-
|
|
103
|
-
)
|
|
82
|
+
collaborator.collaboratorInfo.name
|
|
83
|
+
),
|
|
84
|
+
{
|
|
85
|
+
id: `${NOTIFICATION_TYPE.COLLAB_USER_EXITED}-${collaborator.collaboratorInfo.id}`,
|
|
86
|
+
type: "snackbar",
|
|
87
|
+
isDismissible: false
|
|
88
|
+
}
|
|
104
89
|
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
void createNotice("info", message, {
|
|
135
|
-
id: `${NOTIFICATION_TYPE.COLLAB_POST_UPDATED}-${saver.collaboratorInfo.id}`,
|
|
136
|
-
type: "snackbar",
|
|
137
|
-
isDismissible: false
|
|
138
|
-
});
|
|
139
|
-
}, [
|
|
140
|
-
lastPostSave,
|
|
141
|
-
prevPostSave,
|
|
142
|
-
activeCollaborators,
|
|
143
|
-
isCollaborationEnabled,
|
|
144
|
-
postStatus,
|
|
145
|
-
createNotice
|
|
146
|
-
]);
|
|
90
|
+
},
|
|
91
|
+
[createNotice]
|
|
92
|
+
)
|
|
93
|
+
);
|
|
94
|
+
useOnPostSave(
|
|
95
|
+
effectivePostId,
|
|
96
|
+
effectivePostType,
|
|
97
|
+
useCallback(
|
|
98
|
+
(saveEvent, saver, prevEvent) => {
|
|
99
|
+
if (!postStatus) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const effectiveStatus = saveEvent.postStatus ?? postStatus ?? "draft";
|
|
103
|
+
const prevStatus = prevEvent?.postStatus ?? postStatus;
|
|
104
|
+
const isFirstPublish = !(prevStatus && PUBLISHED_STATUSES.includes(prevStatus)) && PUBLISHED_STATUSES.includes(effectiveStatus);
|
|
105
|
+
const message = getPostUpdatedMessage(
|
|
106
|
+
saver.collaboratorInfo.name,
|
|
107
|
+
effectiveStatus,
|
|
108
|
+
isFirstPublish
|
|
109
|
+
);
|
|
110
|
+
void createNotice("info", message, {
|
|
111
|
+
id: `${NOTIFICATION_TYPE.COLLAB_POST_UPDATED}-${saver.collaboratorInfo.id}`,
|
|
112
|
+
type: "snackbar",
|
|
113
|
+
isDismissible: false
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
[createNotice, postStatus]
|
|
117
|
+
)
|
|
118
|
+
);
|
|
147
119
|
}
|
|
148
120
|
export {
|
|
149
121
|
useCollaboratorNotifications
|
package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/collaborators-presence/use-collaborator-notifications.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {
|
|
5
|
-
"mappings": ";AAGA,SAAS,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useCallback } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport {\n\tprivateApis,\n\ttype PostEditorAwarenessState,\n\ttype PostSaveEvent,\n} from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst { useOnCollaboratorJoin, useOnCollaboratorLeave, useOnPostSave } =\n\tunlock( privateApis );\n\n/**\n * Notice IDs for each notification type. Using stable IDs prevents duplicate\n * notices if the same event is processed more than once.\n */\nconst NOTIFICATION_TYPE = {\n\tCOLLAB_POST_UPDATED: 'collab-post-updated',\n\tCOLLAB_USER_ENTERED: 'collab-user-entered',\n\tCOLLAB_USER_EXITED: 'collab-user-exited',\n} as const;\n\nconst PUBLISHED_STATUSES = [ 'publish', 'private', 'future' ];\n\n/**\n * Returns the snackbar message for a post updated notification.\n *\n * @param name Display name of the collaborator who saved.\n * @param status WordPress post status at the time of save.\n * @param isFirstPublish Whether this save transitioned the post to published.\n */\nfunction getPostUpdatedMessage(\n\tname: string,\n\tstatus: string,\n\tisFirstPublish: boolean\n): string {\n\tif ( isFirstPublish ) {\n\t\t/* translators: %s: collaborator display name */\n\t\treturn sprintf( __( 'Post published by %s.' ), name );\n\t}\n\tif ( PUBLISHED_STATUSES.includes( status ) ) {\n\t\t/* translators: %s: collaborator display name */\n\t\treturn sprintf( __( 'Post updated by %s.' ), name );\n\t}\n\t/* translators: %s: collaborator display name */\n\treturn sprintf( __( 'Draft saved by %s.' ), name );\n}\n\n/**\n * Hook that watches for collaborator join/leave events and remote save events,\n * dispatching snackbar notices accordingly.\n *\n * @param postId The ID of the post being edited.\n * @param postType The post type of the post being edited.\n */\nexport function useCollaboratorNotifications(\n\tpostId: number | null,\n\tpostType: string | null\n): void {\n\tconst { postStatus, isCollaborationEnabled, showNotifications } = useSelect(\n\t\t( select ) => {\n\t\t\tconst editorSel = select( editorStore );\n\t\t\treturn {\n\t\t\t\tpostStatus: editorSel.getCurrentPostAttribute( 'status' ) as\n\t\t\t\t\t| string\n\t\t\t\t\t| undefined,\n\t\t\t\tisCollaborationEnabled:\n\t\t\t\t\teditorSel.isCollaborationEnabledForCurrentPost(),\n\t\t\t\tshowNotifications:\n\t\t\t\t\tselect( preferencesStore ).get(\n\t\t\t\t\t\t'core',\n\t\t\t\t\t\t'showCollaborationNotifications'\n\t\t\t\t\t) ?? true,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { createNotice } = useDispatch( noticesStore );\n\n\t// Pass null when collaboration is disabled or notifications are\n\t// turned off to prevent the hooks from subscribing to awareness state.\n\tconst shouldSubscribe = isCollaborationEnabled && showNotifications;\n\tconst effectivePostId = shouldSubscribe ? postId : null;\n\tconst effectivePostType = shouldSubscribe ? postType : null;\n\n\tuseOnCollaboratorJoin(\n\t\teffectivePostId,\n\t\teffectivePostType,\n\t\tuseCallback(\n\t\t\t(\n\t\t\t\tcollaborator: PostEditorAwarenessState,\n\t\t\t\tme?: PostEditorAwarenessState\n\t\t\t) => {\n\t\t\t\t/*\n\t\t\t\t * Skip collaborators who were present before the current user\n\t\t\t\t * joined. Their enteredAt is earlier than ours, meaning we're\n\t\t\t\t * the newcomer.\n\t\t\t\t */\n\t\t\t\tif (\n\t\t\t\t\tme &&\n\t\t\t\t\tcollaborator.collaboratorInfo.enteredAt <\n\t\t\t\t\t\tme.collaboratorInfo.enteredAt\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvoid createNotice(\n\t\t\t\t\t'info',\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t/* translators: %s: collaborator display name */\n\t\t\t\t\t\t__( '%s has joined the post.' ),\n\t\t\t\t\t\tcollaborator.collaboratorInfo.name\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: `${ NOTIFICATION_TYPE.COLLAB_USER_ENTERED }-${ collaborator.collaboratorInfo.id }`,\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tisDismissible: false,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t},\n\t\t\t[ createNotice ]\n\t\t)\n\t);\n\n\tuseOnCollaboratorLeave(\n\t\teffectivePostId,\n\t\teffectivePostType,\n\t\tuseCallback(\n\t\t\t( collaborator: PostEditorAwarenessState ) => {\n\t\t\t\tvoid createNotice(\n\t\t\t\t\t'info',\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t/* translators: %s: collaborator display name */\n\t\t\t\t\t\t__( '%s has left the post.' ),\n\t\t\t\t\t\tcollaborator.collaboratorInfo.name\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: `${ NOTIFICATION_TYPE.COLLAB_USER_EXITED }-${ collaborator.collaboratorInfo.id }`,\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tisDismissible: false,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t},\n\t\t\t[ createNotice ]\n\t\t)\n\t);\n\n\tuseOnPostSave(\n\t\teffectivePostId,\n\t\teffectivePostType,\n\t\tuseCallback(\n\t\t\t(\n\t\t\t\tsaveEvent: PostSaveEvent,\n\t\t\t\tsaver: PostEditorAwarenessState,\n\t\t\t\tprevEvent: PostSaveEvent | null\n\t\t\t) => {\n\t\t\t\tif ( ! postStatus ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Prefer the remote status from Y.Doc (accurate at save time)\n\t\t\t\t// over the local Redux value, which may not have synced yet.\n\t\t\t\tconst effectiveStatus =\n\t\t\t\t\tsaveEvent.postStatus ?? postStatus ?? 'draft';\n\n\t\t\t\t// Use the previous save event's status when available for\n\t\t\t\t// accurate first-publish detection across rapid saves.\n\t\t\t\tconst prevStatus = prevEvent?.postStatus ?? postStatus;\n\t\t\t\tconst isFirstPublish =\n\t\t\t\t\t! (\n\t\t\t\t\t\tprevStatus && PUBLISHED_STATUSES.includes( prevStatus )\n\t\t\t\t\t) && PUBLISHED_STATUSES.includes( effectiveStatus );\n\n\t\t\t\tconst message = getPostUpdatedMessage(\n\t\t\t\t\tsaver.collaboratorInfo.name,\n\t\t\t\t\teffectiveStatus,\n\t\t\t\t\tisFirstPublish\n\t\t\t\t);\n\n\t\t\t\tvoid createNotice( 'info', message, {\n\t\t\t\t\tid: `${ NOTIFICATION_TYPE.COLLAB_POST_UPDATED }-${ saver.collaboratorInfo.id }`,\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tisDismissible: false,\n\t\t\t\t} );\n\t\t\t},\n\t\t\t[ createNotice, postStatus ]\n\t\t)\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,aAAa,iBAAiB;AACvC,SAAS,mBAAmB;AAC5B,SAAS,IAAI,eAAe;AAC5B,SAAS,SAAS,oBAAoB;AACtC;AAAA,EACC;AAAA,OAGM;AACP,SAAS,SAAS,wBAAwB;AAK1C,SAAS,cAAc;AACvB,SAAS,SAAS,mBAAmB;AAErC,IAAM,EAAE,uBAAuB,wBAAwB,cAAc,IACpE,OAAQ,WAAY;AAMrB,IAAM,oBAAoB;AAAA,EACzB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,oBAAoB;AACrB;AAEA,IAAM,qBAAqB,CAAE,WAAW,WAAW,QAAS;AAS5D,SAAS,sBACR,MACA,QACA,gBACS;AACT,MAAK,gBAAiB;AAErB,WAAO,QAAS,GAAI,uBAAwB,GAAG,IAAK;AAAA,EACrD;AACA,MAAK,mBAAmB,SAAU,MAAO,GAAI;AAE5C,WAAO,QAAS,GAAI,qBAAsB,GAAG,IAAK;AAAA,EACnD;AAEA,SAAO,QAAS,GAAI,oBAAqB,GAAG,IAAK;AAClD;AASO,SAAS,6BACf,QACA,UACO;AACP,QAAM,EAA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AAAA,EACD;AAEA;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,MACC,CACC,WACA,OACA,cACI;AACJ,YAAK,CAAE,YAAa;AACnB;AAAA,QACD;AAIA,cAAM,kBACL,UAAU,cAAc,cAAc;AAIvC,cAAM,aAAa,WAAW,cAAc;AAC5C,cAAM,iBACL,EACC,cAAc,mBAAmB,SAAU,UAAW,MAClD,mBAAmB,SAAU,eAAgB;AAEnD,cAAM,UAAU;AAAA,UACf,MAAM,iBAAiB;AAAA,UACvB;AAAA,UACA;AAAA,QACD;AAEA,aAAK,aAAc,QAAQ,SAAS;AAAA,UACnC,IAAI,GAAI,kBAAkB,mBAAoB,IAAK,MAAM,iBAAiB,EAAG;AAAA,UAC7E,MAAM;AAAA,UACN,eAAe;AAAA,QAChB,CAAE;AAAA,MACH;AAAA,MACA,CAAE,cAAc,UAAW;AAAA,IAC5B;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// packages/editor/src/components/editor-interface/index.js
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import { InterfaceSkeleton, ComplementaryArea } from "@wordpress/interface";
|
|
4
|
-
import { useSelect } from "@wordpress/data";
|
|
4
|
+
import { useSelect, useDispatch } from "@wordpress/data";
|
|
5
5
|
import { __ } from "@wordpress/i18n";
|
|
6
6
|
import { store as preferencesStore } from "@wordpress/preferences";
|
|
7
7
|
import { BlockBreadcrumb, BlockToolbar } from "@wordpress/block-editor";
|
|
@@ -69,7 +69,8 @@ function EditorInterface({
|
|
|
69
69
|
postTypeLabel,
|
|
70
70
|
stylesPath,
|
|
71
71
|
showStylebook,
|
|
72
|
-
isRevisionsMode
|
|
72
|
+
isRevisionsMode,
|
|
73
|
+
showDiff
|
|
73
74
|
} = useSelect((select) => {
|
|
74
75
|
const { get } = select(preferencesStore);
|
|
75
76
|
const {
|
|
@@ -81,7 +82,8 @@ function EditorInterface({
|
|
|
81
82
|
const {
|
|
82
83
|
getStylesPath,
|
|
83
84
|
getShowStylebook,
|
|
84
|
-
isRevisionsMode: _isRevisionsMode
|
|
85
|
+
isRevisionsMode: _isRevisionsMode,
|
|
86
|
+
isShowingRevisionDiff
|
|
85
87
|
} = unlock(select(editorStore));
|
|
86
88
|
const editorSettings = getEditorSettings();
|
|
87
89
|
let _mode = select(editorStore).getEditorMode();
|
|
@@ -104,9 +106,11 @@ function EditorInterface({
|
|
|
104
106
|
stylesPath: getStylesPath(),
|
|
105
107
|
showStylebook: getShowStylebook(),
|
|
106
108
|
isAttachment: getCurrentPostType() === "attachment" && window?.__experimentalMediaEditor,
|
|
107
|
-
isRevisionsMode: _isRevisionsMode()
|
|
109
|
+
isRevisionsMode: _isRevisionsMode(),
|
|
110
|
+
showDiff: isShowingRevisionDiff()
|
|
108
111
|
};
|
|
109
112
|
}, []);
|
|
113
|
+
const { setShowRevisionDiff } = unlock(useDispatch(editorStore));
|
|
110
114
|
useCollaboratorNotifications(postId, postType);
|
|
111
115
|
const isLargeViewport = useViewportMatch("medium");
|
|
112
116
|
const secondarySidebarLabel = isListViewOpened ? __("Document Overview") : __("Block Library");
|
|
@@ -123,7 +127,6 @@ function EditorInterface({
|
|
|
123
127
|
},
|
|
124
128
|
[entitiesSavedStatesCallback]
|
|
125
129
|
);
|
|
126
|
-
const [showDiff, setShowDiff] = useState(true);
|
|
127
130
|
if (isRevisionsMode) {
|
|
128
131
|
return /* @__PURE__ */ jsx(
|
|
129
132
|
InterfaceSkeleton,
|
|
@@ -134,10 +137,10 @@ function EditorInterface({
|
|
|
134
137
|
RevisionsHeader,
|
|
135
138
|
{
|
|
136
139
|
showDiff,
|
|
137
|
-
onToggleDiff: () =>
|
|
140
|
+
onToggleDiff: () => setShowRevisionDiff(!showDiff)
|
|
138
141
|
}
|
|
139
142
|
),
|
|
140
|
-
content: /* @__PURE__ */ jsx(RevisionsCanvas, {
|
|
143
|
+
content: /* @__PURE__ */ jsx(RevisionsCanvas, {}),
|
|
141
144
|
sidebar: /* @__PURE__ */ jsx(ComplementaryArea.Slot, { scope: "core" })
|
|
142
145
|
}
|
|
143
146
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/editor-interface/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { InterfaceSkeleton, ComplementaryArea } from '@wordpress/interface';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { BlockBreadcrumb, BlockToolbar } from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useState, useCallback } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { InlineNotices } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport TemplateValidationNotice from '../template-validation-notice';\nimport Header from '../header';\nimport InserterSidebar from '../inserter-sidebar';\nimport ListViewSidebar from '../list-view-sidebar';\nimport { RevisionsHeader, RevisionsCanvas } from '../post-revisions-preview';\nimport { CollaboratorsOverlay } from '../collaborators-overlay';\nimport { useCollaboratorNotifications } from '../collaborators-presence/use-collaborator-notifications';\nimport SavePublishPanels from '../save-publish-panels';\nimport TextEditor from '../text-editor';\nimport VisualEditor from '../visual-editor';\nimport StylesCanvas from '../styles-canvas';\nimport { MediaPreview } from '../media';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor top bar landmark region. */\n\theader: __( 'Editor top bar' ),\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\nconst Notices = () => (\n\t<InlineNotices\n\t\tpinnedNoticesClassName=\"editor-notices__pinned\"\n\t\tdismissibleNoticesClassName=\"editor-notices__dismissible\"\n\t>\n\t\t<TemplateValidationNotice />\n\t</InlineNotices>\n);\n\nexport default function EditorInterface( {\n\tclassName,\n\tchildren,\n\tforceIsDirty,\n\tcontentRef,\n\tdisableIframe,\n\tautoFocus,\n\tcustomSaveButton,\n\tcustomSavePanel,\n\tforceDisableBlockTools,\n\tiframeProps,\n} ) {\n\tconst {\n\t\tmode,\n\t\tpostId,\n\t\tpostType,\n\t\tisAttachment,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t\tisDistractionFree,\n\t\tisPreviewMode,\n\t\tshowBlockBreadcrumbs,\n\t\tpostTypeLabel,\n\t\tstylesPath,\n\t\tshowStylebook,\n\t\tisRevisionsMode,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst {\n\t\t\tgetEditorSettings,\n\t\t\tgetPostTypeLabel,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t} = select( editorStore );\n\t\tconst {\n\t\t\tgetStylesPath,\n\t\t\tgetShowStylebook,\n\t\t\tisRevisionsMode: _isRevisionsMode,\n\t\t} = unlock( select( editorStore ) );\n\t\tconst editorSettings = getEditorSettings();\n\n\t\tlet _mode = select( editorStore ).getEditorMode();\n\t\tif ( ! editorSettings.richEditingEnabled && _mode === 'visual' ) {\n\t\t\t_mode = 'text';\n\t\t}\n\t\tif ( ! editorSettings.codeEditingEnabled && _mode === 'text' ) {\n\t\t\t_mode = 'visual';\n\t\t}\n\n\t\treturn {\n\t\t\tmode: _mode,\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tisInserterOpened: select( editorStore ).isInserterOpened(),\n\t\t\tisListViewOpened: select( editorStore ).isListViewOpened(),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tisPreviewMode: editorSettings.isPreviewMode,\n\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\tpostTypeLabel: getPostTypeLabel(),\n\t\t\tstylesPath: getStylesPath(),\n\t\t\tshowStylebook: getShowStylebook(),\n\t\t\tisAttachment:\n\t\t\t\tgetCurrentPostType() === 'attachment' &&\n\t\t\t\twindow?.__experimentalMediaEditor,\n\t\t\tisRevisionsMode: _isRevisionsMode(),\n\t\t};\n\t}, [] );\n\t// Runs unconditionally so join/leave/save notifications are dispatched\n\t// regardless of viewport width or whether the header centre area is visible.\n\tuseCollaboratorNotifications( postId, postType );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst secondarySidebarLabel = isListViewOpened\n\t\t? __( 'Document Overview' )\n\t\t: __( 'Block Library' );\n\tconst shouldShowMediaEditor = !! isAttachment;\n\tconst shouldShowStylesCanvas =\n\t\t! isAttachment &&\n\t\t( showStylebook || stylesPath?.startsWith( '/revisions' ) );\n\tconst shouldShowBlockEditor =\n\t\t! shouldShowMediaEditor && ! shouldShowStylesCanvas;\n\n\t// Local state for save panel.\n\t// Note 'truthy' callback implies an open panel.\n\tconst [ entitiesSavedStatesCallback, setEntitiesSavedStatesCallback ] =\n\t\tuseState( false );\n\tconst closeEntitiesSavedStates = useCallback(\n\t\t( arg ) => {\n\t\t\tif ( typeof entitiesSavedStatesCallback === 'function' ) {\n\t\t\t\tentitiesSavedStatesCallback( arg );\n\t\t\t}\n\t\t\tsetEntitiesSavedStatesCallback( false );\n\t\t},\n\t\t[ entitiesSavedStatesCallback ]\n\t);\n\n\t//
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,mBAAmB,yBAAyB;AACrD,SAAS,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { InterfaceSkeleton, ComplementaryArea } from '@wordpress/interface';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { BlockBreadcrumb, BlockToolbar } from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useState, useCallback } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { InlineNotices } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport TemplateValidationNotice from '../template-validation-notice';\nimport Header from '../header';\nimport InserterSidebar from '../inserter-sidebar';\nimport ListViewSidebar from '../list-view-sidebar';\nimport { RevisionsHeader, RevisionsCanvas } from '../post-revisions-preview';\nimport { CollaboratorsOverlay } from '../collaborators-overlay';\nimport { useCollaboratorNotifications } from '../collaborators-presence/use-collaborator-notifications';\nimport SavePublishPanels from '../save-publish-panels';\nimport TextEditor from '../text-editor';\nimport VisualEditor from '../visual-editor';\nimport StylesCanvas from '../styles-canvas';\nimport { MediaPreview } from '../media';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor top bar landmark region. */\n\theader: __( 'Editor top bar' ),\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\nconst Notices = () => (\n\t<InlineNotices\n\t\tpinnedNoticesClassName=\"editor-notices__pinned\"\n\t\tdismissibleNoticesClassName=\"editor-notices__dismissible\"\n\t>\n\t\t<TemplateValidationNotice />\n\t</InlineNotices>\n);\n\nexport default function EditorInterface( {\n\tclassName,\n\tchildren,\n\tforceIsDirty,\n\tcontentRef,\n\tdisableIframe,\n\tautoFocus,\n\tcustomSaveButton,\n\tcustomSavePanel,\n\tforceDisableBlockTools,\n\tiframeProps,\n} ) {\n\tconst {\n\t\tmode,\n\t\tpostId,\n\t\tpostType,\n\t\tisAttachment,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t\tisDistractionFree,\n\t\tisPreviewMode,\n\t\tshowBlockBreadcrumbs,\n\t\tpostTypeLabel,\n\t\tstylesPath,\n\t\tshowStylebook,\n\t\tisRevisionsMode,\n\t\tshowDiff,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst {\n\t\t\tgetEditorSettings,\n\t\t\tgetPostTypeLabel,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t} = select( editorStore );\n\t\tconst {\n\t\t\tgetStylesPath,\n\t\t\tgetShowStylebook,\n\t\t\tisRevisionsMode: _isRevisionsMode,\n\t\t\tisShowingRevisionDiff,\n\t\t} = unlock( select( editorStore ) );\n\t\tconst editorSettings = getEditorSettings();\n\n\t\tlet _mode = select( editorStore ).getEditorMode();\n\t\tif ( ! editorSettings.richEditingEnabled && _mode === 'visual' ) {\n\t\t\t_mode = 'text';\n\t\t}\n\t\tif ( ! editorSettings.codeEditingEnabled && _mode === 'text' ) {\n\t\t\t_mode = 'visual';\n\t\t}\n\n\t\treturn {\n\t\t\tmode: _mode,\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tisInserterOpened: select( editorStore ).isInserterOpened(),\n\t\t\tisListViewOpened: select( editorStore ).isListViewOpened(),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tisPreviewMode: editorSettings.isPreviewMode,\n\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\tpostTypeLabel: getPostTypeLabel(),\n\t\t\tstylesPath: getStylesPath(),\n\t\t\tshowStylebook: getShowStylebook(),\n\t\t\tisAttachment:\n\t\t\t\tgetCurrentPostType() === 'attachment' &&\n\t\t\t\twindow?.__experimentalMediaEditor,\n\t\t\tisRevisionsMode: _isRevisionsMode(),\n\t\t\tshowDiff: isShowingRevisionDiff(),\n\t\t};\n\t}, [] );\n\tconst { setShowRevisionDiff } = unlock( useDispatch( editorStore ) );\n\n\t// Runs unconditionally so join/leave/save notifications are dispatched\n\t// regardless of viewport width or whether the header centre area is visible.\n\tuseCollaboratorNotifications( postId, postType );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst secondarySidebarLabel = isListViewOpened\n\t\t? __( 'Document Overview' )\n\t\t: __( 'Block Library' );\n\tconst shouldShowMediaEditor = !! isAttachment;\n\tconst shouldShowStylesCanvas =\n\t\t! isAttachment &&\n\t\t( showStylebook || stylesPath?.startsWith( '/revisions' ) );\n\tconst shouldShowBlockEditor =\n\t\t! shouldShowMediaEditor && ! shouldShowStylesCanvas;\n\n\t// Local state for save panel.\n\t// Note 'truthy' callback implies an open panel.\n\tconst [ entitiesSavedStatesCallback, setEntitiesSavedStatesCallback ] =\n\t\tuseState( false );\n\tconst closeEntitiesSavedStates = useCallback(\n\t\t( arg ) => {\n\t\t\tif ( typeof entitiesSavedStatesCallback === 'function' ) {\n\t\t\t\tentitiesSavedStatesCallback( arg );\n\t\t\t}\n\t\t\tsetEntitiesSavedStatesCallback( false );\n\t\t},\n\t\t[ entitiesSavedStatesCallback ]\n\t);\n\n\t// When in revisions mode, render the revisions interface.\n\tif ( isRevisionsMode ) {\n\t\treturn (\n\t\t\t<InterfaceSkeleton\n\t\t\t\tclassName={ clsx( 'editor-editor-interface', className ) }\n\t\t\t\tlabels={ interfaceLabels }\n\t\t\t\theader={\n\t\t\t\t\t<RevisionsHeader\n\t\t\t\t\t\tshowDiff={ showDiff }\n\t\t\t\t\t\tonToggleDiff={ () => setShowRevisionDiff( ! showDiff ) }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tcontent={ <RevisionsCanvas /> }\n\t\t\t\tsidebar={ <ComplementaryArea.Slot scope=\"core\" /> }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<InterfaceSkeleton\n\t\t\tisDistractionFree={ isDistractionFree }\n\t\t\tclassName={ clsx( 'editor-editor-interface', className, {\n\t\t\t\t'is-entity-save-view-open': !! entitiesSavedStatesCallback,\n\t\t\t\t'is-distraction-free': isDistractionFree && ! isPreviewMode,\n\t\t\t} ) }\n\t\t\tlabels={ {\n\t\t\t\t...interfaceLabels,\n\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t} }\n\t\t\theader={\n\t\t\t\t! isPreviewMode && (\n\t\t\t\t\t<Header\n\t\t\t\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcustomSaveButton={ customSaveButton }\n\t\t\t\t\t\tforceDisableBlockTools={ forceDisableBlockTools }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\teditorNotices={ <Notices /> }\n\t\t\tsecondarySidebar={\n\t\t\t\t! isAttachment &&\n\t\t\t\t! isPreviewMode &&\n\t\t\t\tmode === 'visual' &&\n\t\t\t\t( ( isInserterOpened && <InserterSidebar /> ) ||\n\t\t\t\t\t( isListViewOpened && <ListViewSidebar /> ) )\n\t\t\t}\n\t\t\tsidebar={\n\t\t\t\t! isPreviewMode &&\n\t\t\t\t! isDistractionFree && <ComplementaryArea.Slot scope=\"core\" />\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ ! isDistractionFree && ! isPreviewMode && <Notices /> }\n\t\t\t\t\t{ shouldShowMediaEditor && (\n\t\t\t\t\t\t<MediaPreview { ...iframeProps } />\n\t\t\t\t\t) }\n\t\t\t\t\t{ shouldShowStylesCanvas && <StylesCanvas /> }\n\t\t\t\t\t{ shouldShowBlockEditor && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isPreviewMode && mode === 'text' && (\n\t\t\t\t\t\t\t\t<TextEditor\n\t\t\t\t\t\t\t\t\t// We should auto-focus the canvas (title) on load.\n\t\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\t\t\t\t\t\tautoFocus={ autoFocus }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ ! isPreviewMode &&\n\t\t\t\t\t\t\t\t! isLargeViewport &&\n\t\t\t\t\t\t\t\tmode === 'visual' && (\n\t\t\t\t\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ ( isPreviewMode || mode === 'visual' ) && (\n\t\t\t\t\t\t\t\t<VisualEditor\n\t\t\t\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\t\t\t\tdisableIframe={ disableIframe }\n\t\t\t\t\t\t\t\t\t// We should auto-focus the canvas (title) on load.\n\t\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\t\t\t\t\t\tautoFocus={ autoFocus }\n\t\t\t\t\t\t\t\t\tiframeProps={ iframeProps }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t<CollaboratorsOverlay\n\t\t\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\t\t\tpostType={ postType }\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</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\t! isPreviewMode &&\n\t\t\t\t! isDistractionFree &&\n\t\t\t\tisLargeViewport &&\n\t\t\t\tshowBlockBreadcrumbs &&\n\t\t\t\tmode === 'visual' && (\n\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\trootLabelText={\n\t\t\t\t\t\t\tpostTypeLabel\n\t\t\t\t\t\t\t\t? decodeEntities( postTypeLabel )\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\tactions={\n\t\t\t\t! isPreviewMode\n\t\t\t\t\t? customSavePanel || (\n\t\t\t\t\t\t\t<SavePublishPanels\n\t\t\t\t\t\t\t\tcloseEntitiesSavedStates={\n\t\t\t\t\t\t\t\t\tcloseEntitiesSavedStates\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisEntitiesSavedStatesOpen={\n\t\t\t\t\t\t\t\t\tentitiesSavedStatesCallback\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tforceIsDirtyPublishPanel={ forceIsDirty }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,mBAAmB,yBAAyB;AACrD,SAAS,WAAW,mBAAmB;AACvC,SAAS,UAAU;AACnB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,wBAAwB;AACjC,SAAS,UAAU,mBAAmB;AACtC,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AAK9B,SAAS,SAAS,mBAAmB;AACrC,SAAS,cAAc;AACvB,OAAO,8BAA8B;AACrC,OAAO,YAAY;AACnB,OAAO,qBAAqB;AAC5B,OAAO,qBAAqB;AAC5B,SAAS,iBAAiB,uBAAuB;AACjD,SAAS,4BAA4B;AACrC,SAAS,oCAAoC;AAC7C,OAAO,uBAAuB;AAC9B,OAAO,gBAAgB;AACvB,OAAO,kBAAkB;AACzB,OAAO,kBAAkB;AACzB,SAAS,oBAAoB;AAoB3B,SAsKI,UAtKJ,KAsKI,YAtKJ;AAlBF,IAAM,kBAAkB;AAAA;AAAA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UACA,eACC,gBACG,eAAgB,aAAc,IAC9B;AAAA;AAAA,MAEL;AAAA,MAGF,SACC,CAAE,gBACC,mBACA;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UAGA,2BACC;AAAA,UAED;AAAA,UAGA,0BAA2B;AAAA;AAAA,MAC5B,IAEA;AAAA;AAAA,EAEL;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -69,7 +69,8 @@ function InserterSidebar() {
|
|
|
69
69
|
showMostUsedBlocks,
|
|
70
70
|
showInserterHelpPanel: true,
|
|
71
71
|
shouldFocusBlock: isMobileViewport,
|
|
72
|
-
rootClientId: blockSectionRootClientId,
|
|
72
|
+
rootClientId: blockSectionRootClientId ?? inserter.rootClientId,
|
|
73
|
+
__experimentalInsertionIndex: inserter.insertionIndex,
|
|
73
74
|
onSelect: inserter.onSelect,
|
|
74
75
|
__experimentalInitialTab: inserter.tab,
|
|
75
76
|
__experimentalInitialCategory: inserter.category,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/inserter-sidebar/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst { PrivateInserterLibrary } = unlock( blockEditorPrivateApis );\n\nexport default function InserterSidebar() {\n\tconst {\n\t\tblockSectionRootClientId,\n\t\tinserterSidebarToggleRef,\n\t\tinserter,\n\t\tshowMostUsedBlocks,\n\t\tsidebarIsOpened,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetInserterSidebarToggleRef,\n\t\t\tgetInserter,\n\t\t\tisPublishSidebarOpened,\n\t\t} = unlock( select( editorStore ) );\n\t\tconst { getBlockRootClientId, isZoomOut, getSectionRootClientId } =\n\t\t\tunlock( select( blockEditorStore ) );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\t\tconst getBlockSectionRootClientId = () => {\n\t\t\tif ( isZoomOut() ) {\n\t\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\n\t\t\t\tif ( sectionRootClientId ) {\n\t\t\t\t\treturn sectionRootClientId;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn getBlockRootClientId();\n\t\t};\n\t\treturn {\n\t\t\tinserterSidebarToggleRef: getInserterSidebarToggleRef(),\n\t\t\tinserter: getInserter(),\n\t\t\tshowMostUsedBlocks: get( 'core', 'mostUsedBlocks' ),\n\t\t\tblockSectionRootClientId: getBlockSectionRootClientId(),\n\t\t\tsidebarIsOpened: !! (\n\t\t\t\tgetActiveComplementaryArea( 'core' ) || isPublishSidebarOpened()\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened } = useDispatch( editorStore );\n\tconst { disableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst libraryRef = useRef();\n\n\t// When closing the inserter, focus should return to the toggle button.\n\tconst closeInserterSidebar = useCallback( () => {\n\t\tsetIsInserterOpened( false );\n\t\tinserterSidebarToggleRef.current?.focus();\n\t}, [ inserterSidebarToggleRef, setIsInserterOpened ] );\n\n\tconst closeOnEscape = useCallback(\n\t\t( event ) => {\n\t\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tcloseInserterSidebar();\n\t\t\t}\n\t\t},\n\t\t[ closeInserterSidebar ]\n\t);\n\n\tconst inserterContents = (\n\t\t<div className=\"editor-inserter-sidebar__content\">\n\t\t\t<PrivateInserterLibrary\n\t\t\t\tshowMostUsedBlocks={ showMostUsedBlocks }\n\t\t\t\tshowInserterHelpPanel\n\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\trootClientId={
|
|
5
|
-
"mappings": ";AAGA,SAAS,aAAa,iBAAiB;AACvC;AAAA,EACC,SAAS;AAAA,EACT,eAAe;AAAA,OACT;AACP,SAAS,wBAAwB;AACjC,SAAS,aAAa,cAAc;AACpC,SAAS,SAAS,wBAAwB;AAC1C,SAAS,cAAc;AACvB,SAAS,SAAS,sBAAsB;AAKxC,SAAS,cAAc;AACvB,SAAS,SAAS,mBAAmB;AAiElC;AA/DH,IAAM,EAAE,uBAAuB,IAAI,OAAQ,sBAAuB;AAEnD,SAAR,kBAAmC;AACzC,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI,UAAW,CAAE,WAAY;AAC5B,UAAM;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACD,IAAI,OAAQ,OAAQ,WAAY,CAAE;AAClC,UAAM,EAAE,sBAAsB,WAAW,uBAAuB,IAC/D,OAAQ,OAAQ,gBAAiB,CAAE;AACpC,UAAM,EAAE,IAAI,IAAI,OAAQ,gBAAiB;AACzC,UAAM,EAAE,2BAA2B,IAAI,OAAQ,cAAe;AAC9D,UAAM,8BAA8B,MAAM;AACzC,UAAK,UAAU,GAAI;AAClB,cAAM,sBAAsB,uBAAuB;AAEnD,YAAK,qBAAsB;AAC1B,iBAAO;AAAA,QACR;AAAA,MACD;AACA,aAAO,qBAAqB;AAAA,IAC7B;AACA,WAAO;AAAA,MACN,0BAA0B,4BAA4B;AAAA,MACtD,UAAU,YAAY;AAAA,MACtB,oBAAoB,IAAK,QAAQ,gBAAiB;AAAA,MAClD,0BAA0B,4BAA4B;AAAA,MACtD,iBAAiB,CAAC,EACjB,2BAA4B,MAAO,KAAK,uBAAuB;AAAA,IAEjE;AAAA,EACD,GAAG,CAAC,CAAE;AACN,QAAM,EAAE,oBAAoB,IAAI,YAAa,WAAY;AACzD,QAAM,EAAE,yBAAyB,IAAI,YAAa,cAAe;AAEjE,QAAM,mBAAmB,iBAAkB,UAAU,GAAI;AACzD,QAAM,aAAa,OAAO;AAG1B,QAAM,uBAAuB,YAAa,MAAM;AAC/C,wBAAqB,KAAM;AAC3B,6BAAyB,SAAS,MAAM;AAAA,EACzC,GAAG,CAAE,0BAA0B,mBAAoB,CAAE;AAErD,QAAM,gBAAgB;AAAA,IACrB,CAAE,UAAW;AACZ,UAAK,MAAM,YAAY,UAAU,CAAE,MAAM,kBAAmB;AAC3D,cAAM,eAAe;AACrB,6BAAqB;AAAA,MACtB;AAAA,IACD;AAAA,IACA,CAAE,oBAAqB;AAAA,EACxB;AAEA,QAAM,mBACL,oBAAC,SAAI,WAAU,oCACd;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,uBAAqB;AAAA,MACrB,kBAAmB;AAAA,MACnB,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst { PrivateInserterLibrary } = unlock( blockEditorPrivateApis );\n\nexport default function InserterSidebar() {\n\tconst {\n\t\tblockSectionRootClientId,\n\t\tinserterSidebarToggleRef,\n\t\tinserter,\n\t\tshowMostUsedBlocks,\n\t\tsidebarIsOpened,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetInserterSidebarToggleRef,\n\t\t\tgetInserter,\n\t\t\tisPublishSidebarOpened,\n\t\t} = unlock( select( editorStore ) );\n\t\tconst { getBlockRootClientId, isZoomOut, getSectionRootClientId } =\n\t\t\tunlock( select( blockEditorStore ) );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\t\tconst getBlockSectionRootClientId = () => {\n\t\t\tif ( isZoomOut() ) {\n\t\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\n\t\t\t\tif ( sectionRootClientId ) {\n\t\t\t\t\treturn sectionRootClientId;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn getBlockRootClientId();\n\t\t};\n\t\treturn {\n\t\t\tinserterSidebarToggleRef: getInserterSidebarToggleRef(),\n\t\t\tinserter: getInserter(),\n\t\t\tshowMostUsedBlocks: get( 'core', 'mostUsedBlocks' ),\n\t\t\tblockSectionRootClientId: getBlockSectionRootClientId(),\n\t\t\tsidebarIsOpened: !! (\n\t\t\t\tgetActiveComplementaryArea( 'core' ) || isPublishSidebarOpened()\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened } = useDispatch( editorStore );\n\tconst { disableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst libraryRef = useRef();\n\n\t// When closing the inserter, focus should return to the toggle button.\n\tconst closeInserterSidebar = useCallback( () => {\n\t\tsetIsInserterOpened( false );\n\t\tinserterSidebarToggleRef.current?.focus();\n\t}, [ inserterSidebarToggleRef, setIsInserterOpened ] );\n\n\tconst closeOnEscape = useCallback(\n\t\t( event ) => {\n\t\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tcloseInserterSidebar();\n\t\t\t}\n\t\t},\n\t\t[ closeInserterSidebar ]\n\t);\n\n\tconst inserterContents = (\n\t\t<div className=\"editor-inserter-sidebar__content\">\n\t\t\t<PrivateInserterLibrary\n\t\t\t\tshowMostUsedBlocks={ showMostUsedBlocks }\n\t\t\t\tshowInserterHelpPanel\n\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\trootClientId={\n\t\t\t\t\tblockSectionRootClientId ?? inserter.rootClientId\n\t\t\t\t}\n\t\t\t\t__experimentalInsertionIndex={ inserter.insertionIndex }\n\t\t\t\tonSelect={ inserter.onSelect }\n\t\t\t\t__experimentalInitialTab={ inserter.tab }\n\t\t\t\t__experimentalInitialCategory={ inserter.category }\n\t\t\t\t__experimentalFilterValue={ inserter.filterValue }\n\t\t\t\tonPatternCategorySelection={\n\t\t\t\t\tsidebarIsOpened\n\t\t\t\t\t\t? () => disableComplementaryArea( 'core' )\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tref={ libraryRef }\n\t\t\t\tonClose={ closeInserterSidebar }\n\t\t\t/>\n\t\t</div>\n\t);\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div onKeyDown={ closeOnEscape } className=\"editor-inserter-sidebar\">\n\t\t\t{ inserterContents }\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,aAAa,iBAAiB;AACvC;AAAA,EACC,SAAS;AAAA,EACT,eAAe;AAAA,OACT;AACP,SAAS,wBAAwB;AACjC,SAAS,aAAa,cAAc;AACpC,SAAS,SAAS,wBAAwB;AAC1C,SAAS,cAAc;AACvB,SAAS,SAAS,sBAAsB;AAKxC,SAAS,cAAc;AACvB,SAAS,SAAS,mBAAmB;AAiElC;AA/DH,IAAM,EAAE,uBAAuB,IAAI,OAAQ,sBAAuB;AAEnD,SAAR,kBAAmC;AACzC,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI,UAAW,CAAE,WAAY;AAC5B,UAAM;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACD,IAAI,OAAQ,OAAQ,WAAY,CAAE;AAClC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,SAAS;AAAA,MACpB,0BAA2B,SAAS;AAAA,MACpC,+BAAgC,SAAS;AAAA,MACzC,2BAA4B,SAAS;AAAA,MACrC,4BACC,kBACG,MAAM,yBAA0B,MAAO,IACvC;AAAA,MAEJ,KAAM;AAAA,MACN,SAAU;AAAA;AAAA,EACX,GACD;AAGD;AAAA;AAAA,IAEC,oBAAC,SAAI,WAAY,eAAgB,WAAU,2BACxC,4BACH;AAAA;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -38,7 +38,7 @@ var getItemPriority = (name, searchValue) => {
|
|
|
38
38
|
};
|
|
39
39
|
function PageAttributesParent() {
|
|
40
40
|
const { editPost } = useDispatch(editorStore);
|
|
41
|
-
const [fieldValue, setFieldValue] = useState(
|
|
41
|
+
const [fieldValue, setFieldValue] = useState("");
|
|
42
42
|
const {
|
|
43
43
|
isHierarchical,
|
|
44
44
|
parentPostId,
|