-
-
Notifications
You must be signed in to change notification settings - Fork 124
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 support for overlapping marks #52
base: master
Are you sure you want to change the base?
Conversation
/** | ||
* @param {Y.XmlText} ytext | ||
* @param {Array<any>} ptexts | ||
*/ | ||
const equalYTextPText = (ytext, ptexts) => { | ||
const delta = ytext.toDelta() | ||
return delta.length === ptexts.length && delta.every((d, i) => d.insert === /** @type {any} */ (ptexts[i]).text && object.keys(d.attributes || {}).length === ptexts[i].marks.length && ptexts[i].marks.every(mark => equalAttrs(d.attributes[mark.type.name] || {}, mark.attrs))) | ||
return delta.length === ptexts.length && delta.every((d, i) => d.insert === /** @type {any} */ (ptexts[i]).text && countYTextMarks(d.attributes || {}) === ptexts[i].marks.length && ptexts[i].marks.every(mark => containsEqualMark(d.attributes[mark.type.name] || {}, mark.attrs))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR for handling multiple marks!
I was pulling this PR into my project and ran into an issue with containsEqualMark
. It looks like you're calling containsEqualMark
with yattrs, pattrs
instead of pattrs, yattrs
.
This is inspired from this PL: yjs#52
Since y-prosemirror/src/plugins/sync-plugin.js Line 961 in 7a3afbc
|
Hey @dmonad, I know it's an old PR, but could you please let us know if this is the right direction to take for supporting overlapping ProseMirror marks? |
This addresses issue #34 - while remaining backwards compatible.
There are still two TODO items open open:
yjs
, but want to make sure the solution I'm implementing here is a right approach.