Text within a mark

use case:

  1. user clicks on text that is in between the start and closing of a mark

Is there a way to get all of the text/content that is in between the start closing of that mark?

Thank you! Trey

I’d just look up the selection and find out

function findTextForYourMark(state) {
  const {state, schema} = state;
  const {from, to} = state;
  const markType = schema.marks['your_mark_name'];
  let text = '';
  doc.nodesBetween(from, to, node => {
    if (node.marks && node.marks.indexOf(markType) > -1) {
      text = node.textContent;
      return false;
    return true;
  return text;