File tree Expand file tree Collapse file tree 3 files changed +28
-5
lines changed
frontend/src/app/shared/dialog/social-share-dialog Expand file tree Collapse file tree 3 files changed +28
-5
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,14 @@ <h2 mat-dialog-title>Share Bookmark</h2>
5
5
< mat-dialog-content >
6
6
< div class ="share-buttons-wrapper ">
7
7
< div class ="row ">
8
+ < div class ="col ">
9
+ < a
10
+ type ="button " class ="btn btn-light btn-sm "
11
+ title ="Copy bookmark link "
12
+ (click) ="copyToClipboard(bookmark.location) ">
13
+ < i class ="far fa-copy " style ="font-size: smaller "> </ i > {{copyLinkButtonText}}
14
+ </ a >
15
+ </ div >
8
16
< div class ="col ">
9
17
< a
10
18
type ="button " class ="btn btn-light btn-sm "
@@ -21,9 +29,6 @@ <h2 mat-dialog-title>Share Bookmark</h2>
21
29
(click) ="onShareButtonClick() ">
22
30
</ tweet >
23
31
</ div >
24
- < div class ="col ">
25
- < fb-share [url] ="bookmark.location "> </ fb-share >
26
- </ div >
27
32
</ div >
28
33
</ div >
29
34
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ export class SocialShareDialogComponent implements OnInit {
16
16
userData : UserData ;
17
17
tagsStr : string ;
18
18
tweetText : string ;
19
+ copyLinkButtonText = 'Link' ;
19
20
20
21
constructor (
21
22
private datePipe : DatePipe ,
@@ -43,7 +44,6 @@ export class SocialShareDialogComponent implements OnInit {
43
44
}
44
45
45
46
onShareButtonClick ( ) {
46
- console . log ( 'share button cliecked' )
47
47
this . dialogRef . close ( 'SHARE_BUTTON_CLICKED' ) ;
48
48
}
49
49
@@ -58,4 +58,22 @@ export class SocialShareDialogComponent implements OnInit {
58
58
return word . charAt ( 0 ) . toUpperCase ( ) + word . slice ( 1 ) . toLowerCase ( ) ;
59
59
} ) . join ( '' ) ;
60
60
}
61
+
62
+ copyToClipboard ( location : string ) {
63
+ const selBox = document . createElement ( 'textarea' ) ;
64
+ selBox . style . position = 'fixed' ;
65
+ selBox . style . left = '0' ;
66
+ selBox . style . top = '0' ;
67
+ selBox . style . opacity = '0' ;
68
+ selBox . value = location ;
69
+ document . body . appendChild ( selBox ) ;
70
+ selBox . focus ( ) ;
71
+ selBox . select ( ) ;
72
+ const copyResult = document . execCommand ( 'copy' ) ;
73
+ if ( copyResult ) {
74
+ this . copyLinkButtonText = 'Copied' ;
75
+ setTimeout ( ( ) => this . copyLinkButtonText = 'Link' , 1300 ) ;
76
+ }
77
+ document . body . removeChild ( selBox ) ;
78
+ }
61
79
}
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " Codever" ,
3
- "version" : " 4.8 .1" ,
3
+ "version" : " 4.9 .1" ,
4
4
"description" : " Codever - bookmarks and snippets manager for developers & co" ,
5
5
"scripts" : {
6
6
"test" : " echo \" Error: no test specified\" && exit 1" ,
You can’t perform that action at this time.
0 commit comments