easymde_controller.js 815 B

12345678910111213141516171819202122232425
  1. import { Controller } from '@hotwired/stimulus';
  2. export default class extends Controller {
  3. connect() {
  4. const easyMde = new EasyMDE({
  5. element: document.querySelector('textarea'),
  6. spellChecker: false,
  7. toolbar: [
  8. 'bold', 'italic', 'heading-2', 'heading-3', '|',
  9. 'quote', 'unordered-list', 'ordered-list', '|',
  10. 'link', 'image', 'upload-image' ,'|',
  11. 'preview', 'side-by-side', 'fullscreen', '|',
  12. 'guide'
  13. ],
  14. uploadImage:true,
  15. imageUploadEndpoint: '/upload-image',
  16. imagePathAbsolute: false,
  17. imageMaxSize: 1024 * 1024 * 100,
  18. imagePreviewInEditor: true,
  19. imagesPreviewHandler: true
  20. });
  21. }
  22. }