1
0

feat: add type info

This commit is contained in:
Dominik Pschenitschni
2022-09-27 22:54:37 +02:00
parent 480aa8813e
commit 0182695cda
4 changed files with 12 additions and 9 deletions

View File

@ -35,7 +35,7 @@ export function setupMarkdownRenderer(checkboxId: string) {
return isLocal ? html : html.replace(/^<a /, '<a target="_blank" rel="noreferrer noopener nofollow" ')
},
},
highlight(code, language) {
highlight(code: string, language: string) {
const validLanguage = hljs.getLanguage(language) ? language : 'plaintext'
return hljs.highlight(code, {language: validLanguage}).value
},

View File

@ -1,21 +1,22 @@
// Save the current list view to local storage
import type { IList } from '@/modelTypes/IList'
type ListView = Record<IList['id'], string>
const DEFAULT_LIST_VIEW = 'list.list' as const
// We use local storage and not a store here to make it persistent across reloads.
export const saveListView = (listId: IList['id'], routeName: string) => {
/**
* Save the current list view to local storage
*/
export function saveListView(listId: IList['id'], routeName: string) {
if (routeName.includes('settings.')) {
return
}
if (!listId) {
return
}
// We use local storage and not the store here to make it persistent across reloads.
const savedListView = localStorage.getItem('listView')
let savedListViewJson: ListView | false = false
if (savedListView !== null) {