awcodes / filament-tiptap-editor

A Rich Text Editor plugin for Filament Forms.
MIT License
297 stars 86 forks source link

Code inside <code> disappears after save & refresh in editor when using HTML output #444

Closed DanielSpravtsev closed 2 months ago

DanielSpravtsev commented 3 months ago

Filament Version

v3.2.98

Plugin Version

3.4.8

PHP Version

8.3.1

Problem description

Code inside code blocks wipes out to first word when using default HTML output after save and refresh in filament resource create When using JSON output everything is ok, so I think there are some issues in code blocks formatting, maybe coming from tiptap dependency itself

2024-08-12_12-13-44 After save & refresh: 2024-08-12_12-14-11

Expected behavior

Code should not disappear

Steps to reproduce

Create new resource record Paste code block to editor Press save Refresh page Code will wiped to the first starting word

Reproduction repository

No response

Relevant log output

No response

awcodes commented 3 months ago

Thinking this could be related: https://github.com/awcodes/filament-tiptap-editor/issues/384

DanielSpravtsev commented 3 months ago

Thinking this could be related: https://github.com/awcodes/filament-tiptap-editor/issues/384

This could fix it

1.4.0 https://github.com/ueberdosis/tiptap-php/releases

awcodes commented 3 months ago

Nice, was waiting on a update from them. Will look into bumping it soon. You should be able to bump it in your project though without having to wait on me.

awcodes commented 3 months ago

Looks like the problem still isn't solved. But I'm unable to replicate your exact issue. I'll do some more digging.

ankitcodes4u commented 3 months ago

I have also encountered this vanishing code problem but my one looks like this.

https://github.com/user-attachments/assets/52aa8487-018d-4256-a6c5-ffe7052dc5ef

Here I have created a custom block. If I add some other element infront of custom block everything works. But if my code start with that custom block followed by regualre element when I try to clear the regular element only the block disappears.

ankitcodes4u commented 3 months ago

And some times if I save only the custom block in the field. It disappears when I save and come back to see it again.

awcodes commented 3 months ago

Yea. There's something odd going on with custom nodes as the first element of the schema. Unfortunately, I have been able yet to track down if it's an issue with Tiptap itself or the plugin.

fabianpimminger commented 2 months ago

@awcodes Unfortunately I'm having the same issue. Any idea whats wrong here?

awcodes commented 2 months ago

No update yet. Sorry.

awcodes commented 2 months ago

Possibly resolved with v3.4.14. Let me know.

fabianpimminger commented 2 months ago

@awcodes it's working in 3.4.14! Thank you very much!

gergo-tar commented 1 month ago

@awcodes I am still having this problem I am using the latest version (v3.4.16). The filament version: v3.2.115

Screencast 2024-10-05 10:06:19.webm

This is the example source code: <p><span style="font-size:12pt;font-family:Roboto,sans-serif;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">After install, verify your PHP version:</span></p><pre class="hljs"><code>php -v</code></pre><p><span style="font-size:12pt;font-family:Roboto,sans-serif;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">To <strong>explore more PHP modules</strong> for your Laravel projects, use the following command:</span></p><pre class="hljs"><code class="language-css">sudo apt search php8.3-</code></pre>

The weird thing is that not every code block is affected. And it seems to happen when I edit the content between the code blocks. Here for example only the 2nd and 4th are partly disappeared: image

After editing: image

DanielSpravtsev commented 1 month ago

@awcodes I am still having this problem

I am using the latest version (v3.4.16).

The filament version: v3.2.115

Screencast 2024-10-05 10:06:19.webm

This is the example source code:

<p><span style="font-size:12pt;font-family:Roboto,sans-serif;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">After install, verify your PHP version:</span></p><pre class="hljs"><code>php -v</code></pre><p><span style="font-size:12pt;font-family:Roboto,sans-serif;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">To <strong>explore more PHP modules</strong> for your Laravel projects, use the following command:</span></p><pre class="hljs"><code class="language-css">sudo apt search php8.3-</code></pre>

The weird thing is that not every code block is affected. And it seems to happen when I edit the content between the code blocks.

Here for example only the 2nd and 4th are partly disappeared:

image

After editing:

image

I just switched everything to json output with conversion to html at blade and forget about this issue. You could also do the same 🙂

awcodes commented 1 month ago

So, it's not an issue? Idk 🤷

gergo-tar commented 1 month ago

Thanks @DanielSpravtsev, I changed the output to TiptapOutput::Json and I do not have this problem. @awcodes the issue occurs only when I change the format for saving to TiptapOutput::Html

But it is not an issue for me anymore since I moved to json.

@awcodes I am still having this problem I am using the latest version (v3.4.16). The filament version: v3.2.115

Screencast.2024-10-05.10.06.19.webm

This is the example source code: <p><span style="font-size:12pt;font-family:Roboto,sans-serif;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">After install, verify your PHP version:</span></p><pre class="hljs"><code>php -v</code>\</pre\><p><span style="font-size:12pt;font-family:Roboto,sans-serif;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">To \<strong\>explore more PHP modules\</strong\> for your Laravel projects, use the following command:</span></p><pre class="hljs"><code class="language-css">sudo apt search php8.3-</code>\</pre\> The weird thing is that not every code block is affected. And it seems to happen when I edit the content between the code blocks. Here for example only the 2nd and 4th are partly disappeared: image After editing: image

I just switched everything to json output with conversion to html at blade and forget about this issue. You could also do the same 🙂