Merge branch 'master' into codeformat

pull/3176/head
bunsenstraat 2 years ago committed by GitHub
commit f40283b8b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx
  2. 10
      libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx
  3. 13
      libs/remix-ui/workspace/src/lib/components/file-explorer.tsx
  4. 2
      libs/remix-ui/workspace/src/lib/types/index.ts
  5. 12
      libs/remix-ui/workspace/src/lib/utils/index.ts

@ -947,12 +947,12 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
</div>}
>
<div className="d-flex align-items-center justify-content-center">
{ <i ref={compileIcon} className="fas fa-sync remixui_iconbtn ml-4" aria-hidden="true"></i> }
{ <i ref={compileIcon} className="fas fa-sync remixui_iconbtn ml-2" aria-hidden="true"></i> }
<div className="d-flex justify-content-between align-items-center">
<span>
<FormattedMessage id='solidity.compile' defaultMessage='Compile' />
</span>
<span className="ml-1">
<span className="ml-1 text-nowrap">
{typeof state.compiledFileName === 'string'
? extractNameFromKey(state.compiledFileName) ||
`<${intl.formatMessage({

@ -13,7 +13,7 @@ declare global {
const _paq = window._paq = window._paq || [] //eslint-disable-line
export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) => {
const { actions, createNewFile, createNewFolder, deletePath, renamePath, hideContextMenu, pushChangesToGist, publishFileToGist, publishFolderToGist, copy, paste, runScript, emit, pageX, pageY, path, type, focus, ...otherProps } = props
const { actions, createNewFile, createNewFolder, deletePath, renamePath, hideContextMenu, pushChangesToGist, publishFileToGist, publishFolderToGist, copy, copyFileName, copyPath, paste, runScript, emit, pageX, pageY, path, type, focus, ...otherProps } = props
const contextMenuRef = useRef(null)
const intl = useIntl()
useEffect(() => {
@ -108,6 +108,14 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) =>
copy(path, type)
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'copy'])
break
case 'Copy name':
copyFileName(path, type)
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'copy'])
break
case 'Copy path':
copyPath(path, type)
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'copy'])
break
case 'Paste':
paste(path, type)
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'paste'])

@ -409,6 +409,17 @@ export const FileExplorer = (props: FileExplorerProps) => {
props.dispatchHandleExpandPath(expandPath)
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const handleCopyFileNameClick = (path: string, _type: string) => {
const fileName = extractNameFromKey(path)
navigator.clipboard.writeText(fileName)
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const handleCopyFilePathClick = (path: string, _type: string) => {
navigator.clipboard.writeText(path)
}
const handleFileMove = (dest: string, src: string) => {
try {
props.dispatchMoveFile(src, dest)
@ -480,6 +491,8 @@ export const FileExplorer = (props: FileExplorerProps) => {
runScript={runScript}
copy={handleCopyClick}
paste={handlePasteClick}
copyFileName={handleCopyFileNameClick}
copyPath={handleCopyFilePathClick}
emit={emitContextMenuEvent}
pageX={state.focusContext.x}
pageY={state.focusContext.y}

@ -134,6 +134,8 @@ export interface FileExplorerContextMenuProps {
onMouseOver?: (...args) => void,
copy?: (path: string, type: string) => void,
paste?: (destination: string, type: string) => void
copyFileName?: (path: string, type: string) => void
copyPath?: (path: string, type: string) => void
}
export interface FileExplorerState {

@ -54,6 +54,18 @@ export const contextMenuActions: MenuItems = [{
type: ['folder', 'file'],
multiselect: false,
label: ''
}, {
id: 'copyFileName',
name: 'Copy name',
type: ['file'],
multiselect: false,
label: ''
}, {
id: 'copyFilePath',
name: 'Copy path',
type: ['file'],
multiselect: false,
label: ''
}, {
id: 'deleteAll',
name: 'Delete All',

Loading…
Cancel
Save