Closed Uzay-G closed 3 years ago
For those wondering, the solution to this is using the replaceSelection
function of codemirror
Ex:
let editor = new EasyMDE({
toolbar: [
{
name: "custom-command",
action: (editor) => {
editor.codemirror.replaceSelection("||")
}
}
],
});
Hi,
I was trying to add a button that would insert some text where the user's writing, like what most of the markup commands do.
Something like this:
Here I'm trying to add a
||
to where the user is currently writing, but (as it should) it adds it to the end of the editor content.How would I go about adding it to where the user is writing?
I've really been trying to read the docs but I can't find anything about it. Thanks!