easymde_controller.js 861 B

1234567891011121314151617181920212223242526
  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', 'table', '|',
  10. 'link', 'image', 'upload-image' ,'|',
  11. 'preview', 'side-by-side', 'fullscreen', '|',
  12. 'undo', 'redo', '|',
  13. 'guide'
  14. ],
  15. uploadImage:true,
  16. imageUploadEndpoint: '/upload-image',
  17. imagePathAbsolute: false,
  18. imageMaxSize: 1024 * 1024 * 100,
  19. imagePreviewInEditor: true,
  20. imagesPreviewHandler: true
  21. });
  22. }
  23. }