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

FIx errors on enter press when several blocks selected #1349

Merged
merged 3 commits into from
Oct 7, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge branch 'next' of github.com:codex-team/editor.js into fix/enter…
…-on-multiselection
  • Loading branch information
gohabereg committed Oct 7, 2020
commit 8d6e540c5dc1fe3a43bc9a227e177e0f03278139
2 changes: 1 addition & 1 deletion dist/editor.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/components/modules/blockSelection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,12 @@ export default class BlockSelection extends Module {
_.delay(() => {
const eventKey = (reason as KeyboardEvent).key;

/**
* If event.key length >1 that means key is special (e.g. Enter or Dead or Unidentifier).
* So we use empty string
*
* @see https://developer.mozilla.org/ru/docs/Web/API/KeyboardEvent/key
*/
Caret.insertContentAtCaretPosition(eventKey.length > 1 ? '' : eventKey);
}, 20)();
}
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.