Как добавить еще один блок после точного блока в редакторе Slate.js?

Этот код меняет тип блока с совпадающим текстом.
Как добавить еще один блок ПОСЛЕ этого в Slate.js?

import {Range} from 'slate';
import {blockTypes} from 'core/slate-types';

export default function autoreplaceHeading(node, matched, change) {
  const matchedLength = matched[0].length;

  return change
    .setBlocks(blockTypes.HEADING)
    .deleteAtRange(
      Range.create({
        anchorKey: node.key,
        focusKey: node.key,
        anchorOffset: matched.index,
        focusOffset: matched.index + matchedLength
      })
  );
}

0 ответов

Другие вопросы по тегам