fix: collaboration user's name display in editor line 1

This commit is contained in:
hjlarry
2026-02-04 10:11:40 +08:00
parent 7535b67423
commit 36bfb08f34
2 changed files with 9 additions and 2 deletions

View File

@@ -369,8 +369,11 @@ export const useSkillCodeCursors = ({ editor, fileId, enabled }: UseSkillCodeCur
}}
/>
<div
className="absolute -top-5 left-2 max-w-[160px] overflow-hidden text-ellipsis whitespace-nowrap rounded px-1.5 py-0.5 text-[11px] font-medium text-white shadow-sm"
className="absolute left-2 max-w-[160px] overflow-hidden text-ellipsis whitespace-nowrap rounded px-1.5 py-0.5 text-[11px] font-medium text-white shadow-sm"
style={{
top: position.y < 20
? Math.max(position.height + 4, 18)
: -20,
backgroundColor: position.color,
}}
>

View File

@@ -626,6 +626,9 @@ export const SkillRemoteCursors = ({ fileId, enabled }: SkillRemoteCursorsProps)
const user = onlineUserMap[cursor.userId]
const name = user?.username || cursor.userId.slice(-4)
const color = getUserColor(cursor.userId)
const labelOffset = cursor.y < 20
? Math.max(cursor.height + 4, 18)
: -20
return (
<div
@@ -644,8 +647,9 @@ export const SkillRemoteCursors = ({ fileId, enabled }: SkillRemoteCursorsProps)
}}
/>
<div
className="absolute -top-5 left-2 max-w-[160px] overflow-hidden text-ellipsis whitespace-nowrap rounded px-1.5 py-0.5 text-[11px] font-medium text-white shadow-sm"
className="absolute left-2 max-w-[160px] overflow-hidden text-ellipsis whitespace-nowrap rounded px-1.5 py-0.5 text-[11px] font-medium text-white shadow-sm"
style={{
top: labelOffset,
backgroundColor: color,
}}
>