Copy share URL for file

Aniket-Engg-patch-1
aniket-engg 10 months ago committed by Aniket
parent 7c296b6744
commit 5ba21573d7
  1. 9
      libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx
  2. 8
      libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
  3. 1
      libs/remix-ui/workspace/src/lib/types/index.ts
  4. 7
      libs/remix-ui/workspace/src/lib/utils/index.ts

@ -28,6 +28,7 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) =>
publishFolderToGist,
copy,
copyFileName,
copyShareURL,
copyPath,
paste,
runScript,
@ -206,11 +207,15 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) =>
break
case 'Copy name':
copyFileName(path, type)
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'copy'])
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'copyName'])
break
case 'Copy path':
copyPath(path, type)
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'copy'])
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'copyPath'])
break
case 'Copy Share URL':
copyShareURL(path, type)
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'copyShareURL'])
break
case 'Paste':
paste(path, type)

@ -534,6 +534,13 @@ export function Workspace() {
navigator.clipboard.writeText(fileName)
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const handleCopyShareURLClick = (path: string, _type: string) => {
const fileName = extractNameFromKey(path)
console.log('handleCopyShareURLClick---->', fileName)
// navigator.clipboard.writeText(fileName)
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const handleCopyFilePathClick = (path: string, _type: string) => {
navigator.clipboard.writeText(path)
@ -1300,6 +1307,7 @@ export function Workspace() {
paste={handlePasteClick}
copyFileName={handleCopyFileNameClick}
copyPath={handleCopyFilePathClick}
copyShareURL={handleCopyShareURLClick}
emit={emitContextMenuEvent}
pageX={state.focusContext.x}
pageY={state.focusContext.y}

@ -165,6 +165,7 @@ export interface FileExplorerContextMenuProps {
copy?: (path: string, type: string) => void
paste?: (destination: string, type: string) => void
copyFileName?: (path: string, type: string) => void
copyShareURL?: (path: string, type: string) => void
copyPath?: (path: string, type: string) => void
generateUml?: (path: string) => Promise<void>
uploadFile?: (target: EventTarget & HTMLInputElement) => void

@ -58,6 +58,13 @@ export const contextMenuActions: MenuItems = [{
multiselect: false,
label: '',
group: 1
}, {
id: 'copyShareURL',
name: 'Copy share URL',
type: ['file'],
multiselect: false,
label: '',
group: 1
}, {
id: 'download',
name: 'Download',

Loading…
Cancel
Save