diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-01-13 20:26:38 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2021-01-13 21:34:03 +0300 |
commit | 12b42d11f977f4895cb782dd0bcdfc756e9e6187 (patch) | |
tree | e799aed117ecc8e30c9bd6e29c4156791f976bbd /src | |
parent | 49f2f80fa4c31acd7e91599110c7c123c41b6924 (diff) |
Always use the updated color depending on the guest name
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/components/EditorWrapper.vue | 7 | ||||
-rw-r--r-- | src/extensions/UserColor.js | 5 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/components/EditorWrapper.vue b/src/components/EditorWrapper.vue index 6b5e65a3b..50331592a 100644 --- a/src/components/EditorWrapper.vue +++ b/src/components/EditorWrapper.vue @@ -302,7 +302,6 @@ export default { this.syncError = null this.tiptap.setOptions({ editable: !this.readOnly }) - }) .on('loaded', ({ documentSource }) => { this.hasConnectionIssue = false @@ -483,6 +482,12 @@ export default { updateSessions(sessions) { this.sessions = sessions.sort((a, b) => b.lastContact - a.lastContact) + + // Make sure we get our own session updated + // This should ideally be part of a global store where we can have that updated on the actual name change for guests + const currentUpdatedSession = this.sessions.find(session => session.id === this.currentSession.id) + Vue.set(this, 'currentSession', currentUpdatedSession) + const currentSessionIds = this.sessions.map((session) => session.userId) const currentGuestIds = this.sessions.map((session) => session.guestId) diff --git a/src/extensions/UserColor.js b/src/extensions/UserColor.js index 2dd786b18..d359b3443 100644 --- a/src/extensions/UserColor.js +++ b/src/extensions/UserColor.js @@ -73,10 +73,11 @@ export default class UserColor extends Extension { .filter(span => typeof tState.commits[span.commit]?.author?.color !== 'undefined') .map(span => { const commit = tState.commits[span.commit] + const clientID = commit.author.clientID return Decoration.inline(span.from, span.to, { class: 'author-annotation', - style: 'background-color: ' + commit.author.color + 'ee;', - title: commit.author.name, + style: 'background-color: ' + this.spec.color(clientID) + 'ee;', + title: this.spec.name(clientID), }) }).filter(dec => dec !== null) return { tracked, deco: DecorationSet.create(state.doc, decos) } |