Skip to content
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

Support for setting extensible keystrokes (e.g. enter) through the keystroke handler #2853

Closed
Reinmar opened this issue Sep 14, 2016 · 6 comments
Labels
package:core resolution:expired This issue was closed due to lack of feedback. status:stale type:feature This issue reports a feature request (an idea for a new functionality or a missing option). type:question This issue asks a question (how to...).

Comments

@Reinmar
Copy link
Member

Reinmar commented Sep 14, 2016

Currently handlers for (Shift+)Enter and (Shift+)Tab are defined directly on the editing view, so there's no way to redefine what keystrokes cause them. Actually, there is but it requires registering a handler (using editor.keystrokes.add()) which fires a proper keydown event on the editing view.

It's also unclear, which keystrokes have to be defined on the editing view and which through a keystroke handler.

So far, that would be easy to solve, however, as we agreed after a very long discussion, the list feature will listen on enter event on the editing view in order to tweak the default behaviour. Some features will be extending the enter command itself, but when the semantics changes, then we should handle it on the view.

However, this means that if we configure keystroke handler to execute enter command on Enter, the list feature will still need to modify this behaviour on the editing view level. So when someone decides to say that now Foo should behave like Enter and sets that through a keystroke handler, only the behaviour of the enter command will be used. The behaviour of the list feature will be ignored.

The only reasonable option that I see is:

  1. Removing the EnterObserver from the editing view.
  2. Use keystroke handler to set that on (???+)Enter (1) the enter command is executed.
  3. The list feature will need to alter the enter command's behaviour (can you think of any cons of this, @scofalik?).

Ad (1) Currently we'd like to handle enter with all modifiers, so either we'll add keystrokes for all combinations (sad) or we'll add a notation for optional modifiers. Like [Ctrl]+[Alt]+[Shift]+Enter.

Now, you'll always be able to redefine which keystrokes trigger enter command and we won't need some magic in the keystroke handler (which seems to be the only alternative if we don't want to change 2.).

Finally, I feel that even keystrokes like Backspace should be defined using the keystroke handler. What I wrote above is very similar to how it works in CKE4 with this difference, that in CKE4 some features like list or tables were listening directly on the editable's events (our editing view):

I think that we must avoid this. It's never been a big problem (although I recall that widgets had to deal with this), but just for the sake of being able to answer people's question – how should I handle xyz (that's how @scofalik provoked this ticket :D).

@Reinmar
Copy link
Member Author

Reinmar commented Sep 28, 2016

I've thought about an interesting conflict if we'll start to explicitly (through the keystroke handler) listen to too many keystrokes – we won't be able to seamlessly switch to the beforeinput event. Read more: #339.

@Reinmar
Copy link
Member Author

Reinmar commented Sep 28, 2016

This ticket needs to be reviewed in light of #340. However, I think that it's in line with that proposal.

@Reinmar
Copy link
Member Author

Reinmar commented Sep 29, 2016

See #340 (comment) – I mentioned a problem with optional modifiers that we can encounter later in the future.

@Reinmar
Copy link
Member Author

Reinmar commented Jun 13, 2017

Another reason for making keystroke handler a simple event dispatcher: #472 (comment).

@mlewand mlewand transferred this issue from ckeditor/ckeditor5-core Oct 9, 2019
@mlewand mlewand added this to the unknown milestone Oct 9, 2019
@mlewand mlewand added type:feature This issue reports a feature request (an idea for a new functionality or a missing option). type:question This issue asks a question (how to...). package:core labels Oct 9, 2019
@pomek pomek removed this from the unknown milestone Feb 21, 2022
@CKEditorBot
Copy link
Collaborator

There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.

@CKEditorBot
Copy link
Collaborator

We've closed your issue due to inactivity over the last year. We understand that the issue may still be relevant. If so, feel free to open a new one (and link this issue to it).

@CKEditorBot CKEditorBot added the resolution:expired This issue was closed due to lack of feedback. label Nov 2, 2023
@CKEditorBot CKEditorBot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:core resolution:expired This issue was closed due to lack of feedback. status:stale type:feature This issue reports a feature request (an idea for a new functionality or a missing option). type:question This issue asks a question (how to...).
Projects
None yet
Development

No branches or pull requests

4 participants