Skip to content

Commit

Permalink
bug: Prevent file:/// img conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
umaranis committed Mar 26, 2024
1 parent 2ecbf29 commit d805d94
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/svelte-lexical/src/core/plugins/Image/ImageNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ export interface ImagePayload {
}

function convertImageElement(domNode: Node): null | DOMConversionOutput {
if (domNode instanceof HTMLImageElement) {
const {alt: altText, src, width, height} = domNode;
const node = $createImageNode({altText, height, src, width});
return {node};
const img = domNode as HTMLImageElement;
if (img.src.startsWith('file:///')) {
return null;
}
return null;
const {alt: altText, src, width, height} = img;
const node = $createImageNode({altText, height, src, width});
return {node};
}

export type SerializedImageNode = Spread<
Expand Down

0 comments on commit d805d94

Please sign in to comment.