@wordpress/editor 14.20.0 → 14.22.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +1 -1
  3. package/build/components/plugin-pre-publish-panel/index.js +1 -1
  4. package/build/components/plugin-pre-publish-panel/index.js.map +1 -1
  5. package/build/components/post-actions/set-as-homepage.js +1 -0
  6. package/build/components/post-actions/set-as-homepage.js.map +1 -1
  7. package/build/components/post-actions/set-as-posts-page.js +1 -0
  8. package/build/components/post-actions/set-as-posts-page.js.map +1 -1
  9. package/build/components/post-status/index.js +4 -0
  10. package/build/components/post-status/index.js.map +1 -1
  11. package/build/components/post-template/block-theme.js +1 -3
  12. package/build/components/post-template/block-theme.js.map +1 -1
  13. package/build/components/post-template/create-new-template-modal.js +7 -2
  14. package/build/components/post-template/create-new-template-modal.js.map +1 -1
  15. package/build/components/post-template/create-new-template.js +1 -4
  16. package/build/components/post-template/create-new-template.js.map +1 -1
  17. package/build/components/preview-dropdown/index.js +2 -4
  18. package/build/components/preview-dropdown/index.js.map +1 -1
  19. package/build/components/start-page-options/index.js +2 -1
  20. package/build/components/start-page-options/index.js.map +1 -1
  21. package/build-module/components/plugin-pre-publish-panel/index.js +1 -1
  22. package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -1
  23. package/build-module/components/post-actions/set-as-homepage.js +1 -0
  24. package/build-module/components/post-actions/set-as-homepage.js.map +1 -1
  25. package/build-module/components/post-actions/set-as-posts-page.js +1 -0
  26. package/build-module/components/post-actions/set-as-posts-page.js.map +1 -1
  27. package/build-module/components/post-status/index.js +4 -0
  28. package/build-module/components/post-status/index.js.map +1 -1
  29. package/build-module/components/post-template/block-theme.js +1 -3
  30. package/build-module/components/post-template/block-theme.js.map +1 -1
  31. package/build-module/components/post-template/create-new-template-modal.js +7 -2
  32. package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
  33. package/build-module/components/post-template/create-new-template.js +1 -4
  34. package/build-module/components/post-template/create-new-template.js.map +1 -1
  35. package/build-module/components/preview-dropdown/index.js +2 -4
  36. package/build-module/components/preview-dropdown/index.js.map +1 -1
  37. package/build-module/components/start-page-options/index.js +2 -1
  38. package/build-module/components/start-page-options/index.js.map +1 -1
  39. package/build-style/style-rtl.css +5 -0
  40. package/build-style/style.css +5 -0
  41. package/build-types/components/plugin-pre-publish-panel/index.d.ts +1 -1
  42. package/build-types/components/post-actions/set-as-homepage.d.ts +1 -0
  43. package/build-types/components/post-actions/set-as-homepage.d.ts.map +1 -1
  44. package/build-types/components/post-actions/set-as-posts-page.d.ts +1 -0
  45. package/build-types/components/post-actions/set-as-posts-page.d.ts.map +1 -1
  46. package/build-types/components/post-status/index.d.ts.map +1 -1
  47. package/build-types/components/post-template/block-theme.d.ts.map +1 -1
  48. package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
  49. package/build-types/components/post-template/create-new-template.d.ts +1 -3
  50. package/build-types/components/post-template/create-new-template.d.ts.map +1 -1
  51. package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
  52. package/build-types/components/start-page-options/index.d.ts.map +1 -1
  53. package/package.json +37 -37
  54. package/src/components/plugin-pre-publish-panel/index.js +1 -1
  55. package/src/components/post-actions/set-as-homepage.js +1 -0
  56. package/src/components/post-actions/set-as-posts-page.js +1 -0
  57. package/src/components/post-publish-panel/style.scss +1 -0
  58. package/src/components/post-status/index.js +6 -1
  59. package/src/components/post-template/block-theme.js +1 -3
  60. package/src/components/post-template/create-new-template-modal.js +7 -2
  61. package/src/components/post-template/create-new-template.js +1 -2
  62. package/src/components/post-template/style.scss +4 -0
  63. package/src/components/preview-dropdown/index.js +6 -3
  64. package/src/components/start-page-options/index.js +3 -1
  65. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","useViewportMatch","DropdownMenu","MenuGroup","MenuItem","MenuItemsChoice","VisuallyHidden","Icon","__","desktop","mobile","tablet","external","check","useSelect","useDispatch","store","coreStore","preferencesStore","ActionItem","editorStore","blockEditorStore","PostPreviewButton","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","PreviewDropdown","forceIsAutosaveable","disabled","deviceType","homeUrl","isTemplate","isViewable","showIconLabels","isTemplateHidden","templateId","select","_getPostType$viewable","getDeviceType","getCurrentPostType","getCurrentTemplateId","getRenderingMode","getEntityRecord","getPostType","get","_currentPostType","home","viewable","setDeviceType","setRenderingMode","setDefaultRenderingMode","resetZoomLevel","handleDevicePreviewChange","newDeviceType","isMobile","popoverProps","placement","toggleProps","className","iconPosition","size","showTooltip","accessibleWhenDisabled","menuProps","deviceIcons","choices","value","label","icon","toLowerCase","disableOpenOnArrowDown","children","onClose","onSelect","href","target","onClick","as","undefined","isSelected","role","newRenderingMode","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, check } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { ActionItem } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport PostPreviewButton from '../post-preview-button';\nimport { unlock } from '../../lock-unlock';\n\nexport default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {\n\tconst {\n\t\tdeviceType,\n\t\thomeUrl,\n\t\tisTemplate,\n\t\tisViewable,\n\t\tshowIconLabels,\n\t\tisTemplateHidden,\n\t\ttemplateId,\n\t} = useSelect( ( select ) => {\n\t\tconst { getDeviceType, getCurrentPostType, getCurrentTemplateId } =\n\t\t\tselect( editorStore );\n\t\tconst { getRenderingMode } = unlock( select( editorStore ) );\n\t\tconst { getEntityRecord, getPostType } = select( coreStore );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst _currentPostType = getCurrentPostType();\n\t\treturn {\n\t\t\tdeviceType: getDeviceType(),\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\tisTemplateHidden: getRenderingMode() === 'post-only',\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t};\n\t}, [] );\n\tconst { setDeviceType, setRenderingMode, setDefaultRenderingMode } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\n\n\tconst handleDevicePreviewChange = ( newDeviceType ) => {\n\t\tsetDeviceType( newDeviceType );\n\t\tresetZoomLevel();\n\t};\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: '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\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\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={ deviceType }\n\t\t\t\t\t\t\tonSelect={ handleDevicePreviewChange }\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{ ! isTemplate && !! templateId && (\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\ticon={ ! isTemplateHidden ? check : undefined }\n\t\t\t\t\t\t\t\tisSelected={ ! isTemplateHidden }\n\t\t\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tconst newRenderingMode = isTemplateHidden\n\t\t\t\t\t\t\t\t\t\t? 'template-locked'\n\t\t\t\t\t\t\t\t\t\t: 'post-only';\n\t\t\t\t\t\t\t\t\tsetRenderingMode( newRenderingMode );\n\t\t\t\t\t\t\t\t\tsetDefaultRenderingMode( newRenderingMode );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Show template' ) }\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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CAAE,oBAAqB,CAAG;UACzC8E,WAAW,eACV3D,KAAA,CAAAE,SAAA;YAAA8C,QAAA,GACGnE,EAAE,CAAE,oBAAqB,CAAC,eAC5BiB,IAAA,CAAClB,IAAI;cAACiE,IAAI,EAAG5D;YAAU,CAAE,CAAC;UAAA,CACzB,CACF;UACD2E,SAAS,EAAGX;QAAS,CACrB;MAAC,CACQ,CACX,eACDnD,IAAA,CAACN,UAAU,CAACqE,IAAI;QACfC,IAAI,EAAC,0BAA0B;QAC/BC,SAAS,EAAG;UAAEV,OAAO,EAAEJ;QAAQ;MAAG,CAClC,CAAC;IAAA,CACD;EACF,CACY,CAAC;AAEjB","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useViewportMatch","DropdownMenu","MenuGroup","MenuItem","MenuItemsChoice","VisuallyHidden","Icon","__","desktop","mobile","tablet","external","check","useSelect","useDispatch","store","coreStore","preferencesStore","ActionItem","editorStore","blockEditorStore","PostPreviewButton","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","PreviewDropdown","forceIsAutosaveable","disabled","deviceType","homeUrl","isTemplate","isViewable","showIconLabels","isTemplateHidden","templateId","select","_getPostType$viewable","getDeviceType","getCurrentPostType","getCurrentTemplateId","getRenderingMode","getEntityRecord","getPostType","get","_currentPostType","home","viewable","setDeviceType","setRenderingMode","setDefaultRenderingMode","resetZoomLevel","handleDevicePreviewChange","newDeviceType","isMobile","popoverProps","placement","toggleProps","className","iconPosition","size","showTooltip","accessibleWhenDisabled","menuProps","deviceIcons","choices","value","label","icon","toLowerCase","disableOpenOnArrowDown","children","onClose","onSelect","href","target","onClick","as","undefined","isSelected","role","newRenderingMode","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, check } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { ActionItem } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport PostPreviewButton from '../post-preview-button';\nimport { unlock } from '../../lock-unlock';\n\nexport default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {\n\tconst {\n\t\tdeviceType,\n\t\thomeUrl,\n\t\tisTemplate,\n\t\tisViewable,\n\t\tshowIconLabels,\n\t\tisTemplateHidden,\n\t\ttemplateId,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetDeviceType,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentTemplateId,\n\t\t\tgetRenderingMode,\n\t\t} = select( editorStore );\n\t\tconst { getEntityRecord, getPostType } = select( coreStore );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst _currentPostType = getCurrentPostType();\n\t\treturn {\n\t\t\tdeviceType: getDeviceType(),\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\tisTemplateHidden: getRenderingMode() === 'post-only',\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t};\n\t}, [] );\n\tconst { setDeviceType, setRenderingMode, setDefaultRenderingMode } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\n\n\tconst handleDevicePreviewChange = ( newDeviceType ) => {\n\t\tsetDeviceType( newDeviceType );\n\t\tresetZoomLevel();\n\t};\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: '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\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\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={ deviceType }\n\t\t\t\t\t\t\tonSelect={ handleDevicePreviewChange }\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{ ! isTemplate && !! templateId && (\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\ticon={ ! isTemplateHidden ? check : undefined }\n\t\t\t\t\t\t\t\tisSelected={ ! isTemplateHidden }\n\t\t\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tconst newRenderingMode = isTemplateHidden\n\t\t\t\t\t\t\t\t\t\t? 'template-locked'\n\t\t\t\t\t\t\t\t\t\t: 'post-only';\n\t\t\t\t\t\t\t\t\tsetRenderingMode( newRenderingMode );\n\t\t\t\t\t\t\t\t\tsetDefaultRenderingMode( newRenderingMode );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Show template' ) }\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\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,EAAEC,KAAK,QAAQ,kBAAkB;AAC3E,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,wBAAwB;AAClE,SAASC,UAAU,QAAQ,sBAAsB;;AAEjD;AACA;AACA;AACA,SAASH,KAAK,IAAII,WAA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,EAAC,kBAAkB;UACvBJ,OAAO,EAAGA,CAAA,KAAM;YACf,MAAMK,gBAAgB,GAAG/C,gBAAgB,GACtC,iBAAiB,GACjB,WAAW;YACde,gBAAgB,CAAEgC,gBAAiB,CAAC;YACpC/B,uBAAuB,CAAE+B,gBAAiB,CAAC;UAC5C,CAAG;UAAAV,QAAA,EAEDnE,EAAE,CAAE,eAAgB;QAAC,CACd;MAAC,CACD,CACX,EACC4B,UAAU,iBACXX,IAAA,CAACtB,SAAS;QAAAwE,QAAA,eACTlD,IAAA,CAACH,iBAAiB;UACjBwC,SAAS,EAAC,0CAA0C;UACpDsB,IAAI,EAAC,UAAU;UACfrD,mBAAmB,EAAGA,mBAAqB;UAC3C,cAAavB,EAAE,CAAE,oBAAqB,CAAG;UACzC8E,WAAW,eACV3D,KAAA,CAAAE,SAAA;YAAA8C,QAAA,GACGnE,EAAE,CAAE,oBAAqB,CAAC,eAC5BiB,IAAA,CAAClB,IAAI;cAACiE,IAAI,EAAG5D;YAAU,CAAE,CAAC;UAAA,CACzB,CACF;UACD2E,SAAS,EAAGX;QAAS,CACrB;MAAC,CACQ,CACX,eACDnD,IAAA,CAACN,UAAU,CAACqE,IAAI;QACfC,IAAI,EAAC,0BAA0B;QAC/BC,SAAS,EAAG;UAAEV,OAAO,EAAEJ;QAAQ;MAAG,CAClC,CAAC;IAAA,CACD;EACF,CACY,CAAC;AAEjB","ignoreList":[]}
@@ -14,6 +14,7 @@ import { store as interfaceStore } from '@wordpress/interface';
14
14
  /**
15
15
  * Internal dependencies
16
16
  */
17
+ import { TEMPLATE_POST_TYPE } from '../../store/constants';
17
18
  import { store as editorStore } from '../../store';
18
19
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
20
  export function useStartPatterns() {
@@ -150,7 +151,7 @@ export default function StartPageOptions() {
150
151
  const choosePatternModalEnabled = select(preferencesStore).get('core', 'enableChoosePatternModal');
151
152
  return {
152
153
  postId: getCurrentPostId(),
153
- enabled: choosePatternModalEnabled && 'page' === getCurrentPostType()
154
+ enabled: choosePatternModalEnabled && TEMPLATE_POST_TYPE !== getCurrentPostType()
154
155
  };
155
156
  }, []);
156
157
 
@@ -1 +1 @@
1
- {"version":3,"names":["Flex","FlexItem","Modal","ToggleControl","__","useState","useMemo","useEffect","store","blockEditorStore","__experimentalBlockPatternsList","BlockPatternsList","useSelect","useDispatch","coreStore","__unstableSerializeAndClean","preferencesStore","interfaceStore","editorStore","jsx","_jsx","jsxs","_jsxs","useStartPatterns","blockPatternsWithPostContentBlockType","postType","select","getPatternsByBlockTypes","getBlocksByName","getCurrentPostType","getRenderingMode","rootClientId","length","filter","pattern","postTypes","Array","isArray","includes","PatternSelection","blockPatterns","onChoosePattern","editEntityRecord","postId","getCurrentPostId","onClickPattern","_pattern","blocks","content","blocksForSerialization","StartPageOptionsModal","onClose","showStartPatterns","setShowStartPatterns","set","setPreference","startPatterns","hasStartPattern","handleClose","className","title","isFullScreen","onRequestClose","children","justify","expanded","__nextHasNoMarginBottom","checked","label","help","onChange","newValue","StartPageOptions","isOpen","setIsOpen","isEditedPostDirty","isEditedPostEmpty","isModalActive","enabled","choosePatternModalEnabled","get","isFreshPage","isPreferencesModalActive"],"sources":["@wordpress/editor/src/components/start-page-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Flex, FlexItem, Modal, ToggleControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport {\n\tstore as blockEditorStore,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function useStartPatterns() {\n\t// A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,\n\t// and it has no postTypes declared and the current post type is page or if\n\t// the current post type is part of the postTypes declared.\n\tconst { blockPatternsWithPostContentBlockType, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPatternsByBlockTypes, getBlocksByName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { getCurrentPostType, getRenderingMode } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst rootClientId =\n\t\t\t\tgetRenderingMode() === 'post-only'\n\t\t\t\t\t? ''\n\t\t\t\t\t: getBlocksByName( 'core/post-content' )?.[ 0 ];\n\t\t\treturn {\n\t\t\t\tblockPatternsWithPostContentBlockType: getPatternsByBlockTypes(\n\t\t\t\t\t'core/post-content',\n\t\t\t\t\trootClientId\n\t\t\t\t),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\treturn useMemo( () => {\n\t\tif ( ! blockPatternsWithPostContentBlockType?.length ) {\n\t\t\treturn [];\n\t\t}\n\n\t\t/*\n\t\t * Filter patterns without postTypes declared if the current postType is page\n\t\t * or patterns that declare the current postType in its post type array.\n\t\t */\n\t\treturn blockPatternsWithPostContentBlockType.filter( ( pattern ) => {\n\t\t\treturn (\n\t\t\t\t( postType === 'page' && ! pattern.postTypes ) ||\n\t\t\t\t( Array.isArray( pattern.postTypes ) &&\n\t\t\t\t\tpattern.postTypes.includes( postType ) )\n\t\t\t);\n\t\t} );\n\t}, [ postType, blockPatternsWithPostContentBlockType ] );\n}\n\nfunction PatternSelection( { blockPatterns, onChoosePattern } ) {\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { postType, postId } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getCurrentPostId } = select( editorStore );\n\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tblockPatterns={ blockPatterns }\n\t\t\tonClickPattern={ ( _pattern, blocks ) => {\n\t\t\t\teditEntityRecord( 'postType', postType, postId, {\n\t\t\t\t\tblocks,\n\t\t\t\t\tcontent: ( { blocks: blocksForSerialization = [] } ) =>\n\t\t\t\t\t\t__unstableSerializeAndClean( blocksForSerialization ),\n\t\t\t\t} );\n\t\t\t\tonChoosePattern();\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction StartPageOptionsModal( { onClose } ) {\n\tconst [ showStartPatterns, setShowStartPatterns ] = useState( true );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tconst startPatterns = useStartPatterns();\n\tconst hasStartPattern = startPatterns.length > 0;\n\n\tif ( ! hasStartPattern ) {\n\t\treturn null;\n\t}\n\n\tfunction handleClose() {\n\t\tonClose();\n\t\tsetPreference( 'core', 'enableChoosePatternModal', showStartPatterns );\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"editor-start-page-options__modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tisFullScreen\n\t\t\tonRequestClose={ handleClose }\n\t\t>\n\t\t\t<div className=\"editor-start-page-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tblockPatterns={ startPatterns }\n\t\t\t\t\tonChoosePattern={ handleClose }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<Flex\n\t\t\t\tclassName=\"editor-start-page-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<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tchecked={ showStartPatterns }\n\t\t\t\t\t\tlabel={ __( 'Show starter patterns' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Shows starter patterns when creating a new page.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\tsetShowStartPatterns( newValue );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</Modal>\n\t);\n}\n\nexport default function StartPageOptions() {\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\tconst { isEditedPostDirty, isEditedPostEmpty } = useSelect( editorStore );\n\tconst { isModalActive } = useSelect( interfaceStore );\n\tconst { enabled, postId } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\tconst choosePatternModalEnabled = select( preferencesStore ).get(\n\t\t\t'core',\n\t\t\t'enableChoosePatternModal'\n\t\t);\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tenabled:\n\t\t\t\tchoosePatternModalEnabled && 'page' === getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\t// Note: The `postId` ensures the effect re-runs when pages are switched without remounting the component.\n\t// Examples: changing pages in the List View, creating a new page via Command Palette.\n\tuseEffect( () => {\n\t\tconst isFreshPage = ! isEditedPostDirty() && isEditedPostEmpty();\n\t\t// Prevents immediately opening when features is enabled via preferences modal.\n\t\tconst isPreferencesModalActive = isModalActive( 'editor/preferences' );\n\t\tif ( ! enabled || ! isFreshPage || isPreferencesModalActive ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Open the modal after the initial render for a new page.\n\t\tsetIsOpen( true );\n\t}, [\n\t\tenabled,\n\t\tpostId,\n\t\tisEditedPostDirty,\n\t\tisEditedPostEmpty,\n\t\tisModalActive,\n\t] );\n\n\tif ( ! isOpen ) {\n\t\treturn null;\n\t}\n\n\treturn <StartPageOptionsModal onClose={ () => setIsOpen( false ) } />;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAI,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,aAAa,QAAQ,uBAAuB;AAC5E,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;AACjE,SACCC,KAAK,IAAIC,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AkB,CAAC,GAAGhE,SAAS,CAAEM,WAAY,CAAC;EACzE,MAAM;IAAE2D;EAAc,CAAC,GAAGjE,SAAS,CAAEK,cAAe,CAAC;EACrD,MAAM;IAAE6D,OAAO;IAAEnC;EAAO,CAAC,GAAG/B,SAAS,CAAIc,MAAM,IAAM;IACpD,MAAM;MAAEkB,gBAAgB;MAAEf;IAAmB,CAAC,GAAGH,MAAM,CAAER,WAAY,CAAC;IACtE,MAAM6D,yBAAyB,GAAGrD,MAAM,CAAEV,gBAAiB,CAAC,CAACgE,GAAG,CAC/D,MAAM,EACN,0BACD,CAAC;IACD,OAAO;MACNrC,MAAM,EAAEC,gBAAgB,CAAC,CAAC;MAC1BkC,OAAO,EACNC,yBAAyB,IAAI,MAAM,KAAKlD,kBAAkB,CAAC;IAC7D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;;EAEP;EACA;EACAtB,SAAS,CAAE,MAAM;IAChB,MAAM0E,WAAW,GAAG,CAAEN,iBAAiB,CAAC,CAAC,IAAIC,iBAAiB,CAAC,CAAC;IAChE;IACA,MAAMM,wBAAwB,GAAGL,aAAa,CAAE,oBAAqB,CAAC;IACtE,IAAK,CAAEC,OAAO,IAAI,CAAEG,WAAW,IAAIC,wBAAwB,EAAG;MAC7D;IACD;;IAEA;IACAR,SAAS,CAAE,IAAK,CAAC;EAClB,CAAC,EAAE,CACFI,OAAO,EACPnC,MAAM,EACNgC,iBAAiB,EACjBC,iBAAiB,EACjBC,aAAa,CACZ,CAAC;EAEH,IAAK,CAAEJ,MAAM,EAAG;IACf,OAAO,IAAI;EACZ;EAEA,oBAAOrD,IAAA,CAAC8B,qBAAqB;IAACC,OAAO,EAAGA,CAAA,KAAMuB,SAAS,CAAE,KAAM;EAAG,CAAE,CAAC;AACtE","ignoreList":[]}
1
+ {"version":3,"names":["Flex","FlexItem","Modal","ToggleControl","__","useState","useMemo","useEffect","store","blockEditorStore","__experimentalBlockPatternsList","BlockPatternsList","useSelect","useDispatch","coreStore","__unstableSerializeAndClean","preferencesStore","interfaceStore","TEMPLATE_POST_TYPE","editorStore","jsx","_jsx","jsxs","_jsxs","useStartPatterns","blockPatternsWithPostContentBlockType","postType","select","getPatternsByBlockTypes","getBlocksByName","getCurrentPostType","getRenderingMode","rootClientId","length","filter","pattern","postTypes","Array","isArray","includes","PatternSelection","blockPatterns","onChoosePattern","editEntityRecord","postId","getCurrentPostId","onClickPattern","_pattern","blocks","content","blocksForSerialization","StartPageOptionsModal","onClose","showStartPatterns","setShowStartPatterns","set","setPreference","startPatterns","hasStartPattern","handleClose","className","title","isFullScreen","onRequestClose","children","justify","expanded","__nextHasNoMarginBottom","checked","label","help","onChange","newValue","StartPageOptions","isOpen","setIsOpen","isEditedPostDirty","isEditedPostEmpty","isModalActive","enabled","choosePatternModalEnabled","get","isFreshPage","isPreferencesModalActive"],"sources":["@wordpress/editor/src/components/start-page-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Flex, FlexItem, Modal, ToggleControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport {\n\tstore as blockEditorStore,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\nimport { store as editorStore } from '../../store';\n\nexport function useStartPatterns() {\n\t// A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,\n\t// and it has no postTypes declared and the current post type is page or if\n\t// the current post type is part of the postTypes declared.\n\tconst { blockPatternsWithPostContentBlockType, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPatternsByBlockTypes, getBlocksByName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { getCurrentPostType, getRenderingMode } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst rootClientId =\n\t\t\t\tgetRenderingMode() === 'post-only'\n\t\t\t\t\t? ''\n\t\t\t\t\t: getBlocksByName( 'core/post-content' )?.[ 0 ];\n\t\t\treturn {\n\t\t\t\tblockPatternsWithPostContentBlockType: getPatternsByBlockTypes(\n\t\t\t\t\t'core/post-content',\n\t\t\t\t\trootClientId\n\t\t\t\t),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\treturn useMemo( () => {\n\t\tif ( ! blockPatternsWithPostContentBlockType?.length ) {\n\t\t\treturn [];\n\t\t}\n\n\t\t/*\n\t\t * Filter patterns without postTypes declared if the current postType is page\n\t\t * or patterns that declare the current postType in its post type array.\n\t\t */\n\t\treturn blockPatternsWithPostContentBlockType.filter( ( pattern ) => {\n\t\t\treturn (\n\t\t\t\t( postType === 'page' && ! pattern.postTypes ) ||\n\t\t\t\t( Array.isArray( pattern.postTypes ) &&\n\t\t\t\t\tpattern.postTypes.includes( postType ) )\n\t\t\t);\n\t\t} );\n\t}, [ postType, blockPatternsWithPostContentBlockType ] );\n}\n\nfunction PatternSelection( { blockPatterns, onChoosePattern } ) {\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { postType, postId } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getCurrentPostId } = select( editorStore );\n\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tblockPatterns={ blockPatterns }\n\t\t\tonClickPattern={ ( _pattern, blocks ) => {\n\t\t\t\teditEntityRecord( 'postType', postType, postId, {\n\t\t\t\t\tblocks,\n\t\t\t\t\tcontent: ( { blocks: blocksForSerialization = [] } ) =>\n\t\t\t\t\t\t__unstableSerializeAndClean( blocksForSerialization ),\n\t\t\t\t} );\n\t\t\t\tonChoosePattern();\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction StartPageOptionsModal( { onClose } ) {\n\tconst [ showStartPatterns, setShowStartPatterns ] = useState( true );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tconst startPatterns = useStartPatterns();\n\tconst hasStartPattern = startPatterns.length > 0;\n\n\tif ( ! hasStartPattern ) {\n\t\treturn null;\n\t}\n\n\tfunction handleClose() {\n\t\tonClose();\n\t\tsetPreference( 'core', 'enableChoosePatternModal', showStartPatterns );\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"editor-start-page-options__modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tisFullScreen\n\t\t\tonRequestClose={ handleClose }\n\t\t>\n\t\t\t<div className=\"editor-start-page-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tblockPatterns={ startPatterns }\n\t\t\t\t\tonChoosePattern={ handleClose }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<Flex\n\t\t\t\tclassName=\"editor-start-page-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<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tchecked={ showStartPatterns }\n\t\t\t\t\t\tlabel={ __( 'Show starter patterns' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Shows starter patterns when creating a new page.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\tsetShowStartPatterns( newValue );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</Modal>\n\t);\n}\n\nexport default function StartPageOptions() {\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\tconst { isEditedPostDirty, isEditedPostEmpty } = useSelect( editorStore );\n\tconst { isModalActive } = useSelect( interfaceStore );\n\tconst { enabled, postId } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\tconst choosePatternModalEnabled = select( preferencesStore ).get(\n\t\t\t'core',\n\t\t\t'enableChoosePatternModal'\n\t\t);\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tenabled:\n\t\t\t\tchoosePatternModalEnabled &&\n\t\t\t\tTEMPLATE_POST_TYPE !== getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\t// Note: The `postId` ensures the effect re-runs when pages are switched without remounting the component.\n\t// Examples: changing pages in the List View, creating a new page via Command Palette.\n\tuseEffect( () => {\n\t\tconst isFreshPage = ! isEditedPostDirty() && isEditedPostEmpty();\n\t\t// Prevents immediately opening when features is enabled via preferences modal.\n\t\tconst isPreferencesModalActive = isModalActive( 'editor/preferences' );\n\t\tif ( ! enabled || ! isFreshPage || isPreferencesModalActive ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Open the modal after the initial render for a new page.\n\t\tsetIsOpen( true );\n\t}, [\n\t\tenabled,\n\t\tpostId,\n\t\tisEditedPostDirty,\n\t\tisEditedPostEmpty,\n\t\tisModalActive,\n\t] );\n\n\tif ( ! isOpen ) {\n\t\treturn null;\n\t}\n\n\treturn <StartPageOptionsModal onClose={ () => setIsOpen( false ) } />;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAI,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,aAAa,QAAQ,uBAAuB;AAC5E,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;AACjE,SACCC,KAAK,IAAIC,gBAAgB,EACzBC,+BAA+B,IAAIC,iBAAiB,QAC9C,yBAAyB;AAChC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASL,KAAK,IAAIM,SAAS,QAAQ,sBAAsB;AACzD,SAASC,2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E8D,OAAO;IAAEnC;EAAO,CAAC,GAAGhC,SAAS,CAAIe,MAAM,IAAM;IACpD,MAAM;MAAEkB,gBAAgB;MAAEf;IAAmB,CAAC,GAAGH,MAAM,CAAER,WAAY,CAAC;IACtE,MAAM6D,yBAAyB,GAAGrD,MAAM,CAAEX,gBAAiB,CAAC,CAACiE,GAAG,CAC/D,MAAM,EACN,0BACD,CAAC;IACD,OAAO;MACNrC,MAAM,EAAEC,gBAAgB,CAAC,CAAC;MAC1BkC,OAAO,EACNC,yBAAyB,IACzB9D,kBAAkB,KAAKY,kBAAkB,CAAC;IAC5C,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;;EAEP;EACA;EACAvB,SAAS,CAAE,MAAM;IAChB,MAAM2E,WAAW,GAAG,CAAEN,iBAAiB,CAAC,CAAC,IAAIC,iBAAiB,CAAC,CAAC;IAChE;IACA,MAAMM,wBAAwB,GAAGL,aAAa,CAAE,oBAAqB,CAAC;IACtE,IAAK,CAAEC,OAAO,IAAI,CAAEG,WAAW,IAAIC,wBAAwB,EAAG;MAC7D;IACD;;IAEA;IACAR,SAAS,CAAE,IAAK,CAAC;EAClB,CAAC,EAAE,CACFI,OAAO,EACPnC,MAAM,EACNgC,iBAAiB,EACjBC,iBAAiB,EACjBC,aAAa,CACZ,CAAC;EAEH,IAAK,CAAEJ,MAAM,EAAG;IACf,OAAO,IAAI;EACZ;EAEA,oBAAOrD,IAAA,CAAC8B,qBAAqB;IAACC,OAAO,EAAGA,CAAA,KAAMuB,SAAS,CAAE,KAAM;EAAG,CAAE,CAAC;AACtE","ignoreList":[]}
@@ -1828,6 +1828,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
1828
1828
  .post-publish-panel__postpublish .components-panel__body {
1829
1829
  border-bottom: 1px solid #e0e0e0;
1830
1830
  border-top: none;
1831
+ word-break: break-word;
1831
1832
  }
1832
1833
 
1833
1834
  .post-publish-panel__postpublish-buttons {
@@ -2042,6 +2043,10 @@ body.is-fullscreen-mode .interface-interface-skeleton {
2042
2043
  z-index: 1000001;
2043
2044
  }
2044
2045
 
2046
+ .editor-post-template__create-template-modal {
2047
+ z-index: 1000001;
2048
+ }
2049
+
2045
2050
  .editor-post-template__swap-template-modal-content .block-editor-block-patterns-list {
2046
2051
  column-count: 2;
2047
2052
  column-gap: 24px;
@@ -1828,6 +1828,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
1828
1828
  .post-publish-panel__postpublish .components-panel__body {
1829
1829
  border-bottom: 1px solid #e0e0e0;
1830
1830
  border-top: none;
1831
+ word-break: break-word;
1831
1832
  }
1832
1833
 
1833
1834
  .post-publish-panel__postpublish-buttons {
@@ -2042,6 +2043,10 @@ body.is-fullscreen-mode .interface-interface-skeleton {
2042
2043
  z-index: 1000001;
2043
2044
  }
2044
2045
 
2046
+ .editor-post-template__create-template-modal {
2047
+ z-index: 1000001;
2048
+ }
2049
+
2045
2050
  .editor-post-template__swap-template-modal-content .block-editor-block-patterns-list {
2046
2051
  column-count: 2;
2047
2052
  column-gap: 24px;
@@ -10,7 +10,7 @@ export default PluginPrePublishPanel;
10
10
  * When no title is provided it is always opened.
11
11
  * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/)
12
12
  * icon slug string, or an SVG WP element, to be rendered when
13
- * the sidebar is pinned to toolbar.
13
+ * the sidebar is pinned to toolbar. If `false` is passed, no icon will be rendered.
14
14
  * @param {React.ReactNode} props.children Children to be rendered
15
15
  *
16
16
  * @example
@@ -2,6 +2,7 @@ export function useSetAsHomepageAction(): {
2
2
  id: string;
3
3
  label: string;
4
4
  isEligible(post: any): boolean;
5
+ modalFocusOnMount: string;
5
6
  RenderModal: ({ items, closeModal }: {
6
7
  items: any;
7
8
  closeModal: any;
@@ -1 +1 @@
1
- {"version":3,"file":"set-as-homepage.d.ts","sourceRoot":"","sources":["../../../src/components/post-actions/set-as-homepage.js"],"names":[],"mappings":"AA0HO;;;;;;;;EA4CN"}
1
+ {"version":3,"file":"set-as-homepage.d.ts","sourceRoot":"","sources":["../../../src/components/post-actions/set-as-homepage.js"],"names":[],"mappings":"AA0HO;;;;;;;;;EA6CN"}
@@ -2,6 +2,7 @@ export function useSetAsPostsPageAction(): {
2
2
  id: string;
3
3
  label: string;
4
4
  isEligible(post: any): boolean;
5
+ modalFocusOnMount: string;
5
6
  RenderModal: ({ items, closeModal }: {
6
7
  items: any;
7
8
  closeModal: any;
@@ -1 +1 @@
1
- {"version":3,"file":"set-as-posts-page.d.ts","sourceRoot":"","sources":["../../../src/components/post-actions/set-as-posts-page.js"],"names":[],"mappings":"AAsHO;;;;;;;;EA6CN"}
1
+ {"version":3,"file":"set-as-posts-page.d.ts","sourceRoot":"","sources":["../../../src/components/post-actions/set-as-posts-page.js"],"names":[],"mappings":"AAsHO;;;;;;;;;EA8CN"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/post-status/index.js"],"names":[],"mappings":"AAmFA,yEAkMC;AArOD;;;;IA0BE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/post-status/index.js"],"names":[],"mappings":"AAmFA,yEAuMC;AA1OD;;;;IA0BE"}
@@ -1 +1 @@
1
- {"version":3,"file":"block-theme.d.ts","sourceRoot":"","sources":["../../../src/components/post-template/block-theme.js"],"names":[],"mappings":"AA2BA;;uCA6IC"}
1
+ {"version":3,"file":"block-theme.d.ts","sourceRoot":"","sources":["../../../src/components/post-template/block-theme.js"],"names":[],"mappings":"AA2BA;;uCA2IC"}
@@ -1 +1 @@
1
- {"version":3,"file":"create-new-template-modal.d.ts","sourceRoot":"","sources":["../../../src/components/post-template/create-new-template-modal.js"],"names":[],"mappings":"AAwBA;;gCAmIC"}
1
+ {"version":3,"file":"create-new-template-modal.d.ts","sourceRoot":"","sources":["../../../src/components/post-template/create-new-template-modal.js"],"names":[],"mappings":"AA4BA;;gCAoIC"}
@@ -1,4 +1,2 @@
1
- export default function CreateNewTemplate({ onClick }: {
2
- onClick: any;
3
- }): import("react").JSX.Element | null;
1
+ export default function CreateNewTemplate(): import("react").JSX.Element | null;
4
2
  //# sourceMappingURL=create-new-template.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-new-template.d.ts","sourceRoot":"","sources":["../../../src/components/post-template/create-new-template.js"],"names":[],"mappings":"AAeA;;uCAqCC"}
1
+ {"version":3,"file":"create-new-template.d.ts","sourceRoot":"","sources":["../../../src/components/post-template/create-new-template.js"],"names":[],"mappings":"AAeA,gFAoCC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/preview-dropdown/index.js"],"names":[],"mappings":"AAgCA;;;uCAwKC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/preview-dropdown/index.js"],"names":[],"mappings":"AAgCA;;;uCA2KC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/start-page-options/index.js"],"names":[],"mappings":"AAqBA,wCA0CC;AA8ED,+EA0CC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/start-page-options/index.js"],"names":[],"mappings":"AAsBA,wCA0CC;AA8ED,+EA2CC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/editor",
3
- "version": "14.20.0",
3
+ "version": "14.22.0",
4
4
  "description": "Enhanced block editor for WordPress posts.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -34,41 +34,41 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@babel/runtime": "7.25.7",
37
- "@wordpress/a11y": "^4.20.0",
38
- "@wordpress/api-fetch": "^7.20.0",
39
- "@wordpress/blob": "^4.20.0",
40
- "@wordpress/block-editor": "^14.15.0",
41
- "@wordpress/blocks": "^14.9.0",
42
- "@wordpress/commands": "^1.20.0",
43
- "@wordpress/components": "^29.6.0",
44
- "@wordpress/compose": "^7.20.0",
45
- "@wordpress/core-data": "^7.20.0",
46
- "@wordpress/data": "^10.20.0",
47
- "@wordpress/dataviews": "^4.16.0",
48
- "@wordpress/date": "^5.20.0",
49
- "@wordpress/deprecated": "^4.20.0",
50
- "@wordpress/dom": "^4.20.0",
51
- "@wordpress/element": "^6.20.0",
52
- "@wordpress/fields": "^0.12.0",
53
- "@wordpress/hooks": "^4.20.0",
54
- "@wordpress/html-entities": "^4.20.0",
55
- "@wordpress/i18n": "^5.20.0",
56
- "@wordpress/icons": "^10.20.0",
57
- "@wordpress/interface": "^9.5.0",
58
- "@wordpress/keyboard-shortcuts": "^5.20.0",
59
- "@wordpress/keycodes": "^4.20.0",
60
- "@wordpress/media-utils": "^5.20.0",
61
- "@wordpress/notices": "^5.20.0",
62
- "@wordpress/patterns": "^2.20.0",
63
- "@wordpress/plugins": "^7.20.0",
64
- "@wordpress/preferences": "^4.20.0",
65
- "@wordpress/private-apis": "^1.20.0",
66
- "@wordpress/reusable-blocks": "^5.20.0",
67
- "@wordpress/rich-text": "^7.20.0",
68
- "@wordpress/server-side-render": "^5.20.0",
69
- "@wordpress/url": "^4.20.0",
70
- "@wordpress/warning": "^3.20.0",
71
- "@wordpress/wordcount": "^4.20.0",
37
+ "@wordpress/a11y": "^4.22.0",
38
+ "@wordpress/api-fetch": "^7.22.0",
39
+ "@wordpress/blob": "^4.22.0",
40
+ "@wordpress/block-editor": "^14.17.0",
41
+ "@wordpress/blocks": "^14.11.0",
42
+ "@wordpress/commands": "^1.22.0",
43
+ "@wordpress/components": "^29.8.0",
44
+ "@wordpress/compose": "^7.22.0",
45
+ "@wordpress/core-data": "^7.22.0",
46
+ "@wordpress/data": "^10.22.0",
47
+ "@wordpress/dataviews": "^4.18.0",
48
+ "@wordpress/date": "^5.22.0",
49
+ "@wordpress/deprecated": "^4.22.0",
50
+ "@wordpress/dom": "^4.22.0",
51
+ "@wordpress/element": "^6.22.0",
52
+ "@wordpress/fields": "^0.14.0",
53
+ "@wordpress/hooks": "^4.22.0",
54
+ "@wordpress/html-entities": "^4.22.0",
55
+ "@wordpress/i18n": "^5.22.0",
56
+ "@wordpress/icons": "^10.22.0",
57
+ "@wordpress/interface": "^9.7.0",
58
+ "@wordpress/keyboard-shortcuts": "^5.22.0",
59
+ "@wordpress/keycodes": "^4.22.0",
60
+ "@wordpress/media-utils": "^5.22.0",
61
+ "@wordpress/notices": "^5.22.0",
62
+ "@wordpress/patterns": "^2.22.0",
63
+ "@wordpress/plugins": "^7.22.0",
64
+ "@wordpress/preferences": "^4.22.0",
65
+ "@wordpress/private-apis": "^1.22.0",
66
+ "@wordpress/reusable-blocks": "^5.22.0",
67
+ "@wordpress/rich-text": "^7.22.0",
68
+ "@wordpress/server-side-render": "^5.22.0",
69
+ "@wordpress/url": "^4.22.0",
70
+ "@wordpress/warning": "^3.22.0",
71
+ "@wordpress/wordcount": "^4.22.0",
72
72
  "change-case": "^4.1.2",
73
73
  "client-zip": "^2.4.5",
74
74
  "clsx": "^2.1.1",
@@ -88,5 +88,5 @@
88
88
  "publishConfig": {
89
89
  "access": "public"
90
90
  },
91
- "gitHead": "72476970386146d450c375e5c71a96dda7c9aaa8"
91
+ "gitHead": "01a314d7e46a50101e328fdb11959c441e49372d"
92
92
  }
@@ -17,7 +17,7 @@ const { Fill, Slot } = createSlotFill( 'PluginPrePublishPanel' );
17
17
  * When no title is provided it is always opened.
18
18
  * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/)
19
19
  * icon slug string, or an SVG WP element, to be rendered when
20
- * the sidebar is pinned to toolbar.
20
+ * the sidebar is pinned to toolbar. If `false` is passed, no icon will be rendered.
21
21
  * @param {React.ReactNode} props.children Children to be rendered
22
22
  *
23
23
  * @example
@@ -160,6 +160,7 @@ export const useSetAsHomepageAction = () => {
160
160
 
161
161
  return true;
162
162
  },
163
+ modalFocusOnMount: 'firstContentElement',
163
164
  RenderModal: SetAsHomepageModal,
164
165
  } ),
165
166
  [ pageForPosts, pageOnFront ]
@@ -157,6 +157,7 @@ export const useSetAsPostsPageAction = () => {
157
157
 
158
158
  return true;
159
159
  },
160
+ modalFocusOnMount: 'firstContentElement',
160
161
  RenderModal: SetAsPostsPageModal,
161
162
  } ),
162
163
  [ pageForPosts, pageOnFront ]
@@ -129,6 +129,7 @@
129
129
  .post-publish-panel__postpublish .components-panel__body {
130
130
  border-bottom: $border-width solid $gray-200;
131
131
  border-top: none;
132
+ word-break: break-word;
132
133
  }
133
134
 
134
135
  .post-publish-panel__postpublish-buttons {
@@ -194,7 +194,12 @@ export default function PostStatus() {
194
194
  title={ __( 'Status & visibility' ) }
195
195
  onClose={ onClose }
196
196
  />
197
- <form>
197
+ <form
198
+ onSubmit={ ( event ) => {
199
+ event.preventDefault();
200
+ onClose();
201
+ } }
202
+ >
198
203
  <VStack spacing={ 4 }>
199
204
  <RadioControl
200
205
  className="editor-change-status__options"
@@ -141,9 +141,7 @@ export default function BlockThemeControl( { id } ) {
141
141
 
142
142
  <SwapTemplateButton onClick={ onClose } />
143
143
  <ResetDefaultTemplate onClick={ onClose } />
144
- { canCreateTemplate && (
145
- <CreateNewTemplate onClick={ onClose } />
146
- ) }
144
+ { canCreateTemplate && <CreateNewTemplate /> }
147
145
  </MenuGroup>
148
146
  <MenuGroup>
149
147
  <MenuItem
@@ -1,3 +1,8 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { paramCase as kebabCase } from 'change-case';
5
+
1
6
  /**
2
7
  * WordPress dependencies
3
8
  */
@@ -12,7 +17,6 @@ import {
12
17
  __experimentalVStack as VStack,
13
18
  } from '@wordpress/components';
14
19
  import { __ } from '@wordpress/i18n';
15
- import { cleanForSlug } from '@wordpress/url';
16
20
 
17
21
  /**
18
22
  * Internal dependencies
@@ -92,7 +96,7 @@ export default function CreateNewTemplateModal( { onClose } ) {
92
96
  ] );
93
97
 
94
98
  const newTemplate = await createTemplate( {
95
- slug: cleanForSlug( title || DEFAULT_TITLE ),
99
+ slug: kebabCase( title || DEFAULT_TITLE ) || 'wp-custom-template',
96
100
  content: newTemplateContent,
97
101
  title: title || DEFAULT_TITLE,
98
102
  } );
@@ -111,6 +115,7 @@ export default function CreateNewTemplateModal( { onClose } ) {
111
115
  onRequestClose={ cancel }
112
116
  focusOnMount="firstContentElement"
113
117
  size="small"
118
+ overlayClassName="editor-post-template__create-template-modal"
114
119
  >
115
120
  <form
116
121
  className="editor-post-template__create-form"
@@ -13,7 +13,7 @@ import { useState } from '@wordpress/element';
13
13
  import CreateNewTemplateModal from './create-new-template-modal';
14
14
  import { useAllowSwitchingTemplates } from './hooks';
15
15
 
16
- export default function CreateNewTemplate( { onClick } ) {
16
+ export default function CreateNewTemplate() {
17
17
  const { canCreateTemplates } = useSelect( ( select ) => {
18
18
  const { canUser } = select( coreStore );
19
19
  return {
@@ -44,7 +44,6 @@ export default function CreateNewTemplate( { onClick } ) {
44
44
  <CreateNewTemplateModal
45
45
  onClose={ () => {
46
46
  setIsCreateModalOpen( false );
47
- onClick();
48
47
  } }
49
48
  />
50
49
  ) }
@@ -2,6 +2,10 @@
2
2
  z-index: z-index(".editor-post-template__swap-template-modal");
3
3
  }
4
4
 
5
+ .editor-post-template__create-template-modal {
6
+ z-index: z-index(".editor-post-template__create-template-modal");
7
+ }
8
+
5
9
  .editor-post-template__swap-template-modal-content .block-editor-block-patterns-list {
6
10
  column-count: 2;
7
11
  column-gap: $grid-unit-30;
@@ -40,9 +40,12 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
40
40
  isTemplateHidden,
41
41
  templateId,
42
42
  } = useSelect( ( select ) => {
43
- const { getDeviceType, getCurrentPostType, getCurrentTemplateId } =
44
- select( editorStore );
45
- const { getRenderingMode } = unlock( select( editorStore ) );
43
+ const {
44
+ getDeviceType,
45
+ getCurrentPostType,
46
+ getCurrentTemplateId,
47
+ getRenderingMode,
48
+ } = select( editorStore );
46
49
  const { getEntityRecord, getPostType } = select( coreStore );
47
50
  const { get } = select( preferencesStore );
48
51
  const _currentPostType = getCurrentPostType();
@@ -17,6 +17,7 @@ import { store as interfaceStore } from '@wordpress/interface';
17
17
  /**
18
18
  * Internal dependencies
19
19
  */
20
+ import { TEMPLATE_POST_TYPE } from '../../store/constants';
20
21
  import { store as editorStore } from '../../store';
21
22
 
22
23
  export function useStartPatterns() {
@@ -152,7 +153,8 @@ export default function StartPageOptions() {
152
153
  return {
153
154
  postId: getCurrentPostId(),
154
155
  enabled:
155
- choosePatternModalEnabled && 'page' === getCurrentPostType(),
156
+ choosePatternModalEnabled &&
157
+ TEMPLATE_POST_TYPE !== getCurrentPostType(),
156
158
  };
157
159
  }, [] );
158
160