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

Inserting content next to block widgets using keyboard navigation #4467

Closed
Dumluregn opened this issue Jan 5, 2021 · 3 comments · Fixed by #4539
Closed

Inserting content next to block widgets using keyboard navigation #4467

Dumluregn opened this issue Jan 5, 2021 · 3 comments · Fixed by #4539
Assignees
Labels
status:confirmed An issue confirmed by the development team. type:feature A feature request.
Milestone

Comments

@Dumluregn
Copy link
Contributor

Type of report

Feature request

Provide description of the new feature

Currently, if two block widgets are inserted right after each other, there is no possibility to add content between them without either some copy&paste workarounds or Magic Line plugin. Could be useful if it was possible in some friendly way.

Since the issue only concerns block widgets, expected result would probably be inserting the paragraph after the widget (like with Magic Line, but without mouse interaction). The enter keystroke is already reserved for widget edition dialog, so we need another one. A possibility is shift+enter, which is currently doing nothing in such scenario (it should be investigated if enterkey plugin doesn't alter this behaviour though).

That part would solve the problem with adding content between two widgets or after the widget if it is placed at the end of the document. There is one more situation to consider which is a widget at the beginning of the document - we would need another keystroke for inserting the paragraph before the widget, but that may be an edge case worth further extracting.

For more context, there is #4433 which probably enables removing the existing paragraph from between two widgets, which may cause the situation with two "glued" widgets more often, so it would be good to have it introduced in the same release as this feature.

@bunglegrind
Copy link
Contributor

I looked into this issue (since it's related to #4433 that I've opened) and probably found a solution. Quite simple, indeed.

Basically, I've add another case in the if else chain

if ( keyCode == 13 ) {

in which when SHIFT+DOWN is pressed (or whatever you prefer) an empty paragraph is added as a sibling next to the widget wrapper I'm in.

(the empty paragraph is filled with appendBogus).

Manual tests performed in FF, Chrome IE9-11 succeeded. With IE8 I'm experiencing some issues, probably related to the widget selection.

@CKEditorBot
Copy link
Collaborator

Closed in #4539

@quicksketch
Copy link

For final reference, documentation on how this works was added at #4559

Docs: https://ckeditor.com/docs/ckeditor5/latest/features/keyboard-support.html#content-editing

Screenshot
image

Thanks @bunglegrind for your work on this, it really makes working with images (and other widgets) a lot better experience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:confirmed An issue confirmed by the development team. type:feature A feature request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants