From 3e9d60c25a010eef51c605f8f40ce75a174e9909 Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Wed, 9 Jul 2025 13:49:09 +0100 Subject: [PATCH] Ensure collaborator cursor colour is updated (#26847) GitOrigin-RevId: 7057cdbb4815d5f1c5e5771d38255e58f592f9cd --- .../source-editor/extensions/cursor-highlights.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/services/web/frontend/js/features/source-editor/extensions/cursor-highlights.ts b/services/web/frontend/js/features/source-editor/extensions/cursor-highlights.ts index ccdc8b90e7..3fef2b2771 100644 --- a/services/web/frontend/js/features/source-editor/extensions/cursor-highlights.ts +++ b/services/web/frontend/js/features/source-editor/extensions/cursor-highlights.ts @@ -166,7 +166,7 @@ export const setCursorHighlights = ( class CursorMarker extends RectangleMarker { constructor( - private highlight: Highlight, + public highlight: Highlight, className: string, left: number, top: number, @@ -181,6 +181,18 @@ class CursorMarker extends RectangleMarker { element.style.setProperty('--hue', String(this.highlight.hue)) return element } + + update(element: HTMLDivElement, prev: CursorMarker) { + if (!super.update(element, prev)) { + return false + } + element.style.setProperty('--hue', String(this.highlight.hue)) + return true + } + + eq(other: CursorMarker) { + return super.eq(other) && this.highlight.hue === other.highlight.hue + } } // draw the collaborator cursors in a separate layer, so they don't affect word wrapping