Hi, I have a strange behavior when selecting a node. When I click once on a node, it is not selected, but the node is selected in one of the following cases:
- triple click on a node
- clicking with pressed ctrl
- when moving a node (drag event)
Figure schema:
{
content: 'caption',
selectable: true,
draggable: true,
group: 'block',
isolating: true,
resizable: true,
attrs: {
position: { default: 'left' },
width: { default: null },
src: {},
},
parseDOM: [{
tag: 'figure.rte-figure',
getAttrs(dom) {
const img = dom.querySelector('img');
const width = dom.style.width || null;
return {
position: dom && dom.getAttribute('position') || 'left',
src: img && img.src,
width,
};
}
}],
toDOM(node) {
const width = node.attrs.width || '';
return ['figure', {
style: `width: ${width}`,
class: `rte-figure rte-figure--${node.attrs.position}`,
position: node.attrs.position,
}, ['img', {
src: node.attrs.src,
class: 'rte-media',
style: 'width: 100%',
}]];
},
}
Caption schema:
{
content: 'inline*',
parseDOM: [{
tag: 'figcaption',
}],
toDOM() {
return ['figcaption', 0];
}
}
Figure has a contentDOM property where the caption node is inserted.
Thanks in advance for any possible solutions to this problem.