Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Add multiline string field support in data view #363

Closed
davidsneighbour opened this issue Jun 27, 2022 · 10 comments
Closed

Enhancement: Add multiline string field support in data view #363

davidsneighbour opened this issue Jun 27, 2022 · 10 comments

Comments

@davidsneighbour
Copy link
Contributor

I would expect the Dashboard > Data view to work according to the docs for field configurations for strings, as in single: false and wysiwyg: true resulting in extended text fields. It doesn't though.

Config:

  "frontMatter.data.files": [
    {
      "id": "music2program2",
      "title": "Music to program to",
      "file": "[[workspace]]/data/dnb/kollitsch/music.json",
      "fileType": "json",
      "labelField": "name",
      "schema": {
        "title": "music2program2",
        "type": "object",
        "required": [
          "name",
          "link"
        ],
        "properties": {
          "name": {
            "type": "string",
            "title": "Name"
          },
          "link": {
            "type": "string",
            "title": "URL"
          },
          "description": {
            "type": "string",
            "title": "Description",
            "single": false,
            "wysiwyg": true
          }
        }
      }
    }
  ],

results in:

20220627-22:20:15-Selection-001

It would be nice to have at least a multiline field here. Maybe even globally some form of distinction between string and "multiline string" as field type in general?

Desktop (please complete the following information):

  • OS: Ubuntu 22.04
@davidsneighbour davidsneighbour added the bug Something isn't working label Jun 27, 2022
@davidsneighbour
Copy link
Contributor Author

davidsneighbour commented Jun 27, 2022

also sidenote: "your $title data items" will probably result in weird displays sometimes. Because the left column is always visible it would be nice to just have "data items" or even "items" as column title here and "Create or modify data" in the third column. The second column could be wider, the first one smaller.

@estruyf
Copy link
Owner

estruyf commented Jun 28, 2022

@davidsneighbour single and wysiwyg are not supported. The files are automatically rendered by the JSON schema and do not follow the same logic as the other content fields (yet). I'm going to tag this as an enhancement.

@estruyf estruyf added enhancement New feature or request and removed bug Something isn't working labels Jun 28, 2022
@estruyf estruyf changed the title Issue: Multiline string field in data view Enhancement: Add multiline string field support in data view Jun 28, 2022
@davidsneighbour
Copy link
Contributor Author

Ping :)

I just worked on my data file configuration and was about to open a new issue when I realized that I had already done so a while back.

The issues remain:

  • from the view, there is no need to have "your $title data items" (it takes too much space and is understood from the left column). "Select your data type", "Items", and "Create or Modify data" would result in a single header line instead of 1 to 3 in the screenshot below.
  • a multiline field would be really nice ;) my description in this specific case is a markdown text that might be long.

new idea ;):

  • validation. the slug field here should not have spaces or special characters, so it would be nice to maybe have some form of a regular expression to match the content of each field against.

20230313-21:50:06-Selection-001

This still stays enhancement, so there is no pressure :) but I got ideas for the data functionality. Think recipes or "trading card games". I think it might be a powerful feature for data file enabled SSGs.

@michaeltlombardi
Copy link

I have a strong need for multiline fields as well (also using markdown in those fields).

@estruyf
Copy link
Owner

estruyf commented Mar 13, 2023

I heard both of you 😀

image

To support this, I must add a new property for the long text (textarea) field.

{
  "name": {
    "type": "string",
    "title": "Name"
  },
  "url": {
    "type": "string",
    "title": "URL"
  },
  "description": {
    "type": "string",
    "longtext": true,
    "title": "Description"
  }
}

Above I used longtext (as that is the field to load in uniforms, but if you have a better suggestion, let me know.

@michaeltlombardi
Copy link

That's fine! As long as it's documented, I can work with it (multiline might be a more intuitive key name but I'm not too fussed about it).

estruyf added a commit that referenced this issue Mar 14, 2023
@estruyf
Copy link
Owner

estruyf commented Mar 14, 2023

and so it became multiline.

@davidsneighbour @michaeltlombardi you can configure it as follows:

{
  "name": {
    "type": "string",
    "title": "Name"
  },
  "url": {
    "type": "string",
    "title": "URL"
  },
  "description": {
    "type": "string",
    "multiline": true, // Set the multiline support
    "title": "Description"
  }
}

@davidsneighbour
Copy link
Contributor Author

davidsneighbour commented Mar 14, 2023

The label of the field is not bold like on the other fields. All else is as I dreamed of :)

20230314-23:01:40-Selection-001

@estruyf
Copy link
Owner

estruyf commented Mar 14, 2023

Good catch, just rendering the OOTB experience, didn't notice it, will fix it.

estruyf added a commit that referenced this issue Mar 14, 2023
@estruyf
Copy link
Owner

estruyf commented Mar 14, 2023

Just released a fix for this @davidsneighbour

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants