Changesets are ignoring changes in marks #4

Closed
opened 2018-11-18 09:11:20 +01:00 by mitar · 8 comments
mitar commented 2018-11-18 09:11:20 +01:00 (Migrated from github.com)

Maybe in addition to inserted and removed there should also be something like modified for those slices which had marks modified?

Maybe in addition to `inserted` and `removed` there should also be something like `modified` for those slices which had marks modified?
marijnh commented 2018-11-18 14:24:55 +01:00 (Migrated from github.com)

This is by design, currently, since modified ranges don't fit that well into the main use case for this, drawing insertions/deletions, and tracking them would further complicate an already tricky codebase. Also, Step objects don't currently have a way to report modified-but-not-replaced ranges, so doing this would require an extension to that interface in prosemirror-transform.

This is by design, currently, since modified ranges don't fit that well into the main use case for this, drawing insertions/deletions, and tracking them would further complicate an already tricky codebase. Also, `Step` objects don't currently have a way to report modified-but-not-replaced ranges, so doing this would require an extension to that interface in `prosemirror-transform`.
mitar commented 2018-11-18 18:32:25 +01:00 (Migrated from github.com)

I understand that it would make this package more complicated, but that is one more reason to have it in a standard/maintained package. :-) Because it is tricky for somebody who is not really an expert in ProseMirror to really come up with this.

If you really want to display full diff to the users, then you need it, no? I mean, marks can sometimes be very meaningful.

Also, Step objects don't currently have a way to report modified-but-not-replaced ranges,

Why would we need Step objects here? I would define a new Span, like ModifiedSpan, which would together with from, to, and data also have addedMarks and removedMarks which would contain a list of added and removed marks on that span in the current document.

I do not think we have to care about marks in the deleted content. But marks in preserved/existing content and diff on them would be useful.

I understand that it would make this package more complicated, but that is one more reason to have it in a standard/maintained package. :-) Because it is tricky for somebody who is not really an expert in ProseMirror to really come up with this. If you really want to display full diff to the users, then you need it, no? I mean, marks can sometimes be very meaningful. > Also, Step objects don't currently have a way to report modified-but-not-replaced ranges, Why would we need `Step` objects here? I would define a new `Span`, like `ModifiedSpan`, which would together with `from`, `to`, and `data` also have `addedMarks` and `removedMarks` which would contain a list of added and removed marks on that span in the current document. I do not think we have to care about marks in the deleted content. But marks in preserved/existing content and diff on them would be useful.
RichieAHB commented 2018-11-20 14:33:44 +01:00 (Migrated from github.com)

I'm not sure whether his is related but diffs are also not show between changes in block type. So when deleting the content between the text below ar will be promoted to a header.

Hea|der

p|ar

Is this due to:

Step objects don't currently have a way to report modified-but-not-replaced ranges

I'm not sure whether his is related but diffs are also not show between changes in block type. So when deleting the content between the text below `ar` will be promoted to a header. ``` Hea|der p|ar ``` Is this due to: >`Step` objects don't currently have a way to report modified-but-not-replaced ranges
marijnh commented 2018-11-20 14:40:14 +01:00 (Migrated from github.com)

Yes, that's also by design too. (This is a rather narrow library designed to fit a specific use case, and I'm not prepared to increase its scope. If someone who has more time for it were to fork it, that'd be great, of course!)

Yes, that's also by design too. (This is a rather narrow library designed to fit a specific use case, and I'm not prepared to increase its scope. If someone who has more time for it were to fork it, that'd be great, of course!)
RichieAHB commented 2018-11-20 14:45:44 +01:00 (Migrated from github.com)

Makes sense - thanks for the quick reply 👍 (and sorry for hijacking this issue)

Makes sense - thanks for the quick reply 👍 (and sorry for hijacking this issue)
arnaugomez commented 2025-05-02 18:03:24 +02:00 (Migrated from github.com)

I've added a configuration option to the ChangeSet library to track changes in marks as well as in nodes. It does not modify the default behavior of the library, but it adds this feature as a configuration option instead.

I know this might be out of scope of the prosemirror-changeset library. However, many popular features of our library, Tiptap, involve tracking when a user (or an AI assistant) changes the format of an element in the document, and showing that change in the UI so that other users can review it. So we're curious to know what you think of this feature, and if it could be supported by prosemirror-changeset.

I've added a configuration option to the ChangeSet library to track changes in marks as well as in nodes. It does not modify the default behavior of the library, but it adds this feature as a configuration option instead. I know this might be out of scope of the prosemirror-changeset library. However, many popular features of our library, [Tiptap](https://tiptap.dev/), involve tracking when a user (or an AI assistant) changes the format of an element in the document, and showing that change in the UI so that other users can review it. So we're curious to know what you think of this feature, and if it could be supported by prosemirror-changeset.
marijnh commented 2025-05-05 10:31:08 +02:00 (Migrated from github.com)

You can now customize the diff behavior by passing a token encoder.

You can now customize the diff behavior by passing a [token encoder](https://github.com/ProseMirror/prosemirror-changeset/?tab=readme-ov-file#interface-tokenencodert).
mitar commented 2025-05-05 10:47:49 +02:00 (Migrated from github.com)

Ooo, so great! Thanks. Interesting approach.

Ooo, so great! Thanks. Interesting approach.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
prosemirror/prosemirror-changeset#4
No description provided.