diff --git a/packages/text-editor/src/components/editor/collaboration.ts b/packages/text-editor/src/components/editor/collaboration.ts index 6722b99868..15a1008c53 100644 --- a/packages/text-editor/src/components/editor/collaboration.ts +++ b/packages/text-editor/src/components/editor/collaboration.ts @@ -22,12 +22,16 @@ export const renderCursor = (user: CollaborationUser): HTMLElement => { const color = getPlatformColor(user.color, false) const cursor = document.createElement('span') - - cursor.classList.add('collaboration-cursor__caret') + cursor.classList.add('collaboration-cursor') cursor.setAttribute('style', `border-color: ${color}`) - cursor.addEventListener('mousemove', () => { - showTooltip(undefined, cursor, 'top', CollaborationUserPopup, { user }) + const caret = document.createElement('div') + caret.classList.add('collaboration-cursor__caret') + caret.setAttribute('style', `border-color: ${color}`) + cursor.appendChild(caret) + + caret.addEventListener('mousemove', () => { + showTooltip(undefined, caret, 'top', CollaborationUserPopup, { user }) }) return cursor diff --git a/packages/theme/styles/_text-editor.scss b/packages/theme/styles/_text-editor.scss index d610210c80..d7e4b8edcb 100644 --- a/packages/theme/styles/_text-editor.scss +++ b/packages/theme/styles/_text-editor.scss @@ -145,13 +145,25 @@ } /* Give a remote user a caret */ - .collaboration-cursor__caret { + .collaboration-cursor { border-left: 1px solid transparent; border-right: 1px solid transparent; margin-left: -1px; margin-right: -1px; position: relative; word-break: normal; + cursor: text; + } + + .collaboration-cursor__caret { + display: flex; + justify-content: center; + cursor: text; + height: 110%; + width: 8px; + top: -2px; + left: -4px; + position: absolute; &::after { content: ''; @@ -160,8 +172,6 @@ border-style: solid; width: 0; height: 0; - top: -2px; - left: -4px; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top-width: 4px;