Skip to content

Commit

Permalink
[#131] feat: shift enter interaction ๊ตฌํ˜„
Browse files Browse the repository at this point in the history
  • Loading branch information
domino8788 committed Dec 16, 2020
1 parent 7aaaafe commit 3a62b6e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions frontend/src/components/atoms/BlockContent/BlockContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ function BlockContent(blockDTO: Block) {
Dispatcher((event.shiftKey ? 'shift' : '') + event.key);
throttleState.isThrottle = false;
});
} else if (event.key === 'Enter' && event.shiftKey) {
const { textContent } = contentEditableRef.current;
const caretOffset = window.getSelection().focusOffset;
const cvTextContent = textContent
.slice(0, caretOffset)
.concat('\n', textContent.slice(caretOffset));
handleBlock(cvTextContent, null, caretOffset + 1);
}
};

Expand Down

0 comments on commit 3a62b6e

Please sign in to comment.