(snippet: SnippetResult)
| 1328 | } |
| 1329 | |
| 1330 | async function openSnippet(snippet: SnippetResult) { |
| 1331 | const [{ useApp }, { useFolders }, { useSnippets }] = await Promise.all([ |
| 1332 | import('@/composables/useApp'), |
| 1333 | import('@/composables/useFolders'), |
| 1334 | import('@/composables/useSnippets'), |
| 1335 | ]) |
| 1336 | const codeApp = useApp() |
| 1337 | const codeFolders = useFolders() |
| 1338 | const codeSnippets = useSnippets() |
| 1339 | |
| 1340 | codeSnippets.isRestoreStateBlocked.value = true |
| 1341 | codeSnippets.clearSearch(false) |
| 1342 | codeApp.state.tagId = undefined |
| 1343 | codeApp.state.snippetContentIndex = 0 |
| 1344 | codeApp.focusedFolderId.value = undefined |
| 1345 | codeApp.highlightedFolderIds.value.clear() |
| 1346 | codeApp.highlightedTagId.value = undefined |
| 1347 | |
| 1348 | const query = snippet.folder?.id |
| 1349 | ? { folderId: snippet.folder.id, isDeleted: snippet.isDeleted } |
| 1350 | : { isDeleted: snippet.isDeleted } |
| 1351 | |
| 1352 | if (snippet.folder?.id) { |
| 1353 | await codeFolders.selectFolder(snippet.folder.id, { |
| 1354 | ensureVisibility: true, |
| 1355 | }) |
| 1356 | } |
| 1357 | else { |
| 1358 | codeFolders.clearFolderSelection() |
| 1359 | codeApp.state.libraryFilter = snippet.isDeleted |
| 1360 | ? LibraryFilter.Trash |
| 1361 | : LibraryFilter.All |
| 1362 | } |
| 1363 | |
| 1364 | await codeSnippets.getSnippets(query) |
| 1365 | codeSnippets.selectSnippet(snippet.id) |
| 1366 | await router.push({ name: RouterName.main }) |
| 1367 | } |
| 1368 | |
| 1369 | async function openNote(note: NoteResult) { |
| 1370 | notesData.isRestoreStateBlocked.value = true |
no test coverage detected