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

yjs Xmlfragment #554

Open
sandstone991 opened this issue Jan 12, 2025 · 2 comments
Open

yjs Xmlfragment #554

sandstone991 opened this issue Jan 12, 2025 · 2 comments

Comments

@sandstone991
Copy link

sandstone991 commented Jan 12, 2025

Hi,

Thanks for the awesome project.

I have a project with blocks like images, charts, and text. I'm trying to use Titap for text editing.

The schema looks something like this

type Page = {
rows: Row[]
}

type Row = {
blocks: Block[]
}

type Block = {
 type: "text" | "image" ...
 props: any
}

I'm trying to use yjs-prosemirror through tiptap.

The problem I'm facing is it requires a Yjs XMLfragment, which doesn't have a binding currently.

export interface CollaborationOptions {
  /**
   * An initialized Y.js document.
   * @example new Y.Doc()
   */
  document?: Doc | null;

  /**
   * Name of a Y.js fragment, can be changed to sync multiple fields with one Y.js document.
   * @default 'default'
   * @example 'my-custom-field'
   */
  field?: string;

  /**
   * A raw Y.js fragment, can be used instead of `document` and `field`.
   * @example new Y.Doc().getXmlFragment('body')
   */
  fragment?: XmlFragment | null;
}

Do I build something like #536 but for XMLfragments?

@xaviergonz
Copy link
Owner

Yes, you'd need to make something like the binding that was made for YText. That's actually a good PR to use as reference. If you are keen to create a PR for it I can take a look. 😄

@xaviergonz
Copy link
Owner

The hardest part might be to make the XML fragment be represented in a JSON like structure to make it compatible with mobx-keystone snapshots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants