import { Controller } from '@hotwired/stimulus'; export default class extends Controller { connect() { const textarea = document.querySelector('textarea') const basePath = textarea.dataset.url const easyMde = new EasyMDE({ element: textarea, spellChecker: false, toolbar: [ 'bold', 'italic', 'heading-2', 'heading-3', '|', 'quote', 'unordered-list', 'ordered-list', 'table', '|', 'link', 'image', 'upload-image' ,'|', 'preview', 'side-by-side', 'fullscreen', '|', 'undo', 'redo', '|', 'guide' ], uploadImage:true, imageUploadEndpoint: basePath + '/upload-image', imagePathAbsolute: false, imageMaxSize: 1024 * 1024 * 100, previewImagesInEditor: true, }); } }