@@ -32,6 +32,28 @@ export default function Table(props) {
3232
3333 const height =
3434 tableData . fields . length * tableFieldHeight + tableHeaderHeight + 7 ;
35+ const openEditor = ( ) => {
36+ if ( ! layout . sidebar ) {
37+ setSelectedElement ( ( prev ) => ( {
38+ ...prev ,
39+ element : ObjectType . TABLE ,
40+ id : tableData . id ,
41+ open : true ,
42+ } ) ) ;
43+ } else {
44+ setSelectedElement ( ( prev ) => ( {
45+ ...prev ,
46+ currentTab : Tab . TABLES ,
47+ element : ObjectType . TABLE ,
48+ id : tableData . id ,
49+ open : true ,
50+ } ) ) ;
51+ if ( selectedElement . currentTab !== Tab . TABLES ) return ;
52+ document
53+ . getElementById ( `scroll_table_${ tableData . id } ` )
54+ . scrollIntoView ( { behavior : "smooth" } ) ;
55+ }
56+ }
3557
3658 return (
3759 < >
@@ -45,6 +67,7 @@ export default function Table(props) {
4567 onMouseDown = { onMouseDown }
4668 >
4769 < div
70+ onDoubleClick = { openEditor }
4871 className = { `border-2 hover:border-dashed hover:border-blue-500
4972 select-none rounded-lg w-full ${
5073 settings . mode === "light"
@@ -80,28 +103,7 @@ export default function Table(props) {
80103 opacity : "0.7" ,
81104 marginRight : "6px" ,
82105 } }
83- onClick = { ( ) => {
84- if ( ! layout . sidebar ) {
85- setSelectedElement ( ( prev ) => ( {
86- ...prev ,
87- element : ObjectType . TABLE ,
88- id : tableData . id ,
89- open : true ,
90- } ) ) ;
91- } else {
92- setSelectedElement ( ( prev ) => ( {
93- ...prev ,
94- currentTab : Tab . TABLES ,
95- element : ObjectType . TABLE ,
96- id : tableData . id ,
97- open : true ,
98- } ) ) ;
99- if ( selectedElement . currentTab !== Tab . TABLES ) return ;
100- document
101- . getElementById ( `scroll_table_${ tableData . id } ` )
102- . scrollIntoView ( { behavior : "smooth" } ) ;
103- }
104- } }
106+ onClick = { openEditor }
105107 />
106108 < Popover
107109 content = {
0 commit comments