import Quill from 'quill'; export default class FileUploader { quill; constructor(quill) { this.quill = quill; } // 파일 추가 selectFile() { const input = document.createElement('input'); input.type = 'file'; input.onchange = () => { if (!input.files) { return; } const file = input.files[0]; if (!file) { return; } const range = this.quill.getSelection() || { index: 0}; if (range) { this.quill.insertEmbed(range.index, 'fileCard', { name: file.name, size: file.size }, Quill.sources.USER); this.quill.setSelection(range.index + 1); } }; input.click(); } // 첨부 파일 활성화 삭제 clearActiveCards() { this.quill.root.querySelectorAll('.file-card.active').forEach(el => el.classList.remove('active')); } }