Fix cursor handling
This commit is contained in:
parent
671359e327
commit
5808fe17ad
|
@ -141,7 +141,7 @@ defineExpose({
|
||||||
return store.cursor && editing.value === null
|
return store.cursor && editing.value === null
|
||||||
},
|
},
|
||||||
cursorRename() {
|
cursorRename() {
|
||||||
editing.value = store.cursor
|
editing.value = props.documents.find(doc => doc.key === store.cursor) ?? null
|
||||||
},
|
},
|
||||||
cursorSelect() {
|
cursorSelect() {
|
||||||
const key = store.cursor
|
const key = store.cursor
|
||||||
|
@ -164,7 +164,7 @@ defineExpose({
|
||||||
const mod = (a: number, b: number) => ((a % b) + b) % b
|
const mod = (a: number, b: number) => ((a % b) + b) % b
|
||||||
const increment = (i: number, d: number) => mod(i + d, N + 1)
|
const increment = (i: number, d: number) => mod(i + d, N + 1)
|
||||||
const index =
|
const index =
|
||||||
store.cursor ? docs.find(doc => doc.key === store.cursor) : docs.length
|
store.cursor ? docs.findIndex(doc => doc.key === store.cursor) : docs.length
|
||||||
const moveto = increment(index, d)
|
const moveto = increment(index, d)
|
||||||
store.cursor = docs[moveto]?.key ?? ''
|
store.cursor = docs[moveto]?.key ?? ''
|
||||||
const tr = store.cursor ? document.getElementById(`file-${store.cursor}`) : ''
|
const tr = store.cursor ? document.getElementById(`file-${store.cursor}`) : ''
|
||||||
|
|
Loading…
Reference in New Issue
Block a user