ProsemirrorEx.Model.Diff (prosemirror_ex v0.3.0)

Copy Markdown View Source

Finds the first and last differing positions between two fragments.

Ported from prosemirror-model's diff.ts.

Summary

Functions

Find the first position counting from the end at which the content of two fragments diverges.

Find the first position at which the content of two fragments diverges.

Functions

find_diff_end(a, b, pos_a \\ nil, pos_b \\ nil)

Find the first position counting from the end at which the content of two fragments diverges.

Returns %{a: pos_a, b: pos_b} or nil if they are identical.

find_diff_start(a, b, pos \\ 0)

Find the first position at which the content of two fragments diverges.

Returns the position or nil if they are identical.