I guess something is wrong with the way I try to define an Inline custom node with an editable text content child:
class Foo extends Inline {
get matchDOMTag() {
return { 'foo': dom => (false) }
}
toDOM(node) {
return ['div', {style:'background-color:yellow;'}, 0]
}
}
and then I add it to my schema:
const schema = new Schema({
nodes: {
doc: {type: Doc, content: 'block+'},
paragraph: {type: Paragraph, content: 'inline<_>*', group: 'block'},
.....
foo: {type: Foo, content: "text<_>*", group: 'inline'},
...
},
marks: {
...
}
})
My actual use case is a Figure with an editable figcaption, and there I face the same problem as in this simple example. The figures needs to be of type Inline
, because they are CSS floating inside a paragraph. If I define my figure as type Block
, then I can edit the text content. But then the figure cannot go anymore inside a paragraph.
Or can I explicitly allow paragraphs to accept figures as content (even it they extend Block
class) ?
Another option of course is to edit the fig caption with a prompt dialog (when clicking on the figcaption node), but I would prefer to have the figcaption text editable directly.