Skip to content

Commit

Permalink
Prevent file:/// img conversion (#5563)
Browse files Browse the repository at this point in the history
  • Loading branch information
zurfyx authored Jan 29, 2024
1 parent b0cc9c4 commit a5a9ccb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/lexical-playground/src/nodes/ImageNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,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

2 comments on commit a5a9ccb

@vercel
Copy link

@vercel vercel bot commented on a5a9ccb Jan 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

lexical – ./packages/lexical-website

lexical-fbopensource.vercel.app
lexicaljs.com
lexicaljs.org
lexical.dev
lexical-git-main-fbopensource.vercel.app
www.lexical.dev

@vercel
Copy link

@vercel vercel bot commented on a5a9ccb Jan 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

lexical-playground – ./packages/lexical-playground

playground.lexical.dev
lexical-playground-git-main-fbopensource.vercel.app
lexical-playground-fbopensource.vercel.app
lexical-playground.vercel.app

Please sign in to comment.