feat(lesson-preparation): selection-slice 增加 anchorNodeForSelection

This commit is contained in:
SpecialX
2026-07-04 11:15:14 +08:00
parent a856ab005d
commit 0f4e58d7e1

View File

@@ -2,8 +2,12 @@ import type { StateCreator } from "zustand";
import type { EditorState } from "./use-lesson-plan-editor";
export interface SelectionSlice {
/** 当前在右栏详情面板显示的节点 ID */
selectedNodeId: string | null;
/** 纸上选中文本时,待锚定的目标节点 ID用户从右键菜单选择节点后设置 */
anchorNodeForSelection: string | null;
selectNode: (id: string | null) => void;
setAnchorNodeForSelection: (id: string | null) => void;
}
export const createSelectionSlice: StateCreator<
@@ -13,5 +17,7 @@ export const createSelectionSlice: StateCreator<
SelectionSlice
> = (set) => ({
selectedNodeId: null,
anchorNodeForSelection: null,
selectNode: (id) => set({ selectedNodeId: id }),
setAnchorNodeForSelection: (id) => set({ anchorNodeForSelection: id }),
});