Skip to content

Commit 8e608ac

Browse files
committed
feat(share link): share link directly under title
1 parent 57cdd6d commit 8e608ac

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

frontend/src/app/shared/bookmark-list-element/bookmark-list-element.component.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ <h6 class="card-subtitle mb-2 text-muted url-under-title">
2828
[innerHtml]="bookmark.location | slice:0:100 | highlight: filterText | highlight: queryText"></span>
2929
<span>...</span>
3030
</ng-template>
31+
<span class="btn-light btn-sm" (click)="copyToClipboard(bookmark.location)" title="Copy link to clipboard">
32+
<i class="far fa-copy copy-link"></i><span class="copy-btn-text">{{copyLinkButtonText}}</span>
33+
</span>
3134
</h6>
3235
</div>
3336
<div style="display: flex">

frontend/src/app/shared/bookmark-list-element/bookmark-list-element.component.scss

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
}
3030

3131
.youtube-icon {
32-
color:red;
32+
color: red;
3333
margin-right: 0.5rem;
3434
cursor: pointer;
3535
}
@@ -44,3 +44,10 @@
4444
pointer-events: none;
4545
}
4646

47+
.copy-link {
48+
font-size: 0.95rem;
49+
}
50+
51+
.copy-btn-text {
52+
font-size: 0.8rem;
53+
}

frontend/src/app/shared/bookmark-list-element/bookmark-list-element.component.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { MyBookmarksStore } from '../../core/user/my-bookmarks.store';
2525
import { NavigationEnd, Router } from '@angular/router';
2626
import { LoginDialogHelperService } from '../../core/login-dialog-helper.service';
2727
import { AddToHistoryService } from '../../core/user/add-to-history.service';
28+
import { Clipboard } from '@angular/cdk/clipboard';
2829

2930
@Component({
3031
selector: 'app-bookmark-list-element',
@@ -64,6 +65,8 @@ export class BookmarkListElementComponent extends TagFollowingBaseComponent impl
6465

6566
private navigationSubscription: Subscription;
6667

68+
copyLinkButtonText = '';
69+
6770
constructor(private router: Router,
6871
private playYoutubeDialog: MatDialog,
6972
public loginDialog: MatDialog,
@@ -81,7 +84,8 @@ export class BookmarkListElementComponent extends TagFollowingBaseComponent impl
8184
private feedStore: FeedStore,
8285
private loginDialogHelperService: LoginDialogHelperService,
8386
private myBookmarksStore: MyBookmarksStore,
84-
public addToHistoryService: AddToHistoryService) {
87+
public addToHistoryService: AddToHistoryService,
88+
private clipboard: Clipboard) {
8589
super(loginDialog, userDataWatchedTagsStore);
8690

8791
// START force reload on same root - solution taken from https://github.com/angular/angular/issues/13831
@@ -280,4 +284,11 @@ export class BookmarkListElementComponent extends TagFollowingBaseComponent impl
280284
}
281285
}
282286

287+
copyToClipboard(location: string) {
288+
const copied = this.clipboard.copy(location);
289+
if (copied) {
290+
this.copyLinkButtonText = ' Copied';
291+
setTimeout(() => this.copyLinkButtonText = '', 1300);
292+
}
293+
}
283294
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Codever",
3-
"version": "4.9.1",
3+
"version": "4.10.0",
44
"description": "Codever - bookmarks and snippets manager for developers & co",
55
"scripts": {
66
"test": "echo \"Error: no test specified\" && exit 1",

0 commit comments

Comments
 (0)