fix bug guide line
This commit is contained in:
@@ -244,7 +244,7 @@ export const buildGroupResult = (
|
||||
|
||||
if (allObjectIdsToGroup.size < 2) return null;
|
||||
|
||||
const groupId = nextGroupId ?? `group-${crypto.randomUUID()}`;
|
||||
const groupId = nextGroupId ?? createScopedId("group");
|
||||
const objectsToGroup = objects.filter(
|
||||
(obj) => allObjectIdsToGroup.has(obj.id) && obj.type !== "group",
|
||||
);
|
||||
|
||||
@@ -121,7 +121,7 @@ export const useEditorStore = create<EditorStoreType>((set, get) => {
|
||||
const sourceIds = new Set(sourceObjects.map((obj) => obj.id));
|
||||
const idMap = new Map<string, string>();
|
||||
sourceObjects.forEach((obj) => {
|
||||
idMap.set(obj.id, `${obj.id}-${crypto.randomUUID()}`);
|
||||
idMap.set(obj.id, createScopedId(obj.id));
|
||||
});
|
||||
|
||||
return sourceObjects.map((objectToClone) => ({
|
||||
@@ -136,13 +136,13 @@ export const useEditorStore = create<EditorStoreType>((set, get) => {
|
||||
...(objectToClone.tableData && {
|
||||
tableData: {
|
||||
...objectToClone.tableData,
|
||||
id: `table-${crypto.randomUUID()}`,
|
||||
id: createScopedId("table"),
|
||||
cells: Object.fromEntries(
|
||||
Object.entries(objectToClone.tableData.cells).map(([key, cell]) => [
|
||||
key,
|
||||
{
|
||||
...cell,
|
||||
id: `cell-${crypto.randomUUID()}`,
|
||||
id: createScopedId("cell"),
|
||||
},
|
||||
]),
|
||||
),
|
||||
@@ -384,7 +384,7 @@ export const useEditorStore = create<EditorStoreType>((set, get) => {
|
||||
editingCell: null,
|
||||
setEditingCell: (cell) => set({ editingCell: cell }),
|
||||
addTable: (x, y, rows = 4, cols = 5) => {
|
||||
const tableId = `table-${crypto.randomUUID()}`;
|
||||
const tableId = createScopedId("table");
|
||||
const cellWidth = 100;
|
||||
const cellHeight = 50;
|
||||
const tableData: TableData = {
|
||||
@@ -626,7 +626,7 @@ export const useEditorStore = create<EditorStoreType>((set, get) => {
|
||||
|
||||
const duplicatedObjects = pageToDuplicate.objects.map((obj) => ({
|
||||
...obj,
|
||||
id: `${obj.id}-${crypto.randomUUID()}`,
|
||||
id: createScopedId(obj.id),
|
||||
}));
|
||||
|
||||
const newPage: Page = {
|
||||
|
||||
Reference in New Issue
Block a user