Skip to content

Commit

Permalink
feat(collab): update remote user cursor style
Browse files Browse the repository at this point in the history
  • Loading branch information
nonumpa committed Jun 28, 2023
1 parent 2c688db commit 090b76a
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions components/Collaborate/Prosemirror.css
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,41 @@ li.ProseMirror-selectednode:after {
color: #aaa;
position: absolute;
}

/* Ref: https://github.com/yjs/y-prosemirror#remote-cursors
this is a rough fix for the first cursor position when the first paragraph is empty */
.ProseMirror > .ProseMirror-yjs-cursor:first-child {
margin-top: 16px;
}
.ProseMirror p:first-child, .ProseMirror h1:first-child, .ProseMirror h2:first-child, .ProseMirror h3:first-child, .ProseMirror h4:first-child, .ProseMirror h5:first-child, .ProseMirror h6:first-child {
margin-top: 16px
}
/* This gives the remote user caret. The colors are automatically overwritten*/
.ProseMirror-yjs-cursor {
position: relative;
margin-left: -1px;
margin-right: -1px;
border-left: 1px solid black;
border-right: 1px solid black;
border-color: orange;
word-break: normal;
pointer-events: none;
}
/* This renders the username above the caret */
.ProseMirror-yjs-cursor > div {
position: absolute;
top: -1.05em;
left: -1px;
font-size: 13px;
background-color: rgb(250, 129, 0);
font-family: serif;
font-style: normal;
font-weight: normal;
line-height: normal;
user-select: none;
color: white;
padding-left: 2px;
padding-right: 2px;
white-space: nowrap;
}

0 comments on commit 090b76a

Please sign in to comment.