awcodes / filament-tiptap-editor

A Rich Text Editor plugin for Filament Forms.
MIT License
293 stars 80 forks source link

"Redo" button not working #436

Open krsaulitis opened 3 months ago

krsaulitis commented 3 months ago

Filament Version

v3.2.95

Plugin Version

v3.4.5

PHP Version

PHP 8.3.8

Problem description

The "redo" button or shortcut is not working in editor, nothing happens.

https://github.com/user-attachments/assets/87163785-d154-4b8d-8455-caa478322f9e

Expected behavior

The "redo" button reverts the changes after pressing undo.

Steps to reproduce

Reproduction repository

No response

Relevant log output

No response

awcodes commented 3 months ago

https://github.com/ueberdosis/tiptap/issues/4821

tlaverdure commented 4 days ago

Hey there, it looks like there is some sort of recursion in this code which is causing the issue:

I'm not really sure what the intent of updateEditorContent() is since it is called several times in various contexts, but if you comment editor.commands.setContent(content, true) the redo button works.

awcodes commented 1 day ago

hmm. Thanks for digging into the issue.

updateEditorContent is used to update the editor from outside of it, ie, through a livewire event or similar.

You may be right about the recursion though.

I'll have to give it some thought.