editor: arreglar bug de los espacios
This commit is contained in:
parent
c5faba9a6b
commit
9514ff7e24
1 changed files with 2 additions and 11 deletions
|
@ -242,7 +242,8 @@ function hasContent (element) {
|
||||||
if (element.tagName === "IMG"
|
if (element.tagName === "IMG"
|
||||||
|| element.tagName === "AUDIO"
|
|| element.tagName === "AUDIO"
|
||||||
|| element.tagName === "VIDEO"
|
|| element.tagName === "VIDEO"
|
||||||
|| element.tagName === "IFRAME") return true
|
|| element.tagName === "IFRAME"
|
||||||
|
|| element.tagName === "BR") return true
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,16 +434,6 @@ function setupEditor (editorEl) {
|
||||||
|
|
||||||
const contentEl = editorEl.querySelector(".editor-content")
|
const contentEl = editorEl.querySelector(".editor-content")
|
||||||
|
|
||||||
contentEl.addEventListener("keydown", event => {
|
|
||||||
if (event.keyCode === 32) { // Espacio
|
|
||||||
event.preventDefault()
|
|
||||||
const sel = window.getSelection()
|
|
||||||
const range = sel.getRangeAt(0)
|
|
||||||
range.insertNode(document.createTextNode("\xa0"))
|
|
||||||
cleanContent(contentEl)
|
|
||||||
range.collapse()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
contentEl.addEventListener("paste", event => {
|
contentEl.addEventListener("paste", event => {
|
||||||
editorEl.querySelector(".editor-aviso-word").style.display = "block"
|
editorEl.querySelector(".editor-aviso-word").style.display = "block"
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue