Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add shouldDiffDescendants #3009

Merged
merged 1 commit into from
Mar 1, 2024
Merged

Add shouldDiffDescendants #3009

merged 1 commit into from
Mar 1, 2024

Conversation

12joan
Copy link
Collaborator

@12joan 12joan commented Mar 1, 2024

Description

  • Add shouldDiffDescendants option to computeDiff to control whether a pair of descendant lists should be diffed. If false, the parent node will be deleted and re-inserted. Defaults to () => true.
    • Example use case: To prevent computeDiff from diffing the text of unrelated paragraphs, use a text similarity checking algorithm to determine whether the paragraphs are sufficiently similar, and return false if not.
  • When multiple consecutive nodes have been deleted and inserted, computeDiff now groups all consecutive deletions together and does the same with all consecutive insertions.
    • Example of a diff prior to this change:
      - Old paragraph 1
      + New paragraph 1
      - Old paragraph 2
      + New paragraph 2
    • Example of a diff after this change:
      - Old paragraph 1
      - Old paragraph 2
      + New paragraph 1
      + New paragraph 2

@12joan 12joan requested a review from zbeyens March 1, 2024 13:43
Copy link

changeset-bot bot commented Mar 1, 2024

🦋 Changeset detected

Latest commit: eb0d661

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@udecode/plate-diff Minor
@udecode/plate Minor
@udecode/plate-suggestion Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Mar 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
plate ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 1, 2024 1:49pm

@12joan 12joan merged commit 4936c99 into main Mar 1, 2024
6 checks passed
@12joan 12joan deleted the feat/should-diff-descendants branch March 1, 2024 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants