Skip to content

Commit

Permalink
fix: fix extracted value from cell content
Browse files Browse the repository at this point in the history
  • Loading branch information
wzhudev committed Mar 19, 2024
1 parent a078b5c commit 2e22324
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Expand Up @@ -30,6 +30,7 @@ import {
DEFAULT_WORKSHEET_COLUMN_WIDTH,
DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY,
DEFAULT_WORKSHEET_ROW_HEIGHT,
extractPureTextFromCell,
handleStyleToString,
ICommandService,
IConfigService,
Expand Down Expand Up @@ -162,7 +163,8 @@ export class SheetClipboardController extends RxDisposable {
},
onCopyCellContent(row: number, col: number): string {
const cell = currentSheet!.getCell(row, col);
return `${cell?.v || ''}`;
const content = cell ? extractPureTextFromCell(cell) : '';
return content;
},
onCopyCellStyle: (row: number, col: number, rowSpan?: number, colSpan?: number) => {
const properties: IClipboardPropertyItem = {};
Expand Down
Expand Up @@ -17,6 +17,7 @@
import type { ICellData, IMutationInfo, IRange, Worksheet } from '@univerjs/core';
import {
Disposable,
extractPureTextFromCell,
ICommandService,
ILogService,
IUndoRedoService,
Expand Down Expand Up @@ -861,7 +862,7 @@ function getMatrixPlainText(matrix: ObjectMatrix<ICellDataWithSpanInfo>) {
}

function getCellTextForClipboard(cell: ICellDataWithSpanInfo) {
const formatValue = cell.v;
const formatValue = extractPureTextFromCell(cell);
return escapeSpecialCode(formatValue?.toString() || '');
}

Expand Down

0 comments on commit 2e22324

Please sign in to comment.