import {Component, Input} from '@angular/core';
import {ModalController} from '@ionic/angular';

@Component({
  selector: 'editor-wysiwyg-modal',
  templateUrl: './wysiwyg-modal.component.html',
  styleUrls: ['./wysiwyg-modal.component.scss'],
})
export class WysiwygModalComponent {
  @Input() value = '';
  @Input() title: string;

  constructor(
      protected modals: ModalController,
  ) {}

  dismissModal() {
    this.modals.dismiss(this.value);
  }

  onContentsChanged(contents: string) {
    if ( this.value !== contents ) {
      this.value = contents;
    }
  }
}
