Merge branch 'main' of github.com:lite-note/lite-note into main

This commit is contained in:
Julien Calixte
2021-08-15 13:26:11 +02:00
3 changed files with 9 additions and 4 deletions

View File

@@ -6,7 +6,7 @@ import { useOverlay } from '@/hooks/useOverlay.hook'
import { useQueryStackedNotes } from '@/hooks/useQueryStackedNotes.hook' import { useQueryStackedNotes } from '@/hooks/useQueryStackedNotes.hook'
import { resolvePath } from '@/modules/repo/services/resolvePath' import { resolvePath } from '@/modules/repo/services/resolvePath'
import { useUserRepoStore } from '@/modules/repo/store/userRepo.store' import { useUserRepoStore } from '@/modules/repo/store/userRepo.store'
import { pathToNoteTitle } from '@/utils/noteTitle' import { pathToNotePathTitle } from '@/utils/noteTitle'
export const useNote = (containerClass: string) => { export const useNote = (containerClass: string) => {
const store = useUserRepoStore() const store = useUserRepoStore()
@@ -20,7 +20,7 @@ export const useNote = (containerClass: string) => {
} }
const filePath = store.files.find((file) => file.sha === note)?.path ?? '' const filePath = store.files.find((file) => file.sha === note)?.path ?? ''
obj[note] = pathToNoteTitle(filePath) obj[note] = pathToNotePathTitle(filePath)
return obj return obj
}, {}) }, {})

View File

@@ -1,5 +1,5 @@
@charset "utf-8"; @charset "utf-8";
@import url('https://fonts.googleapis.com/css2?family=Courier+Prime&family=Courgette&family=IBM+Plex+Serif&family=Kiwi+Maru&family=Maven+Pro&family=Noto+Sans+KR&family=Tajawal&family=Domine&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Courier+Prime&family=Courgette&family=IBM+Plex+Serif&family=Kiwi+Maru&family=Maven+Pro&family=Noto+Sans+KR&family=Tajawal&family=Domine&family=Amiri&display=swap');
/** /**
font-family: 'Courgette', cursive; font-family: 'Courgette', cursive;
@@ -9,6 +9,7 @@
font-family: 'Noto Sans KR', sans-serif; font-family: 'Noto Sans KR', sans-serif;
font-family: 'Tajawal', sans-serif; font-family: 'Tajawal', sans-serif;
font-family: 'Domine', serif; font-family: 'Domine', serif;
font-family: 'Amiri', serif;
*/ */
$primary: #2c3a47; $primary: #2c3a47;

View File

@@ -1,7 +1,7 @@
export const filenameToNoteTitle = (title: string) => export const filenameToNoteTitle = (title: string) =>
title.replaceAll('/', ' / ').replaceAll('-', ' ') title.replaceAll('/', ' / ').replaceAll('-', ' ')
export const pathToNoteTitle = (path: string) => { export const pathToNotePathTitle = (path: string) => {
const fileNames = path.split('.') const fileNames = path.split('.')
fileNames.pop() fileNames.pop()
@@ -12,3 +12,7 @@ export const pathToNoteTitle = (path: string) => {
.join('/') .join('/')
.replaceAll('-', ' ') .replaceAll('-', ' ')
} }
export const pathToNoteTitle = (notePathTitle: string) => {
return pathToNotePathTitle(notePathTitle).split('/').pop()?.trim() ?? ''
}