sanity-io / sanity-plugin-internationalized-array

A plugin to register array fields with a custom input component to store field values in multiple languages, queryable by using the language ID as an array `_key`.
MIT License
45 stars 11 forks source link

String input is rendered for markdown field #49

Open DmitriyMaltsevTakeda opened 1 year ago

DmitriyMaltsevTakeda commented 1 year ago

I'm using https://www.sanity.io/plugins/sanity-plugin-markdown for rendering Markdown inputs. To make them translatable, I added fieldTypes: ['string', 'markdown'] to Sanity config.

I'm assuming I have to use internationalizedArrayMarkdown as type when I create schemas for translatable Markdown fields now, although I didn't find any examples in the docs for custom input types.

I'm expecting to see a markdown input, but I still get a regular string input for internationalizedArrayMarkdown fields:

image

So my question is: is it possible at all to render custom field types with this plugin? If yes, what could I be doing wrong?

Edit: I tried using text and internationalizedArrayText just to check that it's possible to render any input fields other than a regular string inputs, and it works, I'm getting a nice textarea. So this problem must be only for rendering custom fields.

cruzlutor commented 10 months ago

Same issue here!

aliventsevtakeda commented 3 months ago

Still reproducible

azaxarov commented 3 months ago

I took a look at this issue and here are my findings.

Any field types set in the plugin configuration will be processed here and turned into object with a single value field. This field is defined here.

Clearly, there is no restriction imposed on the field types that can be defined in the plugin configuration, meaning it will also accept field types like markdown. The issue arises when a custom type is redefined with custom components here and here.

Commenting out components property on the previously mentioned lines fixes the issue, but then the functionality introduced by InternationalizedField would not be applied.

It is not entirely clear as to how this could be fixed, so I will let the maintainers take a closer look.

cruzlutor commented 1 month ago

Hello! Any update on this? It would be great to have markdown fields working for this plugin