✨ (folders) folders can start with a _
This commit is contained in:
@@ -1,22 +1,27 @@
|
|||||||
import { useUserRepoStore } from '@/modules/repo/store/userRepo.store'
|
import { useUserRepoStore } from '@/modules/repo/store/userRepo.store'
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
|
|
||||||
export const useFolderNotes = (folder: string) => {
|
export const useFolderNotes = (folders: string[]) => {
|
||||||
const store = useUserRepoStore()
|
const store = useUserRepoStore()
|
||||||
|
|
||||||
const fleetingNotes = computed(() =>
|
const fleetingNotes = computed(() =>
|
||||||
store.files.filter(
|
store.files.filter(
|
||||||
(file) => file.path?.startsWith(folder) && file.path?.endsWith('.md')
|
(file) =>
|
||||||
|
folders.some((folder) => file.path?.startsWith(folder)) &&
|
||||||
|
file.path?.endsWith('.md')
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
const content = computed(() =>
|
const content = computed(() =>
|
||||||
fleetingNotes.value?.length > 0
|
fleetingNotes.value?.length > 0
|
||||||
? fleetingNotes.value
|
? fleetingNotes.value
|
||||||
.map(
|
.map((note) => {
|
||||||
(note) =>
|
const firstFolder = note.path?.split('/').shift()
|
||||||
`- [${note.path?.replace(`${folder}/`, '')}](${note.path})`
|
|
||||||
)
|
return `- [${note.path?.replace(`${firstFolder}/`, '')}](${
|
||||||
|
note.path
|
||||||
|
})`
|
||||||
|
})
|
||||||
.join('\n')
|
.join('\n')
|
||||||
: ''
|
: ''
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { defineAsyncComponent, defineComponent } from 'vue'
|
|||||||
|
|
||||||
const FluxNote = defineAsyncComponent(() => import('@/components/FluxNote.vue'))
|
const FluxNote = defineAsyncComponent(() => import('@/components/FluxNote.vue'))
|
||||||
|
|
||||||
const DRAFT_FOLDER = 'drafts'
|
const DRAFT_FOLDER = ['drafts', '_drafts']
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'DraftNotes',
|
name: 'DraftNotes',
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import { defineAsyncComponent, defineComponent } from 'vue'
|
|||||||
|
|
||||||
const FluxNote = defineAsyncComponent(() => import('@/components/FluxNote.vue'))
|
const FluxNote = defineAsyncComponent(() => import('@/components/FluxNote.vue'))
|
||||||
|
|
||||||
const FLEETING_NOTES_FOLDER = 'inbox'
|
const FLEETING_NOTES_FOLDER = ['inbox', '_inbox']
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'FleetingNotes',
|
name: 'FleetingNotes',
|
||||||
|
|||||||
Reference in New Issue
Block a user