react-client icon indicating copy to clipboard operation
react-client copied to clipboard

Graphical editor for YAML-metadata?

Open ErikMichelson opened this issue 4 years ago • 7 comments

What is your question? Based on the feature request #312 I thought maybe we want to add a graphical way to manage YAML-metadata fields in general. Any opinions on that?

ErikMichelson avatar Jul 09 '20 20:07 ErikMichelson

I guess we're talking about our own YAML Metadata so

  title: string
  description: string
  tags: string[]
  robots: string
  lang: iso6391
  dir: 'ltr' | 'rtl'
  breaks: boolean
  GA: string
  disqus: string
  type: 'slide' | ''

and neither any of the opengraph data nor any of the slide options? If not I see no option to implement this feature as we currently have a hard time getting typings for those fields together, not sure how this would improve if we tried building a graphical editor for them.

DerMolly avatar Jul 09 '20 20:07 DerMolly

I'm just talking about the basic properties you listed above. Something like a modal to fill in title, description, select tags, etc.

ErikMichelson avatar Jul 09 '20 23:07 ErikMichelson

Maybe a separate modal to edit the metadata is not necessary. We could also add a button that inserts the metadata block at the top of the note and provide auto completion for fields like tags, lang etc. That way it would be easier to edit the metadata, but the editing happens in the normal editor, so we don't break the edit-flow with a completely different popup.

davidmehren avatar Jul 10 '20 09:07 davidmehren

~Not sure how easy auto completion for this would be~, but a button to insert metadata could be easily build Edit: Apparently we could implement autocompletion with https://codemirror.net/doc/manual.html#addon_show-hint

DerMolly avatar Jul 10 '20 11:07 DerMolly

A few things that came to my mind while thinking about https://github.com/hedgedoc/hedgedoc/issues/729:

  • If we go the "full GUI" route (so not just autocompletion), we should add a setting if the user wants to use the GUI or just edit YAML by default. In the former case, we could hide the YAML metadata in a collapsed block by default.
  • Some people add custom metadata for their own automation purposes. How do we handle that?

davidmehren avatar Jan 19 '21 10:01 davidmehren

* Some people add custom metadata for their own automation purposes. How do we handle that?

We only change what we know and keep everything else intact? Question is how easy that will be, but I guess you know someone who does that? So maybe we could acquire some test data from them after we implemented this. I would suggest waiting until we have a implementation to avoid working to closely of that one persons extra metadata.

DerMolly avatar Jan 19 '21 11:01 DerMolly

If we go the "full GUI" route (so not just autocompletion), we should add a setting if the user wants to use the GUI or just edit YAML by default. In the former case, we could hide the YAML metadata in a collapsed block by default.

The markdown formatter for code mirror (which is in charge for detecting code blocks) doesn't support front matter. So "collapsing" or "hiding" the front matter yaml is quite difficult.

Some people add custom metadata for their own automation purposes. How do we handle that?

We just let them?... The GUI Editor should only change stuff it knows and keep the rest. That's not really difficult.

mrdrogdrog avatar Jan 19 '21 11:01 mrdrogdrog