From 922da5cf33caea341bfb536ac593d6716e363336 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Thu, 26 Jun 2025 09:51:34 -0400 Subject: [PATCH] debug: add more detailed logging to trace content structure issue --- src/lib/components/admin/composer/ComposerCore.svelte | 11 +++++++++-- src/lib/components/edra/editor.ts | 10 ++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/lib/components/admin/composer/ComposerCore.svelte b/src/lib/components/admin/composer/ComposerCore.svelte index eda35ef..d48ae7b 100644 --- a/src/lib/components/admin/composer/ComposerCore.svelte +++ b/src/lib/components/admin/composer/ComposerCore.svelte @@ -164,11 +164,18 @@ // Watch for external data changes and update editor let lastDataString = ''; $effect(() => { - if (editor && data) { + if (editor && data && data.content) { console.log('ComposerCore effect - data received:', data); + // Validate content structure + const isValidContent = data.type === 'doc' && Array.isArray(data.content); + if (!isValidContent) { + console.error('ComposerCore effect - invalid content structure:', data); + return; + } + // Check if the data has actual content (not just empty doc) - const hasContent = data.content && data.content.length > 0 && + const hasContent = data.content.length > 0 && !(data.content.length === 1 && data.content[0].type === 'paragraph' && !data.content[0].content); console.log('ComposerCore effect - hasContent:', hasContent); diff --git a/src/lib/components/edra/editor.ts b/src/lib/components/edra/editor.ts index 7f2ddd8..e2f4715 100644 --- a/src/lib/components/edra/editor.ts +++ b/src/lib/components/edra/editor.ts @@ -32,6 +32,16 @@ export const initiateEditor = ( options?: Partial, placeholder?: string ): Editor => { + console.log('initiateEditor called with:', { + element, + content, + contentType: typeof content, + limit, + hasExtensions: !!extensions, + hasOptions: !!options, + placeholder + }); + const editor = new Editor({ element: element, content: content,