Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix(nc-gui): ai prompt button click issue without selecting cell

Ramesh Manede7da4971f82
diff --git a/packages/nc-gui/components/smartsheet/grid/canvas/cells/LongText.ts b/packages/nc-gui/components/smartsheet/grid/canvas/cells/LongText.ts
index f5ad9c35e1..a9a4bd22a0 100644
--- a/packages/nc-gui/components/smartsheet/grid/canvas/cells/LongText.ts
+++ b/packages/nc-gui/components/smartsheet/grid/canvas/cells/LongText.ts
@@ -120,6 +120,10 @@ export const LongTextCellRenderer: CellRenderer = {
handleClick: async (props) => {
const { column, getCellPosition, row, mousePosition, makeCellEditable, cellRenderStore, isDoubleClick, selected } = props
+ if (isAIPromptCol(column?.columnObj)) {
+ return AILongTextCellRenderer.handleClick!(props)
+ }
+
if (!selected && !isDoubleClick) return false
const isRichMode = column.columnObj?.meta?.richMode
@@ -135,21 +139,17 @@ export const LongTextCellRenderer: CellRenderer = {
}
}
- if (isAIPromptCol(column?.columnObj)) {
- return AILongTextCellRenderer.handleClick!(props)
- } else {
- const { x, y, width, height } = getCellPosition(column, row.rowMeta.rowIndex!)
+ const { x, y, width, height } = getCellPosition(column, row.rowMeta.rowIndex!)
- if (isBoxHovered({ x: x + width - 28, y: y + 7, width: 18, height: 18 }, mousePosition)) {
- makeCellEditable(row, column)
- return true
- }
+ if (isBoxHovered({ x: x + width - 28, y: y + 7, width: 18, height: 18 }, mousePosition)) {
+ makeCellEditable(row, column)
+ return true
+ }
- if (isDoubleClick && isBoxHovered({ x, y, width, height }, mousePosition)) {
- makeCellEditable(row, column)
- }
- return false
+ if (isDoubleClick && isBoxHovered({ x, y, width, height }, mousePosition)) {
+ makeCellEditable(row, column)
}
+ return false
},
async handleKeyDown(ctx) {
const { e, row, column, makeCellEditable } = ctx