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(editor): skip enter keydown handler on composing #4893

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 4 additions & 1 deletion src/components/Editor/Article/Summary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ const EditorSummary: React.FC<Props> = ({
const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {
const target = event.target as HTMLTextAreaElement

if (event.key.toLowerCase() === KEYVALUE.enter) {
if (
event.key.toLowerCase() === KEYVALUE.enter &&
!event.nativeEvent.isComposing
) {
event.preventDefault()

if (target.selectionStart === target.value.length) {
Expand Down
5 changes: 4 additions & 1 deletion src/components/Editor/Article/Title/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ const EditorTitle: React.FC<Props> = ({ defaultValue = '', update }) => {
const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {
const target = event.target as HTMLTextAreaElement

if (event.key.toLowerCase() === KEYVALUE.enter) {
if (
event.key.toLowerCase() === KEYVALUE.enter &&
!event.nativeEvent.isComposing
) {
event.preventDefault()

if (target.selectionStart === target.value.length) {
Expand Down
Loading