Sha256: 233c666d714ede89517ee95cc75f4bf40266d9dbd83e1fa64e118e96b680de7a
Contents?: true
Size: 738 Bytes
Versions: 20
Compression:
Stored size: 738 Bytes
Contents
import { Controller } from '@hotwired/stimulus' import EasyMDE from 'easymde' export default class extends Controller { static targets = ['element'] get view() { return this.elementTarget.dataset.view } get componentOptions() { try { return JSON.parse(this.elementTarget.dataset.componentOptions) } catch (error) { return {} } } connect() { const options = { element: this.elementTarget, spellChecker: this.componentOptions.spell_checker, } if (this.view === 'show') { options.toolbar = false options.status = false } const easyMde = new EasyMDE(options) if (this.view === 'show') { easyMde.codemirror.options.readOnly = true } } }
Version data entries
20 entries across 20 versions & 1 rubygems