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

absolutePositionToSlatePoint returns null for inline elements #401

Open
hemant-brb opened this issue May 31, 2023 · 0 comments
Open

absolutePositionToSlatePoint returns null for inline elements #401

hemant-brb opened this issue May 31, 2023 · 0 comments

Comments

@hemant-brb
Copy link

hemant-brb commented May 31, 2023

I converted a Slate Range To Relative Range using slateRangeToRelativeRange when selection is at the end of inline & void elements and when I tried to convert the relative range back to the slate range it gives null as the function used in relativePositionToSlatePoint -> relativePositionToSlatePoint -> absolutePositionToSlatePoint have a check if the target is Text

  ...
  const [pathOffset, textOffset] = yOffsetToSlateOffsets(parent, index, {
    assoc,
  });


  const target = parent.children[pathOffset];
  if (!Text.isText(target)) {
    return null;
  }

  return { path: [...parentPath, pathOffset], offset: textOffset };

why don't we have support for inline elements to convert slate range <-> relative Range

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

1 participant