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

Make live debounce work #553

Merged
merged 6 commits into from
Feb 6, 2025
Merged

Make live debounce work #553

merged 6 commits into from
Feb 6, 2025

Conversation

thijskuilman
Copy link
Contributor

@thijskuilman thijskuilman commented Jan 22, 2025

Bug description

I experienced the same issue as described in #520. You are able to set live() for the TipTapEditor like this:

✅ This works

TiptapEditor::make('content')
    ->live() 

However, as @awcodes rightfully pointed out, this will result in an excessive amount of requests. To mitigate this, you want to be able to add a debounce, but that breaks the editor (see the screenshots in the referenced issue):

❌ This does not work

TiptapEditor::make('content')
    ->live(debounce: 500) 

Changes

  • I noticed that the RichEditor field defines the state entanglement in a different way. After applying this in the same matter to TipTapEditor, the debounce didn't break the editor anymore
  • I now check if a debounce has been passed and it's now taken into account in onUpdate event within plugin.js.

GIF demonstration

Demo 1: live() without debounce

TiptapEditor::make('content')
    ->live() 

Result
live

Demo 2: live() with debounce

TiptapEditor::make('content')
    ->live(debounce: 400) 

Result
live-debounce

@awcodes
Copy link
Owner

awcodes commented Feb 1, 2025

Tried to fix these conflicts myself, but i don't have permission to push back to your fork. Can you please merge in the latest and rebuild the assets, please.

# Conflicts:
#	resources/dist/filament-tiptap-editor.js
@thijskuilman
Copy link
Contributor Author

Tried to fix these conflicts myself, but i don't have permission to push back to your fork. Can you please merge in the latest and rebuild the assets, please.

@awcodes All done!

@awcodes awcodes merged commit 6f03531 into awcodes:3.x Feb 6, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants