You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This flow describes how to setup image media management with a focal point picker:
305
+
306
+

307
+
308
+
First, you need two attributes for your block's `block.json`:
309
+
310
+
```json
311
+
{
312
+
"attributes": {
313
+
"myImage": {
314
+
"type": "object"
315
+
},
316
+
"myFocalPoint": {
317
+
"type": "object"
318
+
}
319
+
}
320
+
}
321
+
```
322
+
323
+
In your block's `edit.js`, use `ImageControl` from this toolkit and `FocalPointPicker` from `@wordpress/components`.
324
+
325
+
Note how we disable the preview of ImageControl with `showPreview` set to `false`. This allows us to replace it with the focal point picker control after a media item has been selected.
326
+
327
+
Whenever the media item is removed, we also reset the focal point.
328
+
329
+
Then use `FocalPointImage` from this toolkit to render the positioned image result.
0 commit comments