focus newly added card

This commit is contained in:
Triston Armstrong 2024-10-05 13:16:25 -04:00
parent 32cd89a4d1
commit 9016796b51
3 changed files with 4 additions and 1 deletions

View File

@ -19,7 +19,6 @@ export function CardSelector() {
function StickyNote() { function StickyNote() {
function _handleClick(e: MouseEvent) { function _handleClick(e: MouseEvent) {
NotesSigal.default.addNote({ NotesSigal.default.addNote({
type: "note", type: "note",
title: "New Note", title: "New Note",

View File

@ -1,5 +1,6 @@
import { signal } from "kaioken" import { signal } from "kaioken"
import { Card } from "../types" import { Card } from "../types"
import { focusedItem } from "."
export type ImageCardType = Card<"image"> export type ImageCardType = Card<"image">
@ -16,6 +17,7 @@ function addImage(data: Omit<ImageCardType, "id">) {
} }
images.value[newCard.id] = newCard images.value[newCard.id] = newCard
images.notify() images.notify()
focusedItem.value = newCard.id
} }
function removeImage(id: ImageCardType["id"]) { function removeImage(id: ImageCardType["id"]) {

View File

@ -1,5 +1,6 @@
import { signal } from "kaioken" import { signal } from "kaioken"
import { Card } from "../types" import { Card } from "../types"
import { focusedItem } from "."
export type NoteCardType = Card<"note"> export type NoteCardType = Card<"note">
@ -16,6 +17,7 @@ function addNote(data: Omit<NoteCardType, "id">) {
} }
notes.value[newCard.id] = newCard notes.value[newCard.id] = newCard
notes.notify() notes.notify()
focusedItem.value = newCard.id
} }
function removeNote(id: NoteCardType["id"]) { function removeNote(id: NoteCardType["id"]) {