✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

Using onChange and PatchEvent with Custom Asset Sources to Update Other Parts of the Document

4 replies
Last updated: Sep 19, 2022
Hello! 👋
Is it possible when using
custom-asset-sources to be also able to update other parts of the document? It looks like that can be done using
onChange
&
PatchEvent
but I'm not seeing
onChange
passed to my plugin. Any thoughts?
Sep 15, 2022, 12:45 AM
What exactly are you trying to do? 🙂
Sep 16, 2022, 1:48 PM
I have a plugin that is following the Custom Asset Source steps to open a dialog with an existing image modify it, and re-save it. Along with modifying it, I want to be able to have a text input that captures a caption for that image. When a user is done, I'd like them to be able to save the modified image & the caption. Currently I'm only able to pass the image back via
onSelect
.
Sep 16, 2022, 3:04 PM
You should def look into the OG Image creator plugin
user B
created! There might be very useful things for you in there!
Sep 19, 2022, 7:24 AM
Thanks for pointing that out! I'll take a look!
Sep 19, 2022, 3:00 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?