getkirby.com icon indicating copy to clipboard operation
getkirby.com copied to clipboard

Writer docs: paragraph node undocumented

Open adamkiss opened this issue 4 years ago • 7 comments

Today, as I was implementing Writer, I've looked up docs, specifically regarding limiting content;

This is what the docs state:

Sets the allowed nodes. Available nodes: bulletList, orderedList, heading, horizontalRule, listItem. Activate/deactivate them all by passing true/false. Default nodes are heading, bulletList, orderedList.

Looking at the panel source code, I also see following:

  • HardBreak
  • Doc
  • Paragraph
  • Text

Some of those seem obvious (text = inline: true write fields?), but some of those (specifically paragraph, in my case) are probably missing in the docs.

Additionally, I was able to limit my nodes to paragraphs only by setting the field option to:

        nodes:
          - paragraph

which is consistent with other kirby panel options, but not mentioned in the docs.

adamkiss avatar Jun 19 '21 20:06 adamkiss

This needs to be fixed in the source code inline docs

texnixe avatar Aug 07 '21 11:08 texnixe

Should we move this to the kirby repo?

texnixe avatar Aug 07 '21 17:08 texnixe

I wonder if the docs are really incorrect. I don't fully understand the internal writer setup, but as far as I can tell, these are all the supported node types:

https://github.com/getkirby/kirby/blob/79bce56a34a188ceaafb0a5179215fb55dca8bc5/panel/src/components/Writer/Writer.vue#L227-L231

lukasbestle avatar Aug 07 '21 17:08 lukasbestle

But here 6 are imported: https://github.com/getkirby/kirby/blob/79bce56a34a188ceaafb0a5179215fb55dca8bc5/panel/src/components/Writer/Writer.vue#L46

And here it mentions the paragraph node: https://github.com/getkirby/kirby/blob/79bce56a34a188ceaafb0a5179215fb55dca8bc5/panel/src/components/Writer/Writer.vue#L153

And to me it makes sense to be able to limit the writer field to paragraphs only.

texnixe avatar Aug 07 '21 17:08 texnixe

But if we filter the nodes prop to the five (+ HardBreak, which is always forced to be contained in the list), I don't think it's possible to configure other node types.

@distantnative @bastianallgeier?

lukasbestle avatar Aug 07 '21 19:08 lukasbestle

You are probably right. Setting nodes: false always leaves you with the paragraph "node", even though it doesn't seem to count as node.

If that's the case, we should however mention that somehow in the docs as it's obviously confusing.

texnixe avatar Aug 08 '21 08:08 texnixe