From 2c20abc87245160229a48a8813df1c0c077a369e Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Mon, 4 Sep 2023 11:25:05 +0100 Subject: [PATCH] WYSIWYG: Fixed filtering issue causing broken page edits Could error upon div elements without classes, including drawings. Related to #4510 and #4509 --- resources/js/wysiwyg/filters.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/js/wysiwyg/filters.js b/resources/js/wysiwyg/filters.js index 4dd600630..dee5df4c2 100644 --- a/resources/js/wysiwyg/filters.js +++ b/resources/js/wysiwyg/filters.js @@ -24,7 +24,9 @@ function setupBrFilter(editor) { function setupPointerFilter(editor) { editor.parser.addNodeFilter('div', nodes => { for (const node of nodes) { - if (node.attr('id') === 'pointer' || node.attr('class').includes('pointer')) { + const id = node.attr('id') || ''; + const nodeClass = node.attr('class') || ''; + if (id === 'pointer' || nodeClass.includes('pointer')) { node.remove(); } }