4

I am creating a basic editor using slate.js and React.js.

I want to insert text inside the editor at current selected position when i click on a card outside the editor i.e. when i click on a card containing a text, the card on text should get inserted at the last cursor position in slate.js editor.

Sawan Patodia
  • 773
  • 5
  • 13

1 Answers1

0

You don't need to get cursor position. Slate remembers selection when you click your button. You just need to insert content:

editor.insertBlock(...)

Available options

Tomas Kirda
  • 8,347
  • 3
  • 31
  • 23