@wordpress/edit-site 6.30.1-next.836ecdcae.0 → 6.31.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 (81) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-template/add-custom-template-modal-content.js +1 -1
  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 +8 -84
  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-root.js +1 -7
  15. package/build/components/global-styles/screen-root.js.map +1 -1
  16. package/build/components/page-templates/fields.js +65 -5
  17. package/build/components/page-templates/fields.js.map +1 -1
  18. package/build/components/page-templates/hooks.js +1 -1
  19. package/build/components/page-templates/hooks.js.map +1 -1
  20. package/build/components/page-templates/index.js +103 -29
  21. package/build/components/page-templates/index.js.map +1 -1
  22. package/build/components/post-list/index.js +1 -4
  23. package/build/components/post-list/index.js.map +1 -1
  24. package/build/components/sidebar-navigation-screen-templates-browse/content.js +11 -5
  25. package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  26. package/build/components/site-editor-routes/index.js +1 -1
  27. package/build/components/site-editor-routes/index.js.map +1 -1
  28. package/build/components/site-editor-routes/template-item.js +29 -23
  29. package/build/components/site-editor-routes/template-item.js.map +1 -1
  30. package/build/hooks/commands/use-common-commands.js +3 -118
  31. package/build/hooks/commands/use-common-commands.js.map +1 -1
  32. package/build-module/components/add-new-template/add-custom-template-modal-content.js +1 -1
  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 +8 -84
  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-root.js +1 -7
  45. package/build-module/components/global-styles/screen-root.js.map +1 -1
  46. package/build-module/components/page-templates/fields.js +65 -5
  47. package/build-module/components/page-templates/fields.js.map +1 -1
  48. package/build-module/components/page-templates/hooks.js +1 -1
  49. package/build-module/components/page-templates/hooks.js.map +1 -1
  50. package/build-module/components/page-templates/index.js +105 -31
  51. package/build-module/components/page-templates/index.js.map +1 -1
  52. package/build-module/components/post-list/index.js +1 -4
  53. package/build-module/components/post-list/index.js.map +1 -1
  54. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +11 -5
  55. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  56. package/build-module/components/site-editor-routes/index.js +2 -2
  57. package/build-module/components/site-editor-routes/index.js.map +1 -1
  58. package/build-module/components/site-editor-routes/template-item.js +28 -22
  59. package/build-module/components/site-editor-routes/template-item.js.map +1 -1
  60. package/build-module/hooks/commands/use-common-commands.js +5 -120
  61. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  62. package/build-style/posts-rtl.css +17 -10
  63. package/build-style/posts.css +17 -10
  64. package/build-style/style-rtl.css +17 -10
  65. package/build-style/style.css +17 -10
  66. package/package.json +41 -41
  67. package/src/components/add-new-template/add-custom-template-modal-content.js +1 -3
  68. package/src/components/add-new-template/index.js +1 -8
  69. package/src/components/add-new-template/utils.js +9 -118
  70. package/src/components/dataviews-actions/index.js +51 -0
  71. package/src/components/editor/index.js +1 -0
  72. package/src/components/editor/use-resolve-edited-entity.js +54 -7
  73. package/src/components/global-styles/screen-root.js +1 -7
  74. package/src/components/page-templates/fields.js +70 -4
  75. package/src/components/page-templates/hooks.js +1 -1
  76. package/src/components/page-templates/index.js +160 -57
  77. package/src/components/post-list/index.js +1 -2
  78. package/src/components/sidebar-navigation-screen-templates-browse/content.js +17 -7
  79. package/src/components/site-editor-routes/index.js +2 -1
  80. package/src/components/site-editor-routes/template-item.js +34 -26
  81. package/src/hooks/commands/use-common-commands.js +6 -135
@@ -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,53 @@ import { unlock } from '../../lock-unlock';
14
16
  const {
15
17
  useHistory
16
18
  } = unlock(routerPrivateApis);
19
+ export const useSetActiveTemplateAction = () => {
20
+ const {
21
+ getEntityRecord
22
+ } = useSelect(coreStore);
23
+ const {
24
+ editEntityRecord,
25
+ saveEditedEntityRecord
26
+ } = useDispatch(coreStore);
27
+ return useMemo(() => ({
28
+ id: 'set-active-template',
29
+ label(items) {
30
+ return items.some(item => item._isActive) ? __('Deactivate') : __('Activate');
31
+ },
32
+ isPrimary: true,
33
+ icon: edit,
34
+ isEligible(item) {
35
+ return !(item.slug === 'index' && item.source === 'theme');
36
+ },
37
+ async callback(items) {
38
+ var _await$getEntityRecor;
39
+ const deactivate = items.some(item => item._isActive);
40
+ // current active templates
41
+ const activeTemplates = {
42
+ ...((_await$getEntityRecor = await getEntityRecord('root', 'site').active_templates) !== null && _await$getEntityRecor !== void 0 ? _await$getEntityRecor : {})
43
+ };
44
+ for (const item of items) {
45
+ if (deactivate) {
46
+ if (item.source === 'theme') {
47
+ activeTemplates[item.slug] = false;
48
+ } else {
49
+ delete activeTemplates[item.slug];
50
+ }
51
+ } else {
52
+ activeTemplates[item.slug] = item.id;
53
+ }
54
+ }
55
+ // To do: figure out why the REST API deletes the option when
56
+ // it's set to an empty object. That would trigger the migration
57
+ // function, which will make all templates in the database active.
58
+ activeTemplates.__preventCollapse = 0;
59
+ await editEntityRecord('root', 'site', undefined, {
60
+ active_templates: activeTemplates
61
+ });
62
+ await saveEditedEntityRecord('root', 'site');
63
+ }
64
+ }), [editEntityRecord, saveEditedEntityRecord, getEntityRecord]);
65
+ };
17
66
  export const useEditPostAction = () => {
18
67
  const history = useHistory();
19
68
  return useMemo(() => ({
@@ -1 +1 @@
1
- {"version":3,"names":["__","edit","useMemo","privateApis","routerPrivateApis","PATTERN_TYPES","unlock","useHistory","useEditPostAction","history","id","label","isPrimary","icon","isEligible","post","status","type","theme","callback","items","navigate"],"sources":["@wordpress/edit-site/src/components/dataviews-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { edit } from '@wordpress/icons';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { PATTERN_TYPES } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nexport const useEditPostAction = () => {\n\tconst history = useHistory();\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'edit-post',\n\t\t\tlabel: __( 'Edit' ),\n\t\t\tisPrimary: true,\n\t\t\ticon: edit,\n\t\t\tisEligible( post ) {\n\t\t\t\tif ( post.status === 'trash' ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t// It's eligible for all post types except theme patterns.\n\t\t\t\treturn post.type !== PATTERN_TYPES.theme;\n\t\t\t},\n\t\t\tcallback( items ) {\n\t\t\t\tconst post = items[ 0 ];\n\t\t\t\thistory.navigate( `/${ post.type }/${ post.id }?canvas=edit` );\n\t\t\t},\n\t\t} ),\n\t\t[ history ]\n\t);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,QAAQ,kBAAkB;AACvC,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAW,CAAC,GAAGD,MAAM,CAAEF,iBAAkB,CAAC;AAElD,OAAO,MAAMI,iBAAiB,GAAGA,CAAA,KAAM;EACtC,MAAMC,OAAO,GAAGF,UAAU,CAAC,CAAC;EAC5B,OAAOL,OAAO,CACb,OAAQ;IACPQ,EAAE,EAAE,WAAW;IACfC,KAAK,EAAEX,EAAE,CAAE,MAAO,CAAC;IACnBY,SAAS,EAAE,IAAI;IACfC,IAAI,EAAEZ,IAAI;IACVa,UAAUA,CAAEC,IAAI,EAAG;MAClB,IAAKA,IAAI,CAACC,MAAM,KAAK,OAAO,EAAG;QAC9B,OAAO,KAAK;MACb;MACA;MACA,OAAOD,IAAI,CAACE,IAAI,KAAKZ,aAAa,CAACa,KAAK;IACzC,CAAC;IACDC,QAAQA,CAAEC,KAAK,EAAG;MACjB,MAAML,IAAI,GAAGK,KAAK,CAAE,CAAC,CAAE;MACvBX,OAAO,CAACY,QAAQ,CAAE,IAAKN,IAAI,CAACE,IAAI,IAAMF,IAAI,CAACL,EAAE,cAAgB,CAAC;IAC/D;EACD,CAAC,CAAE,EACH,CAAED,OAAO,CACV,CAAC;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["__","edit","useMemo","privateApis","routerPrivateApis","useDispatch","useSelect","store","coreStore","PATTERN_TYPES","unlock","useHistory","useSetActiveTemplateAction","getEntityRecord","editEntityRecord","saveEditedEntityRecord","id","label","items","some","item","_isActive","isPrimary","icon","isEligible","slug","source","callback","_await$getEntityRecor","deactivate","activeTemplates","active_templates","__preventCollapse","undefined","useEditPostAction","history","post","status","type","theme","navigate"],"sources":["@wordpress/edit-site/src/components/dataviews-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { edit } from '@wordpress/icons';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { PATTERN_TYPES } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nexport const useSetActiveTemplateAction = () => {\n\tconst { getEntityRecord } = useSelect( coreStore );\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'set-active-template',\n\t\t\tlabel( items ) {\n\t\t\t\treturn items.some( ( item ) => item._isActive )\n\t\t\t\t\t? __( 'Deactivate' )\n\t\t\t\t\t: __( 'Activate' );\n\t\t\t},\n\t\t\tisPrimary: true,\n\t\t\ticon: edit,\n\t\t\tisEligible( item ) {\n\t\t\t\treturn ! ( item.slug === 'index' && item.source === 'theme' );\n\t\t\t},\n\t\t\tasync callback( items ) {\n\t\t\t\tconst deactivate = items.some( ( item ) => item._isActive );\n\t\t\t\t// current active templates\n\t\t\t\tconst activeTemplates = {\n\t\t\t\t\t...( ( await getEntityRecord( 'root', 'site' )\n\t\t\t\t\t\t.active_templates ) ?? {} ),\n\t\t\t\t};\n\t\t\t\tfor ( const item of items ) {\n\t\t\t\t\tif ( deactivate ) {\n\t\t\t\t\t\tif ( item.source === 'theme' ) {\n\t\t\t\t\t\t\tactiveTemplates[ item.slug ] = false;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdelete activeTemplates[ item.slug ];\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tactiveTemplates[ item.slug ] = item.id;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// To do: figure out why the REST API deletes the option when\n\t\t\t\t// it's set to an empty object. That would trigger the migration\n\t\t\t\t// function, which will make all templates in the database active.\n\t\t\t\tactiveTemplates.__preventCollapse = 0;\n\t\t\t\tawait editEntityRecord( 'root', 'site', undefined, {\n\t\t\t\t\tactive_templates: activeTemplates,\n\t\t\t\t} );\n\t\t\t\tawait saveEditedEntityRecord( 'root', 'site' );\n\t\t\t},\n\t\t} ),\n\t\t[ editEntityRecord, saveEditedEntityRecord, getEntityRecord ]\n\t);\n};\n\nexport const useEditPostAction = () => {\n\tconst history = useHistory();\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'edit-post',\n\t\t\tlabel: __( 'Edit' ),\n\t\t\tisPrimary: true,\n\t\t\ticon: edit,\n\t\t\tisEligible( post ) {\n\t\t\t\tif ( post.status === 'trash' ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t// It's eligible for all post types except theme patterns.\n\t\t\t\treturn post.type !== PATTERN_TYPES.theme;\n\t\t\t},\n\t\t\tcallback( items ) {\n\t\t\t\tconst post = items[ 0 ];\n\t\t\t\thistory.navigate( `/${ post.type }/${ post.id }?canvas=edit` );\n\t\t\t},\n\t\t} ),\n\t\t[ history ]\n\t);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,QAAQ,kBAAkB;AACvC,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,MAAM,QAAQ,mBAAmB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AAe,CAAEV,IAAI,CAACK,IAAI,CAAE;UACpC;QACD,CAAC,MAAM;UACNK,eAAe,CAAEV,IAAI,CAACK,IAAI,CAAE,GAAGL,IAAI,CAACJ,EAAE;QACvC;MACD;MACA;MACA;MACA;MACAc,eAAe,CAACE,iBAAiB,GAAG,CAAC;MACrC,MAAMlB,gBAAgB,CAAE,MAAM,EAAE,MAAM,EAAEmB,SAAS,EAAE;QAClDF,gBAAgB,EAAED;MACnB,CAAE,CAAC;MACH,MAAMf,sBAAsB,CAAE,MAAM,EAAE,MAAO,CAAC;IAC/C;EACD,CAAC,CAAE,EACH,CAAED,gBAAgB,EAAEC,sBAAsB,EAAEF,eAAe,CAC5D,CAAC;AACF,CAAC;AAED,OAAO,MAAMqB,iBAAiB,GAAGA,CAAA,KAAM;EACtC,MAAMC,OAAO,GAAGxB,UAAU,CAAC,CAAC;EAC5B,OAAOT,OAAO,CACb,OAAQ;IACPc,EAAE,EAAE,WAAW;IACfC,KAAK,EAAEjB,EAAE,CAAE,MAAO,CAAC;IACnBsB,SAAS,EAAE,IAAI;IACfC,IAAI,EAAEtB,IAAI;IACVuB,UAAUA,CAAEY,IAAI,EAAG;MAClB,IAAKA,IAAI,CAACC,MAAM,KAAK,OAAO,EAAG;QAC9B,OAAO,KAAK;MACb;MACA;MACA,OAAOD,IAAI,CAACE,IAAI,KAAK7B,aAAa,CAAC8B,KAAK;IACzC,CAAC;IACDZ,QAAQA,CAAET,KAAK,EAAG;MACjB,MAAMkB,IAAI,GAAGlB,KAAK,CAAE,CAAC,CAAE;MACvBiB,OAAO,CAACK,QAAQ,CAAE,IAAKJ,IAAI,CAACE,IAAI,IAAMF,IAAI,CAACpB,EAAE,cAAgB,CAAC;IAC/D;EACD,CAAC,CAAE,EACH,CAAEmB,OAAO,CACV,CAAC;AACF,CAAC","ignoreList":[]}
@@ -101,7 +101,7 @@ function getNavigationPath(location, postType) {
101
101
  path,
102
102
  name
103
103
  } = location;
104
- if (['pattern-item', 'template-part-item', 'page-item', 'template-item', 'post-item'].includes(name)) {
104
+ if (['pattern-item', 'template-part-item', 'page-item', 'template-item', 'static-template-item', 'post-item'].includes(name)) {
105
105
  return getListPathForPostType(postType);
106
106
  }
107
107
  return addQueryArgs(path, {
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","useDispatch","useSelect","Button","__unstableMotion","motion","useInstanceId","useReducedMotion","EditorKeyboardShortcutsRegister","privateApis","editorPrivateApis","store","editorStore","__","sprintf","coreDataStore","blockLibraryPrivateApis","useCallback","useMemo","noticesStore","routerPrivateApis","decodeEntities","Icon","arrowUpLeft","blockEditorStore","addQueryArgs","WelcomeGuide","editSiteStore","GlobalStylesRenderer","CanvasLoader","unlock","useSpecificEditorSettings","PluginTemplateSettingPanel","GlobalStylesSidebar","isPreviewingTheme","getEditorCanvasContainerTitle","useHasEditorCanvasContainer","SaveButton","SavePanel","SiteEditorMoreMenu","SiteIcon","useEditorIframeProps","useEditorTitle","useIsSiteEditorLoading","useAdaptEditorToCanvas","TEMPLATE_POST_TYPE","useResolveEditedEntity","useSyncDeprecatedEntityIntoState","SitePreview","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","Editor","BackButton","useHistory","useLocation","BlockKeyboardShortcuts","toggleHomeIconVariants","edit","opacity","scale","hover","clipPath","siteIconVariants","tap","getListPathForPostType","postType","getNavigationPath","location","path","name","includes","canvas","undefined","EditSiteEditor","isHomeRoute","isPostsList","disableMotion","query","isLoading","entity","postId","context","isBlockBasedTheme","editorCanvasView","currentPostIsTrashed","hasSiteIcon","select","getEditorCanvasContainerView","getCurrentTheme","getEntityRecord","siteData","is_block_theme","getCurrentPostAttribute","site_icon_url","postWithTemplate","_isPreviewingTheme","hasDefaultEditorCanvasView","iframeProps","isEditMode","loadingProgressId","settings","styles","css","resetZoomLevel","createSuccessNotice","history","onActionPerformed","actionId","items","navigate","newItem","_title","title","rendered","type","id","actions","label","onClick","isReady","transition","duration","children","disableRootPadding","templateId","className","customSaveButton","size","customSavePanel","forceDisableBlockTools","extraSidebarPanels","Slot","length","div","animate","initial","whileHover","whileTap","__next40pxDefaultSize","showTooltip","tooltipPosition","focusMode","variants","icon"],"sources":["@wordpress/edit-site/src/components/editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useInstanceId, useReducedMotion } from '@wordpress/compose';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { Icon, arrowUpLeft } from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport CanvasLoader from '../canvas-loader';\nimport { unlock } from '../../lock-unlock';\nimport { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';\nimport PluginTemplateSettingPanel from '../plugin-template-setting-panel';\nimport GlobalStylesSidebar from '../global-styles-sidebar';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\nimport {\n\tgetEditorCanvasContainerTitle,\n\tuseHasEditorCanvasContainer,\n} from '../editor-canvas-container';\nimport SaveButton from '../save-button';\nimport SavePanel from '../save-panel';\nimport SiteEditorMoreMenu from '../more-menu';\nimport SiteIcon from '../site-icon';\nimport useEditorIframeProps from '../block-editor/use-editor-iframe-props';\nimport useEditorTitle from './use-editor-title';\nimport { useIsSiteEditorLoading } from '../layout/hooks';\nimport { useAdaptEditorToCanvas } from './use-adapt-editor-to-canvas';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport {\n\tuseResolveEditedEntity,\n\tuseSyncDeprecatedEntityIntoState,\n} from './use-resolve-edited-entity';\nimport SitePreview from './site-preview';\n\nconst { Editor, BackButton } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nconst toggleHomeIconVariants = {\n\tedit: {\n\t\topacity: 0,\n\t\tscale: 0.2,\n\t},\n\thover: {\n\t\topacity: 1,\n\t\tscale: 1,\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n};\n\nconst siteIconVariants = {\n\tedit: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n\thover: {\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n\ttap: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n};\n\nfunction getListPathForPostType( postType ) {\n\tswitch ( postType ) {\n\t\tcase 'navigation':\n\t\t\treturn '/navigation';\n\t\tcase 'wp_block':\n\t\t\treturn '/pattern?postType=wp_block';\n\t\tcase 'wp_template_part':\n\t\t\treturn '/pattern?postType=wp_template_part';\n\t\tcase 'wp_template':\n\t\t\treturn '/template';\n\t\tcase 'page':\n\t\t\treturn '/page';\n\t\tcase 'post':\n\t\t\treturn '/';\n\t}\n\tthrow 'Unknown post type';\n}\n\nfunction getNavigationPath( location, postType ) {\n\tconst { path, name } = location;\n\tif (\n\t\t[\n\t\t\t'pattern-item',\n\t\t\t'template-part-item',\n\t\t\t'page-item',\n\t\t\t'template-item',\n\t\t\t'post-item',\n\t\t].includes( name )\n\t) {\n\t\treturn getListPathForPostType( postType );\n\t}\n\treturn addQueryArgs( path, { canvas: undefined } );\n}\n\nexport default function EditSiteEditor( {\n\tisHomeRoute = false,\n\tisPostsList = false,\n} ) {\n\tconst disableMotion = useReducedMotion();\n\tconst location = useLocation();\n\tconst { canvas = 'view' } = location.query;\n\tconst isLoading = useIsSiteEditorLoading();\n\tuseAdaptEditorToCanvas( canvas );\n\tconst entity = useResolveEditedEntity();\n\t// deprecated sync state with url\n\tuseSyncDeprecatedEntityIntoState( entity );\n\tconst { postType, postId, context } = entity;\n\tconst {\n\t\tisBlockBasedTheme,\n\t\teditorCanvasView,\n\t\tcurrentPostIsTrashed,\n\t\thasSiteIcon,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditorCanvasContainerView } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst { getCurrentTheme, getEntityRecord } = select( coreDataStore );\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase', undefined );\n\n\t\treturn {\n\t\t\tisBlockBasedTheme: getCurrentTheme()?.is_block_theme,\n\t\t\teditorCanvasView: getEditorCanvasContainerView(),\n\t\t\tcurrentPostIsTrashed:\n\t\t\t\tselect( editorStore ).getCurrentPostAttribute( 'status' ) ===\n\t\t\t\t'trash',\n\t\t\thasSiteIcon: !! siteData?.site_icon_url,\n\t\t};\n\t}, [] );\n\tconst postWithTemplate = !! context?.postId;\n\tuseEditorTitle(\n\t\tpostWithTemplate ? context.postType : postType,\n\t\tpostWithTemplate ? context.postId : postId\n\t);\n\tconst _isPreviewingTheme = isPreviewingTheme();\n\tconst hasDefaultEditorCanvasView = ! useHasEditorCanvasContainer();\n\tconst iframeProps = useEditorIframeProps();\n\tconst isEditMode = canvas === 'edit';\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst settings = useSpecificEditorSettings();\n\tconst styles = useMemo(\n\t\t() => [\n\t\t\t...settings.styles,\n\t\t\t{\n\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\tcss:\n\t\t\t\t\tcanvas === 'view'\n\t\t\t\t\t\t? `body{min-height: 100vh; ${\n\t\t\t\t\t\t\t\tcurrentPostIsTrashed ? '' : 'cursor: pointer;'\n\t\t\t\t\t\t }}`\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t],\n\t\t[ settings.styles, canvas, currentPostIsTrashed ]\n\t);\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst history = useHistory();\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\tcase 'delete-post':\n\t\t\t\t\t{\n\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\tgetListPathForPostType(\n\t\t\t\t\t\t\t\tpostWithTemplate ? context.postType : postType\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst _title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( _title )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t`/${ newItem.type }/${ newItem.id }?canvas=edit`\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tpostType,\n\t\t\tcontext?.postType,\n\t\t\tpostWithTemplate,\n\t\t\thistory,\n\t\t\tcreateSuccessNotice,\n\t\t]\n\t);\n\n\t// Replace the title and icon displayed in the DocumentBar when there's an overlay visible.\n\tconst title = getEditorCanvasContainerTitle( editorCanvasView );\n\n\tconst isReady = ! isLoading;\n\tconst transition = {\n\t\tduration: disableMotion ? 0 : 0.2,\n\t};\n\n\treturn ! isBlockBasedTheme && isHomeRoute ? (\n\t\t<SitePreview />\n\t) : (\n\t\t<>\n\t\t\t<GlobalStylesRenderer\n\t\t\t\tdisableRootPadding={ postType !== TEMPLATE_POST_TYPE }\n\t\t\t/>\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t{ isEditMode && <BlockKeyboardShortcuts /> }\n\t\t\t{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }\n\t\t\t{ isEditMode && (\n\t\t\t\t<WelcomeGuide\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<Editor\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t\tpostId={ postWithTemplate ? context.postId : postId }\n\t\t\t\t\ttemplateId={ postWithTemplate ? postId : undefined }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tclassName=\"edit-site-editor__editor-interface\"\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tcustomSaveButton={\n\t\t\t\t\t\t_isPreviewingTheme && <SaveButton size=\"compact\" />\n\t\t\t\t\t}\n\t\t\t\t\tcustomSavePanel={ _isPreviewingTheme && <SavePanel /> }\n\t\t\t\t\tforceDisableBlockTools={ ! hasDefaultEditorCanvasView }\n\t\t\t\t\ttitle={ title }\n\t\t\t\t\tiframeProps={ iframeProps }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\textraSidebarPanels={\n\t\t\t\t\t\t! postWithTemplate && (\n\t\t\t\t\t\t\t<PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t<BackButton>\n\t\t\t\t\t\t\t{ ( { length } ) =>\n\t\t\t\t\t\t\t\tlength <= 1 && (\n\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-editor__view-mode-toggle\"\n\t\t\t\t\t\t\t\t\t\ttransition={ transition }\n\t\t\t\t\t\t\t\t\t\tanimate=\"edit\"\n\t\t\t\t\t\t\t\t\t\tinitial=\"edit\"\n\t\t\t\t\t\t\t\t\t\twhileHover=\"hover\"\n\t\t\t\t\t\t\t\t\t\twhileTap=\"tap\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open Navigation' ) }\n\t\t\t\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\t\t\t\ttooltipPosition=\"middle right\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tresetZoomLevel();\n\n\t\t\t\t\t\t\t\t\t\t\t\t// TODO: this is a temporary solution to navigate to the posts list if we are\n\t\t\t\t\t\t\t\t\t\t\t\t// come here through `posts list` and are in focus mode editing a template, template part etc..\n\t\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\t\tisPostsList &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tlocation.query?.focusMode\n\t\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\t\thistory.navigate( '/', {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetNavigationPath(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpostWithTemplate\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? context.postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\t\tvariants={ siteIconVariants }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-editor__view-mode-toggle-icon\" />\n\t\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t\t'edit-site-editor__back-icon',\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t'has-site-icon':\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thasSiteIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tvariants={ toggleHomeIconVariants }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ arrowUpLeft } />\n\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</BackButton>\n\t\t\t\t\t) }\n\t\t\t\t\t<SiteEditorMoreMenu />\n\t\t\t\t\t{ isBlockBasedTheme && <GlobalStylesSidebar /> }\n\t\t\t\t</Editor>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,MAAM,EAAEC,gBAAgB,IAAIC,MAAM,QAAQ,uBAAuB;AAC1E,SAASC,aAAa,EAAEC,gBAAgB,QAAQ,oBAAoB;AACpE,SACCC,+BAA+B,EAC/BC,WAAW,IAAIC,iBAAiB,EAChCC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASH,KAAK,IAAII,aAAa,QAAQ,sBAAsB;AAC7D,SAASN,WAAW,IAAIO,uBAAuB,QAAQ,0BAA0B;AACjF,SAASC,WAAW,EAAEC,OAAO,QAAQ,oBAAoB;AACzD,SAASP,KAAK,IAAIQ,Y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2I,qBAAqB;YACrBrB,KAAK,EAAG5G,EAAE,CAAE,iBAAkB,CAAG;YACjCkI,WAAW;YACXC,eAAe,EAAC,cAAc;YAC9BtB,OAAO,EAAGA,CAAA,KAAM;cACff,cAAc,CAAC,CAAC;;cAEhB;cACA;cACA,IACC5B,WAAW,IACXR,QAAQ,CAACU,KAAK,EAAEgE,SAAS,EACxB;gBACDpC,OAAO,CAACI,QAAQ,CAAE,GAAG,EAAE;kBACtBW,UAAU,EACT;gBACF,CAAE,CAAC;cACJ,CAAC,MAAM;gBACNf,OAAO,CAACI,QAAQ,CACf3C,iBAAiB,CAChBC,QAAQ,EACR2B,gBAAgB,GACbb,OAAO,CAAChB,QAAQ,GAChBA,QACJ,CAAC,EACD;kBACCuD,UAAU,EACT;gBACF,CACD,CAAC;cACF;YACD,CAAG;YAAAE,QAAA,eAEH5E,IAAA,CAAC7C,MAAM,CAACoI,GAAG;cACVS,QAAQ,EAAGhF,gBAAkB;cAAA4D,QAAA,eAE7B5E,IAAA,CAACV,QAAQ;gBAACyF,SAAS,EAAC;cAAyC,CAAE;YAAC,CACrD;UAAC,CACN,CAAC,eACT/E,IAAA,CAAC7C,MAAM,CAACoI,GAAG;YACVR,SAAS,EAAGjI,IAAI,CACf,6BAA6B,EAC7B;cACC,eAAe,EACdyF;YACF,CACD,CAAG;YACHyD,QAAQ,EAAGtF,sBAAwB;YAAAkE,QAAA,eAEnC5E,IAAA,CAAC5B,IAAI;cAAC6H,IAAI,EAAG5H;YAAa,CAAE;UAAC,CAClB,CAAC;QAAA,CACF;MACZ,CAES,CACZ,eACD2B,IAAA,CAACX,kBAAkB,IAAE,CAAC,EACpB+C,iBAAiB,iBAAIpC,IAAA,CAACjB,mBAAmB,IAAE,CAAC;IAAA,CACvC,CACR;EAAA,CACA,CACF;AACF","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useDispatch","useSelect","Button","__unstableMotion","motion","useInstanceId","useReducedMotion","EditorKeyboardShortcutsRegister","privateApis","editorPrivateApis","store","editorStore","__","sprintf","coreDataStore","blockLibraryPrivateApis","useCallback","useMemo","noticesStore","routerPrivateApis","decodeEntities","Icon","arrowUpLeft","blockEditorStore","addQueryArgs","WelcomeGuide","editSiteStore","GlobalStylesRenderer","CanvasLoader","unlock","useSpecificEditorSettings","PluginTemplateSettingPanel","GlobalStylesSidebar","isPreviewingTheme","getEditorCanvasContainerTitle","useHasEditorCanvasContainer","SaveButton","SavePanel","SiteEditorMoreMenu","SiteIcon","useEditorIframeProps","useEditorTitle","useIsSiteEditorLoading","useAdaptEditorToCanvas","TEMPLATE_POST_TYPE","useResolveEditedEntity","useSyncDeprecatedEntityIntoState","SitePreview","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","Editor","BackButton","useHistory","useLocation","BlockKeyboardShortcuts","toggleHomeIconVariants","edit","opacity","scale","hover","clipPath","siteIconVariants","tap","getListPathForPostType","postType","getNavigationPath","location","path","name","includes","canvas","undefined","EditSiteEditor","isHomeRoute","isPostsList","disableMotion","query","isLoading","entity","postId","context","isBlockBasedTheme","editorCanvasView","currentPostIsTrashed","hasSiteIcon","select","getEditorCanvasContainerView","getCurrentTheme","getEntityRecord","siteData","is_block_theme","getCurrentPostAttribute","site_icon_url","postWithTemplate","_isPreviewingTheme","hasDefaultEditorCanvasView","iframeProps","isEditMode","loadingProgressId","settings","styles","css","resetZoomLevel","createSuccessNotice","history","onActionPerformed","actionId","items","navigate","newItem","_title","title","rendered","type","id","actions","label","onClick","isReady","transition","duration","children","disableRootPadding","templateId","className","customSaveButton","size","customSavePanel","forceDisableBlockTools","extraSidebarPanels","Slot","length","div","animate","initial","whileHover","whileTap","__next40pxDefaultSize","showTooltip","tooltipPosition","focusMode","variants","icon"],"sources":["@wordpress/edit-site/src/components/editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useInstanceId, useReducedMotion } from '@wordpress/compose';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { Icon, arrowUpLeft } from '@wordpress/icons';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport CanvasLoader from '../canvas-loader';\nimport { unlock } from '../../lock-unlock';\nimport { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';\nimport PluginTemplateSettingPanel from '../plugin-template-setting-panel';\nimport GlobalStylesSidebar from '../global-styles-sidebar';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\nimport {\n\tgetEditorCanvasContainerTitle,\n\tuseHasEditorCanvasContainer,\n} from '../editor-canvas-container';\nimport SaveButton from '../save-button';\nimport SavePanel from '../save-panel';\nimport SiteEditorMoreMenu from '../more-menu';\nimport SiteIcon from '../site-icon';\nimport useEditorIframeProps from '../block-editor/use-editor-iframe-props';\nimport useEditorTitle from './use-editor-title';\nimport { useIsSiteEditorLoading } from '../layout/hooks';\nimport { useAdaptEditorToCanvas } from './use-adapt-editor-to-canvas';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport {\n\tuseResolveEditedEntity,\n\tuseSyncDeprecatedEntityIntoState,\n} from './use-resolve-edited-entity';\nimport SitePreview from './site-preview';\n\nconst { Editor, BackButton } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nconst toggleHomeIconVariants = {\n\tedit: {\n\t\topacity: 0,\n\t\tscale: 0.2,\n\t},\n\thover: {\n\t\topacity: 1,\n\t\tscale: 1,\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n};\n\nconst siteIconVariants = {\n\tedit: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n\thover: {\n\t\tclipPath: 'inset( 22% round 2px )',\n\t},\n\ttap: {\n\t\tclipPath: 'inset(0% round 0px)',\n\t},\n};\n\nfunction getListPathForPostType( postType ) {\n\tswitch ( postType ) {\n\t\tcase 'navigation':\n\t\t\treturn '/navigation';\n\t\tcase 'wp_block':\n\t\t\treturn '/pattern?postType=wp_block';\n\t\tcase 'wp_template_part':\n\t\t\treturn '/pattern?postType=wp_template_part';\n\t\tcase 'wp_template':\n\t\t\treturn '/template';\n\t\tcase 'page':\n\t\t\treturn '/page';\n\t\tcase 'post':\n\t\t\treturn '/';\n\t}\n\tthrow 'Unknown post type';\n}\n\nfunction getNavigationPath( location, postType ) {\n\tconst { path, name } = location;\n\tif (\n\t\t[\n\t\t\t'pattern-item',\n\t\t\t'template-part-item',\n\t\t\t'page-item',\n\t\t\t'template-item',\n\t\t\t'static-template-item',\n\t\t\t'post-item',\n\t\t].includes( name )\n\t) {\n\t\treturn getListPathForPostType( postType );\n\t}\n\treturn addQueryArgs( path, { canvas: undefined } );\n}\n\nexport default function EditSiteEditor( {\n\tisHomeRoute = false,\n\tisPostsList = false,\n} ) {\n\tconst disableMotion = useReducedMotion();\n\tconst location = useLocation();\n\tconst { canvas = 'view' } = location.query;\n\tconst isLoading = useIsSiteEditorLoading();\n\tuseAdaptEditorToCanvas( canvas );\n\tconst entity = useResolveEditedEntity();\n\t// deprecated sync state with url\n\tuseSyncDeprecatedEntityIntoState( entity );\n\tconst { postType, postId, context } = entity;\n\tconst {\n\t\tisBlockBasedTheme,\n\t\teditorCanvasView,\n\t\tcurrentPostIsTrashed,\n\t\thasSiteIcon,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditorCanvasContainerView } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst { getCurrentTheme, getEntityRecord } = select( coreDataStore );\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase', undefined );\n\n\t\treturn {\n\t\t\tisBlockBasedTheme: getCurrentTheme()?.is_block_theme,\n\t\t\teditorCanvasView: getEditorCanvasContainerView(),\n\t\t\tcurrentPostIsTrashed:\n\t\t\t\tselect( editorStore ).getCurrentPostAttribute( 'status' ) ===\n\t\t\t\t'trash',\n\t\t\thasSiteIcon: !! siteData?.site_icon_url,\n\t\t};\n\t}, [] );\n\tconst postWithTemplate = !! context?.postId;\n\tuseEditorTitle(\n\t\tpostWithTemplate ? context.postType : postType,\n\t\tpostWithTemplate ? context.postId : postId\n\t);\n\tconst _isPreviewingTheme = isPreviewingTheme();\n\tconst hasDefaultEditorCanvasView = ! useHasEditorCanvasContainer();\n\tconst iframeProps = useEditorIframeProps();\n\tconst isEditMode = canvas === 'edit';\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst settings = useSpecificEditorSettings();\n\tconst styles = useMemo(\n\t\t() => [\n\t\t\t...settings.styles,\n\t\t\t{\n\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\tcss:\n\t\t\t\t\tcanvas === 'view'\n\t\t\t\t\t\t? `body{min-height: 100vh; ${\n\t\t\t\t\t\t\t\tcurrentPostIsTrashed ? '' : 'cursor: pointer;'\n\t\t\t\t\t\t }}`\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t],\n\t\t[ settings.styles, canvas, currentPostIsTrashed ]\n\t);\n\tconst { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst history = useHistory();\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\tcase 'delete-post':\n\t\t\t\t\t{\n\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\tgetListPathForPostType(\n\t\t\t\t\t\t\t\tpostWithTemplate ? context.postType : postType\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst _title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post or template, e.g: \"Hello world\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( _title )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t`/${ newItem.type }/${ newItem.id }?canvas=edit`\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tpostType,\n\t\t\tcontext?.postType,\n\t\t\tpostWithTemplate,\n\t\t\thistory,\n\t\t\tcreateSuccessNotice,\n\t\t]\n\t);\n\n\t// Replace the title and icon displayed in the DocumentBar when there's an overlay visible.\n\tconst title = getEditorCanvasContainerTitle( editorCanvasView );\n\n\tconst isReady = ! isLoading;\n\tconst transition = {\n\t\tduration: disableMotion ? 0 : 0.2,\n\t};\n\n\treturn ! isBlockBasedTheme && isHomeRoute ? (\n\t\t<SitePreview />\n\t) : (\n\t\t<>\n\t\t\t<GlobalStylesRenderer\n\t\t\t\tdisableRootPadding={ postType !== TEMPLATE_POST_TYPE }\n\t\t\t/>\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t{ isEditMode && <BlockKeyboardShortcuts /> }\n\t\t\t{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }\n\t\t\t{ isEditMode && (\n\t\t\t\t<WelcomeGuide\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<Editor\n\t\t\t\t\tpostType={ postWithTemplate ? context.postType : postType }\n\t\t\t\t\tpostId={ postWithTemplate ? context.postId : postId }\n\t\t\t\t\ttemplateId={ postWithTemplate ? postId : undefined }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tclassName=\"edit-site-editor__editor-interface\"\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tcustomSaveButton={\n\t\t\t\t\t\t_isPreviewingTheme && <SaveButton size=\"compact\" />\n\t\t\t\t\t}\n\t\t\t\t\tcustomSavePanel={ _isPreviewingTheme && <SavePanel /> }\n\t\t\t\t\tforceDisableBlockTools={ ! hasDefaultEditorCanvasView }\n\t\t\t\t\ttitle={ title }\n\t\t\t\t\tiframeProps={ iframeProps }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\textraSidebarPanels={\n\t\t\t\t\t\t! postWithTemplate && (\n\t\t\t\t\t\t\t<PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t<BackButton>\n\t\t\t\t\t\t\t{ ( { length } ) =>\n\t\t\t\t\t\t\t\tlength <= 1 && (\n\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-editor__view-mode-toggle\"\n\t\t\t\t\t\t\t\t\t\ttransition={ transition }\n\t\t\t\t\t\t\t\t\t\tanimate=\"edit\"\n\t\t\t\t\t\t\t\t\t\tinitial=\"edit\"\n\t\t\t\t\t\t\t\t\t\twhileHover=\"hover\"\n\t\t\t\t\t\t\t\t\t\twhileTap=\"tap\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open Navigation' ) }\n\t\t\t\t\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\t\t\t\t\ttooltipPosition=\"middle right\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tresetZoomLevel();\n\n\t\t\t\t\t\t\t\t\t\t\t\t// TODO: this is a temporary solution to navigate to the posts list if we are\n\t\t\t\t\t\t\t\t\t\t\t\t// come here through `posts list` and are in focus mode editing a template, template part etc..\n\t\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\t\tisPostsList &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tlocation.query?.focusMode\n\t\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\t\thistory.navigate( '/', {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\t\thistory.navigate(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetNavigationPath(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpostWithTemplate\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? context.postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: postType\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'canvas-mode-view-transition',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\t\tvariants={ siteIconVariants }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-editor__view-mode-toggle-icon\" />\n\t\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t\t'edit-site-editor__back-icon',\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t'has-site-icon':\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thasSiteIcon,\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tvariants={ toggleHomeIconVariants }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Icon icon={ arrowUpLeft } />\n\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</BackButton>\n\t\t\t\t\t) }\n\t\t\t\t\t<SiteEditorMoreMenu />\n\t\t\t\t\t{ isBlockBasedTheme && <GlobalStylesSidebar /> }\n\t\t\t\t</Editor>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,MAAM,EAAEC,gBAAgB,IAAIC,MAAM,QAAQ,uBAAuB;AAC1E,SAASC,aAAa,EAAEC,gBAAgB,QAAQ,oBAAoB;AACpE,SACCC,+BAA+B,EAC/BC,WAAW,IAAIC,iBAAiB,EAChCC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASH,KAAK,IAAII,aAAa,QAAQ,sBAAsB;AAC7D,SAASN,WAAW,IAAIO,uBAAuB,QAAQ,0BAA0B;AACjF,SAASC,WAAW,EAAEC,OAAO,QAAQ,oBAAoB;AACzD,SAASP,KAAK,IAAIQ,YAAY,QAAQ,oBAAoB;AAC1D,SAASV,WAAW,IAAIW,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,IAAI,EAAEC,WAAW,QAAQ,kBAAkB;AACpD,SAASZ,KAAK,IAAIa,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,YAAY,QAAQ,gBAAgB;;AAE7C;AACA;A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BACDpC,OAAO,CAACI,QAAQ,CAAE,GAAG,EAAE;kBACtBW,UAAU,EACT;gBACF,CAAE,CAAC;cACJ,CAAC,MAAM;gBACNf,OAAO,CAACI,QAAQ,CACf3C,iBAAiB,CAChBC,QAAQ,EACR2B,gBAAgB,GACbb,OAAO,CAAChB,QAAQ,GAChBA,QACJ,CAAC,EACD;kBACCuD,UAAU,EACT;gBACF,CACD,CAAC;cACF;YACD,CAAG;YAAAE,QAAA,eAEH5E,IAAA,CAAC7C,MAAM,CAACoI,GAAG;cACVS,QAAQ,EAAGhF,gBAAkB;cAAA4D,QAAA,eAE7B5E,IAAA,CAACV,QAAQ;gBAACyF,SAAS,EAAC;cAAyC,CAAE;YAAC,CACrD;UAAC,CACN,CAAC,eACT/E,IAAA,CAAC7C,MAAM,CAACoI,GAAG;YACVR,SAAS,EAAGjI,IAAI,CACf,6BAA6B,EAC7B;cACC,eAAe,EACdyF;YACF,CACD,CAAG;YACHyD,QAAQ,EAAGtF,sBAAwB;YAAAkE,QAAA,eAEnC5E,IAAA,CAAC5B,IAAI;cAAC6H,IAAI,EAAG5H;YAAa,CAAE;UAAC,CAClB,CAAC;QAAA,CACF;MACZ,CAES,CACZ,eACD2B,IAAA,CAACX,kBAAkB,IAAE,CAAC,EACpB+C,iBAAiB,iBAAIpC,IAAA,CAACjB,mBAAmB,IAAE,CAAC;IAAA,CACvC,CACR;EAAA,CACA,CACF;AACF","ignoreList":[]}
@@ -15,17 +15,9 @@ import { TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATT
15
15
  const {
16
16
  useLocation
17
17
  } = unlock(routerPrivateApis);
18
- const postTypesWithoutParentTemplate = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATTERN_TYPES.user];
18
+ const postTypesWithoutParentTemplate = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, NAVIGATION_POST_TYPE, PATTERN_TYPES.user, 'wp_registered_template'];
19
19
  const authorizedPostTypes = ['page', 'post'];
20
- export function useResolveEditedEntity() {
21
- const {
22
- name,
23
- params = {},
24
- query
25
- } = useLocation();
26
- const {
27
- postId = query?.postId
28
- } = params; // Fallback to query param for postId for list view routes.
20
+ function getPostType(name, postId) {
29
21
  let postType;
30
22
  if (name === 'navigation-item') {
31
23
  postType = NAVIGATION_POST_TYPE;
@@ -33,19 +25,42 @@ export function useResolveEditedEntity() {
33
25
  postType = PATTERN_TYPES.user;
34
26
  } else if (name === 'template-part-item') {
35
27
  postType = TEMPLATE_PART_POST_TYPE;
36
- } else if (name === 'template-item' || name === 'templates') {
28
+ } else if (name === 'templates') {
29
+ postType = /^\d+$/.test(postId) ? TEMPLATE_POST_TYPE : 'wp_registered_template';
30
+ } else if (name === 'template-item') {
37
31
  postType = TEMPLATE_POST_TYPE;
32
+ } else if (name === 'static-template-item') {
33
+ postType = 'wp_registered_template';
38
34
  } else if (name === 'page-item' || name === 'pages') {
39
35
  postType = 'page';
40
36
  } else if (name === 'post-item' || name === 'posts') {
41
37
  postType = 'post';
42
38
  }
39
+ return postType;
40
+ }
41
+ export function useResolveEditedEntity() {
42
+ var _getPostType;
43
+ const {
44
+ name,
45
+ params = {},
46
+ query
47
+ } = useLocation();
48
+ const {
49
+ postId: _postId = query?.postId
50
+ } = params; // Fallback to query param for postId for list view routes.
51
+ const _postType = (_getPostType = getPostType(name, _postId)) !== null && _getPostType !== void 0 ? _getPostType : query?.postType;
43
52
  const homePage = useSelect(select => {
44
53
  const {
45
54
  getHomePage
46
55
  } = unlock(select(coreDataStore));
47
56
  return getHomePage();
48
57
  }, []);
58
+ const [postType, postId] = useSelect(select => {
59
+ if (_postType !== 'wp_registered_template') {
60
+ return [_postType, _postId];
61
+ }
62
+ return [TEMPLATE_POST_TYPE, unlock(select(coreDataStore)).getTemplateAutoDraftId(_postId)];
63
+ }, [_postType, _postId]);
49
64
 
50
65
  /**
51
66
  * This is a hook that recreates the logic to resolve a template for a given WordPress postID postTypeId
@@ -82,6 +97,12 @@ export function useResolveEditedEntity() {
82
97
  return homePage?.postId;
83
98
  }
84
99
  }, [homePage, postId, postType]);
100
+ const editableResolvedTemplateId = useSelect(select => {
101
+ if (typeof resolvedTemplateId !== 'string') {
102
+ return resolvedTemplateId;
103
+ }
104
+ return unlock(select(coreDataStore)).getTemplateAutoDraftId(resolvedTemplateId);
105
+ }, [resolvedTemplateId]);
85
106
  const context = useMemo(() => {
86
107
  if (postTypesWithoutParentTemplate.includes(postType) && postId) {
87
108
  return {};
@@ -112,9 +133,9 @@ export function useResolveEditedEntity() {
112
133
  }
113
134
  if (!!homePage) {
114
135
  return {
115
- isReady: resolvedTemplateId !== undefined,
136
+ isReady: editableResolvedTemplateId !== undefined,
116
137
  postType: TEMPLATE_POST_TYPE,
117
- postId: resolvedTemplateId,
138
+ postId: editableResolvedTemplateId,
118
139
  context
119
140
  };
120
141
  }
@@ -133,7 +154,14 @@ export function useSyncDeprecatedEntityIntoState({
133
154
  } = useDispatch(editSiteStore);
134
155
  useEffect(() => {
135
156
  if (isReady) {
136
- setEditedEntity(postType, postId, context);
157
+ // setEditedEntity expects a string (because the postId used to be
158
+ // the template slug, even for edited templates). Now the postId can
159
+ // be a number (either because it's an auto-draft or edited
160
+ // template). Passing a number could break plugins doing things like
161
+ // `id.includes`. It would be way more complex to keep passing the
162
+ // template slug, while also being incorrect, so the easiest
163
+ // solution is to cast the postId to a string.
164
+ setEditedEntity(postType, String(postId), context);
137
165
  }
138
166
  }, [isReady, postType, postId, context, setEditedEntity]);
139
167
  }
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useMemo","useSelect","useDispatch","store","coreDataStore","privateApis","routerPrivateApis","editSiteStore","unlock","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","NAVIGATION_POST_TYPE","PATTERN_TYPES","useLocation","postTypesWithoutParentTemplate","user","authorizedPostTypes","useResolveEditedEntity","name","params","query","postId","postType","homePage","select","getHomePage","resolvedTemplateId","includes","getTemplateId","context","isReady","undefined","useSyncDeprecatedEntityIntoState","setEditedEntity"],"sources":["@wordpress/edit-site/src/components/editor/use-resolve-edited-entity.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES,\n} from '../../utils/constants';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst postTypesWithoutParentTemplate = [\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\nconst authorizedPostTypes = [ 'page', 'post' ];\n\nexport function useResolveEditedEntity() {\n\tconst { name, params = {}, query } = useLocation();\n\tconst { postId = query?.postId } = params; // Fallback to query param for postId for list view routes.\n\tlet postType;\n\tif ( name === 'navigation-item' ) {\n\t\tpostType = NAVIGATION_POST_TYPE;\n\t} else if ( name === 'pattern-item' ) {\n\t\tpostType = PATTERN_TYPES.user;\n\t} else if ( name === 'template-part-item' ) {\n\t\tpostType = TEMPLATE_PART_POST_TYPE;\n\t} else if ( name === 'template-item' || name === 'templates' ) {\n\t\tpostType = TEMPLATE_POST_TYPE;\n\t} else if ( name === 'page-item' || name === 'pages' ) {\n\t\tpostType = 'page';\n\t} else if ( name === 'post-item' || name === 'posts' ) {\n\t\tpostType = 'post';\n\t}\n\n\tconst homePage = useSelect( ( select ) => {\n\t\tconst { getHomePage } = unlock( select( coreDataStore ) );\n\t\treturn getHomePage();\n\t}, [] );\n\n\t/**\n\t * This is a hook that recreates the logic to resolve a template for a given WordPress postID postTypeId\n\t * in order to match the frontend as closely as possible in the site editor.\n\t *\n\t * It is not possible to rely on the server logic because there maybe unsaved changes that impact the template resolution.\n\t */\n\tconst resolvedTemplateId = useSelect(\n\t\t( select ) => {\n\t\t\t// If we're rendering a post type that doesn't have a template\n\t\t\t// no need to resolve its template.\n\t\t\tif (\n\t\t\t\tpostTypesWithoutParentTemplate.includes( postType ) &&\n\t\t\t\tpostId\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Don't trigger resolution for multi-selected posts.\n\t\t\tif ( postId && postId.includes( ',' ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { getTemplateId } = unlock( select( coreDataStore ) );\n\n\t\t\t// If we're rendering a specific page, we need to resolve its template.\n\t\t\t// The site editor only supports pages for now, not other CPTs.\n\t\t\tif (\n\t\t\t\tpostType &&\n\t\t\t\tpostId &&\n\t\t\t\tauthorizedPostTypes.includes( postType )\n\t\t\t) {\n\t\t\t\treturn getTemplateId( postType, postId );\n\t\t\t}\n\n\t\t\t// If we're rendering the home page, and we have a static home page, resolve its template.\n\t\t\tif ( homePage?.postType === 'page' ) {\n\t\t\t\treturn getTemplateId( 'page', homePage?.postId );\n\t\t\t}\n\n\t\t\tif ( homePage?.postType === 'wp_template' ) {\n\t\t\t\treturn homePage?.postId;\n\t\t\t}\n\t\t},\n\t\t[ homePage, postId, postType ]\n\t);\n\n\tconst context = useMemo( () => {\n\t\tif ( postTypesWithoutParentTemplate.includes( postType ) && postId ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tif ( postType && postId && authorizedPostTypes.includes( postType ) ) {\n\t\t\treturn { postType, postId };\n\t\t}\n\t\t// TODO: for post types lists we should probably not render the front page, but maybe a placeholder\n\t\t// with a message like \"Select a page\" or something similar.\n\t\tif ( homePage?.postType === 'page' ) {\n\t\t\treturn { postType: 'page', postId: homePage?.postId };\n\t\t}\n\n\t\treturn {};\n\t}, [ homePage, postType, postId ] );\n\n\tif ( postTypesWithoutParentTemplate.includes( postType ) && postId ) {\n\t\treturn { isReady: true, postType, postId, context };\n\t}\n\n\tif ( !! homePage ) {\n\t\treturn {\n\t\t\tisReady: resolvedTemplateId !== undefined,\n\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\tpostId: resolvedTemplateId,\n\t\t\tcontext,\n\t\t};\n\t}\n\n\treturn { isReady: false };\n}\n\nexport function useSyncDeprecatedEntityIntoState( {\n\tpostType,\n\tpostId,\n\tcontext,\n\tisReady,\n} ) {\n\tconst { setEditedEntity } = useDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\tif ( isReady ) {\n\t\t\tsetEditedEntity( postType, postId, context );\n\t\t}\n\t}, [ isReady, postType, postId, context, setEditedEntity ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,OAAO,QAAQ,oBAAoB;AACvD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,aAAa,QAAQ,sBAAsB;AAC7D,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASH,KAAK,IAAII,aAAa,QAAQ,aAAa;AACpD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SACCC,kBAAkB,EAClBC,uBAAuB,EACvBC,oBAAoB,EACpBC,aAAa,QACP,uBAAuB;AAE9B,MAAM;EAAEC;AAAY,CAAC,GAAGL,MAAM,CAAEF,iBAAkB,CAAC;AAEnD,MAAMQ,8BAA8B,GAAG,CACtCL,kBAAkB,EAClBC,uBAAuB,EACvBC,oBAAoB,EACpBC,aAAa,CAACG,IAAI,CAClB;AAED,MAAMC,mBAAmB,GAAG,CAAE,MAAM,EAAE,MAAM,CAAE;AAE9C,OAAO,SAASC,sBAAsBA,CAAA,EAAG;EACxC,MAAM;IAAEC,IAAI;IAAEC,MAAM,GAAG,CAAC,CAAC;IAAEC;EAAM,CAAC,GAAGP,WAAW,CAAC,CAAC;EAClD,MAAM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BAAkB;MAC5BY,MAAM,EAAEK,kBAAkB;MAC1BG;IACD,CAAC;EACF;EAEA,OAAO;IAAEC,OAAO,EAAE;EAAM,CAAC;AAC1B;AAEA,OAAO,SAASE,gCAAgCA,CAAE;EACjDV,QAAQ;EACRD,MAAM;EACNQ,OAAO;EACPC;AACD,CAAC,EAAG;EACH,MAAM;IAAEG;EAAgB,CAAC,GAAG/B,WAAW,CAAEK,aAAc,CAAC;EAExDR,SAAS,CAAE,MAAM;IAChB,IAAK+B,OAAO,EAAG;MACdG,eAAe,CAAEX,QAAQ,EAAED,MAAM,EAAEQ,OAAQ,CAAC;IAC7C;EACD,CAAC,EAAE,CAAEC,OAAO,EAAER,QAAQ,EAAED,MAAM,EAAEQ,OAAO,EAAEI,eAAe,CAAG,CAAC;AAC7D","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","useMemo","useSelect","useDispatch","store","coreDataStore","privateApis","routerPrivateApis","editSiteStore","unlock","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","NAVIGATION_POST_TYPE","PATTERN_TYPES","useLocation","postTypesWithoutParentTemplate","user","authorizedPostTypes","getPostType","name","postId","postType","test","useResolveEditedEntity","_getPostType","params","query","_postId","_postType","homePage","select","getHomePage","getTemplateAutoDraftId","resolvedTemplateId","includes","getTemplateId","editableResolvedTemplateId","context","isReady","undefined","useSyncDeprecatedEntityIntoState","setEditedEntity","String"],"sources":["@wordpress/edit-site/src/components/editor/use-resolve-edited-entity.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES,\n} from '../../utils/constants';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst postTypesWithoutParentTemplate = [\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n\t'wp_registered_template',\n];\n\nconst authorizedPostTypes = [ 'page', 'post' ];\n\nfunction getPostType( name, postId ) {\n\tlet postType;\n\tif ( name === 'navigation-item' ) {\n\t\tpostType = NAVIGATION_POST_TYPE;\n\t} else if ( name === 'pattern-item' ) {\n\t\tpostType = PATTERN_TYPES.user;\n\t} else if ( name === 'template-part-item' ) {\n\t\tpostType = TEMPLATE_PART_POST_TYPE;\n\t} else if ( name === 'templates' ) {\n\t\tpostType = /^\\d+$/.test( postId )\n\t\t\t? TEMPLATE_POST_TYPE\n\t\t\t: 'wp_registered_template';\n\t} else if ( name === 'template-item' ) {\n\t\tpostType = TEMPLATE_POST_TYPE;\n\t} else if ( name === 'static-template-item' ) {\n\t\tpostType = 'wp_registered_template';\n\t} else if ( name === 'page-item' || name === 'pages' ) {\n\t\tpostType = 'page';\n\t} else if ( name === 'post-item' || name === 'posts' ) {\n\t\tpostType = 'post';\n\t}\n\n\treturn postType;\n}\n\nexport function useResolveEditedEntity() {\n\tconst { name, params = {}, query } = useLocation();\n\tconst { postId: _postId = query?.postId } = params; // Fallback to query param for postId for list view routes.\n\tconst _postType = getPostType( name, _postId ) ?? query?.postType;\n\n\tconst homePage = useSelect( ( select ) => {\n\t\tconst { getHomePage } = unlock( select( coreDataStore ) );\n\t\treturn getHomePage();\n\t}, [] );\n\n\tconst [ postType, postId ] = useSelect(\n\t\t( select ) => {\n\t\t\tif ( _postType !== 'wp_registered_template' ) {\n\t\t\t\treturn [ _postType, _postId ];\n\t\t\t}\n\t\t\treturn [\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\tunlock( select( coreDataStore ) ).getTemplateAutoDraftId(\n\t\t\t\t\t_postId\n\t\t\t\t),\n\t\t\t];\n\t\t},\n\t\t[ _postType, _postId ]\n\t);\n\n\t/**\n\t * This is a hook that recreates the logic to resolve a template for a given WordPress postID postTypeId\n\t * in order to match the frontend as closely as possible in the site editor.\n\t *\n\t * It is not possible to rely on the server logic because there maybe unsaved changes that impact the template resolution.\n\t */\n\tconst resolvedTemplateId = useSelect(\n\t\t( select ) => {\n\t\t\t// If we're rendering a post type that doesn't have a template\n\t\t\t// no need to resolve its template.\n\t\t\tif (\n\t\t\t\tpostTypesWithoutParentTemplate.includes( postType ) &&\n\t\t\t\tpostId\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Don't trigger resolution for multi-selected posts.\n\t\t\tif ( postId && postId.includes( ',' ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { getTemplateId } = unlock( select( coreDataStore ) );\n\n\t\t\t// If we're rendering a specific page, we need to resolve its template.\n\t\t\t// The site editor only supports pages for now, not other CPTs.\n\t\t\tif (\n\t\t\t\tpostType &&\n\t\t\t\tpostId &&\n\t\t\t\tauthorizedPostTypes.includes( postType )\n\t\t\t) {\n\t\t\t\treturn getTemplateId( postType, postId );\n\t\t\t}\n\n\t\t\t// If we're rendering the home page, and we have a static home page, resolve its template.\n\t\t\tif ( homePage?.postType === 'page' ) {\n\t\t\t\treturn getTemplateId( 'page', homePage?.postId );\n\t\t\t}\n\n\t\t\tif ( homePage?.postType === 'wp_template' ) {\n\t\t\t\treturn homePage?.postId;\n\t\t\t}\n\t\t},\n\t\t[ homePage, postId, postType ]\n\t);\n\n\tconst editableResolvedTemplateId = useSelect(\n\t\t( select ) => {\n\t\t\tif ( typeof resolvedTemplateId !== 'string' ) {\n\t\t\t\treturn resolvedTemplateId;\n\t\t\t}\n\t\t\treturn unlock( select( coreDataStore ) ).getTemplateAutoDraftId(\n\t\t\t\tresolvedTemplateId\n\t\t\t);\n\t\t},\n\t\t[ resolvedTemplateId ]\n\t);\n\n\tconst context = useMemo( () => {\n\t\tif ( postTypesWithoutParentTemplate.includes( postType ) && postId ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tif ( postType && postId && authorizedPostTypes.includes( postType ) ) {\n\t\t\treturn { postType, postId };\n\t\t}\n\t\t// TODO: for post types lists we should probably not render the front page, but maybe a placeholder\n\t\t// with a message like \"Select a page\" or something similar.\n\t\tif ( homePage?.postType === 'page' ) {\n\t\t\treturn { postType: 'page', postId: homePage?.postId };\n\t\t}\n\n\t\treturn {};\n\t}, [ homePage, postType, postId ] );\n\n\tif ( postTypesWithoutParentTemplate.includes( postType ) && postId ) {\n\t\treturn { isReady: true, postType, postId, context };\n\t}\n\n\tif ( !! homePage ) {\n\t\treturn {\n\t\t\tisReady: editableResolvedTemplateId !== undefined,\n\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\tpostId: editableResolvedTemplateId,\n\t\t\tcontext,\n\t\t};\n\t}\n\n\treturn { isReady: false };\n}\n\nexport function useSyncDeprecatedEntityIntoState( {\n\tpostType,\n\tpostId,\n\tcontext,\n\tisReady,\n} ) {\n\tconst { setEditedEntity } = useDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\tif ( isReady ) {\n\t\t\t// setEditedEntity expects a string (because the postId used to be\n\t\t\t// the template slug, even for edited templates). Now the postId can\n\t\t\t// be a number (either because it's an auto-draft or edited\n\t\t\t// template). Passing a number could break plugins doing things like\n\t\t\t// `id.includes`. It would be way more complex to keep passing the\n\t\t\t// template slug, while also being incorrect, so the easiest\n\t\t\t// solution is to cast the postId to a string.\n\t\t\tsetEditedEntity( postType, String( postId ), context );\n\t\t}\n\t}, [ isReady, postType, postId, context, setEditedEntity ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,OAAO,QAAQ,oBAAoB;AACvD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,aAAa,QAAQ,sBAAsB;AAC7D,SAASC,WAAW,IAAIC,iBAAiB,Q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AAES,QAAQ,EAAET;MAAO,CAAC;IACtD;IAEA,OAAO,CAAC,CAAC;EACV,CAAC,EAAE,CAAES,QAAQ,EAAER,QAAQ,EAAED,MAAM,CAAG,CAAC;EAEnC,IAAKL,8BAA8B,CAACmB,QAAQ,CAAEb,QAAS,CAAC,IAAID,MAAM,EAAG;IACpE,OAAO;MAAEkB,OAAO,EAAE,IAAI;MAAEjB,QAAQ;MAAED,MAAM;MAAEiB;IAAQ,CAAC;EACpD;EAEA,IAAK,CAAC,CAAER,QAAQ,EAAG;IAClB,OAAO;MACNS,OAAO,EAAEF,0BAA0B,KAAKG,SAAS;MACjDlB,QAAQ,EAAEX,kBAAkB;MAC5BU,MAAM,EAAEgB,0BAA0B;MAClCC;IACD,CAAC;EACF;EAEA,OAAO;IAAEC,OAAO,EAAE;EAAM,CAAC;AAC1B;AAEA,OAAO,SAASE,gCAAgCA,CAAE;EACjDnB,QAAQ;EACRD,MAAM;EACNiB,OAAO;EACPC;AACD,CAAC,EAAG;EACH,MAAM;IAAEG;EAAgB,CAAC,GAAGtC,WAAW,CAAEK,aAAc,CAAC;EAExDR,SAAS,CAAE,MAAM;IAChB,IAAKsC,OAAO,EAAG;MACd;MACA;MACA;MACA;MACA;MACA;MACA;MACAG,eAAe,CAAEpB,QAAQ,EAAEqB,MAAM,CAAEtB,MAAO,CAAC,EAAEiB,OAAQ,CAAC;IACvD;EACD,CAAC,EAAE,CAAEC,OAAO,EAAEjB,QAAQ,EAAED,MAAM,EAAEiB,OAAO,EAAEI,eAAe,CAAG,CAAC;AAC7D","ignoreList":[]}
@@ -6,7 +6,6 @@ import { isRTL, __ } from '@wordpress/i18n';
6
6
  import { chevronLeft, chevronRight } from '@wordpress/icons';
7
7
  import { useSelect } from '@wordpress/data';
8
8
  import { store as coreStore } from '@wordpress/core-data';
9
- import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
10
9
 
11
10
  /**
12
11
  * Internal dependencies
@@ -15,13 +14,8 @@ import { IconWithCurrentColor } from './icon-with-current-color';
15
14
  import { NavigationButtonAsItem } from './navigation-button';
16
15
  import RootMenu from './root-menu';
17
16
  import PreviewStyles from './preview-styles';
18
- import { unlock } from '../../lock-unlock';
19
17
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
20
- const {
21
- useGlobalStyle
22
- } = unlock(blockEditorPrivateApis);
23
18
  function ScreenRoot() {
24
- const [customCSS] = useGlobalStyle('css');
25
19
  const {
26
20
  hasVariations,
27
21
  canEditCSS
@@ -91,7 +85,7 @@ function ScreenRoot() {
91
85
  })
92
86
  })
93
87
  })]
94
- }), canEditCSS && !!customCSS && /*#__PURE__*/_jsxs(_Fragment, {
88
+ }), canEditCSS && /*#__PURE__*/_jsxs(_Fragment, {
95
89
  children: [/*#__PURE__*/_jsx(CardDivider, {}), /*#__PURE__*/_jsxs(CardBody, {
96
90
  children: [/*#__PURE__*/_jsx(Spacer, {
97
91
  as: "p",
@@ -1 +1 @@
1
- {"version":3,"names":["__experimentalItemGroup","ItemGroup","__experimentalHStack","HStack","__experimentalSpacer","Spacer","__experimentalVStack","VStack","FlexItem","CardBody","Card","CardDivider","CardMedia","isRTL","__","chevronLeft","chevronRight","useSelect","store","coreStore","privateApis","blockEditorPrivateApis","IconWithCurrentColor","NavigationButtonAsItem","RootMenu","PreviewStyles","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","useGlobalStyle","ScreenRoot","customCSS","hasVariations","canEditCSS","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","__experimentalGetCurrentThemeGlobalStylesVariations","globalStylesId","globalStyles","undefined","length","_links","size","isBorderless","className","isRounded","children","spacing","path","justify","icon","as","paddingTop","paddingX","marginBottom"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-root.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalSpacer as Spacer,\n\t__experimentalVStack as VStack,\n\tFlexItem,\n\tCardBody,\n\tCard,\n\tCardDivider,\n\tCardMedia,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { chevronLeft, chevronRight } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { IconWithCurrentColor } from './icon-with-current-color';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport RootMenu from './root-menu';\nimport PreviewStyles from './preview-styles';\nimport { unlock } from '../../lock-unlock';\n\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nfunction ScreenRoot() {\n\tconst [ customCSS ] = useGlobalStyle( 'css' );\n\n\tconst { hasVariations, canEditCSS } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEntityRecord,\n\t\t\t__experimentalGetCurrentGlobalStylesId,\n\t\t\t__experimentalGetCurrentThemeGlobalStylesVariations,\n\t\t} = select( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\thasVariations:\n\t\t\t\t!! __experimentalGetCurrentThemeGlobalStylesVariations()\n\t\t\t\t\t?.length,\n\t\t\tcanEditCSS: !! globalStyles?._links?.[ 'wp:action-edit-css' ],\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<Card\n\t\t\tsize=\"small\"\n\t\t\tisBorderless\n\t\t\tclassName=\"edit-site-global-styles-screen-root\"\n\t\t\tisRounded={ false }\n\t\t>\n\t\t\t<CardBody>\n\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t<Card className=\"edit-site-global-styles-screen-root__active-style-tile\">\n\t\t\t\t\t\t<CardMedia className=\"edit-site-global-styles-screen-root__active-style-tile-preview\">\n\t\t\t\t\t\t\t<PreviewStyles />\n\t\t\t\t\t\t</CardMedia>\n\t\t\t\t\t</Card>\n\t\t\t\t\t{ hasVariations && (\n\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t<NavigationButtonAsItem path=\"/variations\">\n\t\t\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Browse styles' ) }\n\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t<IconWithCurrentColor\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\tisRTL() ? chevronLeft : chevronRight\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t<RootMenu />\n\t\t\t\t</VStack>\n\t\t\t</CardBody>\n\n\t\t\t<CardDivider />\n\n\t\t\t<CardBody>\n\t\t\t\t<Spacer\n\t\t\t\t\tas=\"p\"\n\t\t\t\t\tpaddingTop={ 2 }\n\t\t\t\t\t/*\n\t\t\t\t\t * 13px matches the text inset of the NavigationButton (12px padding, plus the width of the button's border).\n\t\t\t\t\t * This is an ad hoc override for this instance and the Additional CSS option below. Other options for matching the\n\t\t\t\t\t * the nav button inset should be looked at before reusing further.\n\t\t\t\t\t */\n\t\t\t\t\tpaddingX=\"13px\"\n\t\t\t\t\tmarginBottom={ 4 }\n\t\t\t\t>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Customize the appearance of specific blocks for the whole site.'\n\t\t\t\t\t) }\n\t\t\t\t</Spacer>\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t<NavigationButtonAsItem path=\"/blocks\">\n\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t<FlexItem>{ __( 'Blocks' ) }</FlexItem>\n\t\t\t\t\t\t\t<IconWithCurrentColor\n\t\t\t\t\t\t\t\ticon={ isRTL() ? chevronLeft : chevronRight }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t</ItemGroup>\n\t\t\t</CardBody>\n\n\t\t\t{ canEditCSS && !! customCSS && (\n\t\t\t\t<>\n\t\t\t\t\t<CardDivider />\n\t\t\t\t\t<CardBody>\n\t\t\t\t\t\t<Spacer\n\t\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t\t\tpaddingTop={ 2 }\n\t\t\t\t\t\t\tpaddingX=\"13px\"\n\t\t\t\t\t\t\tmarginBottom={ 4 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Add your own CSS to customize the appearance and layout of your site.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Spacer>\n\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t<NavigationButtonAsItem path=\"/css\">\n\t\t\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Additional CSS' ) }\n\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t<IconWithCurrentColor\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\tisRTL() ? chevronLeft : chevronRight\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t</CardBody>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</Card>\n\t);\n}\n\nexport default ScreenRoot;\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAAS,EACpCC,oBAAoB,IAAIC,M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AA,CACK;UAAC,CACc;QAAC,CACf,CAAC;MAAA,CACH,CAAC;IAAA,CACV,CACF;EAAA,CACI,CAAC;AAET;AAEA,eAAekB,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["__experimentalItemGroup","ItemGroup","__experimentalHStack","HStack","__experimentalSpacer","Spacer","__experimentalVStack","VStack","FlexItem","CardBody","Card","CardDivider","CardMedia","isRTL","__","chevronLeft","chevronRight","useSelect","store","coreStore","IconWithCurrentColor","NavigationButtonAsItem","RootMenu","PreviewStyles","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","ScreenRoot","hasVariations","canEditCSS","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","__experimentalGetCurrentThemeGlobalStylesVariations","globalStylesId","globalStyles","undefined","length","_links","size","isBorderless","className","isRounded","children","spacing","path","justify","icon","as","paddingTop","paddingX","marginBottom"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-root.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalSpacer as Spacer,\n\t__experimentalVStack as VStack,\n\tFlexItem,\n\tCardBody,\n\tCard,\n\tCardDivider,\n\tCardMedia,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { chevronLeft, chevronRight } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { IconWithCurrentColor } from './icon-with-current-color';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport RootMenu from './root-menu';\nimport PreviewStyles from './preview-styles';\n\nfunction ScreenRoot() {\n\tconst { hasVariations, canEditCSS } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEntityRecord,\n\t\t\t__experimentalGetCurrentGlobalStylesId,\n\t\t\t__experimentalGetCurrentThemeGlobalStylesVariations,\n\t\t} = select( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\thasVariations:\n\t\t\t\t!! __experimentalGetCurrentThemeGlobalStylesVariations()\n\t\t\t\t\t?.length,\n\t\t\tcanEditCSS: !! globalStyles?._links?.[ 'wp:action-edit-css' ],\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<Card\n\t\t\tsize=\"small\"\n\t\t\tisBorderless\n\t\t\tclassName=\"edit-site-global-styles-screen-root\"\n\t\t\tisRounded={ false }\n\t\t>\n\t\t\t<CardBody>\n\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t<Card className=\"edit-site-global-styles-screen-root__active-style-tile\">\n\t\t\t\t\t\t<CardMedia className=\"edit-site-global-styles-screen-root__active-style-tile-preview\">\n\t\t\t\t\t\t\t<PreviewStyles />\n\t\t\t\t\t\t</CardMedia>\n\t\t\t\t\t</Card>\n\t\t\t\t\t{ hasVariations && (\n\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t<NavigationButtonAsItem path=\"/variations\">\n\t\t\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Browse styles' ) }\n\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t<IconWithCurrentColor\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\tisRTL() ? chevronLeft : chevronRight\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t<RootMenu />\n\t\t\t\t</VStack>\n\t\t\t</CardBody>\n\n\t\t\t<CardDivider />\n\n\t\t\t<CardBody>\n\t\t\t\t<Spacer\n\t\t\t\t\tas=\"p\"\n\t\t\t\t\tpaddingTop={ 2 }\n\t\t\t\t\t/*\n\t\t\t\t\t * 13px matches the text inset of the NavigationButton (12px padding, plus the width of the button's border).\n\t\t\t\t\t * This is an ad hoc override for this instance and the Additional CSS option below. Other options for matching the\n\t\t\t\t\t * the nav button inset should be looked at before reusing further.\n\t\t\t\t\t */\n\t\t\t\t\tpaddingX=\"13px\"\n\t\t\t\t\tmarginBottom={ 4 }\n\t\t\t\t>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Customize the appearance of specific blocks for the whole site.'\n\t\t\t\t\t) }\n\t\t\t\t</Spacer>\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t<NavigationButtonAsItem path=\"/blocks\">\n\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t<FlexItem>{ __( 'Blocks' ) }</FlexItem>\n\t\t\t\t\t\t\t<IconWithCurrentColor\n\t\t\t\t\t\t\t\ticon={ isRTL() ? chevronLeft : chevronRight }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t</ItemGroup>\n\t\t\t</CardBody>\n\n\t\t\t{ canEditCSS && (\n\t\t\t\t<>\n\t\t\t\t\t<CardDivider />\n\t\t\t\t\t<CardBody>\n\t\t\t\t\t\t<Spacer\n\t\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t\t\tpaddingTop={ 2 }\n\t\t\t\t\t\t\tpaddingX=\"13px\"\n\t\t\t\t\t\t\tmarginBottom={ 4 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Add your own CSS to customize the appearance and layout of your site.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Spacer>\n\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t<NavigationButtonAsItem path=\"/css\">\n\t\t\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Additional CSS' ) }\n\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t<IconWithCurrentColor\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\tisRTL() ? chevronLeft : chevronRight\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t</CardBody>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</Card>\n\t);\n}\n\nexport default ScreenRoot;\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAAS,EACpCC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,QAAQ,EACRC,QAAQ,EACRC,IAAI,EACJC,WAAW,EACXC,SAAS,QACH,uBAAuB;AAC9B,SAASC,KAAK,EAAEC,EAAE,QAAQ,iBAAiB;AAC3C,SAASC,WAAW,EAAEC,YAAY,QAAQ,kBAAkB;AAC5D,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,sBAAsB,QAAQ,qBAAqB;AAC5D,OAAOC,QAAQ,MAAM,aAAa;AAClC,OAAOC,aAAa,MAAM,kBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAE7C,SAASC,UAAUA,CAAA,EAAG;EACrB,MAAM;IAAEC,aAAa;IAAEC;EAAW,CAAC,GAAGf,SAAS,CAAIgB,MAAM,IAAM;I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AC2B,IAAI,EAAC,MAAM;YAAAF,QAAA,eAClCnB,KAAA,CAACxB,MAAM;cAAC8C,OAAO,EAAC,eAAe;cAAAH,QAAA,gBAC9BrB,IAAA,CAACjB,QAAQ;gBAAAsC,QAAA,EACNhC,EAAE,CAAE,gBAAiB;cAAC,CACf,CAAC,eACXW,IAAA,CAACL,oBAAoB;gBACpB8B,IAAI,EACHrC,KAAK,CAAC,CAAC,GAAGE,WAAW,GAAGC;cACxB,CACD,CAAC;YAAA,CACK;UAAC,CACc;QAAC,CACf,CAAC;MAAA,CACH,CAAC;IAAA,CACV,CACF;EAAA,CACI,CAAC;AAET;AAEA,eAAec,UAAU","ignoreList":[]}
@@ -6,24 +6,47 @@ import clsx from 'clsx';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { Icon, __experimentalHStack as HStack } from '@wordpress/components';
9
+ import { Icon, __experimentalHStack as HStack, privateApis as componentsPrivateApis } from '@wordpress/components';
10
10
  import { __ } from '@wordpress/i18n';
11
11
  import { useState, useMemo } from '@wordpress/element';
12
12
  import { decodeEntities } from '@wordpress/html-entities';
13
13
  import { parse } from '@wordpress/blocks';
14
14
  import { BlockPreview, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
15
15
  import { EditorProvider } from '@wordpress/editor';
16
+ import { privateApis as corePrivateApis } from '@wordpress/core-data';
16
17
 
17
18
  /**
18
19
  * Internal dependencies
19
20
  */
20
21
  import { useAddedBy } from './hooks';
22
+ import { useDefaultTemplateTypes } from '../add-new-template/utils';
21
23
  import usePatternSettings from '../page-patterns/use-pattern-settings';
22
24
  import { unlock } from '../../lock-unlock';
23
25
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
26
  const {
25
27
  useGlobalStyle
26
28
  } = unlock(blockEditorPrivateApis);
29
+ const {
30
+ Badge
31
+ } = unlock(componentsPrivateApis);
32
+ const {
33
+ useEntityRecordsWithPermissions
34
+ } = unlock(corePrivateApis);
35
+ function useAllDefaultTemplateTypes() {
36
+ const defaultTemplateTypes = useDefaultTemplateTypes();
37
+ const {
38
+ records: staticRecords
39
+ } = useEntityRecordsWithPermissions('postType', 'wp_registered_template', {
40
+ per_page: -1
41
+ });
42
+ return [...defaultTemplateTypes, ...staticRecords?.filter(record => !record.is_custom).map(record => {
43
+ return {
44
+ slug: record.slug,
45
+ title: record.title.rendered,
46
+ description: record.description
47
+ };
48
+ })];
49
+ }
27
50
  function PreviewField({
28
51
  item
29
52
  }) {
@@ -65,10 +88,12 @@ export const previewField = {
65
88
  export const descriptionField = {
66
89
  label: __('Description'),
67
90
  id: 'description',
68
- render: ({
91
+ render: function RenderDescription({
69
92
  item
70
- }) => {
71
- return item.description && decodeEntities(item.description);
93
+ }) {
94
+ const defaultTemplateTypes = useAllDefaultTemplateTypes();
95
+ const defaultTemplateType = defaultTemplateTypes.find(type => type.slug === item.slug);
96
+ return item.description ? decodeEntities(item.description) : defaultTemplateType?.description;
72
97
  },
73
98
  enableSorting: false,
74
99
  enableGlobalSearch: true
@@ -110,7 +135,42 @@ export const authorField = {
110
135
  id: 'author',
111
136
  getValue: ({
112
137
  item
113
- }) => item.author_text,
138
+ }) => {
139
+ var _item$author_text;
140
+ return (_item$author_text = item.author_text) !== null && _item$author_text !== void 0 ? _item$author_text : item.author;
141
+ },
114
142
  render: AuthorField
115
143
  };
144
+ export const activeField = {
145
+ label: __('Status'),
146
+ id: 'active',
147
+ getValue: ({
148
+ item
149
+ }) => item._isActive,
150
+ render: function Render({
151
+ item
152
+ }) {
153
+ const isActive = item._isActive;
154
+ return /*#__PURE__*/_jsx(Badge, {
155
+ intent: isActive ? 'success' : 'default',
156
+ children: isActive ? __('Active') : __('Inactive')
157
+ });
158
+ }
159
+ };
160
+ export const slugField = {
161
+ label: __('Template Type'),
162
+ id: 'slug',
163
+ getValue: ({
164
+ item
165
+ }) => item.slug,
166
+ render: function Render({
167
+ item
168
+ }) {
169
+ const defaultTemplateTypes = useAllDefaultTemplateTypes();
170
+ const defaultTemplateType = defaultTemplateTypes.find(type => type.slug === item.slug);
171
+ return defaultTemplateType?.title ||
172
+ // translators: %s is the slug of a custom template.
173
+ __('Custom');
174
+ }
175
+ };
116
176
  //# sourceMappingURL=fields.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","Icon","__experimentalHStack","HStack","__","useState","useMemo","decodeEntities","parse","BlockPreview","privateApis","blockEditorPrivateApis","EditorProvider","useAddedBy","usePatternSettings","unlock","jsx","_jsx","jsxs","_jsxs","useGlobalStyle","PreviewField","item","settings","backgroundColor","blocks","content","raw","isEmpty","length","post","children","className","style","Async","previewField","label","id","render","enableSorting","descriptionField","description","enableGlobalSearch","AuthorField","isImageLoaded","setIsImageLoaded","text","icon","imageUrl","type","alignment","spacing","onLoad","alt","src","authorField","getValue","author_text"],"sources":["@wordpress/edit-site/src/components/page-templates/fields.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Icon, __experimentalHStack as HStack } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { parse } from '@wordpress/blocks';\nimport {\n\tBlockPreview,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { EditorProvider } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { useAddedBy } from './hooks';\nimport usePatternSettings from '../page-patterns/use-pattern-settings';\nimport { unlock } from '../../lock-unlock';\n\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nfunction PreviewField( { item } ) {\n\tconst settings = usePatternSettings();\n\tconst [ backgroundColor = 'white' ] = useGlobalStyle( 'color.background' );\n\tconst blocks = useMemo( () => {\n\t\treturn parse( item.content.raw );\n\t}, [ item.content.raw ] );\n\n\tconst isEmpty = ! blocks?.length;\n\t// Wrap everything in a block editor provider to ensure 'styles' that are needed\n\t// for the previews are synced between the site editor store and the block editor store.\n\t// Additionally we need to have the `__experimentalBlockPatterns` setting in order to\n\t// render patterns inside the previews.\n\t// TODO: Same approach is used in the patterns list and it becomes obvious that some of\n\t// the block editor settings are needed in context where we don't have the block editor.\n\t// Explore how we can solve this in a better way.\n\treturn (\n\t\t<EditorProvider post={ item } settings={ settings }>\n\t\t\t<div\n\t\t\t\tclassName=\"page-templates-preview-field\"\n\t\t\t\tstyle={ { backgroundColor } }\n\t\t\t>\n\t\t\t\t{ isEmpty && __( 'Empty template' ) }\n\t\t\t\t{ ! isEmpty && (\n\t\t\t\t\t<BlockPreview.Async>\n\t\t\t\t\t\t<BlockPreview blocks={ blocks } />\n\t\t\t\t\t</BlockPreview.Async>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</EditorProvider>\n\t);\n}\n\nexport const previewField = {\n\tlabel: __( 'Preview' ),\n\tid: 'preview',\n\trender: PreviewField,\n\tenableSorting: false,\n};\n\nexport const descriptionField = {\n\tlabel: __( 'Description' ),\n\tid: 'description',\n\trender: ( { item } ) => {\n\t\treturn item.description && decodeEntities( item.description );\n\t},\n\tenableSorting: false,\n\tenableGlobalSearch: true,\n};\n\nfunction AuthorField( { item } ) {\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\tconst { text, icon, imageUrl } = useAddedBy( item.type, item.id );\n\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 0 }>\n\t\t\t{ imageUrl && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( 'page-templates-author-field__avatar', {\n\t\t\t\t\t\t'is-loaded': isImageLoaded,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tsrc={ imageUrl }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ ! imageUrl && (\n\t\t\t\t<div className=\"page-templates-author-field__icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span className=\"page-templates-author-field__name\">{ text }</span>\n\t\t</HStack>\n\t);\n}\n\nexport const authorField = {\n\tlabel: __( 'Author' ),\n\tid: 'author',\n\tgetValue: ( { item } ) => item.author_text,\n\trender: AuthorField,\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,IAAI,EAAEC,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AAC5E,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,QAAQ,mBAAmB;AACzC,SACCC,YAAY,EACZC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SAASC,cAAc,QAAQ,mBAAmB;;AAElD;AACA;AACA;AACA,SAASC,UAAU,QAAQ,SAAS;AACpC,OAAOC,kBAAkB,MAAM,uCAAuC;AACtE,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE3C,MAAM;EAAEC;AAAe,CAAC,GAAGL,MAAM,CAAEJ,sBAAuB,CAAC;AAE3D,SAASU,YAAYA,CAAE;EAAEC;AAAK,CAAC,EAAG;EACjC,MAAMC,QAAQ,GAAGT,kBAAkB,CAAC,CAAC;EACrC,MAAM,CAAEU,eAAe,GAAG,OAAO,CAAE,GAAGJ,cAAc,CAAE,kBAAmB,CAAC;EAC1E,MAAMK,MAAM,GAAGnB,OAAO,CAAE,MAAM;IAC7B,OAAOE,KAAK,CAAEc,IAAI,CAACI,OAAO,CAACC,GAAI,CAAC;EACjC,CAAC,EAAE,CAAEL,IAAI,CAACI,OAAO,CAACC,GAAG,CAAG,CAAC;EAEzB,MAAMC,OAAO,GAAG,CAAEH,MAAM,EAAEI,MAAM;EAChC;EACA;EAC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,EAAC,MAAM;IAACC,OAAO,EAAG,CAAG;IAAApB,QAAA,GACnCiB,QAAQ,iBACT/B,IAAA;MACCe,SAAS,EAAGhC,IAAI,CAAE,qCAAqC,EAAE;QACxD,WAAW,EAAE4C;MACd,CAAE,CAAG;MAAAb,QAAA,eAELd,IAAA;QACCmC,MAAM,EAAGA,CAAA,KAAMP,gBAAgB,CAAE,IAAK,CAAG;QACzCQ,GAAG,EAAC,EAAE;QACNC,GAAG,EAAGN;MAAU,CAChB;IAAC,CACE,CACL,EACC,CAAEA,QAAQ,iBACX/B,IAAA;MAAKe,SAAS,EAAC,mCAAmC;MAAAD,QAAA,eACjDd,IAAA,CAAChB,IAAI;QAAC8C,IAAI,EAAGA;MAAM,CAAE;IAAC,CAClB,CACL,eACD9B,IAAA;MAAMe,SAAS,EAAC,mCAAmC;MAAAD,QAAA,EAAGe;IAAI,CAAQ,CAAC;EAAA,CAC5D,CAAC;AAEX;AAEA,OAAO,MAAMS,WAAW,GAAG;EAC1BnB,KAAK,EAAEhC,EAAE,CAAE,QAAS,CAAC;EACrBiC,EAAE,EAAE,QAAQ;EACZmB,QAAQ,EAAEA,CAAE;IAAElC;EAAK,CAAC,KAAMA,IAAI,CAACmC,WAAW;EAC1CnB,MAAM,EAAEK;AACT,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["clsx","Icon","__experimentalHStack","HStack","privateApis","componentsPrivateApis","__","useState","useMemo","decodeEntities","parse","BlockPreview","blockEditorPrivateApis","EditorProvider","corePrivateApis","useAddedBy","useDefaultTemplateTypes","usePatternSettings","unlock","jsx","_jsx","jsxs","_jsxs","useGlobalStyle","Badge","useEntityRecordsWithPermissions","useAllDefaultTemplateTypes","defaultTemplateTypes","records","staticRecords","per_page","filter","record","is_custom","map","slug","title","rendered","description","PreviewField","item","settings","backgroundColor","blocks","content","raw","isEmpty","length","post","children","className","style","Async","previewField","label","id","render","enableSorting","descriptionField","RenderDescription","defaultTemplateType","find","type","enableGlobalSearch","AuthorField","isImageLoaded","setIsImageLoaded","text","icon","imageUrl","alignment","spacing","onLoad","alt","src","authorField","getValue","_item$author_text","author_text","author","activeField","_isActive","Render","isActive","intent","slugField"],"sources":["@wordpress/edit-site/src/components/page-templates/fields.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalHStack as HStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { parse } from '@wordpress/blocks';\nimport {\n\tBlockPreview,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { EditorProvider } from '@wordpress/editor';\nimport { privateApis as corePrivateApis } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useAddedBy } from './hooks';\nimport { useDefaultTemplateTypes } from '../add-new-template/utils';\nimport usePatternSettings from '../page-patterns/use-pattern-settings';\nimport { unlock } from '../../lock-unlock';\n\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\nconst { Badge } = unlock( componentsPrivateApis );\nconst { useEntityRecordsWithPermissions } = unlock( corePrivateApis );\n\nfunction useAllDefaultTemplateTypes() {\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst { records: staticRecords } = useEntityRecordsWithPermissions(\n\t\t'postType',\n\t\t'wp_registered_template',\n\t\t{ per_page: -1 }\n\t);\n\treturn [\n\t\t...defaultTemplateTypes,\n\t\t...staticRecords\n\t\t\t?.filter( ( record ) => ! record.is_custom )\n\t\t\t.map( ( record ) => {\n\t\t\t\treturn {\n\t\t\t\t\tslug: record.slug,\n\t\t\t\t\ttitle: record.title.rendered,\n\t\t\t\t\tdescription: record.description,\n\t\t\t\t};\n\t\t\t} ),\n\t];\n}\n\nfunction PreviewField( { item } ) {\n\tconst settings = usePatternSettings();\n\tconst [ backgroundColor = 'white' ] = useGlobalStyle( 'color.background' );\n\tconst blocks = useMemo( () => {\n\t\treturn parse( item.content.raw );\n\t}, [ item.content.raw ] );\n\n\tconst isEmpty = ! blocks?.length;\n\t// Wrap everything in a block editor provider to ensure 'styles' that are needed\n\t// for the previews are synced between the site editor store and the block editor store.\n\t// Additionally we need to have the `__experimentalBlockPatterns` setting in order to\n\t// render patterns inside the previews.\n\t// TODO: Same approach is used in the patterns list and it becomes obvious that some of\n\t// the block editor settings are needed in context where we don't have the block editor.\n\t// Explore how we can solve this in a better way.\n\treturn (\n\t\t<EditorProvider post={ item } settings={ settings }>\n\t\t\t<div\n\t\t\t\tclassName=\"page-templates-preview-field\"\n\t\t\t\tstyle={ { backgroundColor } }\n\t\t\t>\n\t\t\t\t{ isEmpty && __( 'Empty template' ) }\n\t\t\t\t{ ! isEmpty && (\n\t\t\t\t\t<BlockPreview.Async>\n\t\t\t\t\t\t<BlockPreview blocks={ blocks } />\n\t\t\t\t\t</BlockPreview.Async>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</EditorProvider>\n\t);\n}\n\nexport const previewField = {\n\tlabel: __( 'Preview' ),\n\tid: 'preview',\n\trender: PreviewField,\n\tenableSorting: false,\n};\n\nexport const descriptionField = {\n\tlabel: __( 'Description' ),\n\tid: 'description',\n\trender: function RenderDescription( { item } ) {\n\t\tconst defaultTemplateTypes = useAllDefaultTemplateTypes();\n\t\tconst defaultTemplateType = defaultTemplateTypes.find(\n\t\t\t( type ) => type.slug === item.slug\n\t\t);\n\t\treturn item.description\n\t\t\t? decodeEntities( item.description )\n\t\t\t: defaultTemplateType?.description;\n\t},\n\tenableSorting: false,\n\tenableGlobalSearch: true,\n};\n\nfunction AuthorField( { item } ) {\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\tconst { text, icon, imageUrl } = useAddedBy( item.type, item.id );\n\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 0 }>\n\t\t\t{ imageUrl && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( 'page-templates-author-field__avatar', {\n\t\t\t\t\t\t'is-loaded': isImageLoaded,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tsrc={ imageUrl }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ ! imageUrl && (\n\t\t\t\t<div className=\"page-templates-author-field__icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span className=\"page-templates-author-field__name\">{ text }</span>\n\t\t</HStack>\n\t);\n}\n\nexport const authorField = {\n\tlabel: __( 'Author' ),\n\tid: 'author',\n\tgetValue: ( { item } ) => item.author_text ?? item.author,\n\trender: AuthorField,\n};\n\nexport const activeField = {\n\tlabel: __( 'Status' ),\n\tid: 'active',\n\tgetValue: ( { item } ) => item._isActive,\n\trender: function Render( { item } ) {\n\t\tconst isActive = item._isActive;\n\t\treturn (\n\t\t\t<Badge intent={ isActive ? 'success' : 'default' }>\n\t\t\t\t{ isActive ? __( 'Active' ) : __( 'Inactive' ) }\n\t\t\t</Badge>\n\t\t);\n\t},\n};\n\nexport const slugField = {\n\tlabel: __( 'Template Type' ),\n\tid: 'slug',\n\tgetValue: ( { item } ) => item.slug,\n\trender: function Render( { item } ) {\n\t\tconst defaultTemplateTypes = useAllDefaultTemplateTypes();\n\t\tconst defaultTemplateType = defaultTemplateTypes.find(\n\t\t\t( type ) => type.slug === item.slug\n\t\t);\n\t\treturn (\n\t\t\tdefaultTemplateType?.title ||\n\t\t\t// translators: %s is the slug of a custom template.\n\t\t\t__( 'Custom' )\n\t\t);\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,IAAI,EACJC,oBAAoB,IAAIC,MAAM,EAC9BC,WAAW,IAAIC,qBAAqB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