generated from template/vite-react-template
bump
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
import { useReactFlow } from '@xyflow/react';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
import { useWallStore } from '../store/wall';
|
||||
import { useShallow } from 'zustand/react/shallow';
|
||||
export const useTabNode = () => {
|
||||
const reactFlowInstance = useReactFlow();
|
||||
const open = useWallStore(useShallow((state) => state.open));
|
||||
useEffect(() => {
|
||||
if (open) return;
|
||||
const listener = (event: any) => {
|
||||
if (event.key === 'Tab') {
|
||||
console.log('tab');
|
||||
const nodes = reactFlowInstance.getNodes();
|
||||
const selectedNode = nodes.find((node) => node.selected);
|
||||
if (!selectedNode) return;
|
||||
@@ -58,5 +60,5 @@ export const useTabNode = () => {
|
||||
return () => {
|
||||
window.removeEventListener('keydown', listener);
|
||||
};
|
||||
}, [reactFlowInstance]);
|
||||
}, [reactFlowInstance, open]);
|
||||
};
|
||||
|
@@ -1,14 +1,16 @@
|
||||
import { get, set, clear } from 'idb-keyval';
|
||||
import { MyCache } from '@kevisual/cache';
|
||||
|
||||
const cache = new MyCache('cacheWall');
|
||||
|
||||
export async function getWallData() {
|
||||
const data = await get('cacheWall');
|
||||
const data = await cache.getData();
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function setWallData(data: any) {
|
||||
await set('cacheWall', data);
|
||||
await cache.setData(data);
|
||||
}
|
||||
|
||||
export async function clearWallData() {
|
||||
await clear();
|
||||
await cache.del();
|
||||
}
|
||||
|
Reference in New Issue
Block a user