I’m building a ruby text mark that has the following renderHTML method:
renderHTML({ mark, HTMLAttributes }) {
return [
'ruby',
HTMLAttributes,
['span', {}, 0],
['rt', { contenteditable: false }, mark.attrs.text],
];
},
This was based on this answer and it works great. The mark just has a single text
attribute. There’s a separate UI for editing the ruby text, which is why that’s not editable.
The issue I’m having is coming up with a paste rule that also works. I have this so far:
parseHTML() {
return [
{
tag: 'ruby',
contentElement: 'span',
getAttrs: element => ({
text: element.querySelector('rt').textContent,
}),
},
]
},
Which does seem to produce content that looks right, however it throws the following error which is then breaking the editor:
Any ideas?