55 useContentSort ,
66 useCopyToClipboard ,
77 useDeleteShortcut ,
8+ useDialog ,
89 useDrawings ,
910 useInlineRename ,
1011} from ' @/composables'
@@ -26,6 +27,7 @@ const {
2627} = useDrawings ()
2728const copyToClipboard = useCopyToClipboard ()
2829const { contentSortState } = useContentSort ()
30+ const { confirm } = useDialog ()
2931
3032function copyLinkForNote(name : string ) {
3133 copyToClipboard (` }) ` )
@@ -153,12 +155,29 @@ function selectDrawingFromList(id: string, event: MouseEvent) {
153155 focusDrawingListItem (event )
154156}
155157
158+ async function confirmDeleteDrawing(id : string ) {
159+ const drawing = drawings .value .find (item => item .id === id )
160+
161+ const isConfirmed = await confirm ({
162+ title: i18n .t (' messages:confirm.deletePermanently' , {
163+ name: drawing ?.name ?? ' ' ,
164+ }),
165+ content: i18n .t (' messages:warning.noUndo' ),
166+ })
167+
168+ if (! isConfirmed ) {
169+ return
170+ }
171+
172+ await deleteDrawing (id )
173+ }
174+
156175function deleteActiveDrawing() {
157176 if (! activeDrawingId .value ) {
158177 return
159178 }
160179
161- void deleteDrawing (activeDrawingId .value )
180+ void confirmDeleteDrawing (activeDrawingId .value )
162181}
163182
164183useDeleteShortcut ({
@@ -281,7 +300,9 @@ defineExpose({
281300 {{ i18n.t("spaces.drawings.exportImage") }}
282301 </ContextMenu .ContextMenuItem >
283302 <ContextMenu .ContextMenuSeparator />
284- <ContextMenu .ContextMenuItem @click =" deleteDrawing(drawing.id)" >
303+ <ContextMenu .ContextMenuItem
304+ @click =" confirmDeleteDrawing(drawing.id)"
305+ >
285306 {{ i18n.t("action.delete.common") }}
286307 </ContextMenu .ContextMenuItem >
287308 </ContextMenu .ContextMenuContent >
0 commit comments