Hello,
I've been trying to add a custom tool to my Kendo Editor that allows me to insert some text with a specific link whatever the cursor is positioned at.
There's not enough documentation regarding custom tools that mentions how to achieve this, I've search everywhere and nothing to be found.
This is what I have so far in my custom tool:
let node = view?.state.schema.text(settings.text, [view?.state.schema.marks.link.create({ title: "Test", href: "http://www.google.com" })]);
return (
<Button
type="button"
onClick={() => {
EditorUtils.insertNode(
view,
node
);
}}
disabled={!canInsert}
onMouseDown={(e) => e.preventDefault()}
onPointerDown={(e) => e.preventDefault()}
{...settings.props}
>
{settings.props.label}
</Button>
);
I've been reading the ProseMirror documentation to see if I could find any clues.
I understand that inserted "nodes" can have a list of "marks" passed to enhance a given node, so I'm passing the link mark to the text node, however it seems like it's completely ignoring it and it just adds a regular text.
Any help would be greatly appreciated.
Thanks,
Juan