Skip to content

Commit

Permalink
fix line selection in Firefox #16
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonad committed May 11, 2021
1 parent e780685 commit 8b40d48
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/y-codemirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,16 @@ const createRemoteCaret = (username, color) => {
}

const createEmptyLinePlaceholder = (color) => {
const el = document.createElement('span')
el.setAttribute('class', 'y-line-selection')
el.setAttribute('style', `display: inline-block; position: absolute; left: 4px; right: 4px; top: 0; bottom: 0; background-color: ${color}70`)
return el
const placeholder = document.createElement('span')
placeholder.setAttribute('style', 'user-select: none;')
const emptyTxt = document.createElement('span')
emptyTxt.insertBefore(document.createTextNode(''), null)
const sel = document.createElement('span')
sel.setAttribute('class', 'y-line-selection')
sel.setAttribute('style', `display: inline-block; position: absolute; left: 4px; right: 4px; top: 0; bottom: 0; background-color: ${color}70`)
placeholder.insertBefore(sel, null)
placeholder.insertBefore(emptyTxt, null)
return placeholder
}

const updateRemoteSelection = (y, cm, type, cursors, clientId, awareness) => {
Expand Down

0 comments on commit 8b40d48

Please sign in to comment.