@wordpress/media-editor 0.9.0 → 0.10.1

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 (322) hide show
  1. package/build/components/media-editor/index.cjs +212 -170
  2. package/build/components/media-editor/index.cjs.map +3 -3
  3. package/build/components/media-editor/use-crop-options.cjs +63 -0
  4. package/build/components/media-editor/use-crop-options.cjs.map +7 -0
  5. package/build/components/media-editor/use-save-media-editor.cjs +185 -0
  6. package/build/components/media-editor/use-save-media-editor.cjs.map +7 -0
  7. package/build/components/media-editor-canvas/index.cjs +33 -12
  8. package/build/components/media-editor-canvas/index.cjs.map +2 -2
  9. package/build/components/media-editor-crop-panel/index.cjs +70 -84
  10. package/build/components/media-editor-crop-panel/index.cjs.map +2 -2
  11. package/build/components/media-editor-fine-rotation/index.cjs +81 -0
  12. package/build/components/media-editor-fine-rotation/index.cjs.map +7 -0
  13. package/build/components/media-editor-modal/index.cjs +63 -16
  14. package/build/components/media-editor-modal/index.cjs.map +3 -3
  15. package/build/components/media-editor-transform-controls/index.cjs +84 -0
  16. package/build/components/media-editor-transform-controls/index.cjs.map +7 -0
  17. package/build/components/media-form/index.cjs +19 -1
  18. package/build/components/media-form/index.cjs.map +3 -3
  19. package/build/components/media-form/sidebar-datetime-view.cjs +53 -0
  20. package/build/components/media-form/sidebar-datetime-view.cjs.map +7 -0
  21. package/build/components/rotation-ruler/index.cjs +8 -2
  22. package/build/components/rotation-ruler/index.cjs.map +2 -2
  23. package/build/hooks/use-crop-gesture-handlers.cjs +41 -4
  24. package/build/hooks/use-crop-gesture-handlers.cjs.map +2 -2
  25. package/build/image-editor/core/camera.cjs +29 -11
  26. package/build/image-editor/core/camera.cjs.map +2 -2
  27. package/build/image-editor/core/constants.cjs +6 -0
  28. package/build/image-editor/core/constants.cjs.map +2 -2
  29. package/build/image-editor/core/containment.cjs +71 -34
  30. package/build/image-editor/core/containment.cjs.map +2 -2
  31. package/build/image-editor/core/crop-rect.cjs +48 -0
  32. package/build/image-editor/core/crop-rect.cjs.map +7 -0
  33. package/build/image-editor/core/index.cjs +12 -0
  34. package/build/image-editor/core/index.cjs.map +2 -2
  35. package/build/image-editor/core/interaction-controller.cjs.map +2 -2
  36. package/build/image-editor/core/math/sanitize.cjs +92 -0
  37. package/build/image-editor/core/math/sanitize.cjs.map +7 -0
  38. package/build/image-editor/core/setter-helpers.cjs +64 -0
  39. package/build/image-editor/core/setter-helpers.cjs.map +7 -0
  40. package/build/image-editor/core/source-region.cjs +16 -14
  41. package/build/image-editor/core/source-region.cjs.map +2 -2
  42. package/build/image-editor/core/state.cjs +20 -10
  43. package/build/image-editor/core/state.cjs.map +2 -2
  44. package/build/image-editor/core/stencil-math.cjs +31 -20
  45. package/build/image-editor/core/stencil-math.cjs.map +2 -2
  46. package/build/image-editor/core/transform-style.cjs +12 -6
  47. package/build/image-editor/core/transform-style.cjs.map +2 -2
  48. package/build/image-editor/core/types.cjs.map +1 -1
  49. package/build/image-editor/index.cjs +12 -2
  50. package/build/image-editor/index.cjs.map +2 -2
  51. package/build/image-editor/react/components/cropper-provider.cjs +2 -2
  52. package/build/image-editor/react/components/cropper-provider.cjs.map +2 -2
  53. package/build/image-editor/react/components/cropper.cjs +120 -47
  54. package/build/image-editor/react/components/cropper.cjs.map +2 -2
  55. package/build/image-editor/react/components/overlays/dimensions-overlay.cjs +172 -0
  56. package/build/image-editor/react/components/overlays/dimensions-overlay.cjs.map +7 -0
  57. package/build/image-editor/react/components/stencils/rectangle-stencil.cjs +19 -9
  58. package/build/image-editor/react/components/stencils/rectangle-stencil.cjs.map +2 -2
  59. package/build/image-editor/react/hooks/build-cropper-setters.cjs +71 -0
  60. package/build/image-editor/react/hooks/build-cropper-setters.cjs.map +7 -0
  61. package/build/image-editor/react/hooks/index.cjs +6 -3
  62. package/build/image-editor/react/hooks/index.cjs.map +2 -2
  63. package/build/image-editor/react/hooks/use-cropper-reducer.cjs +113 -0
  64. package/build/image-editor/react/hooks/use-cropper-reducer.cjs.map +7 -0
  65. package/build/state/composite-reducer.cjs +103 -0
  66. package/build/state/composite-reducer.cjs.map +7 -0
  67. package/build/state/index.cjs +48 -0
  68. package/build/state/index.cjs.map +7 -0
  69. package/build/state/media-editor-state-provider.cjs +58 -0
  70. package/build/state/media-editor-state-provider.cjs.map +7 -0
  71. package/build/state/types.cjs +33 -0
  72. package/build/state/types.cjs.map +7 -0
  73. package/build/state/use-media-editor-state.cjs +287 -0
  74. package/build/state/use-media-editor-state.cjs.map +7 -0
  75. package/build/store/actions.cjs +4 -2
  76. package/build/store/actions.cjs.map +2 -2
  77. package/build/store/reducer.cjs +5 -3
  78. package/build/store/reducer.cjs.map +2 -2
  79. package/build/store/selectors.cjs +5 -0
  80. package/build/store/selectors.cjs.map +2 -2
  81. package/build-module/components/media-editor/index.mjs +224 -177
  82. package/build-module/components/media-editor/index.mjs.map +2 -2
  83. package/build-module/components/media-editor/use-crop-options.mjs +37 -0
  84. package/build-module/components/media-editor/use-crop-options.mjs.map +7 -0
  85. package/build-module/components/media-editor/use-save-media-editor.mjs +151 -0
  86. package/build-module/components/media-editor/use-save-media-editor.mjs.map +7 -0
  87. package/build-module/components/media-editor-canvas/index.mjs +34 -13
  88. package/build-module/components/media-editor-canvas/index.mjs.map +2 -2
  89. package/build-module/components/media-editor-crop-panel/index.mjs +73 -89
  90. package/build-module/components/media-editor-crop-panel/index.mjs.map +2 -2
  91. package/build-module/components/media-editor-fine-rotation/index.mjs +50 -0
  92. package/build-module/components/media-editor-fine-rotation/index.mjs.map +7 -0
  93. package/build-module/components/media-editor-modal/index.mjs +64 -17
  94. package/build-module/components/media-editor-modal/index.mjs.map +2 -2
  95. package/build-module/components/media-editor-transform-controls/index.mjs +68 -0
  96. package/build-module/components/media-editor-transform-controls/index.mjs.map +7 -0
  97. package/build-module/components/media-form/index.mjs +9 -1
  98. package/build-module/components/media-form/index.mjs.map +2 -2
  99. package/build-module/components/media-form/sidebar-datetime-view.mjs +32 -0
  100. package/build-module/components/media-form/sidebar-datetime-view.mjs.map +7 -0
  101. package/build-module/components/rotation-ruler/index.mjs +8 -2
  102. package/build-module/components/rotation-ruler/index.mjs.map +2 -2
  103. package/build-module/hooks/use-crop-gesture-handlers.mjs +41 -4
  104. package/build-module/hooks/use-crop-gesture-handlers.mjs.map +2 -2
  105. package/build-module/image-editor/core/camera.mjs +34 -11
  106. package/build-module/image-editor/core/camera.mjs.map +2 -2
  107. package/build-module/image-editor/core/constants.mjs +4 -0
  108. package/build-module/image-editor/core/constants.mjs.map +2 -2
  109. package/build-module/image-editor/core/containment.mjs +75 -34
  110. package/build-module/image-editor/core/containment.mjs.map +2 -2
  111. package/build-module/image-editor/core/crop-rect.mjs +23 -0
  112. package/build-module/image-editor/core/crop-rect.mjs.map +7 -0
  113. package/build-module/image-editor/core/index.mjs +12 -0
  114. package/build-module/image-editor/core/index.mjs.map +2 -2
  115. package/build-module/image-editor/core/interaction-controller.mjs.map +2 -2
  116. package/build-module/image-editor/core/math/sanitize.mjs +63 -0
  117. package/build-module/image-editor/core/math/sanitize.mjs.map +7 -0
  118. package/build-module/image-editor/core/setter-helpers.mjs +39 -0
  119. package/build-module/image-editor/core/setter-helpers.mjs.map +7 -0
  120. package/build-module/image-editor/core/source-region.mjs +16 -14
  121. package/build-module/image-editor/core/source-region.mjs.map +2 -2
  122. package/build-module/image-editor/core/state.mjs +25 -11
  123. package/build-module/image-editor/core/state.mjs.map +2 -2
  124. package/build-module/image-editor/core/stencil-math.mjs +30 -19
  125. package/build-module/image-editor/core/stencil-math.mjs.map +2 -2
  126. package/build-module/image-editor/core/transform-style.mjs +12 -6
  127. package/build-module/image-editor/core/transform-style.mjs.map +2 -2
  128. package/build-module/image-editor/index.mjs +11 -2
  129. package/build-module/image-editor/index.mjs.map +2 -2
  130. package/build-module/image-editor/react/components/cropper-provider.mjs +3 -3
  131. package/build-module/image-editor/react/components/cropper-provider.mjs.map +2 -2
  132. package/build-module/image-editor/react/components/cropper.mjs +121 -48
  133. package/build-module/image-editor/react/components/cropper.mjs.map +2 -2
  134. package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs +147 -0
  135. package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs.map +7 -0
  136. package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs +19 -9
  137. package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs.map +2 -2
  138. package/build-module/image-editor/react/hooks/build-cropper-setters.mjs +46 -0
  139. package/build-module/image-editor/react/hooks/build-cropper-setters.mjs.map +7 -0
  140. package/build-module/image-editor/react/hooks/index.mjs +4 -2
  141. package/build-module/image-editor/react/hooks/index.mjs.map +2 -2
  142. package/build-module/image-editor/react/hooks/use-cropper-reducer.mjs +100 -0
  143. package/build-module/image-editor/react/hooks/use-cropper-reducer.mjs.map +7 -0
  144. package/build-module/state/composite-reducer.mjs +82 -0
  145. package/build-module/state/composite-reducer.mjs.map +7 -0
  146. package/build-module/state/index.mjs +26 -0
  147. package/build-module/state/index.mjs.map +7 -0
  148. package/build-module/state/media-editor-state-provider.mjs +34 -0
  149. package/build-module/state/media-editor-state-provider.mjs.map +7 -0
  150. package/build-module/state/types.mjs +8 -0
  151. package/build-module/state/types.mjs.map +7 -0
  152. package/build-module/state/use-media-editor-state.mjs +278 -0
  153. package/build-module/state/use-media-editor-state.mjs.map +7 -0
  154. package/build-module/store/actions.mjs +4 -2
  155. package/build-module/store/actions.mjs.map +2 -2
  156. package/build-module/store/reducer.mjs +5 -3
  157. package/build-module/store/reducer.mjs.map +2 -2
  158. package/build-module/store/selectors.mjs +4 -0
  159. package/build-module/store/selectors.mjs.map +2 -2
  160. package/build-style/style-rtl.css +97 -44
  161. package/build-style/style.css +97 -44
  162. package/build-types/components/media-editor/index.d.ts +14 -5
  163. package/build-types/components/media-editor/index.d.ts.map +1 -1
  164. package/build-types/components/media-editor/use-crop-options.d.ts +35 -0
  165. package/build-types/components/media-editor/use-crop-options.d.ts.map +1 -0
  166. package/build-types/components/media-editor/use-save-media-editor.d.ts +29 -0
  167. package/build-types/components/media-editor/use-save-media-editor.d.ts.map +1 -0
  168. package/build-types/components/media-editor-canvas/index.d.ts +5 -10
  169. package/build-types/components/media-editor-canvas/index.d.ts.map +1 -1
  170. package/build-types/components/media-editor-crop-panel/index.d.ts +6 -25
  171. package/build-types/components/media-editor-crop-panel/index.d.ts.map +1 -1
  172. package/build-types/components/media-editor-fine-rotation/index.d.ts +14 -0
  173. package/build-types/components/media-editor-fine-rotation/index.d.ts.map +1 -0
  174. package/build-types/components/media-editor-modal/index.d.ts.map +1 -1
  175. package/build-types/components/media-editor-transform-controls/index.d.ts +8 -0
  176. package/build-types/components/media-editor-transform-controls/index.d.ts.map +1 -0
  177. package/build-types/components/media-form/index.d.ts.map +1 -1
  178. package/build-types/components/media-form/sidebar-datetime-view.d.ts +10 -0
  179. package/build-types/components/media-form/sidebar-datetime-view.d.ts.map +1 -0
  180. package/build-types/components/rotation-ruler/index.d.ts.map +1 -1
  181. package/build-types/hooks/use-crop-gesture-handlers.d.ts +13 -14
  182. package/build-types/hooks/use-crop-gesture-handlers.d.ts.map +1 -1
  183. package/build-types/image-editor/core/camera.d.ts.map +1 -1
  184. package/build-types/image-editor/core/constants.d.ts +18 -0
  185. package/build-types/image-editor/core/constants.d.ts.map +1 -1
  186. package/build-types/image-editor/core/containment.d.ts +10 -0
  187. package/build-types/image-editor/core/containment.d.ts.map +1 -1
  188. package/build-types/image-editor/core/crop-rect.d.ts +19 -0
  189. package/build-types/image-editor/core/crop-rect.d.ts.map +1 -0
  190. package/build-types/image-editor/core/index.d.ts +3 -1
  191. package/build-types/image-editor/core/index.d.ts.map +1 -1
  192. package/build-types/image-editor/core/interaction-controller.d.ts +5 -1
  193. package/build-types/image-editor/core/interaction-controller.d.ts.map +1 -1
  194. package/build-types/image-editor/core/math/sanitize.d.ts +70 -0
  195. package/build-types/image-editor/core/math/sanitize.d.ts.map +1 -0
  196. package/build-types/image-editor/core/setter-helpers.d.ts +24 -0
  197. package/build-types/image-editor/core/setter-helpers.d.ts.map +1 -0
  198. package/build-types/image-editor/core/source-region.d.ts.map +1 -1
  199. package/build-types/image-editor/core/state.d.ts +12 -0
  200. package/build-types/image-editor/core/state.d.ts.map +1 -1
  201. package/build-types/image-editor/core/stencil-math.d.ts +23 -18
  202. package/build-types/image-editor/core/stencil-math.d.ts.map +1 -1
  203. package/build-types/image-editor/core/transform-style.d.ts.map +1 -1
  204. package/build-types/image-editor/core/types.d.ts +23 -4
  205. package/build-types/image-editor/core/types.d.ts.map +1 -1
  206. package/build-types/image-editor/index.d.ts +4 -4
  207. package/build-types/image-editor/index.d.ts.map +1 -1
  208. package/build-types/image-editor/react/components/cropper-provider.d.ts +11 -7
  209. package/build-types/image-editor/react/components/cropper-provider.d.ts.map +1 -1
  210. package/build-types/image-editor/react/components/cropper.d.ts +6 -4
  211. package/build-types/image-editor/react/components/cropper.d.ts.map +1 -1
  212. package/build-types/image-editor/react/components/overlays/dimensions-overlay.d.ts +36 -0
  213. package/build-types/image-editor/react/components/overlays/dimensions-overlay.d.ts.map +1 -0
  214. package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts +2 -1
  215. package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts.map +1 -1
  216. package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts +47 -0
  217. package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts.map +1 -0
  218. package/build-types/image-editor/react/hooks/index.d.ts +4 -2
  219. package/build-types/image-editor/react/hooks/index.d.ts.map +1 -1
  220. package/build-types/image-editor/react/hooks/use-cropper-reducer.d.ts +58 -0
  221. package/build-types/image-editor/react/hooks/use-cropper-reducer.d.ts.map +1 -0
  222. package/build-types/image-editor/stories/rectangle-crop.story.d.ts.map +1 -1
  223. package/build-types/state/composite-reducer.d.ts +39 -0
  224. package/build-types/state/composite-reducer.d.ts.map +1 -0
  225. package/build-types/state/index.d.ts +7 -0
  226. package/build-types/state/index.d.ts.map +1 -0
  227. package/build-types/state/media-editor-state-provider.d.ts +34 -0
  228. package/build-types/state/media-editor-state-provider.d.ts.map +1 -0
  229. package/build-types/state/types.d.ts +96 -0
  230. package/build-types/state/types.d.ts.map +1 -0
  231. package/build-types/state/use-media-editor-state.d.ts +101 -0
  232. package/build-types/state/use-media-editor-state.d.ts.map +1 -0
  233. package/build-types/store/actions.d.ts +3 -1
  234. package/build-types/store/actions.d.ts.map +1 -1
  235. package/build-types/store/reducer.d.ts +3 -0
  236. package/build-types/store/reducer.d.ts.map +1 -1
  237. package/build-types/store/selectors.d.ts +1 -0
  238. package/build-types/store/selectors.d.ts.map +1 -1
  239. package/package.json +19 -16
  240. package/src/components/media-editor/index.tsx +262 -229
  241. package/src/components/media-editor/style.scss +0 -9
  242. package/src/components/media-editor/test/use-crop-options.tsx +110 -0
  243. package/src/components/media-editor/use-crop-options.ts +79 -0
  244. package/src/components/media-editor/use-save-media-editor.ts +214 -0
  245. package/src/components/media-editor-canvas/index.tsx +57 -25
  246. package/src/components/media-editor-crop-panel/index.tsx +53 -87
  247. package/src/components/media-editor-crop-panel/test/index.tsx +46 -53
  248. package/src/components/media-editor-fine-rotation/index.tsx +74 -0
  249. package/src/components/media-editor-modal/index.tsx +70 -16
  250. package/src/components/media-editor-modal/style.scss +80 -0
  251. package/src/components/media-editor-modal/test/build-modifiers.test.ts +14 -0
  252. package/src/components/media-editor-modal/test/index.tsx +146 -0
  253. package/src/components/media-editor-transform-controls/index.tsx +70 -0
  254. package/src/components/media-editor-transform-controls/style.scss +8 -0
  255. package/src/components/media-form/index.tsx +15 -1
  256. package/src/components/media-form/sidebar-datetime-view.tsx +47 -0
  257. package/src/components/media-form/test/sidebar-datetime-view.test.tsx +96 -0
  258. package/src/components/rotation-ruler/README.md +11 -25
  259. package/src/components/rotation-ruler/index.tsx +17 -2
  260. package/src/components/rotation-ruler/style.scss +49 -13
  261. package/src/hooks/use-crop-gesture-handlers.ts +64 -17
  262. package/src/image-editor/README.md +28 -129
  263. package/src/image-editor/core/camera.ts +51 -26
  264. package/src/image-editor/core/constants.ts +19 -0
  265. package/src/image-editor/core/containment.ts +102 -49
  266. package/src/image-editor/core/crop-rect.ts +45 -0
  267. package/src/image-editor/core/index.ts +16 -4
  268. package/src/image-editor/core/interaction-controller.ts +5 -1
  269. package/src/image-editor/core/math/sanitize.ts +158 -0
  270. package/src/image-editor/core/math/test/sanitize.ts +244 -0
  271. package/src/image-editor/core/setter-helpers.ts +66 -0
  272. package/src/image-editor/core/source-region.ts +21 -14
  273. package/src/image-editor/core/state.ts +67 -15
  274. package/src/image-editor/core/stencil-math.ts +55 -35
  275. package/src/image-editor/core/test/camera.ts +367 -1
  276. package/src/image-editor/core/test/state.ts +101 -8
  277. package/src/image-editor/core/test/stencil-math.ts +193 -0
  278. package/src/image-editor/core/transform-style.ts +21 -6
  279. package/src/image-editor/core/types.ts +24 -4
  280. package/src/image-editor/docs/architecture.md +48 -89
  281. package/src/image-editor/docs/recipes.md +123 -659
  282. package/src/image-editor/index.ts +12 -3
  283. package/src/image-editor/react/components/cropper-provider.tsx +16 -12
  284. package/src/image-editor/react/components/cropper.scss +23 -4
  285. package/src/image-editor/react/components/cropper.tsx +194 -89
  286. package/src/image-editor/react/components/overlays/dimensions-overlay.tsx +269 -0
  287. package/src/image-editor/react/components/stencils/rectangle-stencil.tsx +19 -8
  288. package/src/image-editor/react/components/test/cropper.tsx +55 -13
  289. package/src/image-editor/react/hooks/build-cropper-setters.ts +105 -0
  290. package/src/image-editor/react/hooks/index.ts +4 -2
  291. package/src/image-editor/react/hooks/test/{use-cropper-state.ts → use-cropper-reducer.ts} +142 -286
  292. package/src/image-editor/react/hooks/use-cropper-reducer.ts +204 -0
  293. package/src/image-editor/stories/rectangle-crop.story.tsx +7 -17
  294. package/src/state/composite-reducer.ts +137 -0
  295. package/src/state/index.ts +20 -0
  296. package/src/state/media-editor-state-provider.tsx +70 -0
  297. package/src/state/test/use-media-editor-state.ts +330 -0
  298. package/src/state/types.ts +101 -0
  299. package/src/state/use-media-editor-state.ts +472 -0
  300. package/src/store/actions.ts +3 -0
  301. package/src/store/reducer.ts +6 -1
  302. package/src/store/selectors.ts +4 -0
  303. package/src/store/test/reducer.ts +9 -0
  304. package/src/style.scss +1 -1
  305. package/tsconfig.json +3 -0
  306. package/tsconfig.tsbuildinfo +1 -1
  307. package/build/components/media-editor-toolbar/index.cjs +0 -214
  308. package/build/components/media-editor-toolbar/index.cjs.map +0 -7
  309. package/build/image-editor/react/hooks/use-cropper-state.cjs +0 -277
  310. package/build/image-editor/react/hooks/use-cropper-state.cjs.map +0 -7
  311. package/build-module/components/media-editor-toolbar/index.mjs +0 -190
  312. package/build-module/components/media-editor-toolbar/index.mjs.map +0 -7
  313. package/build-module/image-editor/react/hooks/use-cropper-state.mjs +0 -262
  314. package/build-module/image-editor/react/hooks/use-cropper-state.mjs.map +0 -7
  315. package/build-types/components/media-editor-toolbar/index.d.ts +0 -24
  316. package/build-types/components/media-editor-toolbar/index.d.ts.map +0 -1
  317. package/build-types/image-editor/react/hooks/use-cropper-state.d.ts +0 -97
  318. package/build-types/image-editor/react/hooks/use-cropper-state.d.ts.map +0 -1
  319. package/src/components/media-editor-toolbar/index.tsx +0 -209
  320. package/src/components/media-editor-toolbar/style.scss +0 -49
  321. package/src/image-editor/docs/roadmap.md +0 -66
  322. package/src/image-editor/react/hooks/use-cropper-state.ts +0 -457
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import apiFetch from '@wordpress/api-fetch';
5
4
  import {
6
5
  Button,
7
6
  Flex,
@@ -10,7 +9,8 @@ import {
10
9
  privateApis as componentsPrivateApis,
11
10
  } from '@wordpress/components';
12
11
  import { Stack } from '@wordpress/ui';
13
- import { useDispatch, useRegistry, useSelect } from '@wordpress/data';
12
+ import { useViewportMatch } from '@wordpress/compose';
13
+ import { useDispatch, useSelect } from '@wordpress/data';
14
14
  import { store as coreStore } from '@wordpress/core-data';
15
15
  import {
16
16
  createPortal,
@@ -21,9 +21,13 @@ import {
21
21
  useRef,
22
22
  useState,
23
23
  } from '@wordpress/element';
24
- import { __, sprintf } from '@wordpress/i18n';
25
- import { close, drawerRight, keyboard } from '@wordpress/icons';
26
- import { isAppleOS, isKeyboardEvent } from '@wordpress/keycodes';
24
+ import { __ } from '@wordpress/i18n';
25
+ import { close, drawerRight, keyboard, redo, undo } from '@wordpress/icons';
26
+ import {
27
+ displayShortcut,
28
+ isAppleOS,
29
+ isKeyboardEvent,
30
+ } from '@wordpress/keycodes';
27
31
  import { SnackbarNotices, store as noticesStore } from '@wordpress/notices';
28
32
  import type { Field } from '@wordpress/dataviews';
29
33
  import {
@@ -42,36 +46,30 @@ import { MediaEditorProvider } from '../media-editor-provider';
42
46
  import type { Media } from '../media-editor-provider';
43
47
  import MediaPreview from '../media-preview';
44
48
  import MediaEditorCanvas from '../media-editor-canvas';
45
- import MediaEditorToolbar from '../media-editor-toolbar';
46
- import MediaEditorCropPanel, {
47
- resolveAspectRatio,
48
- } from '../media-editor-crop-panel';
49
+ import MediaEditorFineRotation from '../media-editor-fine-rotation';
50
+ import MediaEditorTransformControls from '../media-editor-transform-controls';
51
+ import MediaEditorCropPanel from '../media-editor-crop-panel';
49
52
  import MediaForm from '../media-form';
50
53
  import { unlock } from '../../lock-unlock';
51
54
  import { getMediaTypeFromMimeType } from '../../utils';
52
- import { CropperProvider, useCropper } from '../../image-editor';
55
+ import { MediaEditorStateProvider, useMediaEditor } from '../../state';
53
56
  import type { AspectRatioPreset } from '../../image-editor/core/constants';
54
57
  import { CROP_CONTROL_ATTR } from '../../hooks/use-crop-gesture-handlers';
55
- import { buildModifiers } from '../media-editor-modal/build-modifiers';
56
58
  import MediaEditorKeyboardShortcutsModal from '../media-editor-keyboard-shortcuts-modal';
59
+ import {
60
+ MEDIA_EDITOR_NOTICES_CONTEXT,
61
+ useSaveMediaEditor,
62
+ type MediaEditorSaveResult,
63
+ } from './use-save-media-editor';
64
+ import { useCropOptions } from './use-crop-options';
57
65
 
58
- // Details-tab edits are bundled into transformed `/edit` requests. Core's
59
- // endpoint only accepts this whitelist.
60
- const METADATA_EDIT_KEYS = [
61
- 'title',
62
- 'caption',
63
- 'description',
64
- 'alt_text',
65
- 'post',
66
- ] as const;
66
+ export type { MediaEditorSaveResult } from './use-save-media-editor';
67
67
 
68
68
  // Embed query for the attachment's author and parent post. Shared between
69
69
  // the `getEntityRecord` read and the matching `invalidateResolution` so the
70
70
  // two stay in lockstep.
71
71
  const ATTACHMENT_EMBED_QUERY = { _embed: 'author,wp:attached-to' } as const;
72
72
 
73
- // Scope save-failure snackbars so they don't leak into the host editor/page.
74
- const NOTICES_CONTEXT = 'media-editor';
75
73
  const PLACEMENT_CONTROL_IDLE_MS = 300;
76
74
 
77
75
  const { Tabs } = unlock( componentsPrivateApis );
@@ -82,15 +80,21 @@ interface EditorTab {
82
80
  panel: JSX.Element;
83
81
  }
84
82
 
85
- export interface MediaEditorSaveResult {
86
- id: number;
87
- url?: string;
88
- media: Media;
89
- }
90
-
91
83
  export interface MediaEditorFrameProps {
92
84
  children: ReactNode;
93
85
  headerActions: ReactNode;
86
+ footerActions: ReactNode;
87
+ /**
88
+ * Footer layout selector. Frames apply this to the footer container
89
+ * as a modifier class.
90
+ *
91
+ * - `wide` — single row: History | Ruler | Transform | Cancel/Save.
92
+ * - `medium` — two rows: ruler on top; History | Transform | Cancel/Save
93
+ * beneath.
94
+ * - `narrow` — three rows: ruler; transform (centered); History |
95
+ * Cancel/Save.
96
+ */
97
+ footerLayout: 'wide' | 'medium' | 'narrow';
94
98
  onRequestClose: () => void;
95
99
  onKeyDown: ( event: ReactKeyboardEvent< HTMLElement > ) => void;
96
100
  shouldCloseOnClickOutside: boolean;
@@ -153,24 +157,17 @@ function MediaEditorSidebar( { tabs }: { tabs: EditorTab[] } ) {
153
157
 
154
158
  interface HeaderActionsProps {
155
159
  isSaving: boolean;
156
- hasMedia: boolean;
157
- hasChanges: boolean;
158
160
  isImage: boolean;
159
161
  showCloseButton?: boolean;
160
162
  onCancel: () => void;
161
- onSave: () => void;
162
163
  }
163
164
 
164
165
  function HeaderActions( {
165
166
  isSaving,
166
- hasMedia,
167
- hasChanges,
168
167
  isImage,
169
168
  showCloseButton = false,
170
169
  onCancel,
171
- onSave,
172
170
  }: HeaderActionsProps ) {
173
- const saveDisabled = isSaving || ! hasMedia || ! hasChanges;
174
171
  const [ isShortcutsModalOpen, setIsShortcutsModalOpen ] = useState( false );
175
172
  return (
176
173
  <Flex
@@ -188,9 +185,131 @@ function HeaderActions( {
188
185
  />
189
186
  ) }
190
187
  <PinnedItems.Slot scope="media-editor" />
188
+ { showCloseButton && (
189
+ <Button
190
+ size="compact"
191
+ icon={ close }
192
+ label={ __( 'Close' ) }
193
+ onClick={ onCancel }
194
+ disabled={ isSaving }
195
+ accessibleWhenDisabled
196
+ />
197
+ ) }
198
+ { isShortcutsModalOpen && (
199
+ <MediaEditorKeyboardShortcutsModal
200
+ onClose={ () => setIsShortcutsModalOpen( false ) }
201
+ />
202
+ ) }
203
+ </Flex>
204
+ );
205
+ }
206
+
207
+ interface HistoryActionsProps {
208
+ isUndoRedoDisabled?: boolean;
209
+ onReset: () => void;
210
+ }
211
+
212
+ function HistoryActions( {
213
+ isUndoRedoDisabled = false,
214
+ onReset,
215
+ }: HistoryActionsProps ) {
216
+ const {
217
+ reset,
218
+ isDirty,
219
+ hasUndo,
220
+ hasRedo,
221
+ undo: undoCrop,
222
+ redo: redoCrop,
223
+ beginGesture,
224
+ endGesture,
225
+ } = useMediaEditor();
226
+ const handleUndo = () => {
227
+ if ( isUndoRedoDisabled ) {
228
+ return;
229
+ }
230
+ undoCrop();
231
+ };
232
+ const handleRedo = () => {
233
+ if ( isUndoRedoDisabled ) {
234
+ return;
235
+ }
236
+ redoCrop();
237
+ };
238
+ const handleReset = () => {
239
+ beginGesture();
240
+ reset();
241
+ onReset();
242
+ endGesture();
243
+ };
244
+ return (
245
+ <Flex
246
+ className="media-editor__history-actions"
247
+ expanded={ false }
248
+ gap={ 2 }
249
+ >
250
+ <Button
251
+ size="compact"
252
+ icon={ undo }
253
+ label={ __( 'Undo' ) }
254
+ showTooltip
255
+ shortcut={ displayShortcut.primary( 'z' ) }
256
+ disabled={ isUndoRedoDisabled || ! hasUndo }
257
+ accessibleWhenDisabled
258
+ onClick={ handleUndo }
259
+ />
260
+ <Button
261
+ size="compact"
262
+ icon={ redo }
263
+ label={ __( 'Redo' ) }
264
+ showTooltip
265
+ shortcut={
266
+ isAppleOS()
267
+ ? displayShortcut.primaryShift( 'z' )
268
+ : displayShortcut.primary( 'y' )
269
+ }
270
+ disabled={ isUndoRedoDisabled || ! hasRedo }
271
+ accessibleWhenDisabled
272
+ onClick={ handleRedo }
273
+ />
191
274
  <Button
192
275
  size="compact"
193
276
  variant="tertiary"
277
+ disabled={ ! isDirty }
278
+ accessibleWhenDisabled
279
+ onClick={ handleReset }
280
+ >
281
+ { __( 'Reset' ) }
282
+ </Button>
283
+ </Flex>
284
+ );
285
+ }
286
+
287
+ interface FooterActionsProps {
288
+ isSaving: boolean;
289
+ hasMedia: boolean;
290
+ hasChanges: boolean;
291
+ onCancel: () => void;
292
+ onSave: () => void;
293
+ }
294
+
295
+ function FooterActions( {
296
+ isSaving,
297
+ hasMedia,
298
+ hasChanges,
299
+ onCancel,
300
+ onSave,
301
+ }: FooterActionsProps ) {
302
+ const saveDisabled = isSaving || ! hasMedia || ! hasChanges;
303
+ return (
304
+ <Flex
305
+ className="media-editor__footer-actions"
306
+ justify="flex-end"
307
+ expanded={ false }
308
+ gap={ 2 }
309
+ >
310
+ <Button
311
+ __next40pxDefaultSize
312
+ variant="tertiary"
194
313
  onClick={ onCancel }
195
314
  disabled={ isSaving }
196
315
  accessibleWhenDisabled
@@ -198,7 +317,7 @@ function HeaderActions( {
198
317
  { __( 'Cancel' ) }
199
318
  </Button>
200
319
  <Button
201
- size="compact"
320
+ __next40pxDefaultSize
202
321
  variant="primary"
203
322
  onClick={ onSave }
204
323
  isBusy={ isSaving }
@@ -207,27 +326,10 @@ function HeaderActions( {
207
326
  >
208
327
  { __( 'Save' ) }
209
328
  </Button>
210
- { showCloseButton && (
211
- <Button
212
- size="compact"
213
- icon={ close }
214
- label={ __( 'Close' ) }
215
- onClick={ onCancel }
216
- disabled={ isSaving }
217
- accessibleWhenDisabled
218
- />
219
- ) }
220
- { isShortcutsModalOpen && (
221
- <MediaEditorKeyboardShortcutsModal
222
- onClose={ () => setIsShortcutsModalOpen( false ) }
223
- />
224
- ) }
225
329
  </Flex>
226
330
  );
227
331
  }
228
332
 
229
- type PendingMetadataEdits = Record< string, unknown > | undefined;
230
-
231
333
  function MediaEditorContent( {
232
334
  fields = [],
233
335
  id,
@@ -240,7 +342,20 @@ function MediaEditorContent( {
240
342
  showCloseButton = false,
241
343
  shouldCloseOnEsc = false,
242
344
  }: MediaEditorProps ) {
243
- const cropper = useCropper();
345
+ const cropper = useMediaEditor();
346
+ // Three footer layouts, picked from the viewport so DOM order matches
347
+ // visual order in all three (no `order` reshuffling needed):
348
+ // wide (≥ xlarge): single row.
349
+ // medium (≥ medium): ruler on top; rest beneath.
350
+ // narrow (< medium): ruler, then transform centered, then history/save.
351
+ const isWideViewport = useViewportMatch( 'xlarge' );
352
+ const isMediumViewport = useViewportMatch( 'medium' );
353
+ let footerLayout: 'wide' | 'medium' | 'narrow' = 'narrow';
354
+ if ( isWideViewport ) {
355
+ footerLayout = 'wide';
356
+ } else if ( isMediumViewport ) {
357
+ footerLayout = 'medium';
358
+ }
244
359
 
245
360
  const { media, hasEdits } = useSelect(
246
361
  ( select ) => {
@@ -275,19 +390,12 @@ function MediaEditorContent( {
275
390
  [ id ]
276
391
  );
277
392
 
278
- const hasChanges = cropper.isDirty || hasEdits;
393
+ const hasChanges = cropper.isCropperDirty || hasEdits;
394
+
395
+ const { clearEntityRecordEdits, editEntityRecord, invalidateResolution } =
396
+ useDispatch( coreStore );
397
+ const { removeAllNotices } = useDispatch( noticesStore );
279
398
 
280
- const registry = useRegistry();
281
- const {
282
- clearEntityRecordEdits,
283
- editEntityRecord,
284
- invalidateResolution,
285
- receiveEntityRecords,
286
- saveEditedEntityRecord,
287
- } = useDispatch( coreStore );
288
- const { createErrorNotice, removeAllNotices } = useDispatch( noticesStore );
289
-
290
- const [ isSaving, setIsSaving ] = useState( false );
291
399
  const [ isDiscardDialogOpen, setIsDiscardDialogOpen ] = useState( false );
292
400
  const [ isPlacementActive, setIsPlacementActive ] = useState( false );
293
401
  const [ isCanvasGestureActive, setIsCanvasGestureActive ] =
@@ -295,9 +403,6 @@ function MediaEditorContent( {
295
403
  const placementControlTimerRef =
296
404
  useRef< ReturnType< typeof setTimeout > >();
297
405
 
298
- const [ aspectRatioValue, setAspectRatioValue ] = useState( '0' );
299
- const [ freeformCrop, setFreeformCrop ] = useState( true );
300
-
301
406
  const signalPlacementControlInteraction = useCallback( () => {
302
407
  setIsPlacementActive( true );
303
408
  clearTimeout( placementControlTimerRef.current );
@@ -320,8 +425,6 @@ function MediaEditorContent( {
320
425
  }, [] );
321
426
 
322
427
  useEffect( () => {
323
- setAspectRatioValue( '0' );
324
- setFreeformCrop( true );
325
428
  setIsPlacementActive( false );
326
429
  setIsCanvasGestureActive( false );
327
430
  }, [ id ] );
@@ -340,22 +443,21 @@ function MediaEditorContent( {
340
443
 
341
444
  const mediaType = getMediaTypeFromMimeType( media?.mime_type ).type;
342
445
  const isImage = !! media && mediaType === 'image';
343
-
344
- const imageAspectRatio = useMemo( () => {
345
- if ( ! isImage ) {
346
- return null;
347
- }
348
- const naturalWidth = Number( media?.media_details?.width );
349
- const naturalHeight = Number( media?.media_details?.height );
350
- if (
351
- Number.isFinite( naturalWidth ) &&
352
- Number.isFinite( naturalHeight ) &&
353
- naturalHeight > 0
354
- ) {
355
- return naturalWidth / naturalHeight;
356
- }
357
- return null;
358
- }, [ isImage, media ] );
446
+ const {
447
+ aspectRatioValue,
448
+ setAspectRatioValue,
449
+ aspectRatioOptions,
450
+ resetCropOptions,
451
+ } = useCropOptions( {
452
+ aspectRatioPresets,
453
+ } );
454
+ const { isSaving, save: saveMediaEditor } = useSaveMediaEditor( {
455
+ cropper,
456
+ id,
457
+ isImage,
458
+ media,
459
+ onSaved,
460
+ } );
359
461
 
360
462
  const tabs = useMemo< EditorTab[] >( () => {
361
463
  const detailsTab: EditorTab = {
@@ -387,12 +489,10 @@ function MediaEditorContent( {
387
489
  <MediaEditorCropPanel
388
490
  aspectRatioValue={ aspectRatioValue }
389
491
  onAspectRatioChange={ setAspectRatioValue }
390
- freeformCrop={ freeformCrop }
391
- onFreeformChange={ setFreeformCrop }
392
492
  onPlacementControlInteraction={
393
493
  signalPlacementControlInteraction
394
494
  }
395
- aspectRatioPresets={ aspectRatioPresets }
495
+ aspectRatioOptions={ aspectRatioOptions }
396
496
  />
397
497
  </Stack>
398
498
  ),
@@ -402,8 +502,8 @@ function MediaEditorContent( {
402
502
  }, [
403
503
  isImage,
404
504
  aspectRatioValue,
405
- freeformCrop,
406
- aspectRatioPresets,
505
+ setAspectRatioValue,
506
+ aspectRatioOptions,
407
507
  signalPlacementControlInteraction,
408
508
  ] );
409
509
 
@@ -412,7 +512,7 @@ function MediaEditorContent( {
412
512
  };
413
513
 
414
514
  const discardAndClose = () => {
415
- removeAllNotices( 'snackbar', NOTICES_CONTEXT );
515
+ removeAllNotices( 'snackbar', MEDIA_EDITOR_NOTICES_CONTEXT );
416
516
  clearEntityRecordEdits( 'postType', 'attachment', id );
417
517
  onClose?.();
418
518
  };
@@ -428,114 +528,6 @@ function MediaEditorContent( {
428
528
  discardAndClose();
429
529
  };
430
530
 
431
- const handleSave = async () => {
432
- removeAllNotices( 'snackbar', NOTICES_CONTEXT );
433
- setIsSaving( true );
434
- try {
435
- let saved: Media | null | undefined;
436
-
437
- const modifiers =
438
- cropper.isDirty && cropper.state.image
439
- ? buildModifiers( cropper.state, {
440
- width: cropper.state.image.naturalWidth,
441
- height: cropper.state.image.naturalHeight,
442
- } )
443
- : [];
444
-
445
- if ( modifiers.length > 0 ) {
446
- const pendingEdits = registry
447
- .select( coreStore )
448
- .getEntityRecordNonTransientEdits(
449
- 'postType',
450
- 'attachment',
451
- id
452
- ) as PendingMetadataEdits;
453
- const metadataEdits: Record< string, unknown > = {};
454
- for ( const key of METADATA_EDIT_KEYS ) {
455
- if ( pendingEdits && key in pendingEdits ) {
456
- metadataEdits[ key ] = pendingEdits[ key ];
457
- }
458
- }
459
- // The `/edit` endpoint creates a new attachment for the crop
460
- // and doesn't inherit `post_parent` from the source (unlike
461
- // title/caption/etc.), so carry the existing value across when
462
- // the user hasn't explicitly edited it. Use a defined-check so
463
- // an explicit `0` (unattached) is also preserved.
464
- if (
465
- ! ( 'post' in metadataEdits ) &&
466
- media?.post !== undefined
467
- ) {
468
- metadataEdits.post = media.post;
469
- }
470
-
471
- saved = ( await apiFetch( {
472
- path: `/wp/v2/media/${ id }/edit`,
473
- method: 'POST',
474
- data: {
475
- src: media?.source_url,
476
- modifiers,
477
- ...metadataEdits,
478
- },
479
- } ) ) as Media;
480
-
481
- if ( saved ) {
482
- receiveEntityRecords(
483
- 'postType',
484
- 'attachment',
485
- saved,
486
- undefined,
487
- true
488
- );
489
- }
490
- } else {
491
- saved = ( await saveEditedEntityRecord(
492
- 'postType',
493
- 'attachment',
494
- id
495
- ) ) as Media | undefined;
496
- }
497
-
498
- const next = ( saved ?? media ) as Media | null;
499
-
500
- if ( next && next.id !== id ) {
501
- clearEntityRecordEdits( 'postType', 'attachment', id );
502
- }
503
-
504
- if ( next && next.id ) {
505
- if ( next.id === id ) {
506
- cropper.reset();
507
- }
508
- onSaved?.( {
509
- id: next.id,
510
- url: next.source_url,
511
- media: next,
512
- } );
513
- }
514
- } catch ( error ) {
515
- const message =
516
- error instanceof Error
517
- ? error.message
518
- : ( error as { message?: string } )?.message ??
519
- __( 'An unknown error occurred.' );
520
- createErrorNotice(
521
- isImage
522
- ? sprintf(
523
- /* translators: %s: Error message. */
524
- __( 'Could not save image. %s' ),
525
- message
526
- )
527
- : sprintf(
528
- /* translators: %s: Error message. */
529
- __( 'Could not save media. %s' ),
530
- message
531
- ),
532
- { type: 'snackbar', context: NOTICES_CONTEXT }
533
- );
534
- } finally {
535
- setIsSaving( false );
536
- }
537
- };
538
-
539
531
  const handleKeyDown = ( event: ReactKeyboardEvent< HTMLElement > ) => {
540
532
  const isUndoShortcut = isKeyboardEvent.primary( event, 'z' );
541
533
  const isRedoShortcut =
@@ -579,7 +571,7 @@ function MediaEditorContent( {
579
571
  const snackbar = (
580
572
  <SnackbarNotices
581
573
  className={ noticesClassName }
582
- context={ NOTICES_CONTEXT }
574
+ context={ MEDIA_EDITOR_NOTICES_CONTEXT }
583
575
  />
584
576
  );
585
577
 
@@ -606,17 +598,11 @@ function MediaEditorContent( {
606
598
  ? __( 'Image editor' )
607
599
  : __( 'Media preview' ),
608
600
  sidebar: __( 'Media details' ),
609
- footer: __( 'Image editing tools' ),
610
601
  } }
611
602
  content={
612
603
  <div className="media-editor__canvas">
613
604
  { isImage ? (
614
605
  <MediaEditorCanvas
615
- aspectRatio={ resolveAspectRatio(
616
- aspectRatioValue,
617
- imageAspectRatio
618
- ) }
619
- freeformCrop={ freeformCrop }
620
606
  focusOnMount
621
607
  isPlacementActive={
622
608
  isPlacementActive
@@ -633,22 +619,6 @@ function MediaEditorContent( {
633
619
  ) }
634
620
  </div>
635
621
  }
636
- footer={
637
- isImage ? (
638
- <MediaEditorToolbar
639
- onReset={ () => {
640
- setAspectRatioValue( '0' );
641
- setFreeformCrop( true );
642
- } }
643
- onPlacementControlInteraction={
644
- signalPlacementControlInteraction
645
- }
646
- isUndoRedoDisabled={
647
- isCropInteractionActive
648
- }
649
- />
650
- ) : undefined
651
- }
652
622
  sidebar={
653
623
  <ComplementaryArea.Slot scope="media-editor" />
654
624
  }
@@ -676,19 +646,82 @@ function MediaEditorContent( {
676
646
  </MediaEditorProvider>
677
647
  );
678
648
 
649
+ const history = isImage ? (
650
+ <HistoryActions
651
+ isUndoRedoDisabled={ isCropInteractionActive }
652
+ onReset={ resetCropOptions }
653
+ />
654
+ ) : null;
655
+ const ruler = isImage ? (
656
+ <MediaEditorFineRotation
657
+ onPlacementControlInteraction={ signalPlacementControlInteraction }
658
+ />
659
+ ) : null;
660
+ const transform = isImage ? <MediaEditorTransformControls /> : null;
661
+ const actions = (
662
+ <FooterActions
663
+ isSaving={ isSaving }
664
+ hasMedia={ !! media }
665
+ hasChanges={ hasChanges }
666
+ onCancel={ handleRequestClose }
667
+ onSave={ saveMediaEditor }
668
+ />
669
+ );
670
+
671
+ // One JSX tree per layout. DOM order matches visual order in all three.
672
+ // `.media-editor-modal__footer-toolbar` (wide only) groups ruler +
673
+ // transform with the centered cluster and divider that the wide layout
674
+ // has always had.
675
+ let footerActions: ReactNode;
676
+ if ( footerLayout === 'wide' ) {
677
+ footerActions = (
678
+ <>
679
+ { history }
680
+ { isImage && (
681
+ <div className="media-editor-modal__footer-toolbar">
682
+ { ruler }
683
+ { transform }
684
+ </div>
685
+ ) }
686
+ { actions }
687
+ </>
688
+ );
689
+ } else if ( footerLayout === 'medium' ) {
690
+ footerActions = (
691
+ <>
692
+ { ruler }
693
+ <div className="media-editor-modal__footer-row">
694
+ { history }
695
+ { transform }
696
+ { actions }
697
+ </div>
698
+ </>
699
+ );
700
+ } else {
701
+ footerActions = (
702
+ <>
703
+ { ruler }
704
+ { transform }
705
+ <div className="media-editor-modal__footer-row">
706
+ { history }
707
+ { actions }
708
+ </div>
709
+ </>
710
+ );
711
+ }
712
+
679
713
  return renderFrame( {
680
714
  children,
681
715
  headerActions: (
682
716
  <HeaderActions
683
717
  isSaving={ isSaving }
684
- hasMedia={ !! media }
685
- hasChanges={ hasChanges }
686
718
  isImage={ isImage }
687
719
  showCloseButton={ showCloseButton }
688
720
  onCancel={ handleRequestClose }
689
- onSave={ handleSave }
690
721
  />
691
722
  ),
723
+ footerActions,
724
+ footerLayout,
692
725
  onRequestClose: handleRequestClose,
693
726
  onKeyDown: handleKeyDown,
694
727
  shouldCloseOnClickOutside: ! hasChanges && ! isSaving,
@@ -700,9 +733,9 @@ function MediaEditorContent( {
700
733
 
701
734
  export function MediaEditor( props: MediaEditorProps ) {
702
735
  return (
703
- <CropperProvider key={ props.id }>
736
+ <MediaEditorStateProvider key={ props.id }>
704
737
  <MediaEditorContent { ...props } />
705
- </CropperProvider>
738
+ </MediaEditorStateProvider>
706
739
  );
707
740
  }
708
741
 
@@ -33,15 +33,6 @@
33
33
  flex: 1;
34
34
  }
35
35
 
36
- .interface-interface-skeleton__footer {
37
- position: relative;
38
- display: flex;
39
- }
40
-
41
- .interface-interface-skeleton.has-footer .interface-interface-skeleton__body {
42
- padding-bottom: 0;
43
- }
44
-
45
36
  .media-editor__canvas {
46
37
  display: flex;
47
38
  align-items: center;