<commit_before>class CollaborativeEditorPane extends Pane

  constructor: (options = {}, data) ->

    super options, data

    log "i am a CollaborativeEditorPane and my session key is #{options.sessionKey}" if options.sessionKey

    @container = new KDView

    @container.on "viewAppended", =>
      @codeMirrorEditor = CodeMirror @container.getDomElement()[0],
        lineNumbers     : yes
        mode            : "javascript"

      panel       = @getDelegate()
      workspace   = panel.getDelegate()
      @sessionKey = @getOptions().sessionKey or @createSessionKey()
      ref         = workspace.firepadRef.child @sessionKey
      @firepad    = Firepad.fromCodeMirror ref, @codeMirrorEditor

      @firepad.on "ready", =>
        if @firepad.isHistoryEmpty()
          @firepad.setText "" # fix for a firepad bug

  createSessionKey: ->
    nick = KD.nick()
    u    = KD.utils
    return "#{nick}:#{u.generatePassword(4)}:#{u.getRandomNumber(100)}"

  pistachio: ->
    """
      {{> @header}}
      {{> @container}}
    """<commit_msg>Workspace: Added setContent method to EditorPane.<commit_after>class CollaborativeEditorPane extends Pane

  constructor: (options = {}, data) ->

    super options, data

    log "i am a CollaborativeEditorPane and my session key is #{options.sessionKey}" if options.sessionKey

    @container = new KDView

    @container.on "viewAppended", =>
      @codeMirrorEditor = CodeMirror @container.getDomElement()[0],
        lineNumbers     : yes
        mode            : "javascript"

      panel       = @getDelegate()
      workspace   = panel.getDelegate()
      @sessionKey = @getOptions().sessionKey or @createSessionKey()
      ref         = workspace.firepadRef.child @sessionKey
      @firepad    = Firepad.fromCodeMirror ref, @codeMirrorEditor

      @firepad.on "ready", =>
        if @firepad.isHistoryEmpty()
          @firepad.setText "" # fix for a firepad bug

  setContent: (content) ->
    @firepad.setText content

  createSessionKey: ->
    nick = KD.nick()
    u    = KD.utils
    return "#{nick}:#{u.generatePassword(4)}:#{u.getRandomNumber(100)}"

  pistachio: ->
    """
      {{> @header}}
      {{> @container}}
    """
{'fraction_non_alphanumeric': 0.12539899680802555, 'fraction_numerical': 0.004559963520291838, 'mean_word_length': 2.675041876046901, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '830083', 'n_tokens_mistral': 664, 'n_tokens_neox': 626, 'n_words': 149}