Open jdanish opened 9 months ago
The core problem here is that the JSON Editor requires the definition of a schema for the template format in order for the JSON Editor to know how to support field editing. e.g. the schema needs to specify that the label
field is a string field, show some help for what a label
field (e.g. 'Display name of the node'
), set a default value, how the field should be exported, etc.
This works well when we're using the standard fields as defined in our template schema. But it breaks when we introduce custom fields. This is true for fancy "select" fields like connotation
, but also for simple string fields like location
. The basic problem is that we need to define all of that schema meta data for any custom fields. See template-schema.js
to get a sense of what is in there.
Right now template editor UI only knows how to deal with the built-in schema of the standard fields. The JSON Editor does not know how to read let alone render custom fields.
So while we can support custom fields by editing the *.template.toml
files directly, the JSON Editor is essentially broken for custom fields.
Unfortunately there's no easy way around this. e.g. we can't just allow Node Type edits without breaking the whole template.
We probably want to consider adding a warning, or disabling template editing altogether for any templates that have been modified.
Thanks for looking into it. To preserve budget let's leave it as-is for now and focus on other things. Thanks!
To reproduce:
We realize that short-term we need to add / edit these node attributes by hand because it is not worth updating the template editor since the plan is, I believe, to replace it. If it is easy to have this not clobber the hand-added fields, that'd be ideal. If that's a major task, we'll just warn the team not to use the template editor on anything that was hand edited.