Add CustomDiv extension to preserve div tags and attributes in Jeditor

This commit is contained in:
jingrow 2025-11-14 13:22:29 +08:00
parent ffc10a7089
commit 1cdcde7a9e

View File

@ -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 [
{