Can you provide a method?
This is already possible with textBetween:
const { selection, state } = this.editor
const { from, to } = selection
const text = state.doc.textBetween(from, to, ' ')
@philippkuehn
Is there possible to get the selected part but the HTML version? So, not only text.
That gets only the text, not a structured kind of content (e. g. headlines, paragraphs), so there鈥檚 nothing that can be transformed to HTML.
If your editor looks like that:
# Headline
Text
And you select #Head only. What would you expect?
This:
<h1>Head
Or this:
<h1>Head</h1>
Both is wrong for different reasons. The first wouldn鈥檛 be the HTML you鈥檇 need to work with. And the second wouldn鈥檛 be the structure from the document.
Most helpful comment
This is already possible with textBetween: