@wordpress/editor 14.10.0 → 14.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +2 -2
- package/build/bindings/post-meta.js +2 -1
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/collab-sidebar/add-comment.js +120 -0
- package/build/components/collab-sidebar/add-comment.js.map +1 -0
- package/build/components/collab-sidebar/comment-button-toolbar.js +37 -0
- package/build/components/collab-sidebar/comment-button-toolbar.js.map +1 -0
- package/build/components/collab-sidebar/comment-button.js +37 -0
- package/build/components/collab-sidebar/comment-button.js.map +1 -0
- package/build/components/collab-sidebar/comments.js +321 -0
- package/build/components/collab-sidebar/comments.js.map +1 -0
- package/build/components/collab-sidebar/constants.js +8 -0
- package/build/components/collab-sidebar/constants.js.map +1 -0
- package/build/components/collab-sidebar/index.js +272 -0
- package/build/components/collab-sidebar/index.js.map +1 -0
- package/build/components/collab-sidebar/utils.js +16 -0
- package/build/components/collab-sidebar/utils.js.map +1 -0
- package/build/components/commands/index.js +6 -6
- package/build/components/commands/index.js.map +1 -1
- package/build/components/document-bar/index.js +8 -7
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/document-tools/index.js +1 -5
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-interface/index.js +3 -2
- package/build/components/editor-interface/index.js.map +1 -1
- package/build/components/entities-saved-states/index.js +1 -1
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/global-styles-provider/index.js +13 -3
- package/build/components/global-styles-provider/index.js.map +1 -1
- package/build/components/header/index.js +5 -2
- package/build/components/header/index.js.map +1 -1
- package/build/components/inserter-sidebar/index.js +2 -2
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/page-attributes/parent.js +5 -5
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/plugin-more-menu-item/index.js +13 -11
- package/build/components/plugin-more-menu-item/index.js.map +1 -1
- package/build/components/plugin-preview-menu-item/index.js +15 -13
- package/build/components/plugin-preview-menu-item/index.js.map +1 -1
- package/build/components/plugin-sidebar/index.js +0 -15
- package/build/components/plugin-sidebar/index.js.map +1 -1
- package/build/components/post-actions/index.js +5 -5
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-author/panel.js +4 -4
- package/build/components/post-author/panel.js.map +1 -1
- package/build/components/post-card-panel/index.js +7 -36
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-content-information/index.js +1 -2
- package/build/components/post-content-information/index.js.map +1 -1
- package/build/components/post-featured-image/index.js +26 -7
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-last-revision/index.js +1 -1
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-schedule/label.js +1 -1
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +9 -1
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-url/index.js +1 -1
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-url/panel.js +3 -3
- package/build/components/post-url/panel.js.map +1 -1
- package/build/components/preview-dropdown/index.js +0 -4
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/index.js +10 -12
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +1 -1
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/sidebar/header.js +2 -1
- package/build/components/sidebar/header.js.map +1 -1
- package/build/components/sidebar/index.js +3 -3
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/time-to-read/index.js +2 -2
- package/build/components/time-to-read/index.js.map +1 -1
- package/build/components/visual-editor/index.js +25 -27
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/components/visual-editor/use-zoom-out-mode-exit.js +52 -0
- package/build/components/visual-editor/use-zoom-out-mode-exit.js.map +1 -0
- package/build/components/zoom-out-toggle/index.js +37 -5
- package/build/components/zoom-out-toggle/index.js.map +1 -1
- package/build/dataviews/actions/duplicate-template-part.js +2 -2
- package/build/dataviews/actions/duplicate-template-part.js.map +1 -1
- package/build/store/actions.js +4 -3
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +2 -2
- package/build/store/private-actions.js.map +1 -1
- package/build/store/selectors.js +3 -2
- package/build/store/selectors.js.map +1 -1
- package/build/utils/pageTypeBadge.js +51 -0
- package/build/utils/pageTypeBadge.js.map +1 -0
- package/build/utils/terms.js +2 -2
- package/build/utils/terms.js.map +1 -1
- package/build-module/bindings/post-meta.js +2 -1
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/collab-sidebar/add-comment.js +114 -0
- package/build-module/components/collab-sidebar/add-comment.js.map +1 -0
- package/build-module/components/collab-sidebar/comment-button-toolbar.js +30 -0
- package/build-module/components/collab-sidebar/comment-button-toolbar.js.map +1 -0
- package/build-module/components/collab-sidebar/comment-button.js +30 -0
- package/build-module/components/collab-sidebar/comment-button.js.map +1 -0
- package/build-module/components/collab-sidebar/comments.js +314 -0
- package/build-module/components/collab-sidebar/comments.js.map +1 -0
- package/build-module/components/collab-sidebar/constants.js +2 -0
- package/build-module/components/collab-sidebar/constants.js.map +1 -0
- package/build-module/components/collab-sidebar/index.js +264 -0
- package/build-module/components/collab-sidebar/index.js.map +1 -0
- package/build-module/components/collab-sidebar/utils.js +10 -0
- package/build-module/components/collab-sidebar/utils.js.map +1 -0
- package/build-module/components/commands/index.js +6 -6
- package/build-module/components/commands/index.js.map +1 -1
- package/build-module/components/document-bar/index.js +9 -8
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/document-tools/index.js +2 -6
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor-interface/index.js +3 -2
- package/build-module/components/editor-interface/index.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +1 -1
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/global-styles-provider/index.js +13 -3
- package/build-module/components/global-styles-provider/index.js.map +1 -1
- package/build-module/components/header/index.js +5 -2
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js +2 -2
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +5 -5
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/plugin-more-menu-item/index.js +12 -10
- package/build-module/components/plugin-more-menu-item/index.js.map +1 -1
- package/build-module/components/plugin-preview-menu-item/index.js +14 -12
- package/build-module/components/plugin-preview-menu-item/index.js.map +1 -1
- package/build-module/components/plugin-sidebar/index.js +0 -15
- package/build-module/components/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/post-actions/index.js +5 -5
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-author/panel.js +4 -4
- package/build-module/components/post-author/panel.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +8 -36
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-content-information/index.js +1 -2
- package/build-module/components/post-content-information/index.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +26 -7
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-last-revision/index.js +1 -1
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-schedule/label.js +1 -1
- package/build-module/components/post-schedule/label.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +12 -4
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-url/index.js +1 -1
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/post-url/panel.js +3 -3
- package/build-module/components/post-url/panel.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +0 -4
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/index.js +10 -12
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +1 -1
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/sidebar/header.js +2 -1
- package/build-module/components/sidebar/header.js.map +1 -1
- package/build-module/components/sidebar/index.js +4 -4
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/time-to-read/index.js +2 -2
- package/build-module/components/time-to-read/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +26 -28
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/use-zoom-out-mode-exit.js +46 -0
- package/build-module/components/visual-editor/use-zoom-out-mode-exit.js.map +1 -0
- package/build-module/components/zoom-out-toggle/index.js +37 -5
- package/build-module/components/zoom-out-toggle/index.js.map +1 -1
- package/build-module/dataviews/actions/duplicate-template-part.js +3 -3
- package/build-module/dataviews/actions/duplicate-template-part.js.map +1 -1
- package/build-module/store/actions.js +4 -3
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +3 -3
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/selectors.js +3 -2
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/pageTypeBadge.js +45 -0
- package/build-module/utils/pageTypeBadge.js.map +1 -0
- package/build-module/utils/terms.js +2 -2
- package/build-module/utils/terms.js.map +1 -1
- package/build-style/style-rtl.css +96 -54
- package/build-style/style.css +96 -54
- package/build-types/bindings/post-meta.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/add-comment.d.ts +15 -0
- package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/comment-button-toolbar.d.ts +5 -0
- package/build-types/components/collab-sidebar/comment-button-toolbar.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/comment-button.d.ts +5 -0
- package/build-types/components/collab-sidebar/comment-button.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/comments.d.ts +19 -0
- package/build-types/components/collab-sidebar/comments.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/constants.d.ts +2 -0
- package/build-types/components/collab-sidebar/constants.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/index.d.ts +5 -0
- package/build-types/components/collab-sidebar/index.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/utils.d.ts +8 -0
- package/build-types/components/collab-sidebar/utils.d.ts.map +1 -0
- package/build-types/components/commands/index.d.ts.map +1 -1
- package/build-types/components/document-bar/index.d.ts.map +1 -1
- package/build-types/components/document-tools/index.d.ts.map +1 -1
- package/build-types/components/editor-interface/index.d.ts.map +1 -1
- package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
- package/build-types/components/header/index.d.ts.map +1 -1
- package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
- package/build-types/components/page-attributes/parent.d.ts.map +1 -1
- package/build-types/components/plugin-more-menu-item/index.d.ts +62 -2
- package/build-types/components/plugin-more-menu-item/index.d.ts.map +1 -1
- package/build-types/components/plugin-preview-menu-item/index.d.ts +41 -2
- package/build-types/components/plugin-preview-menu-item/index.d.ts.map +1 -1
- package/build-types/components/plugin-sidebar/index.d.ts.map +1 -1
- package/build-types/components/post-author/panel.d.ts.map +1 -1
- package/build-types/components/post-card-panel/index.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
- package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/sidebar/index.d.ts.map +1 -1
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/components/visual-editor/use-zoom-out-mode-exit.d.ts +5 -0
- package/build-types/components/visual-editor/use-zoom-out-mode-exit.d.ts.map +1 -0
- package/build-types/components/zoom-out-toggle/index.d.ts +3 -1
- package/build-types/components/zoom-out-toggle/index.d.ts.map +1 -1
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/utils/pageTypeBadge.d.ts +5 -0
- package/build-types/utils/pageTypeBadge.d.ts.map +1 -0
- package/build-types/utils/terms.d.ts.map +1 -1
- package/package.json +38 -37
- package/src/bindings/post-meta.js +1 -0
- package/src/components/collab-sidebar/add-comment.js +124 -0
- package/src/components/collab-sidebar/comment-button-toolbar.js +29 -0
- package/src/components/collab-sidebar/comment-button.js +31 -0
- package/src/components/collab-sidebar/comments.js +404 -0
- package/src/components/collab-sidebar/constants.js +1 -0
- package/src/components/collab-sidebar/index.js +307 -0
- package/src/components/collab-sidebar/style.scss +111 -0
- package/src/components/collab-sidebar/utils.js +9 -0
- package/src/components/commands/index.js +9 -7
- package/src/components/document-bar/index.js +15 -7
- package/src/components/document-bar/style.scss +0 -4
- package/src/components/document-tools/index.js +1 -7
- package/src/components/editor-interface/index.js +4 -3
- package/src/components/entities-saved-states/index.js +2 -2
- package/src/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
- package/src/components/global-styles-provider/index.js +20 -6
- package/src/components/header/index.js +3 -1
- package/src/components/inserter-sidebar/index.js +3 -6
- package/src/components/page-attributes/parent.js +6 -4
- package/src/components/plugin-more-menu-item/index.js +12 -11
- package/src/components/plugin-preview-menu-item/index.js +14 -13
- package/src/components/plugin-sidebar/index.js +0 -13
- package/src/components/post-actions/index.js +8 -11
- package/src/components/post-author/panel.js +4 -2
- package/src/components/post-card-panel/index.js +9 -43
- package/src/components/post-card-panel/style.scss +1 -9
- package/src/components/post-content-information/index.js +1 -1
- package/src/components/post-featured-image/index.js +31 -16
- package/src/components/post-featured-image/style.scss +5 -2
- package/src/components/post-last-revision/index.js +1 -1
- package/src/components/post-schedule/label.js +1 -1
- package/src/components/post-sticky/test/index.js +6 -6
- package/src/components/post-taxonomies/flat-term-selector.js +15 -4
- package/src/components/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/src/components/post-url/index.js +1 -1
- package/src/components/post-url/panel.js +4 -2
- package/src/components/preview-dropdown/index.js +0 -2
- package/src/components/provider/index.js +31 -24
- package/src/components/provider/use-block-editor-settings.js +1 -1
- package/src/components/sidebar/header.js +3 -2
- package/src/components/sidebar/index.js +5 -3
- package/src/components/time-to-read/index.js +3 -3
- package/src/components/visual-editor/index.js +32 -41
- package/src/components/visual-editor/use-zoom-out-mode-exit.js +49 -0
- package/src/components/zoom-out-toggle/index.js +39 -5
- package/src/dataviews/actions/duplicate-template-part.tsx +3 -3
- package/src/store/actions.js +5 -3
- package/src/store/private-actions.js +3 -3
- package/src/store/selectors.js +3 -2
- package/src/style.scss +1 -0
- package/src/utils/pageTypeBadge.js +41 -0
- package/src/utils/terms.js +4 -2
- package/src/utils/test/terms.js +3 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_components","_date","_icons","_i18n","_data","_coreData","_blockEditor","_utils","_jsxRuntime","Comments","threads","onEditComment","onAddReply","onCommentDelete","onCommentResolve","actionState","setActionState","useState","isConfirmDialogOpen","setIsConfirmDialogOpen","handleConfirmDelete","id","handleConfirmResolve","handleCancelDelete","blockCommentId","useSelect","select","_select$getBlock$attr","clientID","blockEditorStore","getSelectedBlockClientId","getBlock","attributes","CommentBoard","thread","parentThread","_parentThread$status","jsxs","Fragment","children","jsx","CommentHeader","onResolve","_parentThread$id","action","onEdit","onDelete","onReply","undefined","status","__experimentalHStack","alignment","spacing","justify","className","__experimentalVStack","CommentForm","onSubmit","value","onCancel","RawHTML","content","raw","__experimentalConfirmDialog","isOpen","onConfirm","confirmButtonText","cancelButtonText","__","Array","isArray","length","map","clsx","inputComment","reply","_thread$content$raw","setInputComment","TextareaControl","__nextHasNoMarginBottom","onChange","Button","__next40pxDefaultSize","accessibleWhenDisabled","variant","onClick","disabled","sanitizeCommentString","_x","dateSettings","getDateSettings","dateTimeFormat","formats","time","useEntityProp","actions","title","moreActions","filter","item","src","author_avatar_urls","alt","width","height","author_name","dateTime","format","date","dateI18n","parent","label","icon","published","showTooltip","DropdownMenu","moreVertical","controls","Tooltip","text","Icon","check"],"sources":["@wordpress/editor/src/components/collab-sidebar/comments.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useState, RawHTML } from '@wordpress/element';\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tButton,\n\tDropdownMenu,\n\tTextareaControl,\n\tTooltip,\n} from '@wordpress/components';\nimport {\n\tdateI18n,\n\tformat,\n\tgetSettings as getDateSettings,\n} from '@wordpress/date';\nimport { Icon, check, published, moreVertical } from '@wordpress/icons';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { sanitizeCommentString } from './utils';\n\n/**\n * Renders the Comments component.\n *\n * @param {Object} props - The component props.\n * @param {Array} props.threads - The array of comment threads.\n * @param {Function} props.onEditComment - The function to handle comment editing.\n * @param {Function} props.onAddReply - The function to add a reply to a comment.\n * @param {Function} props.onCommentDelete - The function to delete a comment.\n * @param {Function} props.onCommentResolve - The function to mark a comment as resolved.\n * @return {JSX.Element} The rendered Comments component.\n */\nexport function Comments( {\n\tthreads,\n\tonEditComment,\n\tonAddReply,\n\tonCommentDelete,\n\tonCommentResolve,\n} ) {\n\tconst [ actionState, setActionState ] = useState( false );\n\tconst [ isConfirmDialogOpen, setIsConfirmDialogOpen ] = useState( false );\n\n\tconst handleConfirmDelete = () => {\n\t\tonCommentDelete( actionState.id );\n\t\tsetActionState( false );\n\t\tsetIsConfirmDialogOpen( false );\n\t};\n\n\tconst handleConfirmResolve = () => {\n\t\tonCommentResolve( actionState.id );\n\t\tsetActionState( false );\n\t\tsetIsConfirmDialogOpen( false );\n\t};\n\n\tconst handleCancelDelete = () => {\n\t\tsetActionState( false );\n\t\tsetIsConfirmDialogOpen( false );\n\t};\n\n\tconst blockCommentId = useSelect( ( select ) => {\n\t\tconst clientID = select( blockEditorStore ).getSelectedBlockClientId();\n\t\treturn (\n\t\t\tselect( blockEditorStore ).getBlock( clientID )?.attributes\n\t\t\t\t?.blockCommentId ?? false\n\t\t);\n\t}, [] );\n\n\tconst CommentBoard = ( { thread, parentThread } ) => {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<CommentHeader\n\t\t\t\t\tthread={ thread }\n\t\t\t\t\tonResolve={ () => {\n\t\t\t\t\t\tsetActionState( {\n\t\t\t\t\t\t\taction: 'resolve',\n\t\t\t\t\t\t\tid: parentThread?.id ?? thread.id,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetIsConfirmDialogOpen( true );\n\t\t\t\t\t} }\n\t\t\t\t\tonEdit={ () =>\n\t\t\t\t\t\tsetActionState( { action: 'edit', id: thread.id } )\n\t\t\t\t\t}\n\t\t\t\t\tonDelete={ () => {\n\t\t\t\t\t\tsetActionState( { action: 'delete', id: thread.id } );\n\t\t\t\t\t\tsetIsConfirmDialogOpen( true );\n\t\t\t\t\t} }\n\t\t\t\t\tonReply={\n\t\t\t\t\t\t! parentThread\n\t\t\t\t\t\t\t? () =>\n\t\t\t\t\t\t\t\t\tsetActionState( {\n\t\t\t\t\t\t\t\t\t\taction: 'reply',\n\t\t\t\t\t\t\t\t\t\tid: thread.id,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tstatus={ parentThread?.status ?? thread.status }\n\t\t\t\t/>\n\t\t\t\t<HStack\n\t\t\t\t\talignment=\"left\"\n\t\t\t\t\tspacing=\"3\"\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__user-comment\"\n\t\t\t\t>\n\t\t\t\t\t<VStack\n\t\t\t\t\t\tspacing=\"3\"\n\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__comment-field\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ 'edit' === actionState?.action &&\n\t\t\t\t\t\t\tthread.id === actionState?.id && (\n\t\t\t\t\t\t\t\t<CommentForm\n\t\t\t\t\t\t\t\t\tonSubmit={ ( value ) => {\n\t\t\t\t\t\t\t\t\t\tonEditComment( thread.id, value );\n\t\t\t\t\t\t\t\t\t\tsetActionState( false );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tonCancel={ () => setActionState( false ) }\n\t\t\t\t\t\t\t\t\tthread={ thread }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ( ! actionState ||\n\t\t\t\t\t\t\t'edit' !== actionState?.action ) && (\n\t\t\t\t\t\t\t<RawHTML>{ thread?.content?.raw }</RawHTML>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</VStack>\n\t\t\t\t</HStack>\n\t\t\t\t{ 'resolve' === actionState?.action &&\n\t\t\t\t\tthread.id === actionState?.id && (\n\t\t\t\t\t\t<ConfirmDialog\n\t\t\t\t\t\t\tisOpen={ isConfirmDialogOpen }\n\t\t\t\t\t\t\tonConfirm={ handleConfirmResolve }\n\t\t\t\t\t\t\tonCancel={ handleCancelDelete }\n\t\t\t\t\t\t\tconfirmButtonText=\"Yes\"\n\t\t\t\t\t\t\tcancelButtonText=\"No\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// translators: message displayed when confirming an action\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Are you sure you want to mark this comment as resolved?'\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</ConfirmDialog>\n\t\t\t\t\t) }\n\t\t\t\t{ 'delete' === actionState?.action &&\n\t\t\t\t\tthread.id === actionState?.id && (\n\t\t\t\t\t\t<ConfirmDialog\n\t\t\t\t\t\t\tisOpen={ isConfirmDialogOpen }\n\t\t\t\t\t\t\tonConfirm={ handleConfirmDelete }\n\t\t\t\t\t\t\tonCancel={ handleCancelDelete }\n\t\t\t\t\t\t\tconfirmButtonText=\"Yes\"\n\t\t\t\t\t\t\tcancelButtonText=\"No\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// translators: message displayed when confirming an action\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Are you sure you want to delete this comment?'\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</ConfirmDialog>\n\t\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t{\n\t\t\t\t// If there are no comments, show a message indicating no comments are available.\n\t\t\t\t( ! Array.isArray( threads ) || threads.length === 0 ) && (\n\t\t\t\t\t<VStack\n\t\t\t\t\t\talignment=\"left\"\n\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__thread\"\n\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t\tspacing=\"3\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// translators: message displayed when there are no comments available\n\t\t\t\t\t\t\t__( 'No comments available' )\n\t\t\t\t\t\t}\n\t\t\t\t\t</VStack>\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t{ Array.isArray( threads ) &&\n\t\t\t\tthreads.length > 0 &&\n\t\t\t\tthreads.map( ( thread ) => (\n\t\t\t\t\t<VStack\n\t\t\t\t\t\tkey={ thread.id }\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t'editor-collab-sidebar-panel__thread',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'editor-collab-sidebar-panel__active-thread':\n\t\t\t\t\t\t\t\t\tblockCommentId &&\n\t\t\t\t\t\t\t\t\tblockCommentId === thread.id,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tid={ thread.id }\n\t\t\t\t\t\tspacing=\"3\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<CommentBoard thread={ thread } />\n\t\t\t\t\t\t{ 'reply' === actionState?.action &&\n\t\t\t\t\t\t\tthread.id === actionState?.id && (\n\t\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\t\talignment=\"left\"\n\t\t\t\t\t\t\t\t\tspacing=\"3\"\n\t\t\t\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__user-comment\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\t\t\t\tspacing=\"3\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__comment-field\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<CommentForm\n\t\t\t\t\t\t\t\t\t\t\tonSubmit={ ( inputComment ) => {\n\t\t\t\t\t\t\t\t\t\t\t\tonAddReply(\n\t\t\t\t\t\t\t\t\t\t\t\t\tinputComment,\n\t\t\t\t\t\t\t\t\t\t\t\t\tthread.id\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\tsetActionState( false );\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\tonCancel={ () =>\n\t\t\t\t\t\t\t\t\t\t\t\tsetActionState( false )\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ 0 < thread?.reply?.length &&\n\t\t\t\t\t\t\tthread.reply.map( ( reply ) => (\n\t\t\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\t\t\tkey={ reply.id }\n\t\t\t\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__child-thread\"\n\t\t\t\t\t\t\t\t\tid={ reply.id }\n\t\t\t\t\t\t\t\t\tspacing=\"2\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<CommentBoard\n\t\t\t\t\t\t\t\t\t\tthread={ reply }\n\t\t\t\t\t\t\t\t\t\tparentThread={ thread }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t</VStack>\n\t\t\t\t) ) }\n\t\t</>\n\t);\n}\n\n/**\n * EditComment component.\n *\n * @param {Object} props - The component props.\n * @param {Function} props.onSubmit - The function to call when updating the comment.\n * @param {Function} props.onCancel - The function to call when canceling the comment update.\n * @param {Object} props.thread - The comment thread object.\n * @return {JSX.Element} The CommentForm component.\n */\nfunction CommentForm( { onSubmit, onCancel, thread } ) {\n\tconst [ inputComment, setInputComment ] = useState(\n\t\tthread?.content?.raw ?? ''\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<TextareaControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tvalue={ inputComment ?? '' }\n\t\t\t\tonChange={ setInputComment }\n\t\t\t/>\n\t\t\t<VStack alignment=\"left\" spacing=\"3\" justify=\"flex-start\">\n\t\t\t\t<HStack alignment=\"left\" spacing=\"3\" justify=\"flex-start\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ () => onSubmit( inputComment ) }\n\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t0 === sanitizeCommentString( inputComment ).length\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ thread\n\t\t\t\t\t\t\t? _x( 'Update', 'verb' )\n\t\t\t\t\t\t\t: _x( 'Reply', 'Add reply comment' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button __next40pxDefaultSize onClick={ onCancel }>\n\t\t\t\t\t\t{ _x( 'Cancel', 'Cancel comment edit' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</>\n\t);\n}\n\n/**\n * Renders the header of a comment in the collaboration sidebar.\n *\n * @param {Object} props - The component props.\n * @param {Object} props.thread - The comment thread object.\n * @param {Function} props.onResolve - The function to resolve the comment.\n * @param {Function} props.onEdit - The function to edit the comment.\n * @param {Function} props.onDelete - The function to delete the comment.\n * @param {Function} props.onReply - The function to reply to the comment.\n * @param {string} props.status - The status of the comment.\n * @return {JSX.Element} The rendered comment header.\n */\nfunction CommentHeader( {\n\tthread,\n\tonResolve,\n\tonEdit,\n\tonDelete,\n\tonReply,\n\tstatus,\n} ) {\n\tconst dateSettings = getDateSettings();\n\tconst [ dateTimeFormat = dateSettings.formats.time ] = useEntityProp(\n\t\t'root',\n\t\t'site',\n\t\t'time_format'\n\t);\n\n\tconst actions = [\n\t\t{\n\t\t\ttitle: _x( 'Edit', 'Edit comment' ),\n\t\t\tonClick: onEdit,\n\t\t},\n\t\t{\n\t\t\ttitle: _x( 'Delete', 'Delete comment' ),\n\t\t\tonClick: onDelete,\n\t\t},\n\t\t{\n\t\t\ttitle: _x( 'Reply', 'Reply on a comment' ),\n\t\t\tonClick: onReply,\n\t\t},\n\t];\n\n\tconst moreActions = actions.filter( ( item ) => item.onClick );\n\n\treturn (\n\t\t<HStack alignment=\"left\" spacing=\"3\" justify=\"flex-start\">\n\t\t\t<img\n\t\t\t\tsrc={ thread?.author_avatar_urls?.[ 48 ] }\n\t\t\t\tclassName=\"editor-collab-sidebar-panel__user-avatar\"\n\t\t\t\t// translators: alt text for user avatar image\n\t\t\t\talt={ __( 'User avatar' ) }\n\t\t\t\twidth={ 32 }\n\t\t\t\theight={ 32 }\n\t\t\t/>\n\t\t\t<VStack spacing=\"0\">\n\t\t\t\t<span className=\"editor-collab-sidebar-panel__user-name\">\n\t\t\t\t\t{ thread.author_name }\n\t\t\t\t</span>\n\t\t\t\t<time\n\t\t\t\t\tdateTime={ format( 'h:i A', thread.date ) }\n\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__user-time\"\n\t\t\t\t>\n\t\t\t\t\t{ dateI18n( dateTimeFormat, thread.date ) }\n\t\t\t\t</time>\n\t\t\t</VStack>\n\t\t\t<span className=\"editor-collab-sidebar-panel__comment-status\">\n\t\t\t\t{ status !== 'approved' && (\n\t\t\t\t\t<HStack alignment=\"right\" justify=\"flex-end\" spacing=\"0\">\n\t\t\t\t\t\t{ 0 === thread.parent && onResolve && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t'Resolve',\n\t\t\t\t\t\t\t\t\t'Mark comment as resolved'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\ticon={ published }\n\t\t\t\t\t\t\t\tonClick={ onResolve }\n\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Select an action',\n\t\t\t\t\t\t\t\t'Select comment action'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tclassName=\"editor-collab-sidebar-panel__comment-dropdown-menu\"\n\t\t\t\t\t\t\tcontrols={ moreActions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</HStack>\n\t\t\t\t) }\n\t\t\t\t{ status === 'approved' && (\n\t\t\t\t\t// translators: tooltip for resolved comment\n\t\t\t\t\t<Tooltip text={ __( 'Resolved' ) }>\n\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QAACC,SAAS,EAAC,OAAO;QAACE,OAAO,EAAC,UAAU;QAACD,OAAO,EAAC,GAAG;QAAAb,QAAA,GACrD,CAAC,KAAKL,MAAM,CAAC4E,MAAM,IAAIpE,SAAS,iBACjC,IAAAlC,WAAA,CAAAgC,GAAA,EAACxC,WAAA,CAAAiF,MAAM;UACN8B,KAAK,EAAG,IAAAvB,QAAE,EACT,SAAS,EACT,0BACD,CAAG;UACHN,qBAAqB;UACrB8B,IAAI,EAAGC,gBAAW;UAClB5B,OAAO,EAAG3C,SAAW;UACrBwE,WAAW;QAAA,CACX,CACD,eACD,IAAA1G,WAAA,CAAAgC,GAAA,EAACxC,WAAA,CAAAmH,YAAY;UACZH,IAAI,EAAGI,mBAAc;UACrBL,KAAK,EAAG,IAAAvB,QAAE,EACT,kBAAkB,EAClB,uBACD,CAAG;UACHlC,SAAS,EAAC,oDAAoD;UAC9D+D,QAAQ,EAAGpB;QAAa,CACxB,CAAC;MAAA,CACK,CACR,EACChD,MAAM,KAAK,UAAU;MAAA;MACtB;MACA,IAAAzC,WAAA,CAAAgC,GAAA,EAACxC,WAAA,CAAAsH,OAAO;QAACC,IAAI,EAAG,IAAAnD,QAAE,EAAE,UAAW,CAAG;QAAA7B,QAAA,eACjC,IAAA/B,WAAA,CAAAgC,GAAA,EAACtC,MAAA,CAAAsH,IAAI;UAACR,IAAI,EAAGS;QAAO,CAAE;MAAC,CACf,CACT;IAAA,CACI,CAAC;EAAA,CACA,CAAC;AAEX","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["collabSidebarName","exports"],"sources":["@wordpress/editor/src/components/collab-sidebar/constants.js"],"sourcesContent":["export const collabSidebarName = 'edit-post/collab-sidebar';\n"],"mappings":";;;;;;AAAO,MAAMA,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,0BAA0B","ignoreList":[]}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = CollabSidebar;
|
|
8
|
+
var _i18n = require("@wordpress/i18n");
|
|
9
|
+
var _data = require("@wordpress/data");
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
var _icons = require("@wordpress/icons");
|
|
12
|
+
var _hooks = require("@wordpress/hooks");
|
|
13
|
+
var _notices = require("@wordpress/notices");
|
|
14
|
+
var _coreData = require("@wordpress/core-data");
|
|
15
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
16
|
+
var _interface = require("@wordpress/interface");
|
|
17
|
+
var _pluginSidebar = _interopRequireDefault(require("../plugin-sidebar"));
|
|
18
|
+
var _constants = require("./constants");
|
|
19
|
+
var _comments = require("./comments");
|
|
20
|
+
var _addComment = require("./add-comment");
|
|
21
|
+
var _store = require("../../store");
|
|
22
|
+
var _commentButton = _interopRequireDefault(require("./comment-button"));
|
|
23
|
+
var _commentButtonToolbar = _interopRequireDefault(require("./comment-button-toolbar"));
|
|
24
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
+
/**
|
|
26
|
+
* WordPress dependencies
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Internal dependencies
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
const threadsEmptyArray = [];
|
|
34
|
+
const isBlockCommentExperimentEnabled = window?.__experimentalEnableBlockComment;
|
|
35
|
+
const modifyBlockCommentAttributes = settings => {
|
|
36
|
+
if (!settings.attributes.blockCommentId) {
|
|
37
|
+
settings.attributes = {
|
|
38
|
+
...settings.attributes,
|
|
39
|
+
blockCommentId: {
|
|
40
|
+
type: 'number'
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return settings;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// Apply the filter to all core blocks
|
|
48
|
+
(0, _hooks.addFilter)('blocks.registerBlockType', 'block-comment/modify-core-block-attributes', modifyBlockCommentAttributes);
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Renders the Collab sidebar.
|
|
52
|
+
*/
|
|
53
|
+
function CollabSidebar() {
|
|
54
|
+
const {
|
|
55
|
+
createNotice
|
|
56
|
+
} = (0, _data.useDispatch)(_notices.store);
|
|
57
|
+
const {
|
|
58
|
+
saveEntityRecord,
|
|
59
|
+
deleteEntityRecord
|
|
60
|
+
} = (0, _data.useDispatch)(_coreData.store);
|
|
61
|
+
const {
|
|
62
|
+
getEntityRecord
|
|
63
|
+
} = (0, _data.resolveSelect)(_coreData.store);
|
|
64
|
+
const {
|
|
65
|
+
enableComplementaryArea
|
|
66
|
+
} = (0, _data.useDispatch)(_interface.store);
|
|
67
|
+
const [blockCommentID, setBlockCommentID] = (0, _element.useState)(null);
|
|
68
|
+
const [showCommentBoard, setShowCommentBoard] = (0, _element.useState)(false);
|
|
69
|
+
const {
|
|
70
|
+
postId
|
|
71
|
+
} = (0, _data.useSelect)(select => {
|
|
72
|
+
return {
|
|
73
|
+
postId: select(_store.store).getCurrentPostId()
|
|
74
|
+
};
|
|
75
|
+
}, []);
|
|
76
|
+
const postStatus = (0, _data.useSelect)(select => {
|
|
77
|
+
const post = select(_store.store).getCurrentPost();
|
|
78
|
+
return {
|
|
79
|
+
postStatus: post?.status
|
|
80
|
+
};
|
|
81
|
+
}, []);
|
|
82
|
+
const threads = (0, _data.useSelect)(select => {
|
|
83
|
+
if (!postId) {
|
|
84
|
+
return threadsEmptyArray;
|
|
85
|
+
}
|
|
86
|
+
const {
|
|
87
|
+
getEntityRecords
|
|
88
|
+
} = select(_coreData.store);
|
|
89
|
+
const data = getEntityRecords('root', 'comment', {
|
|
90
|
+
post: postId,
|
|
91
|
+
type: 'block_comment',
|
|
92
|
+
status: 'any',
|
|
93
|
+
per_page: 100
|
|
94
|
+
});
|
|
95
|
+
return data || threadsEmptyArray;
|
|
96
|
+
}, [postId]);
|
|
97
|
+
const clientId = (0, _data.useSelect)(select => {
|
|
98
|
+
const {
|
|
99
|
+
getSelectedBlockClientId
|
|
100
|
+
} = select(_blockEditor.store);
|
|
101
|
+
return getSelectedBlockClientId();
|
|
102
|
+
}, []);
|
|
103
|
+
const blockDetails = (0, _data.useSelect)(select => {
|
|
104
|
+
return clientId ? select(_blockEditor.store).getBlock(clientId) : null;
|
|
105
|
+
}, [clientId]);
|
|
106
|
+
|
|
107
|
+
// Get the dispatch functions to save the comment and update the block attributes.
|
|
108
|
+
const {
|
|
109
|
+
updateBlockAttributes
|
|
110
|
+
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
111
|
+
|
|
112
|
+
// Process comments to build the tree structure
|
|
113
|
+
const resultComments = (0, _element.useMemo)(() => {
|
|
114
|
+
// Create a compare to store the references to all objects by id
|
|
115
|
+
const compare = {};
|
|
116
|
+
const result = [];
|
|
117
|
+
const filteredComments = threads.filter(comment => comment.status !== 'trash');
|
|
118
|
+
|
|
119
|
+
// Initialize each object with an empty `reply` array
|
|
120
|
+
filteredComments.forEach(item => {
|
|
121
|
+
compare[item.id] = {
|
|
122
|
+
...item,
|
|
123
|
+
reply: []
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
// Iterate over the data to build the tree structure
|
|
128
|
+
filteredComments.forEach(item => {
|
|
129
|
+
if (item.parent === 0) {
|
|
130
|
+
// If parent is 0, it's a root item, push it to the result array
|
|
131
|
+
result.push(compare[item.id]);
|
|
132
|
+
} else if (compare[item.parent]) {
|
|
133
|
+
// Otherwise, find its parent and push it to the parent's `reply` array
|
|
134
|
+
compare[item.parent].reply.push(compare[item.id]);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
return result;
|
|
138
|
+
}, [threads]);
|
|
139
|
+
const openCollabBoard = () => {
|
|
140
|
+
setShowCommentBoard(true);
|
|
141
|
+
enableComplementaryArea('core', 'edit-post/collab-sidebar');
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// Function to save the comment.
|
|
145
|
+
const addNewComment = async (comment, parentCommentId) => {
|
|
146
|
+
const args = {
|
|
147
|
+
post: postId,
|
|
148
|
+
content: comment,
|
|
149
|
+
comment_type: 'block_comment',
|
|
150
|
+
comment_approved: 0
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
// Create a new object, conditionally including the parent property
|
|
154
|
+
const updatedArgs = {
|
|
155
|
+
...args,
|
|
156
|
+
...(parentCommentId ? {
|
|
157
|
+
parent: parentCommentId
|
|
158
|
+
} : {})
|
|
159
|
+
};
|
|
160
|
+
const savedRecord = await saveEntityRecord('root', 'comment', updatedArgs);
|
|
161
|
+
if (savedRecord) {
|
|
162
|
+
// If it's a main comment, update the block attributes with the comment id.
|
|
163
|
+
if (!parentCommentId) {
|
|
164
|
+
updateBlockAttributes(clientId, {
|
|
165
|
+
blockCommentId: savedRecord?.id
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
createNotice('snackbar', parentCommentId ?
|
|
169
|
+
// translators: Reply added successfully
|
|
170
|
+
(0, _i18n.__)('Reply added successfully.') :
|
|
171
|
+
// translators: Comment added successfully
|
|
172
|
+
(0, _i18n.__)('Comment added successfully.'), {
|
|
173
|
+
type: 'snackbar',
|
|
174
|
+
isDismissible: true
|
|
175
|
+
});
|
|
176
|
+
} else {
|
|
177
|
+
onError();
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
const onCommentResolve = async commentId => {
|
|
181
|
+
const savedRecord = await saveEntityRecord('root', 'comment', {
|
|
182
|
+
id: commentId,
|
|
183
|
+
status: 'approved'
|
|
184
|
+
});
|
|
185
|
+
if (savedRecord) {
|
|
186
|
+
// translators: Comment resolved successfully
|
|
187
|
+
createNotice('snackbar', (0, _i18n.__)('Comment marked as resolved.'), {
|
|
188
|
+
type: 'snackbar',
|
|
189
|
+
isDismissible: true
|
|
190
|
+
});
|
|
191
|
+
} else {
|
|
192
|
+
onError();
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
const onEditComment = async (commentId, comment) => {
|
|
196
|
+
const savedRecord = await saveEntityRecord('root', 'comment', {
|
|
197
|
+
id: commentId,
|
|
198
|
+
content: comment
|
|
199
|
+
});
|
|
200
|
+
if (savedRecord) {
|
|
201
|
+
createNotice('snackbar',
|
|
202
|
+
// translators: Comment edited successfully
|
|
203
|
+
(0, _i18n.__)('Comment edited successfully.'), {
|
|
204
|
+
type: 'snackbar',
|
|
205
|
+
isDismissible: true
|
|
206
|
+
});
|
|
207
|
+
} else {
|
|
208
|
+
onError();
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
const onError = () => {
|
|
212
|
+
createNotice('error',
|
|
213
|
+
// translators: Error message when comment submission fails
|
|
214
|
+
(0, _i18n.__)('Something went wrong. Please try publishing the post, or you may have already submitted your comment earlier.'), {
|
|
215
|
+
isDismissible: true
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
const onCommentDelete = async commentId => {
|
|
219
|
+
const childComment = await getEntityRecord('root', 'comment', commentId);
|
|
220
|
+
await deleteEntityRecord('root', 'comment', commentId);
|
|
221
|
+
if (childComment && !childComment.parent) {
|
|
222
|
+
updateBlockAttributes(clientId, {
|
|
223
|
+
blockCommentId: undefined
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
createNotice('snackbar',
|
|
227
|
+
// translators: Comment deleted successfully
|
|
228
|
+
(0, _i18n.__)('Comment deleted successfully.'), {
|
|
229
|
+
type: 'snackbar',
|
|
230
|
+
isDismissible: true
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
(0, _element.useEffect)(() => {
|
|
234
|
+
if (blockDetails) {
|
|
235
|
+
setBlockCommentID(blockDetails?.attributes.blockCommentId);
|
|
236
|
+
}
|
|
237
|
+
}, [postId, clientId]);
|
|
238
|
+
|
|
239
|
+
// Check if the experimental flag is enabled.
|
|
240
|
+
if (!isBlockCommentExperimentEnabled || postStatus.postStatus === 'publish') {
|
|
241
|
+
return null; // or maybe return some message indicating no threads are available.
|
|
242
|
+
}
|
|
243
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
244
|
+
children: [!blockCommentID && /*#__PURE__*/(0, _jsxRuntime.jsx)(_commentButton.default, {
|
|
245
|
+
onClick: openCollabBoard
|
|
246
|
+
}), blockCommentID > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_commentButtonToolbar.default, {
|
|
247
|
+
onClick: openCollabBoard
|
|
248
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_pluginSidebar.default, {
|
|
249
|
+
identifier: _constants.collabSidebarName
|
|
250
|
+
// translators: Comments sidebar title
|
|
251
|
+
,
|
|
252
|
+
title: (0, _i18n.__)('Comments'),
|
|
253
|
+
icon: _icons.comment,
|
|
254
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
255
|
+
className: "editor-collab-sidebar-panel",
|
|
256
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_addComment.AddComment, {
|
|
257
|
+
threads: resultComments,
|
|
258
|
+
onSubmit: addNewComment,
|
|
259
|
+
showCommentBoard: showCommentBoard,
|
|
260
|
+
setShowCommentBoard: setShowCommentBoard
|
|
261
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_comments.Comments, {
|
|
262
|
+
threads: resultComments,
|
|
263
|
+
onEditComment: onEditComment,
|
|
264
|
+
onAddReply: addNewComment,
|
|
265
|
+
onCommentDelete: onCommentDelete,
|
|
266
|
+
onCommentResolve: onCommentResolve
|
|
267
|
+
})]
|
|
268
|
+
})
|
|
269
|
+
})]
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_i18n","require","_data","_element","_icons","_hooks","_notices","_coreData","_blockEditor","_interface","_pluginSidebar","_interopRequireDefault","_constants","_comments","_addComment","_store","_commentButton","_commentButtonToolbar","_jsxRuntime","threadsEmptyArray","isBlockCommentExperimentEnabled","window","__experimentalEnableBlockComment","modifyBlockCommentAttributes","settings","attributes","blockCommentId","type","addFilter","CollabSidebar","createNotice","useDispatch","noticesStore","saveEntityRecord","deleteEntityRecord","coreStore","getEntityRecord","resolveSelect","enableComplementaryArea","interfaceStore","blockCommentID","setBlockCommentID","useState","showCommentBoard","setShowCommentBoard","postId","useSelect","select","editorStore","getCurrentPostId","postStatus","post","getCurrentPost","status","threads","getEntityRecords","data","per_page","clientId","getSelectedBlockClientId","blockEditorStore","blockDetails","getBlock","updateBlockAttributes","resultComments","useMemo","compare","result","filteredComments","filter","comment","forEach","item","id","reply","parent","push","openCollabBoard","addNewComment","parentCommentId","args","content","comment_type","comment_approved","updatedArgs","savedRecord","__","isDismissible","onError","onCommentResolve","commentId","onEditComment","onCommentDelete","childComment","undefined","useEffect","jsxs","Fragment","children","jsx","default","onClick","identifier","collabSidebarName","title","icon","commentIcon","className","AddComment","onSubmit","Comments","onAddReply"],"sources":["@wordpress/editor/src/components/collab-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect, useDispatch, resolveSelect } from '@wordpress/data';\nimport { useState, useEffect, useMemo } from '@wordpress/element';\nimport { comment as commentIcon } from '@wordpress/icons';\nimport { addFilter } from '@wordpress/hooks';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport PluginSidebar from '../plugin-sidebar';\nimport { collabSidebarName } from './constants';\nimport { Comments } from './comments';\nimport { AddComment } from './add-comment';\nimport { store as editorStore } from '../../store';\nimport AddCommentButton from './comment-button';\nimport AddCommentToolbarButton from './comment-button-toolbar';\n\nconst threadsEmptyArray = [];\n\nconst isBlockCommentExperimentEnabled =\n\twindow?.__experimentalEnableBlockComment;\nconst modifyBlockCommentAttributes = ( settings ) => {\n\tif ( ! settings.attributes.blockCommentId ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tblockCommentId: {\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n};\n\n// Apply the filter to all core blocks\naddFilter(\n\t'blocks.registerBlockType',\n\t'block-comment/modify-core-block-attributes',\n\tmodifyBlockCommentAttributes\n);\n\n/**\n * Renders the Collab sidebar.\n */\nexport default function CollabSidebar() {\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord, deleteEntityRecord } = useDispatch( coreStore );\n\tconst { getEntityRecord } = resolveSelect( coreStore );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst [ blockCommentID, setBlockCommentID ] = useState( null );\n\tconst [ showCommentBoard, setShowCommentBoard ] = useState( false );\n\tconst { postId } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostId: select( editorStore ).getCurrentPostId(),\n\t\t};\n\t}, [] );\n\n\tconst postStatus = useSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\treturn { postStatus: post?.status };\n\t}, [] );\n\n\tconst threads = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! postId ) {\n\t\t\t\treturn threadsEmptyArray;\n\t\t\t}\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\tconst data = getEntityRecords( 'root', 'comment', {\n\t\t\t\tpost: postId,\n\t\t\t\ttype: 'block_comment',\n\t\t\t\tstatus: 'any',\n\t\t\t\tper_page: 100,\n\t\t\t} );\n\t\t\treturn data || threadsEmptyArray;\n\t\t},\n\t\t[ postId ]\n\t);\n\n\tconst clientId = useSelect( ( select ) => {\n\t\tconst { getSelectedBlockClientId } = select( blockEditorStore );\n\t\treturn getSelectedBlockClientId();\n\t}, [] );\n\n\tconst blockDetails = useSelect(\n\t\t( select ) => {\n\t\t\treturn clientId\n\t\t\t\t? select( blockEditorStore ).getBlock( clientId )\n\t\t\t\t: null;\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Get the dispatch functions to save the comment and update the block attributes.\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\t// Process comments to build the tree structure\n\tconst resultComments = useMemo( () => {\n\t\t// Create a compare to store the references to all objects by id\n\t\tconst compare = {};\n\t\tconst result = [];\n\n\t\tconst filteredComments = threads.filter(\n\t\t\t( comment ) => comment.status !== 'trash'\n\t\t);\n\n\t\t// Initialize each object with an empty `reply` array\n\t\tfilteredComments.forEach( ( item ) => {\n\t\t\tcompare[ item.id ] = { ...item, reply: [] };\n\t\t} );\n\n\t\t// Iterate over the data to build the tree structure\n\t\tfilteredComments.forEach( ( item ) => {\n\t\t\tif ( item.parent === 0 ) {\n\t\t\t\t// If parent is 0, it's a root item, push it to the result array\n\t\t\t\tresult.push( compare[ item.id ] );\n\t\t\t} else if ( compare[ item.parent ] ) {\n\t\t\t\t// Otherwise, find its parent and push it to the parent's `reply` array\n\t\t\t\tcompare[ item.parent ].reply.push( compare[ item.id ] );\n\t\t\t}\n\t\t} );\n\n\t\treturn result;\n\t}, [ threads ] );\n\n\tconst openCollabBoard = () => {\n\t\tsetShowCommentBoard( true );\n\t\tenableComplementaryArea( 'core', 'edit-post/collab-sidebar' );\n\t};\n\n\t// Function to save the comment.\n\tconst addNewComment = async ( comment, parentCommentId ) => {\n\t\tconst args = {\n\t\t\tpost: postId,\n\t\t\tcontent: comment,\n\t\t\tcomment_type: 'block_comment',\n\t\t\tcomment_approved: 0,\n\t\t};\n\n\t\t// Create a new object, conditionally including the parent property\n\t\tconst updatedArgs = {\n\t\t\t...args,\n\t\t\t...( parentCommentId ? { parent: parentCommentId } : {} ),\n\t\t};\n\n\t\tconst savedRecord = await saveEntityRecord(\n\t\t\t'root',\n\t\t\t'comment',\n\t\t\tupdatedArgs\n\t\t);\n\n\t\tif ( savedRecord ) {\n\t\t\t// If it's a main comment, update the block attributes with the comment id.\n\t\t\tif ( ! parentCommentId ) {\n\t\t\t\tupdateBlockAttributes( clientId, {\n\t\t\t\t\tblockCommentId: savedRecord?.id,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tcreateNotice(\n\t\t\t\t'snackbar',\n\t\t\t\tparentCommentId\n\t\t\t\t\t? // translators: Reply added successfully\n\t\t\t\t\t __( 'Reply added successfully.' )\n\t\t\t\t\t: // translators: Comment added successfully\n\t\t\t\t\t __( 'Comment added successfully.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tisDismissible: true,\n\t\t\t\t}\n\t\t\t);\n\t\t} else {\n\t\t\tonError();\n\t\t}\n\t};\n\n\tconst onCommentResolve = async ( commentId ) => {\n\t\tconst savedRecord = await saveEntityRecord( 'root', 'comment', {\n\t\t\tid: commentId,\n\t\t\tstatus: 'approved',\n\t\t} );\n\n\t\tif ( savedRecord ) {\n\t\t\t// translators: Comment resolved successfully\n\t\t\tcreateNotice( 'snackbar', __( 'Comment marked as resolved.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tisDismissible: true,\n\t\t\t} );\n\t\t} else {\n\t\t\tonError();\n\t\t}\n\t};\n\n\tconst onEditComment = async ( commentId, comment ) => {\n\t\tconst savedRecord = await saveEntityRecord( 'root', 'comment', {\n\t\t\tid: commentId,\n\t\t\tcontent: comment,\n\t\t} );\n\n\t\tif ( savedRecord ) {\n\t\t\tcreateNotice(\n\t\t\t\t'snackbar',\n\t\t\t\t// translators: Comment edited successfully\n\t\t\t\t__( 'Comment edited successfully.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tisDismissible: true,\n\t\t\t\t}\n\t\t\t);\n\t\t} else {\n\t\t\tonError();\n\t\t}\n\t};\n\n\tconst onError = () => {\n\t\tcreateNotice(\n\t\t\t'error',\n\t\t\t// translators: Error message when comment submission fails\n\t\t\t__(\n\t\t\t\t'Something went wrong. Please try publishing the post, or you may have already submitted your comment earlier.'\n\t\t\t),\n\t\t\t{\n\t\t\t\tisDismissible: true,\n\t\t\t}\n\t\t);\n\t};\n\n\tconst onCommentDelete = async ( commentId ) => {\n\t\tconst childComment = await getEntityRecord(\n\t\t\t'root',\n\t\t\t'comment',\n\t\t\tcommentId\n\t\t);\n\t\tawait deleteEntityRecord( 'root', 'comment', commentId );\n\n\t\tif ( childComment && ! childComment.parent ) {\n\t\t\tupdateBlockAttributes( clientId, {\n\t\t\t\tblockCommentId: undefined,\n\t\t\t} );\n\t\t}\n\n\t\tcreateNotice(\n\t\t\t'snackbar',\n\t\t\t// translators: Comment deleted successfully\n\t\t\t__( 'Comment deleted successfully.' ),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tisDismissible: true,\n\t\t\t}\n\t\t);\n\t};\n\n\tuseEffect( () => {\n\t\tif ( blockDetails ) {\n\t\t\tsetBlockCommentID( blockDetails?.attributes.blockCommentId );\n\t\t}\n\t}, [ postId, clientId ] );\n\n\t// Check if the experimental flag is enabled.\n\tif (\n\t\t! isBlockCommentExperimentEnabled ||\n\t\tpostStatus.postStatus === 'publish'\n\t) {\n\t\treturn null; // or maybe return some message indicating no threads are available.\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ ! blockCommentID && (\n\t\t\t\t<AddCommentButton onClick={ openCollabBoard } />\n\t\t\t) }\n\n\t\t\t{ blockCommentID > 0 && (\n\t\t\t\t<AddCommentToolbarButton onClick={ openCollabBoard } />\n\t\t\t) }\n\t\t\t<PluginSidebar\n\t\t\t\tidentifier={ collabSidebarName }\n\t\t\t\t// translators: Comments sidebar title\n\t\t\t\ttitle={ __( 'Comments' ) }\n\t\t\t\ticon={ commentIcon }\n\t\t\t>\n\t\t\t\t<div className=\"editor-collab-sidebar-panel\">\n\t\t\t\t\t<AddComment\n\t\t\t\t\t\tthreads={ resultComments }\n\t\t\t\t\t\tonSubmit={ addNewComment }\n\t\t\t\t\t\tshowCommentBoard={ showCommentBoard }\n\t\t\t\t\t\tsetShowCommentBoard={ setShowCommentBoard }\n\t\t\t\t\t/>\n\t\t\t\t\t<Comments\n\t\t\t\t\t\tthreads={ resultComments }\n\t\t\t\t\t\tonEditComment={ onEditComment }\n\t\t\t\t\t\tonAddReply={ addNewComment }\n\t\t\t\t\t\tonCommentDelete={ onCommentDelete }\n\t\t\t\t\t\tonCommentResolve={ onCommentResolve }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</PluginSidebar>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AAKA,IAAAS,cAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,UAAA,GAAAX,OAAA;AACA,IAAAY,SAAA,GAAAZ,OAAA;AACA,IAAAa,WAAA,GAAAb,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AACA,IAAAe,cAAA,GAAAL,sBAAA,CAAAV,OAAA;AACA,IAAAgB,qBAAA,GAAAN,sBAAA,CAAAV,OAAA;AAA+D,IAAAiB,WAAA,GAAAjB,OAAA;AAtB/D;AACA;AACA;;AAWA;AACA;AACA;;AASA,MAAMkB,iBAAiB,GAAG,EAAE;AAE5B,MAAMC,+BAA+B,GACpCC,MAAM,EAAEC,gCAAgC;AACzC,MAAMC,4BAA4B,GAAKC,QAAQ,IAAM;EACpD,IAAK,CAAEA,QAAQ,CAACC,UAAU,CAACC,cAAc,EAAG;IAC3CF,QAAQ,CAACC,UAAU,GAAG;MACrB,GAAGD,QAAQ,CAACC,UAAU;MACtBC,cAAc,EAAE;QACfC,IAAI,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AA8E,IAAA;QAAKW,SAAS,EAAC,6BAA6B;QAAAT,QAAA,gBAC3C,IAAAhF,WAAA,CAAAiF,GAAA,EAACrF,WAAA,CAAA8F,UAAU;UACVtD,OAAO,EAAGU,cAAgB;UAC1B6C,QAAQ,EAAG/B,aAAe;UAC1BnC,gBAAgB,EAAGA,gBAAkB;UACrCC,mBAAmB,EAAGA;QAAqB,CAC3C,CAAC,eACF,IAAA1B,WAAA,CAAAiF,GAAA,EAACtF,SAAA,CAAAiG,QAAQ;UACRxD,OAAO,EAAGU,cAAgB;UAC1B2B,aAAa,EAAGA,aAAe;UAC/BoB,UAAU,EAAGjC,aAAe;UAC5Bc,eAAe,EAAGA,eAAiB;UACnCH,gBAAgB,EAAGA;QAAkB,CACrC,CAAC;MAAA,CACE;IAAC,CACQ,CAAC;EAAA,CACf,CAAC;AAEL","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.sanitizeCommentString = sanitizeCommentString;
|
|
7
|
+
/**
|
|
8
|
+
* Sanitizes a comment string by removing non-printable ASCII characters.
|
|
9
|
+
*
|
|
10
|
+
* @param {string} str - The comment string to sanitize.
|
|
11
|
+
* @return {string} - The sanitized comment string.
|
|
12
|
+
*/
|
|
13
|
+
function sanitizeCommentString(str) {
|
|
14
|
+
return str.trim();
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["sanitizeCommentString","str","trim"],"sources":["@wordpress/editor/src/components/collab-sidebar/utils.js"],"sourcesContent":["/**\n * Sanitizes a comment string by removing non-printable ASCII characters.\n *\n * @param {string} str - The comment string to sanitize.\n * @return {string} - The sanitized comment string.\n */\nexport function sanitizeCommentString( str ) {\n\treturn str.trim();\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,qBAAqBA,CAAEC,GAAG,EAAG;EAC5C,OAAOA,GAAG,CAACC,IAAI,CAAC,CAAC;AAClB","ignoreList":[]}
|
|
@@ -61,7 +61,7 @@ function useEditorCommandLoader() {
|
|
|
61
61
|
isDistractionFree: get('core', 'distractionFree'),
|
|
62
62
|
isFocusMode: get('core', 'focusMode'),
|
|
63
63
|
isTopToolbar: get('core', 'fixedToolbar'),
|
|
64
|
-
isPreviewMode: getSettings().
|
|
64
|
+
isPreviewMode: getSettings().isPreviewMode,
|
|
65
65
|
isViewable: (_getPostType$viewable = getPostType(getCurrentPostType())?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false,
|
|
66
66
|
isCodeEditingEnabled: getEditorSettings().codeEditingEnabled,
|
|
67
67
|
isRichEditingEnabled: getEditorSettings().richEditingEnabled,
|
|
@@ -112,7 +112,7 @@ function useEditorCommandLoader() {
|
|
|
112
112
|
});
|
|
113
113
|
commands.push({
|
|
114
114
|
name: 'core/toggle-distraction-free',
|
|
115
|
-
label: isDistractionFree ? (0, _i18n.__)('Exit Distraction
|
|
115
|
+
label: isDistractionFree ? (0, _i18n.__)('Exit Distraction free') : (0, _i18n.__)('Enter Distraction free'),
|
|
116
116
|
callback: ({
|
|
117
117
|
close
|
|
118
118
|
}) => {
|
|
@@ -132,7 +132,7 @@ function useEditorCommandLoader() {
|
|
|
132
132
|
});
|
|
133
133
|
commands.push({
|
|
134
134
|
name: 'core/toggle-spotlight-mode',
|
|
135
|
-
label: (0, _i18n.__)('
|
|
135
|
+
label: isFocusMode ? (0, _i18n.__)('Exit Spotlight mode') : (0, _i18n.__)('Enter Spotlight mode'),
|
|
136
136
|
callback: ({
|
|
137
137
|
close
|
|
138
138
|
}) => {
|
|
@@ -167,7 +167,7 @@ function useEditorCommandLoader() {
|
|
|
167
167
|
});
|
|
168
168
|
commands.push({
|
|
169
169
|
name: 'core/toggle-top-toolbar',
|
|
170
|
-
label: (0, _i18n.__)('
|
|
170
|
+
label: (0, _i18n.__)('Top toolbar'),
|
|
171
171
|
callback: ({
|
|
172
172
|
close
|
|
173
173
|
}) => {
|
|
@@ -217,7 +217,7 @@ function useEditorCommandLoader() {
|
|
|
217
217
|
});
|
|
218
218
|
commands.push({
|
|
219
219
|
name: 'core/open-settings-sidebar',
|
|
220
|
-
label: (0, _i18n.__)('
|
|
220
|
+
label: (0, _i18n.__)('Show or hide the Settings panel.'),
|
|
221
221
|
icon: (0, _i18n.isRTL)() ? _icons.drawerLeft : _icons.drawerRight,
|
|
222
222
|
callback: ({
|
|
223
223
|
close
|
|
@@ -233,7 +233,7 @@ function useEditorCommandLoader() {
|
|
|
233
233
|
});
|
|
234
234
|
commands.push({
|
|
235
235
|
name: 'core/open-block-inspector',
|
|
236
|
-
label: (0, _i18n.__)('
|
|
236
|
+
label: (0, _i18n.__)('Show or hide the Block settings panel'),
|
|
237
237
|
icon: _icons.blockDefault,
|
|
238
238
|
callback: ({
|
|
239
239
|
close
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_i18n","_icons","_commands","_preferences","_notices","_blockEditor","_coreData","_interface","_store","_constants","_patternRenameModal","_patternDuplicateModal","useEditorCommandLoader","editorMode","isListViewOpen","showBlockBreadcrumbs","isDistractionFree","isTopToolbar","isFocusMode","isPreviewMode","isViewable","isCodeEditingEnabled","isRichEditingEnabled","isPublishSidebarEnabled","useSelect","select","_get","_getPostType$viewable","get","preferencesStore","isListViewOpened","getCurrentPostType","getEditorSettings","editorStore","getSettings","blockEditorStore","getPostType","coreStore","__unstableIsPreviewMode","viewable","codeEditingEnabled","richEditingEnabled","getActiveComplementaryArea","interfaceStore","toggle","useDispatch","createInfoNotice","noticesStore","__unstableSaveForPreview","setIsListViewOpened","switchEditorMode","toggleDistractionFree","openModal","enableComplementaryArea","disableComplementaryArea","getCurrentPostId","allowSwitchEditorMode","commands","isLoading","push","name","label","__","icon","keyboard","callback","close","id","type","actions","onClick","listView","code","isRTL","drawerLeft","drawerRight","activeSidebar","blockDefault","formatListBullets","external","postId","link","window","open","useEditedEntityContextualCommands","postType","PATTERN_POST_TYPE","edit","patternRenameModalName","symbol","patternDuplicateModalName","useCommands","useCommandLoader","hook","context"],"sources":["@wordpress/editor/src/components/commands/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tblockDefault,\n\tcode,\n\tdrawerLeft,\n\tdrawerRight,\n\tedit,\n\tformatListBullets,\n\tlistView,\n\texternal,\n\tkeyboard,\n\tsymbol,\n} from '@wordpress/icons';\nimport { useCommandLoader } from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { PATTERN_POST_TYPE } from '../../store/constants';\nimport { modalName as patternRenameModalName } from '../pattern-rename-modal';\nimport { modalName as patternDuplicateModalName } from '../pattern-duplicate-modal';\n\nfunction useEditorCommandLoader() {\n\tconst {\n\t\teditorMode,\n\t\tisListViewOpen,\n\t\tshowBlockBreadcrumbs,\n\t\tisDistractionFree,\n\t\tisTopToolbar,\n\t\tisFocusMode,\n\t\tisPreviewMode,\n\t\tisViewable,\n\t\tisCodeEditingEnabled,\n\t\tisRichEditingEnabled,\n\t\tisPublishSidebarEnabled,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { isListViewOpened, getCurrentPostType, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { getPostType } = select( coreStore );\n\n\t\treturn {\n\t\t\teditorMode: get( 'core', 'editorMode' ) ?? 'visual',\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tisFocusMode: get( 'core', 'focusMode' ),\n\t\t\tisTopToolbar: get( 'core', 'fixedToolbar' ),\n\t\t\tisPreviewMode: getSettings().__unstableIsPreviewMode,\n\t\t\tisViewable: getPostType( getCurrentPostType() )?.viewable ?? false,\n\t\t\tisCodeEditingEnabled: getEditorSettings().codeEditingEnabled,\n\t\t\tisRichEditingEnabled: getEditorSettings().richEditingEnabled,\n\t\t\tisPublishSidebarEnabled:\n\t\t\t\tselect( editorStore ).isPublishSidebarEnabled(),\n\t\t};\n\t}, [] );\n\tconst { getActiveComplementaryArea } = useSelect( interfaceStore );\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\tconst {\n\t\t__unstableSaveForPreview,\n\t\tsetIsListViewOpened,\n\t\tswitchEditorMode,\n\t\ttoggleDistractionFree,\n\t} = useDispatch( editorStore );\n\tconst { openModal, enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\tconst { getCurrentPostId } = useSelect( editorStore );\n\tconst allowSwitchEditorMode = isCodeEditingEnabled && isRichEditingEnabled;\n\n\tif ( isPreviewMode ) {\n\t\treturn { commands: [], isLoading: false };\n\t}\n\n\tconst commands = [];\n\n\tcommands.push( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Keyboard shortcuts' ),\n\t\ticon: keyboard,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\topenModal( 'editor/keyboard-shortcut-help' );\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-distraction-free',\n\t\tlabel: isDistractionFree\n\t\t\t? __( 'Exit Distraction Free' )\n\t\t\t: __( 'Enter Distraction Free' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggleDistractionFree();\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Editor preferences' ),\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\topenModal( 'editor/preferences' );\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-spotlight-mode',\n\t\tlabel: __( 'Toggle spotlight' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'focusMode' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisFocusMode ? __( 'Spotlight off.' ) : __( 'Spotlight on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/editor/toggle-spotlight-mode/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core', 'focusMode' );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-list-view',\n\t\tlabel: isListViewOpen\n\t\t\t? __( 'Close List View' )\n\t\t\t: __( 'Open List View' ),\n\t\ticon: listView,\n\t\tcallback: ( { close } ) => {\n\t\t\tsetIsListViewOpened( ! isListViewOpen );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisListViewOpen ? __( 'List View off.' ) : __( 'List View on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/editor/toggle-list-view/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-top-toolbar',\n\t\tlabel: __( 'Toggle top toolbar' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'fixedToolbar' );\n\t\t\tif ( isDistractionFree ) {\n\t\t\t\ttoggleDistractionFree();\n\t\t\t}\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisTopToolbar\n\t\t\t\t\t? __( 'Top toolbar off.' )\n\t\t\t\t\t: __( 'Top toolbar on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/editor/toggle-top-toolbar/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core', 'fixedToolbar' );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tif ( allowSwitchEditorMode ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-code-editor',\n\t\t\tlabel:\n\t\t\t\teditorMode === 'visual'\n\t\t\t\t\t? __( 'Open code editor' )\n\t\t\t\t\t: __( 'Exit code editor' ),\n\t\t\ticon: code,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tswitchEditorMode( editorMode === 'visual' ? 'text' : 'visual' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\tcommands.push( {\n\t\tname: 'core/toggle-breadcrumbs',\n\t\tlabel: showBlockBreadcrumbs\n\t\t\t? __( 'Hide block breadcrumbs' )\n\t\t\t: __( 'Show block breadcrumbs' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'showBlockBreadcrumbs' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tshowBlockBreadcrumbs\n\t\t\t\t\t? __( 'Breadcrumbs hidden.' )\n\t\t\t\t\t: __( 'Breadcrumbs visible.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/editor/toggle-breadcrumbs/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tconst activeSidebar = getActiveComplementaryArea( 'core' );\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/document' ) {\n\t\t\t\tdisableComplementaryArea( 'core' );\n\t\t\t} else {\n\t\t\t\tenableComplementaryArea( 'core', 'edit-post/document' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tconst activeSidebar = getActiveComplementaryArea( 'core' );\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/block' ) {\n\t\t\t\tdisableComplementaryArea( 'core' );\n\t\t\t} else {\n\t\t\t\tenableComplementaryArea( 'core', 'edit-post/block' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-publish-sidebar',\n\t\tlabel: isPublishSidebarEnabled\n\t\t\t? __( 'Disable pre-publish checks' )\n\t\t\t: __( 'Enable pre-publish checks' ),\n\t\ticon: formatListBullets,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\ttoggle( 'core', 'isPublishSidebarEnabled' );\n\t\t\tcreateInfoNotice(\n\t\t\t\tisPublishSidebarEnabled\n\t\t\t\t\t? __( 'Pre-publish checks disabled.' )\n\t\t\t\t\t: __( 'Pre-publish checks enabled.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/editor/publish-sidebar/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tif ( isViewable ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/preview-link',\n\t\t\tlabel: __( 'Preview in a new tab' ),\n\t\t\ticon: external,\n\t\t\tcallback: async ( { close } ) => {\n\t\t\t\tclose();\n\t\t\t\tconst postId = getCurrentPostId();\n\t\t\t\tconst link = await __unstableSaveForPreview();\n\t\t\t\twindow.open( link, `wp-preview-${ postId }` );\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn {\n\t\tcommands,\n\t\tisLoading: false,\n\t};\n}\n\nfunction useEditedEntityContextualCommands() {\n\tconst { postType } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType } = select( editorStore );\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst commands = [];\n\n\tif ( postType === PATTERN_POST_TYPE ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/rename-pattern',\n\t\t\tlabel: __( 'Rename pattern' ),\n\t\t\ticon: edit,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\topenModal( patternRenameModalName );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t\tcommands.push( {\n\t\t\tname: 'core/duplicate-pattern',\n\t\t\tlabel: __( 'Duplicate pattern' ),\n\t\t\ticon: symbol,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\topenModal( patternDuplicateModalName );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nexport default function useCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/editor/edit-ui',\n\t\thook: useEditorCommandLoader,\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/editor/contextual-commands',\n\t\thook: useEditedEntityContextualCommands,\n\t\tcontext: 'entity-edit',\n\t} );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAYA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,G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;MAC9BC,KAAK,EAAE,IAAAC,QAAE,EAAE,mBAAoB,CAAC;MAChCC,IAAI,EAAE0B,aAAM;MACZxB,QAAQ,EAAEA,CAAE;QAAEC;MAAM,CAAC,KAAM;QAC1Bd,SAAS,CAAEsC,gCAA0B,CAAC;QACtCxB,KAAK,CAAC,CAAC;MACR;IACD,CAAE,CAAC;EACJ;EAEA,OAAO;IAAER,SAAS,EAAE,KAAK;IAAED;EAAS,CAAC;AACtC;AAEe,SAASkC,WAAWA,CAAA,EAAG;EACrC,IAAAC,0BAAgB,EAAE;IACjBhC,IAAI,EAAE,qBAAqB;IAC3BiC,IAAI,EAAEjF;EACP,CAAE,CAAC;EAEH,IAAAgF,0BAAgB,EAAE;IACjBhC,IAAI,EAAE,iCAAiC;IACvCiC,IAAI,EAAET,iCAAiC;IACvCU,OAAO,EAAE;EACV,CAAE,CAAC;AACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_data","require","_i18n","_icons","_commands","_preferences","_notices","_blockEditor","_coreData","_interface","_store","_constants","_patternRenameModal","_patternDuplicateModal","useEditorCommandLoader","editorMode","isListViewOpen","showBlockBreadcrumbs","isDistractionFree","isTopToolbar","isFocusMode","isPreviewMode","isViewable","isCodeEditingEnabled","isRichEditingEnabled","isPublishSidebarEnabled","useSelect","select","_get","_getPostType$viewable","get","preferencesStore","isListViewOpened","getCurrentPostType","getEditorSettings","editorStore","getSettings","blockEditorStore","getPostType","coreStore","viewable","codeEditingEnabled","richEditingEnabled","getActiveComplementaryArea","interfaceStore","toggle","useDispatch","createInfoNotice","noticesStore","__unstableSaveForPreview","setIsListViewOpened","switchEditorMode","toggleDistractionFree","openModal","enableComplementaryArea","disableComplementaryArea","getCurrentPostId","allowSwitchEditorMode","commands","isLoading","push","name","label","__","icon","keyboard","callback","close","id","type","actions","onClick","listView","code","isRTL","drawerLeft","drawerRight","activeSidebar","blockDefault","formatListBullets","external","postId","link","window","open","useEditedEntityContextualCommands","postType","PATTERN_POST_TYPE","edit","patternRenameModalName","symbol","patternDuplicateModalName","useCommands","useCommandLoader","hook","context"],"sources":["@wordpress/editor/src/components/commands/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tblockDefault,\n\tcode,\n\tdrawerLeft,\n\tdrawerRight,\n\tedit,\n\tformatListBullets,\n\tlistView,\n\texternal,\n\tkeyboard,\n\tsymbol,\n} from '@wordpress/icons';\nimport { useCommandLoader } from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { PATTERN_POST_TYPE } from '../../store/constants';\nimport { modalName as patternRenameModalName } from '../pattern-rename-modal';\nimport { modalName as patternDuplicateModalName } from '../pattern-duplicate-modal';\n\nfunction useEditorCommandLoader() {\n\tconst {\n\t\teditorMode,\n\t\tisListViewOpen,\n\t\tshowBlockBreadcrumbs,\n\t\tisDistractionFree,\n\t\tisTopToolbar,\n\t\tisFocusMode,\n\t\tisPreviewMode,\n\t\tisViewable,\n\t\tisCodeEditingEnabled,\n\t\tisRichEditingEnabled,\n\t\tisPublishSidebarEnabled,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { isListViewOpened, getCurrentPostType, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { getPostType } = select( coreStore );\n\n\t\treturn {\n\t\t\teditorMode: get( 'core', 'editorMode' ) ?? 'visual',\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tisFocusMode: get( 'core', 'focusMode' ),\n\t\t\tisTopToolbar: get( 'core', 'fixedToolbar' ),\n\t\t\tisPreviewMode: getSettings().isPreviewMode,\n\t\t\tisViewable: getPostType( getCurrentPostType() )?.viewable ?? false,\n\t\t\tisCodeEditingEnabled: getEditorSettings().codeEditingEnabled,\n\t\t\tisRichEditingEnabled: getEditorSettings().richEditingEnabled,\n\t\t\tisPublishSidebarEnabled:\n\t\t\t\tselect( editorStore ).isPublishSidebarEnabled(),\n\t\t};\n\t}, [] );\n\tconst { getActiveComplementaryArea } = useSelect( interfaceStore );\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\tconst {\n\t\t__unstableSaveForPreview,\n\t\tsetIsListViewOpened,\n\t\tswitchEditorMode,\n\t\ttoggleDistractionFree,\n\t} = useDispatch( editorStore );\n\tconst { openModal, enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\tconst { getCurrentPostId } = useSelect( editorStore );\n\tconst allowSwitchEditorMode = isCodeEditingEnabled && isRichEditingEnabled;\n\n\tif ( isPreviewMode ) {\n\t\treturn { commands: [], isLoading: false };\n\t}\n\n\tconst commands = [];\n\n\tcommands.push( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Keyboard shortcuts' ),\n\t\ticon: keyboard,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\topenModal( 'editor/keyboard-shortcut-help' );\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-distraction-free',\n\t\tlabel: isDistractionFree\n\t\t\t? __( 'Exit Distraction free' )\n\t\t\t: __( 'Enter Distraction free' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggleDistractionFree();\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Editor preferences' ),\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\topenModal( 'editor/preferences' );\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-spotlight-mode',\n\t\tlabel: isFocusMode\n\t\t\t? __( 'Exit Spotlight mode' )\n\t\t\t: __( 'Enter Spotlight mode' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'focusMode' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisFocusMode ? __( 'Spotlight off.' ) : __( 'Spotlight on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/editor/toggle-spotlight-mode/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core', 'focusMode' );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-list-view',\n\t\tlabel: isListViewOpen\n\t\t\t? __( 'Close List View' )\n\t\t\t: __( 'Open List View' ),\n\t\ticon: listView,\n\t\tcallback: ( { close } ) => {\n\t\t\tsetIsListViewOpened( ! isListViewOpen );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisListViewOpen ? __( 'List View off.' ) : __( 'List View on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/editor/toggle-list-view/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-top-toolbar',\n\t\tlabel: __( 'Top toolbar' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'fixedToolbar' );\n\t\t\tif ( isDistractionFree ) {\n\t\t\t\ttoggleDistractionFree();\n\t\t\t}\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisTopToolbar\n\t\t\t\t\t? __( 'Top toolbar off.' )\n\t\t\t\t\t: __( 'Top toolbar on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/editor/toggle-top-toolbar/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core', 'fixedToolbar' );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tif ( allowSwitchEditorMode ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-code-editor',\n\t\t\tlabel:\n\t\t\t\teditorMode === 'visual'\n\t\t\t\t\t? __( 'Open code editor' )\n\t\t\t\t\t: __( 'Exit code editor' ),\n\t\t\ticon: code,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tswitchEditorMode( editorMode === 'visual' ? 'text' : 'visual' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\tcommands.push( {\n\t\tname: 'core/toggle-breadcrumbs',\n\t\tlabel: showBlockBreadcrumbs\n\t\t\t? __( 'Hide block breadcrumbs' )\n\t\t\t: __( 'Show block breadcrumbs' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'showBlockBreadcrumbs' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tshowBlockBreadcrumbs\n\t\t\t\t\t? __( 'Breadcrumbs hidden.' )\n\t\t\t\t\t: __( 'Breadcrumbs visible.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/editor/toggle-breadcrumbs/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Show or hide the Settings panel.' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tconst activeSidebar = getActiveComplementaryArea( 'core' );\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/document' ) {\n\t\t\t\tdisableComplementaryArea( 'core' );\n\t\t\t} else {\n\t\t\t\tenableComplementaryArea( 'core', 'edit-post/document' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Show or hide the Block settings panel' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tconst activeSidebar = getActiveComplementaryArea( 'core' );\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/block' ) {\n\t\t\t\tdisableComplementaryArea( 'core' );\n\t\t\t} else {\n\t\t\t\tenableComplementaryArea( 'core', 'edit-post/block' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-publish-sidebar',\n\t\tlabel: isPublishSidebarEnabled\n\t\t\t? __( 'Disable pre-publish checks' )\n\t\t\t: __( 'Enable pre-publish checks' ),\n\t\ticon: formatListBullets,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\ttoggle( 'core', 'isPublishSidebarEnabled' );\n\t\t\tcreateInfoNotice(\n\t\t\t\tisPublishSidebarEnabled\n\t\t\t\t\t? __( 'Pre-publish checks disabled.' )\n\t\t\t\t\t: __( 'Pre-publish checks enabled.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/editor/publish-sidebar/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tif ( isViewable ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/preview-link',\n\t\t\tlabel: __( 'Preview in a new tab' ),\n\t\t\ticon: external,\n\t\t\tcallback: async ( { close } ) => {\n\t\t\t\tclose();\n\t\t\t\tconst postId = getCurrentPostId();\n\t\t\t\tconst link = await __unstableSaveForPreview();\n\t\t\t\twindow.open( link, `wp-preview-${ postId }` );\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn {\n\t\tcommands,\n\t\tisLoading: false,\n\t};\n}\n\nfunction useEditedEntityContextualCommands() {\n\tconst { postType } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType } = select( editorStore );\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst commands = [];\n\n\tif ( postType === PATTERN_POST_TYPE ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/rename-pattern',\n\t\t\tlabel: __( 'Rename pattern' ),\n\t\t\ticon: edit,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\topenModal( patternRenameModalName );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t\tcommands.push( {\n\t\t\tname: 'core/duplicate-pattern',\n\t\t\tlabel: __( 'Duplicate pattern' ),\n\t\t\ticon: symbol,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\topenModal( patternDuplicateModalName );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nexport default function useCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/editor/edit-ui',\n\t\thook: useEditorCommandLoader,\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/editor/contextual-commands',\n\t\thook: useEditedEntityContextualCommands,\n\t\tcontext: 'entity-edit',\n\t} );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAYA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ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,KAAK,EAAE,IAAAC,QAAE,EAAE,mBAAoB,CAAC;MAChCC,IAAI,EAAE0B,aAAM;MACZxB,QAAQ,EAAEA,CAAE;QAAEC;MAAM,CAAC,KAAM;QAC1Bd,SAAS,CAAEsC,gCAA0B,CAAC;QACtCxB,KAAK,CAAC,CAAC;MACR;IACD,CAAE,CAAC;EACJ;EAEA,OAAO;IAAER,SAAS,EAAE,KAAK;IAAED;EAAS,CAAC;AACtC;AAEe,SAASkC,WAAWA,CAAA,EAAG;EACrC,IAAAC,0BAAgB,EAAE;IACjBhC,IAAI,EAAE,qBAAqB;IAC3BiC,IAAI,EAAEhF;EACP,CAAE,CAAC;EAEH,IAAA+E,0BAAgB,EAAE;IACjBhC,IAAI,EAAE,iCAAiC;IACvCiC,IAAI,EAAET,iCAAiC;IACvCU,OAAO,EAAE;EACV,CAAE,CAAC;AACJ","ignoreList":[]}
|
|
@@ -19,6 +19,7 @@ var _compose = require("@wordpress/compose");
|
|
|
19
19
|
var _htmlEntities = require("@wordpress/html-entities");
|
|
20
20
|
var _constants = require("../../store/constants");
|
|
21
21
|
var _store = require("../../store");
|
|
22
|
+
var _pageTypeBadge = _interopRequireDefault(require("../../utils/pageTypeBadge"));
|
|
22
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
24
|
/**
|
|
24
25
|
* External dependencies
|
|
@@ -57,7 +58,6 @@ function DocumentBar(props) {
|
|
|
57
58
|
postTypeLabel,
|
|
58
59
|
documentTitle,
|
|
59
60
|
isNotFound,
|
|
60
|
-
isUnsyncedPattern,
|
|
61
61
|
templateTitle,
|
|
62
62
|
onNavigateToPreviousEntityRecord
|
|
63
63
|
} = (0, _data.useSelect)(select => {
|
|
@@ -82,7 +82,6 @@ function DocumentBar(props) {
|
|
|
82
82
|
postTypeLabel: _postTypeLabel,
|
|
83
83
|
documentTitle: _document.title,
|
|
84
84
|
isNotFound: !_document && !isResolvingSelector('getEditedEntityRecord', 'postType', _postType, _postId),
|
|
85
|
-
isUnsyncedPattern: _document?.wp_pattern_sync_status === 'unsynced',
|
|
86
85
|
templateTitle: _templateInfo.title,
|
|
87
86
|
onNavigateToPreviousEntityRecord: getEditorSettings().onNavigateToPreviousEntityRecord
|
|
88
87
|
};
|
|
@@ -92,19 +91,18 @@ function DocumentBar(props) {
|
|
|
92
91
|
} = (0, _data.useDispatch)(_commands.store);
|
|
93
92
|
const isReducedMotion = (0, _compose.useReducedMotion)();
|
|
94
93
|
const isTemplate = _constants.TEMPLATE_POST_TYPES.includes(postType);
|
|
95
|
-
const isGlobalEntity = _constants.GLOBAL_POST_TYPES.includes(postType);
|
|
96
94
|
const hasBackButton = !!onNavigateToPreviousEntityRecord;
|
|
97
95
|
const entityTitle = isTemplate ? templateTitle : documentTitle;
|
|
98
96
|
const title = props.title || entityTitle;
|
|
99
97
|
const icon = props.icon;
|
|
98
|
+
const pageTypeBadge = (0, _pageTypeBadge.default)();
|
|
100
99
|
const mountedRef = (0, _element.useRef)(false);
|
|
101
100
|
(0, _element.useEffect)(() => {
|
|
102
101
|
mountedRef.current = true;
|
|
103
102
|
}, []);
|
|
104
103
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
105
104
|
className: (0, _clsx.default)('editor-document-bar', {
|
|
106
|
-
'has-back-button': hasBackButton
|
|
107
|
-
'is-global': isGlobalEntity && !isUnsyncedPattern
|
|
105
|
+
'has-back-button': hasBackButton
|
|
108
106
|
}),
|
|
109
107
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__unstableAnimatePresence, {
|
|
110
108
|
children: hasBackButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(MotionButton, {
|
|
@@ -164,9 +162,12 @@ function DocumentBar(props) {
|
|
|
164
162
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
165
163
|
className: "editor-document-bar__post-title",
|
|
166
164
|
children: title ? (0, _htmlEntities.decodeEntities)(title) : (0, _i18n.__)('No title')
|
|
167
|
-
}),
|
|
165
|
+
}), pageTypeBadge && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
168
166
|
className: "editor-document-bar__post-type-label",
|
|
169
|
-
children:
|
|
167
|
+
children: `· ${pageTypeBadge}`
|
|
168
|
+
}), postTypeLabel && !props.title && !pageTypeBadge && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
169
|
+
className: "editor-document-bar__post-type-label",
|
|
170
|
+
children: `· ${(0, _htmlEntities.decodeEntities)(postTypeLabel)}`
|
|
170
171
|
})]
|
|
171
172
|
})]
|
|
172
173
|
}, hasBackButton), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|