-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Space (whitespace) gets deleted after pressing any other key #873
Comments
I fixed this bug in my project by next code:
|
Thank you for your suggestion @glavdir, but this didn't work for me. I'm looking at the Vue dev tools and the editor value (by getHTML()) looks like this after pressing the spacebar: |
Hi @obsessen, I was having the exact same problem, and found #168 which helped me solve the problem. You can pass the following option to the Editor constructor:
Hope this helps! |
Hello @hisem, yes, I saw that issue and tried the suggested fix but for me, the issue still persists. I also tried the 'full' option for the preserveWhitespace with no improvement. Edit: To anyone who ends up here with the same problem here is the solution:
and add this to the Editor options object for good measure (the CSS should be enough by itself):
|
preserveWhitespace: 'full' - really works for me! But "true" - not working. |
I'm using react tiptap latest version as of now. All solutions above not working for me
|
The problem with this solution is that when the text is right-aligned It's not sitting flush agains the right border. I also don't think the CSS justifies this bug being present. When "white-space" is anything but "pre-wrap" it simply doesn't work to add a space at the end of the line. |
React solution using tiptaps content optionsYeah no this is the actual solution when setting content. You just have to use the options parameter and set the white spaces. they are false by default so you need to set it to true however if you want all spaces to pass then "full" is the better bet. editor.commands.setContent(cleanText, false, {preserveWhitespace: "full"}); |
Unfortunately, I've found another problem. <h1>My test header</h1>
<p>This is my test <em>paragraph <strong>with</strong></em> <strong>text</strong></p> While trying to set it as content - even using code from @JahnoelRondon (thanks!), TipTap shows it in this way: It looks like TipTap trims spaces anyway. |
This worked for me:
Also, it seems like one can add a line break using shift + enter. |
@szymekjanaczek I recently also had the same problem and I just updated all tiptap related packages to the most recent version (2.2.4) and for me the spaces between tags now stay. |
…ioning in Tiptap editor Related to: ueberdosis/tiptap#873, ueberdosis/tiptap#2216
I'm still seeing this issue in Firefox (125.0.2 (64-bit)) using @tiptap v2.3.0.
|
same for me. i have the same issue and the proposed fixed don't work anymore. Anyone else having the same? i think the bug needs to be reopened. any other solution that we could try? (using the react version) |
This solution worked for me. Thanks! |
This worked for me with a Vue 3 app using the "Gutentap" editor (https://github.com/johnpuddephatt/gutentap/tree/main), implemented with TipTap. |
|
I am still running into this issue when re-loading the Editor content from saved text (from My flow is as follows:
Has anyone discovered a fix for this or do I need to be reloading from Screen.Recording.2025-01-20.at.10.10.19.AM.mov |
Found a solution for my above issue. If you're using more complex formatting you'll likely want to simply use the ie replacing newlines with linebreaks via something like Note that this requires the hardbreak extension and the use of Also note: this is in combination with |
Describe the bug
Space gets deleted after pressing any other key.
Steps to Reproduce / Codesandbox Example
Steps to reproduce the behavior:
Expected behavior
Whitespace should not get deleted
Screenshots
![ezgif com-video-to-gif](https://user-images.githubusercontent.com/2692737/97013768-bc3f6800-1549-11eb-8ba1-e192f5ce5981.gif)
This is with the most barebones include of the editor and it still doesn't work for me.
Environment
The text was updated successfully, but these errors were encountered: