@wordpress/editor 14.46.0 → 14.47.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 +11 -0
- package/build/components/collab-sidebar/add-note.cjs +6 -0
- package/build/components/collab-sidebar/add-note.cjs.map +2 -2
- package/build/components/collab-sidebar/hooks.cjs +36 -24
- package/build/components/collab-sidebar/hooks.cjs.map +2 -2
- package/build/components/collab-sidebar/index.cjs +19 -10
- package/build/components/collab-sidebar/index.cjs.map +2 -2
- package/build/components/collab-sidebar/note-byline.cjs +16 -9
- package/build/components/collab-sidebar/note-byline.cjs.map +2 -2
- package/build/components/collab-sidebar/notes.cjs +20 -11
- package/build/components/collab-sidebar/notes.cjs.map +2 -2
- package/build/components/collab-sidebar/utils.cjs +42 -2
- package/build/components/collab-sidebar/utils.cjs.map +2 -2
- package/build/components/collaborators-overlay/compute-selection.cjs +39 -15
- package/build/components/collaborators-overlay/compute-selection.cjs.map +3 -3
- package/build/components/collaborators-overlay/use-block-highlighting.cjs +10 -2
- package/build/components/collaborators-overlay/use-block-highlighting.cjs.map +3 -3
- package/build/components/collaborators-overlay/use-render-cursors.cjs +15 -7
- package/build/components/collaborators-overlay/use-render-cursors.cjs.map +3 -3
- package/build/components/collaborators-presence/avatar/component.cjs +5 -1
- package/build/components/collaborators-presence/avatar/component.cjs.map +3 -3
- package/build/components/collaborators-presence/use-collaborator-notifications.cjs +6 -3
- package/build/components/collaborators-presence/use-collaborator-notifications.cjs.map +2 -2
- package/build/components/editor-interface/index.cjs +17 -16
- package/build/components/editor-interface/index.cjs.map +3 -3
- package/build/components/editor-notices/index.cjs +6 -1
- package/build/components/editor-notices/index.cjs.map +3 -3
- package/build/components/global-styles/hooks.cjs +12 -1
- package/build/components/global-styles/hooks.cjs.map +2 -2
- package/build/components/header/index.cjs +11 -6
- package/build/components/header/index.cjs.map +2 -2
- package/build/components/media/media-editor-modal.cjs +14 -1
- package/build/components/media/media-editor-modal.cjs.map +2 -2
- package/build/components/post-card-panel/index.cjs +7 -1
- package/build/components/post-card-panel/index.cjs.map +3 -3
- package/build/components/post-last-revision/index.cjs +28 -8
- package/build/components/post-last-revision/index.cjs.map +2 -2
- package/build/components/post-locked-modal/index.cjs +9 -6
- package/build/components/post-locked-modal/index.cjs.map +2 -2
- package/build/components/post-publish-button/label.cjs +0 -7
- package/build/components/post-publish-button/label.cjs.map +2 -2
- package/build/components/post-publish-panel/prepublish.cjs +8 -1
- package/build/components/post-publish-panel/prepublish.cjs.map +3 -3
- package/build/components/post-revisions-panel/index.cjs +7 -0
- package/build/components/post-revisions-panel/index.cjs.map +2 -2
- package/build/components/post-revisions-preview/diff-markers.cjs +21 -13
- package/build/components/post-revisions-preview/diff-markers.cjs.map +2 -2
- package/build/components/post-revisions-preview/revisions-canvas.cjs +7 -1
- package/build/components/post-revisions-preview/revisions-canvas.cjs.map +2 -2
- package/build/components/post-taxonomies/check.cjs +1 -2
- package/build/components/post-taxonomies/check.cjs.map +2 -2
- package/build/components/post-taxonomies/index.cjs +1 -2
- package/build/components/post-taxonomies/index.cjs.map +2 -2
- package/build/components/preferences-modal/index.cjs +1 -1
- package/build/components/preferences-modal/index.cjs.map +2 -2
- package/build/components/preview-dropdown/index.cjs.map +3 -3
- package/build/components/provider/index.cjs +5 -21
- package/build/components/provider/index.cjs.map +3 -3
- package/build/components/provider/use-block-editor-settings.cjs +16 -9
- package/build/components/provider/use-block-editor-settings.cjs.map +3 -3
- package/build/components/resizable-editor/resize-handle.cjs +24 -16
- package/build/components/resizable-editor/resize-handle.cjs.map +2 -2
- package/build/components/sidebar/header.cjs +16 -21
- package/build/components/sidebar/header.cjs.map +3 -3
- package/build/components/sidebar/index.cjs +2 -6
- package/build/components/sidebar/index.cjs.map +2 -2
- package/build/components/start-page-options/index.cjs +14 -4
- package/build/components/start-page-options/index.cjs.map +2 -2
- package/build/components/start-template-options/index.cjs +8 -6
- package/build/components/start-template-options/index.cjs.map +2 -2
- package/build/components/styles-canvas/style-book.cjs +59 -2
- package/build/components/styles-canvas/style-book.cjs.map +2 -2
- package/build/components/sync-connection-error-modal/index.cjs +10 -7
- package/build/components/sync-connection-error-modal/index.cjs.map +3 -3
- package/build/components/template-actions-panel/block-theme-content.cjs +21 -12
- package/build/components/template-actions-panel/block-theme-content.cjs.map +2 -2
- package/build/dataviews/store/private-actions.cjs.map +2 -2
- package/build/store/private-actions.cjs +17 -1
- package/build/store/private-actions.cjs.map +3 -3
- package/build/store/private-selectors.cjs +18 -0
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/selectors.cjs +0 -17
- package/build/store/selectors.cjs.map +2 -2
- package/build/{components/media → utils/media-delete}/index.cjs +12 -13
- package/build/utils/media-delete/index.cjs.map +7 -0
- package/build/utils/media-finalize/index.cjs +3 -1
- package/build/utils/media-finalize/index.cjs.map +2 -2
- package/build/utils/sync-error-messages.cjs +9 -0
- package/build/utils/sync-error-messages.cjs.map +2 -2
- package/build-module/components/collab-sidebar/add-note.mjs +6 -0
- package/build-module/components/collab-sidebar/add-note.mjs.map +2 -2
- package/build-module/components/collab-sidebar/hooks.mjs +42 -25
- package/build-module/components/collab-sidebar/hooks.mjs.map +2 -2
- package/build-module/components/collab-sidebar/index.mjs +19 -10
- package/build-module/components/collab-sidebar/index.mjs.map +2 -2
- package/build-module/components/collab-sidebar/note-byline.mjs +17 -10
- package/build-module/components/collab-sidebar/note-byline.mjs.map +2 -2
- package/build-module/components/collab-sidebar/notes.mjs +26 -13
- package/build-module/components/collab-sidebar/notes.mjs.map +2 -2
- package/build-module/components/collab-sidebar/utils.mjs +38 -2
- package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/compute-selection.mjs +36 -12
- package/build-module/components/collaborators-overlay/compute-selection.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/use-block-highlighting.mjs +10 -3
- package/build-module/components/collaborators-overlay/use-block-highlighting.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs +11 -6
- package/build-module/components/collaborators-overlay/use-render-cursors.mjs.map +2 -2
- package/build-module/components/collaborators-presence/avatar/component.mjs +7 -3
- package/build-module/components/collaborators-presence/avatar/component.mjs.map +2 -2
- package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs +6 -3
- package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs.map +2 -2
- package/build-module/components/editor-interface/index.mjs +22 -17
- package/build-module/components/editor-interface/index.mjs.map +2 -2
- package/build-module/components/editor-notices/index.mjs +6 -1
- package/build-module/components/editor-notices/index.mjs.map +2 -2
- package/build-module/components/global-styles/hooks.mjs +12 -1
- package/build-module/components/global-styles/hooks.mjs.map +2 -2
- package/build-module/components/header/index.mjs +11 -6
- package/build-module/components/header/index.mjs.map +2 -2
- package/build-module/components/media/media-editor-modal.mjs +14 -1
- package/build-module/components/media/media-editor-modal.mjs.map +2 -2
- package/build-module/components/post-card-panel/index.mjs +8 -2
- package/build-module/components/post-card-panel/index.mjs.map +2 -2
- package/build-module/components/post-last-revision/index.mjs +29 -9
- package/build-module/components/post-last-revision/index.mjs.map +2 -2
- package/build-module/components/post-locked-modal/index.mjs +9 -6
- package/build-module/components/post-locked-modal/index.mjs.map +2 -2
- package/build-module/components/post-publish-button/label.mjs +0 -7
- package/build-module/components/post-publish-button/label.mjs.map +2 -2
- package/build-module/components/post-publish-panel/prepublish.mjs +9 -2
- package/build-module/components/post-publish-panel/prepublish.mjs.map +2 -2
- package/build-module/components/post-revisions-panel/index.mjs +7 -0
- package/build-module/components/post-revisions-panel/index.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/diff-markers.mjs +22 -14
- package/build-module/components/post-revisions-preview/diff-markers.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-canvas.mjs +7 -1
- package/build-module/components/post-revisions-preview/revisions-canvas.mjs.map +2 -2
- package/build-module/components/post-taxonomies/check.mjs +1 -2
- package/build-module/components/post-taxonomies/check.mjs.map +2 -2
- package/build-module/components/post-taxonomies/index.mjs +1 -2
- package/build-module/components/post-taxonomies/index.mjs.map +2 -2
- package/build-module/components/preferences-modal/index.mjs +1 -1
- package/build-module/components/preferences-modal/index.mjs.map +2 -2
- package/build-module/components/preview-dropdown/index.mjs +2 -2
- package/build-module/components/preview-dropdown/index.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +6 -22
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/use-block-editor-settings.mjs +16 -9
- package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
- package/build-module/components/resizable-editor/resize-handle.mjs +26 -18
- package/build-module/components/resizable-editor/resize-handle.mjs.map +2 -2
- package/build-module/components/sidebar/header.mjs +11 -16
- package/build-module/components/sidebar/header.mjs.map +2 -2
- package/build-module/components/sidebar/index.mjs +2 -7
- package/build-module/components/sidebar/index.mjs.map +2 -2
- package/build-module/components/start-page-options/index.mjs +14 -4
- package/build-module/components/start-page-options/index.mjs.map +2 -2
- package/build-module/components/start-template-options/index.mjs +8 -6
- package/build-module/components/start-template-options/index.mjs.map +2 -2
- package/build-module/components/styles-canvas/style-book.mjs +60 -3
- package/build-module/components/styles-canvas/style-book.mjs.map +2 -2
- package/build-module/components/sync-connection-error-modal/index.mjs +14 -8
- package/build-module/components/sync-connection-error-modal/index.mjs.map +2 -2
- package/build-module/components/template-actions-panel/block-theme-content.mjs +21 -13
- package/build-module/components/template-actions-panel/block-theme-content.mjs.map +2 -2
- package/build-module/dataviews/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +16 -1
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +18 -0
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/selectors.mjs +0 -16
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/media-delete/index.mjs +12 -0
- package/build-module/utils/media-delete/index.mjs.map +7 -0
- package/build-module/utils/media-finalize/index.mjs +3 -1
- package/build-module/utils/media-finalize/index.mjs.map +2 -2
- package/build-module/utils/sync-error-messages.mjs +8 -0
- package/build-module/utils/sync-error-messages.mjs.map +2 -2
- package/build-style/style-rtl.css +462 -408
- package/build-style/style.css +462 -408
- package/build-types/components/collab-sidebar/add-note.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/hooks.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/note-byline.d.ts +3 -0
- package/build-types/components/collab-sidebar/note-byline.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/notes.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/utils.d.ts +33 -0
- package/build-types/components/collab-sidebar/utils.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/compute-selection.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/use-block-highlighting.d.ts +3 -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.map +1 -1
- package/build-types/components/collaborators-presence/avatar/component.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/editor-notices/index.d.ts.map +1 -1
- package/build-types/components/global-styles/hooks.d.ts.map +1 -1
- package/build-types/components/media/media-editor-modal.d.ts +6 -2
- package/build-types/components/media/media-editor-modal.d.ts.map +1 -1
- package/build-types/components/post-card-panel/index.d.ts.map +1 -1
- package/build-types/components/post-last-revision/index.d.ts.map +1 -1
- package/build-types/components/post-locked-modal/index.d.ts +1 -6
- package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
- package/build-types/components/post-publish-button/label.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/prepublish.d.ts.map +1 -1
- package/build-types/components/post-revisions-panel/index.d.ts +1 -1
- package/build-types/components/post-revisions-panel/index.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/diff-markers.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/revisions-canvas.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/check.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts +1 -6
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts +1 -6
- package/build-types/components/post-taxonomies/index.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/resizable-editor/resize-handle.d.ts.map +1 -1
- package/build-types/components/sidebar/index.d.ts.map +1 -1
- package/build-types/components/start-page-options/index.d.ts.map +1 -1
- package/build-types/components/start-template-options/index.d.ts.map +1 -1
- package/build-types/components/styles-canvas/style-book.d.ts.map +1 -1
- package/build-types/components/sync-connection-error-modal/index.d.ts.map +1 -1
- package/build-types/components/template-actions-panel/block-theme-content.d.ts.map +1 -1
- package/build-types/dataviews/store/private-actions.d.ts +0 -1
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts +15 -0
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +10 -0
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +0 -10
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/utils/get-template-part-icon.d.ts.map +1 -1
- package/build-types/utils/media-delete/index.d.ts +2 -0
- package/build-types/utils/media-delete/index.d.ts.map +1 -0
- package/build-types/utils/media-finalize/index.d.ts +1 -1
- package/build-types/utils/media-finalize/index.d.ts.map +1 -1
- package/build-types/utils/sync-error-messages.d.ts +1 -0
- package/build-types/utils/sync-error-messages.d.ts.map +1 -1
- package/package.json +48 -48
- package/src/components/collab-sidebar/add-note.js +9 -0
- package/src/components/collab-sidebar/hooks.js +53 -29
- package/src/components/collab-sidebar/index.js +28 -14
- package/src/components/collab-sidebar/note-byline.js +15 -10
- package/src/components/collab-sidebar/notes.js +36 -14
- package/src/components/collab-sidebar/test/utils.js +375 -1
- package/src/components/collab-sidebar/utils.js +70 -1
- package/src/components/collaborators-overlay/compute-selection.ts +67 -19
- package/src/components/collaborators-overlay/use-block-highlighting.ts +14 -1
- package/src/components/collaborators-overlay/use-render-cursors.ts +15 -4
- package/src/components/collaborators-presence/avatar/component.tsx +10 -3
- package/src/components/collaborators-presence/avatar/test/index.tsx +50 -18
- package/src/components/collaborators-presence/styles/collaborators-presence.scss +4 -1
- package/src/components/collaborators-presence/test/use-collaborator-notifications.ts +2 -1
- package/src/components/collaborators-presence/use-collaborator-notifications.ts +6 -4
- package/src/components/editor-help/help-topic-row.native.js +2 -2
- package/src/components/editor-interface/index.js +22 -23
- package/src/components/editor-interface/style.scss +4 -0
- package/src/components/editor-notices/index.js +7 -1
- package/src/components/error-boundary/index.native.js +2 -2
- package/src/components/global-styles/hooks.js +26 -0
- package/src/components/global-styles-sidebar/style.scss +0 -9
- package/src/components/header/index.js +12 -12
- package/src/components/media/media-editor-modal.js +20 -2
- package/src/components/offline-status/index.native.js +2 -2
- package/src/components/post-card-panel/index.js +5 -2
- package/src/components/post-last-revision/index.js +37 -9
- package/src/components/post-last-revision/style.scss +0 -3
- package/src/components/post-locked-modal/index.js +8 -5
- package/src/components/post-panel-row/style.scss +1 -0
- package/src/components/post-publish-button/label.js +0 -11
- package/src/components/post-publish-panel/prepublish.js +6 -2
- package/src/components/post-revisions-panel/index.js +8 -0
- package/src/components/post-revisions-preview/diff-markers.js +17 -11
- package/src/components/post-revisions-preview/revisions-canvas.js +7 -1
- package/src/components/post-revisions-preview/style.scss +4 -4
- package/src/components/post-taxonomies/check.js +1 -2
- package/src/components/post-taxonomies/index.js +1 -2
- package/src/components/preferences-modal/index.js +1 -1
- package/src/components/preview-dropdown/index.js +2 -2
- package/src/components/provider/index.js +10 -31
- package/src/components/provider/use-block-editor-settings.js +19 -12
- package/src/components/resizable-editor/resize-handle.js +22 -16
- package/src/components/sidebar/header.js +18 -28
- package/src/components/sidebar/index.js +5 -14
- package/src/components/start-page-options/index.js +19 -4
- package/src/components/start-template-options/index.js +13 -6
- package/src/components/styles-canvas/style-book.js +75 -13
- package/src/components/sync-connection-error-modal/index.tsx +25 -11
- package/src/components/template-actions-panel/block-theme-content.js +19 -13
- package/src/components/text-editor/style.scss +2 -2
- package/src/dataviews/store/private-actions.ts +0 -1
- package/src/store/private-actions.js +27 -0
- package/src/store/private-selectors.js +26 -0
- package/src/store/selectors.js +0 -24
- package/src/store/test/actions.js +34 -0
- package/src/utils/media-delete/index.js +11 -0
- package/src/utils/media-finalize/index.js +6 -1
- package/src/utils/media-finalize/test/index.js +32 -2
- package/src/utils/sync-error-messages.ts +8 -0
- package/src/utils/test/sync-error-messages.js +1 -0
- package/build/components/global-styles-provider/index.cjs +0 -181
- package/build/components/global-styles-provider/index.cjs.map +0 -7
- package/build/components/media/index.cjs.map +0 -7
- package/build/components/media/metadata-panel.cjs +0 -96
- package/build/components/media/metadata-panel.cjs.map +0 -7
- package/build/components/media/preview.cjs +0 -39
- package/build/components/media/preview.cjs.map +0 -7
- package/build-module/components/global-styles-provider/index.mjs +0 -156
- package/build-module/components/global-styles-provider/index.mjs.map +0 -7
- package/build-module/components/media/index.mjs +0 -8
- package/build-module/components/media/index.mjs.map +0 -7
- package/build-module/components/media/metadata-panel.mjs +0 -65
- package/build-module/components/media/metadata-panel.mjs.map +0 -7
- package/build-module/components/media/preview.mjs +0 -21
- package/build-module/components/media/preview.mjs.map +0 -7
- package/build-types/components/global-styles-provider/index.d.ts +0 -16
- package/build-types/components/global-styles-provider/index.d.ts.map +0 -1
- package/build-types/components/media/index.d.ts +0 -3
- package/build-types/components/media/index.d.ts.map +0 -1
- package/build-types/components/media/metadata-panel.d.ts +0 -12
- package/build-types/components/media/metadata-panel.d.ts.map +0 -1
- package/build-types/components/media/preview.d.ts +0 -9
- package/build-types/components/media/preview.d.ts.map +0 -1
- package/src/components/global-styles-provider/index.js +0 -207
- package/src/components/media/index.js +0 -2
- package/src/components/media/metadata-panel.js +0 -77
- package/src/components/media/preview.js +0 -35
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.47.0",
|
|
4
4
|
"description": "Enhanced block editor for WordPress posts.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -60,50 +60,50 @@
|
|
|
60
60
|
"build-module/bindings/**"
|
|
61
61
|
],
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@wordpress/a11y": "^4.
|
|
64
|
-
"@wordpress/api-fetch": "^7.
|
|
65
|
-
"@wordpress/base-styles": "^
|
|
66
|
-
"@wordpress/blob": "^4.
|
|
67
|
-
"@wordpress/block-editor": "^15.
|
|
68
|
-
"@wordpress/block-serialization-default-parser": "^5.
|
|
69
|
-
"@wordpress/blocks": "^15.
|
|
70
|
-
"@wordpress/commands": "^1.
|
|
71
|
-
"@wordpress/components": "^
|
|
72
|
-
"@wordpress/compose": "^
|
|
73
|
-
"@wordpress/core-data": "^7.
|
|
74
|
-
"@wordpress/data": "^10.
|
|
75
|
-
"@wordpress/dataviews": "^
|
|
76
|
-
"@wordpress/date": "^5.
|
|
77
|
-
"@wordpress/deprecated": "^4.
|
|
78
|
-
"@wordpress/dom": "^4.
|
|
79
|
-
"@wordpress/element": "^
|
|
80
|
-
"@wordpress/fields": "^0.
|
|
81
|
-
"@wordpress/global-styles-engine": "^1.
|
|
82
|
-
"@wordpress/global-styles-ui": "^1.
|
|
83
|
-
"@wordpress/hooks": "^4.
|
|
84
|
-
"@wordpress/html-entities": "^4.
|
|
85
|
-
"@wordpress/i18n": "^6.
|
|
86
|
-
"@wordpress/icons": "^13.
|
|
87
|
-
"@wordpress/interface": "^9.
|
|
88
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
89
|
-
"@wordpress/keycodes": "^4.
|
|
90
|
-
"@wordpress/media-editor": "^0.
|
|
91
|
-
"@wordpress/media-fields": "^0.
|
|
92
|
-
"@wordpress/media-utils": "^5.
|
|
93
|
-
"@wordpress/notices": "^5.
|
|
94
|
-
"@wordpress/patterns": "^2.
|
|
95
|
-
"@wordpress/plugins": "^7.
|
|
96
|
-
"@wordpress/preferences": "^4.
|
|
97
|
-
"@wordpress/private-apis": "^1.
|
|
98
|
-
"@wordpress/reusable-blocks": "^5.
|
|
99
|
-
"@wordpress/rich-text": "^7.
|
|
100
|
-
"@wordpress/server-side-render": "^6.
|
|
101
|
-
"@wordpress/ui": "^0.
|
|
102
|
-
"@wordpress/upload-media": "^0.
|
|
103
|
-
"@wordpress/url": "^4.
|
|
104
|
-
"@wordpress/views": "^1.
|
|
105
|
-
"@wordpress/warning": "^3.
|
|
106
|
-
"@wordpress/wordcount": "^4.
|
|
63
|
+
"@wordpress/a11y": "^4.47.0",
|
|
64
|
+
"@wordpress/api-fetch": "^7.47.0",
|
|
65
|
+
"@wordpress/base-styles": "^9.0.0",
|
|
66
|
+
"@wordpress/blob": "^4.47.0",
|
|
67
|
+
"@wordpress/block-editor": "^15.20.0",
|
|
68
|
+
"@wordpress/block-serialization-default-parser": "^5.47.0",
|
|
69
|
+
"@wordpress/blocks": "^15.20.0",
|
|
70
|
+
"@wordpress/commands": "^1.47.0",
|
|
71
|
+
"@wordpress/components": "^34.0.0",
|
|
72
|
+
"@wordpress/compose": "^8.0.0",
|
|
73
|
+
"@wordpress/core-data": "^7.47.0",
|
|
74
|
+
"@wordpress/data": "^10.47.0",
|
|
75
|
+
"@wordpress/dataviews": "^15.0.0",
|
|
76
|
+
"@wordpress/date": "^5.47.0",
|
|
77
|
+
"@wordpress/deprecated": "^4.47.0",
|
|
78
|
+
"@wordpress/dom": "^4.47.0",
|
|
79
|
+
"@wordpress/element": "^7.0.0",
|
|
80
|
+
"@wordpress/fields": "^0.39.0",
|
|
81
|
+
"@wordpress/global-styles-engine": "^1.14.0",
|
|
82
|
+
"@wordpress/global-styles-ui": "^1.14.0",
|
|
83
|
+
"@wordpress/hooks": "^4.47.0",
|
|
84
|
+
"@wordpress/html-entities": "^4.47.0",
|
|
85
|
+
"@wordpress/i18n": "^6.20.0",
|
|
86
|
+
"@wordpress/icons": "^13.2.0",
|
|
87
|
+
"@wordpress/interface": "^9.32.0",
|
|
88
|
+
"@wordpress/keyboard-shortcuts": "^5.47.0",
|
|
89
|
+
"@wordpress/keycodes": "^4.47.0",
|
|
90
|
+
"@wordpress/media-editor": "^0.10.0",
|
|
91
|
+
"@wordpress/media-fields": "^0.12.0",
|
|
92
|
+
"@wordpress/media-utils": "^5.47.0",
|
|
93
|
+
"@wordpress/notices": "^5.47.0",
|
|
94
|
+
"@wordpress/patterns": "^2.47.0",
|
|
95
|
+
"@wordpress/plugins": "^7.47.0",
|
|
96
|
+
"@wordpress/preferences": "^4.47.0",
|
|
97
|
+
"@wordpress/private-apis": "^1.47.0",
|
|
98
|
+
"@wordpress/reusable-blocks": "^5.47.0",
|
|
99
|
+
"@wordpress/rich-text": "^7.47.0",
|
|
100
|
+
"@wordpress/server-side-render": "^6.23.0",
|
|
101
|
+
"@wordpress/ui": "^0.14.0",
|
|
102
|
+
"@wordpress/upload-media": "^0.32.0",
|
|
103
|
+
"@wordpress/url": "^4.47.0",
|
|
104
|
+
"@wordpress/views": "^1.14.0",
|
|
105
|
+
"@wordpress/warning": "^3.47.0",
|
|
106
|
+
"@wordpress/wordcount": "^4.47.0",
|
|
107
107
|
"change-case": "^4.1.2",
|
|
108
108
|
"client-zip": "^2.4.5",
|
|
109
109
|
"clsx": "^2.1.1",
|
|
@@ -120,11 +120,11 @@
|
|
|
120
120
|
"deep-freeze": "0.0.1"
|
|
121
121
|
},
|
|
122
122
|
"peerDependencies": {
|
|
123
|
-
"react": "^
|
|
124
|
-
"react-dom": "^
|
|
123
|
+
"react": "^19.2.4",
|
|
124
|
+
"react-dom": "^19.2.4"
|
|
125
125
|
},
|
|
126
126
|
"publishConfig": {
|
|
127
127
|
"access": "public"
|
|
128
128
|
},
|
|
129
|
-
"gitHead": "
|
|
129
|
+
"gitHead": "d653c5fd6161571a0c2ebde28553d6e25624eacc"
|
|
130
130
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { useRef } from '@wordpress/element';
|
|
5
6
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
7
|
import {
|
|
7
8
|
store as blockEditorStore,
|
|
@@ -34,6 +35,7 @@ export function AddNote( { onSubmit, sidebarRef, floating } ) {
|
|
|
34
35
|
const blockElement = useBlockElement( clientId );
|
|
35
36
|
const { toggleBlockSpotlight } = unlock( useDispatch( blockEditorStore ) );
|
|
36
37
|
const { selectNote } = unlock( useDispatch( editorStore ) );
|
|
38
|
+
const isSubmittingRef = useRef( false );
|
|
37
39
|
|
|
38
40
|
const unselectNote = () => {
|
|
39
41
|
selectNote( undefined );
|
|
@@ -61,6 +63,12 @@ export function AddNote( { onSubmit, sidebarRef, floating } ) {
|
|
|
61
63
|
if ( ! document.hasFocus() ) {
|
|
62
64
|
return;
|
|
63
65
|
}
|
|
66
|
+
// Prevent blur from closing the form while the async submit
|
|
67
|
+
// is in progress. Clicking "Add note" moves focus away,
|
|
68
|
+
// triggering blur before onSubmit completes.
|
|
69
|
+
if ( isSubmittingRef.current ) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
64
72
|
if ( event.currentTarget.contains( event.relatedTarget ) ) {
|
|
65
73
|
return;
|
|
66
74
|
}
|
|
@@ -71,6 +79,7 @@ export function AddNote( { onSubmit, sidebarRef, floating } ) {
|
|
|
71
79
|
<NoteCard>
|
|
72
80
|
<NoteForm
|
|
73
81
|
onSubmit={ async ( inputComment ) => {
|
|
82
|
+
isSubmittingRef.current = true;
|
|
74
83
|
const { id } = await onSubmit( {
|
|
75
84
|
content: inputComment,
|
|
76
85
|
} );
|
|
@@ -26,7 +26,12 @@ import { store as editorStore } from '../../store';
|
|
|
26
26
|
import { FLOATING_NOTES_SIDEBAR } from './constants';
|
|
27
27
|
import { unlock } from '../../lock-unlock';
|
|
28
28
|
import { createBoardStore } from './board-store';
|
|
29
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
calculateNotePositions,
|
|
31
|
+
getNoteIdsFromMetadata,
|
|
32
|
+
addNoteIdToMetadata,
|
|
33
|
+
removeNoteIdFromMetadata,
|
|
34
|
+
} from './utils';
|
|
30
35
|
|
|
31
36
|
const { cleanEmptyObject } = unlock( blockEditorPrivateApis );
|
|
32
37
|
|
|
@@ -59,15 +64,19 @@ export function useNoteThreads( postId ) {
|
|
|
59
64
|
return { notes: [], unresolvedNotes: [] };
|
|
60
65
|
}
|
|
61
66
|
|
|
62
|
-
// Single pass over clientIds
|
|
67
|
+
// Single pass over clientIds builds the forward map and reverse lookup
|
|
68
|
+
// together. getNoteIdsFromMetadata returns numeric ids, matching the
|
|
69
|
+
// types returned by the comments REST endpoint.
|
|
63
70
|
const blocksWithNotes = {};
|
|
64
71
|
const clientIdByNoteId = new Map();
|
|
65
72
|
for ( const clientId of clientIds ) {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
blocksWithNotes[ clientId ] =
|
|
70
|
-
|
|
73
|
+
const metadata = getBlockAttributes( clientId )?.metadata;
|
|
74
|
+
const noteIds = getNoteIdsFromMetadata( metadata );
|
|
75
|
+
if ( noteIds.length > 0 ) {
|
|
76
|
+
blocksWithNotes[ clientId ] = noteIds;
|
|
77
|
+
for ( const noteId of noteIds ) {
|
|
78
|
+
clientIdByNoteId.set( noteId, clientId );
|
|
79
|
+
}
|
|
71
80
|
}
|
|
72
81
|
}
|
|
73
82
|
|
|
@@ -81,7 +90,7 @@ export function useNoteThreads( postId ) {
|
|
|
81
90
|
reply: [],
|
|
82
91
|
blockClientId:
|
|
83
92
|
item.parent === 0
|
|
84
|
-
? clientIdByNoteId.get(
|
|
93
|
+
? clientIdByNoteId.get( item.id ) ?? null
|
|
85
94
|
: null,
|
|
86
95
|
};
|
|
87
96
|
threadsById.set( item.id, thread );
|
|
@@ -101,20 +110,21 @@ export function useNoteThreads( postId ) {
|
|
|
101
110
|
return { notes: [], unresolvedNotes: [] };
|
|
102
111
|
}
|
|
103
112
|
|
|
104
|
-
// Single partition over notes-in-block-order.
|
|
113
|
+
// Single partition over notes-in-block-order. Each block can have
|
|
114
|
+
// multiple note IDs, so iterate the flattened list.
|
|
105
115
|
const unresolved = [];
|
|
106
116
|
const resolved = [];
|
|
107
|
-
for ( const
|
|
108
|
-
const
|
|
109
|
-
threadsById.get(
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
for ( const noteIds of Object.values( blocksWithNotes ) ) {
|
|
118
|
+
for ( const noteId of noteIds ) {
|
|
119
|
+
const thread = threadsById.get( noteId );
|
|
120
|
+
if ( ! thread ) {
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if ( thread.status === 'hold' ) {
|
|
124
|
+
unresolved.push( thread );
|
|
125
|
+
} else if ( thread.status === 'approved' ) {
|
|
126
|
+
resolved.push( thread );
|
|
127
|
+
}
|
|
118
128
|
}
|
|
119
129
|
}
|
|
120
130
|
|
|
@@ -170,14 +180,22 @@ export function useNoteActions() {
|
|
|
170
180
|
);
|
|
171
181
|
|
|
172
182
|
// If it's a top-level note, update the block attributes with the note id.
|
|
183
|
+
// Read-modify-write on metadata is racy under concurrent edits:
|
|
184
|
+
// two near-simultaneous adds against the same base will each write
|
|
185
|
+
// a 2-element array and the later write wins, dropping the other
|
|
186
|
+
// id. Tracking issue: https://github.com/WordPress/gutenberg/issues/74751.
|
|
173
187
|
if ( ! parent && savedRecord?.id ) {
|
|
174
188
|
const clientId = getSelectedBlockClientId();
|
|
189
|
+
if ( ! clientId ) {
|
|
190
|
+
return savedRecord;
|
|
191
|
+
}
|
|
175
192
|
const metadata = getBlockAttributes( clientId )?.metadata;
|
|
193
|
+
const updatedMetadata = addNoteIdToMetadata(
|
|
194
|
+
metadata,
|
|
195
|
+
savedRecord.id
|
|
196
|
+
);
|
|
176
197
|
updateBlockAttributes( clientId, {
|
|
177
|
-
metadata:
|
|
178
|
-
...metadata,
|
|
179
|
-
noteId: savedRecord.id,
|
|
180
|
-
},
|
|
198
|
+
metadata: cleanEmptyObject( updatedMetadata ),
|
|
181
199
|
} );
|
|
182
200
|
}
|
|
183
201
|
|
|
@@ -267,13 +285,19 @@ export function useNoteActions() {
|
|
|
267
285
|
} );
|
|
268
286
|
|
|
269
287
|
if ( ! note.parent ) {
|
|
270
|
-
|
|
288
|
+
// Use blockClientId if available, otherwise fall back to selected block.
|
|
289
|
+
const clientId =
|
|
290
|
+
note.blockClientId || getSelectedBlockClientId();
|
|
291
|
+
if ( ! clientId ) {
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
271
294
|
const metadata = getBlockAttributes( clientId )?.metadata;
|
|
295
|
+
const updatedMetadata = removeNoteIdFromMetadata(
|
|
296
|
+
metadata,
|
|
297
|
+
note.id
|
|
298
|
+
);
|
|
272
299
|
updateBlockAttributes( clientId, {
|
|
273
|
-
metadata: cleanEmptyObject(
|
|
274
|
-
...metadata,
|
|
275
|
-
noteId: undefined,
|
|
276
|
-
} ),
|
|
300
|
+
metadata: cleanEmptyObject( updatedMetadata ),
|
|
277
301
|
} );
|
|
278
302
|
}
|
|
279
303
|
|
|
@@ -24,8 +24,9 @@ import { Notes } from './notes';
|
|
|
24
24
|
import { store as editorStore } from '../../store';
|
|
25
25
|
import { AddNoteMenuItem } from './add-note-menu-item';
|
|
26
26
|
import { NoteAvatarIndicator } from './note-indicator-toolbar';
|
|
27
|
-
import {
|
|
27
|
+
import { useGlobalStyles } from '../global-styles';
|
|
28
28
|
import { useNoteThreads, useEnableFloatingSidebar } from './hooks';
|
|
29
|
+
import { getNoteIdsFromMetadata, pickPrimaryNote } from './utils';
|
|
29
30
|
import PostTypeSupportCheck from '../post-type-support-check';
|
|
30
31
|
import { unlock } from '../../lock-unlock';
|
|
31
32
|
|
|
@@ -53,6 +54,8 @@ function NotesSidebar( { postId } ) {
|
|
|
53
54
|
: false,
|
|
54
55
|
};
|
|
55
56
|
}, [] );
|
|
57
|
+
|
|
58
|
+
const blockNoteIds = getNoteIdsFromMetadata( { noteId } );
|
|
56
59
|
const { isDistractionFree } = useSelect( ( select ) => {
|
|
57
60
|
const { get } = select( preferencesStore );
|
|
58
61
|
return {
|
|
@@ -108,9 +111,11 @@ function NotesSidebar( { postId } ) {
|
|
|
108
111
|
}
|
|
109
112
|
|
|
110
113
|
function openNoteForBlock( targetClientId ) {
|
|
111
|
-
|
|
112
|
-
|
|
114
|
+
// A block can carry multiple threads; surface the most relevant.
|
|
115
|
+
const blockThreads = notes.filter(
|
|
116
|
+
( thread ) => thread.blockClientId === targetClientId
|
|
113
117
|
);
|
|
118
|
+
const target = pickPrimaryNote( blockThreads );
|
|
114
119
|
return focusNote( {
|
|
115
120
|
targetClientId,
|
|
116
121
|
noteId: target?.id ?? 'new',
|
|
@@ -118,28 +123,35 @@ function NotesSidebar( { postId } ) {
|
|
|
118
123
|
} );
|
|
119
124
|
}
|
|
120
125
|
|
|
126
|
+
function addNewNoteForBlock( targetClientId ) {
|
|
127
|
+
return focusNote( {
|
|
128
|
+
targetClientId,
|
|
129
|
+
noteId: 'new',
|
|
130
|
+
isApproved: false,
|
|
131
|
+
} );
|
|
132
|
+
}
|
|
133
|
+
|
|
121
134
|
useShortcut(
|
|
122
135
|
'core/editor/new-note',
|
|
123
136
|
( event ) => {
|
|
124
137
|
event.preventDefault();
|
|
125
|
-
|
|
138
|
+
addNewNoteForBlock( clientId );
|
|
126
139
|
},
|
|
127
140
|
{
|
|
128
|
-
|
|
129
|
-
// See: https://github.com/WordPress/gutenberg/pull/75147.
|
|
130
|
-
isDisabled:
|
|
131
|
-
isDistractionFree || isClassicBlock || ! clientId || !! noteId,
|
|
141
|
+
isDisabled: isDistractionFree || isClassicBlock || ! clientId,
|
|
132
142
|
}
|
|
133
143
|
);
|
|
134
144
|
|
|
135
145
|
// Get the global styles to set the background color of the sidebar.
|
|
136
|
-
const { merged: GlobalStyles } =
|
|
146
|
+
const { merged: GlobalStyles } = useGlobalStyles();
|
|
137
147
|
const backgroundColor = GlobalStyles?.styles?.color?.background;
|
|
138
148
|
|
|
139
|
-
//
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
149
|
+
// Surface one thread for the avatar indicator.
|
|
150
|
+
const currentThreads =
|
|
151
|
+
blockNoteIds.length > 0
|
|
152
|
+
? notes.filter( ( thread ) => blockNoteIds.includes( thread.id ) )
|
|
153
|
+
: [];
|
|
154
|
+
const currentThread = pickPrimaryNote( currentThreads );
|
|
143
155
|
|
|
144
156
|
if ( isDistractionFree ) {
|
|
145
157
|
return <AddNoteMenuItem isDistractionFree />;
|
|
@@ -154,7 +166,9 @@ function NotesSidebar( { postId } ) {
|
|
|
154
166
|
/>
|
|
155
167
|
) }
|
|
156
168
|
<AddNoteMenuItem
|
|
157
|
-
onClick={ ( menuClientId ) =>
|
|
169
|
+
onClick={ ( menuClientId ) =>
|
|
170
|
+
addNewNoteForBlock( menuClientId )
|
|
171
|
+
}
|
|
158
172
|
/>
|
|
159
173
|
{ showAllNotesSidebar && (
|
|
160
174
|
<PluginSidebar
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
import { Stack } from '@wordpress/ui';
|
|
4
|
+
// eslint-disable-next-line @wordpress/use-recommended-components -- `Tooltip` is not yet on the recommended `@wordpress/ui` allow-list; landing as a migration step ahead of the wider rollout.
|
|
5
|
+
import { Stack, Tooltip } from '@wordpress/ui';
|
|
6
6
|
import { __, _x } from '@wordpress/i18n';
|
|
7
7
|
import {
|
|
8
8
|
dateI18n,
|
|
@@ -95,14 +95,19 @@ export function NoteByline( { avatar, name, date, userId } ) {
|
|
|
95
95
|
{ name ?? currentUserName }
|
|
96
96
|
</span>
|
|
97
97
|
{ date && (
|
|
98
|
-
<Tooltip
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
98
|
+
<Tooltip.Root>
|
|
99
|
+
<Tooltip.Trigger
|
|
100
|
+
render={
|
|
101
|
+
<time
|
|
102
|
+
dateTime={ commentDateTime }
|
|
103
|
+
className="editor-collab-sidebar-panel__user-time"
|
|
104
|
+
>
|
|
105
|
+
{ commentDateText }
|
|
106
|
+
</time>
|
|
107
|
+
}
|
|
108
|
+
/>
|
|
109
|
+
<Tooltip.Popup>{ tooltipText }</Tooltip.Popup>
|
|
110
|
+
</Tooltip.Root>
|
|
106
111
|
) }
|
|
107
112
|
</Stack>
|
|
108
113
|
</>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useEffect, useMemo } from '@wordpress/element';
|
|
4
|
+
import { useEffect, useMemo, useRef } from '@wordpress/element';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
7
7
|
import { Stack } from '@wordpress/ui';
|
|
@@ -15,7 +15,11 @@ import {
|
|
|
15
15
|
*/
|
|
16
16
|
import { unlock } from '../../lock-unlock';
|
|
17
17
|
import { NoteThread } from './note-thread';
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
focusNoteThread,
|
|
20
|
+
getNoteIdsFromMetadata,
|
|
21
|
+
pickPrimaryNote,
|
|
22
|
+
} from './utils';
|
|
19
23
|
import { useFloatingBoard, useNoteActions } from './hooks';
|
|
20
24
|
import { AddNote } from './add-note';
|
|
21
25
|
import { store as editorStore } from '../../store';
|
|
@@ -33,7 +37,7 @@ export function Notes( { notes, sidebarRef, isFloating = false, styles } ) {
|
|
|
33
37
|
useDispatch( blockEditorStore )
|
|
34
38
|
);
|
|
35
39
|
|
|
36
|
-
const {
|
|
40
|
+
const { noteId, selectedBlockClientId, orderedBlockIds } = useSelect(
|
|
37
41
|
( select ) => {
|
|
38
42
|
const {
|
|
39
43
|
getBlockAttributes,
|
|
@@ -42,7 +46,7 @@ export function Notes( { notes, sidebarRef, isFloating = false, styles } ) {
|
|
|
42
46
|
} = select( blockEditorStore );
|
|
43
47
|
const clientId = getSelectedBlockClientId();
|
|
44
48
|
return {
|
|
45
|
-
|
|
49
|
+
noteId: clientId
|
|
46
50
|
? getBlockAttributes( clientId )?.metadata?.noteId
|
|
47
51
|
: null,
|
|
48
52
|
selectedBlockClientId: clientId,
|
|
@@ -77,15 +81,15 @@ export function Notes( { notes, sidebarRef, isFloating = false, styles } ) {
|
|
|
77
81
|
};
|
|
78
82
|
const out = [];
|
|
79
83
|
orderedBlockIds.forEach( ( blockId ) => {
|
|
84
|
+
// Blocks can carry multiple notes — surface them all.
|
|
85
|
+
const threadsForBlock = notes.filter(
|
|
86
|
+
( t ) => t.blockClientId === blockId
|
|
87
|
+
);
|
|
88
|
+
out.push( ...threadsForBlock );
|
|
80
89
|
if ( blockId === selectedBlockClientId ) {
|
|
90
|
+
// Place the new note placeholder after the block's existing
|
|
91
|
+
// threads so the form appears alongside them.
|
|
81
92
|
out.push( newNoteThread );
|
|
82
|
-
} else {
|
|
83
|
-
const threadForBlock = notes.find(
|
|
84
|
-
( t ) => t.blockClientId === blockId
|
|
85
|
-
);
|
|
86
|
-
if ( threadForBlock ) {
|
|
87
|
-
out.push( threadForBlock );
|
|
88
|
-
}
|
|
89
93
|
}
|
|
90
94
|
} );
|
|
91
95
|
return out;
|
|
@@ -128,10 +132,28 @@ export function Notes( { notes, sidebarRef, isFloating = false, styles } ) {
|
|
|
128
132
|
}
|
|
129
133
|
};
|
|
130
134
|
|
|
131
|
-
//
|
|
135
|
+
// Pick the most relevant thread for the selected block. Derived outside
|
|
136
|
+
// the effect so the effect body stays minimal.
|
|
137
|
+
const targetNoteId = useMemo( () => {
|
|
138
|
+
const blockNoteIds = getNoteIdsFromMetadata( { noteId } );
|
|
139
|
+
const blockThreads = notes.filter( ( t ) =>
|
|
140
|
+
blockNoteIds.includes( t.id )
|
|
141
|
+
);
|
|
142
|
+
return pickPrimaryNote( blockThreads )?.id;
|
|
143
|
+
}, [ noteId, notes ] );
|
|
144
|
+
|
|
145
|
+
// Sync the selected note to the new block's primary thread when the
|
|
146
|
+
// block context changes. The ref tracks the previous block id so the
|
|
147
|
+
// effect only fires on block transitions, leaving in-block note changes
|
|
148
|
+
// (Escape, Cancel, "new" form) alone.
|
|
149
|
+
const prevBlockIdRef = useRef( selectedBlockClientId );
|
|
132
150
|
useEffect( () => {
|
|
133
|
-
|
|
134
|
-
|
|
151
|
+
if ( prevBlockIdRef.current === selectedBlockClientId ) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
prevBlockIdRef.current = selectedBlockClientId;
|
|
155
|
+
selectNote( targetNoteId );
|
|
156
|
+
}, [ selectedBlockClientId, targetNoteId, selectNote ] );
|
|
135
157
|
|
|
136
158
|
// Focus the selected note when requested.
|
|
137
159
|
useEffect( () => {
|