canMergeBothParagraphs method

  1. @override
bool canMergeBothParagraphs({
  1. required Paragraph paragraph,
  2. required Paragraph nextParagraph,
})
override

Decides if we will merge the current Pr ↓ with the nextParagraph

Implementation

@override
bool canMergeBothParagraphs({
  required Paragraph paragraph,
  required Paragraph nextParagraph,
}) {
  return paragraph.isTextInsert && nextParagraph.isTextInsert ||
      (paragraph.isBlock) &&
          nextParagraph.isBlock &&
          mapEquality(
            paragraph.blockAttributes,
            nextParagraph.blockAttributes,
          ) ||
      mergeEmbeds &&
          (paragraph.isBlock) &&
          nextParagraph.isBlock &&
          mapEquality(
            paragraph.blockAttributes,
            nextParagraph.blockAttributes,
            true,
          );
}