Minor Changes
-
-
Remove
shouldDiffDescendants
option in favour ofelementsAreRelated
. -
The
elementsAreRelated
option controls whethercomputeDiff
treats a given pair of elements as "related" and thus tries to diff them. By default, elements are related if they have the samechildren
OR they differ only in theirchildren
. Return null to use the default logic for a pair of elements.-
Use case: In addition to supporting the same use case as the deprecated
shouldDiffDescendants
,elementsAreRelated
can be used to ensure thatcomputeDiff
compares the correct pair of paragraphs.For example, by default,
computeDiff
would compareMy slightly modified paragraph.
withNew paragraph
in the following diff.- My slightly modified paragraph. + New paragraph + My slightly modified paragraph!
If a custom
elementsAreRelated
function is provided that returns true for mostly similar paragraphs,computeDiff
would instead compareMy slightly modified paragraph.
withMy slightly modified paragraph!
.
-
-