@@ -5,7 +5,10 @@ import {
55 OnChanges ,
66 OnInit ,
77 Output ,
8+ ViewChild ,
89} from '@angular/core' ;
10+ import { MatInput } from '@angular/material/input' ;
11+ import { MatSnackBar } from '@angular/material/snack-bar' ;
912
1013@Component ( {
1114 selector : 'app-path-splitter[path]' ,
@@ -15,6 +18,12 @@ import {
1518export class PathSplitterComponent implements OnInit , OnChanges {
1619 @Input ( ) path ! : string ;
1720 @Output ( ) pathChange = new EventEmitter < string > ( ) ;
21+ editMode = false ;
22+ editingPath = '' ;
23+
24+ @ViewChild ( 'pathInput' ) pathInput : MatInput | undefined ;
25+
26+ constructor ( private snackBar : MatSnackBar ) { }
1827
1928 pathParts : {
2029 name : string ;
@@ -48,4 +57,31 @@ export class PathSplitterComponent implements OnInit, OnChanges {
4857 pathClicked ( fullPath : string ) {
4958 this . pathChange . emit ( fullPath ) ;
5059 }
60+
61+ pathCopy ( fullPath : string ) {
62+ navigator . clipboard . writeText ( '/' + fullPath ) ;
63+ this . snackBar . open ( $localize `Path copied to clipboard` , undefined , {
64+ duration : 3000 ,
65+ } ) ;
66+ }
67+
68+ pathEditClicked ( ) {
69+ this . editingPath = this . path ;
70+ this . editMode = true ;
71+ this . pathInput ?. focus ( ) ;
72+ }
73+
74+ pathEditCancel ( ) {
75+ this . editMode = false ;
76+ }
77+
78+ pathEditSave ( ) {
79+ let newPath = this . editingPath . trim ( ) ;
80+ // remove leading slash if present
81+ if ( newPath . startsWith ( '/' ) ) {
82+ newPath = newPath . substring ( 1 ) ;
83+ }
84+ this . pathChange . emit ( newPath ) ;
85+ this . editMode = false ;
86+ }
5187}
0 commit comments