mirror of
				https://github.com/strapi/strapi.git
				synced 2025-11-04 11:54:10 +00:00 
			
		
		
		
	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:
		
							parent
							
								
									a04615767f
								
							
						
					
					
						commit
						d938b73b42
					
				@ -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: ['!['],
 | 
			
		||||
 | 
			
		||||
@ -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} />
 | 
			
		||||
      );
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user