Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#10024 closed New Feature (wontfix)

Define keystrokes using strings ( "Ctrl-B" )

Reported by: Danil Owned by:
Priority: Normal Milestone:
Component: Core : Keystrokes Version:
Keywords: Cc:

Description

I think this is very useful feature because this allows JSON configuration.

Change History (8)

comment:1 Changed 6 years ago by Wiktor Walc

Yeah, on the other side it means a few more bytes to parse yet another syntax... You may simply use values (see values here) instead of constants, they are not changed in major versions of CKEditor.

Also there are different settings where constants are used, not only keystrokes.

comment:2 Changed 6 years ago by Jakub Ś

Resolution: wontfix
Status: newclosed

CKEditor has already a way to define keystrokes - http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setKeystroke and http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-blockedKeystrokes. Also this may be useful - http://docs.ckeditor.com/#!/api/CKEDITOR.config. These are not Strings but numbers(key codes) and strings (command names).

@danya_postfactum I'm sorry, but we have whole working mechanism for keystrokes thus I don't think it will be changed. I'm closing this as won't fix.

comment:3 Changed 6 years ago by Piotrek Koszuliński

Kuba - having keystrokes handler and keystrokes parser are different things.

@danya_postfactum:

Surprisingly this is not an easy thing to implement. There are differences between browsers (seriously) and most likely between keyboard layouts too. Also, this can't be tested automatically ;<.

We can add parser for the most popular cases like - [ctrl+shift+alt]+letter. Plus maybe few special characters. But why those, not other ones? We'd introduce feature that is incomplete and unclear (and not properly tested). It'd also add few kbs (http://craig.is/killing/mice adds 1.7kb when gzipped - and check their issues list...) and will be used by users just for few keystrokes and pretty rarely. It doesn't make much sense for me.

On the other hand - if it's so hard to work with keystrokes maybe we should simplify this for users? I don't think so too. Plugin developer or developer who's integrating CKE usually sets just few keystrokes and he can test them properly on the most likely used keyboard layout. We'd have to handle many times more keystrokes and couldn't test them in proper context.

comment:4 Changed 6 years ago by Danil

We need easy way to define keystrokes. Simple expample: we have a CMS with CKEditor. We want to have the setting keystrokes . Do you offer CMS user to learn CKEditor api to define a few simple keystrokes? How can we pass this string-represented setting to CKEditor? JSON.parse( keystrokes ) will not work.

Instead, we can use something like [ ["Ctrl-Shift-L", "link"] ] . It can be easely passed as JSON.

See example https://github.com/ajaxorg/ace/blob/master/lib/ace/commands/default_commands.js Similar syntax is used in Emmet and other products.

This will simplify key bindings very much. Current implementation is used by developers only, not end users.

Of course, this can be handled in the integration wrapper, but it's quite hard. It would be great and useful to have it in the core.

comment:5 Changed 6 years ago by Piotrek Koszuliński

Exactly - this should be handled in integration wrapper or by plugin. But not in core. Adding this kind of functionality (I mean - not small, not stable) for so rare issue isn't reasonable.

Also, note that there's a significant difference between editors like Ace and CKE. Ace is used by developers and many of us changes keystrokes. CKE's users don't do that so often.

comment:6 Changed 6 years ago by Wiktor Walc

Usually the editor is configured just a few times during the initial setup, by someone with sufficient skills. Then it is just used for editing for years, many times by thousands of different users.

It means that it makes very little sense to introduce an extra overhead and add at least a few kilobytes of code that will be downloaded by anyone, just to simplify a bit the initial configuration procedure. I agree with Reinmar here - the cost is simply too high.

comment:8 Changed 5 years ago by Danil

TinyMCE has shortcut parser: http://www.tinymce.com/wiki.php/api4:method.tinymce.Editor.addShortcut Redactor has it also: http://imperavi.com/redactor/examples/shortcuts-add/

Too bad CKEditor left behind...

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy