Short: Can a node have multiple contentDOM
s? No - but then how to express an object like e.g. an album with title, description and tracks?
Long: I am looking into transferring the core of my XML based editor to PM (Prosemirror) but I am facing the caveat of PM not having “objects” but only “simple nodes” with a single entry point for children/content. Lets say this is whats in my system:
Data:
<albums>
<album title="Twoism" artist="Board of Canada">
<desc>Very <b>cool</b> stuff</desc>
<tracks>
<tracks title="Sixtyniner" />
<tracks title="Oirectine" />
Template:
<div x:list="albums/album">
<div class="album">
<div class="header">
<h1><x:literal path="@title" /></h1>
<p><x:content path="@title" /></p>
<div>
<ol x:list="tracks">
<li x:template="track" />
Output: … pretty obvious - the template(s) without the x name space etc. - just like Vue etc.
This makes for both a server render engine and a client side editor to edit albums in wysiwyg style with some inline helpers like “+” to insert new albums and tracks (and much much more).
So trying to “transfer” this to PM I bump in to a PM node should be the album
and then the PM node needs to map to @title
+ desc
- this will be flat JSON - sure, that I can then map to XML - but the problem is that the PM node can only have 1 content entry point… I tried with nodeView
, but no dice. And I can’t break it into pieces as e.g. <div class="header">
is not an object + the PM does not seem to insert child nodes if the are forced 1 elements only.
Is this possible somehow? Am I missing something?
Another maybe more simple HTML’ish sample would be a fieldset
node/control - it has 1 top legend and multiple content elements as siblings:
<fieldset>
<legend>The Legend</legend>
<p>Hello <b>World</b></p>