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

[Feature request] Support multiple marks with same mark type. #61

Open
vivaxy opened this issue Aug 4, 2021 · 1 comment
Open

[Feature request] Support multiple marks with same mark type. #61

vivaxy opened this issue Aug 4, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@vivaxy
Copy link

vivaxy commented Aug 4, 2021

Is your feature request related to a problem? Please describe.
ProseMirror marks can have attributes. We can custom the mark with excludes to coexist with the mark of the same type, but different attributes.

For example, the annotation feature allows users to comment on the same text. The mark is defined like:

marks: {
  annotation: {
    attrs: { id: { default: null } },
    excludes: '',
    parseDOM: [{ tag: 'annotation', getAttrs(dom) { Number(dom.getAttributes('data-id')) } }],
    toDOM(node) { return ['annotation', { dataId: node.attrs.id }, 0] }
  }
}

Suppose we have a doc ABC, and two users adding annotations at the same time:
User1: Add annotation to AB. yDoc is <annotation id="1"> -> A -> B -> </annotation> -> C.
User2: Add annotation to BC. yDoc is A -> <annotation id="2"> -> B -> C -> </annotation>.

After merging, yDoc is <annotation id="1"> -> A -> <annotation id="2"> -> B -> </annotation> -> C -> </annotation>. The yDoc data is confusing the closing position of annotations, resulting C to be left out of the annotations.

Describe the solution you'd like
Not sure right now.

Describe alternatives you've considered
N/A

Additional context
N/A

@vivaxy vivaxy added the enhancement New feature or request label Aug 4, 2021
@BrianHung
Copy link
Contributor

Similar to #34

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

No branches or pull requests

3 participants