describo / crate-builder-component

A VueJS UI component to build an RO-Crate
MIT License
6 stars 3 forks source link

Prevent switching from text type to url #99

Closed csontosreka closed 2 months ago

csontosreka commented 3 months ago

I have encountered a problem where, in my Describo profile, I define a field with a Text type. However, if I save a URL as its value, it switches the type to URL and saves an object instead of a string. In my opinion, since Describo can handle both Text and URL types, it could be more consistent if the fields would maintain the type originally assigned to them in the profile.

In this PR, I removed the code that caused the type switching. If this feature is necessary in Describo, do you have any ideas for a better solution?

marcolarosa commented 2 months ago

That behaviour comes from consciously deciding to create a rich URL entity rather than just having a simple string as it's more in keeping with the spirit of rich, linked data entities. So, I'm not keen to remove it and I don't think you should be doing things that way but I will accept a configuration option that turns that behaviour off at the component level.

So how about adding another config property enable-url-markup (or something better - can't think of anything right now...) that is true by default and keeps the current behaviour. But if set to false, would turn it off at the component level; ie the component would just add the string as is.

What do you think?

csontosreka commented 2 months ago

Great idea! I fixed the code to use enable-url-markup config property.

marcolarosa commented 2 months ago

Looks good. I'll merge and then add a toggle on the app for it and a couple of small cleanups but otherwise - thanks!