base load viewer

This commit is contained in:
hamid zarghami
2026-01-07 09:25:59 +03:30
parent a4861eab9b
commit 9479a3425b
9 changed files with 1109 additions and 83 deletions
+12
View File
@@ -146,6 +146,7 @@ type EditorStoreType = {
toggleObjectVisibility: (id: string) => void;
groupObjects: (objectIds: string[]) => void;
ungroupObjects: (groupId: string) => void;
loadPages: (pages: Page[]) => void;
};
const createTableCellId = (row: number, col: number) => `cell-${row}-${col}`;
@@ -904,5 +905,16 @@ export const useEditorStore = create<EditorStoreType>((set, get) => {
const state = get();
return state.objects.filter((obj) => obj.groupId === groupId);
},
loadPages: (pages) => {
if (pages.length === 0) return;
const firstPage = pages[0];
set({
pages,
currentPageId: firstPage.id,
objects: firstPage.objects,
selectedObjectId: null,
selectedObjectIds: [],
});
},
};
});