diff --git a/src/renderer/components/Preview.vue b/src/renderer/components/Preview.vue index e1a39ca4..522fcaf9 100644 --- a/src/renderer/components/Preview.vue +++ b/src/renderer/components/Preview.vue @@ -17,8 +17,13 @@ -
-
目录
+
+
+ 目录 +
+ +
+
{{ head.text }} @@ -45,6 +50,7 @@ import { useBus } from '@fe/support/bus' import { getActionHandler, registerAction, removeAction } from '@fe/context/action' import { revealLineInCenter } from '@fe/context/editor' import Render from './Render.vue' +import SvgIcon from './SvgIcon.vue' import 'github-markdown-css/github-markdown.css' import 'highlight.js/styles/atom-one-dark.css' @@ -52,11 +58,12 @@ import 'katex/dist/katex.min.css' export default defineComponent({ name: 'xview', - components: { Render }, + components: { Render, SvgIcon }, setup () { const bus = useBus() const store = useStore() + const pinOutline = ref(false) const { currentContent, currentFile, autoPreview, presentation } = toRefs(store.state) const fileName = computed(() => currentFile.value?.name) const filePath = computed(() => currentFile.value?.path) @@ -83,6 +90,10 @@ export default defineComponent({ bottom: `max(100vh - ${height.value - (isElectron ? 0 : 20)}px, 40px)` })) + function togglePinOutline () { + pinOutline.value = !pinOutline.value + } + function resizeHandler () { width.value = refViewWrapper.value!.clientWidth height.value = refViewWrapper.value!.clientHeight @@ -222,6 +233,7 @@ export default defineComponent({ }) return { + pinOutline, refViewWrapper, refView, presentation, @@ -232,6 +244,7 @@ export default defineComponent({ heads, todoCount, todoDoneCount, + togglePinOutline, scrollTop, print, showExport, @@ -313,6 +326,7 @@ export default defineComponent({ margin-top: 1em; } +.outline.pined, .outline:hover { max-height: 75vh; max-width: 20em; @@ -338,6 +352,40 @@ export default defineComponent({ background: var(--g-color-75); } +.outline-title { + padding: .5em; + display: flex; + justify-content: space-between; + align-items: center; +} + +.outline-pin { + width: 20px; + height: 20px; + overflow: hidden; + transition: left .1s; + display: flex; + align-items: center; + justify-content: center; + position: relative; + border-radius: 50%; + left: 40px; + color: var(--g-color-20); + + &:hover { + background: var(--g-color-75); + } +} + +.outline:hover .outline-pin, +.outline.pined .outline-pin { + left: 3px; +} + +.outline.pined .outline-pin { + background: var(--g-color-70); +} + .action-btns { font-size: 14px; pointer-events: initial; diff --git a/src/renderer/components/SvgIcon.vue b/src/renderer/components/SvgIcon.vue index 3d44a6d1..736a8cd4 100644 --- a/src/renderer/components/SvgIcon.vue +++ b/src/renderer/components/SvgIcon.vue @@ -24,6 +24,7 @@ export default defineComponent({ clipboard: '', 'chevron-down': '', terminal: '', + thumbtack: '', } const html = ref(icons[props.name!])