|
|
|
@ -69,108 +69,108 @@ export const FileExplorerMenu = (props: FileExplorerMenuProps) => { |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
(!global.fs.browser.isSuccessfulWorkspace ? null : |
|
|
|
|
<> |
|
|
|
|
<> |
|
|
|
|
|
|
|
|
|
<span data-id="spanContaining" className="pl-0 pb-1 w-50"> |
|
|
|
|
{state.menuItems.map(({action, title, icon, placement}, index) => { |
|
|
|
|
if (action === 'uploadFile') { |
|
|
|
|
return ( |
|
|
|
|
<CustomTooltip |
|
|
|
|
placement={placement as Placement} |
|
|
|
|
tooltipId="uploadFileTooltip" |
|
|
|
|
tooltipClasses="text-nowrap" |
|
|
|
|
tooltipText={<FormattedMessage id={`filePanel.${action}`} defaultMessage={title} />} |
|
|
|
|
key={`index-${action}-${placement}-${icon}`} |
|
|
|
|
> |
|
|
|
|
<label |
|
|
|
|
id={action} |
|
|
|
|
style={{fontSize: '1.1rem', cursor: 'pointer'}} |
|
|
|
|
data-id={'fileExplorerUploadFile' + action} |
|
|
|
|
className={icon + ' mx-1 remixui_menuItem'} |
|
|
|
|
<span data-id="spanContaining" className="pl-0 pb-1 w-50"> |
|
|
|
|
{state.menuItems.map(({action, title, icon, placement}, index) => { |
|
|
|
|
if (action === 'uploadFile') { |
|
|
|
|
return ( |
|
|
|
|
<CustomTooltip |
|
|
|
|
placement={placement as Placement} |
|
|
|
|
tooltipId="uploadFileTooltip" |
|
|
|
|
tooltipClasses="text-nowrap" |
|
|
|
|
tooltipText={<FormattedMessage id={`filePanel.${action}`} defaultMessage={title} />} |
|
|
|
|
key={`index-${action}-${placement}-${icon}`} |
|
|
|
|
> |
|
|
|
|
<input |
|
|
|
|
id="fileUpload" |
|
|
|
|
data-id="fileExplorerFileUpload" |
|
|
|
|
type="file" |
|
|
|
|
onChange={(e) => { |
|
|
|
|
e.stopPropagation() |
|
|
|
|
_paq.push(['trackEvent', 'fileExplorer', 'fileAction', action]) |
|
|
|
|
props.uploadFile(e.target) |
|
|
|
|
e.target.value = null |
|
|
|
|
}} |
|
|
|
|
multiple |
|
|
|
|
/> |
|
|
|
|
</label> |
|
|
|
|
</CustomTooltip> |
|
|
|
|
) |
|
|
|
|
} else if (action === 'uploadFolder') { |
|
|
|
|
return ( |
|
|
|
|
<CustomTooltip |
|
|
|
|
placement={placement as Placement} |
|
|
|
|
tooltipId="uploadFolderTooltip" |
|
|
|
|
tooltipClasses="text-nowrap" |
|
|
|
|
tooltipText={<FormattedMessage id={`filePanel.${action}`} defaultMessage={title} />} |
|
|
|
|
key={`index-${action}-${placement}-${icon}`} |
|
|
|
|
> |
|
|
|
|
<label |
|
|
|
|
id={action} |
|
|
|
|
style={{fontSize: '1.1rem', cursor: 'pointer'}} |
|
|
|
|
data-id={'fileExplorerUploadFolder' + action} |
|
|
|
|
className={icon + ' mx-1 remixui_menuItem'} |
|
|
|
|
<label |
|
|
|
|
id={action} |
|
|
|
|
style={{fontSize: '1.1rem', cursor: 'pointer'}} |
|
|
|
|
data-id={'fileExplorerUploadFile' + action} |
|
|
|
|
className={icon + ' mx-1 remixui_menuItem'} |
|
|
|
|
key={`index-${action}-${placement}-${icon}`} |
|
|
|
|
> |
|
|
|
|
<input |
|
|
|
|
id="fileUpload" |
|
|
|
|
data-id="fileExplorerFileUpload" |
|
|
|
|
type="file" |
|
|
|
|
onChange={(e) => { |
|
|
|
|
e.stopPropagation() |
|
|
|
|
_paq.push(['trackEvent', 'fileExplorer', 'fileAction', action]) |
|
|
|
|
props.uploadFile(e.target) |
|
|
|
|
e.target.value = null |
|
|
|
|
}} |
|
|
|
|
multiple |
|
|
|
|
/> |
|
|
|
|
</label> |
|
|
|
|
</CustomTooltip> |
|
|
|
|
) |
|
|
|
|
} else if (action === 'uploadFolder') { |
|
|
|
|
return ( |
|
|
|
|
<CustomTooltip |
|
|
|
|
placement={placement as Placement} |
|
|
|
|
tooltipId="uploadFolderTooltip" |
|
|
|
|
tooltipClasses="text-nowrap" |
|
|
|
|
tooltipText={<FormattedMessage id={`filePanel.${action}`} defaultMessage={title} />} |
|
|
|
|
key={`index-${action}-${placement}-${icon}`} |
|
|
|
|
> |
|
|
|
|
<input |
|
|
|
|
id="folderUpload" |
|
|
|
|
data-id="fileExplorerFolderUpload" |
|
|
|
|
type="file" |
|
|
|
|
onChange={(e) => { |
|
|
|
|
<label |
|
|
|
|
id={action} |
|
|
|
|
style={{fontSize: '1.1rem', cursor: 'pointer'}} |
|
|
|
|
data-id={'fileExplorerUploadFolder' + action} |
|
|
|
|
className={icon + ' mx-1 remixui_menuItem'} |
|
|
|
|
key={`index-${action}-${placement}-${icon}`} |
|
|
|
|
> |
|
|
|
|
<input |
|
|
|
|
id="folderUpload" |
|
|
|
|
data-id="fileExplorerFolderUpload" |
|
|
|
|
type="file" |
|
|
|
|
onChange={(e) => { |
|
|
|
|
e.stopPropagation() |
|
|
|
|
_paq.push(['trackEvent', 'fileExplorer', 'fileAction', action]) |
|
|
|
|
props.uploadFolder(e.target) |
|
|
|
|
e.target.value = null |
|
|
|
|
}} |
|
|
|
|
{...enableDirUpload} |
|
|
|
|
multiple |
|
|
|
|
/> |
|
|
|
|
</label> |
|
|
|
|
</CustomTooltip> |
|
|
|
|
) |
|
|
|
|
} else { |
|
|
|
|
return ( |
|
|
|
|
<CustomTooltip |
|
|
|
|
placement={placement as Placement} |
|
|
|
|
tooltipId={`${action}-${title}-${icon}-${index}`} |
|
|
|
|
tooltipClasses="text-nowrap" |
|
|
|
|
tooltipText={<FormattedMessage id={`filePanel.${action}`} defaultMessage={title} />} |
|
|
|
|
key={`${action}-${title}-${index}`} |
|
|
|
|
> |
|
|
|
|
<label |
|
|
|
|
id={action} |
|
|
|
|
style={{fontSize: '1.1rem', cursor: 'pointer'}} |
|
|
|
|
data-id={'fileExplorerNewFile' + action} |
|
|
|
|
onClick={(e) => { |
|
|
|
|
e.stopPropagation() |
|
|
|
|
_paq.push(['trackEvent', 'fileExplorer', 'fileAction', action]) |
|
|
|
|
props.uploadFolder(e.target) |
|
|
|
|
e.target.value = null |
|
|
|
|
if (action === 'createNewFile') { |
|
|
|
|
props.createNewFile() |
|
|
|
|
} else if (action === 'createNewFolder') { |
|
|
|
|
props.createNewFolder() |
|
|
|
|
} else if (action === 'publishToGist') { |
|
|
|
|
props.publishToGist() |
|
|
|
|
} else { |
|
|
|
|
state.actions[action]() |
|
|
|
|
} |
|
|
|
|
}} |
|
|
|
|
{...enableDirUpload} |
|
|
|
|
multiple |
|
|
|
|
/> |
|
|
|
|
</label> |
|
|
|
|
</CustomTooltip> |
|
|
|
|
) |
|
|
|
|
} else { |
|
|
|
|
return ( |
|
|
|
|
<CustomTooltip |
|
|
|
|
placement={placement as Placement} |
|
|
|
|
tooltipId={`${action}-${title}-${icon}-${index}`} |
|
|
|
|
tooltipClasses="text-nowrap" |
|
|
|
|
tooltipText={<FormattedMessage id={`filePanel.${action}`} defaultMessage={title} />} |
|
|
|
|
key={`${action}-${title}-${index}`} |
|
|
|
|
> |
|
|
|
|
<label |
|
|
|
|
id={action} |
|
|
|
|
style={{fontSize: '1.1rem', cursor: 'pointer'}} |
|
|
|
|
data-id={'fileExplorerNewFile' + action} |
|
|
|
|
onClick={(e) => { |
|
|
|
|
e.stopPropagation() |
|
|
|
|
_paq.push(['trackEvent', 'fileExplorer', 'fileAction', action]) |
|
|
|
|
if (action === 'createNewFile') { |
|
|
|
|
props.createNewFile() |
|
|
|
|
} else if (action === 'createNewFolder') { |
|
|
|
|
props.createNewFolder() |
|
|
|
|
} else if (action === 'publishToGist') { |
|
|
|
|
props.publishToGist() |
|
|
|
|
} else { |
|
|
|
|
state.actions[action]() |
|
|
|
|
} |
|
|
|
|
}} |
|
|
|
|
className={icon + ' mx-1 remixui_menuItem'} |
|
|
|
|
key={`${action}-${title}-${index}`} |
|
|
|
|
></label> |
|
|
|
|
</CustomTooltip> |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
})} |
|
|
|
|
</span> |
|
|
|
|
</>) |
|
|
|
|
className={icon + ' mx-1 remixui_menuItem'} |
|
|
|
|
key={`${action}-${title}-${index}`} |
|
|
|
|
></label> |
|
|
|
|
</CustomTooltip> |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
})} |
|
|
|
|
</span> |
|
|
|
|
</>) |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|