-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
What is the best way to disable a certain key? #479
Comments
A |
What's the correct way to do this in 1.X? |
The documentation is correct. But I think there may be a misunderstanding. You can add a handler to run before the default and not propagate to |
Thanks @jhchen, the following worked just fine to prevent a new line and tab space keyboard: {
bindings: {
tab: false,
handleEnter: {
key: 13,
handler: function() {
// Do nothing
}
}
}
} |
How do you prevent/remove newlines when pasting in content? |
Hello, I stumbled upon a particular behavior while trying to disable the enter key in Quill. The snippet suggested by @Joeao works fine until you pass to a heading format. Any suggestions in order to fix this issue? |
@l4nz10 You've probably solved this by now, but I landed here with the same problems. Just to help anyone else who lands here in the future, this disables enter for headers & paragraphs: keyboard: {
bindings: {
handleEnter: {
key: 13,
handler: () => {},
},
"header enter": {
key: 13,
handler: () => {},
},
},
}, |
You saved me vafter three misirable days of figuring out how to. Thank you Sir ! |
on Key press of 'enter' i have prevent from breaking line but when i search quill-emoji and try to press that is even stopped now because it's a part of quill editor and emoji selection is causing problem. any suggestion how to do by quill methods ?? |
@mind-jayesh2401 Can you please tell me how to prevent line break. I am using ReactQuill in Nextjs App. |
I need to build an editor that simulates a native
input
, so I need to prevent enter from being pressed and causing a newline. To prevent most characters I can just preventDefault on keydown if a disallowed character is pressed, but because I need to disallow enter I also need to deletequill.modules.keyboard.hotkeys[13]
, but that seems a little gross. Is there a better way to do this?The text was updated successfully, but these errors were encountered: