Can Quill BlockEmbeds use arbitrary tags?

Viewed 3723

I've got a bunch of components (pieces of html and logic) that I want to be able to embed inside a Quill document, and I'm not entirely sure how to get started. Each component has a single root element, but the tagName is arbitrary (there are aside, div, section, etc tags). Each of the components has a completely non-Quill editing experience (that's handled elsewhere), so ideally their deltas would just look like this:

{
  ops: [
    { insert: 'Hello', attributes: { bold: true } },
    { insert: { component: 'domain.com/components/image/instances/foo' } },
    { insert: 'World!\n' }
  ]
}

I believe I read somewhere in the documentation that block-level Blots must specify a tagName or a className, but I can't find the reference for that. All of the examples I can find using the BlockEmbed specify a tagName, and the Parchment docs don't really explain it. Is there a correct way this should be done, and are there any edge cases I should be aware of?

All of these components would be block-level, so (from my reading of this issue) I don't think selection should be a problem, right?

1 Answers
Related