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

Custom arrow keys handling #5038

Closed
szymonkups opened this issue Dec 1, 2016 · 0 comments · Fixed by ckeditor/ckeditor5-image#17
Closed

Custom arrow keys handling #5038

szymonkups opened this issue Dec 1, 2016 · 0 comments · Fixed by ckeditor/ckeditor5-image#17
Assignees
Labels
package:image type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Milestone

Comments

@szymonkups
Copy link
Contributor

Extracted from: https://github.com/ckeditor/ckeditor5-engine/issues/696#issuecomment-263840273.

Custom widget handler for arrows

Use the view events (keydown or selectionChange).

Object selected

  1. Collapse selection in the right direction (or even base on the view#selectionChange which currently implements the same behaviour).
  2. Use Document#getNearestSelectionPosition with the right direction param to find the next possible position.
  3. If not position found... rollback?

Selection next to an object

  1. If selection is not collapsed – do nothing.
  2. Two options:
  • Use DataController#extendSelection() on a selection clone to probe what's next. If selection focus is before/after an object, it means that this object should be selected.
  • Alternatively – use the walker to find a closest object (in the right direction, ofc). Check if position after/before that object is touching the current selection.
  1. Select the found object.

Note: The above algorithm (the option 2a) will automatically work with the case when e.g. we selected an object at the beginning of the root and pressed left arrow. The focus will not be moved any further, so on its right side there'll still be that object and we'll reselect it. 🎉

@szymonkups szymonkups self-assigned this Dec 1, 2016
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-image Oct 9, 2019
@mlewand mlewand added this to the iteration 6 milestone Oct 9, 2019
@mlewand mlewand added status:confirmed type:feature This issue reports a feature request (an idea for a new functionality or a missing option). package:image labels Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:image type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants