Merge pull request #27 from gautamkrishnar/feat/double-click
Added double click to open the table editor
This commit is contained in:
commit
cd90faeb53
@ -32,6 +32,28 @@ export default function Table(props) {
|
|||||||
|
|
||||||
const height =
|
const height =
|
||||||
tableData.fields.length * tableFieldHeight + tableHeaderHeight + 7;
|
tableData.fields.length * tableFieldHeight + tableHeaderHeight + 7;
|
||||||
|
const openEditor = () => {
|
||||||
|
if (!layout.sidebar) {
|
||||||
|
setSelectedElement((prev) => ({
|
||||||
|
...prev,
|
||||||
|
element: ObjectType.TABLE,
|
||||||
|
id: tableData.id,
|
||||||
|
open: true,
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
setSelectedElement((prev) => ({
|
||||||
|
...prev,
|
||||||
|
currentTab: Tab.TABLES,
|
||||||
|
element: ObjectType.TABLE,
|
||||||
|
id: tableData.id,
|
||||||
|
open: true,
|
||||||
|
}));
|
||||||
|
if (selectedElement.currentTab !== Tab.TABLES) return;
|
||||||
|
document
|
||||||
|
.getElementById(`scroll_table_${tableData.id}`)
|
||||||
|
.scrollIntoView({ behavior: "smooth" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -45,6 +67,7 @@ export default function Table(props) {
|
|||||||
onMouseDown={onMouseDown}
|
onMouseDown={onMouseDown}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
onDoubleClick={openEditor}
|
||||||
className={`border-2 hover:border-dashed hover:border-blue-500
|
className={`border-2 hover:border-dashed hover:border-blue-500
|
||||||
select-none rounded-lg w-full ${
|
select-none rounded-lg w-full ${
|
||||||
settings.mode === "light"
|
settings.mode === "light"
|
||||||
@ -80,28 +103,7 @@ export default function Table(props) {
|
|||||||
opacity: "0.7",
|
opacity: "0.7",
|
||||||
marginRight: "6px",
|
marginRight: "6px",
|
||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={openEditor}
|
||||||
if (!layout.sidebar) {
|
|
||||||
setSelectedElement((prev) => ({
|
|
||||||
...prev,
|
|
||||||
element: ObjectType.TABLE,
|
|
||||||
id: tableData.id,
|
|
||||||
open: true,
|
|
||||||
}));
|
|
||||||
} else {
|
|
||||||
setSelectedElement((prev) => ({
|
|
||||||
...prev,
|
|
||||||
currentTab: Tab.TABLES,
|
|
||||||
element: ObjectType.TABLE,
|
|
||||||
id: tableData.id,
|
|
||||||
open: true,
|
|
||||||
}));
|
|
||||||
if (selectedElement.currentTab !== Tab.TABLES) return;
|
|
||||||
document
|
|
||||||
.getElementById(`scroll_table_${tableData.id}`)
|
|
||||||
.scrollIntoView({ behavior: "smooth" });
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
<Popover
|
<Popover
|
||||||
content={
|
content={
|
||||||
|
Loading…
Reference in New Issue
Block a user