I'm creating an application in Purescript and I want to have a text box displaying some documentation, and then I want to perform some NLP tasks on the server based on the sentences highlighted by the mouse on that text.
How could I extract that text in Purescript?
You can subscribe to the
selectionchangeevent in theinitializehandler of your halogen component.Then write an FFI function to get current selected text, something like
Then use
getSelectionStringin theOnSelectionChangehandler.A not exactly the same example here https://github.com/nonbili/halogen-contenteditable-example/blob/master/src/Example/Editor.purs#L178-L180