@wordpress/editor 14.18.0 → 14.19.1

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 (160) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +2 -0
  3. package/build/components/document-bar/index.js +3 -2
  4. package/build/components/document-bar/index.js.map +1 -1
  5. package/build/components/document-outline/index.js +37 -17
  6. package/build/components/document-outline/index.js.map +1 -1
  7. package/build/components/document-outline/item.js +32 -20
  8. package/build/components/document-outline/item.js.map +1 -1
  9. package/build/components/entities-saved-states/entity-record-item.js +4 -3
  10. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  11. package/build/components/entities-saved-states/entity-type-list.js +2 -1
  12. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  13. package/build/components/entities-saved-states/index.js +66 -42
  14. package/build/components/entities-saved-states/index.js.map +1 -1
  15. package/build/components/post-actions/index.js +19 -28
  16. package/build/components/post-actions/index.js.map +1 -1
  17. package/build/components/post-card-panel/index.js +5 -5
  18. package/build/components/post-card-panel/index.js.map +1 -1
  19. package/build/components/post-featured-image/index.js +4 -2
  20. package/build/components/post-featured-image/index.js.map +1 -1
  21. package/build/components/post-template/block-theme.js +68 -48
  22. package/build/components/post-template/block-theme.js.map +1 -1
  23. package/build/components/post-template/classic-theme.js +30 -18
  24. package/build/components/post-template/classic-theme.js.map +1 -1
  25. package/build/components/post-template/create-new-template-modal.js +3 -1
  26. package/build/components/post-template/create-new-template-modal.js.map +1 -1
  27. package/build/components/post-template/panel.js +3 -11
  28. package/build/components/post-template/panel.js.map +1 -1
  29. package/build/components/preferences-modal/block-visibility.js +2 -1
  30. package/build/components/preferences-modal/block-visibility.js.map +1 -1
  31. package/build/components/preferences-modal/index.js +1 -1
  32. package/build/components/preferences-modal/index.js.map +1 -1
  33. package/build/components/preview-dropdown/index.js +6 -3
  34. package/build/components/preview-dropdown/index.js.map +1 -1
  35. package/build/components/provider/index.js +19 -18
  36. package/build/components/provider/index.js.map +1 -1
  37. package/build/components/sidebar/header.js +1 -1
  38. package/build/components/sidebar/header.js.map +1 -1
  39. package/build/components/sidebar/index.js +1 -1
  40. package/build/components/sidebar/index.js.map +1 -1
  41. package/build/components/start-page-options/index.js +148 -23
  42. package/build/components/start-page-options/index.js.map +1 -1
  43. package/build/components/visual-editor/edit-template-blocks-notification.js +1 -1
  44. package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  45. package/build/store/private-actions.js +29 -2
  46. package/build/store/private-actions.js.map +1 -1
  47. package/build/store/private-selectors.js +45 -1
  48. package/build/store/private-selectors.js.map +1 -1
  49. package/build/store/selectors.js +8 -7
  50. package/build/store/selectors.js.map +1 -1
  51. package/build/utils/media-upload/index.js +5 -2
  52. package/build/utils/media-upload/index.js.map +1 -1
  53. package/build-module/components/document-bar/index.js +3 -2
  54. package/build-module/components/document-bar/index.js.map +1 -1
  55. package/build-module/components/document-outline/index.js +38 -18
  56. package/build-module/components/document-outline/index.js.map +1 -1
  57. package/build-module/components/document-outline/item.js +32 -20
  58. package/build-module/components/document-outline/item.js.map +1 -1
  59. package/build-module/components/entities-saved-states/entity-record-item.js +4 -3
  60. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  61. package/build-module/components/entities-saved-states/entity-type-list.js +2 -1
  62. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  63. package/build-module/components/entities-saved-states/index.js +67 -43
  64. package/build-module/components/entities-saved-states/index.js.map +1 -1
  65. package/build-module/components/post-actions/index.js +19 -28
  66. package/build-module/components/post-actions/index.js.map +1 -1
  67. package/build-module/components/post-card-panel/index.js +5 -5
  68. package/build-module/components/post-card-panel/index.js.map +1 -1
  69. package/build-module/components/post-featured-image/index.js +4 -2
  70. package/build-module/components/post-featured-image/index.js.map +1 -1
  71. package/build-module/components/post-template/block-theme.js +68 -48
  72. package/build-module/components/post-template/block-theme.js.map +1 -1
  73. package/build-module/components/post-template/classic-theme.js +30 -18
  74. package/build-module/components/post-template/classic-theme.js.map +1 -1
  75. package/build-module/components/post-template/create-new-template-modal.js +3 -1
  76. package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
  77. package/build-module/components/post-template/panel.js +3 -11
  78. package/build-module/components/post-template/panel.js.map +1 -1
  79. package/build-module/components/preferences-modal/block-visibility.js +2 -1
  80. package/build-module/components/preferences-modal/block-visibility.js.map +1 -1
  81. package/build-module/components/preferences-modal/index.js +1 -1
  82. package/build-module/components/preferences-modal/index.js.map +1 -1
  83. package/build-module/components/preview-dropdown/index.js +6 -3
  84. package/build-module/components/preview-dropdown/index.js.map +1 -1
  85. package/build-module/components/provider/index.js +19 -18
  86. package/build-module/components/provider/index.js.map +1 -1
  87. package/build-module/components/sidebar/header.js +1 -1
  88. package/build-module/components/sidebar/header.js.map +1 -1
  89. package/build-module/components/sidebar/index.js +1 -1
  90. package/build-module/components/sidebar/index.js.map +1 -1
  91. package/build-module/components/start-page-options/index.js +148 -24
  92. package/build-module/components/start-page-options/index.js.map +1 -1
  93. package/build-module/components/visual-editor/edit-template-blocks-notification.js +1 -1
  94. package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  95. package/build-module/store/private-actions.js +25 -0
  96. package/build-module/store/private-actions.js.map +1 -1
  97. package/build-module/store/private-selectors.js +44 -1
  98. package/build-module/store/private-selectors.js.map +1 -1
  99. package/build-module/store/selectors.js +8 -7
  100. package/build-module/store/selectors.js.map +1 -1
  101. package/build-module/utils/media-upload/index.js +5 -2
  102. package/build-module/utils/media-upload/index.js.map +1 -1
  103. package/build-style/style-rtl.css +51 -9
  104. package/build-style/style.css +51 -9
  105. package/build-types/components/document-outline/index.d.ts.map +1 -1
  106. package/build-types/components/document-outline/item.d.ts +2 -1
  107. package/build-types/components/document-outline/item.d.ts.map +1 -1
  108. package/build-types/components/entities-saved-states/entity-record-item.d.ts.map +1 -1
  109. package/build-types/components/entities-saved-states/entity-type-list.d.ts.map +1 -1
  110. package/build-types/components/entities-saved-states/index.d.ts +6 -2
  111. package/build-types/components/entities-saved-states/index.d.ts.map +1 -1
  112. package/build-types/components/post-actions/index.d.ts.map +1 -1
  113. package/build-types/components/post-card-panel/index.d.ts.map +1 -1
  114. package/build-types/components/post-template/block-theme.d.ts.map +1 -1
  115. package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
  116. package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
  117. package/build-types/components/post-template/panel.d.ts.map +1 -1
  118. package/build-types/components/preferences-modal/block-visibility.d.ts.map +1 -1
  119. package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
  120. package/build-types/components/provider/index.d.ts.map +1 -1
  121. package/build-types/components/start-page-options/index.d.ts +2 -1
  122. package/build-types/components/start-page-options/index.d.ts.map +1 -1
  123. package/build-types/store/private-actions.d.ts +4 -0
  124. package/build-types/store/private-actions.d.ts.map +1 -1
  125. package/build-types/store/private-selectors.d.ts +13 -0
  126. package/build-types/store/private-selectors.d.ts.map +1 -1
  127. package/build-types/store/selectors.d.ts.map +1 -1
  128. package/build-types/utils/media-upload/index.d.ts +3 -1
  129. package/build-types/utils/media-upload/index.d.ts.map +1 -1
  130. package/package.json +37 -37
  131. package/src/components/document-bar/index.js +2 -2
  132. package/src/components/document-outline/index.js +49 -17
  133. package/src/components/document-outline/item.js +38 -23
  134. package/src/components/document-outline/style.scss +2 -0
  135. package/src/components/entities-saved-states/entity-record-item.js +2 -4
  136. package/src/components/entities-saved-states/entity-type-list.js +6 -2
  137. package/src/components/entities-saved-states/index.js +98 -58
  138. package/src/components/entities-saved-states/style.scss +40 -5
  139. package/src/components/post-actions/index.js +19 -37
  140. package/src/components/post-card-panel/index.js +9 -7
  141. package/src/components/post-featured-image/index.js +2 -0
  142. package/src/components/post-template/block-theme.js +76 -56
  143. package/src/components/post-template/classic-theme.js +31 -15
  144. package/src/components/post-template/create-new-template-modal.js +1 -0
  145. package/src/components/post-template/panel.js +2 -12
  146. package/src/components/post-text-editor/style.scss +0 -2
  147. package/src/components/preferences-modal/block-visibility.js +2 -1
  148. package/src/components/preferences-modal/index.js +1 -1
  149. package/src/components/preview-dropdown/index.js +8 -6
  150. package/src/components/provider/index.js +21 -30
  151. package/src/components/sidebar/header.js +1 -1
  152. package/src/components/sidebar/index.js +1 -1
  153. package/src/components/start-page-options/index.js +149 -23
  154. package/src/components/start-page-options/style.scss +27 -0
  155. package/src/components/visual-editor/edit-template-blocks-notification.js +1 -1
  156. package/src/store/private-actions.js +33 -0
  157. package/src/store/private-selectors.js +59 -4
  158. package/src/store/selectors.js +9 -14
  159. package/src/utils/media-upload/index.js +3 -0
  160. package/tsconfig.tsbuildinfo +1 -1
@@ -4,12 +4,18 @@
4
4
  import { useSelect, useDispatch } from '@wordpress/data';
5
5
  import { decodeEntities } from '@wordpress/html-entities';
6
6
  import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
7
+ import { useState, useMemo } from '@wordpress/element';
7
8
  import { __ } from '@wordpress/i18n';
8
9
  import { useEntityRecord, store as coreStore } from '@wordpress/core-data';
9
10
  import { check } from '@wordpress/icons';
10
11
  import { store as noticesStore } from '@wordpress/notices';
11
12
  import { store as preferencesStore } from '@wordpress/preferences';
12
13
 
14
+ /**
15
+ * Internal dependencies
16
+ */
17
+ import PostPanelRow from '../post-panel-row';
18
+
13
19
  /**
14
20
  * Internal dependencies
15
21
  */
@@ -19,10 +25,6 @@ import ResetDefaultTemplate from './reset-default-template';
19
25
  import { unlock } from '../../lock-unlock';
20
26
  import CreateNewTemplate from './create-new-template';
21
27
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
22
- const POPOVER_PROPS = {
23
- className: 'editor-post-template__dropdown',
24
- placement: 'bottom-start'
25
- };
26
28
  export default function BlockThemeControl({
27
29
  id
28
30
  }) {
@@ -55,12 +57,24 @@ export default function BlockThemeControl({
55
57
  createSuccessNotice
56
58
  } = useDispatch(noticesStore);
57
59
  const {
58
- setRenderingMode
59
- } = useDispatch(editorStore);
60
+ setRenderingMode,
61
+ setDefaultRenderingMode
62
+ } = unlock(useDispatch(editorStore));
60
63
  const canCreateTemplate = useSelect(select => !!select(coreStore).canUser('create', {
61
64
  kind: 'postType',
62
65
  name: 'wp_template'
63
66
  }), []);
67
+ const [popoverAnchor, setPopoverAnchor] = useState(null);
68
+ // Memoize popoverProps to avoid returning a new object every time.
69
+ const popoverProps = useMemo(() => ({
70
+ // Anchor the popover to the middle of the entire row so that it doesn't
71
+ // move around when the label changes.
72
+ anchor: popoverAnchor,
73
+ className: 'editor-post-template__dropdown',
74
+ placement: 'left-start',
75
+ offset: 36,
76
+ shift: true
77
+ }), [popoverAnchor]);
64
78
  if (!hasResolved) {
65
79
  return null;
66
80
  }
@@ -79,49 +93,55 @@ export default function BlockThemeControl({
79
93
  });
80
94
  }
81
95
  };
82
- return /*#__PURE__*/_jsx(DropdownMenu, {
83
- popoverProps: POPOVER_PROPS,
84
- focusOnMount: true,
85
- toggleProps: {
86
- size: 'compact',
87
- variant: 'tertiary',
88
- tooltipPosition: 'middle left'
89
- },
90
- label: __('Template options'),
91
- text: decodeEntities(template.title),
92
- icon: null,
93
- children: ({
94
- onClose
95
- }) => /*#__PURE__*/_jsxs(_Fragment, {
96
- children: [/*#__PURE__*/_jsxs(MenuGroup, {
97
- children: [canCreateTemplate && /*#__PURE__*/_jsx(MenuItem, {
98
- onClick: () => {
99
- onNavigateToEntityRecord({
100
- postId: template.id,
101
- postType: 'wp_template'
102
- });
103
- onClose();
104
- mayShowTemplateEditNotice();
105
- },
106
- children: __('Edit template')
107
- }), /*#__PURE__*/_jsx(SwapTemplateButton, {
108
- onClick: onClose
109
- }), /*#__PURE__*/_jsx(ResetDefaultTemplate, {
110
- onClick: onClose
111
- }), canCreateTemplate && /*#__PURE__*/_jsx(CreateNewTemplate, {
112
- onClick: onClose
96
+ return /*#__PURE__*/_jsx(PostPanelRow, {
97
+ label: __('Template'),
98
+ ref: setPopoverAnchor,
99
+ children: /*#__PURE__*/_jsx(DropdownMenu, {
100
+ popoverProps: popoverProps,
101
+ focusOnMount: true,
102
+ toggleProps: {
103
+ size: 'compact',
104
+ variant: 'tertiary',
105
+ tooltipPosition: 'middle left'
106
+ },
107
+ label: __('Template options'),
108
+ text: decodeEntities(template.title),
109
+ icon: null,
110
+ children: ({
111
+ onClose
112
+ }) => /*#__PURE__*/_jsxs(_Fragment, {
113
+ children: [/*#__PURE__*/_jsxs(MenuGroup, {
114
+ children: [canCreateTemplate && /*#__PURE__*/_jsx(MenuItem, {
115
+ onClick: () => {
116
+ onNavigateToEntityRecord({
117
+ postId: template.id,
118
+ postType: 'wp_template'
119
+ });
120
+ onClose();
121
+ mayShowTemplateEditNotice();
122
+ },
123
+ children: __('Edit template')
124
+ }), /*#__PURE__*/_jsx(SwapTemplateButton, {
125
+ onClick: onClose
126
+ }), /*#__PURE__*/_jsx(ResetDefaultTemplate, {
127
+ onClick: onClose
128
+ }), canCreateTemplate && /*#__PURE__*/_jsx(CreateNewTemplate, {
129
+ onClick: onClose
130
+ })]
131
+ }), /*#__PURE__*/_jsx(MenuGroup, {
132
+ children: /*#__PURE__*/_jsx(MenuItem, {
133
+ icon: !isTemplateHidden ? check : undefined,
134
+ isSelected: !isTemplateHidden,
135
+ role: "menuitemcheckbox",
136
+ onClick: () => {
137
+ const newRenderingMode = isTemplateHidden ? 'template-locked' : 'post-only';
138
+ setRenderingMode(newRenderingMode);
139
+ setDefaultRenderingMode(newRenderingMode);
140
+ },
141
+ children: __('Show template')
142
+ })
113
143
  })]
114
- }), /*#__PURE__*/_jsx(MenuGroup, {
115
- children: /*#__PURE__*/_jsx(MenuItem, {
116
- icon: !isTemplateHidden ? check : undefined,
117
- isSelected: !isTemplateHidden,
118
- role: "menuitemcheckbox",
119
- onClick: () => {
120
- setRenderingMode(isTemplateHidden ? 'template-locked' : 'post-only');
121
- },
122
- children: __('Show template')
123
- })
124
- })]
144
+ })
125
145
  })
126
146
  });
127
147
  }
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","decodeEntities","DropdownMenu","MenuGroup","MenuItem","__","useEntityRecord","store","coreStore","check","noticesStore","preferencesStore","editorStore","SwapTemplateButton","ResetDefaultTemplate","unlock","CreateNewTemplate","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","POPOVER_PROPS","className","placement","BlockThemeControl","id","isTemplateHidden","onNavigateToEntityRecord","getEditorSettings","hasGoBack","select","getRenderingMode","_getEditorSettings","editorSettings","hasOwnProperty","get","getPreference","editedRecord","template","hasResolved","createSuccessNotice","setRenderingMode","canCreateTemplate","canUser","kind","name","notificationAction","label","onClick","onNavigateToPreviousEntityRecord","undefined","mayShowTemplateEditNotice","type","actions","popoverProps","focusOnMount","toggleProps","size","variant","tooltipPosition","text","title","icon","children","onClose","postId","postType","isSelected","role"],"sources":["@wordpress/editor/src/components/post-template/block-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecord, store as coreStore } from '@wordpress/core-data';\nimport { check } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport SwapTemplateButton from './swap-template-button';\nimport ResetDefaultTemplate from './reset-default-template';\nimport { unlock } from '../../lock-unlock';\nimport CreateNewTemplate from './create-new-template';\n\nconst POPOVER_PROPS = {\n\tclassName: 'editor-post-template__dropdown',\n\tplacement: 'bottom-start',\n};\n\nexport default function BlockThemeControl( { id } ) {\n\tconst {\n\t\tisTemplateHidden,\n\t\tonNavigateToEntityRecord,\n\t\tgetEditorSettings,\n\t\thasGoBack,\n\t} = useSelect( ( select ) => {\n\t\tconst { getRenderingMode, getEditorSettings: _getEditorSettings } =\n\t\t\tunlock( select( editorStore ) );\n\t\tconst editorSettings = _getEditorSettings();\n\t\treturn {\n\t\t\tisTemplateHidden: getRenderingMode() === 'post-only',\n\t\t\tonNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord,\n\t\t\tgetEditorSettings: _getEditorSettings,\n\t\t\thasGoBack: editorSettings.hasOwnProperty(\n\t\t\t\t'onNavigateToPreviousEntityRecord'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst { get: getPreference } = useSelect( preferencesStore );\n\n\tconst { editedRecord: template, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'wp_template',\n\t\tid\n\t);\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst { setRenderingMode } = useDispatch( editorStore );\n\n\tconst canCreateTemplate = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ),\n\t\t[]\n\t);\n\n\tif ( ! hasResolved ) {\n\t\treturn null;\n\t}\n\n\t// The site editor does not have a `onNavigateToPreviousEntityRecord` setting as it uses its own routing\n\t// and assigns its own backlink to focusMode pages.\n\tconst notificationAction = hasGoBack\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord(),\n\t\t\t\t},\n\t\t ]\n\t\t: undefined;\n\n\tconst mayShowTemplateEditNotice = () => {\n\t\tif ( ! getPreference( 'core/edit-site', 'welcomeGuideTemplate' ) ) {\n\t\t\tcreateSuccessNotice(\n\t\t\t\t__(\n\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', actions: notificationAction }\n\t\t\t);\n\t\t}\n\t};\n\treturn (\n\t\t<DropdownMenu\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\tfocusOnMount\n\t\t\ttoggleProps={ {\n\t\t\t\tsize: 'compact',\n\t\t\t\tvariant: 'tertiary',\n\t\t\t\ttooltipPosition: 'middle left',\n\t\t\t} }\n\t\t\tlabel={ __( 'Template options' ) }\n\t\t\ttext={ decodeEntities( template.title ) }\n\t\t\ticon={ null }\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{ canCreateTemplate && (\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\tpostId: template.id,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\tmayShowTemplateEditNotice();\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{ __( 'Edit template' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t<SwapTemplateButton onClick={ onClose } />\n\t\t\t\t\t\t<ResetDefaultTemplate onClick={ onClose } />\n\t\t\t\t\t\t{ canCreateTemplate && (\n\t\t\t\t\t\t\t<CreateNewTemplate onClick={ onClose } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\ticon={ ! isTemplateHidden ? check : undefined }\n\t\t\t\t\t\t\tisSelected={ ! isTemplateHidden }\n\t\t\t\t\t\t\trole=\"menuitemcheckbox\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetRenderingMode(\n\t\t\t\t\t\t\t\t\tisTemplateHidden\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);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t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,kBAAkB;UACvBpB,OAAO,EAAGA,CAAA,KAAM;YACfP,gBAAgB,CACff,gBAAgB,GACb,iBAAiB,GACjB,WACJ,CAAC;UACF,CAAG;UAAAqC,QAAA,EAED5D,EAAE,CAAE,eAAgB;QAAC,CACd;MAAC,CACD,CAAC;IAAA,CACX;EACF,CACY,CAAC;AAEjB","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","useDispatch","decodeEntities","DropdownMenu","MenuGroup","MenuItem","useState","useMemo","__","useEntityRecord","store","coreStore","check","noticesStore","preferencesStore","PostPanelRow","editorStore","SwapTemplateButton","ResetDefaultTemplate","unlock","CreateNewTemplate","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","BlockThemeControl","id","isTemplateHidden","onNavigateToEntityRecord","getEditorSettings","hasGoBack","select","getRenderingMode","_getEditorSettings","editorSettings","hasOwnProperty","get","getPreference","editedRecord","template","hasResolved","createSuccessNotice","setRenderingMode","setDefaultRenderingMode","canCreateTemplate","canUser","kind","name","popoverAnchor","setPopoverAnchor","popoverProps","anchor","className","placement","offset","shift","notificationAction","label","onClick","onNavigateToPreviousEntityRecord","undefined","mayShowTemplateEditNotice","type","actions","ref","children","focusOnMount","toggleProps","size","variant","tooltipPosition","text","title","icon","onClose","postId","postType","isSelected","role","newRenderingMode"],"sources":["@wordpress/editor/src/components/post-template/block-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecord, store as coreStore } from '@wordpress/core-data';\nimport { check } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport PostPanelRow from '../post-panel-row';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport SwapTemplateButton from './swap-template-button';\nimport ResetDefaultTemplate from './reset-default-template';\nimport { unlock } from '../../lock-unlock';\nimport CreateNewTemplate from './create-new-template';\n\nexport default function BlockThemeControl( { id } ) {\n\tconst {\n\t\tisTemplateHidden,\n\t\tonNavigateToEntityRecord,\n\t\tgetEditorSettings,\n\t\thasGoBack,\n\t} = useSelect( ( select ) => {\n\t\tconst { getRenderingMode, getEditorSettings: _getEditorSettings } =\n\t\t\tunlock( select( editorStore ) );\n\t\tconst editorSettings = _getEditorSettings();\n\t\treturn {\n\t\t\tisTemplateHidden: getRenderingMode() === 'post-only',\n\t\t\tonNavigateToEntityRecord: editorSettings.onNavigateToEntityRecord,\n\t\t\tgetEditorSettings: _getEditorSettings,\n\t\t\thasGoBack: editorSettings.hasOwnProperty(\n\t\t\t\t'onNavigateToPreviousEntityRecord'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst { get: getPreference } = useSelect( preferencesStore );\n\n\tconst { editedRecord: template, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'wp_template',\n\t\tid\n\t);\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst { setRenderingMode, setDefaultRenderingMode } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\n\tconst canCreateTemplate = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ),\n\t\t[]\n\t);\n\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tclassName: 'editor-post-template__dropdown',\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tif ( ! hasResolved ) {\n\t\treturn null;\n\t}\n\n\t// The site editor does not have a `onNavigateToPreviousEntityRecord` setting as it uses its own routing\n\t// and assigns its own backlink to focusMode pages.\n\tconst notificationAction = hasGoBack\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord(),\n\t\t\t\t},\n\t\t ]\n\t\t: undefined;\n\n\tconst mayShowTemplateEditNotice = () => {\n\t\tif ( ! getPreference( 'core/edit-site', 'welcomeGuideTemplate' ) ) {\n\t\t\tcreateSuccessNotice(\n\t\t\t\t__(\n\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', actions: notificationAction }\n\t\t\t);\n\t\t}\n\t};\n\treturn (\n\t\t<PostPanelRow label={ __( 'Template' ) } ref={ setPopoverAnchor }>\n\t\t\t<DropdownMenu\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tfocusOnMount\n\t\t\t\ttoggleProps={ {\n\t\t\t\t\tsize: 'compact',\n\t\t\t\t\tvariant: 'tertiary',\n\t\t\t\t\ttooltipPosition: 'middle left',\n\t\t\t\t} }\n\t\t\t\tlabel={ __( 'Template options' ) }\n\t\t\t\ttext={ decodeEntities( template.title ) }\n\t\t\t\ticon={ null }\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ canCreateTemplate && (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\t\tpostId: template.id,\n\t\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\tmayShowTemplateEditNotice();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Edit template' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t<SwapTemplateButton onClick={ onClose } />\n\t\t\t\t\t\t\t<ResetDefaultTemplate onClick={ onClose } />\n\t\t\t\t\t\t\t{ canCreateTemplate && (\n\t\t\t\t\t\t\t\t<CreateNewTemplate onClick={ onClose } />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\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) }\n\t\t\t</DropdownMenu>\n\t\t</PostPanelRow>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,YAAY,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,uBAAuB;AACzE,SA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B,SAAS;UAAA+D,QAAA,eACT7C,IAAA,CAACjB,QAAQ;YACRsE,IAAI,EAAG,CAAE9C,gBAAgB,GAAGjB,KAAK,GAAGkD,SAAW;YAC/CiB,UAAU,EAAG,CAAElD,gBAAkB;YACjCmD,IAAI,EAAC,kBAAkB;YACvBpB,OAAO,EAAGA,CAAA,KAAM;cACf,MAAMqB,gBAAgB,GAAGpD,gBAAgB,GACtC,iBAAiB,GACjB,WAAW;cACde,gBAAgB,CAAEqC,gBAAiB,CAAC;cACpCpC,uBAAuB,CAAEoC,gBAAiB,CAAC;YAC5C,CAAG;YAAAd,QAAA,EAED3D,EAAE,CAAE,eAAgB;UAAC,CACd;QAAC,CACD,CAAC;MAAA,CACX;IACF,CACY;EAAC,CACF,CAAC;AAEjB","ignoreList":[]}
@@ -16,11 +16,8 @@ import { store as noticesStore } from '@wordpress/notices';
16
16
  import { store as editorStore } from '../../store';
17
17
  import CreateNewTemplateModal from './create-new-template-modal';
18
18
  import { useAllowSwitchingTemplates } from './hooks';
19
+ import PostPanelRow from '../post-panel-row';
19
20
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
- const POPOVER_PROPS = {
21
- className: 'editor-post-template__dropdown',
22
- placement: 'bottom-start'
23
- };
24
21
  function PostTemplateToggle({
25
22
  isOpen,
26
23
  onClick
@@ -167,20 +164,35 @@ function PostTemplateDropdownContent({
167
164
  });
168
165
  }
169
166
  function ClassicThemeControl() {
170
- return /*#__PURE__*/_jsx(Dropdown, {
171
- popoverProps: POPOVER_PROPS,
172
- focusOnMount: true,
173
- renderToggle: ({
174
- isOpen,
175
- onToggle
176
- }) => /*#__PURE__*/_jsx(PostTemplateToggle, {
177
- isOpen: isOpen,
178
- onClick: onToggle
179
- }),
180
- renderContent: ({
181
- onClose
182
- }) => /*#__PURE__*/_jsx(PostTemplateDropdownContent, {
183
- onClose: onClose
167
+ const [popoverAnchor, setPopoverAnchor] = useState(null);
168
+ // Memoize popoverProps to avoid returning a new object every time.
169
+ const popoverProps = useMemo(() => ({
170
+ // Anchor the popover to the middle of the entire row so that it doesn't
171
+ // move around when the label changes.
172
+ anchor: popoverAnchor,
173
+ className: 'editor-post-template__dropdown',
174
+ placement: 'left-start',
175
+ offset: 36,
176
+ shift: true
177
+ }), [popoverAnchor]);
178
+ return /*#__PURE__*/_jsx(PostPanelRow, {
179
+ label: __('Template'),
180
+ ref: setPopoverAnchor,
181
+ children: /*#__PURE__*/_jsx(Dropdown, {
182
+ popoverProps: popoverProps,
183
+ focusOnMount: true,
184
+ renderToggle: ({
185
+ isOpen,
186
+ onToggle
187
+ }) => /*#__PURE__*/_jsx(PostTemplateToggle, {
188
+ isOpen: isOpen,
189
+ onClick: onToggle
190
+ }),
191
+ renderContent: ({
192
+ onClose
193
+ }) => /*#__PURE__*/_jsx(PostTemplateDropdownContent, {
194
+ onClose: onClose
195
+ })
184
196
  })
185
197
  });
186
198
  }
@@ -1 +1 @@
1
- {"version":3,"names":["__","SelectControl","Dropdown","Button","Notice","useSelect","useDispatch","store","coreStore","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","useState","useMemo","addTemplate","noticesStore","editorStore","CreateNewTemplateModal","useAllowSwitchingTemplates","jsx","_jsx","jsxs","_jsxs","POPOVER_PROPS","className","placement","PostTemplateToggle","isOpen","onClick","templateTitle","select","templateSlug","getEditedPostAttribute","supportsTemplateMode","availableTemplates","getEditorSettings","template","canUser","kind","name","getCurrentTemplateId","title","slug","__next40pxDefaultSize","variant","children","PostTemplateDropdownContent","onClose","_options$find","_selectedOption$value","allowSwitchingTemplate","fetchedTemplates","selectedTemplateSlug","canCreate","canEdit","currentTemplateId","onNavigateToEntityRecord","getEntityRecords","editorSettings","canCreateTemplates","_currentTemplateId","post_type","getCurrentPostType","per_page","undefined","options","Object","entries","fromEntries","map","rendered","value","label","selectedOption","find","option","editPost","createSuccessNotice","isCreateModalOpen","setIsCreateModalOpen","help","actions","icon","status","isDismissible","__nextHasNoMarginBottom","hideLabelFromVision","onChange","postId","postType","type","onNavigateToPreviousEntityRecord","ClassicThemeControl","popoverProps","focusOnMount","renderToggle","onToggle","renderContent"],"sources":["@wordpress/editor/src/components/post-template/classic-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { SelectControl, Dropdown, Button, Notice } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { useState, useMemo } from '@wordpress/element';\nimport { addTemplate } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport CreateNewTemplateModal from './create-new-template-modal';\nimport { useAllowSwitchingTemplates } from './hooks';\n\nconst POPOVER_PROPS = {\n\tclassName: 'editor-post-template__dropdown',\n\tplacement: 'bottom-start',\n};\n\nfunction PostTemplateToggle( { isOpen, onClick } ) {\n\tconst templateTitle = useSelect( ( select ) => {\n\t\tconst templateSlug =\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' );\n\n\t\tconst { supportsTemplateMode, availableTemplates } =\n\t\t\tselect( editorStore ).getEditorSettings();\n\t\tif ( ! supportsTemplateMode && availableTemplates[ templateSlug ] ) {\n\t\t\treturn availableTemplates[ templateSlug ];\n\t\t}\n\t\tconst template =\n\t\t\tselect( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ) && select( editorStore ).getCurrentTemplateId();\n\t\treturn (\n\t\t\ttemplate?.title ||\n\t\t\ttemplate?.slug ||\n\t\t\tavailableTemplates?.[ templateSlug ]\n\t\t);\n\t}, [] );\n\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\taria-label={ __( 'Template options' ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ templateTitle ?? __( 'Default template' ) }\n\t\t</Button>\n\t);\n}\n\n/**\n * Renders the dropdown content for selecting a post template.\n *\n * @param {Object} props The component props.\n * @param {Function} props.onClose The function to close the dropdown.\n *\n * @return {React.ReactNode} The rendered dropdown content.\n */\nfunction PostTemplateDropdownContent( { onClose } ) {\n\tconst allowSwitchingTemplate = useAllowSwitchingTemplates();\n\tconst {\n\t\tavailableTemplates,\n\t\tfetchedTemplates,\n\t\tselectedTemplateSlug,\n\t\tcanCreate,\n\t\tcanEdit,\n\t\tcurrentTemplateId,\n\t\tonNavigateToEntityRecord,\n\t\tgetEditorSettings,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser, getEntityRecords } = select( coreStore );\n\t\t\tconst editorSettings = select( editorStore ).getEditorSettings();\n\t\t\tconst canCreateTemplates = canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} );\n\t\t\tconst _currentTemplateId =\n\t\t\t\tselect( editorStore ).getCurrentTemplateId();\n\t\t\treturn {\n\t\t\t\tavailableTemplates: editorSettings.availableTemplates,\n\t\t\t\tfetchedTemplates: canCreateTemplates\n\t\t\t\t\t? getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\t\t\t\tpost_type:\n\t\t\t\t\t\t\t\tselect( editorStore ).getCurrentPostType(),\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t } )\n\t\t\t\t\t: undefined,\n\t\t\t\tselectedTemplateSlug:\n\t\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' ),\n\t\t\t\tcanCreate:\n\t\t\t\t\tallowSwitchingTemplate &&\n\t\t\t\t\tcanCreateTemplates &&\n\t\t\t\t\teditorSettings.supportsTemplateMode,\n\t\t\t\tcanEdit:\n\t\t\t\t\tallowSwitchingTemplate &&\n\t\t\t\t\tcanCreateTemplates &&\n\t\t\t\t\teditorSettings.supportsTemplateMode &&\n\t\t\t\t\t!! _currentTemplateId,\n\t\t\t\tcurrentTemplateId: _currentTemplateId,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\teditorSettings.onNavigateToEntityRecord,\n\t\t\t\tgetEditorSettings: select( editorStore ).getEditorSettings,\n\t\t\t};\n\t\t},\n\t\t[ allowSwitchingTemplate ]\n\t);\n\n\tconst options = useMemo(\n\t\t() =>\n\t\t\tObject.entries( {\n\t\t\t\t...availableTemplates,\n\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t( fetchedTemplates ?? [] ).map( ( { slug, title } ) => [\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\ttitle.rendered,\n\t\t\t\t\t] )\n\t\t\t\t),\n\t\t\t} ).map( ( [ slug, title ] ) => ( { value: slug, label: title } ) ),\n\t\t[ availableTemplates, fetchedTemplates ]\n\t);\n\n\tconst selectedOption =\n\t\toptions.find( ( option ) => option.value === selectedTemplateSlug ) ??\n\t\toptions.find( ( option ) => ! option.value ); // The default option has '' value.\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst [ isCreateModalOpen, setIsCreateModalOpen ] = useState( false );\n\n\treturn (\n\t\t<div className=\"editor-post-template__classic-theme-dropdown\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Template' ) }\n\t\t\t\thelp={ __(\n\t\t\t\t\t'Templates define the way content is displayed when viewing your site.'\n\t\t\t\t) }\n\t\t\t\tactions={\n\t\t\t\t\tcanCreate\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ticon: addTemplate,\n\t\t\t\t\t\t\t\t\tlabel: __( 'Add template' ),\n\t\t\t\t\t\t\t\t\tonClick: () => setIsCreateModalOpen( true ),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t ]\n\t\t\t\t\t\t: []\n\t\t\t\t}\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t{ ! allowSwitchingTemplate ? (\n\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t{ __( 'The posts page template cannot be changed.' ) }\n\t\t\t\t</Notice>\n\t\t\t) : (\n\t\t\t\t<SelectControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tlabel={ __( 'Template' ) }\n\t\t\t\t\tvalue={ selectedOption?.value ?? '' }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\tonChange={ ( slug ) =>\n\t\t\t\t\t\teditPost( { template: slug || '' } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ canEdit && onNavigateToEntityRecord && (\n\t\t\t\t<p>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\tpostId: currentTemplateId,\n\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\t\t\t\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\t\t\t\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord(),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Edit template' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t{ isCreateModalOpen && (\n\t\t\t\t<CreateNewTemplateModal\n\t\t\t\t\tonClose={ () => setIsCreateModalOpen( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nfunction ClassicThemeControl() {\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\tfocusOnMount\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<PostTemplateToggle isOpen={ isOpen } onClick={ onToggle } />\n\t\t\t) }\n\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t<PostTemplateDropdownContent onClose={ onClose } />\n\t\t\t) }\n\t\t/>\n\t);\n}\n\n/**\n * Provides a dropdown menu for selecting and managing post templates.\n *\n * The dropdown menu includes a button for toggling the menu, a list of available templates, and options for creating and editing templates.\n *\n * @return {React.ReactNode} The rendered ClassicThemeControl component.\n */\nexport default ClassicThemeControl;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,aAAa,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,MAAM,QAAQ,uBAAuB;AAC/E,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,oCAAoC,IAAIC,sBAAsB,QAAQ,yBAAyB;AACxG,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,WAAW,QAAQ,kBAAkB;AAC9C,SAASN,KAAK,IAAIO,YAAY,QAAQ,oBAAoB;;AAE1D;AACA;AACA;AACA,SAASP,KAAK,IAAIQ,WAAW,QAAQ,aAAa;AAClD,OAAOC,sBAAsB,MAAM,6BAA6B;AAChE,SAASC,0BAA0B,QAAQ,SAAS;AAAC,SAAAC,GA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,CAAE,SAAU,CAAC;cACtB2B,OAAO,EAAEA,CAAA,KACRO,iBAAiB,CAAC,CAAC,CAACwD,gCAAgC,CAAC;YACvD,CAAC;UAEH,CACD,CAAC;QACF,CAAG;QAAA9C,QAAA,EAED5C,EAAE,CAAE,eAAgB;MAAC,CAChB;IAAC,CACP,CACH,EACC6E,iBAAiB,iBAClB1D,IAAA,CAACH,sBAAsB;MACtB8B,OAAO,EAAGA,CAAA,KAAMgC,oBAAoB,CAAE,KAAM;IAAG,CAC/C,CACD;EAAA,CACG,CAAC;AAER;AAEA,SAASa,mBAAmBA,CAAA,EAAG;EAC9B,oBACCxE,IAAA,CAACjB,QAAQ;IACR0F,YAAY,EAAGtE,aAAe;IAC9BuE,YAAY;IACZC,YAAY,EAAGA,CAAE;MAAEpE,MAAM;MAAEqE;IAAS,CAAC,kBACpC5E,IAAA,CAACM,kBAAkB;MAACC,MAAM,EAAGA,MAAQ;MAACC,OAAO,EAAGoE;IAAU,CAAE,CAC1D;IACHC,aAAa,EAAGA,CAAE;MAAElD;IAAQ,CAAC,kBAC5B3B,IAAA,CAAC0B,2BAA2B;MAACC,OAAO,EAAGA;IAAS,CAAE;EAChD,CACH,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe6C,mBAAmB","ignoreList":[]}
1
+ {"version":3,"names":["__","SelectControl","Dropdown","Button","Notice","useSelect","useDispatch","store","coreStore","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","useState","useMemo","addTemplate","noticesStore","editorStore","CreateNewTemplateModal","useAllowSwitchingTemplates","PostPanelRow","jsx","_jsx","jsxs","_jsxs","PostTemplateToggle","isOpen","onClick","templateTitle","select","templateSlug","getEditedPostAttribute","supportsTemplateMode","availableTemplates","getEditorSettings","template","canUser","kind","name","getCurrentTemplateId","title","slug","__next40pxDefaultSize","variant","children","PostTemplateDropdownContent","onClose","_options$find","_selectedOption$value","allowSwitchingTemplate","fetchedTemplates","selectedTemplateSlug","canCreate","canEdit","currentTemplateId","onNavigateToEntityRecord","getEntityRecords","editorSettings","canCreateTemplates","_currentTemplateId","post_type","getCurrentPostType","per_page","undefined","options","Object","entries","fromEntries","map","rendered","value","label","selectedOption","find","option","editPost","createSuccessNotice","isCreateModalOpen","setIsCreateModalOpen","className","help","actions","icon","status","isDismissible","__nextHasNoMarginBottom","hideLabelFromVision","onChange","postId","postType","type","onNavigateToPreviousEntityRecord","ClassicThemeControl","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","ref","focusOnMount","renderToggle","onToggle","renderContent"],"sources":["@wordpress/editor/src/components/post-template/classic-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { SelectControl, Dropdown, Button, Notice } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { useState, useMemo } from '@wordpress/element';\nimport { addTemplate } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport CreateNewTemplateModal from './create-new-template-modal';\nimport { useAllowSwitchingTemplates } from './hooks';\nimport PostPanelRow from '../post-panel-row';\n\nfunction PostTemplateToggle( { isOpen, onClick } ) {\n\tconst templateTitle = useSelect( ( select ) => {\n\t\tconst templateSlug =\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' );\n\n\t\tconst { supportsTemplateMode, availableTemplates } =\n\t\t\tselect( editorStore ).getEditorSettings();\n\t\tif ( ! supportsTemplateMode && availableTemplates[ templateSlug ] ) {\n\t\t\treturn availableTemplates[ templateSlug ];\n\t\t}\n\t\tconst template =\n\t\t\tselect( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ) && select( editorStore ).getCurrentTemplateId();\n\t\treturn (\n\t\t\ttemplate?.title ||\n\t\t\ttemplate?.slug ||\n\t\t\tavailableTemplates?.[ templateSlug ]\n\t\t);\n\t}, [] );\n\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\taria-label={ __( 'Template options' ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ templateTitle ?? __( 'Default template' ) }\n\t\t</Button>\n\t);\n}\n\n/**\n * Renders the dropdown content for selecting a post template.\n *\n * @param {Object} props The component props.\n * @param {Function} props.onClose The function to close the dropdown.\n *\n * @return {React.ReactNode} The rendered dropdown content.\n */\nfunction PostTemplateDropdownContent( { onClose } ) {\n\tconst allowSwitchingTemplate = useAllowSwitchingTemplates();\n\tconst {\n\t\tavailableTemplates,\n\t\tfetchedTemplates,\n\t\tselectedTemplateSlug,\n\t\tcanCreate,\n\t\tcanEdit,\n\t\tcurrentTemplateId,\n\t\tonNavigateToEntityRecord,\n\t\tgetEditorSettings,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser, getEntityRecords } = select( coreStore );\n\t\t\tconst editorSettings = select( editorStore ).getEditorSettings();\n\t\t\tconst canCreateTemplates = canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} );\n\t\t\tconst _currentTemplateId =\n\t\t\t\tselect( editorStore ).getCurrentTemplateId();\n\t\t\treturn {\n\t\t\t\tavailableTemplates: editorSettings.availableTemplates,\n\t\t\t\tfetchedTemplates: canCreateTemplates\n\t\t\t\t\t? getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\t\t\t\tpost_type:\n\t\t\t\t\t\t\t\tselect( editorStore ).getCurrentPostType(),\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t } )\n\t\t\t\t\t: undefined,\n\t\t\t\tselectedTemplateSlug:\n\t\t\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' ),\n\t\t\t\tcanCreate:\n\t\t\t\t\tallowSwitchingTemplate &&\n\t\t\t\t\tcanCreateTemplates &&\n\t\t\t\t\teditorSettings.supportsTemplateMode,\n\t\t\t\tcanEdit:\n\t\t\t\t\tallowSwitchingTemplate &&\n\t\t\t\t\tcanCreateTemplates &&\n\t\t\t\t\teditorSettings.supportsTemplateMode &&\n\t\t\t\t\t!! _currentTemplateId,\n\t\t\t\tcurrentTemplateId: _currentTemplateId,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\teditorSettings.onNavigateToEntityRecord,\n\t\t\t\tgetEditorSettings: select( editorStore ).getEditorSettings,\n\t\t\t};\n\t\t},\n\t\t[ allowSwitchingTemplate ]\n\t);\n\n\tconst options = useMemo(\n\t\t() =>\n\t\t\tObject.entries( {\n\t\t\t\t...availableTemplates,\n\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t( fetchedTemplates ?? [] ).map( ( { slug, title } ) => [\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\ttitle.rendered,\n\t\t\t\t\t] )\n\t\t\t\t),\n\t\t\t} ).map( ( [ slug, title ] ) => ( { value: slug, label: title } ) ),\n\t\t[ availableTemplates, fetchedTemplates ]\n\t);\n\n\tconst selectedOption =\n\t\toptions.find( ( option ) => option.value === selectedTemplateSlug ) ??\n\t\toptions.find( ( option ) => ! option.value ); // The default option has '' value.\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst [ isCreateModalOpen, setIsCreateModalOpen ] = useState( false );\n\n\treturn (\n\t\t<div className=\"editor-post-template__classic-theme-dropdown\">\n\t\t\t<InspectorPopoverHeader\n\t\t\t\ttitle={ __( 'Template' ) }\n\t\t\t\thelp={ __(\n\t\t\t\t\t'Templates define the way content is displayed when viewing your site.'\n\t\t\t\t) }\n\t\t\t\tactions={\n\t\t\t\t\tcanCreate\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ticon: addTemplate,\n\t\t\t\t\t\t\t\t\tlabel: __( 'Add template' ),\n\t\t\t\t\t\t\t\t\tonClick: () => setIsCreateModalOpen( true ),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t ]\n\t\t\t\t\t\t: []\n\t\t\t\t}\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t\t{ ! allowSwitchingTemplate ? (\n\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t{ __( 'The posts page template cannot be changed.' ) }\n\t\t\t\t</Notice>\n\t\t\t) : (\n\t\t\t\t<SelectControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tlabel={ __( 'Template' ) }\n\t\t\t\t\tvalue={ selectedOption?.value ?? '' }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\tonChange={ ( slug ) =>\n\t\t\t\t\t\teditPost( { template: slug || '' } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ canEdit && onNavigateToEntityRecord && (\n\t\t\t\t<p>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\tpostId: currentTemplateId,\n\t\t\t\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Editing template. Changes made here affect all posts and pages that use the template.'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tlabel: __( 'Go back' ),\n\t\t\t\t\t\t\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\t\t\t\t\t\t\tgetEditorSettings().onNavigateToPreviousEntityRecord(),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Edit template' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t{ isCreateModalOpen && (\n\t\t\t\t<CreateNewTemplateModal\n\t\t\t\t\tonClose={ () => setIsCreateModalOpen( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nfunction ClassicThemeControl() {\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tclassName: 'editor-post-template__dropdown',\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostPanelRow label={ __( 'Template' ) } ref={ setPopoverAnchor }>\n\t\t\t<Dropdown\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tfocusOnMount\n\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t<PostTemplateToggle\n\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t<PostTemplateDropdownContent onClose={ onClose } />\n\t\t\t\t) }\n\t\t\t/>\n\t\t</PostPanelRow>\n\t);\n}\n\n/**\n * Provides a dropdown menu for selecting and managing post templates.\n *\n * The dropdown menu includes a button for toggling the menu, a list of available templates, and options for creating and editing templates.\n *\n * @return {React.ReactNode} The rendered ClassicThemeControl component.\n */\nexport default ClassicThemeControl;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,aAAa,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,MAAM,QAAQ,uBAAuB;AAC/E,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,oCAAoC,IAAIC,sBAAsB,QAAQ,yBAAyB;AACxG,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,WAAW,QAAQ,kBAAkB;AAC9C,SAASN,KAAK,IAAIO,YAAY,QAAQ,oBAAoB;;AAE1D;AACA;AACA;AACA,SAASP,KAAK,IAAIQ,WAAW,QAAQ,aAAa;AAClD,OAAOC,sBAAsB,MAAM,6BAA6B;AAChE,SAASC,0BAA0B,QAAQ,SAAS;AACpD,OAAOC,YAAY,MAAM,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE7C,SAASC,kBAAkBA,CAAE;EAAEC,MAAM;EAAEC;AAAQ,CAAC,EAAG;EAClD,MAAMC,aAAa,GAAGrB,SAAS,CAAIsB,MAAM,IAAM;IAC9C,MAAMC,YAAY,GACjBD,MAAM,CAAEZ,WAAY,CAAC,CAACc,sBAAsB,CAAE,UAAW,CAAC;IAE3D,MAAM;MAAEC,oBAAoB;MAAEC;IAAmB,CAAC,GACjDJ,MAAM,CAAEZ,WAAY,CAAC,CAACiB,iBAAiB,CAAC,CAAC;IAC1C,IAAK,CAAEF,oBAAoB,IAAIC,kBAAkB,CAAEH,YAAY,CAAE,EAAG;MACnE,OAAOG,kBAAkB,CAAEH,YAAY,CAAE;IAC1C;IACA,MAAMK,QAAQ,GACbN,MAAM,CAAEnB,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AE,YAAY;IACvBC,MAAM,EAAE,EAAE;IACVC,KAAK,EAAE;EACR,CAAC,CAAE,EACH,CAAEN,aAAa,CAChB,CAAC;EAED,oBACCvE,IAAA,CAACF,YAAY;IAACmD,KAAK,EAAGrE,EAAE,CAAE,UAAW,CAAG;IAACkG,GAAG,EAAGN,gBAAkB;IAAAlD,QAAA,eAChEtB,IAAA,CAAClB,QAAQ;MACR2F,YAAY,EAAGA,YAAc;MAC7BM,YAAY;MACZC,YAAY,EAAGA,CAAE;QAAE5E,MAAM;QAAE6E;MAAS,CAAC,kBACpCjF,IAAA,CAACG,kBAAkB;QAClBC,MAAM,EAAGA,MAAQ;QACjBC,OAAO,EAAG4E;MAAU,CACpB,CACC;MACHC,aAAa,EAAGA,CAAE;QAAE1D;MAAQ,CAAC,kBAC5BxB,IAAA,CAACuB,2BAA2B;QAACC,OAAO,EAAGA;MAAS,CAAE;IAChD,CACH;EAAC,CACW,CAAC;AAEjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe8C,mBAAmB","ignoreList":[]}
@@ -93,7 +93,9 @@ export default function CreateNewTemplateModal({
93
93
  onChange: setTitle,
94
94
  placeholder: DEFAULT_TITLE,
95
95
  disabled: isBusy,
96
- help: __('Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.')
96
+ help: __(
97
+ // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts
98
+ 'Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.')
97
99
  }), /*#__PURE__*/_jsxs(HStack, {
98
100
  justify: "right",
99
101
  children: [/*#__PURE__*/_jsx(Button, {
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","useState","serialize","createBlock","Modal","TextControl","Button","__experimentalHStack","HStack","__experimentalVStack","VStack","__","cleanForSlug","unlock","store","editorStore","jsx","_jsx","jsxs","_jsxs","DEFAULT_TITLE","CreateNewTemplateModal","onClose","defaultBlockTemplate","onNavigateToEntityRecord","select","getEditorSettings","getCurrentTemplateId","getTemplateId","createTemplate","title","setTitle","isBusy","setIsBusy","cancel","submit","event","preventDefault","newTemplateContent","tagName","layout","inherit","newTemplate","slug","content","postId","id","postType","onRequestClose","focusOnMount","size","children","className","onSubmit","spacing","__next40pxDefaultSize","__nextHasNoMarginBottom","label","value","onChange","placeholder","disabled","help","justify","variant","onClick","type"],"sources":["@wordpress/editor/src/components/post-template/create-new-template-modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { serialize, createBlock } from '@wordpress/blocks';\nimport {\n\tModal,\n\tTextControl,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { cleanForSlug } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst DEFAULT_TITLE = __( 'Custom Template' );\n\nexport default function CreateNewTemplateModal( { onClose } ) {\n\tconst { defaultBlockTemplate, onNavigateToEntityRecord } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings, getCurrentTemplateId } =\n\t\t\t\tselect( editorStore );\n\t\t\treturn {\n\t\t\t\tdefaultBlockTemplate: getEditorSettings().defaultBlockTemplate,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetEditorSettings().onNavigateToEntityRecord,\n\t\t\t\tgetTemplateId: getCurrentTemplateId,\n\t\t\t};\n\t\t}\n\t);\n\n\tconst { createTemplate } = unlock( useDispatch( editorStore ) );\n\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst [ isBusy, setIsBusy ] = useState( false );\n\n\tconst cancel = () => {\n\t\tsetTitle( '' );\n\t\tonClose();\n\t};\n\n\tconst submit = async ( event ) => {\n\t\tevent.preventDefault();\n\n\t\tif ( isBusy ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsBusy( true );\n\n\t\tconst newTemplateContent =\n\t\t\tdefaultBlockTemplate ??\n\t\t\tserialize( [\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'header',\n\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/site-title' ),\n\t\t\t\t\t\tcreateBlock( 'core/site-tagline' ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t\tcreateBlock( 'core/separator' ),\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'main',\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t[ createBlock( 'core/post-title' ) ]\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcreateBlock( 'core/post-content', {\n\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t] );\n\n\t\tconst newTemplate = await createTemplate( {\n\t\t\tslug: cleanForSlug( title || DEFAULT_TITLE ),\n\t\t\tcontent: newTemplateContent,\n\t\t\ttitle: title || DEFAULT_TITLE,\n\t\t} );\n\n\t\tsetIsBusy( false );\n\t\tonNavigateToEntityRecord( {\n\t\t\tpostId: newTemplate.id,\n\t\t\tpostType: 'wp_template',\n\t\t} );\n\t\tcancel();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create custom template' ) }\n\t\t\tonRequestClose={ cancel }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form\n\t\t\t\tclassName=\"editor-post-template__create-form\"\n\t\t\t\tonSubmit={ submit }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ DEFAULT_TITLE }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Describe the template, e.g. \"Post with sidebar\". A custom template can be manually applied to any post or page.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ cancel }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\t\taria-disabled={ isBusy }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,mBAAmB;AAC1D,SACCC,KAAK,EACLC,WAAW,EACXC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,QAC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KAAA,CAACT,MAAM;QAAC4C,OAAO,EAAC,GAAG;QAAAH,QAAA,gBAClBlC,IAAA,CAACZ,WAAW;UACXkD,qBAAqB;UACrBC,uBAAuB;UACvBC,KAAK,EAAG9C,EAAE,CAAE,MAAO,CAAG;UACtB+C,KAAK,EAAG5B,KAAO;UACf6B,QAAQ,EAAG5B,QAAU;UACrB6B,WAAW,EAAGxC,aAAe;UAC7ByC,QAAQ,EAAG7B,MAAQ;UACnB8B,IAAI,EAAGnD,EAAE,CACR,iHACD;QAAG,CACH,CAAC,eACFQ,KAAA,CAACX,MAAM;UAACuD,OAAO,EAAC,OAAO;UAAAZ,QAAA,gBACtBlC,IAAA,CAACX,MAAM;YACNiD,qBAAqB;YACrBS,OAAO,EAAC,UAAU;YAClBC,OAAO,EAAG/B,MAAQ;YAAAiB,QAAA,EAEhBxC,EAAE,CAAE,QAAS;UAAC,CACT,CAAC,eAETM,IAAA,CAACX,MAAM;YACNiD,qBAAqB;YACrBS,OAAO,EAAC,SAAS;YACjBE,IAAI,EAAC,QAAQ;YACblC,MAAM,EAAGA,MAAQ;YACjB,iBAAgBA,MAAQ;YAAAmB,QAAA,EAEtBxC,EAAE,CAAE,QAAS;UAAC,CACT,CAAC;QAAA,CACF,CAAC;MAAA,CACF;IAAC,CACJ;EAAC,CACD,CAAC;AAEV","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","useDispatch","useState","serialize","createBlock","Modal","TextControl","Button","__experimentalHStack","HStack","__experimentalVStack","VStack","__","cleanForSlug","unlock","store","editorStore","jsx","_jsx","jsxs","_jsxs","DEFAULT_TITLE","CreateNewTemplateModal","onClose","defaultBlockTemplate","onNavigateToEntityRecord","select","getEditorSettings","getCurrentTemplateId","getTemplateId","createTemplate","title","setTitle","isBusy","setIsBusy","cancel","submit","event","preventDefault","newTemplateContent","tagName","layout","inherit","newTemplate","slug","content","postId","id","postType","onRequestClose","focusOnMount","size","children","className","onSubmit","spacing","__next40pxDefaultSize","__nextHasNoMarginBottom","label","value","onChange","placeholder","disabled","help","justify","variant","onClick","type"],"sources":["@wordpress/editor/src/components/post-template/create-new-template-modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { serialize, createBlock } from '@wordpress/blocks';\nimport {\n\tModal,\n\tTextControl,\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { cleanForSlug } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst DEFAULT_TITLE = __( 'Custom Template' );\n\nexport default function CreateNewTemplateModal( { onClose } ) {\n\tconst { defaultBlockTemplate, onNavigateToEntityRecord } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings, getCurrentTemplateId } =\n\t\t\t\tselect( editorStore );\n\t\t\treturn {\n\t\t\t\tdefaultBlockTemplate: getEditorSettings().defaultBlockTemplate,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetEditorSettings().onNavigateToEntityRecord,\n\t\t\t\tgetTemplateId: getCurrentTemplateId,\n\t\t\t};\n\t\t}\n\t);\n\n\tconst { createTemplate } = unlock( useDispatch( editorStore ) );\n\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst [ isBusy, setIsBusy ] = useState( false );\n\n\tconst cancel = () => {\n\t\tsetTitle( '' );\n\t\tonClose();\n\t};\n\n\tconst submit = async ( event ) => {\n\t\tevent.preventDefault();\n\n\t\tif ( isBusy ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsBusy( true );\n\n\t\tconst newTemplateContent =\n\t\t\tdefaultBlockTemplate ??\n\t\t\tserialize( [\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'header',\n\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/site-title' ),\n\t\t\t\t\t\tcreateBlock( 'core/site-tagline' ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t\tcreateBlock( 'core/separator' ),\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'main',\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t[ createBlock( 'core/post-title' ) ]\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcreateBlock( 'core/post-content', {\n\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t] );\n\n\t\tconst newTemplate = await createTemplate( {\n\t\t\tslug: cleanForSlug( title || DEFAULT_TITLE ),\n\t\t\tcontent: newTemplateContent,\n\t\t\ttitle: title || DEFAULT_TITLE,\n\t\t} );\n\n\t\tsetIsBusy( false );\n\t\tonNavigateToEntityRecord( {\n\t\t\tpostId: newTemplate.id,\n\t\t\tpostType: 'wp_template',\n\t\t} );\n\t\tcancel();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create custom template' ) }\n\t\t\tonRequestClose={ cancel }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form\n\t\t\t\tclassName=\"editor-post-template__create-form\"\n\t\t\t\tonSubmit={ submit }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ DEFAULT_TITLE }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t// eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts\n\t\t\t\t\t\t\t'Describe the template, e.g. \"Post with sidebar\". A custom template can be manually applied to any post or page.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ cancel }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\t\taria-disabled={ isBusy }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,mBAAmB;AAC1D,SACCC,KAAK,EACLC,WAAW,EACXC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,QAAQ,gBAAgB;;AAE7C;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAA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AK,EAAG9C,EAAE,CAAE,MAAO,CAAG;UACtB+C,KAAK,EAAG5B,KAAO;UACf6B,QAAQ,EAAG5B,QAAU;UACrB6B,WAAW,EAAGxC,aAAe;UAC7ByC,QAAQ,EAAG7B,MAAQ;UACnB8B,IAAI,EAAGnD,EAAE;UACR;UACA,iHACD;QAAG,CACH,CAAC,eACFQ,KAAA,CAACX,MAAM;UAACuD,OAAO,EAAC,OAAO;UAAAZ,QAAA,gBACtBlC,IAAA,CAACX,MAAM;YACNiD,qBAAqB;YACrBS,OAAO,EAAC,UAAU;YAClBC,OAAO,EAAG/B,MAAQ;YAAAiB,QAAA,EAEhBxC,EAAE,CAAE,QAAS;UAAC,CACT,CAAC,eAETM,IAAA,CAACX,MAAM;YACNiD,qBAAqB;YACrBS,OAAO,EAAC,SAAS;YACjBE,IAAI,EAAC,QAAQ;YACblC,MAAM,EAAGA,MAAQ;YACjB,iBAAgBA,MAAQ;YAAAmB,QAAA,EAEtBxC,EAAE,CAAE,QAAS;UAAC,CACT,CAAC;QAAA,CACF,CAAC;MAAA,CACF;IAAC,CACJ;EAAC,CACD,CAAC;AAEV","ignoreList":[]}
@@ -2,7 +2,6 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { useSelect } from '@wordpress/data';
5
- import { __ } from '@wordpress/i18n';
6
5
  import { store as coreStore } from '@wordpress/core-data';
7
6
 
8
7
  /**
@@ -11,7 +10,6 @@ import { store as coreStore } from '@wordpress/core-data';
11
10
  import { store as editorStore } from '../../store';
12
11
  import ClassicThemeControl from './classic-theme';
13
12
  import BlockThemeControl from './block-theme';
14
- import PostPanelRow from '../post-panel-row';
15
13
 
16
14
  /**
17
15
  * Displays the template controls based on the current editor settings and user permissions.
@@ -62,17 +60,11 @@ export default function PostTemplatePanel() {
62
60
  })) !== null && _select$canUser2 !== void 0 ? _select$canUser2 : false;
63
61
  }, []);
64
62
  if ((!isBlockTheme || !canViewTemplates) && isVisible) {
65
- return /*#__PURE__*/_jsx(PostPanelRow, {
66
- label: __('Template'),
67
- children: /*#__PURE__*/_jsx(ClassicThemeControl, {})
68
- });
63
+ return /*#__PURE__*/_jsx(ClassicThemeControl, {});
69
64
  }
70
65
  if (isBlockTheme && !!templateId) {
71
- return /*#__PURE__*/_jsx(PostPanelRow, {
72
- label: __('Template'),
73
- children: /*#__PURE__*/_jsx(BlockThemeControl, {
74
- id: templateId
75
- })
66
+ return /*#__PURE__*/_jsx(BlockThemeControl, {
67
+ id: templateId
76
68
  });
77
69
  }
78
70
  return null;
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","__","store","coreStore","editorStore","ClassicThemeControl","BlockThemeControl","PostPanelRow","jsx","_jsx","PostTemplatePanel","templateId","isBlockTheme","select","getCurrentTemplateId","getEditorSettings","__unstableIsBlockBasedTheme","isVisible","_select$canUser","postTypeSlug","getCurrentPostType","postType","getPostType","viewable","settings","hasTemplates","availableTemplates","Object","keys","length","supportsTemplateMode","canCreateTemplates","canUser","kind","name","canViewTemplates","_select$canUser2","label","children","id"],"sources":["@wordpress/editor/src/components/post-template/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport ClassicThemeControl from './classic-theme';\nimport BlockThemeControl from './block-theme';\nimport PostPanelRow from '../post-panel-row';\n\n/**\n * Displays the template controls based on the current editor settings and user permissions.\n *\n * @return {React.ReactNode} The rendered PostTemplatePanel component.\n */\nexport default function PostTemplatePanel() {\n\tconst { templateId, isBlockTheme } = useSelect( ( select ) => {\n\t\tconst { getCurrentTemplateId, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t\tisBlockTheme: getEditorSettings().__unstableIsBlockBasedTheme,\n\t\t};\n\t}, [] );\n\n\tconst isVisible = useSelect( ( select ) => {\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\t\tif ( ! postType?.viewable ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst settings = select( editorStore ).getEditorSettings();\n\t\tconst hasTemplates =\n\t\t\t!! settings.availableTemplates &&\n\t\t\tObject.keys( settings.availableTemplates ).length > 0;\n\t\tif ( hasTemplates ) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif ( ! settings.supportsTemplateMode ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst canCreateTemplates =\n\t\t\tselect( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ) ?? false;\n\t\treturn canCreateTemplates;\n\t}, [] );\n\n\tconst canViewTemplates = useSelect( ( select ) => {\n\t\treturn (\n\t\t\tselect( coreStore ).canUser( 'read', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ) ?? false\n\t\t);\n\t}, [] );\n\n\tif ( ( ! isBlockTheme || ! canViewTemplates ) && isVisible ) {\n\t\treturn (\n\t\t\t<PostPanelRow label={ __( 'Template' ) }>\n\t\t\t\t<ClassicThemeControl />\n\t\t\t</PostPanelRow>\n\t\t);\n\t}\n\n\tif ( isBlockTheme && !! templateId ) {\n\t\treturn (\n\t\t\t<PostPanelRow label={ __( 'Template' ) }>\n\t\t\t\t<BlockThemeControl id={ templateId } />\n\t\t\t</PostPanelRow>\n\t\t);\n\t}\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAClD,OAAOC,mBAAmB,MAAM,iBAAiB;AACjD,OAAOC,iBAAiB,MAAM,eAAe;AAC7C,OAAO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CAAC,cAAAhB,eAAA,cAAAA,eAAA,GAAI,KAAK;IACb,OAAOa,kBAAkB;EAC1B,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMI,gBAAgB,GAAGnC,SAAS,CAAIa,MAAM,IAAM;IAAA,IAAAuB,gBAAA;IACjD,QAAAA,gBAAA,GACCvB,MAAM,CAAEV,SAAU,CAAC,CAAC6B,OAAO,CAAE,MAAM,EAAE;MACpCC,IAAI,EAAE,UAAU;MAChBC,IAAI,EAAE;IACP,CAAE,CAAC,cAAAE,gBAAA,cAAAA,gBAAA,GAAI,KAAK;EAEd,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAE,CAAExB,YAAY,IAAI,CAAEuB,gBAAgB,KAAMlB,SAAS,EAAG;IAC5D,oBACCR,IAAA,CAACF,YAAY;MAAC8B,KAAK,EAAGpC,EAAE,CAAE,UAAW,CAAG;MAAAqC,QAAA,eACvC7B,IAAA,CAACJ,mBAAmB,IAAE;IAAC,CACV,CAAC;EAEjB;EAEA,IAAKO,YAAY,IAAI,CAAC,CAAED,UAAU,EAAG;IACpC,oBACCF,IAAA,CAACF,YAAY;MAAC8B,KAAK,EAAGpC,EAAE,CAAE,UAAW,CAAG;MAAAqC,QAAA,eACvC7B,IAAA,CAACH,iBAAiB;QAACiC,EAAE,EAAG5B;MAAY,CAAE;IAAC,CAC1B,CAAC;EAEjB;EACA,OAAO,IAAI;AACZ","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","store","coreStore","editorStore","ClassicThemeControl","BlockThemeControl","jsx","_jsx","PostTemplatePanel","templateId","isBlockTheme","select","getCurrentTemplateId","getEditorSettings","__unstableIsBlockBasedTheme","isVisible","_select$canUser","postTypeSlug","getCurrentPostType","postType","getPostType","viewable","settings","hasTemplates","availableTemplates","Object","keys","length","supportsTemplateMode","canCreateTemplates","canUser","kind","name","canViewTemplates","_select$canUser2","id"],"sources":["@wordpress/editor/src/components/post-template/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport ClassicThemeControl from './classic-theme';\nimport BlockThemeControl from './block-theme';\n\n/**\n * Displays the template controls based on the current editor settings and user permissions.\n *\n * @return {React.ReactNode} The rendered PostTemplatePanel component.\n */\nexport default function PostTemplatePanel() {\n\tconst { templateId, isBlockTheme } = useSelect( ( select ) => {\n\t\tconst { getCurrentTemplateId, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t\tisBlockTheme: getEditorSettings().__unstableIsBlockBasedTheme,\n\t\t};\n\t}, [] );\n\n\tconst isVisible = useSelect( ( select ) => {\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\t\tif ( ! postType?.viewable ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst settings = select( editorStore ).getEditorSettings();\n\t\tconst hasTemplates =\n\t\t\t!! settings.availableTemplates &&\n\t\t\tObject.keys( settings.availableTemplates ).length > 0;\n\t\tif ( hasTemplates ) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif ( ! settings.supportsTemplateMode ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst canCreateTemplates =\n\t\t\tselect( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ) ?? false;\n\t\treturn canCreateTemplates;\n\t}, [] );\n\n\tconst canViewTemplates = useSelect( ( select ) => {\n\t\treturn (\n\t\t\tselect( coreStore ).canUser( 'read', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ) ?? false\n\t\t);\n\t}, [] );\n\n\tif ( ( ! isBlockTheme || ! canViewTemplates ) && isVisible ) {\n\t\treturn <ClassicThemeControl />;\n\t}\n\n\tif ( isBlockTheme && !! templateId ) {\n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AAY,EAAG;MACnB,OAAO,IAAI;IACZ;IAEA,IAAK,CAAED,QAAQ,CAACM,oBAAoB,EAAG;MACtC,OAAO,KAAK;IACb;IAEA,MAAMC,kBAAkB,IAAAb,eAAA,GACvBL,MAAM,CAAET,SAAU,CAAC,CAAC4B,OAAO,CAAE,QAAQ,EAAE;MACtCC,IAAI,EAAE,UAAU;MAChBC,IAAI,EAAE;IACP,CAAE,CAAC,cAAAhB,eAAA,cAAAA,eAAA,GAAI,KAAK;IACb,OAAOa,kBAAkB;EAC1B,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMI,gBAAgB,GAAGjC,SAAS,CAAIW,MAAM,IAAM;IAAA,IAAAuB,gBAAA;IACjD,QAAAA,gBAAA,GACCvB,MAAM,CAAET,SAAU,CAAC,CAAC4B,OAAO,CAAE,MAAM,EAAE;MACpCC,IAAI,EAAE,UAAU;MAChBC,IAAI,EAAE;IACP,CAAE,CAAC,cAAAE,gBAAA,cAAAA,gBAAA,GAAI,KAAK;EAEd,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAE,CAAExB,YAAY,IAAI,CAAEuB,gBAAgB,KAAMlB,SAAS,EAAG;IAC5D,oBAAOR,IAAA,CAACH,mBAAmB,IAAE,CAAC;EAC/B;EAEA,IAAKM,YAAY,IAAI,CAAC,CAAED,UAAU,EAAG;IACpC,oBAAOF,IAAA,CAACF,iBAAiB;MAAC8B,EAAE,EAAG1B;IAAY,CAAE,CAAC;EAC/C;EACA,OAAO,IAAI;AACZ","ignoreList":[]}
@@ -16,6 +16,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
16
16
  const {
17
17
  BlockManager
18
18
  } = unlock(blockEditorPrivateApis);
19
+ const EMPTY_ARRAY = [];
19
20
  export default function BlockVisibility() {
20
21
  const {
21
22
  showBlockTypes,
@@ -30,7 +31,7 @@ export default function BlockVisibility() {
30
31
  return {
31
32
  blockTypes: select(blocksStore).getBlockTypes(),
32
33
  allowedBlockTypes: select(editorStore).getEditorSettings().allowedBlockTypes,
33
- hiddenBlockTypes: (_select$get = select(preferencesStore).get('core', 'hiddenBlockTypes')) !== null && _select$get !== void 0 ? _select$get : []
34
+ hiddenBlockTypes: (_select$get = select(preferencesStore).get('core', 'hiddenBlockTypes')) !== null && _select$get !== void 0 ? _select$get : EMPTY_ARRAY
34
35
  };
35
36
  }, []);
36
37
  const allowedBlockTypes = useMemo(() => {
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","store","preferencesStore","hasBlockSupport","blocksStore","useMemo","privateApis","blockEditorPrivateApis","editorStore","unlock","jsx","_jsx","BlockManager","BlockVisibility","showBlockTypes","hideBlockTypes","blockTypes","allowedBlockTypes","_allowedBlockTypes","hiddenBlockTypes","_hiddenBlockTypes","select","_select$get","getBlockTypes","getEditorSettings","get","filter","name","includes","filteredBlockTypes","blockType","parent","hiddenBlock","some","registeredBlock","selectedBlockTypes","onChangeSelectedBlockTypes","newSelectedBlockTypes","length","blockTypesToHide","find","map","blockTypesToShow","onChange"],"sources":["@wordpress/editor/src/components/preferences-modal/block-visibility.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { hasBlockSupport, store as blocksStore } from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { BlockManager } = unlock( blockEditorPrivateApis );\n\nexport default function BlockVisibility() {\n\tconst { showBlockTypes, hideBlockTypes } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\n\tconst {\n\t\tblockTypes,\n\t\tallowedBlockTypes: _allowedBlockTypes,\n\t\thiddenBlockTypes: _hiddenBlockTypes,\n\t} = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tblockTypes: select( blocksStore ).getBlockTypes(),\n\t\t\tallowedBlockTypes:\n\t\t\t\tselect( editorStore ).getEditorSettings().allowedBlockTypes,\n\t\t\thiddenBlockTypes:\n\t\t\t\tselect( preferencesStore ).get( 'core', 'hiddenBlockTypes' ) ??\n\t\t\t\t[],\n\t\t};\n\t}, [] );\n\n\tconst allowedBlockTypes = useMemo( () => {\n\t\tif ( _allowedBlockTypes === true ) {\n\t\t\treturn blockTypes;\n\t\t}\n\t\treturn blockTypes.filter( ( { name } ) => {\n\t\t\treturn _allowedBlockTypes?.includes( name );\n\t\t} );\n\t}, [ _allowedBlockTypes, blockTypes ] );\n\n\tconst filteredBlockTypes = allowedBlockTypes.filter(\n\t\t( blockType ) =>\n\t\t\thasBlockSupport( blockType, 'inserter', true ) &&\n\t\t\t( ! blockType.parent ||\n\t\t\t\tblockType.parent.includes( 'core/post-content' ) )\n\t);\n\n\t// Some hidden blocks become unregistered\n\t// by removing for instance the plugin that registered them, yet\n\t// they're still remain as hidden by the user's action.\n\t// We consider \"hidden\", blocks which were hidden and\n\t// are still registered.\n\tconst hiddenBlockTypes = _hiddenBlockTypes.filter( ( hiddenBlock ) => {\n\t\treturn filteredBlockTypes.some(\n\t\t\t( registeredBlock ) => registeredBlock.name === hiddenBlock\n\t\t);\n\t} );\n\n\tconst selectedBlockTypes = filteredBlockTypes.filter(\n\t\t( blockType ) => ! hiddenBlockTypes.includes( blockType.name )\n\t);\n\n\tconst onChangeSelectedBlockTypes = ( newSelectedBlockTypes ) => {\n\t\tif ( selectedBlockTypes.length > newSelectedBlockTypes.length ) {\n\t\t\tconst blockTypesToHide = selectedBlockTypes.filter(\n\t\t\t\t( blockType ) =>\n\t\t\t\t\t! newSelectedBlockTypes.find(\n\t\t\t\t\t\t( { name } ) => name === blockType.name\n\t\t\t\t\t)\n\t\t\t);\n\t\t\thideBlockTypes( blockTypesToHide.map( ( { name } ) => name ) );\n\t\t} else if ( selectedBlockTypes.length < newSelectedBlockTypes.length ) {\n\t\t\tconst blockTypesToShow = newSelectedBlockTypes.filter(\n\t\t\t\t( blockType ) =>\n\t\t\t\t\t! selectedBlockTypes.find(\n\t\t\t\t\t\t( { name } ) => name === blockType.name\n\t\t\t\t\t)\n\t\t\t);\n\t\t\tshowBlockTypes( blockTypesToShow.map( ( { name } ) => name ) );\n\t\t}\n\t};\n\n\treturn (\n\t\t<BlockManager\n\t\t\tblockTypes={ filteredBlockTypes }\n\t\t\tselectedBlockTypes={ selectedBlockTypes }\n\t\t\tonChange={ onChangeSelectedBlockTypes }\n\t\t/>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;AAClE,SAASC,eAAe,EAAEF,KAAK,IAAIG,WAAW,QAAQ,mBAAmB;AACzE,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;;AAE/E;AACA;AACA;AACA,SAASN,KAAK,IAAIO,WAAW,QAAQ,aAAa;AAClD,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3C,MAAM;EAAEC;AAAa,CAAC,GAAGH,MAAM,CAAEF,sBAAuB,CAAC;AAEzD,eAAe,SAASM,eAAeA,CAAA,EAAG;EACzC,MAAM;IAAEC,cAAc;IAAEC;EAAe,CAAC,GAAGN,MAAM,CAChDT,WAAW,CAAEQ,WAAY,CAC1B,CAAC;EAED,MAAM;IACLQ,UAAU;IACVC,iBAAiB,EAAEC,kBAAkB;IACrCC,gBAAgB,EAAEC;EACnB,CAAC,GAAGrB,SAAS,CAAIsB,MAAM,IAAM;IAAA,IAAAC,WAAA;IAC5B,OAAO;MACNN,UAAU,EAAEK,MAAM,CAAEjB,WAAY,CAAC,CAACmB,aAAa,CAAC,CAAC;MACjDN,iBAAiB,EAChBI,MAAM,CAAEb,WAAY,CAAC,CAACgB,iBAAiB,CAAC,CAAC,CAACP,iBAAiB;MAC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IACV,CAAEO,qBAAqB,CAACG,IAAI,CAC3B,CAAE;QAAEb;MAAK,CAAC,KAAMA,IAAI,KAAKG,SAAS,CAACH,IACpC,CACF,CAAC;MACDZ,cAAc,CAAEwB,gBAAgB,CAACE,GAAG,CAAE,CAAE;QAAEd;MAAK,CAAC,KAAMA,IAAK,CAAE,CAAC;IAC/D,CAAC,MAAM,IAAKQ,kBAAkB,CAACG,MAAM,GAAGD,qBAAqB,CAACC,MAAM,EAAG;MACtE,MAAMI,gBAAgB,GAAGL,qBAAqB,CAACX,MAAM,CAClDI,SAAS,IACV,CAAEK,kBAAkB,CAACK,IAAI,CACxB,CAAE;QAAEb;MAAK,CAAC,KAAMA,IAAI,KAAKG,SAAS,CAACH,IACpC,CACF,CAAC;MACDb,cAAc,CAAE4B,gBAAgB,CAACD,GAAG,CAAE,CAAE;QAAEd;MAAK,CAAC,KAAMA,IAAK,CAAE,CAAC;IAC/D;EACD,CAAC;EAED,oBACChB,IAAA,CAACC,YAAY;IACZI,UAAU,EAAGa,kBAAoB;IACjCM,kBAAkB,EAAGA,kBAAoB;IACzCQ,QAAQ,EAAGP;EAA4B,CACvC,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","useDispatch","store","preferencesStore","hasBlockSupport","blocksStore","useMemo","privateApis","blockEditorPrivateApis","editorStore","unlock","jsx","_jsx","BlockManager","EMPTY_ARRAY","BlockVisibility","showBlockTypes","hideBlockTypes","blockTypes","allowedBlockTypes","_allowedBlockTypes","hiddenBlockTypes","_hiddenBlockTypes","select","_select$get","getBlockTypes","getEditorSettings","get","filter","name","includes","filteredBlockTypes","blockType","parent","hiddenBlock","some","registeredBlock","selectedBlockTypes","onChangeSelectedBlockTypes","newSelectedBlockTypes","length","blockTypesToHide","find","map","blockTypesToShow","onChange"],"sources":["@wordpress/editor/src/components/preferences-modal/block-visibility.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { hasBlockSupport, store as blocksStore } from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { BlockManager } = unlock( blockEditorPrivateApis );\nconst EMPTY_ARRAY = [];\n\nexport default function BlockVisibility() {\n\tconst { showBlockTypes, hideBlockTypes } = unlock(\n\t\tuseDispatch( editorStore )\n\t);\n\n\tconst {\n\t\tblockTypes,\n\t\tallowedBlockTypes: _allowedBlockTypes,\n\t\thiddenBlockTypes: _hiddenBlockTypes,\n\t} = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tblockTypes: select( blocksStore ).getBlockTypes(),\n\t\t\tallowedBlockTypes:\n\t\t\t\tselect( editorStore ).getEditorSettings().allowedBlockTypes,\n\t\t\thiddenBlockTypes:\n\t\t\t\tselect( preferencesStore ).get( 'core', 'hiddenBlockTypes' ) ??\n\t\t\t\tEMPTY_ARRAY,\n\t\t};\n\t}, [] );\n\n\tconst allowedBlockTypes = useMemo( () => {\n\t\tif ( _allowedBlockTypes === true ) {\n\t\t\treturn blockTypes;\n\t\t}\n\t\treturn blockTypes.filter( ( { name } ) => {\n\t\t\treturn _allowedBlockTypes?.includes( name );\n\t\t} );\n\t}, [ _allowedBlockTypes, blockTypes ] );\n\n\tconst filteredBlockTypes = allowedBlockTypes.filter(\n\t\t( blockType ) =>\n\t\t\thasBlockSupport( blockType, 'inserter', true ) &&\n\t\t\t( ! blockType.parent ||\n\t\t\t\tblockType.parent.includes( 'core/post-content' ) )\n\t);\n\n\t// Some hidden blocks become unregistered\n\t// by removing for instance the plugin that registered them, yet\n\t// they're still remain as hidden by the user's action.\n\t// We consider \"hidden\", blocks which were hidden and\n\t// are still registered.\n\tconst hiddenBlockTypes = _hiddenBlockTypes.filter( ( hiddenBlock ) => {\n\t\treturn filteredBlockTypes.some(\n\t\t\t( registeredBlock ) => registeredBlock.name === hiddenBlock\n\t\t);\n\t} );\n\n\tconst selectedBlockTypes = filteredBlockTypes.filter(\n\t\t( blockType ) => ! hiddenBlockTypes.includes( blockType.name )\n\t);\n\n\tconst onChangeSelectedBlockTypes = ( newSelectedBlockTypes ) => {\n\t\tif ( selectedBlockTypes.length > newSelectedBlockTypes.length ) {\n\t\t\tconst blockTypesToHide = selectedBlockTypes.filter(\n\t\t\t\t( blockType ) =>\n\t\t\t\t\t! newSelectedBlockTypes.find(\n\t\t\t\t\t\t( { name } ) => name === blockType.name\n\t\t\t\t\t)\n\t\t\t);\n\t\t\thideBlockTypes( blockTypesToHide.map( ( { name } ) => name ) );\n\t\t} else if ( selectedBlockTypes.length < newSelectedBlockTypes.length ) {\n\t\t\tconst blockTypesToShow = newSelectedBlockTypes.filter(\n\t\t\t\t( blockType ) =>\n\t\t\t\t\t! selectedBlockTypes.find(\n\t\t\t\t\t\t( { name } ) => name === blockType.name\n\t\t\t\t\t)\n\t\t\t);\n\t\t\tshowBlockTypes( blockTypesToShow.map( ( { name } ) => name ) );\n\t\t}\n\t};\n\n\treturn (\n\t\t<BlockManager\n\t\t\tblockTypes={ filteredBlockTypes }\n\t\t\tselectedBlockTypes={ selectedBlockTypes }\n\t\t\tonChange={ onChangeSelectedBlockTypes }\n\t\t/>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;AAClE,SAASC,eAAe,EAAEF,KAAK,IAAIG,WAAW,QAAQ,mBAAmB;AACzE,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;;AAE/E;AACA;AACA;AACA,SAASN,KAAK,IAAIO,WAAW,QAAQ,aAAa;AAClD,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AA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zCQ,QAAQ,EAAGP;EAA4B,CACvC,CAAC;AAEJ","ignoreList":[]}
@@ -83,7 +83,7 @@ function PreferencesModalContents({
83
83
  children: [/*#__PURE__*/_jsx(PreferenceToggleControl, {
84
84
  scope: "core",
85
85
  featureName: "showListViewByDefault",
86
- help: __('Opens the List View sidebar by default.'),
86
+ help: __('Opens the List View panel by default.'),
87
87
  label: __('Always open List View')
88
88
  }), showBlockBreadcrumbsOption && /*#__PURE__*/_jsx(PreferenceToggleControl, {
89
89
  scope: "core",