Skip to content

Commit

Permalink
update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Darginec05 committed Jun 25, 2024
1 parent cfc3108 commit 298a53f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"workspaces": [
"packages/plugins/*",
"packages/tools/*",
"packages/marks/*",
"packages/marks",
"packages/core/*",
"packages/development"
],
Expand Down
7 changes: 5 additions & 2 deletions packages/core/editor/src/handlers/onKeyDown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,11 @@ export function onKeyDown(editor: YooEditor) {
const fullRange = Editor.range(slate, firstElementPath, lastElementPath);
const isAllBlockElementsSelected = Range.equals(slate.selection, fullRange);

// [TODO] - handle cases for void node elements and when string is empty
if (Range.isExpanded(slate.selection) && isAllBlockElementsSelected) {
const string = Editor.string(slate, fullRange);
const isElementEmpty = string.trim().length === 0;

// [TODO] - handle cases for void node elements
if ((Range.isExpanded(slate.selection) && isAllBlockElementsSelected) || isElementEmpty) {
event.preventDefault();

ReactEditor.blur(slate);
Expand Down

0 comments on commit 298a53f

Please sign in to comment.