From 25e05254da5801561235bfc50090c95991966e83 Mon Sep 17 00:00:00 2001 From: gaze <397334393@qq.com> Date: Thu, 31 Aug 2023 14:29:56 +0800 Subject: [PATCH] fix: copy number with text format to a cell with text format --- packages/core/src/events/paste.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/core/src/events/paste.ts b/packages/core/src/events/paste.ts index 846ae7eb..31e8658b 100644 --- a/packages/core/src/events/paste.ts +++ b/packages/core/src/events/paste.ts @@ -1498,6 +1498,11 @@ export function handlePaste(ctx: Context, e: ClipboardEvent) { // } const allowEdit = isAllowEdit(ctx); if (!allowEdit) return; + if ((ctx.luckysheet_select_save?.length ?? 0) !== 1) return; + const minh = ctx.luckysheet_select_save![0].row[0]; + const minc = ctx.luckysheet_select_save![0].column[0]; + const flowdata = getFlowdata(ctx); + if (!flowdata) return; if (selectionCache.isPasteAction) { ctx.luckysheetCellUpdate = []; @@ -1719,7 +1724,9 @@ export function handlePaste(ctx: Context, e: ClipboardEvent) { } else { const mask = genarate(txt); // @ts-ignore - [cell.m, cell.ct, cell.v] = mask; + [cell.m, cell.ct, cell.v] = flowdata[r + minh][c + minc]?.ct?.fa + ? [txt, flowdata[r + minh][c + minc]?.ct, txt] + : mask; } const styleString = typeof allStyleList[`.${className}`] === "string"