I’m making a wrapper called a photo grid. The photo grid sets content to have only two to four images.
content: 'image{2,4}'
With three images, I want to delete the images one by one and remove them from the photo grid when I have one image left.
Basically, the behavior of ProseMirror seems to automatically fill up the insufficient content when deleting.
What I want is to make sure that parsDOM doesn’t parse with the photo grid in certain situations, but this option doesn’t seem to exist.
parseDOM() {
return [
{
tag: 'div[data-type="photo-grid"]',
// ex
validate: (element) => element.childNodes.length >= 2 && element.childNodes.length <= 4
}
]
}
There will be various situations where i need to check the changes in content, is there a good way to handle it? (For example, when inserting initial data / inserting or moving with drag / cutting or removing with keyboard, etc.)