diff --git a/libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx b/libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx index 4fe50450ca..cec5ddd442 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx @@ -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) diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index a71d5b897e..bcc6312d4a 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -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} diff --git a/libs/remix-ui/workspace/src/lib/types/index.ts b/libs/remix-ui/workspace/src/lib/types/index.ts index b3968ac21c..7ac7b6de1e 100644 --- a/libs/remix-ui/workspace/src/lib/types/index.ts +++ b/libs/remix-ui/workspace/src/lib/types/index.ts @@ -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 uploadFile?: (target: EventTarget & HTMLInputElement) => void diff --git a/libs/remix-ui/workspace/src/lib/utils/index.ts b/libs/remix-ui/workspace/src/lib/utils/index.ts index 14d76536f8..d55f533228 100644 --- a/libs/remix-ui/workspace/src/lib/utils/index.ts +++ b/libs/remix-ui/workspace/src/lib/utils/index.ts @@ -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',