From 1cdcde7a9eac1e89163e9a1a66b9feb5587f6118 Mon Sep 17 00:00:00 2001 From: jingrow Date: Fri, 14 Nov 2025 13:22:29 +0800 Subject: [PATCH] Add CustomDiv extension to preserve div tags and attributes in Jeditor --- .../core/pagetype/form/controls/Jeditor.vue | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/apps/jingrow/frontend/src/core/pagetype/form/controls/Jeditor.vue b/apps/jingrow/frontend/src/core/pagetype/form/controls/Jeditor.vue index a7fb10d..468e33d 100644 --- a/apps/jingrow/frontend/src/core/pagetype/form/controls/Jeditor.vue +++ b/apps/jingrow/frontend/src/core/pagetype/form/controls/Jeditor.vue @@ -73,6 +73,25 @@ const CustomDiv = Node.create({ name: 'customDiv', group: 'block', content: 'block*', + addAttributes() { + return { + class: { + default: null, + parseHTML: element => element.getAttribute('class'), + renderHTML: attributes => attributes.class ? { class: attributes.class } : {}, + }, + style: { + default: null, + parseHTML: element => element.getAttribute('style'), + renderHTML: attributes => attributes.style ? { style: attributes.style } : {}, + }, + id: { + default: null, + parseHTML: element => element.getAttribute('id'), + renderHTML: attributes => attributes.id ? { id: attributes.id } : {}, + }, + } + }, parseHTML() { return [ {