Editability of html5 template tag's content?

I wonder if prosemirror could support edition of a template node:

<template>
<p>some block content</p>
</template>
  • it is possible to template.append(template.content) and directly edit that content, as it would be possible with a standard div
  • serialization from DOM to HTML behaves as expected
  • parsing from html string in prosemirror always fail since the html fragment inside the template tag goes into template.content and template.childNodes is empty.

If prosemirror-view systematically did

if (template.content) {
  template.textContent = '';
  template.appendChild(template.content)
}

it would fix it. However i’m not sure of the side effects.

Yeah, that seems dodgy, and I’m not really sure what the point is of editing literal <template> tags in the editor. Couldn’t you just wrap the content in a different tag and serialize it to a <template> in non-editable output?

I actually did that, but it felt a bit of a hack, and at some point i tried to just work directly with template tags, to see what happens, and the conclusion is that some approach could work. Maybe if more users have similar cases to share a systematic approach would make sense.