@wordpress/editor 14.33.3 → 14.34.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 (301) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/collab-sidebar/comment-author-info.js +26 -14
  3. package/build/components/collab-sidebar/comment-author-info.js.map +2 -2
  4. package/build/components/document-bar/index.js +16 -3
  5. package/build/components/document-bar/index.js.map +2 -2
  6. package/build/components/editor/index.js +23 -4
  7. package/build/components/editor/index.js.map +3 -3
  8. package/build/components/editor-interface/index.js +15 -10
  9. package/build/components/editor-interface/index.js.map +3 -3
  10. package/build/components/entities-saved-states/entity-type-list.js +19 -15
  11. package/build/components/entities-saved-states/entity-type-list.js.map +3 -3
  12. package/build/components/global-styles/block-link.js +70 -0
  13. package/build/components/global-styles/block-link.js.map +7 -0
  14. package/build/components/global-styles/header.js +54 -0
  15. package/build/components/global-styles/header.js.map +7 -0
  16. package/build/components/global-styles/hooks.js +176 -0
  17. package/build/components/global-styles/hooks.js.map +7 -0
  18. package/build/components/global-styles/index.js +138 -0
  19. package/build/components/global-styles/index.js.map +7 -0
  20. package/build/components/global-styles/menu.js +95 -0
  21. package/build/components/global-styles/menu.js.map +7 -0
  22. package/build/components/global-styles-provider/index.js +3 -49
  23. package/build/components/global-styles-provider/index.js.map +3 -3
  24. package/build/components/global-styles-renderer/index.js +55 -0
  25. package/build/components/global-styles-renderer/index.js.map +7 -0
  26. package/build/components/global-styles-sidebar/default-sidebar.js +66 -0
  27. package/build/components/global-styles-sidebar/default-sidebar.js.map +7 -0
  28. package/build/components/global-styles-sidebar/index.js +182 -0
  29. package/build/components/global-styles-sidebar/index.js.map +7 -0
  30. package/build/components/global-styles-sidebar/welcome-guide-image.js +37 -0
  31. package/build/components/global-styles-sidebar/welcome-guide-image.js.map +7 -0
  32. package/build/components/global-styles-sidebar/welcome-guide.js +143 -0
  33. package/build/components/global-styles-sidebar/welcome-guide.js.map +7 -0
  34. package/build/components/header/index.js +12 -9
  35. package/build/components/header/index.js.map +2 -2
  36. package/build/components/post-featured-image/index.js +32 -1
  37. package/build/components/post-featured-image/index.js.map +3 -3
  38. package/build/components/provider/index.js +0 -2
  39. package/build/components/provider/index.js.map +3 -3
  40. package/build/components/style-book/categories.js +86 -0
  41. package/build/components/style-book/categories.js.map +7 -0
  42. package/build/components/style-book/color-examples.js +64 -0
  43. package/build/components/style-book/color-examples.js.map +7 -0
  44. package/build/components/style-book/constants.js +319 -0
  45. package/build/components/style-book/constants.js.map +7 -0
  46. package/build/components/style-book/duotone-examples.js +68 -0
  47. package/build/components/style-book/duotone-examples.js.map +7 -0
  48. package/build/components/style-book/examples.js +237 -0
  49. package/build/components/style-book/examples.js.map +7 -0
  50. package/build/components/style-book/index.js +627 -0
  51. package/build/components/style-book/index.js.map +7 -0
  52. package/build/components/style-book/types.js +17 -0
  53. package/build/components/style-book/types.js.map +7 -0
  54. package/build/components/styles-canvas/index.js +138 -0
  55. package/build/components/styles-canvas/index.js.map +7 -0
  56. package/build/components/styles-canvas/revisions.js +121 -0
  57. package/build/components/styles-canvas/revisions.js.map +7 -0
  58. package/build/components/styles-canvas/style-book.js +68 -0
  59. package/build/components/styles-canvas/style-book.js.map +7 -0
  60. package/build/components/visual-editor/index.js +4 -3
  61. package/build/components/visual-editor/index.js.map +2 -2
  62. package/build/dataviews/fields/content-preview/content-preview-view.js.map +2 -2
  63. package/build/hooks/index.js +1 -0
  64. package/build/hooks/index.js.map +2 -2
  65. package/build/hooks/media-upload.js +15 -4
  66. package/build/hooks/media-upload.js.map +3 -3
  67. package/build/hooks/push-changes-to-global-styles/index.js +322 -0
  68. package/build/hooks/push-changes-to-global-styles/index.js.map +7 -0
  69. package/build/hooks/use-global-styles-output.js +74 -0
  70. package/build/hooks/use-global-styles-output.js.map +7 -0
  71. package/build/private-apis.js +10 -5
  72. package/build/private-apis.js.map +3 -3
  73. package/build/store/private-actions.js +23 -0
  74. package/build/store/private-actions.js.map +2 -2
  75. package/build/store/private-selectors.js +10 -0
  76. package/build/store/private-selectors.js.map +2 -2
  77. package/build/store/reducer.js +24 -0
  78. package/build/store/reducer.js.map +2 -2
  79. package/build/{components/editor-interface/content-slot-fill.js → utils/set-nested-value.js} +24 -10
  80. package/build/utils/set-nested-value.js.map +7 -0
  81. package/build-module/components/collab-sidebar/comment-author-info.js +26 -14
  82. package/build-module/components/collab-sidebar/comment-author-info.js.map +2 -2
  83. package/build-module/components/document-bar/index.js +16 -3
  84. package/build-module/components/document-bar/index.js.map +2 -2
  85. package/build-module/components/editor/index.js +23 -4
  86. package/build-module/components/editor/index.js.map +2 -2
  87. package/build-module/components/editor-interface/index.js +15 -10
  88. package/build-module/components/editor-interface/index.js.map +2 -2
  89. package/build-module/components/entities-saved-states/entity-type-list.js +18 -14
  90. package/build-module/components/entities-saved-states/entity-type-list.js.map +2 -2
  91. package/build-module/components/global-styles/block-link.js +46 -0
  92. package/build-module/components/global-styles/block-link.js.map +7 -0
  93. package/build-module/components/global-styles/header.js +41 -0
  94. package/build-module/components/global-styles/header.js.map +7 -0
  95. package/build-module/components/global-styles/hooks.js +154 -0
  96. package/build-module/components/global-styles/hooks.js.map +7 -0
  97. package/build-module/components/global-styles/index.js +112 -0
  98. package/build-module/components/global-styles/index.js.map +7 -0
  99. package/build-module/components/global-styles/menu.js +71 -0
  100. package/build-module/components/global-styles/menu.js.map +7 -0
  101. package/build-module/components/global-styles-provider/index.js +3 -37
  102. package/build-module/components/global-styles-provider/index.js.map +2 -2
  103. package/build-module/components/global-styles-renderer/index.js +31 -0
  104. package/build-module/components/global-styles-renderer/index.js.map +7 -0
  105. package/build-module/components/global-styles-sidebar/default-sidebar.js +49 -0
  106. package/build-module/components/global-styles-sidebar/default-sidebar.js.map +7 -0
  107. package/build-module/components/global-styles-sidebar/index.js +152 -0
  108. package/build-module/components/global-styles-sidebar/index.js.map +7 -0
  109. package/build-module/components/global-styles-sidebar/welcome-guide-image.js +17 -0
  110. package/build-module/components/global-styles-sidebar/welcome-guide-image.js.map +7 -0
  111. package/build-module/components/global-styles-sidebar/welcome-guide.js +113 -0
  112. package/build-module/components/global-styles-sidebar/welcome-guide.js.map +7 -0
  113. package/build-module/components/header/index.js +12 -9
  114. package/build-module/components/header/index.js.map +2 -2
  115. package/build-module/components/post-featured-image/index.js +35 -3
  116. package/build-module/components/post-featured-image/index.js.map +2 -2
  117. package/build-module/components/provider/index.js +0 -2
  118. package/build-module/components/provider/index.js.map +2 -2
  119. package/build-module/components/style-book/categories.js +64 -0
  120. package/build-module/components/style-book/categories.js.map +7 -0
  121. package/build-module/components/style-book/color-examples.js +37 -0
  122. package/build-module/components/style-book/color-examples.js.map +7 -0
  123. package/build-module/components/style-book/constants.js +290 -0
  124. package/build-module/components/style-book/constants.js.map +7 -0
  125. package/build-module/components/style-book/duotone-examples.js +48 -0
  126. package/build-module/components/style-book/duotone-examples.js.map +7 -0
  127. package/build-module/components/style-book/examples.js +208 -0
  128. package/build-module/components/style-book/examples.js.map +7 -0
  129. package/build-module/components/style-book/index.js +618 -0
  130. package/build-module/components/style-book/index.js.map +7 -0
  131. package/build-module/components/style-book/types.js +1 -0
  132. package/build-module/components/style-book/types.js.map +7 -0
  133. package/build-module/components/styles-canvas/index.js +104 -0
  134. package/build-module/components/styles-canvas/index.js.map +7 -0
  135. package/build-module/components/styles-canvas/revisions.js +107 -0
  136. package/build-module/components/styles-canvas/revisions.js.map +7 -0
  137. package/build-module/components/styles-canvas/style-book.js +38 -0
  138. package/build-module/components/styles-canvas/style-book.js.map +7 -0
  139. package/build-module/components/visual-editor/index.js +4 -3
  140. package/build-module/components/visual-editor/index.js.map +2 -2
  141. package/build-module/dataviews/fields/content-preview/content-preview-view.js.map +2 -2
  142. package/build-module/hooks/index.js +1 -0
  143. package/build-module/hooks/index.js.map +2 -2
  144. package/build-module/hooks/media-upload.js +19 -5
  145. package/build-module/hooks/media-upload.js.map +2 -2
  146. package/build-module/hooks/push-changes-to-global-styles/index.js +309 -0
  147. package/build-module/hooks/push-changes-to-global-styles/index.js.map +7 -0
  148. package/build-module/hooks/use-global-styles-output.js +49 -0
  149. package/build-module/hooks/use-global-styles-output.js.map +7 -0
  150. package/build-module/private-apis.js +10 -8
  151. package/build-module/private-apis.js.map +2 -2
  152. package/build-module/store/private-actions.js +20 -0
  153. package/build-module/store/private-actions.js.map +2 -2
  154. package/build-module/store/private-selectors.js +8 -0
  155. package/build-module/store/private-selectors.js.map +2 -2
  156. package/build-module/store/reducer.js +22 -0
  157. package/build-module/store/reducer.js.map +2 -2
  158. package/build-module/utils/set-nested-value.js +23 -0
  159. package/build-module/utils/set-nested-value.js.map +7 -0
  160. package/build-style/style-rtl.css +3017 -11
  161. package/build-style/style.css +3018 -11
  162. package/build-types/components/collab-sidebar/comment-author-info.d.ts +5 -16
  163. package/build-types/components/collab-sidebar/comment-author-info.d.ts.map +1 -1
  164. package/build-types/components/document-bar/index.d.ts +2 -2
  165. package/build-types/components/document-bar/index.d.ts.map +1 -1
  166. package/build-types/components/editor/index.d.ts.map +1 -1
  167. package/build-types/components/editor-interface/index.d.ts +1 -3
  168. package/build-types/components/editor-interface/index.d.ts.map +1 -1
  169. package/build-types/components/entities-saved-states/entity-type-list.d.ts.map +1 -1
  170. package/build-types/components/global-styles/block-link.d.ts +12 -0
  171. package/build-types/components/global-styles/block-link.d.ts.map +1 -0
  172. package/build-types/components/global-styles/header.d.ts +7 -0
  173. package/build-types/components/global-styles/header.d.ts.map +1 -0
  174. package/build-types/components/global-styles/hooks.d.ts +24 -0
  175. package/build-types/components/global-styles/hooks.d.ts.map +1 -0
  176. package/build-types/components/global-styles/index.d.ts +6 -0
  177. package/build-types/components/global-styles/index.d.ts.map +1 -0
  178. package/build-types/components/global-styles/menu.d.ts +13 -0
  179. package/build-types/components/global-styles/menu.d.ts.map +1 -0
  180. package/build-types/components/global-styles-provider/index.d.ts +1 -5
  181. package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
  182. package/build-types/components/global-styles-renderer/index.d.ts +4 -0
  183. package/build-types/components/global-styles-renderer/index.d.ts.map +1 -0
  184. package/build-types/components/global-styles-sidebar/default-sidebar.d.ts +13 -0
  185. package/build-types/components/global-styles-sidebar/default-sidebar.d.ts.map +1 -0
  186. package/build-types/components/global-styles-sidebar/index.d.ts +2 -0
  187. package/build-types/components/global-styles-sidebar/index.d.ts.map +1 -0
  188. package/build-types/components/global-styles-sidebar/welcome-guide-image.d.ts +5 -0
  189. package/build-types/components/global-styles-sidebar/welcome-guide-image.d.ts.map +1 -0
  190. package/build-types/components/global-styles-sidebar/welcome-guide.d.ts +2 -0
  191. package/build-types/components/global-styles-sidebar/welcome-guide.d.ts.map +1 -0
  192. package/build-types/components/header/index.d.ts +1 -3
  193. package/build-types/components/header/index.d.ts.map +1 -1
  194. package/build-types/components/provider/index.d.ts.map +1 -1
  195. package/build-types/components/style-book/categories.d.ts +18 -0
  196. package/build-types/components/style-book/categories.d.ts.map +1 -0
  197. package/build-types/components/style-book/color-examples.d.ts +7 -0
  198. package/build-types/components/style-book/color-examples.d.ts.map +1 -0
  199. package/build-types/components/style-book/constants.d.ts +11 -0
  200. package/build-types/components/style-book/constants.d.ts.map +1 -0
  201. package/build-types/components/style-book/duotone-examples.d.ts +9 -0
  202. package/build-types/components/style-book/duotone-examples.d.ts.map +1 -0
  203. package/build-types/components/style-book/examples.d.ts +12 -0
  204. package/build-types/components/style-book/examples.d.ts.map +1 -0
  205. package/build-types/components/style-book/index.d.ts +31 -0
  206. package/build-types/components/style-book/index.d.ts.map +1 -0
  207. package/build-types/components/style-book/types.d.ts +72 -0
  208. package/build-types/components/style-book/types.d.ts.map +1 -0
  209. package/build-types/components/styles-canvas/index.d.ts +16 -0
  210. package/build-types/components/styles-canvas/index.d.ts.map +1 -0
  211. package/build-types/components/styles-canvas/revisions.d.ts +5 -0
  212. package/build-types/components/styles-canvas/revisions.d.ts.map +1 -0
  213. package/build-types/components/styles-canvas/style-book.d.ts +6 -0
  214. package/build-types/components/styles-canvas/style-book.d.ts.map +1 -0
  215. package/build-types/components/visual-editor/index.d.ts +1 -2
  216. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  217. package/build-types/dataviews/fields/content-preview/content-preview-view.d.ts.map +1 -1
  218. package/build-types/hooks/push-changes-to-global-styles/index.d.ts +2 -0
  219. package/build-types/hooks/push-changes-to-global-styles/index.d.ts.map +1 -0
  220. package/build-types/hooks/use-global-styles-output.d.ts +18 -0
  221. package/build-types/hooks/use-global-styles-output.d.ts.map +1 -0
  222. package/build-types/private-apis.d.ts.map +1 -1
  223. package/build-types/store/private-actions.d.ts +20 -0
  224. package/build-types/store/private-actions.d.ts.map +1 -1
  225. package/build-types/store/private-selectors.d.ts +14 -0
  226. package/build-types/store/private-selectors.d.ts.map +1 -1
  227. package/build-types/store/reducer.d.ts +20 -0
  228. package/build-types/store/reducer.d.ts.map +1 -1
  229. package/build-types/utils/set-nested-value.d.ts +20 -0
  230. package/build-types/utils/set-nested-value.d.ts.map +1 -0
  231. package/package.json +40 -40
  232. package/src/components/collab-sidebar/comment-author-info.js +32 -25
  233. package/src/components/collab-sidebar/style.scss +1 -1
  234. package/src/components/document-bar/index.js +18 -3
  235. package/src/components/editor/index.js +25 -1
  236. package/src/components/editor-help/style.scss +1 -1
  237. package/src/components/editor-interface/index.js +40 -39
  238. package/src/components/entities-saved-states/entity-type-list.js +19 -17
  239. package/src/components/global-styles/block-link.js +65 -0
  240. package/src/components/global-styles/header.js +48 -0
  241. package/src/components/global-styles/hooks.js +216 -0
  242. package/src/components/global-styles/index.js +125 -0
  243. package/src/components/global-styles/menu.js +101 -0
  244. package/src/components/global-styles/style.scss +11 -0
  245. package/src/components/global-styles-provider/index.js +3 -45
  246. package/src/components/global-styles-renderer/index.js +39 -0
  247. package/src/components/global-styles-sidebar/default-sidebar.js +46 -0
  248. package/src/components/global-styles-sidebar/index.js +177 -0
  249. package/src/components/global-styles-sidebar/style.scss +119 -0
  250. package/src/components/global-styles-sidebar/welcome-guide-image.js +11 -0
  251. package/src/components/global-styles-sidebar/welcome-guide.js +136 -0
  252. package/src/components/header/index.js +11 -6
  253. package/src/components/post-featured-image/index.js +44 -1
  254. package/src/components/post-last-revision/style.scss +1 -1
  255. package/src/components/post-panel-row/style.scss +1 -0
  256. package/src/components/post-publish-panel/style.scss +1 -1
  257. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +2 -2
  258. package/src/components/provider/index.js +0 -2
  259. package/src/components/style-book/categories.ts +97 -0
  260. package/src/components/style-book/color-examples.tsx +56 -0
  261. package/src/components/style-book/constants.ts +308 -0
  262. package/src/components/style-book/duotone-examples.tsx +56 -0
  263. package/src/components/style-book/examples.tsx +273 -0
  264. package/src/components/style-book/index.js +794 -0
  265. package/src/components/style-book/style.scss +44 -0
  266. package/src/components/style-book/test/categories.js +166 -0
  267. package/src/components/style-book/types.ts +80 -0
  268. package/src/components/styles-canvas/index.js +126 -0
  269. package/src/components/styles-canvas/revisions.js +144 -0
  270. package/src/components/styles-canvas/style-book.js +57 -0
  271. package/src/components/styles-canvas/style.scss +40 -0
  272. package/src/components/visual-editor/index.js +2 -1
  273. package/src/dataviews/fields/content-preview/content-preview-view.tsx +2 -0
  274. package/src/hooks/index.js +1 -0
  275. package/src/hooks/media-upload.js +25 -5
  276. package/src/hooks/push-changes-to-global-styles/index.js +391 -0
  277. package/src/hooks/push-changes-to-global-styles/style.scss +4 -0
  278. package/src/hooks/use-global-styles-output.js +76 -0
  279. package/src/private-apis.js +10 -8
  280. package/src/store/private-actions.js +37 -0
  281. package/src/store/private-selectors.js +20 -0
  282. package/src/store/reducer.js +36 -0
  283. package/src/style.scss +7 -1
  284. package/src/utils/set-nested-value.js +39 -0
  285. package/tsconfig.json +3 -0
  286. package/tsconfig.tsbuildinfo +1 -1
  287. package/build/components/block-settings-menu/content-only-settings-menu.js +0 -186
  288. package/build/components/block-settings-menu/content-only-settings-menu.js.map +0 -7
  289. package/build/components/editor-interface/content-slot-fill.js.map +0 -7
  290. package/build-module/components/block-settings-menu/content-only-settings-menu.js +0 -161
  291. package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +0 -7
  292. package/build-module/components/editor-interface/content-slot-fill.js +0 -9
  293. package/build-module/components/editor-interface/content-slot-fill.js.map +0 -7
  294. package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts +0 -2
  295. package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts.map +0 -1
  296. package/build-types/components/editor-interface/content-slot-fill.d.ts +0 -14
  297. package/build-types/components/editor-interface/content-slot-fill.d.ts.map +0 -1
  298. package/src/components/block-settings-menu/content-only-settings-menu.js +0 -185
  299. package/src/components/block-settings-menu/content-only-settings-menu.native.js +0 -4
  300. package/src/components/block-settings-menu/style.scss +0 -6
  301. package/src/components/editor-interface/content-slot-fill.js +0 -10
@@ -1,186 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var content_only_settings_menu_exports = {};
30
- __export(content_only_settings_menu_exports, {
31
- default: () => ContentOnlySettingsMenu
32
- });
33
- module.exports = __toCommonJS(content_only_settings_menu_exports);
34
- var import_jsx_runtime = require("react/jsx-runtime");
35
- var import_block_editor = require("@wordpress/block-editor");
36
- var import_core_data = require("@wordpress/core-data");
37
- var import_components = require("@wordpress/components");
38
- var import_data = require("@wordpress/data");
39
- var import_i18n = require("@wordpress/i18n");
40
- var import_store = require("../../store");
41
- var import_lock_unlock = require("../../lock-unlock");
42
- var import_use_post_content_blocks = __toESM(require("../provider/use-post-content-blocks"));
43
- function ContentOnlySettingsMenuItems({ clientId, onClose }) {
44
- const postContentBlocks = (0, import_use_post_content_blocks.default)();
45
- const { entity, onNavigateToEntityRecord, canEditTemplates } = (0, import_data.useSelect)(
46
- (select) => {
47
- const {
48
- getBlockParentsByBlockName,
49
- getSettings,
50
- getBlockAttributes,
51
- getBlockParents
52
- } = select(import_block_editor.store);
53
- const { getCurrentTemplateId, getRenderingMode } = select(import_store.store);
54
- const patternParent = getBlockParentsByBlockName(
55
- clientId,
56
- "core/block",
57
- true
58
- )[0];
59
- let record;
60
- if (patternParent) {
61
- record = select(import_core_data.store).getEntityRecord(
62
- "postType",
63
- "wp_block",
64
- getBlockAttributes(patternParent).ref
65
- );
66
- } else if (getRenderingMode() === "template-locked" && !getBlockParents(clientId).some(
67
- (parent) => postContentBlocks.includes(parent)
68
- )) {
69
- record = select(import_core_data.store).getEntityRecord(
70
- "postType",
71
- "wp_template",
72
- getCurrentTemplateId()
73
- );
74
- }
75
- if (!record) {
76
- return {};
77
- }
78
- const _canEditTemplates = select(import_core_data.store).canUser("create", {
79
- kind: "postType",
80
- name: "wp_template"
81
- });
82
- return {
83
- canEditTemplates: _canEditTemplates,
84
- entity: record,
85
- onNavigateToEntityRecord: getSettings().onNavigateToEntityRecord
86
- };
87
- },
88
- [clientId, postContentBlocks]
89
- );
90
- if (!entity) {
91
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
92
- TemplateLockContentOnlyMenuItems,
93
- {
94
- clientId,
95
- onClose
96
- }
97
- );
98
- }
99
- const isPattern = entity.type === "wp_block";
100
- let helpText = isPattern ? (0, import_i18n.__)(
101
- "Edit the pattern to move, delete, or make further changes to this block."
102
- ) : (0, import_i18n.__)(
103
- "Edit the template to move, delete, or make further changes to this block."
104
- );
105
- if (!canEditTemplates) {
106
- helpText = (0, import_i18n.__)(
107
- "Only users with permissions to edit the template can move or delete this block"
108
- );
109
- }
110
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
111
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.__unstableBlockSettingsMenuFirstItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
112
- import_components.MenuItem,
113
- {
114
- onClick: () => {
115
- onNavigateToEntityRecord({
116
- postId: entity.id,
117
- postType: entity.type
118
- });
119
- },
120
- disabled: !canEditTemplates,
121
- children: isPattern ? (0, import_i18n.__)("Edit pattern") : (0, import_i18n.__)("Edit template")
122
- }
123
- ) }),
124
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
125
- import_components.__experimentalText,
126
- {
127
- variant: "muted",
128
- as: "p",
129
- className: "editor-content-only-settings-menu__description",
130
- children: helpText
131
- }
132
- )
133
- ] });
134
- }
135
- function TemplateLockContentOnlyMenuItems({ clientId, onClose }) {
136
- const { contentLockingParent } = (0, import_data.useSelect)(
137
- (select) => {
138
- const { getContentLockingParent } = (0, import_lock_unlock.unlock)(
139
- select(import_block_editor.store)
140
- );
141
- return {
142
- contentLockingParent: getContentLockingParent(clientId)
143
- };
144
- },
145
- [clientId]
146
- );
147
- const blockDisplayInformation = (0, import_block_editor.useBlockDisplayInformation)(contentLockingParent);
148
- const blockEditorActions = (0, import_data.useDispatch)(import_block_editor.store);
149
- if (!blockDisplayInformation?.title) {
150
- return null;
151
- }
152
- const { modifyContentLockBlock } = (0, import_lock_unlock.unlock)(blockEditorActions);
153
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
154
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.__unstableBlockSettingsMenuFirstItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
155
- import_components.MenuItem,
156
- {
157
- onClick: () => {
158
- modifyContentLockBlock(contentLockingParent);
159
- onClose();
160
- },
161
- children: (0, import_i18n._x)("Unlock", "Unlock content locked blocks")
162
- }
163
- ) }),
164
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
165
- import_components.__experimentalText,
166
- {
167
- variant: "muted",
168
- as: "p",
169
- className: "editor-content-only-settings-menu__description",
170
- children: (0, import_i18n.__)(
171
- "Temporarily unlock the parent block to edit, delete or make further changes to this block."
172
- )
173
- }
174
- )
175
- ] });
176
- }
177
- function ContentOnlySettingsMenu() {
178
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockSettingsMenuControls, { children: ({ selectedClientIds, onClose }) => selectedClientIds.length === 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
179
- ContentOnlySettingsMenuItems,
180
- {
181
- clientId: selectedClientIds[0],
182
- onClose
183
- }
184
- ) });
185
- }
186
- //# sourceMappingURL=content-only-settings-menu.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/block-settings-menu/content-only-settings-menu.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tBlockSettingsMenuControls,\n\t__unstableBlockSettingsMenuFirstItem as BlockSettingsMenuFirstItem,\n\tstore as blockEditorStore,\n\tuseBlockDisplayInformation,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalText as Text, MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport usePostContentBlocks from '../provider/use-post-content-blocks';\n\nfunction ContentOnlySettingsMenuItems( { clientId, onClose } ) {\n\tconst postContentBlocks = usePostContentBlocks();\n\tconst { entity, onNavigateToEntityRecord, canEditTemplates } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t\tgetSettings,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockParents,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { getCurrentTemplateId, getRenderingMode } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst patternParent = getBlockParentsByBlockName(\n\t\t\t\tclientId,\n\t\t\t\t'core/block',\n\t\t\t\ttrue\n\t\t\t)[ 0 ];\n\n\t\t\tlet record;\n\t\t\tif ( patternParent ) {\n\t\t\t\trecord = select( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_block',\n\t\t\t\t\tgetBlockAttributes( patternParent ).ref\n\t\t\t\t);\n\t\t\t} else if (\n\t\t\t\tgetRenderingMode() === 'template-locked' &&\n\t\t\t\t! getBlockParents( clientId ).some( ( parent ) =>\n\t\t\t\t\tpostContentBlocks.includes( parent )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\trecord = select( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template',\n\t\t\t\t\tgetCurrentTemplateId()\n\t\t\t\t);\n\t\t\t}\n\t\t\tif ( ! record ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst _canEditTemplates = select( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} );\n\t\t\treturn {\n\t\t\t\tcanEditTemplates: _canEditTemplates,\n\t\t\t\tentity: record,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetSettings().onNavigateToEntityRecord,\n\t\t\t};\n\t\t},\n\t\t[ clientId, postContentBlocks ]\n\t);\n\n\tif ( ! entity ) {\n\t\treturn (\n\t\t\t<TemplateLockContentOnlyMenuItems\n\t\t\t\tclientId={ clientId }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst isPattern = entity.type === 'wp_block';\n\tlet helpText = isPattern\n\t\t? __(\n\t\t\t\t'Edit the pattern to move, delete, or make further changes to this block.'\n\t\t )\n\t\t: __(\n\t\t\t\t'Edit the template to move, delete, or make further changes to this block.'\n\t\t );\n\n\tif ( ! canEditTemplates ) {\n\t\thelpText = __(\n\t\t\t'Only users with permissions to edit the template can move or delete this block'\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockSettingsMenuFirstItem>\n\t\t\t\t<MenuItem\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\tpostId: entity.id,\n\t\t\t\t\t\t\tpostType: entity.type,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdisabled={ ! canEditTemplates }\n\t\t\t\t>\n\t\t\t\t\t{ isPattern ? __( 'Edit pattern' ) : __( 'Edit template' ) }\n\t\t\t\t</MenuItem>\n\t\t\t</BlockSettingsMenuFirstItem>\n\t\t\t<Text\n\t\t\t\tvariant=\"muted\"\n\t\t\t\tas=\"p\"\n\t\t\t\tclassName=\"editor-content-only-settings-menu__description\"\n\t\t\t>\n\t\t\t\t{ helpText }\n\t\t\t</Text>\n\t\t</>\n\t);\n}\n\nfunction TemplateLockContentOnlyMenuItems( { clientId, onClose } ) {\n\tconst { contentLockingParent } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getContentLockingParent } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tcontentLockingParent: getContentLockingParent( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst blockDisplayInformation =\n\t\tuseBlockDisplayInformation( contentLockingParent );\n\tconst blockEditorActions = useDispatch( blockEditorStore );\n\tif ( ! blockDisplayInformation?.title ) {\n\t\treturn null;\n\t}\n\n\tconst { modifyContentLockBlock } = unlock( blockEditorActions );\n\n\treturn (\n\t\t<>\n\t\t\t<BlockSettingsMenuFirstItem>\n\t\t\t\t<MenuItem\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tmodifyContentLockBlock( contentLockingParent );\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ _x( 'Unlock', 'Unlock content locked blocks' ) }\n\t\t\t\t</MenuItem>\n\t\t\t</BlockSettingsMenuFirstItem>\n\t\t\t<Text\n\t\t\t\tvariant=\"muted\"\n\t\t\t\tas=\"p\"\n\t\t\t\tclassName=\"editor-content-only-settings-menu__description\"\n\t\t\t>\n\t\t\t\t{ __(\n\t\t\t\t\t'Temporarily unlock the parent block to edit, delete or make further changes to this block.'\n\t\t\t\t) }\n\t\t\t</Text>\n\t\t</>\n\t);\n}\n\nexport default function ContentOnlySettingsMenu() {\n\treturn (\n\t\t<BlockSettingsMenuControls>\n\t\t\t{ ( { selectedClientIds, onClose } ) =>\n\t\t\t\tselectedClientIds.length === 1 && (\n\t\t\t\t\t<ContentOnlySettingsMenuItems\n\t\t\t\t\t\tclientId={ selectedClientIds[ 0 ] }\n\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t</BlockSettingsMenuControls>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA6EG;AA1EH,0BAKO;AACP,uBAAmC;AACnC,wBAAqD;AACrD,kBAAuC;AACvC,kBAAuB;AAKvB,mBAAqC;AACrC,yBAAuB;AACvB,qCAAiC;AAEjC,SAAS,6BAA8B,EAAE,UAAU,QAAQ,GAA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AAG;AAAA,QACH,WAAU;AAAA,QAER;AAAA,UACD;AAAA,QACD;AAAA;AAAA,IACD;AAAA,KACD;AAEF;AAEe,SAAR,0BAA2C;AACjD,SACC,4CAAC,iDACE,WAAE,EAAE,mBAAmB,QAAQ,MAChC,kBAAkB,WAAW,KAC5B;AAAA,IAAC;AAAA;AAAA,MACA,UAAW,kBAAmB,CAAE;AAAA,MAChC;AAAA;AAAA,EACD,GAGH;AAEF;",
6
- "names": ["usePostContentBlocks", "blockEditorStore", "editorStore", "coreStore", "BlockSettingsMenuFirstItem", "Text"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/editor-interface/content-slot-fill.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst EditorContentSlotFill = createSlotFill(\n\tSymbol( 'EditCanvasContainerSlot' )\n);\n\nexport default EditorContentSlotFill;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA+B;AAE/B,MAAM,4BAAwB;AAAA,EAC7B,OAAQ,yBAA0B;AACnC;AAEA,IAAO,4BAAQ;",
6
- "names": []
7
- }
@@ -1,161 +0,0 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import {
3
- BlockSettingsMenuControls,
4
- __unstableBlockSettingsMenuFirstItem as BlockSettingsMenuFirstItem,
5
- store as blockEditorStore,
6
- useBlockDisplayInformation
7
- } from "@wordpress/block-editor";
8
- import { store as coreStore } from "@wordpress/core-data";
9
- import { __experimentalText as Text, MenuItem } from "@wordpress/components";
10
- import { useSelect, useDispatch } from "@wordpress/data";
11
- import { __, _x } from "@wordpress/i18n";
12
- import { store as editorStore } from "../../store";
13
- import { unlock } from "../../lock-unlock";
14
- import usePostContentBlocks from "../provider/use-post-content-blocks";
15
- function ContentOnlySettingsMenuItems({ clientId, onClose }) {
16
- const postContentBlocks = usePostContentBlocks();
17
- const { entity, onNavigateToEntityRecord, canEditTemplates } = useSelect(
18
- (select) => {
19
- const {
20
- getBlockParentsByBlockName,
21
- getSettings,
22
- getBlockAttributes,
23
- getBlockParents
24
- } = select(blockEditorStore);
25
- const { getCurrentTemplateId, getRenderingMode } = select(editorStore);
26
- const patternParent = getBlockParentsByBlockName(
27
- clientId,
28
- "core/block",
29
- true
30
- )[0];
31
- let record;
32
- if (patternParent) {
33
- record = select(coreStore).getEntityRecord(
34
- "postType",
35
- "wp_block",
36
- getBlockAttributes(patternParent).ref
37
- );
38
- } else if (getRenderingMode() === "template-locked" && !getBlockParents(clientId).some(
39
- (parent) => postContentBlocks.includes(parent)
40
- )) {
41
- record = select(coreStore).getEntityRecord(
42
- "postType",
43
- "wp_template",
44
- getCurrentTemplateId()
45
- );
46
- }
47
- if (!record) {
48
- return {};
49
- }
50
- const _canEditTemplates = select(coreStore).canUser("create", {
51
- kind: "postType",
52
- name: "wp_template"
53
- });
54
- return {
55
- canEditTemplates: _canEditTemplates,
56
- entity: record,
57
- onNavigateToEntityRecord: getSettings().onNavigateToEntityRecord
58
- };
59
- },
60
- [clientId, postContentBlocks]
61
- );
62
- if (!entity) {
63
- return /* @__PURE__ */ jsx(
64
- TemplateLockContentOnlyMenuItems,
65
- {
66
- clientId,
67
- onClose
68
- }
69
- );
70
- }
71
- const isPattern = entity.type === "wp_block";
72
- let helpText = isPattern ? __(
73
- "Edit the pattern to move, delete, or make further changes to this block."
74
- ) : __(
75
- "Edit the template to move, delete, or make further changes to this block."
76
- );
77
- if (!canEditTemplates) {
78
- helpText = __(
79
- "Only users with permissions to edit the template can move or delete this block"
80
- );
81
- }
82
- return /* @__PURE__ */ jsxs(Fragment, { children: [
83
- /* @__PURE__ */ jsx(BlockSettingsMenuFirstItem, { children: /* @__PURE__ */ jsx(
84
- MenuItem,
85
- {
86
- onClick: () => {
87
- onNavigateToEntityRecord({
88
- postId: entity.id,
89
- postType: entity.type
90
- });
91
- },
92
- disabled: !canEditTemplates,
93
- children: isPattern ? __("Edit pattern") : __("Edit template")
94
- }
95
- ) }),
96
- /* @__PURE__ */ jsx(
97
- Text,
98
- {
99
- variant: "muted",
100
- as: "p",
101
- className: "editor-content-only-settings-menu__description",
102
- children: helpText
103
- }
104
- )
105
- ] });
106
- }
107
- function TemplateLockContentOnlyMenuItems({ clientId, onClose }) {
108
- const { contentLockingParent } = useSelect(
109
- (select) => {
110
- const { getContentLockingParent } = unlock(
111
- select(blockEditorStore)
112
- );
113
- return {
114
- contentLockingParent: getContentLockingParent(clientId)
115
- };
116
- },
117
- [clientId]
118
- );
119
- const blockDisplayInformation = useBlockDisplayInformation(contentLockingParent);
120
- const blockEditorActions = useDispatch(blockEditorStore);
121
- if (!blockDisplayInformation?.title) {
122
- return null;
123
- }
124
- const { modifyContentLockBlock } = unlock(blockEditorActions);
125
- return /* @__PURE__ */ jsxs(Fragment, { children: [
126
- /* @__PURE__ */ jsx(BlockSettingsMenuFirstItem, { children: /* @__PURE__ */ jsx(
127
- MenuItem,
128
- {
129
- onClick: () => {
130
- modifyContentLockBlock(contentLockingParent);
131
- onClose();
132
- },
133
- children: _x("Unlock", "Unlock content locked blocks")
134
- }
135
- ) }),
136
- /* @__PURE__ */ jsx(
137
- Text,
138
- {
139
- variant: "muted",
140
- as: "p",
141
- className: "editor-content-only-settings-menu__description",
142
- children: __(
143
- "Temporarily unlock the parent block to edit, delete or make further changes to this block."
144
- )
145
- }
146
- )
147
- ] });
148
- }
149
- function ContentOnlySettingsMenu() {
150
- return /* @__PURE__ */ jsx(BlockSettingsMenuControls, { children: ({ selectedClientIds, onClose }) => selectedClientIds.length === 1 && /* @__PURE__ */ jsx(
151
- ContentOnlySettingsMenuItems,
152
- {
153
- clientId: selectedClientIds[0],
154
- onClose
155
- }
156
- ) });
157
- }
158
- export {
159
- ContentOnlySettingsMenu as default
160
- };
161
- //# sourceMappingURL=content-only-settings-menu.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/block-settings-menu/content-only-settings-menu.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tBlockSettingsMenuControls,\n\t__unstableBlockSettingsMenuFirstItem as BlockSettingsMenuFirstItem,\n\tstore as blockEditorStore,\n\tuseBlockDisplayInformation,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalText as Text, MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport usePostContentBlocks from '../provider/use-post-content-blocks';\n\nfunction ContentOnlySettingsMenuItems( { clientId, onClose } ) {\n\tconst postContentBlocks = usePostContentBlocks();\n\tconst { entity, onNavigateToEntityRecord, canEditTemplates } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t\tgetSettings,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockParents,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { getCurrentTemplateId, getRenderingMode } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst patternParent = getBlockParentsByBlockName(\n\t\t\t\tclientId,\n\t\t\t\t'core/block',\n\t\t\t\ttrue\n\t\t\t)[ 0 ];\n\n\t\t\tlet record;\n\t\t\tif ( patternParent ) {\n\t\t\t\trecord = select( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_block',\n\t\t\t\t\tgetBlockAttributes( patternParent ).ref\n\t\t\t\t);\n\t\t\t} else if (\n\t\t\t\tgetRenderingMode() === 'template-locked' &&\n\t\t\t\t! getBlockParents( clientId ).some( ( parent ) =>\n\t\t\t\t\tpostContentBlocks.includes( parent )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\trecord = select( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template',\n\t\t\t\t\tgetCurrentTemplateId()\n\t\t\t\t);\n\t\t\t}\n\t\t\tif ( ! record ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst _canEditTemplates = select( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} );\n\t\t\treturn {\n\t\t\t\tcanEditTemplates: _canEditTemplates,\n\t\t\t\tentity: record,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetSettings().onNavigateToEntityRecord,\n\t\t\t};\n\t\t},\n\t\t[ clientId, postContentBlocks ]\n\t);\n\n\tif ( ! entity ) {\n\t\treturn (\n\t\t\t<TemplateLockContentOnlyMenuItems\n\t\t\t\tclientId={ clientId }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst isPattern = entity.type === 'wp_block';\n\tlet helpText = isPattern\n\t\t? __(\n\t\t\t\t'Edit the pattern to move, delete, or make further changes to this block.'\n\t\t )\n\t\t: __(\n\t\t\t\t'Edit the template to move, delete, or make further changes to this block.'\n\t\t );\n\n\tif ( ! canEditTemplates ) {\n\t\thelpText = __(\n\t\t\t'Only users with permissions to edit the template can move or delete this block'\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockSettingsMenuFirstItem>\n\t\t\t\t<MenuItem\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\tpostId: entity.id,\n\t\t\t\t\t\t\tpostType: entity.type,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdisabled={ ! canEditTemplates }\n\t\t\t\t>\n\t\t\t\t\t{ isPattern ? __( 'Edit pattern' ) : __( 'Edit template' ) }\n\t\t\t\t</MenuItem>\n\t\t\t</BlockSettingsMenuFirstItem>\n\t\t\t<Text\n\t\t\t\tvariant=\"muted\"\n\t\t\t\tas=\"p\"\n\t\t\t\tclassName=\"editor-content-only-settings-menu__description\"\n\t\t\t>\n\t\t\t\t{ helpText }\n\t\t\t</Text>\n\t\t</>\n\t);\n}\n\nfunction TemplateLockContentOnlyMenuItems( { clientId, onClose } ) {\n\tconst { contentLockingParent } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getContentLockingParent } = unlock(\n\t\t\t\tselect( blockEditorStore )\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tcontentLockingParent: getContentLockingParent( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst blockDisplayInformation =\n\t\tuseBlockDisplayInformation( contentLockingParent );\n\tconst blockEditorActions = useDispatch( blockEditorStore );\n\tif ( ! blockDisplayInformation?.title ) {\n\t\treturn null;\n\t}\n\n\tconst { modifyContentLockBlock } = unlock( blockEditorActions );\n\n\treturn (\n\t\t<>\n\t\t\t<BlockSettingsMenuFirstItem>\n\t\t\t\t<MenuItem\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tmodifyContentLockBlock( contentLockingParent );\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ _x( 'Unlock', 'Unlock content locked blocks' ) }\n\t\t\t\t</MenuItem>\n\t\t\t</BlockSettingsMenuFirstItem>\n\t\t\t<Text\n\t\t\t\tvariant=\"muted\"\n\t\t\t\tas=\"p\"\n\t\t\t\tclassName=\"editor-content-only-settings-menu__description\"\n\t\t\t>\n\t\t\t\t{ __(\n\t\t\t\t\t'Temporarily unlock the parent block to edit, delete or make further changes to this block.'\n\t\t\t\t) }\n\t\t\t</Text>\n\t\t</>\n\t);\n}\n\nexport default function ContentOnlySettingsMenu() {\n\treturn (\n\t\t<BlockSettingsMenuControls>\n\t\t\t{ ( { selectedClientIds, onClose } ) =>\n\t\t\t\tselectedClientIds.length === 1 && (\n\t\t\t\t\t<ContentOnlySettingsMenuItems\n\t\t\t\t\t\tclientId={ selectedClientIds[ 0 ] }\n\t\t\t\t\t\tonClose={ onClose }\n\t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ACR;AAEA,QAAM,EAAE,uBAAuB,IAAI,OAAQ,kBAAmB;AAE9D,SACC,iCACC;AAAA,wBAAC,8BACA;AAAA,MAAC;AAAA;AAAA,QACA,SAAU,MAAM;AACf,iCAAwB,oBAAqB;AAC7C,kBAAQ;AAAA,QACT;AAAA,QAEE,aAAI,UAAU,8BAA+B;AAAA;AAAA,IAChD,GACD;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,SAAQ;AAAA,QACR,IAAG;AAAA,QACH,WAAU;AAAA,QAER;AAAA,UACD;AAAA,QACD;AAAA;AAAA,IACD;AAAA,KACD;AAEF;AAEe,SAAR,0BAA2C;AACjD,SACC,oBAAC,6BACE,WAAE,EAAE,mBAAmB,QAAQ,MAChC,kBAAkB,WAAW,KAC5B;AAAA,IAAC;AAAA;AAAA,MACA,UAAW,kBAAmB,CAAE;AAAA,MAChC;AAAA;AAAA,EACD,GAGH;AAEF;",
6
- "names": []
7
- }
@@ -1,9 +0,0 @@
1
- import { createSlotFill } from "@wordpress/components";
2
- const EditorContentSlotFill = createSlotFill(
3
- Symbol("EditCanvasContainerSlot")
4
- );
5
- var content_slot_fill_default = EditorContentSlotFill;
6
- export {
7
- content_slot_fill_default as default
8
- };
9
- //# sourceMappingURL=content-slot-fill.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/editor-interface/content-slot-fill.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst EditorContentSlotFill = createSlotFill(\n\tSymbol( 'EditCanvasContainerSlot' )\n);\n\nexport default EditorContentSlotFill;\n"],
5
- "mappings": "AAGA,SAAS,sBAAsB;AAE/B,MAAM,wBAAwB;AAAA,EAC7B,OAAQ,yBAA0B;AACnC;AAEA,IAAO,4BAAQ;",
6
- "names": []
7
- }
@@ -1,2 +0,0 @@
1
- export default function ContentOnlySettingsMenu(): import("react").JSX.Element;
2
- //# sourceMappingURL=content-only-settings-menu.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"content-only-settings-menu.d.ts","sourceRoot":"","sources":["../../../src/components/block-settings-menu/content-only-settings-menu.js"],"names":[],"mappings":"AA2KA,+EAaC"}
@@ -1,14 +0,0 @@
1
- export default EditorContentSlotFill;
2
- declare const EditorContentSlotFill: {
3
- name: import("@wordpress/components/build-types/slot-fill/types").SlotKey;
4
- Fill: {
5
- (props: Omit<import("@wordpress/components/build-types/slot-fill/types").FillComponentProps, "name">): import("react").JSX.Element;
6
- displayName: string;
7
- };
8
- Slot: {
9
- (props: import("@wordpress/components/build-types/slot-fill/types").DistributiveOmit<import("@wordpress/components/build-types/slot-fill/types").SlotComponentProps, "name">): import("react").JSX.Element;
10
- displayName: string;
11
- __unstableName: import("@wordpress/components/build-types/slot-fill/types").SlotKey;
12
- };
13
- };
14
- //# sourceMappingURL=content-slot-fill.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"content-slot-fill.d.ts","sourceRoot":"","sources":["../../../src/components/editor-interface/content-slot-fill.js"],"names":[],"mappings":";AAKA;;;sHAK+7B,OAAO;;;;8LAAqI,OAAO;;;;EAHhlC"}
@@ -1,185 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import {
5
- BlockSettingsMenuControls,
6
- __unstableBlockSettingsMenuFirstItem as BlockSettingsMenuFirstItem,
7
- store as blockEditorStore,
8
- useBlockDisplayInformation,
9
- } from '@wordpress/block-editor';
10
- import { store as coreStore } from '@wordpress/core-data';
11
- import { __experimentalText as Text, MenuItem } from '@wordpress/components';
12
- import { useSelect, useDispatch } from '@wordpress/data';
13
- import { __, _x } from '@wordpress/i18n';
14
-
15
- /**
16
- * Internal dependencies
17
- */
18
- import { store as editorStore } from '../../store';
19
- import { unlock } from '../../lock-unlock';
20
- import usePostContentBlocks from '../provider/use-post-content-blocks';
21
-
22
- function ContentOnlySettingsMenuItems( { clientId, onClose } ) {
23
- const postContentBlocks = usePostContentBlocks();
24
- const { entity, onNavigateToEntityRecord, canEditTemplates } = useSelect(
25
- ( select ) => {
26
- const {
27
- getBlockParentsByBlockName,
28
- getSettings,
29
- getBlockAttributes,
30
- getBlockParents,
31
- } = select( blockEditorStore );
32
- const { getCurrentTemplateId, getRenderingMode } =
33
- select( editorStore );
34
- const patternParent = getBlockParentsByBlockName(
35
- clientId,
36
- 'core/block',
37
- true
38
- )[ 0 ];
39
-
40
- let record;
41
- if ( patternParent ) {
42
- record = select( coreStore ).getEntityRecord(
43
- 'postType',
44
- 'wp_block',
45
- getBlockAttributes( patternParent ).ref
46
- );
47
- } else if (
48
- getRenderingMode() === 'template-locked' &&
49
- ! getBlockParents( clientId ).some( ( parent ) =>
50
- postContentBlocks.includes( parent )
51
- )
52
- ) {
53
- record = select( coreStore ).getEntityRecord(
54
- 'postType',
55
- 'wp_template',
56
- getCurrentTemplateId()
57
- );
58
- }
59
- if ( ! record ) {
60
- return {};
61
- }
62
- const _canEditTemplates = select( coreStore ).canUser( 'create', {
63
- kind: 'postType',
64
- name: 'wp_template',
65
- } );
66
- return {
67
- canEditTemplates: _canEditTemplates,
68
- entity: record,
69
- onNavigateToEntityRecord:
70
- getSettings().onNavigateToEntityRecord,
71
- };
72
- },
73
- [ clientId, postContentBlocks ]
74
- );
75
-
76
- if ( ! entity ) {
77
- return (
78
- <TemplateLockContentOnlyMenuItems
79
- clientId={ clientId }
80
- onClose={ onClose }
81
- />
82
- );
83
- }
84
-
85
- const isPattern = entity.type === 'wp_block';
86
- let helpText = isPattern
87
- ? __(
88
- 'Edit the pattern to move, delete, or make further changes to this block.'
89
- )
90
- : __(
91
- 'Edit the template to move, delete, or make further changes to this block.'
92
- );
93
-
94
- if ( ! canEditTemplates ) {
95
- helpText = __(
96
- 'Only users with permissions to edit the template can move or delete this block'
97
- );
98
- }
99
-
100
- return (
101
- <>
102
- <BlockSettingsMenuFirstItem>
103
- <MenuItem
104
- onClick={ () => {
105
- onNavigateToEntityRecord( {
106
- postId: entity.id,
107
- postType: entity.type,
108
- } );
109
- } }
110
- disabled={ ! canEditTemplates }
111
- >
112
- { isPattern ? __( 'Edit pattern' ) : __( 'Edit template' ) }
113
- </MenuItem>
114
- </BlockSettingsMenuFirstItem>
115
- <Text
116
- variant="muted"
117
- as="p"
118
- className="editor-content-only-settings-menu__description"
119
- >
120
- { helpText }
121
- </Text>
122
- </>
123
- );
124
- }
125
-
126
- function TemplateLockContentOnlyMenuItems( { clientId, onClose } ) {
127
- const { contentLockingParent } = useSelect(
128
- ( select ) => {
129
- const { getContentLockingParent } = unlock(
130
- select( blockEditorStore )
131
- );
132
- return {
133
- contentLockingParent: getContentLockingParent( clientId ),
134
- };
135
- },
136
- [ clientId ]
137
- );
138
- const blockDisplayInformation =
139
- useBlockDisplayInformation( contentLockingParent );
140
- const blockEditorActions = useDispatch( blockEditorStore );
141
- if ( ! blockDisplayInformation?.title ) {
142
- return null;
143
- }
144
-
145
- const { modifyContentLockBlock } = unlock( blockEditorActions );
146
-
147
- return (
148
- <>
149
- <BlockSettingsMenuFirstItem>
150
- <MenuItem
151
- onClick={ () => {
152
- modifyContentLockBlock( contentLockingParent );
153
- onClose();
154
- } }
155
- >
156
- { _x( 'Unlock', 'Unlock content locked blocks' ) }
157
- </MenuItem>
158
- </BlockSettingsMenuFirstItem>
159
- <Text
160
- variant="muted"
161
- as="p"
162
- className="editor-content-only-settings-menu__description"
163
- >
164
- { __(
165
- 'Temporarily unlock the parent block to edit, delete or make further changes to this block.'
166
- ) }
167
- </Text>
168
- </>
169
- );
170
- }
171
-
172
- export default function ContentOnlySettingsMenu() {
173
- return (
174
- <BlockSettingsMenuControls>
175
- { ( { selectedClientIds, onClose } ) =>
176
- selectedClientIds.length === 1 && (
177
- <ContentOnlySettingsMenuItems
178
- clientId={ selectedClientIds[ 0 ] }
179
- onClose={ onClose }
180
- />
181
- )
182
- }
183
- </BlockSettingsMenuControls>
184
- );
185
- }
@@ -1,4 +0,0 @@
1
- // Render nothing in native for now.
2
- export default function ContentOnlySettingsMenu() {
3
- return null;
4
- }
@@ -1,6 +0,0 @@
1
- @use "@wordpress/base-styles/variables" as *;
2
-
3
- .editor-content-only-settings-menu__description {
4
- padding: $grid-unit;
5
- min-width: 235px;
6
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { createSlotFill } from '@wordpress/components';
5
-
6
- const EditorContentSlotFill = createSlotFill(
7
- Symbol( 'EditCanvasContainerSlot' )
8
- );
9
-
10
- export default EditorContentSlotFill;