New dashboard look & feel
[src/xds/xds-agent.git] / webapp / src / app / @theme / components / tiny-mce / tiny-mce.component.ts
1 import { Component, OnDestroy, AfterViewInit, Output, EventEmitter, ElementRef } from '@angular/core';
2
3 @Component({
4   selector: 'ngx-tiny-mce',
5   template: '',
6 })
7 export class TinyMCEComponent implements OnDestroy, AfterViewInit {
8
9   @Output() editorKeyup = new EventEmitter<any>();
10
11   editor: any;
12
13   constructor(private host: ElementRef) { }
14
15   ngAfterViewInit() {
16     tinymce.init({
17       target: this.host.nativeElement,
18       plugins: ['link', 'paste', 'table'],
19       skin_url: 'assets/skins/lightgray',
20       setup: editor => {
21         this.editor = editor;
22         editor.on('keyup', () => {
23           this.editorKeyup.emit(editor.getContent());
24         });
25       },
26       height: '320',
27     });
28   }
29
30   ngOnDestroy() {
31     tinymce.remove(this.editor);
32   }
33 }