@wordpress/edit-site 4.12.0 → 4.13.1-next.957ca95e4c.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 (109) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-template/new-template.js +8 -3
  3. package/build/components/add-new-template/new-template.js.map +1 -1
  4. package/build/components/add-new-template/utils.js +90 -52
  5. package/build/components/add-new-template/utils.js.map +1 -1
  6. package/build/components/block-editor/resizable-editor.js +26 -12
  7. package/build/components/block-editor/resizable-editor.js.map +1 -1
  8. package/build/components/global-styles/border-panel.js +3 -3
  9. package/build/components/global-styles/border-panel.js.map +1 -1
  10. package/build/components/global-styles/dimensions-panel.js +110 -7
  11. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  12. package/build/components/global-styles/hooks.js +4 -4
  13. package/build/components/global-styles/hooks.js.map +1 -1
  14. package/build/components/global-styles/preview.js +2 -2
  15. package/build/components/global-styles/preview.js.map +1 -1
  16. package/build/components/global-styles/typography-panel.js +28 -21
  17. package/build/components/global-styles/typography-panel.js.map +1 -1
  18. package/build/components/global-styles/use-global-styles-output.js +42 -10
  19. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  20. package/build/components/global-styles/utils.js +39 -5
  21. package/build/components/global-styles/utils.js.map +1 -1
  22. package/build/components/header/document-actions/index.js +1 -0
  23. package/build/components/header/document-actions/index.js.map +1 -1
  24. package/build/components/header/index.js +5 -2
  25. package/build/components/header/index.js.map +1 -1
  26. package/build/components/header/mode-switcher/index.js +0 -4
  27. package/build/components/header/mode-switcher/index.js.map +1 -1
  28. package/build/components/header/more-menu/index.js +13 -3
  29. package/build/components/header/more-menu/index.js.map +1 -1
  30. package/build/components/sidebar/default-sidebar.js +11 -1
  31. package/build/components/sidebar/default-sidebar.js.map +1 -1
  32. package/build/components/sidebar/plugin-sidebar/index.js +11 -1
  33. package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
  34. package/build/components/template-details/edit-template-title.js +1 -1
  35. package/build/components/template-details/edit-template-title.js.map +1 -1
  36. package/build/components/template-details/index.js +18 -8
  37. package/build/components/template-details/index.js.map +1 -1
  38. package/build/components/template-details/template-part-area-selector.js +47 -0
  39. package/build/components/template-details/template-part-area-selector.js.map +1 -0
  40. package/build/index.js +1 -1
  41. package/build/index.js.map +1 -1
  42. package/build-module/components/add-new-template/new-template.js +10 -5
  43. package/build-module/components/add-new-template/new-template.js.map +1 -1
  44. package/build-module/components/add-new-template/utils.js +87 -52
  45. package/build-module/components/add-new-template/utils.js.map +1 -1
  46. package/build-module/components/block-editor/resizable-editor.js +26 -12
  47. package/build-module/components/block-editor/resizable-editor.js.map +1 -1
  48. package/build-module/components/global-styles/border-panel.js +3 -3
  49. package/build-module/components/global-styles/border-panel.js.map +1 -1
  50. package/build-module/components/global-styles/dimensions-panel.js +108 -8
  51. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  52. package/build-module/components/global-styles/hooks.js +5 -5
  53. package/build-module/components/global-styles/hooks.js.map +1 -1
  54. package/build-module/components/global-styles/preview.js +2 -2
  55. package/build-module/components/global-styles/preview.js.map +1 -1
  56. package/build-module/components/global-styles/typography-panel.js +29 -22
  57. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  58. package/build-module/components/global-styles/use-global-styles-output.js +42 -10
  59. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  60. package/build-module/components/global-styles/utils.js +39 -5
  61. package/build-module/components/global-styles/utils.js.map +1 -1
  62. package/build-module/components/header/document-actions/index.js +1 -0
  63. package/build-module/components/header/document-actions/index.js.map +1 -1
  64. package/build-module/components/header/index.js +5 -2
  65. package/build-module/components/header/index.js.map +1 -1
  66. package/build-module/components/header/mode-switcher/index.js +0 -4
  67. package/build-module/components/header/mode-switcher/index.js.map +1 -1
  68. package/build-module/components/header/more-menu/index.js +13 -3
  69. package/build-module/components/header/more-menu/index.js.map +1 -1
  70. package/build-module/components/sidebar/default-sidebar.js +9 -1
  71. package/build-module/components/sidebar/default-sidebar.js.map +1 -1
  72. package/build-module/components/sidebar/plugin-sidebar/index.js +9 -1
  73. package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
  74. package/build-module/components/template-details/edit-template-title.js +1 -1
  75. package/build-module/components/template-details/edit-template-title.js.map +1 -1
  76. package/build-module/components/template-details/index.js +18 -9
  77. package/build-module/components/template-details/index.js.map +1 -1
  78. package/build-module/components/template-details/template-part-area-selector.js +35 -0
  79. package/build-module/components/template-details/template-part-area-selector.js.map +1 -0
  80. package/build-module/index.js +1 -1
  81. package/build-module/index.js.map +1 -1
  82. package/build-style/style-rtl.css +4 -6
  83. package/build-style/style.css +4 -6
  84. package/package.json +29 -29
  85. package/src/components/add-new-template/new-template.js +15 -4
  86. package/src/components/add-new-template/utils.js +82 -20
  87. package/src/components/block-editor/resizable-editor.js +28 -18
  88. package/src/components/editor/style.scss +1 -0
  89. package/src/components/global-styles/border-panel.js +3 -3
  90. package/src/components/global-styles/dimensions-panel.js +155 -30
  91. package/src/components/global-styles/hooks.js +6 -8
  92. package/src/components/global-styles/preview.js +2 -2
  93. package/src/components/global-styles/style.scss +3 -2
  94. package/src/components/global-styles/test/use-global-styles-output.js +16 -3
  95. package/src/components/global-styles/test/utils.js +68 -8
  96. package/src/components/global-styles/typography-panel.js +96 -94
  97. package/src/components/global-styles/use-global-styles-output.js +41 -14
  98. package/src/components/global-styles/utils.js +29 -4
  99. package/src/components/header/document-actions/index.js +3 -0
  100. package/src/components/header/index.js +4 -1
  101. package/src/components/header/mode-switcher/index.js +0 -3
  102. package/src/components/header/more-menu/index.js +7 -2
  103. package/src/components/sidebar/default-sidebar.js +12 -0
  104. package/src/components/sidebar/plugin-sidebar/index.js +12 -0
  105. package/src/components/template-details/edit-template-title.js +7 -3
  106. package/src/components/template-details/index.js +20 -7
  107. package/src/components/template-details/style.scss +0 -5
  108. package/src/components/template-details/template-part-area-selector.js +38 -0
  109. package/src/index.js +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["__","Button","MenuGroup","MenuItem","__experimentalHeading","Heading","__experimentalText","Text","useDispatch","useSelect","store","editorStore","isTemplateRevertable","editSiteStore","TemplateAreas","EditTemplateTitle","useLink","TemplateDetails","template","onClose","title","description","select","__experimentalGetTemplateInfo","revertTemplate","browseAllLinkProps","postType","type","postId","undefined","canEditTitle","is_custom","has_theme_file","revert"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,MADD,EAECC,SAFD,EAGCC,QAHD,EAICC,qBAAqB,IAAIC,OAJ1B,EAKCC,kBAAkB,IAAIC,IALvB,QAMO,uBANP;AAOA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,aAAvC;AACA,OAAOC,aAAP,MAA0B,kBAA1B;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,SAASC,OAAT,QAAwB,gBAAxB;AAEA,eAAe,SAASC,eAAT,OAAkD;AAAA,MAAxB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAwB;AAChE,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAyBZ,SAAS,CACrCa,MAAF,IACCA,MAAM,CAAEX,WAAF,CAAN,CAAsBY,6BAAtB,CAAqDL,QAArD,CAFsC,EAGvC,EAHuC,CAAxC;AAKA,QAAM;AAAEM,IAAAA;AAAF,MAAqBhB,WAAW,CAAEK,aAAF,CAAtC;AAEA,QAAMY,kBAAkB,GAAGT,OAAO,CAAE;AACnC;AACAU,IAAAA,QAAQ,EAAER,QAAQ,CAACS,IAFgB;AAGnCC,IAAAA,MAAM,EAAEC;AAH2B,GAAF,CAAlC,CARgE,CAchE;;AACA,QAAMC,Y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wordpress/i18n';\nimport {\n\tButton,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { store as editSiteStore } from '../../store';\nimport TemplateAreas from './template-areas';\nimport EditTemplateTitle from './edit-template-title';\nimport { useLink } from '../routes/link';\n\nexport default function TemplateDetails( { template, onClose } ) {\n\tconst { title, description } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetTemplateInfo( template ),\n\t\t[]\n\t);\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\n\tconst browseAllLinkProps = useLink( {\n\t\t// TODO: We should update this to filter by template part's areas as well.\n\t\tpostType: template.type,\n\t\tpostId: undefined,\n\t} );\n\n\t// Only user-created and non-default templates can change the name.\n\tconst canEditTitle = template.is_custom && ! template.has_theme_file;\n\n\tif ( ! template ) {\n\t\treturn null;\n\t}\n\n\tconst revert = () => {\n\t\trevertTemplate( template );\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<div className=\"edit-site-template-details\">\n\t\t\t<div className=\"edit-site-template-details__group\">\n\t\t\t\t{ canEditTitle ? (\n\t\t\t\t\t<EditTemplateTitle template={ template } />\n\t\t\t\t) : (\n\t\t\t\t\t<Heading\n\t\t\t\t\t\tlevel={ 4 }\n\t\t\t\t\t\tweight={ 600 }\n\t\t\t\t\t\tclassName=\"edit-site-template-details__title\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</Heading>\n\t\t\t\t) }\n\n\t\t\t\t{ description && (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize=\"body\"\n\t\t\t\t\t\tclassName=\"edit-site-template-details__description\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</div>\n\n\t\t\t<TemplateAreas closeTemplateDetailsDropdown={ onClose } />\n\n\t\t\t{ isTemplateRevertable( template ) && (\n\t\t\t\t<MenuGroup className=\"edit-site-template-details__group edit-site-template-details__revert\">\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tclassName=\"edit-site-template-details__revert-button\"\n\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t'Use the template as supplied by the theme.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ revert }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-template-details__show-all-button\"\n\t\t\t\t{ ...browseAllLinkProps }\n\t\t\t>\n\t\t\t\t{ template?.type === 'wp_template'\n\t\t\t\t\t? __( 'Browse all templates' )\n\t\t\t\t\t: __( 'Browse all template parts' ) }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["__","Button","MenuGroup","MenuItem","__experimentalVStack","VStack","__experimentalText","Text","useDispatch","useSelect","store","editorStore","isTemplateRevertable","editSiteStore","TemplateAreas","EditTemplateTitle","useLink","TemplatePartAreaSelector","TemplateDetails","template","onClose","title","description","select","__experimentalGetTemplateInfo","revertTemplate","browseAllLinkProps","postType","type","postId","undefined","isTemplatePart","canEditTitle","has_theme_file","is_custom","revert","id"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,MADD,EAECC,SAFD,EAGCC,QAHD,EAICC,oBAAoB,IAAIC,MAJzB,EAKCC,kBAAkB,IAAIC,IALvB,QAMO,uBANP;AAOA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,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AC,iBAAD;AAAmB,IAAA,QAAQ,EAAGb;AAA9B,IADa,GAGb,cAAC,IAAD;AACC,IAAA,IAAI,EAAG,EADR;AAEC,IAAA,MAAM,EAAG,GAFV;AAGC,IAAA,SAAS,EAAC,mCAHX;AAIC,IAAA,EAAE,EAAC;AAJJ,KAMGE,KANH,CAJF,EAcGC,WAAW,IACZ,cAAC,IAAD;AACC,IAAA,IAAI,EAAC,MADN;AAEC,IAAA,SAAS,EAAC,yCAFX;AAGC,IAAA,EAAE,EAAC;AAHJ,KAKGA,WALH,CAfF,CADD,EA0BGS,cAAc,IACf;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,wBAAD;AAA0B,IAAA,EAAE,EAAGZ,QAAQ,CAACiB;AAAxC,IADD,CA3BF,EAgCC,cAAC,aAAD;AAAe,IAAA,4BAA4B,EAAGhB;AAA9C,IAhCD,EAkCGR,oBAAoB,CAAEO,QAAF,CAApB,IACD,cAAC,SAAD;AAAW,IAAA,SAAS,EAAC;AAArB,KACC,cAAC,QAAD;AACC,IAAA,SAAS,EAAC,2CADX;AAEC,IAAA,IAAI,EAAGnB,EAAE,CACR,4CADQ,CAFV;AAKC,IAAA,OAAO,EAAGmC;AALX,KAOGnC,EAAE,CAAE,sBAAF,CAPL,CADD,CAnCF,EAgDC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC;AADX,KAEM0B,kBAFN,GAIG,CAAAP,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAES,IAAV,MAAmB,aAAnB,GACC5B,EAAE,CAAE,sBAAF,CADH,GAECA,EAAE,CAAE,2BAAF,CANN,CAhDD,CADD;AA2DA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalVStack as VStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { store as editSiteStore } from '../../store';\nimport TemplateAreas from './template-areas';\nimport EditTemplateTitle from './edit-template-title';\nimport { useLink } from '../routes/link';\nimport TemplatePartAreaSelector from './template-part-area-selector';\n\nexport default function TemplateDetails( { template, onClose } ) {\n\tconst { title, description } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetTemplateInfo( template ),\n\t\t[]\n\t);\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\n\tconst browseAllLinkProps = useLink( {\n\t\t// TODO: We should update this to filter by template part's areas as well.\n\t\tpostType: template.type,\n\t\tpostId: undefined,\n\t} );\n\n\tconst isTemplatePart = template.type === 'wp_template_part';\n\n\t// Only user-created and non-default templates can change the name.\n\t// But any user-created template part can be renamed.\n\tconst canEditTitle = isTemplatePart\n\t\t? ! template.has_theme_file\n\t\t: template.is_custom && ! template.has_theme_file;\n\n\tif ( ! template ) {\n\t\treturn null;\n\t}\n\n\tconst revert = () => {\n\t\trevertTemplate( template );\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<div className=\"edit-site-template-details\">\n\t\t\t<VStack className=\"edit-site-template-details__group\" spacing={ 3 }>\n\t\t\t\t{ canEditTitle ? (\n\t\t\t\t\t<EditTemplateTitle template={ template } />\n\t\t\t\t) : (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize={ 16 }\n\t\t\t\t\t\tweight={ 600 }\n\t\t\t\t\t\tclassName=\"edit-site-template-details__title\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\n\t\t\t\t{ description && (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize=\"body\"\n\t\t\t\t\t\tclassName=\"edit-site-template-details__description\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</VStack>\n\n\t\t\t{ isTemplatePart && (\n\t\t\t\t<div className=\"edit-site-template-details__group\">\n\t\t\t\t\t<TemplatePartAreaSelector id={ template.id } />\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t<TemplateAreas closeTemplateDetailsDropdown={ onClose } />\n\n\t\t\t{ isTemplateRevertable( template ) && (\n\t\t\t\t<MenuGroup className=\"edit-site-template-details__group edit-site-template-details__revert\">\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tclassName=\"edit-site-template-details__revert-button\"\n\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t'Use the template as supplied by the theme.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ revert }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-template-details__show-all-button\"\n\t\t\t\t{ ...browseAllLinkProps }\n\t\t\t>\n\t\t\t\t{ template?.type === 'wp_template'\n\t\t\t\t\t? __( 'Browse all templates' )\n\t\t\t\t\t: __( 'Browse all template parts' ) }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"]}
@@ -0,0 +1,35 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { __ } from '@wordpress/i18n';
7
+ import { SelectControl } from '@wordpress/components';
8
+ import { useEntityProp } from '@wordpress/core-data';
9
+ import { useSelect } from '@wordpress/data';
10
+ import { store as editorStore } from '@wordpress/editor';
11
+ export default function TemplatePartAreaSelector(_ref) {
12
+ let {
13
+ id
14
+ } = _ref;
15
+ const [area, setArea] = useEntityProp('postType', 'wp_template_part', 'area', id);
16
+ const definedAreas = useSelect(select => select(editorStore).__experimentalGetDefaultTemplatePartAreas(), []);
17
+ const areaOptions = definedAreas.map(_ref2 => {
18
+ let {
19
+ label,
20
+ area: _area
21
+ } = _ref2;
22
+ return {
23
+ label,
24
+ value: _area
25
+ };
26
+ });
27
+ return createElement(SelectControl, {
28
+ label: __('Area'),
29
+ labelPosition: "top",
30
+ options: areaOptions,
31
+ value: area,
32
+ onChange: setArea
33
+ });
34
+ }
35
+ //# sourceMappingURL=template-part-area-selector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/template-details/template-part-area-selector.js"],"names":["__","SelectControl","useEntityProp","useSelect","store","editorStore","TemplatePartAreaSelector","id","area","setArea","definedAreas","select","__experimentalGetDefaultTemplatePartAreas","areaOptions","map","label","_area","value"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,aAAT,QAA8B,uBAA9B;AACA,SAASC,aAAT,QAA8B,sBAA9B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AAEA,eAAe,SAASC,wBAAT,OAA4C;AAAA,MAAT;AAAEC,IAAAA;AAAF,GAAS;AAC1D,QAAM,CAAEC,IAAF,EAAQC,OAAR,IAAoBP,aAAa,CACtC,UADsC,EAEtC,kBAFsC,EAGtC,MAHsC,EAItCK,EAJsC,CAAvC;AAOA,QAAMG,YAAY,GAAGP,SAAS,CAC3BQ,MAAF,IACCA,MAAM,CAAEN,WAAF,CAAN,CAAsBO,yCAAtB,EAF4B,EAG7B,EAH6B,CAA9B;AAMA,QAAMC,WAAW,GAAGH,YAAY,CAACI,GAAb,CAAkB;AAAA,QAAE;AAAEC,MAAAA,KAAF;AAASP,MAAAA,IAAI,EAAEQ;AAAf,KAAF;AAAA,WAAgC;AACrED,MAAAA,KADqE;AAErEE,MAAAA,KAAK,EAAED;AAF8D,KAAhC;AAAA,GAAlB,CAApB;AAKA,SACC,cAAC,aAAD;AACC,IAAA,KAAK,EAAGhB,EAAE,CAAE,MAAF,CADX;AAEC,IAAA,aAAa,EAAC,KAFf;AAGC,IAAA,OAAO,EAAGa,WAHX;AAIC,IAAA,KAAK,EAAGL,IAJT;AAKC,IAAA,QAAQ,EAAGC;AALZ,IADD;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { SelectControl } from '@wordpress/components';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function TemplatePartAreaSelector( { id } ) {\n\tconst [ area, setArea ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'area',\n\t\tid\n\t);\n\n\tconst definedAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\n\tconst areaOptions = definedAreas.map( ( { label, area: _area } ) => ( {\n\t\tlabel,\n\t\tvalue: _area,\n\t} ) );\n\n\treturn (\n\t\t<SelectControl\n\t\t\tlabel={ __( 'Area' ) }\n\t\t\tlabelPosition=\"top\"\n\t\t\toptions={ areaOptions }\n\t\t\tvalue={ area }\n\t\t\tonChange={ setArea }\n\t\t/>\n\t);\n}\n"]}
@@ -55,7 +55,7 @@ export function reinitializeEditor(target, settings) {
55
55
  keepCaretInsideBlock: false,
56
56
  welcomeGuide: true,
57
57
  welcomeGuideStyles: true,
58
- shouldListViewOpenByDefault: false
58
+ showListViewByDefault: false
59
59
  }); // Check if the block list view should be open by default.
60
60
 
61
61
  if (select(preferencesStore).get('core/edit-site', 'showListViewByDefault')) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","select","render","unmountComponentAtNode","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","editorStore","interfaceStore","preferencesStore","__","viewportStore","getQueryArgs","editSiteStore","EditSiteApp","getIsListPage","ErrorBoundaryWarning","reinitializeEditor","target","settings","__unstableHomeTemplate","reboot","bind","setDefaults","editorMode","fixedToolbar","focusMode","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","shouldListViewOpenByDefault","get","setIsListViewOpened","setDefaultComplementaryArea","updateSettings","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","isLandingOnListPage","window","location","href","setIsNavigationPanelOpened","isViewportMatch","initializeEditor","id","search","searchOptions","__experimentalFetchRichUrlData","document","getElementById","__experimentalReapplyBlockTypeFilters","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","default","__experimentalMainDashboardButton","__experimentalNavigationToggle","PluginSidebar","PluginSidebarMoreMenuItem","PluginMoreMenuItem"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SACCC,kBADD,EAECC,4CAFD,QAGO,0BAHP;AAIA,SAASC,QAAT,EAAmBC,MAAnB,QAAiC,iBAAjC;AACA,SAASC,MAAT,EAAiBC,sBAAjB,QAA+C,oBAA/C;AACA,SACCC,kCAAkC,IAAIC,oBADvC,EAECC,0BAA0B,IAAIC,YAF/B,QAGO,sBAHP;AAIA,SAASX,KAAK,IAAIY,WAAlB,QAAqC,mBAArC;AACA,SAASZ,KAAK,IAAIa,cAAlB,QAAwC,sBAAxC;AACA,SAASb,KAAK,IAAIc,gBAAlB,QAA0C,wBAA1C;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASf,KAAK,IAAIgB,aAAlB,QAAuC,qBAAvC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;;AACA,OAAO,SAAP;AACA,SAASjB,KAAK,IAAIkB,aAAlB,QAAuC,SAAvC;AACA,OAAOC,WAAP,MAAwB,kBAAxB;AACA,OAAOC,aAAP,MAA0B,0BAA1B;AACA,OAAOC,oBAAP,MAAiC,qCAAjC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,kBAAT,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AO,IAAIG,aAApB,QAAyC,qCAAzC;AACA,SAASH,OAAO,IAAII,yBAApB,QAAqD,mDAArD;AACA,SAASJ,OAAO,IAAIK,kBAApB,QAA8C,2CAA9C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch, select } from '@wordpress/data';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { __ } from '@wordpress/i18n';\nimport { store as viewportStore } from '@wordpress/viewport';\nimport { getQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport EditSiteApp from './components/app';\nimport getIsListPage from './utils/get-is-list-page';\nimport ErrorBoundaryWarning from './components/error-boundary/warning';\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n */\nexport function reinitializeEditor( target, settings ) {\n\t// Display warning if editor wasn't able to resolve homepage template.\n\tif ( ! settings.__unstableHomeTemplate ) {\n\t\trender(\n\t\t\t<ErrorBoundaryWarning\n\t\t\t\tmessage={ __(\n\t\t\t\t\t'The editor is unable to find a block template for the homepage.'\n\t\t\t\t) }\n\t\t\t\tdashboardLink=\"index.php\"\n\t\t\t/>,\n\t\t\ttarget\n\t\t);\n\t\treturn;\n\t}\n\n\t// This will be a no-op if the target doesn't have any React nodes.\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\t{\n\t\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\t\teditorMode: 'visual',\n\t\t\tfixedToolbar: false,\n\t\t\tfocusMode: false,\n\t\t\tkeepCaretInsideBlock: false,\n\t\t\twelcomeGuide: true,\n\t\t\twelcomeGuideStyles: true,\n\t\t\tshouldListViewOpenByDefault: false,\n\t\t} );\n\n\t\t// Check if the block list view should be open by default.\n\t\tif (\n\t\t\tselect( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showListViewByDefault'\n\t\t\t)\n\t\t) {\n\t\t\tdispatch( editSiteStore ).setIsListViewOpened( true );\n\t\t}\n\n\t\tdispatch( interfaceStore ).setDefaultComplementaryArea(\n\t\t\t'core/edit-site',\n\t\t\t'edit-site/template'\n\t\t);\n\n\t\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t\t// so that they can be selected with core/editor selectors in any editor.\n\t\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t\t// which internally uses updateEditorSettings as well.\n\t\tdispatch( editorStore ).updateEditorSettings( {\n\t\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t\t} );\n\n\t\tconst isLandingOnListPage = getIsListPage(\n\t\t\tgetQueryArgs( window.location.href )\n\t\t);\n\n\t\tif ( isLandingOnListPage ) {\n\t\t\t// Default the navigation panel to be opened when we're in a bigger\n\t\t\t// screen and land in the list screen.\n\t\t\tdispatch( editSiteStore ).setIsNavigationPanelOpened(\n\t\t\t\tselect( viewportStore ).isViewportMatch( 'medium' )\n\t\t\t);\n\t\t}\n\t}\n\n\trender( <EditSiteApp reboot={ reboot } />, target );\n}\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\n\tconst target = document.getElementById( id );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks();\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\treinitializeEditor( target, settings );\n}\n\nexport { default as __experimentalMainDashboardButton } from './components/main-dashboard-button';\nexport { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","select","render","unmountComponentAtNode","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","editorStore","interfaceStore","preferencesStore","__","viewportStore","getQueryArgs","editSiteStore","EditSiteApp","getIsListPage","ErrorBoundaryWarning","reinitializeEditor","target","settings","__unstableHomeTemplate","reboot","bind","setDefaults","editorMode","fixedToolbar","focusMode","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","showListViewByDefault","get","setIsListViewOpened","setDefaultComplementaryArea","updateSettings","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","isLandingOnListPage","window","location","href","setIsNavigationPanelOpened","isViewportMatch","initializeEditor","id","search","searchOptions","__experimentalFetchRichUrlData","document","getElementById","__experimentalReapplyBlockTypeFilters","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","default","__experimentalMainDashboardButton","__experimentalNavigationToggle","PluginSidebar","PluginSidebarMoreMenuItem","PluginMoreMenuItem"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SACCC,kBADD,EAECC,4CAFD,QAGO,0BAHP;AAIA,SAASC,QAAT,EAAmBC,MAAnB,QAAiC,iBAAjC;AACA,SAASC,MAAT,EAAiBC,sBAAjB,QAA+C,oBAA/C;AACA,SACCC,kCAAkC,IAAIC,oBADvC,EAECC,0BAA0B,IAAIC,YAF/B,QAGO,sBAHP;AAIA,SAASX,KAAK,IAAIY,WAAlB,QAAqC,mBAArC;AACA,SAASZ,KAAK,IAAIa,cAAlB,QAAwC,sBAAxC;AACA,SAASb,KAAK,IAAIc,gBAAlB,QAA0C,wBAA1C;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASf,KAAK,IAAIgB,aAAlB,QAAuC,qBAAvC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;;AACA,OAAO,SAAP;AACA,SAASjB,KAAK,IAAIkB,aAAlB,QAAuC,SAAvC;AACA,OAAOC,WAAP,MAAwB,kBAAxB;AACA,OAAOC,aAAP,MAA0B,0BAA1B;AACA,OAAOC,oBAAP,MAAiC,qCAAjC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,kBAAT,CAA6BC,MAA7B,EAAqCC,QAArC,EAAgD;AACtD;AACA,MAAK,CAAEA,QAAQ,CAACC,sBAAhB,EAAyC;AACxCnB,IAAAA,MAAM,CACL,cAAC,oBAAD;AACC,MAAA,OAAO,EAAGS,EAAE,CACX,iEADW,CADb;AAIC,MAAA,aAAa,EAAC;AAJf,MADK,EAOLQ,MAPK,CAAN;AASA;AACA,GAbqD,CAetD;;;AACAhB,EAAAA,sBAAsB,CAAEgB,MAAF,CAAtB;AACA,QAAMG,MAAM,GAAGJ,kBAAkB,CAACK,IAAnB,CAAyB,IAAzB,EAA+BJ,MAA/B,EA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,MAAM,CAAE,cAAC,WAAD;AAAa,IAAA,MAAM,EAAGoB;AAAtB,IAAF,EAAqCH,MAArC,CAAN;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAAS0B,gBAAT,CAA2BC,EAA3B,EAA+B1B,QAA/B,EAA0C;AAChDA,EAAAA,QAAQ,CAAChB,kCAAT,GAA8C,CAAE2C,MAAF,EAAUC,aAAV,KAC7C3C,oBAAoB,CAAE0C,MAAF,EAAUC,aAAV,EAAyB5B,QAAzB,CADrB;;AAEAA,EAAAA,QAAQ,CAAC6B,8BAAT,GAA0C1C,YAA1C;AAEA,QAAMY,MAAM,GAAG+B,QAAQ,CAACC,cAAT,CAAyBL,EAAzB,CAAf;;AAEA9C,EAAAA,QAAQ,CAAEH,WAAF,CAAR,CAAwBuD,qCAAxB;;AACAtD,EAAAA,kBAAkB;;AAClB,MAAKuD,OAAO,CAACC,GAAR,CAAYC,mBAAjB,EAAuC;AACtCxD,IAAAA,4CAA4C,CAAE;AAC7CyD,MAAAA,eAAe,EAAE;AAD4B,KAAF,CAA5C;AAGA;;AAEDtC,EAAAA,kBAAkB,CAAEC,MAAF,EAAUC,QAAV,CAAlB;AACA;AAED,SAASqC,OAAO,IAAIC,iCAApB,QAA6D,oCAA7D;AACA,SAASD,OAAO,IAAIE,8BAApB,QAA0D,mDAA1D;AACA,SAASF,OAAO,IAAIG,aAApB,QAAyC,qCAAzC;AACA,SAASH,OAAO,IAAII,yBAApB,QAAqD,mDAArD;AACA,SAASJ,OAAO,IAAIK,kBAApB,QAA8C,2CAA9C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch, select } from '@wordpress/data';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { __ } from '@wordpress/i18n';\nimport { store as viewportStore } from '@wordpress/viewport';\nimport { getQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport EditSiteApp from './components/app';\nimport getIsListPage from './utils/get-is-list-page';\nimport ErrorBoundaryWarning from './components/error-boundary/warning';\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n */\nexport function reinitializeEditor( target, settings ) {\n\t// Display warning if editor wasn't able to resolve homepage template.\n\tif ( ! settings.__unstableHomeTemplate ) {\n\t\trender(\n\t\t\t<ErrorBoundaryWarning\n\t\t\t\tmessage={ __(\n\t\t\t\t\t'The editor is unable to find a block template for the homepage.'\n\t\t\t\t) }\n\t\t\t\tdashboardLink=\"index.php\"\n\t\t\t/>,\n\t\t\ttarget\n\t\t);\n\t\treturn;\n\t}\n\n\t// This will be a no-op if the target doesn't have any React nodes.\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\t{\n\t\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\t\teditorMode: 'visual',\n\t\t\tfixedToolbar: false,\n\t\t\tfocusMode: false,\n\t\t\tkeepCaretInsideBlock: false,\n\t\t\twelcomeGuide: true,\n\t\t\twelcomeGuideStyles: true,\n\t\t\tshowListViewByDefault: false,\n\t\t} );\n\n\t\t// Check if the block list view should be open by default.\n\t\tif (\n\t\t\tselect( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showListViewByDefault'\n\t\t\t)\n\t\t) {\n\t\t\tdispatch( editSiteStore ).setIsListViewOpened( true );\n\t\t}\n\n\t\tdispatch( interfaceStore ).setDefaultComplementaryArea(\n\t\t\t'core/edit-site',\n\t\t\t'edit-site/template'\n\t\t);\n\n\t\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t\t// so that they can be selected with core/editor selectors in any editor.\n\t\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t\t// which internally uses updateEditorSettings as well.\n\t\tdispatch( editorStore ).updateEditorSettings( {\n\t\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t\t} );\n\n\t\tconst isLandingOnListPage = getIsListPage(\n\t\t\tgetQueryArgs( window.location.href )\n\t\t);\n\n\t\tif ( isLandingOnListPage ) {\n\t\t\t// Default the navigation panel to be opened when we're in a bigger\n\t\t\t// screen and land in the list screen.\n\t\t\tdispatch( editSiteStore ).setIsNavigationPanelOpened(\n\t\t\t\tselect( viewportStore ).isViewportMatch( 'medium' )\n\t\t\t);\n\t\t}\n\t}\n\n\trender( <EditSiteApp reboot={ reboot } />, target );\n}\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\n\tconst target = document.getElementById( id );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks();\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\treinitializeEditor( target, settings );\n}\n\nexport { default as __experimentalMainDashboardButton } from './components/main-dashboard-button';\nexport { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\n"]}
@@ -722,8 +722,9 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
722
722
  border-radius: 2px;
723
723
  }
724
724
 
725
- .edit-site-typography-panel__half-width-control {
726
- width: calc((100% - 24px) / 2);
725
+ .edit-site-typography-panel__full-width-control {
726
+ grid-column: 1/-1;
727
+ max-width: 100%;
727
728
  }
728
729
 
729
730
  .edit-site-global-styles-screen-heading-color,
@@ -1901,6 +1902,7 @@ html.wp-toolbar {
1901
1902
  position: relative;
1902
1903
  height: 100%;
1903
1904
  display: block;
1905
+ overflow: hidden;
1904
1906
  }
1905
1907
  .edit-site-visual-editor iframe {
1906
1908
  display: block;
@@ -1962,11 +1964,7 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
1962
1964
  .edit-site-template-details .edit-site-template-details__group + .edit-site-template-details__group {
1963
1965
  border-top: 1px solid #ccc;
1964
1966
  }
1965
- .edit-site-template-details .edit-site-template-details__title {
1966
- margin: 0;
1967
- }
1968
1967
  .edit-site-template-details .edit-site-template-details__description {
1969
- margin: 12px 0 0;
1970
1968
  color: #757575;
1971
1969
  }
1972
1970
  .edit-site-template-details .edit-site-template-details__group.edit-site-template-details__template-areas {
@@ -722,8 +722,9 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
722
722
  border-radius: 2px;
723
723
  }
724
724
 
725
- .edit-site-typography-panel__half-width-control {
726
- width: calc((100% - 24px) / 2);
725
+ .edit-site-typography-panel__full-width-control {
726
+ grid-column: 1/-1;
727
+ max-width: 100%;
727
728
  }
728
729
 
729
730
  .edit-site-global-styles-screen-heading-color,
@@ -1901,6 +1902,7 @@ html.wp-toolbar {
1901
1902
  position: relative;
1902
1903
  height: 100%;
1903
1904
  display: block;
1905
+ overflow: hidden;
1904
1906
  }
1905
1907
  .edit-site-visual-editor iframe {
1906
1908
  display: block;
@@ -1962,11 +1964,7 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
1962
1964
  .edit-site-template-details .edit-site-template-details__group + .edit-site-template-details__group {
1963
1965
  border-top: 1px solid #ccc;
1964
1966
  }
1965
- .edit-site-template-details .edit-site-template-details__title {
1966
- margin: 0;
1967
- }
1968
1967
  .edit-site-template-details .edit-site-template-details__description {
1969
- margin: 12px 0 0;
1970
1968
  color: #757575;
1971
1969
  }
1972
1970
  .edit-site-template-details .edit-site-template-details__group.edit-site-template-details__template-areas {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "4.12.0",
3
+ "version": "4.13.1-next.957ca95e4c.0",
4
4
  "description": "Edit Site Page module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,33 +27,33 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/a11y": "^3.15.0",
31
- "@wordpress/api-fetch": "^6.12.0",
32
- "@wordpress/block-editor": "^9.7.0",
33
- "@wordpress/block-library": "^7.12.0",
34
- "@wordpress/blocks": "^11.14.0",
35
- "@wordpress/components": "^19.17.0",
36
- "@wordpress/compose": "^5.13.0",
37
- "@wordpress/core-data": "^4.13.0",
38
- "@wordpress/data": "^6.15.0",
39
- "@wordpress/deprecated": "^3.15.0",
40
- "@wordpress/editor": "^12.14.0",
41
- "@wordpress/element": "^4.13.0",
42
- "@wordpress/hooks": "^3.15.0",
43
- "@wordpress/html-entities": "^3.15.0",
44
- "@wordpress/i18n": "^4.15.0",
45
- "@wordpress/icons": "^9.6.0",
46
- "@wordpress/interface": "^4.14.0",
47
- "@wordpress/keyboard-shortcuts": "^3.13.0",
48
- "@wordpress/keycodes": "^3.15.0",
49
- "@wordpress/media-utils": "^4.6.0",
50
- "@wordpress/notices": "^3.15.0",
51
- "@wordpress/plugins": "^4.13.0",
52
- "@wordpress/preferences": "^2.7.0",
53
- "@wordpress/reusable-blocks": "^3.13.0",
54
- "@wordpress/style-engine": "^0.14.0",
55
- "@wordpress/url": "^3.16.0",
56
- "@wordpress/viewport": "^4.13.0",
30
+ "@wordpress/a11y": "^3.16.1-next.957ca95e4c.0",
31
+ "@wordpress/api-fetch": "^6.13.1-next.957ca95e4c.0",
32
+ "@wordpress/block-editor": "^9.8.1-next.957ca95e4c.0",
33
+ "@wordpress/block-library": "^7.13.1-next.957ca95e4c.0",
34
+ "@wordpress/blocks": "^11.15.1-next.957ca95e4c.0",
35
+ "@wordpress/components": "^20.0.2-next.957ca95e4c.0",
36
+ "@wordpress/compose": "^5.14.1-next.957ca95e4c.0",
37
+ "@wordpress/core-data": "^5.0.1-next.957ca95e4c.0",
38
+ "@wordpress/data": "^7.0.1-next.957ca95e4c.0",
39
+ "@wordpress/deprecated": "^3.16.1-next.957ca95e4c.0",
40
+ "@wordpress/editor": "^12.15.1-next.957ca95e4c.0",
41
+ "@wordpress/element": "^4.14.1-next.957ca95e4c.0",
42
+ "@wordpress/hooks": "^3.16.1-next.957ca95e4c.0",
43
+ "@wordpress/html-entities": "^3.16.1-next.957ca95e4c.0",
44
+ "@wordpress/i18n": "^4.16.1-next.957ca95e4c.0",
45
+ "@wordpress/icons": "^9.7.1-next.957ca95e4c.0",
46
+ "@wordpress/interface": "^4.15.1-next.957ca95e4c.0",
47
+ "@wordpress/keyboard-shortcuts": "^3.14.1-next.957ca95e4c.0",
48
+ "@wordpress/keycodes": "^3.16.1-next.957ca95e4c.0",
49
+ "@wordpress/media-utils": "^4.7.1-next.957ca95e4c.0",
50
+ "@wordpress/notices": "^3.16.1-next.957ca95e4c.0",
51
+ "@wordpress/plugins": "^4.14.1-next.957ca95e4c.0",
52
+ "@wordpress/preferences": "^2.8.1-next.957ca95e4c.0",
53
+ "@wordpress/reusable-blocks": "^3.14.1-next.957ca95e4c.0",
54
+ "@wordpress/style-engine": "^0.15.1-next.957ca95e4c.0",
55
+ "@wordpress/url": "^3.17.1-next.957ca95e4c.0",
56
+ "@wordpress/viewport": "^4.14.1-next.957ca95e4c.0",
57
57
  "classnames": "^2.3.1",
58
58
  "downloadjs": "^1.4.7",
59
59
  "history": "^5.1.0",
@@ -68,5 +68,5 @@
68
68
  "publishConfig": {
69
69
  "access": "public"
70
70
  },
71
- "gitHead": "08358f53b627a15148c3a3e433cdf58cf8714aa4"
71
+ "gitHead": "272a74bbbaab10ee24424eafe9578e705fbfbbb4"
72
72
  }
@@ -28,7 +28,7 @@ import {
28
28
  tag,
29
29
  layout as customGenericTemplateIcon,
30
30
  } from '@wordpress/icons';
31
- import { __ } from '@wordpress/i18n';
31
+ import { __, sprintf } from '@wordpress/i18n';
32
32
  import { store as noticesStore } from '@wordpress/notices';
33
33
 
34
34
  /**
@@ -41,6 +41,7 @@ import {
41
41
  useTaxonomiesMenuItems,
42
42
  usePostTypeMenuItems,
43
43
  useAuthorMenuItem,
44
+ usePostTypeArchiveMenuItems,
44
45
  } from './utils';
45
46
  import AddCustomGenericTemplateModal from './add-custom-generic-template-modal';
46
47
  import { useHistory } from '../routes';
@@ -88,7 +89,8 @@ export default function NewTemplate( { postType } ) {
88
89
 
89
90
  const history = useHistory();
90
91
  const { saveEntityRecord } = useDispatch( coreStore );
91
- const { createErrorNotice } = useDispatch( noticesStore );
92
+ const { createErrorNotice, createSuccessNotice } =
93
+ useDispatch( noticesStore );
92
94
  const { setTemplate } = useDispatch( editSiteStore );
93
95
 
94
96
  async function createTemplate( template, isWPSuggestion = true ) {
@@ -130,8 +132,16 @@ export default function NewTemplate( { postType } ) {
130
132
  postId: newTemplate.id,
131
133
  postType: newTemplate.type,
132
134
  } );
133
-
134
- // TODO: Add a success notice?
135
+ createSuccessNotice(
136
+ sprintf(
137
+ // translators: %s: Title of the created template e.g: "Category".
138
+ __( '"%s" successfully created.' ),
139
+ title
140
+ ),
141
+ {
142
+ type: 'snackbar',
143
+ }
144
+ );
135
145
  } catch ( error ) {
136
146
  const errorMessage =
137
147
  error.message && error.code !== 'unknown_error'
@@ -292,6 +302,7 @@ function useMissingTemplates(
292
302
  } );
293
303
  const missingTemplates = [
294
304
  ...enhancedMissingDefaultTemplateTypes,
305
+ ...usePostTypeArchiveMenuItems(),
295
306
  ...postTypesMenuItems,
296
307
  ...taxonomiesMenuItems,
297
308
  ];
@@ -12,7 +12,7 @@ import { store as editorStore } from '@wordpress/editor';
12
12
  import { decodeEntities } from '@wordpress/html-entities';
13
13
  import { useMemo, useCallback } from '@wordpress/element';
14
14
  import { __, sprintf } from '@wordpress/i18n';
15
- import { blockMeta, post } from '@wordpress/icons';
15
+ import { blockMeta, post, archive } from '@wordpress/icons';
16
16
 
17
17
  /**
18
18
  * @typedef IHasNameAndId
@@ -86,10 +86,90 @@ const usePublicTaxonomies = () => {
86
86
  }, [ taxonomies ] );
87
87
  };
88
88
 
89
+ function usePostTypeNeedsUniqueIdentifier( publicPostTypes ) {
90
+ const postTypeLabels = useMemo( () =>
91
+ publicPostTypes?.reduce( ( accumulator, { labels } ) => {
92
+ const singularName = labels.singular_name.toLowerCase();
93
+ accumulator[ singularName ] =
94
+ ( accumulator[ singularName ] || 0 ) + 1;
95
+ return accumulator;
96
+ }, {} )
97
+ );
98
+ return useCallback(
99
+ ( { labels, slug } ) => {
100
+ const singularName = labels.singular_name.toLowerCase();
101
+ return postTypeLabels[ singularName ] > 1 && singularName !== slug;
102
+ },
103
+ [ postTypeLabels ]
104
+ );
105
+ }
106
+
107
+ export function usePostTypeArchiveMenuItems() {
108
+ const publicPostTypes = usePublicPostTypes();
109
+ const postTypesWithArchives = useMemo(
110
+ () => publicPostTypes?.filter( ( postType ) => postType.has_archive ),
111
+ [ publicPostTypes ]
112
+ );
113
+ const existingTemplates = useExistingTemplates();
114
+ const needsUniqueIdentifier = usePostTypeNeedsUniqueIdentifier(
115
+ postTypesWithArchives
116
+ );
117
+ return useMemo(
118
+ () =>
119
+ postTypesWithArchives
120
+ ?.filter(
121
+ ( postType ) =>
122
+ ! ( existingTemplates || [] ).some(
123
+ ( existingTemplate ) =>
124
+ existingTemplate.slug ===
125
+ 'archive-' + postType.slug
126
+ )
127
+ )
128
+ .map( ( postType ) => {
129
+ let title;
130
+ if ( needsUniqueIdentifier( postType ) ) {
131
+ title = sprintf(
132
+ // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book".
133
+ __( 'Archive: %1$s (%2$s)' ),
134
+ postType.labels.singular_name,
135
+ postType.slug
136
+ );
137
+ } else {
138
+ title = sprintf(
139
+ // translators: %s: Name of the post type e.g: "Post".
140
+ __( 'Archive: %s' ),
141
+ postType.labels.singular_name
142
+ );
143
+ }
144
+ return {
145
+ slug: 'archive-' + postType.slug,
146
+ description: sprintf(
147
+ // translators: %s: Name of the post type e.g: "Post".
148
+ __(
149
+ 'Displays an archive with the latests posts of type: %s.'
150
+ ),
151
+ postType.labels.singular_name
152
+ ),
153
+ title,
154
+ // `icon` is the `menu_icon` property of a post type. We
155
+ // only handle `dashicons` for now, even if the `menu_icon`
156
+ // also supports urls and svg as values.
157
+ icon: postType.icon?.startsWith( 'dashicons-' )
158
+ ? postType.icon.slice( 10 )
159
+ : archive,
160
+ templatePrefix: 'archive',
161
+ };
162
+ } ) || [],
163
+ [ postTypesWithArchives, existingTemplates, needsUniqueIdentifier ]
164
+ );
165
+ }
166
+
89
167
  export const usePostTypeMenuItems = ( onClickMenuItem ) => {
90
168
  const publicPostTypes = usePublicPostTypes();
91
169
  const existingTemplates = useExistingTemplates();
92
170
  const defaultTemplateTypes = useDefaultTemplateTypes();
171
+ const needsUniqueIdentifier =
172
+ usePostTypeNeedsUniqueIdentifier( publicPostTypes );
93
173
  // `page`is a special case in template hierarchy.
94
174
  const templatePrefixes = useMemo(
95
175
  () =>
@@ -103,21 +183,6 @@ export const usePostTypeMenuItems = ( onClickMenuItem ) => {
103
183
  }, {} ),
104
184
  [ publicPostTypes ]
105
185
  );
106
- // We need to keep track of naming conflicts. If a conflict
107
- // occurs, we need to add slug.
108
- const postTypeLabels = publicPostTypes?.reduce(
109
- ( accumulator, { labels } ) => {
110
- const singularName = labels.singular_name.toLowerCase();
111
- accumulator[ singularName ] =
112
- ( accumulator[ singularName ] || 0 ) + 1;
113
- return accumulator;
114
- },
115
- {}
116
- );
117
- const needsUniqueIdentifier = ( labels, slug ) => {
118
- const singularName = labels.singular_name.toLowerCase();
119
- return postTypeLabels[ singularName ] > 1 && singularName !== slug;
120
- };
121
186
  const postTypesInfo = useEntitiesInfo( 'postType', templatePrefixes );
122
187
  const existingTemplateSlugs = ( existingTemplates || [] ).map(
123
188
  ( { slug } ) => slug
@@ -134,10 +199,7 @@ export const usePostTypeMenuItems = ( onClickMenuItem ) => {
134
199
  );
135
200
  const hasGeneralTemplate =
136
201
  existingTemplateSlugs?.includes( generalTemplateSlug );
137
- const _needsUniqueIdentifier = needsUniqueIdentifier(
138
- labels,
139
- slug
140
- );
202
+ const _needsUniqueIdentifier = needsUniqueIdentifier( postType );
141
203
  let menuItemTitle = sprintf(
142
204
  // translators: %s: Name of the post type e.g: "Post".
143
205
  __( 'Single item: %s' ),
@@ -57,20 +57,31 @@ function ResizableEditor( { enableResizing, settings, children, ...props } ) {
57
57
  return;
58
58
  }
59
59
 
60
- let animationFrame = null;
60
+ let timeoutId = null;
61
61
 
62
62
  function resizeHeight() {
63
- if ( ! animationFrame ) {
64
- // Throttle the updates on animation frame.
65
- animationFrame = iframe.contentWindow.requestAnimationFrame(
66
- () => {
67
- setHeight(
68
- iframe.contentDocument.documentElement
69
- .scrollHeight
70
- );
71
- animationFrame = null;
63
+ if ( ! timeoutId ) {
64
+ // Throttle the updates on timeout. This code previously
65
+ // used `requestAnimationFrame`, but that seems to not
66
+ // always work before an iframe is ready.
67
+ timeoutId = iframe.contentWindow.setTimeout( () => {
68
+ const { readyState } = iframe.contentDocument;
69
+
70
+ // Continue deferring the timeout until the document is ready.
71
+ // Only then will it have a height.
72
+ if (
73
+ readyState !== 'interactive' &&
74
+ readyState !== 'complete'
75
+ ) {
76
+ resizeHeight();
77
+ return;
72
78
  }
73
- );
79
+
80
+ setHeight( iframe.contentDocument.body.scrollHeight );
81
+ timeoutId = null;
82
+
83
+ // 30 frames per second.
84
+ }, 1000 / 30 );
74
85
  }
75
86
  }
76
87
 
@@ -82,11 +93,10 @@ function ResizableEditor( { enableResizing, settings, children, ...props } ) {
82
93
  resizeObserver = new iframe.contentWindow.ResizeObserver(
83
94
  resizeHeight
84
95
  );
85
- // Observing the <html> rather than the <body> because the latter
86
- // gets destroyed and remounted after initialization in <Iframe>.
87
- resizeObserver.observe(
88
- iframe.contentDocument.documentElement
89
- );
96
+
97
+ // Observe the body, since the `html` element seems to always
98
+ // have a height of `100%`.
99
+ resizeObserver.observe( iframe.contentDocument.body );
90
100
 
91
101
  resizeHeight();
92
102
  }
@@ -97,7 +107,7 @@ function ResizableEditor( { enableResizing, settings, children, ...props } ) {
97
107
  registerObserver();
98
108
 
99
109
  return () => {
100
- iframe.contentWindow?.cancelAnimationFrame( animationFrame );
110
+ iframe.contentWindow?.clearTimeout( timeoutId );
101
111
  resizeObserver?.disconnect();
102
112
  iframe.removeEventListener( 'load', registerObserver );
103
113
  };
@@ -153,7 +163,7 @@ function ResizableEditor( { enableResizing, settings, children, ...props } ) {
153
163
  } }
154
164
  >
155
165
  <Iframe
156
- style={ enableResizing ? undefined : deviceStyles }
166
+ style={ enableResizing ? { height } : deviceStyles }
157
167
  head={
158
168
  <>
159
169
  <EditorStyles styles={ settings.styles } />
@@ -32,6 +32,7 @@ html.wp-toolbar {
32
32
  position: relative;
33
33
  height: 100%;
34
34
  display: block;
35
+ overflow: hidden;
35
36
 
36
37
  iframe {
37
38
  display: block;
@@ -179,11 +179,11 @@ export default function BorderPanel( { name } ) {
179
179
  <BorderBoxControl
180
180
  colors={ colors }
181
181
  enableAlpha={ true }
182
+ enableStyle={ showBorderStyle }
182
183
  onChange={ onBorderChange }
183
- showStyle={ showBorderStyle }
184
- value={ border }
185
- popoverPlacement="left-start"
186
184
  popoverOffset={ 40 }
185
+ popoverPlacement="left-start"
186
+ value={ border }
187
187
  __experimentalHasMultipleOrigins={ true }
188
188
  __experimentalIsRenderedInSidebar={ true }
189
189
  />