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>
55< mat-dialog-content >
66 < div class ="share-buttons-wrapper ">
77 < 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 >
816 < div class ="col ">
917 < a
1018 type ="button " class ="btn btn-light btn-sm "
@@ -21,9 +29,6 @@ <h2 mat-dialog-title>Share Bookmark</h2>
2129 (click) ="onShareButtonClick() ">
2230 </ tweet >
2331 </ div >
24- < div class ="col ">
25- < fb-share [url] ="bookmark.location "> </ fb-share >
26- </ div >
2732 </ div >
2833 </ div >
2934
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ export class SocialShareDialogComponent implements OnInit {
1616 userData : UserData ;
1717 tagsStr : string ;
1818 tweetText : string ;
19+ copyLinkButtonText = 'Link' ;
1920
2021 constructor (
2122 private datePipe : DatePipe ,
@@ -43,7 +44,6 @@ export class SocialShareDialogComponent implements OnInit {
4344 }
4445
4546 onShareButtonClick ( ) {
46- console . log ( 'share button cliecked' )
4747 this . dialogRef . close ( 'SHARE_BUTTON_CLICKED' ) ;
4848 }
4949
@@ -58,4 +58,22 @@ export class SocialShareDialogComponent implements OnInit {
5858 return word . charAt ( 0 ) . toUpperCase ( ) + word . slice ( 1 ) . toLowerCase ( ) ;
5959 } ) . join ( '' ) ;
6060 }
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+ }
6179}
Original file line number Diff line number Diff line change 11{
22 "name" : " Codever" ,
3- "version" : " 4.8 .1" ,
3+ "version" : " 4.9 .1" ,
44 "description" : " Codever - bookmarks and snippets manager for developers & co" ,
55 "scripts" : {
66 "test" : " echo \" Error: no test specified\" && exit 1" ,
You can’t perform that action at this time.
0 commit comments