all files / ui/ CursorComponent.js

0% Statements 0/8
0% Branches 0/2
0% Functions 0/1
0% Lines 0/8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27                                                     
import Component from './Component'
 
class CursorComponent extends Component {
 
  render($$) {
    // TODO: we should rename se-cursor to sc-cursor
    let el = $$('span').addClass('se-cursor')
    // Add zero-width character. Since we have a non-empty element, the
    // outline style set on the cursor would not be visible in certain
    // scenarios (e.g. when cursor is at the very beginning of a text.
    el.append("\uFEFF")
    el.append($$('div').addClass('se-cursor-inner'))
 
    if (this.props.collaborator) {
      let collaboratorIndex = this.props.collaborator.colorIndex
      el.addClass('sm-collaborator-'+collaboratorIndex)
    } else {
      el.addClass('sm-local-user')
    }
 
    return el
  }
 
}
 
export default CursorComponent