Compare commits

..

No commits in common. "db7e49ee928efa50a2a1df404fe203e4232b1ddd" and "2b75651655075c41eb2b69229c536f187fe9020e" have entirely different histories.

1 changed files with 8 additions and 17 deletions

View File

@ -400,11 +400,6 @@ export class RStackCollabOverlay extends HTMLElement {
// ── Local broadcasting ──
/** Effective view identifier — viewId if set, else moduleId. Used to scope cursor visibility. */
get #effectiveViewId(): string | null {
return this.#viewId || this.#moduleId || null;
}
#broadcastPresence(cursor?: { x: number; y: number }, selection?: string) {
if (this.#soloMode) return; // suppress outgoing awareness in solo mode
@ -416,7 +411,7 @@ export class RStackCollabOverlay extends HTMLElement {
selection,
username: this.#localUsername,
color: this.#localColor,
viewId: this.#effectiveViewId,
viewId: this.#viewId,
});
}
@ -624,8 +619,7 @@ export class RStackCollabOverlay extends HTMLElement {
if (peer.module) ctxParts.push(peer.module);
if (peer.context) ctxParts.push(peer.context);
const ctxStr = ctxParts.join(' · ');
const localView = this.#effectiveViewId;
const differentView = !!((localView || peer.viewId) && localView !== peer.viewId);
const differentView = !!(this.#viewId && peer.viewId && this.#viewId !== peer.viewId);
fragments.push(`
<div class="people-row${differentView ? ' different-view' : ''}">
<span class="dot" style="background:${peer.color}"></span>
@ -784,12 +778,10 @@ export class RStackCollabOverlay extends HTMLElement {
const now = Date.now();
const fragments: string[] = [];
// Deduplicate by username — only show the most recent cursor per user
const localView = this.#effectiveViewId;
for (const peer of this.#uniquePeers()) {
for (const peer of this.#peers.values()) {
if (!peer.cursor) continue;
// Only show cursors for peers on the same page/view
if ((localView || peer.viewId) && localView !== peer.viewId) continue;
// Skip peers viewing a different sub-document (e.g. different note in rDocs)
if (this.#viewId && peer.viewId && this.#viewId !== peer.viewId) continue;
const age = now - peer.lastSeen;
const opacity = age > 5000 ? 0.3 : 1;
@ -827,11 +819,10 @@ export class RStackCollabOverlay extends HTMLElement {
// Remove all existing focus rings from the document
document.querySelectorAll('.rstack-collab-focus-ring').forEach(el => el.remove());
const localView = this.#effectiveViewId;
for (const peer of this.#uniquePeers()) {
for (const peer of this.#peers.values()) {
if (!peer.selection) continue;
// Only show focus rings for peers on the same page/view
if ((localView || peer.viewId) && localView !== peer.viewId) continue;
// Skip peers viewing a different sub-document
if (this.#viewId && peer.viewId && this.#viewId !== peer.viewId) continue;
const target = this.#findCollabEl(peer.selection);
if (!target) continue;