Merge branch 'main' of github.com:lite-note/lite-note into main
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import LiteLoading from '@/components/LiteLoading.vue'
|
||||||
import { useLinks } from '@/hooks/useLinks.hook'
|
import { useLinks } from '@/hooks/useLinks.hook'
|
||||||
import { useMarkdown } from '@/hooks/useMarkdown.hook'
|
import { useMarkdown } from '@/hooks/useMarkdown.hook'
|
||||||
import { useNote } from '@/hooks/useNote.hook'
|
import { useNote } from '@/hooks/useNote.hook'
|
||||||
@@ -111,13 +112,7 @@ const focus = () => scrollToFocusedNote(undefined, true)
|
|||||||
</h4>
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
<slot />
|
<slot />
|
||||||
<div v-if="isLoading" class="loading">
|
<lite-loading v-if="isLoading" />
|
||||||
<img
|
|
||||||
class="is-loading"
|
|
||||||
src="@/assets/icons/loading.svg"
|
|
||||||
alt="loading..."
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div v-else-if="!hasContent">No content here 📝</div>
|
<div v-else-if="!hasContent">No content here 📝</div>
|
||||||
<p
|
<p
|
||||||
v-else-if="withContent"
|
v-else-if="withContent"
|
||||||
@@ -184,7 +179,11 @@ $header-height: 40px;
|
|||||||
|
|
||||||
.repo-title {
|
.repo-title {
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
text-align: center;
|
|
||||||
|
.title,
|
||||||
|
.subtitle {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,6 +202,10 @@ $header-height: 40px;
|
|||||||
&:not(:first-child) {
|
&:not(:first-child) {
|
||||||
border-top: 1px solid rgba(18, 19, 58, 0.2);
|
border-top: 1px solid rgba(18, 19, 58, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 769px) {
|
@media screen and (min-width: 769px) {
|
||||||
@@ -224,17 +227,6 @@ $header-height: 40px;
|
|||||||
max-width: var(--note-width);
|
max-width: var(--note-width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading {
|
|
||||||
display: flex;
|
|
||||||
flex: 1;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.is-loading {
|
|
||||||
animation: spinAround 0.8s infinite linear;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media print, screen and (max-width: 768px) {
|
@media print, screen and (max-width: 768px) {
|
||||||
|
|||||||
18
src/components/LiteLoading.vue
Normal file
18
src/components/LiteLoading.vue
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<template>
|
||||||
|
<div class="lite-loading">
|
||||||
|
<img class="is-loading" src="@/assets/icons/loading.svg" alt="loading..." />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.lite-loading {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.is-loading {
|
||||||
|
animation: spinAround 0.8s infinite linear;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import LiteLoading from '@/components/LiteLoading.vue'
|
||||||
import { useRegisterSW } from 'virtual:pwa-register/vue'
|
import { useRegisterSW } from 'virtual:pwa-register/vue'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
|
||||||
const devMode = ref(import.meta.env.DEV)
|
const devMode = ref(import.meta.env.DEV)
|
||||||
|
const isLoading = ref(false)
|
||||||
const { offlineReady, needRefresh, updateServiceWorker } = useRegisterSW()
|
const { offlineReady, needRefresh, updateServiceWorker } = useRegisterSW()
|
||||||
|
|
||||||
const close = async () => {
|
const close = async () => {
|
||||||
@@ -10,6 +12,11 @@ const close = async () => {
|
|||||||
needRefresh.value = false
|
needRefresh.value = false
|
||||||
devMode.value = false
|
devMode.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const reload = () => {
|
||||||
|
isLoading.value = true
|
||||||
|
updateServiceWorker()
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -25,12 +32,9 @@ const close = async () => {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<button
|
<button class="button is-primary" v-if="needRefresh" @click="reload">
|
||||||
class="button is-primary"
|
<LiteLoading v-if="isLoading" />
|
||||||
v-if="needRefresh"
|
<span v-else>Reload</span>
|
||||||
@click="updateServiceWorker()"
|
|
||||||
>
|
|
||||||
Reload
|
|
||||||
</button>
|
</button>
|
||||||
<button class="button" @click="close">Close</button>
|
<button class="button" @click="close">Close</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ const props = defineProps<{
|
|||||||
|
|
||||||
const { scrollToFocusedNote } = useQueryStackedNotes()
|
const { scrollToFocusedNote } = useQueryStackedNotes()
|
||||||
const { content } = useFile(props.sha)
|
const { content } = useFile(props.sha)
|
||||||
const { listenToClick } = useLinks('stacked-note', props.sha)
|
|
||||||
const className = computed(() => `stacked-note-${props.index}`)
|
const className = computed(() => `stacked-note-${props.index}`)
|
||||||
|
const { listenToClick } = useLinks(className.value, props.sha)
|
||||||
const titleClassName = computed(() => `title-${className.value}`)
|
const titleClassName = computed(() => `title-${className.value}`)
|
||||||
useTitleNotes(props.repo)
|
useTitleNotes(props.repo)
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ const focus = () => scrollToFocusedNote(props.sha)
|
|||||||
$border-color: rgba(18, 19, 58, 0.2);
|
$border-color: rgba(18, 19, 58, 0.2);
|
||||||
|
|
||||||
.stacked-note {
|
.stacked-note {
|
||||||
padding: 1rem 1.5rem;
|
padding: 0 1.5rem 1rem;
|
||||||
background-color: var(--background-color);
|
background-color: var(--background-color);
|
||||||
|
|
||||||
transition: cubic-bezier(0.39, 0.575, 0.565, 1) 0.3s;
|
transition: cubic-bezier(0.39, 0.575, 0.565, 1) 0.3s;
|
||||||
@@ -125,7 +125,7 @@ $border-color: rgba(18, 19, 58, 0.2);
|
|||||||
|
|
||||||
@media screen and (max-width: 768px) {
|
@media screen and (max-width: 768px) {
|
||||||
.stacked-note {
|
.stacked-note {
|
||||||
padding: 0 1.5rem;
|
padding: 0 0.5rem 1rem;
|
||||||
|
|
||||||
.title-stacked-note {
|
.title-stacked-note {
|
||||||
padding: 0.5rem 0 0;
|
padding: 0.5rem 0 0;
|
||||||
@@ -137,6 +137,8 @@ $border-color: rgba(18, 19, 58, 0.2);
|
|||||||
}
|
}
|
||||||
|
|
||||||
.note-content {
|
.note-content {
|
||||||
|
padding: 0 1.5rem;
|
||||||
|
|
||||||
.table {
|
.table {
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
import { noteEventBus } from '@/bus/noteEventBus'
|
import { noteEventBus } from '@/bus/noteEventBus'
|
||||||
import { useUserRepoStore } from '@/modules/repo/store/userRepo.store'
|
import { useUserRepoStore } from '@/modules/repo/store/userRepo.store'
|
||||||
import { isExternalLink } from '@/utils/link'
|
import { isExternalLink } from '@/utils/link'
|
||||||
import { onUnmounted } from 'vue'
|
import { ComputedRef, onUnmounted, toValue } from 'vue'
|
||||||
|
|
||||||
export const useLinks = (className: string, sha?: string) => {
|
export const useLinks = (
|
||||||
|
className: ComputedRef<string> | string,
|
||||||
|
sha?: string
|
||||||
|
) => {
|
||||||
const store = useUserRepoStore()
|
const store = useUserRepoStore()
|
||||||
|
|
||||||
const linkNote: EventListener = (event) => {
|
const linkNote: EventListener = (event) => {
|
||||||
@@ -34,7 +37,7 @@ export const useLinks = (className: string, sha?: string) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const selector = `.${className} a`
|
const selector = `.${toValue(className)} a`
|
||||||
|
|
||||||
const removeListeners = () => {
|
const removeListeners = () => {
|
||||||
const elements = document.querySelectorAll(selector)
|
const elements = document.querySelectorAll(selector)
|
||||||
|
|||||||
@@ -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&family=Amiri&display=swap&family=Montagu+Slab&family=Gowun+Batang&family=Cormorant+Garamond&family=forum');
|
@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&family=Montagu+Slab&family=Gowun+Batang&family=Cormorant+Garamond&family=Forum');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
font-family: 'Courgette', cursive;
|
font-family: 'Courgette', cursive;
|
||||||
@@ -113,4 +113,4 @@ pre {
|
|||||||
|
|
||||||
code {
|
code {
|
||||||
font-family: var(--font-family);
|
font-family: var(--font-family);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user