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.

Merge branch 'dev' of https://github.com/dream-num/univer into dev

DR-Univer3fc690936985
diff --cc packages/base-ui/src/Helpers/Cell.ts
index eabd193062,c4260fb445..593106853e
--- a/packages/base-ui/src/Helpers/Cell.ts
+++ b/packages/base-ui/src/Helpers/Cell.ts
@@@ -1,23 -1,5 +1,5 @@@
- import {
- BaselineOffset,
- BlockType,
- BorderStyleTypes,
- getColorStyle,
- HorizontalAlign,
- ICellData,
- IDocumentData,
- IElement,
- IRangeData,
- IStyleData,
- ITextDecoration,
- ParagraphElementType,
- TextDirection,
- Tools,
- VerticalAlign,
- WrapStrategy,
- } from '@univer/core';
- import { nanoid } from 'nanoid';
-import { BlockType, ICellData, IDocumentData, IElementsOrder, IRangeData, IStyleData, ITextDecoration, Tools } from '@univerjs/core';
-import { pxToPt } from '@univerjs/base-render';
++import { BlockType, ICellData, IDocumentData, IElement, IRangeData, IStyleData, ITextDecoration, Tools } from '@univer/core';
+import { pxToPt } from '@univer/base-render';
import { textTrim } from '../Utils';
// TODO: move to Utils
@@@ -62,9 -45,9 +44,9 @@@ export function handleDomToJson($dom: H
spanTexts.forEach((item) => {
ed = +item.length;
- let eId = nanoid(6);
+ let eId = Tools.generateRandomId(6);
- elements[eId] = {
+ elements.push({
eId,
st: 0,
ed: item.length - 1,
@@@ -104,12 -93,12 +86,12 @@@
});
}
- const blockId = nanoid(6);
+ const blockId = Tools.generateRandomId(6);
let p = {
- id: nanoid(6),
+ id: Tools.generateRandomId(6),
body: {
- blockElements: {
- [blockId]: {
+ blockElements: [
+ {
blockId,
st: 0,
ed,
diff --cc packages/core/src/Docs/Domain/DocumentModel.ts
index 323e5470db,8bb92db538..74aeb826c8
--- a/packages/core/src/Docs/Domain/DocumentModel.ts
+++ b/packages/core/src/Docs/Domain/DocumentModel.ts
@@@ -5,7 -4,7 +4,7 @@@ import { BlockType, IDocumentData, ITex
import { DEFAULT_DOC } from '../../Const';
import { DOC_ACTION_NAMES } from '../../Const/DOC_ACTION_NAMES';
import { getDocsUpdateBody } from '../Apply/Common';
- import { Nullable } from '../../Shared';
-import { Tools } from '../../Shared';
++import { Nullable, Tools } from '../../Shared';
export class DocumentModel {
private _snapshot: IDocumentData;
diff --cc packages/core/src/Shared/Migrate/Migrate.ts
index 90b467dd56,2846e9a895..536b106ad8
--- a/packages/core/src/Shared/Migrate/Migrate.ts
+++ b/packages/core/src/Shared/Migrate/Migrate.ts
@@@ -3,10 -2,11 +2,11 @@@ import
IWorkbookConfig,
IWorksheetConfig,
ICellData,
- IElementsOrder,
ITextStyle,
IStyleData,
+ IElement,
} from '../../Interfaces';
+ import { Tools } from '../Tools';
import { IKeyValue } from '../Types';
import { border } from './Border';
@@@ -226,8 -227,8 +226,8 @@@ export function migrate(config: any): P
};
}
- const eId = nanoid(6);
+ const eId = Tools.generateRandomId(6);
- elements[eId] = {
+ elements.push({
eId,
st: 0,
ed: element.v.length - 1,
@@@ -240,10 -246,10 +240,10 @@@
});
newCell.p = {
- id: nanoid(6),
+ id: Tools.generateRandomId(6),
body: {
- blockElements: {
- p1: {
+ blockElements: [
+ {
blockId: 'p1',
st: 0,
ed: cell.ct.s.length - 1,