From 2d8507369bc59bb0758384afa4b42dc034b37125 Mon Sep 17 00:00:00 2001 From: void Date: Fri, 26 Mar 2021 15:57:07 +0000 Subject: [PATCH] editor: mantener text nodes solo cuando tienen texto --- app/javascript/editor/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/editor/types.ts b/app/javascript/editor/types.ts index 3c215a8..0e75081 100644 --- a/app/javascript/editor/types.ts +++ b/app/javascript/editor/types.ts @@ -62,7 +62,7 @@ export function getValidChildren (node: Element, type: EditorNode): Node[] { return [...node.childNodes].filter(n => { // si permite texto y esto es un texto, es válido if (n.nodeType === Node.TEXT_NODE) - return type.allowedChildren.includes('text') + return type.allowedChildren.includes('text') && n.textContent?.length // si no es un elemento, no es válido if (!(n instanceof Element))