File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -709,12 +709,15 @@ export default function ControlPanel({
709709 return ;
710710 }
711711 const v = new Validator ( ) ;
712+ console . log ( obj ) ;
712713 if ( v . validate ( obj , tableSchema ) . valid ) {
713714 addTable ( {
714- ...obj ,
715- x : obj . x + 20 ,
716- y : obj . y + 20 ,
717- id : nanoid ( ) ,
715+ table : {
716+ ...obj ,
717+ x : obj . x + 20 ,
718+ y : obj . y + 20 ,
719+ id : nanoid ( ) ,
720+ } ,
718721 } ) ;
719722 } else if ( v . validate ( obj , areaSchema ) . valid ) {
720723 addArea ( {
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ export default function DiagramContextProvider({ children }) {
4545 if ( data ) {
4646 setTables ( ( prev ) => {
4747 const temp = prev . slice ( ) ;
48- temp . splice ( data . index , 0 , data . table ) ;
48+ temp . splice ( data . index || tables . length , 0 , data . table ) ;
4949 return temp ;
5050 } ) ;
5151 } else {
You can’t perform that action at this time.
0 commit comments