5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-15 08:31:42 +00:00

editor: arreglar bug de los espacios

This commit is contained in:
void 2021-02-02 17:00:42 +00:00
parent c5faba9a6b
commit 9514ff7e24

View file

@ -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"
}) })