fix: show media dialog in blocks and markdown editors (#20846)

* fix: show media dialow in blocks and markdown editors

* fix: creating folders

* chore: remove unnecessary onClose code
This commit is contained in:
Rémi de Juvigny 2024-07-18 10:55:34 +02:00 committed by GitHub
parent a04615767f
commit d938b73b42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 10 deletions

View File

@ -196,9 +196,11 @@ const imageBlocks: Pick<BlocksStore, 'image'> = {
}); });
}, },
handleConvert: () => { handleConvert: () => {
// All the logic is managed inside the ImageDialog component, /**
// because the blocks are only created when the user selects images in the modal and submits * All the logic is managed inside the ImageDialog component,
// and if he closes the modal, then no changes are made to the editor * because the blocks are only created when the user selects images in the modal and submits
* and if he closes the modal, then no changes are made to the editor
*/
return () => <ImageDialog />; return () => <ImageDialog />;
}, },
snippets: ['!['], snippets: ['!['],

View File

@ -22,11 +22,8 @@ export const MediaLibraryDialog = ({ onClose, onSelectAssets, allowedTypes }) =>
<AssetDialog <AssetDialog
allowedTypes={allowedTypes} allowedTypes={allowedTypes}
folderId={folderId} folderId={folderId}
onClose={() => { open
setStep(undefined); onClose={onClose}
setFolderId(null);
onClose();
}}
onValidate={onSelectAssets} onValidate={onSelectAssets}
onAddAsset={() => setStep(STEPS.AssetUpload)} onAddAsset={() => setStep(STEPS.AssetUpload)}
onAddFolder={() => setStep(STEPS.FolderCreate)} onAddFolder={() => setStep(STEPS.FolderCreate)}
@ -37,11 +34,17 @@ export const MediaLibraryDialog = ({ onClose, onSelectAssets, allowedTypes }) =>
case STEPS.FolderCreate: case STEPS.FolderCreate:
return ( return (
<EditFolderDialog onClose={() => setStep(STEPS.AssetSelect)} parentFolderId={folderId} /> <EditFolderDialog
open
onClose={() => setStep(STEPS.AssetSelect)}
parentFolderId={folderId}
/>
); );
default: default:
return <UploadAssetDialog onClose={() => setStep(STEPS.AssetSelect)} folderId={folderId} />; return (
<UploadAssetDialog open onClose={() => setStep(STEPS.AssetSelect)} folderId={folderId} />
);
} }
}; };