@wordpress/edit-site 5.27.1 → 5.27.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/build/components/block-editor/back-button.js +2 -3
  2. package/build/components/block-editor/back-button.js.map +1 -1
  3. package/build/components/block-editor/site-editor-canvas.js +8 -2
  4. package/build/components/block-editor/site-editor-canvas.js.map +1 -1
  5. package/build/components/block-editor/use-post-link-props.js +5 -1
  6. package/build/components/block-editor/use-post-link-props.js.map +1 -1
  7. package/build/components/editor/index.js +7 -7
  8. package/build/components/editor/index.js.map +1 -1
  9. package/build/components/global-styles/font-library-modal/context.js +14 -0
  10. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  11. package/build/components/global-styles/font-library-modal/font-collection.js +17 -33
  12. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  13. package/build/components/global-styles/font-library-modal/font-demo.js +1 -1
  14. package/build/components/global-styles/font-library-modal/font-demo.js.map +1 -1
  15. package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +1 -1
  16. package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
  17. package/build/components/global-styles/font-library-modal/index.js +10 -3
  18. package/build/components/global-styles/font-library-modal/index.js.map +1 -1
  19. package/build/components/global-styles/font-library-modal/installed-fonts.js +8 -21
  20. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  21. package/build/components/global-styles/font-library-modal/library-font-variant.js +2 -2
  22. package/build/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
  23. package/build/components/global-styles/font-library-modal/resolvers.js +1 -1
  24. package/build/components/global-styles/font-library-modal/resolvers.js.map +1 -1
  25. package/build/components/global-styles/font-library-modal/tab-panel-layout.js +9 -1
  26. package/build/components/global-styles/font-library-modal/tab-panel-layout.js.map +1 -1
  27. package/build/components/global-styles/font-library-modal/upload-fonts.js +160 -4
  28. package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  29. package/build/components/global-styles/font-library-modal/utils/index.js +33 -31
  30. package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  31. package/build/components/routes/link.js +1 -1
  32. package/build/components/routes/link.js.map +1 -1
  33. package/build/components/sidebar-edit-mode/index.js +1 -2
  34. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  35. package/build/components/sidebar-edit-mode/settings-header/index.js +7 -36
  36. package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
  37. package/build/components/welcome-guide/template.js +2 -2
  38. package/build/components/welcome-guide/template.js.map +1 -1
  39. package/build/hooks/commands/use-edit-mode-commands.js +16 -6
  40. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  41. package/build-module/components/block-editor/back-button.js +2 -3
  42. package/build-module/components/block-editor/back-button.js.map +1 -1
  43. package/build-module/components/block-editor/site-editor-canvas.js +8 -2
  44. package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
  45. package/build-module/components/block-editor/use-post-link-props.js +5 -1
  46. package/build-module/components/block-editor/use-post-link-props.js.map +1 -1
  47. package/build-module/components/editor/index.js +7 -7
  48. package/build-module/components/editor/index.js.map +1 -1
  49. package/build-module/components/global-styles/font-library-modal/context.js +14 -0
  50. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  51. package/build-module/components/global-styles/font-library-modal/font-collection.js +19 -35
  52. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  53. package/build-module/components/global-styles/font-library-modal/font-demo.js +1 -1
  54. package/build-module/components/global-styles/font-library-modal/font-demo.js.map +1 -1
  55. package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +1 -1
  56. package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
  57. package/build-module/components/global-styles/font-library-modal/index.js +10 -3
  58. package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
  59. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +9 -22
  60. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  61. package/build-module/components/global-styles/font-library-modal/library-font-variant.js +2 -2
  62. package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
  63. package/build-module/components/global-styles/font-library-modal/resolvers.js +1 -1
  64. package/build-module/components/global-styles/font-library-modal/resolvers.js.map +1 -1
  65. package/build-module/components/global-styles/font-library-modal/tab-panel-layout.js +10 -2
  66. package/build-module/components/global-styles/font-library-modal/tab-panel-layout.js.map +1 -1
  67. package/build-module/components/global-styles/font-library-modal/upload-fonts.js +162 -6
  68. package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  69. package/build-module/components/global-styles/font-library-modal/utils/index.js +32 -30
  70. package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  71. package/build-module/components/routes/link.js +1 -1
  72. package/build-module/components/routes/link.js.map +1 -1
  73. package/build-module/components/sidebar-edit-mode/index.js +1 -2
  74. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  75. package/build-module/components/sidebar-edit-mode/settings-header/index.js +7 -36
  76. package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
  77. package/build-module/components/welcome-guide/template.js +2 -2
  78. package/build-module/components/welcome-guide/template.js.map +1 -1
  79. package/build-module/hooks/commands/use-edit-mode-commands.js +16 -6
  80. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  81. package/build-style/style-rtl.css +4 -6
  82. package/build-style/style.css +4 -6
  83. package/package.json +11 -11
  84. package/src/components/block-editor/back-button.js +6 -3
  85. package/src/components/block-editor/site-editor-canvas.js +19 -12
  86. package/src/components/block-editor/use-post-link-props.js +5 -1
  87. package/src/components/editor/index.js +4 -9
  88. package/src/components/global-styles/font-library-modal/context.js +14 -0
  89. package/src/components/global-styles/font-library-modal/font-collection.js +16 -40
  90. package/src/components/global-styles/font-library-modal/font-demo.js +1 -1
  91. package/src/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +1 -1
  92. package/src/components/global-styles/font-library-modal/index.js +8 -3
  93. package/src/components/global-styles/font-library-modal/installed-fonts.js +12 -31
  94. package/src/components/global-styles/font-library-modal/library-font-variant.js +2 -2
  95. package/src/components/global-styles/font-library-modal/resolvers.js +1 -1
  96. package/src/components/global-styles/font-library-modal/style.scss +0 -10
  97. package/src/components/global-styles/font-library-modal/tab-panel-layout.js +15 -0
  98. package/src/components/global-styles/font-library-modal/upload-fonts.js +201 -6
  99. package/src/components/global-styles/font-library-modal/utils/index.js +44 -38
  100. package/src/components/routes/link.js +1 -1
  101. package/src/components/sidebar-edit-mode/index.js +1 -4
  102. package/src/components/sidebar-edit-mode/settings-header/index.js +12 -34
  103. package/src/components/welcome-guide/template.js +2 -2
  104. package/src/hooks/commands/use-edit-mode-commands.js +26 -14
  105. package/build/components/global-styles/font-library-modal/local-fonts.js +0 -196
  106. package/build/components/global-styles/font-library-modal/local-fonts.js.map +0 -1
  107. package/build-module/components/global-styles/font-library-modal/local-fonts.js +0 -187
  108. package/build-module/components/global-styles/font-library-modal/local-fonts.js.map +0 -1
  109. package/src/components/global-styles/font-library-modal/local-fonts.js +0 -239
@@ -9,7 +9,6 @@ import { useEffect } from '@wordpress/element';
9
9
  import { useSelect, useDispatch } from '@wordpress/data';
10
10
  import { store as interfaceStore } from '@wordpress/interface';
11
11
  import { store as blockEditorStore } from '@wordpress/block-editor';
12
- import { store as editorStore } from '@wordpress/editor';
13
12
 
14
13
  /**
15
14
  * Internal dependencies
@@ -44,7 +43,7 @@ export function SidebarComplementaryAreaFills() {
44
43
  isEditorSidebarOpened: _isEditorSidebarOpened,
45
44
  hasBlockSelection: !!select(blockEditorStore).getBlockSelectionStart(),
46
45
  supportsGlobalStyles: !settings?.supportsTemplatePartsMode,
47
- isEditingPage: select(editSiteStore).isPage() && select(editorStore).getRenderingMode() !== 'template-only'
46
+ isEditingPage: select(editSiteStore).isPage()
48
47
  };
49
48
  }, []);
50
49
  const {
@@ -1 +1 @@
1
- {"version":3,"names":["createSlotFill","isRTL","__","drawerLeft","drawerRight","useEffect","useSelect","useDispatch","store","interfaceStore","blockEditorStore","editorStore","DefaultSidebar","GlobalStylesSidebar","STORE_NAME","SettingsHeader","PagePanels","TemplatePanel","PluginTemplateSettingPanel","SIDEBAR_BLOCK","SIDEBAR_TEMPLATE","editSiteStore","Slot","InspectorSlot","Fill","InspectorFill","SidebarInspectorFill","SidebarComplementaryAreaFills","sidebar","isEditorSidebarOpened","hasBlockSelection","supportsGlobalStyles","isEditingPage","select","_sidebar","getActiveComplementaryArea","_isEditorSidebarOpened","includes","settings","getSettings","getBlockSelectionStart","supportsTemplatePartsMode","isPage","getRenderingMode","enableComplementaryArea","sidebarName","createElement","Fragment","identifier","title","icon","closeLabel","header","headerClassName","bubblesVirtually"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport GlobalStylesSidebar from './global-styles-sidebar';\nimport { STORE_NAME } from '../../store/constants';\nimport SettingsHeader from './settings-header';\nimport PagePanels from './page-panels';\nimport TemplatePanel from './template-panel';\nimport PluginTemplateSettingPanel from '../plugin-template-setting-panel';\nimport { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from './constants';\nimport { store as editSiteStore } from '../../store';\n\nconst { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(\n\t'EditSiteSidebarInspector'\n);\nexport const SidebarInspectorFill = InspectorFill;\n\nexport function SidebarComplementaryAreaFills() {\n\tconst {\n\t\tsidebar,\n\t\tisEditorSidebarOpened,\n\t\thasBlockSelection,\n\t\tsupportsGlobalStyles,\n\t\tisEditingPage,\n\t} = useSelect( ( select ) => {\n\t\tconst _sidebar =\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea( STORE_NAME );\n\t\tconst _isEditorSidebarOpened = [\n\t\t\tSIDEBAR_BLOCK,\n\t\t\tSIDEBAR_TEMPLATE,\n\t\t].includes( _sidebar );\n\t\tconst settings = select( editSiteStore ).getSettings();\n\t\treturn {\n\t\t\tsidebar: _sidebar,\n\t\t\tisEditorSidebarOpened: _isEditorSidebarOpened,\n\t\t\thasBlockSelection:\n\t\t\t\t!! select( blockEditorStore ).getBlockSelectionStart(),\n\t\t\tsupportsGlobalStyles: ! settings?.supportsTemplatePartsMode,\n\t\t\tisEditingPage:\n\t\t\t\tselect( editSiteStore ).isPage() &&\n\t\t\t\tselect( editorStore ).getRenderingMode() !== 'template-only',\n\t\t};\n\t}, [] );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\t// Don't automatically switch tab when the sidebar is closed or when we\n\t\t// are focused on page content.\n\t\tif ( ! isEditorSidebarOpened ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( hasBlockSelection ) {\n\t\t\tif ( ! isEditingPage ) {\n\t\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\t\t\t}\n\t\t} else {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_TEMPLATE );\n\t\t}\n\t}, [\n\t\thasBlockSelection,\n\t\tisEditorSidebarOpened,\n\t\tisEditingPage,\n\t\tenableComplementaryArea,\n\t] );\n\n\tlet sidebarName = sidebar;\n\tif ( ! isEditorSidebarOpened ) {\n\t\tsidebarName = hasBlockSelection ? SIDEBAR_BLOCK : SIDEBAR_TEMPLATE;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<DefaultSidebar\n\t\t\t\tidentifier={ sidebarName }\n\t\t\t\ttitle={ __( 'Settings' ) }\n\t\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\t\theader={ <SettingsHeader sidebarName={ sidebarName } /> }\n\t\t\t\theaderClassName=\"edit-site-sidebar-edit-mode__panel-tabs\"\n\t\t\t>\n\t\t\t\t{ sidebarName === SIDEBAR_TEMPLATE && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isEditingPage ? <PagePanels /> : <TemplatePanel /> }\n\t\t\t\t\t\t<PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t{ sidebarName === SIDEBAR_BLOCK && (\n\t\t\t\t\t<InspectorSlot bubblesVirtually />\n\t\t\t\t) }\n\t\t\t</DefaultSidebar>\n\t\t\t{ supportsGlobalStyles && <GlobalStylesSidebar /> }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,cAAc,QAAQ,uBAAuB;AACtD,SAASC,KAAK,EAAEC,EAAE,QAAQ,iBAAiB;AAC3C,SAASC,UAAU,EAAEC,WAAW,QAAQ,kBAAkB;AAC1D,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,cAAc,QAAQ,sBAAsB;AAC9D,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,yBAAyB;AACnE,SAASF,KAAK,IAAIG,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,OAAOC,cAAc,MAAM,mBAAmB;AAC9C,OAAOC,mBAAmB,MAAM,yBAAyB;AACzD,SAASC,UAAU,QAAQ,uBAAuB;AAClD,OAAOC,cAAc,MAAM,mBAAmB;AAC9C,OAAOC,UAAU,MAAM,eAAe;AACtC,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,OAAOC,0BAA0B,MAAM,kCAAkC;AACzE,SAASC,aAAa,EAAEC,gBAAgB,QAAQ,aAAa;AAC7D,SAASZ,KAAK,IAAIa,aAAa,QAAQ,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AAC;MACrD;IACD,CAAC,MAAM;MACNyB,uBAAuB,CAAE9B,UAAU,EAAEM,gBAAiB,CAAC;IACxD;EACD,CAAC,EAAE,CACFU,iBAAiB,EACjBD,qBAAqB,EACrBG,aAAa,EACbY,uBAAuB,CACtB,CAAC;EAEH,IAAIC,WAAW,GAAGjB,OAAO;EACzB,IAAK,CAAEC,qBAAqB,EAAG;IAC9BgB,WAAW,GAAGf,iBAAiB,GAAGX,aAAa,GAAGC,gBAAgB;EACnE;EAEA,OACC0B,aAAA,CAAAC,QAAA,QACCD,aAAA,CAAClC,cAAc;IACdoC,UAAU,EAAGH,WAAa;IAC1BI,KAAK,EAAG/C,EAAE,CAAE,UAAW,CAAG;IAC1BgD,IAAI,EAAGjD,KAAK,CAAC,CAAC,GAAGE,UAAU,GAAGC,WAAa;IAC3C+C,UAAU,EAAGjD,EAAE,CAAE,gBAAiB,CAAG;IACrCkD,MAAM,EAAGN,aAAA,CAAC/B,cAAc;MAAC8B,WAAW,EAAGA;IAAa,CAAE,CAAG;IACzDQ,eAAe,EAAC;EAAyC,GAEvDR,WAAW,KAAKzB,gBAAgB,IACjC0B,aAAA,CAAAC,QAAA,QACGf,aAAa,GAAGc,aAAA,CAAC9B,UAAU,MAAE,CAAC,GAAG8B,aAAA,CAAC7B,aAAa,MAAE,CAAC,EACpD6B,aAAA,CAAC5B,0BAA0B,CAACI,IAAI,MAAE,CACjC,CACF,EACCuB,WAAW,KAAK1B,aAAa,IAC9B2B,aAAA,CAACvB,aAAa;IAAC+B,gBAAgB;EAAA,CAAE,CAEnB,CAAC,EACfvB,oBAAoB,IAAIe,aAAA,CAACjC,mBAAmB,MAAE,CAC/C,CAAC;AAEL"}
1
+ {"version":3,"names":["createSlotFill","isRTL","__","drawerLeft","drawerRight","useEffect","useSelect","useDispatch","store","interfaceStore","blockEditorStore","DefaultSidebar","GlobalStylesSidebar","STORE_NAME","SettingsHeader","PagePanels","TemplatePanel","PluginTemplateSettingPanel","SIDEBAR_BLOCK","SIDEBAR_TEMPLATE","editSiteStore","Slot","InspectorSlot","Fill","InspectorFill","SidebarInspectorFill","SidebarComplementaryAreaFills","sidebar","isEditorSidebarOpened","hasBlockSelection","supportsGlobalStyles","isEditingPage","select","_sidebar","getActiveComplementaryArea","_isEditorSidebarOpened","includes","settings","getSettings","getBlockSelectionStart","supportsTemplatePartsMode","isPage","enableComplementaryArea","sidebarName","createElement","Fragment","identifier","title","icon","closeLabel","header","headerClassName","bubblesVirtually"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport GlobalStylesSidebar from './global-styles-sidebar';\nimport { STORE_NAME } from '../../store/constants';\nimport SettingsHeader from './settings-header';\nimport PagePanels from './page-panels';\nimport TemplatePanel from './template-panel';\nimport PluginTemplateSettingPanel from '../plugin-template-setting-panel';\nimport { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from './constants';\nimport { store as editSiteStore } from '../../store';\n\nconst { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(\n\t'EditSiteSidebarInspector'\n);\nexport const SidebarInspectorFill = InspectorFill;\n\nexport function SidebarComplementaryAreaFills() {\n\tconst {\n\t\tsidebar,\n\t\tisEditorSidebarOpened,\n\t\thasBlockSelection,\n\t\tsupportsGlobalStyles,\n\t\tisEditingPage,\n\t} = useSelect( ( select ) => {\n\t\tconst _sidebar =\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea( STORE_NAME );\n\t\tconst _isEditorSidebarOpened = [\n\t\t\tSIDEBAR_BLOCK,\n\t\t\tSIDEBAR_TEMPLATE,\n\t\t].includes( _sidebar );\n\t\tconst settings = select( editSiteStore ).getSettings();\n\t\treturn {\n\t\t\tsidebar: _sidebar,\n\t\t\tisEditorSidebarOpened: _isEditorSidebarOpened,\n\t\t\thasBlockSelection:\n\t\t\t\t!! select( blockEditorStore ).getBlockSelectionStart(),\n\t\t\tsupportsGlobalStyles: ! settings?.supportsTemplatePartsMode,\n\t\t\tisEditingPage: select( editSiteStore ).isPage(),\n\t\t};\n\t}, [] );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\t// Don't automatically switch tab when the sidebar is closed or when we\n\t\t// are focused on page content.\n\t\tif ( ! isEditorSidebarOpened ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( hasBlockSelection ) {\n\t\t\tif ( ! isEditingPage ) {\n\t\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\t\t\t}\n\t\t} else {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_TEMPLATE );\n\t\t}\n\t}, [\n\t\thasBlockSelection,\n\t\tisEditorSidebarOpened,\n\t\tisEditingPage,\n\t\tenableComplementaryArea,\n\t] );\n\n\tlet sidebarName = sidebar;\n\tif ( ! isEditorSidebarOpened ) {\n\t\tsidebarName = hasBlockSelection ? SIDEBAR_BLOCK : SIDEBAR_TEMPLATE;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<DefaultSidebar\n\t\t\t\tidentifier={ sidebarName }\n\t\t\t\ttitle={ __( 'Settings' ) }\n\t\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\t\theader={ <SettingsHeader sidebarName={ sidebarName } /> }\n\t\t\t\theaderClassName=\"edit-site-sidebar-edit-mode__panel-tabs\"\n\t\t\t>\n\t\t\t\t{ sidebarName === SIDEBAR_TEMPLATE && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isEditingPage ? <PagePanels /> : <TemplatePanel /> }\n\t\t\t\t\t\t<PluginTemplateSettingPanel.Slot />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t{ sidebarName === SIDEBAR_BLOCK && (\n\t\t\t\t\t<InspectorSlot bubblesVirtually />\n\t\t\t\t) }\n\t\t\t</DefaultSidebar>\n\t\t\t{ supportsGlobalStyles && <GlobalStylesSidebar /> }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,cAAc,QAAQ,uBAAuB;AACtD,SAASC,KAAK,EAAEC,EAAE,QAAQ,iBAAiB;AAC3C,SAASC,UAAU,EAAEC,WAAW,QAAQ,kBAAkB;AAC1D,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,cAAc,QAAQ,sBAAsB;AAC9D,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,yBAAyB;;AAEnE;AACA;AACA;AACA,OAAOC,cAAc,MAAM,mBAAmB;AAC9C,OAAOC,mBAAmB,MAAM,yBAAyB;AACzD,SAASC,UAAU,QAAQ,uBAAuB;AAClD,OAAOC,cAAc,MAAM,mBAAmB;AAC9C,OAAOC,UAAU,MAAM,eAAe;AACtC,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,OAAOC,0BAA0B,MAAM,kCAAkC;AACzE,SAASC,aAAa,EAAEC,gBAAgB,QAAQ,aAAa;AAC7D,SAASX,KAAK,IAAIY,aAAa,QAAQ,aAAa;AAEpD,MAAM;EAAEC,IAAI,EAAEC,aAAa;EAAEC,IAAI,EAAEC;AAAc,CAAC,GAAGxB,cAAc,CAClE,0BACD,CAAC;AACD,OAAO,MAAMyB,oBAAoB,GAAGD,aAAa;AAEjD,OAAO,SAASE,6BAA6BA,CAAA,EAAG;EAC/C,MAAM;IACLC,OAAO;IACPC,qBAAqB;IACrBC,iBAAiB;IACjBC,oBAAoB;IACpBC;EACD,CAAC,GAAGzB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;IACdmC,UAAU,EAAGH,WAAa;IAC1BI,KAAK,EAAG7C,EAAE,CAAE,UAAW,CAAG;IAC1B8C,IAAI,EAAG/C,KAAK,CAAC,CAAC,GAAGE,UAAU,GAAGC,WAAa;IAC3C6C,UAAU,EAAG/C,EAAE,CAAE,gBAAiB,CAAG;IACrCgD,MAAM,EAAGN,aAAA,CAAC9B,cAAc;MAAC6B,WAAW,EAAGA;IAAa,CAAE,CAAG;IACzDQ,eAAe,EAAC;EAAyC,GAEvDR,WAAW,KAAKxB,gBAAgB,IACjCyB,aAAA,CAAAC,QAAA,QACGd,aAAa,GAAGa,aAAA,CAAC7B,UAAU,MAAE,CAAC,GAAG6B,aAAA,CAAC5B,aAAa,MAAE,CAAC,EACpD4B,aAAA,CAAC3B,0BAA0B,CAACI,IAAI,MAAE,CACjC,CACF,EACCsB,WAAW,KAAKzB,aAAa,IAC9B0B,aAAA,CAACtB,aAAa;IAAC8B,gBAAgB;EAAA,CAAE,CAEnB,CAAC,EACftB,oBAAoB,IAAIc,aAAA,CAAChC,mBAAmB,MAAE,CAC/C,CAAC;AAEL"}
@@ -18,47 +18,18 @@ import { store as editorStore } from '@wordpress/editor';
18
18
  */
19
19
  import { STORE_NAME } from '../../../store/constants';
20
20
  import { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from '../constants';
21
- import { store as editSiteStore } from '../../../store';
22
- import { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../../utils/constants';
23
21
  const SettingsHeader = ({
24
22
  sidebarName
25
23
  }) => {
26
- const {
27
- isEditingPage,
28
- entityType
29
- } = useSelect(select => {
30
- const {
31
- getEditedPostType,
32
- isPage
33
- } = select(editSiteStore);
34
- const {
35
- getRenderingMode
36
- } = select(editorStore);
37
- return {
38
- isEditingPage: isPage() && getRenderingMode() !== 'template-only',
39
- entityType: getEditedPostType()
40
- };
41
- });
42
- const entityLabel = POST_TYPE_LABELS[entityType] || POST_TYPE_LABELS[TEMPLATE_POST_TYPE];
24
+ const postTypeLabel = useSelect(select => select(editorStore).getPostTypeLabel(), []);
43
25
  const {
44
26
  enableComplementaryArea
45
27
  } = useDispatch(interfaceStore);
46
28
  const openTemplateSettings = () => enableComplementaryArea(STORE_NAME, SIDEBAR_TEMPLATE);
47
29
  const openBlockSettings = () => enableComplementaryArea(STORE_NAME, SIDEBAR_BLOCK);
48
- let templateAriaLabel;
49
- if (isEditingPage) {
50
- templateAriaLabel = sidebarName === SIDEBAR_TEMPLATE ?
51
- // translators: ARIA label for the Template sidebar tab, selected.
52
- __('Page (selected)') :
53
- // translators: ARIA label for the Template Settings Sidebar tab, not selected.
54
- __('Page');
55
- } else {
56
- templateAriaLabel = sidebarName === SIDEBAR_TEMPLATE ?
57
- // translators: ARIA label for the Template sidebar tab, selected.
58
- sprintf(__('%s (selected)'), entityLabel) :
59
- // translators: ARIA label for the Template Settings Sidebar tab, not selected.
60
- entityLabel;
61
- }
30
+ const documentAriaLabel = sidebarName === SIDEBAR_TEMPLATE ?
31
+ // translators: ARIA label for the Template sidebar tab, selected.
32
+ sprintf(__('%s (selected)'), postTypeLabel) : postTypeLabel;
62
33
 
63
34
  /* Use a list so screen readers will announce how many tabs there are. */
64
35
  return createElement("ul", null, createElement("li", null, createElement(Button, {
@@ -66,9 +37,9 @@ const SettingsHeader = ({
66
37
  className: classnames('edit-site-sidebar-edit-mode__panel-tab', {
67
38
  'is-active': sidebarName === SIDEBAR_TEMPLATE
68
39
  }),
69
- "aria-label": templateAriaLabel,
70
- "data-label": isEditingPage ? __('Page') : entityLabel
71
- }, isEditingPage ? __('Page') : entityLabel)), createElement("li", null, createElement(Button, {
40
+ "aria-label": documentAriaLabel,
41
+ "data-label": postTypeLabel
42
+ }, postTypeLabel)), createElement("li", null, createElement(Button, {
72
43
  onClick: openBlockSettings,
73
44
  className: classnames('edit-site-sidebar-edit-mode__panel-tab', {
74
45
  'is-active': sidebarName === SIDEBAR_BLOCK
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","Button","__","sprintf","useSelect","useDispatch","store","interfaceStore","editorStore","STORE_NAME","SIDEBAR_BLOCK","SIDEBAR_TEMPLATE","editSiteStore","POST_TYPE_LABELS","TEMPLATE_POST_TYPE","SettingsHeader","sidebarName","isEditingPage","entityType","select","getEditedPostType","isPage","getRenderingMode","entityLabel","enableComplementaryArea","openTemplateSettings","openBlockSettings","templateAriaLabel","createElement","onClick","className"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/settings-header/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from '../../../store/constants';\nimport { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from '../constants';\nimport { store as editSiteStore } from '../../../store';\nimport { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../../utils/constants';\n\nconst SettingsHeader = ( { sidebarName } ) => {\n\tconst { isEditingPage, entityType } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, isPage } = select( editSiteStore );\n\t\tconst { getRenderingMode } = select( editorStore );\n\n\t\treturn {\n\t\t\tisEditingPage: isPage() && getRenderingMode() !== 'template-only',\n\t\t\tentityType: getEditedPostType(),\n\t\t};\n\t} );\n\n\tconst entityLabel =\n\t\tPOST_TYPE_LABELS[ entityType ] ||\n\t\tPOST_TYPE_LABELS[ TEMPLATE_POST_TYPE ];\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst openTemplateSettings = () =>\n\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_TEMPLATE );\n\tconst openBlockSettings = () =>\n\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\n\tlet templateAriaLabel;\n\tif ( isEditingPage ) {\n\t\ttemplateAriaLabel =\n\t\t\tsidebarName === SIDEBAR_TEMPLATE\n\t\t\t\t? // translators: ARIA label for the Template sidebar tab, selected.\n\t\t\t\t __( 'Page (selected)' )\n\t\t\t\t: // translators: ARIA label for the Template Settings Sidebar tab, not selected.\n\t\t\t\t __( 'Page' );\n\t} else {\n\t\ttemplateAriaLabel =\n\t\t\tsidebarName === SIDEBAR_TEMPLATE\n\t\t\t\t? // translators: ARIA label for the Template sidebar tab, selected.\n\t\t\t\t sprintf( __( '%s (selected)' ), entityLabel )\n\t\t\t\t: // translators: ARIA label for the Template Settings Sidebar tab, not selected.\n\t\t\t\t entityLabel;\n\t}\n\n\t/* Use a list so screen readers will announce how many tabs there are. */\n\treturn (\n\t\t<ul>\n\t\t\t<li>\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ openTemplateSettings }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'edit-site-sidebar-edit-mode__panel-tab',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-active': sidebarName === SIDEBAR_TEMPLATE,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\taria-label={ templateAriaLabel }\n\t\t\t\t\tdata-label={ isEditingPage ? __( 'Page' ) : entityLabel }\n\t\t\t\t>\n\t\t\t\t\t{ isEditingPage ? __( 'Page' ) : entityLabel }\n\t\t\t\t</Button>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ openBlockSettings }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'edit-site-sidebar-edit-mode__panel-tab',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-active': sidebarName === SIDEBAR_BLOCK,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\taria-label={\n\t\t\t\t\t\tsidebarName === SIDEBAR_BLOCK\n\t\t\t\t\t\t\t? // translators: ARIA label for the Block Settings Sidebar tab, selected.\n\t\t\t\t\t\t\t __( 'Block (selected)' )\n\t\t\t\t\t\t\t: // translators: ARIA label for the Block Settings Sidebar tab, not selected.\n\t\t\t\t\t\t\t __( 'Block' )\n\t\t\t\t\t}\n\t\t\t\t\tdata-label={ __( 'Block' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Block' ) }\n\t\t\t\t</Button>\n\t\t\t</li>\n\t\t</ul>\n\t);\n};\n\nexport default SettingsHeader;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,cAAc,QAAQ,sBAAsB;AAC9D,SAASD,KAAK,IAAIE,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,SAASC,UAAU,QAAQ,0BAA0B;AACrD,SAASC,aAAa,EAAEC,gBAAgB,QAAQ,cAAc;AAC9D,SAASL,KAAK,IAAIM,aAAa,QAAQ,gBAAgB;AACvD,SAASC,gBAAgB,EAAEC,kBAAkB,QAAQ,0BAA0B;AAE/E,MAAMC,cAAc,GAAGA,CAAE;EAAEC;AAAY,CAAC,KAAM;EAC7C,MAAM;IAAEC,aAAa;IAAEC;EAAW,CAAC,GAAGd,SAAS,CAAIe,MAAM,IAAM;IAC9D,MAAM;MAAEC,iBAAiB;MAAEC;IAAO,CAAC,GAAGF,MAAM,CAAEP,aAAc,CAAC;IAC7D,MAAM;MAAEU;IAAiB,CAAC,GAAGH,MAAM,CAAEX,WAAY,CAAC;IAElD,OAAO;MACNS,aAAa,EAAEI,MAAM,CAAC,CAAC,IAAIC,gBAAgB,CAAC,CAAC,KAAK,eAAe;MACjEJ,UAAU,EAAEE,iBAAiB,CAAC;IAC/B,CAAC;EACF,CAAE,CAAC;EAEH,MAAMG,WAAW,GAChBV,gBAAgB,CAAEK,UAAU,CA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D,cAAaA,EAAE,CAAE,OAAQ;EAAG,GAE1BA,EAAE,CAAE,OAAQ,CACP,CACL,CACD,CAAC;AAEP,CAAC;AAED,eAAea,cAAc"}
1
+ {"version":3,"names":["classnames","Button","__","sprintf","useSelect","useDispatch","store","interfaceStore","editorStore","STORE_NAME","SIDEBAR_BLOCK","SIDEBAR_TEMPLATE","SettingsHeader","sidebarName","postTypeLabel","select","getPostTypeLabel","enableComplementaryArea","openTemplateSettings","openBlockSettings","documentAriaLabel","createElement","onClick","className"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/settings-header/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from '../../../store/constants';\nimport { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from '../constants';\n\nconst SettingsHeader = ( { sidebarName } ) => {\n\tconst postTypeLabel = useSelect(\n\t\t( select ) => select( editorStore ).getPostTypeLabel(),\n\t\t[]\n\t);\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst openTemplateSettings = () =>\n\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_TEMPLATE );\n\tconst openBlockSettings = () =>\n\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\n\tconst documentAriaLabel =\n\t\tsidebarName === SIDEBAR_TEMPLATE\n\t\t\t? // translators: ARIA label for the Template sidebar tab, selected.\n\t\t\t sprintf( __( '%s (selected)' ), postTypeLabel )\n\t\t\t: postTypeLabel;\n\n\t/* Use a list so screen readers will announce how many tabs there are. */\n\treturn (\n\t\t<ul>\n\t\t\t<li>\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ openTemplateSettings }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'edit-site-sidebar-edit-mode__panel-tab',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-active': sidebarName === SIDEBAR_TEMPLATE,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\taria-label={ documentAriaLabel }\n\t\t\t\t\tdata-label={ postTypeLabel }\n\t\t\t\t>\n\t\t\t\t\t{ postTypeLabel }\n\t\t\t\t</Button>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ openBlockSettings }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'edit-site-sidebar-edit-mode__panel-tab',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-active': sidebarName === SIDEBAR_BLOCK,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\taria-label={\n\t\t\t\t\t\tsidebarName === SIDEBAR_BLOCK\n\t\t\t\t\t\t\t? // translators: ARIA label for the Block Settings Sidebar tab, selected.\n\t\t\t\t\t\t\t __( 'Block (selected)' )\n\t\t\t\t\t\t\t: // translators: ARIA label for the Block Settings Sidebar tab, not selected.\n\t\t\t\t\t\t\t __( 'Block' )\n\t\t\t\t\t}\n\t\t\t\t\tdata-label={ __( 'Block' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Block' ) }\n\t\t\t\t</Button>\n\t\t\t</li>\n\t\t</ul>\n\t);\n};\n\nexport default SettingsHeader;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,cAAc,QAAQ,sBAAsB;AAC9D,SAASD,KAAK,IAAIE,WAAW,QAAQ,mBAAmB;;AAExD;AAC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,CACL,CACD,CAAC;AAEP,CAAC;AAED,eAAeU,cAAc"}
@@ -23,9 +23,9 @@ export default function WelcomeGuideTemplate() {
23
23
  isPage
24
24
  } = select(editSiteStore);
25
25
  const {
26
- getRenderingMode
26
+ getCurrentPostType
27
27
  } = select(editorStore);
28
- return isTemplateActive && !isEditorActive && isPage() && getRenderingMode() === 'template-only';
28
+ return isTemplateActive && !isEditorActive && isPage() && getCurrentPostType() === 'wp_template';
29
29
  }, []);
30
30
  if (!isVisible) {
31
31
  return null;
@@ -1 +1 @@
1
- {"version":3,"names":["useDispatch","useSelect","Guide","__","store","preferencesStore","editorStore","editSiteStore","WelcomeGuideTemplate","toggle","isVisible","select","isTemplateActive","get","isEditorActive","isPage","getRenderingMode","heading","createElement","className","contentLabel","finishButtonText","onFinish","pages","image","autoPlay","loop","muted","width","height","src","type","content","Fragment"],"sources":["@wordpress/edit-site/src/components/welcome-guide/template.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Guide } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function WelcomeGuideTemplate() {\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst isVisible = useSelect( ( select ) => {\n\t\tconst isTemplateActive = !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\t'welcomeGuideTemplate'\n\t\t);\n\t\tconst isEditorActive = !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\t'welcomeGuide'\n\t\t);\n\t\tconst { isPage } = select( editSiteStore );\n\t\tconst { getRenderingMode } = select( editorStore );\n\t\treturn (\n\t\t\tisTemplateActive &&\n\t\t\t! isEditorActive &&\n\t\t\tisPage() &&\n\t\t\tgetRenderingMode() === 'template-only'\n\t\t);\n\t}, [] );\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\tconst heading = __( 'Editing a template' );\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-site-welcome-guide guide-template\"\n\t\t\tcontentLabel={ heading }\n\t\t\tfinishButtonText={ __( 'Continue' ) }\n\t\t\tonFinish={ () =>\n\t\t\t\ttoggle( 'core/edit-site', 'welcomeGuideTemplate' )\n\t\t\t}\n\t\t\tpages={ [\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<video\n\t\t\t\t\t\t\tclassName=\"edit-site-welcome-guide__video\"\n\t\t\t\t\t\t\tautoPlay\n\t\t\t\t\t\t\tloop\n\t\t\t\t\t\t\tmuted\n\t\t\t\t\t\t\twidth=\"312\"\n\t\t\t\t\t\t\theight=\"240\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<source\n\t\t\t\t\t\t\t\tsrc=\"https://s.w.org/images/block-editor/editing-your-template.mp4\"\n\t\t\t\t\t\t\t\ttype=\"video/mp4\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</video>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ heading }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the ‘Back’ button in the toolbar.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t] }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,KAAK,QAAQ,uBAAuB;AAC7C,SAAS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Q;QACRC,IAAI;QACJC,KAAK;QACLC,KAAK,EAAC,KAAK;QACXC,MAAM,EAAC;MAAK,GAEZX,aAAA;QACCY,GAAG,EAAC,+DAA+D;QACnEC,IAAI,EAAC;MAAW,CAChB,CACK,CACP;MACDC,OAAO,EACNd,aAAA,CAAAe,QAAA,QACCf,aAAA;QAAIC,SAAS,EAAC;MAAkC,GAC7CF,OACC,CAAC,EACLC,aAAA;QAAGC,SAAS,EAAC;MAA+B,GACzChB,EAAE,CACH,4MACD,CACE,CACF;IAEJ,CAAC;EACC,CACH,CAAC;AAEJ"}
1
+ {"version":3,"names":["useDispatch","useSelect","Guide","__","store","preferencesStore","editorStore","editSiteStore","WelcomeGuideTemplate","toggle","isVisible","select","isTemplateActive","get","isEditorActive","isPage","getCurrentPostType","heading","createElement","className","contentLabel","finishButtonText","onFinish","pages","image","autoPlay","loop","muted","width","height","src","type","content","Fragment"],"sources":["@wordpress/edit-site/src/components/welcome-guide/template.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Guide } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function WelcomeGuideTemplate() {\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst isVisible = useSelect( ( select ) => {\n\t\tconst isTemplateActive = !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\t'welcomeGuideTemplate'\n\t\t);\n\t\tconst isEditorActive = !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\t'welcomeGuide'\n\t\t);\n\t\tconst { isPage } = select( editSiteStore );\n\t\tconst { getCurrentPostType } = select( editorStore );\n\t\treturn (\n\t\t\tisTemplateActive &&\n\t\t\t! isEditorActive &&\n\t\t\tisPage() &&\n\t\t\tgetCurrentPostType() === 'wp_template'\n\t\t);\n\t}, [] );\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\tconst heading = __( 'Editing a template' );\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-site-welcome-guide guide-template\"\n\t\t\tcontentLabel={ heading }\n\t\t\tfinishButtonText={ __( 'Continue' ) }\n\t\t\tonFinish={ () =>\n\t\t\t\ttoggle( 'core/edit-site', 'welcomeGuideTemplate' )\n\t\t\t}\n\t\t\tpages={ [\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<video\n\t\t\t\t\t\t\tclassName=\"edit-site-welcome-guide__video\"\n\t\t\t\t\t\t\tautoPlay\n\t\t\t\t\t\t\tloop\n\t\t\t\t\t\t\tmuted\n\t\t\t\t\t\t\twidth=\"312\"\n\t\t\t\t\t\t\theight=\"240\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<source\n\t\t\t\t\t\t\t\tsrc=\"https://s.w.org/images/block-editor/editing-your-template.mp4\"\n\t\t\t\t\t\t\t\ttype=\"video/mp4\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</video>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ heading }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the ‘Back’ button in the toolbar.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t] }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,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SAAS,EAAC,gCAAgC;QAC1CM,QAAQ;QACRC,IAAI;QACJC,KAAK;QACLC,KAAK,EAAC,KAAK;QACXC,MAAM,EAAC;MAAK,GAEZX,aAAA;QACCY,GAAG,EAAC,+DAA+D;QACnEC,IAAI,EAAC;MAAW,CAChB,CACK,CACP;MACDC,OAAO,EACNd,aAAA,CAAAe,QAAA,QACCf,aAAA;QAAIC,SAAS,EAAC;MAAkC,GAC7CF,OACC,CAAC,EACLC,aAAA;QAAGC,SAAS,EAAC;MAA+B,GACzChB,EAAE,CACH,4MACD,CACE,CACF;IAEJ,CAAC;EACC,CACH,CAAC;AAEJ"}
@@ -24,6 +24,7 @@ import { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';
24
24
  import { PATTERN_MODALS } from '../../components/pattern-modal';
25
25
  import { unlock } from '../../lock-unlock';
26
26
  import { TEMPLATE_POST_TYPE } from '../../utils/constants';
27
+ import { useLink } from '../../components/routes/link';
27
28
  const {
28
29
  useHistory
29
30
  } = unlock(routerPrivateApis);
@@ -34,21 +35,30 @@ function usePageContentFocusCommands() {
34
35
  const {
35
36
  isPage,
36
37
  canvasMode,
37
- renderingMode
38
+ templateId,
39
+ currentPostType
38
40
  } = useSelect(select => {
39
41
  const {
40
42
  isPage: _isPage,
41
43
  getCanvasMode
42
44
  } = unlock(select(editSiteStore));
43
45
  const {
44
- getRenderingMode
46
+ getCurrentPostType,
47
+ getCurrentTemplateId
45
48
  } = select(editorStore);
46
49
  return {
47
50
  isPage: _isPage(),
48
51
  canvasMode: getCanvasMode(),
49
- renderingMode: getRenderingMode()
52
+ templateId: getCurrentTemplateId(),
53
+ currentPostType: getCurrentPostType()
50
54
  };
51
55
  }, []);
56
+ const {
57
+ onClick: editTemplate
58
+ } = useLink({
59
+ postType: 'wp_template',
60
+ postId: templateId
61
+ });
52
62
  const {
53
63
  setRenderingMode
54
64
  } = useDispatch(editorStore);
@@ -59,7 +69,7 @@ function usePageContentFocusCommands() {
59
69
  };
60
70
  }
61
71
  const commands = [];
62
- if (renderingMode !== 'template-only') {
72
+ if (currentPostType !== 'wp_template') {
63
73
  commands.push({
64
74
  name: 'core/switch-to-template-focus',
65
75
  /* translators: %1$s: template title */
@@ -68,7 +78,7 @@ function usePageContentFocusCommands() {
68
78
  callback: ({
69
79
  close
70
80
  }) => {
71
- setRenderingMode('template-only');
81
+ editTemplate();
72
82
  close();
73
83
  }
74
84
  });
@@ -136,7 +146,7 @@ function useManipulateDocumentCommands() {
136
146
  revertTemplate
137
147
  } = useDispatch(editSiteStore);
138
148
  const history = useHistory();
139
- const isEditingPage = useSelect(select => select(editSiteStore).isPage() && select(editorStore).getRenderingMode() !== 'template-only', []);
149
+ const isEditingPage = useSelect(select => select(editSiteStore).isPage() && select(editorStore).getCurrentPostType() !== 'wp_template', []);
140
150
  if (!isLoaded) {
141
151
  return {
142
152
  isLoading: true,
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","__","sprintf","isRTL","edit","trash","rotateLeft","rotateRight","layout","page","drawerLeft","drawerRight","blockDefault","code","keyboard","listView","symbol","useCommandLoader","decodeEntities","privateApis","routerPrivateApis","store","preferencesStore","interfaceStore","noticesStore","editorStore","editSiteStore","useEditedEntityRecord","isTemplateRemovable","isTemplateRevertable","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","PREFERENCES_MODAL_NAME","PATTERN_MODALS","unlock","TEMPLATE_POST_TYPE","useHistory","usePageContentFocusCommands","record","template","isPage","canvasMode","renderingMode","select","_isPage","getCanvasMode","getRenderingMode","setRenderingMode","isLoading","commands","push","name","label","title","icon","callback","close","useEditorModeCommands","switchEditorMode","editorMode","getEditorMode","useManipulateDocumentCommands","isLoaded","removeTemplate","revertTemplate","history","isEditingPage","type","path","useEditUICommands","openGeneralSidebar","closeGeneralSidebar","toggleDistractionFree","setIsListViewOpened","activeSidebar","showBlockBreadcrumbs","isListViewOpen","isDistractionFree","isTopToolbar","isFocusMode","get","isListViewOpened","getActiveComplementaryArea","openModal","toggle","createInfoNotice","id","actions","onClick","usePatternCommands","pattern","rename","duplicate","useEditModeCommands","hook","context"],"sources":["@wordpress/edit-site/src/hooks/commands/use-edit-mode-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, sprintf, isRTL } from '@wordpress/i18n';\nimport {\n\tedit,\n\ttrash,\n\trotateLeft,\n\trotateRight,\n\tlayout,\n\tpage,\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tcode,\n\tkeyboard,\n\tlistView,\n\tsymbol,\n} from '@wordpress/icons';\nimport { useCommandLoader } from '@wordpress/commands';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport useEditedEntityRecord from '../../components/use-edited-entity-record';\nimport isTemplateRemovable from '../../utils/is-template-removable';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { PATTERN_MODALS } from '../../components/pattern-modal';\nimport { unlock } from '../../lock-unlock';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction usePageContentFocusCommands() {\n\tconst { record: template } = useEditedEntityRecord();\n\tconst { isPage, canvasMode, renderingMode } = useSelect( ( select ) => {\n\t\tconst { isPage: _isPage, getCanvasMode } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst { getRenderingMode } = select( editorStore );\n\t\treturn {\n\t\t\tisPage: _isPage(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\trenderingMode: getRenderingMode(),\n\t\t};\n\t}, [] );\n\tconst { setRenderingMode } = useDispatch( editorStore );\n\n\tif ( ! isPage || canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( renderingMode !== 'template-only' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-template-focus',\n\t\t\t/* translators: %1$s: template title */\n\t\t\tlabel: sprintf(\n\t\t\t\t'Edit template: %s',\n\t\t\t\tdecodeEntities( template.title )\n\t\t\t),\n\t\t\ticon: layout,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetRenderingMode( 'template-only' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t} else {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-page-focus',\n\t\t\tlabel: __( 'Back to page' ),\n\t\t\ticon: page,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetRenderingMode( 'template-locked' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nfunction useEditorModeCommands() {\n\tconst { switchEditorMode } = useDispatch( editSiteStore );\n\tconst { canvasMode, editorMode } = useSelect(\n\t\t( select ) => ( {\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\teditorMode: select( editSiteStore ).getEditorMode(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tif ( canvasMode !== 'edit' || editorMode !== 'text' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( editorMode === 'text' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/exit-code-editor',\n\t\t\tlabel: __( 'Exit code editor' ),\n\t\t\ticon: code,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tswitchEditorMode( 'visual' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nfunction useManipulateDocumentCommands() {\n\tconst { isLoaded, record: template } = useEditedEntityRecord();\n\tconst { removeTemplate, revertTemplate } = useDispatch( editSiteStore );\n\tconst history = useHistory();\n\tconst isEditingPage = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editSiteStore ).isPage() &&\n\t\t\tselect( editorStore ).getRenderingMode() !== 'template-only',\n\t\t[]\n\t);\n\n\tif ( ! isLoaded ) {\n\t\treturn { isLoading: true, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( isTemplateRevertable( template ) && ! isEditingPage ) {\n\t\tconst label =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? /* translators: %1$s: template title */\n\t\t\t\t sprintf(\n\t\t\t\t\t\t'Reset template: %s',\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t )\n\t\t\t\t: /* translators: %1$s: template part title */\n\t\t\t\t sprintf(\n\t\t\t\t\t\t'Reset template part: %s',\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t );\n\t\tcommands.push( {\n\t\t\tname: 'core/reset-template',\n\t\t\tlabel,\n\t\t\ticon: isRTL() ? rotateRight : rotateLeft,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\trevertTemplate( template );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\tif ( isTemplateRemovable( template ) && ! isEditingPage ) {\n\t\tconst label =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? /* translators: %1$s: template title */\n\t\t\t\t sprintf(\n\t\t\t\t\t\t'Delete template: %s',\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t )\n\t\t\t\t: /* translators: %1$s: template part title */\n\t\t\t\t sprintf(\n\t\t\t\t\t\t'Delete template part: %s',\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t );\n\t\tconst path =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? '/wp_template'\n\t\t\t\t: '/wp_template_part/all';\n\t\tcommands.push( {\n\t\t\tname: 'core/remove-template',\n\t\t\tlabel,\n\t\t\ticon: trash,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tremoveTemplate( template );\n\t\t\t\t// Navigate to the template list\n\t\t\t\thistory.push( {\n\t\t\t\t\tpath,\n\t\t\t\t} );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn {\n\t\tisLoading: ! isLoaded,\n\t\tcommands,\n\t};\n}\n\nfunction useEditUICommands() {\n\tconst {\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\ttoggleDistractionFree,\n\t\tsetIsListViewOpened,\n\t\tswitchEditorMode,\n\t} = useDispatch( editSiteStore );\n\tconst {\n\t\tcanvasMode,\n\t\teditorMode,\n\t\tactiveSidebar,\n\t\tshowBlockBreadcrumbs,\n\t\tisListViewOpen,\n\t\tisDistractionFree,\n\t\tisTopToolbar,\n\t\tisFocusMode,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getEditorMode } = select( editSiteStore );\n\t\tconst { isListViewOpened } = select( editorStore );\n\t\treturn {\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\teditorMode: getEditorMode(),\n\t\t\tactiveSidebar: select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tisFocusMode: get( 'core', 'focusMode' ),\n\t\t\tisTopToolbar: get( 'core', 'fixedToolbar' ),\n\t\t};\n\t}, [] );\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\n\tif ( canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tcommands.push( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-site/template' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-site/template' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-site/block-inspector' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-site/block-inspector' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-spotlight-mode',\n\t\tlabel: __( 'Toggle spotlight' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'focusMode' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisFocusMode ? __( 'Spotlight off.' ) : __( 'Spotlight on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-site/toggle-spotlight-mode/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core', 'focusMode' );\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}\n\t\t\t);\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-distraction-free',\n\t\tlabel: isDistractionFree\n\t\t\t? __( 'Exit Distraction Free' )\n\t\t\t: __( 'Enter Distraction Free ' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggleDistractionFree();\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-top-toolbar',\n\t\tlabel: __( 'Toggle top toolbar' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'fixedToolbar' );\n\t\t\tif ( isDistractionFree ) {\n\t\t\t\ttoggleDistractionFree();\n\t\t\t}\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisTopToolbar\n\t\t\t\t\t? __( 'Top toolbar off.' )\n\t\t\t\t\t: __( 'Top toolbar on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-site/toggle-top-toolbar/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core', 'fixedToolbar' );\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}\n\t\t\t);\n\t\t},\n\t} );\n\n\tif ( editorMode === 'visual' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-code-editor',\n\t\t\tlabel: __( 'Open code editor' ),\n\t\t\ticon: code,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tswitchEditorMode( 'text' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\tcommands.push( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Editor preferences' ),\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Keyboard shortcuts' ),\n\t\ticon: keyboard,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-breadcrumbs',\n\t\tlabel: showBlockBreadcrumbs\n\t\t\t? __( 'Hide block breadcrumbs' )\n\t\t\t: __( 'Show block breadcrumbs' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'showBlockBreadcrumbs' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tshowBlockBreadcrumbs\n\t\t\t\t\t? __( 'Breadcrumbs hidden.' )\n\t\t\t\t\t: __( 'Breadcrumbs visible.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-site/toggle-breadcrumbs/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-list-view',\n\t\tlabel: isListViewOpen\n\t\t\t? __( 'Close List View' )\n\t\t\t: __( 'Open List View' ),\n\t\ticon: listView,\n\t\tcallback: ( { close } ) => {\n\t\t\tsetIsListViewOpened( ! isListViewOpen );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisListViewOpen ? __( 'List View off.' ) : __( 'List View on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-site/toggle-list-view/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\treturn {\n\t\tisLoading: false,\n\t\tcommands,\n\t};\n}\n\nfunction usePatternCommands() {\n\tconst { isLoaded, record: pattern } = useEditedEntityRecord();\n\tconst { openModal } = useDispatch( interfaceStore );\n\n\tif ( ! isLoaded ) {\n\t\treturn { isLoading: true, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( pattern?.type === 'wp_block' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/rename-pattern',\n\t\t\tlabel: __( 'Rename pattern' ),\n\t\t\ticon: edit,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\topenModal( PATTERN_MODALS.rename );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t\tcommands.push( {\n\t\t\tname: 'core/duplicate-pattern',\n\t\t\tlabel: __( 'Duplicate pattern' ),\n\t\t\ticon: symbol,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\topenModal( PATTERN_MODALS.duplicate );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nexport function useEditModeCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/exit-code-editor',\n\t\thook: useEditorModeCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/page-content-focus',\n\t\thook: usePageContentFocusCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/manipulate-document',\n\t\thook: useManipulateDocumentCommands,\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/patterns',\n\t\thook: usePatternCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/edit-ui',\n\t\thook: useEditUICommands,\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,OAAO,EAAEC,KAAK,QAAQ,iBAAiB;AACpD,SACCC,IAAI,EACJC,KAAK,EACLC,UAAU,EACVC,WAAW,EACXC,MAAM,EACNC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,YAAY,EACZC,IAAI,EACJC,QAAQ,EACRC,QAAQ,EACRC,MAAM,QACA,kBAAkB;AACzB,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;AAClE,SAASD,KAAK,IAAIE,cAAc,QAAQ,sBAAsB;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,CAAE,CAAC;IACHP,QAAQ,CAACC,IAAI,CAAE;MACdC,IAAI,EAAE,wBAAwB;MAC9BC,KAAK,EAAElD,EAAE,CAAE,mBAAoB,CAAC;MAChCoD,IAAI,EAAErC,MAAM;MACZsC,QAAQ,EAAEA,CAAE;QAAEC;MAAM,CAAC,KAAM;QAC1B2B,SAAS,CAAElD,cAAc,CAAC2D,SAAU,CAAC;QACrCpC,KAAK,CAAC,CAAC;MACR;IACD,CAAE,CAAC;EACJ;EAEA,OAAO;IAAER,SAAS,EAAE,KAAK;IAAEC;EAAS,CAAC;AACtC;AAEA,OAAO,SAAS4C,mBAAmBA,CAAA,EAAG;EACrC3E,gBAAgB,CAAE;IACjBiC,IAAI,EAAE,uBAAuB;IAC7B2C,IAAI,EAAErC,qBAAqB;IAC3BsC,OAAO,EAAE;EACV,CAAE,CAAC;EAEH7E,gBAAgB,CAAE;IACjBiC,IAAI,EAAE,mCAAmC;IACzC2C,IAAI,EAAEzD,2BAA2B;IACjC0D,OAAO,EAAE;EACV,CAAE,CAAC;EAEH7E,gBAAgB,CAAE;IACjBiC,IAAI,EAAE,oCAAoC;IAC1C2C,IAAI,EAAEjC;EACP,CAAE,CAAC;EAEH3C,gBAAgB,CAAE;IACjBiC,IAAI,EAAE,yBAAyB;IAC/B2C,IAAI,EAAEL,kBAAkB;IACxBM,OAAO,EAAE;EACV,CAAE,CAAC;EAEH7E,gBAAgB,CAAE;IACjBiC,IAAI,EAAE,wBAAwB;IAC9B2C,IAAI,EAAEzB;EACP,CAAE,CAAC;AACJ"}
1
+ {"version":3,"names":["useSelect","useDispatch","__","sprintf","isRTL","edit","trash","rotateLeft","rotateRight","layout","page","drawerLeft","drawerRight","blockDefault","code","keyboard","listView","symbol","useCommandLoader","decodeEntities","privateApis","routerPrivateApis","store","preferencesStore","interfaceStore","noticesStore","editorStore","editSiteStore","useEditedEntityRecord","isTemplateRemovable","isTemplateRevertable","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","PREFERENCES_MODAL_NAME","PATTERN_MODALS","unlock","TEMPLATE_POST_TYPE","useLink","useHistory","usePageContentFocusCommands","record","template","isPage","canvasMode","templateId","currentPostType","select","_isPage","getCanvasMode","getCurrentPostType","getCurrentTemplateId","onClick","editTemplate","postType","postId","setRenderingMode","isLoading","commands","push","name","label","title","icon","callback","close","useEditorModeCommands","switchEditorMode","editorMode","getEditorMode","useManipulateDocumentCommands","isLoaded","removeTemplate","revertTemplate","history","isEditingPage","type","path","useEditUICommands","openGeneralSidebar","closeGeneralSidebar","toggleDistractionFree","setIsListViewOpened","activeSidebar","showBlockBreadcrumbs","isListViewOpen","isDistractionFree","isTopToolbar","isFocusMode","get","isListViewOpened","getActiveComplementaryArea","openModal","toggle","createInfoNotice","id","actions","usePatternCommands","pattern","rename","duplicate","useEditModeCommands","hook","context"],"sources":["@wordpress/edit-site/src/hooks/commands/use-edit-mode-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, sprintf, isRTL } from '@wordpress/i18n';\nimport {\n\tedit,\n\ttrash,\n\trotateLeft,\n\trotateRight,\n\tlayout,\n\tpage,\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tcode,\n\tkeyboard,\n\tlistView,\n\tsymbol,\n} from '@wordpress/icons';\nimport { useCommandLoader } from '@wordpress/commands';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport useEditedEntityRecord from '../../components/use-edited-entity-record';\nimport isTemplateRemovable from '../../utils/is-template-removable';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { PATTERN_MODALS } from '../../components/pattern-modal';\nimport { unlock } from '../../lock-unlock';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport { useLink } from '../../components/routes/link';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction usePageContentFocusCommands() {\n\tconst { record: template } = useEditedEntityRecord();\n\tconst { isPage, canvasMode, templateId, currentPostType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isPage: _isPage, getCanvasMode } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\tconst { getCurrentPostType, getCurrentTemplateId } =\n\t\t\t\tselect( editorStore );\n\t\t\treturn {\n\t\t\t\tisPage: _isPage(),\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t\t\tcurrentPostType: getCurrentPostType(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { onClick: editTemplate } = useLink( {\n\t\tpostType: 'wp_template',\n\t\tpostId: templateId,\n\t} );\n\n\tconst { setRenderingMode } = useDispatch( editorStore );\n\n\tif ( ! isPage || canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( currentPostType !== 'wp_template' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-template-focus',\n\t\t\t/* translators: %1$s: template title */\n\t\t\tlabel: sprintf(\n\t\t\t\t'Edit template: %s',\n\t\t\t\tdecodeEntities( template.title )\n\t\t\t),\n\t\t\ticon: layout,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\teditTemplate();\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t} else {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-page-focus',\n\t\t\tlabel: __( 'Back to page' ),\n\t\t\ticon: page,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetRenderingMode( 'template-locked' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nfunction useEditorModeCommands() {\n\tconst { switchEditorMode } = useDispatch( editSiteStore );\n\tconst { canvasMode, editorMode } = useSelect(\n\t\t( select ) => ( {\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\teditorMode: select( editSiteStore ).getEditorMode(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tif ( canvasMode !== 'edit' || editorMode !== 'text' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( editorMode === 'text' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/exit-code-editor',\n\t\t\tlabel: __( 'Exit code editor' ),\n\t\t\ticon: code,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tswitchEditorMode( 'visual' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nfunction useManipulateDocumentCommands() {\n\tconst { isLoaded, record: template } = useEditedEntityRecord();\n\tconst { removeTemplate, revertTemplate } = useDispatch( editSiteStore );\n\tconst history = useHistory();\n\tconst isEditingPage = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editSiteStore ).isPage() &&\n\t\t\tselect( editorStore ).getCurrentPostType() !== 'wp_template',\n\t\t[]\n\t);\n\n\tif ( ! isLoaded ) {\n\t\treturn { isLoading: true, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( isTemplateRevertable( template ) && ! isEditingPage ) {\n\t\tconst label =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? /* translators: %1$s: template title */\n\t\t\t\t sprintf(\n\t\t\t\t\t\t'Reset template: %s',\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t )\n\t\t\t\t: /* translators: %1$s: template part title */\n\t\t\t\t sprintf(\n\t\t\t\t\t\t'Reset template part: %s',\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t );\n\t\tcommands.push( {\n\t\t\tname: 'core/reset-template',\n\t\t\tlabel,\n\t\t\ticon: isRTL() ? rotateRight : rotateLeft,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\trevertTemplate( template );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\tif ( isTemplateRemovable( template ) && ! isEditingPage ) {\n\t\tconst label =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? /* translators: %1$s: template title */\n\t\t\t\t sprintf(\n\t\t\t\t\t\t'Delete template: %s',\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t )\n\t\t\t\t: /* translators: %1$s: template part title */\n\t\t\t\t sprintf(\n\t\t\t\t\t\t'Delete template part: %s',\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t );\n\t\tconst path =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? '/wp_template'\n\t\t\t\t: '/wp_template_part/all';\n\t\tcommands.push( {\n\t\t\tname: 'core/remove-template',\n\t\t\tlabel,\n\t\t\ticon: trash,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tremoveTemplate( template );\n\t\t\t\t// Navigate to the template list\n\t\t\t\thistory.push( {\n\t\t\t\t\tpath,\n\t\t\t\t} );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn {\n\t\tisLoading: ! isLoaded,\n\t\tcommands,\n\t};\n}\n\nfunction useEditUICommands() {\n\tconst {\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\ttoggleDistractionFree,\n\t\tsetIsListViewOpened,\n\t\tswitchEditorMode,\n\t} = useDispatch( editSiteStore );\n\tconst {\n\t\tcanvasMode,\n\t\teditorMode,\n\t\tactiveSidebar,\n\t\tshowBlockBreadcrumbs,\n\t\tisListViewOpen,\n\t\tisDistractionFree,\n\t\tisTopToolbar,\n\t\tisFocusMode,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getEditorMode } = select( editSiteStore );\n\t\tconst { isListViewOpened } = select( editorStore );\n\t\treturn {\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\teditorMode: getEditorMode(),\n\t\t\tactiveSidebar: select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tisFocusMode: get( 'core', 'focusMode' ),\n\t\t\tisTopToolbar: get( 'core', 'fixedToolbar' ),\n\t\t};\n\t}, [] );\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\n\tif ( canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tcommands.push( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-site/template' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-site/template' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-site/block-inspector' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-site/block-inspector' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-spotlight-mode',\n\t\tlabel: __( 'Toggle spotlight' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'focusMode' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisFocusMode ? __( 'Spotlight off.' ) : __( 'Spotlight on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-site/toggle-spotlight-mode/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core', 'focusMode' );\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}\n\t\t\t);\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-distraction-free',\n\t\tlabel: isDistractionFree\n\t\t\t? __( 'Exit Distraction Free' )\n\t\t\t: __( 'Enter Distraction Free ' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggleDistractionFree();\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-top-toolbar',\n\t\tlabel: __( 'Toggle top toolbar' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'fixedToolbar' );\n\t\t\tif ( isDistractionFree ) {\n\t\t\t\ttoggleDistractionFree();\n\t\t\t}\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisTopToolbar\n\t\t\t\t\t? __( 'Top toolbar off.' )\n\t\t\t\t\t: __( 'Top toolbar on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-site/toggle-top-toolbar/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core', 'fixedToolbar' );\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}\n\t\t\t);\n\t\t},\n\t} );\n\n\tif ( editorMode === 'visual' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-code-editor',\n\t\t\tlabel: __( 'Open code editor' ),\n\t\t\ticon: code,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tswitchEditorMode( 'text' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\tcommands.push( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Editor preferences' ),\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Keyboard shortcuts' ),\n\t\ticon: keyboard,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-breadcrumbs',\n\t\tlabel: showBlockBreadcrumbs\n\t\t\t? __( 'Hide block breadcrumbs' )\n\t\t\t: __( 'Show block breadcrumbs' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'showBlockBreadcrumbs' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tshowBlockBreadcrumbs\n\t\t\t\t\t? __( 'Breadcrumbs hidden.' )\n\t\t\t\t\t: __( 'Breadcrumbs visible.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-site/toggle-breadcrumbs/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-list-view',\n\t\tlabel: isListViewOpen\n\t\t\t? __( 'Close List View' )\n\t\t\t: __( 'Open List View' ),\n\t\ticon: listView,\n\t\tcallback: ( { close } ) => {\n\t\t\tsetIsListViewOpened( ! isListViewOpen );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisListViewOpen ? __( 'List View off.' ) : __( 'List View on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-site/toggle-list-view/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\treturn {\n\t\tisLoading: false,\n\t\tcommands,\n\t};\n}\n\nfunction usePatternCommands() {\n\tconst { isLoaded, record: pattern } = useEditedEntityRecord();\n\tconst { openModal } = useDispatch( interfaceStore );\n\n\tif ( ! isLoaded ) {\n\t\treturn { isLoading: true, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( pattern?.type === 'wp_block' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/rename-pattern',\n\t\t\tlabel: __( 'Rename pattern' ),\n\t\t\ticon: edit,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\topenModal( PATTERN_MODALS.rename );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t\tcommands.push( {\n\t\t\tname: 'core/duplicate-pattern',\n\t\t\tlabel: __( 'Duplicate pattern' ),\n\t\t\ticon: symbol,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\topenModal( PATTERN_MODALS.duplicate );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nexport function useEditModeCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/exit-code-editor',\n\t\thook: useEditorModeCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/page-content-focus',\n\t\thook: usePageContentFocusCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/manipulate-document',\n\t\thook: useManipulateDocumentCommands,\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/patterns',\n\t\thook: usePatternCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/edit-ui',\n\t\thook: useEditUICommands,\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,OAAO,EAAEC,KAAK,QAAQ,iBAAiB;AACpD,SACCC,IAAI,EACJC,KAAK,EACLC,UAAU,EACVC,WAAW,EACXC,MAAM,EACNC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,YAAY,EACZC,IAAI,EACJC,QAAQ,EACRC,QAAQ,EACRC,MAAM,QACA,kBAAkB;AACzB,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;AAClE,SAASD,KAAK,IAAIE,cAAc,QAAQ,sBAAsB;AAC9D,SAASF,KAAK,IAAIG,YAAY,QAAQ,oBAAoB;AAC1D,SAASH,KAAK,IAAII,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,SAASJ,KAAK,IAAIK,aAAa,QAAQ,aAAa;AACpD,OAAOC,qBAAqB,MAAM,2CAA2C;AAC7E,OAAOC,mBAAmB,MAAM,mCAAmC;AACnE,OAAOC,oBAAoB,MAAM,oCAAoC;AACrE,SAASC,iCAAiC,QAAQ,+CAA+C;AACjG,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SAASC,cAAc,QAAQ,gCAAgC;AAC/D,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SAASC,OAAO,QAAQ,8BAA8B;AAEtD,MAAM;EAAEC;AAAW,CAAC,GAAGH,MAAM,CAAEb,iBAAkB,CAAC;AAElD,SAASiB,2BAA2BA,CAAA,EAA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AAE,KAAK;IAAEC;EAAS,CAAC;AACtC;AAEA,OAAO,SAAS2C,mBAAmBA,CAAA,EAAG;EACrCjF,gBAAgB,CAAE;IACjBwC,IAAI,EAAE,uBAAuB;IAC7B0C,IAAI,EAAEpC,qBAAqB;IAC3BqC,OAAO,EAAE;EACV,CAAE,CAAC;EAEHnF,gBAAgB,CAAE;IACjBwC,IAAI,EAAE,mCAAmC;IACzC0C,IAAI,EAAE9D,2BAA2B;IACjC+D,OAAO,EAAE;EACV,CAAE,CAAC;EAEHnF,gBAAgB,CAAE;IACjBwC,IAAI,EAAE,oCAAoC;IAC1C0C,IAAI,EAAEhC;EACP,CAAE,CAAC;EAEHlD,gBAAgB,CAAE;IACjBwC,IAAI,EAAE,yBAAyB;IAC/B0C,IAAI,EAAEL,kBAAkB;IACxBM,OAAO,EAAE;EACV,CAAE,CAAC;EAEHnF,gBAAgB,CAAE;IACjBwC,IAAI,EAAE,wBAAwB;IAC9B0C,IAAI,EAAExB;EACP,CAAE,CAAC;AACJ"}
@@ -660,6 +660,9 @@ body.is-fullscreen-mode .interface-interface-skeleton {
660
660
  display: flex;
661
661
  align-items: center;
662
662
  }
663
+ .dataviews-view-table tbody .dataviews-view-table__cell-content-wrapper > * {
664
+ flex-grow: 1;
665
+ }
663
666
  .dataviews-view-table .dataviews-view-table-header-button {
664
667
  padding: 4px 8px;
665
668
  font-size: 11px;
@@ -726,6 +729,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
726
729
  .dataviews-view-grid {
727
730
  margin-bottom: 24px;
728
731
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
732
+ grid-template-rows: max-content;
729
733
  padding: 0 32px;
730
734
  }
731
735
  @media (min-width: 1080px) {
@@ -4106,9 +4110,6 @@ body:has(.edit-site-resizable-frame__inner.is-resizing) {
4106
4110
  font-size: 11px;
4107
4111
  }
4108
4112
 
4109
- .font-library-modal__tabpanel-layout .font-library-modal__tabpanel-layout__main {
4110
- padding-bottom: 64px;
4111
- }
4112
4113
  .font-library-modal__tabpanel-layout .font-library-modal__tabpanel-layout__footer {
4113
4114
  border-top: 1px solid #ddd;
4114
4115
  margin: 0 -32px -32px;
@@ -4180,9 +4181,6 @@ button.font-library-modal__upload-area {
4180
4181
  .font-library-modal__local-fonts .font-library-modal__upload-area__text {
4181
4182
  color: #757575;
4182
4183
  }
4183
- .font-library-modal__local-fonts .font-library-modal__upload-area__notice {
4184
- margin: 0;
4185
- }
4186
4184
 
4187
4185
  .font-library-modal__font-variant_demo-wrapper {
4188
4186
  white-space: nowrap;
@@ -660,6 +660,9 @@ body.is-fullscreen-mode .interface-interface-skeleton {
660
660
  display: flex;
661
661
  align-items: center;
662
662
  }
663
+ .dataviews-view-table tbody .dataviews-view-table__cell-content-wrapper > * {
664
+ flex-grow: 1;
665
+ }
663
666
  .dataviews-view-table .dataviews-view-table-header-button {
664
667
  padding: 4px 8px;
665
668
  font-size: 11px;
@@ -726,6 +729,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
726
729
  .dataviews-view-grid {
727
730
  margin-bottom: 24px;
728
731
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
732
+ grid-template-rows: max-content;
729
733
  padding: 0 32px;
730
734
  }
731
735
  @media (min-width: 1080px) {
@@ -4107,9 +4111,6 @@ body:has(.edit-site-resizable-frame__inner.is-resizing) {
4107
4111
  font-size: 11px;
4108
4112
  }
4109
4113
 
4110
- .font-library-modal__tabpanel-layout .font-library-modal__tabpanel-layout__main {
4111
- padding-bottom: 64px;
4112
- }
4113
4114
  .font-library-modal__tabpanel-layout .font-library-modal__tabpanel-layout__footer {
4114
4115
  border-top: 1px solid #ddd;
4115
4116
  margin: 0 -32px -32px;
@@ -4181,9 +4182,6 @@ button.font-library-modal__upload-area {
4181
4182
  .font-library-modal__local-fonts .font-library-modal__upload-area__text {
4182
4183
  color: #757575;
4183
4184
  }
4184
- .font-library-modal__local-fonts .font-library-modal__upload-area__notice {
4185
- margin: 0;
4186
- }
4187
4185
 
4188
4186
  .font-library-modal__font-variant_demo-wrapper {
4189
4187
  white-space: nowrap;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "5.27.1",
3
+ "version": "5.27.2",
4
4
  "description": "Edit Site Page module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -30,20 +30,20 @@
30
30
  "@wordpress/a11y": "^3.50.0",
31
31
  "@wordpress/api-fetch": "^6.47.0",
32
32
  "@wordpress/blob": "^3.50.0",
33
- "@wordpress/block-editor": "^12.18.1",
34
- "@wordpress/block-library": "^8.27.1",
33
+ "@wordpress/block-editor": "^12.18.2",
34
+ "@wordpress/block-library": "^8.27.2",
35
35
  "@wordpress/blocks": "^12.27.1",
36
36
  "@wordpress/commands": "^0.21.0",
37
37
  "@wordpress/components": "^25.16.0",
38
38
  "@wordpress/compose": "^6.27.0",
39
- "@wordpress/core-commands": "^0.19.1",
40
- "@wordpress/core-data": "^6.27.1",
39
+ "@wordpress/core-commands": "^0.19.2",
40
+ "@wordpress/core-data": "^6.27.2",
41
41
  "@wordpress/data": "^9.20.0",
42
- "@wordpress/dataviews": "^0.4.0",
42
+ "@wordpress/dataviews": "^0.4.1",
43
43
  "@wordpress/date": "^4.50.0",
44
44
  "@wordpress/deprecated": "^3.50.0",
45
45
  "@wordpress/dom": "^3.50.0",
46
- "@wordpress/editor": "^13.27.1",
46
+ "@wordpress/editor": "^13.27.2",
47
47
  "@wordpress/element": "^5.27.0",
48
48
  "@wordpress/escape-html": "^2.50.0",
49
49
  "@wordpress/hooks": "^3.50.0",
@@ -55,17 +55,17 @@
55
55
  "@wordpress/keycodes": "^3.50.0",
56
56
  "@wordpress/media-utils": "^4.41.0",
57
57
  "@wordpress/notices": "^4.18.0",
58
- "@wordpress/patterns": "^1.11.1",
58
+ "@wordpress/patterns": "^1.11.2",
59
59
  "@wordpress/plugins": "^6.18.0",
60
60
  "@wordpress/preferences": "^3.27.0",
61
61
  "@wordpress/primitives": "^3.48.0",
62
62
  "@wordpress/private-apis": "^0.32.0",
63
- "@wordpress/reusable-blocks": "^4.27.1",
63
+ "@wordpress/reusable-blocks": "^4.27.2",
64
64
  "@wordpress/router": "^0.19.0",
65
65
  "@wordpress/style-engine": "^1.33.1",
66
66
  "@wordpress/url": "^3.51.0",
67
67
  "@wordpress/viewport": "^5.27.0",
68
- "@wordpress/widgets": "^3.27.1",
68
+ "@wordpress/widgets": "^3.27.2",
69
69
  "@wordpress/wordcount": "^3.50.0",
70
70
  "change-case": "^4.1.2",
71
71
  "classnames": "^2.3.1",
@@ -85,5 +85,5 @@
85
85
  "publishConfig": {
86
86
  "access": "public"
87
87
  },
88
- "gitHead": "c2f6d07ffab7d68b9ac3c423ce7e11af91f6e45e"
88
+ "gitHead": "fefb6f718fbfd5df9390f366d5733369f613084a"
89
89
  }
@@ -24,11 +24,14 @@ function BackButton() {
24
24
  const isTemplatePart = location.params.postType === TEMPLATE_PART_POST_TYPE;
25
25
  const isNavigationMenu = location.params.postType === NAVIGATION_POST_TYPE;
26
26
  const isPattern = location.params.postType === PATTERN_TYPES.user;
27
- const previousTemplateId = location.state?.fromTemplateId;
28
27
 
29
- const isFocusMode = isTemplatePart || isNavigationMenu || isPattern;
28
+ const isFocusMode =
29
+ location.params.focusMode ||
30
+ isTemplatePart ||
31
+ isNavigationMenu ||
32
+ isPattern;
30
33
 
31
- if ( ! isFocusMode || ( ! previousTemplateId && ! isPattern ) ) {
34
+ if ( ! isFocusMode ) {
32
35
  return null;
33
36
  }
34
37
 
@@ -22,22 +22,29 @@ import {
22
22
  NAVIGATION_POST_TYPE,
23
23
  } from '../../utils/constants';
24
24
  import { unlock } from '../../lock-unlock';
25
+ import { privateApis as routerPrivateApis } from '@wordpress/router';
25
26
 
26
- export default function SiteEditorCanvas() {
27
- const { templateType, isFocusMode, isViewMode } = useSelect( ( select ) => {
28
- const { getEditedPostType, getCanvasMode } = unlock(
29
- select( editSiteStore )
30
- );
27
+ const { useLocation } = unlock( routerPrivateApis );
31
28
 
32
- const _templateType = getEditedPostType();
29
+ export default function SiteEditorCanvas() {
30
+ const location = useLocation();
31
+ const { templateType, isFocusableEntity, isViewMode } = useSelect(
32
+ ( select ) => {
33
+ const { getEditedPostType, getCanvasMode } = unlock(
34
+ select( editSiteStore )
35
+ );
33
36
 
34
- return {
35
- templateType: _templateType,
36
- isFocusMode: FOCUSABLE_ENTITIES.includes( _templateType ),
37
- isViewMode: getCanvasMode() === 'view',
38
- };
39
- }, [] );
37
+ const _templateType = getEditedPostType();
40
38
 
39
+ return {
40
+ templateType: _templateType,
41
+ isFocusableEntity: FOCUSABLE_ENTITIES.includes( _templateType ),
42
+ isViewMode: getCanvasMode() === 'view',
43
+ };
44
+ },
45
+ []
46
+ );
47
+ const isFocusMode = location.params.focusMode || isFocusableEntity;
41
48
  const [ resizeObserver, sizes ] = useResizeObserver();
42
49
 
43
50
  const settings = useSiteEditorSettings();
@@ -15,6 +15,10 @@ export function usePostLinkProps() {
15
15
  const history = useHistory();
16
16
 
17
17
  return ( params, state ) => {
18
- return getPostLinkProps( history, params, state );
18
+ return getPostLinkProps(
19
+ history,
20
+ { ...params, focusMode: true, canvas: 'edit' },
21
+ state
22
+ );
19
23
  };
20
24
  }