Skip to content

Commit

Permalink
[codemirror] update shared cursor css
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonad committed Apr 14, 2020
1 parent 073d440 commit c4b9785
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 44 deletions.
25 changes: 18 additions & 7 deletions codemirror/codemirror.html
Expand Up @@ -7,16 +7,18 @@
<link rel=stylesheet href="https://codemirror.net/lib/codemirror.css" async defer>
<style>
.remote-caret {
position: absolute;
border-left: black;
border-left-style: solid;
border-left-width: 2px;
height: 1em;
position: relative;
border-left: 1px solid black;
border-right: 1px solid black;
margin-left: -1px;
margin-right: -1px;
box-sizing: border-box;
}
.remote-caret > div {
position: relative;
position: absolute;
top: -1.05em;
font-size: 13px;
left: -1px;
font-size: .6em;
background-color: rgb(250, 129, 0);
font-family: serif;
font-style: normal;
Expand All @@ -27,6 +29,15 @@
padding-left: 2px;
padding-right: 2px;
z-index: 3;
transition: opacity .3s ease-in-out;
}
.remote-caret.hide-name > div {
transition-delay: .7s;
opacity: 0;
}
.remote-caret:hover > div {
opacity: 1;
transition-delay: 0s;
}
</style>
</head>
Expand Down
4 changes: 2 additions & 2 deletions codemirror/codemirror.js
Expand Up @@ -4,7 +4,7 @@
import CodeMirror from 'codemirror'
import * as Y from 'yjs'
import { WebsocketProvider } from 'y-websocket'
import { CodeMirrorBinding } from 'y-codemirror'
import { CodemirrorBinding } from 'y-codemirror'
import 'codemirror/mode/javascript/javascript.js'

window.addEventListener('load', () => {
Expand All @@ -24,7 +24,7 @@ window.addEventListener('load', () => {
lineNumbers: true
})

const binding = new CodeMirrorBinding(yText, editor, provider.awareness)
const binding = new CodemirrorBinding(yText, editor, provider.awareness)

const connectBtn = /** @type {HTMLElement} */ (document.getElementById('y-connect-btn'))
connectBtn.addEventListener('click', () => {
Expand Down
38 changes: 19 additions & 19 deletions codemirror/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion codemirror/package.json
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"codemirror": "^5.52.2",
"serve": "^11.2.0",
"y-codemirror": "^1.0.6",
"y-codemirror": "^2.0.0",
"y-websocket": "^1.2.4",
"yjs": "^13.0.0",
"webpack": "^4.41.2",
Expand Down
42 changes: 30 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -29,9 +29,9 @@
"standard": "^12.0.1",
"tiptap-demo": "./tiptap",
"ws": "^7.2.3",
"y-protocols": "^0.2.2",
"y-websocket": "^1.2.4",
"yjs": "^13.0.4"
"y-protocols": "^0.2.3",
"y-websocket": "^1.2.5",
"yjs": "^13.0.5"
},
"engines": {
"node": "^12.0.0"
Expand Down

0 comments on commit c4b9785

Please sign in to comment.