Custom Shortcut "ctrl+shift+#" not triggering
Chrome latest (93.0.4577.82) under Windows
Steps to reproduce the problem
- Code a custom shortcut with:
var textarea = $('textarea[name="'+fieldname+'"]')[0];
// shortcut to insert latex inline
sceditor.instance(textarea).addShortcut('ctrl+shift+#', function()
{
alert('got shortcut');
}
Is not triggering.
Probably the special char ´#´ is not interpreted. Is there another way of passing the character or is it a bug?
PS: In the source code here.
Thanks for reporting. It could be down to the keyboard layout. The code that handles shortcuts is very hacky at the moment and could do with updating as the key property is now supported in all browsers the editor supports.
I've tidied it up and switched to using the key property here: https://github.com/samclarke/SCEditor/tree/fix-847 Could you check if that fixes the issue for you?
If not, it could be that the shift key is changing the value of the # key. Shortcut sequences are based on key values rather than physical keys. For example, shift+# is an impossible combination on my keyboard as if I press shift, then # gets changed to ~. The shortcut would need to be shift+~ to work for me.
If it's that, the only solution is to use a different shortcut or add multiple aliases. The code could be changed to use physical locations for shortcuts, but that creates an issue with telling the user what the shortcut combination is as it depends on the keyboard layout.
I still cannot test because I don't have the setup to compile the source and I am only using distributed files. However, there is no dist folder at https://github.com/samclarke/SCEditor
I guess the fix is not in https://github.com/samclarke/SCEditor/releases/download/v3.0.0/sceditor-3.0.0.zip
I will test with the new release.
Thank you 🙂
Here's a build to test sceditor.zip
I tried it with the following shortcuts (to avoid the #~ issue above):
ctrl+shift+(
and
ctrl+shift+8
Both don't work.
I also tried ´ctrl+(´. Same, it doesn't work.