<commit_before>/* global Firepad */
/* global Firebase */
/* global ace */

import '../mode-html';
import '../theme-chrome';



export class HtmlEditor {

  constructor(eventAggregator) {
        this.eventAggregator = eventAggregator;
    }
    
  activate(params) {
    if (params.id) {
      this.pastebinId = params.id;
    } 
  }
  attached(params) {
    if (params.id) {
      this.pastebinId = params.id;
    }

    this.pastebinId = params.id;

    let editor = ace.edit('aceHtmlEditorDiv');
    this.configureEditor(editor);
    
    this.editor = editor;

    let session = editor.getSession();
    this.configureSession(session);

    let selection = editor.getSelection();

    this.session = session;
    this.selection = selection;
    this.firepad = this.createFirepad(editor);        
    this.setupSessionEvents(session);
  }
 
    

  configureEditor(editor) {
    editor.setTheme('ace/theme/chrome');
    editor.setShowFoldWidgets(false);
  }

  configureSession(session) {
    session.setUseWrapMode(true);
    session.setUseWorker(false);
    session.setMode('ace/mode/html');
  } 

  createFirepad(editor) {
    let baseURL = 'https://seecoderun.firebaseio.com';
    let firebase = new Firebase(baseURL + '/' + this.pastebinId + '/content/html');
var firepad = Firepad.fromACE(firebase, editor, 
    { defaultText: '<!DOCTYPE html>\n<html>\n<head>\n\t<meta charset="utf-8">\n\t<title>Coode</title>\n</head>\n'
            + '<body>\n\n</body>\n</html>' });
  }
<commit_msg> fix html-viewer firpad return statement<commit_after>/* global Firepad */
/* global Firebase */
/* global ace */

import '../mode-html';
import '../theme-chrome';



export class HtmlEditor {

  constructor(eventAggregator) {
        this.eventAggregator = eventAggregator;
    }
    
  activate(params) {
    if (params.id) {
      this.pastebinId = params.id;
    } 
  }
  attached(params) {
    if (params.id) {
      this.pastebinId = params.id;
    }

    this.pastebinId = params.id;

    let editor = ace.edit('aceHtmlEditorDiv');
    this.configureEditor(editor);
    
    this.editor = editor;

    let session = editor.getSession();
    this.configureSession(session);

    let selection = editor.getSelection();

    this.session = session;
    this.selection = selection;
    this.firepad = this.createFirepad(editor);        
    this.setupSessionEvents(session);
  }
 
    

  configureEditor(editor) {
    editor.setTheme('ace/theme/chrome');
    editor.setShowFoldWidgets(false);
  }

  configureSession(session) {
    session.setUseWrapMode(true);
    session.setUseWorker(false);
    session.setMode('ace/mode/html');
  } 

  createFirepad(editor) {
    let baseURL = 'https://seecoderun.firebaseio.com';
    let firebase = new Firebase(baseURL + '/' + this.pastebinId + '/content/html');
  return Firepad.fromACE(firebase, editor, 
    { defaultText: '<!DOCTYPE html>\n<html>\n<head>\n\t<meta charset="utf-8">\n\t<title>Coode</title>\n</head>\n'
            + '<body>\n\n</body>\n</html>' });
  }

{'fraction_non_alphanumeric': 0.15272244355909695, 'fraction_numerical': 0.0006640106241699867, 'mean_word_length': 2.9592641261498027, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 2, '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': '900684', 'n_tokens_mistral': 1017, 'n_tokens_neox': 980, 'n_words': 154}