Skip to content

Commit

Permalink
fix: backspace event error #45
Browse files Browse the repository at this point in the history
  • Loading branch information
lovefields committed Aug 30, 2024
1 parent 189bf9e commit 0bcb6fa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/runtime/utils/keyboardEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ function defaultBlockBackspaceEvent(e: KeyboardEvent, store: any, $element: Elem
} else {
// 내용이 있는 경우

if (store.cursorData.startOffset === 0 && ($textBlock.childNodes[0] === store.cursorData.startNode || $textBlock.childNodes[0] === $target)) {
if (store.cursorData.type === "Caret" && store.cursorData.startOffset === 0 && ($textBlock.childNodes[0] === store.cursorData.startNode || $textBlock.childNodes[0] === $target)) {
// 커서가 첫번째에 있는 경우

e.preventDefault();
Expand Down Expand Up @@ -966,7 +966,7 @@ function listBlockBackspaceEvent(e: KeyboardEvent, store: any, $element: Element
} else {
// 텍스트가 있는 경우

if (store.cursorData.startOffset === 0 && ($targetItem.childNodes[0] === store.cursorData.startNode || $targetItem.childNodes[0] === $target)) {
if (store.cursorData.type === "Caret" && store.cursorData.startOffset === 0 && ($targetItem.childNodes[0] === store.cursorData.startNode || $targetItem.childNodes[0] === $target)) {
// 커서가 첫번째에 있는 경우

e.preventDefault();
Expand Down Expand Up @@ -1022,7 +1022,7 @@ function listBlockBackspaceEvent(e: KeyboardEvent, store: any, $element: Element
} else {
// 텍스트가 있는 경우

if (store.cursorData.startOffset === 0 && ($targetItem.childNodes[0] === store.cursorData.startNode || $targetItem.childNodes[0] === $target)) {
if (store.cursorData.type === "Caret" && store.cursorData.startOffset === 0 && ($targetItem.childNodes[0] === store.cursorData.startNode || $targetItem.childNodes[0] === $target)) {
// 커서가 첫번째에 있는 경우

e.preventDefault();
Expand Down Expand Up @@ -1071,7 +1071,7 @@ function listBlockBackspaceEvent(e: KeyboardEvent, store: any, $element: Element
} else {
// 텍스트가 있는 경우

if (store.cursorData.startOffset === 0 && ($targetItem.childNodes[0] === store.cursorData.startNode || $targetItem.childNodes[0] === $target)) {
if (store.cursorData.type === "Caret" && store.cursorData.startOffset === 0 && ($targetItem.childNodes[0] === store.cursorData.startNode || $targetItem.childNodes[0] === $target)) {
// 커서가 첫번째에 있는 경우

e.preventDefault();
Expand Down

0 comments on commit 0bcb6fa

Please sign in to comment.