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.

fix: no need to convert to px (#1385)

Ran Luoa65516958661
diff --git a/packages/docs-ui/src/services/clipboard/html-to-udm/parse-node-style.ts b/packages/docs-ui/src/services/clipboard/html-to-udm/parse-node-style.ts
index 3b6fcb9408..604905e7dd 100644
--- a/packages/docs-ui/src/services/clipboard/html-to-udm/parse-node-style.ts
+++ b/packages/docs-ui/src/services/clipboard/html-to-udm/parse-node-style.ts
@@ -17,8 +17,6 @@
import type { ITextStyle } from '@univerjs/core';
import { BaselineOffset, BooleanNumber, ColorKit } from '@univerjs/core';
-import { ptToPixel } from './utils';
-
export function extractNodeStyle(node: HTMLElement): ITextStyle {
const styles = node.style;
const docStyles: ITextStyle = {};
@@ -74,7 +72,9 @@ export function extractNodeStyle(node: HTMLElement): ITextStyle {
if (!Number.isNaN(fontSize)) {
// TODO: @JOCS, hand other CSS value unit, rem, em, pt, %
- docStyles.fs = cssValue.endsWith('pt') ? ptToPixel(fontSize) : fontSize;
+ if (cssValue.endsWith('pt')) {
+ docStyles.fs = fontSize;
+ }
}
break;
diff --git a/packages/sheets-ui/src/services/clipboard/html-to-usm/parse-node-style.ts b/packages/sheets-ui/src/services/clipboard/html-to-usm/parse-node-style.ts
index afdfba8542..b11d964eb3 100644
--- a/packages/sheets-ui/src/services/clipboard/html-to-usm/parse-node-style.ts
+++ b/packages/sheets-ui/src/services/clipboard/html-to-usm/parse-node-style.ts
@@ -17,8 +17,6 @@
import type { ITextStyle } from '@univerjs/core';
import { BaselineOffset, BooleanNumber, ColorKit } from '@univerjs/core';
-import { ptToPixel } from './utils';
-
export function extractNodeStyle(node: HTMLElement): ITextStyle {
const styles = node.style;
const docStyles: ITextStyle = {};
@@ -74,7 +72,9 @@ export function extractNodeStyle(node: HTMLElement): ITextStyle {
if (!Number.isNaN(fontSize)) {
// TODO: @JOCS, hand other CSS value unit, rem, em, pt, %
- docStyles.fs = cssValue.endsWith('pt') ? ptToPixel(fontSize) : fontSize;
+ if (cssValue.endsWith('pt')) {
+ docStyles.fs = fontSize;
+ }
}
break;