Skip to content

Commit

Permalink
Select right
Browse files Browse the repository at this point in the history
  • Loading branch information
istarkov committed Dec 21, 2024
1 parent 5874e7e commit 660c195
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions apps/builder/app/canvas/features/text-editor/text-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -575,12 +575,21 @@ const InitCursorPlugin = () => {
if ($isTextNode(node)) {
selection.anchor.set(node.getKey(), domOffset, "text");
selection.focus.set(node.getKey(), domOffset, "text");
const normalizedSelection =
$normalizeSelection__EXPERIMENTAL(selection);

$setSelection(normalizedSelection);
return;
}
const normalizedSelection =
$normalizeSelection__EXPERIMENTAL(selection);
}

$setSelection(normalizedSelection);
return;
if (domNode instanceof Element) {
const rect = domNode.getBoundingClientRect();
if (mouseX > rect.right) {
const selection = $getRoot().selectEnd();
$setSelection(selection);
return;
}
}
}
}
Expand Down Expand Up @@ -1528,8 +1537,6 @@ export const TextEditor = ({
}
);

console.log(currentIndex);

if (currentIndex === -1) {
return;
}
Expand Down

0 comments on commit 660c195

Please sign in to comment.