@wordpress/edit-post 7.34.0 → 8.0.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 (252) hide show
  1. package/CHANGELOG.md +15 -2
  2. package/build/commands/use-commands.js +56 -0
  3. package/build/commands/use-commands.js.map +1 -0
  4. package/build/components/{header/fullscreen-mode-close/index.js → back-button/fullscreen-mode-close.js} +18 -16
  5. package/build/components/back-button/fullscreen-mode-close.js.map +1 -0
  6. package/build/components/back-button/index.js +57 -0
  7. package/build/components/back-button/index.js.map +1 -0
  8. package/build/components/header/header-toolbar/index.native.js +63 -62
  9. package/build/components/header/header-toolbar/index.native.js.map +1 -1
  10. package/build/components/header/index.native.js +2 -2
  11. package/build/components/header/index.native.js.map +1 -1
  12. package/build/components/init-pattern-modal/index.js +50 -43
  13. package/build/components/init-pattern-modal/index.js.map +1 -1
  14. package/build/components/layout/index.js +134 -156
  15. package/build/components/layout/index.js.map +1 -1
  16. package/build/components/layout/index.native.js +28 -21
  17. package/build/components/layout/index.native.js.map +1 -1
  18. package/build/components/{visual-editor → layout}/use-padding-appender.js +6 -1
  19. package/build/components/layout/use-padding-appender.js.map +1 -0
  20. package/build/components/layout/use-should-iframe.js +46 -0
  21. package/build/components/layout/use-should-iframe.js.map +1 -0
  22. package/build/components/meta-boxes/index.js +10 -9
  23. package/build/components/meta-boxes/index.js.map +1 -1
  24. package/build/components/meta-boxes/meta-boxes-area/index.js +13 -13
  25. package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  26. package/build/components/more-menu/index.js +49 -0
  27. package/build/components/more-menu/index.js.map +1 -0
  28. package/build/components/{header/more-menu → more-menu}/manage-patterns-menu-item.js +6 -5
  29. package/build/components/more-menu/manage-patterns-menu-item.js.map +1 -0
  30. package/build/components/{header/more-menu → more-menu}/welcome-guide-menu-item.js +2 -2
  31. package/build/components/more-menu/welcome-guide-menu-item.js.map +1 -0
  32. package/build/components/preferences-modal/enable-custom-fields.js +23 -18
  33. package/build/components/preferences-modal/enable-custom-fields.js.map +1 -1
  34. package/build/components/preferences-modal/index.js +4 -4
  35. package/build/components/preferences-modal/index.js.map +1 -1
  36. package/build/components/preferences-modal/meta-boxes-section.js +13 -13
  37. package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
  38. package/build/components/visual-editor/header.native.js +11 -10
  39. package/build/components/visual-editor/header.native.js.map +1 -1
  40. package/build/components/visual-editor/index.native.js +3 -3
  41. package/build/components/visual-editor/index.native.js.map +1 -1
  42. package/build/components/welcome-guide/default.js +50 -33
  43. package/build/components/welcome-guide/default.js.map +1 -1
  44. package/build/components/welcome-guide/image.js +13 -12
  45. package/build/components/welcome-guide/image.js.map +1 -1
  46. package/build/components/welcome-guide/index.js +2 -2
  47. package/build/components/welcome-guide/index.js.map +1 -1
  48. package/build/components/welcome-guide/template.js +12 -8
  49. package/build/components/welcome-guide/template.js.map +1 -1
  50. package/build/deprecated.js +9 -9
  51. package/build/deprecated.js.map +1 -1
  52. package/build/editor.js +16 -11
  53. package/build/editor.js.map +1 -1
  54. package/build/editor.native.js +18 -12
  55. package/build/editor.native.js.map +1 -1
  56. package/build/index.js +12 -13
  57. package/build/index.js.map +1 -1
  58. package/build/index.native.js +2 -2
  59. package/build/index.native.js.map +1 -1
  60. package/build/store/selectors.js +1 -1
  61. package/build/store/selectors.js.map +1 -1
  62. package/build-module/commands/use-commands.js +49 -0
  63. package/build-module/commands/use-commands.js.map +1 -0
  64. package/build-module/components/{header/fullscreen-mode-close/index.js → back-button/fullscreen-mode-close.js} +18 -16
  65. package/build-module/components/back-button/fullscreen-mode-close.js.map +1 -0
  66. package/build-module/components/back-button/index.js +49 -0
  67. package/build-module/components/back-button/index.js.map +1 -0
  68. package/build-module/components/header/header-toolbar/index.native.js +64 -62
  69. package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
  70. package/build-module/components/header/index.native.js +2 -2
  71. package/build-module/components/header/index.native.js.map +1 -1
  72. package/build-module/components/init-pattern-modal/index.js +52 -43
  73. package/build-module/components/init-pattern-modal/index.js.map +1 -1
  74. package/build-module/components/layout/index.js +139 -159
  75. package/build-module/components/layout/index.js.map +1 -1
  76. package/build-module/components/layout/index.native.js +30 -21
  77. package/build-module/components/layout/index.native.js.map +1 -1
  78. package/build-module/components/{visual-editor → layout}/use-padding-appender.js +6 -1
  79. package/build-module/components/layout/use-padding-appender.js.map +1 -0
  80. package/build-module/components/layout/use-should-iframe.js +39 -0
  81. package/build-module/components/layout/use-should-iframe.js.map +1 -0
  82. package/build-module/components/meta-boxes/index.js +12 -9
  83. package/build-module/components/meta-boxes/index.js.map +1 -1
  84. package/build-module/components/meta-boxes/meta-boxes-area/index.js +13 -11
  85. package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  86. package/build-module/components/more-menu/index.js +43 -0
  87. package/build-module/components/more-menu/index.js.map +1 -0
  88. package/build-module/components/{header/more-menu → more-menu}/manage-patterns-menu-item.js +6 -5
  89. package/build-module/components/more-menu/manage-patterns-menu-item.js.map +1 -0
  90. package/build-module/components/{header/more-menu → more-menu}/welcome-guide-menu-item.js +2 -2
  91. package/build-module/components/more-menu/welcome-guide-menu-item.js.map +1 -0
  92. package/build-module/components/preferences-modal/enable-custom-fields.js +25 -18
  93. package/build-module/components/preferences-modal/enable-custom-fields.js.map +1 -1
  94. package/build-module/components/preferences-modal/index.js +4 -4
  95. package/build-module/components/preferences-modal/index.js.map +1 -1
  96. package/build-module/components/preferences-modal/meta-boxes-section.js +14 -13
  97. package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
  98. package/build-module/components/visual-editor/header.native.js +11 -10
  99. package/build-module/components/visual-editor/header.native.js.map +1 -1
  100. package/build-module/components/visual-editor/index.native.js +3 -3
  101. package/build-module/components/visual-editor/index.native.js.map +1 -1
  102. package/build-module/components/welcome-guide/default.js +52 -33
  103. package/build-module/components/welcome-guide/default.js.map +1 -1
  104. package/build-module/components/welcome-guide/image.js +14 -12
  105. package/build-module/components/welcome-guide/image.js.map +1 -1
  106. package/build-module/components/welcome-guide/index.js +2 -2
  107. package/build-module/components/welcome-guide/index.js.map +1 -1
  108. package/build-module/components/welcome-guide/template.js +14 -8
  109. package/build-module/components/welcome-guide/template.js.map +1 -1
  110. package/build-module/deprecated.js +9 -9
  111. package/build-module/deprecated.js.map +1 -1
  112. package/build-module/editor.js +17 -11
  113. package/build-module/editor.js.map +1 -1
  114. package/build-module/editor.native.js +18 -12
  115. package/build-module/editor.native.js.map +1 -1
  116. package/build-module/index.js +10 -7
  117. package/build-module/index.js.map +1 -1
  118. package/build-module/index.native.js +2 -2
  119. package/build-module/index.native.js.map +1 -1
  120. package/build-module/store/selectors.js +1 -1
  121. package/build-module/store/selectors.js.map +1 -1
  122. package/build-style/style-rtl.css +31 -392
  123. package/build-style/style.css +31 -392
  124. package/package.json +33 -33
  125. package/src/commands/use-commands.js +48 -0
  126. package/src/components/{header/fullscreen-mode-close/index.js → back-button/fullscreen-mode-close.js} +3 -3
  127. package/src/components/back-button/index.js +34 -0
  128. package/src/components/{header/fullscreen-mode-close → back-button}/style.scss +16 -2
  129. package/src/components/{header/fullscreen-mode-close/test/index.js → back-button/test/fullscreen-mode-close.js} +1 -1
  130. package/src/components/layout/index.js +151 -207
  131. package/src/components/layout/style.scss +9 -17
  132. package/src/components/{visual-editor → layout}/use-padding-appender.js +7 -1
  133. package/src/components/layout/use-should-iframe.js +40 -0
  134. package/src/components/meta-boxes/meta-boxes-area/index.js +4 -8
  135. package/src/components/{header/more-menu → more-menu}/index.js +2 -2
  136. package/src/components/{header/more-menu → more-menu}/manage-patterns-menu-item.js +1 -1
  137. package/src/index.js +11 -6
  138. package/src/store/selectors.js +8 -5
  139. package/src/style.scss +3 -10
  140. package/src/test/__snapshots__/editor.native.js.snap +72 -0
  141. package/src/test/editor.native.js +77 -0
  142. package/build/components/header/fullscreen-mode-close/index.js.map +0 -1
  143. package/build/components/header/index.js +0 -158
  144. package/build/components/header/index.js.map +0 -1
  145. package/build/components/header/main-dashboard-button/index.js +0 -33
  146. package/build/components/header/main-dashboard-button/index.js.map +0 -1
  147. package/build/components/header/more-menu/index.js +0 -43
  148. package/build/components/header/more-menu/index.js.map +0 -1
  149. package/build/components/header/more-menu/manage-patterns-menu-item.js.map +0 -1
  150. package/build/components/header/more-menu/welcome-guide-menu-item.js.map +0 -1
  151. package/build/components/sidebar/post-format/index.js +0 -21
  152. package/build/components/sidebar/post-format/index.js.map +0 -1
  153. package/build/components/sidebar/post-pending-status/index.js +0 -26
  154. package/build/components/sidebar/post-pending-status/index.js.map +0 -1
  155. package/build/components/sidebar/post-slug/index.js +0 -21
  156. package/build/components/sidebar/post-slug/index.js.map +0 -1
  157. package/build/components/sidebar/post-status/index.js +0 -92
  158. package/build/components/sidebar/post-status/index.js.map +0 -1
  159. package/build/components/sidebar/post-sticky/index.js +0 -26
  160. package/build/components/sidebar/post-sticky/index.js.map +0 -1
  161. package/build/components/sidebar/post-trash/index.js +0 -16
  162. package/build/components/sidebar/post-trash/index.js.map +0 -1
  163. package/build/components/sidebar/post-visibility/index.js +0 -78
  164. package/build/components/sidebar/post-visibility/index.js.map +0 -1
  165. package/build/components/sidebar/settings-header/index.js +0 -53
  166. package/build/components/sidebar/settings-header/index.js.map +0 -1
  167. package/build/components/sidebar/settings-sidebar/index.js +0 -193
  168. package/build/components/sidebar/settings-sidebar/index.js.map +0 -1
  169. package/build/components/text-editor/index.js +0 -61
  170. package/build/components/text-editor/index.js.map +0 -1
  171. package/build/components/visual-editor/block-inspector-button.js +0 -55
  172. package/build/components/visual-editor/block-inspector-button.js.map +0 -1
  173. package/build/components/visual-editor/index.js +0 -92
  174. package/build/components/visual-editor/index.js.map +0 -1
  175. package/build/components/visual-editor/use-padding-appender.js.map +0 -1
  176. package/build/hooks/commands/use-common-commands.js +0 -119
  177. package/build/hooks/commands/use-common-commands.js.map +0 -1
  178. package/build/hooks/components/index.js +0 -11
  179. package/build/hooks/components/index.js.map +0 -1
  180. package/build/hooks/index.js +0 -5
  181. package/build/hooks/index.js.map +0 -1
  182. package/build/hooks/validate-multiple-use/index.js +0 -134
  183. package/build/hooks/validate-multiple-use/index.js.map +0 -1
  184. package/build-module/components/header/fullscreen-mode-close/index.js.map +0 -1
  185. package/build-module/components/header/index.js +0 -150
  186. package/build-module/components/header/index.js.map +0 -1
  187. package/build-module/components/header/main-dashboard-button/index.js +0 -26
  188. package/build-module/components/header/main-dashboard-button/index.js.map +0 -1
  189. package/build-module/components/header/more-menu/index.js +0 -35
  190. package/build-module/components/header/more-menu/index.js.map +0 -1
  191. package/build-module/components/header/more-menu/manage-patterns-menu-item.js.map +0 -1
  192. package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +0 -1
  193. package/build-module/components/sidebar/post-format/index.js +0 -13
  194. package/build-module/components/sidebar/post-format/index.js.map +0 -1
  195. package/build-module/components/sidebar/post-pending-status/index.js +0 -18
  196. package/build-module/components/sidebar/post-pending-status/index.js.map +0 -1
  197. package/build-module/components/sidebar/post-slug/index.js +0 -13
  198. package/build-module/components/sidebar/post-slug/index.js.map +0 -1
  199. package/build-module/components/sidebar/post-status/index.js +0 -84
  200. package/build-module/components/sidebar/post-status/index.js.map +0 -1
  201. package/build-module/components/sidebar/post-sticky/index.js +0 -18
  202. package/build-module/components/sidebar/post-sticky/index.js.map +0 -1
  203. package/build-module/components/sidebar/post-trash/index.js +0 -9
  204. package/build-module/components/sidebar/post-trash/index.js.map +0 -1
  205. package/build-module/components/sidebar/post-visibility/index.js +0 -70
  206. package/build-module/components/sidebar/post-visibility/index.js.map +0 -1
  207. package/build-module/components/sidebar/settings-header/index.js +0 -46
  208. package/build-module/components/sidebar/settings-header/index.js.map +0 -1
  209. package/build-module/components/sidebar/settings-sidebar/index.js +0 -185
  210. package/build-module/components/sidebar/settings-sidebar/index.js.map +0 -1
  211. package/build-module/components/text-editor/index.js +0 -54
  212. package/build-module/components/text-editor/index.js.map +0 -1
  213. package/build-module/components/visual-editor/block-inspector-button.js +0 -47
  214. package/build-module/components/visual-editor/block-inspector-button.js.map +0 -1
  215. package/build-module/components/visual-editor/index.js +0 -84
  216. package/build-module/components/visual-editor/index.js.map +0 -1
  217. package/build-module/components/visual-editor/use-padding-appender.js.map +0 -1
  218. package/build-module/hooks/commands/use-common-commands.js +0 -112
  219. package/build-module/hooks/commands/use-common-commands.js.map +0 -1
  220. package/build-module/hooks/components/index.js +0 -8
  221. package/build-module/hooks/components/index.js.map +0 -1
  222. package/build-module/hooks/index.js +0 -6
  223. package/build-module/hooks/index.js.map +0 -1
  224. package/build-module/hooks/validate-multiple-use/index.js +0 -132
  225. package/build-module/hooks/validate-multiple-use/index.js.map +0 -1
  226. package/src/components/header/index.js +0 -156
  227. package/src/components/header/main-dashboard-button/index.js +0 -28
  228. package/src/components/header/style.scss +0 -251
  229. package/src/components/sidebar/post-format/index.js +0 -20
  230. package/src/components/sidebar/post-format/style.scss +0 -5
  231. package/src/components/sidebar/post-pending-status/index.js +0 -27
  232. package/src/components/sidebar/post-slug/index.js +0 -17
  233. package/src/components/sidebar/post-slug/style.scss +0 -5
  234. package/src/components/sidebar/post-status/index.js +0 -128
  235. package/src/components/sidebar/post-sticky/index.js +0 -27
  236. package/src/components/sidebar/post-trash/index.js +0 -12
  237. package/src/components/sidebar/post-visibility/index.js +0 -88
  238. package/src/components/sidebar/post-visibility/style.scss +0 -5
  239. package/src/components/sidebar/settings-header/index.js +0 -49
  240. package/src/components/sidebar/settings-sidebar/index.js +0 -247
  241. package/src/components/sidebar/style.scss +0 -18
  242. package/src/components/text-editor/index.js +0 -63
  243. package/src/components/text-editor/style.scss +0 -71
  244. package/src/components/visual-editor/block-inspector-button.js +0 -59
  245. package/src/components/visual-editor/index.js +0 -101
  246. package/src/components/visual-editor/style.scss +0 -53
  247. package/src/hooks/commands/use-common-commands.js +0 -126
  248. package/src/hooks/components/index.js +0 -13
  249. package/src/hooks/index.js +0 -5
  250. package/src/hooks/validate-multiple-use/index.js +0 -163
  251. /package/src/components/{header/fullscreen-mode-close/test/__snapshots__/index.js.snap → back-button/test/__snapshots__/fullscreen-mode-close.js.snap} +0 -0
  252. /package/src/components/{header/more-menu → more-menu}/welcome-guide-menu-item.js +0 -0
@@ -1,55 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.BlockInspectorButton = BlockInspectorButton;
7
- exports.default = void 0;
8
- var _react = require("react");
9
- var _i18n = require("@wordpress/i18n");
10
- var _components = require("@wordpress/components");
11
- var _data = require("@wordpress/data");
12
- var _a11y = require("@wordpress/a11y");
13
- var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
14
- var _store = require("../../store");
15
- /**
16
- * WordPress dependencies
17
- */
18
-
19
- /**
20
- * Internal dependencies
21
- */
22
-
23
- const noop = () => {};
24
- function BlockInspectorButton({
25
- onClick = noop,
26
- small = false
27
- }) {
28
- const {
29
- shortcut,
30
- areAdvancedSettingsOpened
31
- } = (0, _data.useSelect)(select => ({
32
- shortcut: select(_keyboardShortcuts.store).getShortcutRepresentation('core/editor/toggle-sidebar'),
33
- areAdvancedSettingsOpened: select(_store.store).getActiveGeneralSidebarName() === 'edit-post/block'
34
- }), []);
35
- const {
36
- openGeneralSidebar,
37
- closeGeneralSidebar
38
- } = (0, _data.useDispatch)(_store.store);
39
- const label = areAdvancedSettingsOpened ? (0, _i18n.__)('Hide more settings') : (0, _i18n.__)('Show more settings');
40
- return (0, _react.createElement)(_components.MenuItem, {
41
- onClick: () => {
42
- if (areAdvancedSettingsOpened) {
43
- closeGeneralSidebar();
44
- (0, _a11y.speak)((0, _i18n.__)('Block settings closed'));
45
- } else {
46
- openGeneralSidebar('edit-post/block');
47
- (0, _a11y.speak)((0, _i18n.__)('Additional settings are now available in the Editor block settings sidebar'));
48
- }
49
- onClick();
50
- },
51
- shortcut: shortcut
52
- }, !small && label);
53
- }
54
- var _default = exports.default = BlockInspectorButton;
55
- //# sourceMappingURL=block-inspector-button.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_i18n","require","_components","_data","_a11y","_keyboardShortcuts","_store","noop","BlockInspectorButton","onClick","small","shortcut","areAdvancedSettingsOpened","useSelect","select","keyboardShortcutsStore","getShortcutRepresentation","editPostStore","getActiveGeneralSidebarName","openGeneralSidebar","closeGeneralSidebar","useDispatch","label","__","_react","createElement","MenuItem","speak","_default","exports","default"],"sources":["@wordpress/edit-post/src/components/visual-editor/block-inspector-button.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { speak } from '@wordpress/a11y';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nconst noop = () => {};\n\nexport function BlockInspectorButton( { onClick = noop, small = false } ) {\n\tconst { shortcut, areAdvancedSettingsOpened } = useSelect(\n\t\t( select ) => ( {\n\t\t\tshortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation( 'core/editor/toggle-sidebar' ),\n\t\t\tareAdvancedSettingsOpened:\n\t\t\t\tselect( editPostStore ).getActiveGeneralSidebarName() ===\n\t\t\t\t'edit-post/block',\n\t\t} ),\n\t\t[]\n\t);\n\tconst { openGeneralSidebar, closeGeneralSidebar } =\n\t\tuseDispatch( editPostStore );\n\n\tconst label = areAdvancedSettingsOpened\n\t\t? __( 'Hide more settings' )\n\t\t: __( 'Show more settings' );\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\tif ( areAdvancedSettingsOpened ) {\n\t\t\t\t\tcloseGeneralSidebar();\n\t\t\t\t\tspeak( __( 'Block settings closed' ) );\n\t\t\t\t} else {\n\t\t\t\t\topenGeneralSidebar( 'edit-post/block' );\n\t\t\t\t\tspeak(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Additional settings are now available in the Editor block settings sidebar'\n\t\t\t\t\t\t)\n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wB,CAAE,CAAC;MACvC,CAAC,MAAM;QACNJ,kBAAkB,CAAE,iBAAkB,CAAC;QACvC,IAAAQ,WAAK,EACJ,IAAAJ,QAAE,EACD,4EACD,CACD,CAAC;MACF;MACAd,OAAO,CAAC,CAAC;IACV,CAAG;IACHE,QAAQ,EAAGA;EAAU,GAEnB,CAAED,KAAK,IAAIY,KACJ,CAAC;AAEb;AAAC,IAAAM,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEctB,oBAAoB","ignoreList":[]}
@@ -1,92 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = VisualEditor;
8
- var _react = require("react");
9
- var _classnames = _interopRequireDefault(require("classnames"));
10
- var _editor = require("@wordpress/editor");
11
- var _element = require("@wordpress/element");
12
- var _data = require("@wordpress/data");
13
- var _blocks = require("@wordpress/blocks");
14
- var _store = require("../../store");
15
- var _lockUnlock = require("../../lock-unlock");
16
- var _usePaddingAppender = require("./use-padding-appender");
17
- /**
18
- * External dependencies
19
- */
20
-
21
- /**
22
- * WordPress dependencies
23
- */
24
-
25
- /**
26
- * Internal dependencies
27
- */
28
-
29
- const {
30
- EditorCanvas
31
- } = (0, _lockUnlock.unlock)(_editor.privateApis);
32
- const isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;
33
- function VisualEditor({
34
- styles
35
- }) {
36
- const {
37
- isWelcomeGuideVisible,
38
- renderingMode,
39
- isBlockBasedTheme,
40
- hasV3BlocksOnly,
41
- isEditingTemplate
42
- } = (0, _data.useSelect)(select => {
43
- const {
44
- isFeatureActive
45
- } = select(_store.store);
46
- const {
47
- getEditorSettings,
48
- getRenderingMode
49
- } = select(_editor.store);
50
- const {
51
- getBlockTypes
52
- } = select(_blocks.store);
53
- const editorSettings = getEditorSettings();
54
- return {
55
- isWelcomeGuideVisible: isFeatureActive('welcomeGuide'),
56
- renderingMode: getRenderingMode(),
57
- isBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme,
58
- hasV3BlocksOnly: getBlockTypes().every(type => {
59
- return type.apiVersion >= 3;
60
- }),
61
- isEditingTemplate: select(_editor.store).getCurrentPostType() === 'wp_template'
62
- };
63
- }, []);
64
- const hasMetaBoxes = (0, _data.useSelect)(select => select(_store.store).hasMetaBoxes(), []);
65
- const paddingAppenderRef = (0, _usePaddingAppender.usePaddingAppender)();
66
- let paddingBottom;
67
-
68
- // Add a constant padding for the typewritter effect. When typing at the
69
- // bottom, there needs to be room to scroll up.
70
- if (!hasMetaBoxes && renderingMode === 'post-only') {
71
- paddingBottom = '40vh';
72
- }
73
- styles = (0, _element.useMemo)(() => [...styles, {
74
- // We should move this in to future to the body.
75
- css: paddingBottom ? `body{padding-bottom:${paddingBottom}}` : ''
76
- }], [styles, paddingBottom]);
77
- const isToBeIframed = (hasV3BlocksOnly || isGutenbergPlugin && isBlockBasedTheme) && !hasMetaBoxes || isEditingTemplate;
78
- return (0, _react.createElement)("div", {
79
- className: (0, _classnames.default)('edit-post-visual-editor', {
80
- 'has-inline-canvas': !isToBeIframed
81
- })
82
- }, (0, _react.createElement)(EditorCanvas, {
83
- disableIframe: !isToBeIframed,
84
- styles: styles
85
- // We should auto-focus the canvas (title) on load.
86
- // eslint-disable-next-line jsx-a11y/no-autofocus
87
- ,
88
- autoFocus: !isWelcomeGuideVisible,
89
- contentRef: paddingAppenderRef
90
- }));
91
- }
92
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_editor","_element","_data","_blocks","_store","_lockUnlock","_usePaddingAppender","EditorCanvas","unlock","editorPrivateApis","isGutenbergPlugin","process","env","IS_GUTENBERG_PLUGIN","VisualEditor","styles","isWelcomeGuideVisible","renderingMode","isBlockBasedTheme","hasV3BlocksOnly","isEditingTemplate","useSelect","select","isFeatureActive","editPostStore","getEditorSettings","getRenderingMode","editorStore","getBlockTypes","blocksStore","editorSettings","__unstableIsBlockBasedTheme","every","type","apiVersion","getCurrentPostType","hasMetaBoxes","paddingAppenderRef","usePaddingAppender","paddingBottom","useMemo","css","isToBeIframed","_react","createElement","className","classnames","disableIframe","autoFocus","contentRef"],"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { usePaddingAppender } from './use-padding-appender';\n\nconst { EditorCanvas } = unlock( editorPrivateApis );\n\nconst isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;\n\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tisWelcomeGuideVisible,\n\t\trenderingMode,\n\t\tisBlockBasedTheme,\n\t\thasV3BlocksOnly,\n\t\tisEditingTemplate,\n\t} = useSelect( ( select ) => {\n\t\tconst { isFeatureActive } = select( editPostStore );\n\t\tconst { getEditorSettings, getRenderingMode } = select( editorStore );\n\t\tconst { getBlockTypes } = select( blocksStore );\n\t\tconst editorSettings = getEditorSettings();\n\n\t\treturn {\n\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t\trenderingMode: getRenderingMode(),\n\t\t\tisBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme,\n\t\t\thasV3BlocksOnly: getBlockTypes().every( ( type ) => {\n\t\t\t\treturn type.apiVersion >= 3;\n\t\t\t} ),\n\t\t\tisEditingTemplate:\n\t\t\t\tselect( editorStore ).getCurrentPostType() === 'wp_template',\n\t\t};\n\t}, [] );\n\tconst hasMetaBoxes = useSelect(\n\t\t( select ) => select( editPostStore ).hasMetaBoxes(),\n\t\t[]\n\t);\n\n\tconst paddingAppenderRef = usePaddingAppender();\n\n\tlet paddingBottom;\n\n\t// Add a constant padding for the typewritter effect. When typing at the\n\t// bottom, there needs to be room to scroll up.\n\tif ( ! hasMetaBoxes && renderingMode === 'post-only' ) {\n\t\tpaddingBottom = '40vh';\n\t}\n\n\tstyles = useMemo(\n\t\t() => [\n\t\t\t...styles,\n\t\t\t{\n\t\t\t\t// We should move this in to future to the body.\n\t\t\t\tcss: paddingBottom\n\t\t\t\t\t? `body{padding-bottom:${ paddingBottom }}`\n\t\t\t\t\t: '',\n\t\t\t},\n\t\t],\n\t\t[ styles, paddingBottom ]\n\t);\n\n\tconst isToBeIframed =\n\t\t( ( hasV3BlocksOnly || ( isGutenbergPlugin && isBlockBasedTheme ) ) &&\n\t\t\t! hasMetaBoxes ) ||\n\t\tisEditingTemplate;\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames( 'edit-post-visual-editor', {\n\t\t\t\t'has-inline-canvas': ! isToBeIframed,\n\t\t\t} ) }\n\t\t>\n\t\t\t<EditorCanvas\n\t\t\t\tdisableIframe={ ! isToBeIframed }\n\t\t\t\tstyles={ styles }\n\t\t\t\t// We should auto-focus the canvas (title) on load.\n\t\t\t\t// eslint-disable-next-line jsx-a11y/no-autofocus\n\t\t\t\tautoFocus={ ! isWelcomeGuideVisible }\n\t\t\t\tcontentRef={ paddingAppenderRef }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,mBAAA,GAAAP,OAAA;AArBA;AACA;AACA;;AAGA;AACA;AACA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K,CAAEH,YAAY,IAAInB,aAAa,KAAK,WAAW,EAAG;IACtDsB,aAAa,GAAG,MAAM;EACvB;EAEAxB,MAAM,GAAG,IAAAyB,gBAAO,EACf,MAAM,CACL,GAAGzB,MAAM,EACT;IACC;IACA0B,GAAG,EAAEF,aAAa,GACd,uBAAuBA,aAAe,GAAE,GACzC;EACJ,CAAC,CACD,EACD,CAAExB,MAAM,EAAEwB,aAAa,CACxB,CAAC;EAED,MAAMG,aAAa,GAChB,CAAEvB,eAAe,IAAMT,iBAAiB,IAAIQ,iBAAmB,KAChE,CAAEkB,YAAY,IACfhB,iBAAiB;EAElB,OACC,IAAAuB,MAAA,CAAAC,aAAA;IACCC,SAAS,EAAG,IAAAC,mBAAU,EAAE,yBAAyB,EAAE;MAClD,mBAAmB,EAAE,CAAEJ;IACxB,CAAE;EAAG,GAEL,IAAAC,MAAA,CAAAC,aAAA,EAACrC,YAAY;IACZwC,aAAa,EAAG,CAAEL,aAAe;IACjC3B,MAAM,EAAGA;IACT;IACA;IAAA;IACAiC,SAAS,EAAG,CAAEhC,qBAAuB;IACrCiC,UAAU,EAAGZ;EAAoB,CACjC,CACG,CAAC;AAER","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["_data","require","_compose","_blockEditor","_blocks","usePaddingAppender","registry","useRegistry","useRefEffect","node","onMouseDown","event","target","ownerDocument","defaultView","paddingBottom","parseInt","getComputedStyle","lastChild","lastElementChild","lastChildRect","getBoundingClientRect","clientY","bottom","preventDefault","blockOrder","select","blockEditorStore","getBlockOrder","lastBlockClientId","length","lastBlock","getBlock","selectBlock","insertDefaultBlock","dispatch","isUnmodifiedDefaultBlock","addEventListener","removeEventListener"],"sources":["@wordpress/edit-post/src/components/visual-editor/use-padding-appender.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\n\nexport function usePaddingAppender() {\n\tconst registry = useRegistry();\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tfunction onMouseDown( event ) {\n\t\t\t\tif ( event.target !== node ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst { ownerDocument } = node;\n\t\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\t\tconst paddingBottom = defaultView.parseInt(\n\t\t\t\t\tdefaultView.getComputedStyle( node ).paddingBottom,\n\t\t\t\t\t10\n\t\t\t\t);\n\n\t\t\t\tif ( ! paddingBottom ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// only handle clicks under the last child\n\t\t\t\tconst lastChild = node.lastElementChild;\n\t\t\t\tif ( ! lastChild ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst lastChildRect = lastChild.getBoundingClientRect();\n\t\t\t\tif ( event.clientY < lastChildRect.bottom ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tconst blockOrder = registry\n\t\t\t\t\t.select( blockEditorStore )\n\t\t\t\t\t.getBlockOrder( '' );\n\t\t\t\tconst lastBlockClientId = blockOrder[ blockOrder.length - 1 ];\n\t\t\t\tconst lastBlock = registry\n\t\t\t\t\t.select( blockEditorStore )\n\t\t\t\t\t.getBlock( lastBlockClientId );\n\t\t\t\tconst { selectBlock, insertDefaultBlock } =\n\t\t\t\t\tregistry.dispatch( blockEditorStore );\n\n\t\t\t\tif ( isUnmodifiedDefaultBlock( lastBlock ) ) {\n\t\t\t\t\tselectBlock( lastBlockClientId );\n\t\t\t\t} else {\n\t\t\t\t\tinsertDefaultBlock();\n\t\t\t\t}\n\t\t\t}\n\t\t\tnode.addEventListener( 'mousedown', onMouseDown );\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'mousedown', onMouseDown );\n\t\t\t};\n\t\t},\n\t\t[ registry ]\n\t);\n}\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AEC;MAAmB,CAAC,GACxC5B,QAAQ,CAAC6B,QAAQ,CAAER,kBAAiB,CAAC;MAEtC,IAAK,IAAAS,gCAAwB,EAAEL,SAAU,CAAC,EAAG;QAC5CE,WAAW,CAAEJ,iBAAkB,CAAC;MACjC,CAAC,MAAM;QACNK,kBAAkB,CAAC,CAAC;MACrB;IACD;IACAzB,IAAI,CAAC4B,gBAAgB,CAAE,WAAW,EAAE3B,WAAY,CAAC;IACjD,OAAO,MAAM;MACZD,IAAI,CAAC6B,mBAAmB,CAAE,WAAW,EAAE5B,WAAY,CAAC;IACrD,CAAC;EACF,CAAC,EACD,CAAEJ,QAAQ,CACX,CAAC;AACF","ignoreList":[]}
@@ -1,119 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = useCommonCommands;
7
- var _data = require("@wordpress/data");
8
- var _i18n = require("@wordpress/i18n");
9
- var _icons = require("@wordpress/icons");
10
- var _commands = require("@wordpress/commands");
11
- var _preferences = require("@wordpress/preferences");
12
- var _editor = require("@wordpress/editor");
13
- var _notices = require("@wordpress/notices");
14
- var _store = require("../../store");
15
- var _lockUnlock = require("../../lock-unlock");
16
- /**
17
- * WordPress dependencies
18
- */
19
-
20
- /**
21
- * Internal dependencies
22
- */
23
-
24
- const {
25
- interfaceStore
26
- } = (0, _lockUnlock.unlock)(_editor.privateApis);
27
- function useCommonCommands() {
28
- const {
29
- openGeneralSidebar,
30
- closeGeneralSidebar
31
- } = (0, _data.useDispatch)(_store.store);
32
- const {
33
- activeSidebar,
34
- isFullscreen,
35
- isPublishSidebarEnabled
36
- } = (0, _data.useSelect)(select => {
37
- const {
38
- get
39
- } = select(_preferences.store);
40
- return {
41
- activeSidebar: select(interfaceStore).getActiveComplementaryArea('core'),
42
- isPublishSidebarEnabled: select(_editor.store).isPublishSidebarEnabled(),
43
- isFullscreen: get('core/edit-post', 'fullscreenMode')
44
- };
45
- }, []);
46
- const {
47
- toggle
48
- } = (0, _data.useDispatch)(_preferences.store);
49
- const {
50
- createInfoNotice
51
- } = (0, _data.useDispatch)(_notices.store);
52
- (0, _commands.useCommand)({
53
- name: 'core/open-settings-sidebar',
54
- label: (0, _i18n.__)('Toggle settings sidebar'),
55
- icon: (0, _i18n.isRTL)() ? _icons.drawerLeft : _icons.drawerRight,
56
- callback: ({
57
- close
58
- }) => {
59
- close();
60
- if (activeSidebar === 'edit-post/document') {
61
- closeGeneralSidebar();
62
- } else {
63
- openGeneralSidebar('edit-post/document');
64
- }
65
- }
66
- });
67
- (0, _commands.useCommand)({
68
- name: 'core/open-block-inspector',
69
- label: (0, _i18n.__)('Toggle block inspector'),
70
- icon: _icons.blockDefault,
71
- callback: ({
72
- close
73
- }) => {
74
- close();
75
- if (activeSidebar === 'edit-post/block') {
76
- closeGeneralSidebar();
77
- } else {
78
- openGeneralSidebar('edit-post/block');
79
- }
80
- }
81
- });
82
- (0, _commands.useCommand)({
83
- name: 'core/toggle-fullscreen-mode',
84
- label: isFullscreen ? (0, _i18n.__)('Exit fullscreen') : (0, _i18n.__)('Enter fullscreen'),
85
- icon: _icons.fullscreen,
86
- callback: ({
87
- close
88
- }) => {
89
- toggle('core/edit-post', 'fullscreenMode');
90
- close();
91
- createInfoNotice(isFullscreen ? (0, _i18n.__)('Fullscreen off.') : (0, _i18n.__)('Fullscreen on.'), {
92
- id: 'core/edit-post/toggle-fullscreen-mode/notice',
93
- type: 'snackbar',
94
- actions: [{
95
- label: (0, _i18n.__)('Undo'),
96
- onClick: () => {
97
- toggle('core/edit-post', 'fullscreenMode');
98
- }
99
- }]
100
- });
101
- }
102
- });
103
- (0, _commands.useCommand)({
104
- name: 'core/toggle-publish-sidebar',
105
- label: isPublishSidebarEnabled ? (0, _i18n.__)('Disable pre-publish checks') : (0, _i18n.__)('Enable pre-publish checks'),
106
- icon: _icons.formatListBullets,
107
- callback: ({
108
- close
109
- }) => {
110
- close();
111
- toggle('core', 'isPublishSidebarEnabled');
112
- createInfoNotice(isPublishSidebarEnabled ? (0, _i18n.__)('Pre-publish checks disabled.') : (0, _i18n.__)('Pre-publish checks enabled.'), {
113
- id: 'core/editor/publish-sidebar/notice',
114
- type: 'snackbar'
115
- });
116
- }
117
- });
118
- }
119
- //# sourceMappingURL=use-common-commands.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_data","require","_i18n","_icons","_commands","_preferences","_editor","_notices","_store","_lockUnlock","interfaceStore","unlock","editorPrivateApis","useCommonCommands","openGeneralSidebar","closeGeneralSidebar","useDispatch","editPostStore","activeSidebar","isFullscreen","isPublishSidebarEnabled","useSelect","select","get","preferencesStore","getActiveComplementaryArea","editorStore","toggle","createInfoNotice","noticesStore","useCommand","name","label","__","icon","isRTL","drawerLeft","drawerRight","callback","close","blockDefault","fullscreen","id","type","actions","onClick","formatListBullets"],"sources":["@wordpress/edit-post/src/hooks/commands/use-common-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tfullscreen,\n\tformatListBullets,\n} from '@wordpress/icons';\nimport { useCommand } from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { interfaceStore } = unlock( editorPrivateApis );\n\nexport default function useCommonCommands() {\n\tconst { openGeneralSidebar, closeGeneralSidebar } =\n\t\tuseDispatch( editPostStore );\n\tconst { activeSidebar, isFullscreen, isPublishSidebarEnabled } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { get } = select( preferencesStore );\n\n\t\t\treturn {\n\t\t\t\tactiveSidebar:\n\t\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t\t\t'core'\n\t\t\t\t\t),\n\t\t\t\tisPublishSidebarEnabled:\n\t\t\t\t\tselect( editorStore ).isPublishSidebarEnabled(),\n\t\t\t\tisFullscreen: get( 'core/edit-post', 'fullscreenMode' ),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\n\tuseCommand( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/document' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/document' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-post/block' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-post/block' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-fullscreen-mode',\n\t\tlabel: isFullscreen\n\t\t\t? __( 'Exit fullscreen' )\n\t\t\t: __( 'Enter fullscreen' ),\n\t\ticon: fullscreen,\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-post', 'fullscreenMode' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisFullscreen ? __( 'Fullscreen off.' ) : __( 'Fullscreen on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-post/toggle-fullscreen-mode/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core/edit-post', 'fullscreenMode' );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tuseCommand( {\n\t\tname: 'core/toggle-publish-sidebar',\n\t\tlabel: isPublishSidebarEnabled\n\t\t\t? __( 'Disable pre-publish checks' )\n\t\t\t: __( 'Enable pre-publish checks' ),\n\t\ticon: formatListBullets,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\ttoggle( 'core', 'isPublishSidebarEnabled' );\n\t\t\tcreateInfoNotice(\n\t\t\t\tisPublishSidebarEnabled\n\t\t\t\t\t? __( 'Pre-publish checks disabled.' )\n\t\t\t\t\t: __( 'Pre-publish checks enabled.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/editor/publish-sidebar/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAOA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAIA,IAAAM,QAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAxBA;AACA;AACA;;AAkBA;AACA;AACA;;AAIA,MAAM;EAAES;AAAe,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAEvC,SAASC,iBAAiBA,CAAA,EAAG;EAC3C,MAAM;IAAEC,kBAAkB;IAAEC;EAAoB,CAAC,GAChD,IAAAC,iBAAW,EAAEC,YAAc,CAAC;EAC7B,MAAM;IAAEC,aAAa;IAA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ACxCC,IAAI,EAAE;MACP,CACD,CAAC;IACF;EACD,CAAE,CAAC;AACJ","ignoreList":[]}
@@ -1,11 +0,0 @@
1
- "use strict";
2
-
3
- var _hooks = require("@wordpress/hooks");
4
- var _mediaUtils = require("@wordpress/media-utils");
5
- /**
6
- * WordPress dependencies
7
- */
8
-
9
- const replaceMediaUpload = () => _mediaUtils.MediaUpload;
10
- (0, _hooks.addFilter)('editor.MediaUpload', 'core/edit-post/replace-media-upload', replaceMediaUpload);
11
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_hooks","require","_mediaUtils","replaceMediaUpload","MediaUpload","addFilter"],"sources":["@wordpress/edit-post/src/hooks/components/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { MediaUpload } from '@wordpress/media-utils';\n\nconst replaceMediaUpload = () => MediaUpload;\n\naddFilter(\n\t'editor.MediaUpload',\n\t'core/edit-post/replace-media-upload',\n\treplaceMediaUpload\n);\n"],"mappings":";;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA,MAAME,kBAAkB,GAAGA,CAAA,KAAMC,uBAAW;AAE5C,IAAAC,gBAAS,EACR,oBAAoB,EACpB,qCAAqC,EACrCF,kBACD,CAAC","ignoreList":[]}
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- require("./components");
4
- require("./validate-multiple-use");
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["require"],"sources":["@wordpress/edit-post/src/hooks/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport './components';\nimport './validate-multiple-use';\n"],"mappings":";;AAGAA,OAAA;AACAA,OAAA","ignoreList":[]}
@@ -1,134 +0,0 @@
1
- "use strict";
2
-
3
- var _react = require("react");
4
- var _blocks = require("@wordpress/blocks");
5
- var _components = require("@wordpress/components");
6
- var _data = require("@wordpress/data");
7
- var _blockEditor = require("@wordpress/block-editor");
8
- var _hooks = require("@wordpress/hooks");
9
- var _i18n = require("@wordpress/i18n");
10
- var _compose = require("@wordpress/compose");
11
- /**
12
- * WordPress dependencies
13
- */
14
-
15
- /**
16
- * Recursively find very first block of an specific block type.
17
- *
18
- * @param {Object[]} blocks List of blocks.
19
- * @param {string} name Block name to search.
20
- *
21
- * @return {Object|undefined} Return block object or undefined.
22
- */
23
- function findFirstOfSameType(blocks, name) {
24
- if (!Array.isArray(blocks) || !blocks.length) {
25
- return;
26
- }
27
- for (const block of blocks) {
28
- if (block.name === name) {
29
- return block;
30
- }
31
-
32
- // Search inside innerBlocks.
33
- const firstBlock = findFirstOfSameType(block.innerBlocks, name);
34
- if (firstBlock) {
35
- return firstBlock;
36
- }
37
- }
38
- }
39
- const enhance = (0, _compose.compose)(
40
- /**
41
- * For blocks whose block type doesn't support `multiple`, provides the
42
- * wrapped component with `originalBlockClientId` -- a reference to the
43
- * first block of the same type in the content -- if and only if that
44
- * "original" block is not the current one. Thus, an inexisting
45
- * `originalBlockClientId` prop signals that the block is valid.
46
- *
47
- * @param {Component} WrappedBlockEdit A filtered BlockEdit instance.
48
- *
49
- * @return {Component} Enhanced component with merged state data props.
50
- */
51
- (0, _data.withSelect)((select, block) => {
52
- const multiple = (0, _blocks.hasBlockSupport)(block.name, 'multiple', true);
53
-
54
- // For block types with `multiple` support, there is no "original
55
- // block" to be found in the content, as the block itself is valid.
56
- if (multiple) {
57
- return {};
58
- }
59
-
60
- // Otherwise, only pass `originalBlockClientId` if it refers to a different
61
- // block from the current one.
62
- const blocks = select(_blockEditor.store).getBlocks();
63
- const firstOfSameType = findFirstOfSameType(blocks, block.name);
64
- const isInvalid = firstOfSameType && firstOfSameType.clientId !== block.clientId;
65
- return {
66
- originalBlockClientId: isInvalid && firstOfSameType.clientId
67
- };
68
- }), (0, _data.withDispatch)((dispatch, {
69
- originalBlockClientId
70
- }) => ({
71
- selectFirst: () => dispatch(_blockEditor.store).selectBlock(originalBlockClientId)
72
- })));
73
- const withMultipleValidation = (0, _compose.createHigherOrderComponent)(BlockEdit => {
74
- return enhance(({
75
- originalBlockClientId,
76
- selectFirst,
77
- ...props
78
- }) => {
79
- if (!originalBlockClientId) {
80
- return (0, _react.createElement)(BlockEdit, {
81
- ...props
82
- });
83
- }
84
- const blockType = (0, _blocks.getBlockType)(props.name);
85
- const outboundType = getOutboundType(props.name);
86
- return [(0, _react.createElement)("div", {
87
- key: "invalid-preview",
88
- style: {
89
- minHeight: '60px'
90
- }
91
- }, (0, _react.createElement)(BlockEdit, {
92
- key: "block-edit",
93
- ...props
94
- })), (0, _react.createElement)(_blockEditor.Warning, {
95
- key: "multiple-use-warning",
96
- actions: [(0, _react.createElement)(_components.Button, {
97
- key: "find-original",
98
- variant: "secondary",
99
- onClick: selectFirst
100
- }, (0, _i18n.__)('Find original')), (0, _react.createElement)(_components.Button, {
101
- key: "remove",
102
- variant: "secondary",
103
- onClick: () => props.onReplace([])
104
- }, (0, _i18n.__)('Remove')), outboundType && (0, _react.createElement)(_components.Button, {
105
- key: "transform",
106
- variant: "secondary",
107
- onClick: () => props.onReplace((0, _blocks.createBlock)(outboundType.name, props.attributes))
108
- }, (0, _i18n.__)('Transform into:'), " ", outboundType.title)]
109
- }, (0, _react.createElement)("strong", null, blockType?.title, ": "), (0, _i18n.__)('This block can only be used once.'))];
110
- });
111
- }, 'withMultipleValidation');
112
-
113
- /**
114
- * Given a base block name, returns the default block type to which to offer
115
- * transforms.
116
- *
117
- * @param {string} blockName Base block name.
118
- *
119
- * @return {?Object} The chosen default block type.
120
- */
121
- function getOutboundType(blockName) {
122
- // Grab the first outbound transform.
123
- const transform = (0, _blocks.findTransform)((0, _blocks.getBlockTransforms)('to', blockName), ({
124
- type,
125
- blocks
126
- }) => type === 'block' && blocks.length === 1 // What about when .length > 1?
127
- );
128
- if (!transform) {
129
- return null;
130
- }
131
- return (0, _blocks.getBlockType)(transform.blocks[0]);
132
- }
133
- (0, _hooks.addFilter)('editor.BlockEdit', 'core/edit-post/validate-multiple-use/with-multiple-validation', withMultipleValidation);
134
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_blocks","require","_components","_data","_blockEditor","_hooks","_i18n","_compose","findFirstOfSameType","blocks","name","Array","isArray","length","block","firstBlock","innerBlocks","enhance","compose","withSelect","select","multiple","hasBlockSupport","blockEditorStore","getBlocks","firstOfSameType","isInvalid","clientId","originalBlockClientId","withDispatch","dispatch","selectFirst","selectBlock","withMultipleValidation","createHigherOrderComponent","BlockEdit","props","_react","createElement","blockType","getBlockType","outboundType","getOutboundType","key","style","minHeight","Warning","actions","Button","variant","onClick","__","onReplace","createBlock","attributes","title","blockName","transform","findTransform","getBlockTransforms","type","addFilter"],"sources":["@wordpress/edit-post/src/hooks/validate-multiple-use/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateBlock,\n\tfindTransform,\n\tgetBlockTransforms,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { Button } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { Warning, store as blockEditorStore } from '@wordpress/block-editor';\nimport { addFilter } from '@wordpress/hooks';\nimport { __ } from '@wordpress/i18n';\nimport { compose, createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Recursively find very first block of an specific block type.\n *\n * @param {Object[]} blocks List of blocks.\n * @param {string} name Block name to search.\n *\n * @return {Object|undefined} Return block object or undefined.\n */\nfunction findFirstOfSameType( blocks, name ) {\n\tif ( ! Array.isArray( blocks ) || ! blocks.length ) {\n\t\treturn;\n\t}\n\n\tfor ( const block of blocks ) {\n\t\tif ( block.name === name ) {\n\t\t\treturn block;\n\t\t}\n\n\t\t// Search inside innerBlocks.\n\t\tconst firstBlock = findFirstOfSameType( block.innerBlocks, name );\n\n\t\tif ( firstBlock ) {\n\t\t\treturn firstBlock;\n\t\t}\n\t}\n}\n\nconst enhance = compose(\n\t/**\n\t * For blocks whose block type doesn't support `multiple`, provides the\n\t * wrapped component with `originalBlockClientId` -- a reference to the\n\t * first block of the same type in the content -- if and only if that\n\t * \"original\" block is not the current one. Thus, an inexisting\n\t * `originalBlockClientId` prop signals that the block is valid.\n\t *\n\t * @param {Component} WrappedBlockEdit A filtered BlockEdit instance.\n\t *\n\t * @return {Component} Enhanced component with merged state data props.\n\t */\n\twithSelect( ( select, block ) => {\n\t\tconst multiple = hasBlockSupport( block.name, 'multiple', true );\n\n\t\t// For block types with `multiple` support, there is no \"original\n\t\t// block\" to be found in the content, as the block itself is valid.\n\t\tif ( multiple ) {\n\t\t\treturn {};\n\t\t}\n\n\t\t// Otherwise, only pass `originalBlockClientId` if it refers to a different\n\t\t// block from the current one.\n\t\tconst blocks = select( blockEditorStore ).getBlocks();\n\t\tconst firstOfSameType = findFirstOfSameType( blocks, block.name );\n\t\tconst isInvalid =\n\t\t\tfirstOfSameType && firstOfSameType.clientId !== block.clientId;\n\t\treturn {\n\t\t\toriginalBlockClientId: isInvalid && firstOfSameType.clientId,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { originalBlockClientId } ) => ( {\n\t\tselectFirst: () =>\n\t\t\tdispatch( blockEditorStore ).selectBlock( originalBlockClientId ),\n\t} ) )\n);\n\nconst withMultipleValidation = createHigherOrderComponent( ( BlockEdit ) => {\n\treturn enhance( ( { originalBlockClientId, selectFirst, ...props } ) => {\n\t\tif ( ! originalBlockClientId ) {\n\t\t\treturn <BlockEdit { ...props } />;\n\t\t}\n\n\t\tconst blockType = getBlockType( props.name );\n\t\tconst outboundType = getOutboundType( props.name );\n\n\t\treturn [\n\t\t\t<div key=\"invalid-preview\" style={ { minHeight: '60px' } }>\n\t\t\t\t<BlockEdit key=\"block-edit\" { ...props } />\n\t\t\t</div>,\n\t\t\t<Warning\n\t\t\t\tkey=\"multiple-use-warning\"\n\t\t\t\tactions={ [\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey=\"find-original\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ selectFirst }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Find original' ) }\n\t\t\t\t\t</Button>,\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey=\"remove\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ () => props.onReplace( [] ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t</Button>,\n\t\t\t\t\toutboundType && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey=\"transform\"\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tprops.onReplace(\n\t\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\t\toutboundType.name,\n\t\t\t\t\t\t\t\t\t\tprops.attributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Transform into:' ) } { outboundType.title }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t),\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t<strong>{ blockType?.title }: </strong>\n\t\t\t\t{ __( 'This block can only be used once.' ) }\n\t\t\t</Warning>,\n\t\t];\n\t} );\n}, 'withMultipleValidation' );\n\n/**\n * Given a base block name, returns the default block type to which to offer\n * transforms.\n *\n * @param {string} blockName Base block name.\n *\n * @return {?Object} The chosen default block type.\n */\nfunction getOutboundType( blockName ) {\n\t// Grab the first outbound transform.\n\tconst transform = findTransform(\n\t\tgetBlockTransforms( 'to', blockName ),\n\t\t( { type, blocks } ) => type === 'block' && blocks.length === 1 // What about when .length > 1?\n\t);\n\n\tif ( ! transform ) {\n\t\treturn null;\n\t}\n\n\treturn getBlockType( transform.blocks[ 0 ] );\n}\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit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AS,CAAChD,MAAM,CAAE,CAAC,CAAG,CAAC;AAC7C;AAEA,IAAAoD,gBAAS,EACR,kBAAkB,EAClB,+DAA+D,EAC/D5B,sBACD,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["classnames","useSelect","Button","Icon","__unstableMotion","motion","__","addQueryArgs","wordpress","store","editorStore","coreStore","useReducedMotion","editPostStore","FullscreenModeClose","showTooltip","icon","href","initialPost","_postType$labels$view","isActive","isRequestingSiteIcon","postType","siteIconUrl","select","getCurrentPostType","isFeatureActive","getEntityRecord","getPostType","isResolving","siteData","undefined","_postType","type","site_icon_url","disableMotion","buttonIcon","createElement","size","effect","expand","scale","transition","duration","img","variants","alt","className","src","classes","buttonHref","post_type","slug","buttonLabel","labels","view_items","div","whileHover","label"],"sources":["@wordpress/edit-post/src/components/header/fullscreen-mode-close/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tIcon,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\nimport { wordpress } from '@wordpress/icons';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useReducedMotion } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nfunction FullscreenModeClose( { showTooltip, icon, href, initialPost } ) {\n\tconst { isActive, isRequestingSiteIcon, postType, siteIconUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPostType } = select( editorStore );\n\t\t\tconst { isFeatureActive } = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, isResolving } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst siteData =\n\t\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\t\t\tconst _postType = initialPost?.type || getCurrentPostType();\n\t\t\treturn {\n\t\t\t\tisActive: isFeatureActive( 'fullscreenMode' ),\n\t\t\t\tisRequestingSiteIcon: isResolving( 'getEntityRecord', [\n\t\t\t\t\t'root',\n\t\t\t\t\t'__unstableBase',\n\t\t\t\t\tundefined,\n\t\t\t\t] ),\n\t\t\t\tpostType: getPostType( _postType ),\n\t\t\t\tsiteIconUrl: siteData.site_icon_url,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst disableMotion = useReducedMotion();\n\n\tif ( ! isActive || ! postType ) {\n\t\treturn null;\n\t}\n\n\tlet buttonIcon = <Icon size=\"36px\" icon={ wordpress } />;\n\n\tconst effect = {\n\t\texpand: {\n\t\t\tscale: 1.25,\n\t\t\ttransition: { type: 'tween', duration: '0.3' },\n\t\t},\n\t};\n\n\tif ( siteIconUrl ) {\n\t\tbuttonIcon = (\n\t\t\t<motion.img\n\t\t\t\tvariants={ ! disableMotion && effect }\n\t\t\t\talt={ __( 'Site Icon' ) }\n\t\t\t\tclassName=\"edit-post-fullscreen-mode-close_site-icon\"\n\t\t\t\tsrc={ siteIconUrl }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isRequestingSiteIcon ) {\n\t\tbuttonIcon = null;\n\t}\n\n\t// Override default icon if custom icon is provided via props.\n\tif ( icon ) {\n\t\tbuttonIcon = <Icon size=\"36px\" icon={ icon } />;\n\t}\n\n\tconst classes = classnames( {\n\t\t'edit-post-fullscreen-mode-close': true,\n\t\t'has-icon': siteIconUrl,\n\t} );\n\n\tconst buttonHref =\n\t\thref ??\n\t\taddQueryArgs( 'edit.php', {\n\t\t\tpost_type: postType.slug,\n\t\t} );\n\n\tconst buttonLabel = postType?.labels?.view_items ?? __( 'Back' );\n\n\treturn (\n\t\t<motion.div whileHover=\"expand\">\n\t\t\t<Button\n\t\t\t\tclassName={ classes }\n\t\t\t\thref={ buttonHref }\n\t\t\t\tlabel={ buttonLabel }\n\t\t\t\tshowTooltip={ showTooltip }\n\t\t\t>\n\t\t\t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