-
-
Notifications
You must be signed in to change notification settings - Fork 3
Fixed constant request to the server as the user types into the editor #14
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
base: main
Are you sure you want to change the base?
Conversation
…so added toolbar option for snow theme
dasundev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll keep this PR open until someone else provides their opinion on it.
| clearTimeout(timeout); | ||
| } | ||
| timeout = setTimeout(function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this is the best way to handle this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because you are using a timeout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dasundev Just use lodash debounce
quill.on('text-change', _.debounce( () => {
let value = quill.root.innerHTML;
@this.set('value', value);
}, 1000));lodash comes along with quill
|
i improved the code to use debouncing directly, `quill.root.innerHTML = $wire.get('value'); |
|
i found another quill livewire package, they use debouncing also, and they even handle the image upload into their text editor, have a look =>>> https://github.com/joelwmale/livewire-quill/blob/master/resources/views/livewire/livewire-quill.blade.php |
|
Why not use the livewire own debounce? This will send an request after time (n) no further inputs are made. |
the problem with this package is not the .live of livewire, the quill editor fires an event by names of (text-change) each time the user types into the editor and with that the set method is used so each time the value will be set as the user types into the editor look at the code of the package: |
|
No description provided.