fix images
This commit is contained in:
@@ -114,9 +114,10 @@ const htmlToSlate = (html: string): Descendant[] => {
|
||||
const img = element as HTMLImageElement;
|
||||
results.push({
|
||||
type: 'image',
|
||||
src: img.src || img.getAttribute('src') || '',
|
||||
alt: img.alt || img.getAttribute('alt') || '',
|
||||
caption: img.title || img.getAttribute('title') || '',
|
||||
// Use getAttribute to preserve relative URLs instead of .src which converts to absolute
|
||||
src: img.getAttribute('src') || '',
|
||||
alt: img.getAttribute('alt') || '',
|
||||
caption: img.getAttribute('title') || '',
|
||||
children: [{ text: '' }] // Images need children in Slate
|
||||
});
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user