feat(lesson-preparation): selection-slice 增加 anchorNodeForSelection
This commit is contained in:
@@ -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 }),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user