Keep current cursor when switching gallery/details.
This commit is contained in:
		| @@ -80,8 +80,6 @@ import { connect, controlUrl } from '@/repositories/WS' | ||||
| import { formatSize } from '@/utils' | ||||
| import { useRouter } from 'vue-router' | ||||
| import ContextMenu from '@imengyu/vue3-context-menu' | ||||
| import type { SortOrder } from '@/utils/docsort' | ||||
| import type SvgButtonVue from './SvgButton.vue' | ||||
|  | ||||
| const props = defineProps<{ | ||||
|   path: Array<string> | ||||
| @@ -219,7 +217,14 @@ let modifiedTimer: any = null | ||||
| const updateModified = () => { | ||||
|   nowkey.value = Math.floor(Date.now() / 1000) | ||||
| } | ||||
| onMounted(() => { updateModified(); modifiedTimer = setInterval(updateModified, 1000) }) | ||||
| onMounted(() => { | ||||
|   updateModified(); modifiedTimer = setInterval(updateModified, 1000) | ||||
|   const active = document.querySelector('.cursor') as HTMLElement | null | ||||
|   if (active) { | ||||
|     active.scrollIntoView({ block: 'center', behavior: 'smooth' }) | ||||
|     active.focus() | ||||
|   } | ||||
| }) | ||||
| onUnmounted(() => { clearInterval(modifiedTimer) }) | ||||
| const mkdir = (doc: Doc, name: string) => { | ||||
|   const control = connect(controlUrl, { | ||||
|   | ||||
| @@ -169,8 +169,13 @@ let modifiedTimer: any = null | ||||
| const updateModified = () => { | ||||
|   nowkey.value = Math.floor(Date.now() / 1000) | ||||
| } | ||||
| onMounted(() => { updateModified(); modifiedTimer = setInterval(updateModified, 1000) }) | ||||
| onUnmounted(() => { clearInterval(modifiedTimer) }) | ||||
| onMounted(() => { | ||||
|   const active = document.querySelector('.cursor') as HTMLElement | null | ||||
|   if (active) { | ||||
|     active.scrollIntoView({ block: 'center', behavior: 'smooth' }) | ||||
|     active.focus() | ||||
|   } | ||||
| }) | ||||
| const mkdir = (doc: Doc, name: string) => { | ||||
|   const control = connect(controlUrl, { | ||||
|     open() { | ||||
|   | ||||
| @@ -9,12 +9,12 @@ | ||||
|       <slot></slot> | ||||
|       <MediaPreview ref=m :doc="doc" tabindex=-1 quality="sz=512" class="figcontent" /> | ||||
|       <div class="titlespacer"></div> | ||||
|       <figcaption> | ||||
|       <figcaption @click.prevent> | ||||
|         <template v-if="editing"> | ||||
|           <FileRenameInput :doc=doc :rename=editing.rename :exit=editing.exit /> | ||||
|         </template> | ||||
|         <template v-else> | ||||
|           <SelectBox :doc=doc /> | ||||
|           <SelectBox :doc=doc @click="store.cursor = doc.key"/> | ||||
|           <span :title="doc.name + '\n' + doc.modified + '\n' + doc.sizedisp">{{ doc.name }}</span> | ||||
|           <div class=namespacer></div> | ||||
|         </template> | ||||
| @@ -83,11 +83,13 @@ figcaption input[type='checkbox'] { | ||||
|   margin: .25em 0 .25em .25em; | ||||
|   opacity: 0; | ||||
|   flex-shrink: 0; | ||||
|   transition: opacity var(--transition-time) ease-in-out; | ||||
| } | ||||
| figcaption input[type='checkbox']:checked, figcaption input[type='checkbox']:hover { | ||||
| figcaption input[type='checkbox']:checked, figcaption:hover input[type='checkbox'] { | ||||
|   opacity: 1; | ||||
| } | ||||
| figcaption span { | ||||
|   cursor: default; | ||||
|   padding: .5em; | ||||
|   color: #fff; | ||||
|   font-weight: 600; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Leo Vasanko
					Leo Vasanko