How to allow 'enter' in editors but block enter from submitting forms?

Hello, To prevent 'enter' click from submitting forms, we added; onkeydown="return event.key != 'Enter';" But now the enter key won't do new line in editor inputs. Does anyone know how to allow enter to work in editor inputs but prevent it from submitting form?
4 Replies
Dan Harrin
Dan Harrin2y ago
which editors
Joe Kneeland
Joe Kneeland2y ago
Hi Dan, is effecting both; Forms\Components\RichEditor Forms\Components\Textarea Realized it's you I saw in a youtube interview I watched about filament. Dan, we love you!
Joe Kneeland
Joe Kneeland2y ago
So you know, there's also a thread about this over at laracasts - https://laracasts.com/discuss/channels/livewire/stop-submiting-form-when-press-enter
Laracasts
Eren
Eren2y ago
I had this problem before. I gave up when I couldn't find a solution. is there a solution? x-on:keydown.enter=" if (!['TEXTAREA', 'TRIX-EDITOR'].includes($event.target.tagName)) { $event.preventDefault() } " @joekneeland @Dan Harrin if I add this code to form/index.php, it works. but I don't know the right method.
Want results from more Discord servers?
Add your server