diff --git a/src/components/editor/QEditor.vue b/src/components/editor/QEditor.vue index 5caca78..321f170 100644 --- a/src/components/editor/QEditor.vue +++ b/src/components/editor/QEditor.vue @@ -57,21 +57,16 @@ import Quill from 'quill'; import 'quill/dist/quill.snow.css'; import { onMounted, ref, watch, defineEmits, defineProps } from 'vue'; import $api from '@api'; - -// props로 title과 isAlert를 받습니다. const props = defineProps({ isAlert: { - value:true, type: Boolean, default: false, }, }); - const editor = ref(null); const font = ref('nanum-gothic'); const fontSize = ref('16px'); const emit = defineEmits(['update:data']); - onMounted(() => { const Font = Quill.import('formats/font'); Font.whitelist = ['nanum-gothic', 'd2coding', 'consolas', 'serif', 'monospace']; @@ -91,11 +86,9 @@ onMounted(() => { syntax: true, }, }); - quillInstance.format('font', font.value); quillInstance.format('size', fontSize.value); - // When content changes, send the Delta object quillInstance.on('text-change', () => { const delta = quillInstance.getContents(); // Get Delta format emit('update:data', delta); @@ -111,11 +104,9 @@ onMounted(() => { quillInstance.getModule('toolbar').addHandler('image', () => { selectLocalImage(); }); - quillInstance.on('text-change', (delta, oldDelta, source) => { // Emit Delta when content changes emit('update:data', quillInstance.getContents()); - delta.ops.forEach(op => { if (op.insert && typeof op.insert === 'object' && op.insert.image) { const imageUrl = op.insert.image; @@ -125,13 +116,11 @@ onMounted(() => { } }); }); - async function selectLocalImage() { const input = document.createElement('input'); input.setAttribute('type', 'file'); input.setAttribute('accept', 'image/*'); input.click(); - input.onchange = () => { const file = input.files[0]; if (file) { @@ -152,7 +141,6 @@ onMounted(() => { } }; } - async function uploadImageToServer(formData) { try { const response = await $api.post('quilleditor/upload', formData, { isFormData: true }); @@ -163,7 +151,6 @@ onMounted(() => { throw error; } } - function checkForDeletedImages() { const editorImages = document.querySelectorAll('#editor img'); const currentImages = new Set(Array.from(editorImages).map(img => img.src)); @@ -176,10 +163,8 @@ onMounted(() => { } }); -