getkirby.com
getkirby.com copied to clipboard
Writer docs: paragraph node undocumented
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.
This needs to be fixed in the source code inline docs
Should we move this to the kirby repo?
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
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.
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?
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.