fix grid add text

This commit is contained in:
hamid zarghami
2025-12-31 14:31:37 +03:30
parent 1ba62b0cee
commit 828ba0c7c1
4 changed files with 33 additions and 32 deletions
+13 -19
View File
@@ -71,8 +71,8 @@ const EditorCanvas = () => {
}
};
const handleCellDblClick = (tableId: string, cellId: string, x: number, y: number, text: string) => {
setEditingCell({ tableId, cellId, x, y, value: text });
const handleCellDblClick = (tableId: string, cellId: string, x: number, y: number, width: number, height: number, text: string) => {
setEditingCell({ tableId, cellId, x, y, width, height, value: text });
};
const handleCellEditorSave = (text: string) => {
@@ -228,23 +228,17 @@ const EditorCanvas = () => {
</Layer>
</Stage>
</div>
{editingCell && (() => {
const obj = objects.find((o) => o.id === editingCell.tableId);
if (!obj || !obj.tableData) return null;
const cell = obj.tableData.cells[editingCell.cellId];
if (!cell) return null;
return (
<CellEditor
x={editingCell.x}
y={editingCell.y}
width={cell.width}
height={cell.height}
value={editingCell.value}
onSave={handleCellEditorSave}
onCancel={handleCellEditorCancel}
/>
);
})()}
{editingCell && (
<CellEditor
x={editingCell.x}
y={editingCell.y}
width={editingCell.width}
height={editingCell.height}
value={editingCell.value}
onSave={handleCellEditorSave}
onCancel={handleCellEditorCancel}
/>
)}
<ZoomControls />
</div>
);