Toolbelt.Blazor.HotKeys
Toolbelt.Blazor.HotKeys copied to clipboard
Is it possible to disable keyboard shortcuts for contenteditable div?
Hot to disable shortcuts for contenteditable ?
Unfortunately, it is impossible to disable keyboard shortcuts for contenteditable div at this time.
Actually, I designed this library as a clone of the "angular-hotkeys" library, so I did not consider numerous situations well.
I may have to extend the "AllowIn" feature, like adding a new "AllowIn.NonContentEditable" flag to resolve this problem.
I'll consider that do or do not it.
I released "Toolbelt.Blazor.HotKeys" ver.12.0.0 today.
- https://www.nuget.org/packages/Toolbelt.Blazor.HotKeys/12.0.0
I added the "Exclude" flags for this version, and I deprecated the "AllowIn" flags instead.
So if you want to disable a hotkey for any "contenteditable" elements, then you can do that with the code like this:
this.HotKeysContext = this.HotKeys.CreateContext()
.Add(ModKeys.None, Keys.A, OnKeyDownA, "...", Exclude.Default | Exclude.ContentEditable)
...
Could you try it out?