@wordpress/editor 14.14.0 → 14.15.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/LICENSE.md +1 -1
- package/README.md +1 -0
- package/build/components/commands/index.js +28 -0
- package/build/components/commands/index.js.map +1 -1
- package/build/components/document-bar/index.js +2 -1
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/document-tools/index.js +3 -6
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-help/intro-to-blocks.native.js +1 -1
- package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
- package/build/components/entities-saved-states/index.js +2 -1
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/error-boundary/index.native.js +1 -1
- package/build/components/error-boundary/index.native.js.map +1 -1
- package/build/components/more-menu/index.js +0 -1
- package/build/components/more-menu/index.js.map +1 -1
- package/build/components/post-actions/actions.js +9 -4
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/index.js +17 -14
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-actions/set-as-homepage.js +23 -34
- package/build/components/post-actions/set-as-homepage.js.map +1 -1
- package/build/components/post-actions/set-as-posts-page.js +154 -0
- package/build/components/post-actions/set-as-posts-page.js.map +1 -0
- package/build/components/post-card-panel/index.js +12 -5
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build/components/preferences-modal/index.js +2 -4
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js +0 -1
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/disable-non-page-content-blocks.js +65 -13
- package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/provider/index.js +9 -13
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +3 -1
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/start-page-options/index.js +20 -107
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/template-part-menu-items/index.js +2 -10
- package/build/components/template-part-menu-items/index.js.map +1 -1
- package/build/store/actions.js +0 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +1 -3
- package/build/store/constants.js.map +1 -1
- package/build/store/private-actions.js +1 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/utils/notice-builder.js +3 -8
- package/build/store/utils/notice-builder.js.map +1 -1
- package/build/utils/get-item-title.js +32 -0
- package/build/utils/get-item-title.js.map +1 -0
- package/build/utils/media-sideload/index.js +21 -0
- package/build/utils/media-sideload/index.js.map +1 -0
- package/build/utils/media-sideload/index.native.js +8 -0
- package/build/utils/media-sideload/index.native.js.map +1 -0
- package/build/utils/media-upload/index.js +5 -2
- package/build/utils/media-upload/index.js.map +1 -1
- package/build-module/components/commands/index.js +28 -0
- package/build-module/components/commands/index.js.map +1 -1
- package/build-module/components/document-bar/index.js +2 -1
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/document-tools/index.js +4 -7
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor-help/intro-to-blocks.native.js +1 -1
- package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +2 -1
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/error-boundary/index.native.js +2 -2
- package/build-module/components/error-boundary/index.native.js.map +1 -1
- package/build-module/components/more-menu/index.js +0 -1
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/post-actions/actions.js +9 -4
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/index.js +18 -15
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-actions/set-as-homepage.js +22 -33
- package/build-module/components/post-actions/set-as-homepage.js.map +1 -1
- package/build-module/components/post-actions/set-as-posts-page.js +146 -0
- package/build-module/components/post-actions/set-as-posts-page.js.map +1 -0
- package/build-module/components/post-card-panel/index.js +11 -6
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-upload-media.js +2 -2
- package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +2 -4
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +0 -1
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/disable-non-page-content-blocks.js +65 -13
- package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/provider/index.js +10 -14
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +3 -1
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/start-page-options/index.js +21 -107
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/template-part-menu-items/index.js +2 -10
- package/build-module/components/template-part-menu-items/index.js.map +1 -1
- package/build-module/store/actions.js +0 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js +0 -2
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/private-actions.js +1 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/utils/notice-builder.js +3 -8
- package/build-module/store/utils/notice-builder.js.map +1 -1
- package/build-module/utils/get-item-title.js +26 -0
- package/build-module/utils/get-item-title.js.map +1 -0
- package/build-module/utils/media-sideload/index.js +14 -0
- package/build-module/utils/media-sideload/index.js.map +1 -0
- package/build-module/utils/media-sideload/index.native.js +2 -0
- package/build-module/utils/media-sideload/index.native.js.map +1 -0
- package/build-module/utils/media-upload/index.js +5 -2
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/build-style/style-rtl.css +5 -25
- package/build-style/style.css +5 -25
- 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/entities-saved-states/index.d.ts.map +1 -1
- package/build-types/components/more-menu/index.d.ts.map +1 -1
- package/build-types/components/post-actions/actions.d.ts.map +1 -1
- package/build-types/components/post-actions/index.d.ts.map +1 -1
- package/build-types/components/post-actions/set-as-homepage.d.ts.map +1 -1
- package/build-types/components/post-actions/set-as-posts-page.d.ts +10 -0
- package/build-types/components/post-actions/set-as-posts-page.d.ts.map +1 -0
- package/build-types/components/post-card-panel/index.d.ts.map +1 -1
- package/build-types/components/preferences-modal/index.d.ts.map +1 -1
- package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
- package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
- package/build-types/components/start-page-options/index.d.ts +1 -2
- package/build-types/components/start-page-options/index.d.ts.map +1 -1
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/constants.d.ts +0 -2
- package/build-types/store/constants.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/utils/notice-builder.d.ts.map +1 -1
- package/build-types/utils/get-item-title.d.ts +10 -0
- package/build-types/utils/get-item-title.d.ts.map +1 -0
- package/build-types/utils/media-sideload/index.d.ts +3 -0
- package/build-types/utils/media-sideload/index.d.ts.map +1 -0
- package/build-types/utils/media-upload/index.d.ts +3 -1
- package/build-types/utils/media-upload/index.d.ts.map +1 -1
- package/package.json +37 -37
- package/src/components/commands/index.js +29 -0
- package/src/components/document-bar/index.js +2 -1
- package/src/components/document-tools/index.js +3 -6
- package/src/components/document-tools/style.scss +0 -6
- package/src/components/editor-help/intro-to-blocks.native.js +1 -1
- package/src/components/entities-saved-states/index.js +5 -1
- package/src/components/error-boundary/index.native.js +2 -2
- package/src/components/more-menu/index.js +0 -1
- package/src/components/post-actions/actions.js +12 -4
- package/src/components/post-actions/index.js +19 -17
- package/src/components/post-actions/set-as-homepage.js +29 -45
- package/src/components/post-actions/set-as-posts-page.js +164 -0
- package/src/components/post-card-panel/index.js +8 -6
- package/src/components/post-card-panel/style.scss +4 -13
- package/src/components/post-publish-panel/maybe-upload-media.js +2 -2
- package/src/components/preferences-modal/index.js +8 -13
- package/src/components/preview-dropdown/index.js +0 -1
- package/src/components/provider/disable-non-page-content-blocks.js +64 -13
- package/src/components/provider/index.js +13 -27
- package/src/components/provider/use-block-editor-settings.js +3 -0
- package/src/components/start-page-options/index.js +28 -119
- package/src/components/template-part-menu-items/index.js +2 -11
- package/src/store/actions.js +0 -2
- package/src/store/constants.ts +0 -2
- package/src/store/private-actions.js +1 -1
- package/src/store/utils/notice-builder.js +3 -8
- package/src/store/utils/test/notice-builder.js +3 -4
- package/src/utils/get-item-title.js +25 -0
- package/src/utils/media-sideload/index.js +13 -0
- package/src/utils/media-sideload/index.native.js +1 -0
- package/src/utils/media-upload/index.js +4 -1
- package/tsconfig.json +1 -4
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","__","isRTL","useSelect","useDispatch","Button","__experimentalText","Text","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","BlockIcon","chevronLeftSmall","chevronRightSmall","layout","displayShortcut","store","coreStore","commandsStore","useRef","useEffect","useReducedMotion","decodeEntities","TEMPLATE_POST_TYPES","editorStore","usePageTypeBadge","getTemplateInfo","jsx","_jsx","jsxs","_jsxs","MotionButton","DocumentBar","props","postId","postType","postTypeLabel","documentTitle","isNotFound","templateTitle","onNavigateToPreviousEntityRecord","isTemplatePreview","select","_select$getEntityReco","getCurrentPostType","getCurrentPostId","getEditorSettings","getRenderingMode","getEditedEntityRecord","getPostType","isResolving","isResolvingSelector","_postType","_postId","_document","default_template_types","templateTypes","getEntityRecord","_templateInfo","template","_postTypeLabel","labels","singular_name","title","open","openCommandCenter","isReducedMotion","isTemplate","includes","hasBackButton","entityTitle","icon","pageTypeBadge","mountedRef","current","className","children","onClick","event","stopPropagation","size","initial","opacity","transform","animate","exit","transition","duration","undefined","div","as","primary"],"sources":["@wordpress/editor/src/components/document-bar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { chevronLeftSmall, chevronRightSmall, layout } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as commandsStore } from '@wordpress/commands';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPES } from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport usePageTypeBadge from '../../utils/pageTypeBadge';\nimport { getTemplateInfo } from '../../utils/get-template-info';\n\n/** @typedef {import(\"@wordpress/components\").IconType} IconType */\n\nconst MotionButton = motion( Button );\n\n/**\n * This component renders a navigation bar at the top of the editor. It displays the title of the current document,\n * a back button (if applicable), and a command center button. It also handles different states of the document,\n * such as \"not found\" or \"unsynced\".\n *\n * @example\n * ```jsx\n * <DocumentBar />\n * ```\n * @param {Object} props The component props.\n * @param {string} props.title A title for the document, defaulting to the document or\n * template title currently being edited.\n * @param {IconType} props.icon An icon for the document, no default.\n * (A default icon indicating the document post type is no longer used.)\n *\n * @return {React.ReactNode} The rendered DocumentBar component.\n */\nexport default function DocumentBar( props ) {\n\tconst {\n\t\tpostId,\n\t\tpostType,\n\t\tpostTypeLabel,\n\t\tdocumentTitle,\n\t\tisNotFound,\n\t\ttemplateTitle,\n\t\tonNavigateToPreviousEntityRecord,\n\t\tisTemplatePreview,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t\tgetEditorSettings,\n\t\t\tgetRenderingMode,\n\t\t} = select( editorStore );\n\n\t\tconst {\n\t\t\tgetEditedEntityRecord,\n\t\t\tgetPostType,\n\t\t\tisResolving: isResolvingSelector,\n\t\t} = select( coreStore );\n\t\tconst _postType = getCurrentPostType();\n\t\tconst _postId = getCurrentPostId();\n\t\tconst _document = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t_postType,\n\t\t\t_postId\n\t\t);\n\n\t\tconst { default_template_types: templateTypes = [] } =\n\t\t\tselect( coreStore ).getEntityRecord( 'root', '__unstableBase' ) ??\n\t\t\t{};\n\n\t\tconst _templateInfo = getTemplateInfo( {\n\t\t\ttemplateTypes,\n\t\t\ttemplate: _document,\n\t\t} );\n\t\tconst _postTypeLabel = getPostType( _postType )?.labels?.singular_name;\n\n\t\treturn {\n\t\t\tpostId: _postId,\n\t\t\tpostType: _postType,\n\t\t\tpostTypeLabel: _postTypeLabel,\n\t\t\tdocumentTitle: _document.title,\n\t\t\tisNotFound:\n\t\t\t\t! _document &&\n\t\t\t\t! isResolvingSelector(\n\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\t'postType',\n\t\t\t\t\t_postType,\n\t\t\t\t\t_postId\n\t\t\t\t),\n\t\t\ttemplateTitle: _templateInfo.title,\n\t\t\tonNavigateToPreviousEntityRecord:\n\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t\tisTemplatePreview: getRenderingMode() === 'template-locked',\n\t\t};\n\t}, [] );\n\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\tconst isReducedMotion = useReducedMotion();\n\n\tconst isTemplate = TEMPLATE_POST_TYPES.includes( postType );\n\tconst hasBackButton = !! onNavigateToPreviousEntityRecord;\n\tconst entityTitle = isTemplate ? templateTitle : documentTitle;\n\tconst title = props.title || entityTitle;\n\tconst icon = props.icon;\n\n\tconst pageTypeBadge = usePageTypeBadge( postId );\n\n\tconst mountedRef = useRef( false );\n\tuseEffect( () => {\n\t\tmountedRef.current = true;\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'editor-document-bar', {\n\t\t\t\t'has-back-button': hasBackButton,\n\t\t\t} ) }\n\t\t>\n\t\t\t<AnimatePresence>\n\t\t\t\t{ hasBackButton && (\n\t\t\t\t\t<MotionButton\n\t\t\t\t\t\tclassName=\"editor-document-bar__back\"\n\t\t\t\t\t\ticon={ isRTL() ? chevronRightSmall : chevronLeftSmall }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\tonNavigateToPreviousEntityRecord();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmountedRef.current\n\t\t\t\t\t\t\t\t? { opacity: 0, transform: 'translateX(15%)' }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ { opacity: 1, transform: 'translateX(0%)' } }\n\t\t\t\t\t\texit={ { opacity: 0, transform: 'translateX(15%)' } }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</MotionButton>\n\t\t\t\t) }\n\t\t\t</AnimatePresence>\n\t\t\t{ ! isTemplate && isTemplatePreview && (\n\t\t\t\t<BlockIcon\n\t\t\t\t\ticon={ layout }\n\t\t\t\t\tclassName=\"editor-document-bar__icon-layout\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isNotFound ? (\n\t\t\t\t<Text>{ __( 'Document not found' ) }</Text>\n\t\t\t) : (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"editor-document-bar__command\"\n\t\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName=\"editor-document-bar__title\"\n\t\t\t\t\t\t// Force entry animation when the back button is added or removed.\n\t\t\t\t\t\tkey={ hasBackButton }\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmountedRef.current\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\t\t\ttransform: hasBackButton\n\t\t\t\t\t\t\t\t\t\t\t? 'translateX(15%)'\n\t\t\t\t\t\t\t\t\t\t\t: 'translateX(-15%)',\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\ttransform: 'translateX(0%)',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ icon && <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\t<Text size=\"body\" as=\"h1\">\n\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-title\">\n\t\t\t\t\t\t\t\t{ title\n\t\t\t\t\t\t\t\t\t? decodeEntities( title )\n\t\t\t\t\t\t\t\t\t: __( 'No title' ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t{ pageTypeBadge && (\n\t\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-type-label\">\n\t\t\t\t\t\t\t\t\t{ `· ${ pageTypeBadge }` }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ postTypeLabel &&\n\t\t\t\t\t\t\t\t! props.title &&\n\t\t\t\t\t\t\t\t! pageTypeBadge && (\n\t\t\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-type-label\">\n\t\t\t\t\t\t\t\t\t\t{ `· ${ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\tpostTypeLabel\n\t\t\t\t\t\t\t\t\t\t) }` }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</motion.div>\n\t\t\t\t\t<span className=\"editor-document-bar__shortcut\">\n\t\t\t\t\t\t{ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t</span>\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,MAAM,EACNC,kBAAkB,IAAIC,IAAI,EAC1BC,gBAAgB,IAAIC,MAAM,EAC1BC,yBAAyB,IAAIC,eAAe,QACtC,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,yBAAyB;AACnD,SAASC,gBAAgB,EAAEC,iBAAiB,EAAEC,MAAM,QAAQ,kBAAkB;AAC9E,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,aAAa,QAAQ,qBAAqB;AAC5D,SAASC,MAAM,EAAEC,SAAS,QAAQ,oBAAoB;AACtD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,cAAc,QAAQ,0BAA0B;;AAEzD;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASP,KAAK,IAAIQ,WAAW,QAAQ,aAAa;AAClD,OAAOC,gBAAgB,MAAM,2BAA2B;AACxD,SAASC,eAAe,QAAQ,+BAA+B;;AAE/D;AAAA,SAAAC,G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ACT;QACDe,OAAO,EAAG;UACTF,OAAO,EAAE,CAAC;UACVC,SAAS,EAAE;QACZ,CAAG;QACHG,UAAU,EACTpB,eAAe,GAAG;UAAEqB,QAAQ,EAAE;QAAE,CAAC,GAAGC,SACpC;QAAAZ,QAAA,GAECL,IAAI,iBAAI3C,IAAA,CAACjB,SAAS;UAAC4D,IAAI,EAAGA;QAAM,CAAE,CAAC,eACrCzC,KAAA,CAACxB,IAAI;UAAC0E,IAAI,EAAC,MAAM;UAACU,EAAE,EAAC,IAAI;UAAAd,QAAA,gBACxBhD,IAAA;YAAM+C,SAAS,EAAC,iCAAiC;YAAAC,QAAA,EAC9Cb,KAAK,GACJzC,cAAc,CAAEyC,KAAM,CAAC,GACvB/D,EAAE,CAAE,UAAW;UAAC,CACd,CAAC,EACLwE,aAAa,iBACd5C,IAAA;YAAM+C,SAAS,EAAC,sCAAsC;YAAAC,QAAA,EACnD,KAAMJ,aAAa;UAAG,CACnB,CACN,EACCpC,aAAa,IACd,CAAEH,KAAK,CAAC8B,KAAK,IACb,CAAES,aAAa,iBACd5C,IAAA;YAAM+C,SAAS,EAAC,sCAAsC;YAAAC,QAAA,EACnD,KAAMtD,cAAc,CACrBc,aACD,CAAC;UAAG,CACC,CACN;QAAA,CACG,CAAC;MAAA,GAxCDiC,aAyCK,CAAC,eACbzC,IAAA;QAAM+C,SAAS,EAAC,+BAA+B;QAAAC,QAAA,EAC5C7D,eAAe,CAAC4E,OAAO,CAAE,GAAI;MAAC,CAC3B,CAAC;IAAA,CACA,CACR;EAAA,CACG,CAAC;AAER","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","__","isRTL","useSelect","useDispatch","Button","__experimentalText","Text","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","BlockIcon","chevronLeftSmall","chevronRightSmall","layout","displayShortcut","store","coreStore","commandsStore","useRef","useEffect","useReducedMotion","decodeEntities","__unstableStripHTML","stripHTML","TEMPLATE_POST_TYPES","editorStore","usePageTypeBadge","getTemplateInfo","jsx","_jsx","jsxs","_jsxs","MotionButton","DocumentBar","props","postId","postType","postTypeLabel","documentTitle","isNotFound","templateTitle","onNavigateToPreviousEntityRecord","isTemplatePreview","select","_select$getEntityReco","getCurrentPostType","getCurrentPostId","getEditorSettings","getRenderingMode","getEditedEntityRecord","getPostType","isResolving","isResolvingSelector","_postType","_postId","_document","default_template_types","templateTypes","getEntityRecord","_templateInfo","template","_postTypeLabel","labels","singular_name","title","open","openCommandCenter","isReducedMotion","isTemplate","includes","hasBackButton","entityTitle","icon","pageTypeBadge","mountedRef","current","className","children","onClick","event","stopPropagation","size","initial","opacity","transform","animate","exit","transition","duration","undefined","div","as","primary"],"sources":["@wordpress/editor/src/components/document-bar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { chevronLeftSmall, chevronRightSmall, layout } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as commandsStore } from '@wordpress/commands';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPES } from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport usePageTypeBadge from '../../utils/pageTypeBadge';\nimport { getTemplateInfo } from '../../utils/get-template-info';\n\n/** @typedef {import(\"@wordpress/components\").IconType} IconType */\n\nconst MotionButton = motion( Button );\n\n/**\n * This component renders a navigation bar at the top of the editor. It displays the title of the current document,\n * a back button (if applicable), and a command center button. It also handles different states of the document,\n * such as \"not found\" or \"unsynced\".\n *\n * @example\n * ```jsx\n * <DocumentBar />\n * ```\n * @param {Object} props The component props.\n * @param {string} props.title A title for the document, defaulting to the document or\n * template title currently being edited.\n * @param {IconType} props.icon An icon for the document, no default.\n * (A default icon indicating the document post type is no longer used.)\n *\n * @return {React.ReactNode} The rendered DocumentBar component.\n */\nexport default function DocumentBar( props ) {\n\tconst {\n\t\tpostId,\n\t\tpostType,\n\t\tpostTypeLabel,\n\t\tdocumentTitle,\n\t\tisNotFound,\n\t\ttemplateTitle,\n\t\tonNavigateToPreviousEntityRecord,\n\t\tisTemplatePreview,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentPostId,\n\t\t\tgetEditorSettings,\n\t\t\tgetRenderingMode,\n\t\t} = select( editorStore );\n\n\t\tconst {\n\t\t\tgetEditedEntityRecord,\n\t\t\tgetPostType,\n\t\t\tisResolving: isResolvingSelector,\n\t\t} = select( coreStore );\n\t\tconst _postType = getCurrentPostType();\n\t\tconst _postId = getCurrentPostId();\n\t\tconst _document = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t_postType,\n\t\t\t_postId\n\t\t);\n\n\t\tconst { default_template_types: templateTypes = [] } =\n\t\t\tselect( coreStore ).getEntityRecord( 'root', '__unstableBase' ) ??\n\t\t\t{};\n\n\t\tconst _templateInfo = getTemplateInfo( {\n\t\t\ttemplateTypes,\n\t\t\ttemplate: _document,\n\t\t} );\n\t\tconst _postTypeLabel = getPostType( _postType )?.labels?.singular_name;\n\n\t\treturn {\n\t\t\tpostId: _postId,\n\t\t\tpostType: _postType,\n\t\t\tpostTypeLabel: _postTypeLabel,\n\t\t\tdocumentTitle: _document.title,\n\t\t\tisNotFound:\n\t\t\t\t! _document &&\n\t\t\t\t! isResolvingSelector(\n\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\t'postType',\n\t\t\t\t\t_postType,\n\t\t\t\t\t_postId\n\t\t\t\t),\n\t\t\ttemplateTitle: _templateInfo.title,\n\t\t\tonNavigateToPreviousEntityRecord:\n\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t\tisTemplatePreview: getRenderingMode() === 'template-locked',\n\t\t};\n\t}, [] );\n\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\tconst isReducedMotion = useReducedMotion();\n\n\tconst isTemplate = TEMPLATE_POST_TYPES.includes( postType );\n\tconst hasBackButton = !! onNavigateToPreviousEntityRecord;\n\tconst entityTitle = isTemplate ? templateTitle : documentTitle;\n\tconst title = props.title || entityTitle;\n\tconst icon = props.icon;\n\n\tconst pageTypeBadge = usePageTypeBadge( postId );\n\n\tconst mountedRef = useRef( false );\n\tuseEffect( () => {\n\t\tmountedRef.current = true;\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx( 'editor-document-bar', {\n\t\t\t\t'has-back-button': hasBackButton,\n\t\t\t} ) }\n\t\t>\n\t\t\t<AnimatePresence>\n\t\t\t\t{ hasBackButton && (\n\t\t\t\t\t<MotionButton\n\t\t\t\t\t\tclassName=\"editor-document-bar__back\"\n\t\t\t\t\t\ticon={ isRTL() ? chevronRightSmall : chevronLeftSmall }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\tonNavigateToPreviousEntityRecord();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmountedRef.current\n\t\t\t\t\t\t\t\t? { opacity: 0, transform: 'translateX(15%)' }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ { opacity: 1, transform: 'translateX(0%)' } }\n\t\t\t\t\t\texit={ { opacity: 0, transform: 'translateX(15%)' } }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</MotionButton>\n\t\t\t\t) }\n\t\t\t</AnimatePresence>\n\t\t\t{ ! isTemplate && isTemplatePreview && (\n\t\t\t\t<BlockIcon\n\t\t\t\t\ticon={ layout }\n\t\t\t\t\tclassName=\"editor-document-bar__icon-layout\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isNotFound ? (\n\t\t\t\t<Text>{ __( 'Document not found' ) }</Text>\n\t\t\t) : (\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"editor-document-bar__command\"\n\t\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName=\"editor-document-bar__title\"\n\t\t\t\t\t\t// Force entry animation when the back button is added or removed.\n\t\t\t\t\t\tkey={ hasBackButton }\n\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\tmountedRef.current\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\t\t\ttransform: hasBackButton\n\t\t\t\t\t\t\t\t\t\t\t? 'translateX(15%)'\n\t\t\t\t\t\t\t\t\t\t\t: 'translateX(-15%)',\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: false // Don't show entry animation when DocumentBar mounts.\n\t\t\t\t\t\t}\n\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\ttransform: 'translateX(0%)',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ttransition={\n\t\t\t\t\t\t\tisReducedMotion ? { duration: 0 } : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ icon && <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\t<Text size=\"body\" as=\"h1\">\n\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-title\">\n\t\t\t\t\t\t\t\t{ title\n\t\t\t\t\t\t\t\t\t? stripHTML( title )\n\t\t\t\t\t\t\t\t\t: __( 'No title' ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t{ pageTypeBadge && (\n\t\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-type-label\">\n\t\t\t\t\t\t\t\t\t{ `· ${ pageTypeBadge }` }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ postTypeLabel &&\n\t\t\t\t\t\t\t\t! props.title &&\n\t\t\t\t\t\t\t\t! pageTypeBadge && (\n\t\t\t\t\t\t\t\t\t<span className=\"editor-document-bar__post-type-label\">\n\t\t\t\t\t\t\t\t\t\t{ `· ${ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\tpostTypeLabel\n\t\t\t\t\t\t\t\t\t\t) }` }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</motion.div>\n\t\t\t\t\t<span className=\"editor-document-bar__shortcut\">\n\t\t\t\t\t\t{ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t</span>\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,MAAM,EACNC,kBAAkB,IAAIC,IAAI,EAC1BC,gBAAgB,IAAIC,MAAM,EAC1BC,yBAAyB,IAAIC,eAAe,QACtC,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,yBAAyB;AACnD,SAASC,gBAAgB,EAAEC,iBAAiB,EAAEC,MAAM,QAAQ,kBAAkB;AAC9E,SAASC,eAAe,QAAQ,qBA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QAAA,CACG,CAAC;MAAA,GAxCDiC,aAyCK,CAAC,eACbzC,IAAA;QAAM+C,SAAS,EAAC,+BAA+B;QAAAC,QAAA,EAC5C/D,eAAe,CAAC8E,OAAO,CAAE,GAAI;MAAC,CAC3B,CAAC;IAAA,CACA,CACR;EAAA,CACG,CAAC;AAER","ignoreList":[]}
|
|
@@ -10,7 +10,7 @@ import { useViewportMatch } from '@wordpress/compose';
|
|
|
10
10
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
11
11
|
import { __, _x } from '@wordpress/i18n';
|
|
12
12
|
import { NavigableToolbar, ToolSelector } from '@wordpress/block-editor';
|
|
13
|
-
import {
|
|
13
|
+
import { ToolbarButton, ToolbarItem } from '@wordpress/components';
|
|
14
14
|
import { listView, plus } from '@wordpress/icons';
|
|
15
15
|
import { useCallback } from '@wordpress/element';
|
|
16
16
|
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
@@ -103,9 +103,8 @@ function DocumentTools({
|
|
|
103
103
|
variant: "unstyled",
|
|
104
104
|
children: /*#__PURE__*/_jsxs("div", {
|
|
105
105
|
className: "editor-document-tools__left",
|
|
106
|
-
children: [!isDistractionFree && /*#__PURE__*/_jsx(
|
|
106
|
+
children: [!isDistractionFree && /*#__PURE__*/_jsx(ToolbarButton, {
|
|
107
107
|
ref: inserterSidebarToggleRef,
|
|
108
|
-
as: Button,
|
|
109
108
|
className: "editor-document-tools__inserter-toggle",
|
|
110
109
|
variant: "primary",
|
|
111
110
|
isPressed: isInserterOpened,
|
|
@@ -133,8 +132,7 @@ function DocumentTools({
|
|
|
133
132
|
showTooltip: !showIconLabels,
|
|
134
133
|
variant: showIconLabels ? 'tertiary' : undefined,
|
|
135
134
|
size: "compact"
|
|
136
|
-
}), !isDistractionFree && /*#__PURE__*/_jsx(
|
|
137
|
-
as: Button,
|
|
135
|
+
}), !isDistractionFree && /*#__PURE__*/_jsx(ToolbarButton, {
|
|
138
136
|
className: "editor-document-tools__document-overview-toggle",
|
|
139
137
|
icon: listView,
|
|
140
138
|
disabled: disableBlockTools,
|
|
@@ -146,8 +144,7 @@ function DocumentTools({
|
|
|
146
144
|
showTooltip: !showIconLabels,
|
|
147
145
|
variant: showIconLabels ? 'tertiary' : undefined,
|
|
148
146
|
"aria-expanded": isListViewOpen,
|
|
149
|
-
ref: listViewToggleRef
|
|
150
|
-
size: "compact"
|
|
147
|
+
ref: listViewToggleRef
|
|
151
148
|
})]
|
|
152
149
|
})]
|
|
153
150
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","useViewportMatch","useSelect","useDispatch","__","_x","NavigableToolbar","ToolSelector","Button","ToolbarItem","listView","plus","useCallback","store","keyboardShortcutsStore","preferencesStore","unlock","editorStore","EditorHistoryRedo","EditorHistoryUndo","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","DocumentTools","className","disableBlockTools","setIsInserterOpened","setIsListViewOpened","isDistractionFree","isInserterOpened","isListViewOpen","listViewShortcut","inserterSidebarToggleRef","listViewToggleRef","showIconLabels","showTools","select","get","isListViewOpened","getEditorMode","getInserterSidebarToggleRef","getListViewToggleRef","getRenderingMode","getCurrentPostType","getShortcutRepresentation","isVisualMode","window","__experimentalEditorWriteMode","preventDefault","event","isLargeViewport","isWideViewport","toolbarAriaLabel","toggleListView","toggleInserter","longLabel","shortLabel","variant","children","ref","as","isPressed","onMouseDown","onClick","disabled","icon","label","showTooltip","undefined","size","shortcut"],"sources":["@wordpress/editor/src/components/document-tools/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { NavigableToolbar, ToolSelector } from '@wordpress/block-editor';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport EditorHistoryRedo from '../editor-history/redo';\nimport EditorHistoryUndo from '../editor-history/undo';\n\nfunction DocumentTools( { className, disableBlockTools = false } ) {\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editorStore );\n\tconst {\n\t\tisDistractionFree,\n\t\tisInserterOpened,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t\tinserterSidebarToggleRef,\n\t\tlistViewToggleRef,\n\t\tshowIconLabels,\n\t\tshowTools,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst {\n\t\t\tisListViewOpened,\n\t\t\tgetEditorMode,\n\t\t\tgetInserterSidebarToggleRef,\n\t\t\tgetListViewToggleRef,\n\t\t\tgetRenderingMode,\n\t\t\tgetCurrentPostType,\n\t\t} = unlock( select( editorStore ) );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\n\t\treturn {\n\t\t\tisInserterOpened: select( editorStore ).isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/editor/toggle-list-view'\n\t\t\t),\n\t\t\tinserterSidebarToggleRef: getInserterSidebarToggleRef(),\n\t\t\tlistViewToggleRef: getListViewToggleRef(),\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tisVisualMode: getEditorMode() === 'visual',\n\t\t\tshowTools:\n\t\t\t\t!! window?.__experimentalEditorWriteMode &&\n\t\t\t\t( getRenderingMode() !== 'post-only' ||\n\t\t\t\t\tgetCurrentPostType() === 'wp_template' ),\n\t\t};\n\t}, [] );\n\n\tconst preventDefault = ( event ) => {\n\t\t// Because the inserter behaves like a dialog,\n\t\t// if the inserter is opened already then when we click on the toggle button\n\t\t// then the initial click event will close the inserter and then be propagated\n\t\t// to the inserter toggle and it will open it again.\n\t\t// To prevent this we need to stop the propagation of the event.\n\t\t// This won't be necessary when the inserter no longer behaves like a dialog.\n\n\t\tif ( isInserterOpened ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t};\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideViewport = useViewportMatch( 'wide' );\n\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst toggleInserter = useCallback(\n\t\t() => setIsInserterOpened( ! isInserterOpened ),\n\t\t[ isInserterOpened, setIsInserterOpened ]\n\t);\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Block Inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );\n\n\treturn (\n\t\t// Some plugins expect and use the `edit-post-header-toolbar` CSS class to\n\t\t// find the toolbar and inject UI elements into it. This is not officially\n\t\t// supported, but we're keeping it in the list of class names for backwards\n\t\t// compatibility.\n\t\t<NavigableToolbar\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-document-tools',\n\t\t\t\t'edit-post-header-toolbar',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\taria-label={ toolbarAriaLabel }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<div className=\"editor-document-tools__left\">\n\t\t\t\t{ ! isDistractionFree && (\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\tref={ inserterSidebarToggleRef }\n\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\tclassName=\"editor-document-tools__inserter-toggle\"\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\t\tonClick={ toggleInserter }\n\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ showIconLabels ? shortLabel : longLabel }\n\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\taria-expanded={ isInserterOpened }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ showTools && isLargeViewport && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryUndo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryRedo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ ! isDistractionFree && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\tclassName=\"editor-document-tools__document-overview-toggle\"\n\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\tlabel={ __( 'Document Overview' ) }\n\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taria-expanded={ isListViewOpen }\n\t\t\t\t\t\t\t\tref={ listViewToggleRef }\n\t\t\t\t\t\t\t\tsize=\"compact\"\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</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default DocumentTools;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SAASC,gBAAgB,EAAEC,YAAY,QAAQ,yBAAyB;AACxE,SAASC,MAAM,EAAEC,WAAW,QAAQ,uBAAuB;AAC3D,SAASC,QAAQ,EAAEC,IAAI,QAAQ,kBAAkB;AACjD,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASC,KAAK,IAAIC,sBAAsB,QAAQ,+BAA+B;AAC/E,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASH,KAAK,IAAII,WAAW,QAAQ,aAAa;AA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,QAAU;YACjByD,QAAQ,EAAGvC,iBAAmB;YAC9BoC,SAAS,EAAG/B;YACZ;YACAoC,KAAK,EAAGjE,EAAE,CAAE,mBAAoB,CAAG;YACnC8D,OAAO,EAAGV,cAAgB;YAC1BiB,QAAQ,EAAGvC,gBAAkB;YAC7BoC,WAAW,EAAG,CAAEjC,cAAgB;YAChCuB,OAAO,EACNvB,cAAc,GAAG,UAAU,GAAGkC,SAC9B;YACD,iBAAgBtC,cAAgB;YAChC6B,GAAG,EAAG1B,iBAAmB;YACzBoC,IAAI,EAAC;UAAS,CACd,CACD;QAAA,CACA,CACF;MAAA,CACG;IAAC,CACW;EAAC;AAErB;AAEA,eAAe9C,aAAa","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","useViewportMatch","useSelect","useDispatch","__","_x","NavigableToolbar","ToolSelector","ToolbarButton","ToolbarItem","listView","plus","useCallback","store","keyboardShortcutsStore","preferencesStore","unlock","editorStore","EditorHistoryRedo","EditorHistoryUndo","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","DocumentTools","className","disableBlockTools","setIsInserterOpened","setIsListViewOpened","isDistractionFree","isInserterOpened","isListViewOpen","listViewShortcut","inserterSidebarToggleRef","listViewToggleRef","showIconLabels","showTools","select","get","isListViewOpened","getEditorMode","getInserterSidebarToggleRef","getListViewToggleRef","getRenderingMode","getCurrentPostType","getShortcutRepresentation","isVisualMode","window","__experimentalEditorWriteMode","preventDefault","event","isLargeViewport","isWideViewport","toolbarAriaLabel","toggleListView","toggleInserter","longLabel","shortLabel","variant","children","ref","isPressed","onMouseDown","onClick","disabled","icon","label","showTooltip","as","undefined","size","shortcut"],"sources":["@wordpress/editor/src/components/document-tools/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { NavigableToolbar, ToolSelector } from '@wordpress/block-editor';\nimport { ToolbarButton, ToolbarItem } from '@wordpress/components';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport EditorHistoryRedo from '../editor-history/redo';\nimport EditorHistoryUndo from '../editor-history/undo';\n\nfunction DocumentTools( { className, disableBlockTools = false } ) {\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editorStore );\n\tconst {\n\t\tisDistractionFree,\n\t\tisInserterOpened,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t\tinserterSidebarToggleRef,\n\t\tlistViewToggleRef,\n\t\tshowIconLabels,\n\t\tshowTools,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst {\n\t\t\tisListViewOpened,\n\t\t\tgetEditorMode,\n\t\t\tgetInserterSidebarToggleRef,\n\t\t\tgetListViewToggleRef,\n\t\t\tgetRenderingMode,\n\t\t\tgetCurrentPostType,\n\t\t} = unlock( select( editorStore ) );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\n\t\treturn {\n\t\t\tisInserterOpened: select( editorStore ).isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/editor/toggle-list-view'\n\t\t\t),\n\t\t\tinserterSidebarToggleRef: getInserterSidebarToggleRef(),\n\t\t\tlistViewToggleRef: getListViewToggleRef(),\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tisVisualMode: getEditorMode() === 'visual',\n\t\t\tshowTools:\n\t\t\t\t!! window?.__experimentalEditorWriteMode &&\n\t\t\t\t( getRenderingMode() !== 'post-only' ||\n\t\t\t\t\tgetCurrentPostType() === 'wp_template' ),\n\t\t};\n\t}, [] );\n\n\tconst preventDefault = ( event ) => {\n\t\t// Because the inserter behaves like a dialog,\n\t\t// if the inserter is opened already then when we click on the toggle button\n\t\t// then the initial click event will close the inserter and then be propagated\n\t\t// to the inserter toggle and it will open it again.\n\t\t// To prevent this we need to stop the propagation of the event.\n\t\t// This won't be necessary when the inserter no longer behaves like a dialog.\n\n\t\tif ( isInserterOpened ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t};\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideViewport = useViewportMatch( 'wide' );\n\n\t/* translators: accessibility text for the editor toolbar */\n\tconst toolbarAriaLabel = __( 'Document tools' );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst toggleInserter = useCallback(\n\t\t() => setIsInserterOpened( ! isInserterOpened ),\n\t\t[ isInserterOpened, setIsInserterOpened ]\n\t);\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Block Inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );\n\n\treturn (\n\t\t// Some plugins expect and use the `edit-post-header-toolbar` CSS class to\n\t\t// find the toolbar and inject UI elements into it. This is not officially\n\t\t// supported, but we're keeping it in the list of class names for backwards\n\t\t// compatibility.\n\t\t<NavigableToolbar\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-document-tools',\n\t\t\t\t'edit-post-header-toolbar',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\taria-label={ toolbarAriaLabel }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<div className=\"editor-document-tools__left\">\n\t\t\t\t{ ! isDistractionFree && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tref={ inserterSidebarToggleRef }\n\t\t\t\t\t\tclassName=\"editor-document-tools__inserter-toggle\"\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\t\tonClick={ toggleInserter }\n\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ showIconLabels ? shortLabel : longLabel }\n\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\taria-expanded={ isInserterOpened }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ showTools && isLargeViewport && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryUndo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tas={ EditorHistoryRedo }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ ! isDistractionFree && (\n\t\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\t\tclassName=\"editor-document-tools__document-overview-toggle\"\n\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\tdisabled={ disableBlockTools }\n\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\tlabel={ __( 'Document Overview' ) }\n\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taria-expanded={ isListViewOpen }\n\t\t\t\t\t\t\t\tref={ listViewToggleRef }\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</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default DocumentTools;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SAASC,gBAAgB,EAAEC,YAAY,QAAQ,yBAAyB;AACxE,SAASC,aAAa,EAAEC,WAAW,QAAQ,uBAAuB;AAClE,SAASC,QAAQ,EAAEC,IAAI,QAAQ,kBAAkB;AACjD,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASC,KAAK,IAAIC,sBAAsB,QAAQ,+BAA+B;AAC/E,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SA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AAGtC,iBAAmB;YAC9BmC,SAAS,EAAG9B;YACZ;YACAmC,KAAK,EAAGhE,EAAE,CAAE,mBAAoB,CAAG;YACnC6D,OAAO,EAAGT,cAAgB;YAC1BiB,QAAQ,EAAGvC,gBAAkB;YAC7BmC,WAAW,EAAG,CAAEhC,cAAgB;YAChCuB,OAAO,EACNvB,cAAc,GAAG,UAAU,GAAGkC,SAC9B;YACD,iBAAgBtC,cAAgB;YAChC6B,GAAG,EAAG1B;UAAmB,CACzB,CACD;QAAA,CACA,CACF;MAAA,CACG;IAAC,CACW;EAAC;AAErB;AAEA,eAAeV,aAAa","ignoreList":[]}
|
|
@@ -48,7 +48,7 @@ const IntroToBlocks = () => {
|
|
|
48
48
|
}), /*#__PURE__*/_jsx(HelpDetailSectionHeadingText, {
|
|
49
49
|
text: __('Build layouts')
|
|
50
50
|
}), /*#__PURE__*/_jsx(HelpDetailBodyText, {
|
|
51
|
-
text: __('Arrange your content into columns, add Call to
|
|
51
|
+
text: __('Arrange your content into columns, add Call to action buttons, and overlay images with text.')
|
|
52
52
|
}), /*#__PURE__*/_jsx(HelpDetailImage, {
|
|
53
53
|
source: require('./images/build-layouts-light.png'),
|
|
54
54
|
sourceDarkMode: require('./images/build-layouts-dark.png')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["View","Text","__","usePreferredColorSchemeStyle","styles","HelpDetailBodyText","HelpDetailSectionHeadingText","HelpDetailImage","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","IntroToBlocks","titleStyle","helpDetailTitle","helpDetailTitleDark","children","source","require","style","helpDetailContainer","accessibilityRole","selectable","text","accessible","accessibilityLabel","sourceDarkMode"],"sources":["@wordpress/editor/src/components/editor-help/intro-to-blocks.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport {\n\tHelpDetailBodyText,\n\tHelpDetailSectionHeadingText,\n\tHelpDetailImage,\n} from './view-sections';\n\nconst IntroToBlocks = () => {\n\tconst titleStyle = usePreferredColorSchemeStyle(\n\t\tstyles.helpDetailTitle,\n\t\tstyles.helpDetailTitleDark\n\t);\n\treturn (\n\t\t<>\n\t\t\t<HelpDetailImage\n\t\t\t\tsource={ require( './images/block-layout-collage.png' ) }\n\t\t\t/>\n\t\t\t<View style={ styles.helpDetailContainer }>\n\t\t\t\t<Text\n\t\t\t\t\taccessibilityRole=\"header\"\n\t\t\t\t\tselectable\n\t\t\t\t\tstyle={ titleStyle }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Welcome to the world of blocks' ) }\n\t\t\t\t</Text>\n\t\t\t\t<HelpDetailBodyText\n\t\t\t\t\ttext={ __(\n\t\t\t\t\t\t'Blocks are pieces of content that you can insert, rearrange, and style without needing to know how to code. Blocks are an easy and modern way for you to create beautiful layouts.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<HelpDetailSectionHeadingText\n\t\t\t\t\ttext={ __( 'Rich text editing' ) }\n\t\t\t\t/>\n\t\t\t\t<HelpDetailBodyText\n\t\t\t\t\ttext={ __(\n\t\t\t\t\t\t'Blocks allow you to focus on writing your content, knowing that all the formatting tools you need are there to help you get your message across.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<HelpDetailImage\n\t\t\t\t\taccessible\n\t\t\t\t\taccessibilityLabel={ __(\n\t\t\t\t\t\t'Text formatting controls are located within the toolbar positioned above the keyboard while editing a text block'\n\t\t\t\t\t) }\n\t\t\t\t\tsource={ require( './images/rich-text-light.png' ) }\n\t\t\t\t\tsourceDarkMode={ require( './images/rich-text-dark.png' ) }\n\t\t\t\t/>\n\t\t\t\t<HelpDetailSectionHeadingText text={ __( 'Embed media' ) } />\n\t\t\t\t<HelpDetailBodyText\n\t\t\t\t\ttext={ __(\n\t\t\t\t\t\t'Make your content stand out by adding images, gifs, videos, and embedded media to your pages.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<HelpDetailImage\n\t\t\t\t\tsource={ require( './images/embed-media-light.png' ) }\n\t\t\t\t\tsourceDarkMode={ require( './images/embed-media-dark.png' ) }\n\t\t\t\t/>\n\t\t\t\t<HelpDetailSectionHeadingText text={ __( 'Build layouts' ) } />\n\t\t\t\t<HelpDetailBodyText\n\t\t\t\t\ttext={ __(\n\t\t\t\t\t\t'Arrange your content into columns, add Call to
|
|
1
|
+
{"version":3,"names":["View","Text","__","usePreferredColorSchemeStyle","styles","HelpDetailBodyText","HelpDetailSectionHeadingText","HelpDetailImage","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","IntroToBlocks","titleStyle","helpDetailTitle","helpDetailTitleDark","children","source","require","style","helpDetailContainer","accessibilityRole","selectable","text","accessible","accessibilityLabel","sourceDarkMode"],"sources":["@wordpress/editor/src/components/editor-help/intro-to-blocks.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport {\n\tHelpDetailBodyText,\n\tHelpDetailSectionHeadingText,\n\tHelpDetailImage,\n} from './view-sections';\n\nconst IntroToBlocks = () => {\n\tconst titleStyle = usePreferredColorSchemeStyle(\n\t\tstyles.helpDetailTitle,\n\t\tstyles.helpDetailTitleDark\n\t);\n\treturn (\n\t\t<>\n\t\t\t<HelpDetailImage\n\t\t\t\tsource={ require( './images/block-layout-collage.png' ) }\n\t\t\t/>\n\t\t\t<View style={ styles.helpDetailContainer }>\n\t\t\t\t<Text\n\t\t\t\t\taccessibilityRole=\"header\"\n\t\t\t\t\tselectable\n\t\t\t\t\tstyle={ titleStyle }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Welcome to the world of blocks' ) }\n\t\t\t\t</Text>\n\t\t\t\t<HelpDetailBodyText\n\t\t\t\t\ttext={ __(\n\t\t\t\t\t\t'Blocks are pieces of content that you can insert, rearrange, and style without needing to know how to code. Blocks are an easy and modern way for you to create beautiful layouts.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<HelpDetailSectionHeadingText\n\t\t\t\t\ttext={ __( 'Rich text editing' ) }\n\t\t\t\t/>\n\t\t\t\t<HelpDetailBodyText\n\t\t\t\t\ttext={ __(\n\t\t\t\t\t\t'Blocks allow you to focus on writing your content, knowing that all the formatting tools you need are there to help you get your message across.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<HelpDetailImage\n\t\t\t\t\taccessible\n\t\t\t\t\taccessibilityLabel={ __(\n\t\t\t\t\t\t'Text formatting controls are located within the toolbar positioned above the keyboard while editing a text block'\n\t\t\t\t\t) }\n\t\t\t\t\tsource={ require( './images/rich-text-light.png' ) }\n\t\t\t\t\tsourceDarkMode={ require( './images/rich-text-dark.png' ) }\n\t\t\t\t/>\n\t\t\t\t<HelpDetailSectionHeadingText text={ __( 'Embed media' ) } />\n\t\t\t\t<HelpDetailBodyText\n\t\t\t\t\ttext={ __(\n\t\t\t\t\t\t'Make your content stand out by adding images, gifs, videos, and embedded media to your pages.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<HelpDetailImage\n\t\t\t\t\tsource={ require( './images/embed-media-light.png' ) }\n\t\t\t\t\tsourceDarkMode={ require( './images/embed-media-dark.png' ) }\n\t\t\t\t/>\n\t\t\t\t<HelpDetailSectionHeadingText text={ __( 'Build layouts' ) } />\n\t\t\t\t<HelpDetailBodyText\n\t\t\t\t\ttext={ __(\n\t\t\t\t\t\t'Arrange your content into columns, add Call to action buttons, and overlay images with text.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<HelpDetailImage\n\t\t\t\t\tsource={ require( './images/build-layouts-light.png' ) }\n\t\t\t\t\tsourceDarkMode={ require( './images/build-layouts-dark.png' ) }\n\t\t\t\t/>\n\t\t\t\t<HelpDetailBodyText\n\t\t\t\t\ttext={ __(\n\t\t\t\t\t\t'Give it a try by adding a few blocks to your post or page!'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</View>\n\t\t</>\n\t);\n};\n\nexport default IntroToBlocks;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAI,EAAEC,IAAI,QAAQ,cAAc;;AAEzC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,4BAA4B,QAAQ,oBAAoB;;AAEjE;AACA;AACA;AACA,OAAOC,MAAM,MAAM,cAAc;AACjC,SACCC,kBAAkB,EAClBC,4BAA4B,EAC5BC,eAAe,QACT,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAEzB,MAAMC,aAAa,GAAGA,CAAA,KAAM;EAC3B,MAAMC,UAAU,GAAGZ,4BAA4B,CAC9CC,MAAM,CAACY,eAAe,EACtBZ,MAAM,CAACa,mBACR,CAAC;EACD,oBACCN,KAAA,CAAAE,SAAA;IAAAK,QAAA,gBACCT,IAAA,CAACF,eAAe;MACfY,MAAM,EAAGC,OAAO,CAAE,mCAAoC;IAAG,CACzD,CAAC,eACFT,KAAA,CAACX,IAAI;MAACqB,KAAK,EAAGjB,MAAM,CAACkB,mBAAqB;MAAAJ,QAAA,gBACzCT,IAAA,CAACR,IAAI;QACJsB,iBAAiB,EAAC,QAAQ;QAC1BC,UAAU;QACVH,KAAK,EAAGN,UAAY;QAAAG,QAAA,EAElBhB,EAAE,CAAE,gCAAiC;MAAC,CACnC,CAAC,eACPO,IAAA,CAACJ,kBAAkB;QAClBoB,IAAI,EAAGvB,EAAE,CACR,oLACD;MAAG,CACH,CAAC,eACFO,IAAA,CAACH,4BAA4B;QAC5BmB,IAAI,EAAGvB,EAAE,CAAE,mBAAoB;MAAG,CAClC,CAAC,eACFO,IAAA,CAACJ,kBAAkB;QAClBoB,IAAI,EAAGvB,EAAE,CACR,kJACD;MAAG,CACH,CAAC,eACFO,IAAA,CAACF,eAAe;QACfmB,UAAU;QACVC,kBAAkB,EAAGzB,EAAE,CACtB,kHACD,CAAG;QACHiB,MAAM,EAAGC,OAAO,CAAE,8BAA+B,CAAG;QACpDQ,cAAc,EAAGR,OAAO,CAAE,6BAA8B;MAAG,CAC3D,CAAC,eACFX,IAAA,CAACH,4BAA4B;QAACmB,IAAI,EAAGvB,EAAE,CAAE,aAAc;MAAG,CAAE,CAAC,eAC7DO,IAAA,CAACJ,kBAAkB;QAClBoB,IAAI,EAAGvB,EAAE,CACR,+FACD;MAAG,CACH,CAAC,eACFO,IAAA,CAACF,eAAe;QACfY,MAAM,EAAGC,OAAO,CAAE,gCAAiC,CAAG;QACtDQ,cAAc,EAAGR,OAAO,CAAE,+BAAgC;MAAG,CAC7D,CAAC,eACFX,IAAA,CAACH,4BAA4B;QAACmB,IAAI,EAAGvB,EAAE,CAAE,eAAgB;MAAG,CAAE,CAAC,eAC/DO,IAAA,CAACJ,kBAAkB;QAClBoB,IAAI,EAAGvB,EAAE,CACR,8FACD;MAAG,CACH,CAAC,eACFO,IAAA,CAACF,eAAe;QACfY,MAAM,EAAGC,OAAO,CAAE,kCAAmC,CAAG;QACxDQ,cAAc,EAAGR,OAAO,CAAE,iCAAkC;MAAG,CAC/D,CAAC,eACFX,IAAA,CAACJ,kBAAkB;QAClBoB,IAAI,EAAGvB,EAAE,CACR,4DACD;MAAG,CACH,CAAC;IAAA,CACG,CAAC;EAAA,CACN,CAAC;AAEL,CAAC;AAED,eAAeY,aAAa","ignoreList":[]}
|
|
@@ -103,6 +103,7 @@ export function EntitiesSavedStatesExtensible({
|
|
|
103
103
|
});
|
|
104
104
|
const dialogLabel = useInstanceId(EntitiesSavedStatesExtensible, 'label');
|
|
105
105
|
const dialogDescription = useInstanceId(EntitiesSavedStatesExtensible, 'description');
|
|
106
|
+
const selectItemsToSaveDescription = !!dirtyEntityRecords.length ? __('Select the items you want to save.') : undefined;
|
|
106
107
|
return /*#__PURE__*/_jsxs("div", {
|
|
107
108
|
ref: renderDialog ? saveDialogRef : undefined,
|
|
108
109
|
...(renderDialog && saveDialogProps),
|
|
@@ -151,7 +152,7 @@ export function EntitiesSavedStatesExtensible({
|
|
|
151
152
|
children: isDirty ? createInterpolateElement(sprintf(/* translators: %d: number of site changes waiting to be saved. */
|
|
152
153
|
_n('There is <strong>%d site change</strong> waiting to be saved.', 'There are <strong>%d site changes</strong> waiting to be saved.', dirtyEntityRecords.length), dirtyEntityRecords.length), {
|
|
153
154
|
strong: /*#__PURE__*/_jsx("strong", {})
|
|
154
|
-
}) :
|
|
155
|
+
}) : selectItemsToSaveDescription
|
|
155
156
|
})]
|
|
156
157
|
}), sortedPartitionedSavables.map(list => {
|
|
157
158
|
return /*#__PURE__*/_jsx(EntityTypeList, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Button","Flex","FlexItem","__","_n","sprintf","useCallback","useRef","createInterpolateElement","__experimentalUseDialog","useDialog","useInstanceId","useDispatch","EntityTypeList","useIsDirty","store","editorStore","unlock","jsx","_jsx","jsxs","_jsxs","identity","values","EntitiesSavedStates","close","renderDialog","isDirtyProps","EntitiesSavedStatesExtensible","additionalPrompt","undefined","onSave","saveEnabled","saveEnabledProp","saveLabel","dirtyEntityRecords","isDirty","setUnselectedEntities","unselectedEntities","saveButtonRef","saveDirtyEntities","partitionedSavables","reduce","acc","record","name","push","site","siteSavables","wp_template","templateSavables","wp_template_part","templatePartSavables","contentSavables","sortedPartitionedSavables","Object","filter","Array","isArray","dismissPanel","saveDialogRef","saveDialogProps","onClose","dialogLabel","dialogDescription","ref","className","role","children","gap","isBlock","as","variant","size","onClick","disabled","accessibleWhenDisabled","entitiesToSkip","id","length","strong","map","list"],"sources":["@wordpress/editor/src/components/entities-saved-states/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, Flex, FlexItem } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tuseCallback,\n\tuseRef,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport {\n\t__experimentalUseDialog as useDialog,\n\tuseInstanceId,\n} from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport EntityTypeList from './entity-type-list';\nimport { useIsDirty } from './hooks/use-is-dirty';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction identity( values ) {\n\treturn values;\n}\n\n/**\n * Renders the component for managing saved states of entities.\n *\n * @param {Object} props The component props.\n * @param {Function} props.close The function to close the dialog.\n * @param {boolean} props.renderDialog Whether to render the component with modal dialog behavior.\n *\n * @return {React.ReactNode} The rendered component.\n */\nexport default function EntitiesSavedStates( { close, renderDialog } ) {\n\tconst isDirtyProps = useIsDirty();\n\treturn (\n\t\t<EntitiesSavedStatesExtensible\n\t\t\tclose={ close }\n\t\t\trenderDialog={ renderDialog }\n\t\t\t{ ...isDirtyProps }\n\t\t/>\n\t);\n}\n\n/**\n * Renders a panel for saving entities with dirty records.\n *\n * @param {Object} props The component props.\n * @param {string} props.additionalPrompt Additional prompt to display.\n * @param {Function} props.close Function to close the panel.\n * @param {Function} props.onSave Function to call when saving entities.\n * @param {boolean} props.saveEnabled Flag indicating if save is enabled.\n * @param {string} props.saveLabel Label for the save button.\n * @param {boolean} props.renderDialog Whether to render the component with modal dialog behavior.\n * @param {Array} props.dirtyEntityRecords Array of dirty entity records.\n * @param {boolean} props.isDirty Flag indicating if there are dirty entities.\n * @param {Function} props.setUnselectedEntities Function to set unselected entities.\n * @param {Array} props.unselectedEntities Array of unselected entities.\n *\n * @return {React.ReactNode} The rendered component.\n */\nexport function EntitiesSavedStatesExtensible( {\n\tadditionalPrompt = undefined,\n\tclose,\n\tonSave = identity,\n\tsaveEnabled: saveEnabledProp = undefined,\n\tsaveLabel = __( 'Save' ),\n\trenderDialog,\n\tdirtyEntityRecords,\n\tisDirty,\n\tsetUnselectedEntities,\n\tunselectedEntities,\n} ) {\n\tconst saveButtonRef = useRef();\n\tconst { saveDirtyEntities } = unlock( useDispatch( editorStore ) );\n\t// To group entities by type.\n\tconst partitionedSavables = dirtyEntityRecords.reduce( ( acc, record ) => {\n\t\tconst { name } = record;\n\t\tif ( ! acc[ name ] ) {\n\t\t\tacc[ name ] = [];\n\t\t}\n\t\tacc[ name ].push( record );\n\t\treturn acc;\n\t}, {} );\n\n\t// Sort entity groups.\n\tconst {\n\t\tsite: siteSavables,\n\t\twp_template: templateSavables,\n\t\twp_template_part: templatePartSavables,\n\t\t...contentSavables\n\t} = partitionedSavables;\n\tconst sortedPartitionedSavables = [\n\t\tsiteSavables,\n\t\ttemplateSavables,\n\t\ttemplatePartSavables,\n\t\t...Object.values( contentSavables ),\n\t].filter( Array.isArray );\n\n\tconst saveEnabled = saveEnabledProp ?? isDirty;\n\t// Explicitly define this with no argument passed. Using `close` on\n\t// its own will use the event object in place of the expected saved entities.\n\tconst dismissPanel = useCallback( () => close(), [ close ] );\n\n\tconst [ saveDialogRef, saveDialogProps ] = useDialog( {\n\t\tonClose: () => dismissPanel(),\n\t} );\n\tconst dialogLabel = useInstanceId( EntitiesSavedStatesExtensible, 'label' );\n\tconst dialogDescription = useInstanceId(\n\t\tEntitiesSavedStatesExtensible,\n\t\t'description'\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tref={ renderDialog ? saveDialogRef : undefined }\n\t\t\t{ ...( renderDialog && saveDialogProps ) }\n\t\t\tclassName=\"entities-saved-states__panel\"\n\t\t\trole={ renderDialog ? 'dialog' : undefined }\n\t\t\taria-labelledby={ renderDialog ? dialogLabel : undefined }\n\t\t\taria-describedby={ renderDialog ? dialogDescription : undefined }\n\t\t>\n\t\t\t<Flex className=\"entities-saved-states__panel-header\" gap={ 2 }>\n\t\t\t\t<FlexItem\n\t\t\t\t\tisBlock\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tonClick={ dismissPanel }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem\n\t\t\t\t\tisBlock\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tref={ saveButtonRef }\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tdisabled={ ! saveEnabled }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\tsaveDirtyEntities( {\n\t\t\t\t\t\t\tonSave,\n\t\t\t\t\t\t\tdirtyEntityRecords,\n\t\t\t\t\t\t\tentitiesToSkip: unselectedEntities,\n\t\t\t\t\t\t\tclose,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tclassName=\"editor-entities-saved-states__save-button\"\n\t\t\t\t>\n\t\t\t\t\t{ saveLabel }\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\n\t\t\t<div className=\"entities-saved-states__text-prompt\">\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"entities-saved-states__text-prompt--header-wrapper\"\n\t\t\t\t\tid={ renderDialog ? dialogLabel : undefined }\n\t\t\t\t>\n\t\t\t\t\t<strong className=\"entities-saved-states__text-prompt--header\">\n\t\t\t\t\t\t{ __( 'Are you ready to save?' ) }\n\t\t\t\t\t</strong>\n\t\t\t\t\t{ additionalPrompt }\n\t\t\t\t</div>\n\t\t\t\t<p id={ renderDialog ? dialogDescription : undefined }>\n\t\t\t\t\t{ isDirty\n\t\t\t\t\t\t? createInterpolateElement(\n\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %d: number of site changes waiting to be saved. */\n\t\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t\t'There is <strong>%d site change</strong> waiting to be saved.',\n\t\t\t\t\t\t\t\t\t\t'There are <strong>%d site changes</strong> waiting to be saved.',\n\t\t\t\t\t\t\t\t\t\tdirtyEntityRecords.length\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tdirtyEntityRecords.length\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{ strong: <strong /> }\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __( 'Select the items you want to save.' ) }\n\t\t\t\t</p>\n\t\t\t</div>\n\n\t\t\t{ sortedPartitionedSavables.map( ( list ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<EntityTypeList\n\t\t\t\t\t\tkey={ list[ 0 ].name }\n\t\t\t\t\t\tlist={ list }\n\t\t\t\t\t\tunselectedEntities={ unselectedEntities }\n\t\t\t\t\t\tsetUnselectedEntities={ setUnselectedEntities }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,uBAAuB;AAC9D,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SACCC,WAAW,EACXC,MAAM,EACNC,wBAAwB,QAClB,oBAAoB;AAC3B,SACCC,uBAAuB,IAAIC,SAAS,EACpCC,aAAa,QACP,oBAAoB;AAC3B,SAASC,WAAW,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,cAAc,MAAM,oBAAoB;AAC/C,SAASC,UAAU,QAAQ,sBAAsB;AACjD,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAClD,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE3C,SAASC,QAAQA,CAAEC,MAAM,EAAG;EAC3B,OAAOA,MAAM;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,mBAAmBA,CAAE;E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B,EAAGA;MAAuB,GAHzC6C,IAAI,CAAE,CAAC,CAAE,CAACrC,IAIhB,CAAC;IAEJ,CAAE,CAAC;EAAA,CACC,CAAC;AAER","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Button","Flex","FlexItem","__","_n","sprintf","useCallback","useRef","createInterpolateElement","__experimentalUseDialog","useDialog","useInstanceId","useDispatch","EntityTypeList","useIsDirty","store","editorStore","unlock","jsx","_jsx","jsxs","_jsxs","identity","values","EntitiesSavedStates","close","renderDialog","isDirtyProps","EntitiesSavedStatesExtensible","additionalPrompt","undefined","onSave","saveEnabled","saveEnabledProp","saveLabel","dirtyEntityRecords","isDirty","setUnselectedEntities","unselectedEntities","saveButtonRef","saveDirtyEntities","partitionedSavables","reduce","acc","record","name","push","site","siteSavables","wp_template","templateSavables","wp_template_part","templatePartSavables","contentSavables","sortedPartitionedSavables","Object","filter","Array","isArray","dismissPanel","saveDialogRef","saveDialogProps","onClose","dialogLabel","dialogDescription","selectItemsToSaveDescription","length","ref","className","role","children","gap","isBlock","as","variant","size","onClick","disabled","accessibleWhenDisabled","entitiesToSkip","id","strong","map","list"],"sources":["@wordpress/editor/src/components/entities-saved-states/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, Flex, FlexItem } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tuseCallback,\n\tuseRef,\n\tcreateInterpolateElement,\n} from '@wordpress/element';\nimport {\n\t__experimentalUseDialog as useDialog,\n\tuseInstanceId,\n} from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport EntityTypeList from './entity-type-list';\nimport { useIsDirty } from './hooks/use-is-dirty';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction identity( values ) {\n\treturn values;\n}\n\n/**\n * Renders the component for managing saved states of entities.\n *\n * @param {Object} props The component props.\n * @param {Function} props.close The function to close the dialog.\n * @param {boolean} props.renderDialog Whether to render the component with modal dialog behavior.\n *\n * @return {React.ReactNode} The rendered component.\n */\nexport default function EntitiesSavedStates( { close, renderDialog } ) {\n\tconst isDirtyProps = useIsDirty();\n\treturn (\n\t\t<EntitiesSavedStatesExtensible\n\t\t\tclose={ close }\n\t\t\trenderDialog={ renderDialog }\n\t\t\t{ ...isDirtyProps }\n\t\t/>\n\t);\n}\n\n/**\n * Renders a panel for saving entities with dirty records.\n *\n * @param {Object} props The component props.\n * @param {string} props.additionalPrompt Additional prompt to display.\n * @param {Function} props.close Function to close the panel.\n * @param {Function} props.onSave Function to call when saving entities.\n * @param {boolean} props.saveEnabled Flag indicating if save is enabled.\n * @param {string} props.saveLabel Label for the save button.\n * @param {boolean} props.renderDialog Whether to render the component with modal dialog behavior.\n * @param {Array} props.dirtyEntityRecords Array of dirty entity records.\n * @param {boolean} props.isDirty Flag indicating if there are dirty entities.\n * @param {Function} props.setUnselectedEntities Function to set unselected entities.\n * @param {Array} props.unselectedEntities Array of unselected entities.\n *\n * @return {React.ReactNode} The rendered component.\n */\nexport function EntitiesSavedStatesExtensible( {\n\tadditionalPrompt = undefined,\n\tclose,\n\tonSave = identity,\n\tsaveEnabled: saveEnabledProp = undefined,\n\tsaveLabel = __( 'Save' ),\n\trenderDialog,\n\tdirtyEntityRecords,\n\tisDirty,\n\tsetUnselectedEntities,\n\tunselectedEntities,\n} ) {\n\tconst saveButtonRef = useRef();\n\tconst { saveDirtyEntities } = unlock( useDispatch( editorStore ) );\n\t// To group entities by type.\n\tconst partitionedSavables = dirtyEntityRecords.reduce( ( acc, record ) => {\n\t\tconst { name } = record;\n\t\tif ( ! acc[ name ] ) {\n\t\t\tacc[ name ] = [];\n\t\t}\n\t\tacc[ name ].push( record );\n\t\treturn acc;\n\t}, {} );\n\n\t// Sort entity groups.\n\tconst {\n\t\tsite: siteSavables,\n\t\twp_template: templateSavables,\n\t\twp_template_part: templatePartSavables,\n\t\t...contentSavables\n\t} = partitionedSavables;\n\tconst sortedPartitionedSavables = [\n\t\tsiteSavables,\n\t\ttemplateSavables,\n\t\ttemplatePartSavables,\n\t\t...Object.values( contentSavables ),\n\t].filter( Array.isArray );\n\n\tconst saveEnabled = saveEnabledProp ?? isDirty;\n\t// Explicitly define this with no argument passed. Using `close` on\n\t// its own will use the event object in place of the expected saved entities.\n\tconst dismissPanel = useCallback( () => close(), [ close ] );\n\n\tconst [ saveDialogRef, saveDialogProps ] = useDialog( {\n\t\tonClose: () => dismissPanel(),\n\t} );\n\tconst dialogLabel = useInstanceId( EntitiesSavedStatesExtensible, 'label' );\n\tconst dialogDescription = useInstanceId(\n\t\tEntitiesSavedStatesExtensible,\n\t\t'description'\n\t);\n\n\tconst selectItemsToSaveDescription = !! dirtyEntityRecords.length\n\t\t? __( 'Select the items you want to save.' )\n\t\t: undefined;\n\n\treturn (\n\t\t<div\n\t\t\tref={ renderDialog ? saveDialogRef : undefined }\n\t\t\t{ ...( renderDialog && saveDialogProps ) }\n\t\t\tclassName=\"entities-saved-states__panel\"\n\t\t\trole={ renderDialog ? 'dialog' : undefined }\n\t\t\taria-labelledby={ renderDialog ? dialogLabel : undefined }\n\t\t\taria-describedby={ renderDialog ? dialogDescription : undefined }\n\t\t>\n\t\t\t<Flex className=\"entities-saved-states__panel-header\" gap={ 2 }>\n\t\t\t\t<FlexItem\n\t\t\t\t\tisBlock\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tonClick={ dismissPanel }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem\n\t\t\t\t\tisBlock\n\t\t\t\t\tas={ Button }\n\t\t\t\t\tref={ saveButtonRef }\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tdisabled={ ! saveEnabled }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\tsaveDirtyEntities( {\n\t\t\t\t\t\t\tonSave,\n\t\t\t\t\t\t\tdirtyEntityRecords,\n\t\t\t\t\t\t\tentitiesToSkip: unselectedEntities,\n\t\t\t\t\t\t\tclose,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tclassName=\"editor-entities-saved-states__save-button\"\n\t\t\t\t>\n\t\t\t\t\t{ saveLabel }\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\n\t\t\t<div className=\"entities-saved-states__text-prompt\">\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"entities-saved-states__text-prompt--header-wrapper\"\n\t\t\t\t\tid={ renderDialog ? dialogLabel : undefined }\n\t\t\t\t>\n\t\t\t\t\t<strong className=\"entities-saved-states__text-prompt--header\">\n\t\t\t\t\t\t{ __( 'Are you ready to save?' ) }\n\t\t\t\t\t</strong>\n\t\t\t\t\t{ additionalPrompt }\n\t\t\t\t</div>\n\t\t\t\t<p id={ renderDialog ? dialogDescription : undefined }>\n\t\t\t\t\t{ isDirty\n\t\t\t\t\t\t? createInterpolateElement(\n\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %d: number of site changes waiting to be saved. */\n\t\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t\t'There is <strong>%d site change</strong> waiting to be saved.',\n\t\t\t\t\t\t\t\t\t\t'There are <strong>%d site changes</strong> waiting to be saved.',\n\t\t\t\t\t\t\t\t\t\tdirtyEntityRecords.length\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tdirtyEntityRecords.length\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{ strong: <strong /> }\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: selectItemsToSaveDescription }\n\t\t\t\t</p>\n\t\t\t</div>\n\n\t\t\t{ sortedPartitionedSavables.map( ( list ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<EntityTypeList\n\t\t\t\t\t\tkey={ list[ 0 ].name }\n\t\t\t\t\t\tlist={ list }\n\t\t\t\t\t\tunselectedEntities={ unselectedEntities }\n\t\t\t\t\t\tsetUnselectedEntities={ setUnselectedEntities }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,uBAAuB;AAC9D,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SACCC,WAAW,EACXC,MAAM,EACNC,wBAAwB,QAClB,oBAAoB;AAC3B,SACCC,uBAAuB,IAAIC,SAAS,EACpCC,aAAa,QACP,oBAAoB;AAC3B,SAASC,WAAW,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,cAAc,MAAM,oBAAoB;AAC/C,SAASC,UAAU,QAAQ,sBAAsB;AACjD,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAClD,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE3C,SAASC,QAAQA,CAAEC,MAAM,EAAG;EAC3B,OAAOA,MAAM;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,mBAAmBA,CAAE;EAAEC,KAAK;EAAEC;AAAa,CAAC,EAAG;EACtE,MAAMC,YAAY,GAAGb,UAAU,CAAC,CAAC;EACjC,oBACCK,IAAA,CAACS,6BAA6B;IAC7BH,KAAK,EAAGA,KAAO;IACfC,YAAY,EAAGA,YAAc;IAAA,GACxBC;EAAY,CACjB,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,6BAA6BA,CAAE;EAC9CC,gBAAgB,GAAGC,SAAS;EAC5BL,KAAK;EACLM,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B;UAClB4C,cAAc,EAAEzC,kBAAkB;UAClCb;QACD,CAAE,CACF;QACD2C,SAAS,EAAC,2CAA2C;QAAAE,QAAA,EAEnDpC;MAAS,CACF,CAAC;IAAA,CACN,CAAC,eAEPb,KAAA;MAAK+C,SAAS,EAAC,oCAAoC;MAAAE,QAAA,gBAClDjD,KAAA;QACC+C,SAAS,EAAC,oDAAoD;QAC9DY,EAAE,EAAGtD,YAAY,GAAGqC,WAAW,GAAGjC,SAAW;QAAAwC,QAAA,gBAE7CnD,IAAA;UAAQiD,SAAS,EAAC,4CAA4C;UAAAE,QAAA,EAC3DnE,EAAE,CAAE,wBAAyB;QAAC,CACzB,CAAC,EACP0B,gBAAgB;MAAA,CACd,CAAC,eACNV,IAAA;QAAG6D,EAAE,EAAGtD,YAAY,GAAGsC,iBAAiB,GAAGlC,SAAW;QAAAwC,QAAA,EACnDlC,OAAO,GACN5B,wBAAwB,CACxBH,OAAO,CACN;QACAD,EAAE,CACD,+DAA+D,EAC/D,iEAAiE,EACjE+B,kBAAkB,CAAC+B,MACpB,CAAC,EACD/B,kBAAkB,CAAC+B,MACpB,CAAC,EACD;UAAEe,MAAM,eAAE9D,IAAA,aAAS;QAAE,CACrB,CAAC,GACD8C;MAA4B,CAC7B,CAAC;IAAA,CACA,CAAC,EAEJX,yBAAyB,CAAC4B,GAAG,CAAIC,IAAI,IAAM;MAC5C,oBACChE,IAAA,CAACN,cAAc;QAEdsE,IAAI,EAAGA,IAAM;QACb7C,kBAAkB,EAAGA,kBAAoB;QACzCD,qBAAqB,EAAGA;MAAuB,GAHzC8C,IAAI,CAAE,CAAC,CAAE,CAACtC,IAIhB,CAAC;IAEJ,CAAE,CAAC;EAAA,CACC,CAAC;AAER","ignoreList":[]}
|
|
@@ -13,7 +13,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
13
13
|
import { select } from '@wordpress/data';
|
|
14
14
|
import { logException } from '@wordpress/react-native-bridge';
|
|
15
15
|
import { usePreferredColorSchemeStyle, withPreferredColorScheme } from '@wordpress/compose';
|
|
16
|
-
import {
|
|
16
|
+
import { cautionFilled } from '@wordpress/icons';
|
|
17
17
|
import { Icon } from '@wordpress/components';
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -102,7 +102,7 @@ class ErrorBoundary extends Component {
|
|
|
102
102
|
children: [/*#__PURE__*/_jsx(View, {
|
|
103
103
|
style: iconContainerStyle,
|
|
104
104
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
105
|
-
icon:
|
|
105
|
+
icon: cautionFilled,
|
|
106
106
|
...styles['error-boundary__icon']
|
|
107
107
|
})
|
|
108
108
|
}), /*#__PURE__*/_jsx(Text, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ScrollView","Text","TouchableOpacity","View","Clipboard","SafeAreaView","Component","__","select","logException","usePreferredColorSchemeStyle","withPreferredColorScheme","warning","Icon","store","editorStore","styles","jsx","_jsx","jsxs","_jsxs","getContent","getEditedPostContent","error","CopyButton","text","label","accessibilityLabel","accessibilityHint","secondary","containerStyle","containerSecondaryStyle","textStyle","textSecondaryStyle","activeOpacity","style","accessibilityRole","onPress","setString","children","ErrorBoundary","constructor","arguments","state","componentDidCatch","context","component_stack","componentStack","isHandled","handledBy","getDerivedStateFromError","render","props","getStylesFromColorScheme","iconContainerStyle","titleStyle","messageStyle","contentContainerStyle","icon","stack"],"sources":["@wordpress/editor/src/components/error-boundary/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { ScrollView, Text, TouchableOpacity, View } from 'react-native';\nimport Clipboard from '@react-native-clipboard/clipboard';\nimport { SafeAreaView } from 'react-native-safe-area-context';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { select } from '@wordpress/data';\nimport { logException } from '@wordpress/react-native-bridge';\nimport {\n\tusePreferredColorSchemeStyle,\n\twithPreferredColorScheme,\n} from '@wordpress/compose';\nimport { warning } from '@wordpress/icons';\nimport { Icon } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport styles from './style.scss';\n\nfunction getContent() {\n\ttry {\n\t\t// While `select` in a component is generally discouraged, it is\n\t\t// used here because it (a) reduces the chance of data loss in the\n\t\t// case of additional errors by performing a direct retrieval and\n\t\t// (b) avoids the performance cost associated with unnecessary\n\t\t// content serialization throughout the lifetime of a non-erroring\n\t\t// application.\n\t\treturn select( editorStore ).getEditedPostContent();\n\t} catch ( error ) {}\n}\n\nfunction CopyButton( {\n\ttext,\n\tlabel,\n\taccessibilityLabel,\n\taccessibilityHint,\n\tsecondary = false,\n} ) {\n\tconst containerStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'copy-button__container' ],\n\t\tstyles[ 'copy-button__container--dark' ]\n\t);\n\n\tconst containerSecondaryStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'copy-button__container--secondary' ],\n\t\tstyles[ 'copy-button__container--secondary-dark' ]\n\t);\n\n\tconst textStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'copy-button__text' ],\n\t\tstyles[ 'copy-button__text--dark' ]\n\t);\n\n\tconst textSecondaryStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'copy-button__text--secondary' ],\n\t\tstyles[ 'copy-button__text--secondary-dark' ]\n\t);\n\n\treturn (\n\t\t<TouchableOpacity\n\t\t\tactiveOpacity={ 0.5 }\n\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\tstyle={ [ containerStyle, secondary && containerSecondaryStyle ] }\n\t\t\taccessibilityRole=\"button\"\n\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\tonPress={ () => {\n\t\t\t\tClipboard.setString(\n\t\t\t\t\ttypeof text === 'function' ? text() : text || ''\n\t\t\t\t);\n\t\t\t} }\n\t\t>\n\t\t\t<Text style={ [ textStyle, secondary && textSecondaryStyle ] }>\n\t\t\t\t{ label }\n\t\t\t</Text>\n\t\t</TouchableOpacity>\n\t);\n}\n\nclass ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error ) {\n\t\tlogException( error, {\n\t\t\tcontext: {\n\t\t\t\tcomponent_stack: error.componentStack,\n\t\t\t},\n\t\t\tisHandled: true,\n\t\t\thandledBy: 'Editor-level Error Boundary',\n\t\t} );\n\t}\n\n\tstatic getDerivedStateFromError( error ) {\n\t\treturn { error };\n\t}\n\n\trender() {\n\t\tconst { error } = this.state;\n\t\tif ( ! error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\tconst { getStylesFromColorScheme } = this.props;\n\n\t\tconst iconContainerStyle = getStylesFromColorScheme(\n\t\t\tstyles[ 'error-boundary__icon-container' ],\n\t\t\tstyles[ 'error-boundary__icon-container--dark' ]\n\t\t);\n\n\t\tconst titleStyle = getStylesFromColorScheme(\n\t\t\tstyles[ 'error-boundary__title' ],\n\t\t\tstyles[ 'error-boundary__title--dark' ]\n\t\t);\n\n\t\tconst messageStyle = getStylesFromColorScheme(\n\t\t\tstyles[ 'error-boundary__message' ],\n\t\t\tstyles[ 'error-boundary__message--dark' ]\n\t\t);\n\n\t\treturn (\n\t\t\t<SafeAreaView>\n\t\t\t\t<ScrollView\n\t\t\t\t\tstyle={ styles[ 'error-boundary__scroll' ] }\n\t\t\t\t\tcontentContainerStyle={\n\t\t\t\t\t\tstyles[ 'error-boundary__scroll-container' ]\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<View style={ styles[ 'error-boundary__container' ] }>\n\t\t\t\t\t\t<View style={ iconContainerStyle }>\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\ticon={ warning }\n\t\t\t\t\t\t\t\t{ ...styles[ 'error-boundary__icon' ] }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</View>\n\t\t\t\t\t\t<Text style={ titleStyle }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'The editor has encountered an unexpected error'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t<Text style={ messageStyle }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'You can copy your post text in case your content is impacted. Copy error details to debug and share with support.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t<View\n\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\tstyles[ 'error-boundary__actions-container' ]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<CopyButton\n\t\t\t\t\t\t\t\tlabel={ __( 'Copy post text' ) }\n\t\t\t\t\t\t\t\taccessibilityLabel={ __(\n\t\t\t\t\t\t\t\t\t'Button to copy post text'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\taccessibilityHint={ __(\n\t\t\t\t\t\t\t\t\t'Tap here to copy post text'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttext={ getContent }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<CopyButton\n\t\t\t\t\t\t\t\tlabel={ __( 'Copy error details' ) }\n\t\t\t\t\t\t\t\taccessibilityLabel={ __(\n\t\t\t\t\t\t\t\t\t'Button to copy error details'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\taccessibilityHint={ __(\n\t\t\t\t\t\t\t\t\t'Tap here to copy error details'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttext={ error.stack }\n\t\t\t\t\t\t\t\tsecondary\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</View>\n\t\t\t\t</ScrollView>\n\t\t\t</SafeAreaView>\n\t\t);\n\t}\n}\n\nexport default withPreferredColorScheme( ErrorBoundary );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,IAAI,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AACvE,O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BAAiB,EAAGrB,EAAE,CACrB,4BACD,CAAG;cACHkB,IAAI,EAAGJ;YAAY,CACnB,CAAC,eACFH,IAAA,CAACM,UAAU;cACVE,KAAK,EAAGnB,EAAE,CAAE,oBAAqB,CAAG;cACpCoB,kBAAkB,EAAGpB,EAAE,CACtB,8BACD,CAAG;cACHqB,iBAAiB,EAAGrB,EAAE,CACrB,gCACD,CAAG;cACHkB,IAAI,EAAGF,KAAK,CAACoC,KAAO;cACpB9B,SAAS;YAAA,CACT,CAAC;UAAA,CACG,CAAC;QAAA,CACF;MAAC,CACI;IAAC,CACA,CAAC;EAEjB;AACD;AAEA,eAAelB,wBAAwB,CAAE6B,aAAc,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["ScrollView","Text","TouchableOpacity","View","Clipboard","SafeAreaView","Component","__","select","logException","usePreferredColorSchemeStyle","withPreferredColorScheme","cautionFilled","Icon","store","editorStore","styles","jsx","_jsx","jsxs","_jsxs","getContent","getEditedPostContent","error","CopyButton","text","label","accessibilityLabel","accessibilityHint","secondary","containerStyle","containerSecondaryStyle","textStyle","textSecondaryStyle","activeOpacity","style","accessibilityRole","onPress","setString","children","ErrorBoundary","constructor","arguments","state","componentDidCatch","context","component_stack","componentStack","isHandled","handledBy","getDerivedStateFromError","render","props","getStylesFromColorScheme","iconContainerStyle","titleStyle","messageStyle","contentContainerStyle","icon","stack"],"sources":["@wordpress/editor/src/components/error-boundary/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { ScrollView, Text, TouchableOpacity, View } from 'react-native';\nimport Clipboard from '@react-native-clipboard/clipboard';\nimport { SafeAreaView } from 'react-native-safe-area-context';\n\n/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { select } from '@wordpress/data';\nimport { logException } from '@wordpress/react-native-bridge';\nimport {\n\tusePreferredColorSchemeStyle,\n\twithPreferredColorScheme,\n} from '@wordpress/compose';\nimport { cautionFilled } from '@wordpress/icons';\nimport { Icon } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport styles from './style.scss';\n\nfunction getContent() {\n\ttry {\n\t\t// While `select` in a component is generally discouraged, it is\n\t\t// used here because it (a) reduces the chance of data loss in the\n\t\t// case of additional errors by performing a direct retrieval and\n\t\t// (b) avoids the performance cost associated with unnecessary\n\t\t// content serialization throughout the lifetime of a non-erroring\n\t\t// application.\n\t\treturn select( editorStore ).getEditedPostContent();\n\t} catch ( error ) {}\n}\n\nfunction CopyButton( {\n\ttext,\n\tlabel,\n\taccessibilityLabel,\n\taccessibilityHint,\n\tsecondary = false,\n} ) {\n\tconst containerStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'copy-button__container' ],\n\t\tstyles[ 'copy-button__container--dark' ]\n\t);\n\n\tconst containerSecondaryStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'copy-button__container--secondary' ],\n\t\tstyles[ 'copy-button__container--secondary-dark' ]\n\t);\n\n\tconst textStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'copy-button__text' ],\n\t\tstyles[ 'copy-button__text--dark' ]\n\t);\n\n\tconst textSecondaryStyle = usePreferredColorSchemeStyle(\n\t\tstyles[ 'copy-button__text--secondary' ],\n\t\tstyles[ 'copy-button__text--secondary-dark' ]\n\t);\n\n\treturn (\n\t\t<TouchableOpacity\n\t\t\tactiveOpacity={ 0.5 }\n\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\tstyle={ [ containerStyle, secondary && containerSecondaryStyle ] }\n\t\t\taccessibilityRole=\"button\"\n\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\tonPress={ () => {\n\t\t\t\tClipboard.setString(\n\t\t\t\t\ttypeof text === 'function' ? text() : text || ''\n\t\t\t\t);\n\t\t\t} }\n\t\t>\n\t\t\t<Text style={ [ textStyle, secondary && textSecondaryStyle ] }>\n\t\t\t\t{ label }\n\t\t\t</Text>\n\t\t</TouchableOpacity>\n\t);\n}\n\nclass ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error ) {\n\t\tlogException( error, {\n\t\t\tcontext: {\n\t\t\t\tcomponent_stack: error.componentStack,\n\t\t\t},\n\t\t\tisHandled: true,\n\t\t\thandledBy: 'Editor-level Error Boundary',\n\t\t} );\n\t}\n\n\tstatic getDerivedStateFromError( error ) {\n\t\treturn { error };\n\t}\n\n\trender() {\n\t\tconst { error } = this.state;\n\t\tif ( ! error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\tconst { getStylesFromColorScheme } = this.props;\n\n\t\tconst iconContainerStyle = getStylesFromColorScheme(\n\t\t\tstyles[ 'error-boundary__icon-container' ],\n\t\t\tstyles[ 'error-boundary__icon-container--dark' ]\n\t\t);\n\n\t\tconst titleStyle = getStylesFromColorScheme(\n\t\t\tstyles[ 'error-boundary__title' ],\n\t\t\tstyles[ 'error-boundary__title--dark' ]\n\t\t);\n\n\t\tconst messageStyle = getStylesFromColorScheme(\n\t\t\tstyles[ 'error-boundary__message' ],\n\t\t\tstyles[ 'error-boundary__message--dark' ]\n\t\t);\n\n\t\treturn (\n\t\t\t<SafeAreaView>\n\t\t\t\t<ScrollView\n\t\t\t\t\tstyle={ styles[ 'error-boundary__scroll' ] }\n\t\t\t\t\tcontentContainerStyle={\n\t\t\t\t\t\tstyles[ 'error-boundary__scroll-container' ]\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<View style={ styles[ 'error-boundary__container' ] }>\n\t\t\t\t\t\t<View style={ iconContainerStyle }>\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\ticon={ cautionFilled }\n\t\t\t\t\t\t\t\t{ ...styles[ 'error-boundary__icon' ] }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</View>\n\t\t\t\t\t\t<Text style={ titleStyle }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'The editor has encountered an unexpected error'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t<Text style={ messageStyle }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'You can copy your post text in case your content is impacted. Copy error details to debug and share with support.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t<View\n\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\tstyles[ 'error-boundary__actions-container' ]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<CopyButton\n\t\t\t\t\t\t\t\tlabel={ __( 'Copy post text' ) }\n\t\t\t\t\t\t\t\taccessibilityLabel={ __(\n\t\t\t\t\t\t\t\t\t'Button to copy post text'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\taccessibilityHint={ __(\n\t\t\t\t\t\t\t\t\t'Tap here to copy post text'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttext={ getContent }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<CopyButton\n\t\t\t\t\t\t\t\tlabel={ __( 'Copy error details' ) }\n\t\t\t\t\t\t\t\taccessibilityLabel={ __(\n\t\t\t\t\t\t\t\t\t'Button to copy error details'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\taccessibilityHint={ __(\n\t\t\t\t\t\t\t\t\t'Tap here to copy error details'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttext={ error.stack }\n\t\t\t\t\t\t\t\tsecondary\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</View>\n\t\t\t\t</ScrollView>\n\t\t\t</SafeAreaView>\n\t\t);\n\t}\n}\n\nexport default withPreferredColorScheme( ErrorBoundary );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,IAAI,EAAEC,gBAAgB,EAAEC,IAA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B,0BACD,CAAG;cACHqB,iBAAiB,EAAGrB,EAAE,CACrB,4BACD,CAAG;cACHkB,IAAI,EAAGJ;YAAY,CACnB,CAAC,eACFH,IAAA,CAACM,UAAU;cACVE,KAAK,EAAGnB,EAAE,CAAE,oBAAqB,CAAG;cACpCoB,kBAAkB,EAAGpB,EAAE,CACtB,8BACD,CAAG;cACHqB,iBAAiB,EAAGrB,EAAE,CACrB,gCACD,CAAG;cACHkB,IAAI,EAAGF,KAAK,CAACoC,KAAO;cACpB9B,SAAS;YAAA,CACT,CAAC;UAAA,CACG,CAAC;QAAA,CACF;MAAC,CACI;IAAC,CACA,CAAC;EAEjB;AACD;AAEA,eAAelB,wBAAwB,CAAE6B,aAAc,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","_x","useSelect","useDispatch","displayShortcut","external","moreVertical","MenuGroup","MenuItem","VisuallyHidden","DropdownMenu","PreferenceToggleMenuItem","store","preferencesStore","interfaceStore","ActionItem","CopyContentMenuItem","ModeSwitcher","ToolsMoreMenuGroup","ViewMoreMenuGroup","editorStore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","MoreMenu","openModal","set","setPreference","toggleDistractionFree","showIconLabels","select","get","turnOffDistractionFree","children","icon","label","popoverProps","placement","className","toggleProps","showTooltip","variant","tooltipPosition","size","onClose","scope","name","onToggle","info","messageActivated","messageDeactivated","handleToggling","createNotice","shortcut","primaryShift","Slot","fillProps","as","onClick","access","href","target","rel"],"sources":["@wordpress/editor/src/components/more-menu/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { external, moreVertical } from '@wordpress/icons';\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tVisuallyHidden,\n\tDropdownMenu,\n} from '@wordpress/components';\nimport {\n\tPreferenceToggleMenuItem,\n\tstore as preferencesStore,\n} from '@wordpress/preferences';\nimport { store as interfaceStore, ActionItem } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport CopyContentMenuItem from './copy-content-menu-item';\nimport ModeSwitcher from '../mode-switcher';\nimport ToolsMoreMenuGroup from './tools-more-menu-group';\nimport ViewMoreMenuGroup from './view-more-menu-group';\nimport { store as editorStore } from '../../store';\n\nexport default function MoreMenu() {\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tconst { toggleDistractionFree } = useDispatch( editorStore );\n\tconst showIconLabels = useSelect(\n\t\t( select ) =>\n\t\t\tselect( preferencesStore ).get( 'core', 'showIconLabels' ),\n\t\t[]\n\t);\n\n\tconst turnOffDistractionFree = () => {\n\t\tsetPreference( 'core', 'distractionFree', false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\tpopoverProps={ {\n\t\t\t\t\tplacement: 'bottom-end',\n\t\t\t\t\tclassName: 'more-menu-dropdown__content',\n\t\t\t\t} }\n\t\t\t\ttoggleProps={ {\n\t\t\t\t\tshowTooltip: ! showIconLabels,\n\t\t\t\t\t...( showIconLabels && { variant: 'tertiary' } ),\n\t\t\t\t\ttooltipPosition: 'bottom',\n\t\t\t\t\tsize: 'compact',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tname=\"fixedToolbar\"\n\t\t\t\t\t\t\t\tonToggle={ turnOffDistractionFree }\n\t\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar activated.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar deactivated.'\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<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tname=\"distractionFree\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Distraction free' ) }\n\t\t\t\t\t\t\t\tinfo={ __( 'Write with calmness' ) }\n\t\t\t\t\t\t\t\thandleToggling={ false }\n\t\t\t\t\t\t\t\tonToggle={ () =>\n\t\t\t\t\t\t\t\t\ttoggleDistractionFree( {\n\t\t\t\t\t\t\t\t\t\tcreateNotice: false,\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\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Distraction free mode activated.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Distraction free mode deactivated.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.primaryShift(\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<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tname=\"focusMode\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Spotlight mode' ) }\n\t\t\t\t\t\t\t\tinfo={ __( 'Focus on one block at a time' ) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Spotlight mode activated.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Spotlight mode deactivated.'\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<ViewMoreMenuGroup.Slot fillProps={ { onClose } } />\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<ModeSwitcher />\n\t\t\t\t\t\t<ActionItem.Slot\n\t\t\t\t\t\t\tname=\"core/plugin-more-menu\"\n\t\t\t\t\t\t\tlabel={ __( 'Plugins' ) }\n\t\t\t\t\t\t\tas={ MenuGroup }\n\t\t\t\t\t\t\tfillProps={ { onClick: onClose } }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\topenModal( 'editor/keyboard-shortcut-help' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<CopyContentMenuItem />\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<ToolsMoreMenuGroup.Slot\n\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\topenModal( 'editor/preferences' )\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\t{ __( 'Preferences' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,QAAQ,EAAEC,YAAY,QAAQ,kBAAkB;AACzD,SACCC,SAAS,EACTC,QAAQ,EACRC,cAAc,EACdC,YAAY,QACN,uBAAuB;AAC9B,SACCC,wBAAwB,EACxBC,KAAK,IAAIC,gBAAgB,QACnB,wBAAwB;AAC/B,SAASD,KAAK,IAAIE,cAAc,EAAEC,UAAU,QAAQ,sBAAsB;;AAE1E;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,kBAAkB,MAAM,yBAAyB;AACxD,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,SAASP,KAAK,IAAIQ,WAAW,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAEnD,eA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;UAAQ;QAAG,CAClC,CAAC,eACFvB,KAAA,CAACjB,SAAS;UAAC+B,KAAK,EAAGtC,EAAE,CAAE,OAAQ,CAAG;UAAAoC,QAAA,gBACjCd,IAAA,CAACd,QAAQ;YACRqD,OAAO,EAAGA,CAAA,KACTjC,SAAS,CAAE,+BAAgC,CAC3C;YACD4B,QAAQ,EAAGpD,eAAe,CAAC0D,MAAM,CAAE,GAAI,CAAG;YAAA1B,QAAA,EAExCpC,EAAE,CAAE,oBAAqB;UAAC,CACnB,CAAC,eACXsB,IAAA,CAACN,mBAAmB,IAAE,CAAC,eACvBQ,KAAA,CAAChB,QAAQ;YACR6B,IAAI,EAAGhC,QAAU;YACjB0D,IAAI,EAAG/D,EAAE,CACR,qEACD,CAAG;YACHgE,MAAM,EAAC,QAAQ;YACfC,GAAG,EAAC,qBAAqB;YAAA7B,QAAA,GAEvBpC,EAAE,CAAE,MAAO,CAAC,eACdsB,IAAA,CAACb,cAAc;cAACmD,EAAE,EAAC,MAAM;cAAAxB,QAAA,EAEvB;cACApC,EAAE,CAAE,sBAAuB;YAAC,CAEd,CAAC;UAAA,CACR,CAAC,eACXsB,IAAA,CAACJ,kBAAkB,CAACwC,IAAI;YACvBC,SAAS,EAAG;cAAEZ;YAAQ;UAAG,CACzB,CAAC;QAAA,CACQ,CAAC,eACZzB,IAAA,CAACf,SAAS;UAAA6B,QAAA,eACTd,IAAA,CAACd,QAAQ;YACRqD,OAAO,EAAGA,CAAA,KACTjC,SAAS,CAAE,oBAAqB,CAChC;YAAAQ,QAAA,EAECpC,EAAE,CAAE,aAAc;UAAC,CACZ;QAAC,CACD,CAAC;MAAA,CACX;IACF,CACY;EAAC,CACd,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["__","_x","useSelect","useDispatch","displayShortcut","external","moreVertical","MenuGroup","MenuItem","VisuallyHidden","DropdownMenu","PreferenceToggleMenuItem","store","preferencesStore","interfaceStore","ActionItem","CopyContentMenuItem","ModeSwitcher","ToolsMoreMenuGroup","ViewMoreMenuGroup","editorStore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","MoreMenu","openModal","set","setPreference","toggleDistractionFree","showIconLabels","select","get","turnOffDistractionFree","children","icon","label","popoverProps","placement","className","toggleProps","showTooltip","variant","tooltipPosition","size","onClose","scope","name","onToggle","info","messageActivated","messageDeactivated","handleToggling","createNotice","shortcut","primaryShift","Slot","fillProps","onClick","access","href","target","rel","as"],"sources":["@wordpress/editor/src/components/more-menu/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { external, moreVertical } from '@wordpress/icons';\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tVisuallyHidden,\n\tDropdownMenu,\n} from '@wordpress/components';\nimport {\n\tPreferenceToggleMenuItem,\n\tstore as preferencesStore,\n} from '@wordpress/preferences';\nimport { store as interfaceStore, ActionItem } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport CopyContentMenuItem from './copy-content-menu-item';\nimport ModeSwitcher from '../mode-switcher';\nimport ToolsMoreMenuGroup from './tools-more-menu-group';\nimport ViewMoreMenuGroup from './view-more-menu-group';\nimport { store as editorStore } from '../../store';\n\nexport default function MoreMenu() {\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tconst { toggleDistractionFree } = useDispatch( editorStore );\n\tconst showIconLabels = useSelect(\n\t\t( select ) =>\n\t\t\tselect( preferencesStore ).get( 'core', 'showIconLabels' ),\n\t\t[]\n\t);\n\n\tconst turnOffDistractionFree = () => {\n\t\tsetPreference( 'core', 'distractionFree', false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\tpopoverProps={ {\n\t\t\t\t\tplacement: 'bottom-end',\n\t\t\t\t\tclassName: 'more-menu-dropdown__content',\n\t\t\t\t} }\n\t\t\t\ttoggleProps={ {\n\t\t\t\t\tshowTooltip: ! showIconLabels,\n\t\t\t\t\t...( showIconLabels && { variant: 'tertiary' } ),\n\t\t\t\t\ttooltipPosition: 'bottom',\n\t\t\t\t\tsize: 'compact',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tname=\"fixedToolbar\"\n\t\t\t\t\t\t\t\tonToggle={ turnOffDistractionFree }\n\t\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar activated.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar deactivated.'\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<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tname=\"distractionFree\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Distraction free' ) }\n\t\t\t\t\t\t\t\tinfo={ __( 'Write with calmness' ) }\n\t\t\t\t\t\t\t\thandleToggling={ false }\n\t\t\t\t\t\t\t\tonToggle={ () =>\n\t\t\t\t\t\t\t\t\ttoggleDistractionFree( {\n\t\t\t\t\t\t\t\t\t\tcreateNotice: false,\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\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Distraction free mode activated.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Distraction free mode deactivated.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.primaryShift(\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<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tname=\"focusMode\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Spotlight mode' ) }\n\t\t\t\t\t\t\t\tinfo={ __( 'Focus on one block at a time' ) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Spotlight mode activated.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Spotlight mode deactivated.'\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<ViewMoreMenuGroup.Slot fillProps={ { onClose } } />\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<ModeSwitcher />\n\t\t\t\t\t\t<ActionItem.Slot\n\t\t\t\t\t\t\tname=\"core/plugin-more-menu\"\n\t\t\t\t\t\t\tlabel={ __( 'Plugins' ) }\n\t\t\t\t\t\t\tfillProps={ { onClick: onClose } }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\topenModal( 'editor/keyboard-shortcut-help' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<CopyContentMenuItem />\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<ToolsMoreMenuGroup.Slot\n\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\topenModal( 'editor/preferences' )\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\t{ __( 'Preferences' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,eAAe,QAAQ,qBA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A,CAACJ,kBAAkB,CAACwC,IAAI;YACvBC,SAAS,EAAG;cAAEZ;YAAQ;UAAG,CACzB,CAAC;QAAA,CACQ,CAAC,eACZzB,IAAA,CAACf,SAAS;UAAA6B,QAAA,eACTd,IAAA,CAACd,QAAQ;YACRoD,OAAO,EAAGA,CAAA,KACThC,SAAS,CAAE,oBAAqB,CAChC;YAAAQ,QAAA,EAECpC,EAAE,CAAE,aAAc;UAAC,CACZ;QAAC,CACD,CAAC;MAAA,CACX;IACF,CACY;EAAC,CACd,CAAC;AAEL","ignoreList":[]}
|
|
@@ -12,6 +12,7 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
12
12
|
import { store as editorStore } from '../../store';
|
|
13
13
|
import { unlock } from '../../lock-unlock';
|
|
14
14
|
import { useSetAsHomepageAction } from './set-as-homepage';
|
|
15
|
+
import { useSetAsPostsPageAction } from './set-as-posts-page';
|
|
15
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
17
|
export function usePostActions({
|
|
17
18
|
postType,
|
|
@@ -47,7 +48,8 @@ export function usePostActions({
|
|
|
47
48
|
};
|
|
48
49
|
});
|
|
49
50
|
const setAsHomepageAction = useSetAsHomepageAction();
|
|
50
|
-
const
|
|
51
|
+
const setAsPostsPageAction = useSetAsPostsPageAction();
|
|
52
|
+
const shouldShowHomepageActions = canManageOptions && !hasFrontPageTemplate;
|
|
51
53
|
const {
|
|
52
54
|
registerPostTypeSchema
|
|
53
55
|
} = unlock(useDispatch(editorStore));
|
|
@@ -56,10 +58,13 @@ export function usePostActions({
|
|
|
56
58
|
}, [registerPostTypeSchema, postType]);
|
|
57
59
|
return useMemo(() => {
|
|
58
60
|
let actions = [...defaultActions];
|
|
59
|
-
if (
|
|
60
|
-
actions.push(setAsHomepageAction);
|
|
61
|
+
if (shouldShowHomepageActions) {
|
|
62
|
+
actions.push(setAsHomepageAction, setAsPostsPageAction);
|
|
61
63
|
}
|
|
62
64
|
|
|
65
|
+
// Ensure "Move to trash" is always the last action.
|
|
66
|
+
actions = actions.sort((a, b) => b.id === 'move-to-trash' ? -1 : 0);
|
|
67
|
+
|
|
63
68
|
// Filter actions based on provided context. If not provided
|
|
64
69
|
// all actions are returned. We'll have a single entry for getting the actions
|
|
65
70
|
// and the consumer should provide the context to filter the actions, if needed.
|
|
@@ -111,6 +116,6 @@ export function usePostActions({
|
|
|
111
116
|
}
|
|
112
117
|
}
|
|
113
118
|
return actions;
|
|
114
|
-
}, [context, defaultActions, onActionPerformed, setAsHomepageAction,
|
|
119
|
+
}, [context, defaultActions, onActionPerformed, setAsHomepageAction, setAsPostsPageAction, shouldShowHomepageActions]);
|
|
115
120
|
}
|
|
116
121
|
//# sourceMappingURL=actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDispatch","useSelect","useMemo","useEffect","store","coreStore","editorStore","unlock","useSetAsHomepageAction","jsx","_jsx","usePostActions","postType","onActionPerformed","context","defaultActions","select","getEntityActions","canManageOptions","hasFrontPageTemplate","getEntityRecords","templates","per_page","canUser","kind","name","find","template","slug","setAsHomepageAction","
|
|
1
|
+
{"version":3,"names":["useDispatch","useSelect","useMemo","useEffect","store","coreStore","editorStore","unlock","useSetAsHomepageAction","useSetAsPostsPageAction","jsx","_jsx","usePostActions","postType","onActionPerformed","context","defaultActions","select","getEntityActions","canManageOptions","hasFrontPageTemplate","getEntityRecords","templates","per_page","canUser","kind","name","find","template","slug","setAsHomepageAction","setAsPostsPageAction","shouldShowHomepageActions","registerPostTypeSchema","actions","push","sort","a","b","id","filter","action","i","length","callback","existingCallback","items","argsObject","_items","RenderModal","ExistingRenderModal","props"],"sources":["@wordpress/editor/src/components/post-actions/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMemo, useEffect } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useSetAsHomepageAction } from './set-as-homepage';\nimport { useSetAsPostsPageAction } from './set-as-posts-page';\n\nexport function usePostActions( { postType, onActionPerformed, context } ) {\n\tconst { defaultActions } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityActions } = unlock( select( editorStore ) );\n\t\t\treturn {\n\t\t\t\tdefaultActions: getEntityActions( 'postType', postType ),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tconst { canManageOptions, hasFrontPageTemplate } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\tconst templates = getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\tper_page: -1,\n\t\t\t} );\n\n\t\t\treturn {\n\t\t\t\tcanManageOptions: select( coreStore ).canUser( 'update', {\n\t\t\t\t\tkind: 'root',\n\t\t\t\t\tname: 'site',\n\t\t\t\t} ),\n\t\t\t\thasFrontPageTemplate: !! templates?.find(\n\t\t\t\t\t( template ) => template?.slug === 'front-page'\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t);\n\n\tconst setAsHomepageAction = useSetAsHomepageAction();\n\tconst setAsPostsPageAction = useSetAsPostsPageAction();\n\tconst shouldShowHomepageActions =\n\t\tcanManageOptions && ! hasFrontPageTemplate;\n\n\tconst { registerPostTypeSchema } = unlock( useDispatch( editorStore ) );\n\tuseEffect( () => {\n\t\tregisterPostTypeSchema( postType );\n\t}, [ registerPostTypeSchema, postType ] );\n\n\treturn useMemo( () => {\n\t\tlet actions = [ ...defaultActions ];\n\t\tif ( shouldShowHomepageActions ) {\n\t\t\tactions.push( setAsHomepageAction, setAsPostsPageAction );\n\t\t}\n\n\t\t// Ensure \"Move to trash\" is always the last action.\n\t\tactions = actions.sort( ( a, b ) =>\n\t\t\tb.id === 'move-to-trash' ? -1 : 0\n\t\t);\n\n\t\t// Filter actions based on provided context. If not provided\n\t\t// all actions are returned. We'll have a single entry for getting the actions\n\t\t// and the consumer should provide the context to filter the actions, if needed.\n\t\t// Actions should also provide the `context` they support, if it's specific, to\n\t\t// compare with the provided context to get all the actions.\n\t\t// Right now the only supported context is `list`.\n\t\tactions = actions.filter( ( action ) => {\n\t\t\tif ( ! action.context ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn action.context === context;\n\t\t} );\n\n\t\tif ( onActionPerformed ) {\n\t\t\tfor ( let i = 0; i < actions.length; ++i ) {\n\t\t\t\tif ( actions[ i ].callback ) {\n\t\t\t\t\tconst existingCallback = actions[ i ].callback;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tcallback: ( items, argsObject ) => {\n\t\t\t\t\t\t\texistingCallback( items, {\n\t\t\t\t\t\t\t\t...argsObject,\n\t\t\t\t\t\t\t\tonActionPerformed: ( _items ) => {\n\t\t\t\t\t\t\t\t\tif ( argsObject?.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\targsObject.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t_items\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},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tif ( actions[ i ].RenderModal ) {\n\t\t\t\t\tconst ExistingRenderModal = actions[ i ].RenderModal;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tRenderModal: ( props ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<ExistingRenderModal\n\t\t\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\t\t\tonActionPerformed={ ( _items ) => {\n\t\t\t\t\t\t\t\t\t\tif ( props.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\t\tprops.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t\t_items\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},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn actions;\n\t}, [\n\t\tcontext,\n\t\tdefaultActions,\n\t\tonActionPerformed,\n\t\tsetAsHomepageAction,\n\t\tsetAsPostsPageAction,\n\t\tshouldShowHomepageActions,\n\t] );\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;AACvD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAClD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,sBAAsB,QAAQ,mBAAmB;AAC1D,SAASC,uBAAuB,QAAQ,qBAAqB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE9D,OAAO,SAASC,cAAcA,CAAE;EAAEC,QAAQ;EAAEC,iBAAiB;EAAEC;AAAQ,CAAC,EAAG;EAC1E,MAAM;IAAEC;EAAe,CAAC,GAAGf,SAAS,CACjCgB,MAAM,IAAM;IACb,MAAM;MAAEC;IAAiB,CAAC,GAAGX,MAAM,CAAEU,MAAM,CAAEX,WAAY,CAAE,CAAC;IAC5D,OAAO;MACNU,cAAc,EAAEE,gBAAgB,CAAE,UAAU,EAAEL,QAAS;IACxD,CAAC;EACF,CAAC,EACD,CAAEA,QAAQ,CACX,CAAC;EAED,MAAM;IAAEM,gBAAgB;IAAEC;EAAqB,CAAC,GAAGnB,SAAS,CACzDgB,MAAM,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CAACrC,iBAAiB,EAAG;oBAC9BqC,KAAK,CAACrC,iBAAiB,CAAEkC,MAAO,CAAC;kBAClC;kBACAlC,iBAAiB,CAChBoB,OAAO,CAAEQ,CAAC,CAAE,CAACH,EAAE,EACfS,MACD,CAAC;gBACF;cAAG,CACH,CAAC;YAEJ;UACD,CAAC;QACF;MACD;IACD;IAEA,OAAOd,OAAO;EACf,CAAC,EAAE,CACFnB,OAAO,EACPC,cAAc,EACdF,iBAAiB,EACjBgB,mBAAmB,EACnBC,oBAAoB,EACpBC,yBAAyB,CACxB,CAAC;AACJ","ignoreList":[]}
|
|
@@ -14,7 +14,7 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
14
14
|
*/
|
|
15
15
|
import { unlock } from '../../lock-unlock';
|
|
16
16
|
import { usePostActions } from './actions';
|
|
17
|
-
import { jsx as _jsx,
|
|
17
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
18
|
const {
|
|
19
19
|
Menu,
|
|
20
20
|
kebabCase
|
|
@@ -63,21 +63,24 @@ export default function PostActions({
|
|
|
63
63
|
});
|
|
64
64
|
}, [allActions, itemsWithPermissions]);
|
|
65
65
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
66
|
-
children: [/*#__PURE__*/
|
|
67
|
-
trigger: /*#__PURE__*/_jsx(Button, {
|
|
68
|
-
size: "small",
|
|
69
|
-
icon: moreVertical,
|
|
70
|
-
label: __('Actions'),
|
|
71
|
-
disabled: !actions.length,
|
|
72
|
-
accessibleWhenDisabled: true,
|
|
73
|
-
className: "editor-all-actions-button"
|
|
74
|
-
}),
|
|
66
|
+
children: [/*#__PURE__*/_jsxs(Menu, {
|
|
75
67
|
placement: "bottom-end",
|
|
76
|
-
children: /*#__PURE__*/_jsx(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
68
|
+
children: [/*#__PURE__*/_jsx(Menu.TriggerButton, {
|
|
69
|
+
render: /*#__PURE__*/_jsx(Button, {
|
|
70
|
+
size: "small",
|
|
71
|
+
icon: moreVertical,
|
|
72
|
+
label: __('Actions'),
|
|
73
|
+
disabled: !actions.length,
|
|
74
|
+
accessibleWhenDisabled: true,
|
|
75
|
+
className: "editor-all-actions-button"
|
|
76
|
+
})
|
|
77
|
+
}), /*#__PURE__*/_jsx(Menu.Popover, {
|
|
78
|
+
children: /*#__PURE__*/_jsx(ActionsDropdownMenuGroup, {
|
|
79
|
+
actions: actions,
|
|
80
|
+
items: itemsWithPermissions,
|
|
81
|
+
setActiveModalAction: setActiveModalAction
|
|
82
|
+
})
|
|
83
|
+
})]
|
|
81
84
|
}), !!activeModalAction && /*#__PURE__*/_jsx(ActionModal, {
|
|
82
85
|
action: activeModalAction,
|
|
83
86
|
items: itemsWithPermissions,
|