@wordpress/editor 14.6.0 → 14.7.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/README.md +37 -0
- package/build/bindings/post-meta.js +10 -8
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/block-manager/index.js +4 -1
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/block-settings-menu/content-only-settings-menu.js +5 -8
- package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build/components/document-bar/index.js +4 -4
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/editor-history/redo.js +4 -1
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/editor-history/undo.js +4 -1
- package/build/components/editor-history/undo.js.map +1 -1
- package/build/components/editor-interface/index.js +2 -3
- package/build/components/editor-interface/index.js.map +1 -1
- package/build/components/error-boundary/index.js +4 -1
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/index.js +8 -0
- package/build/components/index.js.map +1 -1
- package/build/components/inserter-sidebar/index.js +3 -5
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/local-autosave-monitor/index.js +5 -5
- package/build/components/local-autosave-monitor/index.js.map +1 -1
- package/build/components/page-attributes/parent.js +4 -1
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/plugin-preview-menu-item/index.js +57 -0
- package/build/components/plugin-preview-menu-item/index.js.map +1 -0
- package/build/components/post-actions/index.js +5 -8
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-excerpt/panel.js +4 -1
- package/build/components/post-excerpt/panel.js.map +1 -1
- package/build/components/post-featured-image/index.js +12 -3
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-format/index.js +4 -1
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-last-revision/index.js +4 -1
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-locked-modal/index.js +12 -3
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-publish-panel/index.js +4 -1
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +4 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js +14 -8
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build/components/post-status/index.js +4 -2
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +4 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js +4 -1
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-template/block-theme.js +13 -4
- package/build/components/post-template/block-theme.js.map +1 -1
- package/build/components/post-template/classic-theme.js +4 -1
- package/build/components/post-template/classic-theme.js.map +1 -1
- package/build/components/post-title/index.js +32 -46
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-url/index.js +4 -1
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js +26 -14
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +5 -6
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/save-publish-panels/index.js +8 -2
- package/build/components/save-publish-panels/index.js.map +1 -1
- package/build/components/start-template-options/index.js +4 -1
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/table-of-contents/index.js +4 -1
- package/build/components/table-of-contents/index.js.map +1 -1
- package/build/components/text-editor/index.js +4 -1
- package/build/components/text-editor/index.js.map +1 -1
- package/build/components/visual-editor/index.js +1 -6
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/dataviews/actions/export-pattern.js +2 -0
- package/build/dataviews/actions/export-pattern.js.map +1 -1
- package/build/dataviews/actions/permanently-delete-post.js +2 -0
- package/build/dataviews/actions/permanently-delete-post.js.map +1 -1
- package/build/dataviews/actions/reset-post.js +8 -2
- package/build/dataviews/actions/reset-post.js.map +1 -1
- package/build/dataviews/actions/trash-post.js +8 -2
- package/build/dataviews/actions/trash-post.js.map +1 -1
- package/build/dataviews/actions/view-post.js +1 -1
- package/build/dataviews/actions/view-post.js.map +1 -1
- package/build/private-apis.js +0 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/private-actions.js +1 -1
- package/build/store/private-actions.js.map +1 -1
- package/build-module/bindings/post-meta.js +10 -8
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/block-manager/index.js +4 -1
- package/build-module/components/block-manager/index.js.map +1 -1
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +6 -9
- package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build-module/components/document-bar/index.js +4 -4
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/editor-history/redo.js +4 -1
- package/build-module/components/editor-history/redo.js.map +1 -1
- package/build-module/components/editor-history/undo.js +4 -1
- package/build-module/components/editor-history/undo.js.map +1 -1
- package/build-module/components/editor-interface/index.js +2 -3
- package/build-module/components/editor-interface/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +4 -1
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/index.js +1 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js +3 -5
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/local-autosave-monitor/index.js +5 -5
- package/build-module/components/local-autosave-monitor/index.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +4 -1
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/plugin-preview-menu-item/index.js +52 -0
- package/build-module/components/plugin-preview-menu-item/index.js.map +1 -0
- package/build-module/components/post-actions/index.js +5 -8
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +4 -1
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +12 -3
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-format/index.js +4 -1
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-last-revision/index.js +4 -1
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js +12 -3
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +4 -1
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js +4 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-upload-media.js +14 -8
- package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build-module/components/post-status/index.js +4 -2
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +4 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js +4 -1
- package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build-module/components/post-template/block-theme.js +13 -4
- package/build-module/components/post-template/block-theme.js.map +1 -1
- package/build-module/components/post-template/classic-theme.js +4 -1
- package/build-module/components/post-template/classic-theme.js.map +1 -1
- package/build-module/components/post-title/index.js +33 -47
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-url/index.js +4 -1
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +26 -14
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +6 -7
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/save-publish-panels/index.js +8 -2
- package/build-module/components/save-publish-panels/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +4 -1
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/table-of-contents/index.js +4 -1
- package/build-module/components/table-of-contents/index.js.map +1 -1
- package/build-module/components/text-editor/index.js +4 -1
- package/build-module/components/text-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +1 -6
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/dataviews/actions/export-pattern.js +2 -0
- package/build-module/dataviews/actions/export-pattern.js.map +1 -1
- package/build-module/dataviews/actions/permanently-delete-post.js +3 -0
- package/build-module/dataviews/actions/permanently-delete-post.js.map +1 -1
- package/build-module/dataviews/actions/reset-post.js +8 -2
- package/build-module/dataviews/actions/reset-post.js.map +1 -1
- package/build-module/dataviews/actions/trash-post.js +8 -2
- package/build-module/dataviews/actions/trash-post.js.map +1 -1
- package/build-module/dataviews/actions/view-post.js +2 -2
- package/build-module/dataviews/actions/view-post.js.map +1 -1
- package/build-module/private-apis.js +0 -2
- package/build-module/private-apis.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-style/style-rtl.css +12 -7
- package/build-style/style.css +12 -7
- package/build-types/bindings/post-meta.d.ts +0 -3
- package/build-types/bindings/post-meta.d.ts.map +1 -1
- package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts.map +1 -1
- package/build-types/components/editor-history/redo.d.ts.map +1 -1
- package/build-types/components/editor-history/undo.d.ts.map +1 -1
- package/build-types/components/editor-interface/index.d.ts.map +1 -1
- package/build-types/components/error-boundary/index.d.ts.map +1 -1
- package/build-types/components/index.d.ts +1 -0
- package/build-types/components/index.d.ts.map +1 -1
- package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
- package/build-types/components/page-attributes/parent.d.ts.map +1 -1
- package/build-types/components/plugin-preview-menu-item/index.d.ts +3 -0
- package/build-types/components/plugin-preview-menu-item/index.d.ts.map +1 -0
- package/build-types/components/post-actions/index.d.ts.map +1 -1
- package/build-types/components/post-format/index.d.ts.map +1 -1
- package/build-types/components/post-last-revision/index.d.ts.map +1 -1
- package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/index.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/maybe-post-format-panel.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/maybe-upload-media.d.ts.map +1 -1
- package/build-types/components/post-status/index.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/most-used-terms.d.ts.map +1 -1
- package/build-types/components/post-template/block-theme.d.ts.map +1 -1
- package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
- package/build-types/components/post-url/index.d.ts.map +1 -1
- package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
- package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
- package/build-types/components/save-publish-panels/index.d.ts.map +1 -1
- package/build-types/components/start-template-options/index.d.ts.map +1 -1
- package/build-types/components/text-editor/index.d.ts.map +1 -1
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/dataviews/actions/export-pattern.d.ts.map +1 -1
- package/build-types/dataviews/actions/permanently-delete-post.d.ts.map +1 -1
- package/build-types/dataviews/actions/reset-post.d.ts.map +1 -1
- package/build-types/dataviews/actions/trash-post.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/package.json +36 -36
- package/src/bindings/post-meta.js +12 -6
- package/src/components/block-manager/index.js +2 -0
- package/src/components/block-settings-menu/content-only-settings-menu.js +5 -9
- package/src/components/create-template-part-modal/style.scss +1 -1
- package/src/components/document-bar/index.js +4 -4
- package/src/components/document-outline/style.scss +1 -1
- package/src/components/editor-history/redo.js +2 -0
- package/src/components/editor-history/undo.js +2 -0
- package/src/components/editor-interface/index.js +2 -4
- package/src/components/error-boundary/index.js +6 -1
- package/src/components/header/style.scss +6 -3
- package/src/components/index.js +1 -0
- package/src/components/inserter-sidebar/index.js +4 -3
- package/src/components/local-autosave-monitor/index.js +6 -6
- package/src/components/page-attributes/parent.js +5 -4
- package/src/components/plugin-preview-menu-item/index.js +52 -0
- package/src/components/post-actions/index.js +8 -14
- package/src/components/post-card-panel/style.scss +1 -1
- package/src/components/post-excerpt/panel.js +2 -0
- package/src/components/post-featured-image/index.js +6 -0
- package/src/components/post-featured-image/style.scss +1 -2
- package/src/components/post-format/index.js +2 -0
- package/src/components/post-last-revision/index.js +2 -0
- package/src/components/post-locked-modal/index.js +14 -2
- package/src/components/post-locked-modal/style.scss +1 -1
- package/src/components/post-publish-panel/index.js +2 -0
- package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -0
- package/src/components/post-publish-panel/maybe-upload-media.js +37 -29
- package/src/components/post-publish-panel/style.scss +3 -1
- package/src/components/post-status/index.js +3 -2
- package/src/components/post-taxonomies/hierarchical-term-selector.js +2 -0
- package/src/components/post-taxonomies/most-used-terms.js +2 -0
- package/src/components/post-template/block-theme.js +15 -9
- package/src/components/post-template/classic-theme.js +2 -0
- package/src/components/post-title/index.js +30 -41
- package/src/components/post-url/index.js +2 -0
- package/src/components/preview-dropdown/index.js +28 -20
- package/src/components/provider/use-block-editor-settings.js +5 -5
- package/src/components/resizable-editor/style.scss +2 -2
- package/src/components/save-publish-panels/index.js +4 -0
- package/src/components/start-template-options/index.js +6 -1
- package/src/components/table-of-contents/index.js +2 -0
- package/src/components/text-editor/index.js +2 -0
- package/src/components/visual-editor/index.js +2 -9
- package/src/dataviews/actions/export-pattern.tsx +2 -0
- package/src/dataviews/actions/permanently-delete-post.tsx +2 -0
- package/src/dataviews/actions/reset-post.tsx +4 -0
- package/src/dataviews/actions/trash-post.tsx +4 -0
- package/src/dataviews/actions/view-post.tsx +2 -2
- package/src/private-apis.js +0 -2
- package/src/store/private-actions.js +3 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useDispatch","safeDecodeURIComponent","cleanForSlug","useState","createInterpolateElement","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","__","ExternalLink","Button","__experimentalInputControl","InputControl","__experimentalInputControlPrefixWrapper","InputControlPrefixWrapper","__experimentalVStack","VStack","store","noticesStore","copySmall","coreStore","useCopyToClipboard","editorStore","jsx","_jsx","jsxs","_jsxs","PostURL","onClose","isEditable","postSlug","postLink","permalinkPrefix","permalinkSuffix","permalink","select","_post$_links$wpActio","post","getCurrentPost","postTypeSlug","getCurrentPostType","postType","getPostType","permalinkParts","getPermalinkParts","hasPublishAction","_links","isPermalinkEditable","getEditedPostSlug","viewPostLabel","labels","view_item","link","prefix","suffix","getPermalink","editPost","createNotice","forceEmptyField","setForceEmptyField","copyButtonRef","isDismissible","type","className","children","title","spacing","a","href","__next40pxDefaultSize","icon","ref","label","hideLabelFromVision","value","autoComplete","spellCheck","onChange","newValue","slug","onBlur","event","target","help"],"sources":["@wordpress/editor/src/components/post-url/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { safeDecodeURIComponent, cleanForSlug } from '@wordpress/url';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tExternalLink,\n\tButton,\n\t__experimentalInputControl as InputControl,\n\t__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { copySmall } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useCopyToClipboard } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders the `PostURL` component.\n *\n * @example\n * ```jsx\n * <PostURL />\n * ```\n *\n * @param {Function} onClose Callback function to be executed when the popover is closed.\n *\n * @return {Component} The rendered PostURL component.\n */\nexport default function PostURL( { onClose } ) {\n\tconst {\n\t\tisEditable,\n\t\tpostSlug,\n\t\tpostLink,\n\t\tpermalinkPrefix,\n\t\tpermalinkSuffix,\n\t\tpermalink,\n\t} = useSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\t\tconst permalinkParts = select( editorStore ).getPermalinkParts();\n\t\tconst hasPublishAction = post?._links?.[ 'wp:action-publish' ] ?? false;\n\n\t\treturn {\n\t\t\tisEditable:\n\t\t\t\tselect( editorStore ).isPermalinkEditable() && hasPublishAction,\n\t\t\tpostSlug: safeDecodeURIComponent(\n\t\t\t\tselect( editorStore ).getEditedPostSlug()\n\t\t\t),\n\t\t\tviewPostLabel: postType?.labels.view_item,\n\t\t\tpostLink: post.link,\n\t\t\tpermalinkPrefix: permalinkParts?.prefix,\n\t\t\tpermalinkSuffix: permalinkParts?.suffix,\n\t\t\tpermalink: safeDecodeURIComponent(\n\t\t\t\tselect( editorStore ).getPermalink()\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst [ forceEmptyField, setForceEmptyField ] = useState( false );\n\tconst copyButtonRef = useCopyToClipboard( permalink, () => {\n\t\tcreateNotice( 'info', __( 'Copied URL to clipboard.' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t} );\n\treturn (\n\t\t<div className=\"editor-post-url\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t{ isEditable && (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Customize the last part of the URL. <a>Learn more.</a>'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink'\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</div>\n\t\t\t\t) }\n\t\t\t\t<div>\n\t\t\t\t\t{ isEditable && (\n\t\t\t\t\t\t<InputControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tprefix={\n\t\t\t\t\t\t\t\t<InputControlPrefixWrapper>\n\t\t\t\t\t\t\t\t\t/\n\t\t\t\t\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\ticon={ copySmall }\n\t\t\t\t\t\t\t\t\tref={ copyButtonRef }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Copy' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tvalue={ forceEmptyField ? '' : postSlug }\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\tclassName=\"editor-post-url__input\"\n\t\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\t\teditPost( { slug: newValue } );\n\t\t\t\t\t\t\t\t// When we delete the field the permalink gets\n\t\t\t\t\t\t\t\t// reverted to the original value.\n\t\t\t\t\t\t\t\t// The forceEmptyField logic allows the user to have\n\t\t\t\t\t\t\t\t// the field temporarily empty while typing.\n\t\t\t\t\t\t\t\tif ( ! newValue ) {\n\t\t\t\t\t\t\t\t\tif ( ! forceEmptyField ) {\n\t\t\t\t\t\t\t\t\t\tsetForceEmptyField( true );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\t\t\tsetForceEmptyField( false );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonBlur={ ( event ) => {\n\t\t\t\t\t\t\t\teditPost( {\n\t\t\t\t\t\t\t\t\tslug: cleanForSlug( event.target.value ),\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\t\t\tsetForceEmptyField( false );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\tclassName=\"editor-post-url__link\"\n\t\t\t\t\t\t\t\t\thref={ postLink }\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-prefix\">\n\t\t\t\t\t\t\t\t\t\t{ permalinkPrefix }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-slug\">\n\t\t\t\t\t\t\t\t\t\t{ postSlug }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-suffix\">\n\t\t\t\t\t\t\t\t\t\t{ permalinkSuffix }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isEditable && (\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\tclassName=\"editor-post-url__link\"\n\t\t\t\t\t\t\thref={ postLink }\n\t\t\t\t\t\t\ttar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YACD;YACA,IAAKD,eAAe,EAAG;cACtBC,kBAAkB,CAAE,KAAM,CAAC;YAC5B;UACD,CAAG;UACHqB,MAAM,EAAKC,KAAK,IAAM;YACrBzB,QAAQ,CAAE;cACTuB,IAAI,EAAE5E,YAAY,CAAE8E,KAAK,CAACC,MAAM,CAACR,KAAM;YACxC,CAAE,CAAC;YACH,IAAKhB,eAAe,EAAG;cACtBC,kBAAkB,CAAE,KAAM,CAAC;YAC5B;UACD,CAAG;UACHwB,IAAI,eACHzD,KAAA,CAACjB,YAAY;YACZsD,SAAS,EAAC,uBAAuB;YACjCK,IAAI,EAAGrC,QAAU;YACjBmD,MAAM,EAAC,QAAQ;YAAAlB,QAAA,gBAEfxC,IAAA;cAAMuC,SAAS,EAAC,8BAA8B;cAAAC,QAAA,EAC3ChC;YAAe,CACZ,CAAC,eACPR,IAAA;cAAMuC,SAAS,EAAC,4BAA4B;cAAAC,QAAA,EACzClC;YAAQ,CACL,CAAC,eACPN,IAAA;cAAMuC,SAAS,EAAC,8BAA8B;cAAAC,QAAA,EAC3C/B;YAAe,CACZ,CAAC;UAAA,CACM;QACd,CACD,CACD,EACC,CAAEJ,UAAU,iBACbL,IAAA,CAACf,YAAY;UACZsD,SAAS,EAAC,uBAAuB;UACjCK,IAAI,EAAGrC,QAAU;UACjBmD,MAAM,EAAC,QAAQ;UAAAlB,QAAA,EAEbjC;QAAQ,CACG,CACd;MAAA,CACG,CAAC;IAAA,CACC,CAAC;EAAA,CACL,CAAC;AAER","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","safeDecodeURIComponent","cleanForSlug","useState","createInterpolateElement","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","__","ExternalLink","Button","__experimentalInputControl","InputControl","__experimentalInputControlPrefixWrapper","InputControlPrefixWrapper","__experimentalVStack","VStack","store","noticesStore","copySmall","coreStore","useCopyToClipboard","editorStore","jsx","_jsx","jsxs","_jsxs","PostURL","onClose","isEditable","postSlug","postLink","permalinkPrefix","permalinkSuffix","permalink","select","_post$_links$wpActio","post","getCurrentPost","postTypeSlug","getCurrentPostType","postType","getPostType","permalinkParts","getPermalinkParts","hasPublishAction","_links","isPermalinkEditable","getEditedPostSlug","viewPostLabel","labels","view_item","link","prefix","suffix","getPermalink","editPost","createNotice","forceEmptyField","setForceEmptyField","copyButtonRef","isDismissible","type","className","children","title","spacing","a","href","__next40pxDefaultSize","icon","ref","label","hideLabelFromVision","value","autoComplete","spellCheck","onChange","newValue","slug","onBlur","event","target","help"],"sources":["@wordpress/editor/src/components/post-url/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { safeDecodeURIComponent, cleanForSlug } from '@wordpress/url';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tExternalLink,\n\tButton,\n\t__experimentalInputControl as InputControl,\n\t__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { copySmall } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useCopyToClipboard } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders the `PostURL` component.\n *\n * @example\n * ```jsx\n * <PostURL />\n * ```\n *\n * @param {Function} onClose Callback function to be executed when the popover is closed.\n *\n * @return {Component} The rendered PostURL component.\n */\nexport default function PostURL( { onClose } ) {\n\tconst {\n\t\tisEditable,\n\t\tpostSlug,\n\t\tpostLink,\n\t\tpermalinkPrefix,\n\t\tpermalinkSuffix,\n\t\tpermalink,\n\t} = useSelect( ( select ) => {\n\t\tconst post = select( editorStore ).getCurrentPost();\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\t\tconst permalinkParts = select( editorStore ).getPermalinkParts();\n\t\tconst hasPublishAction = post?._links?.[ 'wp:action-publish' ] ?? false;\n\n\t\treturn {\n\t\t\tisEditable:\n\t\t\t\tselect( editorStore ).isPermalinkEditable() && hasPublishAction,\n\t\t\tpostSlug: safeDecodeURIComponent(\n\t\t\t\tselect( editorStore ).getEditedPostSlug()\n\t\t\t),\n\t\t\tviewPostLabel: postType?.labels.view_item,\n\t\t\tpostLink: post.link,\n\t\t\tpermalinkPrefix: permalinkParts?.prefix,\n\t\t\tpermalinkSuffix: permalinkParts?.suffix,\n\t\t\tpermalink: safeDecodeURIComponent(\n\t\t\t\tselect( editorStore ).getPermalink()\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst [ forceEmptyField, setForceEmptyField ] = useState( false );\n\tconst copyButtonRef = useCopyToClipboard( permalink, () => {\n\t\tcreateNotice( 'info', __( 'Copied URL to clipboard.' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t} );\n\treturn (\n\t\t<div className=\"editor-post-url\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t{ isEditable && (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Customize the last part of the URL. <a>Learn more.</a>'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink'\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</div>\n\t\t\t\t) }\n\t\t\t\t<div>\n\t\t\t\t\t{ isEditable && (\n\t\t\t\t\t\t<InputControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tprefix={\n\t\t\t\t\t\t\t\t<InputControlPrefixWrapper>\n\t\t\t\t\t\t\t\t\t/\n\t\t\t\t\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize={ false }\n\t\t\t\t\t\t\t\t\ticon={ copySmall }\n\t\t\t\t\t\t\t\t\tref={ copyButtonRef }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Copy' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tvalue={ forceEmptyField ? '' : postSlug }\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\tclassName=\"editor-post-url__input\"\n\t\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\t\teditPost( { slug: newValue } );\n\t\t\t\t\t\t\t\t// When we delete the field the permalink gets\n\t\t\t\t\t\t\t\t// reverted to the original value.\n\t\t\t\t\t\t\t\t// The forceEmptyField logic allows the user to have\n\t\t\t\t\t\t\t\t// the field temporarily empty while typing.\n\t\t\t\t\t\t\t\tif ( ! newValue ) {\n\t\t\t\t\t\t\t\t\tif ( ! forceEmptyField ) {\n\t\t\t\t\t\t\t\t\t\tsetForceEmptyField( true );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\t\t\tsetForceEmptyField( false );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonBlur={ ( event ) => {\n\t\t\t\t\t\t\t\teditPost( {\n\t\t\t\t\t\t\t\t\tslug: cleanForSlug( event.target.value ),\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\tif ( forceEmptyField ) {\n\t\t\t\t\t\t\t\t\tsetForceEmptyField( false );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\tclassName=\"editor-post-url__link\"\n\t\t\t\t\t\t\t\t\thref={ postLink }\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-prefix\">\n\t\t\t\t\t\t\t\t\t\t{ permalinkPrefix }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-slug\">\n\t\t\t\t\t\t\t\t\t\t{ postSlug }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<span className=\"editor-post-url__link-suffix\">\n\t\t\t\t\t\t\t\t\t\t{ permalinkSuffix }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isEditable && (\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\tclassName=\"editor-post-url__link\"\n\t\t\t\t\t\t\thref={ postLink }\n\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t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3B;cACA;YACD;YACA,IAAKD,eAAe,EAAG;cACtBC,kBAAkB,CAAE,KAAM,CAAC;YAC5B;UACD,CAAG;UACHqB,MAAM,EAAKC,KAAK,IAAM;YACrBzB,QAAQ,CAAE;cACTuB,IAAI,EAAE5E,YAAY,CAAE8E,KAAK,CAACC,MAAM,CAACR,KAAM;YACxC,CAAE,CAAC;YACH,IAAKhB,eAAe,EAAG;cACtBC,kBAAkB,CAAE,KAAM,CAAC;YAC5B;UACD,CAAG;UACHwB,IAAI,eACHzD,KAAA,CAACjB,YAAY;YACZsD,SAAS,EAAC,uBAAuB;YACjCK,IAAI,EAAGrC,QAAU;YACjBmD,MAAM,EAAC,QAAQ;YAAAlB,QAAA,gBAEfxC,IAAA;cAAMuC,SAAS,EAAC,8BAA8B;cAAAC,QAAA,EAC3ChC;YAAe,CACZ,CAAC,eACPR,IAAA;cAAMuC,SAAS,EAAC,4BAA4B;cAAAC,QAAA,EACzClC;YAAQ,CACL,CAAC,eACPN,IAAA;cAAMuC,SAAS,EAAC,8BAA8B;cAAAC,QAAA,EAC3C/B;YAAe,CACZ,CAAC;UAAA,CACM;QACd,CACD,CACD,EACC,CAAEJ,UAAU,iBACbL,IAAA,CAACf,YAAY;UACZsD,SAAS,EAAC,uBAAuB;UACjCK,IAAI,EAAGrC,QAAU;UACjBmD,MAAM,EAAC,QAAQ;UAAAlB,QAAA,EAEbjC;QAAQ,CACG,CACd;MAAA,CACG,CAAC;IAAA,CACC,CAAC;EAAA,CACL,CAAC;AAER","ignoreList":[]}
|
|
@@ -15,6 +15,7 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
15
15
|
import { useEffect, useRef } from '@wordpress/element';
|
|
16
16
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
17
17
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
18
|
+
import { ActionItem } from '@wordpress/interface';
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Internal dependencies
|
|
@@ -42,7 +43,7 @@ export default function PreviewDropdown({
|
|
|
42
43
|
getCurrentPostType
|
|
43
44
|
} = select(editorStore);
|
|
44
45
|
const {
|
|
45
|
-
|
|
46
|
+
getEntityRecord,
|
|
46
47
|
getPostType
|
|
47
48
|
} = select(coreStore);
|
|
48
49
|
const {
|
|
@@ -55,7 +56,7 @@ export default function PreviewDropdown({
|
|
|
55
56
|
return {
|
|
56
57
|
deviceType: getDeviceType(),
|
|
57
58
|
editorMode: __unstableGetEditorMode(),
|
|
58
|
-
homeUrl:
|
|
59
|
+
homeUrl: getEntityRecord('root', '__unstableBase')?.home,
|
|
59
60
|
isTemplate: _currentPostType === 'wp_template',
|
|
60
61
|
isViewable: (_getPostType$viewable = getPostType(_currentPostType)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false,
|
|
61
62
|
showIconLabels: get('core', 'showIconLabels')
|
|
@@ -71,14 +72,14 @@ export default function PreviewDropdown({
|
|
|
71
72
|
/**
|
|
72
73
|
* Save the original editing mode in a ref to restore it when we exit zoom out.
|
|
73
74
|
*/
|
|
74
|
-
const
|
|
75
|
+
const originalEditingModeRef = useRef(editorMode);
|
|
75
76
|
useEffect(() => {
|
|
76
77
|
if (editorMode !== 'zoom-out') {
|
|
77
|
-
|
|
78
|
+
originalEditingModeRef.current = editorMode;
|
|
78
79
|
}
|
|
79
80
|
return () => {
|
|
80
|
-
if (editorMode === 'zoom-out' && editorMode !==
|
|
81
|
-
__unstableSetEditorMode(
|
|
81
|
+
if (editorMode === 'zoom-out' && editorMode !== originalEditingModeRef.current) {
|
|
82
|
+
__unstableSetEditorMode(originalEditingModeRef.current);
|
|
82
83
|
}
|
|
83
84
|
};
|
|
84
85
|
}, [editorMode, __unstableSetEditorMode]);
|
|
@@ -115,19 +116,24 @@ export default function PreviewDropdown({
|
|
|
115
116
|
value: 'Desktop',
|
|
116
117
|
label: __('Desktop'),
|
|
117
118
|
icon: desktop
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
}];
|
|
120
|
+
if (window.__experimentalEnableZoomOutExperiment) {
|
|
121
|
+
choices.push({
|
|
122
|
+
value: 'ZoomOut',
|
|
123
|
+
label: __('Desktop (50%)'),
|
|
124
|
+
icon: desktop
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
choices.push({
|
|
123
128
|
value: 'Tablet',
|
|
124
129
|
label: __('Tablet'),
|
|
125
130
|
icon: tablet
|
|
126
|
-
}
|
|
131
|
+
});
|
|
132
|
+
choices.push({
|
|
127
133
|
value: 'Mobile',
|
|
128
134
|
label: __('Mobile'),
|
|
129
135
|
icon: mobile
|
|
130
|
-
}
|
|
136
|
+
});
|
|
131
137
|
const previewValue = editorMode === 'zoom-out' ? 'ZoomOut' : deviceType;
|
|
132
138
|
|
|
133
139
|
/**
|
|
@@ -136,7 +142,7 @@ export default function PreviewDropdown({
|
|
|
136
142
|
* @param {string} value The device type.
|
|
137
143
|
*/
|
|
138
144
|
const onSelect = value => {
|
|
139
|
-
let newEditorMode =
|
|
145
|
+
let newEditorMode = originalEditingModeRef.current;
|
|
140
146
|
if (value === 'ZoomOut') {
|
|
141
147
|
newEditorMode = 'zoom-out';
|
|
142
148
|
setDeviceType('Desktop');
|
|
@@ -188,6 +194,12 @@ export default function PreviewDropdown({
|
|
|
188
194
|
}),
|
|
189
195
|
onPreview: onClose
|
|
190
196
|
})
|
|
197
|
+
}), /*#__PURE__*/_jsx(ActionItem.Slot, {
|
|
198
|
+
name: "core/plugin-preview-menu",
|
|
199
|
+
as: MenuGroup,
|
|
200
|
+
fillProps: {
|
|
201
|
+
onClick: onClose
|
|
202
|
+
}
|
|
191
203
|
})]
|
|
192
204
|
})
|
|
193
205
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","useViewportMatch","DropdownMenu","MenuGroup","MenuItem","MenuItemsChoice","VisuallyHidden","Icon","__","desktop","mobile","tablet","external","useSelect","useDispatch","store","coreStore","useEffect","useRef","preferencesStore","blockEditorStore","editorStore","PostPreviewButton","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","PreviewDropdown","forceIsAutosaveable","disabled","deviceType","editorMode","homeUrl","isTemplate","isViewable","showIconLabels","select","_getPostType$viewable","getDeviceType","getCurrentPostType","getUnstableBase","getPostType","get","__unstableGetEditorMode","_currentPostType","home","viewable","setDeviceType","__unstableSetEditorMode","originalEditingMode","current","isMobile","popoverProps","placement","toggleProps","className","iconPosition","size","showTooltip","accessibleWhenDisabled","menuProps","deviceIcons","choices","value","label","icon","previewValue","onSelect","newEditorMode","toLowerCase","text","undefined","disableOpenOnArrowDown","children","onClose","href","target","onClick","as","role","textContent","onPreview"],"sources":["@wordpress/editor/src/components/preview-dropdown/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tMenuItemsChoice,\n\tVisuallyHidden,\n\tIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { desktop, mobile, tablet, external } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PostPreviewButton from '../post-preview-button';\n\nexport default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {\n\tconst {\n\t\tdeviceType,\n\t\teditorMode,\n\t\thomeUrl,\n\t\tisTemplate,\n\t\tisViewable,\n\t\tshowIconLabels,\n\t} = useSelect( ( select ) => {\n\t\tconst { getDeviceType, getCurrentPostType } = select( editorStore );\n\t\tconst { getUnstableBase, getPostType } = select( coreStore );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst _currentPostType = getCurrentPostType();\n\t\treturn {\n\t\t\tdeviceType: getDeviceType(),\n\t\t\teditorMode: __unstableGetEditorMode(),\n\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t\tisTemplate: _currentPostType === 'wp_template',\n\t\t\tisViewable: getPostType( _currentPostType )?.viewable ?? false,\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t};\n\t}, [] );\n\tconst { setDeviceType } = useDispatch( editorStore );\n\tconst { __unstableSetEditorMode } = useDispatch( blockEditorStore );\n\n\t/**\n\t * Save the original editing mode in a ref to restore it when we exit zoom out.\n\t */\n\tconst originalEditingMode = useRef( editorMode );\n\tuseEffect( () => {\n\t\tif ( editorMode !== 'zoom-out' ) {\n\t\t\toriginalEditingMode.current = editorMode;\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (\n\t\t\t\teditorMode === 'zoom-out' &&\n\t\t\t\teditorMode !== originalEditingMode.current\n\t\t\t) {\n\t\t\t\t__unstableSetEditorMode( originalEditingMode.current );\n\t\t\t}\n\t\t};\n\t}, [ editorMode, __unstableSetEditorMode ] );\n\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\tif ( isMobile ) {\n\t\treturn null;\n\t}\n\n\tconst popoverProps = {\n\t\tplacement: 'bottom-end',\n\t};\n\tconst toggleProps = {\n\t\tclassName: 'editor-preview-dropdown__toggle',\n\t\ticonPosition: 'right',\n\t\tsize: 'compact',\n\t\tshowTooltip: ! showIconLabels,\n\t\tdisabled,\n\t\taccessibleWhenDisabled: disabled,\n\t};\n\tconst menuProps = {\n\t\t'aria-label': __( 'View options' ),\n\t};\n\n\tconst deviceIcons = {\n\t\tdesktop,\n\t\tmobile,\n\t\ttablet,\n\t};\n\n\t/**\n\t * The choices for the device type.\n\t *\n\t * @type {Array}\n\t */\n\tconst choices = [\n\t\t{\n\t\t\tvalue: 'Desktop',\n\t\t\tlabel: __( 'Desktop' ),\n\t\t\ticon: desktop,\n\t\t},\n\t\t{\n\t\t\tvalue: 'ZoomOut',\n\t\t\tlabel: __( 'Desktop (50%)' ),\n\t\t\ticon: desktop,\n\t\t},\n\t\t{\n\t\t\tvalue: 'Tablet',\n\t\t\tlabel: __( 'Tablet' ),\n\t\t\ticon: tablet,\n\t\t},\n\t\t{\n\t\t\tvalue: 'Mobile',\n\t\t\tlabel: __( 'Mobile' ),\n\t\t\ticon: mobile,\n\t\t},\n\t];\n\n\tconst previewValue = editorMode === 'zoom-out' ? 'ZoomOut' : deviceType;\n\n\t/**\n\t * Handles the selection of a device type.\n\t *\n\t * @param {string} value The device type.\n\t */\n\tconst onSelect = ( value ) => {\n\t\tlet newEditorMode = originalEditingMode.current;\n\n\t\tif ( value === 'ZoomOut' ) {\n\t\t\tnewEditorMode = 'zoom-out';\n\t\t\tsetDeviceType( 'Desktop' );\n\t\t} else {\n\t\t\tsetDeviceType( value );\n\t\t}\n\n\t\t__unstableSetEditorMode( newEditorMode );\n\t};\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-preview-dropdown',\n\t\t\t\t`editor-preview-dropdown--${ deviceType.toLowerCase() }`\n\t\t\t) }\n\t\t\tpopoverProps={ popoverProps }\n\t\t\ttoggleProps={ toggleProps }\n\t\t\tmenuProps={ menuProps }\n\t\t\ticon={ deviceIcons[ deviceType.toLowerCase() ] }\n\t\t\ttext={ editorMode === 'zoom-out' ? __( '50%' ) : undefined }\n\t\t\tlabel={ __( 'View' ) }\n\t\t\tdisableOpenOnArrowDown={ disabled }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\tchoices={ choices }\n\t\t\t\t\t\t\tvalue={ previewValue }\n\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t{ isTemplate && (\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\thref={ homeUrl }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'View site' ) }\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</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isViewable && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<PostPreviewButton\n\t\t\t\t\t\t\t\tclassName=\"editor-preview-dropdown__button-external\"\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\tforceIsAutosaveable={ forceIsAutosaveable }\n\t\t\t\t\t\t\t\taria-label={ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\ttextContent={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\t\t\t<Icon icon={ external } />\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\tonPreview={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAC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E,oBAAqB,CAAC,eAC5BgB,IAAA,CAACjB,IAAI;cAAC4D,IAAI,EAAGvD;YAAU,CAAE,CAAC;UAAA,CACzB,CACF;UACDuE,SAAS,EAAGP;QAAS,CACrB;MAAC,CACQ,CACX;IAAA,CACA;EACF,CACY,CAAC;AAEjB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","useViewportMatch","DropdownMenu","MenuGroup","MenuItem","MenuItemsChoice","VisuallyHidden","Icon","__","desktop","mobile","tablet","external","useSelect","useDispatch","store","coreStore","useEffect","useRef","preferencesStore","blockEditorStore","ActionItem","editorStore","PostPreviewButton","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","PreviewDropdown","forceIsAutosaveable","disabled","deviceType","editorMode","homeUrl","isTemplate","isViewable","showIconLabels","select","_getPostType$viewable","getDeviceType","getCurrentPostType","getEntityRecord","getPostType","get","__unstableGetEditorMode","_currentPostType","home","viewable","setDeviceType","__unstableSetEditorMode","originalEditingModeRef","current","isMobile","popoverProps","placement","toggleProps","className","iconPosition","size","showTooltip","accessibleWhenDisabled","menuProps","deviceIcons","choices","value","label","icon","window","__experimentalEnableZoomOutExperiment","push","previewValue","onSelect","newEditorMode","toLowerCase","text","undefined","disableOpenOnArrowDown","children","onClose","href","target","onClick","as","role","textContent","onPreview","Slot","name","fillProps"],"sources":["@wordpress/editor/src/components/preview-dropdown/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tMenuItemsChoice,\n\tVisuallyHidden,\n\tIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { desktop, mobile, tablet, external } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { ActionItem } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport PostPreviewButton from '../post-preview-button';\n\nexport default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {\n\tconst {\n\t\tdeviceType,\n\t\teditorMode,\n\t\thomeUrl,\n\t\tisTemplate,\n\t\tisViewable,\n\t\tshowIconLabels,\n\t} = useSelect( ( select ) => {\n\t\tconst { getDeviceType, getCurrentPostType } = select( editorStore );\n\t\tconst { getEntityRecord, getPostType } = select( coreStore );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst _currentPostType = getCurrentPostType();\n\t\treturn {\n\t\t\tdeviceType: getDeviceType(),\n\t\t\teditorMode: __unstableGetEditorMode(),\n\t\t\thomeUrl: getEntityRecord( 'root', '__unstableBase' )?.home,\n\t\t\tisTemplate: _currentPostType === 'wp_template',\n\t\t\tisViewable: getPostType( _currentPostType )?.viewable ?? false,\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t};\n\t}, [] );\n\tconst { setDeviceType } = useDispatch( editorStore );\n\tconst { __unstableSetEditorMode } = useDispatch( blockEditorStore );\n\n\t/**\n\t * Save the original editing mode in a ref to restore it when we exit zoom out.\n\t */\n\tconst originalEditingModeRef = useRef( editorMode );\n\tuseEffect( () => {\n\t\tif ( editorMode !== 'zoom-out' ) {\n\t\t\toriginalEditingModeRef.current = editorMode;\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (\n\t\t\t\teditorMode === 'zoom-out' &&\n\t\t\t\teditorMode !== originalEditingModeRef.current\n\t\t\t) {\n\t\t\t\t__unstableSetEditorMode( originalEditingModeRef.current );\n\t\t\t}\n\t\t};\n\t}, [ editorMode, __unstableSetEditorMode ] );\n\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\tif ( isMobile ) {\n\t\treturn null;\n\t}\n\n\tconst popoverProps = {\n\t\tplacement: 'bottom-end',\n\t};\n\tconst toggleProps = {\n\t\tclassName: 'editor-preview-dropdown__toggle',\n\t\ticonPosition: 'right',\n\t\tsize: 'compact',\n\t\tshowTooltip: ! showIconLabels,\n\t\tdisabled,\n\t\taccessibleWhenDisabled: disabled,\n\t};\n\tconst menuProps = {\n\t\t'aria-label': __( 'View options' ),\n\t};\n\n\tconst deviceIcons = {\n\t\tdesktop,\n\t\tmobile,\n\t\ttablet,\n\t};\n\n\t/**\n\t * The choices for the device type.\n\t *\n\t * @type {Array}\n\t */\n\tconst choices = [\n\t\t{\n\t\t\tvalue: 'Desktop',\n\t\t\tlabel: __( 'Desktop' ),\n\t\t\ticon: desktop,\n\t\t},\n\t];\n\tif ( window.__experimentalEnableZoomOutExperiment ) {\n\t\tchoices.push( {\n\t\t\tvalue: 'ZoomOut',\n\t\t\tlabel: __( 'Desktop (50%)' ),\n\t\t\ticon: desktop,\n\t\t} );\n\t}\n\tchoices.push( {\n\t\tvalue: 'Tablet',\n\t\tlabel: __( 'Tablet' ),\n\t\ticon: tablet,\n\t} );\n\tchoices.push( {\n\t\tvalue: 'Mobile',\n\t\tlabel: __( 'Mobile' ),\n\t\ticon: mobile,\n\t} );\n\n\tconst previewValue = editorMode === 'zoom-out' ? 'ZoomOut' : deviceType;\n\n\t/**\n\t * Handles the selection of a device type.\n\t *\n\t * @param {string} value The device type.\n\t */\n\tconst onSelect = ( value ) => {\n\t\tlet newEditorMode = originalEditingModeRef.current;\n\n\t\tif ( value === 'ZoomOut' ) {\n\t\t\tnewEditorMode = 'zoom-out';\n\t\t\tsetDeviceType( 'Desktop' );\n\t\t} else {\n\t\t\tsetDeviceType( value );\n\t\t}\n\n\t\t__unstableSetEditorMode( newEditorMode );\n\t};\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-preview-dropdown',\n\t\t\t\t`editor-preview-dropdown--${ deviceType.toLowerCase() }`\n\t\t\t) }\n\t\t\tpopoverProps={ popoverProps }\n\t\t\ttoggleProps={ toggleProps }\n\t\t\tmenuProps={ menuProps }\n\t\t\ticon={ deviceIcons[ deviceType.toLowerCase() ] }\n\t\t\ttext={ editorMode === 'zoom-out' ? __( '50%' ) : undefined }\n\t\t\tlabel={ __( 'View' ) }\n\t\t\tdisableOpenOnArrowDown={ disabled }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\tchoices={ choices }\n\t\t\t\t\t\t\tvalue={ previewValue }\n\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t{ isTemplate && (\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\thref={ homeUrl }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'View site' ) }\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</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isViewable && (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<PostPreviewButton\n\t\t\t\t\t\t\t\tclassName=\"editor-preview-dropdown__button-external\"\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\tforceIsAutosaveable={ forceIsAutosaveable }\n\t\t\t\t\t\t\t\taria-label={ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\ttextContent={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Preview in new tab' ) }\n\t\t\t\t\t\t\t\t\t\t<Icon icon={ external } />\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\tonPreview={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t<ActionItem.Slot\n\t\t\t\t\t\tname=\"core/plugin-preview-menu\"\n\t\t\t\t\t\tas={ MenuGroup }\n\t\t\t\t\t\tfillProps={ { onClick: onClose } }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SACCC,YAAY,EACZC,SAAS,EACTC,QAAQ,EACRC,eAAe,EACfC,cAAc,EACdC,IAAI,QACE,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,OAAO,EAAEC,MAAM,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,kBAAkB;AACpE,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;AACtD,SAASH,KAAK,IAAII,gBAAgB,QAAQ,wBAAwB;AAClE,SAASJ,KAAK,IAAIK,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,UAAU,QAAQ,sBAAsB;;AAEjD;AACA;AACA;AACA,SAASN,KAAK,IAAIO,WAAW,QAAQ,aAAa;AAClD,OAAOC,iBAAiB,MAAM,wBAAwB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA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ockEditorStore } from '@wordpress/block-editor'
|
|
|
16
16
|
import inserterMediaCategories from '../media-categories';
|
|
17
17
|
import { mediaUpload } from '../../utils';
|
|
18
18
|
import { store as editorStore } from '../../store';
|
|
19
|
-
import {
|
|
19
|
+
import { unlock } from '../../lock-unlock';
|
|
20
20
|
import { useGlobalStylesContext } from '../global-styles-provider';
|
|
21
21
|
const EMPTY_BLOCKS_LIST = [];
|
|
22
22
|
const EMPTY_OBJECT = {};
|
|
@@ -26,12 +26,13 @@ function __experimentalReusableBlocksSelect(select) {
|
|
|
26
26
|
per_page: -1
|
|
27
27
|
})) !== null && _select$getEntityReco !== void 0 ? _select$getEntityReco : EMPTY_BLOCKS_LIST;
|
|
28
28
|
}
|
|
29
|
-
const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', 'alignWide', 'blockInspectorTabs', 'allowedMimeTypes', 'bodyPlaceholder', 'canLockBlocks', 'capabilities', 'clearBlockSelection', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'enableOpenverseMediaCategory', 'fontSizes', 'gradients', 'generateAnchors', 'onNavigateToEntityRecord', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'locale', 'maxWidth', 'postContentAttributes', 'postsPerPage', 'readOnly', '
|
|
29
|
+
const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', 'alignWide', 'blockInspectorTabs', 'allowedMimeTypes', 'bodyPlaceholder', 'canLockBlocks', 'canUpdateBlockBindings', 'capabilities', 'clearBlockSelection', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'enableOpenverseMediaCategory', 'fontSizes', 'gradients', 'generateAnchors', 'onNavigateToEntityRecord', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'locale', 'maxWidth', 'postContentAttributes', 'postsPerPage', 'readOnly', 'styles', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableHasCustomAppender', '__unstableIsPreviewMode', '__unstableResolvedAssets', '__unstableIsBlockBasedTheme'];
|
|
30
30
|
const {
|
|
31
31
|
globalStylesDataKey,
|
|
32
32
|
globalStylesLinksDataKey,
|
|
33
33
|
selectBlockPatternsKey,
|
|
34
|
-
reusableBlocksSelectKey
|
|
34
|
+
reusableBlocksSelectKey,
|
|
35
|
+
sectionRootClientIdKey
|
|
35
36
|
} = unlock(privateApis);
|
|
36
37
|
|
|
37
38
|
/**
|
|
@@ -216,11 +217,9 @@ function useBlockEditorSettings(settings, postType, postId, renderingMode) {
|
|
|
216
217
|
__experimentalPreferPatternsOnRoot: postType === 'wp_template',
|
|
217
218
|
templateLock: postType === 'wp_navigation' ? 'insert' : settings.templateLock,
|
|
218
219
|
template: postType === 'wp_navigation' ? [['core/navigation', {}, []]] : settings.template,
|
|
219
|
-
__experimentalSetIsInserterOpened: setIsInserterOpened
|
|
220
|
+
__experimentalSetIsInserterOpened: setIsInserterOpened,
|
|
221
|
+
[sectionRootClientIdKey]: sectionRootClientId
|
|
220
222
|
};
|
|
221
|
-
lock(blockEditorSettings, {
|
|
222
|
-
sectionRootClientId
|
|
223
|
-
});
|
|
224
223
|
return blockEditorSettings;
|
|
225
224
|
}, [allowedBlockTypes, allowRightClickOverrides, focusMode, forceDisableFocusMode, hasFixedToolbar, isDistractionFree, keepCaretInsideBlock, settings, hasUploadPermissions, userPatternCategories, blockPatterns, blockPatternCategories, canUseUnfilteredHTML, undo, createPageEntity, userCanCreatePages, pageOnFront, pageForPosts, postType, setIsInserterOpened, sectionRootClientId, globalStylesData, globalStylesLinksData]);
|
|
226
225
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useMemo","useCallback","useDispatch","useSelect","store","coreStore","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","__","preferencesStore","useViewportMatch","blocksStore","privateApis","blockEditorStore","inserterMediaCategories","mediaUpload","editorStore","lock","unlock","useGlobalStylesContext","EMPTY_BLOCKS_LIST","EMPTY_OBJECT","__experimentalReusableBlocksSelect","select","_select$getEntityReco","getEntityRecords","per_page","BLOCK_EDITOR_SETTINGS","globalStylesDataKey","globalStylesLinksDataKey","selectBlockPatternsKey","reusableBlocksSelectKey","useBlockEditorSettings","settings","postType","postId","renderingMode","_mergedGlobalStyles$s","_mergedGlobalStyles$_","_settings$__experimen","_settings$__experimen2","isLargeViewport","allowRightClickOverrides","blockTypes","focusMode","hasFixedToolbar","isDistractionFree","keepCaretInsideBlock","hasUploadPermissions","hiddenBlockTypes","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","pageForPosts","userPatternCategories","restBlockPatternCategories","sectionRootClientId","_canUser","canUser","getRawEntityRecord","getEntityRecord","getUserPatternCategories","getBlockPatternCategories","get","getBlockTypes","getBlocksByName","getBlockAttributes","siteSettings","kind","name","undefined","getSectionRootBlock","_getBlocksByName$find","_getBlocksByName$","find","clientId","tagName","_links","hasOwnProperty","page_on_front","page_for_posts","merged","mergedGlobalStyles","globalStylesData","styles","globalStylesLinksData","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","blockPatterns","filter","postTypes","Array","isArray","includes","blockPatternCategories","x","index","arr","findIndex","y","undo","setIsInserterOpened","saveEntityRecord","createPageEntity","options","Promise","reject","message","allowedBlockTypes","length","defaultAllowedBlockTypes","map","type","forceDisableFocusMode","blockEditorSettings","Object","fromEntries","entries","key","hasFinishedResolution","getBlockPatternsForPostType","patterns","__experimentalUserPatternCategories","search","searchOptions","__experimentalFetchRichUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot","templateLock","template","__experimentalSetIsInserterOpened"],"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tprivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport inserterMediaCategories from '../media-categories';\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\nimport { lock, unlock } from '../../lock-unlock';\nimport { useGlobalStylesContext } from '../global-styles-provider';\n\nconst EMPTY_BLOCKS_LIST = [];\nconst EMPTY_OBJECT = {};\n\nfunction __experimentalReusableBlocksSelect( select ) {\n\treturn (\n\t\tselect( coreStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\tper_page: -1,\n\t\t} ) ?? EMPTY_BLOCKS_LIST\n\t);\n}\n\nconst BLOCK_EDITOR_SETTINGS = [\n\t'__experimentalBlockDirectory',\n\t'__experimentalDiscussionSettings',\n\t'__experimentalFeatures',\n\t'__experimentalGlobalStylesBaseStyles',\n\t'alignWide',\n\t'blockInspectorTabs',\n\t'allowedMimeTypes',\n\t'bodyPlaceholder',\n\t'canLockBlocks',\n\t'capabilities',\n\t'clearBlockSelection',\n\t'codeEditingEnabled',\n\t'colors',\n\t'disableCustomColors',\n\t'disableCustomFontSizes',\n\t'disableCustomSpacingSizes',\n\t'disableCustomGradients',\n\t'disableLayoutStyles',\n\t'enableCustomLineHeight',\n\t'enableCustomSpacing',\n\t'enableCustomUnits',\n\t'enableOpenverseMediaCategory',\n\t'fontSizes',\n\t'gradients',\n\t'generateAnchors',\n\t'onNavigateToEntityRecord',\n\t'imageDefaultSize',\n\t'imageDimensions',\n\t'imageEditing',\n\t'imageSizes',\n\t'isRTL',\n\t'locale',\n\t'maxWidth',\n\t'postContentAttributes',\n\t'postsPerPage',\n\t'readOnly',\n\t'sectionRootClientId',\n\t'styles',\n\t'titlePlaceholder',\n\t'supportsLayout',\n\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t'__unstableHasCustomAppender',\n\t'__unstableIsPreviewMode',\n\t'__unstableResolvedAssets',\n\t'__unstableIsBlockBasedTheme',\n];\n\nconst {\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tselectBlockPatternsKey,\n\treusableBlocksSelectKey,\n} = unlock( privateApis );\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {string} postType Editor root level post type.\n * @param {string} postId Editor root level post ID.\n * @param {string} renderingMode Editor rendering mode.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, postType, postId, renderingMode ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\tallowRightClickOverrides,\n\t\tblockTypes,\n\t\tfocusMode,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tkeepCaretInsideBlock,\n\t\thasUploadPermissions,\n\t\thiddenBlockTypes,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\tuserPatternCategories,\n\t\trestBlockPatternCategories,\n\t\tsectionRootClientId,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tcanUser,\n\t\t\t\tgetRawEntityRecord,\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetUserPatternCategories,\n\t\t\t\tgetBlockPatternCategories,\n\t\t\t} = select( coreStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst { getBlocksByName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\n\t\t\tfunction getSectionRootBlock() {\n\t\t\t\tif ( renderingMode === 'template-locked' ) {\n\t\t\t\t\treturn getBlocksByName( 'core/post-content' )?.[ 0 ] ?? '';\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\tgetBlocksByName( 'core/group' ).find(\n\t\t\t\t\t\t( clientId ) =>\n\t\t\t\t\t\t\tgetBlockAttributes( clientId )?.tagName === 'main'\n\t\t\t\t\t) ?? ''\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tallowRightClickOverrides: get(\n\t\t\t\t\t'core',\n\t\t\t\t\t'allowRightClickOverrides'\n\t\t\t\t),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tcanUseUnfilteredHTML: getRawEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t)?._links?.hasOwnProperty( 'wp:action-unfiltered-html' ),\n\t\t\t\tfocusMode: get( 'core', 'focusMode' ),\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tget( 'core', 'fixedToolbar' ) || ! isLargeViewport,\n\t\t\t\thiddenBlockTypes: get( 'core', 'hiddenBlockTypes' ),\n\t\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\t\tkeepCaretInsideBlock: get( 'core', 'keepCaretInsideBlock' ),\n\t\t\t\thasUploadPermissions:\n\t\t\t\t\tcanUser( 'create', {\n\t\t\t\t\t\tkind: 'root',\n\t\t\t\t\t\tname: 'media',\n\t\t\t\t\t} ) ?? true,\n\t\t\t\tuserCanCreatePages: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'page',\n\t\t\t\t} ),\n\t\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\t\tpageForPosts: siteSettings?.page_for_posts,\n\t\t\t\tuserPatternCategories: getUserPatternCategories(),\n\t\t\t\trestBlockPatternCategories: getBlockPatternCategories(),\n\t\t\t\tsectionRootClientId: getSectionRootBlock(),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, isLargeViewport, renderingMode ]\n\t);\n\n\tconst { merged: mergedGlobalStyles } = useGlobalStylesContext();\n\tconst globalStylesData = mergedGlobalStyles.styles ?? EMPTY_OBJECT;\n\tconst globalStylesLinksData = mergedGlobalStyles._links ?? EMPTY_OBJECT;\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[ ...( settingsBlockPatterns || [] ) ].filter(\n\t\t\t\t( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t),\n\t\t[ settingsBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst { undo, setIsInserterOpened } = useDispatch( editorStore );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = useCallback(\n\t\t( options ) => {\n\t\t\tif ( ! userCanCreatePages ) {\n\t\t\t\treturn Promise.reject( {\n\t\t\t\t\tmessage: __(\n\t\t\t\t\t\t'You do not have permission to create Pages.'\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t\t},\n\t\t[ saveEntityRecord, userCanCreatePages ]\n\t);\n\n\tconst allowedBlockTypes = useMemo( () => {\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes && hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\treturn defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn settings.allowedBlockTypes;\n\t}, [ settings.allowedBlockTypes, hiddenBlockTypes, blockTypes ] );\n\n\tconst forceDisableFocusMode = settings.focusMode === false;\n\n\treturn useMemo( () => {\n\t\tconst blockEditorSettings = {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( settings ).filter( ( [ key ] ) =>\n\t\t\t\t\tBLOCK_EDITOR_SETTINGS.includes( key )\n\t\t\t\t)\n\t\t\t),\n\t\t\t[ globalStylesDataKey ]: globalStylesData,\n\t\t\t[ globalStylesLinksDataKey ]: globalStylesLinksData,\n\t\t\tallowedBlockTypes,\n\t\t\tallowRightClickOverrides,\n\t\t\tfocusMode: focusMode && ! forceDisableFocusMode,\n\t\t\thasFixedToolbar,\n\t\t\tisDistractionFree,\n\t\t\tkeepCaretInsideBlock,\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t[ selectBlockPatternsKey ]: ( select ) => {\n\t\t\t\tconst { hasFinishedResolution, getBlockPatternsForPostType } =\n\t\t\t\t\tunlock( select( coreStore ) );\n\t\t\t\tconst patterns = getBlockPatternsForPostType( postType );\n\t\t\t\treturn hasFinishedResolution( 'getBlockPatterns' )\n\t\t\t\t\t? patterns\n\t\t\t\t\t: undefined;\n\t\t\t},\n\t\t\t[ reusableBlocksSelectKey ]: __experimentalReusableBlocksSelect,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalUserPatternCategories: userPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t// Todo: This only checks the top level post, not the post within a template or any other entity that can be edited.\n\t\t\t// This might be better as a generic \"canUser\" selector.\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t//Todo: this is only needed for native and should probably be removed.\n\t\t\t__experimentalUndo: undo,\n\t\t\t// Check whether we want all site editor frames to have outlines\n\t\t\t// including the navigation / pattern / parts editors.\n\t\t\toutlineMode: ! isDistractionFree && postType === 'wp_template',\n\t\t\t// Check these two properties: they were not present in the site editor.\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\tpageForPosts,\n\t\t\t__experimentalPreferPatternsOnRoot: postType === 'wp_template',\n\t\t\ttemplateLock:\n\t\t\t\tpostType === 'wp_navigation' ? 'insert' : settings.templateLock,\n\t\t\ttemplate:\n\t\t\t\tpostType === 'wp_navigation'\n\t\t\t\t\t? [ [ 'core/navigation', {}, [] ] ]\n\t\t\t\t\t: settings.template,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t};\n\t\tlock( blockEditorSettings, {\n\t\t\tsectionRootClientId,\n\t\t} );\n\t\treturn blockEditorSettings;\n\t}, [\n\t\tallowedBlockTypes,\n\t\tallowRightClickOverrides,\n\t\tfocusMode,\n\t\tforceDisableFocusMode,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tkeepCaretInsideBlock,\n\t\tsettings,\n\t\thasUploadPermissions,\n\t\tuserPatternCategories,\n\t\tblockPatterns,\n\t\tblockPatternCategories,\n\t\tcanUseUnfilteredHTML,\n\t\tundo,\n\t\tcreatePageEntity,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\tpostType,\n\t\tsetIsInserterOpened,\n\t\tsectionRootClientId,\n\t\tglobalStylesData,\n\t\tglobalStylesLinksData,\n\t] );\n}\n\nexport default useBlockEditorSettings;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,WAAW,QAAQ,oBAAoB;AACzD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SACCC,KAAK,IAAIC,SAAS,EAClBC,kCAAkC,IAAIC,oBAAoB,EAC1DC,0BAA0B,IAAIC,YAAY,QACpC,sBAAsB;AAC7B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASN,KAAK,IAAIO,gBAAgB,QAAQ,wBAAwB;AAClE,SAASC,gBAAgB,Q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ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useMemo","useCallback","useDispatch","useSelect","store","coreStore","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","__","preferencesStore","useViewportMatch","blocksStore","privateApis","blockEditorStore","inserterMediaCategories","mediaUpload","editorStore","unlock","useGlobalStylesContext","EMPTY_BLOCKS_LIST","EMPTY_OBJECT","__experimentalReusableBlocksSelect","select","_select$getEntityReco","getEntityRecords","per_page","BLOCK_EDITOR_SETTINGS","globalStylesDataKey","globalStylesLinksDataKey","selectBlockPatternsKey","reusableBlocksSelectKey","sectionRootClientIdKey","useBlockEditorSettings","settings","postType","postId","renderingMode","_mergedGlobalStyles$s","_mergedGlobalStyles$_","_settings$__experimen","_settings$__experimen2","isLargeViewport","allowRightClickOverrides","blockTypes","focusMode","hasFixedToolbar","isDistractionFree","keepCaretInsideBlock","hasUploadPermissions","hiddenBlockTypes","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","pageForPosts","userPatternCategories","restBlockPatternCategories","sectionRootClientId","_canUser","canUser","getRawEntityRecord","getEntityRecord","getUserPatternCategories","getBlockPatternCategories","get","getBlockTypes","getBlocksByName","getBlockAttributes","siteSettings","kind","name","undefined","getSectionRootBlock","_getBlocksByName$find","_getBlocksByName$","find","clientId","tagName","_links","hasOwnProperty","page_on_front","page_for_posts","merged","mergedGlobalStyles","globalStylesData","styles","globalStylesLinksData","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","blockPatterns","filter","postTypes","Array","isArray","includes","blockPatternCategories","x","index","arr","findIndex","y","undo","setIsInserterOpened","saveEntityRecord","createPageEntity","options","Promise","reject","message","allowedBlockTypes","length","defaultAllowedBlockTypes","map","type","forceDisableFocusMode","blockEditorSettings","Object","fromEntries","entries","key","hasFinishedResolution","getBlockPatternsForPostType","patterns","__experimentalUserPatternCategories","search","searchOptions","__experimentalFetchRichUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot","templateLock","template","__experimentalSetIsInserterOpened"],"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tprivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport inserterMediaCategories from '../media-categories';\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useGlobalStylesContext } from '../global-styles-provider';\n\nconst EMPTY_BLOCKS_LIST = [];\nconst EMPTY_OBJECT = {};\n\nfunction __experimentalReusableBlocksSelect( select ) {\n\treturn (\n\t\tselect( coreStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\tper_page: -1,\n\t\t} ) ?? EMPTY_BLOCKS_LIST\n\t);\n}\n\nconst BLOCK_EDITOR_SETTINGS = [\n\t'__experimentalBlockDirectory',\n\t'__experimentalDiscussionSettings',\n\t'__experimentalFeatures',\n\t'__experimentalGlobalStylesBaseStyles',\n\t'alignWide',\n\t'blockInspectorTabs',\n\t'allowedMimeTypes',\n\t'bodyPlaceholder',\n\t'canLockBlocks',\n\t'canUpdateBlockBindings',\n\t'capabilities',\n\t'clearBlockSelection',\n\t'codeEditingEnabled',\n\t'colors',\n\t'disableCustomColors',\n\t'disableCustomFontSizes',\n\t'disableCustomSpacingSizes',\n\t'disableCustomGradients',\n\t'disableLayoutStyles',\n\t'enableCustomLineHeight',\n\t'enableCustomSpacing',\n\t'enableCustomUnits',\n\t'enableOpenverseMediaCategory',\n\t'fontSizes',\n\t'gradients',\n\t'generateAnchors',\n\t'onNavigateToEntityRecord',\n\t'imageDefaultSize',\n\t'imageDimensions',\n\t'imageEditing',\n\t'imageSizes',\n\t'isRTL',\n\t'locale',\n\t'maxWidth',\n\t'postContentAttributes',\n\t'postsPerPage',\n\t'readOnly',\n\t'styles',\n\t'titlePlaceholder',\n\t'supportsLayout',\n\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t'__unstableHasCustomAppender',\n\t'__unstableIsPreviewMode',\n\t'__unstableResolvedAssets',\n\t'__unstableIsBlockBasedTheme',\n];\n\nconst {\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tselectBlockPatternsKey,\n\treusableBlocksSelectKey,\n\tsectionRootClientIdKey,\n} = unlock( privateApis );\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {string} postType Editor root level post type.\n * @param {string} postId Editor root level post ID.\n * @param {string} renderingMode Editor rendering mode.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, postType, postId, renderingMode ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\tallowRightClickOverrides,\n\t\tblockTypes,\n\t\tfocusMode,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tkeepCaretInsideBlock,\n\t\thasUploadPermissions,\n\t\thiddenBlockTypes,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\tuserPatternCategories,\n\t\trestBlockPatternCategories,\n\t\tsectionRootClientId,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tcanUser,\n\t\t\t\tgetRawEntityRecord,\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetUserPatternCategories,\n\t\t\t\tgetBlockPatternCategories,\n\t\t\t} = select( coreStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst { getBlocksByName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\n\t\t\tfunction getSectionRootBlock() {\n\t\t\t\tif ( renderingMode === 'template-locked' ) {\n\t\t\t\t\treturn getBlocksByName( 'core/post-content' )?.[ 0 ] ?? '';\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\tgetBlocksByName( 'core/group' ).find(\n\t\t\t\t\t\t( clientId ) =>\n\t\t\t\t\t\t\tgetBlockAttributes( clientId )?.tagName === 'main'\n\t\t\t\t\t) ?? ''\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tallowRightClickOverrides: get(\n\t\t\t\t\t'core',\n\t\t\t\t\t'allowRightClickOverrides'\n\t\t\t\t),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tcanUseUnfilteredHTML: getRawEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t)?._links?.hasOwnProperty( 'wp:action-unfiltered-html' ),\n\t\t\t\tfocusMode: get( 'core', 'focusMode' ),\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tget( 'core', 'fixedToolbar' ) || ! isLargeViewport,\n\t\t\t\thiddenBlockTypes: get( 'core', 'hiddenBlockTypes' ),\n\t\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\t\tkeepCaretInsideBlock: get( 'core', 'keepCaretInsideBlock' ),\n\t\t\t\thasUploadPermissions:\n\t\t\t\t\tcanUser( 'create', {\n\t\t\t\t\t\tkind: 'root',\n\t\t\t\t\t\tname: 'media',\n\t\t\t\t\t} ) ?? true,\n\t\t\t\tuserCanCreatePages: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'page',\n\t\t\t\t} ),\n\t\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\t\tpageForPosts: siteSettings?.page_for_posts,\n\t\t\t\tuserPatternCategories: getUserPatternCategories(),\n\t\t\t\trestBlockPatternCategories: getBlockPatternCategories(),\n\t\t\t\tsectionRootClientId: getSectionRootBlock(),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, isLargeViewport, renderingMode ]\n\t);\n\n\tconst { merged: mergedGlobalStyles } = useGlobalStylesContext();\n\tconst globalStylesData = mergedGlobalStyles.styles ?? EMPTY_OBJECT;\n\tconst globalStylesLinksData = mergedGlobalStyles._links ?? EMPTY_OBJECT;\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[ ...( settingsBlockPatterns || [] ) ].filter(\n\t\t\t\t( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t),\n\t\t[ settingsBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst { undo, setIsInserterOpened } = useDispatch( editorStore );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = useCallback(\n\t\t( options ) => {\n\t\t\tif ( ! userCanCreatePages ) {\n\t\t\t\treturn Promise.reject( {\n\t\t\t\t\tmessage: __(\n\t\t\t\t\t\t'You do not have permission to create Pages.'\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t\t},\n\t\t[ saveEntityRecord, userCanCreatePages ]\n\t);\n\n\tconst allowedBlockTypes = useMemo( () => {\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes && hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\treturn defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn settings.allowedBlockTypes;\n\t}, [ settings.allowedBlockTypes, hiddenBlockTypes, blockTypes ] );\n\n\tconst forceDisableFocusMode = settings.focusMode === false;\n\n\treturn useMemo( () => {\n\t\tconst blockEditorSettings = {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( settings ).filter( ( [ key ] ) =>\n\t\t\t\t\tBLOCK_EDITOR_SETTINGS.includes( key )\n\t\t\t\t)\n\t\t\t),\n\t\t\t[ globalStylesDataKey ]: globalStylesData,\n\t\t\t[ globalStylesLinksDataKey ]: globalStylesLinksData,\n\t\t\tallowedBlockTypes,\n\t\t\tallowRightClickOverrides,\n\t\t\tfocusMode: focusMode && ! forceDisableFocusMode,\n\t\t\thasFixedToolbar,\n\t\t\tisDistractionFree,\n\t\t\tkeepCaretInsideBlock,\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t[ selectBlockPatternsKey ]: ( select ) => {\n\t\t\t\tconst { hasFinishedResolution, getBlockPatternsForPostType } =\n\t\t\t\t\tunlock( select( coreStore ) );\n\t\t\t\tconst patterns = getBlockPatternsForPostType( postType );\n\t\t\t\treturn hasFinishedResolution( 'getBlockPatterns' )\n\t\t\t\t\t? patterns\n\t\t\t\t\t: undefined;\n\t\t\t},\n\t\t\t[ reusableBlocksSelectKey ]: __experimentalReusableBlocksSelect,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalUserPatternCategories: userPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t// Todo: This only checks the top level post, not the post within a template or any other entity that can be edited.\n\t\t\t// This might be better as a generic \"canUser\" selector.\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t//Todo: this is only needed for native and should probably be removed.\n\t\t\t__experimentalUndo: undo,\n\t\t\t// Check whether we want all site editor frames to have outlines\n\t\t\t// including the navigation / pattern / parts editors.\n\t\t\toutlineMode: ! isDistractionFree && postType === 'wp_template',\n\t\t\t// Check these two properties: they were not present in the site editor.\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\tpageForPosts,\n\t\t\t__experimentalPreferPatternsOnRoot: postType === 'wp_template',\n\t\t\ttemplateLock:\n\t\t\t\tpostType === 'wp_navigation' ? 'insert' : settings.templateLock,\n\t\t\ttemplate:\n\t\t\t\tpostType === 'wp_navigation'\n\t\t\t\t\t? [ [ 'core/navigation', {}, [] ] ]\n\t\t\t\t\t: settings.template,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\t[ sectionRootClientIdKey ]: sectionRootClientId,\n\t\t};\n\n\t\treturn blockEditorSettings;\n\t}, [\n\t\tallowedBlockTypes,\n\t\tallowRightClickOverrides,\n\t\tfocusMode,\n\t\tforceDisableFocusMode,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tkeepCaretInsideBlock,\n\t\tsettings,\n\t\thasUploadPermissions,\n\t\tuserPatternCategories,\n\t\tblockPatterns,\n\t\tblockPatternCategories,\n\t\tcanUseUnfilteredHTML,\n\t\tundo,\n\t\tcreatePageEntity,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\tpostType,\n\t\tsetIsInserterOpened,\n\t\tsectionRootClientId,\n\t\tglobalStylesData,\n\t\tglobalStylesLinksData,\n\t] );\n}\n\nexport default useBlockEditorSettings;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,WAAW,QAAQ,oBAAoB;AACzD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SACCC,KAAK,IAAIC,SAAS,EAClBC,kCAAkC,IAAIC,oBAAoB,EAC1DC,0BAA0B,IAAIC,YAAY,QACpC,sBAAsB;AAC7B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASN,KAAK,IAAIO,gBAAgB,QAAQ,wBAAwB;AAClE,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASR,KAAK,IAAIS,WAAW,QAAQ,mBAAmB;A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EntitiesChanges) {
|
|
69
69
|
unmountableContent = /*#__PURE__*/_jsx("div", {
|
|
70
70
|
className: "editor-layout__toggle-publish-panel",
|
|
71
|
-
children: /*#__PURE__*/_jsx(Button
|
|
71
|
+
children: /*#__PURE__*/_jsx(Button
|
|
72
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
73
|
+
, {
|
|
74
|
+
__next40pxDefaultSize: false,
|
|
72
75
|
variant: "secondary",
|
|
73
76
|
className: "editor-layout__toggle-publish-panel-button",
|
|
74
77
|
onClick: togglePublishSidebar,
|
|
@@ -79,7 +82,10 @@ export default function SavePublishPanels({
|
|
|
79
82
|
} else {
|
|
80
83
|
unmountableContent = /*#__PURE__*/_jsx("div", {
|
|
81
84
|
className: "editor-layout__toggle-entities-saved-states-panel",
|
|
82
|
-
children: /*#__PURE__*/_jsx(Button
|
|
85
|
+
children: /*#__PURE__*/_jsx(Button
|
|
86
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
87
|
+
, {
|
|
88
|
+
__next40pxDefaultSize: false,
|
|
83
89
|
variant: "secondary",
|
|
84
90
|
className: "editor-layout__toggle-entities-saved-states-panel-button",
|
|
85
91
|
onClick: openEntitiesSavedStates,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useDispatch","Button","createSlotFill","__","useCallback","EntitiesSavedStates","PostPublishPanel","PluginPrePublishPanel","PluginPostPublishPanel","store","editorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","Fill","Slot","ActionsPanelFill","SavePublishPanels","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","isEntitiesSavedStatesOpen","forceIsDirtyPublishPanel","closePublishSidebar","togglePublishSidebar","publishSidebarOpened","isPublishable","isDirty","hasOtherEntitiesChanges","select","isPublishSidebarOpened","isEditedPostPublishable","isCurrentPostPublished","isEditedPostDirty","hasNonPostEntityChanges","_hasOtherEntitiesChanges","openEntitiesSavedStates","unmountableContent","onClose","forceIsDirty","PrePublishExtension","PostPublishExtension","className","children","variant","onClick","disabled","accessibleWhenDisabled","close","bubblesVirtually"],"sources":["@wordpress/editor/src/components/save-publish-panels/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button, createSlotFill } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport EntitiesSavedStates from '../entities-saved-states';\nimport PostPublishPanel from '../post-publish-panel';\nimport PluginPrePublishPanel from '../plugin-pre-publish-panel';\nimport PluginPostPublishPanel from '../plugin-post-publish-panel';\nimport { store as editorStore } from '../../store';\n\nconst { Fill, Slot } = createSlotFill( 'ActionsPanel' );\n\nexport const ActionsPanelFill = Fill;\n\nexport default function SavePublishPanels( {\n\tsetEntitiesSavedStatesCallback,\n\tcloseEntitiesSavedStates,\n\tisEntitiesSavedStatesOpen,\n\tforceIsDirtyPublishPanel,\n} ) {\n\tconst { closePublishSidebar, togglePublishSidebar } =\n\t\tuseDispatch( editorStore );\n\tconst {\n\t\tpublishSidebarOpened,\n\t\tisPublishable,\n\t\tisDirty,\n\t\thasOtherEntitiesChanges,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisPublishSidebarOpened,\n\t\t\tisEditedPostPublishable,\n\t\t\tisCurrentPostPublished,\n\t\t\tisEditedPostDirty,\n\t\t\thasNonPostEntityChanges,\n\t\t} = select( editorStore );\n\t\tconst _hasOtherEntitiesChanges = hasNonPostEntityChanges();\n\t\treturn {\n\t\t\tpublishSidebarOpened: isPublishSidebarOpened(),\n\t\t\tisPublishable:\n\t\t\t\t! isCurrentPostPublished() && isEditedPostPublishable(),\n\t\t\tisDirty: _hasOtherEntitiesChanges || isEditedPostDirty(),\n\t\t\thasOtherEntitiesChanges: _hasOtherEntitiesChanges,\n\t\t};\n\t}, [] );\n\n\tconst openEntitiesSavedStates = useCallback(\n\t\t() => setEntitiesSavedStatesCallback( true ),\n\t\t[]\n\t);\n\n\t// It is ok for these components to be unmounted when not in visual use.\n\t// We don't want more than one present at a time, decide which to render.\n\tlet unmountableContent;\n\tif ( publishSidebarOpened ) {\n\t\tunmountableContent = (\n\t\t\t<PostPublishPanel\n\t\t\t\tonClose={ closePublishSidebar }\n\t\t\t\tforceIsDirty={ forceIsDirtyPublishPanel }\n\t\t\t\tPrePublishExtension={ PluginPrePublishPanel.Slot }\n\t\t\t\tPostPublishExtension={ PluginPostPublishPanel.Slot }\n\t\t\t/>\n\t\t);\n\t} else if ( isPublishable && ! hasOtherEntitiesChanges ) {\n\t\tunmountableContent = (\n\t\t\t<div className=\"editor-layout__toggle-publish-panel\">\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tclassName=\"editor-layout__toggle-publish-panel-button\"\n\t\t\t\t\tonClick={ togglePublishSidebar }\n\t\t\t\t\taria-expanded={ false }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Open publish panel' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t);\n\t} else {\n\t\tunmountableContent = (\n\t\t\t<div className=\"editor-layout__toggle-entities-saved-states-panel\">\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tclassName=\"editor-layout__toggle-entities-saved-states-panel-button\"\n\t\t\t\t\tonClick={ openEntitiesSavedStates }\n\t\t\t\t\taria-expanded={ false }\n\t\t\t\t\tdisabled={ ! isDirty }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Open save panel' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Since EntitiesSavedStates controls its own panel, we can keep it\n\t// always mounted to retain its own component state (such as checkboxes).\n\treturn (\n\t\t<>\n\t\t\t{ isEntitiesSavedStatesOpen && (\n\t\t\t\t<EntitiesSavedStates close={ closeEntitiesSavedStates } />\n\t\t\t) }\n\t\t\t<Slot bubblesVirtually />\n\t\t\t{ ! isEntitiesSaved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,uBAAuB,CAAC,CAAC;MACxDJ,OAAO,EAAEQ,wBAAwB,IAAIF,iBAAiB,CAAC,CAAC;MACxDL,uBAAuB,EAAEO;IAC1B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMC,uBAAuB,GAAGlC,WAAW,CAC1C,MAAMiB,8BAA8B,CAAE,IAAK,CAAC,EAC5C,EACD,CAAC;;EAED;EACA;EACA,IAAIkB,kBAAkB;EACtB,IAAKZ,oBAAoB,EAAG;IAC3BY,kBAAkB,gBACjB3B,IAAA,CAACN,gBAAgB;MAChBkC,OAAO,EAAGf,mBAAqB;MAC/BgB,YAAY,EAAGjB,wBAA0B;MACzCkB,mBAAmB,EAAGnC,qBAAqB,CAACW,IAAM;MAClDyB,oBAAoB,EAAGnC,sBAAsB,CAACU;IAAM,CACpD,CACD;EACF,CAAC,MAAM,IAAKU,aAAa,IAAI,CAAEE,uBAAuB,EAAG;IACxDS,kBAAkB,gBACjB3B,IAAA;MAAKgC,SAAS,EAAC,qCAAqC;MAAAC,QAAA,eACnDjC,IAAA,CAACX,
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","Button","createSlotFill","__","useCallback","EntitiesSavedStates","PostPublishPanel","PluginPrePublishPanel","PluginPostPublishPanel","store","editorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","Fill","Slot","ActionsPanelFill","SavePublishPanels","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","isEntitiesSavedStatesOpen","forceIsDirtyPublishPanel","closePublishSidebar","togglePublishSidebar","publishSidebarOpened","isPublishable","isDirty","hasOtherEntitiesChanges","select","isPublishSidebarOpened","isEditedPostPublishable","isCurrentPostPublished","isEditedPostDirty","hasNonPostEntityChanges","_hasOtherEntitiesChanges","openEntitiesSavedStates","unmountableContent","onClose","forceIsDirty","PrePublishExtension","PostPublishExtension","className","children","__next40pxDefaultSize","variant","onClick","disabled","accessibleWhenDisabled","close","bubblesVirtually"],"sources":["@wordpress/editor/src/components/save-publish-panels/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button, createSlotFill } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport EntitiesSavedStates from '../entities-saved-states';\nimport PostPublishPanel from '../post-publish-panel';\nimport PluginPrePublishPanel from '../plugin-pre-publish-panel';\nimport PluginPostPublishPanel from '../plugin-post-publish-panel';\nimport { store as editorStore } from '../../store';\n\nconst { Fill, Slot } = createSlotFill( 'ActionsPanel' );\n\nexport const ActionsPanelFill = Fill;\n\nexport default function SavePublishPanels( {\n\tsetEntitiesSavedStatesCallback,\n\tcloseEntitiesSavedStates,\n\tisEntitiesSavedStatesOpen,\n\tforceIsDirtyPublishPanel,\n} ) {\n\tconst { closePublishSidebar, togglePublishSidebar } =\n\t\tuseDispatch( editorStore );\n\tconst {\n\t\tpublishSidebarOpened,\n\t\tisPublishable,\n\t\tisDirty,\n\t\thasOtherEntitiesChanges,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisPublishSidebarOpened,\n\t\t\tisEditedPostPublishable,\n\t\t\tisCurrentPostPublished,\n\t\t\tisEditedPostDirty,\n\t\t\thasNonPostEntityChanges,\n\t\t} = select( editorStore );\n\t\tconst _hasOtherEntitiesChanges = hasNonPostEntityChanges();\n\t\treturn {\n\t\t\tpublishSidebarOpened: isPublishSidebarOpened(),\n\t\t\tisPublishable:\n\t\t\t\t! isCurrentPostPublished() && isEditedPostPublishable(),\n\t\t\tisDirty: _hasOtherEntitiesChanges || isEditedPostDirty(),\n\t\t\thasOtherEntitiesChanges: _hasOtherEntitiesChanges,\n\t\t};\n\t}, [] );\n\n\tconst openEntitiesSavedStates = useCallback(\n\t\t() => setEntitiesSavedStatesCallback( true ),\n\t\t[]\n\t);\n\n\t// It is ok for these components to be unmounted when not in visual use.\n\t// We don't want more than one present at a time, decide which to render.\n\tlet unmountableContent;\n\tif ( publishSidebarOpened ) {\n\t\tunmountableContent = (\n\t\t\t<PostPublishPanel\n\t\t\t\tonClose={ closePublishSidebar }\n\t\t\t\tforceIsDirty={ forceIsDirtyPublishPanel }\n\t\t\t\tPrePublishExtension={ PluginPrePublishPanel.Slot }\n\t\t\t\tPostPublishExtension={ PluginPostPublishPanel.Slot }\n\t\t\t/>\n\t\t);\n\t} else if ( isPublishable && ! hasOtherEntitiesChanges ) {\n\t\tunmountableContent = (\n\t\t\t<div className=\"editor-layout__toggle-publish-panel\">\n\t\t\t\t<Button\n\t\t\t\t\t// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t__next40pxDefaultSize={ false }\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tclassName=\"editor-layout__toggle-publish-panel-button\"\n\t\t\t\t\tonClick={ togglePublishSidebar }\n\t\t\t\t\taria-expanded={ false }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Open publish panel' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t);\n\t} else {\n\t\tunmountableContent = (\n\t\t\t<div className=\"editor-layout__toggle-entities-saved-states-panel\">\n\t\t\t\t<Button\n\t\t\t\t\t// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t__next40pxDefaultSize={ false }\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tclassName=\"editor-layout__toggle-entities-saved-states-panel-button\"\n\t\t\t\t\tonClick={ openEntitiesSavedStates }\n\t\t\t\t\taria-expanded={ false }\n\t\t\t\t\tdisabled={ ! isDirty }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Open save panel' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Since EntitiesSavedStates controls its own panel, we can keep it\n\t// always mounted to retain its own component state (such as checkboxes).\n\treturn (\n\t\t<>\n\t\t\t{ isEntitiesSavedStatesOpen && (\n\t\t\t\t<EntitiesSavedStates close={ closeEntitiesSavedStates }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QACtBqB,sBAAsB;QAAAL,QAAA,EAEpB1C,EAAE,CAAE,iBAAkB;MAAC,CAClB;IAAC,CACL,CACL;EACF;;EAEA;EACA;EACA,oBACCa,KAAA,CAAAF,SAAA;IAAA+B,QAAA,GACGtB,yBAAyB,iBAC1BX,IAAA,CAACP,mBAAmB;MAAC8C,KAAK,EAAG7B;IAA0B,CAAE,CACzD,eACDV,IAAA,CAACM,IAAI;MAACkC,gBAAgB;IAAA,CAAE,CAAC,EACvB,CAAE7B,yBAAyB,IAAIgB,kBAAkB;EAAA,CAClD,CAAC;AAEL","ignoreList":[]}
|
|
@@ -137,7 +137,10 @@ function StartModal({
|
|
|
137
137
|
justify: "flex-end",
|
|
138
138
|
expanded: false,
|
|
139
139
|
children: /*#__PURE__*/_jsx(FlexItem, {
|
|
140
|
-
children: /*#__PURE__*/_jsx(Button
|
|
140
|
+
children: /*#__PURE__*/_jsx(Button
|
|
141
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
142
|
+
, {
|
|
143
|
+
__next40pxDefaultSize: false,
|
|
141
144
|
variant: "tertiary",
|
|
142
145
|
onClick: onClose,
|
|
143
146
|
children: __('Skip')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Modal","Flex","FlexItem","Button","__","useState","useMemo","useEffect","__experimentalBlockPatternsList","BlockPatternsList","useSelect","useAsyncList","parse","store","coreStore","useEntityBlockEditor","editorStore","TEMPLATE_POST_TYPE","jsx","_jsx","jsxs","_jsxs","useFallbackTemplateContent","slug","isCustom","select","getEntityRecord","getDefaultTemplateId","templateId","is_custom","ignore_empty","content","raw","undefined","useStartPatterns","fallbackContent","patterns","getCurrentPostType","getCurrentPostId","getBlockPatterns","postId","postType","record","currentThemeStylesheet","getCurrentTheme","stylesheet","injectThemeAttributeInBlockTemplateContent","block","innerBlocks","find","innerBlock","name","map","attributes","theme","blocks","title","filter","pattern","Array","isArray","templateTypes","some","templateType","startsWith","PatternSelection","onChoosePattern","onChange","blockPatterns","shownBlockPatterns","shownPatterns","onClickPattern","selection","StartModal","onClose","className","closeLabel","focusOnMount","onRequestClose","isFullScreen","children","justify","expanded","variant","onClick","StartTemplateOptions","isClosed","setIsClosed","shouldOpenModal","_postType","_postId","getEditedEntityRecord","hasEditsForEntityRecord","templateRecord","hasEdits"],"sources":["@wordpress/editor/src/components/start-template-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal, Flex, FlexItem, Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useAsyncList } from '@wordpress/compose';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore, useEntityBlockEditor } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\n\nfunction useFallbackTemplateContent( slug, isCustom = false ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getDefaultTemplateId } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst templateId = getDefaultTemplateId( {\n\t\t\t\tslug,\n\t\t\t\tis_custom: isCustom,\n\t\t\t\tignore_empty: true,\n\t\t\t} );\n\t\t\treturn templateId\n\t\t\t\t? getEntityRecord( 'postType', TEMPLATE_POST_TYPE, templateId )\n\t\t\t\t\t\t?.content?.raw\n\t\t\t\t: undefined;\n\t\t},\n\t\t[ slug, isCustom ]\n\t);\n}\n\nfunction useStartPatterns( fallbackContent ) {\n\tconst { slug, patterns } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getCurrentPostId } = select( editorStore );\n\t\tconst { getEntityRecord, getBlockPatterns } = select( coreStore );\n\t\tconst postId = getCurrentPostId();\n\t\tconst postType = getCurrentPostType();\n\t\tconst record = getEntityRecord( 'postType', postType, postId );\n\t\treturn {\n\t\t\tslug: record.slug,\n\t\t\tpatterns: getBlockPatterns(),\n\t\t};\n\t}, [] );\n\n\tconst currentThemeStylesheet = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme().stylesheet\n\t);\n\n\t// Duplicated from packages/block-library/src/pattern/edit.js.\n\tfunction injectThemeAttributeInBlockTemplateContent( block ) {\n\t\tif (\n\t\t\tblock.innerBlocks.find(\n\t\t\t\t( innerBlock ) => innerBlock.name === 'core/template-part'\n\t\t\t)\n\t\t) {\n\t\t\tblock.innerBlocks = block.innerBlocks.map( ( innerBlock ) => {\n\t\t\t\tif (\n\t\t\t\t\tinnerBlock.name === 'core/template-part' &&\n\t\t\t\t\tinnerBlock.attributes.theme === undefined\n\t\t\t\t) {\n\t\t\t\t\tinnerBlock.attributes.theme = currentThemeStylesheet;\n\t\t\t\t}\n\t\t\t\treturn innerBlock;\n\t\t\t} );\n\t\t}\n\n\t\tif (\n\t\t\tblock.name === 'core/template-part' &&\n\t\t\tblock.attributes.theme === undefined\n\t\t) {\n\t\t\tblock.attributes.theme = currentThemeStylesheet;\n\t\t}\n\t\treturn block;\n\t}\n\n\treturn useMemo( () => {\n\t\t// filter patterns that are supposed to be used in the current template being edited.\n\t\treturn [\n\t\t\t{\n\t\t\t\tname: 'fallback',\n\t\t\t\tblocks: parse( fallbackContent ),\n\t\t\t\ttitle: __( 'Fallback content' ),\n\t\t\t},\n\t\t\t...patterns\n\t\t\t\t.filter( ( pattern ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\tArray.isArray( pattern.templateTypes ) &&\n\t\t\t\t\t\tpattern.templateTypes.some( ( templateType ) =>\n\t\t\t\t\t\t\tslug.startsWith( templateType )\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t} )\n\t\t\t\t.map( ( pattern ) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...pattern,\n\t\t\t\t\t\tblocks: parse( pattern.content ).map( ( block ) =>\n\t\t\t\t\t\t\tinjectThemeAttributeInBlockTemplateContent( block )\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t} ),\n\t\t];\n\t}, [ fallbackContent, slug, patterns ] );\n}\n\nfunction PatternSelection( { fallbackContent, onChoosePattern, postType } ) {\n\tconst [ , , onChange ] = useEntityBlockEditor( 'postType', postType );\n\tconst blockPatterns = useStartPatterns( fallbackContent );\n\tconst shownBlockPatterns = useAsyncList( blockPatterns );\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tblockPatterns={ blockPatterns }\n\t\t\tshownPatterns={ shownBlockPatterns }\n\t\t\tonClickPattern={ ( pattern, blocks ) => {\n\t\t\t\tonChange( blocks, { selection: undefined } );\n\t\t\t\tonChoosePattern();\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction StartModal( { slug, isCustom, onClose, postType } ) {\n\tconst fallbackContent = useFallbackTemplateContent( slug, isCustom );\n\tif ( ! fallbackContent ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"editor-start-template-options__modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tcloseLabel={ __( 'Cancel' ) }\n\t\t\tfocusOnMount=\"firstElement\"\n\t\t\tonRequestClose={ onClose }\n\t\t\tisFullScreen\n\t\t>\n\t\t\t<div className=\"editor-start-template-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tfallbackContent={ fallbackContent }\n\t\t\t\t\tslug={ slug }\n\t\t\t\t\tisCustom={ isCustom }\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tonChoosePattern={ () => {\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<Flex\n\t\t\t\tclassName=\"editor-start-template-options__modal__actions\"\n\t\t\t\tjustify=\"flex-end\"\n\t\t\t\texpanded={ false }\n\t\t\t>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<Button variant=\"tertiary\" onClick={ onClose }>\n\t\t\t\t\t\t{ __( 'Skip' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</Modal>\n\t);\n}\n\nexport default function StartTemplateOptions() {\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst { shouldOpenModal, slug, isCustom, postType, postId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPostType, getCurrentPostId } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst _postType = getCurrentPostType();\n\t\t\tconst _postId = getCurrentPostId();\n\t\t\tconst { getEditedEntityRecord, hasEditsForEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst templateRecord = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\t_postId\n\t\t\t);\n\t\t\tconst hasEdits = hasEditsForEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\t_postId\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tshouldOpenModal:\n\t\t\t\t\t! hasEdits &&\n\t\t\t\t\t'' === templateRecord.content &&\n\t\t\t\t\tTEMPLATE_POST_TYPE === _postType,\n\t\t\t\tslug: templateRecord.slug,\n\t\t\t\tisCustom: templateRecord.is_custom,\n\t\t\t\tpostType: _postType,\n\t\t\t\tpostId: _postId,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tuseEffect( () => {\n\t\t// Should reset the modal state when navigating to a new page/post.\n\t\tsetIsClosed( false );\n\t}, [ postType, postId ] );\n\n\tif ( ! shouldOpenModal || isClosed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StartModal\n\t\t\tslug={ slug }\n\t\t\tisCustom={ isCustom }\n\t\t\tpostType={ postType }\n\t\t\tonClose={ () => setIsClosed( true ) }\n\t\t/>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,MAAM,QAAQ,uBAAuB;AACrE,SAASC,EAAE,QAAQ,iBAAiB;AACpC,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,MAAM,CAAET,WAAY,CAAC;IACtB,MAAMyE,SAAS,GAAGpD,kBAAkB,CAAC,CAAC;IACtC,MAAMqD,OAAO,GAAGpD,gBAAgB,CAAC,CAAC;IAClC,MAAM;MAAEqD,qBAAqB;MAAEC;IAAwB,CAAC,GACvDnE,MAAM,CAAEX,SAAU,CAAC;IACpB,MAAM+E,cAAc,GAAGF,qBAAqB,CAC3C,UAAU,EACVF,SAAS,EACTC,OACD,CAAC;IACD,MAAMI,QAAQ,GAAGF,uBAAuB,CACvC,UAAU,EACVH,SAAS,EACTC,OACD,CAAC;IAED,OAAO;MACNF,eAAe,EACd,CAAEM,QAAQ,IACV,EAAE,KAAKD,cAAc,CAAC9D,OAAO,IAC7Bd,kBAAkB,KAAKwE,SAAS;MACjClE,IAAI,EAAEsE,cAAc,CAACtE,IAAI;MACzBC,QAAQ,EAAEqE,cAAc,CAAChE,SAAS;MAClCY,QAAQ,EAAEgD,SAAS;MACnBjD,MAAM,EAAEkD;IACT,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAEDnF,SAAS,CAAE,MAAM;IAChB;IACAgF,WAAW,CAAE,KAAM,CAAC;EACrB,CAAC,EAAE,CAAE9C,QAAQ,EAAED,MAAM,CAAG,CAAC;EAEzB,IAAK,CAAEgD,eAAe,IAAIF,QAAQ,EAAG;IACpC,OAAO,IAAI;EACZ;EAEA,oBACCnE,IAAA,CAACsD,UAAU;IACVlD,IAAI,EAAGA,IAAM;IACbC,QAAQ,EAAGA,QAAU;IACrBiB,QAAQ,EAAGA,QAAU;IACrBiC,OAAO,EAAGA,CAAA,KAAMa,WAAW,CAAE,IAAK;EAAG,CACrC,CAAC;AAEJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Modal","Flex","FlexItem","Button","__","useState","useMemo","useEffect","__experimentalBlockPatternsList","BlockPatternsList","useSelect","useAsyncList","parse","store","coreStore","useEntityBlockEditor","editorStore","TEMPLATE_POST_TYPE","jsx","_jsx","jsxs","_jsxs","useFallbackTemplateContent","slug","isCustom","select","getEntityRecord","getDefaultTemplateId","templateId","is_custom","ignore_empty","content","raw","undefined","useStartPatterns","fallbackContent","patterns","getCurrentPostType","getCurrentPostId","getBlockPatterns","postId","postType","record","currentThemeStylesheet","getCurrentTheme","stylesheet","injectThemeAttributeInBlockTemplateContent","block","innerBlocks","find","innerBlock","name","map","attributes","theme","blocks","title","filter","pattern","Array","isArray","templateTypes","some","templateType","startsWith","PatternSelection","onChoosePattern","onChange","blockPatterns","shownBlockPatterns","shownPatterns","onClickPattern","selection","StartModal","onClose","className","closeLabel","focusOnMount","onRequestClose","isFullScreen","children","justify","expanded","__next40pxDefaultSize","variant","onClick","StartTemplateOptions","isClosed","setIsClosed","shouldOpenModal","_postType","_postId","getEditedEntityRecord","hasEditsForEntityRecord","templateRecord","hasEdits"],"sources":["@wordpress/editor/src/components/start-template-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal, Flex, FlexItem, Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useAsyncList } from '@wordpress/compose';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore, useEntityBlockEditor } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\n\nfunction useFallbackTemplateContent( slug, isCustom = false ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getDefaultTemplateId } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst templateId = getDefaultTemplateId( {\n\t\t\t\tslug,\n\t\t\t\tis_custom: isCustom,\n\t\t\t\tignore_empty: true,\n\t\t\t} );\n\t\t\treturn templateId\n\t\t\t\t? getEntityRecord( 'postType', TEMPLATE_POST_TYPE, templateId )\n\t\t\t\t\t\t?.content?.raw\n\t\t\t\t: undefined;\n\t\t},\n\t\t[ slug, isCustom ]\n\t);\n}\n\nfunction useStartPatterns( fallbackContent ) {\n\tconst { slug, patterns } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getCurrentPostId } = select( editorStore );\n\t\tconst { getEntityRecord, getBlockPatterns } = select( coreStore );\n\t\tconst postId = getCurrentPostId();\n\t\tconst postType = getCurrentPostType();\n\t\tconst record = getEntityRecord( 'postType', postType, postId );\n\t\treturn {\n\t\t\tslug: record.slug,\n\t\t\tpatterns: getBlockPatterns(),\n\t\t};\n\t}, [] );\n\n\tconst currentThemeStylesheet = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme().stylesheet\n\t);\n\n\t// Duplicated from packages/block-library/src/pattern/edit.js.\n\tfunction injectThemeAttributeInBlockTemplateContent( block ) {\n\t\tif (\n\t\t\tblock.innerBlocks.find(\n\t\t\t\t( innerBlock ) => innerBlock.name === 'core/template-part'\n\t\t\t)\n\t\t) {\n\t\t\tblock.innerBlocks = block.innerBlocks.map( ( innerBlock ) => {\n\t\t\t\tif (\n\t\t\t\t\tinnerBlock.name === 'core/template-part' &&\n\t\t\t\t\tinnerBlock.attributes.theme === undefined\n\t\t\t\t) {\n\t\t\t\t\tinnerBlock.attributes.theme = currentThemeStylesheet;\n\t\t\t\t}\n\t\t\t\treturn innerBlock;\n\t\t\t} );\n\t\t}\n\n\t\tif (\n\t\t\tblock.name === 'core/template-part' &&\n\t\t\tblock.attributes.theme === undefined\n\t\t) {\n\t\t\tblock.attributes.theme = currentThemeStylesheet;\n\t\t}\n\t\treturn block;\n\t}\n\n\treturn useMemo( () => {\n\t\t// filter patterns that are supposed to be used in the current template being edited.\n\t\treturn [\n\t\t\t{\n\t\t\t\tname: 'fallback',\n\t\t\t\tblocks: parse( fallbackContent ),\n\t\t\t\ttitle: __( 'Fallback content' ),\n\t\t\t},\n\t\t\t...patterns\n\t\t\t\t.filter( ( pattern ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\tArray.isArray( pattern.templateTypes ) &&\n\t\t\t\t\t\tpattern.templateTypes.some( ( templateType ) =>\n\t\t\t\t\t\t\tslug.startsWith( templateType )\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t} )\n\t\t\t\t.map( ( pattern ) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...pattern,\n\t\t\t\t\t\tblocks: parse( pattern.content ).map( ( block ) =>\n\t\t\t\t\t\t\tinjectThemeAttributeInBlockTemplateContent( block )\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t} ),\n\t\t];\n\t}, [ fallbackContent, slug, patterns ] );\n}\n\nfunction PatternSelection( { fallbackContent, onChoosePattern, postType } ) {\n\tconst [ , , onChange ] = useEntityBlockEditor( 'postType', postType );\n\tconst blockPatterns = useStartPatterns( fallbackContent );\n\tconst shownBlockPatterns = useAsyncList( blockPatterns );\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tblockPatterns={ blockPatterns }\n\t\t\tshownPatterns={ shownBlockPatterns }\n\t\t\tonClickPattern={ ( pattern, blocks ) => {\n\t\t\t\tonChange( blocks, { selection: undefined } );\n\t\t\t\tonChoosePattern();\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction StartModal( { slug, isCustom, onClose, postType } ) {\n\tconst fallbackContent = useFallbackTemplateContent( slug, isCustom );\n\tif ( ! fallbackContent ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"editor-start-template-options__modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tcloseLabel={ __( 'Cancel' ) }\n\t\t\tfocusOnMount=\"firstElement\"\n\t\t\tonRequestClose={ onClose }\n\t\t\tisFullScreen\n\t\t>\n\t\t\t<div className=\"editor-start-template-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tfallbackContent={ fallbackContent }\n\t\t\t\t\tslug={ slug }\n\t\t\t\t\tisCustom={ isCustom }\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tonChoosePattern={ () => {\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<Flex\n\t\t\t\tclassName=\"editor-start-template-options__modal__actions\"\n\t\t\t\tjustify=\"flex-end\"\n\t\t\t\texpanded={ false }\n\t\t\t>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t\t__next40pxDefaultSize={ false }\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Skip' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</Modal>\n\t);\n}\n\nexport default function StartTemplateOptions() {\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst { shouldOpenModal, slug, isCustom, postType, postId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPostType, getCurrentPostId } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst _postType = getCurrentPostType();\n\t\t\tconst _postId = getCurrentPostId();\n\t\t\tconst { getEditedEntityRecord, hasEditsForEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst templateRecord = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\t_postId\n\t\t\t);\n\t\t\tconst hasEdits = hasEditsForEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\t_postId\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tshouldOpenModal:\n\t\t\t\t\t! hasEdits &&\n\t\t\t\t\t'' === templateRecord.content &&\n\t\t\t\t\tTEMPLATE_POST_TYPE === _postType,\n\t\t\t\tslug: templateRecord.slug,\n\t\t\t\tisCustom: templateRecord.is_custom,\n\t\t\t\tpostType: _postType,\n\t\t\t\tpostId: _postId,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tuseEffect( () => {\n\t\t// Should reset the modal state when navigating to a new page/post.\n\t\tsetIsClosed( false );\n\t}, [ postType, postId ] );\n\n\tif ( ! shouldOpenModal || isClosed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StartModal\n\t\t\tslug={ slug }\n\t\t\tisCustom={ isCustom }\n\t\t\tpostType={ postType }\n\t\t\tonClose={ () => setIsClosed( true ) }\n\t\t/>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,MAAM,QAAQ,uBAAuB;AACrE,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;AACjE,SAASC,+BAA+B,IAAIC,iBAAiB,QAAQ,yBAAyB;AAC9F,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,KAAK,QAAQ,mBAAmB;AACzC,SAASC,KAAK,IAAIC,SAAS,EAAEC,oBAAoB,QAAQ,sBAAsB;;AAE/E;AACA;AACA;AACA,SAASF,KAAK,IAAIG,WAAW,QAAQ,aAAa;AAClD,SAASC,kBAAkB,QAAQ,uBAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAE3D,SAASC,0BAA0BA,CAAEC,IAAI,EAAEC,QAAQ,GAAG,KAAK,EAAG;EAC7D,OAAOd,SAAS,CACbe,MAAM,IAAM;IACb,MAAM;MAAEC,eAAe;MAAEC;IAAqB,CAAC,GAC9CF,MAAM,CAAEX,SAAU,CAAC;IACpB,MAAMc,UAAU,GAAGD,oBAAoB,CAAE;MACxCJ,IAAI;MACJM,SAAS,EAAEL,QAAQ;MACnBM,YAAY,EAAE;IACf,CAAE,CAAC;IACH,OAAOF,UAAU,GACdF,eAAe,CAAE,UAAU,EAAET,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AM,CAAG,CAAC;EAEzB,IAAK,CAAEiD,eAAe,IAAIF,QAAQ,EAAG;IACpC,OAAO,IAAI;EACZ;EAEA,oBACCpE,IAAA,CAACsD,UAAU;IACVlD,IAAI,EAAGA,IAAM;IACbC,QAAQ,EAAGA,QAAU;IACrBiB,QAAQ,EAAGA,QAAU;IACrBiC,OAAO,EAAGA,CAAA,KAAMc,WAAW,CAAE,IAAK;EAAG,CACrC,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -28,7 +28,10 @@ function TableOfContents({
|
|
|
28
28
|
renderToggle: ({
|
|
29
29
|
isOpen,
|
|
30
30
|
onToggle
|
|
31
|
-
}) => /*#__PURE__*/_jsx(Button
|
|
31
|
+
}) => /*#__PURE__*/_jsx(Button
|
|
32
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
33
|
+
, {
|
|
34
|
+
__next40pxDefaultSize: false,
|
|
32
35
|
...props,
|
|
33
36
|
ref: ref,
|
|
34
37
|
onClick: hasBlocks ? onToggle : undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","Dropdown","Button","useSelect","info","forwardRef","store","blockEditorStore","TableOfContentsPanel","jsx","_jsx","TableOfContents","hasOutlineItemsDisabled","repositionDropdown","props","ref","hasBlocks","select","getBlockCount","popoverProps","placement","className","contentClassName","renderToggle","isOpen","onToggle","onClick","undefined","icon","label","tooltipPosition","renderContent","onClose","onRequestClose"],"sources":["@wordpress/editor/src/components/table-of-contents/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { info } from '@wordpress/icons';\nimport { forwardRef } from '@wordpress/element';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport TableOfContentsPanel from './panel';\n\nfunction TableOfContents(\n\t{ hasOutlineItemsDisabled, repositionDropdown, ...props },\n\tref\n) {\n\tconst hasBlocks = useSelect(\n\t\t( select ) => !! select( blockEditorStore ).getBlockCount(),\n\t\t[]\n\t);\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ {\n\t\t\t\tplacement: repositionDropdown ? 'right' : 'bottom',\n\t\t\t} }\n\t\t\tclassName=\"table-of-contents\"\n\t\t\tcontentClassName=\"table-of-contents__popover\"\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tonClick={ hasBlocks ? onToggle : undefined }\n\t\t\t\t\ticon={ info }\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\tlabel={ __( 'Details' ) }\n\t\t\t\t\ttooltipPosition=\"bottom\"\n\t\t\t\t\taria-disabled={ ! hasBlocks }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t<TableOfContentsPanel\n\t\t\t\t\tonRequestClose={ onClose }\n\t\t\t\t\thasOutlineItemsDisabled={ hasOutlineItemsDisabled }\n\t\t\t\t/>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\n/**\n * Renders a table of contents component.\n *\n * @param {Object} props The component props.\n * @param {boolean} props.hasOutlineItemsDisabled Whether outline items are disabled.\n * @param {boolean} props.repositionDropdown Whether to reposition the dropdown.\n * @param {Element.ref} ref The component's ref.\n *\n * @return {JSX.Element} The rendered table of contents component.\n */\nexport default forwardRef( TableOfContents );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,MAAM,QAAQ,uBAAuB;AACxD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,IAAI,QAAQ,kBAAkB;AACvC,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;;AAEnE;AACA;AACA;AACA,OAAOC,oBAAoB,MAAM,SAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3C,SAASC,eAAeA,CACvB;EAAEC,uBAAuB;EAAEC,kBAAkB;EAAE,GAAGC;AAAM,CAAC,EACzDC,GAAG,EACF;EACD,MAAMC,SAAS,GAAGb,SAAS,CACxBc,MAAM,IAAM,CAAC,CAAEA,MAAM,CAAEV,gBAAiB,CAAC,CAACW,aAAa,CAAC,CAAC,EAC3D,EACD,CAAC;EACD,oBACCR,IAAA,CAACT,QAAQ;IACRkB,YAAY,EAAG;MACdC,SAAS,EAAEP,kBAAkB,GAAG,OAAO,GAAG;IAC3C,CAAG;IACHQ,SAAS,EAAC,mBAAmB;IAC7BC,gBAAgB,EAAC,4BAA4B;IAC7CC,YAAY,EAAGA,CAAE;MAAEC,MAAM;MAAEC;IAAS,CAAC,kBACpCf,IAAA,CAACR,
|
|
1
|
+
{"version":3,"names":["__","Dropdown","Button","useSelect","info","forwardRef","store","blockEditorStore","TableOfContentsPanel","jsx","_jsx","TableOfContents","hasOutlineItemsDisabled","repositionDropdown","props","ref","hasBlocks","select","getBlockCount","popoverProps","placement","className","contentClassName","renderToggle","isOpen","onToggle","__next40pxDefaultSize","onClick","undefined","icon","label","tooltipPosition","renderContent","onClose","onRequestClose"],"sources":["@wordpress/editor/src/components/table-of-contents/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { info } from '@wordpress/icons';\nimport { forwardRef } from '@wordpress/element';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport TableOfContentsPanel from './panel';\n\nfunction TableOfContents(\n\t{ hasOutlineItemsDisabled, repositionDropdown, ...props },\n\tref\n) {\n\tconst hasBlocks = useSelect(\n\t\t( select ) => !! select( blockEditorStore ).getBlockCount(),\n\t\t[]\n\t);\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ {\n\t\t\t\tplacement: repositionDropdown ? 'right' : 'bottom',\n\t\t\t} }\n\t\t\tclassName=\"table-of-contents\"\n\t\t\tcontentClassName=\"table-of-contents__popover\"\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\t// TODO: Switch to `true` (40px size) if possible\n\t\t\t\t\t__next40pxDefaultSize={ false }\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tonClick={ hasBlocks ? onToggle : undefined }\n\t\t\t\t\ticon={ info }\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\tlabel={ __( 'Details' ) }\n\t\t\t\t\ttooltipPosition=\"bottom\"\n\t\t\t\t\taria-disabled={ ! hasBlocks }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t<TableOfContentsPanel\n\t\t\t\t\tonRequestClose={ onClose }\n\t\t\t\t\thasOutlineItemsDisabled={ hasOutlineItemsDisabled }\n\t\t\t\t/>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\n/**\n * Renders a table of contents component.\n *\n * @param {Object} props The component props.\n * @param {boolean} props.hasOutlineItemsDisabled Whether outline items are disabled.\n * @param {boolean} props.repositionDropdown Whether to reposition the dropdown.\n * @param {Element.ref} ref The component's ref.\n *\n * @return {JSX.Element} The rendered table of contents component.\n */\nexport default forwardRef( TableOfContents );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,MAAM,QAAQ,uBAAuB;AACxD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,IAAI,QAAQ,kBAAkB;AACvC,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,K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|
49
49
|
className: "editor-text-editor__toolbar",
|
|
50
50
|
children: [/*#__PURE__*/_jsx("h2", {
|
|
51
51
|
children: __('Editing code')
|
|
52
|
-
}), /*#__PURE__*/_jsx(Button
|
|
52
|
+
}), /*#__PURE__*/_jsx(Button
|
|
53
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
54
|
+
, {
|
|
55
|
+
__next40pxDefaultSize: false,
|
|
53
56
|
variant: "tertiary",
|
|
54
57
|
onClick: () => switchEditorMode('visual'),
|
|
55
58
|
shortcut: shortcut,
|