Extending existing image widget used by the Markdown widget - netlifyCMS

My background is as a junior web dev.
I’ve implemented netlify CMS on a hugo site.
It’s working just fine.
I’ve using a custom preview template (simple and my first time touching React, but it’s also working fine).

What I need to do is extend the functionality of the image widgets which are within the markdown widget (specifically options for basic - center - right - left alignment, which would just be a select widget that adds an entry to front matter).
It seems if I register a new widget, the markdown widget is not using it.
So it seems I need to:
Have the markdown widget use the custom/new widget for markdown images OR their is some way to extend the image widget.

I cannot find such in the docs. It’s possibly I’m just missing it.

Could someone shed light or examples of where I could look to do so?

Thank you for your time.

Editor widgets are actually called editor components, you can register them to the markdown widget with the registerEditorComponent function:

2 Likes

Thank you for the answer, much appreciated.
I keep editing this as I received more data and my question evolves.

The reference seems to make sense to me, but this leads me to a degree to the original question (and perhaps my confusion is elsewhere):

With the above and a note from:

If you pass the default widget ID you can overwrite.

But, this isn’t documented. Also I just want to extend the widget, so existing functionality (keeping of) would be important.
So for instance, in this case, the widget:markdown - which automatically takes images in the markdown and creates some sort of image widget, I want to extend those image widgets, NOT overwrite.

Is their a way to do this?

Not exactly, no. But here’s the source code of the existing image editor component, you can use it to create a new one:

2 Likes