Skip to content

Commit

Permalink
Fix editing empty
Browse files Browse the repository at this point in the history
  • Loading branch information
istarkov committed Dec 21, 2024
1 parent e7dbc8e commit 5874e7e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion apps/builder/app/canvas/features/text-editor/text-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1528,6 +1528,8 @@ export const TextEditor = ({
}
);

console.log(currentIndex);

Check failure on line 1531 in apps/builder/app/canvas/features/text-editor/text-editor.tsx

View workflow job for this annotation

GitHub Actions / checks

Unexpected console statement

if (currentIndex === -1) {
return;
}
Expand Down Expand Up @@ -1561,9 +1563,20 @@ export const TextEditor = ({

const instance = instances.get(nextSelector[0]);

if (instance === undefined) {
continue;
}

// Components with pseudo-elements (e.g., ::marker) that prevent content from collapsing
const componentsWithPseudoElementChildren = ["ListItem"];

// opinionated: Non-collapsed elements without children can act as spacers (they have size for some reason).
if (instance?.children.length === 0) {
if (
!componentsWithPseudoElementChildren.includes(instance.component) &&
instance?.children.length === 0
) {
const elt = getElementByInstanceSelector(nextSelector);

if (elt === undefined) {
continue;
}
Expand Down

0 comments on commit 5874e7e

Please sign in to comment.