Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

chore: use rich text convert util (#5085)

ybzkydc61cd9a9cc6
diff --git a/packages/docs-ui/src/index.ts b/packages/docs-ui/src/index.ts
index 0a56c230f2..c9318414bf 100644
--- a/packages/docs-ui/src/index.ts
+++ b/packages/docs-ui/src/index.ts
@@ -150,4 +150,5 @@ export { MoveCursorOperation } from './commands/operations/doc-cursor.operation'
export { DocSelectAllCommand } from './commands/commands/doc-select-all.command';
export { type ISetDocZoomRatioOperationParams, SetDocZoomRatioOperation } from './commands/operations/set-doc-zoom-ratio.operation';
export { SetParagraphNamedStyleCommand } from './commands/commands/set-heading.command';
+export { convertBodyToHtml } from './services/clipboard/udm-to-html/convertor';
// #endregion
diff --git a/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts b/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts
index da4ba3f45e..00c337fff8 100644
--- a/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts
+++ b/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts
@@ -47,7 +47,6 @@ import type { IUniverSheetsUIConfig } from '../config.schema';
import {
BooleanNumber,
- convertBodyToHtml,
DEFAULT_WORKSHEET_COLUMN_WIDTH,
DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY,
DEFAULT_WORKSHEET_ROW_HEIGHT,
@@ -69,7 +68,7 @@ import {
} from '@univerjs/core';
import { MessageType } from '@univerjs/design';
-import { DocSelectionRenderService } from '@univerjs/docs-ui';
+import { convertBodyToHtml, DocSelectionRenderService } from '@univerjs/docs-ui';
import { IRenderManagerService, withCurrentTypeOfRenderer } from '@univerjs/engine-render';
import {
@@ -245,7 +244,7 @@ export class SheetClipboardController extends RxDisposable {
onCopyCellContent(row: number, col: number): string {
const cell = currentSheet!.getCell(row, col);
if (cell?.p?.body?.paragraphs || cell?.p?.body?.textRuns) {
- return convertBodyToHtml(cell.p.body);
+ return convertBodyToHtml(cell.p);
}
const content = cell ? extractPureTextFromCell(cell) : '';
return content;