diff --git a/src/components/editor/QEditor.vue b/src/components/editor/QEditor.vue index 86b9cde..7f2c826 100644 --- a/src/components/editor/QEditor.vue +++ b/src/components/editor/QEditor.vue @@ -138,17 +138,20 @@ // 영상 넣기 quillInstance.getModule('toolbar').addHandler('video', () => { const url = prompt('YouTube 영상 URL을 입력하세요:'); - let src = ''; - if (!url || url.trim() == '') return; // 일반 youtube url - if (url.indexOf('watch?v=') != -1) { + if (url.indexOf('watch?v=') !== -1) { src = url.replace('watch?v=', 'embed/'); + // youtu.be 단축 URL (ex : https://youtu.be/CfiojceAaeQ?si=G7eM56sdDjIEw-Tz) + } else if (url.indexOf('youtu.be/') !== -1) { + const videoId = url.split('youtu.be/')[1].split('?')[0]; + src = `https://www.youtube.com/embed/${videoId}`; + // iframe 주소 - } else if (url.indexOf('