♻️ (flux note) move in a component flux …
flux note will be used for fleeting notes and drafts too
This commit is contained in:
@@ -28,6 +28,7 @@ export const useLinks = (className: string, sha?: string) => {
|
||||
|
||||
const removeListeners = () => {
|
||||
const elements = document.querySelectorAll(selector)
|
||||
|
||||
elements.forEach((element) => {
|
||||
element.removeEventListener('click', linkNote)
|
||||
})
|
||||
@@ -36,6 +37,7 @@ export const useLinks = (className: string, sha?: string) => {
|
||||
const listenToClick = () => {
|
||||
removeListeners()
|
||||
const elements = document.querySelectorAll(selector)
|
||||
|
||||
elements.forEach((element) => {
|
||||
element.addEventListener('click', linkNote)
|
||||
})
|
||||
|
||||
@@ -8,8 +8,8 @@ let initial = true
|
||||
|
||||
export const useQueryStackedNotes = () => {
|
||||
const { query } = useRoute()
|
||||
if (initial) {
|
||||
initial = false
|
||||
|
||||
const setStackedNotes = () => {
|
||||
stackedNotes.value = (Array.isArray(query.stackedNotes)
|
||||
? query.stackedNotes
|
||||
: [query.stackedNotes]
|
||||
@@ -18,6 +18,11 @@ export const useQueryStackedNotes = () => {
|
||||
.filter((n) => !!n) as string[]
|
||||
}
|
||||
|
||||
if (initial) {
|
||||
initial = false
|
||||
setStackedNotes()
|
||||
}
|
||||
|
||||
return {
|
||||
stackedNotes: readonly(stackedNotes),
|
||||
updateQueryStackedNotes: (newStackedNotes: string[]) =>
|
||||
|
||||
@@ -14,7 +14,11 @@ interface Tree {
|
||||
url?: string
|
||||
}
|
||||
|
||||
export const useRepo = (owner: Ref<string>, repo: Ref<string>) => {
|
||||
export const useRepo = (
|
||||
owner: Ref<string>,
|
||||
repo: Ref<string>,
|
||||
fetchRepo = true
|
||||
) => {
|
||||
const { getCachedNote, saveCacheNote } = useNoteCache('README')
|
||||
const { accessToken } = useGitHubLogin()
|
||||
|
||||
@@ -83,7 +87,11 @@ export const useRepo = (owner: Ref<string>, repo: Ref<string>) => {
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => retrieveRepo())
|
||||
onMounted(() => {
|
||||
if (fetchRepo) {
|
||||
retrieveRepo()
|
||||
}
|
||||
})
|
||||
|
||||
watch([owner, repo], () => retrieveRepo())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user