mirror of
https://github.com/chartdb/chartdb.git
synced 2025-11-04 14:03:15 +00:00
get current diagram to export
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, { useCallback } from 'react';
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
import { DBTable } from '@/lib/domain/db-table';
|
||||
import { generateId, randomHSLA } from '@/lib/utils';
|
||||
import { ChartDBContext, chartDBContext } from './chartdb-context';
|
||||
@@ -8,6 +8,7 @@ import { DBIndex } from '@/lib/domain/db-index';
|
||||
import { DBRelationship } from '@/lib/domain/db-relationship';
|
||||
import { useStorage } from '@/hooks/use-storage';
|
||||
import { useRedoUndoStack } from '@/hooks/use-redo-undo-stack';
|
||||
import { Diagram } from '@/lib/domain/diagram';
|
||||
|
||||
export const ChartDBProvider: React.FC<React.PropsWithChildren> = ({
|
||||
children,
|
||||
@@ -24,6 +25,17 @@ export const ChartDBProvider: React.FC<React.PropsWithChildren> = ({
|
||||
[]
|
||||
);
|
||||
|
||||
const currentDiagram: Diagram = useMemo(
|
||||
() => ({
|
||||
id: diagramId,
|
||||
name: diagramName,
|
||||
databaseType,
|
||||
tables,
|
||||
relationships,
|
||||
}),
|
||||
[diagramId, diagramName, databaseType, tables, relationships]
|
||||
);
|
||||
|
||||
const updateDatabaseType: ChartDBContext['updateDatabaseType'] =
|
||||
useCallback(
|
||||
async (databaseType) => {
|
||||
@@ -778,6 +790,7 @@ export const ChartDBProvider: React.FC<React.PropsWithChildren> = ({
|
||||
databaseType,
|
||||
tables,
|
||||
relationships,
|
||||
currentDiagram,
|
||||
updateDiagramId,
|
||||
updateDiagramName,
|
||||
loadDiagram,
|
||||
|
||||
Reference in New Issue
Block a user