Skip to content

Commit 5159ce9

Browse files
committed
feat(json-crdt-peritext-ui): 🎸 display cursor anchor position with the dotted border
1 parent 502f0c1 commit 5159ce9

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

‎src/json-crdt-peritext-ui/plugins/cursor/RenderCaret.tsx‎

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,6 @@ const innerClass2 = rule({
4949
'mix-blend-mode': 'hard-light',
5050
});
5151

52-
const dotClass = rule({
53-
pos: 'absolute',
54-
pe: 'none',
55-
us: 'none',
56-
w: '2px',
57-
h: '2px',
58-
bdrad: '50%',
59-
z: 9999,
60-
top: '-8px',
61-
left: '4px',
62-
bg: DefaultRendererColors.InactiveCursor,
63-
});
64-
6552
export interface RenderCaretProps extends CaretViewProps {
6653
children: React.ReactNode;
6754
}
@@ -117,6 +104,11 @@ export const RenderCaret: React.FC<RenderCaretProps> = ({italic, point, children
117104
style.rotate = '11deg';
118105
}
119106

107+
if (anchorForward) {
108+
style.borderLeft = 0;
109+
style.borderRight = `1px dotted ${DefaultRendererColors.InactiveCursor}`;
110+
}
111+
120112
return (
121113
<span ref={ref} className={blockClass}>
122114
{children}
@@ -129,7 +121,6 @@ export const RenderCaret: React.FC<RenderCaretProps> = ({italic, point, children
129121
}}
130122
/>
131123
)}
132-
{anchorForward && <span className={dotClass} />}
133124

134125
{/* Two carets overlay, so that they look good, both, on white and black backgrounds. */}
135126
<span className={innerClass + innerClass2} style={style} />

0 commit comments

Comments
 (0)