@wordpress/edit-site 6.32.1-next.b8c8708f3.0 → 6.33.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 (41) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/editor/use-resolve-edited-entity.js +3 -20
  3. package/build/components/editor/use-resolve-edited-entity.js.map +2 -2
  4. package/build/components/page-templates/index.js +92 -24
  5. package/build/components/page-templates/index.js.map +3 -3
  6. package/build/components/post-edit/index.js +1 -1
  7. package/build/components/post-edit/index.js.map +2 -2
  8. package/build/components/post-list/index.js +4 -4
  9. package/build/components/post-list/index.js.map +2 -2
  10. package/build/components/sidebar-navigation-screen-templates-browse/content.js +5 -1
  11. package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +2 -2
  12. package/build/components/site-editor-routes/index.js +0 -1
  13. package/build/components/site-editor-routes/index.js.map +2 -2
  14. package/build/components/site-editor-routes/template-item.js +0 -7
  15. package/build/components/site-editor-routes/template-item.js.map +2 -2
  16. package/build-module/components/editor/use-resolve-edited-entity.js +3 -20
  17. package/build-module/components/editor/use-resolve-edited-entity.js.map +2 -2
  18. package/build-module/components/page-templates/index.js +95 -27
  19. package/build-module/components/page-templates/index.js.map +2 -2
  20. package/build-module/components/post-edit/index.js +1 -1
  21. package/build-module/components/post-edit/index.js.map +2 -2
  22. package/build-module/components/post-list/index.js +4 -4
  23. package/build-module/components/post-list/index.js.map +2 -2
  24. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +5 -1
  25. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +2 -2
  26. package/build-module/components/site-editor-routes/index.js +1 -2
  27. package/build-module/components/site-editor-routes/index.js.map +2 -2
  28. package/build-module/components/site-editor-routes/template-item.js +0 -6
  29. package/build-module/components/site-editor-routes/template-item.js.map +2 -2
  30. package/build-style/posts-rtl.css +8 -1
  31. package/build-style/posts.css +8 -1
  32. package/build-style/style-rtl.css +8 -1
  33. package/build-style/style.css +8 -1
  34. package/package.json +44 -44
  35. package/src/components/editor/use-resolve-edited-entity.js +2 -20
  36. package/src/components/page-templates/index.js +75 -7
  37. package/src/components/post-edit/index.js +1 -1
  38. package/src/components/post-list/index.js +4 -4
  39. package/src/components/sidebar-navigation-screen-templates-browse/content.js +7 -1
  40. package/src/components/site-editor-routes/index.js +1 -2
  41. package/src/components/site-editor-routes/template-item.js +0 -6
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/site-editor-routes/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useRegistry, useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as siteEditorStore } from '../../store';\nimport { homeRoute } from './home';\nimport { stylesRoute } from './styles';\nimport { navigationRoute } from './navigation';\nimport { navigationItemRoute } from './navigation-item';\nimport { patternsRoute } from './patterns';\nimport { patternItemRoute } from './pattern-item';\nimport { templatePartItemRoute } from './template-part-item';\nimport { templatesRoute } from './templates';\nimport { templateItemRoute, staticTemplateItemRoute } from './template-item';\nimport { pagesRoute } from './pages';\nimport { pageItemRoute } from './page-item';\nimport { stylebookRoute } from './stylebook';\nimport { notFoundRoute } from './notfound';\n\nconst routes = [\n\tpageItemRoute,\n\tpagesRoute,\n\ttemplateItemRoute,\n\tstaticTemplateItemRoute,\n\ttemplatesRoute,\n\ttemplatePartItemRoute,\n\tpatternItemRoute,\n\tpatternsRoute,\n\tnavigationItemRoute,\n\tnavigationRoute,\n\tstylesRoute,\n\thomeRoute,\n\tstylebookRoute,\n\tnotFoundRoute,\n];\n\nexport function useRegisterSiteEditorRoutes() {\n\tconst registry = useRegistry();\n\tconst { registerRoute } = unlock( useDispatch( siteEditorStore ) );\n\tuseEffect( () => {\n\t\tregistry.batch( () => {\n\t\t\troutes.forEach( registerRoute );\n\t\t} );\n\t}, [ registry, registerRoute ] );\n}\n"],
5
- "mappings": "AAGA,SAAS,aAAa,mBAAmB;AACzC,SAAS,iBAAiB;AAK1B,SAAS,cAAc;AACvB,SAAS,SAAS,uBAAuB;AACzC,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,2BAA2B;AACpC,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AACjC,SAAS,6BAA6B;AACtC,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB,+BAA+B;AAC3D,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AAE9B,MAAM,SAAS;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEO,SAAS,8BAA8B;AAC7C,QAAM,WAAW,YAAY;AAC7B,QAAM,EAAE,cAAc,IAAI,OAAQ,YAAa,eAAgB,CAAE;AACjE,YAAW,MAAM;AAChB,aAAS,MAAO,MAAM;AACrB,aAAO,QAAS,aAAc;AAAA,IAC/B,CAAE;AAAA,EACH,GAAG,CAAE,UAAU,aAAc,CAAE;AAChC;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useRegistry, useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as siteEditorStore } from '../../store';\nimport { homeRoute } from './home';\nimport { stylesRoute } from './styles';\nimport { navigationRoute } from './navigation';\nimport { navigationItemRoute } from './navigation-item';\nimport { patternsRoute } from './patterns';\nimport { patternItemRoute } from './pattern-item';\nimport { templatePartItemRoute } from './template-part-item';\nimport { templatesRoute } from './templates';\nimport { templateItemRoute } from './template-item';\nimport { pagesRoute } from './pages';\nimport { pageItemRoute } from './page-item';\nimport { stylebookRoute } from './stylebook';\nimport { notFoundRoute } from './notfound';\n\nconst routes = [\n\tpageItemRoute,\n\tpagesRoute,\n\ttemplateItemRoute,\n\ttemplatesRoute,\n\ttemplatePartItemRoute,\n\tpatternItemRoute,\n\tpatternsRoute,\n\tnavigationItemRoute,\n\tnavigationRoute,\n\tstylesRoute,\n\thomeRoute,\n\tstylebookRoute,\n\tnotFoundRoute,\n];\n\nexport function useRegisterSiteEditorRoutes() {\n\tconst registry = useRegistry();\n\tconst { registerRoute } = unlock( useDispatch( siteEditorStore ) );\n\tuseEffect( () => {\n\t\tregistry.batch( () => {\n\t\t\troutes.forEach( registerRoute );\n\t\t} );\n\t}, [ registry, registerRoute ] );\n}\n"],
5
+ "mappings": "AAGA,SAAS,aAAa,mBAAmB;AACzC,SAAS,iBAAiB;AAK1B,SAAS,cAAc;AACvB,SAAS,SAAS,uBAAuB;AACzC,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,2BAA2B;AACpC,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AACjC,SAAS,6BAA6B;AACtC,SAAS,sBAAsB;AAC/B,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AAE9B,MAAM,SAAS;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEO,SAAS,8BAA8B;AAC7C,QAAM,WAAW,YAAY;AAC7B,QAAM,EAAE,cAAc,IAAI,OAAQ,YAAa,eAAgB,CAAE;AACjE,YAAW,MAAM;AAChB,aAAS,MAAO,MAAM;AACrB,aAAO,QAAS,aAAc;AAAA,IAC/B,CAAE;AAAA,EACH,GAAG,CAAE,UAAU,aAAc,CAAE;AAChC;",
6
6
  "names": []
7
7
  }
@@ -21,13 +21,7 @@ const templateItemRoute = {
21
21
  path: "/wp_template/*postId",
22
22
  areas
23
23
  };
24
- const staticTemplateItemRoute = {
25
- name: "static-template-item",
26
- path: "/wp_registered_template/*postId",
27
- areas
28
- };
29
24
  export {
30
- staticTemplateItemRoute,
31
25
  templateItemRoute
32
26
  };
33
27
  //# sourceMappingURL=template-item.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/site-editor-routes/template-item.js"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nimport Editor from '../editor';\nimport SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';\nimport SidebarNavigationScreenUnsupported from '../sidebar-navigation-screen-unsupported';\n\nconst areas = {\n\tsidebar( { siteData } ) {\n\t\tconst isBlockTheme = siteData.currentTheme?.is_block_theme;\n\t\treturn isBlockTheme ? (\n\t\t\t<SidebarNavigationScreenTemplatesBrowse backPath=\"/\" />\n\t\t) : (\n\t\t\t<SidebarNavigationScreenUnsupported />\n\t\t);\n\t},\n\tmobile( { siteData } ) {\n\t\tconst isBlockTheme = siteData.currentTheme?.is_block_theme;\n\t\treturn isBlockTheme ? (\n\t\t\t<Editor />\n\t\t) : (\n\t\t\t<SidebarNavigationScreenUnsupported />\n\t\t);\n\t},\n\tpreview( { siteData } ) {\n\t\tconst isBlockTheme = siteData.currentTheme?.is_block_theme;\n\t\treturn isBlockTheme ? (\n\t\t\t<Editor />\n\t\t) : (\n\t\t\t<SidebarNavigationScreenUnsupported />\n\t\t);\n\t},\n};\n\nexport const templateItemRoute = {\n\tname: 'template-item',\n\tpath: '/wp_template/*postId',\n\tareas,\n};\n\nexport const staticTemplateItemRoute = {\n\tname: 'static-template-item',\n\tpath: '/wp_registered_template/*postId',\n\tareas,\n};\n"],
5
- "mappings": "AAWG;AARH,OAAO,YAAY;AACnB,OAAO,4CAA4C;AACnD,OAAO,wCAAwC;AAE/C,MAAM,QAAQ;AAAA,EACb,QAAS,EAAE,SAAS,GAAI;AACvB,UAAM,eAAe,SAAS,cAAc;AAC5C,WAAO,eACN,oBAAC,0CAAuC,UAAS,KAAI,IAErD,oBAAC,sCAAmC;AAAA,EAEtC;AAAA,EACA,OAAQ,EAAE,SAAS,GAAI;AACtB,UAAM,eAAe,SAAS,cAAc;AAC5C,WAAO,eACN,oBAAC,UAAO,IAER,oBAAC,sCAAmC;AAAA,EAEtC;AAAA,EACA,QAAS,EAAE,SAAS,GAAI;AACvB,UAAM,eAAe,SAAS,cAAc;AAC5C,WAAO,eACN,oBAAC,UAAO,IAER,oBAAC,sCAAmC;AAAA,EAEtC;AACD;AAEO,MAAM,oBAAoB;AAAA,EAChC,MAAM;AAAA,EACN,MAAM;AAAA,EACN;AACD;AAEO,MAAM,0BAA0B;AAAA,EACtC,MAAM;AAAA,EACN,MAAM;AAAA,EACN;AACD;",
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport Editor from '../editor';\nimport SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';\nimport SidebarNavigationScreenUnsupported from '../sidebar-navigation-screen-unsupported';\n\nconst areas = {\n\tsidebar( { siteData } ) {\n\t\tconst isBlockTheme = siteData.currentTheme?.is_block_theme;\n\t\treturn isBlockTheme ? (\n\t\t\t<SidebarNavigationScreenTemplatesBrowse backPath=\"/\" />\n\t\t) : (\n\t\t\t<SidebarNavigationScreenUnsupported />\n\t\t);\n\t},\n\tmobile( { siteData } ) {\n\t\tconst isBlockTheme = siteData.currentTheme?.is_block_theme;\n\t\treturn isBlockTheme ? (\n\t\t\t<Editor />\n\t\t) : (\n\t\t\t<SidebarNavigationScreenUnsupported />\n\t\t);\n\t},\n\tpreview( { siteData } ) {\n\t\tconst isBlockTheme = siteData.currentTheme?.is_block_theme;\n\t\treturn isBlockTheme ? (\n\t\t\t<Editor />\n\t\t) : (\n\t\t\t<SidebarNavigationScreenUnsupported />\n\t\t);\n\t},\n};\n\nexport const templateItemRoute = {\n\tname: 'template-item',\n\tpath: '/wp_template/*postId',\n\tareas,\n};\n"],
5
+ "mappings": "AAWG;AARH,OAAO,YAAY;AACnB,OAAO,4CAA4C;AACnD,OAAO,wCAAwC;AAE/C,MAAM,QAAQ;AAAA,EACb,QAAS,EAAE,SAAS,GAAI;AACvB,UAAM,eAAe,SAAS,cAAc;AAC5C,WAAO,eACN,oBAAC,0CAAuC,UAAS,KAAI,IAErD,oBAAC,sCAAmC;AAAA,EAEtC;AAAA,EACA,OAAQ,EAAE,SAAS,GAAI;AACtB,UAAM,eAAe,SAAS,cAAc;AAC5C,WAAO,eACN,oBAAC,UAAO,IAER,oBAAC,sCAAmC;AAAA,EAEtC;AAAA,EACA,QAAS,EAAE,SAAS,GAAI;AACvB,UAAM,eAAe,SAAS,cAAc;AAC5C,WAAO,eACN,oBAAC,UAAO,IAER,oBAAC,sCAAmC;AAAA,EAEtC;AACD;AAEO,MAAM,oBAAoB;AAAA,EAChC,MAAM;AAAA,EACN,MAAM;AAAA,EACN;AACD;",
6
6
  "names": []
7
7
  }
@@ -546,7 +546,7 @@
546
546
  padding: 8px 16px;
547
547
  }
548
548
 
549
- .dataviews-filters__summary-operators-container:has(+ .dataviews-filters__search-widget-listbox), .dataviews-filters__summary-operators-container:has(+ .dataviews-filters__user-input-widget) {
549
+ .dataviews-filters__summary-operators-container:has(+ .dataviews-filters__search-widget-listbox), .dataviews-filters__summary-operators-container:has(+ .dataviews-filters__search-widget-no-elements), .dataviews-filters__summary-operators-container:has(+ .dataviews-filters__user-input-widget) {
550
550
  border-bottom: 1px solid #e0e0e0;
551
551
  }
552
552
 
@@ -1087,6 +1087,13 @@
1087
1087
  padding-right: 8px;
1088
1088
  }
1089
1089
 
1090
+ .dataviews-filters__search-widget-no-elements {
1091
+ display: flex;
1092
+ align-items: center;
1093
+ justify-content: center;
1094
+ padding: 16px;
1095
+ }
1096
+
1090
1097
  .dataviews-footer {
1091
1098
  position: sticky;
1092
1099
  bottom: 0;
@@ -546,7 +546,7 @@
546
546
  padding: 8px 16px;
547
547
  }
548
548
 
549
- .dataviews-filters__summary-operators-container:has(+ .dataviews-filters__search-widget-listbox), .dataviews-filters__summary-operators-container:has(+ .dataviews-filters__user-input-widget) {
549
+ .dataviews-filters__summary-operators-container:has(+ .dataviews-filters__search-widget-listbox), .dataviews-filters__summary-operators-container:has(+ .dataviews-filters__search-widget-no-elements), .dataviews-filters__summary-operators-container:has(+ .dataviews-filters__user-input-widget) {
550
550
  border-bottom: 1px solid #e0e0e0;
551
551
  }
552
552
 
@@ -1087,6 +1087,13 @@
1087
1087
  padding-left: 8px;
1088
1088
  }
1089
1089
 
1090
+ .dataviews-filters__search-widget-no-elements {
1091
+ display: flex;
1092
+ align-items: center;
1093
+ justify-content: center;
1094
+ padding: 16px;
1095
+ }
1096
+
1090
1097
  .dataviews-footer {
1091
1098
  position: sticky;
1092
1099
  bottom: 0;
@@ -546,7 +546,7 @@
546
546
  padding: 8px 16px;
547
547
  }
548
548
 
549
- .dataviews-filters__summary-operators-container:has(+ .dataviews-filters__search-widget-listbox), .dataviews-filters__summary-operators-container:has(+ .dataviews-filters__user-input-widget) {
549
+ .dataviews-filters__summary-operators-container:has(+ .dataviews-filters__search-widget-listbox), .dataviews-filters__summary-operators-container:has(+ .dataviews-filters__search-widget-no-elements), .dataviews-filters__summary-operators-container:has(+ .dataviews-filters__user-input-widget) {
550
550
  border-bottom: 1px solid #e0e0e0;
551
551
  }
552
552
 
@@ -1087,6 +1087,13 @@
1087
1087
  padding-right: 8px;
1088
1088
  }
1089
1089
 
1090
+ .dataviews-filters__search-widget-no-elements {
1091
+ display: flex;
1092
+ align-items: center;
1093
+ justify-content: center;
1094
+ padding: 16px;
1095
+ }
1096
+
1090
1097
  .dataviews-footer {
1091
1098
  position: sticky;
1092
1099
  bottom: 0;
@@ -546,7 +546,7 @@
546
546
  padding: 8px 16px;
547
547
  }
548
548
 
549
- .dataviews-filters__summary-operators-container:has(+ .dataviews-filters__search-widget-listbox), .dataviews-filters__summary-operators-container:has(+ .dataviews-filters__user-input-widget) {
549
+ .dataviews-filters__summary-operators-container:has(+ .dataviews-filters__search-widget-listbox), .dataviews-filters__summary-operators-container:has(+ .dataviews-filters__search-widget-no-elements), .dataviews-filters__summary-operators-container:has(+ .dataviews-filters__user-input-widget) {
550
550
  border-bottom: 1px solid #e0e0e0;
551
551
  }
552
552
 
@@ -1087,6 +1087,13 @@
1087
1087
  padding-left: 8px;
1088
1088
  }
1089
1089
 
1090
+ .dataviews-filters__search-widget-no-elements {
1091
+ display: flex;
1092
+ align-items: center;
1093
+ justify-content: center;
1094
+ padding: 16px;
1095
+ }
1096
+
1090
1097
  .dataviews-footer {
1091
1098
  position: sticky;
1092
1099
  bottom: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "6.32.1-next.b8c8708f3.0",
3
+ "version": "6.33.0",
4
4
  "description": "Edit Site Page module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -37,48 +37,48 @@
37
37
  "wpScript": true,
38
38
  "dependencies": {
39
39
  "@react-spring/web": "^9.4.5",
40
- "@wordpress/a11y": "^4.32.1-next.b8c8708f3.0",
41
- "@wordpress/admin-ui": "^1.0.1-next.b8c8708f3.0",
42
- "@wordpress/api-fetch": "^7.32.1-next.b8c8708f3.0",
43
- "@wordpress/base-styles": "^6.8.1-next.b8c8708f3.0",
44
- "@wordpress/blob": "^4.32.1-next.b8c8708f3.0",
45
- "@wordpress/block-editor": "^15.5.1-next.b8c8708f3.0",
46
- "@wordpress/block-library": "^9.33.1-next.b8c8708f3.0",
47
- "@wordpress/blocks": "^15.5.1-next.b8c8708f3.0",
48
- "@wordpress/commands": "^1.32.1-next.b8c8708f3.0",
49
- "@wordpress/components": "^30.6.1-next.b8c8708f3.0",
50
- "@wordpress/compose": "^7.32.1-next.b8c8708f3.0",
51
- "@wordpress/core-data": "^7.32.1-next.b8c8708f3.0",
52
- "@wordpress/data": "^10.32.1-next.b8c8708f3.0",
53
- "@wordpress/dataviews": "^10.0.1-next.b8c8708f3.0",
54
- "@wordpress/date": "^5.32.1-next.b8c8708f3.0",
55
- "@wordpress/deprecated": "^4.32.1-next.b8c8708f3.0",
56
- "@wordpress/dom": "^4.32.1-next.b8c8708f3.0",
57
- "@wordpress/editor": "^14.32.1-next.b8c8708f3.0",
58
- "@wordpress/element": "^6.32.1-next.b8c8708f3.0",
59
- "@wordpress/escape-html": "^3.32.1-next.b8c8708f3.0",
60
- "@wordpress/fields": "^0.24.1-next.b8c8708f3.0",
61
- "@wordpress/hooks": "^4.32.1-next.b8c8708f3.0",
62
- "@wordpress/html-entities": "^4.32.1-next.b8c8708f3.0",
63
- "@wordpress/i18n": "^6.5.1-next.b8c8708f3.0",
64
- "@wordpress/icons": "^11.0.1-next.b8c8708f3.0",
65
- "@wordpress/keyboard-shortcuts": "^5.32.1-next.b8c8708f3.0",
66
- "@wordpress/keycodes": "^4.32.1-next.b8c8708f3.0",
67
- "@wordpress/media-utils": "^5.32.1-next.b8c8708f3.0",
68
- "@wordpress/notices": "^5.32.1-next.b8c8708f3.0",
69
- "@wordpress/patterns": "^2.32.1-next.b8c8708f3.0",
70
- "@wordpress/plugins": "^7.32.1-next.b8c8708f3.0",
71
- "@wordpress/preferences": "^4.32.1-next.b8c8708f3.0",
72
- "@wordpress/primitives": "^4.32.1-next.b8c8708f3.0",
73
- "@wordpress/private-apis": "^1.32.1-next.b8c8708f3.0",
74
- "@wordpress/reusable-blocks": "^5.32.1-next.b8c8708f3.0",
75
- "@wordpress/router": "^1.32.1-next.b8c8708f3.0",
76
- "@wordpress/style-engine": "^2.32.1-next.b8c8708f3.0",
77
- "@wordpress/url": "^4.32.1-next.b8c8708f3.0",
78
- "@wordpress/viewport": "^6.32.1-next.b8c8708f3.0",
79
- "@wordpress/views": "^1.0.1-next.b8c8708f3.0",
80
- "@wordpress/widgets": "^4.32.1-next.b8c8708f3.0",
81
- "@wordpress/wordcount": "^4.32.1-next.b8c8708f3.0",
40
+ "@wordpress/a11y": "^4.33.0",
41
+ "@wordpress/admin-ui": "^1.1.0",
42
+ "@wordpress/api-fetch": "^7.33.0",
43
+ "@wordpress/base-styles": "^6.9.0",
44
+ "@wordpress/blob": "^4.33.0",
45
+ "@wordpress/block-editor": "^15.6.0",
46
+ "@wordpress/block-library": "^9.33.0",
47
+ "@wordpress/blocks": "^15.6.0",
48
+ "@wordpress/commands": "^1.33.0",
49
+ "@wordpress/components": "^30.6.0",
50
+ "@wordpress/compose": "^7.33.0",
51
+ "@wordpress/core-data": "^7.33.0",
52
+ "@wordpress/data": "^10.33.0",
53
+ "@wordpress/dataviews": "^10.0.0",
54
+ "@wordpress/date": "^5.33.0",
55
+ "@wordpress/deprecated": "^4.33.0",
56
+ "@wordpress/dom": "^4.33.0",
57
+ "@wordpress/editor": "^14.33.0",
58
+ "@wordpress/element": "^6.33.0",
59
+ "@wordpress/escape-html": "^3.33.0",
60
+ "@wordpress/fields": "^0.25.0",
61
+ "@wordpress/hooks": "^4.33.0",
62
+ "@wordpress/html-entities": "^4.33.0",
63
+ "@wordpress/i18n": "^6.6.0",
64
+ "@wordpress/icons": "^11.0.0",
65
+ "@wordpress/keyboard-shortcuts": "^5.33.0",
66
+ "@wordpress/keycodes": "^4.33.0",
67
+ "@wordpress/media-utils": "^5.33.0",
68
+ "@wordpress/notices": "^5.33.0",
69
+ "@wordpress/patterns": "^2.33.0",
70
+ "@wordpress/plugins": "^7.33.0",
71
+ "@wordpress/preferences": "^4.33.0",
72
+ "@wordpress/primitives": "^4.33.0",
73
+ "@wordpress/private-apis": "^1.33.0",
74
+ "@wordpress/reusable-blocks": "^5.33.0",
75
+ "@wordpress/router": "^1.33.0",
76
+ "@wordpress/style-engine": "^2.33.0",
77
+ "@wordpress/url": "^4.33.0",
78
+ "@wordpress/viewport": "^6.33.0",
79
+ "@wordpress/views": "^1.0.0",
80
+ "@wordpress/widgets": "^4.33.0",
81
+ "@wordpress/wordcount": "^4.33.0",
82
82
  "change-case": "^4.1.2",
83
83
  "clsx": "^2.1.1",
84
84
  "colord": "^2.9.2",
@@ -93,5 +93,5 @@
93
93
  "publishConfig": {
94
94
  "access": "public"
95
95
  },
96
- "gitHead": "67cfd7e661931aeb0d06bec894599d287a4f8d0f"
96
+ "gitHead": "2bbe0d34ab65458468758c48826296d7a753428b"
97
97
  }
@@ -25,7 +25,6 @@ const postTypesWithoutParentTemplate = [
25
25
  TEMPLATE_PART_POST_TYPE,
26
26
  NAVIGATION_POST_TYPE,
27
27
  PATTERN_TYPES.user,
28
- 'wp_registered_template',
29
28
  ];
30
29
 
31
30
  const authorizedPostTypes = [ 'page', 'post' ];
@@ -42,8 +41,6 @@ function getPostType( name ) {
42
41
  postType = TEMPLATE_POST_TYPE;
43
42
  } else if ( name === 'template-item' ) {
44
43
  postType = TEMPLATE_POST_TYPE;
45
- } else if ( name === 'static-template-item' ) {
46
- postType = 'wp_registered_template';
47
44
  } else if ( name === 'page-item' || name === 'pages' ) {
48
45
  postType = 'page';
49
46
  } else if ( name === 'post-item' || name === 'posts' ) {
@@ -55,29 +52,14 @@ function getPostType( name ) {
55
52
 
56
53
  export function useResolveEditedEntity() {
57
54
  const { name, params = {}, query } = useLocation();
58
- const { postId: _postId = query?.postId } = params; // Fallback to query param for postId for list view routes.
59
- const _postType = getPostType( name, _postId ) ?? query?.postType;
55
+ const { postId = query?.postId } = params; // Fallback to query param for postId for list view routes.
56
+ const postType = getPostType( name, postId ) ?? query?.postType;
60
57
 
61
58
  const homePage = useSelect( ( select ) => {
62
59
  const { getHomePage } = unlock( select( coreDataStore ) );
63
60
  return getHomePage();
64
61
  }, [] );
65
62
 
66
- const [ postType, postId ] = useSelect(
67
- ( select ) => {
68
- if ( _postType !== 'wp_registered_template' ) {
69
- return [ _postType, _postId ];
70
- }
71
- return [
72
- TEMPLATE_POST_TYPE,
73
- unlock( select( coreDataStore ) ).getTemplateAutoDraftId(
74
- _postId
75
- ),
76
- ];
77
- },
78
- [ _postType, _postId ]
79
- );
80
-
81
63
  /**
82
64
  * This is a hook that recreates the logic to resolve a template for a given WordPress postID postTypeId
83
65
  * in order to match the frontend as closely as possible in the site editor.
@@ -2,7 +2,8 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { Page } from '@wordpress/admin-ui';
5
- import { __ } from '@wordpress/i18n';
5
+ import { __, sprintf } from '@wordpress/i18n';
6
+ import { decodeEntities } from '@wordpress/html-entities';
6
7
  import { useState, useMemo, useCallback } from '@wordpress/element';
7
8
  import {
8
9
  privateApis as corePrivateApis,
@@ -12,10 +13,11 @@ import { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';
12
13
  import { privateApis as routerPrivateApis } from '@wordpress/router';
13
14
  import { privateApis as editorPrivateApis } from '@wordpress/editor';
14
15
  import { addQueryArgs } from '@wordpress/url';
15
- import { useSelect } from '@wordpress/data';
16
+ import { useSelect, useDispatch } from '@wordpress/data';
16
17
  import { useEvent } from '@wordpress/compose';
17
18
  import { useView } from '@wordpress/views';
18
- import { Button } from '@wordpress/components';
19
+ import { Button, Modal } from '@wordpress/components';
20
+ import { store as noticesStore } from '@wordpress/notices';
19
21
 
20
22
  /**
21
23
  * Internal dependencies
@@ -45,6 +47,8 @@ export default function PageTemplates() {
45
47
  const { path, query } = useLocation();
46
48
  const { activeView = 'active', postId } = query;
47
49
  const [ selection, setSelection ] = useState( [ postId ] );
50
+ const [ selectedRegisteredTemplate, setSelectedRegisteredTemplate ] =
51
+ useState( false );
48
52
  const defaultView = useMemo( () => {
49
53
  return getDefaultView( activeView );
50
54
  }, [ activeView ] );
@@ -207,15 +211,54 @@ export default function PageTemplates() {
207
211
  elements,
208
212
  } );
209
213
  return _fields;
210
- }, [ users, activeView ] );
214
+ }, [ users, activeView, themeField ] );
211
215
 
212
216
  const { data, paginationInfo } = useMemo( () => {
213
217
  return filterSortAndPaginate( records, view, fields );
214
218
  }, [ records, view, fields ] );
215
219
 
220
+ const { createSuccessNotice } = useDispatch( noticesStore );
221
+ const onActionPerformed = useCallback(
222
+ ( actionId, items ) => {
223
+ switch ( actionId ) {
224
+ case 'duplicate-post':
225
+ {
226
+ const newItem = items[ 0 ];
227
+ const _title =
228
+ typeof newItem.title === 'string'
229
+ ? newItem.title
230
+ : newItem.title?.rendered;
231
+ createSuccessNotice(
232
+ sprintf(
233
+ // translators: %s: Title of the created post or template, e.g: "Hello world".
234
+ __( '"%s" successfully created.' ),
235
+ decodeEntities( _title ) || __( '(no title)' )
236
+ ),
237
+ {
238
+ type: 'snackbar',
239
+ id: 'duplicate-post-action',
240
+ actions: [
241
+ {
242
+ label: __( 'Edit' ),
243
+ onClick: () => {
244
+ history.navigate(
245
+ `/${ newItem.type }/${ newItem.id }?canvas=edit`
246
+ );
247
+ },
248
+ },
249
+ ],
250
+ }
251
+ );
252
+ }
253
+ break;
254
+ }
255
+ },
256
+ [ history, createSuccessNotice ]
257
+ );
216
258
  const postTypeActions = usePostActions( {
217
259
  postType: TEMPLATE_POST_TYPE,
218
260
  context: 'list',
261
+ onActionPerformed,
219
262
  } );
220
263
  const editAction = useEditPostAction();
221
264
  const setActiveTemplateAction = useSetActiveTemplateAction();
@@ -235,6 +278,10 @@ export default function PageTemplates() {
235
278
  updateView( newView );
236
279
  } );
237
280
 
281
+ const duplicateAction = actions.find(
282
+ ( action ) => action.id === 'duplicate-post'
283
+ );
284
+
238
285
  return (
239
286
  <Page
240
287
  className="edit-site-page-templates"
@@ -268,13 +315,34 @@ export default function PageTemplates() {
268
315
  onChangeSelection={ onChangeSelection }
269
316
  isItemClickable={ () => true }
270
317
  onClickItem={ ( item ) => {
271
- history.navigate(
272
- `/${ item.type }/${ item.id }?canvas=edit`
273
- );
318
+ if ( item.type === 'wp_registered_template' ) {
319
+ setSelectedRegisteredTemplate( item );
320
+ } else {
321
+ history.navigate(
322
+ `/${ item.type }/${ item.id }?canvas=edit`
323
+ );
324
+ }
274
325
  } }
275
326
  selection={ selection }
276
327
  defaultLayouts={ defaultLayouts }
277
328
  />
329
+ { selectedRegisteredTemplate && duplicateAction && (
330
+ <Modal
331
+ title={ __( 'Duplicate' ) }
332
+ onRequestClose={ () => setSelectedRegisteredTemplate() }
333
+ size="small"
334
+ >
335
+ <duplicateAction.RenderModal
336
+ items={ [ selectedRegisteredTemplate ] }
337
+ closeModal={ () => setSelectedRegisteredTemplate() }
338
+ onActionPerformed={ ( [ item ] ) => {
339
+ history.navigate(
340
+ `/${ item.type }/${ item.id }?canvas=edit`
341
+ );
342
+ } }
343
+ />
344
+ </Modal>
345
+ ) }
278
346
  </Page>
279
347
  );
280
348
  }
@@ -56,7 +56,7 @@ function PostEditForm( { postType, postId } ) {
56
56
  );
57
57
  const [ multiEdits, setMultiEdits ] = useState( {} );
58
58
  const { editEntityRecord } = useDispatch( coreDataStore );
59
- const { fields: _fields } = usePostFields( { postType } );
59
+ const _fields = usePostFields( { postType } );
60
60
  const fields = useMemo(
61
61
  () =>
62
62
  _fields?.map( ( field ) => {
@@ -99,7 +99,7 @@ export default function PostList( { postType } ) {
99
99
  [ path, history ]
100
100
  );
101
101
 
102
- const { isLoading: isLoadingFields, fields: fields } = usePostFields( {
102
+ const fields = usePostFields( {
103
103
  postType,
104
104
  } );
105
105
 
@@ -151,7 +151,7 @@ export default function PostList( { postType } ) {
151
151
 
152
152
  // The REST API sort the authors by ID, but we want to sort them by name.
153
153
  const data = useMemo( () => {
154
- if ( ! isLoadingFields && view?.sort?.field === 'author' ) {
154
+ if ( view?.sort?.field === 'author' ) {
155
155
  return filterSortAndPaginate(
156
156
  records,
157
157
  { sort: { ...view.sort } },
@@ -160,7 +160,7 @@ export default function PostList( { postType } ) {
160
160
  }
161
161
 
162
162
  return records;
163
- }, [ records, fields, isLoadingFields, view?.sort ] );
163
+ }, [ records, fields, view?.sort ] );
164
164
 
165
165
  const ids = data?.map( ( record ) => getItemId( record ) ) ?? [];
166
166
  const prevIds = usePrevious( ids ) ?? [];
@@ -261,7 +261,7 @@ export default function PostList( { postType } ) {
261
261
  fields={ fields }
262
262
  actions={ actions }
263
263
  data={ data || EMPTY_ARRAY }
264
- isLoading={ isLoadingData || isLoadingFields }
264
+ isLoading={ isLoadingData }
265
265
  view={ view }
266
266
  onChangeView={ onChangeView }
267
267
  selection={ selection }
@@ -73,7 +73,13 @@ export default function DataviewsTemplatesSidebarContent() {
73
73
  icon={ layout }
74
74
  aria-current={ activeView === 'user' }
75
75
  >
76
- { __( 'Custom templates' ) }
76
+ {
77
+ // Let's avoid calling them "custom templates" to avoid
78
+ // confusion. "Created" is closest to meaning database
79
+ // templates, created by users.
80
+ // https://developer.wordpress.org/themes/classic-themes/templates/page-template-files/#creating-custom-page-templates-for-global-use
81
+ __( 'Created templates' )
82
+ }
77
83
  </SidebarNavigationItem>
78
84
  { firstItemPerAuthorText.map( ( template ) => {
79
85
  return (
@@ -17,7 +17,7 @@ import { patternsRoute } from './patterns';
17
17
  import { patternItemRoute } from './pattern-item';
18
18
  import { templatePartItemRoute } from './template-part-item';
19
19
  import { templatesRoute } from './templates';
20
- import { templateItemRoute, staticTemplateItemRoute } from './template-item';
20
+ import { templateItemRoute } from './template-item';
21
21
  import { pagesRoute } from './pages';
22
22
  import { pageItemRoute } from './page-item';
23
23
  import { stylebookRoute } from './stylebook';
@@ -27,7 +27,6 @@ const routes = [
27
27
  pageItemRoute,
28
28
  pagesRoute,
29
29
  templateItemRoute,
30
- staticTemplateItemRoute,
31
30
  templatesRoute,
32
31
  templatePartItemRoute,
33
32
  patternItemRoute,
@@ -37,9 +37,3 @@ export const templateItemRoute = {
37
37
  path: '/wp_template/*postId',
38
38
  areas,
39
39
  };
40
-
41
- export const staticTemplateItemRoute = {
42
- name: 'static-template-item',
43
- path: '/wp_registered_template/*postId',
44
- areas,
45
- };