Sha256: c7114f57eb96af6a549aaf9d069dc14180844af1772c3d66864a1d2a892664ba

Contents?: true

Size: 553 Bytes

Versions: 4

Compression:

Stored size: 553 Bytes

Contents

import { Controller } from 'stimulus'
import SimpleMDE from 'simplemde'

export default class extends Controller {
  static targets = ['element']

  get view() {
    return this.elementTarget.dataset.view
  }

  connect() {
    const options = {
      element: this.elementTarget,
      spellChecker: false,
    }

    if (this.view === 'show') {
      options.toolbar = false
      options.status = false
    }

    const simpleMde = new SimpleMDE(options)
    if (this.view === 'show') {
      simpleMde.codemirror.options.readOnly = true
    }
  }
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
avo-1.2.11.pre.4 app/packs/js/controllers/fields/simple_mde_controller.js
avo-1.2.11.pre.3 app/packs/js/controllers/fields/simple_mde_controller.js
avo-1.2.11.pre.2 app/packs/js/controllers/fields/simple_mde_controller.js
avo-1.2.11.pre.1 app/packs/js/controllers/fields/simple_mde_controller.js