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

Slate is adding link (inline bode) next to text node #5833

Open
sewellstephens opened this issue Mar 24, 2025 · 2 comments
Open

Slate is adding link (inline bode) next to text node #5833

sewellstephens opened this issue Mar 24, 2025 · 2 comments
Labels

Comments

@sewellstephens
Copy link

Description
A clear and concise description of what the bug is.

Slate inline link node is appearing next to text despite copying and pasting code from example.

Recording
A GIF or video showing the issue happening. (If you don't include this, there's a very good chance your issue will be closed, because it's much too hard to figure out exactly what is going wrong, and it makes maintenance much harder.)

Image

Sandbox
A link to a sandbox where the error can be reproduced. (You can start from the base sandbox here: https://codesandbox.io/s/slate-reproductions-c7gyg or refer to the Slate website too.)

Reproduce sandbox: https://codesandbox.io/p/sandbox/slate-reproductions-forked-sq4gcf

Steps
To reproduce the behavior:

  1. Go to 'the sandbox'
  2. Click on 'add link'
  3. See error

Expectation
A clear and concise description of what you expected to happen. (Often it's helpful to test out the behavior of other editors like Google Docs, Medium, Notion, etc. to see how they handle the same issue.)

For text to be replaced by link

Environment

  • Slate Version: [e.g. 0.59]
  • Operating System: [e.g. iOS]
  • Browser: [e.g. Chrome, Safari]
  • TypeScript Version: [e.g. 3.9.7 - required only if it's a TypeScript issue]

Context
Add any other context about the problem here. (The fastest way to have an issue fixed is to create a pull request with working, tested code and we'll help merge it. Slate is solving a pretty complex problem, and we can't do it without active contributors, so thank you so much for your help!)

@sewellstephens
Copy link
Author

sewellstephens commented Mar 24, 2025

it now seem to work after pasting more of your code from example. I still don't understand why previous code dont work. still would be worth taking a look @ianstormtaylor

@hiteshshetty-dev
Copy link

Hi @sewellstephens,

After looking into it, I found that the problem isn't with Slate itself but rather with how the Link element is being rendered in your setup. The JSON structure and editor behavior are correct, but when neither the https:// nor mailto: conditions are met, the children get rendered twice.

I've fixed this in a fork of your sandbox:
🔗 Slate Sandbox Fix

You can check out the changes and apply the fix to your implementation. Let me know if you have any questions—happy to help!

Thanks! 🚀

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

No branches or pull requests

2 participants