Skip to content

merging diffs together #146

Description

@christianhugoch

I have a problem where I want to merge three version of html together.
let originalHtml = "<p>one</p><p>two</p><p>three</p>"; let unsafedHtml = "<p>one</p><p>two</p><p>unsafed</p><p>three</p>"; let incomingHtml = "<p>one</p><p>incoming</p><p>two</p><p>three</p>";
Unsafed HTML are changes made by the user in an editor and incomingHtml comes from an external event.

I can diff originalHtml -> unsafedHtml. Now, I want to apply this diff to incoming HTML but I believe because incomingHtml has a new node I can't just apply the unsafedDiff to incomingHTML.

Does someone has an idea how to do it,

The README says
This diff is non-destructive, meaning that relocations of DOM nodes are preferred over remove-insert operations.
I believe this makes diff merging harder

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions