36
36
/>
37
37
38
38
<DeepBtn
39
- class =" delete -btn"
40
- icon =" mdi-close "
39
+ class =" menu -btn"
40
+ icon =" mdi-dots-vertical "
41
41
round
42
42
flat
43
- style =" min-width : 32px ; min-height : 32px ; width : 32px ; height : 32px "
44
- title =" Remove backlink"
45
- @click.stop =" deleteBacklink(backlinkPageId)"
46
- />
43
+ style =" min-width : 0 ; min-height : 0 ; width : 32px ; height : 32px "
44
+ >
45
+ <q-menu >
46
+ <q-list >
47
+ <q-item
48
+ clickable
49
+ v-ripple
50
+ @click =" addToSelection(backlinkPageId)"
51
+ >
52
+ <q-item-section avatar >
53
+ <q-icon name =" mdi-selection-multiple" />
54
+ </q-item-section >
55
+
56
+ <q-item-section >
57
+ <q-item-label >Add to selection</q-item-label >
58
+ </q-item-section >
59
+ </q-item >
60
+ <q-item
61
+ clickable
62
+ v-ripple
63
+ @click =" deleteBacklink(backlinkPageId)"
64
+ >
65
+ <q-item-section avatar >
66
+ <q-icon name =" mdi-trash-can" />
67
+ </q-item-section >
68
+
69
+ <q-item-section >
70
+ <q-item-label >Delete backlink</q-item-label >
71
+ </q-item-section >
72
+ </q-item >
73
+ </q-list >
74
+ </q-menu >
75
+ </DeepBtn >
47
76
</div >
48
77
</q-list >
49
78
</div >
52
81
<script setup lang="ts">
53
82
import type { Page } from ' src/code/pages/page/page' ;
54
83
import { handleError } from ' src/code/utils/misc' ;
84
+ import { pageSelectionStore } from ' src/stores/page-selection' ;
55
85
import type { Ref } from ' vue' ;
56
86
57
87
const page = inject <Ref <Page >>(' page' )! ;
@@ -61,6 +91,16 @@ const backlinks = computed(
61
91
page .value .realtimeCtx .hget (' page-backlinks' , page .value .id , ' list' ) ?? [],
62
92
);
63
93
94
+ function addToSelection(pageId : string ) {
95
+ pageSelectionStore ().selectedPages .add (pageId );
96
+
97
+ $quasar ().notify ({
98
+ message: ' Page added to selection.' ,
99
+ color: ' positive' ,
100
+ timeout: 1000 ,
101
+ });
102
+ }
103
+
64
104
async function deleteBacklink(backlinkPageId : string ) {
65
105
try {
66
106
await trpcClient .pages .backlinks .delete .mutate ({
@@ -86,7 +126,7 @@ async function deleteBacklink(backlinkPageId: string) {
86
126
.backlink {
87
127
position : relative ;
88
128
89
- > .delete -btn {
129
+ > .menu -btn {
90
130
position : absolute ;
91
131
92
132
top : 50% ;
@@ -98,13 +138,6 @@ async function deleteBacklink(backlinkPageId: string) {
98
138
min-height : 30px ;
99
139
width : 30px ;
100
140
height : 30px ;
101
-
102
- opacity : 0 ;
103
- transition : opacity 0.2s ;
104
141
}
105
142
}
106
-
107
- .backlink :hover > .delete-btn {
108
- opacity : 1 ;
109
- }
110
143
</style >
0 commit comments