NordSecurity / storyblok-rich-text-astro-renderer

Storyblok Rich Text Renderer for Astro
MIT License
24 stars 6 forks source link

[Feat] Expose the whole `Node` object to to `renderFn` instances #166

Closed Edo-San closed 7 months ago

Edo-San commented 7 months ago

The purpose of this PR is to provide an initial solution to the issue reported on #129 If we let users get the whole Node object inside schema resolver functions, they will be able to use that data (map pieces of content to specific props, use as conditional logic, etc.).

Edo-San commented 7 months ago

FYI @edvinasjurele This is a simple PoC that should at least provide the very basic functionality needed to handle any custom case. No frills 😅

WDYT? If that's fine I can add some lines to the README file. Maybe should we get rid of the existing Codeblock so that we can showcase the native Astro Code component as the main use case for this update?

Thank you in advance! 🙏

edvinasjurele commented 7 months ago

Hi, @Edo-San, thanks, for looking into the code.

edvinasjurele commented 7 months ago

Hi, made solution on my MR https://github.com/NordSecurity/storyblok-rich-text-astro-renderer/pull/168. I hope that one will be a good candidate to merge. Wanted to try the descturcture ({ attrs }) possibility and not (node) + node.attrs, thus made TS a little differently.

edvinasjurele commented 7 months ago

Closing due to https://github.com/NordSecurity/storyblok-rich-text-astro-renderer/pull/168