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

Does not support marks on non-TextNodes #47

Open
2 tasks done
ascott18 opened this issue May 3, 2021 · 8 comments · May be fixed by #135
Open
2 tasks done

Does not support marks on non-TextNodes #47

ascott18 opened this issue May 3, 2021 · 8 comments · May be fixed by #135
Assignees
Labels
bug Something isn't working

Comments

@ascott18
Copy link

ascott18 commented May 3, 2021

Checklist

Describe the bug

This plugin fundamentally does not support marks on nodes that are not text nodes. For example, Tiptap's image node, which is an inline, non-text node: https://github.com/ueberdosis/tiptap/blob/v1/packages/tiptap-extensions/src/nodes/Image.js.

To Reproduce

  1. Apply a mark to an inline node. For example, apply a hyperlink (https://github.com/ueberdosis/tiptap/blob/v1/packages/tiptap-extensions/src/marks/Link.js) to an image (https://github.com/ueberdosis/tiptap/blob/v1/packages/tiptap-extensions/src/nodes/Image.js)
  2. Be the editor of the document. Observe that the JSON version of the prosemirror doc does contain the expected mark, and that the HTML is rendered with the correct <a></a> wrapping the image node.
  3. Be a realtime collaborator on the same document, OR reload the document using the serialized ydoc. Observe that the hyperlink on the image is missing because the mark is not serialized into the ydoc.

Expected behavior

Marks on custom nodes are handled just as attributes on custom nodes are handled.

@ascott18 ascott18 added the bug Something isn't working label May 3, 2021
@BrianHung
Copy link
Contributor

If anyone wants to tackle this in a PR, two main functions to address are createTypeFromElementNode and createNodeFromYElement.

Particularly, serialize the marks of a node as Y.XmlElement attributes using setAttribute while differentiating them somehow from node.attrs, then deserializing them and passing Mark[] as argument to schema.node.

@alexharri
Copy link

The lack of support for marks on custom nodes is currently causing issues in an editor that I'm building. Would love to see this feature.

Judging from the title, #63 sounds like it should resolve the issue. Is there something preventing us from taking #63 in @dmonad? I would love to help if I can.

@rebolyte
Copy link

rebolyte commented Nov 8, 2022

Same here, this has become a blocker on one of my projects as well. Can #63 be merged?

@devalberg
Copy link

Any updates on this @dmonad?

@martinboksa
Copy link

Any updates, please? @dmonad

@icode
Copy link

icode commented Mar 28, 2023

The same problem, custom nodes cannot support marks

@pointnet
Copy link

pointnet commented Apr 4, 2023

Same problem here, any updates?

@hoebbelsB
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants