비디오
All checks were successful
LocalNet_front/pipeline/head This commit looks good

This commit is contained in:
nevermoregb 2025-04-08 21:22:33 +09:00
parent 23525d5ba1
commit 1b354d464c

View File

@ -132,14 +132,26 @@
initCheckImageIndex();
}
// .
//
quillInstance.getModule('toolbar').addHandler('video', () => {
const url = prompt('영상 URL을 입력하세요:');
if (url) {
// iframe
const index = quillInstance.getSelection().index; //
quillInstance.insertEmbed(index, 'video', url);
quillInstance.setSelection(index + 1); //
const url = prompt('iframe 태그가 포함된 주소를 입력해 주세요:');
if (url && url.indexOf('<iframe') != -1) {
//debugger;
// <iframe width="560" height="315" src="https://www.youtube.com/embed/-nSHIYz5SOM?si=o5aVCkG8CfCeNvHY" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
//
// DOMParser embeded url
const parser = new DOMParser();
const doc = parser.parseFromString(url, 'text/html');
const iframeEL = doc.querySelector('iframe');
const src = iframeEL.getAttribute('src');
const width = iframeEL.getAttribute('width');
const height = iframeEL.getAttribute('height');
//
const index = quillInstance.getSelection().index;
quillInstance.insertEmbed(index, 'video', src);
quillInstance.setSelection(index + 1);
}
});