<commit_before>import { Component, View, CORE_DIRECTIVES, EventEmitter } from 'angular2/angular2';
import { Client } from "src/services/api";

declare var tinymce;

@Component({
  selector: 'minds-tinymce',
  properties: [ '_content: content' ],
  events: [ 'update: contentChange' ]
})
@View({
  template: `
    <textarea>{{content}}</textarea>
  `,
  directives: [ CORE_DIRECTIVES ]
})

export class MindsTinymce {

  editor : any;
  ready : boolean = false;
  content = "";
  update = new EventEmitter();
  timeout;

  constructor(public client : Client) {
    this.init();
  }

  init(){
    var self = this;
    tinymce.init({
      selector:'minds-tinymce > textarea',
      format: 'raw',
      menubar: false,
      toolbar: "styleselect | bold italic underline textcolor | alignleft aligncenter alignright alignjustify | bullist numlist | link image media | code",
      statusbar: false,
      plugins: [
	         "advlist autolink link image lists preview hr anchor pagebreak",
	         "media nonbreaking code",
	         "table directionality autoresize"
	    ],
      setup: (ed) => {

        this.editor = ed;

        ed.on('change', (e) => {
          this.content = ed.getContent();
          this.update.next(ed.getContent());
        })

      }
    });
  }

  onDestroy(){
   if(tinymce)
    tinymce.remove('minds-tinymce > textarea');
    this.content = "";
    this.ready = false;
  }

  set _content(value : string){
    new Promise((resolve, reject) => {<commit_msg>(fix): tinymce updates<commit_after>import { Component, View, CORE_DIRECTIVES, EventEmitter } from 'angular2/angular2';
import { Client } from "src/services/api";

declare var tinymce;

@Component({
  selector: 'minds-tinymce',
  properties: [ '_content: content' ],
  events: [ 'update: contentChange' ]
})
@View({
  template: `
    <textarea>{{content}}</textarea>
  `,
  directives: [ CORE_DIRECTIVES ]
})

export class MindsTinymce {

  editor : any;
  ready : boolean = false;
  content = "";
  update = new EventEmitter();
  timeout;

  constructor(public client : Client) {
    this.init();
  }

  init(){
    var self = this;
    tinymce.init({
      selector:'minds-tinymce > textarea',
      format: 'raw',
      menubar: false,
      toolbar: "styleselect | bold italic underline textcolor | alignleft aligncenter alignright alignjustify | bullist numlist | link image media | code",
      statusbar: false,
      plugins: [
	         "advlist autolink link image lists preview hr anchor pagebreak",
	         "media nonbreaking code",
	         "table directionality autoresize"
	    ],
      setup: (ed) => {

        this.editor = ed;

        ed.on('change', (e) => {
          this.content = ed.getContent();
          this.update.next(ed.getContent());
        })

        ed.on('keyup', (e) => {
          this.content = ed.getContent();
          this.update.next(ed.getContent());
        })

      }
    });
  }

  onDestroy(){
   if(tinymce)
    tinymce.remove('minds-tinymce > textarea');
    this.content = "";
    this.ready = false;
  }

  set _content(value : string){
    new Promise((resolve, reject) => {
{'fraction_non_alphanumeric': 0.13970588235294118, 'fraction_numerical': 0.0012787723785166241, 'mean_word_length': 2.711743772241993, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2348747', 'n_tokens_mistral': 1020, 'n_tokens_neox': 976, 'n_words': 231}