From 03120d4fe20f7f80073fe834f81349be423f4eb8 Mon Sep 17 00:00:00 2001 From: Richard Mann Date: Tue, 10 Oct 2023 17:41:44 +0100 Subject: [PATCH] This change allows the final HTML that is output from the editors using this plugin, to then consume/import/open said HTML content again and recognise the custom-code blocks that you previsouly added. This has been important for my project due to limitation preventing me from running the editor off of the Component JSON Data. --- src/blocks.ts | 2 +- src/components.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/blocks.ts b/src/blocks.ts index c888c6c..ff41233 100644 --- a/src/blocks.ts +++ b/src/blocks.ts @@ -15,7 +15,7 @@ export default (editor: Editor, { blockCustomCode }: PluginOptions = {}) => { category: 'Extra', activate: true, select: true, - content: { type: typeCustomCode }, + content: { type: typeCustomCode, attributes: { class: 'grapes-custom-code' } }, ...blockCustomCode }); } diff --git a/src/components.ts b/src/components.ts index bf4b16f..9a519c3 100644 --- a/src/components.ts +++ b/src/components.ts @@ -18,6 +18,7 @@ export default (editor: Editor, opts: PluginOptions = {}) => { }); Components.addType(typeCustomCode, { + isComponent: el => el.className === 'grapes-custom-code', model: { defaults: { name: 'Custom Code',