Sha256: 5014c3abdd100fdba634143c1a3bc783dbde305af523b1fc635ac8c57ae2f57f

Contents?: true

Size: 492 Bytes

Versions: 2

Compression:

Stored size: 492 Bytes

Contents

/* global Trestle, tinymce */

export default class extends Trestle.ApplicationController {
  static values = {
    configuration: {
      type: String,
      default: 'default'
    }
  }

  connect () {
    tinymce.init({
      target: this.element,
      ...this.configuration
    })
  }

  disconnect () {
    const editor = tinymce.get(this.element.id)

    if (editor) {
      editor.remove()
    }
  }

  get configuration () {
    return Trestle.TinyMCE[this.configurationValue]
  }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
trestle-tinymce-0.4.0 frontend/js/controllers/tinymce_controller.js
trestle-tinymce-0.4.0.pre2 frontend/js/controllers/tinymce_controller.js