mirror of
https://github.com/desktop/desktop
synced 2024-08-25 03:07:41 +00:00
Merge pull request #13751 from uttiya10/copy-relative-path-changed-files
Add "Copy Relative File Path" Option to Changed Files' Context Menu
This commit is contained in:
commit
e9b6653a3a
|
@ -23,6 +23,7 @@ import {
|
|||
CopyFilePathLabel,
|
||||
RevealInFileManagerLabel,
|
||||
OpenWithDefaultProgramLabel,
|
||||
CopyRelativeFilePathLabel,
|
||||
} from '../lib/context-menu'
|
||||
import { CommitMessage } from './commit-message'
|
||||
import { ChangedFile } from './changed-file'
|
||||
|
@ -405,6 +406,15 @@ export class ChangesList extends React.Component<
|
|||
}
|
||||
}
|
||||
|
||||
private getCopyRelativePathMenuItem = (
|
||||
file: WorkingDirectoryFileChange
|
||||
): IMenuItem => {
|
||||
return {
|
||||
label: CopyRelativeFilePathLabel,
|
||||
action: () => clipboard.writeText(Path.normalize(file.path)),
|
||||
}
|
||||
}
|
||||
|
||||
private getRevealInFileManagerMenuItem = (
|
||||
file: WorkingDirectoryFileChange
|
||||
): IMenuItem => {
|
||||
|
@ -517,6 +527,8 @@ export class ChangesList extends React.Component<
|
|||
items.push(
|
||||
{ type: 'separator' },
|
||||
this.getCopyPathMenuItem(file),
|
||||
this.getCopyRelativePathMenuItem(file),
|
||||
{ type: 'separator' },
|
||||
this.getRevealInFileManagerMenuItem(file),
|
||||
this.getOpenInExternalEditorMenuItem(file, enabled),
|
||||
{
|
||||
|
@ -549,6 +561,8 @@ export class ChangesList extends React.Component<
|
|||
|
||||
items.push(
|
||||
this.getCopyPathMenuItem(file),
|
||||
this.getCopyRelativePathMenuItem(file),
|
||||
{ type: 'separator' },
|
||||
this.getRevealInFileManagerMenuItem(file),
|
||||
this.getOpenInExternalEditorMenuItem(file, enabled),
|
||||
{
|
||||
|
|
|
@ -18,6 +18,7 @@ import {
|
|||
DefaultEditorLabel,
|
||||
RevealInFileManagerLabel,
|
||||
OpenWithDefaultProgramLabel,
|
||||
CopyRelativeFilePathLabel,
|
||||
} from '../lib/context-menu'
|
||||
import { ThrottledScheduler } from '../lib/throttled-scheduler'
|
||||
|
||||
|
@ -363,6 +364,11 @@ export class SelectedCommit extends React.Component<
|
|||
label: CopyFilePathLabel,
|
||||
action: () => clipboard.writeText(fullPath),
|
||||
},
|
||||
{
|
||||
label: CopyRelativeFilePathLabel,
|
||||
action: () => clipboard.writeText(Path.normalize(file.path)),
|
||||
},
|
||||
{ type: 'separator' },
|
||||
]
|
||||
|
||||
let viewOnGitHubLabel = 'View on GitHub'
|
||||
|
|
|
@ -3,6 +3,10 @@ export const CopyFilePathLabel = __DARWIN__
|
|||
? 'Copy File Path'
|
||||
: 'Copy file path'
|
||||
|
||||
export const CopyRelativeFilePathLabel = __DARWIN__
|
||||
? 'Copy Relative File Path'
|
||||
: 'Copy relative file path'
|
||||
|
||||
export const DefaultEditorLabel = __DARWIN__
|
||||
? 'Open in External Editor'
|
||||
: 'Open in external editor'
|
||||
|
|
Loading…
Reference in a new issue