debug: add more detailed logging to trace content structure issue
This commit is contained in:
parent
7211ccff9f
commit
922da5cf33
2 changed files with 19 additions and 2 deletions
|
|
@ -164,11 +164,18 @@
|
||||||
// Watch for external data changes and update editor
|
// Watch for external data changes and update editor
|
||||||
let lastDataString = '';
|
let lastDataString = '';
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if (editor && data) {
|
if (editor && data && data.content) {
|
||||||
console.log('ComposerCore effect - data received:', data);
|
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)
|
// 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);
|
!(data.content.length === 1 && data.content[0].type === 'paragraph' && !data.content[0].content);
|
||||||
|
|
||||||
console.log('ComposerCore effect - hasContent:', hasContent);
|
console.log('ComposerCore effect - hasContent:', hasContent);
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,16 @@ export const initiateEditor = (
|
||||||
options?: Partial<EditorOptions>,
|
options?: Partial<EditorOptions>,
|
||||||
placeholder?: string
|
placeholder?: string
|
||||||
): Editor => {
|
): Editor => {
|
||||||
|
console.log('initiateEditor called with:', {
|
||||||
|
element,
|
||||||
|
content,
|
||||||
|
contentType: typeof content,
|
||||||
|
limit,
|
||||||
|
hasExtensions: !!extensions,
|
||||||
|
hasOptions: !!options,
|
||||||
|
placeholder
|
||||||
|
});
|
||||||
|
|
||||||
const editor = new Editor({
|
const editor = new Editor({
|
||||||
element: element,
|
element: element,
|
||||||
content: content,
|
content: content,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue