mokhosh / filament-kanban

Add kanban boards to your Filament pages
https://filamentphp.com/plugins/mokhosh-kanban
MIT License
271 stars 40 forks source link

[Bug]: RichEditor Components are not clearing when opening a modal without Rick editor value #49

Closed Cybrarist closed 3 months ago

Cybrarist commented 3 months ago

What happened?

you have 2 tickets, ticket A and ticket B

ticket A has a value in rich editor field, while ticket B doesn't.

if you opened ticket A first, then Ticket B, you will see the value of ticket A in ticket B, if you checked the log there's an issue with rich editor js file, exactly in n=n.replace, i guess n=n?.replace might fix it, but didn't check.

anyway, a quick fix for this issue for this package by writing the following in your edit-record view

<div
    onClick="clear_trix_editors()"
    id="{{ $record->id }}">
the ticket code
</div>
<script>
    function clear_trix_editors(){

        var trix_items= document.getElementsByTagName('trix-editor');
        for(let i = 0;i < trix_items.length; {
            trix_items[i].innerHTML=""
        }
    }
</script>

i believe this fix will be good for the note available in vendor/mokhosh/filament-kanban/src/Concerns/HasEditRecordModal.php:34

How to reproduce the bug

put richeditor in the form schema

Package Version

latest

PHP Version

8.1 , 8.2 ,8.3

Laravel Version

11.9.1

Which operating systems does with happen with?

macOS, Linux

Which browsers does with happen with?

Chrome, Firefox

Notes

No response

mokhosh commented 3 months ago

I could not reproduce this error. The rich editor component is working fine.

  1. Are you overriding the mount method by any chance?
  2. Create a reproduction repo please.