@wordpress/edit-site 5.12.11 → 5.12.13

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 (116) hide show
  1. package/build/components/block-editor/constants.js +1 -1
  2. package/build/components/block-editor/constants.js.map +1 -1
  3. package/build/components/editor/index.js +2 -3
  4. package/build/components/editor/index.js.map +1 -1
  5. package/build/components/global-styles/screen-revisions/index.js +8 -2
  6. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  7. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +31 -25
  8. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  9. package/build/components/header-edit-mode/document-actions/index.js +1 -1
  10. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  11. package/build/components/keyboard-shortcuts/edit-mode.js +7 -5
  12. package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
  13. package/build/components/layout/index.js +6 -0
  14. package/build/components/layout/index.js.map +1 -1
  15. package/build/components/page-patterns/grid.js +2 -1
  16. package/build/components/page-patterns/grid.js.map +1 -1
  17. package/build/components/page-patterns/patterns-list.js +17 -3
  18. package/build/components/page-patterns/patterns-list.js.map +1 -1
  19. package/build/components/page-patterns/use-patterns.js +20 -3
  20. package/build/components/page-patterns/use-patterns.js.map +1 -1
  21. package/build/components/page-template-parts/index.js +1 -2
  22. package/build/components/page-template-parts/index.js.map +1 -1
  23. package/build/components/resizable-frame/index.js +11 -19
  24. package/build/components/resizable-frame/index.js.map +1 -1
  25. package/build/components/sidebar-navigation-screen/index.js +15 -13
  26. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  27. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +8 -0
  28. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  29. package/build/components/sidebar-navigation-screen-pages/index.js +2 -0
  30. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  31. package/build/components/sidebar-navigation-screen-patterns/category-item.js +0 -5
  32. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  33. package/build/components/sidebar-navigation-screen-patterns/index.js +0 -9
  34. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  35. package/build/components/sidebar-navigation-screen-templates/index.js +1 -10
  36. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  37. package/build/components/sidebar-navigation-screen-templates-browse/index.js +9 -0
  38. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  39. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
  40. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  41. package/build/hooks/commands/use-edit-mode-commands.js +30 -0
  42. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  43. package/build/store/private-actions.js +2 -1
  44. package/build/store/private-actions.js.map +1 -1
  45. package/build-module/components/block-editor/constants.js +1 -1
  46. package/build-module/components/block-editor/constants.js.map +1 -1
  47. package/build-module/components/editor/index.js +2 -3
  48. package/build-module/components/editor/index.js.map +1 -1
  49. package/build-module/components/global-styles/screen-revisions/index.js +9 -3
  50. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  51. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +27 -21
  52. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  53. package/build-module/components/header-edit-mode/document-actions/index.js +3 -3
  54. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  55. package/build-module/components/keyboard-shortcuts/edit-mode.js +7 -5
  56. package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
  57. package/build-module/components/layout/index.js +6 -0
  58. package/build-module/components/layout/index.js.map +1 -1
  59. package/build-module/components/page-patterns/grid.js +3 -2
  60. package/build-module/components/page-patterns/grid.js.map +1 -1
  61. package/build-module/components/page-patterns/patterns-list.js +17 -3
  62. package/build-module/components/page-patterns/patterns-list.js.map +1 -1
  63. package/build-module/components/page-patterns/use-patterns.js +19 -3
  64. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  65. package/build-module/components/page-template-parts/index.js +1 -2
  66. package/build-module/components/page-template-parts/index.js.map +1 -1
  67. package/build-module/components/resizable-frame/index.js +12 -20
  68. package/build-module/components/resizable-frame/index.js.map +1 -1
  69. package/build-module/components/sidebar-navigation-screen/index.js +13 -13
  70. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  71. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +7 -0
  72. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  73. package/build-module/components/sidebar-navigation-screen-pages/index.js +2 -0
  74. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  75. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +0 -5
  76. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  77. package/build-module/components/sidebar-navigation-screen-patterns/index.js +0 -7
  78. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  79. package/build-module/components/sidebar-navigation-screen-templates/index.js +1 -8
  80. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  81. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +7 -0
  82. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  83. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
  84. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  85. package/build-module/hooks/commands/use-edit-mode-commands.js +29 -0
  86. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  87. package/build-module/store/private-actions.js +2 -1
  88. package/build-module/store/private-actions.js.map +1 -1
  89. package/build-style/style-rtl.css +25 -25
  90. package/build-style/style.css +25 -25
  91. package/package.json +20 -20
  92. package/src/components/block-editor/constants.js +5 -1
  93. package/src/components/editor/index.js +2 -3
  94. package/src/components/global-styles/screen-revisions/index.js +76 -58
  95. package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +14 -1
  96. package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +63 -48
  97. package/src/components/header-edit-mode/document-actions/index.js +4 -3
  98. package/src/components/header-edit-mode/document-actions/style.scss +25 -25
  99. package/src/components/keyboard-shortcuts/edit-mode.js +4 -5
  100. package/src/components/layout/index.js +6 -0
  101. package/src/components/page-patterns/grid.js +8 -3
  102. package/src/components/page-patterns/patterns-list.js +15 -2
  103. package/src/components/page-patterns/style.scss +3 -0
  104. package/src/components/page-patterns/use-patterns.js +19 -3
  105. package/src/components/page-template-parts/index.js +0 -1
  106. package/src/components/resizable-frame/index.js +10 -25
  107. package/src/components/sidebar-navigation-screen/index.js +13 -15
  108. package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +27 -15
  109. package/src/components/sidebar-navigation-screen-pages/index.js +9 -4
  110. package/src/components/sidebar-navigation-screen-patterns/category-item.js +5 -13
  111. package/src/components/sidebar-navigation-screen-patterns/index.js +0 -8
  112. package/src/components/sidebar-navigation-screen-templates/index.js +1 -9
  113. package/src/components/sidebar-navigation-screen-templates-browse/index.js +10 -0
  114. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -4
  115. package/src/hooks/commands/use-edit-mode-commands.js +34 -3
  116. package/src/store/private-actions.js +5 -1
@@ -4,12 +4,14 @@ import { createElement } from "@wordpress/element";
4
4
  * WordPress dependencies
5
5
  */
6
6
  import { __ } from '@wordpress/i18n';
7
+ import { useSelect } from '@wordpress/data';
7
8
  import { __experimentalUseNavigator as useNavigator } from '@wordpress/components';
8
9
  /**
9
10
  * Internal dependencies
10
11
  */
11
12
 
12
13
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
14
+ import { store as editSiteStore } from '../../store';
13
15
  const config = {
14
16
  wp_template: {
15
17
  title: __('All templates'),
@@ -27,7 +29,12 @@ export default function SidebarNavigationScreenTemplatesBrowse() {
27
29
  postType
28
30
  }
29
31
  } = useNavigator();
32
+ const isTemplatePartsMode = useSelect(select => {
33
+ const settings = select(editSiteStore).getSettings();
34
+ return !!settings.supportsTemplatePartsMode;
35
+ }, []);
30
36
  return createElement(SidebarNavigationScreen, {
37
+ isRoot: isTemplatePartsMode,
31
38
  title: config[postType].title,
32
39
  description: config[postType].description,
33
40
  backPath: config[postType].backPath
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/index.js"],"names":["__","__experimentalUseNavigator","useNavigator","SidebarNavigationScreen","config","wp_template","title","description","wp_template_part","backPath","SidebarNavigationScreenTemplatesBrowse","params","postType"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,0BAA0B,IAAIC,YAAvC,QAA2D,uBAA3D;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AAEA,MAAMC,MAAM,GAAG;AACdC,EAAAA,WAAW,EAAE;AACZC,IAAAA,KAAK,EAAEN,EAAE,CAAE,eAAF,CADG;AAEZO,IAAAA,WAAW,EAAEP,EAAE,CACd,iGADc;AAFH,GADC;AAOdQ,EAAAA,gBAAgB,EAAE;AACjBF,IAAAA,KAAK,EAAEN,EAAE,CAAE,oBAAF,CADQ;AAEjBO,IAAAA,WAAW,EAAEP,EAAE,CACd,2GADc,CAFE;AAKjBS,IAAAA,QAAQ,EAAE;AALO;AAPJ,CAAf;AAgBA,eAAe,SAASC,sCAAT,GAAkD;AAChE,QAAM;AACLC,IAAAA,MAAM,EAAE;AAAEC,MAAAA;AAAF;AADH,MAEFV,YAAY,EAFhB;AAGA,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGE,MAAM,CAAEQ,QAAF,CAAN,CAAmBN,KAD5B;AAEC,IAAA,WAAW,EAAGF,MAAM,CAAEQ,QAAF,CAAN,CAAmBL,WAFlC;AAGC,IAAA,QAAQ,EAAGH,MAAM,CAAEQ,QAAF,CAAN,CAAmBH;AAH/B,IADD;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\n\nconst config = {\n\twp_template: {\n\t\ttitle: __( 'All templates' ),\n\t\tdescription: __(\n\t\t\t'Create new templates, or reset any customizations made to the templates supplied by your theme.'\n\t\t),\n\t},\n\twp_template_part: {\n\t\ttitle: __( 'All template parts' ),\n\t\tdescription: __(\n\t\t\t'Create new template parts, or reset any customizations made to the template parts supplied by your theme.'\n\t\t),\n\t\tbackPath: '/patterns',\n\t},\n};\n\nexport default function SidebarNavigationScreenTemplatesBrowse() {\n\tconst {\n\t\tparams: { postType },\n\t} = useNavigator();\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ config[ postType ].title }\n\t\t\tdescription={ config[ postType ].description }\n\t\t\tbackPath={ config[ postType ].backPath }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/index.js"],"names":["__","useSelect","__experimentalUseNavigator","useNavigator","SidebarNavigationScreen","store","editSiteStore","config","wp_template","title","description","wp_template_part","backPath","SidebarNavigationScreenTemplatesBrowse","params","postType","isTemplatePartsMode","select","settings","getSettings","supportsTemplatePartsMode"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,0BAA0B,IAAIC,YAAvC,QAA2D,uBAA3D;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA,MAAMC,MAAM,GAAG;AACdC,EAAAA,WAAW,EAAE;AACZC,IAAAA,KAAK,EAAET,EAAE,CAAE,eAAF,CADG;AAEZU,IAAAA,WAAW,EAAEV,EAAE,CACd,iGADc;AAFH,GADC;AAOdW,EAAAA,gBAAgB,EAAE;AACjBF,IAAAA,KAAK,EAAET,EAAE,CAAE,oBAAF,CADQ;AAEjBU,IAAAA,WAAW,EAAEV,EAAE,CACd,2GADc,CAFE;AAKjBY,IAAAA,QAAQ,EAAE;AALO;AAPJ,CAAf;AAgBA,eAAe,SAASC,sCAAT,GAAkD;AAChE,QAAM;AACLC,IAAAA,MAAM,EAAE;AAAEC,MAAAA;AAAF;AADH,MAEFZ,YAAY,EAFhB;AAIA,QAAMa,mBAAmB,GAAGf,SAAS,CAAIgB,MAAF,IAAc;AACpD,UAAMC,QAAQ,GAAGD,MAAM,CAAEX,aAAF,CAAN,CAAwBa,WAAxB,EAAjB;AAEA,WAAO,CAAC,CAAED,QAAQ,CAACE,yBAAnB;AACA,GAJoC,EAIlC,EAJkC,CAArC;AAMA,SACC,cAAC,uBAAD;AACC,IAAA,MAAM,EAAGJ,mBADV;AAEC,IAAA,KAAK,EAAGT,MAAM,CAAEQ,QAAF,CAAN,CAAmBN,KAF5B;AAGC,IAAA,WAAW,EAAGF,MAAM,CAAEQ,QAAF,CAAN,CAAmBL,WAHlC;AAIC,IAAA,QAAQ,EAAGH,MAAM,CAAEQ,QAAF,CAAN,CAAmBH;AAJ/B,IADD;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { store as editSiteStore } from '../../store';\n\nconst config = {\n\twp_template: {\n\t\ttitle: __( 'All templates' ),\n\t\tdescription: __(\n\t\t\t'Create new templates, or reset any customizations made to the templates supplied by your theme.'\n\t\t),\n\t},\n\twp_template_part: {\n\t\ttitle: __( 'All template parts' ),\n\t\tdescription: __(\n\t\t\t'Create new template parts, or reset any customizations made to the template parts supplied by your theme.'\n\t\t),\n\t\tbackPath: '/patterns',\n\t},\n};\n\nexport default function SidebarNavigationScreenTemplatesBrowse() {\n\tconst {\n\t\tparams: { postType },\n\t} = useNavigator();\n\n\tconst isTemplatePartsMode = useSelect( ( select ) => {\n\t\tconst settings = select( editSiteStore ).getSettings();\n\n\t\treturn !! settings.supportsTemplatePartsMode;\n\t}, [] );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot={ isTemplatePartsMode }\n\t\t\ttitle={ config[ postType ].title }\n\t\t\tdescription={ config[ postType ].description }\n\t\t\tbackPath={ config[ postType ].backPath }\n\t\t/>\n\t);\n}\n"]}
@@ -54,7 +54,7 @@ export default function useSyncCanvasModeWithURL() {
54
54
  useEffect(() => {
55
55
  currentCanvasInUrl.current = canvasInUrl;
56
56
 
57
- if (canvasInUrl === undefined && currentCanvasMode.current !== 'view') {
57
+ if (canvasInUrl !== 'edit' && currentCanvasMode.current !== 'view') {
58
58
  setCanvasMode('view');
59
59
  } else if (canvasInUrl === 'edit' && currentCanvasMode.current !== 'edit') {
60
60
  setCanvasMode('edit');
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js"],"names":["useEffect","useRef","useSelect","useDispatch","privateApis","routerPrivateApis","store","editSiteStore","unlock","useLocation","useHistory","useSyncCanvasModeWithURL","history","params","canvasMode","select","getCanvasMode","setCanvasMode","currentCanvasMode","canvas","canvasInUrl","currentCanvasInUrl","currentUrlParams","current","push","undefined"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,MAApB,QAAkC,oBAAlC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,WAAW,IAAIC,iBAAxB,QAAiD,mBAAjD;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAM;AAAEC,EAAAA,WAAF;AAA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ADP;AAEbJ,QAAAA,MAAM,EAAEM;AAFK,OAAd;AAIA;AACD,GAzBQ,EAyBN,CAAEX,UAAF,EAAcF,OAAd,CAzBM,CAAT;AA2BAZ,EAAAA,SAAS,CAAE,MAAM;AAChBqB,IAAAA,kBAAkB,CAACE,OAAnB,GAA6BH,WAA7B;;AACA,QACCA,WAAW,KAAKK,SAAhB,IACAP,iBAAiB,CAACK,OAAlB,KAA8B,MAF/B,EAGE;AACDN,MAAAA,aAAa,CAAE,MAAF,CAAb;AACA,KALD,MAKO,IACNG,WAAW,KAAK,MAAhB,IACAF,iBAAiB,CAACK,OAAlB,KAA8B,MAFxB,EAGL;AACDN,MAAAA,aAAa,CAAE,MAAF,CAAb;AACA;AACD,GAbQ,EAaN,CAAEG,WAAF,EAAeH,aAAf,CAbM,CAAT;AAcA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/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';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nexport default function useSyncCanvasModeWithURL() {\n\tconst history = useHistory();\n\tconst { params } = useLocation();\n\tconst canvasMode = useSelect(\n\t\t( select ) => unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t[]\n\t);\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst currentCanvasMode = useRef( canvasMode );\n\tconst { canvas: canvasInUrl } = params;\n\tconst currentCanvasInUrl = useRef( canvasInUrl );\n\tconst currentUrlParams = useRef( params );\n\tuseEffect( () => {\n\t\tcurrentUrlParams.current = params;\n\t}, [ params ] );\n\n\tuseEffect( () => {\n\t\tcurrentCanvasMode.current = canvasMode;\n\t\tif ( canvasMode === 'init' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tcanvasMode === 'edit' &&\n\t\t\tcurrentCanvasInUrl.current !== canvasMode\n\t\t) {\n\t\t\thistory.push( {\n\t\t\t\t...currentUrlParams.current,\n\t\t\t\tcanvas: 'edit',\n\t\t\t} );\n\t\t}\n\n\t\tif (\n\t\t\tcanvasMode === 'view' &&\n\t\t\tcurrentCanvasInUrl.current !== undefined\n\t\t) {\n\t\t\thistory.push( {\n\t\t\t\t...currentUrlParams.current,\n\t\t\t\tcanvas: undefined,\n\t\t\t} );\n\t\t}\n\t}, [ canvasMode, history ] );\n\n\tuseEffect( () => {\n\t\tcurrentCanvasInUrl.current = canvasInUrl;\n\t\tif (\n\t\t\tcanvasInUrl === undefined &&\n\t\t\tcurrentCanvasMode.current !== 'view'\n\t\t) {\n\t\t\tsetCanvasMode( 'view' );\n\t\t} else if (\n\t\t\tcanvasInUrl === 'edit' &&\n\t\t\tcurrentCanvasMode.current !== 'edit'\n\t\t) {\n\t\t\tsetCanvasMode( 'edit' );\n\t\t}\n\t}, [ canvasInUrl, setCanvasMode ] );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js"],"names":["useEffect","useRef","useSelect","useDispatch","privateApis","routerPrivateApis","store","editSiteStore","unlock","useLocation","useHistory","useSyncCanvasModeWithURL","history","params","canvasMode","select","getCanvasMode","setCanvasMode","currentCanvasMode","canvas","canvasInUrl","currentCanvasInUrl","currentUrlParams","current","push","undefined"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,MAApB,QAAkC,oBAAlC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,WAAW,IAAIC,iBAAxB,QAAiD,mBAAjD;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAM;AAAEC,EAAAA,WAAF;AAAeC,EAAAA;AAAf,IAA8BF,MAAM,CAAEH,iBAAF,CA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A;AACD,GAzBQ,EAyBN,CAAEX,UAAF,EAAcF,OAAd,CAzBM,CAAT;AA2BAZ,EAAAA,SAAS,CAAE,MAAM;AAChBqB,IAAAA,kBAAkB,CAACE,OAAnB,GAA6BH,WAA7B;;AACA,QAAKA,WAAW,KAAK,MAAhB,IAA0BF,iBAAiB,CAACK,OAAlB,KAA8B,MAA7D,EAAsE;AACrEN,MAAAA,aAAa,CAAE,MAAF,CAAb;AACA,KAFD,MAEO,IACNG,WAAW,KAAK,MAAhB,IACAF,iBAAiB,CAACK,OAAlB,KAA8B,MAFxB,EAGL;AACDN,MAAAA,aAAa,CAAE,MAAF,CAAb;AACA;AACD,GAVQ,EAUN,CAAEG,WAAF,EAAeH,aAAf,CAVM,CAAT;AAWA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/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';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nexport default function useSyncCanvasModeWithURL() {\n\tconst history = useHistory();\n\tconst { params } = useLocation();\n\tconst canvasMode = useSelect(\n\t\t( select ) => unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t[]\n\t);\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst currentCanvasMode = useRef( canvasMode );\n\tconst { canvas: canvasInUrl } = params;\n\tconst currentCanvasInUrl = useRef( canvasInUrl );\n\tconst currentUrlParams = useRef( params );\n\tuseEffect( () => {\n\t\tcurrentUrlParams.current = params;\n\t}, [ params ] );\n\n\tuseEffect( () => {\n\t\tcurrentCanvasMode.current = canvasMode;\n\t\tif ( canvasMode === 'init' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tcanvasMode === 'edit' &&\n\t\t\tcurrentCanvasInUrl.current !== canvasMode\n\t\t) {\n\t\t\thistory.push( {\n\t\t\t\t...currentUrlParams.current,\n\t\t\t\tcanvas: 'edit',\n\t\t\t} );\n\t\t}\n\n\t\tif (\n\t\t\tcanvasMode === 'view' &&\n\t\t\tcurrentCanvasInUrl.current !== undefined\n\t\t) {\n\t\t\thistory.push( {\n\t\t\t\t...currentUrlParams.current,\n\t\t\t\tcanvas: undefined,\n\t\t\t} );\n\t\t}\n\t}, [ canvasMode, history ] );\n\n\tuseEffect( () => {\n\t\tcurrentCanvasInUrl.current = canvasInUrl;\n\t\tif ( canvasInUrl !== 'edit' && currentCanvasMode.current !== 'view' ) {\n\t\t\tsetCanvasMode( 'view' );\n\t\t} else if (\n\t\t\tcanvasInUrl === 'edit' &&\n\t\t\tcurrentCanvasMode.current !== 'edit'\n\t\t) {\n\t\t\tsetCanvasMode( 'edit' );\n\t\t}\n\t}, [ canvasInUrl, setCanvasMode ] );\n}\n"]}
@@ -8,6 +8,7 @@ import { useCommandLoader } from '@wordpress/commands';
8
8
  import { privateApis as routerPrivateApis } from '@wordpress/router';
9
9
  import { store as preferencesStore } from '@wordpress/preferences';
10
10
  import { store as interfaceStore } from '@wordpress/interface';
11
+ import { store as noticesStore } from '@wordpress/notices';
11
12
  /**
12
13
  * Internal dependencies
13
14
  */
@@ -144,6 +145,8 @@ function useEditUICommands() {
144
145
  const {
145
146
  openGeneralSidebar,
146
147
  closeGeneralSidebar,
148
+ setIsInserterOpened,
149
+ setIsListViewOpened,
147
150
  switchEditorMode
148
151
  } = useDispatch(editSiteStore);
149
152
  const {
@@ -159,8 +162,15 @@ function useEditUICommands() {
159
162
  openModal
160
163
  } = useDispatch(interfaceStore);
161
164
  const {
165
+ get: getPreference
166
+ } = useSelect(preferencesStore);
167
+ const {
168
+ set: setPreference,
162
169
  toggle
163
170
  } = useDispatch(preferencesStore);
171
+ const {
172
+ createInfoNotice
173
+ } = useDispatch(noticesStore);
164
174
 
165
175
  if (canvasMode !== 'edit') {
166
176
  return {
@@ -213,6 +223,25 @@ function useEditUICommands() {
213
223
  close();
214
224
  }
215
225
  });
226
+ commands.push({
227
+ name: 'core/toggle-distraction-free',
228
+ label: __('Toggle distraction free'),
229
+ icon: cog,
230
+ callback: ({
231
+ close
232
+ }) => {
233
+ setPreference('core/edit-site', 'fixedToolbar', false);
234
+ setIsInserterOpened(false);
235
+ setIsListViewOpened(false);
236
+ closeGeneralSidebar();
237
+ toggle('core/edit-site', 'distractionFree');
238
+ createInfoNotice(getPreference('core/edit-site', 'distractionFree') ? __('Distraction free mode turned on.') : __('Distraction free mode turned off.'), {
239
+ id: 'core/edit-site/distraction-free-mode/notice',
240
+ type: 'snackbar'
241
+ });
242
+ close();
243
+ }
244
+ });
216
245
  commands.push({
217
246
  name: 'core/toggle-top-toolbar',
218
247
  label: __('Toggle top toolbar'),
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/hooks/commands/use-edit-mode-commands.js"],"names":["useSelect","useDispatch","__","isRTL","trash","backup","layout","page","drawerLeft","drawerRight","blockDefault","cog","code","keyboardClose","useCommandLoader","privateApis","routerPrivateApis","store","preferencesStore","interfaceStore","editSiteStore","useEditedEntityRecord","isTemplateRemovable","isTemplateRevertable","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","PREFERENCES_MODAL_NAME","unlock","useHistory","usePageContentFocusCommands","isPage","canvasMode","hasPageContentFocus","select","getCanvasMode","setHasPageContentFocus","isLoading","commands","push","name","label","icon","callback","close","useManipulateDocumentCommands","isLoaded","record","template","removeTemplate","revertTemplate","history","type","path","useEditUICommands","openGeneralSidebar","closeGeneralSidebar","switchEditorMode","editorMode","activeSidebar","getEditorMode","getActiveComplementaryArea","openModal","toggle","useEditModeCommands","hook","context"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,EAAaC,KAAb,QAA0B,iBAA1B;AACA,SACCC,KADD,EAECC,MAFD,EAGCC,MAHD,EAICC,IAJD,EAKCC,UAL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EjByB,IAAAA,IAAI,EAAEX;AAFW,GAAF,CAAhB;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\ttrash,\n\tbackup,\n\tlayout,\n\tpage,\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tcog,\n\tcode,\n\tkeyboardClose,\n} from '@wordpress/icons';\nimport { useCommandLoader } from '@wordpress/commands';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\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 { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction usePageContentFocusCommands() {\n\tconst { isPage, canvasMode, hasPageContentFocus } = useSelect(\n\t\t( select ) => ( {\n\t\t\tisPage: select( editSiteStore ).isPage(),\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\thasPageContentFocus: select( editSiteStore ).hasPageContentFocus(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { setHasPageContentFocus } = useDispatch( editSiteStore );\n\n\tif ( ! isPage || canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( hasPageContentFocus ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-template-focus',\n\t\t\tlabel: __( 'Edit template' ),\n\t\t\ticon: layout,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetHasPageContentFocus( false );\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\tsetHasPageContentFocus( true );\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 hasPageContentFocus = useSelect(\n\t\t( select ) => select( editSiteStore ).hasPageContentFocus(),\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 ) && ! hasPageContentFocus ) {\n\t\tconst label =\n\t\t\ttemplate.type === 'wp_template'\n\t\t\t\t? __( 'Reset template' )\n\t\t\t\t: __( 'Reset template part' );\n\t\tcommands.push( {\n\t\t\tname: 'core/reset-template',\n\t\t\tlabel,\n\t\t\ticon: backup,\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 ) && ! hasPageContentFocus ) {\n\t\tconst label =\n\t\t\ttemplate.type === 'wp_template'\n\t\t\t\t? __( 'Delete template' )\n\t\t\t\t: __( 'Delete template part' );\n\t\tconst path =\n\t\t\ttemplate.type === 'wp_template'\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 { openGeneralSidebar, closeGeneralSidebar, switchEditorMode } =\n\t\tuseDispatch( editSiteStore );\n\tconst { canvasMode, editorMode, activeSidebar } = useSelect(\n\t\t( select ) => ( {\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\teditorMode: select( editSiteStore ).getEditorMode(),\n\t\t\tactiveSidebar: select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { toggle } = useDispatch( preferencesStore );\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 mode' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-site', 'focusMode' );\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\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-site', 'fixedToolbar' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-code-editor',\n\t\tlabel: __( 'Toggle code editor' ),\n\t\ticon: code,\n\t\tcallback: ( { close } ) => {\n\t\t\tswitchEditorMode( editorMode === 'visual' ? 'text' : 'visual' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Open editor preferences' ),\n\t\ticon: cog,\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: __( 'Open keyboard shortcuts' ),\n\t\ticon: keyboardClose,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n\n\treturn {\n\t\tisLoading: false,\n\t\tcommands,\n\t};\n}\n\nexport function useEditModeCommands() {\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/edit-ui',\n\t\thook: useEditUICommands,\n\t} );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/hooks/commands/use-edit-mode-commands.js"],"names":["useSelect","useDispatch","__","isRTL","trash","backup","layout","page","drawerLeft","drawerRight","blockDefault","cog","code","keyboardClose","useCommandLoader","privateApis","routerPrivateApis","store","preferencesStore","interfaceStore","noticesStore","editSiteStore","useEditedEntityRecord","isTemplateRemovable","isTemplateRevertable","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","PREFERENCES_MODAL_NAME","unlock","useHistory","usePageContentFocusCommands","isPage","canvasMode","hasPageContentFocus","select","getCanvasMode","setHasPageContentFocus","isLoading","commands","push","name","label","icon","callback","close","useManipulateDocumentCommands","isLoaded","record","template","removeTemplate","revertTemplate","history","type","path","useEditUICommands","openGeneralSidebar","closeGeneralSidebar","setIsInserterOpened","setIsListViewOpened","switchEditorMode","editorMode","activeSidebar","getEditorMode","getActiveComplementaryArea","openModal","get","getPreference","set","setPreference","toggle","createInfoNotice","id","useEditModeCommands","hook","context"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,EAAaC,KAAb,QAA0B,iBAA1B;AACA,SACCC,KADD,EAECC,MAFD,EAGCC,MAHD,EAICC,IAJD,EAKCC,UALD,EAMCC,WAND,EAOCC,YAPD,EAQCC,GARD,EASCC,IATD,EAUCC,aAVD,QAWO,kBAXP;AAYA,SAASC,gBAAT,QAAiC,qBAAjC;AACA,SAASC,WAAW,IAAIC,iBAAxB,QAAiD,mBAAjD;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AACA,SAASD,KAAK,IAAIE,cAAlB,QAAwC,sBAAxC;AACA,SAASF,KAAK,IAAIG,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,aAAvC;AACA,OAAOC,qBAAP,MAAkC,2CAAlC;AACA,OAAOC,mBAAP,MAAgC,mCAAhC;AACA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,SAASC,iCAAT,QAAkD,+CAAlD;AACA,SAASC,sBAAT,QAAuC,oCAAvC;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAM;AAAEC,E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AENC,IAAAA;AAFM,GAAP;AAIA;;AAED,OAAO,SAASkC,mBAAT,GAA+B;AACrCzD,EAAAA,gBAAgB,CAAE;AACjByB,IAAAA,IAAI,EAAE,mCADW;AAEjBiC,IAAAA,IAAI,EAAE3C,2BAFW;AAGjB4C,IAAAA,OAAO,EAAE;AAHQ,GAAF,CAAhB;AAMA3D,EAAAA,gBAAgB,CAAE;AACjByB,IAAAA,IAAI,EAAE,oCADW;AAEjBiC,IAAAA,IAAI,EAAE5B;AAFW,GAAF,CAAhB;AAKA9B,EAAAA,gBAAgB,CAAE;AACjByB,IAAAA,IAAI,EAAE,wBADW;AAEjBiC,IAAAA,IAAI,EAAEnB;AAFW,GAAF,CAAhB;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\ttrash,\n\tbackup,\n\tlayout,\n\tpage,\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tcog,\n\tcode,\n\tkeyboardClose,\n} from '@wordpress/icons';\nimport { useCommandLoader } from '@wordpress/commands';\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';\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 { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction usePageContentFocusCommands() {\n\tconst { isPage, canvasMode, hasPageContentFocus } = useSelect(\n\t\t( select ) => ( {\n\t\t\tisPage: select( editSiteStore ).isPage(),\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\thasPageContentFocus: select( editSiteStore ).hasPageContentFocus(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { setHasPageContentFocus } = useDispatch( editSiteStore );\n\n\tif ( ! isPage || canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( hasPageContentFocus ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-template-focus',\n\t\t\tlabel: __( 'Edit template' ),\n\t\t\ticon: layout,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetHasPageContentFocus( false );\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\tsetHasPageContentFocus( true );\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 hasPageContentFocus = useSelect(\n\t\t( select ) => select( editSiteStore ).hasPageContentFocus(),\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 ) && ! hasPageContentFocus ) {\n\t\tconst label =\n\t\t\ttemplate.type === 'wp_template'\n\t\t\t\t? __( 'Reset template' )\n\t\t\t\t: __( 'Reset template part' );\n\t\tcommands.push( {\n\t\t\tname: 'core/reset-template',\n\t\t\tlabel,\n\t\t\ticon: backup,\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 ) && ! hasPageContentFocus ) {\n\t\tconst label =\n\t\t\ttemplate.type === 'wp_template'\n\t\t\t\t? __( 'Delete template' )\n\t\t\t\t: __( 'Delete template part' );\n\t\tconst path =\n\t\t\ttemplate.type === 'wp_template'\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\tsetIsInserterOpened,\n\t\tsetIsListViewOpened,\n\t\tswitchEditorMode,\n\t} = useDispatch( editSiteStore );\n\tconst { canvasMode, editorMode, activeSidebar } = useSelect(\n\t\t( select ) => ( {\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\teditorMode: select( editSiteStore ).getEditorMode(),\n\t\t\tactiveSidebar: select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { get: getPreference } = useSelect( preferencesStore );\n\tconst { set: setPreference, 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 mode' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-site', 'focusMode' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-distraction-free',\n\t\tlabel: __( 'Toggle distraction free' ),\n\t\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\tsetPreference( 'core/edit-site', 'fixedToolbar', false );\n\t\t\tsetIsInserterOpened( false );\n\t\t\tsetIsListViewOpened( false );\n\t\t\tcloseGeneralSidebar();\n\t\t\ttoggle( 'core/edit-site', 'distractionFree' );\n\t\t\tcreateInfoNotice(\n\t\t\t\tgetPreference( 'core/edit-site', 'distractionFree' )\n\t\t\t\t\t? __( 'Distraction free mode turned on.' )\n\t\t\t\t\t: __( 'Distraction free mode turned off.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-site/distraction-free-mode/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\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\ticon: cog,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-site', 'fixedToolbar' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-code-editor',\n\t\tlabel: __( 'Toggle code editor' ),\n\t\ticon: code,\n\t\tcallback: ( { close } ) => {\n\t\t\tswitchEditorMode( editorMode === 'visual' ? 'text' : 'visual' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Open editor preferences' ),\n\t\ticon: cog,\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: __( 'Open keyboard shortcuts' ),\n\t\ticon: keyboardClose,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n\n\treturn {\n\t\tisLoading: false,\n\t\tcommands,\n\t};\n}\n\nexport function useEditModeCommands() {\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/edit-ui',\n\t\thook: useEditUICommands,\n\t} );\n}\n"]}
@@ -20,8 +20,9 @@ export const setCanvasMode = mode => ({
20
20
  type: 'SET_CANVAS_MODE',
21
21
  mode
22
22
  }); // Check if the block list view should be open by default.
23
+ // If `distractionFree` mode is enabled, the block list view should not be open.
23
24
 
24
- if (mode === 'edit' && registry.select(preferencesStore).get('core/edit-site', 'showListViewByDefault')) {
25
+ if (mode === 'edit' && registry.select(preferencesStore).get('core/edit-site', 'showListViewByDefault') && !registry.select(preferencesStore).get('core/edit-site', 'distractionFree')) {
25
26
  dispatch.setIsListViewOpened(true);
26
27
  } // Switch focus away from editing the template when switching to view mode.
27
28
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/private-actions.js"],"names":["store","blockEditorStore","preferencesStore","setCanvasMode","mode","registry","dispatch","select","__unstableSetEditorMode","type","get","setIsListViewOpened","isPage","setHasPageContentFocus","setEditorCanvasContainerView","view"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,aAAa,GACvBC,IAAF,IACA,CAAE;AAAEC,EAAAA,QAAF;AAAYC,EAAAA,QAAZ;AAAsBC,EAAAA;AAAtB,CAAF,KAAsC;AACrCF,EAAAA,QAAQ,CAACC,QAAT,CAAmBL,gBAAnB,EAAsCO,uBAAtC,CAA+D,MAA/D;;AACAF,EAAAA,QAAQ,CAAE;AACTG,IAAAA,IAAI,EAAE,iBADG;AAETL,IAAAA;AAFS,GAAF,CAAR,CAFqC,CAMrC;;AACA,MACCA,IAAI,KAAK,MAAT,IACAC,QAAQ,CACNE,MADF,CACUL,gBADV,EAEEQ,GAFF,CAEO,gBAFP,EAEyB,uBAFzB,CAFD,EAKE;AACDJ,IAAAA,QAAQ,CAACK,mBAAT,CAA8B,IAA9B;AACA,GAdoC,CAerC;;;AACA,MAAKP,IAAI,KAAK,MAAT,IAAmBG,MAAM,CAACK,MAAP,EAAxB,EAA0C;AACzCN,IAAAA,QAAQ,CAACO,sBAAT,CAAiC,IAAjC;AACA;AACD,CArBK;AAuBP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,4BAA4B,GACtCC,IAAF,IACA,CAAE;AAAET,EAAAA;AAAF,CAAF,KAAoB;AACnBA,EAAAA,QAAQ,CAAE;AACTG,IAAAA,IAAI,EAAE,kCADG;AAETM,IAAAA;AAFS,GAAF,CAAR;AAIA,CAPK","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch, select } ) => {\n\t\tregistry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );\n\t\tdispatch( {\n\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\tmode,\n\t\t} );\n\t\t// Check if the block list view should be open by default.\n\t\tif (\n\t\t\tmode === 'edit' &&\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'showListViewByDefault' )\n\t\t) {\n\t\t\tdispatch.setIsListViewOpened( true );\n\t\t}\n\t\t// Switch focus away from editing the template when switching to view mode.\n\t\tif ( mode === 'view' && select.isPage() ) {\n\t\t\tdispatch.setHasPageContentFocus( true );\n\t\t}\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',\n\t\t\tview,\n\t\t} );\n\t};\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/private-actions.js"],"names":["store","blockEditorStore","preferencesStore","setCanvasMode","mode","registry","dispatch","select","__unstableSetEditorMode","type","get","setIsListViewOpened","isPage","setHasPageContentFocus","setEditorCanvasContainerView","view"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,aAAa,GACvBC,IAAF,IACA,CAAE;AAAEC,EAAAA,QAAF;AAAYC,EAAAA,QAAZ;AAAsBC,EAAAA;AAAtB,CAAF,KAAsC;AACrCF,EAAAA,QAAQ,CAACC,QAAT,CAAmBL,gBAAnB,EAAsCO,uBAAtC,CAA+D,MAA/D;;AACAF,EAAAA,QAAQ,CAAE;AACTG,IAAAA,IAAI,EAAE,iBADG;AAETL,IAAAA;AAFS,GAAF,CAAR,CAFqC,CAMrC;AACA;;AACA,MACCA,IAAI,KAAK,MAAT,IACAC,QAAQ,CACNE,MADF,CACUL,gBADV,EAEEQ,GAFF,CAEO,gBAFP,EAEyB,uBAFzB,CADA,IAIA,CAAEL,QAAQ,CACRE,MADA,CACQL,gBADR,EAEAQ,GAFA,CAEK,gBAFL,EAEuB,iBAFvB,CALH,EAQE;AACDJ,IAAAA,QAAQ,CAACK,mBAAT,CAA8B,IAA9B;AACA,GAlBoC,CAmBrC;;;AACA,MAAKP,IAAI,KAAK,MAAT,IAAmBG,MAAM,CAACK,MAAP,EAAxB,EAA0C;AACzCN,IAAAA,QAAQ,CAACO,sBAAT,CAAiC,IAAjC;AACA;AACD,CAzBK;AA2BP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,4BAA4B,GACtCC,IAAF,IACA,CAAE;AAAET,EAAAA;AAAF,CAAF,KAAoB;AACnBA,EAAAA,QAAQ,CAAE;AACTG,IAAAA,IAAI,EAAE,kCADG;AAETM,IAAAA;AAFS,GAAF,CAAR;AAIA,CAPK","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch, select } ) => {\n\t\tregistry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );\n\t\tdispatch( {\n\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\tmode,\n\t\t} );\n\t\t// Check if the block list view should be open by default.\n\t\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t\tif (\n\t\t\tmode === 'edit' &&\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'showListViewByDefault' ) &&\n\t\t\t! registry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'distractionFree' )\n\t\t) {\n\t\t\tdispatch.setIsListViewOpened( true );\n\t\t}\n\t\t// Switch focus away from editing the template when switching to view mode.\n\t\tif ( mode === 'view' && select.isPage() ) {\n\t\t\tdispatch.setHasPageContentFocus( true );\n\t\t}\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',\n\t\t\tview,\n\t\t} );\n\t};\n"]}
@@ -1446,17 +1446,18 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1446
1446
  }
1447
1447
 
1448
1448
  .edit-site-document-actions {
1449
- display: grid;
1450
- grid-template-columns: 1fr 2fr 1fr;
1449
+ display: flex;
1450
+ align-items: center;
1451
+ gap: 8px;
1451
1452
  height: 36px;
1453
+ justify-content: space-between;
1452
1454
  min-width: 0;
1453
1455
  background: #f0f0f0;
1454
1456
  border-radius: 4px;
1455
1457
  width: min(100%, 450px);
1456
- overflow: hidden;
1457
1458
  }
1458
- .edit-site-document-actions:hover {
1459
- color: currentColor;
1459
+ .edit-site-document-actions .components-button:hover {
1460
+ color: var(--wp-block-synced-color);
1460
1461
  background: #e0e0e0;
1461
1462
  }
1462
1463
  @media (min-width: 782px) {
@@ -1471,20 +1472,22 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1471
1472
  }
1472
1473
 
1473
1474
  .edit-site-document-actions__command {
1474
- grid-column: 1/-1;
1475
- display: grid;
1476
- grid-template-columns: 1fr 2fr 1fr;
1477
- grid-row: 1;
1475
+ flex-grow: 1;
1476
+ color: var(--wp-block-synced-color);
1477
+ overflow: hidden;
1478
1478
  }
1479
1479
 
1480
1480
  .edit-site-document-actions__title {
1481
1481
  flex-grow: 1;
1482
1482
  color: var(--wp-block-synced-color);
1483
1483
  overflow: hidden;
1484
- grid-column: 2/3;
1484
+ }
1485
+ .edit-site-document-actions__title:hover {
1486
+ color: var(--wp-block-synced-color);
1485
1487
  }
1486
1488
  .edit-site-document-actions__title .block-editor-block-icon {
1487
1489
  min-width: 24px;
1490
+ flex-shrink: 0;
1488
1491
  }
1489
1492
  .edit-site-document-actions__title h1 {
1490
1493
  white-space: nowrap;
@@ -1517,31 +1520,25 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1517
1520
  }
1518
1521
  }
1519
1522
 
1520
- .edit-site-document-actions__shortcut,
1521
- .edit-site-document-actions__back {
1522
- color: #2f2f2f;
1523
- }
1524
- .edit-site-document-actions:hover .edit-site-document-actions__shortcut,
1525
- .edit-site-document-actions:hover .edit-site-document-actions__back {
1526
- color: #1e1e1e;
1527
- }
1528
-
1529
1523
  .edit-site-document-actions__shortcut {
1530
- text-align: left;
1524
+ color: #2f2f2f;
1531
1525
  }
1532
1526
 
1533
- .edit-site-document-actions__back {
1527
+ .edit-site-document-actions__back.components-button.has-icon.has-text {
1534
1528
  min-width: 36px;
1535
1529
  flex-shrink: 0;
1536
- grid-column: 1/2;
1537
- grid-row: 1;
1530
+ color: #757575;
1531
+ gap: 0;
1538
1532
  z-index: 1;
1539
1533
  }
1540
- .edit-site-document-actions.is-animated .edit-site-document-actions__back {
1534
+ .edit-site-document-actions__back.components-button.has-icon.has-text:hover {
1535
+ color: currentColor;
1536
+ }
1537
+ .edit-site-document-actions.is-animated .edit-site-document-actions__back.components-button.has-icon.has-text {
1541
1538
  animation: edit-site-document-actions__slide-in-left 0.3s;
1542
1539
  }
1543
1540
  @media (prefers-reduced-motion: reduce) {
1544
- .edit-site-document-actions.is-animated .edit-site-document-actions__back {
1541
+ .edit-site-document-actions.is-animated .edit-site-document-actions__back.components-button.has-icon.has-text {
1545
1542
  animation-duration: 1ms;
1546
1543
  animation-delay: 0s;
1547
1544
  }
@@ -1837,6 +1834,9 @@ body.is-fullscreen-mode .edit-site-list-header {
1837
1834
  width: 300px;
1838
1835
  }
1839
1836
  }
1837
+ .edit-site-patterns .edit-site-patterns__sync-status-filter-option:not([aria-checked=true]) {
1838
+ color: #949494;
1839
+ }
1840
1840
  .edit-site-patterns .edit-site-patterns__sync-status-filter-option:active {
1841
1841
  background: #757575;
1842
1842
  color: #f0f0f0;
@@ -1447,17 +1447,18 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1447
1447
  }
1448
1448
 
1449
1449
  .edit-site-document-actions {
1450
- display: grid;
1451
- grid-template-columns: 1fr 2fr 1fr;
1450
+ display: flex;
1451
+ align-items: center;
1452
+ gap: 8px;
1452
1453
  height: 36px;
1454
+ justify-content: space-between;
1453
1455
  min-width: 0;
1454
1456
  background: #f0f0f0;
1455
1457
  border-radius: 4px;
1456
1458
  width: min(100%, 450px);
1457
- overflow: hidden;
1458
1459
  }
1459
- .edit-site-document-actions:hover {
1460
- color: currentColor;
1460
+ .edit-site-document-actions .components-button:hover {
1461
+ color: var(--wp-block-synced-color);
1461
1462
  background: #e0e0e0;
1462
1463
  }
1463
1464
  @media (min-width: 782px) {
@@ -1472,20 +1473,22 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1472
1473
  }
1473
1474
 
1474
1475
  .edit-site-document-actions__command {
1475
- grid-column: 1/-1;
1476
- display: grid;
1477
- grid-template-columns: 1fr 2fr 1fr;
1478
- grid-row: 1;
1476
+ flex-grow: 1;
1477
+ color: var(--wp-block-synced-color);
1478
+ overflow: hidden;
1479
1479
  }
1480
1480
 
1481
1481
  .edit-site-document-actions__title {
1482
1482
  flex-grow: 1;
1483
1483
  color: var(--wp-block-synced-color);
1484
1484
  overflow: hidden;
1485
- grid-column: 2/3;
1485
+ }
1486
+ .edit-site-document-actions__title:hover {
1487
+ color: var(--wp-block-synced-color);
1486
1488
  }
1487
1489
  .edit-site-document-actions__title .block-editor-block-icon {
1488
1490
  min-width: 24px;
1491
+ flex-shrink: 0;
1489
1492
  }
1490
1493
  .edit-site-document-actions__title h1 {
1491
1494
  white-space: nowrap;
@@ -1518,31 +1521,25 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1518
1521
  }
1519
1522
  }
1520
1523
 
1521
- .edit-site-document-actions__shortcut,
1522
- .edit-site-document-actions__back {
1523
- color: #2f2f2f;
1524
- }
1525
- .edit-site-document-actions:hover .edit-site-document-actions__shortcut,
1526
- .edit-site-document-actions:hover .edit-site-document-actions__back {
1527
- color: #1e1e1e;
1528
- }
1529
-
1530
1524
  .edit-site-document-actions__shortcut {
1531
- text-align: right;
1525
+ color: #2f2f2f;
1532
1526
  }
1533
1527
 
1534
- .edit-site-document-actions__back {
1528
+ .edit-site-document-actions__back.components-button.has-icon.has-text {
1535
1529
  min-width: 36px;
1536
1530
  flex-shrink: 0;
1537
- grid-column: 1/2;
1538
- grid-row: 1;
1531
+ color: #757575;
1532
+ gap: 0;
1539
1533
  z-index: 1;
1540
1534
  }
1541
- .edit-site-document-actions.is-animated .edit-site-document-actions__back {
1535
+ .edit-site-document-actions__back.components-button.has-icon.has-text:hover {
1536
+ color: currentColor;
1537
+ }
1538
+ .edit-site-document-actions.is-animated .edit-site-document-actions__back.components-button.has-icon.has-text {
1542
1539
  animation: edit-site-document-actions__slide-in-left 0.3s;
1543
1540
  }
1544
1541
  @media (prefers-reduced-motion: reduce) {
1545
- .edit-site-document-actions.is-animated .edit-site-document-actions__back {
1542
+ .edit-site-document-actions.is-animated .edit-site-document-actions__back.components-button.has-icon.has-text {
1546
1543
  animation-duration: 1ms;
1547
1544
  animation-delay: 0s;
1548
1545
  }
@@ -1838,6 +1835,9 @@ body.is-fullscreen-mode .edit-site-list-header {
1838
1835
  width: 300px;
1839
1836
  }
1840
1837
  }
1838
+ .edit-site-patterns .edit-site-patterns__sync-status-filter-option:not([aria-checked=true]) {
1839
+ color: #949494;
1840
+ }
1841
1841
  .edit-site-patterns .edit-site-patterns__sync-status-filter-option:active {
1842
1842
  background: #757575;
1843
1843
  color: #f0f0f0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "5.12.11",
3
+ "version": "5.12.13",
4
4
  "description": "Edit Site Page module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -29,40 +29,40 @@
29
29
  "@babel/runtime": "^7.16.0",
30
30
  "@wordpress/a11y": "^3.35.1",
31
31
  "@wordpress/api-fetch": "^6.32.1",
32
- "@wordpress/block-editor": "^12.3.9",
33
- "@wordpress/block-library": "^8.12.11",
34
- "@wordpress/blocks": "^12.12.5",
35
- "@wordpress/commands": "^0.6.8",
36
- "@wordpress/components": "^25.1.8",
37
- "@wordpress/compose": "^6.12.1",
38
- "@wordpress/core-commands": "^0.4.9",
39
- "@wordpress/core-data": "^6.12.9",
40
- "@wordpress/data": "^9.5.4",
32
+ "@wordpress/block-editor": "^12.3.11",
33
+ "@wordpress/block-library": "^8.12.13",
34
+ "@wordpress/blocks": "^12.12.6",
35
+ "@wordpress/commands": "^0.6.10",
36
+ "@wordpress/components": "^25.1.10",
37
+ "@wordpress/compose": "^6.12.2",
38
+ "@wordpress/core-commands": "^0.4.11",
39
+ "@wordpress/core-data": "^6.12.11",
40
+ "@wordpress/data": "^9.5.5",
41
41
  "@wordpress/date": "^4.35.1",
42
42
  "@wordpress/deprecated": "^3.35.1",
43
43
  "@wordpress/dom": "^3.35.1",
44
- "@wordpress/editor": "^13.12.9",
44
+ "@wordpress/editor": "^13.12.11",
45
45
  "@wordpress/element": "^5.12.1",
46
46
  "@wordpress/escape-html": "^2.35.1",
47
47
  "@wordpress/hooks": "^3.35.1",
48
48
  "@wordpress/html-entities": "^3.35.1",
49
49
  "@wordpress/i18n": "^4.35.1",
50
50
  "@wordpress/icons": "^9.26.2",
51
- "@wordpress/interface": "^5.12.8",
52
- "@wordpress/keyboard-shortcuts": "^4.12.4",
51
+ "@wordpress/interface": "^5.12.10",
52
+ "@wordpress/keyboard-shortcuts": "^4.12.5",
53
53
  "@wordpress/keycodes": "^3.35.1",
54
54
  "@wordpress/media-utils": "^4.26.1",
55
- "@wordpress/notices": "^4.3.4",
56
- "@wordpress/plugins": "^6.3.8",
57
- "@wordpress/preferences": "^3.12.8",
55
+ "@wordpress/notices": "^4.3.5",
56
+ "@wordpress/plugins": "^6.3.10",
57
+ "@wordpress/preferences": "^3.12.10",
58
58
  "@wordpress/primitives": "^3.33.1",
59
59
  "@wordpress/private-apis": "^0.17.2",
60
- "@wordpress/reusable-blocks": "^4.12.9",
60
+ "@wordpress/reusable-blocks": "^4.12.11",
61
61
  "@wordpress/router": "^0.4.2",
62
62
  "@wordpress/style-engine": "^1.18.1",
63
63
  "@wordpress/url": "^3.36.1",
64
- "@wordpress/viewport": "^5.12.4",
65
- "@wordpress/widgets": "^3.12.9",
64
+ "@wordpress/viewport": "^5.12.5",
65
+ "@wordpress/widgets": "^3.12.11",
66
66
  "@wordpress/wordcount": "^3.35.1",
67
67
  "change-case": "^4.1.2",
68
68
  "classnames": "^2.3.1",
@@ -84,5 +84,5 @@
84
84
  "publishConfig": {
85
85
  "access": "public"
86
86
  },
87
- "gitHead": "ec0ed708e46a598ab2cf8e18bf2591b0102b5bb3"
87
+ "gitHead": "a6c8348f0058e714c97df49b4025e5d7d1c9e437"
88
88
  }
@@ -1 +1,5 @@
1
- export const FOCUSABLE_ENTITIES = [ 'wp_template_part', 'wp_navigation' ];
1
+ export const FOCUSABLE_ENTITIES = [
2
+ 'wp_template_part',
3
+ 'wp_navigation',
4
+ 'wp_block',
5
+ ];
@@ -58,7 +58,7 @@ const interfaceLabels = {
58
58
  };
59
59
 
60
60
  const typeLabels = {
61
- wp_template: __( 'Template Part' ),
61
+ wp_template: __( 'Template' ),
62
62
  wp_template_part: __( 'Template Part' ),
63
63
  wp_block: __( 'Pattern' ),
64
64
  };
@@ -165,12 +165,11 @@ export default function Editor( { isLoading } ) {
165
165
 
166
166
  let title;
167
167
  if ( hasLoadedPost ) {
168
- const type = typeLabels[ editedPostType ] ?? __( 'Template' );
169
168
  title = sprintf(
170
169
  // translators: A breadcrumb trail in browser tab. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).
171
170
  __( '%1$s ‹ %2$s ‹ Editor' ),
172
171
  getTitle(),
173
- type
172
+ typeLabels[ editedPostType ] ?? typeLabels.wp_template
174
173
  );
175
174
  }
176
175