@wordpress/editor 14.40.2-next.v.202602241322.0 → 14.41.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 +2 -0
- package/build/components/collab-sidebar/add-comment.cjs +3 -0
- package/build/components/collab-sidebar/add-comment.cjs.map +2 -2
- package/build/components/collab-sidebar/comments.cjs +3 -0
- package/build/components/collab-sidebar/comments.cjs.map +2 -2
- package/build/components/collaborators-overlay/overlay.cjs +36 -38
- package/build/components/collaborators-overlay/overlay.cjs.map +2 -2
- package/build/components/collaborators-presence/index.cjs +2 -2
- package/build/components/collaborators-presence/index.cjs.map +2 -2
- package/build/components/collaborators-presence/list.cjs +2 -2
- package/build/components/collaborators-presence/list.cjs.map +2 -2
- package/build/components/collaborators-presence/use-collaborator-notifications.cjs +174 -0
- package/build/components/collaborators-presence/use-collaborator-notifications.cjs.map +7 -0
- package/build/components/editor-interface/index.cjs +2 -0
- package/build/components/editor-interface/index.cjs.map +2 -2
- package/build/components/more-menu/copy-content-menu-item.cjs +2 -19
- package/build/components/more-menu/copy-content-menu-item.cjs.map +3 -3
- package/build/components/page-attributes/parent.cjs +0 -1
- package/build/components/page-attributes/parent.cjs.map +2 -2
- package/build/components/post-author/panel.cjs +0 -1
- package/build/components/post-author/panel.cjs.map +2 -2
- package/build/components/post-locked-modal/index.cjs +30 -14
- package/build/components/post-locked-modal/index.cjs.map +3 -3
- package/build/components/post-revisions-preview/revisions-header.cjs +33 -26
- package/build/components/post-revisions-preview/revisions-header.cjs.map +3 -3
- package/build/components/post-revisions-preview/revisions-slider.cjs +7 -5
- package/build/components/post-revisions-preview/revisions-slider.cjs.map +2 -2
- package/build/components/post-text-editor/index.cjs +5 -20
- package/build/components/post-text-editor/index.cjs.map +3 -3
- package/build/components/post-url/panel.cjs +0 -1
- package/build/components/post-url/panel.cjs.map +2 -2
- package/build/components/sync-connection-modal/index.cjs +78 -27
- package/build/components/sync-connection-modal/index.cjs.map +3 -3
- package/build/components/sync-connection-modal/use-retry-countdown.cjs +74 -0
- package/build/components/sync-connection-modal/use-retry-countdown.cjs.map +7 -0
- package/build/store/private-selectors.cjs +12 -2
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/selectors.cjs +3 -0
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/sync-error-messages.cjs +16 -12
- package/build/utils/sync-error-messages.cjs.map +2 -2
- package/build-module/components/collab-sidebar/add-comment.mjs +3 -0
- package/build-module/components/collab-sidebar/add-comment.mjs.map +2 -2
- package/build-module/components/collab-sidebar/comments.mjs +3 -0
- package/build-module/components/collab-sidebar/comments.mjs.map +2 -2
- package/build-module/components/collaborators-overlay/overlay.mjs +36 -38
- package/build-module/components/collaborators-overlay/overlay.mjs.map +2 -2
- package/build-module/components/collaborators-presence/index.mjs +2 -2
- package/build-module/components/collaborators-presence/index.mjs.map +2 -2
- package/build-module/components/collaborators-presence/list.mjs +2 -2
- package/build-module/components/collaborators-presence/list.mjs.map +2 -2
- package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs +151 -0
- package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs.map +7 -0
- package/build-module/components/editor-interface/index.mjs +2 -0
- package/build-module/components/editor-interface/index.mjs.map +2 -2
- package/build-module/components/more-menu/copy-content-menu-item.mjs +2 -19
- package/build-module/components/more-menu/copy-content-menu-item.mjs.map +2 -2
- package/build-module/components/page-attributes/parent.mjs +0 -1
- package/build-module/components/page-attributes/parent.mjs.map +2 -2
- package/build-module/components/post-author/panel.mjs +0 -1
- package/build-module/components/post-author/panel.mjs.map +2 -2
- package/build-module/components/post-locked-modal/index.mjs +30 -14
- package/build-module/components/post-locked-modal/index.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-header.mjs +36 -33
- package/build-module/components/post-revisions-preview/revisions-header.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-slider.mjs +7 -5
- package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
- package/build-module/components/post-text-editor/index.mjs +5 -20
- package/build-module/components/post-text-editor/index.mjs.map +2 -2
- package/build-module/components/post-url/panel.mjs +0 -1
- package/build-module/components/post-url/panel.mjs.map +2 -2
- package/build-module/components/sync-connection-modal/index.mjs +83 -30
- package/build-module/components/sync-connection-modal/index.mjs.map +2 -2
- package/build-module/components/sync-connection-modal/use-retry-countdown.mjs +49 -0
- package/build-module/components/sync-connection-modal/use-retry-countdown.mjs.map +7 -0
- package/build-module/store/private-selectors.mjs +12 -2
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/selectors.mjs +3 -0
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/sync-error-messages.mjs +16 -12
- package/build-module/utils/sync-error-messages.mjs.map +2 -2
- package/build-style/style-rtl.css +99 -34
- package/build-style/style.css +99 -34
- package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -1
- package/build-types/components/collaborators-overlay/overlay.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/use-collaborator-notifications.d.ts +9 -0
- package/build-types/components/collaborators-presence/use-collaborator-notifications.d.ts.map +1 -0
- package/build-types/components/editor-interface/index.d.ts.map +1 -1
- package/build-types/components/more-menu/copy-content-menu-item.d.ts.map +1 -1
- package/build-types/components/page-attributes/parent.d.ts.map +1 -1
- package/build-types/components/post-author/panel.d.ts.map +1 -1
- package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/revisions-header.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/revisions-slider.d.ts.map +1 -1
- package/build-types/components/post-text-editor/index.d.ts.map +1 -1
- package/build-types/components/sync-connection-modal/index.d.ts.map +1 -1
- package/build-types/components/sync-connection-modal/use-retry-countdown.d.ts +9 -0
- package/build-types/components/sync-connection-modal/use-retry-countdown.d.ts.map +1 -0
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/utils/sync-error-messages.d.ts +1 -1
- package/build-types/utils/sync-error-messages.d.ts.map +1 -1
- package/package.json +44 -44
- package/src/components/collab-sidebar/add-comment.js +4 -0
- package/src/components/collab-sidebar/comments.js +5 -0
- package/src/components/collaborators-overlay/overlay.tsx +1 -7
- package/src/components/collaborators-presence/test/use-collaborator-notifications.ts +454 -0
- package/src/components/collaborators-presence/use-collaborator-notifications.ts +258 -0
- package/src/components/editor-interface/index.js +5 -0
- package/src/components/more-menu/copy-content-menu-item.js +2 -20
- package/src/components/page-attributes/parent.js +0 -1
- package/src/components/post-author/panel.js +0 -1
- package/src/components/post-locked-modal/index.js +46 -23
- package/src/components/post-revisions-preview/revisions-header.js +35 -37
- package/src/components/post-revisions-preview/revisions-slider.js +7 -4
- package/src/components/post-text-editor/index.js +6 -25
- package/src/components/post-url/panel.js +0 -1
- package/src/components/post-url/style.scss +0 -5
- package/src/components/sync-connection-modal/index.js +97 -37
- package/src/components/sync-connection-modal/style.scss +6 -8
- package/src/components/sync-connection-modal/use-retry-countdown.js +70 -0
- package/src/store/private-selectors.js +12 -2
- package/src/store/selectors.js +5 -0
- package/src/utils/sync-error-messages.js +17 -12
- package/src/utils/test/sync-error-messages.js +57 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/collab-sidebar/add-comment.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport CommentAuthorInfo from './comment-author-info';\nimport CommentForm from './comment-form';\nimport { focusCommentThread, noop } from './utils';\nimport { store as editorStore } from '../../store';\n\nconst { useBlockElement } = unlock( blockEditorPrivateApis );\n\nexport function AddComment( {\n\tonSubmit,\n\tcommentSidebarRef,\n\treflowComments = noop,\n\tisFloating = false,\n\ty,\n\trefs,\n} ) {\n\tconst { clientId } = useSelect( ( select ) => {\n\t\tconst { getSelectedBlockClientId } = select( blockEditorStore );\n\t\treturn {\n\t\t\tclientId: getSelectedBlockClientId(),\n\t\t};\n\t}, [] );\n\tconst selectedNote = useSelect(\n\t\t( select ) => unlock( select( editorStore ) ).getSelectedNote(),\n\t\t[]\n\t);\n\tconst blockElement = useBlockElement( clientId );\n\tconst { toggleBlockSpotlight } = unlock( useDispatch( blockEditorStore ) );\n\tconst { selectNote } = unlock( useDispatch( editorStore ) );\n\n\tconst unselectThread = () => {\n\t\tselectNote( undefined );\n\t\tblockElement?.focus();\n\t\ttoggleBlockSpotlight( clientId, false );\n\t};\n\n\tif ( selectedNote !== 'new' || ! clientId ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-collab-sidebar-panel__thread is-selected',\n\t\t\t\t{\n\t\t\t\t\t'is-floating': isFloating,\n\t\t\t\t}\n\t\t\t) }\n\t\t\tspacing=\"3\"\n\t\t\ttabIndex={ 0 }\n\t\t\taria-label={ __( 'New note' ) }\n\t\t\trole=\"treeitem\"\n\t\t\tref={ isFloating ? refs.setFloating : undefined }\n\t\t\tstyle={\n\t\t\t\tisFloating\n\t\t\t\t\t? // Delay showing the floating note box until a Y position is known to prevent blink.\n\t\t\t\t\t { top: y, opacity: ! y ? 0 : undefined }\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\tonBlur={ ( event ) => {\n\t\t\t\tif ( event.currentTarget.contains( event.relatedTarget ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\ttoggleBlockSpotlight( clientId, false );\n\t\t\t\tselectNote( undefined );\n\t\t\t} }\n\t\t>\n\t\t\t<HStack alignment=\"left\" spacing=\"3\">\n\t\t\t\t<CommentAuthorInfo />\n\t\t\t</HStack>\n\t\t\t<CommentForm\n\t\t\t\tonSubmit={ async ( inputComment ) => {\n\t\t\t\t\tconst { id } = await onSubmit( { content: inputComment } );\n\t\t\t\t\tselectNote( id );\n\t\t\t\t\tfocusCommentThread( id, commentSidebarRef.current );\n\t\t\t\t} }\n\t\t\t\tonCancel={ unselectThread }\n\t\t\t\treflowComments={ reflowComments }\n\t\t\t\tsubmitButtonText={ __( 'Add note' ) }\n\t\t\t\tlabelText={ __( 'New note' ) }\n\t\t\t/>\n\t\t</VStack>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAIjB,kBAAmB;AACnB,kBAAuC;AACvC,wBAGO;AACP,0BAGO;AAKP,yBAAuB;AACvB,iCAA8B;AAC9B,0BAAwB;AACxB,mBAAyC;AACzC,mBAAqC;AAqCnC;AAnCF,IAAM,EAAE,gBAAgB,QAAI,2BAAQ,oBAAAA,WAAuB;AAEpD,SAAS,WAAY;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb;AAAA,EACA;AACD,GAAI;AACH,QAAM,EAAE,SAAS,QAAI,uBAAW,CAAE,WAAY;AAC7C,UAAM,EAAE,yBAAyB,IAAI,OAAQ,oBAAAC,KAAiB;AAC9D,WAAO;AAAA,MACN,UAAU,yBAAyB;AAAA,IACpC;AAAA,EACD,GAAG,CAAC,CAAE;AACN,QAAM,mBAAe;AAAA,IACpB,CAAE,eAAY,2BAAQ,OAAQ,aAAAC,KAAY,CAAE,EAAE,gBAAgB;AAAA,IAC9D,CAAC;AAAA,EACF;AACA,QAAM,eAAe,gBAAiB,QAAS;AAC/C,QAAM,EAAE,qBAAqB,QAAI,+BAAQ,yBAAa,oBAAAD,KAAiB,CAAE;AACzE,QAAM,EAAE,WAAW,QAAI,+BAAQ,yBAAa,aAAAC,KAAY,CAAE;AAE1D,QAAM,iBAAiB,MAAM;AAC5B,eAAY,MAAU;AACtB,kBAAc,MAAM;AACpB,yBAAsB,UAAU,KAAM;AAAA,EACvC;AAEA,MAAK,iBAAiB,SAAS,CAAE,UAAW;AAC3C,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC,kBAAAC;AAAA,IAAA;AAAA,MACA,eAAY,YAAAC;AAAA,QACX;AAAA,QACA;AAAA,UACC,eAAe;AAAA,QAChB;AAAA,MACD;AAAA,MACA,SAAQ;AAAA,MACR,UAAW;AAAA,MACX,kBAAa,gBAAI,UAAW;AAAA,MAC5B,MAAK;AAAA,MACL,KAAM,aAAa,KAAK,cAAc;AAAA,MACtC,OACC;AAAA;AAAA,QAEG,EAAE,KAAK,GAAG,SAAS,CAAE,IAAI,IAAI,OAAU;AAAA,UACvC;AAAA,MAEJ,QAAS,CAAE,UAAW;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport CommentAuthorInfo from './comment-author-info';\nimport CommentForm from './comment-form';\nimport { focusCommentThread, noop } from './utils';\nimport { store as editorStore } from '../../store';\n\nconst { useBlockElement } = unlock( blockEditorPrivateApis );\n\nexport function AddComment( {\n\tonSubmit,\n\tcommentSidebarRef,\n\treflowComments = noop,\n\tisFloating = false,\n\ty,\n\trefs,\n} ) {\n\tconst { clientId } = useSelect( ( select ) => {\n\t\tconst { getSelectedBlockClientId } = select( blockEditorStore );\n\t\treturn {\n\t\t\tclientId: getSelectedBlockClientId(),\n\t\t};\n\t}, [] );\n\tconst selectedNote = useSelect(\n\t\t( select ) => unlock( select( editorStore ) ).getSelectedNote(),\n\t\t[]\n\t);\n\tconst blockElement = useBlockElement( clientId );\n\tconst { toggleBlockSpotlight } = unlock( useDispatch( blockEditorStore ) );\n\tconst { selectNote } = unlock( useDispatch( editorStore ) );\n\n\tconst unselectThread = () => {\n\t\tselectNote( undefined );\n\t\tblockElement?.focus();\n\t\ttoggleBlockSpotlight( clientId, false );\n\t};\n\n\tif ( selectedNote !== 'new' || ! clientId ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-collab-sidebar-panel__thread is-selected',\n\t\t\t\t{\n\t\t\t\t\t'is-floating': isFloating,\n\t\t\t\t}\n\t\t\t) }\n\t\t\tspacing=\"3\"\n\t\t\ttabIndex={ 0 }\n\t\t\taria-label={ __( 'New note' ) }\n\t\t\trole=\"treeitem\"\n\t\t\tref={ isFloating ? refs.setFloating : undefined }\n\t\t\tstyle={\n\t\t\t\tisFloating\n\t\t\t\t\t? // Delay showing the floating note box until a Y position is known to prevent blink.\n\t\t\t\t\t { top: y, opacity: ! y ? 0 : undefined }\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\tonBlur={ ( event ) => {\n\t\t\t\t// Don't deselect notes when the browser window/tab loses focus.\n\t\t\t\tif ( ! document.hasFocus() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif ( event.currentTarget.contains( event.relatedTarget ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\ttoggleBlockSpotlight( clientId, false );\n\t\t\t\tselectNote( undefined );\n\t\t\t} }\n\t\t>\n\t\t\t<HStack alignment=\"left\" spacing=\"3\">\n\t\t\t\t<CommentAuthorInfo />\n\t\t\t</HStack>\n\t\t\t<CommentForm\n\t\t\t\tonSubmit={ async ( inputComment ) => {\n\t\t\t\t\tconst { id } = await onSubmit( { content: inputComment } );\n\t\t\t\t\tselectNote( id );\n\t\t\t\t\tfocusCommentThread( id, commentSidebarRef.current );\n\t\t\t\t} }\n\t\t\t\tonCancel={ unselectThread }\n\t\t\t\treflowComments={ reflowComments }\n\t\t\t\tsubmitButtonText={ __( 'Add note' ) }\n\t\t\t\tlabelText={ __( 'New note' ) }\n\t\t\t/>\n\t\t</VStack>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAIjB,kBAAmB;AACnB,kBAAuC;AACvC,wBAGO;AACP,0BAGO;AAKP,yBAAuB;AACvB,iCAA8B;AAC9B,0BAAwB;AACxB,mBAAyC;AACzC,mBAAqC;AAqCnC;AAnCF,IAAM,EAAE,gBAAgB,QAAI,2BAAQ,oBAAAA,WAAuB;AAEpD,SAAS,WAAY;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb;AAAA,EACA;AACD,GAAI;AACH,QAAM,EAAE,SAAS,QAAI,uBAAW,CAAE,WAAY;AAC7C,UAAM,EAAE,yBAAyB,IAAI,OAAQ,oBAAAC,KAAiB;AAC9D,WAAO;AAAA,MACN,UAAU,yBAAyB;AAAA,IACpC;AAAA,EACD,GAAG,CAAC,CAAE;AACN,QAAM,mBAAe;AAAA,IACpB,CAAE,eAAY,2BAAQ,OAAQ,aAAAC,KAAY,CAAE,EAAE,gBAAgB;AAAA,IAC9D,CAAC;AAAA,EACF;AACA,QAAM,eAAe,gBAAiB,QAAS;AAC/C,QAAM,EAAE,qBAAqB,QAAI,+BAAQ,yBAAa,oBAAAD,KAAiB,CAAE;AACzE,QAAM,EAAE,WAAW,QAAI,+BAAQ,yBAAa,aAAAC,KAAY,CAAE;AAE1D,QAAM,iBAAiB,MAAM;AAC5B,eAAY,MAAU;AACtB,kBAAc,MAAM;AACpB,yBAAsB,UAAU,KAAM;AAAA,EACvC;AAEA,MAAK,iBAAiB,SAAS,CAAE,UAAW;AAC3C,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC,kBAAAC;AAAA,IAAA;AAAA,MACA,eAAY,YAAAC;AAAA,QACX;AAAA,QACA;AAAA,UACC,eAAe;AAAA,QAChB;AAAA,MACD;AAAA,MACA,SAAQ;AAAA,MACR,UAAW;AAAA,MACX,kBAAa,gBAAI,UAAW;AAAA,MAC5B,MAAK;AAAA,MACL,KAAM,aAAa,KAAK,cAAc;AAAA,MACtC,OACC;AAAA;AAAA,QAEG,EAAE,KAAK,GAAG,SAAS,CAAE,IAAI,IAAI,OAAU;AAAA,UACvC;AAAA,MAEJ,QAAS,CAAE,UAAW;AAErB,YAAK,CAAE,SAAS,SAAS,GAAI;AAC5B;AAAA,QACD;AACA,YAAK,MAAM,cAAc,SAAU,MAAM,aAAc,GAAI;AAC1D;AAAA,QACD;AACA,6BAAsB,UAAU,KAAM;AACtC,mBAAY,MAAU;AAAA,MACvB;AAAA,MAEA;AAAA,oDAAC,kBAAAC,sBAAA,EAAO,WAAU,QAAO,SAAQ,KAChC,sDAAC,2BAAAC,SAAA,EAAkB,GACpB;AAAA,QACA;AAAA,UAAC,oBAAAC;AAAA,UAAA;AAAA,YACA,UAAW,OAAQ,iBAAkB;AACpC,oBAAM,EAAE,GAAG,IAAI,MAAM,SAAU,EAAE,SAAS,aAAa,CAAE;AACzD,yBAAY,EAAG;AACf,mDAAoB,IAAI,kBAAkB,OAAQ;AAAA,YACnD;AAAA,YACA,UAAW;AAAA,YACX;AAAA,YACA,sBAAmB,gBAAI,UAAW;AAAA,YAClC,eAAY,gBAAI,UAAW;AAAA;AAAA,QAC5B;AAAA;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": ["blockEditorPrivateApis", "blockEditorStore", "editorStore", "VStack", "clsx", "HStack", "CommentAuthorInfo", "CommentForm"]
|
|
7
7
|
}
|
|
@@ -376,6 +376,9 @@ function Thread({
|
|
|
376
376
|
toggleBlockHighlight(thread.blockClientId, true);
|
|
377
377
|
};
|
|
378
378
|
const onBlur = (event) => {
|
|
379
|
+
if (!document.hasFocus()) {
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
379
382
|
const isNoteFocused = event.relatedTarget?.closest(
|
|
380
383
|
".editor-collab-sidebar-panel__thread"
|
|
381
384
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/collab-sidebar/comments.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tRawHTML,\n\tuseEffect,\n\tuseCallback,\n\tuseMemo,\n\tuseRef,\n} from '@wordpress/element';\nimport {\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tButton,\n\tFlexItem,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useDebounce } from '@wordpress/compose';\n\nimport { published, moreVertical } from '@wordpress/icons';\nimport { __, _x, sprintf, _n } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport CommentAuthorInfo from './comment-author-info';\nimport CommentForm from './comment-form';\nimport { focusCommentThread, getCommentExcerpt } from './utils';\nimport { useFloatingThread } from './hooks';\nimport { AddComment } from './add-comment';\nimport { store as editorStore } from '../../store';\n\nconst { useBlockElement } = unlock( blockEditorPrivateApis );\nconst { Menu } = unlock( componentsPrivateApis );\n\nexport function Comments( {\n\tthreads: noteThreads,\n\tonEditComment,\n\tonAddReply,\n\tonCommentDelete,\n\tcommentSidebarRef,\n\treflowComments,\n\tisFloating = false,\n\tcommentLastUpdated,\n} ) {\n\tconst [ heights, setHeights ] = useState( {} );\n\tconst [ boardOffsets, setBoardOffsets ] = useState( {} );\n\tconst [ blockRefs, setBlockRefs ] = useState( {} );\n\n\tconst { setCanvasMinHeight, selectNote } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\tconst { selectBlock, toggleBlockSpotlight } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tconst { blockCommentId, selectedBlockClientId, orderedBlockIds } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetClientIdsWithDescendants,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst clientId = getSelectedBlockClientId();\n\t\t\treturn {\n\t\t\t\tblockCommentId: clientId\n\t\t\t\t\t? getBlockAttributes( clientId )?.metadata?.noteId\n\t\t\t\t\t: null,\n\t\t\t\tselectedBlockClientId: clientId,\n\t\t\t\torderedBlockIds: getClientIdsWithDescendants(),\n\t\t\t};\n\t\t}, [] );\n\tconst { selectedNote, noteFocused } = useSelect( ( select ) => {\n\t\tconst { getSelectedNote, isNoteFocused } = unlock(\n\t\t\tselect( editorStore )\n\t\t);\n\t\treturn {\n\t\t\tselectedNote: getSelectedNote(),\n\t\t\tnoteFocused: isNoteFocused(),\n\t\t};\n\t}, [] );\n\n\tconst relatedBlockElement = useBlockElement( selectedBlockClientId );\n\n\tconst threads = useMemo( () => {\n\t\tconst t = [ ...noteThreads ];\n\t\tconst orderedThreads = [];\n\t\t// In floating mode, when the note board is shown, and as long\n\t\t// as the selected block doesn't have an existing note attached -\n\t\t// add a \"new note\" entry to the threads. This special thread type\n\t\t// gets sorted and floated like regular threads, but shows an AddComment\n\t\t// component instead of a regular comment thread.\n\t\tif ( isFloating && selectedNote === 'new' ) {\n\t\t\t// Insert the new note entry at the correct location for its blockId.\n\t\t\tconst newNoteThread = {\n\t\t\t\tid: 'new',\n\t\t\t\tblockClientId: selectedBlockClientId,\n\t\t\t\tcontent: { rendered: '' },\n\t\t\t};\n\t\t\t// Insert the new comment block at the right order within the threads.\n\t\t\torderedBlockIds.forEach( ( blockId ) => {\n\t\t\t\tif ( blockId === selectedBlockClientId ) {\n\t\t\t\t\torderedThreads.push( newNoteThread );\n\t\t\t\t} else {\n\t\t\t\t\tconst threadForBlock = t.find(\n\t\t\t\t\t\t( thread ) => thread.blockClientId === blockId\n\t\t\t\t\t);\n\t\t\t\t\tif ( threadForBlock ) {\n\t\t\t\t\t\torderedThreads.push( threadForBlock );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\t\treturn orderedThreads;\n\t\t}\n\t\treturn t;\n\t}, [\n\t\tnoteThreads,\n\t\tisFloating,\n\t\tselectedNote,\n\t\tselectedBlockClientId,\n\t\torderedBlockIds,\n\t] );\n\n\tconst handleDelete = async ( comment ) => {\n\t\tconst currentIndex = threads.findIndex( ( t ) => t.id === comment.id );\n\t\tconst nextThread = threads[ currentIndex + 1 ];\n\t\tconst prevThread = threads[ currentIndex - 1 ];\n\n\t\tawait onCommentDelete( comment );\n\n\t\tif ( comment.parent !== 0 ) {\n\t\t\t// Move focus to the parent thread when a reply was deleted.\n\t\t\tselectNote( comment.parent );\n\t\t\tfocusCommentThread( comment.parent, commentSidebarRef.current );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( nextThread ) {\n\t\t\tselectNote( nextThread.id );\n\t\t\tfocusCommentThread( nextThread.id, commentSidebarRef.current );\n\t\t} else if ( prevThread ) {\n\t\t\tselectNote( prevThread.id );\n\t\t\tfocusCommentThread( prevThread.id, commentSidebarRef.current );\n\t\t} else {\n\t\t\tselectNote( undefined );\n\t\t\ttoggleBlockSpotlight( comment.blockClientId, false );\n\t\t\t// Move focus to the related block.\n\t\t\trelatedBlockElement?.focus();\n\t\t}\n\t};\n\n\t// Auto-select the related comment thread when a block is selected.\n\tuseEffect( () => {\n\t\tselectNote( blockCommentId ?? undefined );\n\t}, [ blockCommentId, selectNote ] );\n\n\t// Focus the selected note when requested.\n\tuseEffect( () => {\n\t\tif ( noteFocused && selectedNote ) {\n\t\t\tfocusCommentThread(\n\t\t\t\tselectedNote,\n\t\t\t\tcommentSidebarRef.current,\n\t\t\t\tselectedNote === 'new' ? 'textarea' : undefined\n\t\t\t);\n\t\t\t// Clear focus flag to avoid re-triggering.\n\t\t\tselectNote( selectedNote );\n\t\t}\n\t}, [ noteFocused, selectedNote, selectNote, commentSidebarRef ] );\n\n\t// Recalculate floating comment thread offsets whenever the heights change.\n\tuseEffect( () => {\n\t\t/**\n\t\t * Calculate the y offsets for all comment threads. Account for potentially\n\t\t * overlapping threads and adjust their positions accordingly.\n\t\t */\n\t\tconst calculateAllOffsets = () => {\n\t\t\tconst offsets = {};\n\n\t\t\tif ( ! isFloating ) {\n\t\t\t\treturn { offsets, minHeight: 0 };\n\t\t\t}\n\n\t\t\t// Find the index of the selected thread.\n\t\t\tconst selectedThreadIndex = threads.findIndex(\n\t\t\t\t( t ) => t.id === selectedNote\n\t\t\t);\n\n\t\t\tconst breakIndex =\n\t\t\t\tselectedThreadIndex === -1 ? 0 : selectedThreadIndex;\n\n\t\t\t// If there is a selected thread, push threads above up and threads below down.\n\t\t\tconst selectedThreadData = threads[ breakIndex ];\n\n\t\t\tif (\n\t\t\t\t! selectedThreadData ||\n\t\t\t\t! blockRefs[ selectedThreadData.id ]\n\t\t\t) {\n\t\t\t\treturn { offsets, minHeight: 0 };\n\t\t\t}\n\n\t\t\tlet blockElement = blockRefs[ selectedThreadData.id ];\n\t\t\tlet blockRect = blockElement?.getBoundingClientRect();\n\t\t\tconst selectedThreadTop = blockRect?.top || 0;\n\t\t\tconst selectedThreadHeight = heights[ selectedThreadData.id ] || 0;\n\n\t\t\toffsets[ selectedThreadData.id ] = -16;\n\n\t\t\tlet previousThreadData = {\n\t\t\t\tthreadTop: selectedThreadTop - 16,\n\t\t\t\tthreadHeight: selectedThreadHeight,\n\t\t\t};\n\n\t\t\t// Process threads after the selected thread, offsetting any overlapping\n\t\t\t// threads downward.\n\t\t\tfor ( let i = breakIndex + 1; i < threads.length; i++ ) {\n\t\t\t\tconst thread = threads[ i ];\n\t\t\t\tif ( ! blockRefs[ thread.id ] ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tblockElement = blockRefs[ thread.id ];\n\t\t\t\tblockRect = blockElement?.getBoundingClientRect();\n\t\t\t\tconst threadTop = blockRect?.top || 0;\n\t\t\t\tconst threadHeight = heights[ thread.id ] || 0;\n\n\t\t\t\tlet additionalOffset = -16;\n\n\t\t\t\t// Check if the thread overlaps with the previous one.\n\t\t\t\tconst previousBottom =\n\t\t\t\t\tpreviousThreadData.threadTop +\n\t\t\t\t\tpreviousThreadData.threadHeight;\n\t\t\t\tif ( threadTop < previousBottom + 16 ) {\n\t\t\t\t\t// Shift down by the difference plus a margin to avoid overlap.\n\t\t\t\t\tadditionalOffset = previousBottom - threadTop + 20;\n\t\t\t\t}\n\n\t\t\t\toffsets[ thread.id ] = additionalOffset;\n\n\t\t\t\t// Update for next iteration.\n\t\t\t\tpreviousThreadData = {\n\t\t\t\t\tthreadTop: threadTop + additionalOffset,\n\t\t\t\t\tthreadHeight,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Process threads before the selected thread, offsetting any overlapping\n\t\t\t// threads upward.\n\t\t\tlet nextThreadData = {\n\t\t\t\tthreadTop: selectedThreadTop - 16,\n\t\t\t};\n\n\t\t\tfor ( let i = selectedThreadIndex - 1; i >= 0; i-- ) {\n\t\t\t\tconst thread = threads[ i ];\n\t\t\t\tif ( ! blockRefs[ thread.id ] ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tblockElement = blockRefs[ thread.id ];\n\t\t\t\tblockRect = blockElement?.getBoundingClientRect();\n\t\t\t\tconst threadTop = blockRect?.top || 0;\n\t\t\t\tconst threadHeight = heights[ thread.id ] || 0;\n\n\t\t\t\tlet additionalOffset = -16;\n\n\t\t\t\t// Calculate the bottom position of this thread with default offset.\n\t\t\t\tconst threadBottom = threadTop + threadHeight;\n\n\t\t\t\t// Check if this thread's bottom would overlap with the next thread's top.\n\t\t\t\tif ( threadBottom > nextThreadData.threadTop ) {\n\t\t\t\t\t// Shift up by the difference plus a margin to avoid overlap.\n\t\t\t\t\tadditionalOffset =\n\t\t\t\t\t\tnextThreadData.threadTop -\n\t\t\t\t\t\tthreadTop -\n\t\t\t\t\t\tthreadHeight -\n\t\t\t\t\t\t20;\n\t\t\t\t}\n\n\t\t\t\toffsets[ thread.id ] = additionalOffset;\n\n\t\t\t\t// Update for next iteration (going upward).\n\t\t\t\tnextThreadData = {\n\t\t\t\t\tthreadTop: threadTop + additionalOffset,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tlet editorMinHeight = 0;\n\t\t\t// Take the calculated top of the final note plus its height as the editor min height.\n\t\t\tconst lastThread = threads[ threads.length - 1 ];\n\t\t\tif ( blockRefs[ lastThread.id ] ) {\n\t\t\t\tconst lastBlockElement = blockRefs[ lastThread.id ];\n\t\t\t\tconst lastBlockRect = lastBlockElement?.getBoundingClientRect();\n\t\t\t\tconst lastThreadTop = lastBlockRect?.top || 0;\n\t\t\t\tconst lastThreadHeight = heights[ lastThread.id ] || 0;\n\t\t\t\tconst lastThreadOffset = offsets[ lastThread.id ] || 0;\n\t\t\t\teditorMinHeight =\n\t\t\t\t\tlastThreadTop + lastThreadHeight + lastThreadOffset + 32;\n\t\t\t}\n\n\t\t\treturn { offsets, minHeight: editorMinHeight };\n\t\t};\n\t\tconst { offsets: newOffsets, minHeight } = calculateAllOffsets();\n\t\tif ( Object.keys( newOffsets ).length > 0 ) {\n\t\t\tsetBoardOffsets( newOffsets );\n\t\t}\n\t\t// Ensure the editor has enough height to scroll to all notes.\n\t\tsetCanvasMinHeight( minHeight );\n\t}, [\n\t\theights,\n\t\tblockRefs,\n\t\tisFloating,\n\t\tthreads,\n\t\tselectedNote,\n\t\tsetCanvasMinHeight,\n\t] );\n\n\tconst handleThreadNavigation = ( event, thread, isSelected ) => {\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentIndex = threads.findIndex( ( t ) => t.id === thread.id );\n\n\t\tif (\n\t\t\t( event.key === 'Enter' || event.key === 'ArrowRight' ) &&\n\t\t\tevent.currentTarget === event.target &&\n\t\t\t! isSelected\n\t\t) {\n\t\t\t// Expand thread.\n\t\t\tselectNote( thread.id );\n\t\t\tif ( !! thread.blockClientId ) {\n\t\t\t\t// Pass `null` as the second parameter to prevent focusing the block.\n\t\t\t\tselectBlock( thread.blockClientId, null );\n\t\t\t\ttoggleBlockSpotlight( thread.blockClientId, true );\n\t\t\t}\n\t\t} else if (\n\t\t\t( ( event.key === 'Enter' || event.key === 'ArrowLeft' ) &&\n\t\t\t\tevent.currentTarget === event.target &&\n\t\t\t\tisSelected ) ||\n\t\t\tevent.key === 'Escape'\n\t\t) {\n\t\t\t// Collapse thread.\n\t\t\tselectNote( undefined );\n\t\t\tif ( thread.blockClientId ) {\n\t\t\t\ttoggleBlockSpotlight( thread.blockClientId, false );\n\t\t\t}\n\t\t\tfocusCommentThread( thread.id, commentSidebarRef.current );\n\t\t} else if (\n\t\t\tevent.key === 'ArrowDown' &&\n\t\t\tcurrentIndex < threads.length - 1 &&\n\t\t\tevent.currentTarget === event.target\n\t\t) {\n\t\t\t// Move to the next thread.\n\t\t\tconst nextThread = threads[ currentIndex + 1 ];\n\t\t\tfocusCommentThread( nextThread.id, commentSidebarRef.current );\n\t\t} else if (\n\t\t\tevent.key === 'ArrowUp' &&\n\t\t\tcurrentIndex > 0 &&\n\t\t\tevent.currentTarget === event.target\n\t\t) {\n\t\t\t// Move to the previous thread.\n\t\t\tconst prevThread = threads[ currentIndex - 1 ];\n\t\t\tfocusCommentThread( prevThread.id, commentSidebarRef.current );\n\t\t} else if (\n\t\t\tevent.key === 'Home' &&\n\t\t\tevent.currentTarget === event.target\n\t\t) {\n\t\t\t// Move to the first thread.\n\t\t\tfocusCommentThread( threads[ 0 ].id, commentSidebarRef.current );\n\t\t} else if (\n\t\t\tevent.key === 'End' &&\n\t\t\tevent.currentTarget === event.target\n\t\t) {\n\t\t\t// Move to the last thread.\n\t\t\tfocusCommentThread(\n\t\t\t\tthreads[ threads.length - 1 ].id,\n\t\t\t\tcommentSidebarRef.current\n\t\t\t);\n\t\t}\n\t};\n\n\tconst setBlockRef = useCallback( ( id, blockRef ) => {\n\t\tsetBlockRefs( ( prev ) => ( { ...prev, [ id ]: blockRef } ) );\n\t}, [] );\n\n\tconst hasThreads = Array.isArray( threads ) && threads.length > 0;\n\t// A special case for `template-locked` mode - https://github.com/WordPress/gutenberg/pull/72646.\n\tif ( ! hasThreads && ! isFloating ) {\n\t\treturn (\n\t\t\t<AddComment\n\t\t\t\tonSubmit={ onAddReply }\n\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ ! isFloating && selectedNote === 'new' && (\n\t\t\t\t<AddComment\n\t\t\t\t\tonSubmit={ onAddReply }\n\t\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ threads.map( ( thread ) => (\n\t\t\t\t<Thread\n\t\t\t\t\tkey={ thread.id }\n\t\t\t\t\tthread={ thread }\n\t\t\t\t\tonAddReply={ onAddReply }\n\t\t\t\t\tonCommentDelete={ handleDelete }\n\t\t\t\t\tonEditComment={ onEditComment }\n\t\t\t\t\tisSelected={ selectedNote === thread.id }\n\t\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t\tisFloating={ isFloating }\n\t\t\t\t\tcalculatedOffset={ boardOffsets[ thread.id ] ?? 0 }\n\t\t\t\t\tsetHeights={ setHeights }\n\t\t\t\t\tsetBlockRef={ setBlockRef }\n\t\t\t\t\tcommentLastUpdated={ commentLastUpdated }\n\t\t\t\t\tonKeyDown={ ( event ) =>\n\t\t\t\t\t\thandleThreadNavigation(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\tthread,\n\t\t\t\t\t\t\tselectedNote === thread.id\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</>\n\t);\n}\n\nfunction Thread( {\n\tthread,\n\tonEditComment,\n\tonAddReply,\n\tonCommentDelete,\n\tisSelected,\n\tcommentSidebarRef,\n\treflowComments,\n\tisFloating,\n\tcalculatedOffset,\n\tsetHeights,\n\tsetBlockRef,\n\tcommentLastUpdated,\n\tonKeyDown,\n} ) {\n\tconst { toggleBlockHighlight, selectBlock, toggleBlockSpotlight } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tconst { selectNote } = unlock( useDispatch( editorStore ) );\n\tconst selectedNote = useSelect(\n\t\t( select ) => unlock( select( editorStore ) ).getSelectedNote(),\n\t\t[]\n\t);\n\tconst relatedBlockElement = useBlockElement( thread.blockClientId );\n\tconst debouncedToggleBlockHighlight = useDebounce(\n\t\ttoggleBlockHighlight,\n\t\t50\n\t);\n\tconst { y, refs } = useFloatingThread( {\n\t\tthread,\n\t\tcalculatedOffset,\n\t\tsetHeights,\n\t\tsetBlockRef,\n\t\tselectedThread: selectedNote,\n\t\tcommentLastUpdated,\n\t} );\n\tconst isKeyboardTabbingRef = useRef( false );\n\n\tconst onMouseEnter = () => {\n\t\tdebouncedToggleBlockHighlight( thread.blockClientId, true );\n\t};\n\n\tconst onMouseLeave = () => {\n\t\tdebouncedToggleBlockHighlight( thread.blockClientId, false );\n\t};\n\n\tconst onFocus = () => {\n\t\ttoggleBlockHighlight( thread.blockClientId, true );\n\t};\n\n\tconst onBlur = ( event ) => {\n\t\tconst isNoteFocused = event.relatedTarget?.closest(\n\t\t\t'.editor-collab-sidebar-panel__thread'\n\t\t);\n\t\tconst isDialogFocused =\n\t\t\tevent.relatedTarget?.closest( '[role=\"dialog\"]' );\n\t\tconst isTabbing = isKeyboardTabbingRef.current;\n\n\t\t// When another note is clicked, do nothing because the current note is automatically closed.\n\t\tif ( isNoteFocused && ! isTabbing ) {\n\t\t\treturn;\n\t\t}\n\t\t// When deleting a note, a dialog appears, but the note should not be collapsed.\n\t\tif ( isDialogFocused ) {\n\t\t\treturn;\n\t\t}\n\t\t// When tabbing, do nothing if the focus is within the current note.\n\t\tif (\n\t\t\tisTabbing &&\n\t\t\tevent.currentTarget.contains( event.relatedTarget )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Closes a note that has lost focus when any of the following conditions are met:\n\t\t// - An element other than a note is clicked.\n\t\t// - Focus was lost by tabbing.\n\t\ttoggleBlockHighlight( thread.blockClientId, false );\n\t\tunselectThread();\n\t};\n\n\tconst handleCommentSelect = () => {\n\t\tselectNote( thread.id );\n\t\ttoggleBlockSpotlight( thread.blockClientId, true );\n\t\tif ( !! thread.blockClientId ) {\n\t\t\t// Pass `null` as the second parameter to prevent focusing the block.\n\t\t\tselectBlock( thread.blockClientId, null );\n\t\t}\n\t};\n\n\tconst unselectThread = () => {\n\t\tselectNote( undefined );\n\t\ttoggleBlockSpotlight( thread.blockClientId, false );\n\t};\n\n\tconst allReplies = thread?.reply || [];\n\tconst lastReply =\n\t\tallReplies.length > 0 ? allReplies[ allReplies.length - 1 ] : undefined;\n\tconst restReplies = allReplies.length > 0 ? allReplies.slice( 0, -1 ) : [];\n\n\tconst commentExcerpt = getCommentExcerpt(\n\t\tstripHTML( thread.content?.rendered ),\n\t\t10\n\t);\n\tconst ariaLabel = !! thread.blockClientId\n\t\t? sprintf(\n\t\t\t\t// translators: %s: note excerpt\n\t\t\t\t__( 'Note: %s' ),\n\t\t\t\tcommentExcerpt\n\t\t )\n\t\t: sprintf(\n\t\t\t\t// translators: %s: note excerpt\n\t\t\t\t__( 'Original block deleted. Note: %s' ),\n\t\t\t\tcommentExcerpt\n\t\t );\n\n\tif ( isFloating && thread.id === 'new' ) {\n\t\treturn (\n\t\t\t<AddComment\n\t\t\t\tonSubmit={ onAddReply }\n\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\treflowComments={ reflowComments }\n\t\t\t\tisFloating={ isFloating }\n\t\t\t\ty={ y }\n\t\t\t\trefs={ refs }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<VStack\n\t\t\tclassName={ clsx( 'editor-collab-sidebar-panel__thread', {\n\t\t\t\t'is-selected': isSelected,\n\t\t\t\t'is-floating': isFloating,\n\t\t\t} ) }\n\t\t\tid={ `comment-thread-${ thread.id }` }\n\t\t\tspacing=\"3\"\n\t\t\tonClick={ handleCommentSelect }\n\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\tonFocus={ onFocus }\n\t\t\tonBlur={ onBlur }\n\t\t\tonKeyUp={ ( event ) => {\n\t\t\t\tif ( event.key === 'Tab' ) {\n\t\t\t\t\tisKeyboardTabbingRef.current = false;\n\t\t\t\t}\n\t\t\t} }\n\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\tif ( event.key === 'Tab' ) {\n\t\t\t\t\tisKeyboardTabbingRef.current = true;\n\t\t\t\t} else {\n\t\t\t\t\tonKeyDown( event );\n\t\t\t\t}\n\t\t\t} }\n\t\t\ttabIndex={ 0 }\n\t\t\trole=\"treeitem\"\n\t\t\taria-label={ ariaLabel }\n\t\t\taria-expanded={ isSelected }\n\t\t\tref={ isFloating ? refs.setFloating : undefined }\n\t\t\tstyle={ isFloating ? { top: y } : undefined }\n\t\t>\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-collab-sidebar-panel__skip-to-comment\"\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tsize=\"compact\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tfocusCommentThread(\n\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\tcommentSidebarRef.current,\n\t\t\t\t\t\t'textarea'\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Add new reply' ) }\n\t\t\t</Button>\n\t\t\t{ ! thread.blockClientId && (\n\t\t\t\t<Text as=\"p\" weight={ 500 } variant=\"muted\">\n\t\t\t\t\t{ __( 'Original block deleted.' ) }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t\t<CommentBoard\n\t\t\t\tthread={ thread }\n\t\t\t\tisExpanded={ isSelected }\n\t\t\t\tonEdit={ ( params = {} ) => {\n\t\t\t\t\tonEditComment( params );\n\t\t\t\t\tif ( params.status === 'approved' ) {\n\t\t\t\t\t\tunselectThread();\n\t\t\t\t\t\tif ( isFloating ) {\n\t\t\t\t\t\t\trelatedBlockElement?.focus();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfocusCommentThread(\n\t\t\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\t\t\tcommentSidebarRef.current\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\tonDelete={ onCommentDelete }\n\t\t\t\treflowComments={ reflowComments }\n\t\t\t/>\n\t\t\t{ isSelected &&\n\t\t\t\tallReplies.map( ( reply ) => (\n\t\t\t\t\t<CommentBoard\n\t\t\t\t\t\tkey={ reply.id }\n\t\t\t\t\t\tthread={ reply }\n\t\t\t\t\t\tparent={ thread }\n\t\t\t\t\t\tisExpanded={ isSelected }\n\t\t\t\t\t\tonEdit={ onEditComment }\n\t\t\t\t\t\tonDelete={ onCommentDelete }\n\t\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t{ ! isSelected && restReplies.length > 0 && (\n\t\t\t\t<HStack className=\"editor-collab-sidebar-panel__more-reply-separator\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__more-reply-button\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tselectNote( thread.id );\n\t\t\t\t\t\t\tfocusCommentThread(\n\t\t\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\t\t\tcommentSidebarRef.current\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\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %s: number of replies.\n\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t'%s more reply',\n\t\t\t\t\t\t\t\t'%s more replies',\n\t\t\t\t\t\t\t\trestReplies.length\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\trestReplies.length\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t\t{ ! isSelected && lastReply && (\n\t\t\t\t<CommentBoard\n\t\t\t\t\tthread={ lastReply }\n\t\t\t\t\tparent={ thread }\n\t\t\t\t\tisExpanded={ isSelected }\n\t\t\t\t\tonEdit={ onEditComment }\n\t\t\t\t\tonDelete={ onCommentDelete }\n\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isSelected && (\n\t\t\t\t<VStack spacing=\"2\" role=\"treeitem\">\n\t\t\t\t\t<HStack alignment=\"left\" spacing=\"3\" justify=\"flex-start\">\n\t\t\t\t\t\t<CommentAuthorInfo />\n\t\t\t\t\t</HStack>\n\t\t\t\t\t<VStack spacing=\"2\">\n\t\t\t\t\t\t<CommentForm\n\t\t\t\t\t\t\tonSubmit={ ( inputComment ) => {\n\t\t\t\t\t\t\t\tif ( 'approved' === thread.status ) {\n\t\t\t\t\t\t\t\t\t// For reopening, include the content in the reopen action.\n\t\t\t\t\t\t\t\t\tonEditComment( {\n\t\t\t\t\t\t\t\t\t\tid: thread.id,\n\t\t\t\t\t\t\t\t\t\tstatus: 'hold',\n\t\t\t\t\t\t\t\t\t\tcontent: inputComment,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// For regular replies, add as separate comment.\n\t\t\t\t\t\t\t\t\tonAddReply( {\n\t\t\t\t\t\t\t\t\t\tcontent: inputComment,\n\t\t\t\t\t\t\t\t\t\tparent: thread.id,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonCancel={ ( event ) => {\n\t\t\t\t\t\t\t\t// Prevent the parent onClick from being triggered.\n\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\tunselectThread();\n\t\t\t\t\t\t\t\tfocusCommentThread(\n\t\t\t\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\t\t\t\tcommentSidebarRef.current\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsubmitButtonText={\n\t\t\t\t\t\t\t\t'approved' === thread.status\n\t\t\t\t\t\t\t\t\t? __( 'Reopen & Reply' )\n\t\t\t\t\t\t\t\t\t: __( 'Reply' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\trows={ 'approved' === thread.status ? 2 : 4 }\n\t\t\t\t\t\t\tlabelText={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %1$s: note identifier, %2$s: author name\n\t\t\t\t\t\t\t\t__( 'Reply to note %1$s by %2$s' ),\n\t\t\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\t\t\tthread.author_name\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\n\t\t\t\t</VStack>\n\t\t\t) }\n\t\t\t{ !! thread.blockClientId && (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__skip-to-block\"\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\trelatedBlockElement?.focus();\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Back to block' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nconst CommentBoard = ( {\n\tthread,\n\tparent,\n\tisExpanded,\n\tonEdit,\n\tonDelete,\n\treflowComments,\n} ) => {\n\tconst [ actionState, setActionState ] = useState( false );\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\tconst actionButtonRef = useRef( null );\n\tconst handleConfirmDelete = () => {\n\t\tonDelete( thread );\n\t\tsetActionState( false );\n\t\tsetShowConfirmDialog( false );\n\t};\n\n\tconst handleCancel = () => {\n\t\tsetActionState( false );\n\t\tsetShowConfirmDialog( false );\n\t\tactionButtonRef.current?.focus();\n\t};\n\n\t// Check if this is a resolution comment by checking metadata.\n\tconst isResolutionComment =\n\t\tthread.type === 'note' &&\n\t\tthread.meta &&\n\t\t( thread.meta._wp_note_status === 'resolved' ||\n\t\t\tthread.meta._wp_note_status === 'reopen' );\n\n\tconst actions = [\n\t\t{\n\t\t\tid: 'edit',\n\t\t\ttitle: __( 'Edit' ),\n\t\t\tisEligible: ( { status } ) => status !== 'approved',\n\t\t\tonClick: () => {\n\t\t\t\tsetActionState( 'edit' );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: 'reopen',\n\t\t\ttitle: _x( 'Reopen', 'Reopen note' ),\n\t\t\tisEligible: ( { status } ) => status === 'approved',\n\t\t\tonClick: () => {\n\t\t\t\tonEdit( { id: thread.id, status: 'hold' } );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: 'delete',\n\t\t\ttitle: __( 'Delete' ),\n\t\t\tisEligible: () => true,\n\t\t\tonClick: () => {\n\t\t\t\tsetActionState( 'delete' );\n\t\t\t\tsetShowConfirmDialog( true );\n\t\t\t},\n\t\t},\n\t];\n\n\tconst canResolve = thread.parent === 0;\n\tconst moreActions =\n\t\tparent?.status !== 'approved'\n\t\t\t? actions.filter( ( item ) => item.isEligible( thread ) )\n\t\t\t: [];\n\n\tconst deleteConfirmMessage =\n\t\t// When deleting a top level note, descendants will also be deleted.\n\t\tthread.parent === 0\n\t\t\t? __(\n\t\t\t\t\t\"Are you sure you want to delete this note? This will also delete all of this note's replies.\"\n\t\t\t )\n\t\t\t: __( 'Are you sure you want to delete this reply?' );\n\n\treturn (\n\t\t<VStack\n\t\t\tspacing=\"2\"\n\t\t\trole={ thread.parent !== 0 ? 'treeitem' : undefined }\n\t\t>\n\t\t\t<HStack alignment=\"left\" spacing=\"3\" justify=\"flex-start\">\n\t\t\t\t<CommentAuthorInfo\n\t\t\t\t\tavatar={ thread?.author_avatar_urls?.[ 48 ] }\n\t\t\t\t\tname={ thread?.author_name }\n\t\t\t\t\tdate={ thread?.date }\n\t\t\t\t\tuserId={ thread?.author }\n\t\t\t\t/>\n\t\t\t\t{ isExpanded && (\n\t\t\t\t\t<FlexItem\n\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__comment-status\"\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\t// Prevent the thread from being selected.\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<HStack spacing=\"0\">\n\t\t\t\t\t\t\t{ canResolve && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t\t'Resolve',\n\t\t\t\t\t\t\t\t\t\t'Mark note as resolved'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\ticon={ published }\n\t\t\t\t\t\t\t\t\tdisabled={ thread.status === 'approved' }\n\t\t\t\t\t\t\t\t\taccessibleWhenDisabled={\n\t\t\t\t\t\t\t\t\t\tthread.status === 'approved'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonEdit( {\n\t\t\t\t\t\t\t\t\t\t\tid: thread.id,\n\t\t\t\t\t\t\t\t\t\t\tstatus: 'approved',\n\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/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<Menu placement=\"bottom-end\">\n\t\t\t\t\t\t\t\t<Menu.TriggerButton\n\t\t\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tref={ actionButtonRef }\n\t\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\t\t\t\t\t\t\tdisabled={ ! moreActions.length }\n\t\t\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\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/>\n\t\t\t\t\t\t\t\t<Menu.Popover\n\t\t\t\t\t\t\t\t\t// The menu popover is rendered in a portal, which causes focus to be\n\t\t\t\t\t\t\t\t\t// lost and the note to be collapsed unintentionally. To prevent this,\n\t\t\t\t\t\t\t\t\t// the popover should be rendered as an inline.\n\t\t\t\t\t\t\t\t\tmodal={ false }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ moreActions.map( ( action ) => (\n\t\t\t\t\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => action.onClick() }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t\t\t{ action.title }\n\t\t\t\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t</Menu.Popover>\n\t\t\t\t\t\t\t</Menu>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t\t{ 'edit' === actionState ? (\n\t\t\t\t<CommentForm\n\t\t\t\t\tonSubmit={ ( value ) => {\n\t\t\t\t\t\tonEdit( {\n\t\t\t\t\t\t\tid: thread.id,\n\t\t\t\t\t\t\tcontent: value,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetActionState( false );\n\t\t\t\t\t\tactionButtonRef.current?.focus();\n\t\t\t\t\t} }\n\t\t\t\t\tonCancel={ () => handleCancel() }\n\t\t\t\t\tthread={ thread }\n\t\t\t\t\tsubmitButtonText={ _x( 'Update', 'verb' ) }\n\t\t\t\t\tlabelText={ sprintf(\n\t\t\t\t\t\t// translators: %1$s: note identifier, %2$s: author name.\n\t\t\t\t\t\t__( 'Edit note %1$s by %2$s' ),\n\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\tthread.author_name\n\t\t\t\t\t) }\n\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<RawHTML\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'editor-collab-sidebar-panel__user-comment',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'editor-collab-sidebar-panel__resolution-text':\n\t\t\t\t\t\t\t\tisResolutionComment,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ isResolutionComment\n\t\t\t\t\t\t? ( () => {\n\t\t\t\t\t\t\t\tconst actionText =\n\t\t\t\t\t\t\t\t\tthread.meta._wp_note_status === 'resolved'\n\t\t\t\t\t\t\t\t\t\t? __( 'Marked as resolved' )\n\t\t\t\t\t\t\t\t\t\t: __( 'Reopened' );\n\t\t\t\t\t\t\t\tconst content = thread?.content?.raw;\n\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tcontent &&\n\t\t\t\t\t\t\t\t\ttypeof content === 'string' &&\n\t\t\t\t\t\t\t\t\tcontent.trim() !== ''\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\treturn sprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %1$s: action label (\"Marked as resolved\" or \"Reopened\"); %2$s: note text.\n\t\t\t\t\t\t\t\t\t\t__( '%1$s: %2$s' ),\n\t\t\t\t\t\t\t\t\t\tactionText,\n\t\t\t\t\t\t\t\t\t\tcontent\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// If no content, just show the action.\n\t\t\t\t\t\t\t\treturn actionText;\n\t\t\t\t\t\t } )()\n\t\t\t\t\t\t: thread?.content?.rendered }\n\t\t\t\t</RawHTML>\n\t\t\t) }\n\t\t\t{ 'delete' === actionState && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\tisOpen={ showConfirmDialog }\n\t\t\t\t\tonConfirm={ handleConfirmDelete }\n\t\t\t\t\tonCancel={ handleCancel }\n\t\t\t\t\tconfirmButtonText={ __( 'Delete' ) }\n\t\t\t\t>\n\t\t\t\t\t{ deleteConfirmMessage }\n\t\t\t\t</ConfirmDialog>\n\t\t\t) }\n\t\t</VStack>\n\t);\n};\n\nexport default Comments;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAOO;AACP,wBAQO;AACP,qBAA4B;AAE5B,mBAAwC;AACxC,kBAAoC;AACpC,kBAAuC;AACvC,iBAAiD;AACjD,0BAGO;AAKP,yBAAuB;AACvB,iCAA8B;AAC9B,0BAAwB;AACxB,mBAAsD;AACtD,mBAAkC;AAClC,yBAA2B;AAC3B,mBAAqC;AAsWlC;AApWH,IAAM,EAAE,gBAAgB,QAAI,2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AACR,oBAAM,aACL,OAAO,KAAK,oBAAoB,iBAC7B,gBAAI,oBAAqB,QACzB,gBAAI,UAAW;AACnB,oBAAM,UAAU,QAAQ,SAAS;AAEjC,kBACC,WACA,OAAO,YAAY,YACnB,QAAQ,KAAK,MAAM,IAClB;AACD,2BAAO;AAAA;AAAA,sBAEN,gBAAI,YAAa;AAAA,kBACjB;AAAA,kBACA;AAAA,gBACD;AAAA,cACD;AAEA,qBAAO;AAAA,YACP,GAAI,IACJ,QAAQ,SAAS;AAAA;AAAA,QACrB;AAAA,QAEC,aAAa,eACd;AAAA,UAAC,kBAAAK;AAAA,UAAA;AAAA,YACA,QAAS;AAAA,YACT,WAAY;AAAA,YACZ,UAAW;AAAA,YACX,uBAAoB,gBAAI,QAAS;AAAA,YAE/B;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EAEF;AAEF;AAEA,IAAO,mBAAQ;",
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tRawHTML,\n\tuseEffect,\n\tuseCallback,\n\tuseMemo,\n\tuseRef,\n} from '@wordpress/element';\nimport {\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tButton,\n\tFlexItem,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useDebounce } from '@wordpress/compose';\n\nimport { published, moreVertical } from '@wordpress/icons';\nimport { __, _x, sprintf, _n } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport CommentAuthorInfo from './comment-author-info';\nimport CommentForm from './comment-form';\nimport { focusCommentThread, getCommentExcerpt } from './utils';\nimport { useFloatingThread } from './hooks';\nimport { AddComment } from './add-comment';\nimport { store as editorStore } from '../../store';\n\nconst { useBlockElement } = unlock( blockEditorPrivateApis );\nconst { Menu } = unlock( componentsPrivateApis );\n\nexport function Comments( {\n\tthreads: noteThreads,\n\tonEditComment,\n\tonAddReply,\n\tonCommentDelete,\n\tcommentSidebarRef,\n\treflowComments,\n\tisFloating = false,\n\tcommentLastUpdated,\n} ) {\n\tconst [ heights, setHeights ] = useState( {} );\n\tconst [ boardOffsets, setBoardOffsets ] = useState( {} );\n\tconst [ blockRefs, setBlockRefs ] = useState( {} );\n\n\tconst { setCanvasMinHeight, selectNote } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\tconst { selectBlock, toggleBlockSpotlight } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tconst { blockCommentId, selectedBlockClientId, orderedBlockIds } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\tgetClientIdsWithDescendants,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst clientId = getSelectedBlockClientId();\n\t\t\treturn {\n\t\t\t\tblockCommentId: clientId\n\t\t\t\t\t? getBlockAttributes( clientId )?.metadata?.noteId\n\t\t\t\t\t: null,\n\t\t\t\tselectedBlockClientId: clientId,\n\t\t\t\torderedBlockIds: getClientIdsWithDescendants(),\n\t\t\t};\n\t\t}, [] );\n\tconst { selectedNote, noteFocused } = useSelect( ( select ) => {\n\t\tconst { getSelectedNote, isNoteFocused } = unlock(\n\t\t\tselect( editorStore )\n\t\t);\n\t\treturn {\n\t\t\tselectedNote: getSelectedNote(),\n\t\t\tnoteFocused: isNoteFocused(),\n\t\t};\n\t}, [] );\n\n\tconst relatedBlockElement = useBlockElement( selectedBlockClientId );\n\n\tconst threads = useMemo( () => {\n\t\tconst t = [ ...noteThreads ];\n\t\tconst orderedThreads = [];\n\t\t// In floating mode, when the note board is shown, and as long\n\t\t// as the selected block doesn't have an existing note attached -\n\t\t// add a \"new note\" entry to the threads. This special thread type\n\t\t// gets sorted and floated like regular threads, but shows an AddComment\n\t\t// component instead of a regular comment thread.\n\t\tif ( isFloating && selectedNote === 'new' ) {\n\t\t\t// Insert the new note entry at the correct location for its blockId.\n\t\t\tconst newNoteThread = {\n\t\t\t\tid: 'new',\n\t\t\t\tblockClientId: selectedBlockClientId,\n\t\t\t\tcontent: { rendered: '' },\n\t\t\t};\n\t\t\t// Insert the new comment block at the right order within the threads.\n\t\t\torderedBlockIds.forEach( ( blockId ) => {\n\t\t\t\tif ( blockId === selectedBlockClientId ) {\n\t\t\t\t\torderedThreads.push( newNoteThread );\n\t\t\t\t} else {\n\t\t\t\t\tconst threadForBlock = t.find(\n\t\t\t\t\t\t( thread ) => thread.blockClientId === blockId\n\t\t\t\t\t);\n\t\t\t\t\tif ( threadForBlock ) {\n\t\t\t\t\t\torderedThreads.push( threadForBlock );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\t\treturn orderedThreads;\n\t\t}\n\t\treturn t;\n\t}, [\n\t\tnoteThreads,\n\t\tisFloating,\n\t\tselectedNote,\n\t\tselectedBlockClientId,\n\t\torderedBlockIds,\n\t] );\n\n\tconst handleDelete = async ( comment ) => {\n\t\tconst currentIndex = threads.findIndex( ( t ) => t.id === comment.id );\n\t\tconst nextThread = threads[ currentIndex + 1 ];\n\t\tconst prevThread = threads[ currentIndex - 1 ];\n\n\t\tawait onCommentDelete( comment );\n\n\t\tif ( comment.parent !== 0 ) {\n\t\t\t// Move focus to the parent thread when a reply was deleted.\n\t\t\tselectNote( comment.parent );\n\t\t\tfocusCommentThread( comment.parent, commentSidebarRef.current );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( nextThread ) {\n\t\t\tselectNote( nextThread.id );\n\t\t\tfocusCommentThread( nextThread.id, commentSidebarRef.current );\n\t\t} else if ( prevThread ) {\n\t\t\tselectNote( prevThread.id );\n\t\t\tfocusCommentThread( prevThread.id, commentSidebarRef.current );\n\t\t} else {\n\t\t\tselectNote( undefined );\n\t\t\ttoggleBlockSpotlight( comment.blockClientId, false );\n\t\t\t// Move focus to the related block.\n\t\t\trelatedBlockElement?.focus();\n\t\t}\n\t};\n\n\t// Auto-select the related comment thread when a block is selected.\n\tuseEffect( () => {\n\t\tselectNote( blockCommentId ?? undefined );\n\t}, [ blockCommentId, selectNote ] );\n\n\t// Focus the selected note when requested.\n\tuseEffect( () => {\n\t\tif ( noteFocused && selectedNote ) {\n\t\t\tfocusCommentThread(\n\t\t\t\tselectedNote,\n\t\t\t\tcommentSidebarRef.current,\n\t\t\t\tselectedNote === 'new' ? 'textarea' : undefined\n\t\t\t);\n\t\t\t// Clear focus flag to avoid re-triggering.\n\t\t\tselectNote( selectedNote );\n\t\t}\n\t}, [ noteFocused, selectedNote, selectNote, commentSidebarRef ] );\n\n\t// Recalculate floating comment thread offsets whenever the heights change.\n\tuseEffect( () => {\n\t\t/**\n\t\t * Calculate the y offsets for all comment threads. Account for potentially\n\t\t * overlapping threads and adjust their positions accordingly.\n\t\t */\n\t\tconst calculateAllOffsets = () => {\n\t\t\tconst offsets = {};\n\n\t\t\tif ( ! isFloating ) {\n\t\t\t\treturn { offsets, minHeight: 0 };\n\t\t\t}\n\n\t\t\t// Find the index of the selected thread.\n\t\t\tconst selectedThreadIndex = threads.findIndex(\n\t\t\t\t( t ) => t.id === selectedNote\n\t\t\t);\n\n\t\t\tconst breakIndex =\n\t\t\t\tselectedThreadIndex === -1 ? 0 : selectedThreadIndex;\n\n\t\t\t// If there is a selected thread, push threads above up and threads below down.\n\t\t\tconst selectedThreadData = threads[ breakIndex ];\n\n\t\t\tif (\n\t\t\t\t! selectedThreadData ||\n\t\t\t\t! blockRefs[ selectedThreadData.id ]\n\t\t\t) {\n\t\t\t\treturn { offsets, minHeight: 0 };\n\t\t\t}\n\n\t\t\tlet blockElement = blockRefs[ selectedThreadData.id ];\n\t\t\tlet blockRect = blockElement?.getBoundingClientRect();\n\t\t\tconst selectedThreadTop = blockRect?.top || 0;\n\t\t\tconst selectedThreadHeight = heights[ selectedThreadData.id ] || 0;\n\n\t\t\toffsets[ selectedThreadData.id ] = -16;\n\n\t\t\tlet previousThreadData = {\n\t\t\t\tthreadTop: selectedThreadTop - 16,\n\t\t\t\tthreadHeight: selectedThreadHeight,\n\t\t\t};\n\n\t\t\t// Process threads after the selected thread, offsetting any overlapping\n\t\t\t// threads downward.\n\t\t\tfor ( let i = breakIndex + 1; i < threads.length; i++ ) {\n\t\t\t\tconst thread = threads[ i ];\n\t\t\t\tif ( ! blockRefs[ thread.id ] ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tblockElement = blockRefs[ thread.id ];\n\t\t\t\tblockRect = blockElement?.getBoundingClientRect();\n\t\t\t\tconst threadTop = blockRect?.top || 0;\n\t\t\t\tconst threadHeight = heights[ thread.id ] || 0;\n\n\t\t\t\tlet additionalOffset = -16;\n\n\t\t\t\t// Check if the thread overlaps with the previous one.\n\t\t\t\tconst previousBottom =\n\t\t\t\t\tpreviousThreadData.threadTop +\n\t\t\t\t\tpreviousThreadData.threadHeight;\n\t\t\t\tif ( threadTop < previousBottom + 16 ) {\n\t\t\t\t\t// Shift down by the difference plus a margin to avoid overlap.\n\t\t\t\t\tadditionalOffset = previousBottom - threadTop + 20;\n\t\t\t\t}\n\n\t\t\t\toffsets[ thread.id ] = additionalOffset;\n\n\t\t\t\t// Update for next iteration.\n\t\t\t\tpreviousThreadData = {\n\t\t\t\t\tthreadTop: threadTop + additionalOffset,\n\t\t\t\t\tthreadHeight,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Process threads before the selected thread, offsetting any overlapping\n\t\t\t// threads upward.\n\t\t\tlet nextThreadData = {\n\t\t\t\tthreadTop: selectedThreadTop - 16,\n\t\t\t};\n\n\t\t\tfor ( let i = selectedThreadIndex - 1; i >= 0; i-- ) {\n\t\t\t\tconst thread = threads[ i ];\n\t\t\t\tif ( ! blockRefs[ thread.id ] ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tblockElement = blockRefs[ thread.id ];\n\t\t\t\tblockRect = blockElement?.getBoundingClientRect();\n\t\t\t\tconst threadTop = blockRect?.top || 0;\n\t\t\t\tconst threadHeight = heights[ thread.id ] || 0;\n\n\t\t\t\tlet additionalOffset = -16;\n\n\t\t\t\t// Calculate the bottom position of this thread with default offset.\n\t\t\t\tconst threadBottom = threadTop + threadHeight;\n\n\t\t\t\t// Check if this thread's bottom would overlap with the next thread's top.\n\t\t\t\tif ( threadBottom > nextThreadData.threadTop ) {\n\t\t\t\t\t// Shift up by the difference plus a margin to avoid overlap.\n\t\t\t\t\tadditionalOffset =\n\t\t\t\t\t\tnextThreadData.threadTop -\n\t\t\t\t\t\tthreadTop -\n\t\t\t\t\t\tthreadHeight -\n\t\t\t\t\t\t20;\n\t\t\t\t}\n\n\t\t\t\toffsets[ thread.id ] = additionalOffset;\n\n\t\t\t\t// Update for next iteration (going upward).\n\t\t\t\tnextThreadData = {\n\t\t\t\t\tthreadTop: threadTop + additionalOffset,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tlet editorMinHeight = 0;\n\t\t\t// Take the calculated top of the final note plus its height as the editor min height.\n\t\t\tconst lastThread = threads[ threads.length - 1 ];\n\t\t\tif ( blockRefs[ lastThread.id ] ) {\n\t\t\t\tconst lastBlockElement = blockRefs[ lastThread.id ];\n\t\t\t\tconst lastBlockRect = lastBlockElement?.getBoundingClientRect();\n\t\t\t\tconst lastThreadTop = lastBlockRect?.top || 0;\n\t\t\t\tconst lastThreadHeight = heights[ lastThread.id ] || 0;\n\t\t\t\tconst lastThreadOffset = offsets[ lastThread.id ] || 0;\n\t\t\t\teditorMinHeight =\n\t\t\t\t\tlastThreadTop + lastThreadHeight + lastThreadOffset + 32;\n\t\t\t}\n\n\t\t\treturn { offsets, minHeight: editorMinHeight };\n\t\t};\n\t\tconst { offsets: newOffsets, minHeight } = calculateAllOffsets();\n\t\tif ( Object.keys( newOffsets ).length > 0 ) {\n\t\t\tsetBoardOffsets( newOffsets );\n\t\t}\n\t\t// Ensure the editor has enough height to scroll to all notes.\n\t\tsetCanvasMinHeight( minHeight );\n\t}, [\n\t\theights,\n\t\tblockRefs,\n\t\tisFloating,\n\t\tthreads,\n\t\tselectedNote,\n\t\tsetCanvasMinHeight,\n\t] );\n\n\tconst handleThreadNavigation = ( event, thread, isSelected ) => {\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentIndex = threads.findIndex( ( t ) => t.id === thread.id );\n\n\t\tif (\n\t\t\t( event.key === 'Enter' || event.key === 'ArrowRight' ) &&\n\t\t\tevent.currentTarget === event.target &&\n\t\t\t! isSelected\n\t\t) {\n\t\t\t// Expand thread.\n\t\t\tselectNote( thread.id );\n\t\t\tif ( !! thread.blockClientId ) {\n\t\t\t\t// Pass `null` as the second parameter to prevent focusing the block.\n\t\t\t\tselectBlock( thread.blockClientId, null );\n\t\t\t\ttoggleBlockSpotlight( thread.blockClientId, true );\n\t\t\t}\n\t\t} else if (\n\t\t\t( ( event.key === 'Enter' || event.key === 'ArrowLeft' ) &&\n\t\t\t\tevent.currentTarget === event.target &&\n\t\t\t\tisSelected ) ||\n\t\t\tevent.key === 'Escape'\n\t\t) {\n\t\t\t// Collapse thread.\n\t\t\tselectNote( undefined );\n\t\t\tif ( thread.blockClientId ) {\n\t\t\t\ttoggleBlockSpotlight( thread.blockClientId, false );\n\t\t\t}\n\t\t\tfocusCommentThread( thread.id, commentSidebarRef.current );\n\t\t} else if (\n\t\t\tevent.key === 'ArrowDown' &&\n\t\t\tcurrentIndex < threads.length - 1 &&\n\t\t\tevent.currentTarget === event.target\n\t\t) {\n\t\t\t// Move to the next thread.\n\t\t\tconst nextThread = threads[ currentIndex + 1 ];\n\t\t\tfocusCommentThread( nextThread.id, commentSidebarRef.current );\n\t\t} else if (\n\t\t\tevent.key === 'ArrowUp' &&\n\t\t\tcurrentIndex > 0 &&\n\t\t\tevent.currentTarget === event.target\n\t\t) {\n\t\t\t// Move to the previous thread.\n\t\t\tconst prevThread = threads[ currentIndex - 1 ];\n\t\t\tfocusCommentThread( prevThread.id, commentSidebarRef.current );\n\t\t} else if (\n\t\t\tevent.key === 'Home' &&\n\t\t\tevent.currentTarget === event.target\n\t\t) {\n\t\t\t// Move to the first thread.\n\t\t\tfocusCommentThread( threads[ 0 ].id, commentSidebarRef.current );\n\t\t} else if (\n\t\t\tevent.key === 'End' &&\n\t\t\tevent.currentTarget === event.target\n\t\t) {\n\t\t\t// Move to the last thread.\n\t\t\tfocusCommentThread(\n\t\t\t\tthreads[ threads.length - 1 ].id,\n\t\t\t\tcommentSidebarRef.current\n\t\t\t);\n\t\t}\n\t};\n\n\tconst setBlockRef = useCallback( ( id, blockRef ) => {\n\t\tsetBlockRefs( ( prev ) => ( { ...prev, [ id ]: blockRef } ) );\n\t}, [] );\n\n\tconst hasThreads = Array.isArray( threads ) && threads.length > 0;\n\t// A special case for `template-locked` mode - https://github.com/WordPress/gutenberg/pull/72646.\n\tif ( ! hasThreads && ! isFloating ) {\n\t\treturn (\n\t\t\t<AddComment\n\t\t\t\tonSubmit={ onAddReply }\n\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ ! isFloating && selectedNote === 'new' && (\n\t\t\t\t<AddComment\n\t\t\t\t\tonSubmit={ onAddReply }\n\t\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ threads.map( ( thread ) => (\n\t\t\t\t<Thread\n\t\t\t\t\tkey={ thread.id }\n\t\t\t\t\tthread={ thread }\n\t\t\t\t\tonAddReply={ onAddReply }\n\t\t\t\t\tonCommentDelete={ handleDelete }\n\t\t\t\t\tonEditComment={ onEditComment }\n\t\t\t\t\tisSelected={ selectedNote === thread.id }\n\t\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t\tisFloating={ isFloating }\n\t\t\t\t\tcalculatedOffset={ boardOffsets[ thread.id ] ?? 0 }\n\t\t\t\t\tsetHeights={ setHeights }\n\t\t\t\t\tsetBlockRef={ setBlockRef }\n\t\t\t\t\tcommentLastUpdated={ commentLastUpdated }\n\t\t\t\t\tonKeyDown={ ( event ) =>\n\t\t\t\t\t\thandleThreadNavigation(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\tthread,\n\t\t\t\t\t\t\tselectedNote === thread.id\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</>\n\t);\n}\n\nfunction Thread( {\n\tthread,\n\tonEditComment,\n\tonAddReply,\n\tonCommentDelete,\n\tisSelected,\n\tcommentSidebarRef,\n\treflowComments,\n\tisFloating,\n\tcalculatedOffset,\n\tsetHeights,\n\tsetBlockRef,\n\tcommentLastUpdated,\n\tonKeyDown,\n} ) {\n\tconst { toggleBlockHighlight, selectBlock, toggleBlockSpotlight } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tconst { selectNote } = unlock( useDispatch( editorStore ) );\n\tconst selectedNote = useSelect(\n\t\t( select ) => unlock( select( editorStore ) ).getSelectedNote(),\n\t\t[]\n\t);\n\tconst relatedBlockElement = useBlockElement( thread.blockClientId );\n\tconst debouncedToggleBlockHighlight = useDebounce(\n\t\ttoggleBlockHighlight,\n\t\t50\n\t);\n\tconst { y, refs } = useFloatingThread( {\n\t\tthread,\n\t\tcalculatedOffset,\n\t\tsetHeights,\n\t\tsetBlockRef,\n\t\tselectedThread: selectedNote,\n\t\tcommentLastUpdated,\n\t} );\n\tconst isKeyboardTabbingRef = useRef( false );\n\n\tconst onMouseEnter = () => {\n\t\tdebouncedToggleBlockHighlight( thread.blockClientId, true );\n\t};\n\n\tconst onMouseLeave = () => {\n\t\tdebouncedToggleBlockHighlight( thread.blockClientId, false );\n\t};\n\n\tconst onFocus = () => {\n\t\ttoggleBlockHighlight( thread.blockClientId, true );\n\t};\n\n\tconst onBlur = ( event ) => {\n\t\t// Don't deselect notes when the browser window/tab loses focus.\n\t\tif ( ! document.hasFocus() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isNoteFocused = event.relatedTarget?.closest(\n\t\t\t'.editor-collab-sidebar-panel__thread'\n\t\t);\n\t\tconst isDialogFocused =\n\t\t\tevent.relatedTarget?.closest( '[role=\"dialog\"]' );\n\t\tconst isTabbing = isKeyboardTabbingRef.current;\n\n\t\t// When another note is clicked, do nothing because the current note is automatically closed.\n\t\tif ( isNoteFocused && ! isTabbing ) {\n\t\t\treturn;\n\t\t}\n\t\t// When deleting a note, a dialog appears, but the note should not be collapsed.\n\t\tif ( isDialogFocused ) {\n\t\t\treturn;\n\t\t}\n\t\t// When tabbing, do nothing if the focus is within the current note.\n\t\tif (\n\t\t\tisTabbing &&\n\t\t\tevent.currentTarget.contains( event.relatedTarget )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Closes a note that has lost focus when any of the following conditions are met:\n\t\t// - An element other than a note is clicked.\n\t\t// - Focus was lost by tabbing.\n\t\ttoggleBlockHighlight( thread.blockClientId, false );\n\t\tunselectThread();\n\t};\n\n\tconst handleCommentSelect = () => {\n\t\tselectNote( thread.id );\n\t\ttoggleBlockSpotlight( thread.blockClientId, true );\n\t\tif ( !! thread.blockClientId ) {\n\t\t\t// Pass `null` as the second parameter to prevent focusing the block.\n\t\t\tselectBlock( thread.blockClientId, null );\n\t\t}\n\t};\n\n\tconst unselectThread = () => {\n\t\tselectNote( undefined );\n\t\ttoggleBlockSpotlight( thread.blockClientId, false );\n\t};\n\n\tconst allReplies = thread?.reply || [];\n\tconst lastReply =\n\t\tallReplies.length > 0 ? allReplies[ allReplies.length - 1 ] : undefined;\n\tconst restReplies = allReplies.length > 0 ? allReplies.slice( 0, -1 ) : [];\n\n\tconst commentExcerpt = getCommentExcerpt(\n\t\tstripHTML( thread.content?.rendered ),\n\t\t10\n\t);\n\tconst ariaLabel = !! thread.blockClientId\n\t\t? sprintf(\n\t\t\t\t// translators: %s: note excerpt\n\t\t\t\t__( 'Note: %s' ),\n\t\t\t\tcommentExcerpt\n\t\t )\n\t\t: sprintf(\n\t\t\t\t// translators: %s: note excerpt\n\t\t\t\t__( 'Original block deleted. Note: %s' ),\n\t\t\t\tcommentExcerpt\n\t\t );\n\n\tif ( isFloating && thread.id === 'new' ) {\n\t\treturn (\n\t\t\t<AddComment\n\t\t\t\tonSubmit={ onAddReply }\n\t\t\t\tcommentSidebarRef={ commentSidebarRef }\n\t\t\t\treflowComments={ reflowComments }\n\t\t\t\tisFloating={ isFloating }\n\t\t\t\ty={ y }\n\t\t\t\trefs={ refs }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<VStack\n\t\t\tclassName={ clsx( 'editor-collab-sidebar-panel__thread', {\n\t\t\t\t'is-selected': isSelected,\n\t\t\t\t'is-floating': isFloating,\n\t\t\t} ) }\n\t\t\tid={ `comment-thread-${ thread.id }` }\n\t\t\tspacing=\"3\"\n\t\t\tonClick={ handleCommentSelect }\n\t\t\tonMouseEnter={ onMouseEnter }\n\t\t\tonMouseLeave={ onMouseLeave }\n\t\t\tonFocus={ onFocus }\n\t\t\tonBlur={ onBlur }\n\t\t\tonKeyUp={ ( event ) => {\n\t\t\t\tif ( event.key === 'Tab' ) {\n\t\t\t\t\tisKeyboardTabbingRef.current = false;\n\t\t\t\t}\n\t\t\t} }\n\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\tif ( event.key === 'Tab' ) {\n\t\t\t\t\tisKeyboardTabbingRef.current = true;\n\t\t\t\t} else {\n\t\t\t\t\tonKeyDown( event );\n\t\t\t\t}\n\t\t\t} }\n\t\t\ttabIndex={ 0 }\n\t\t\trole=\"treeitem\"\n\t\t\taria-label={ ariaLabel }\n\t\t\taria-expanded={ isSelected }\n\t\t\tref={ isFloating ? refs.setFloating : undefined }\n\t\t\tstyle={ isFloating ? { top: y } : undefined }\n\t\t>\n\t\t\t<Button\n\t\t\t\tclassName=\"editor-collab-sidebar-panel__skip-to-comment\"\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tsize=\"compact\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tfocusCommentThread(\n\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\tcommentSidebarRef.current,\n\t\t\t\t\t\t'textarea'\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Add new reply' ) }\n\t\t\t</Button>\n\t\t\t{ ! thread.blockClientId && (\n\t\t\t\t<Text as=\"p\" weight={ 500 } variant=\"muted\">\n\t\t\t\t\t{ __( 'Original block deleted.' ) }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t\t<CommentBoard\n\t\t\t\tthread={ thread }\n\t\t\t\tisExpanded={ isSelected }\n\t\t\t\tonEdit={ ( params = {} ) => {\n\t\t\t\t\tonEditComment( params );\n\t\t\t\t\tif ( params.status === 'approved' ) {\n\t\t\t\t\t\tunselectThread();\n\t\t\t\t\t\tif ( isFloating ) {\n\t\t\t\t\t\t\trelatedBlockElement?.focus();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfocusCommentThread(\n\t\t\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\t\t\tcommentSidebarRef.current\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\tonDelete={ onCommentDelete }\n\t\t\t\treflowComments={ reflowComments }\n\t\t\t/>\n\t\t\t{ isSelected &&\n\t\t\t\tallReplies.map( ( reply ) => (\n\t\t\t\t\t<CommentBoard\n\t\t\t\t\t\tkey={ reply.id }\n\t\t\t\t\t\tthread={ reply }\n\t\t\t\t\t\tparent={ thread }\n\t\t\t\t\t\tisExpanded={ isSelected }\n\t\t\t\t\t\tonEdit={ onEditComment }\n\t\t\t\t\t\tonDelete={ onCommentDelete }\n\t\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t{ ! isSelected && restReplies.length > 0 && (\n\t\t\t\t<HStack className=\"editor-collab-sidebar-panel__more-reply-separator\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__more-reply-button\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tselectNote( thread.id );\n\t\t\t\t\t\t\tfocusCommentThread(\n\t\t\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\t\t\tcommentSidebarRef.current\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\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %s: number of replies.\n\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t'%s more reply',\n\t\t\t\t\t\t\t\t'%s more replies',\n\t\t\t\t\t\t\t\trestReplies.length\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\trestReplies.length\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t\t{ ! isSelected && lastReply && (\n\t\t\t\t<CommentBoard\n\t\t\t\t\tthread={ lastReply }\n\t\t\t\t\tparent={ thread }\n\t\t\t\t\tisExpanded={ isSelected }\n\t\t\t\t\tonEdit={ onEditComment }\n\t\t\t\t\tonDelete={ onCommentDelete }\n\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isSelected && (\n\t\t\t\t<VStack spacing=\"2\" role=\"treeitem\">\n\t\t\t\t\t<HStack alignment=\"left\" spacing=\"3\" justify=\"flex-start\">\n\t\t\t\t\t\t<CommentAuthorInfo />\n\t\t\t\t\t</HStack>\n\t\t\t\t\t<VStack spacing=\"2\">\n\t\t\t\t\t\t<CommentForm\n\t\t\t\t\t\t\tonSubmit={ ( inputComment ) => {\n\t\t\t\t\t\t\t\tif ( 'approved' === thread.status ) {\n\t\t\t\t\t\t\t\t\t// For reopening, include the content in the reopen action.\n\t\t\t\t\t\t\t\t\tonEditComment( {\n\t\t\t\t\t\t\t\t\t\tid: thread.id,\n\t\t\t\t\t\t\t\t\t\tstatus: 'hold',\n\t\t\t\t\t\t\t\t\t\tcontent: inputComment,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// For regular replies, add as separate comment.\n\t\t\t\t\t\t\t\t\tonAddReply( {\n\t\t\t\t\t\t\t\t\t\tcontent: inputComment,\n\t\t\t\t\t\t\t\t\t\tparent: thread.id,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonCancel={ ( event ) => {\n\t\t\t\t\t\t\t\t// Prevent the parent onClick from being triggered.\n\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\tunselectThread();\n\t\t\t\t\t\t\t\tfocusCommentThread(\n\t\t\t\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\t\t\t\tcommentSidebarRef.current\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsubmitButtonText={\n\t\t\t\t\t\t\t\t'approved' === thread.status\n\t\t\t\t\t\t\t\t\t? __( 'Reopen & Reply' )\n\t\t\t\t\t\t\t\t\t: __( 'Reply' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\trows={ 'approved' === thread.status ? 2 : 4 }\n\t\t\t\t\t\t\tlabelText={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %1$s: note identifier, %2$s: author name\n\t\t\t\t\t\t\t\t__( 'Reply to note %1$s by %2$s' ),\n\t\t\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\t\t\tthread.author_name\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\n\t\t\t\t</VStack>\n\t\t\t) }\n\t\t\t{ !! thread.blockClientId && (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__skip-to-block\"\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\trelatedBlockElement?.focus();\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Back to block' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nconst CommentBoard = ( {\n\tthread,\n\tparent,\n\tisExpanded,\n\tonEdit,\n\tonDelete,\n\treflowComments,\n} ) => {\n\tconst [ actionState, setActionState ] = useState( false );\n\tconst [ showConfirmDialog, setShowConfirmDialog ] = useState( false );\n\tconst actionButtonRef = useRef( null );\n\tconst handleConfirmDelete = () => {\n\t\tonDelete( thread );\n\t\tsetActionState( false );\n\t\tsetShowConfirmDialog( false );\n\t};\n\n\tconst handleCancel = () => {\n\t\tsetActionState( false );\n\t\tsetShowConfirmDialog( false );\n\t\tactionButtonRef.current?.focus();\n\t};\n\n\t// Check if this is a resolution comment by checking metadata.\n\tconst isResolutionComment =\n\t\tthread.type === 'note' &&\n\t\tthread.meta &&\n\t\t( thread.meta._wp_note_status === 'resolved' ||\n\t\t\tthread.meta._wp_note_status === 'reopen' );\n\n\tconst actions = [\n\t\t{\n\t\t\tid: 'edit',\n\t\t\ttitle: __( 'Edit' ),\n\t\t\tisEligible: ( { status } ) => status !== 'approved',\n\t\t\tonClick: () => {\n\t\t\t\tsetActionState( 'edit' );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: 'reopen',\n\t\t\ttitle: _x( 'Reopen', 'Reopen note' ),\n\t\t\tisEligible: ( { status } ) => status === 'approved',\n\t\t\tonClick: () => {\n\t\t\t\tonEdit( { id: thread.id, status: 'hold' } );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: 'delete',\n\t\t\ttitle: __( 'Delete' ),\n\t\t\tisEligible: () => true,\n\t\t\tonClick: () => {\n\t\t\t\tsetActionState( 'delete' );\n\t\t\t\tsetShowConfirmDialog( true );\n\t\t\t},\n\t\t},\n\t];\n\n\tconst canResolve = thread.parent === 0;\n\tconst moreActions =\n\t\tparent?.status !== 'approved'\n\t\t\t? actions.filter( ( item ) => item.isEligible( thread ) )\n\t\t\t: [];\n\n\tconst deleteConfirmMessage =\n\t\t// When deleting a top level note, descendants will also be deleted.\n\t\tthread.parent === 0\n\t\t\t? __(\n\t\t\t\t\t\"Are you sure you want to delete this note? This will also delete all of this note's replies.\"\n\t\t\t )\n\t\t\t: __( 'Are you sure you want to delete this reply?' );\n\n\treturn (\n\t\t<VStack\n\t\t\tspacing=\"2\"\n\t\t\trole={ thread.parent !== 0 ? 'treeitem' : undefined }\n\t\t>\n\t\t\t<HStack alignment=\"left\" spacing=\"3\" justify=\"flex-start\">\n\t\t\t\t<CommentAuthorInfo\n\t\t\t\t\tavatar={ thread?.author_avatar_urls?.[ 48 ] }\n\t\t\t\t\tname={ thread?.author_name }\n\t\t\t\t\tdate={ thread?.date }\n\t\t\t\t\tuserId={ thread?.author }\n\t\t\t\t/>\n\t\t\t\t{ isExpanded && (\n\t\t\t\t\t<FlexItem\n\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__comment-status\"\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\t// Prevent the thread from being selected.\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<HStack spacing=\"0\">\n\t\t\t\t\t\t\t{ canResolve && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t\t'Resolve',\n\t\t\t\t\t\t\t\t\t\t'Mark note as resolved'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\ticon={ published }\n\t\t\t\t\t\t\t\t\tdisabled={ thread.status === 'approved' }\n\t\t\t\t\t\t\t\t\taccessibleWhenDisabled={\n\t\t\t\t\t\t\t\t\t\tthread.status === 'approved'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonEdit( {\n\t\t\t\t\t\t\t\t\t\t\tid: thread.id,\n\t\t\t\t\t\t\t\t\t\t\tstatus: 'approved',\n\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/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<Menu placement=\"bottom-end\">\n\t\t\t\t\t\t\t\t<Menu.TriggerButton\n\t\t\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tref={ actionButtonRef }\n\t\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\t\t\t\t\t\t\tdisabled={ ! moreActions.length }\n\t\t\t\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\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/>\n\t\t\t\t\t\t\t\t<Menu.Popover\n\t\t\t\t\t\t\t\t\t// The menu popover is rendered in a portal, which causes focus to be\n\t\t\t\t\t\t\t\t\t// lost and the note to be collapsed unintentionally. To prevent this,\n\t\t\t\t\t\t\t\t\t// the popover should be rendered as an inline.\n\t\t\t\t\t\t\t\t\tmodal={ false }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ moreActions.map( ( action ) => (\n\t\t\t\t\t\t\t\t\t\t<Menu.Item\n\t\t\t\t\t\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => action.onClick() }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t\t\t{ action.title }\n\t\t\t\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t\t</Menu.Item>\n\t\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t</Menu.Popover>\n\t\t\t\t\t\t\t</Menu>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t\t{ 'edit' === actionState ? (\n\t\t\t\t<CommentForm\n\t\t\t\t\tonSubmit={ ( value ) => {\n\t\t\t\t\t\tonEdit( {\n\t\t\t\t\t\t\tid: thread.id,\n\t\t\t\t\t\t\tcontent: value,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetActionState( false );\n\t\t\t\t\t\tactionButtonRef.current?.focus();\n\t\t\t\t\t} }\n\t\t\t\t\tonCancel={ () => handleCancel() }\n\t\t\t\t\tthread={ thread }\n\t\t\t\t\tsubmitButtonText={ _x( 'Update', 'verb' ) }\n\t\t\t\t\tlabelText={ sprintf(\n\t\t\t\t\t\t// translators: %1$s: note identifier, %2$s: author name.\n\t\t\t\t\t\t__( 'Edit note %1$s by %2$s' ),\n\t\t\t\t\t\tthread.id,\n\t\t\t\t\t\tthread.author_name\n\t\t\t\t\t) }\n\t\t\t\t\treflowComments={ reflowComments }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<RawHTML\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'editor-collab-sidebar-panel__user-comment',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'editor-collab-sidebar-panel__resolution-text':\n\t\t\t\t\t\t\t\tisResolutionComment,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ isResolutionComment\n\t\t\t\t\t\t? ( () => {\n\t\t\t\t\t\t\t\tconst actionText =\n\t\t\t\t\t\t\t\t\tthread.meta._wp_note_status === 'resolved'\n\t\t\t\t\t\t\t\t\t\t? __( 'Marked as resolved' )\n\t\t\t\t\t\t\t\t\t\t: __( 'Reopened' );\n\t\t\t\t\t\t\t\tconst content = thread?.content?.raw;\n\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tcontent &&\n\t\t\t\t\t\t\t\t\ttypeof content === 'string' &&\n\t\t\t\t\t\t\t\t\tcontent.trim() !== ''\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\treturn sprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %1$s: action label (\"Marked as resolved\" or \"Reopened\"); %2$s: note text.\n\t\t\t\t\t\t\t\t\t\t__( '%1$s: %2$s' ),\n\t\t\t\t\t\t\t\t\t\tactionText,\n\t\t\t\t\t\t\t\t\t\tcontent\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// If no content, just show the action.\n\t\t\t\t\t\t\t\treturn actionText;\n\t\t\t\t\t\t } )()\n\t\t\t\t\t\t: thread?.content?.rendered }\n\t\t\t\t</RawHTML>\n\t\t\t) }\n\t\t\t{ 'delete' === actionState && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\tisOpen={ showConfirmDialog }\n\t\t\t\t\tonConfirm={ handleConfirmDelete }\n\t\t\t\t\tonCancel={ handleCancel }\n\t\t\t\t\tconfirmButtonText={ __( 'Delete' ) }\n\t\t\t\t>\n\t\t\t\t\t{ deleteConfirmMessage }\n\t\t\t\t</ConfirmDialog>\n\t\t\t) }\n\t\t</VStack>\n\t);\n};\n\nexport default Comments;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;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AACtB,8BAAgB,SAAS,MAAM;AAAA,YAChC;AAAA,YACA,UAAW,MAAM,aAAa;AAAA,YAC9B;AAAA,YACA,sBAAmB,gBAAI,UAAU,MAAO;AAAA,YACxC,eAAY;AAAA;AAAA,kBAEX,gBAAI,wBAAyB;AAAA,cAC7B,OAAO;AAAA,cACP,OAAO;AAAA,YACR;AAAA,YACA;AAAA;AAAA,QACD,IAEA;AAAA,UAAC;AAAA;AAAA,YACA,eAAY,YAAAJ;AAAA,cACX;AAAA,cACA;AAAA,gBACC,gDACC;AAAA,cACF;AAAA,YACD;AAAA,YAEE,iCACG,MAAM;AACR,oBAAM,aACL,OAAO,KAAK,oBAAoB,iBAC7B,gBAAI,oBAAqB,QACzB,gBAAI,UAAW;AACnB,oBAAM,UAAU,QAAQ,SAAS;AAEjC,kBACC,WACA,OAAO,YAAY,YACnB,QAAQ,KAAK,MAAM,IAClB;AACD,2BAAO;AAAA;AAAA,sBAEN,gBAAI,YAAa;AAAA,kBACjB;AAAA,kBACA;AAAA,gBACD;AAAA,cACD;AAEA,qBAAO;AAAA,YACP,GAAI,IACJ,QAAQ,SAAS;AAAA;AAAA,QACrB;AAAA,QAEC,aAAa,eACd;AAAA,UAAC,kBAAAK;AAAA,UAAA;AAAA,YACA,QAAS;AAAA,YACT,WAAY;AAAA,YACZ,UAAW;AAAA,YACX,uBAAoB,gBAAI,QAAS;AAAA,YAE/B;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EAEF;AAEF;AAEA,IAAO,mBAAQ;",
|
|
6
6
|
"names": ["blockEditorPrivateApis", "componentsPrivateApis", "editorStore", "blockEditorStore", "stripHTML", "VStack", "clsx", "Text", "HStack", "CommentAuthorInfo", "CommentForm", "ConfirmDialog"]
|
|
7
7
|
}
|
|
@@ -23,7 +23,6 @@ __export(overlay_exports, {
|
|
|
23
23
|
Overlay: () => Overlay
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(overlay_exports);
|
|
26
|
-
var import_block_editor = require("@wordpress/block-editor");
|
|
27
26
|
var import_components = require("@wordpress/components");
|
|
28
27
|
var import_compose = require("@wordpress/compose");
|
|
29
28
|
var import_element = require("@wordpress/element");
|
|
@@ -224,10 +223,6 @@ function Overlay({
|
|
|
224
223
|
postId,
|
|
225
224
|
postType
|
|
226
225
|
}) {
|
|
227
|
-
(0, import_block_editor.useStyleOverride)({
|
|
228
|
-
id: "collaborators-overlay",
|
|
229
|
-
css: COLLABORATORS_OVERLAY_STYLES
|
|
230
|
-
});
|
|
231
226
|
const [overlayElement, setOverlayElement] = (0, import_element.useState)(null);
|
|
232
227
|
const { cursors, rerenderCursorsAfterDelay } = (0, import_use_render_cursors.useRenderCursors)(
|
|
233
228
|
overlayElement,
|
|
@@ -246,40 +241,43 @@ function Overlay({
|
|
|
246
241
|
postId ?? null,
|
|
247
242
|
postType ?? null
|
|
248
243
|
);
|
|
249
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.
|
|
250
|
-
"
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "collaborators-overlay-full", ref: mergedRef, children: [
|
|
245
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: COLLABORATORS_OVERLAY_STYLES }),
|
|
246
|
+
cursors.map((cursor) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
247
|
+
"div",
|
|
248
|
+
{
|
|
249
|
+
className: "collaborators-overlay-user",
|
|
250
|
+
style: {
|
|
251
|
+
left: `${cursor.x}px`,
|
|
252
|
+
top: `${cursor.y}px`
|
|
253
|
+
},
|
|
254
|
+
children: [
|
|
255
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
256
|
+
"div",
|
|
257
|
+
{
|
|
258
|
+
className: "collaborators-overlay-user-cursor",
|
|
259
|
+
style: {
|
|
260
|
+
backgroundColor: cursor.color,
|
|
261
|
+
height: `${cursor.height}px`
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
),
|
|
265
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
266
|
+
Avatar,
|
|
267
|
+
{
|
|
268
|
+
className: "collaborators-overlay-user-label",
|
|
269
|
+
badge: true,
|
|
270
|
+
size: "small",
|
|
271
|
+
src: cursor.avatarUrl,
|
|
272
|
+
name: cursor.userName,
|
|
273
|
+
borderColor: cursor.color
|
|
265
274
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
badge: true,
|
|
273
|
-
size: "small",
|
|
274
|
-
src: cursor.avatarUrl,
|
|
275
|
-
name: cursor.userName,
|
|
276
|
-
borderColor: cursor.color
|
|
277
|
-
}
|
|
278
|
-
)
|
|
279
|
-
]
|
|
280
|
-
},
|
|
281
|
-
cursor.clientId
|
|
282
|
-
)) });
|
|
275
|
+
)
|
|
276
|
+
]
|
|
277
|
+
},
|
|
278
|
+
cursor.clientId
|
|
279
|
+
))
|
|
280
|
+
] });
|
|
283
281
|
}
|
|
284
282
|
// Annotate the CommonJS export names for ESM import in node:
|
|
285
283
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/collaborators-overlay/overlay.tsx"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { useResizeObserver, useMergeRefs } from '@wordpress/compose';\nimport { useEffect, useState } from '@wordpress/element';\n\nimport { unlock } from '../../lock-unlock';\nimport { useBlockHighlighting } from './use-block-highlighting';\nimport { useRenderCursors } from './use-render-cursors';\nimport { ELEVATION_X_SMALL } from './collaborator-styles';\n\nconst { Avatar } = unlock( componentsPrivateApis );\n\n// wp-components styles are excluded from the editor canvas iframe, so the\n// Avatar component's SCSS is not available there. We inject compiled versions\n// of the relevant rules alongside the overlay-specific positioning styles.\nconst COLLABORATORS_OVERLAY_STYLES = `\n.block-canvas-cover {\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\twidth: 100%;\n\theight: 100%;\n\tpointer-events: none;\n\tz-index: 20000;\n}\n.block-canvas-cover .collaborators-overlay-full {\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\twidth: 100%;\n\theight: 100%;\n}\n.block-canvas-cover .collaborators-overlay-fixed {\n\tposition: fixed;\n\twidth: 100%;\n\theight: 100%;\n}\n.collaborators-overlay-user {\n\tposition: absolute;\n}\n.collaborators-overlay-user-cursor {\n\tposition: absolute;\n\twidth: 2px;\n\tborder-radius: 1px;\n\toutline: 1px solid #fff;\n\tbox-shadow: ${ ELEVATION_X_SMALL };\n\tanimation: collaborators-overlay-cursor-blink 1s infinite;\n}\n\n/* \u2500\u2500 Avatar component (compiled from packages/components/src/avatar/styles.scss) \u2500\u2500 */\n.components-avatar {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tborder-radius: 9999px;\n\toverflow: clip;\n\tflex-shrink: 0;\n\tbackground-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));\n\tbox-shadow: 0 0 0 var(--wp-admin-border-width-focus, 2px) #fff, ${ ELEVATION_X_SMALL };\n}\n.components-avatar__image {\n\tbox-sizing: border-box;\n\tposition: relative;\n\twidth: 32px;\n\theight: 32px;\n\tborder-radius: 9999px;\n\tborder: 0;\n\tbackground-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));\n\toverflow: clip;\n\tflex-shrink: 0;\n\tfont-size: 0;\n\tcolor: #fff;\n}\n.is-small > .components-avatar__image {\n\twidth: 24px;\n\theight: 24px;\n}\n.has-src > .components-avatar__image {\n\tbackground-image: var(--components-avatar-url);\n\tbackground-size: cover;\n\tbackground-position: center;\n}\n.has-avatar-border-color > .components-avatar__image {\n\tborder: var(--wp-admin-border-width-focus, 2px) solid var(--components-avatar-outline-color);\n\tbox-shadow: inset 0 0 0 var(--wp-admin-border-width-focus, 2px) #fff;\n\tbackground-clip: padding-box;\n}\n.components-avatar:not(.has-src) > .components-avatar__image {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tfont-size: 11px;\n\tfont-weight: 499;\n\tborder: 0;\n\tbox-shadow: none;\n\tbackground-clip: border-box;\n}\n.components-avatar:not(.has-src).has-avatar-border-color > .components-avatar__image {\n\tbackground-color: var(--components-avatar-outline-color);\n}\n.components-avatar__name {\n\tfont-size: 13px;\n\tline-height: 20px;\n\tcolor: #fff;\n\tmin-width: 0;\n\tpadding-bottom: 2px;\n\toverflow: hidden;\n\topacity: 0;\n\twhite-space: nowrap;\n\ttransition: opacity 0.15s cubic-bezier(0.15, 0, 0.15, 1);\n}\n.components-avatar.has-badge {\n\tdisplay: inline-grid;\n\tgrid-template-columns: min-content 0fr;\n\tcolumn-gap: 0;\n\tpadding-inline-end: 0;\n\ttransition:\n\t\tgrid-template-columns 0.3s cubic-bezier(0.15, 0, 0.15, 1),\n\t\tcolumn-gap 0.3s cubic-bezier(0.15, 0, 0.15, 1),\n\t\tpadding-inline-end 0.3s cubic-bezier(0.15, 0, 0.15, 1);\n}\n.components-avatar.has-badge:hover {\n\tgrid-template-columns: min-content 1fr;\n\tcolumn-gap: 4px;\n\tpadding-inline-end: 8px;\n\ttransition-timing-function: cubic-bezier(0.85, 0, 0.85, 1);\n}\n.components-avatar.has-badge:hover .components-avatar__name {\n\topacity: 1;\n\ttransition-timing-function: cubic-bezier(0.85, 0, 0.85, 1);\n}\n.components-avatar.has-badge.has-avatar-border-color {\n\tbackground-color: var(--components-avatar-outline-color);\n}\n/* \u2500\u2500 end Avatar \u2500\u2500 */\n\n/* Overlay-specific positioning applied to the Avatar cursor label. */\n.collaborators-overlay-user-label.components-avatar {\n\tposition: absolute;\n\ttransform: translate(-11px, -100%);\n\tmargin-top: -4px;\n\tpointer-events: auto;\n\toverflow: visible;\n\twidth: max-content;\n}\n\n@keyframes collaborators-overlay-cursor-blink {\n\t0%, 45% { opacity: 1; }\n\t55%, 95% { opacity: 0; }\n\t100% { opacity: 1; }\n}\n.collaborators-overlay-cursor-highlighted .collaborators-overlay-user-cursor {\n\tanimation: collaborators-overlay-cursor-highlight 0.6s ease-in-out 3;\n}\n.collaborators-overlay-cursor-highlighted .collaborators-overlay-user-label {\n\tanimation: collaborators-overlay-label-highlight 0.6s ease-in-out 3;\n}\n@keyframes collaborators-overlay-cursor-highlight {\n\t0%, 100% {\n\t\ttransform: scale(1);\n\t\tfilter: drop-shadow(0 0 0 transparent);\n\t}\n\t50% {\n\t\ttransform: scale(1.2);\n\t\tfilter: drop-shadow(0 0 8px currentColor);\n\t}\n}\n@keyframes collaborators-overlay-label-highlight {\n\t0%, 100% {\n\t\ttransform: translate(-11px, -100%) scale(1);\n\t\tfilter: drop-shadow(0 0 0 transparent);\n\t}\n\t50% {\n\t\ttransform: translate(-11px, -100%) scale(1.1);\n\t\tfilter: drop-shadow(0 0 6px currentColor);\n\t}\n}\n.block-editor-block-list__block.is-collaborator-selected:not(:focus)::after {\n\tcontent: \"\";\n\tposition: absolute;\n\tpointer-events: none;\n\ttop: 0;\n\tright: 0;\n\tbottom: 0;\n\tleft: 0;\n\toutline-color: var(--collaborator-outline-color);\n\toutline-style: solid;\n\toutline-width: calc(var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));\n\toutline-offset: calc(-1 * var(--wp-admin-border-width-focus) / var(--wp-block-editor-iframe-zoom-out-scale, 1));\n\tbox-shadow: inset 0 0 0 calc(var(--wp-admin-border-width-focus, 2px) + 1px) #fff, 0 0 0 1px #fff, ${ ELEVATION_X_SMALL };\n\tz-index: 1;\n}\n@media (prefers-reduced-motion: reduce) {\n\t.components-avatar.has-badge,\n\t.components-avatar__name,\n\t.collaborators-overlay-user-label,\n\t.collaborators-overlay-user-cursor {\n\t\ttransition: none;\n\t\tanimation: none;\n\t}\n}\n`;\n\ninterface OverlayProps {\n\tblockEditorDocument?: Document;\n\tpostId: number | null;\n\tpostType: string | null;\n}\n\n/**\n * This component is responsible for rendering the overlay components within the editor iframe.\n *\n * @param props - The overlay props.\n * @param props.blockEditorDocument - The block editor document.\n * @param props.postId - The ID of the post.\n * @param props.postType - The type of the post.\n * @return The Overlay component.\n */\nexport function Overlay( {\n\tblockEditorDocument,\n\tpostId,\n\tpostType,\n}: OverlayProps ) {\n\t// Use state for the overlay element so that the hook re-runs once the ref is attached.\n\tconst [ overlayElement, setOverlayElement ] =\n\t\tuseState< HTMLDivElement | null >( null );\n\n\tconst { cursors, rerenderCursorsAfterDelay } = useRenderCursors(\n\t\toverlayElement,\n\t\tblockEditorDocument ?? null,\n\t\tpostId ?? null,\n\t\tpostType ?? null\n\t);\n\n\t// Detect layout changes on overlay (e.g. turning on \"Show Template\") and window\n\t// resizes, and re-render the cursors.\n\tconst resizeObserverRef = useResizeObserver( rerenderCursorsAfterDelay );\n\tuseEffect( rerenderCursorsAfterDelay, [ rerenderCursorsAfterDelay ] );\n\n\t// Merge the refs to use the same element for both overlay and resize observation\n\tconst mergedRef = useMergeRefs< HTMLDivElement | null >( [\n\t\tsetOverlayElement,\n\t\tresizeObserverRef,\n\t] );\n\n\tuseBlockHighlighting(\n\t\tblockEditorDocument ?? null,\n\t\tpostId ?? null,\n\t\tpostType ?? null\n\t);\n\n\t// This is a full overlay that covers the entire iframe document. Good for\n\t// scrollable elements like cursor indicators.\n\treturn (\n\t\t<div className=\"collaborators-overlay-full\" ref={ mergedRef }>\n\t\t\t<style>{ COLLABORATORS_OVERLAY_STYLES }</style>\n\t\t\t{ cursors.map( ( cursor ) => (\n\t\t\t\t<div\n\t\t\t\t\tkey={ cursor.clientId }\n\t\t\t\t\tclassName=\"collaborators-overlay-user\"\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tleft: `${ cursor.x }px`,\n\t\t\t\t\t\ttop: `${ cursor.y }px`,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"collaborators-overlay-user-cursor\"\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\tbackgroundColor: cursor.color,\n\t\t\t\t\t\t\theight: `${ cursor.height }px`,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<Avatar\n\t\t\t\t\t\tclassName=\"collaborators-overlay-user-label\"\n\t\t\t\t\t\tbadge\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tsrc={ cursor.avatarUrl }\n\t\t\t\t\t\tname={ cursor.userName }\n\t\t\t\t\t\tborderColor={ cursor.color }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) ) }\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAqD;AACrD,qBAAgD;AAChD,qBAAoC;AAEpC,yBAAuB;AACvB,oCAAqC;AACrC,gCAAiC;AACjC,iCAAkC;AAsP/B;AApPH,IAAM,EAAE,OAAO,QAAI,2BAAQ,kBAAAA,WAAsB;AAKjD,IAAM,+BAA+B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eA8BrB,4CAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mEAYkC,4CAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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AuB;AAAA,IACvB,UAAU;AAAA,IACV,YAAY;AAAA,EACb;AAIA,SACC,6CAAC,SAAI,WAAU,8BAA6B,KAAM,WACjD;AAAA,gDAAC,WAAQ,wCAA8B;AAAA,IACrC,QAAQ,IAAK,CAAE,WAChB;AAAA,MAAC;AAAA;AAAA,QAEA,WAAU;AAAA,QACV,OAAQ;AAAA,UACP,MAAM,GAAI,OAAO,CAAE;AAAA,UACnB,KAAK,GAAI,OAAO,CAAE;AAAA,QACnB;AAAA,QAEA;AAAA;AAAA,YAAC;AAAA;AAAA,cACA,WAAU;AAAA,cACV,OAAQ;AAAA,gBACP,iBAAiB,OAAO;AAAA,gBACxB,QAAQ,GAAI,OAAO,MAAO;AAAA,cAC3B;AAAA;AAAA,UACD;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACA,WAAU;AAAA,cACV,OAAK;AAAA,cACL,MAAK;AAAA,cACL,KAAM,OAAO;AAAA,cACb,MAAO,OAAO;AAAA,cACd,aAAc,OAAO;AAAA;AAAA,UACtB;AAAA;AAAA;AAAA,MArBM,OAAO;AAAA,IAsBd,CACC;AAAA,KACH;AAEF;",
|
|
6
6
|
"names": ["componentsPrivateApis"]
|
|
7
7
|
}
|
|
@@ -33,9 +33,9 @@ var import_get_avatar_url = require("../collaborators-overlay/get-avatar-url.cjs
|
|
|
33
33
|
var import_utils = require("../collab-sidebar/utils.cjs");
|
|
34
34
|
|
|
35
35
|
// packages/editor/src/components/collaborators-presence/styles/collaborators-presence.scss
|
|
36
|
-
if (typeof document !== "undefined" && !document.head.querySelector("style[data-wp-hash='
|
|
36
|
+
if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='75307c1ddf']")) {
|
|
37
37
|
const style = document.createElement("style");
|
|
38
|
-
style.setAttribute("data-wp-hash", "
|
|
38
|
+
style.setAttribute("data-wp-hash", "75307c1ddf");
|
|
39
39
|
style.appendChild(document.createTextNode(".editor-collaborators-presence{align-items:center;background:#f0f0f0;border-radius:4px;display:flex;flex-shrink:0;height:32px;margin-right:8px}.editor-collaborators-presence:hover{background-color:#e0e0e0}.editor-collaborators-presence__button.editor-collaborators-presence__button.components-button{align-items:center;background:#0000;border-radius:4px;box-sizing:border-box;color:#2f2f2f;cursor:pointer;display:flex;height:100%;padding:4px;position:relative}.editor-collaborators-presence__button.editor-collaborators-presence__button.components-button:hover{background:#0000;color:#2f2f2f}.editor-collaborators-presence__button.editor-collaborators-presence__button.components-button.is-pressed,.editor-collaborators-presence__button.editor-collaborators-presence__button.components-button.is-pressed:hover{background:#ddd;color:#2f2f2f}.editor-collaborators-presence__button.editor-collaborators-presence__button.components-button:focus:not(:active){box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus,2px) var(--wp-admin-theme-color,#007cba);outline:none}"));
|
|
40
40
|
document.head.appendChild(style);
|
|
41
41
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/collaborators-presence/index.tsx", "../../../src/components/collaborators-presence/styles/collaborators-presence.scss"],
|
|
4
|
-
"sourcesContent": ["import {\n\tButton,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport {\n\tprivateApis,\n\ttype PostEditorAwarenessState,\n} from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\n\nimport { CollaboratorsList } from './list';\nimport { unlock } from '../../lock-unlock';\nimport { getAvatarUrl } from '../collaborators-overlay/get-avatar-url';\nimport { getAvatarBorderColor } from '../collab-sidebar/utils';\n\nimport './styles/collaborators-presence.scss';\nimport { CollaboratorsOverlay } from '../collaborators-overlay';\n\nconst { useActiveCollaborators } = unlock( privateApis );\nconst { Avatar, AvatarGroup } = unlock( componentsPrivateApis );\n\ninterface CollaboratorsPresenceProps {\n\tpostId: number | null;\n\tpostType: string | null;\n}\n\n/**\n * Renders a list of avatars for the active collaborators, with a maximum of 3 visible avatars.\n * Shows a popover with all collaborators on hover.\n *\n * @param props CollaboratorsPresence component props\n * @param props.postId ID of the post\n * @param props.postType Type of the post\n */\nexport function CollaboratorsPresence( {\n\tpostId,\n\tpostType,\n}: CollaboratorsPresenceProps ) {\n\tconst activeCollaborators = useActiveCollaborators(\n\t\tpostId,\n\t\tpostType\n\t) as PostEditorAwarenessState[];\n\n\t// Filter out current user - we never show ourselves in the list\n\tconst otherActiveCollaborators = activeCollaborators.filter(\n\t\t( collaborator ) => ! collaborator.isMe\n\t);\n\n\tconst [ isPopoverVisible, setIsPopoverVisible ] = useState( false );\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState< HTMLElement | null >(\n\t\tnull\n\t);\n\n\t// When there are no other collaborators, this component should not render\n\t// at all. This will always be the case when collaboration is not enabled, but\n\t// also when the current user is the only editor with the post open.\n\tif ( otherActiveCollaborators.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<div className=\"editor-collaborators-presence\">\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tclassName=\"editor-collaborators-presence__button\"\n\t\t\t\t\tonClick={ () => setIsPopoverVisible( ! isPopoverVisible ) }\n\t\t\t\t\tisPressed={ isPopoverVisible }\n\t\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t// translators: %d: number of online collaborators.\n\t\t\t\t\t\t__( 'Collaborators list, %d online' ),\n\t\t\t\t\t\totherActiveCollaborators.length\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t<AvatarGroup max={ 3 }>\n\t\t\t\t\t\t{ otherActiveCollaborators.map(\n\t\t\t\t\t\t\t( collaboratorState ) => (\n\t\t\t\t\t\t\t\t<Avatar\n\t\t\t\t\t\t\t\t\tkey={ collaboratorState.clientId }\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={ getAvatarBorderColor(\n\t\t\t\t\t\t\t\t\t\tcollaboratorState.collaboratorInfo.id\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) }\n\t\t\t\t\t</AvatarGroup>\n\t\t\t\t</Button>\n\t\t\t\t{ isPopoverVisible && (\n\t\t\t\t\t<CollaboratorsList\n\t\t\t\t\t\tactiveCollaborators={ otherActiveCollaborators }\n\t\t\t\t\t\tpopoverAnchor={ popoverAnchor }\n\t\t\t\t\t\tsetIsPopoverVisible={ setIsPopoverVisible }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t<CollaboratorsOverlay postId={ postId } postType={ postType } />\n\t\t</>\n\t);\n}\n", "if (typeof document !== 'undefined' && !document.head.querySelector(\"style[data-wp-hash='
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAGO;AACP,qBAAyB;AACzB,uBAGO;AACP,kBAA4B;AAE5B,kBAAkC;AAClC,yBAAuB;AACvB,4BAA6B;AAC7B,mBAAqC;;;ACdrC,IAAI,OAAO,aAAa,eAAe,CAAC,SAAS,KAAK,cAAc,kCAAkC,GAAG;
|
|
4
|
+
"sourcesContent": ["import {\n\tButton,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport {\n\tprivateApis,\n\ttype PostEditorAwarenessState,\n} from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\n\nimport { CollaboratorsList } from './list';\nimport { unlock } from '../../lock-unlock';\nimport { getAvatarUrl } from '../collaborators-overlay/get-avatar-url';\nimport { getAvatarBorderColor } from '../collab-sidebar/utils';\n\nimport './styles/collaborators-presence.scss';\nimport { CollaboratorsOverlay } from '../collaborators-overlay';\n\nconst { useActiveCollaborators } = unlock( privateApis );\nconst { Avatar, AvatarGroup } = unlock( componentsPrivateApis );\n\ninterface CollaboratorsPresenceProps {\n\tpostId: number | null;\n\tpostType: string | null;\n}\n\n/**\n * Renders a list of avatars for the active collaborators, with a maximum of 3 visible avatars.\n * Shows a popover with all collaborators on hover.\n *\n * @param props CollaboratorsPresence component props\n * @param props.postId ID of the post\n * @param props.postType Type of the post\n */\nexport function CollaboratorsPresence( {\n\tpostId,\n\tpostType,\n}: CollaboratorsPresenceProps ) {\n\tconst activeCollaborators = useActiveCollaborators(\n\t\tpostId,\n\t\tpostType\n\t) as PostEditorAwarenessState[];\n\n\t// Filter out current user - we never show ourselves in the list\n\tconst otherActiveCollaborators = activeCollaborators.filter(\n\t\t( collaborator ) => ! collaborator.isMe\n\t);\n\n\tconst [ isPopoverVisible, setIsPopoverVisible ] = useState( false );\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState< HTMLElement | null >(\n\t\tnull\n\t);\n\n\t// When there are no other collaborators, this component should not render\n\t// at all. This will always be the case when collaboration is not enabled, but\n\t// also when the current user is the only editor with the post open.\n\tif ( otherActiveCollaborators.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<div className=\"editor-collaborators-presence\">\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tclassName=\"editor-collaborators-presence__button\"\n\t\t\t\t\tonClick={ () => setIsPopoverVisible( ! isPopoverVisible ) }\n\t\t\t\t\tisPressed={ isPopoverVisible }\n\t\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t// translators: %d: number of online collaborators.\n\t\t\t\t\t\t__( 'Collaborators list, %d online' ),\n\t\t\t\t\t\totherActiveCollaborators.length\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t<AvatarGroup max={ 3 }>\n\t\t\t\t\t\t{ otherActiveCollaborators.map(\n\t\t\t\t\t\t\t( collaboratorState ) => (\n\t\t\t\t\t\t\t\t<Avatar\n\t\t\t\t\t\t\t\t\tkey={ collaboratorState.clientId }\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={ getAvatarBorderColor(\n\t\t\t\t\t\t\t\t\t\tcollaboratorState.collaboratorInfo.id\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) }\n\t\t\t\t\t</AvatarGroup>\n\t\t\t\t</Button>\n\t\t\t\t{ isPopoverVisible && (\n\t\t\t\t\t<CollaboratorsList\n\t\t\t\t\t\tactiveCollaborators={ otherActiveCollaborators }\n\t\t\t\t\t\tpopoverAnchor={ popoverAnchor }\n\t\t\t\t\t\tsetIsPopoverVisible={ setIsPopoverVisible }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t<CollaboratorsOverlay postId={ postId } postType={ postType } />\n\t\t</>\n\t);\n}\n", "if (typeof document !== 'undefined' && process.env.NODE_ENV !== 'test' && !document.head.querySelector(\"style[data-wp-hash='75307c1ddf']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"75307c1ddf\");\n\tstyle.appendChild(document.createTextNode(\".editor-collaborators-presence{align-items:center;background:#f0f0f0;border-radius:4px;display:flex;flex-shrink:0;height:32px;margin-right:8px}.editor-collaborators-presence:hover{background-color:#e0e0e0}.editor-collaborators-presence__button.editor-collaborators-presence__button.components-button{align-items:center;background:#0000;border-radius:4px;box-sizing:border-box;color:#2f2f2f;cursor:pointer;display:flex;height:100%;padding:4px;position:relative}.editor-collaborators-presence__button.editor-collaborators-presence__button.components-button:hover{background:#0000;color:#2f2f2f}.editor-collaborators-presence__button.editor-collaborators-presence__button.components-button.is-pressed,.editor-collaborators-presence__button.editor-collaborators-presence__button.components-button.is-pressed:hover{background:#ddd;color:#2f2f2f}.editor-collaborators-presence__button.editor-collaborators-presence__button.components-button:focus:not(:active){box-shadow:inset 0 0 0 var(--wp-admin-border-width-focus,2px) var(--wp-admin-theme-color,#007cba);outline:none}\"));\n\tdocument.head.appendChild(style);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAGO;AACP,qBAAyB;AACzB,uBAGO;AACP,kBAA4B;AAE5B,kBAAkC;AAClC,yBAAuB;AACvB,4BAA6B;AAC7B,mBAAqC;;;ACdrC,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,2iCAA2iC,CAAC;AACtlC,WAAS,KAAK,YAAY,KAAK;AAChC;;;ADYA,mCAAqC;AA6CnC;AA3CF,IAAM,EAAE,uBAAuB,QAAI,2BAAQ,4BAAY;AACvD,IAAM,EAAE,QAAQ,YAAY,QAAI,2BAAQ,kBAAAA,WAAsB;AAevD,SAAS,sBAAuB;AAAA,EACtC;AAAA,EACA;AACD,GAAgC;AAC/B,QAAM,sBAAsB;AAAA,IAC3B;AAAA,IACA;AAAA,EACD;AAGA,QAAM,2BAA2B,oBAAoB;AAAA,IACpD,CAAE,iBAAkB,CAAE,aAAa;AAAA,EACpC;AAEA,QAAM,CAAE,kBAAkB,mBAAoB,QAAI,yBAAU,KAAM;AAClE,QAAM,CAAE,eAAe,gBAAiB,QAAI;AAAA,IAC3C;AAAA,EACD;AAKA,MAAK,yBAAyB,WAAW,GAAI;AAC5C,WAAO;AAAA,EACR;AAEA,SACC,4EACC;AAAA,iDAAC,SAAI,WAAU,iCACd;AAAA;AAAA,QAAC;AAAA;AAAA,UACA,uBAAqB;AAAA,UACrB,WAAU;AAAA,UACV,SAAU,MAAM,oBAAqB,CAAE,gBAAiB;AAAA,UACxD,WAAY;AAAA,UACZ,KAAM;AAAA,UACN,kBAAa;AAAA;AAAA,gBAEZ,gBAAI,+BAAgC;AAAA,YACpC,yBAAyB;AAAA,UAC1B;AAAA,UAEA,sDAAC,eAAY,KAAM,GAChB,mCAAyB;AAAA,YAC1B,CAAE,sBACD;AAAA,cAAC;AAAA;AAAA,gBAEA,SAAM;AAAA,kBACL,kBAAkB,iBAChB;AAAA,gBACH;AAAA,gBACA,MACC,kBAAkB,iBAAiB;AAAA,gBAEpC,iBAAc;AAAA,kBACb,kBAAkB,iBAAiB;AAAA,gBACpC;AAAA,gBACA,MAAK;AAAA;AAAA,cAXC,kBAAkB;AAAA,YAYzB;AAAA,UAEF,GACD;AAAA;AAAA,MACD;AAAA,MACE,oBACD;AAAA,QAAC;AAAA;AAAA,UACA,qBAAsB;AAAA,UACtB;AAAA,UACA;AAAA;AAAA,MACD;AAAA,OAEF;AAAA,IACA,4CAAC,qDAAqB,QAAkB,UAAsB;AAAA,KAC/D;AAEF;",
|
|
6
6
|
"names": ["componentsPrivateApis"]
|
|
7
7
|
}
|
|
@@ -31,9 +31,9 @@ var import_get_avatar_url = require("../collaborators-overlay/get-avatar-url.cjs
|
|
|
31
31
|
var import_utils = require("../collab-sidebar/utils.cjs");
|
|
32
32
|
|
|
33
33
|
// packages/editor/src/components/collaborators-presence/styles/collaborators-list.scss
|
|
34
|
-
if (typeof document !== "undefined" && !document.head.querySelector("style[data-wp-hash='
|
|
34
|
+
if (typeof document !== "undefined" && process.env.NODE_ENV !== "test" && !document.head.querySelector("style[data-wp-hash='0d3429a67b']")) {
|
|
35
35
|
const style = document.createElement("style");
|
|
36
|
-
style.setAttribute("data-wp-hash", "
|
|
36
|
+
style.setAttribute("data-wp-hash", "0d3429a67b");
|
|
37
37
|
style.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:0 16px}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-header-title{font-size:13px;font-weight:499;line-height:20px;padding:14px 0;text-transform:uppercase}.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:8px 0}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-header-action button{color:#1e1e1e;height:24px;padding:0;width:24px}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-items{display:flex;flex-direction:column;padding:0 10px 16px}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-item{all:unset;align-items:center;border-radius:12px;box-sizing:border-box;cursor:pointer;display:flex;gap:8px;padding:6px;transition:background-color .2s ease;width:100%}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-item:hover:not(:disabled){background-color:#0000000d}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-item:active:not(:disabled){background-color:#00000014}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-item:focus-visible{outline:2px solid var(--wp-admin-theme-color,#007cba);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;font-size:12px;line-height:16px}"));
|
|
38
38
|
document.head.appendChild(style);
|
|
39
39
|
}
|
|
@@ -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 {\n\tPopover,\n\tButton,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { close } from '@wordpress/icons';\nimport { type PostEditorAwarenessState } from '@wordpress/core-data';\n\nimport { unlock } from '../../lock-unlock';\nimport { getAvatarUrl } from '../collaborators-overlay/get-avatar-url';\nimport { getAvatarBorderColor } from '../collab-sidebar/utils';\n\nimport './styles/collaborators-list.scss';\n\nconst { Avatar } = unlock( componentsPrivateApis );\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 * Note: activeUsers should already exclude the current user (filtered by parent component).\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={ close }\n\t\t\t\t\t\t\ticonSize={ 16 }\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\t<button\n\t\t\t\t\t\t\tkey={ collaboratorState.clientId }\n\t\t\t\t\t\t\tclassName=\"editor-collaborators-presence__list-item\"\n\t\t\t\t\t\t\tdisabled\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\topacity: collaboratorState.isConnected\n\t\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t\t: 0.5,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Avatar\n\t\t\t\t\t\t\t\tsrc={ getAvatarUrl(\n\t\t\t\t\t\t\t\t\tcollaboratorState.collaboratorInfo\n\t\t\t\t\t\t\t\t\t\t.avatar_urls\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tname={ collaboratorState.collaboratorInfo.name }\n\t\t\t\t\t\t\t\tborderColor={ getAvatarBorderColor(\n\t\t\t\t\t\t\t\t\tcollaboratorState.collaboratorInfo.id\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<div className=\"editor-collaborators-presence__list-item-info\">\n\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{ collaboratorState.collaboratorInfo.name }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</button>\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' && !document.head.querySelector(\"style[data-wp-hash='
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmB;AACnB,wBAIO;AACP,mBAAsB;AAGtB,yBAAuB;AACvB,4BAA6B;AAC7B,mBAAqC;;;ACXrC,IAAI,OAAO,aAAa,eAAe,CAAC,SAAS,KAAK,cAAc,kCAAkC,GAAG;
|
|
4
|
+
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport {\n\tPopover,\n\tButton,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { close } from '@wordpress/icons';\nimport { type PostEditorAwarenessState } from '@wordpress/core-data';\n\nimport { unlock } from '../../lock-unlock';\nimport { getAvatarUrl } from '../collaborators-overlay/get-avatar-url';\nimport { getAvatarBorderColor } from '../collab-sidebar/utils';\n\nimport './styles/collaborators-list.scss';\n\nconst { Avatar } = unlock( componentsPrivateApis );\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 * Note: activeUsers should already exclude the current user (filtered by parent component).\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={ close }\n\t\t\t\t\t\t\ticonSize={ 16 }\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\t<button\n\t\t\t\t\t\t\tkey={ collaboratorState.clientId }\n\t\t\t\t\t\t\tclassName=\"editor-collaborators-presence__list-item\"\n\t\t\t\t\t\t\tdisabled\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\topacity: collaboratorState.isConnected\n\t\t\t\t\t\t\t\t\t? 1\n\t\t\t\t\t\t\t\t\t: 0.5,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Avatar\n\t\t\t\t\t\t\t\tsrc={ getAvatarUrl(\n\t\t\t\t\t\t\t\t\tcollaboratorState.collaboratorInfo\n\t\t\t\t\t\t\t\t\t\t.avatar_urls\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tname={ collaboratorState.collaboratorInfo.name }\n\t\t\t\t\t\t\t\tborderColor={ getAvatarBorderColor(\n\t\t\t\t\t\t\t\t\tcollaboratorState.collaboratorInfo.id\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<div className=\"editor-collaborators-presence__list-item-info\">\n\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{ collaboratorState.collaboratorInfo.name }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</button>\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='0d3429a67b']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"0d3429a67b\");\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:0 16px}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-header-title{font-size:13px;font-weight:499;line-height:20px;padding:14px 0;text-transform:uppercase}.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:8px 0}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-header-action button{color:#1e1e1e;height:24px;padding:0;width:24px}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-items{display:flex;flex-direction:column;padding:0 10px 16px}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-item{all:unset;align-items:center;border-radius:12px;box-sizing:border-box;cursor:pointer;display:flex;gap:8px;padding:6px;transition:background-color .2s ease;width:100%}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-item:hover:not(:disabled){background-color:#0000000d}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-item:active:not(:disabled){background-color:#00000014}.editor-collaborators-presence__list.components-popover .editor-collaborators-presence__list-item:focus-visible{outline:2px solid var(--wp-admin-theme-color,#007cba);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;font-size:12px;line-height:16px}\"));\n\tdocument.head.appendChild(style);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmB;AACnB,wBAIO;AACP,mBAAsB;AAGtB,yBAAuB;AACvB,4BAA6B;AAC7B,mBAAqC;;;ACXrC,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,8yEAA8yE,CAAC;AACz1E,WAAS,KAAK,YAAY,KAAK;AAChC;;;AD2CM;AAjCN,IAAM,EAAE,OAAO,QAAI,2BAAQ,kBAAAA,WAAsB;AAgB1C,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,uDAAC,SAAI,WAAU,+CACd;AAAA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