@wordpress/editor 13.24.1 → 13.26.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 (307) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE.md +1 -1
  3. package/build/components/document-bar/index.js +164 -0
  4. package/build/components/document-bar/index.js.map +1 -0
  5. package/build/components/document-outline/index.js +82 -1
  6. package/build/components/document-outline/index.js.map +1 -1
  7. package/build/components/document-tools/index.js +160 -0
  8. package/build/components/document-tools/index.js.map +1 -0
  9. package/build/components/editor-canvas/edit-template-blocks-notification.js +106 -0
  10. package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -0
  11. package/build/components/editor-canvas/index.js +298 -0
  12. package/build/components/editor-canvas/index.js.map +1 -0
  13. package/build/components/entities-saved-states/index.js +3 -1
  14. package/build/components/entities-saved-states/index.js.map +1 -1
  15. package/build/components/global-keyboard-shortcuts/index.js +12 -2
  16. package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
  17. package/build/components/global-keyboard-shortcuts/register-shortcuts.js +9 -0
  18. package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  19. package/build/components/index.js +72 -8
  20. package/build/components/index.js.map +1 -1
  21. package/build/components/index.native.js +9 -1
  22. package/build/components/index.native.js.map +1 -1
  23. package/build/components/inserter-sidebar/index.js +77 -0
  24. package/build/components/inserter-sidebar/index.js.map +1 -0
  25. package/build/components/list-view-sidebar/index.js +150 -0
  26. package/build/components/list-view-sidebar/index.js.map +1 -0
  27. package/build/components/list-view-sidebar/list-view-outline.js +28 -0
  28. package/build/components/list-view-sidebar/list-view-outline.js.map +1 -0
  29. package/build/components/offline-status/index.native.js +85 -0
  30. package/build/components/offline-status/index.native.js.map +1 -0
  31. package/build/components/page-attributes/panel.js +63 -0
  32. package/build/components/page-attributes/panel.js.map +1 -0
  33. package/build/components/post-discussion/panel.js +59 -0
  34. package/build/components/post-discussion/panel.js.map +1 -0
  35. package/build/components/post-excerpt/check.js +19 -0
  36. package/build/components/post-excerpt/check.js.map +1 -1
  37. package/build/components/post-excerpt/panel.js +55 -0
  38. package/build/components/post-excerpt/panel.js.map +1 -0
  39. package/build/components/post-excerpt/plugin.js +72 -0
  40. package/build/components/post-excerpt/plugin.js.map +1 -0
  41. package/build/components/post-featured-image/index.js +5 -8
  42. package/build/components/post-featured-image/index.js.map +1 -1
  43. package/build/components/post-featured-image/panel.js +60 -0
  44. package/build/components/post-featured-image/panel.js.map +1 -0
  45. package/build/components/post-last-revision/panel.js +27 -0
  46. package/build/components/post-last-revision/panel.js.map +1 -0
  47. package/build/components/post-publish-button/index.js +1 -0
  48. package/build/components/post-publish-button/index.js.map +1 -1
  49. package/build/components/post-publish-panel/maybe-upload-media.js +2 -4
  50. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  51. package/build/components/post-saved-state/index.js +13 -8
  52. package/build/components/post-saved-state/index.js.map +1 -1
  53. package/build/components/post-schedule/panel.js +1 -1
  54. package/build/components/post-schedule/panel.js.map +1 -1
  55. package/build/components/post-taxonomies/panel.js +68 -0
  56. package/build/components/post-taxonomies/panel.js.map +1 -0
  57. package/build/components/post-template/block-theme.js +100 -0
  58. package/build/components/post-template/block-theme.js.map +1 -0
  59. package/build/components/post-template/classic-theme.js +171 -0
  60. package/build/components/post-template/classic-theme.js.map +1 -0
  61. package/build/components/post-template/create-new-template-modal.js +98 -0
  62. package/build/components/post-template/create-new-template-modal.js.map +1 -0
  63. package/build/components/post-template/create-new-template.js +55 -0
  64. package/build/components/post-template/create-new-template.js.map +1 -0
  65. package/build/components/post-template/hooks.js +88 -0
  66. package/build/components/post-template/hooks.js.map +1 -0
  67. package/build/components/post-template/panel.js +70 -0
  68. package/build/components/post-template/panel.js.map +1 -0
  69. package/build/components/post-template/reset-default-template.js +48 -0
  70. package/build/components/post-template/reset-default-template.js.map +1 -0
  71. package/build/components/post-template/swap-template-button.js +86 -0
  72. package/build/components/post-template/swap-template-button.js.map +1 -0
  73. package/build/components/post-title/index.native.js +25 -15
  74. package/build/components/post-title/index.native.js.map +1 -1
  75. package/build/components/post-view-link/index.js +58 -0
  76. package/build/components/post-view-link/index.js.map +1 -0
  77. package/build/components/post-visibility/check.js +5 -17
  78. package/build/components/post-visibility/check.js.map +1 -1
  79. package/build/components/preview-dropdown/index.js +118 -0
  80. package/build/components/preview-dropdown/index.js.map +1 -0
  81. package/build/components/provider/index.js +24 -82
  82. package/build/components/provider/index.js.map +1 -1
  83. package/build/components/provider/index.native.js +36 -8
  84. package/build/components/provider/index.native.js.map +1 -1
  85. package/build/components/provider/navigation-block-editing-mode.js +40 -0
  86. package/build/components/provider/navigation-block-editing-mode.js.map +1 -0
  87. package/build/components/provider/use-block-editor-settings.js +38 -15
  88. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  89. package/build/hooks/index.js +1 -0
  90. package/build/hooks/index.js.map +1 -1
  91. package/build/hooks/pattern-partial-syncing.js +49 -0
  92. package/build/hooks/pattern-partial-syncing.js.map +1 -0
  93. package/build/private-apis.js +14 -0
  94. package/build/private-apis.js.map +1 -1
  95. package/build/store/actions.js +161 -13
  96. package/build/store/actions.js.map +1 -1
  97. package/build/store/defaults.js +2 -1
  98. package/build/store/defaults.js.map +1 -1
  99. package/build/store/index.js +5 -0
  100. package/build/store/index.js.map +1 -1
  101. package/build/store/private-actions.js +52 -0
  102. package/build/store/private-actions.js.map +1 -0
  103. package/build/store/private-selectors.js +52 -0
  104. package/build/store/private-selectors.js.map +1 -0
  105. package/build/store/reducer.js +109 -27
  106. package/build/store/reducer.js.map +1 -1
  107. package/build/store/reducer.native.js +0 -1
  108. package/build/store/reducer.native.js.map +1 -1
  109. package/build/store/selectors.js +104 -9
  110. package/build/store/selectors.js.map +1 -1
  111. package/build/utils/media-upload/index.js +8 -2
  112. package/build/utils/media-upload/index.js.map +1 -1
  113. package/build-module/components/document-bar/index.js +156 -0
  114. package/build-module/components/document-bar/index.js.map +1 -0
  115. package/build-module/components/document-outline/index.js +82 -1
  116. package/build-module/components/document-outline/index.js.map +1 -1
  117. package/build-module/components/document-tools/index.js +151 -0
  118. package/build-module/components/document-tools/index.js.map +1 -0
  119. package/build-module/components/editor-canvas/edit-template-blocks-notification.js +100 -0
  120. package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -0
  121. package/build-module/components/editor-canvas/index.js +289 -0
  122. package/build-module/components/editor-canvas/index.js.map +1 -0
  123. package/build-module/components/entities-saved-states/index.js +3 -1
  124. package/build-module/components/entities-saved-states/index.js.map +1 -1
  125. package/build-module/components/global-keyboard-shortcuts/index.js +12 -2
  126. package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
  127. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +9 -0
  128. package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
  129. package/build-module/components/index.js +9 -1
  130. package/build-module/components/index.js.map +1 -1
  131. package/build-module/components/index.native.js +1 -0
  132. package/build-module/components/index.native.js.map +1 -1
  133. package/build-module/components/inserter-sidebar/index.js +70 -0
  134. package/build-module/components/inserter-sidebar/index.js.map +1 -0
  135. package/build-module/components/list-view-sidebar/index.js +142 -0
  136. package/build-module/components/list-view-sidebar/index.js.map +1 -0
  137. package/build-module/components/list-view-sidebar/list-view-outline.js +20 -0
  138. package/build-module/components/list-view-sidebar/list-view-outline.js.map +1 -0
  139. package/build-module/components/offline-status/index.native.js +77 -0
  140. package/build-module/components/offline-status/index.native.js.map +1 -0
  141. package/build-module/components/page-attributes/panel.js +53 -0
  142. package/build-module/components/page-attributes/panel.js.map +1 -0
  143. package/build-module/components/post-discussion/panel.js +50 -0
  144. package/build-module/components/post-discussion/panel.js.map +1 -0
  145. package/build-module/components/post-excerpt/check.js +19 -0
  146. package/build-module/components/post-excerpt/check.js.map +1 -1
  147. package/build-module/components/post-excerpt/panel.js +48 -0
  148. package/build-module/components/post-excerpt/panel.js.map +1 -0
  149. package/build-module/components/post-excerpt/plugin.js +64 -0
  150. package/build-module/components/post-excerpt/plugin.js.map +1 -0
  151. package/build-module/components/post-featured-image/index.js +5 -8
  152. package/build-module/components/post-featured-image/index.js.map +1 -1
  153. package/build-module/components/post-featured-image/panel.js +51 -0
  154. package/build-module/components/post-featured-image/panel.js.map +1 -0
  155. package/build-module/components/post-last-revision/panel.js +18 -0
  156. package/build-module/components/post-last-revision/panel.js.map +1 -0
  157. package/build-module/components/post-publish-button/index.js +1 -0
  158. package/build-module/components/post-publish-button/index.js.map +1 -1
  159. package/build-module/components/post-publish-panel/maybe-upload-media.js +2 -4
  160. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  161. package/build-module/components/post-saved-state/index.js +13 -8
  162. package/build-module/components/post-saved-state/index.js.map +1 -1
  163. package/build-module/components/post-schedule/panel.js +1 -1
  164. package/build-module/components/post-schedule/panel.js.map +1 -1
  165. package/build-module/components/post-taxonomies/panel.js +59 -0
  166. package/build-module/components/post-taxonomies/panel.js.map +1 -0
  167. package/build-module/components/post-template/block-theme.js +92 -0
  168. package/build-module/components/post-template/block-theme.js.map +1 -0
  169. package/build-module/components/post-template/classic-theme.js +162 -0
  170. package/build-module/components/post-template/classic-theme.js.map +1 -0
  171. package/build-module/components/post-template/create-new-template-modal.js +91 -0
  172. package/build-module/components/post-template/create-new-template-modal.js.map +1 -0
  173. package/build-module/components/post-template/create-new-template.js +47 -0
  174. package/build-module/components/post-template/create-new-template.js.map +1 -0
  175. package/build-module/components/post-template/hooks.js +78 -0
  176. package/build-module/components/post-template/hooks.js.map +1 -0
  177. package/build-module/components/post-template/panel.js +62 -0
  178. package/build-module/components/post-template/panel.js.map +1 -0
  179. package/build-module/components/post-template/reset-default-template.js +41 -0
  180. package/build-module/components/post-template/reset-default-template.js.map +1 -0
  181. package/build-module/components/post-template/swap-template-button.js +79 -0
  182. package/build-module/components/post-template/swap-template-button.js.map +1 -0
  183. package/build-module/components/post-title/index.native.js +26 -16
  184. package/build-module/components/post-title/index.native.js.map +1 -1
  185. package/build-module/components/post-view-link/index.js +51 -0
  186. package/build-module/components/post-view-link/index.js.map +1 -0
  187. package/build-module/components/post-visibility/check.js +6 -16
  188. package/build-module/components/post-visibility/check.js.map +1 -1
  189. package/build-module/components/preview-dropdown/index.js +110 -0
  190. package/build-module/components/preview-dropdown/index.js.map +1 -0
  191. package/build-module/components/provider/index.js +25 -83
  192. package/build-module/components/provider/index.js.map +1 -1
  193. package/build-module/components/provider/index.native.js +37 -9
  194. package/build-module/components/provider/index.native.js.map +1 -1
  195. package/build-module/components/provider/navigation-block-editing-mode.js +34 -0
  196. package/build-module/components/provider/navigation-block-editing-mode.js.map +1 -0
  197. package/build-module/components/provider/use-block-editor-settings.js +38 -15
  198. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  199. package/build-module/hooks/index.js +1 -0
  200. package/build-module/hooks/index.js.map +1 -1
  201. package/build-module/hooks/pattern-partial-syncing.js +46 -0
  202. package/build-module/hooks/pattern-partial-syncing.js.map +1 -0
  203. package/build-module/private-apis.js +14 -0
  204. package/build-module/private-apis.js.map +1 -1
  205. package/build-module/store/actions.js +147 -9
  206. package/build-module/store/actions.js.map +1 -1
  207. package/build-module/store/defaults.js +2 -1
  208. package/build-module/store/defaults.js.map +1 -1
  209. package/build-module/store/index.js +5 -0
  210. package/build-module/store/index.js.map +1 -1
  211. package/build-module/store/private-actions.js +44 -0
  212. package/build-module/store/private-actions.js.map +1 -0
  213. package/build-module/store/private-selectors.js +43 -0
  214. package/build-module/store/private-selectors.js.map +1 -0
  215. package/build-module/store/reducer.js +103 -26
  216. package/build-module/store/reducer.js.map +1 -1
  217. package/build-module/store/reducer.native.js +1 -2
  218. package/build-module/store/reducer.native.js.map +1 -1
  219. package/build-module/store/selectors.js +93 -6
  220. package/build-module/store/selectors.js.map +1 -1
  221. package/build-module/utils/media-upload/index.js +8 -2
  222. package/build-module/utils/media-upload/index.js.map +1 -1
  223. package/build-style/style-rtl.css +433 -0
  224. package/build-style/style.css +433 -0
  225. package/package.json +32 -31
  226. package/src/components/document-bar/index.js +193 -0
  227. package/src/components/document-bar/style.scss +130 -0
  228. package/src/components/document-outline/index.js +48 -1
  229. package/src/components/document-outline/style.scss +12 -0
  230. package/src/components/document-tools/index.js +177 -0
  231. package/src/components/document-tools/style.scss +98 -0
  232. package/src/components/editor-canvas/edit-template-blocks-notification.js +108 -0
  233. package/src/components/editor-canvas/index.js +386 -0
  234. package/src/components/editor-canvas/style.scss +5 -0
  235. package/src/components/entities-saved-states/index.js +3 -1
  236. package/src/components/entities-saved-states/style.scss +4 -0
  237. package/src/components/global-keyboard-shortcuts/index.js +12 -2
  238. package/src/components/global-keyboard-shortcuts/register-shortcuts.js +10 -0
  239. package/src/components/index.js +9 -1
  240. package/src/components/index.native.js +1 -0
  241. package/src/components/inserter-sidebar/index.js +73 -0
  242. package/src/components/inserter-sidebar/style.scss +22 -0
  243. package/src/components/list-view-sidebar/index.js +169 -0
  244. package/src/components/list-view-sidebar/list-view-outline.js +37 -0
  245. package/src/components/list-view-sidebar/style.scss +84 -0
  246. package/src/components/offline-status/index.native.js +101 -0
  247. package/src/components/offline-status/style.native.scss +28 -0
  248. package/src/components/offline-status/test/index.native.js +108 -0
  249. package/src/components/page-attributes/panel.js +62 -0
  250. package/src/components/post-discussion/panel.js +57 -0
  251. package/src/components/post-excerpt/check.js +18 -0
  252. package/src/components/post-excerpt/panel.js +57 -0
  253. package/src/components/post-excerpt/plugin.js +61 -0
  254. package/src/components/post-excerpt/test/plugin.js +36 -0
  255. package/src/components/post-featured-image/index.js +3 -7
  256. package/src/components/post-featured-image/panel.js +55 -0
  257. package/src/components/post-last-revision/panel.js +22 -0
  258. package/src/components/post-last-revision/style.scss +10 -0
  259. package/src/components/post-publish-button/index.js +1 -0
  260. package/src/components/post-publish-panel/maybe-upload-media.js +3 -8
  261. package/src/components/post-saved-state/index.js +9 -8
  262. package/src/components/post-saved-state/test/__snapshots__/index.js.snap +2 -2
  263. package/src/components/post-schedule/panel.js +1 -1
  264. package/src/components/post-taxonomies/panel.js +66 -0
  265. package/src/components/post-template/block-theme.js +110 -0
  266. package/src/components/post-template/classic-theme.js +213 -0
  267. package/src/components/post-template/create-new-template-modal.js +139 -0
  268. package/src/components/post-template/create-new-template.js +50 -0
  269. package/src/components/post-template/hooks.js +95 -0
  270. package/src/components/post-template/panel.js +66 -0
  271. package/src/components/post-template/reset-default-template.js +43 -0
  272. package/src/components/post-template/style.scss +52 -0
  273. package/src/components/post-template/swap-template-button.js +86 -0
  274. package/src/components/post-title/index.native.js +32 -18
  275. package/src/components/post-title/style.scss +1 -0
  276. package/src/components/post-title/test/__snapshots__/index.native.js.snap +25 -0
  277. package/src/components/post-title/test/index.native.js +78 -0
  278. package/src/components/post-view-link/index.js +47 -0
  279. package/src/components/post-visibility/check.js +10 -15
  280. package/src/components/post-visibility/test/check.js +24 -13
  281. package/src/components/preview-dropdown/index.js +133 -0
  282. package/src/components/preview-dropdown/style.scss +5 -0
  283. package/src/components/provider/index.js +28 -118
  284. package/src/components/provider/index.native.js +55 -14
  285. package/src/components/provider/navigation-block-editing-mode.js +37 -0
  286. package/src/components/provider/use-block-editor-settings.js +42 -17
  287. package/src/hooks/index.js +1 -0
  288. package/src/hooks/pattern-partial-syncing.js +73 -0
  289. package/src/private-apis.js +14 -0
  290. package/src/store/actions.js +160 -9
  291. package/src/store/defaults.js +1 -0
  292. package/src/store/index.js +5 -0
  293. package/src/store/private-actions.js +61 -0
  294. package/src/store/private-selectors.js +51 -0
  295. package/src/store/reducer.js +103 -26
  296. package/src/store/reducer.native.js +0 -2
  297. package/src/store/selectors.js +144 -42
  298. package/src/store/test/actions.js +56 -0
  299. package/src/store/test/reducer.js +98 -0
  300. package/src/store/test/selectors.js +137 -147
  301. package/src/style.scss +7 -0
  302. package/src/utils/media-upload/index.js +9 -2
  303. package/build/components/post-template/index.js +0 -66
  304. package/build/components/post-template/index.js.map +0 -1
  305. package/build-module/components/post-template/index.js +0 -57
  306. package/build-module/components/post-template/index.js.map +0 -1
  307. package/src/components/post-template/index.js +0 -64
@@ -9,6 +9,8 @@ var _element = require("@wordpress/element");
9
9
  var _data = require("@wordpress/data");
10
10
  var _coreData = require("@wordpress/core-data");
11
11
  var _i18n = require("@wordpress/i18n");
12
+ var _preferences = require("@wordpress/preferences");
13
+ var _compose = require("@wordpress/compose");
12
14
  var _mediaCategories = _interopRequireDefault(require("../media-categories"));
13
15
  var _utils = require("../../utils");
14
16
  var _store = require("../../store");
@@ -21,7 +23,7 @@ var _store = require("../../store");
21
23
  */
22
24
 
23
25
  const EMPTY_BLOCKS_LIST = [];
24
- const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', '__unstableGalleryWithImageBlocks', 'alignWide', 'allowedBlockTypes', 'blockInspectorTabs', 'allowedMimeTypes', 'bodyPlaceholder', 'canLockBlocks', 'capabilities', 'clearBlockSelection', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'enableOpenverseMediaCategory', 'focusMode', 'distractionFree', 'fontSizes', 'gradients', 'generateAnchors', 'hasFixedToolbar', 'hasInlineToolbar', 'isDistractionFree', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'keepCaretInsideBlock', 'locale', 'maxWidth', 'onUpdateDefaultBlockStyles', 'postContentAttributes', 'postsPerPage', 'readOnly', 'styles', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableHasCustomAppender', '__unstableIsPreviewMode', '__unstableResolvedAssets', '__unstableIsBlockBasedTheme', '__experimentalArchiveTitleTypeLabel', '__experimentalArchiveTitleNameLabel'];
26
+ const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', '__experimentalPreferredStyleVariations', '__unstableGalleryWithImageBlocks', 'alignWide', 'allowedBlockTypes', 'blockInspectorTabs', 'allowedMimeTypes', 'bodyPlaceholder', 'canLockBlocks', 'capabilities', 'clearBlockSelection', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'enableOpenverseMediaCategory', 'fontSizes', 'gradients', 'generateAnchors', 'getPostLinkProps', 'hasInlineToolbar', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'locale', 'maxWidth', 'onUpdateDefaultBlockStyles', 'postContentAttributes', 'postsPerPage', 'readOnly', 'styles', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableHasCustomAppender', '__unstableIsPreviewMode', '__unstableResolvedAssets', '__unstableIsBlockBasedTheme', '__experimentalArchiveTitleTypeLabel', '__experimentalArchiveTitleNameLabel'];
25
27
 
26
28
  /**
27
29
  * React hook used to compute the block editor settings to use for the post editor.
@@ -34,14 +36,22 @@ const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__experimentalDi
34
36
  */
35
37
  function useBlockEditorSettings(settings, postType, postId) {
36
38
  var _settings$__experimen, _settings$__experimen2;
39
+ const isLargeViewport = (0, _compose.useViewportMatch)('medium');
37
40
  const {
41
+ allowRightClickOverrides,
42
+ focusMode,
43
+ hasFixedToolbar,
44
+ isDistractionFree,
45
+ keepCaretInsideBlock,
38
46
  reusableBlocks,
39
47
  hasUploadPermissions,
40
48
  canUseUnfilteredHTML,
41
49
  userCanCreatePages,
42
50
  pageOnFront,
43
51
  pageForPosts,
44
- userPatternCategories
52
+ userPatternCategories,
53
+ restBlockPatterns,
54
+ restBlockPatternCategories
45
55
  } = (0, _data.useSelect)(select => {
46
56
  var _canUser;
47
57
  const isWeb = _element.Platform.OS === 'web';
@@ -50,11 +60,21 @@ function useBlockEditorSettings(settings, postType, postId) {
50
60
  getRawEntityRecord,
51
61
  getEntityRecord,
52
62
  getUserPatternCategories,
53
- getEntityRecords
63
+ getEntityRecords,
64
+ getBlockPatterns,
65
+ getBlockPatternCategories
54
66
  } = select(_coreData.store);
67
+ const {
68
+ get
69
+ } = select(_preferences.store);
55
70
  const siteSettings = canUser('read', 'settings') ? getEntityRecord('root', 'site') : undefined;
56
71
  return {
72
+ allowRightClickOverrides: get('core', 'allowRightClickOverrides'),
57
73
  canUseUnfilteredHTML: getRawEntityRecord('postType', postType, postId)?._links?.hasOwnProperty('wp:action-unfiltered-html'),
74
+ focusMode: get('core', 'focusMode'),
75
+ hasFixedToolbar: get('core', 'fixedToolbar') || !isLargeViewport,
76
+ isDistractionFree: get('core', 'distractionFree'),
77
+ keepCaretInsideBlock: get('core', 'keepCaretInsideBlock'),
58
78
  reusableBlocks: isWeb ? getEntityRecords('postType', 'wp_block', {
59
79
  per_page: -1
60
80
  }) : EMPTY_BLOCKS_LIST,
@@ -63,9 +83,11 @@ function useBlockEditorSettings(settings, postType, postId) {
63
83
  userCanCreatePages: canUser('create', 'pages'),
64
84
  pageOnFront: siteSettings?.page_on_front,
65
85
  pageForPosts: siteSettings?.page_for_posts,
66
- userPatternCategories: getUserPatternCategories()
86
+ userPatternCategories: getUserPatternCategories(),
87
+ restBlockPatterns: getBlockPatterns(),
88
+ restBlockPatternCategories: getBlockPatternCategories()
67
89
  };
68
- }, [postType, postId]);
90
+ }, [postType, postId, isLargeViewport]);
69
91
  const settingsBlockPatterns = (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen :
70
92
  // WP 6.0
71
93
  settings.__experimentalBlockPatterns; // WP 5.9
@@ -73,13 +95,6 @@ function useBlockEditorSettings(settings, postType, postId) {
73
95
  // WP 6.0
74
96
  settings.__experimentalBlockPatternCategories; // WP 5.9
75
97
 
76
- const {
77
- restBlockPatterns,
78
- restBlockPatternCategories
79
- } = (0, _data.useSelect)(select => ({
80
- restBlockPatterns: select(_coreData.store).getBlockPatterns(),
81
- restBlockPatternCategories: select(_coreData.store).getBlockPatternCategories()
82
- }), []);
83
98
  const blockPatterns = (0, _element.useMemo)(() => [...(settingsBlockPatterns || []), ...(restBlockPatterns || [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)).filter(({
84
99
  postTypes
85
100
  }) => {
@@ -87,7 +102,8 @@ function useBlockEditorSettings(settings, postType, postId) {
87
102
  }), [settingsBlockPatterns, restBlockPatterns, postType]);
88
103
  const blockPatternCategories = (0, _element.useMemo)(() => [...(settingsBlockPatternCategories || []), ...(restBlockPatternCategories || [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)), [settingsBlockPatternCategories, restBlockPatternCategories]);
89
104
  const {
90
- undo
105
+ undo,
106
+ setIsInserterOpened
91
107
  } = (0, _data.useDispatch)(_store.store);
92
108
  const {
93
109
  saveEntityRecord
@@ -108,8 +124,14 @@ function useBlockEditorSettings(settings, postType, postId) {
108
124
  }
109
125
  return saveEntityRecord('postType', 'page', options);
110
126
  }, [saveEntityRecord, userCanCreatePages]);
127
+ const forceDisableFocusMode = settings.focusMode === false;
111
128
  return (0, _element.useMemo)(() => ({
112
129
  ...Object.fromEntries(Object.entries(settings).filter(([key]) => BLOCK_EDITOR_SETTINGS.includes(key))),
130
+ allowRightClickOverrides,
131
+ focusMode: focusMode && !forceDisableFocusMode,
132
+ hasFixedToolbar,
133
+ isDistractionFree,
134
+ keepCaretInsideBlock,
113
135
  mediaUpload: hasUploadPermissions ? _utils.mediaUpload : undefined,
114
136
  __experimentalReusableBlocks: reusableBlocks,
115
137
  __experimentalBlockPatterns: blockPatterns,
@@ -133,8 +155,9 @@ function useBlockEditorSettings(settings, postType, postId) {
133
155
  pageForPosts,
134
156
  __experimentalPreferPatternsOnRoot: postType === 'wp_template',
135
157
  templateLock: postType === 'wp_navigation' ? 'insert' : settings.templateLock,
136
- template: postType === 'wp_navigation' ? [['core/navigation', {}, []]] : settings.template
137
- }), [settings, hasUploadPermissions, reusableBlocks, userPatternCategories, blockPatterns, blockPatternCategories, canUseUnfilteredHTML, undo, createPageEntity, userCanCreatePages, pageOnFront, pageForPosts, postType]);
158
+ template: postType === 'wp_navigation' ? [['core/navigation', {}, []]] : settings.template,
159
+ __experimentalSetIsInserterOpened: setIsInserterOpened
160
+ }), [allowRightClickOverrides, focusMode, forceDisableFocusMode, hasFixedToolbar, isDistractionFree, keepCaretInsideBlock, settings, hasUploadPermissions, reusableBlocks, userPatternCategories, blockPatterns, blockPatternCategories, canUseUnfilteredHTML, undo, createPageEntity, userCanCreatePages, pageOnFront, pageForPosts, postType, setIsInserterOpened]);
138
161
  }
139
162
  var _default = useBlockEditorSettings;
140
163
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_data","_coreData","_i18n","_mediaCategories","_interopRequireDefault","_utils","_store","EMPTY_BLOCKS_LIST","BLOCK_EDITOR_SETTINGS","useBlockEditorSettings","settings","postType","postId","_settings$__experimen","_settings$__experimen2","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","pageForPosts","userPatternCategories","useSelect","select","_canUser","isWeb","Platform","OS","canUser","getRawEntityRecord","getEntityRecord","getUserPatternCategories","getEntityRecords","coreStore","siteSettings","undefined","_links","hasOwnProperty","per_page","page_on_front","page_for_posts","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","getBlockPatterns","getBlockPatternCategories","blockPatterns","useMemo","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","undo","useDispatch","editorStore","saveEntityRecord","createPageEntity","useCallback","options","Promise","reject","message","__","Object","fromEntries","entries","key","mediaUpload","__experimentalReusableBlocks","__experimentalUserPatternCategories","__experimentalFetchLinkSuggestions","search","searchOptions","fetchLinkSuggestions","inserterMediaCategories","__experimentalFetchRichUrlData","fetchUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot","templateLock","template","_default","exports","default"],"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Platform, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport inserterMediaCategories from '../media-categories';\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\n\nconst EMPTY_BLOCKS_LIST = [];\n\nconst BLOCK_EDITOR_SETTINGS = [\n\t'__experimentalBlockDirectory',\n\t'__experimentalDiscussionSettings',\n\t'__experimentalFeatures',\n\t'__experimentalGlobalStylesBaseStyles',\n\t'__experimentalPreferredStyleVariations',\n\t'__experimentalSetIsInserterOpened',\n\t'__unstableGalleryWithImageBlocks',\n\t'alignWide',\n\t'allowedBlockTypes',\n\t'blockInspectorTabs',\n\t'allowedMimeTypes',\n\t'bodyPlaceholder',\n\t'canLockBlocks',\n\t'capabilities',\n\t'clearBlockSelection',\n\t'codeEditingEnabled',\n\t'colors',\n\t'disableCustomColors',\n\t'disableCustomFontSizes',\n\t'disableCustomSpacingSizes',\n\t'disableCustomGradients',\n\t'disableLayoutStyles',\n\t'enableCustomLineHeight',\n\t'enableCustomSpacing',\n\t'enableCustomUnits',\n\t'enableOpenverseMediaCategory',\n\t'focusMode',\n\t'distractionFree',\n\t'fontSizes',\n\t'gradients',\n\t'generateAnchors',\n\t'hasFixedToolbar',\n\t'hasInlineToolbar',\n\t'isDistractionFree',\n\t'imageDefaultSize',\n\t'imageDimensions',\n\t'imageEditing',\n\t'imageSizes',\n\t'isRTL',\n\t'keepCaretInsideBlock',\n\t'locale',\n\t'maxWidth',\n\t'onUpdateDefaultBlockStyles',\n\t'postContentAttributes',\n\t'postsPerPage',\n\t'readOnly',\n\t'styles',\n\t'titlePlaceholder',\n\t'supportsLayout',\n\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t'__unstableHasCustomAppender',\n\t'__unstableIsPreviewMode',\n\t'__unstableResolvedAssets',\n\t'__unstableIsBlockBasedTheme',\n\t'__experimentalArchiveTitleTypeLabel',\n\t'__experimentalArchiveTitleNameLabel',\n];\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {string} postType Editor root level post type.\n * @param {string} postId Editor root level post ID.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, postType, postId ) {\n\tconst {\n\t\treusableBlocks,\n\t\thasUploadPermissions,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\tuserPatternCategories,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst isWeb = Platform.OS === 'web';\n\t\t\tconst {\n\t\t\t\tcanUser,\n\t\t\t\tgetRawEntityRecord,\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetUserPatternCategories,\n\t\t\t\tgetEntityRecords,\n\t\t\t} = select( coreStore );\n\n\t\t\tconst siteSettings = canUser( 'read', 'settings' )\n\t\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\n\t\t\treturn {\n\t\t\t\tcanUseUnfilteredHTML: getRawEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t)?._links?.hasOwnProperty( 'wp:action-unfiltered-html' ),\n\t\t\t\treusableBlocks: isWeb\n\t\t\t\t\t? getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t } )\n\t\t\t\t\t: EMPTY_BLOCKS_LIST, // Reusable blocks are fetched in the native version of this hook.\n\t\t\t\thasUploadPermissions: canUser( 'create', 'media' ) ?? true,\n\t\t\t\tuserCanCreatePages: canUser( 'create', 'pages' ),\n\t\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\t\tpageForPosts: siteSettings?.page_for_posts,\n\t\t\t\tuserPatternCategories: getUserPatternCategories(),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories:\n\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst { undo } = useDispatch( editorStore );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = useCallback(\n\t\t( options ) => {\n\t\t\tif ( ! userCanCreatePages ) {\n\t\t\t\treturn Promise.reject( {\n\t\t\t\t\tmessage: __(\n\t\t\t\t\t\t'You do not have permission to create Pages.'\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t\t},\n\t\t[ saveEntityRecord, userCanCreatePages ]\n\t);\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( settings ).filter( ( [ key ] ) =>\n\t\t\t\t\tBLOCK_EDITOR_SETTINGS.includes( key )\n\t\t\t\t)\n\t\t\t),\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalUserPatternCategories: userPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t// Todo: This only checks the top level post, not the post within a template or any other entity that can be edited.\n\t\t\t// This might be better as a generic \"canUser\" selector.\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t//Todo: this is only needed for native and should probably be removed.\n\t\t\t__experimentalUndo: undo,\n\t\t\t// Check whether we want all site editor frames to have outlines\n\t\t\t// including the navigation / pattern / parts editors.\n\t\t\toutlineMode: postType === 'wp_template',\n\t\t\t// Check these two properties: they were not present in the site editor.\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\tpageForPosts,\n\t\t\t__experimentalPreferPatternsOnRoot: postType === 'wp_template',\n\t\t\ttemplateLock:\n\t\t\t\tpostType === 'wp_navigation' ? 'insert' : settings.templateLock,\n\t\t\ttemplate:\n\t\t\t\tpostType === 'wp_navigation'\n\t\t\t\t\t? [ [ 'core/navigation', {}, [] ] ]\n\t\t\t\t\t: settings.template,\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\thasUploadPermissions,\n\t\t\treusableBlocks,\n\t\t\tuserPatternCategories,\n\t\t\tblockPatterns,\n\t\t\tblockPatternCategories,\n\t\t\tcanUseUnfilteredHTML,\n\t\t\tundo,\n\t\t\tcreatePageEntity,\n\t\t\tuserCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\tpageForPosts,\n\t\t\tpostType,\n\t\t]\n\t);\n}\n\nexport default useBlockEditorSettings;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,gBAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAjBA;AACA;AACA;;AAUA;AACA;AACA;;AAKA,MAAM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pF,QAAQ,KAAK,aAAa;IAC9DqF,YAAY,EACXrF,QAAQ,KAAK,eAAe,GAAG,QAAQ,GAAGD,QAAQ,CAACsF,YAAY;IAChEC,QAAQ,EACPtF,QAAQ,KAAK,eAAe,GACzB,CAAE,CAAE,iBAAiB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAE,CAAE,GACjCD,QAAQ,CAACuF;EACd,CAAC,CAAE,EACH,CACCvF,QAAQ,EACRM,oBAAoB,EACpBD,cAAc,EACdM,qBAAqB,EACrB8B,aAAa,EACba,sBAAsB,EACtB/C,oBAAoB,EACpBgD,IAAI,EACJI,gBAAgB,EAChBnD,kBAAkB,EAClBC,WAAW,EACXC,YAAY,EACZT,QAAQ,CAEV,CAAC;AACF;AAAC,IAAAuF,QAAA,GAEczF,sBAAsB;AAAA0F,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
1
+ {"version":3,"names":["_element","require","_data","_coreData","_i18n","_preferences","_compose","_mediaCategories","_interopRequireDefault","_utils","_store","EMPTY_BLOCKS_LIST","BLOCK_EDITOR_SETTINGS","useBlockEditorSettings","settings","postType","postId","_settings$__experimen","_settings$__experimen2","isLargeViewport","useViewportMatch","allowRightClickOverrides","focusMode","hasFixedToolbar","isDistractionFree","keepCaretInsideBlock","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","pageForPosts","userPatternCategories","restBlockPatterns","restBlockPatternCategories","useSelect","select","_canUser","isWeb","Platform","OS","canUser","getRawEntityRecord","getEntityRecord","getUserPatternCategories","getEntityRecords","getBlockPatterns","getBlockPatternCategories","coreStore","get","preferencesStore","siteSettings","undefined","_links","hasOwnProperty","per_page","page_on_front","page_for_posts","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","blockPatterns","useMemo","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","undo","setIsInserterOpened","useDispatch","editorStore","saveEntityRecord","createPageEntity","useCallback","options","Promise","reject","message","__","forceDisableFocusMode","Object","fromEntries","entries","key","mediaUpload","__experimentalReusableBlocks","__experimentalUserPatternCategories","__experimentalFetchLinkSuggestions","search","searchOptions","fetchLinkSuggestions","inserterMediaCategories","__experimentalFetchRichUrlData","fetchUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot","templateLock","template","__experimentalSetIsInserterOpened","_default","exports","default"],"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Platform, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport inserterMediaCategories from '../media-categories';\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\n\nconst EMPTY_BLOCKS_LIST = [];\n\nconst BLOCK_EDITOR_SETTINGS = [\n\t'__experimentalBlockDirectory',\n\t'__experimentalDiscussionSettings',\n\t'__experimentalFeatures',\n\t'__experimentalGlobalStylesBaseStyles',\n\t'__experimentalPreferredStyleVariations',\n\t'__unstableGalleryWithImageBlocks',\n\t'alignWide',\n\t'allowedBlockTypes',\n\t'blockInspectorTabs',\n\t'allowedMimeTypes',\n\t'bodyPlaceholder',\n\t'canLockBlocks',\n\t'capabilities',\n\t'clearBlockSelection',\n\t'codeEditingEnabled',\n\t'colors',\n\t'disableCustomColors',\n\t'disableCustomFontSizes',\n\t'disableCustomSpacingSizes',\n\t'disableCustomGradients',\n\t'disableLayoutStyles',\n\t'enableCustomLineHeight',\n\t'enableCustomSpacing',\n\t'enableCustomUnits',\n\t'enableOpenverseMediaCategory',\n\t'fontSizes',\n\t'gradients',\n\t'generateAnchors',\n\t'getPostLinkProps',\n\t'hasInlineToolbar',\n\t'imageDefaultSize',\n\t'imageDimensions',\n\t'imageEditing',\n\t'imageSizes',\n\t'isRTL',\n\t'locale',\n\t'maxWidth',\n\t'onUpdateDefaultBlockStyles',\n\t'postContentAttributes',\n\t'postsPerPage',\n\t'readOnly',\n\t'styles',\n\t'titlePlaceholder',\n\t'supportsLayout',\n\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t'__unstableHasCustomAppender',\n\t'__unstableIsPreviewMode',\n\t'__unstableResolvedAssets',\n\t'__unstableIsBlockBasedTheme',\n\t'__experimentalArchiveTitleTypeLabel',\n\t'__experimentalArchiveTitleNameLabel',\n];\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {string} postType Editor root level post type.\n * @param {string} postId Editor root level post ID.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, postType, postId ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst {\n\t\tallowRightClickOverrides,\n\t\tfocusMode,\n\t\thasFixedToolbar,\n\t\tisDistractionFree,\n\t\tkeepCaretInsideBlock,\n\t\treusableBlocks,\n\t\thasUploadPermissions,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\tuserPatternCategories,\n\t\trestBlockPatterns,\n\t\trestBlockPatternCategories,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst isWeb = Platform.OS === 'web';\n\t\t\tconst {\n\t\t\t\tcanUser,\n\t\t\t\tgetRawEntityRecord,\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetUserPatternCategories,\n\t\t\t\tgetEntityRecords,\n\t\t\t\tgetBlockPatterns,\n\t\t\t\tgetBlockPatternCategories,\n\t\t\t} = select( coreStore );\n\t\t\tconst { get } = select( preferencesStore );\n\n\t\t\tconst siteSettings = canUser( 'read', 'settings' )\n\t\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\n\t\t\treturn {\n\t\t\t\tallowRightClickOverrides: get(\n\t\t\t\t\t'core',\n\t\t\t\t\t'allowRightClickOverrides'\n\t\t\t\t),\n\t\t\t\tcanUseUnfilteredHTML: getRawEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t)?._links?.hasOwnProperty( 'wp:action-unfiltered-html' ),\n\t\t\t\tfocusMode: get( 'core', 'focusMode' ),\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tget( 'core', 'fixedToolbar' ) || ! isLargeViewport,\n\t\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\t\tkeepCaretInsideBlock: get( 'core', 'keepCaretInsideBlock' ),\n\t\t\t\treusableBlocks: isWeb\n\t\t\t\t\t? getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t } )\n\t\t\t\t\t: EMPTY_BLOCKS_LIST, // Reusable blocks are fetched in the native version of this hook.\n\t\t\t\thasUploadPermissions: canUser( 'create', 'media' ) ?? true,\n\t\t\t\tuserCanCreatePages: canUser( 'create', 'pages' ),\n\t\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\t\tpageForPosts: siteSettings?.page_for_posts,\n\t\t\t\tuserPatternCategories: getUserPatternCategories(),\n\t\t\t\trestBlockPatterns: getBlockPatterns(),\n\t\t\t\trestBlockPatternCategories: getBlockPatternCategories(),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId, isLargeViewport ]\n\t);\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst { undo, setIsInserterOpened } = useDispatch( editorStore );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = useCallback(\n\t\t( options ) => {\n\t\t\tif ( ! userCanCreatePages ) {\n\t\t\t\treturn Promise.reject( {\n\t\t\t\t\tmessage: __(\n\t\t\t\t\t\t'You do not have permission to create Pages.'\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t\t},\n\t\t[ saveEntityRecord, userCanCreatePages ]\n\t);\n\n\tconst forceDisableFocusMode = settings.focusMode === false;\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( settings ).filter( ( [ key ] ) =>\n\t\t\t\t\tBLOCK_EDITOR_SETTINGS.includes( key )\n\t\t\t\t)\n\t\t\t),\n\t\t\tallowRightClickOverrides,\n\t\t\tfocusMode: focusMode && ! forceDisableFocusMode,\n\t\t\thasFixedToolbar,\n\t\t\tisDistractionFree,\n\t\t\tkeepCaretInsideBlock,\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalUserPatternCategories: userPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t// Todo: This only checks the top level post, not the post within a template or any other entity that can be edited.\n\t\t\t// This might be better as a generic \"canUser\" selector.\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t//Todo: this is only needed for native and should probably be removed.\n\t\t\t__experimentalUndo: undo,\n\t\t\t// Check whether we want all site editor frames to have outlines\n\t\t\t// including the navigation / pattern / parts editors.\n\t\t\toutlineMode: postType === 'wp_template',\n\t\t\t// Check these two properties: they were not present in the site editor.\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\tpageForPosts,\n\t\t\t__experimentalPreferPatternsOnRoot: postType === 'wp_template',\n\t\t\ttemplateLock:\n\t\t\t\tpostType === 'wp_navigation' ? 'insert' : settings.templateLock,\n\t\t\ttemplate:\n\t\t\t\tpostType === 'wp_navigation'\n\t\t\t\t\t? [ [ 'core/navigation', {}, [] ] ]\n\t\t\t\t\t: settings.template,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t} ),\n\t\t[\n\t\t\tallowRightClickOverrides,\n\t\t\tfocusMode,\n\t\t\tforceDisableFocusMode,\n\t\t\thasFixedToolbar,\n\t\t\tisDistractionFree,\n\t\t\tkeepCaretInsideBlock,\n\t\t\tsettings,\n\t\t\thasUploadPermissions,\n\t\t\treusableBlocks,\n\t\t\tuserPatternCategories,\n\t\t\tblockPatterns,\n\t\t\tblockPatternCategories,\n\t\t\tcanUseUnfilteredHTML,\n\t\t\tundo,\n\t\t\tcreatePageEntity,\n\t\t\tuserCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\tpageForPosts,\n\t\t\tpostType,\n\t\t\tsetIsInserterOpened,\n\t\t]\n\t);\n}\n\nexport default useBlockEditorSettings;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,gBAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AAnBA;AACA;AACA;;AAYA;AACA;AACA;;AAKA,MAAMU,iBAAiB,GAAG,EAAE;AAE5B,MAAMC,qBAAqB,GAAG,CAC7B,8BAA8B,EAC9B,kCAAkC,EAClC,wBAAwB,EACxB,sCAAsC,EACtC,wCAAwC,EACxC,kCAAkC,EAClC,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB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uB;IACvBC,8BAA8B,EAAEC,oCAAY;IAC5C;IACA;IACAC,sCAAsC,EAAE7E,oBAAoB;IAC5D;IACA8E,kBAAkB,EAAE5B,IAAI;IACxB;IACA;IACA6B,WAAW,EAAE5F,QAAQ,KAAK,aAAa;IACvC;IACA6F,8BAA8B,EAAEzB,gBAAgB;IAChD0B,gCAAgC,EAAEhF,kBAAkB;IACpDC,WAAW;IACXC,YAAY;IACZ+E,kCAAkC,EAAE/F,QAAQ,KAAK,aAAa;IAC9DgG,YAAY,EACXhG,QAAQ,KAAK,eAAe,GAAG,QAAQ,GAAGD,QAAQ,CAACiG,YAAY;IAChEC,QAAQ,EACPjG,QAAQ,KAAK,eAAe,GACzB,CAAE,CAAE,iBAAiB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAE,CAAE,GACjCD,QAAQ,CAACkG,QAAQ;IACrBC,iCAAiC,EAAElC;EACpC,CAAC,CAAE,EACH,CACC1D,wBAAwB,EACxBC,SAAS,EACToE,qBAAqB,EACrBnE,eAAe,EACfC,iBAAiB,EACjBC,oBAAoB,EACpBX,QAAQ,EACRa,oBAAoB,EACpBD,cAAc,EACdM,qBAAqB,EACrBgC,aAAa,EACba,sBAAsB,EACtBjD,oBAAoB,EACpBkD,IAAI,EACJK,gBAAgB,EAChBtD,kBAAkB,EAClBC,WAAW,EACXC,YAAY,EACZhB,QAAQ,EACRgE,mBAAmB,CAErB,CAAC;AACF;AAAC,IAAAmC,QAAA,GAEcrG,sBAAsB;AAAAsG,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -2,4 +2,5 @@
2
2
 
3
3
  require("./custom-sources-backwards-compatibility");
4
4
  require("./default-autocompleters");
5
+ require("./pattern-partial-syncing");
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["require"],"sources":["@wordpress/editor/src/hooks/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport './custom-sources-backwards-compatibility';\nimport './default-autocompleters';\n"],"mappings":";;AAGAA,OAAA;AACAA,OAAA"}
1
+ {"version":3,"names":["require"],"sources":["@wordpress/editor/src/hooks/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport './custom-sources-backwards-compatibility';\nimport './default-autocompleters';\nimport './pattern-partial-syncing';\n"],"mappings":";;AAGAA,OAAA;AACAA,OAAA;AACAA,OAAA"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ var _react = require("react");
4
+ var _hooks = require("@wordpress/hooks");
5
+ var _patterns = require("@wordpress/patterns");
6
+ var _compose = require("@wordpress/compose");
7
+ var _blockEditor = require("@wordpress/block-editor");
8
+ var _blocks = require("@wordpress/blocks");
9
+ var _data = require("@wordpress/data");
10
+ var _store = require("../store");
11
+ var _lockUnlock = require("../lock-unlock");
12
+ /**
13
+ * WordPress dependencies
14
+ */
15
+
16
+ /**
17
+ * Internal dependencies
18
+ */
19
+
20
+ const {
21
+ PartialSyncingControls,
22
+ PATTERN_TYPES,
23
+ PARTIAL_SYNCING_SUPPORTED_BLOCKS
24
+ } = (0, _lockUnlock.unlock)(_patterns.privateApis);
25
+
26
+ /**
27
+ * Override the default edit UI to include a new block inspector control for
28
+ * assigning a partial syncing controls to supported blocks in the pattern editor.
29
+ * Currently, only the `core/paragraph` block is supported.
30
+ *
31
+ * @param {Component} BlockEdit Original component.
32
+ *
33
+ * @return {Component} Wrapped component.
34
+ */
35
+ const withPartialSyncingControls = (0, _compose.createHigherOrderComponent)(BlockEdit => props => {
36
+ const blockEditingMode = (0, _blockEditor.useBlockEditingMode)();
37
+ const hasCustomFieldsSupport = (0, _blocks.hasBlockSupport)(props.name, '__experimentalConnections', false);
38
+ const isEditingPattern = (0, _data.useSelect)(select => select(_store.store).getCurrentPostType() === PATTERN_TYPES.user, []);
39
+ const shouldShowPartialSyncingControls = hasCustomFieldsSupport && props.isSelected && isEditingPattern && blockEditingMode === 'default' && Object.keys(PARTIAL_SYNCING_SUPPORTED_BLOCKS).includes(props.name);
40
+ return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(BlockEdit, {
41
+ ...props
42
+ }), shouldShowPartialSyncingControls && (0, _react.createElement)(PartialSyncingControls, {
43
+ ...props
44
+ }));
45
+ });
46
+ if (window.__experimentalPatternPartialSyncing) {
47
+ (0, _hooks.addFilter)('editor.BlockEdit', 'core/editor/with-partial-syncing-controls', withPartialSyncingControls);
48
+ }
49
+ //# sourceMappingURL=pattern-partial-syncing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_hooks","require","_patterns","_compose","_blockEditor","_blocks","_data","_store","_lockUnlock","PartialSyncingControls","PATTERN_TYPES","PARTIAL_SYNCING_SUPPORTED_BLOCKS","unlock","patternsPrivateApis","withPartialSyncingControls","createHigherOrderComponent","BlockEdit","props","blockEditingMode","useBlockEditingMode","hasCustomFieldsSupport","hasBlockSupport","name","isEditingPattern","useSelect","select","editorStore","getCurrentPostType","user","shouldShowPartialSyncingControls","isSelected","Object","keys","includes","_react","createElement","Fragment","window","__experimentalPatternPartialSyncing","addFilter"],"sources":["@wordpress/editor/src/hooks/pattern-partial-syncing.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useBlockEditingMode } from '@wordpress/block-editor';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\nconst {\n\tPartialSyncingControls,\n\tPATTERN_TYPES,\n\tPARTIAL_SYNCING_SUPPORTED_BLOCKS,\n} = unlock( patternsPrivateApis );\n\n/**\n * Override the default edit UI to include a new block inspector control for\n * assigning a partial syncing controls to supported blocks in the pattern editor.\n * Currently, only the `core/paragraph` block is supported.\n *\n * @param {Component} BlockEdit Original component.\n *\n * @return {Component} Wrapped component.\n */\nconst withPartialSyncingControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst blockEditingMode = useBlockEditingMode();\n\t\tconst hasCustomFieldsSupport = hasBlockSupport(\n\t\t\tprops.name,\n\t\t\t'__experimentalConnections',\n\t\t\tfalse\n\t\t);\n\t\tconst isEditingPattern = useSelect(\n\t\t\t( select ) =>\n\t\t\t\tselect( editorStore ).getCurrentPostType() ===\n\t\t\t\tPATTERN_TYPES.user,\n\t\t\t[]\n\t\t);\n\n\t\tconst shouldShowPartialSyncingControls =\n\t\t\thasCustomFieldsSupport &&\n\t\t\tprops.isSelected &&\n\t\t\tisEditingPattern &&\n\t\t\tblockEditingMode === 'default' &&\n\t\t\tObject.keys( PARTIAL_SYNCING_SUPPORTED_BLOCKS ).includes(\n\t\t\t\tprops.name\n\t\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ shouldShowPartialSyncingControls && (\n\t\t\t\t\t<PartialSyncingControls { ...props } />\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n);\n\nif ( window.__experimentalPatternPartialSyncing ) {\n\taddFilter(\n\t\t'editor.BlockEdit',\n\t\t'core/editor/with-partial-syncing-controls',\n\t\twithPartialSyncingControls\n\t);\n}\n"],"mappings":";;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAdA;AACA;AACA;;AAQA;AACA;AACA;;AAIA,MAAM;EACLQ,sBAAsB;EACtBC,aAAa;EACbC;AACD,CAAC,GAAG,IAAAC,kBAAM,EAAEC,qBAAoB,CAAC;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,0BAA0B,GAAG,IAAAC,mCAA0B,EAC1DC,SAAS,IAAQC,KAAK,IAAM;EAC7B,MAAMC,gBAAgB,GAAG,IAAAC,gCAAmB,EAAC,CAAC;EAC9C,MAAMC,sBAAsB,GAAG,IAAAC,uBAAe,EAC7CJ,KAAK,CAACK,IAAI,EACV,2BAA2B,EAC3B,KACD,CAAC;EACD,MAAMC,gBAAgB,GAAG,IAAAC,eAAS,EAC/BC,MAAM,IACPA,MAAM,CAAEC,YAAY,CAAC,CAACC,kBAAkB,CAAC,CAAC,KAC1CjB,aAAa,CAACkB,IAAI,EACnB,EACD,CAAC;EAED,MAAMC,gCAAgC,GACrCT,sBAAsB,IACtBH,KAAK,CAACa,UAAU,IAChBP,gBAAgB,IAChBL,gBAAgB,KAAK,SAAS,IAC9Ba,MAAM,CAACC,IAAI,CAAErB,gCAAiC,CAAC,CAACsB,QAAQ,CACvDhB,KAAK,CAACK,IACP,CAAC;EAEF,OACC,IAAAY,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA,EAACnB,SAAS;IAAA,GAAMC;EAAK,CAAI,CAAC,EACxBY,gCAAgC,IACjC,IAAAK,MAAA,CAAAC,aAAA,EAAC1B,sBAAsB;IAAA,GAAMQ;EAAK,CAAI,CAEtC,CAAC;AAEL,CACD,CAAC;AAED,IAAKoB,MAAM,CAACC,mCAAmC,EAAG;EACjD,IAAAC,gBAAS,EACR,kBAAkB,EAClB,2CAA2C,EAC3CzB,0BACD,CAAC;AACF"}
@@ -5,11 +5,18 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.privateApis = void 0;
8
+ var _editorCanvas = _interopRequireDefault(require("./components/editor-canvas"));
8
9
  var _provider = require("./components/provider");
9
10
  var _lockUnlock = require("./lock-unlock");
10
11
  var _entitiesSavedStates = require("./components/entities-saved-states");
11
12
  var _useBlockEditorSettings = _interopRequireDefault(require("./components/provider/use-block-editor-settings"));
13
+ var _documentTools = _interopRequireDefault(require("./components/document-tools"));
14
+ var _inserterSidebar = _interopRequireDefault(require("./components/inserter-sidebar"));
15
+ var _listViewSidebar = _interopRequireDefault(require("./components/list-view-sidebar"));
12
16
  var _postPanelRow = _interopRequireDefault(require("./components/post-panel-row"));
17
+ var _postViewLink = _interopRequireDefault(require("./components/post-view-link"));
18
+ var _previewDropdown = _interopRequireDefault(require("./components/preview-dropdown"));
19
+ var _plugin = _interopRequireDefault(require("./components/post-excerpt/plugin"));
13
20
  /**
14
21
  * Internal dependencies
15
22
  */
@@ -17,9 +24,16 @@ var _postPanelRow = _interopRequireDefault(require("./components/post-panel-row"
17
24
  const privateApis = {};
18
25
  exports.privateApis = privateApis;
19
26
  (0, _lockUnlock.lock)(privateApis, {
27
+ DocumentTools: _documentTools.default,
28
+ EditorCanvas: _editorCanvas.default,
20
29
  ExperimentalEditorProvider: _provider.ExperimentalEditorProvider,
21
30
  EntitiesSavedStatesExtensible: _entitiesSavedStates.EntitiesSavedStatesExtensible,
31
+ InserterSidebar: _inserterSidebar.default,
32
+ ListViewSidebar: _listViewSidebar.default,
22
33
  PostPanelRow: _postPanelRow.default,
34
+ PostViewLink: _postViewLink.default,
35
+ PreviewDropdown: _previewDropdown.default,
36
+ PluginPostExcerpt: _plugin.default,
23
37
  // This is a temporary private API while we're updating the site editor to use EditorProvider.
24
38
  useBlockEditorSettings: _useBlockEditorSettings.default
25
39
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_provider","require","_lockUnlock","_entitiesSavedStates","_useBlockEditorSettings","_interopRequireDefault","_postPanelRow","privateApis","exports","lock","ExperimentalEditorProvider","EntitiesSavedStatesExtensible","PostPanelRow","useBlockEditorSettings"],"sources":["@wordpress/editor/src/private-apis.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { ExperimentalEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport { EntitiesSavedStatesExtensible } from './components/entities-saved-states';\nimport useBlockEditorSettings from './components/provider/use-block-editor-settings';\nimport PostPanelRow from './components/post-panel-row';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tExperimentalEditorProvider,\n\tEntitiesSavedStatesExtensible,\n\tPostPanelRow,\n\n\t// This is a temporary private API while we're updating the site editor to use EditorProvider.\n\tuseBlockEditorSettings,\n} );\n"],"mappings":";;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AACA,IAAAG,uBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAPA;AACA;AACA;;AAOO,MAAMM,WAAW,GAAG,CAAC,CAAC;AAACC,OAAA,CAAAD,WAAA,GAAAA,WAAA;AAC9B,IAAAE,gBAAI,EAAEF,WAAW,EAAE;EAClBG,0BAA0B,EAA1BA,oCAA0B;EAC1BC,6BAA6B,EAA7BA,kDAA6B;EAC7BC,YAAY,EAAZA,qBAAY;EAEZ;EACAC,sBAAsB,EAAtBA;AACD,CAAE,CAAC"}
1
+ {"version":3,"names":["_editorCanvas","_interopRequireDefault","require","_provider","_lockUnlock","_entitiesSavedStates","_useBlockEditorSettings","_documentTools","_inserterSidebar","_listViewSidebar","_postPanelRow","_postViewLink","_previewDropdown","_plugin","privateApis","exports","lock","DocumentTools","EditorCanvas","ExperimentalEditorProvider","EntitiesSavedStatesExtensible","InserterSidebar","ListViewSidebar","PostPanelRow","PostViewLink","PreviewDropdown","PluginPostExcerpt","useBlockEditorSettings"],"sources":["@wordpress/editor/src/private-apis.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport EditorCanvas from './components/editor-canvas';\nimport { ExperimentalEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport { EntitiesSavedStatesExtensible } from './components/entities-saved-states';\nimport useBlockEditorSettings from './components/provider/use-block-editor-settings';\nimport DocumentTools from './components/document-tools';\nimport InserterSidebar from './components/inserter-sidebar';\nimport ListViewSidebar from './components/list-view-sidebar';\nimport PostPanelRow from './components/post-panel-row';\nimport PostViewLink from './components/post-view-link';\nimport PreviewDropdown from './components/preview-dropdown';\nimport PluginPostExcerpt from './components/post-excerpt/plugin';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tDocumentTools,\n\tEditorCanvas,\n\tExperimentalEditorProvider,\n\tEntitiesSavedStatesExtensible,\n\tInserterSidebar,\n\tListViewSidebar,\n\tPostPanelRow,\n\tPostViewLink,\n\tPreviewDropdown,\n\tPluginPostExcerpt,\n\n\t// This is a temporary private API while we're updating the site editor to use EditorProvider.\n\tuseBlockEditorSettings,\n} );\n"],"mappings":";;;;;;;AAGA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAH,OAAA;AACA,IAAAI,uBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,cAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,gBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,gBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,aAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,aAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,gBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,OAAA,GAAAZ,sBAAA,CAAAC,OAAA;AAdA;AACA;AACA;;AAcO,MAAMY,WAAW,GAAG,CAAC,CAAC;AAACC,OAAA,CAAAD,WAAA,GAAAA,WAAA;AAC9B,IAAAE,gBAAI,EAAEF,WAAW,EAAE;EAClBG,aAAa,EAAbA,sBAAa;EACbC,YAAY,EAAZA,qBAAY;EACZC,0BAA0B,EAA1BA,oCAA0B;EAC1BC,6BAA6B,EAA7BA,kDAA6B;EAC7BC,eAAe,EAAfA,wBAAe;EACfC,eAAe,EAAfA,wBAAe;EACfC,YAAY,EAAZA,qBAAY;EACZC,YAAY,EAAZA,qBAAY;EACZC,eAAe,EAAfA,wBAAe;EACfC,iBAAiB,EAAjBA,eAAiB;EAEjB;EACAC,sBAAsB,EAAtBA;AACD,CAAE,CAAC"}
@@ -12,11 +12,18 @@ exports.lockPostAutosaving = lockPostAutosaving;
12
12
  exports.lockPostSaving = lockPostSaving;
13
13
  exports.redo = exports.receiveBlocks = exports.multiSelect = exports.moveBlocksUp = exports.moveBlocksDown = exports.moveBlockToPosition = exports.mergeBlocks = void 0;
14
14
  exports.refreshPost = refreshPost;
15
- exports.resetEditorBlocks = exports.resetBlocks = exports.replaceBlocks = exports.replaceBlock = exports.removeBlocks = exports.removeBlock = void 0;
15
+ exports.removeBlocks = exports.removeBlock = void 0;
16
+ exports.removeEditorPanel = removeEditorPanel;
17
+ exports.resetEditorBlocks = exports.resetBlocks = exports.replaceBlocks = exports.replaceBlock = void 0;
16
18
  exports.resetPost = resetPost;
17
- exports.setupEditor = exports.setTemplateValidity = exports.setRenderingMode = exports.selectBlock = exports.savePost = void 0;
19
+ exports.selectBlock = exports.savePost = void 0;
20
+ exports.setDeviceType = setDeviceType;
21
+ exports.setEditedPost = setEditedPost;
22
+ exports.setIsInserterOpened = setIsInserterOpened;
23
+ exports.setIsListViewOpened = setIsListViewOpened;
24
+ exports.setupEditor = exports.setTemplateValidity = exports.setRenderingMode = void 0;
18
25
  exports.setupEditorState = setupEditorState;
19
- exports.undo = exports.trashPost = exports.toggleSelection = exports.toggleBlockMode = exports.synchronizeTemplate = exports.stopTyping = exports.stopMultiSelect = exports.startTyping = exports.startMultiSelect = exports.showInsertionPoint = void 0;
26
+ exports.undo = exports.trashPost = exports.toggleSelection = exports.toggleEditorPanelOpened = exports.toggleEditorPanelEnabled = exports.toggleBlockMode = exports.synchronizeTemplate = exports.stopTyping = exports.stopMultiSelect = exports.startTyping = exports.startMultiSelect = exports.showInsertionPoint = void 0;
20
27
  exports.unlockPostAutosaving = unlockPostAutosaving;
21
28
  exports.unlockPostSaving = unlockPostSaving;
22
29
  exports.updateBlockListSettings = exports.updateBlockAttributes = exports.updateBlock = void 0;
@@ -53,7 +60,7 @@ var _noticeBuilder = require("./utils/notice-builder");
53
60
  const setupEditor = (post, edits, template) => ({
54
61
  dispatch
55
62
  }) => {
56
- dispatch.setupEditorState(post);
63
+ dispatch.setEditedPost(post.type, post.id);
57
64
  // Apply a template for new posts only, if exists.
58
65
  const isNewPost = post.status === 'auto-draft';
59
66
  if (isNewPost && template) {
@@ -84,12 +91,17 @@ const setupEditor = (post, edits, template) => ({
84
91
  * Returns an action object signalling that the editor is being destroyed and
85
92
  * that any necessary state or side-effect cleanup should occur.
86
93
  *
94
+ * @deprecated
95
+ *
87
96
  * @return {Object} Action object.
88
97
  */
89
98
  exports.setupEditor = setupEditor;
90
99
  function __experimentalTearDownEditor() {
100
+ (0, _deprecated.default)("wp.data.dispatch( 'core/editor' ).__experimentalTearDownEditor", {
101
+ since: '6.5'
102
+ });
91
103
  return {
92
- type: 'TEAR_DOWN_EDITOR'
104
+ type: 'DO_NOTHING'
93
105
  };
94
106
  }
95
107
 
@@ -128,17 +140,33 @@ function updatePost() {
128
140
  }
129
141
 
130
142
  /**
131
- * Returns an action object used to setup the editor state when first opening
132
- * an editor.
143
+ * Setup the editor state.
144
+ *
145
+ * @deprecated
133
146
  *
134
147
  * @param {Object} post Post object.
148
+ */
149
+ function setupEditorState(post) {
150
+ (0, _deprecated.default)("wp.data.dispatch( 'core/editor' ).setupEditorState", {
151
+ since: '6.5',
152
+ alternative: "wp.data.dispatch( 'core/editor' ).setEditedPost"
153
+ });
154
+ return setEditedPost(post.type, post.id);
155
+ }
156
+
157
+ /**
158
+ * Returns an action that sets the current post Type and post ID.
159
+ *
160
+ * @param {string} postType Post Type.
161
+ * @param {string} postId Post ID.
135
162
  *
136
163
  * @return {Object} Action object.
137
164
  */
138
- function setupEditorState(post) {
165
+ function setEditedPost(postType, postId) {
139
166
  return {
140
- type: 'SETUP_EDITOR_STATE',
141
- post
167
+ type: 'SET_EDITED_POST',
168
+ postType,
169
+ postId
142
170
  };
143
171
  }
144
172
 
@@ -582,9 +610,18 @@ function updateEditorSettings(settings) {
582
610
  */
583
611
  const setRenderingMode = mode => ({
584
612
  dispatch,
585
- registry
613
+ registry,
614
+ select
586
615
  }) => {
587
- registry.dispatch(_blockEditor.store).clearSelectedBlock();
616
+ if (select.__unstableIsEditorReady()) {
617
+ // We clear the block selection but we also need to clear the selection from the core store.
618
+ registry.dispatch(_blockEditor.store).clearSelectedBlock();
619
+ dispatch.editPost({
620
+ selection: undefined
621
+ }, {
622
+ undoIgnore: true
623
+ });
624
+ }
588
625
  dispatch({
589
626
  type: 'SET_RENDERING_MODE',
590
627
  mode
@@ -592,9 +629,120 @@ const setRenderingMode = mode => ({
592
629
  };
593
630
 
594
631
  /**
595
- * Backward compatibility
632
+ * Action that changes the width of the editing canvas.
633
+ *
634
+ * @param {string} deviceType
635
+ *
636
+ * @return {Object} Action object.
596
637
  */
597
638
  exports.setRenderingMode = setRenderingMode;
639
+ function setDeviceType(deviceType) {
640
+ return {
641
+ type: 'SET_DEVICE_TYPE',
642
+ deviceType
643
+ };
644
+ }
645
+
646
+ /**
647
+ * Returns an action object used to enable or disable a panel in the editor.
648
+ *
649
+ * @param {string} panelName A string that identifies the panel to enable or disable.
650
+ *
651
+ * @return {Object} Action object.
652
+ */
653
+ const toggleEditorPanelEnabled = panelName => ({
654
+ registry
655
+ }) => {
656
+ var _registry$select$get;
657
+ const inactivePanels = (_registry$select$get = registry.select(_preferences.store).get('core', 'inactivePanels')) !== null && _registry$select$get !== void 0 ? _registry$select$get : [];
658
+ const isPanelInactive = !!inactivePanels?.includes(panelName);
659
+
660
+ // If the panel is inactive, remove it to enable it, else add it to
661
+ // make it inactive.
662
+ let updatedInactivePanels;
663
+ if (isPanelInactive) {
664
+ updatedInactivePanels = inactivePanels.filter(invactivePanelName => invactivePanelName !== panelName);
665
+ } else {
666
+ updatedInactivePanels = [...inactivePanels, panelName];
667
+ }
668
+ registry.dispatch(_preferences.store).set('core', 'inactivePanels', updatedInactivePanels);
669
+ };
670
+
671
+ /**
672
+ * Opens a closed panel and closes an open panel.
673
+ *
674
+ * @param {string} panelName A string that identifies the panel to open or close.
675
+ */
676
+ exports.toggleEditorPanelEnabled = toggleEditorPanelEnabled;
677
+ const toggleEditorPanelOpened = panelName => ({
678
+ registry
679
+ }) => {
680
+ var _registry$select$get2;
681
+ const openPanels = (_registry$select$get2 = registry.select(_preferences.store).get('core', 'openPanels')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : [];
682
+ const isPanelOpen = !!openPanels?.includes(panelName);
683
+
684
+ // If the panel is open, remove it to close it, else add it to
685
+ // make it open.
686
+ let updatedOpenPanels;
687
+ if (isPanelOpen) {
688
+ updatedOpenPanels = openPanels.filter(openPanelName => openPanelName !== panelName);
689
+ } else {
690
+ updatedOpenPanels = [...openPanels, panelName];
691
+ }
692
+ registry.dispatch(_preferences.store).set('core', 'openPanels', updatedOpenPanels);
693
+ };
694
+
695
+ /**
696
+ * Returns an action object used to remove a panel from the editor.
697
+ *
698
+ * @param {string} panelName A string that identifies the panel to remove.
699
+ *
700
+ * @return {Object} Action object.
701
+ */
702
+ exports.toggleEditorPanelOpened = toggleEditorPanelOpened;
703
+ function removeEditorPanel(panelName) {
704
+ return {
705
+ type: 'REMOVE_PANEL',
706
+ panelName
707
+ };
708
+ }
709
+
710
+ /**
711
+ * Returns an action object used to open/close the inserter.
712
+ *
713
+ * @param {boolean|Object} value Whether the inserter should be
714
+ * opened (true) or closed (false).
715
+ * To specify an insertion point,
716
+ * use an object.
717
+ * @param {string} value.rootClientId The root client ID to insert at.
718
+ * @param {number} value.insertionIndex The index to insert at.
719
+ *
720
+ * @return {Object} Action object.
721
+ */
722
+ function setIsInserterOpened(value) {
723
+ return {
724
+ type: 'SET_IS_INSERTER_OPENED',
725
+ value
726
+ };
727
+ }
728
+
729
+ /**
730
+ * Returns an action object used to open/close the list view.
731
+ *
732
+ * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.
733
+ * @return {Object} Action object.
734
+ */
735
+ function setIsListViewOpened(isOpen) {
736
+ return {
737
+ type: 'SET_IS_LIST_VIEW_OPENED',
738
+ isOpen
739
+ };
740
+ }
741
+
742
+ /**
743
+ * Backward compatibility
744
+ */
745
+
598
746
  const getBlockEditorAction = name => (...args) => ({
599
747
  registry
600
748
  }) => {