yjs / y-prosemirror

ProseMirror editor binding for Yjs
https://demos.yjs.dev/prosemirror/prosemirror.html
MIT License
328 stars 115 forks source link

fix: unsupported node mark #135

Open XiaodongTong opened 1 year ago

XiaodongTong commented 1 year ago

fix https://github.com/yjs/y-prosemirror/issues/47

Using『node mark』 as an attribute on YElement,Each mark corresponds to an YElement attribute.
Runable in my project.

Hope to merge

kkeybbs commented 1 year ago

I meet similar sitituation in my custom prosemirror's schema.I'm not sure about when to use mark / attrs for a node.

But in file y-prosemirror/src/lib.js, yXmlFragmentToProsemirrorJSON this function processes only text nodes' marks, and attrs only for non-text nodes.

If marks are designed just for text node, and atts for non-text nodes, y-prosemirror will should not support marks for non-text nodes, as that will be anti prosemirror's design.

It's a pleasure for any suggestion or guidance on how to use marks/attrs correctly, fellows the design.

josonyang commented 1 year ago

I meet similar sitituation in my custom prosemirror's schema.I'm not sure about when to use mark / attrs for a node.

But in file y-prosemirror/src/lib.js, yXmlFragmentToProsemirrorJSON this function processes only text nodes' marks, and attrs only for non-text nodes.

If marks are designed just for text node, and atts for non-text nodes, y-prosemirror will should not support marks for non-text nodes, as that will be anti prosemirror's design.

It's a pleasure for any suggestion or guidance on how to use marks/attrs correctly, fellows the design.

I have also need to handle this case

In my understanding,marks act as a way to add attrs to prosemirror document , not only text node.

In tiptap and Confluence Editor , also use mark to effect non-text node

jjgmckenzie commented 1 year ago

Looking good, very useful feature for format compatibility & avoiding data loss.

@XiaodongTong - any plans to fix the final requested change and add tests?

hoebbelsB commented 3 months ago

@dmonad are there any plans to merge this? I also face the very same issue and wanted to raise a PR. Then I noticed this one here. I can also complete this work if you like

Pruxis commented 1 month ago

What's actuality pending here? I'd like to contribute to get this thing through