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

[Bug]: Removing spaces between tags #4792

Closed
1 of 2 tasks
szymekjanaczek opened this issue Jan 16, 2024 · 7 comments
Closed
1 of 2 tasks

[Bug]: Removing spaces between tags #4792

szymekjanaczek opened this issue Jan 16, 2024 · 7 comments
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug

Comments

@szymekjanaczek
Copy link

szymekjanaczek commented Jan 16, 2024

Which packages did you experience the bug in?

core, react

What Tiptap version are you using?

2.1.16

What’s the bug you are facing?

Let's assume we write a text and format it like below:

<p>Lorem <em>ipsum <strong>dolor</strong></em> <strong>sit</strong> amet.</p>

When saving this somewhere and then recovering and load into tiptap again, getting text in this format:

<p>Lorem <em>ipsum <strong>dolor</strong></em><strong>sit</strong> amet.</p>

Without space between </em> and <strong>. So the words "dolor" and "sits" connects into one word "dolorsit".

What browser are you using?

Chrome

Code example

codesandbox.io - React version

const editor = useEditor({
  extensions: [StarterKit],
  editorProps: {
    attributes: {
      class: "Editor",
    },
  },
  content: `
    <p>Lorem <em>ipsum <strong>dolor</strong></em> <strong>sit</strong> amet.</p>
  `,
});

return (
  <div className="App">
    <EditorContent editor={editor} />
  </div>
);

What did you expect to happen?

Reading the text as it has been previously written - with spaces between HTML tags.
So when I save

<p>Lorem <em>ipsum <strong>dolor</strong></em> <strong>sit</strong> amet.</p>

And then set it as a content of the TipTap editor, I want to keep original spaces - without gluing words together.

Anything to add? (optional)

image

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. 💖
@szymekjanaczek szymekjanaczek added Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug labels Jan 16, 2024
@andrewvasilchuk
Copy link

I'm getting the same problem. This is related to the changes made in #4767.

@szymekjanaczek
Copy link
Author

szymekjanaczek commented Jan 22, 2024

I'm getting the same problem. This is related to the changes made in #4767.

At least some clue.
@andrewvasilchuk, have you tried installing an older version - from before this update?

@andrewvasilchuk
Copy link

@szymekjanaczek yes the problem is not seen in 2.1.15.

@ashu12chi
Copy link

I am facing similar issue: #4822

@andrewvasilchuk
Copy link

Another example may be seen on the "Mention" extension page.

<span data-type="mention" data-id="Winona Ryder"></span> <span data-type="mention" data-id="Axl Rose"></span>

The HTML above is collapsed when parsed by the editor, but there is an empty space between these 2 mentions.

@ElHex
Copy link

ElHex commented Jan 26, 2024

This is also happening in the project I'm working on and its related to this commit (confirmed after a lot of time debugging tiptap)

I guess its not checking the options set like (preserveWhitespace: true)
b7a2504

@svenadlung
Copy link
Contributor

Thanks for reporting. I was able to reproduce. Will be working on a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug
Projects
Status: Done
Development

No branches or pull requests

6 participants