@wordpress/edit-site 6.30.1-next.a730c9c8c.0 → 6.31.1-next.233ccab9b.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 (77) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-template/add-custom-template-modal-content.js +3 -2
  3. package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
  4. package/build/components/add-new-template/index.js +1 -5
  5. package/build/components/add-new-template/index.js.map +1 -1
  6. package/build/components/add-new-template/utils.js +26 -87
  7. package/build/components/add-new-template/utils.js.map +1 -1
  8. package/build/components/dataviews-actions/index.js +51 -1
  9. package/build/components/dataviews-actions/index.js.map +1 -1
  10. package/build/components/editor/index.js +1 -1
  11. package/build/components/editor/index.js.map +1 -1
  12. package/build/components/editor/use-resolve-edited-entity.js +42 -14
  13. package/build/components/editor/use-resolve-edited-entity.js.map +1 -1
  14. package/build/components/global-styles/screen-css.js +2 -3
  15. package/build/components/global-styles/screen-css.js.map +1 -1
  16. package/build/components/global-styles/screen-root.js +3 -35
  17. package/build/components/global-styles/screen-root.js.map +1 -1
  18. package/build/components/page-templates/fields.js +65 -5
  19. package/build/components/page-templates/fields.js.map +1 -1
  20. package/build/components/page-templates/hooks.js +1 -1
  21. package/build/components/page-templates/hooks.js.map +1 -1
  22. package/build/components/page-templates/index.js +103 -29
  23. package/build/components/page-templates/index.js.map +1 -1
  24. package/build/components/sidebar-global-styles-wrapper/index.js +45 -13
  25. package/build/components/sidebar-global-styles-wrapper/index.js.map +1 -1
  26. package/build/components/sidebar-navigation-screen-templates-browse/content.js +11 -5
  27. package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  28. package/build/components/site-editor-routes/index.js +1 -1
  29. package/build/components/site-editor-routes/index.js.map +1 -1
  30. package/build/components/site-editor-routes/template-item.js +29 -23
  31. package/build/components/site-editor-routes/template-item.js.map +1 -1
  32. package/build-module/components/add-new-template/add-custom-template-modal-content.js +3 -2
  33. package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
  34. package/build-module/components/add-new-template/index.js +2 -6
  35. package/build-module/components/add-new-template/index.js.map +1 -1
  36. package/build-module/components/add-new-template/utils.js +26 -87
  37. package/build-module/components/add-new-template/utils.js.map +1 -1
  38. package/build-module/components/dataviews-actions/index.js +49 -0
  39. package/build-module/components/dataviews-actions/index.js.map +1 -1
  40. package/build-module/components/editor/index.js +1 -1
  41. package/build-module/components/editor/index.js.map +1 -1
  42. package/build-module/components/editor/use-resolve-edited-entity.js +42 -14
  43. package/build-module/components/editor/use-resolve-edited-entity.js.map +1 -1
  44. package/build-module/components/global-styles/screen-css.js +2 -3
  45. package/build-module/components/global-styles/screen-css.js.map +1 -1
  46. package/build-module/components/global-styles/screen-root.js +4 -36
  47. package/build-module/components/global-styles/screen-root.js.map +1 -1
  48. package/build-module/components/page-templates/fields.js +65 -5
  49. package/build-module/components/page-templates/fields.js.map +1 -1
  50. package/build-module/components/page-templates/hooks.js +1 -1
  51. package/build-module/components/page-templates/hooks.js.map +1 -1
  52. package/build-module/components/page-templates/index.js +105 -31
  53. package/build-module/components/page-templates/index.js.map +1 -1
  54. package/build-module/components/sidebar-global-styles-wrapper/index.js +48 -16
  55. package/build-module/components/sidebar-global-styles-wrapper/index.js.map +1 -1
  56. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +11 -5
  57. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  58. package/build-module/components/site-editor-routes/index.js +2 -2
  59. package/build-module/components/site-editor-routes/index.js.map +1 -1
  60. package/build-module/components/site-editor-routes/template-item.js +28 -22
  61. package/build-module/components/site-editor-routes/template-item.js.map +1 -1
  62. package/package.json +41 -41
  63. package/src/components/add-new-template/add-custom-template-modal-content.js +3 -4
  64. package/src/components/add-new-template/index.js +1 -8
  65. package/src/components/add-new-template/utils.js +36 -121
  66. package/src/components/dataviews-actions/index.js +51 -0
  67. package/src/components/editor/index.js +1 -0
  68. package/src/components/editor/use-resolve-edited-entity.js +54 -7
  69. package/src/components/global-styles/screen-css.js +4 -5
  70. package/src/components/global-styles/screen-root.js +5 -51
  71. package/src/components/page-templates/fields.js +70 -4
  72. package/src/components/page-templates/hooks.js +1 -1
  73. package/src/components/page-templates/index.js +160 -57
  74. package/src/components/sidebar-global-styles-wrapper/index.js +62 -16
  75. package/src/components/sidebar-navigation-screen-templates-browse/content.js +17 -7
  76. package/src/components/site-editor-routes/index.js +2 -1
  77. package/src/components/site-editor-routes/template-item.js +34 -26
@@ -1 +1 @@
1
- {"version":3,"names":["useRegistry","useDispatch","useEffect","unlock","store","siteEditorStore","homeRoute","stylesRoute","navigationRoute","navigationItemRoute","patternsRoute","patternItemRoute","templatePartItemRoute","templatesRoute","templateItemRoute","pagesRoute","pageItemRoute","stylebookRoute","notFoundRoute","routes","useRegisterSiteEditorRoutes","registry","registerRoute","batch","forEach"],"sources":["@wordpress/edit-site/src/components/site-editor-routes/index.js"],"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"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,iBAAiB;AAC1D,SAASC,SAAS,QAAQ,oBAAoB;;AAE9C;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,KAAK,IAAIC,eAAe,QAAQ,aAAa;AACtD,SAASC,SAAS,QAAQ,QAAQ;AAClC,SAASC,WAAW,QAAQ,UAAU;AACtC,SAASC,eAAe,QAAQ,cAAc;AAC9C,SAASC,mBAAmB,QAAQ,mBAAmB;AACvD,SAASC,aAAa,QAAQ,YAAY;AAC1C,SAASC,gBAAgB,QAAQ,gBAAgB;AACjD,SAASC,qBAAqB,QAAQ,sBAAsB;AAC5D,SAASC,cAAc,QAAQ,aAAa;AAC5C,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SAASC,UAAU,QAAQ,SAAS;AACpC,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,cAAc,QAAQ,aAAa;AAC5C,SAASC,aAAa,QAAQ,YAAY;AAE1C,MAAMC,MAAM,GAAG,CACdH,aAAa,EACbD,UAAU,EACVD,iBAAiB,EACjBD,cAAc,EACdD,qBAAqB,EACrBD,gBAAgB,EAChBD,aAAa,EACbD,mBAAmB,EACnBD,eAAe,EACfD,WAAW,EACXD,SAAS,EACTW,cAAc,EACdC,aAAa,CACb;AAED,OAAO,SAASE,2BAA2BA,CAAA,EAAG;EAC7C,MAAMC,QAAQ,GAAGrB,WAAW,CAAC,CAAC;EAC9B,MAAM;IAAEsB;EAAc,CAAC,GAAGnB,MAAM,CAAEF,WAAW,CAAEI,eAAgB,CAAE,CAAC;EAClEH,SAAS,CAAE,MAAM;IAChBmB,QAAQ,CAACE,KAAK,CAAE,MAAM;MACrBJ,MAAM,CAACK,OAAO,CAAEF,aAAc,CAAC;IAChC,CAAE,CAAC;EACJ,CAAC,EAAE,CAAED,QAAQ,EAAEC,aAAa,CAAG,CAAC;AACjC","ignoreList":[]}
1
+ {"version":3,"names":["useRegistry","useDispatch","useEffect","unlock","store","siteEditorStore","homeRoute","stylesRoute","navigationRoute","navigationItemRoute","patternsRoute","patternItemRoute","templatePartItemRoute","templatesRoute","templateItemRoute","staticTemplateItemRoute","pagesRoute","pageItemRoute","stylebookRoute","notFoundRoute","routes","useRegisterSiteEditorRoutes","registry","registerRoute","batch","forEach"],"sources":["@wordpress/edit-site/src/components/site-editor-routes/index.js"],"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"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,iBAAiB;AAC1D,SAASC,SAAS,QAAQ,oBAAoB;;AAE9C;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,KAAK,IAAIC,eAAe,QAAQ,aAAa;AACtD,SAASC,SAAS,QAAQ,QAAQ;AAClC,SAASC,WAAW,QAAQ,UAAU;AACtC,SAASC,eAAe,QAAQ,cAAc;AAC9C,SAASC,mBAAmB,QAAQ,mBAAmB;AACvD,SAASC,aAAa,QAAQ,YAAY;AAC1C,SAASC,gBAAgB,QAAQ,gBAAgB;AACjD,SAASC,qBAAqB,QAAQ,sBAAsB;AAC5D,SAASC,cAAc,QAAQ,aAAa;AAC5C,SAASC,iBAAiB,EAAEC,uBAAuB,QAAQ,iBAAiB;AAC5E,SAASC,UAAU,QAAQ,SAAS;AACpC,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,cAAc,QAAQ,aAAa;AAC5C,SAASC,aAAa,QAAQ,YAAY;AAE1C,MAAMC,MAAM,GAAG,CACdH,aAAa,EACbD,UAAU,EACVF,iBAAiB,EACjBC,uBAAuB,EACvBF,cAAc,EACdD,qBAAqB,EACrBD,gBAAgB,EAChBD,aAAa,EACbD,mBAAmB,EACnBD,eAAe,EACfD,WAAW,EACXD,SAAS,EACTY,cAAc,EACdC,aAAa,CACb;AAED,OAAO,SAASE,2BAA2BA,CAAA,EAAG;EAC7C,MAAMC,QAAQ,GAAGtB,WAAW,CAAC,CAAC;EAC9B,MAAM;IAAEuB;EAAc,CAAC,GAAGpB,MAAM,CAAEF,WAAW,CAAEI,eAAgB,CAAE,CAAC;EAClEH,SAAS,CAAE,MAAM;IAChBoB,QAAQ,CAACE,KAAK,CAAE,MAAM;MACrBJ,MAAM,CAACK,OAAO,CAAEF,aAAc,CAAC;IAChC,CAAE,CAAC;EACJ,CAAC,EAAE,CAAED,QAAQ,EAAEC,aAAa,CAAG,CAAC;AACjC","ignoreList":[]}
@@ -5,30 +5,36 @@ import Editor from '../editor';
5
5
  import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';
6
6
  import SidebarNavigationScreenUnsupported from '../sidebar-navigation-screen-unsupported';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
+ const areas = {
9
+ sidebar({
10
+ siteData
11
+ }) {
12
+ const isBlockTheme = siteData.currentTheme?.is_block_theme;
13
+ return isBlockTheme ? /*#__PURE__*/_jsx(SidebarNavigationScreenTemplatesBrowse, {
14
+ backPath: "/"
15
+ }) : /*#__PURE__*/_jsx(SidebarNavigationScreenUnsupported, {});
16
+ },
17
+ mobile({
18
+ siteData
19
+ }) {
20
+ const isBlockTheme = siteData.currentTheme?.is_block_theme;
21
+ return isBlockTheme ? /*#__PURE__*/_jsx(Editor, {}) : /*#__PURE__*/_jsx(SidebarNavigationScreenUnsupported, {});
22
+ },
23
+ preview({
24
+ siteData
25
+ }) {
26
+ const isBlockTheme = siteData.currentTheme?.is_block_theme;
27
+ return isBlockTheme ? /*#__PURE__*/_jsx(Editor, {}) : /*#__PURE__*/_jsx(SidebarNavigationScreenUnsupported, {});
28
+ }
29
+ };
8
30
  export const templateItemRoute = {
9
31
  name: 'template-item',
10
32
  path: '/wp_template/*postId',
11
- areas: {
12
- sidebar({
13
- siteData
14
- }) {
15
- const isBlockTheme = siteData.currentTheme?.is_block_theme;
16
- return isBlockTheme ? /*#__PURE__*/_jsx(SidebarNavigationScreenTemplatesBrowse, {
17
- backPath: "/"
18
- }) : /*#__PURE__*/_jsx(SidebarNavigationScreenUnsupported, {});
19
- },
20
- mobile({
21
- siteData
22
- }) {
23
- const isBlockTheme = siteData.currentTheme?.is_block_theme;
24
- return isBlockTheme ? /*#__PURE__*/_jsx(Editor, {}) : /*#__PURE__*/_jsx(SidebarNavigationScreenUnsupported, {});
25
- },
26
- preview({
27
- siteData
28
- }) {
29
- const isBlockTheme = siteData.currentTheme?.is_block_theme;
30
- return isBlockTheme ? /*#__PURE__*/_jsx(Editor, {}) : /*#__PURE__*/_jsx(SidebarNavigationScreenUnsupported, {});
31
- }
32
- }
33
+ areas
34
+ };
35
+ export const staticTemplateItemRoute = {
36
+ name: 'static-template-item',
37
+ path: '/wp_registered_template/*postId',
38
+ areas
33
39
  };
34
40
  //# sourceMappingURL=template-item.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Editor","SidebarNavigationScreenTemplatesBrowse","SidebarNavigationScreenUnsupported","jsx","_jsx","templateItemRoute","name","path","areas","sidebar","siteData","isBlockTheme","currentTheme","is_block_theme","backPath","mobile","preview"],"sources":["@wordpress/edit-site/src/components/site-editor-routes/template-item.js"],"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\nexport const templateItemRoute = {\n\tname: 'template-item',\n\tpath: '/wp_template/*postId',\n\tareas: {\n\t\tsidebar( { siteData } ) {\n\t\t\tconst isBlockTheme = siteData.currentTheme?.is_block_theme;\n\t\t\treturn isBlockTheme ? (\n\t\t\t\t<SidebarNavigationScreenTemplatesBrowse backPath=\"/\" />\n\t\t\t) : (\n\t\t\t\t<SidebarNavigationScreenUnsupported />\n\t\t\t);\n\t\t},\n\t\tmobile( { siteData } ) {\n\t\t\tconst isBlockTheme = siteData.currentTheme?.is_block_theme;\n\t\t\treturn isBlockTheme ? (\n\t\t\t\t<Editor />\n\t\t\t) : (\n\t\t\t\t<SidebarNavigationScreenUnsupported />\n\t\t\t);\n\t\t},\n\t\tpreview( { siteData } ) {\n\t\t\tconst isBlockTheme = siteData.currentTheme?.is_block_theme;\n\t\t\treturn isBlockTheme ? (\n\t\t\t\t<Editor />\n\t\t\t) : (\n\t\t\t\t<SidebarNavigationScreenUnsupported />\n\t\t\t);\n\t\t},\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,MAAM,MAAM,WAAW;AAC9B,OAAOC,sCAAsC,MAAM,+CAA+C;AAClG,OAAOC,kCAAkC,MAAM,0CAA0C;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE1F,OAAO,MAAMC,iBAAiB,GAAG;EAChCC,IAAI,EAAE,eAAe;EACrBC,IAAI,EAAE,sBAAsB;EAC5BC,KAAK,EAAE;IACNC,OAAOA,CAAE;MAAEC;IAAS,CAAC,EAAG;MACvB,MAAMC,YAAY,GAAGD,QAAQ,CAACE,YAAY,EAAEC,cAAc;MAC1D,OAAOF,YAAY,gBAClBP,IAAA,CAACH,sCAAsC;QAACa,QAAQ,EAAC;MAAG,CAAE,CAAC,gBAEvDV,IAAA,CAACF,kCAAkC,IAAE,CACrC;IACF,CAAC;IACDa,MAAMA,CAAE;MAAEL;IAAS,CAAC,EAAG;MACtB,MAAMC,YAAY,GAAGD,QAAQ,CAACE,YAAY,EAAEC,cAAc;MAC1D,OAAOF,YAAY,gBAClBP,IAAA,CAACJ,MAAM,IAAE,CAAC,gBAEVI,IAAA,CAACF,kCAAkC,IAAE,CACrC;IACF,CAAC;IACDc,OAAOA,CAAE;MAAEN;IAAS,CAAC,EAAG;MACvB,MAAMC,YAAY,GAAGD,QAAQ,CAACE,YAAY,EAAEC,cAAc;MAC1D,OAAOF,YAAY,gBAClBP,IAAA,CAACJ,MAAM,IAAE,CAAC,gBAEVI,IAAA,CAACF,kCAAkC,IAAE,CACrC;IACF;EACD;AACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Editor","SidebarNavigationScreenTemplatesBrowse","SidebarNavigationScreenUnsupported","jsx","_jsx","areas","sidebar","siteData","isBlockTheme","currentTheme","is_block_theme","backPath","mobile","preview","templateItemRoute","name","path","staticTemplateItemRoute"],"sources":["@wordpress/edit-site/src/components/site-editor-routes/template-item.js"],"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"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,MAAM,MAAM,WAAW;AAC9B,OAAOC,sCAAsC,MAAM,+CAA+C;AAClG,OAAOC,kCAAkC,MAAM,0CAA0C;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE1F,MAAMC,KAAK,GAAG;EACbC,OAAOA,CAAE;IAAEC;EAAS,CAAC,EAAG;IACvB,MAAMC,YAAY,GAAGD,QAAQ,CAACE,YAAY,EAAEC,cAAc;IAC1D,OAAOF,YAAY,gBAClBJ,IAAA,CAACH,sCAAsC;MAACU,QAAQ,EAAC;IAAG,CAAE,CAAC,gBAEvDP,IAAA,CAACF,kCAAkC,IAAE,CACrC;EACF,CAAC;EACDU,MAAMA,CAAE;IAAEL;EAAS,CAAC,EAAG;IACtB,MAAMC,YAAY,GAAGD,QAAQ,CAACE,YAAY,EAAEC,cAAc;IAC1D,OAAOF,YAAY,gBAClBJ,IAAA,CAACJ,MAAM,IAAE,CAAC,gBAEVI,IAAA,CAACF,kCAAkC,IAAE,CACrC;EACF,CAAC;EACDW,OAAOA,CAAE;IAAEN;EAAS,CAAC,EAAG;IACvB,MAAMC,YAAY,GAAGD,QAAQ,CAACE,YAAY,EAAEC,cAAc;IAC1D,OAAOF,YAAY,gBAClBJ,IAAA,CAACJ,MAAM,IAAE,CAAC,gBAEVI,IAAA,CAACF,kCAAkC,IAAE,CACrC;EACF;AACD,CAAC;AAED,OAAO,MAAMY,iBAAiB,GAAG;EAChCC,IAAI,EAAE,eAAe;EACrBC,IAAI,EAAE,sBAAsB;EAC5BX;AACD,CAAC;AAED,OAAO,MAAMY,uBAAuB,GAAG;EACtCF,IAAI,EAAE,sBAAsB;EAC5BC,IAAI,EAAE,iCAAiC;EACvCX;AACD,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "6.30.1-next.a730c9c8c.0",
3
+ "version": "6.31.1-next.233ccab9b.0",
4
4
  "description": "Edit Site Page module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -30,45 +30,45 @@
30
30
  "dependencies": {
31
31
  "@babel/runtime": "7.25.7",
32
32
  "@react-spring/web": "^9.4.5",
33
- "@wordpress/a11y": "^4.30.1-next.a730c9c8c.0",
34
- "@wordpress/api-fetch": "^7.30.1-next.a730c9c8c.0",
35
- "@wordpress/blob": "^4.30.1-next.a730c9c8c.0",
36
- "@wordpress/block-editor": "^15.3.1-next.a730c9c8c.0",
37
- "@wordpress/block-library": "^9.30.1-next.a730c9c8c.0",
38
- "@wordpress/blocks": "^15.3.1-next.a730c9c8c.0",
39
- "@wordpress/commands": "^1.30.1-next.a730c9c8c.0",
40
- "@wordpress/components": "^30.3.2-next.a730c9c8c.0",
41
- "@wordpress/compose": "^7.30.1-next.a730c9c8c.0",
42
- "@wordpress/core-data": "^7.30.1-next.a730c9c8c.0",
43
- "@wordpress/data": "^10.30.1-next.a730c9c8c.0",
44
- "@wordpress/dataviews": "^9.0.1-next.a730c9c8c.0",
45
- "@wordpress/date": "^5.30.1-next.a730c9c8c.0",
46
- "@wordpress/deprecated": "^4.30.1-next.a730c9c8c.0",
47
- "@wordpress/dom": "^4.30.1-next.a730c9c8c.0",
48
- "@wordpress/editor": "^14.30.1-next.a730c9c8c.0",
49
- "@wordpress/element": "^6.30.1-next.a730c9c8c.0",
50
- "@wordpress/escape-html": "^3.30.1-next.a730c9c8c.0",
51
- "@wordpress/fields": "^0.22.1-next.a730c9c8c.0",
52
- "@wordpress/hooks": "^4.30.1-next.a730c9c8c.0",
53
- "@wordpress/html-entities": "^4.30.1-next.a730c9c8c.0",
54
- "@wordpress/i18n": "^6.3.1-next.a730c9c8c.0",
55
- "@wordpress/icons": "^10.30.1-next.a730c9c8c.0",
56
- "@wordpress/keyboard-shortcuts": "^5.30.1-next.a730c9c8c.0",
57
- "@wordpress/keycodes": "^4.30.1-next.a730c9c8c.0",
58
- "@wordpress/media-utils": "^5.30.1-next.a730c9c8c.0",
59
- "@wordpress/notices": "^5.30.1-next.a730c9c8c.0",
60
- "@wordpress/patterns": "^2.30.1-next.a730c9c8c.0",
61
- "@wordpress/plugins": "^7.30.1-next.a730c9c8c.0",
62
- "@wordpress/preferences": "^4.30.1-next.a730c9c8c.0",
63
- "@wordpress/primitives": "^4.30.1-next.a730c9c8c.0",
64
- "@wordpress/private-apis": "^1.30.1-next.a730c9c8c.0",
65
- "@wordpress/reusable-blocks": "^5.30.1-next.a730c9c8c.0",
66
- "@wordpress/router": "^1.30.1-next.a730c9c8c.0",
67
- "@wordpress/style-engine": "^2.30.1-next.a730c9c8c.0",
68
- "@wordpress/url": "^4.30.1-next.a730c9c8c.0",
69
- "@wordpress/viewport": "^6.30.1-next.a730c9c8c.0",
70
- "@wordpress/widgets": "^4.30.1-next.a730c9c8c.0",
71
- "@wordpress/wordcount": "^4.30.1-next.a730c9c8c.0",
33
+ "@wordpress/a11y": "^4.31.1-next.233ccab9b.0",
34
+ "@wordpress/api-fetch": "^7.31.1-next.233ccab9b.0",
35
+ "@wordpress/blob": "^4.31.1-next.233ccab9b.0",
36
+ "@wordpress/block-editor": "^15.4.1-next.233ccab9b.0",
37
+ "@wordpress/block-library": "^9.31.1-next.233ccab9b.0",
38
+ "@wordpress/blocks": "^15.4.1-next.233ccab9b.0",
39
+ "@wordpress/commands": "^1.31.1-next.233ccab9b.0",
40
+ "@wordpress/components": "^30.5.1-next.233ccab9b.0",
41
+ "@wordpress/compose": "^7.31.1-next.233ccab9b.0",
42
+ "@wordpress/core-data": "^7.31.1-next.233ccab9b.0",
43
+ "@wordpress/data": "^10.31.1-next.233ccab9b.0",
44
+ "@wordpress/dataviews": "^9.1.1-next.233ccab9b.0",
45
+ "@wordpress/date": "^5.31.1-next.233ccab9b.0",
46
+ "@wordpress/deprecated": "^4.31.1-next.233ccab9b.0",
47
+ "@wordpress/dom": "^4.31.1-next.233ccab9b.0",
48
+ "@wordpress/editor": "^14.31.1-next.233ccab9b.0",
49
+ "@wordpress/element": "^6.31.1-next.233ccab9b.0",
50
+ "@wordpress/escape-html": "^3.31.1-next.233ccab9b.0",
51
+ "@wordpress/fields": "^0.23.1-next.233ccab9b.0",
52
+ "@wordpress/hooks": "^4.31.1-next.233ccab9b.0",
53
+ "@wordpress/html-entities": "^4.31.1-next.233ccab9b.0",
54
+ "@wordpress/i18n": "^6.4.1-next.233ccab9b.0",
55
+ "@wordpress/icons": "^10.31.1-next.233ccab9b.0",
56
+ "@wordpress/keyboard-shortcuts": "^5.31.1-next.233ccab9b.0",
57
+ "@wordpress/keycodes": "^4.31.1-next.233ccab9b.0",
58
+ "@wordpress/media-utils": "^5.31.1-next.233ccab9b.0",
59
+ "@wordpress/notices": "^5.31.1-next.233ccab9b.0",
60
+ "@wordpress/patterns": "^2.31.1-next.233ccab9b.0",
61
+ "@wordpress/plugins": "^7.31.1-next.233ccab9b.0",
62
+ "@wordpress/preferences": "^4.31.1-next.233ccab9b.0",
63
+ "@wordpress/primitives": "^4.31.1-next.233ccab9b.0",
64
+ "@wordpress/private-apis": "^1.31.1-next.233ccab9b.0",
65
+ "@wordpress/reusable-blocks": "^5.31.1-next.233ccab9b.0",
66
+ "@wordpress/router": "^1.31.1-next.233ccab9b.0",
67
+ "@wordpress/style-engine": "^2.31.1-next.233ccab9b.0",
68
+ "@wordpress/url": "^4.31.1-next.233ccab9b.0",
69
+ "@wordpress/viewport": "^6.31.1-next.233ccab9b.0",
70
+ "@wordpress/widgets": "^4.31.1-next.233ccab9b.0",
71
+ "@wordpress/wordcount": "^4.31.1-next.233ccab9b.0",
72
72
  "change-case": "^4.1.2",
73
73
  "clsx": "^2.1.1",
74
74
  "colord": "^2.9.2",
@@ -83,5 +83,5 @@
83
83
  "publishConfig": {
84
84
  "access": "public"
85
85
  },
86
- "gitHead": "85a580bd2c55f811c8969b42dbb10209d19d514e"
86
+ "gitHead": "d11f971521e4b39b07124d5c5516890ff98b0e31"
87
87
  }
@@ -17,6 +17,7 @@ import { useEntityRecords } from '@wordpress/core-data';
17
17
  import { decodeEntities } from '@wordpress/html-entities';
18
18
  import { useDebouncedInput } from '@wordpress/compose';
19
19
  import { focus } from '@wordpress/dom';
20
+ import { safeDecodeURI } from '@wordpress/url';
20
21
 
21
22
  /**
22
23
  * Internal dependencies
@@ -67,7 +68,7 @@ function SuggestionListItem( {
67
68
  lineHeight={ 1.53846153846 } // 20px
68
69
  className={ `${ baseCssClass }__info` }
69
70
  >
70
- { suggestion.link }
71
+ { safeDecodeURI( suggestion.link ) }
71
72
  </Text>
72
73
  ) }
73
74
  </Composite.Item>
@@ -172,9 +173,7 @@ function AddCustomTemplateModalContent( {
172
173
  onBack,
173
174
  containerRef,
174
175
  } ) {
175
- const [ showSearchEntities, setShowSearchEntities ] = useState(
176
- entityForSuggestions.hasGeneralTemplate
177
- );
176
+ const [ showSearchEntities, setShowSearchEntities ] = useState();
178
177
 
179
178
  // Focus on the first focusable element when the modal opens.
180
179
  // We handle focus management in the parent modal, just need to focus on the first focusable element.
@@ -53,7 +53,6 @@ import { TEMPLATE_POST_TYPE } from '../../utils/constants';
53
53
  */
54
54
  import AddCustomTemplateModalContent from './add-custom-template-modal-content';
55
55
  import {
56
- useExistingTemplates,
57
56
  useDefaultTemplateTypes,
58
57
  useTaxonomiesMenuItems,
59
58
  usePostTypeMenuItems,
@@ -387,15 +386,9 @@ function NewTemplate() {
387
386
  }
388
387
 
389
388
  function useMissingTemplates( setEntityForSuggestions, onClick ) {
390
- const existingTemplates = useExistingTemplates();
391
389
  const defaultTemplateTypes = useDefaultTemplateTypes();
392
- const existingTemplateSlugs = ( existingTemplates || [] ).map(
393
- ( { slug } ) => slug
394
- );
395
390
  const missingDefaultTemplates = ( defaultTemplateTypes || [] ).filter(
396
- ( template ) =>
397
- DEFAULT_TEMPLATE_SLUGS.includes( template.slug ) &&
398
- ! existingTemplateSlugs.includes( template.slug )
391
+ ( template ) => DEFAULT_TEMPLATE_SLUGS.includes( template.slug )
399
392
  );
400
393
  const onClickMenuItem = ( _entityForSuggestions ) => {
401
394
  onClick?.();
@@ -7,6 +7,7 @@ import { decodeEntities } from '@wordpress/html-entities';
7
7
  import { useMemo, useCallback } from '@wordpress/element';
8
8
  import { __, _x, sprintf } from '@wordpress/i18n';
9
9
  import { blockMeta, post, archive } from '@wordpress/icons';
10
+ import { safeDecodeURI } from '@wordpress/url';
10
11
 
11
12
  /**
12
13
  * Internal dependencies
@@ -29,6 +30,20 @@ const getValueFromObjectPath = ( object, path ) => {
29
30
  return value;
30
31
  };
31
32
 
33
+ /**
34
+ * Helper that adds a prefix to a post slug. The slug needs to be URL-decoded first,
35
+ * so that we have raw Unicode characters there. The server will truncate the slug to
36
+ * 200 characters, respecing Unicode char boundary. On the other hand, the server
37
+ * doesn't detect urlencoded octet boundary and can possibly construct slugs that
38
+ * are not valid urlencoded strings.
39
+ * @param {string} prefix The prefix to add to the slug.
40
+ * @param {string} slug The slug to add the prefix to.
41
+ * @return {string} The slug with the prefix.
42
+ */
43
+ function prefixSlug( prefix, slug ) {
44
+ return `${ prefix }-${ safeDecodeURI( slug ) }`;
45
+ }
46
+
32
47
  /**
33
48
  * Helper util to map records to add a `name` prop from a
34
49
  * provided path, in order to handle all entities in the same
@@ -189,7 +204,6 @@ export function usePostTypeArchiveMenuItems() {
189
204
 
190
205
  export const usePostTypeMenuItems = ( onClickMenuItem ) => {
191
206
  const publicPostTypes = usePublicPostTypes();
192
- const existingTemplates = useExistingTemplates();
193
207
  const defaultTemplateTypes = useDefaultTemplateTypes();
194
208
  // We need to keep track of naming conflicts. If a conflict
195
209
  // occurs, we need to add slug.
@@ -229,9 +243,6 @@ export const usePostTypeMenuItems = ( onClickMenuItem ) => {
229
243
  [ publicPostTypes ]
230
244
  );
231
245
  const postTypesInfo = useEntitiesInfo( 'postType', templatePrefixes );
232
- const existingTemplateSlugs = ( existingTemplates || [] ).map(
233
- ( { slug } ) => slug
234
- );
235
246
  const menuItems = ( publicPostTypes || [] ).reduce(
236
247
  ( accumulator, postType ) => {
237
248
  const { slug, labels, icon } = postType;
@@ -242,8 +253,6 @@ export const usePostTypeMenuItems = ( onClickMenuItem ) => {
242
253
  const defaultTemplateType = defaultTemplateTypes?.find(
243
254
  ( { slug: _slug } ) => _slug === generalTemplateSlug
244
255
  );
245
- const hasGeneralTemplate =
246
- existingTemplateSlugs?.includes( generalTemplateSlug );
247
256
  const _needsUniqueIdentifier = needsUniqueIdentifier( postType );
248
257
  let menuItemTitle =
249
258
  labels.template_name ||
@@ -312,7 +321,10 @@ export const usePostTypeMenuItems = ( onClickMenuItem ) => {
312
321
  };
313
322
  },
314
323
  getSpecificTemplate: ( suggestion ) => {
315
- const templateSlug = `${ templatePrefixes[ slug ] }-${ suggestion.slug }`;
324
+ const templateSlug = prefixSlug(
325
+ templatePrefixes[ slug ],
326
+ suggestion.slug
327
+ );
316
328
  return {
317
329
  title: templateSlug,
318
330
  slug: templateSlug,
@@ -321,14 +333,12 @@ export const usePostTypeMenuItems = ( onClickMenuItem ) => {
321
333
  },
322
334
  },
323
335
  labels,
324
- hasGeneralTemplate,
325
336
  template,
326
337
  } );
327
338
  };
328
339
  }
329
- // We don't need to add the menu item if there are no
330
- // entities and the general template exists.
331
- if ( ! hasGeneralTemplate || hasEntities ) {
340
+ // We don't need to add the menu item if there are no entities.
341
+ if ( hasEntities ) {
332
342
  accumulator.push( menuItem );
333
343
  }
334
344
  return accumulator;
@@ -468,7 +478,10 @@ export const useTaxonomiesMenuItems = ( onClickMenuItem ) => {
468
478
  };
469
479
  },
470
480
  getSpecificTemplate: ( suggestion ) => {
471
- const templateSlug = `${ templatePrefixes[ slug ] }-${ suggestion.slug }`;
481
+ const templateSlug = prefixSlug(
482
+ templatePrefixes[ slug ],
483
+ suggestion.slug
484
+ );
472
485
  return {
473
486
  title: templateSlug,
474
487
  slug: templateSlug,
@@ -553,9 +566,16 @@ export function useAuthorMenuItem( onClickMenuItem ) {
553
566
  };
554
567
  },
555
568
  getSpecificTemplate: ( suggestion ) => {
556
- const templateSlug = `author-${ suggestion.slug }`;
569
+ const templateSlug = prefixSlug(
570
+ 'author',
571
+ suggestion.slug
572
+ );
557
573
  return {
558
- title: templateSlug,
574
+ title: sprintf(
575
+ // translators: %s: Name of the author e.g: "Admin".
576
+ __( 'Author: %s' ),
577
+ suggestion.name
578
+ ),
559
579
  slug: templateSlug,
560
580
  templatePrefix: 'author',
561
581
  };
@@ -577,91 +597,6 @@ export function useAuthorMenuItem( onClickMenuItem ) {
577
597
  }
578
598
  }
579
599
 
580
- /**
581
- * Helper hook that filters all the existing templates by the given
582
- * object with the entity's slug as key and the template prefix as value.
583
- *
584
- * Example:
585
- * `existingTemplates` is: [ { slug: 'tag-apple' }, { slug: 'page-about' }, { slug: 'tag' } ]
586
- * `templatePrefixes` is: { post_tag: 'tag' }
587
- * It will return: { post_tag: ['apple'] }
588
- *
589
- * Note: We append the `-` to the given template prefix in this function for our checks.
590
- *
591
- * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.
592
- * @return {Record<string,string[]>} An object with the entity's slug as key and an array with the existing template slugs as value.
593
- */
594
- const useExistingTemplateSlugs = ( templatePrefixes ) => {
595
- const existingTemplates = useExistingTemplates();
596
- const existingSlugs = useMemo( () => {
597
- return Object.entries( templatePrefixes || {} ).reduce(
598
- ( accumulator, [ slug, prefix ] ) => {
599
- const slugsWithTemplates = ( existingTemplates || [] ).reduce(
600
- ( _accumulator, existingTemplate ) => {
601
- const _prefix = `${ prefix }-`;
602
- if ( existingTemplate.slug.startsWith( _prefix ) ) {
603
- _accumulator.push(
604
- existingTemplate.slug.substring(
605
- _prefix.length
606
- )
607
- );
608
- }
609
- return _accumulator;
610
- },
611
- []
612
- );
613
- if ( slugsWithTemplates.length ) {
614
- accumulator[ slug ] = slugsWithTemplates;
615
- }
616
- return accumulator;
617
- },
618
- {}
619
- );
620
- }, [ templatePrefixes, existingTemplates ] );
621
- return existingSlugs;
622
- };
623
-
624
- /**
625
- * Helper hook that finds the existing records with an associated template,
626
- * as they need to be excluded from the template suggestions.
627
- *
628
- * @param {string} entityName The entity's name.
629
- * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.
630
- * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.
631
- * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the existing records as value.
632
- */
633
- const useTemplatesToExclude = (
634
- entityName,
635
- templatePrefixes,
636
- additionalQueryParameters = {}
637
- ) => {
638
- const slugsToExcludePerEntity =
639
- useExistingTemplateSlugs( templatePrefixes );
640
- const recordsToExcludePerEntity = useSelect(
641
- ( select ) => {
642
- return Object.entries( slugsToExcludePerEntity || {} ).reduce(
643
- ( accumulator, [ slug, slugsWithTemplates ] ) => {
644
- const entitiesWithTemplates = select(
645
- coreStore
646
- ).getEntityRecords( entityName, slug, {
647
- _fields: 'id',
648
- context: 'view',
649
- slug: slugsWithTemplates,
650
- ...additionalQueryParameters[ slug ],
651
- } );
652
- if ( entitiesWithTemplates?.length ) {
653
- accumulator[ slug ] = entitiesWithTemplates;
654
- }
655
- return accumulator;
656
- },
657
- {}
658
- );
659
- },
660
- [ slugsToExcludePerEntity ]
661
- );
662
- return recordsToExcludePerEntity;
663
- };
664
-
665
600
  /**
666
601
  * Helper hook that returns information about an entity having
667
602
  * records that we can create a specific template for.
@@ -682,26 +617,16 @@ const useEntitiesInfo = (
682
617
  templatePrefixes,
683
618
  additionalQueryParameters = EMPTY_OBJECT
684
619
  ) => {
685
- const recordsToExcludePerEntity = useTemplatesToExclude(
686
- entityName,
687
- templatePrefixes,
688
- additionalQueryParameters
689
- );
690
620
  const entitiesHasRecords = useSelect(
691
621
  ( select ) => {
692
622
  return Object.keys( templatePrefixes || {} ).reduce(
693
623
  ( accumulator, slug ) => {
694
- const existingEntitiesIds =
695
- recordsToExcludePerEntity?.[ slug ]?.map(
696
- ( { id } ) => id
697
- ) || [];
698
624
  accumulator[ slug ] = !! select(
699
625
  coreStore
700
626
  ).getEntityRecords( entityName, slug, {
701
627
  per_page: 1,
702
628
  _fields: 'id',
703
629
  context: 'view',
704
- exclude: existingEntitiesIds,
705
630
  ...additionalQueryParameters[ slug ],
706
631
  } )?.length;
707
632
  return accumulator;
@@ -709,28 +634,18 @@ const useEntitiesInfo = (
709
634
  {}
710
635
  );
711
636
  },
712
- [
713
- templatePrefixes,
714
- recordsToExcludePerEntity,
715
- entityName,
716
- additionalQueryParameters,
717
- ]
637
+ [ templatePrefixes, entityName, additionalQueryParameters ]
718
638
  );
719
639
  const entitiesInfo = useMemo( () => {
720
640
  return Object.keys( templatePrefixes || {} ).reduce(
721
641
  ( accumulator, slug ) => {
722
- const existingEntitiesIds =
723
- recordsToExcludePerEntity?.[ slug ]?.map(
724
- ( { id } ) => id
725
- ) || [];
726
642
  accumulator[ slug ] = {
727
643
  hasEntities: entitiesHasRecords[ slug ],
728
- existingEntitiesIds,
729
644
  };
730
645
  return accumulator;
731
646
  },
732
647
  {}
733
648
  );
734
- }, [ templatePrefixes, recordsToExcludePerEntity, entitiesHasRecords ] );
649
+ }, [ templatePrefixes, entitiesHasRecords ] );
735
650
  return entitiesInfo;
736
651
  };
@@ -5,6 +5,8 @@ import { __ } from '@wordpress/i18n';
5
5
  import { edit } from '@wordpress/icons';
6
6
  import { useMemo } from '@wordpress/element';
7
7
  import { privateApis as routerPrivateApis } from '@wordpress/router';
8
+ import { useDispatch, useSelect } from '@wordpress/data';
9
+ import { store as coreStore } from '@wordpress/core-data';
8
10
 
9
11
  /**
10
12
  * Internal dependencies
@@ -14,6 +16,55 @@ import { unlock } from '../../lock-unlock';
14
16
 
15
17
  const { useHistory } = unlock( routerPrivateApis );
16
18
 
19
+ export const useSetActiveTemplateAction = () => {
20
+ const { getEntityRecord } = useSelect( coreStore );
21
+ const { editEntityRecord, saveEditedEntityRecord } =
22
+ useDispatch( coreStore );
23
+ return useMemo(
24
+ () => ( {
25
+ id: 'set-active-template',
26
+ label( items ) {
27
+ return items.some( ( item ) => item._isActive )
28
+ ? __( 'Deactivate' )
29
+ : __( 'Activate' );
30
+ },
31
+ isPrimary: true,
32
+ icon: edit,
33
+ isEligible( item ) {
34
+ return ! ( item.slug === 'index' && item.source === 'theme' );
35
+ },
36
+ async callback( items ) {
37
+ const deactivate = items.some( ( item ) => item._isActive );
38
+ // current active templates
39
+ const activeTemplates = {
40
+ ...( ( await getEntityRecord( 'root', 'site' )
41
+ .active_templates ) ?? {} ),
42
+ };
43
+ for ( const item of items ) {
44
+ if ( deactivate ) {
45
+ if ( item.source === 'theme' ) {
46
+ activeTemplates[ item.slug ] = false;
47
+ } else {
48
+ delete activeTemplates[ item.slug ];
49
+ }
50
+ } else {
51
+ activeTemplates[ item.slug ] = item.id;
52
+ }
53
+ }
54
+ // To do: figure out why the REST API deletes the option when
55
+ // it's set to an empty object. That would trigger the migration
56
+ // function, which will make all templates in the database active.
57
+ activeTemplates.__preventCollapse = 0;
58
+ await editEntityRecord( 'root', 'site', undefined, {
59
+ active_templates: activeTemplates,
60
+ } );
61
+ await saveEditedEntityRecord( 'root', 'site' );
62
+ },
63
+ } ),
64
+ [ editEntityRecord, saveEditedEntityRecord, getEntityRecord ]
65
+ );
66
+ };
67
+
17
68
  export const useEditPostAction = () => {
18
69
  const history = useHistory();
19
70
  return useMemo(
@@ -110,6 +110,7 @@ function getNavigationPath( location, postType ) {
110
110
  'template-part-item',
111
111
  'page-item',
112
112
  'template-item',
113
+ 'static-template-item',
113
114
  'post-item',
114
115
  ].includes( name )
115
116
  ) {