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: () => {
// 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
// and if he closes the modal, then no changes are made to the editor
/**
* 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
* and if he closes the modal, then no changes are made to the editor
*/
return () => <ImageDialog />;
},
snippets: ['!['],

View File

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