@wordpress/edit-site 4.8.0 → 4.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/add-new-template/add-custom-generic-template-modal.js +84 -0
  3. package/build/components/add-new-template/add-custom-generic-template-modal.js.map +1 -0
  4. package/build/components/add-new-template/add-custom-template-modal.js +204 -0
  5. package/build/components/add-new-template/add-custom-template-modal.js.map +1 -0
  6. package/build/components/add-new-template/new-template.js +91 -33
  7. package/build/components/add-new-template/new-template.js.map +1 -1
  8. package/build/components/add-new-template/utils.js +532 -0
  9. package/build/components/add-new-template/utils.js.map +1 -0
  10. package/build/components/block-editor/index.js +1 -3
  11. package/build/components/block-editor/index.js.map +1 -1
  12. package/build/components/code-editor/index.js +17 -4
  13. package/build/components/code-editor/index.js.map +1 -1
  14. package/build/components/editor/index.js +16 -0
  15. package/build/components/editor/index.js.map +1 -1
  16. package/build/components/error-boundary/index.js +6 -0
  17. package/build/components/error-boundary/index.js.map +1 -1
  18. package/build/components/global-styles/context-menu.js +6 -3
  19. package/build/components/global-styles/context-menu.js.map +1 -1
  20. package/build/components/global-styles/dimensions-panel.js +185 -19
  21. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  22. package/build/components/global-styles/global-styles-provider.js +4 -2
  23. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  24. package/build/components/global-styles/hooks.js +11 -2
  25. package/build/components/global-styles/hooks.js.map +1 -1
  26. package/build/components/global-styles/palette.js +2 -1
  27. package/build/components/global-styles/palette.js.map +1 -1
  28. package/build/components/global-styles/screen-block-list.js +4 -1
  29. package/build/components/global-styles/screen-block-list.js.map +1 -1
  30. package/build/components/global-styles/screen-button-color.js +80 -0
  31. package/build/components/global-styles/screen-button-color.js.map +1 -0
  32. package/build/components/global-styles/screen-color-palette.js +13 -17
  33. package/build/components/global-styles/screen-color-palette.js.map +1 -1
  34. package/build/components/global-styles/screen-colors.js +56 -8
  35. package/build/components/global-styles/screen-colors.js.map +1 -1
  36. package/build/components/global-styles/screen-link-color.js +48 -14
  37. package/build/components/global-styles/screen-link-color.js.map +1 -1
  38. package/build/components/global-styles/screen-root.js +4 -2
  39. package/build/components/global-styles/screen-root.js.map +1 -1
  40. package/build/components/global-styles/screen-typography-element.js +4 -0
  41. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  42. package/build/components/global-styles/screen-typography.js +9 -1
  43. package/build/components/global-styles/screen-typography.js.map +1 -1
  44. package/build/components/global-styles/ui.js +11 -0
  45. package/build/components/global-styles/ui.js.map +1 -1
  46. package/build/components/global-styles/use-global-styles-output.js +282 -35
  47. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  48. package/build/components/global-styles/utils.js +35 -2
  49. package/build/components/global-styles/utils.js.map +1 -1
  50. package/build/components/header/index.js +29 -10
  51. package/build/components/header/index.js.map +1 -1
  52. package/build/components/header/more-menu/site-export.js +4 -1
  53. package/build/components/header/more-menu/site-export.js.map +1 -1
  54. package/build/components/header/undo-redo/redo.js +13 -4
  55. package/build/components/header/undo-redo/redo.js.map +1 -1
  56. package/build/components/header/undo-redo/undo.js +13 -4
  57. package/build/components/header/undo-redo/undo.js.map +1 -1
  58. package/build/components/keyboard-shortcut-help-modal/config.js +17 -0
  59. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  60. package/build/components/keyboard-shortcut-help-modal/index.js +1 -3
  61. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  62. package/build/components/sidebar/template-card/index.js +19 -7
  63. package/build/components/sidebar/template-card/index.js.map +1 -1
  64. package/build/components/sidebar/template-card/template-actions.js +64 -0
  65. package/build/components/sidebar/template-card/template-actions.js.map +1 -0
  66. package/build/components/template-details/edit-template-title.js +11 -3
  67. package/build/components/template-details/edit-template-title.js.map +1 -1
  68. package/build/components/template-details/index.js +1 -20
  69. package/build/components/template-details/index.js.map +1 -1
  70. package/build/hooks/index.js +2 -0
  71. package/build/hooks/index.js.map +1 -1
  72. package/build/hooks/template-part-edit.js +86 -0
  73. package/build/hooks/template-part-edit.js.map +1 -0
  74. package/build/store/selectors.js +4 -1
  75. package/build/store/selectors.js.map +1 -1
  76. package/build-module/components/add-new-template/add-custom-generic-template-modal.js +77 -0
  77. package/build-module/components/add-new-template/add-custom-generic-template-modal.js.map +1 -0
  78. package/build-module/components/add-new-template/add-custom-template-modal.js +189 -0
  79. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -0
  80. package/build-module/components/add-new-template/new-template.js +90 -34
  81. package/build-module/components/add-new-template/new-template.js.map +1 -1
  82. package/build-module/components/add-new-template/utils.js +503 -0
  83. package/build-module/components/add-new-template/utils.js.map +1 -0
  84. package/build-module/components/block-editor/index.js +1 -2
  85. package/build-module/components/block-editor/index.js.map +1 -1
  86. package/build-module/components/code-editor/index.js +18 -5
  87. package/build-module/components/code-editor/index.js.map +1 -1
  88. package/build-module/components/editor/index.js +16 -0
  89. package/build-module/components/editor/index.js.map +1 -1
  90. package/build-module/components/error-boundary/index.js +5 -0
  91. package/build-module/components/error-boundary/index.js.map +1 -1
  92. package/build-module/components/global-styles/context-menu.js +6 -3
  93. package/build-module/components/global-styles/context-menu.js.map +1 -1
  94. package/build-module/components/global-styles/dimensions-panel.js +185 -20
  95. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  96. package/build-module/components/global-styles/global-styles-provider.js +4 -2
  97. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  98. package/build-module/components/global-styles/hooks.js +11 -2
  99. package/build-module/components/global-styles/hooks.js.map +1 -1
  100. package/build-module/components/global-styles/palette.js +2 -1
  101. package/build-module/components/global-styles/palette.js.map +1 -1
  102. package/build-module/components/global-styles/screen-block-list.js +4 -1
  103. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  104. package/build-module/components/global-styles/screen-button-color.js +67 -0
  105. package/build-module/components/global-styles/screen-button-color.js.map +1 -0
  106. package/build-module/components/global-styles/screen-color-palette.js +14 -19
  107. package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
  108. package/build-module/components/global-styles/screen-colors.js +57 -9
  109. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  110. package/build-module/components/global-styles/screen-link-color.js +47 -14
  111. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  112. package/build-module/components/global-styles/screen-root.js +4 -2
  113. package/build-module/components/global-styles/screen-root.js.map +1 -1
  114. package/build-module/components/global-styles/screen-typography-element.js +4 -0
  115. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  116. package/build-module/components/global-styles/screen-typography.js +10 -2
  117. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  118. package/build-module/components/global-styles/ui.js +10 -0
  119. package/build-module/components/global-styles/ui.js.map +1 -1
  120. package/build-module/components/global-styles/use-global-styles-output.js +280 -42
  121. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  122. package/build-module/components/global-styles/utils.js +34 -3
  123. package/build-module/components/global-styles/utils.js.map +1 -1
  124. package/build-module/components/header/index.js +31 -11
  125. package/build-module/components/header/index.js.map +1 -1
  126. package/build-module/components/header/more-menu/site-export.js +4 -1
  127. package/build-module/components/header/more-menu/site-export.js.map +1 -1
  128. package/build-module/components/header/undo-redo/redo.js +9 -3
  129. package/build-module/components/header/undo-redo/redo.js.map +1 -1
  130. package/build-module/components/header/undo-redo/undo.js +9 -3
  131. package/build-module/components/header/undo-redo/undo.js.map +1 -1
  132. package/build-module/components/keyboard-shortcut-help-modal/config.js +17 -0
  133. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  134. package/build-module/components/keyboard-shortcut-help-modal/index.js +1 -2
  135. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  136. package/build-module/components/sidebar/template-card/index.js +18 -7
  137. package/build-module/components/sidebar/template-card/index.js.map +1 -1
  138. package/build-module/components/sidebar/template-card/template-actions.js +49 -0
  139. package/build-module/components/sidebar/template-card/template-actions.js.map +1 -0
  140. package/build-module/components/template-details/edit-template-title.js +12 -3
  141. package/build-module/components/template-details/edit-template-title.js.map +1 -1
  142. package/build-module/components/template-details/index.js +2 -21
  143. package/build-module/components/template-details/index.js.map +1 -1
  144. package/build-module/hooks/index.js +1 -0
  145. package/build-module/hooks/index.js.map +1 -1
  146. package/build-module/hooks/template-part-edit.js +67 -0
  147. package/build-module/hooks/template-part-edit.js.map +1 -0
  148. package/build-module/store/selectors.js +5 -2
  149. package/build-module/store/selectors.js.map +1 -1
  150. package/build-style/style-rtl.css +198 -49
  151. package/build-style/style.css +198 -49
  152. package/package.json +29 -29
  153. package/src/components/add-new-template/add-custom-generic-template-modal.js +97 -0
  154. package/src/components/add-new-template/add-custom-template-modal.js +247 -0
  155. package/src/components/add-new-template/new-template.js +158 -70
  156. package/src/components/add-new-template/style.scss +149 -0
  157. package/src/components/add-new-template/utils.js +538 -0
  158. package/src/components/block-editor/index.js +0 -2
  159. package/src/components/code-editor/index.js +15 -5
  160. package/src/components/editor/index.js +11 -0
  161. package/src/components/error-boundary/index.js +5 -0
  162. package/src/components/global-styles/context-menu.js +3 -0
  163. package/src/components/global-styles/dimensions-panel.js +209 -21
  164. package/src/components/global-styles/global-styles-provider.js +8 -9
  165. package/src/components/global-styles/hooks.js +18 -0
  166. package/src/components/global-styles/palette.js +4 -1
  167. package/src/components/global-styles/screen-block-list.js +10 -1
  168. package/src/components/global-styles/screen-button-color.js +102 -0
  169. package/src/components/global-styles/screen-color-palette.js +25 -27
  170. package/src/components/global-styles/screen-colors.js +58 -7
  171. package/src/components/global-styles/screen-link-color.js +65 -23
  172. package/src/components/global-styles/screen-root.js +8 -2
  173. package/src/components/global-styles/screen-typography-element.js +4 -0
  174. package/src/components/global-styles/screen-typography.js +17 -2
  175. package/src/components/global-styles/style.scss +14 -8
  176. package/src/components/global-styles/test/use-global-styles-output.js +313 -16
  177. package/src/components/global-styles/ui.js +13 -0
  178. package/src/components/global-styles/use-global-styles-output.js +344 -38
  179. package/src/components/global-styles/utils.js +36 -2
  180. package/src/components/header/index.js +42 -17
  181. package/src/components/header/more-menu/site-export.js +3 -0
  182. package/src/components/header/style.scss +58 -8
  183. package/src/components/header/undo-redo/redo.js +6 -1
  184. package/src/components/header/undo-redo/undo.js +6 -1
  185. package/src/components/keyboard-shortcut-help-modal/config.js +12 -0
  186. package/src/components/keyboard-shortcut-help-modal/index.js +1 -2
  187. package/src/components/keyboard-shortcut-help-modal/style.scss +0 -5
  188. package/src/components/list/style.scss +0 -8
  189. package/src/components/sidebar/style.scss +4 -0
  190. package/src/components/sidebar/template-card/index.js +15 -6
  191. package/src/components/sidebar/template-card/style.scss +49 -35
  192. package/src/components/sidebar/template-card/template-actions.js +43 -0
  193. package/src/components/template-details/edit-template-title.js +10 -2
  194. package/src/components/template-details/index.js +4 -21
  195. package/src/components/test/error-boundary.js +38 -0
  196. package/src/hooks/index.js +1 -0
  197. package/src/hooks/template-part-edit.js +82 -0
  198. package/src/store/selectors.js +11 -5
  199. package/src/style.scss +0 -1
  200. package/build/components/edit-template-part-menu-button/index.js +0 -90
  201. package/build/components/edit-template-part-menu-button/index.js.map +0 -1
  202. package/build-module/components/edit-template-part-menu-button/index.js +0 -72
  203. package/build-module/components/edit-template-part-menu-button/index.js.map +0 -1
  204. package/src/components/edit-template-part-menu-button/index.js +0 -82
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/header/undo-redo/undo.js"],"names":["UndoButton","hasUndo","select","coreStore","undo","undoIcon","redoIcon","displayShortcut","primary","undefined"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AARA;AACA;AACA;AAQe,SAASA,UAAT,GAAsB;AACpC,QAAMC,OAAO,GAAG,qBACbC,MAAF,IAAcA,MAAM,CAAEC,eAAF,CAAN,CAAoBF,OAApB,EADC,EAEf,EAFe,CAAhB;AAIA,QAAM;AAAEG,IAAAA;AAAF,MAAW,uBAAaD,eAAb,CAAjB;AACA,SACC,4BAAC,kBAAD;AACC,IAAA,IAAI,EAAG,CAAE,kBAAF,GAAYE,WAAZ,GAAuBC,WAD/B;AAEC,IAAA,KAAK,EAAG,cAAI,MAAJ,CAFT;AAGC,IAAA,QAAQ,EAAGC,0BAAgBC,OAAhB,CAAyB,GAAzB,CAHZ,CAIC;AACA;AACA;AAND;AAOC,qBAAgB,CAAEP,OAPnB;AAQC,IAAA,OAAO,EAAGA,OAAO,GAAGG,IAAH,GAAUK;AAR5B,IADD;AAYA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { undo as undoIcon, redo as redoIcon } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\n\nexport default function UndoButton() {\n\tconst hasUndo = useSelect(\n\t\t( select ) => select( coreStore ).hasUndo(),\n\t\t[]\n\t);\n\tconst { undo } = useDispatch( coreStore );\n\treturn (\n\t\t<Button\n\t\t\ticon={ ! isRTL() ? undoIcon : redoIcon }\n\t\t\tlabel={ __( 'Undo' ) }\n\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasUndo }\n\t\t\tonClick={ hasUndo ? undo : undefined }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/header/undo-redo/undo.js"],"names":["UndoButton","props","ref","hasUndo","select","coreStore","undo","undoIcon","redoIcon","displayShortcut","primary","undefined"],"mappings":";;;;;;;;;AASA;;;;AANA;;AACA;;AACA;;AACA;;AACA;;AACA;;AARA;AACA;AACA;AASA,SAASA,UAAT,CAAqBC,KAArB,EAA4BC,GAA5B,EAAkC;AACjC,QAAMC,OAAO,GAAG,qBACbC,MAAF,IAAcA,MAAM,CAAEC,eAAF,CAAN,CAAoBF,OAApB,EADC,EAEf,EAFe,CAAhB;AAIA,QAAM;AAAEG,IAAAA;AAAF,MAAW,uBAAaD,eAAb,CAAjB;AACA,SACC,4BAAC,kBAAD,6BACMJ,KADN;AAEC,IAAA,GAAG,EAAGC,GAFP;AAGC,IAAA,IAAI,EAAG,CAAE,kBAAF,GAAYK,WAAZ,GAAuBC,WAH/B;AAIC,IAAA,KAAK,EAAG,cAAI,MAAJ,CAJT;AAKC,IAAA,QAAQ,EAAGC,0BAAgBC,OAAhB,CAAyB,GAAzB,CALZ,CAMC;AACA;AACA;AARD;AASC,qBAAgB,CAAEP,OATnB;AAUC,IAAA,OAAO,EAAGA,OAAO,GAAGG,IAAH,GAAUK;AAV5B,KADD;AAcA;;eAEc,yBAAYX,UAAZ,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { undo as undoIcon, redo as redoIcon } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { forwardRef } from '@wordpress/element';\n\nfunction UndoButton( props, ref ) {\n\tconst hasUndo = useSelect(\n\t\t( select ) => select( coreStore ).hasUndo(),\n\t\t[]\n\t);\n\tconst { undo } = useDispatch( coreStore );\n\treturn (\n\t\t<Button\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\ticon={ ! isRTL() ? undoIcon : redoIcon }\n\t\t\tlabel={ __( 'Undo' ) }\n\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasUndo }\n\t\t\tonClick={ hasUndo ? undo : undefined }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( UndoButton );\n"]}
@@ -34,12 +34,29 @@ const textFormattingShortcuts = [{
34
34
  character: 'k'
35
35
  },
36
36
  description: (0, _i18n.__)('Remove a link.')
37
+ }, {
38
+ keyCombination: {
39
+ character: '[['
40
+ },
41
+ description: (0, _i18n.__)('Insert a link to a post or page')
37
42
  }, {
38
43
  keyCombination: {
39
44
  modifier: 'primary',
40
45
  character: 'u'
41
46
  },
42
47
  description: (0, _i18n.__)('Underline the selected text.')
48
+ }, {
49
+ keyCombination: {
50
+ modifier: 'access',
51
+ character: 'd'
52
+ },
53
+ description: (0, _i18n.__)('Strikethrough the selected text.')
54
+ }, {
55
+ keyCombination: {
56
+ modifier: 'access',
57
+ character: 'x'
58
+ },
59
+ description: (0, _i18n.__)('Make the selected text inline code.')
43
60
  }];
44
61
  exports.textFormattingShortcuts = textFormattingShortcuts;
45
62
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/keyboard-shortcut-help-modal/config.js"],"names":["textFormattingShortcuts","keyCombination","modifier","character","description"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAMA,uBAAuB,GAAG,CACtC;AACCC,EAAAA,cAAc,EAAE;AAAEC,IAAAA,QAAQ,EAAE,SAAZ;AAAuBC,IAAAA,SAAS,EAAE;AAAlC,GADjB;AAECC,EAAAA,WAAW,EAAE,cAAI,8BAAJ;AAFd,CADsC,EAKtC;AACCH,EAAAA,cAAc,EAAE;AAAEC,IAAAA,QAAQ,EAAE,SAAZ;AAAuBC,IAAAA,SAAS,EAAE;AAAlC,GADjB;AAECC,EAAAA,WAAW,EAAE,cAAI,gCAAJ;AAFd,CALsC,EAStC;AACCH,EAAAA,cAAc,EAAE;AAAEC,IAAAA,QAAQ,EAAE,SAAZ;AAAuBC,IAAAA,SAAS,EAAE;AAAlC,GADjB;AAECC,EAAAA,WAAW,EAAE,cAAI,wCAAJ;AAFd,CATsC,EAatC;AACCH,EAAAA,cAAc,EAAE;AAAEC,IAAAA,QAAQ,EAAE,cAAZ;AAA4BC,IAAAA,SAAS,EAAE;AAAvC,GADjB;AAECC,EAAAA,WAAW,EAAE,cAAI,gBAAJ;AAFd,CAbsC,EAiBtC;AACCH,EAAAA,cAAc,EAAE;AAAEC,IAAAA,QAAQ,EAAE,SAAZ;AAAuBC,IAAAA,SAAS,EAAE;AAAlC,GADjB;AAECC,EAAAA,WAAW,EAAE,cAAI,8BAAJ;AAFd,CAjBsC,CAAhC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const textFormattingShortcuts = [\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'b' },\n\t\tdescription: __( 'Make the selected text bold.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'i' },\n\t\tdescription: __( 'Make the selected text italic.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'k' },\n\t\tdescription: __( 'Convert the selected text into a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primaryShift', character: 'k' },\n\t\tdescription: __( 'Remove a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'u' },\n\t\tdescription: __( 'Underline the selected text.' ),\n\t},\n];\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/keyboard-shortcut-help-modal/config.js"],"names":["textFormattingShortcuts","keyCombination","modifier","character","description"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAMA,uBAAuB,GAAG,CACtC;AACCC,EAAAA,cAAc,EAAE;AAAEC,IAAAA,QAAQ,EAAE,SAAZ;AAAuBC,IAAAA,SAAS,EAAE;AAAlC,GADjB;AAECC,EAAAA,WAAW,EAAE,cAAI,8BAAJ;AAFd,CADsC,EAKtC;AACCH,EAAAA,cAAc,EAAE;AAAEC,IAAAA,QAAQ,EAAE,SAAZ;AAAuBC,IAAAA,SAAS,EAAE;AAAlC,GADjB;AAECC,EAAAA,WAAW,EAAE,cAAI,gCAAJ;AAFd,CALsC,EAStC;AACCH,EAAAA,cAAc,EAAE;AAAEC,IAAAA,QAAQ,EAAE,SAAZ;AAAuBC,IAAAA,SAAS,EAAE;AAAlC,GADjB;AAECC,EAAAA,WAAW,EAAE,cAAI,wCAAJ;AAFd,CATsC,EAatC;AACCH,EAAAA,cAAc,EAAE;AAAEC,IAAAA,QAAQ,EAAE,cAAZ;AAA4BC,IAAAA,SAAS,EAAE;AAAvC,GADjB;AAECC,EAAAA,WAAW,EAAE,cAAI,gBAAJ;AAFd,CAbsC,EAiBtC;AACCH,EAAAA,cAAc,EAAE;AAAEE,IAAAA,SAAS,EAAE;AAAb,GADjB;AAECC,EAAAA,WAAW,EAAE,cAAI,iCAAJ;AAFd,CAjBsC,EAqBtC;AACCH,EAAAA,cAAc,EAAE;AAAEC,IAAAA,QAAQ,EAAE,SAAZ;AAAuBC,IAAAA,SAAS,EAAE;AAAlC,GADjB;AAECC,EAAAA,WAAW,EAAE,cAAI,8BAAJ;AAFd,CArBsC,EAyBtC;AACCH,EAAAA,cAAc,EAAE;AAAEC,IAAAA,QAAQ,EAAE,QAAZ;AAAsBC,IAAAA,SAAS,EAAE;AAAjC,GADjB;AAECC,EAAAA,WAAW,EAAE,cAAI,kCAAJ;AAFd,CAzBsC,EA6BtC;AACCH,EAAAA,cAAc,EAAE;AAAEC,IAAAA,QAAQ,EAAE,QAAZ;AAAsBC,IAAAA,SAAS,EAAE;AAAjC,GADjB;AAECC,EAAAA,WAAW,EAAE,cAAI,qCAAJ;AAFd,CA7BsC,CAAhC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const textFormattingShortcuts = [\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'b' },\n\t\tdescription: __( 'Make the selected text bold.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'i' },\n\t\tdescription: __( 'Make the selected text italic.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'k' },\n\t\tdescription: __( 'Convert the selected text into a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primaryShift', character: 'k' },\n\t\tdescription: __( 'Remove a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { character: '[[' },\n\t\tdescription: __( 'Insert a link to a post or page' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'u' },\n\t\tdescription: __( 'Underline the selected text.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: 'd' },\n\t\tdescription: __( 'Strikethrough the selected text.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: 'x' },\n\t\tdescription: __( 'Make the selected text inline code.' ),\n\t},\n];\n"]}
@@ -11,8 +11,6 @@ var _element = require("@wordpress/element");
11
11
 
12
12
  var _classnames = _interopRequireDefault(require("classnames"));
13
13
 
14
- var _lodash = require("lodash");
15
-
16
14
  var _components = require("@wordpress/components");
17
15
 
18
16
  var _i18n = require("@wordpress/i18n");
@@ -55,7 +53,7 @@ const ShortcutList = _ref => {
55
53
  }, shortcuts.map((shortcut, index) => (0, _element.createElement)("li", {
56
54
  className: "edit-site-keyboard-shortcut-help-modal__shortcut",
57
55
  key: index
58
- }, (0, _lodash.isString)(shortcut) ? (0, _element.createElement)(_dynamicShortcut.default, {
56
+ }, typeof shortcut === 'string' ? (0, _element.createElement)(_dynamicShortcut.default, {
59
57
  name: shortcut
60
58
  }) : (0, _element.createElement)(_shortcut.default, shortcut))))
61
59
  /* eslint-enable jsx-a11y/no-redundant-roles */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/keyboard-shortcut-help-modal/index.js"],"names":["ShortcutList","shortcuts","map","shortcut","index","ShortcutSection","title","className","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","select","keyboardShortcutsStore","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","toggleModal","keyCombination","character","description","ariaLabel","textFormattingShortcuts"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAK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AAGK,iBAAiB,CAACI,MAAlB,CAA0BL,mBAA1B;AAFb,IADD;AAMA,CApBD;;AAsBe,SAASM,yBAAT,QAGX;AAAA,MAH+C;AAClDC,IAAAA,aADkD;AAElDC,IAAAA;AAFkD,GAG/C;;AACH,MAAK,CAAED,aAAP,EAAuB;AACtB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,iBAAD;AACC,IAAA,SAAS,EAAC,wCADX;AAEC,IAAA,KAAK,EAAG,cAAI,oBAAJ,CAFT;AAGC,IAAA,UAAU,EAAG,cAAI,OAAJ,CAHd;AAIC,IAAA,cAAc,EAAGC;AAJlB,KAMC,4BAAC,eAAD;AACC,IAAA,SAAS,EAAC,wDADX;AAEC,IAAA,SAAS,EAAG,CAAE,mCAAF;AAFb,IAND,EAUC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,kBAAJ,CADT;AAEC,IAAA,YAAY,EAAC;AAFd,IAVD,EAeC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,qBAAJ,CADT;AAEC,IAAA,YAAY,EAAC;AAFd,IAfD,EAoBC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,iBAAJ,CADT;AAEC,IAAA,YAAY,EAAC,OAFd;AAGC,IAAA,mBAAmB,EAAG,CACrB;AACCC,MAAAA,cAAc,EAAE;AAAEC,QAAAA,SAAS,EAAE;AAAb,OADjB;AAECC,MAAAA,WAAW,EAAE,cACZ,qDADY,CAFd;;AAKC;AACAC,MAAAA,SAAS,EAAE,cAAI,eAAJ;AANZ,KADqB;AAHvB,IApBD,EAkCC,4BAAC,eAAD;AACC,IAAA,KAAK,EAAG,cAAI,iBAAJ,CADT;AAEC,IAAA,SAAS,EAAGC;AAFb,IAlCD,CADD;AAyCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { isString } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { textFormattingShortcuts } from './config';\nimport Shortcut from './shortcut';\nimport DynamicShortcut from './dynamic-shortcut';\n\nconst ShortcutList = ( { shortcuts } ) => (\n\t/*\n\t * Disable reason: The `list` ARIA role is redundant but\n\t * Safari+VoiceOver won't announce the list otherwise.\n\t */\n\t/* eslint-disable jsx-a11y/no-redundant-roles */\n\t<ul\n\t\tclassName=\"edit-site-keyboard-shortcut-help-modal__shortcut-list\"\n\t\trole=\"list\"\n\t>\n\t\t{ shortcuts.map( ( shortcut, index ) => (\n\t\t\t<li\n\t\t\t\tclassName=\"edit-site-keyboard-shortcut-help-modal__shortcut\"\n\t\t\t\tkey={ index }\n\t\t\t>\n\t\t\t\t{ isString( shortcut ) ? (\n\t\t\t\t\t<DynamicShortcut name={ shortcut } />\n\t\t\t\t) : (\n\t\t\t\t\t<Shortcut { ...shortcut } />\n\t\t\t\t) }\n\t\t\t</li>\n\t\t) ) }\n\t</ul>\n\t/* eslint-enable jsx-a11y/no-redundant-roles */\n);\n\nconst ShortcutSection = ( { title, shortcuts, className } ) => (\n\t<section\n\t\tclassName={ classnames(\n\t\t\t'edit-site-keyboard-shortcut-help-modal__section',\n\t\t\tclassName\n\t\t) }\n\t>\n\t\t{ !! title && (\n\t\t\t<h2 className=\"edit-site-keyboard-shortcut-help-modal__section-title\">\n\t\t\t\t{ title }\n\t\t\t</h2>\n\t\t) }\n\t\t<ShortcutList shortcuts={ shortcuts } />\n\t</section>\n);\n\nconst ShortcutCategorySection = ( {\n\ttitle,\n\tcategoryName,\n\tadditionalShortcuts = [],\n} ) => {\n\tconst categoryShortcuts = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( keyboardShortcutsStore ).getCategoryShortcuts(\n\t\t\t\tcategoryName\n\t\t\t);\n\t\t},\n\t\t[ categoryName ]\n\t);\n\n\treturn (\n\t\t<ShortcutSection\n\t\t\ttitle={ title }\n\t\t\tshortcuts={ categoryShortcuts.concat( additionalShortcuts ) }\n\t\t/>\n\t);\n};\n\nexport default function KeyboardShortcutHelpModal( {\n\tisModalActive,\n\ttoggleModal,\n} ) {\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"edit-site-keyboard-shortcut-help-modal\"\n\t\t\ttitle={ __( 'Keyboard shortcuts' ) }\n\t\t\tcloseLabel={ __( 'Close' ) }\n\t\t\tonRequestClose={ toggleModal }\n\t\t>\n\t\t\t<ShortcutSection\n\t\t\t\tclassName=\"edit-site-keyboard-shortcut-help-modal__main-shortcuts\"\n\t\t\t\tshortcuts={ [ 'core/edit-site/keyboard-shortcuts' ] }\n\t\t\t/>\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Global shortcuts' ) }\n\t\t\t\tcategoryName=\"global\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Selection shortcuts' ) }\n\t\t\t\tcategoryName=\"selection\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Block shortcuts' ) }\n\t\t\t\tcategoryName=\"block\"\n\t\t\t\tadditionalShortcuts={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tkeyCombination: { character: '/' },\n\t\t\t\t\t\tdescription: __(\n\t\t\t\t\t\t\t'Change the block type after adding a new paragraph.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t/* translators: The forward-slash character. e.g. '/'. */\n\t\t\t\t\t\tariaLabel: __( 'Forward-slash' ),\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t/>\n\t\t\t<ShortcutSection\n\t\t\t\ttitle={ __( 'Text formatting' ) }\n\t\t\t\tshortcuts={ textFormattingShortcuts }\n\t\t\t/>\n\t\t</Modal>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/keyboard-shortcut-help-modal/index.js"],"names":["ShortcutList","shortcuts","map","shortcut","index","ShortcutSection","title","className","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","select","keyboardShortcutsStore","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","toggleModal","keyCombination","character","description","ariaLabel","textFormattingShortcuts"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAKA,MAAMA,YAAY,GAAG;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA;AACpB;AACD;AACA;AACA;;AACC;AACA;AACC,MAAA,SAAS,EAAC,uDADX;AAEC,MAAA,IAAI,EAAC;AAFN,OAIGA,SAAS,CAACC,GAAV,CAAe,CAAEC,QAAF,EAAYC,KAAZ,KAChB;AACC,MAAA,SAAS,EAAC,kDADX;AAEC,MAAA,GAAG,EAAGA;AAFP,OAIG,OAAOD,QAAP,KAAoB,QAApB,GACD,4BAAC,wBAAD;AAAiB,MAAA,IAAI,EAAGA;AAAxB,MADC,GAGD,4BAAC,iBAAD,EAAeA,QAAf,CAPF,CADC,CAJH;AAiBA;;AAvBoB;AAAA,CAArB;;AA0BA,MAAME,eAAe,GAAG;AAAA,MAAE;AAAEC,IAAAA,KAAF;AAASL,IAAAA,SAAT;AAAoBM,IAAAA;AAApB,GAAF;AAAA,SACvB;AACC,IAAA,SAAS,EAAG,yBACX,iDADW,EAEXA,SAFW;AADb,KAMG,CAAC,CAAED,KAAH,IACD;AAAI,IAAA,SAAS,EAAC;AAAd,KACGA,KADH,CAPF,EAWC,4BAAC,YAAD;AAAc,IAAA,SAAS,EAAGL;AAA1B,IAXD,CADuB;AAAA,CAAxB;;AAgBA,MAAMO,uBAAuB,GAAG,SAIzB;AAAA,MAJ2B;AACjCF,IAAAA,KADiC;AAEjCG,IAAAA,YAFiC;AAGjCC,IAAAA,mBAAmB,GAAG;AAHW,GAI3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AAC,eAAD;AACC,IAAA,KAAK,EAAG,cAAI,iBAAJ,CADT;AAEC,IAAA,SAAS,EAAGC;AAFb,IAlCD,CADD;AAyCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { textFormattingShortcuts } from './config';\nimport Shortcut from './shortcut';\nimport DynamicShortcut from './dynamic-shortcut';\n\nconst ShortcutList = ( { shortcuts } ) => (\n\t/*\n\t * Disable reason: The `list` ARIA role is redundant but\n\t * Safari+VoiceOver won't announce the list otherwise.\n\t */\n\t/* eslint-disable jsx-a11y/no-redundant-roles */\n\t<ul\n\t\tclassName=\"edit-site-keyboard-shortcut-help-modal__shortcut-list\"\n\t\trole=\"list\"\n\t>\n\t\t{ shortcuts.map( ( shortcut, index ) => (\n\t\t\t<li\n\t\t\t\tclassName=\"edit-site-keyboard-shortcut-help-modal__shortcut\"\n\t\t\t\tkey={ index }\n\t\t\t>\n\t\t\t\t{ typeof shortcut === 'string' ? (\n\t\t\t\t\t<DynamicShortcut name={ shortcut } />\n\t\t\t\t) : (\n\t\t\t\t\t<Shortcut { ...shortcut } />\n\t\t\t\t) }\n\t\t\t</li>\n\t\t) ) }\n\t</ul>\n\t/* eslint-enable jsx-a11y/no-redundant-roles */\n);\n\nconst ShortcutSection = ( { title, shortcuts, className } ) => (\n\t<section\n\t\tclassName={ classnames(\n\t\t\t'edit-site-keyboard-shortcut-help-modal__section',\n\t\t\tclassName\n\t\t) }\n\t>\n\t\t{ !! title && (\n\t\t\t<h2 className=\"edit-site-keyboard-shortcut-help-modal__section-title\">\n\t\t\t\t{ title }\n\t\t\t</h2>\n\t\t) }\n\t\t<ShortcutList shortcuts={ shortcuts } />\n\t</section>\n);\n\nconst ShortcutCategorySection = ( {\n\ttitle,\n\tcategoryName,\n\tadditionalShortcuts = [],\n} ) => {\n\tconst categoryShortcuts = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( keyboardShortcutsStore ).getCategoryShortcuts(\n\t\t\t\tcategoryName\n\t\t\t);\n\t\t},\n\t\t[ categoryName ]\n\t);\n\n\treturn (\n\t\t<ShortcutSection\n\t\t\ttitle={ title }\n\t\t\tshortcuts={ categoryShortcuts.concat( additionalShortcuts ) }\n\t\t/>\n\t);\n};\n\nexport default function KeyboardShortcutHelpModal( {\n\tisModalActive,\n\ttoggleModal,\n} ) {\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"edit-site-keyboard-shortcut-help-modal\"\n\t\t\ttitle={ __( 'Keyboard shortcuts' ) }\n\t\t\tcloseLabel={ __( 'Close' ) }\n\t\t\tonRequestClose={ toggleModal }\n\t\t>\n\t\t\t<ShortcutSection\n\t\t\t\tclassName=\"edit-site-keyboard-shortcut-help-modal__main-shortcuts\"\n\t\t\t\tshortcuts={ [ 'core/edit-site/keyboard-shortcuts' ] }\n\t\t\t/>\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Global shortcuts' ) }\n\t\t\t\tcategoryName=\"global\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Selection shortcuts' ) }\n\t\t\t\tcategoryName=\"selection\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Block shortcuts' ) }\n\t\t\t\tcategoryName=\"block\"\n\t\t\t\tadditionalShortcuts={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tkeyCombination: { character: '/' },\n\t\t\t\t\t\tdescription: __(\n\t\t\t\t\t\t\t'Change the block type after adding a new paragraph.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t/* translators: The forward-slash character. e.g. '/'. */\n\t\t\t\t\t\tariaLabel: __( 'Forward-slash' ),\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t/>\n\t\t\t<ShortcutSection\n\t\t\t\ttitle={ __( 'Text formatting' ) }\n\t\t\t\tshortcuts={ textFormattingShortcuts }\n\t\t\t/>\n\t\t</Modal>\n\t);\n}\n"]}
@@ -19,6 +19,8 @@ var _coreData = require("@wordpress/core-data");
19
19
 
20
20
  var _store = require("../../../store");
21
21
 
22
+ var _templateActions = _interopRequireDefault(require("./template-actions"));
23
+
22
24
  var _templateAreas = _interopRequireDefault(require("./template-areas"));
23
25
 
24
26
  /**
@@ -30,25 +32,31 @@ var _templateAreas = _interopRequireDefault(require("./template-areas"));
30
32
  */
31
33
  function TemplateCard() {
32
34
  const {
33
- title,
34
- description,
35
- icon
35
+ info: {
36
+ title,
37
+ description,
38
+ icon
39
+ },
40
+ template
36
41
  } = (0, _data.useSelect)(select => {
37
42
  const {
38
43
  getEditedPostType,
39
44
  getEditedPostId
40
45
  } = select(_store.store);
41
46
  const {
42
- getEntityRecord
47
+ getEditedEntityRecord
43
48
  } = select(_coreData.store);
44
49
  const {
45
50
  __experimentalGetTemplateInfo: getTemplateInfo
46
51
  } = select(_editor.store);
47
52
  const postType = getEditedPostType();
48
53
  const postId = getEditedPostId();
49
- const record = getEntityRecord('postType', postType, postId);
54
+ const record = getEditedEntityRecord('postType', postType, postId);
50
55
  const info = record ? getTemplateInfo(record) : {};
51
- return info;
56
+ return {
57
+ info,
58
+ template: record
59
+ };
52
60
  }, []);
53
61
 
54
62
  if (!title && !description) {
@@ -62,9 +70,13 @@ function TemplateCard() {
62
70
  icon: icon
63
71
  }), (0, _element.createElement)("div", {
64
72
  className: "edit-site-template-card__content"
73
+ }, (0, _element.createElement)("div", {
74
+ className: "edit-site-template-card__header"
65
75
  }, (0, _element.createElement)("h2", {
66
76
  className: "edit-site-template-card__title"
67
- }, title), (0, _element.createElement)("div", {
77
+ }, title), (0, _element.createElement)(_templateActions.default, {
78
+ template: template
79
+ })), (0, _element.createElement)("div", {
68
80
  className: "edit-site-template-card__description"
69
81
  }, description), (0, _element.createElement)(_templateAreas.default, null)));
70
82
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/template-card/index.js"],"names":["TemplateCard","title","description","icon","select","getEditedPostType","getEditedPostId","editSiteStore","getEntityRecord","coreStore","__experimentalGetTemplateInfo","getTemplateInfo","editorStore","postType","postId","record","info"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAZA;AACA;AACA;;AAMA;AACA;AACA;AAIe,SAASA,YAAT,GAAwB;AACtC,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA,WAAT;AAAsBC,IAAAA;AAAtB,MAA+B,qBAAaC,MAAF,IAAc;AAC7D,UAAM;AAAEC,MAAAA,iBAAF;AAAqBC,MAAAA;AAArB,QAAyCF,MAAM,CAAEG,YAAF,CAArD;AACA,UAAM;AAAEC,MAAAA;AAAF,QAAsBJ,MAAM,CAAEK,eAAF,CAAlC;AACA,UAAM;AAAEC,MAAAA,6BAA6B,EAAEC;AAAjC,QACLP,MAAM,CAAEQ,aAAF,CADP;AAGA,UAAMC,QAAQ,GAAGR,iBAAiB,EAAlC;AACA,UAAMS,MAAM,GAAGR,eAAe,EAA9B;AACA,UAAMS,MAAM,GAAGP,eAAe,CAAE,UAAF,EAAcK,QAAd,EAAwBC,MAAxB,CAA9B;AACA,UAAME,IAAI,GAAGD,MAAM,GAAGJ,eAAe,CAAEI,MAAF,CAAlB,GAA+B,EAAlD;AAEA,WAAOC,IAAP;AACA,GAZoC,EAYlC,EAZkC,CAArC;;AAcA,MAAK,CAAEf,KAAF,IAAW,CAAEC,WAAlB,EAAgC;AAC/B,WAAO,IAAP;AACA;;AAED,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,gBAAD;AAAM,IAAA,SAAS,EAAC,+BAAhB;AAAgD,IAAA,IAAI,EAAGC;AAAvD,IADD,EAEC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAI,IAAA,SAAS,EAAC;AAAd,KAAiDF,KAAjD,CADD,EAEC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGC,WADH,CAFD,EAMC,4BAAC,sBAAD,OAND,CAFD,CADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { Icon } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport TemplateAreas from './template-areas';\n\nexport default function TemplateCard() {\n\tconst { title, description, icon } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId } = select( editSiteStore );\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst { __experimentalGetTemplateInfo: getTemplateInfo } =\n\t\t\tselect( editorStore );\n\n\t\tconst postType = getEditedPostType();\n\t\tconst postId = getEditedPostId();\n\t\tconst record = getEntityRecord( 'postType', postType, postId );\n\t\tconst info = record ? getTemplateInfo( record ) : {};\n\n\t\treturn info;\n\t}, [] );\n\n\tif ( ! title && ! description ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"edit-site-template-card\">\n\t\t\t<Icon className=\"edit-site-template-card__icon\" icon={ icon } />\n\t\t\t<div className=\"edit-site-template-card__content\">\n\t\t\t\t<h2 className=\"edit-site-template-card__title\">{ title }</h2>\n\t\t\t\t<div className=\"edit-site-template-card__description\">\n\t\t\t\t\t{ description }\n\t\t\t\t</div>\n\n\t\t\t\t<TemplateAreas />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/template-card/index.js"],"names":["TemplateCard","info","title","description","icon","template","select","getEditedPostType","getEditedPostId","editSiteStore","getEditedEntityRecord","coreStore","__experimentalGetTemplateInfo","getTemplateInfo","editorStore","postType","postId","record"],"mappings":";;;;;;;;;;;AAGA;;AACA;;A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AAK,IAAA,SAAS,EAAC;AAAf,KACGF,WADH,CAPD,EAUC,4BAAC,sBAAD,OAVD,CAFD,CADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { Icon } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport TemplateActions from './template-actions';\nimport TemplateAreas from './template-areas';\n\nexport default function TemplateCard() {\n\tconst {\n\t\tinfo: { title, description, icon },\n\t\ttemplate,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId } = select( editSiteStore );\n\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\tconst { __experimentalGetTemplateInfo: getTemplateInfo } =\n\t\t\tselect( editorStore );\n\n\t\tconst postType = getEditedPostType();\n\t\tconst postId = getEditedPostId();\n\t\tconst record = getEditedEntityRecord( 'postType', postType, postId );\n\n\t\tconst info = record ? getTemplateInfo( record ) : {};\n\n\t\treturn { info, template: record };\n\t}, [] );\n\n\tif ( ! title && ! description ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"edit-site-template-card\">\n\t\t\t<Icon className=\"edit-site-template-card__icon\" icon={ icon } />\n\t\t\t<div className=\"edit-site-template-card__content\">\n\t\t\t\t<div className=\"edit-site-template-card__header\">\n\t\t\t\t\t<h2 className=\"edit-site-template-card__title\">\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</h2>\n\t\t\t\t\t<TemplateActions template={ template } />\n\t\t\t\t</div>\n\t\t\t\t<div className=\"edit-site-template-card__description\">\n\t\t\t\t\t{ description }\n\t\t\t\t</div>\n\t\t\t\t<TemplateAreas />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = Actions;
9
+
10
+ var _element = require("@wordpress/element");
11
+
12
+ var _data = require("@wordpress/data");
13
+
14
+ var _i18n = require("@wordpress/i18n");
15
+
16
+ var _components = require("@wordpress/components");
17
+
18
+ var _icons = require("@wordpress/icons");
19
+
20
+ var _store = require("../../../store");
21
+
22
+ var _isTemplateRevertable = _interopRequireDefault(require("../../../utils/is-template-revertable"));
23
+
24
+ /**
25
+ * WordPress dependencies
26
+ */
27
+
28
+ /**
29
+ * Internal dependencies
30
+ */
31
+ function Actions(_ref) {
32
+ let {
33
+ template
34
+ } = _ref;
35
+ const {
36
+ revertTemplate
37
+ } = (0, _data.useDispatch)(_store.store);
38
+ const isRevertable = (0, _isTemplateRevertable.default)(template);
39
+
40
+ if (!isRevertable) {
41
+ return null;
42
+ }
43
+
44
+ return (0, _element.createElement)(_components.DropdownMenu, {
45
+ icon: _icons.moreVertical,
46
+ label: (0, _i18n.__)('Actions'),
47
+ className: "edit-site-template-card__actions",
48
+ toggleProps: {
49
+ isSmall: true
50
+ }
51
+ }, _ref2 => {
52
+ let {
53
+ onClose
54
+ } = _ref2;
55
+ return (0, _element.createElement)(_components.MenuGroup, null, (0, _element.createElement)(_components.MenuItem, {
56
+ info: (0, _i18n.__)('Restore to default state'),
57
+ onClick: () => {
58
+ revertTemplate(template);
59
+ onClose();
60
+ }
61
+ }, (0, _i18n.__)('Clear customizations')));
62
+ });
63
+ }
64
+ //# sourceMappingURL=template-actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/template-card/template-actions.js"],"names":["Actions","template","revertTemplate","editSiteStore","isRevertable","moreVertical","isSmall","onClose"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAZA;AACA;AACA;;AAMA;AACA;AACA;AAIe,SAASA,OAAT,OAAiC;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AAC/C,QAAM;AAAEC,IAAAA;AAAF,MAAqB,uBAAaC,YAAb,CAA3B;AACA,QAAMC,YAAY,GAAG,mCAAsBH,QAAtB,CAArB;;AACA,MAAK,CAAEG,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AACD,SACC,4BAAC,wBAAD;AACC,IAAA,IAAI,EAAGC,mBADR;AAEC,IAAA,KAAK,EAAG,cAAI,SAAJ,CAFT;AAGC,IAAA,SAAS,EAAC,kCAHX;AAIC,IAAA,WAAW,EAAG;AAAEC,MAAAA,OAAO,EAAE;AAAX;AAJf,KAMG;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WACD,4BAAC,qBAAD,QACC,4BAAC,oBAAD;AACC,MAAA,IAAI,EAAG,cAAI,0BAAJ,CADR;AAEC,MAAA,OAAO,EAAG,MAAM;AACfL,QAAAA,cAAc,CAAED,QAAF,CAAd;AACAM,QAAAA,OAAO;AACP;AALF,OAOG,cAAI,sBAAJ,CAPH,CADD,CADC;AAAA,GANH,CADD;AAsBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport isTemplateRevertable from '../../../utils/is-template-revertable';\n\nexport default function Actions( { template } ) {\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\tconst isRevertable = isTemplateRevertable( template );\n\tif ( ! isRevertable ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Actions' ) }\n\t\t\tclassName=\"edit-site-template-card__actions\"\n\t\t\ttoggleProps={ { isSmall: true } }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tinfo={ __( 'Restore to default state' ) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\trevertTemplate( template );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"]}
@@ -20,14 +20,22 @@ function EditTemplateTitle(_ref) {
20
20
  let {
21
21
  template
22
22
  } = _ref;
23
+ const [forceEmpty, setForceEmpty] = (0, _element.useState)(false);
23
24
  const [title, setTitle] = (0, _coreData.useEntityProp)('postType', template.type, 'title', template.id);
24
25
  return (0, _element.createElement)(_components.TextControl, {
25
26
  label: (0, _i18n.__)('Title'),
26
- value: title,
27
+ value: forceEmpty ? '' : title,
27
28
  help: (0, _i18n.__)('Give the template a title that indicates its purpose, e.g. "Full Width".'),
28
29
  onChange: newTitle => {
29
- setTitle(newTitle || template.slug);
30
- }
30
+ if (!newTitle && !forceEmpty) {
31
+ setForceEmpty(true);
32
+ return;
33
+ }
34
+
35
+ setForceEmpty(false);
36
+ setTitle(newTitle);
37
+ },
38
+ onBlur: () => setForceEmpty(false)
31
39
  });
32
40
  }
33
41
  //# sourceMappingURL=edit-template-title.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/template-details/edit-template-title.js"],"names":["EditTemplateTitle","template","title","setTitle","type","id","newTitle","slug"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;AAKe,SAASA,iBAAT,OAA2C;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACzD,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsB,6BAC3B,UAD2B,EAE3BF,QAAQ,CAACG,IAFkB,EAG3B,OAH2B,EAI3BH,QAAQ,CAACI,EAJkB,CAA5B;AAOA,SACC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,OAAJ,CADT;AAEC,IAAA,KAAK,EAAGH,KAFT;AAGC,IAAA,IAAI,EAAG,cACN,0EADM,CAHR;AAMC,IAAA,QAAQ,EAAKI,QAAF,IAAgB;AAC1BH,MAAAA,QAAQ,CAAEG,QAAQ,IAAIL,QAAQ,CAACM,IAAvB,CAAR;AACA;AARF,IADD;AAYA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { TextControl } from '@wordpress/components';\nimport { useEntityProp } from '@wordpress/core-data';\n\nexport default function EditTemplateTitle( { template } ) {\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\ttemplate.type,\n\t\t'title',\n\t\ttemplate.id\n\t);\n\n\treturn (\n\t\t<TextControl\n\t\t\tlabel={ __( 'Title' ) }\n\t\t\tvalue={ title }\n\t\t\thelp={ __(\n\t\t\t\t'Give the template a title that indicates its purpose, e.g. \"Full Width\".'\n\t\t\t) }\n\t\t\tonChange={ ( newTitle ) => {\n\t\t\t\tsetTitle( newTitle || template.slug );\n\t\t\t} }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/template-details/edit-template-title.js"],"names":["EditTemplateTitle","template","forceEmpty","setForceEmpty","title","setTitle","type","id","newTitle"],"mappings":";;;;;;;AAMA;;AAHA;;AACA;;AACA;;AALA;AACA;AACA;AAMe,SAASA,iBAAT,OAA2C;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACzD,QAAM,CAAEC,UAAF,EAAcC,aAAd,IAAgC,uBAAU,KAAV,CAAtC;AACA,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsB,6BAC3B,UAD2B,EAE3BJ,QAAQ,CAACK,IAFkB,EAG3B,OAH2B,EAI3BL,QAAQ,CAACM,EAJkB,CAA5B;AAOA,SACC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,OAAJ,CADT;AAEC,IAAA,KAAK,EAAGL,UAAU,GAAG,EAAH,GAAQE,KAF3B;AAGC,IAAA,IAAI,EAAG,cACN,0EADM,CAHR;AAMC,IAAA,QAAQ,EAAKI,QAAF,IAAgB;AAC1B,UAAK,CAAEA,QAAF,IAAc,CAAEN,UAArB,EAAkC;AACjCC,QAAAA,aAAa,CAAE,IAAF,CAAb;AACA;AACA;;AACDA,MAAAA,aAAa,CAAE,KAAF,CAAb;AACAE,MAAAA,QAAQ,CAAEG,QAAF,CAAR;AACA,KAbF;AAcC,IAAA,MAAM,EAAG,MAAML,aAAa,CAAE,KAAF;AAd7B,IADD;AAkBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { TextControl } from '@wordpress/components';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\n\nexport default function EditTemplateTitle( { template } ) {\n\tconst [ forceEmpty, setForceEmpty ] = useState( false );\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\ttemplate.type,\n\t\t'title',\n\t\ttemplate.id\n\t);\n\n\treturn (\n\t\t<TextControl\n\t\t\tlabel={ __( 'Title' ) }\n\t\t\tvalue={ forceEmpty ? '' : title }\n\t\t\thelp={ __(\n\t\t\t\t'Give the template a title that indicates its purpose, e.g. \"Full Width\".'\n\t\t\t) }\n\t\t\tonChange={ ( newTitle ) => {\n\t\t\t\tif ( ! newTitle && ! forceEmpty ) {\n\t\t\t\t\tsetForceEmpty( true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tsetForceEmpty( false );\n\t\t\t\tsetTitle( newTitle );\n\t\t\t} }\n\t\t\tonBlur={ () => setForceEmpty( false ) }\n\t\t/>\n\t);\n}\n"]}
@@ -21,8 +21,6 @@ var _editor = require("@wordpress/editor");
21
21
 
22
22
  var _isTemplateRevertable = _interopRequireDefault(require("../../utils/is-template-revertable"));
23
23
 
24
- var _constants = require("../navigation-sidebar/navigation-panel/constants");
25
-
26
24
  var _store = require("../../store");
27
25
 
28
26
  var _templateAreas = _interopRequireDefault(require("./template-areas"));
@@ -50,21 +48,6 @@ function TemplateDetails(_ref) {
50
48
  const {
51
49
  revertTemplate
52
50
  } = (0, _data.useDispatch)(_store.store);
53
- const templateSubMenu = (0, _element.useMemo)(() => {
54
- if ((template === null || template === void 0 ? void 0 : template.type) === 'wp_template') {
55
- return {
56
- title: (0, _i18n.__)('templates'),
57
- menu: _constants.MENU_TEMPLATES
58
- };
59
- }
60
-
61
- return _constants.TEMPLATE_PARTS_SUB_MENUS.find(_ref2 => {
62
- let {
63
- area
64
- } = _ref2;
65
- return area === (template === null || template === void 0 ? void 0 : template.area);
66
- });
67
- }, [template]);
68
51
  const browseAllLinkProps = (0, _link.useLink)({
69
52
  // TODO: We should update this to filter by template part's areas as well.
70
53
  postType: template.type,
@@ -106,8 +89,6 @@ function TemplateDetails(_ref) {
106
89
  onClick: revert
107
90
  }, (0, _i18n.__)('Clear customizations'))), (0, _element.createElement)(_components.Button, (0, _extends2.default)({
108
91
  className: "edit-site-template-details__show-all-button"
109
- }, browseAllLinkProps), (0, _i18n.sprintf)(
110
- /* translators: the template part's area name ("Headers", "Sidebars") or "templates". */
111
- (0, _i18n.__)('Browse all %s'), templateSubMenu.title)));
92
+ }, browseAllLinkProps), (template === null || template === void 0 ? void 0 : template.type) === 'wp_template' ? (0, _i18n.__)('Browse all templates') : (0, _i18n.__)('Browse all template parts')));
112
93
  }
113
94
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["TemplateDetails","template","onClose","title","description","select","editorStore","__experimentalGetTemplateInfo","revertTemplate","editSiteStore","templateSubMenu","type","menu","MENU_TEMPLATES","TEMPLATE_PARTS_SUB_MENUS","find","area","browseAllLinkProps","postType","postId","undefined","canEditTitle","is_custom","has_theme_file","revert"],"mappings":";;;;;;;;;AAGA;;;;AACA;;AACA;;AAOA;;AACA;;AAKA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AA1BA;AACA;AACA;;AAaA;AAC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ACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGmB,YAAY,GACb,4BAAC,0BAAD;AAAmB,IAAA,QAAQ,EAAGpB;AAA9B,IADa,GAGb,4BAAC,iCAAD;AACC,IAAA,KAAK,EAAG,CADT;AAEC,IAAA,MAAM,EAAG,GAFV;AAGC,IAAA,SAAS,EAAC;AAHX,KAKGE,KALH,CAJF,EAaGC,WAAW,IACZ,4BAAC,8BAAD;AACC,IAAA,IAAI,EAAC,MADN;AAEC,IAAA,SAAS,EAAC,yCAFX;AAGC,IAAA,EAAE,EAAC;AAHJ,KAKGA,WALH,CAdF,CADD,EAyBC,4BAAC,sBAAD;AAAe,IAAA,4BAA4B,EAAGF;AAA9C,IAzBD,EA2BG,mCAAsBD,QAAtB,KACD,4BAAC,qBAAD;AAAW,IAAA,SAAS,EAAC;AAArB,KACC,4BAAC,oBAAD;AACC,IAAA,SAAS,EAAC,2CADX;AAEC,IAAA,IAAI,EAAG,cAAI,mCAAJ,CAFR;AAGC,IAAA,OAAO,EAAGuB;AAHX,KAKG,cAAI,sBAAJ,CALH,CADD,CA5BF,EAuCC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC;AADX,KAEMP,kBAFN,GAIG;AACD;AACA,gBAAI,eAAJ,CAFC,EAGDP,eAAe,CAACP,KAHf,CAJH,CAvCD,CADD;AAoDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport {\n\tMENU_TEMPLATES,\n\tTEMPLATE_PARTS_SUB_MENUS,\n} from '../navigation-sidebar/navigation-panel/constants';\nimport { store as editSiteStore } from '../../store';\nimport TemplateAreas from './template-areas';\nimport EditTemplateTitle from './edit-template-title';\nimport { useLink } from '../routes/link';\n\nexport default function TemplateDetails( { template, onClose } ) {\n\tconst { title, description } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetTemplateInfo( template ),\n\t\t[]\n\t);\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\n\tconst templateSubMenu = useMemo( () => {\n\t\tif ( template?.type === 'wp_template' ) {\n\t\t\treturn { title: __( 'templates' ), menu: MENU_TEMPLATES };\n\t\t}\n\n\t\treturn TEMPLATE_PARTS_SUB_MENUS.find(\n\t\t\t( { area } ) => area === template?.area\n\t\t);\n\t}, [ template ] );\n\n\tconst browseAllLinkProps = useLink( {\n\t\t// TODO: We should update this to filter by template part's areas as well.\n\t\tpostType: template.type,\n\t\tpostId: undefined,\n\t} );\n\n\t// Only user-created and non-default templates can change the name.\n\tconst canEditTitle = template.is_custom && ! template.has_theme_file;\n\n\tif ( ! template ) {\n\t\treturn null;\n\t}\n\n\tconst revert = () => {\n\t\trevertTemplate( template );\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<div className=\"edit-site-template-details\">\n\t\t\t<div className=\"edit-site-template-details__group\">\n\t\t\t\t{ canEditTitle ? (\n\t\t\t\t\t<EditTemplateTitle template={ template } />\n\t\t\t\t) : (\n\t\t\t\t\t<Heading\n\t\t\t\t\t\tlevel={ 4 }\n\t\t\t\t\t\tweight={ 600 }\n\t\t\t\t\t\tclassName=\"edit-site-template-details__title\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</Heading>\n\t\t\t\t) }\n\n\t\t\t\t{ description && (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize=\"body\"\n\t\t\t\t\t\tclassName=\"edit-site-template-details__description\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</div>\n\n\t\t\t<TemplateAreas closeTemplateDetailsDropdown={ onClose } />\n\n\t\t\t{ isTemplateRevertable( template ) && (\n\t\t\t\t<MenuGroup className=\"edit-site-template-details__group edit-site-template-details__revert\">\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tclassName=\"edit-site-template-details__revert-button\"\n\t\t\t\t\t\tinfo={ __( 'Restore template to default state' ) }\n\t\t\t\t\t\tonClick={ revert }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-template-details__show-all-button\"\n\t\t\t\t{ ...browseAllLinkProps }\n\t\t\t>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t/* translators: the template part's area name (\"Headers\", \"Sidebars\") or \"templates\". */\n\t\t\t\t\t__( 'Browse all %s' ),\n\t\t\t\t\ttemplateSubMenu.title\n\t\t\t\t) }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["TemplateDetails","template","onClose","title","description","select","editorStore","__experimentalGetTemplateInfo","revertTemplate","editSiteStore","browseAllLinkProps","postType","type","postId","undefined","canEditTitle","is_custom","has_theme_file","revert"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAOA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AAYA;AACA;AACA;AAOe,SAASA,eAAT,OAAkD;AAAA,MAAxB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAwB;AAChE,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAyB,qBAC5BC,MAAF,IACCA,MAAM,CAAEC,aAAF,CAAN,CAAsBC,6BAAtB,CAAqDN,QAArD,CAF6B,EAG9B,EAH8B,CAA/B;AAKA,QAAM;AAAEO,IAAAA;AAAF,MAAqB,uBAAaC,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AAR,YAAAA,QAAQ,CAAEW,IAAV,MAAmB,aAAnB,GACC,cAAI,sBAAJ,CADD,GAEC,cAAI,2BAAJ,CANJ,CAvCD,CADD;AAkDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { store as editSiteStore } from '../../store';\nimport TemplateAreas from './template-areas';\nimport EditTemplateTitle from './edit-template-title';\nimport { useLink } from '../routes/link';\n\nexport default function TemplateDetails( { template, onClose } ) {\n\tconst { title, description } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetTemplateInfo( template ),\n\t\t[]\n\t);\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\n\tconst browseAllLinkProps = useLink( {\n\t\t// TODO: We should update this to filter by template part's areas as well.\n\t\tpostType: template.type,\n\t\tpostId: undefined,\n\t} );\n\n\t// Only user-created and non-default templates can change the name.\n\tconst canEditTitle = template.is_custom && ! template.has_theme_file;\n\n\tif ( ! template ) {\n\t\treturn null;\n\t}\n\n\tconst revert = () => {\n\t\trevertTemplate( template );\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<div className=\"edit-site-template-details\">\n\t\t\t<div className=\"edit-site-template-details__group\">\n\t\t\t\t{ canEditTitle ? (\n\t\t\t\t\t<EditTemplateTitle template={ template } />\n\t\t\t\t) : (\n\t\t\t\t\t<Heading\n\t\t\t\t\t\tlevel={ 4 }\n\t\t\t\t\t\tweight={ 600 }\n\t\t\t\t\t\tclassName=\"edit-site-template-details__title\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</Heading>\n\t\t\t\t) }\n\n\t\t\t\t{ description && (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize=\"body\"\n\t\t\t\t\t\tclassName=\"edit-site-template-details__description\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</div>\n\n\t\t\t<TemplateAreas closeTemplateDetailsDropdown={ onClose } />\n\n\t\t\t{ isTemplateRevertable( template ) && (\n\t\t\t\t<MenuGroup className=\"edit-site-template-details__group edit-site-template-details__revert\">\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tclassName=\"edit-site-template-details__revert-button\"\n\t\t\t\t\t\tinfo={ __( 'Restore template to default state' ) }\n\t\t\t\t\t\tonClick={ revert }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-template-details__show-all-button\"\n\t\t\t\t{ ...browseAllLinkProps }\n\t\t\t>\n\t\t\t\t{ template?.type === 'wp_template'\n\t\t\t\t\t? __( 'Browse all templates' )\n\t\t\t\t\t: __( 'Browse all template parts' ) }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"]}
@@ -1,4 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  require("./components");
4
+
5
+ require("./template-part-edit");
4
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/hooks/index.js"],"names":[],"mappings":";;AAGA","sourcesContent":["/**\n * Internal dependencies\n */\nimport './components';\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/hooks/index.js"],"names":[],"mappings":";;AAGA;;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport './components';\nimport './template-part-edit';\n"]}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.withEditBlockControls = void 0;
9
+
10
+ var _element = require("@wordpress/element");
11
+
12
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
+
14
+ var _i18n = require("@wordpress/i18n");
15
+
16
+ var _data = require("@wordpress/data");
17
+
18
+ var _blockEditor = require("@wordpress/block-editor");
19
+
20
+ var _coreData = require("@wordpress/core-data");
21
+
22
+ var _components = require("@wordpress/components");
23
+
24
+ var _hooks = require("@wordpress/hooks");
25
+
26
+ var _compose = require("@wordpress/compose");
27
+
28
+ var _routes = require("../components/routes");
29
+
30
+ var _link = require("../components/routes/link");
31
+
32
+ /**
33
+ * WordPress dependencies
34
+ */
35
+
36
+ /**
37
+ * Internal dependencies
38
+ */
39
+ function EditTemplatePartMenuItem(_ref) {
40
+ let {
41
+ attributes
42
+ } = _ref;
43
+ const {
44
+ theme,
45
+ slug
46
+ } = attributes;
47
+ const {
48
+ params
49
+ } = (0, _routes.useLocation)();
50
+ const templatePart = (0, _data.useSelect)(select => {
51
+ return select(_coreData.store).getEntityRecord('postType', 'wp_template_part', // Ideally this should be an official public API.
52
+ `${theme}//${slug}`);
53
+ }, [theme, slug]);
54
+ const linkProps = (0, _link.useLink)({
55
+ postId: templatePart === null || templatePart === void 0 ? void 0 : templatePart.id,
56
+ postType: templatePart === null || templatePart === void 0 ? void 0 : templatePart.type
57
+ }, {
58
+ fromTemplateId: params.postId
59
+ });
60
+
61
+ if (!templatePart) {
62
+ return null;
63
+ }
64
+
65
+ return (0, _element.createElement)(_blockEditor.BlockControls, {
66
+ group: "other"
67
+ }, (0, _element.createElement)(_components.ToolbarButton, (0, _extends2.default)({}, linkProps, {
68
+ onClick: event => {
69
+ linkProps.onClick(event);
70
+ }
71
+ }), (0, _i18n.__)('Edit')));
72
+ }
73
+
74
+ const withEditBlockControls = (0, _compose.createHigherOrderComponent)(BlockEdit => props => {
75
+ const {
76
+ attributes,
77
+ name
78
+ } = props;
79
+ const isDisplayed = name === 'core/template-part' && attributes.slug;
80
+ return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(BlockEdit, props), isDisplayed && (0, _element.createElement)(EditTemplatePartMenuItem, {
81
+ attributes: attributes
82
+ }));
83
+ }, 'withEditBlockControls');
84
+ exports.withEditBlockControls = withEditBlockControls;
85
+ (0, _hooks.addFilter)('editor.BlockEdit', 'core/edit-site/template-part-edit-button', withEditBlockControls);
86
+ //# sourceMappingURL=template-part-edit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/hooks/template-part-edit.js"],"names":["EditTemplatePartMenuItem","attributes","theme","slug","params","templatePart","select","coreStore","getEntityRecord","linkProps","postId","id","postType","type","fromTemplateId","event","onClick","withEditBlockControls","BlockEdit","props","name","isDisplayed"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AASA;AACA;AACA;AAIA,SAASA,wBAAT,OAAoD;AAAA,MAAjB;AAAEC,IAAAA;AAAF,GAAiB;AACnD,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAkBF,UAAxB;AACA,QAAM;AAAEG,IAAAA;AAAF,MAAa,0BAAnB;AACA,QAAMC,YAAY,GAAG,qBAClBC,MAAF,IAAc;AACb,WAAOA,MAAM,CAAEC,eAAF,CAAN,CAAoBC,eAApB,CACN,UADM,EAEN,kBAFM,EAGN;AACC,OAAGN,KAAO,KAAKC,IAAM,EAJhB,CAAP;AAMA,GARmB,EASpB,CAAED,KAAF,EAASC,IAAT,CAToB,CAArB;AAYA,QAAMM,SAAS,GAAG,mBACjB;AACCC,IAAAA,MAAM,EAAEL,YAAF,aAAEA,YAAF,uBAAEA,YAAY,CAAEM,EADvB;AAECC,IAAAA,QAAQ,EAAEP,YAAF,aAAEA,YAAF,uBAAEA,YAAY,CAAEQ;AAFzB,GADiB,EAKjB;AACCC,IAAAA,cAAc,EAAEV,MAAM,CAACM;AADxB,GALiB,CAAlB;;AAUA,MAAK,CAAEL,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,0BAAD;AAAe,IAAA,KAAK,EAAC;AAArB,KACC,4BAAC,yBAAD,6BACMI,SADN;AAEC,IAAA,OAAO,EAAKM,KAAF,IAAa;AACtBN,MAAAA,SAAS,CAACO,OAAV,CAAmBD,KAAnB;AACA;AAJF,MAMG,cAAI,MAAJ,CANH,CADD,CADD;AAYA;;AAEM,MAAME,qBAAqB,GAAG,yCAClCC,SAAF,IAAmBC,KAAF,IAAa;AAC7B,QAAM;AAAElB,IAAAA,UAAF;AAAcmB,IAAAA;AAAd,MAAuBD,KAA7B;AACA,QAAME,WAAW,GAAGD,IAAI,KAAK,oBAAT,IAAiCnB,UAAU,CAACE,IAAhE;AAEA,SACC,qDACC,4BAAC,SAAD,EAAgBgB,KAAhB,CADD,EAEGE,WAAW,IACZ,4BAAC,wBAAD;AAA0B,IAAA,UAAU,EAAGpB;AAAvC,IAHF,CADD;AAQA,CAbmC,EAcpC,uBAdoC,CAA9B;;AAiBP,sBACC,kBADD,EAEC,0CAFD,EAGCgB,qBAHD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { BlockControls } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ToolbarButton } from '@wordpress/components';\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { useLocation } from '../components/routes';\nimport { useLink } from '../components/routes/link';\n\nfunction EditTemplatePartMenuItem( { attributes } ) {\n\tconst { theme, slug } = attributes;\n\tconst { params } = useLocation();\n\tconst templatePart = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\t// Ideally this should be an official public API.\n\t\t\t\t`${ theme }//${ slug }`\n\t\t\t);\n\t\t},\n\t\t[ theme, slug ]\n\t);\n\n\tconst linkProps = useLink(\n\t\t{\n\t\t\tpostId: templatePart?.id,\n\t\t\tpostType: templatePart?.type,\n\t\t},\n\t\t{\n\t\t\tfromTemplateId: params.postId,\n\t\t}\n\t);\n\n\tif ( ! templatePart ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockControls group=\"other\">\n\t\t\t<ToolbarButton\n\t\t\t\t{ ...linkProps }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\tlinkProps.onClick( event );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Edit' ) }\n\t\t\t</ToolbarButton>\n\t\t</BlockControls>\n\t);\n}\n\nexport const withEditBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { attributes, name } = props;\n\t\tconst isDisplayed = name === 'core/template-part' && attributes.slug;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ isDisplayed && (\n\t\t\t\t\t<EditTemplatePartMenuItem attributes={ attributes } />\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withEditBlockControls'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/template-part-edit-button',\n\twithEditBlockControls\n);\n"]}
@@ -344,7 +344,10 @@ const getCurrentTemplateTemplateParts = (0, _data.createRegistrySelector)(select
344
344
  const templateParts = select(_coreData.store).getEntityRecords('postType', 'wp_template_part', {
345
345
  per_page: -1
346
346
  });
347
- const templatePartsById = (0, _lodash.keyBy)(templateParts, templatePart => templatePart.id);
347
+ const templatePartsById = templateParts ? // Key template parts by their ID.
348
+ templateParts.reduce((newTemplateParts, part) => ({ ...newTemplateParts,
349
+ [part.id]: part
350
+ }), {}) : {};
348
351
  return ((_template$blocks = template.blocks) !== null && _template$blocks !== void 0 ? _template$blocks : []).filter(block => (0, _blocks.isTemplatePart)(block)).map(block => {
349
352
  const {
350
353
  attributes: {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/selectors.js"],"names":["__unstableGetPreference","select","state","name","preferencesStore","get","isFeatureActive","featureName","since","alternative","__experimentalGetPreviewDeviceType","deviceType","getCanUserCreateMedia","coreDataStore","canUser","getReusableBlocks","isWeb","Platform","OS","getEntityRecords","per_page","getSettings","setIsInserterOpen","settings","outlineMode","focusMode","hasFixedToolbar","keepCaretInsideBlock","showIconLabels","__experimentalSetIsInserterOpened","__experimentalReusableBlocks","__experimentalPreferPatternsOnRoot","getEditedPostType","canUserCreateMedia","mediaUpload","onError","rest","wpAllowedMimeTypes","allowedMimeTypes","message","getHomeTemplateId","homeTemplateId","getCurrentEditedPost","editedPost","type","getEditedPostId","id","getPage","page","getNavigationPanelActiveMenu","navigationPanel","menu","getCurrentTemplateNavigationPanelSubMenu","templateType","templateId","template","getEntityRecord","MENU_ROOT","find","submenu","area","MENU_TEMPLATE_PARTS","templates","showOnFront","getEditedEntityRecord","show_on_front","slug","MENU_TEMPLATES_UNUSED","isNavigationOpened","isOpen","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","getCurrentTemplateTemplateParts","templateParts","templatePartsById","templatePart","blocks","filter","block","map","attributes","theme","templatePartId","getEditorMode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAMA;;AA1BA;AACA;AACA;;AAIA;AACA;AACA;;AASA;AACA;AACA;;AAYA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,uBAAuB,GAAG,kCACpCC,MAAF,IAAc,CAAEC,KAAF,EAASC,IAAT,KACbF,MAAM,CAAEG,kBAAF,CAAN,CAA2BC,GAA3B,CAAgC,gBAAhC,EAAkDF,IAAlD,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AwBvF,KAAxB,EAAgC;AACtC,SAAOF,uBAAuB,CAAEE,KAAF,EAAS,YAAT,CAA9B;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { map, keyBy } from 'lodash';\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { isTemplatePart } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport {\n\tMENU_ROOT,\n\tMENU_TEMPLATE_PARTS,\n\tMENU_TEMPLATES_UNUSED,\n\tTEMPLATE_PARTS_SUB_MENUS,\n} from '../components/navigation-sidebar/navigation-panel/constants';\nimport {\n\tgetTemplateLocation,\n\tisTemplateSuperseded,\n} from '../components/navigation-sidebar/navigation-panel/template-hierarchy';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Helper for getting a preference from the preferences store.\n *\n * This is only present so that `getSettings` doesn't need to be made a\n * registry selector.\n *\n * It's unstable because the selector needs to be exported and so part of the\n * public API to work.\n */\nexport const __unstableGetPreference = createRegistrySelector(\n\t( select ) => ( state, name ) =>\n\t\tselect( preferencesStore ).get( 'core/edit-site', name )\n);\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport function isFeatureActive( state, featureName ) {\n\tdeprecated( `select( 'core/interface' ).isFeatureActive`, {\n\t\tsince: '6.0',\n\t\talternative: `select( 'core/preferences' ).get`,\n\t} );\n\n\treturn !! __unstableGetPreference( state, featureName );\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the settings, taking into account active features and permissions.\n *\n * @param {Object} state Global application state.\n * @param {Function} setIsInserterOpen Setter for the open state of the global inserter.\n *\n * @return {Object} Settings.\n */\nexport const getSettings = createSelector(\n\t( state, setIsInserterOpen ) => {\n\t\tconst settings = {\n\t\t\t...state.settings,\n\t\t\toutlineMode: true,\n\t\t\tfocusMode: !! __unstableGetPreference( state, 'focusMode' ),\n\t\t\thasFixedToolbar: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tshowIconLabels: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpen,\n\t\t\t__experimentalReusableBlocks: getReusableBlocks( state ),\n\t\t\t__experimentalPreferPatternsOnRoot:\n\t\t\t\t'wp_template' === getEditedPostType( state ),\n\t\t};\n\n\t\tconst canUserCreateMedia = getCanUserCreateMedia( state );\n\t\tif ( ! canUserCreateMedia ) {\n\t\t\treturn settings;\n\t\t}\n\n\t\tsettings.mediaUpload = ( { onError, ...rest } ) => {\n\t\t\tuploadMedia( {\n\t\t\t\twpAllowedMimeTypes: state.settings.allowedMimeTypes,\n\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t...rest,\n\t\t\t} );\n\t\t};\n\t\treturn settings;\n\t},\n\t( state ) => [\n\t\tgetCanUserCreateMedia( state ),\n\t\tstate.settings,\n\t\t__unstableGetPreference( state, 'focusMode' ),\n\t\t__unstableGetPreference( state, 'fixedToolbar' ),\n\t\t__unstableGetPreference( state, 'keepCaretInsideBlock' ),\n\t\t__unstableGetPreference( state, 'showIconLabels' ),\n\t\tgetReusableBlocks( state ),\n\t\tgetEditedPostType( state ),\n\t]\n);\n\n/**\n * Returns the current home template ID.\n *\n * @param {Object} state Global application state.\n *\n * @return {number?} Home template ID.\n */\nexport function getHomeTemplateId( state ) {\n\treturn state.homeTemplateId;\n}\n\nfunction getCurrentEditedPost( state ) {\n\treturn state.editedPost;\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn getCurrentEditedPost( state ).type;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn getCurrentEditedPost( state ).id;\n}\n\n/**\n * Returns the current page object.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn getCurrentEditedPost( state ).page;\n}\n\n/**\n * Returns the active menu in the navigation panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Active menu.\n */\nexport function getNavigationPanelActiveMenu( state ) {\n\treturn state.navigationPanel.menu;\n}\n\n/**\n * Returns the current template or template part's corresponding\n * navigation panel's sub menu, to be used with `openNavigationPanelToMenu`.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} The current template or template part's sub menu.\n */\nexport const getCurrentTemplateNavigationPanelSubMenu = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = templateId\n\t\t\t? select( coreDataStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplateType,\n\t\t\t\t\ttemplateId\n\t\t\t )\n\t\t\t: null;\n\n\t\tif ( ! template ) {\n\t\t\treturn MENU_ROOT;\n\t\t}\n\n\t\tif ( 'wp_template_part' === templateType ) {\n\t\t\treturn (\n\t\t\t\tTEMPLATE_PARTS_SUB_MENUS.find(\n\t\t\t\t\t( submenu ) => submenu.area === template?.area\n\t\t\t\t)?.menu || MENU_TEMPLATE_PARTS\n\t\t\t);\n\t\t}\n\n\t\tconst templates = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_template'\n\t\t);\n\t\tconst showOnFront = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'root',\n\t\t\t'site'\n\t\t).show_on_front;\n\n\t\tif (\n\t\t\tisTemplateSuperseded(\n\t\t\t\ttemplate.slug,\n\t\t\t\tmap( templates, 'slug' ),\n\t\t\t\tshowOnFront\n\t\t\t)\n\t\t) {\n\t\t\treturn MENU_TEMPLATES_UNUSED;\n\t\t}\n\n\t\treturn getTemplateLocation( template.slug );\n\t}\n);\n\n/**\n * Returns the current opened/closed state of the navigation panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the navigation panel should be open; false if closed.\n */\nexport function isNavigationOpened( state ) {\n\treturn state.navigationPanel.isOpen;\n}\n\n/**\n * Returns the current opened/closed state of the inserter panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the inserter panel should be open; false if closed.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst { rootClientId, insertionIndex, filterValue } =\n\t\tstate.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns the current opened/closed state of the list view panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the list view panel should be open; false if closed.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\ttemplateType,\n\t\t\ttemplateId\n\t\t);\n\n\t\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t{ per_page: -1 }\n\t\t);\n\t\tconst templatePartsById = keyBy(\n\t\t\ttemplateParts,\n\t\t\t( templatePart ) => templatePart.id\n\t\t);\n\n\t\treturn ( template.blocks ?? [] )\n\t\t\t.filter( ( block ) => isTemplatePart( block ) )\n\t\t\t.map( ( block ) => {\n\t\t\t\tconst {\n\t\t\t\t\tattributes: { theme, slug },\n\t\t\t\t} = block;\n\t\t\t\tconst templatePartId = `${ theme }//${ slug }`;\n\t\t\t\tconst templatePart = templatePartsById[ templatePartId ];\n\n\t\t\t\treturn {\n\t\t\t\t\ttemplatePart,\n\t\t\t\t\tblock,\n\t\t\t\t};\n\t\t\t} )\n\t\t\t.filter( ( { templatePart } ) => !! templatePart );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport function getEditorMode( state ) {\n\treturn __unstableGetPreference( state, 'editorMode' );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/selectors.js"],"names":["__unstableGetPreference","select","state","name","preferencesStore","get","isFeatureActive","featureName","since","alternative","__experimentalGetPreviewDeviceType","deviceType","getCanUserCreateMedia","coreDataStore","canUser","getReusableBlocks","isWeb","Platform","OS","getEntityRecords","per_page","getSettings","setIsInserterOpen","settings","outlineMode","focusMode","hasFixedToolbar","keepCaretInsideBlock","showIconLabels","__experimentalSetIsInserterOpened","__experimentalReusableBlocks","__experimentalPreferPatternsOnRoot","getEditedPostType","canUserCreateMedia","mediaUpload","onError","rest","wpAllowedMimeTypes","allowedMimeTypes","message","getHomeTemplateId","homeTemplateId","getCurrentEditedPost","editedPost","type","getEditedPostId","id","getPage","page","getNavigationPanelActiveMenu","navigationPanel","menu","getCurrentTemplateNavigationPanelSubMenu","templateType","templateId","template","getEntityRecord","MENU_ROOT","find","submenu","area","MENU_TEMPLATE_PARTS","templates","showOnFront","getEditedEntityRecord","show_on_front","slug","MENU_TEMPLATES_UNUSED","isNavigationOpened","isOpen","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","getCurrentTemplateTemplateParts","templateParts","templatePartsById","reduce","newTemplateParts","part","blocks","filter","block","map","attributes","theme","templatePartId","templatePart","getEditorMode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAMA;;AA1BA;AACA;AACA;;AAIA;AACA;AACA;;AASA;AACA;AACA;;AAYA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,uBAAuB,GAAG,kCACpCC,MAAF,IAAc,CAAEC,KAAF,EAASC,IAAT,KACbF,MAAM,CAAEG,kBAAF,CAAN,CAA2BC,GAA3B,CAAgC,gBAAhC,EAAkDF,IAAlD,CAFqC,CAAhC;AAKP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,SAASG,eAAT,CAA0BJ,KAA1B,EAAiCK,WAAjC,EAA+C;AACrD,2BAAa,4CAAb,EAA0D;AACzDC,IAAAA,KAAK,EAAE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F,uBAAuB,CAAEE,KAAF,EAAS,YAAT,CAA9B;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { map } from 'lodash';\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { isTemplatePart } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport {\n\tMENU_ROOT,\n\tMENU_TEMPLATE_PARTS,\n\tMENU_TEMPLATES_UNUSED,\n\tTEMPLATE_PARTS_SUB_MENUS,\n} from '../components/navigation-sidebar/navigation-panel/constants';\nimport {\n\tgetTemplateLocation,\n\tisTemplateSuperseded,\n} from '../components/navigation-sidebar/navigation-panel/template-hierarchy';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Helper for getting a preference from the preferences store.\n *\n * This is only present so that `getSettings` doesn't need to be made a\n * registry selector.\n *\n * It's unstable because the selector needs to be exported and so part of the\n * public API to work.\n */\nexport const __unstableGetPreference = createRegistrySelector(\n\t( select ) => ( state, name ) =>\n\t\tselect( preferencesStore ).get( 'core/edit-site', name )\n);\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport function isFeatureActive( state, featureName ) {\n\tdeprecated( `select( 'core/interface' ).isFeatureActive`, {\n\t\tsince: '6.0',\n\t\talternative: `select( 'core/preferences' ).get`,\n\t} );\n\n\treturn !! __unstableGetPreference( state, featureName );\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the settings, taking into account active features and permissions.\n *\n * @param {Object} state Global application state.\n * @param {Function} setIsInserterOpen Setter for the open state of the global inserter.\n *\n * @return {Object} Settings.\n */\nexport const getSettings = createSelector(\n\t( state, setIsInserterOpen ) => {\n\t\tconst settings = {\n\t\t\t...state.settings,\n\t\t\toutlineMode: true,\n\t\t\tfocusMode: !! __unstableGetPreference( state, 'focusMode' ),\n\t\t\thasFixedToolbar: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tshowIconLabels: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpen,\n\t\t\t__experimentalReusableBlocks: getReusableBlocks( state ),\n\t\t\t__experimentalPreferPatternsOnRoot:\n\t\t\t\t'wp_template' === getEditedPostType( state ),\n\t\t};\n\n\t\tconst canUserCreateMedia = getCanUserCreateMedia( state );\n\t\tif ( ! canUserCreateMedia ) {\n\t\t\treturn settings;\n\t\t}\n\n\t\tsettings.mediaUpload = ( { onError, ...rest } ) => {\n\t\t\tuploadMedia( {\n\t\t\t\twpAllowedMimeTypes: state.settings.allowedMimeTypes,\n\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t...rest,\n\t\t\t} );\n\t\t};\n\t\treturn settings;\n\t},\n\t( state ) => [\n\t\tgetCanUserCreateMedia( state ),\n\t\tstate.settings,\n\t\t__unstableGetPreference( state, 'focusMode' ),\n\t\t__unstableGetPreference( state, 'fixedToolbar' ),\n\t\t__unstableGetPreference( state, 'keepCaretInsideBlock' ),\n\t\t__unstableGetPreference( state, 'showIconLabels' ),\n\t\tgetReusableBlocks( state ),\n\t\tgetEditedPostType( state ),\n\t]\n);\n\n/**\n * Returns the current home template ID.\n *\n * @param {Object} state Global application state.\n *\n * @return {number?} Home template ID.\n */\nexport function getHomeTemplateId( state ) {\n\treturn state.homeTemplateId;\n}\n\nfunction getCurrentEditedPost( state ) {\n\treturn state.editedPost;\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn getCurrentEditedPost( state ).type;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn getCurrentEditedPost( state ).id;\n}\n\n/**\n * Returns the current page object.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn getCurrentEditedPost( state ).page;\n}\n\n/**\n * Returns the active menu in the navigation panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Active menu.\n */\nexport function getNavigationPanelActiveMenu( state ) {\n\treturn state.navigationPanel.menu;\n}\n\n/**\n * Returns the current template or template part's corresponding\n * navigation panel's sub menu, to be used with `openNavigationPanelToMenu`.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} The current template or template part's sub menu.\n */\nexport const getCurrentTemplateNavigationPanelSubMenu = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = templateId\n\t\t\t? select( coreDataStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplateType,\n\t\t\t\t\ttemplateId\n\t\t\t )\n\t\t\t: null;\n\n\t\tif ( ! template ) {\n\t\t\treturn MENU_ROOT;\n\t\t}\n\n\t\tif ( 'wp_template_part' === templateType ) {\n\t\t\treturn (\n\t\t\t\tTEMPLATE_PARTS_SUB_MENUS.find(\n\t\t\t\t\t( submenu ) => submenu.area === template?.area\n\t\t\t\t)?.menu || MENU_TEMPLATE_PARTS\n\t\t\t);\n\t\t}\n\n\t\tconst templates = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_template'\n\t\t);\n\t\tconst showOnFront = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'root',\n\t\t\t'site'\n\t\t).show_on_front;\n\n\t\tif (\n\t\t\tisTemplateSuperseded(\n\t\t\t\ttemplate.slug,\n\t\t\t\tmap( templates, 'slug' ),\n\t\t\t\tshowOnFront\n\t\t\t)\n\t\t) {\n\t\t\treturn MENU_TEMPLATES_UNUSED;\n\t\t}\n\n\t\treturn getTemplateLocation( template.slug );\n\t}\n);\n\n/**\n * Returns the current opened/closed state of the navigation panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the navigation panel should be open; false if closed.\n */\nexport function isNavigationOpened( state ) {\n\treturn state.navigationPanel.isOpen;\n}\n\n/**\n * Returns the current opened/closed state of the inserter panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the inserter panel should be open; false if closed.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst { rootClientId, insertionIndex, filterValue } =\n\t\tstate.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns the current opened/closed state of the list view panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the list view panel should be open; false if closed.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\ttemplateType,\n\t\t\ttemplateId\n\t\t);\n\n\t\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t{ per_page: -1 }\n\t\t);\n\t\tconst templatePartsById = templateParts\n\t\t\t? // Key template parts by their ID.\n\t\t\t templateParts.reduce(\n\t\t\t\t\t( newTemplateParts, part ) => ( {\n\t\t\t\t\t\t...newTemplateParts,\n\t\t\t\t\t\t[ part.id ]: part,\n\t\t\t\t\t} ),\n\t\t\t\t\t{}\n\t\t\t )\n\t\t\t: {};\n\n\t\treturn ( template.blocks ?? [] )\n\t\t\t.filter( ( block ) => isTemplatePart( block ) )\n\t\t\t.map( ( block ) => {\n\t\t\t\tconst {\n\t\t\t\t\tattributes: { theme, slug },\n\t\t\t\t} = block;\n\t\t\t\tconst templatePartId = `${ theme }//${ slug }`;\n\t\t\t\tconst templatePart = templatePartsById[ templatePartId ];\n\n\t\t\t\treturn {\n\t\t\t\t\ttemplatePart,\n\t\t\t\t\tblock,\n\t\t\t\t};\n\t\t\t} )\n\t\t\t.filter( ( { templatePart } ) => !! templatePart );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport function getEditorMode( state ) {\n\treturn __unstableGetPreference( state, 'editorMode' );\n}\n"]}