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

getMarkRange should be handled differently for link #3872

Closed
1 of 2 tasks
hasakilol opened this issue Mar 23, 2023 · 2 comments
Closed
1 of 2 tasks

getMarkRange should be handled differently for link #3872

hasakilol opened this issue Mar 23, 2023 · 2 comments
Labels
Type: Bug The issue or pullrequest is related to a bug

Comments

@hasakilol
Copy link

hasakilol commented Mar 23, 2023

What’s the bug you are facing?

If two links are ajacent with no white space between, getMarkRange will return the range containing both the links, but not one.

Which browser was this experienced in? Are any special extensions installed?

Chrome

How can we reproduce the bug on our side?

I will provide with a demo later. Please don't delete my post.

Can you provide a CodeSandbox?

No response

What did you expect to happen?

Range with only one link is returned.

Anything to add? (optional)

No response

Did you update your dependencies?

  • Yes, I’ve updated my dependencies to use the latest version of all packages.

Are you sponsoring us?

  • Yes, I’m a sponsor. 💖
@hasakilol hasakilol added the Type: Bug The issue or pullrequest is related to a bug label Mar 23, 2023
@hasakilol
Copy link
Author

hasakilol commented Mar 23, 2023

let startIndex = start.index
  let startPos = $pos.start() + start.offset
  let endIndex = startIndex + 1
  let endPos = startPos + start.node.nodeSize

  findMarkInSet([...start.node.marks], type, attributes) // 1. this code seems useless???

  while (startIndex > 0 && mark.isInSet($pos.parent.child(startIndex - 1).marks)) {
    startIndex -= 1
    startPos -= $pos.parent.child(startIndex).nodeSize
  }

  while (
    endIndex < $pos.parent.childCount
    && isMarkInSet([...$pos.parent.child(endIndex).marks], type, attributes) 
    // 2. in git history, this was mark.isInSet($pos.parent.child(endIndex).marks). Why did the change happen?
  ) {
    endPos += $pos.parent.child(endIndex).nodeSize
    endIndex += 1
  }

Note the 2 comments in the above code.

@nperez0111
Copy link
Contributor

This is released with 2.10.0

@github-project-automation github-project-automation bot moved this from Triage open to Done in Tiptap Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug The issue or pullrequest is related to a bug
Projects
No open projects
Archived in project
Development

No branches or pull requests

2 participants