poder editar videos

This commit is contained in:
f 2020-11-17 17:36:55 -03:00
parent dbd64457e1
commit 1f28ea77a0
2 changed files with 13 additions and 2 deletions

View file

@ -92,7 +92,6 @@ const blocks = {
selector: "AUDIO", selector: "AUDIO",
createFn: editorEl => { createFn: editorEl => {
const el = document.createElement("AUDIO") const el = document.createElement("AUDIO")
el.controls = true
return el return el
}, },
}, },
@ -100,7 +99,13 @@ const blocks = {
selector: "VIDEO", selector: "VIDEO",
createFn: editorEl => { createFn: editorEl => {
const el = document.createElement("VIDEO") const el = document.createElement("VIDEO")
el.controls = true el.poster = "/public/placeholder.png"
// Para poder seleccionar el video tenemos que sacarle los
// controles, pero queremos poder verlos para reproducir el video.
// Al hacer click le damos los controles y al salir se los sacamos
// para poder hacer click de vuelta
el.addEventListener('click', event => event.target.controls = true)
el.addEventListener('focusout', event => event.target.controls = false)
return el return el
}, },
}, },
@ -283,6 +288,7 @@ const typesWithProperties = {
const file = videoFileEl.files[0] const file = videoFileEl.files[0]
videoEl.poster = ""
videoEl.src = URL.createObjectURL(file) videoEl.src = URL.createObjectURL(file)
videoEl.dataset.editorLoading = true videoEl.dataset.editorLoading = true
uploadFile(file) uploadFile(file)

View file

@ -462,6 +462,11 @@ function setupEditor (editorEl) {
document.addEventListener(editorBtn("video"), () => setAuxiliaryToolbar(editorEl, "video")) document.addEventListener(editorBtn("video"), () => setAuxiliaryToolbar(editorEl, "video"))
document.addEventListener(editorBtn("pdf"), () => setAuxiliaryToolbar(editorEl, "pdf")) document.addEventListener(editorBtn("pdf"), () => setAuxiliaryToolbar(editorEl, "pdf"))
for (const video of document.querySelectorAll('.editor .editor-content video')) {
video.addEventListener('click', event => event.target.controls = true)
video.addEventListener('focusout', event => event.target.controls = false)
}
cleanContent(contentEl) cleanContent(contentEl)
htmlEl.value = contentEl.innerHTML htmlEl.value = contentEl.innerHTML
fixContent(contentEl) fixContent(contentEl)