Skip to content

Commit

Permalink
[RTE]: fixed working of old iframe data structure with 'src' prop
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekseyManetov committed Oct 24, 2024
1 parent a750f0d commit 46ee400
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions uui-editor/src/migrations/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export type DeprecatedTLinkElement = TLinkElement & {
};

export type DeprecatedTIframeElement = TIframeElement & {
src?: string; // removed
data: TIframeElement['data'] & {
src?: string; // removed
}
Expand Down
6 changes: 4 additions & 2 deletions uui-editor/src/plugins/iframePlugin/IframeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ export const IframeBlock: PlatePluginComponent<{
const isPdf = element.data?.extension === 'pdf';
const style = element.data?.style;

const url: string = element.url || element.src as string; // element.src it's previous editor format structure

return (
// style attr needed for serialization
<div { ...attributes }>
<iframe
title={ element.url }
title={ url }
allowFullScreen={ true }
src={ sanitizeUrl(element.url) }
src={ sanitizeUrl(url) }
style={ style }
className={ cx(css.content, isSelected && uuiMod.focus, IFRAME_GLOBAL_CLASS, isPdf && PDF_GLOBAL_CLASS) }
/>
Expand Down

0 comments on commit 46ee400

Please sign in to comment.