Hi all,
I’m trying to create a plugin that will show a menu and an input when the type ‘/’ is on a new line. For some reason, the placeholder text is not rendering. I’m not sure what I am doing wrong. Any tips would be appreciated. Here is the code I go so far.
TIA
new Plugin({
key: PluginKey,
props: {
decorations: ({ doc, selection }) => {
const active = this.editor.isEditable;
if (!active) return null;
const isNewLine = doc.lastChild?.content.size === 0;
console.log('is new line', isNewLine, doc.lastChild?.nodeSize);
if (isNewLine) {
const to = doc.lastChild.nodeSize;
const decoration = Decoration.node(0, to, {
nodeName: 'inlinemenu',
class: 'text-red italics',
'data-placeholder': 'Press spacebar to start',
});
return DecorationSet.create(doc, [decoration]);
}
return null;
}
}
})