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.

refactor: remove segmentId and line etc in action type (#3877)

Ran Luo26d796b32d2e
diff --git a/packages/core/src/docs/data-model/text-x/__tests__/action-iterator.spec.ts b/packages/core/src/docs/data-model/text-x/__tests__/action-iterator.spec.ts
index 34ab6fa929..cf43fe1b3c 100644
--- a/packages/core/src/docs/data-model/text-x/__tests__/action-iterator.spec.ts
+++ b/packages/core/src/docs/data-model/text-x/__tests__/action-iterator.spec.ts
@@ -37,11 +37,9 @@ describe('Test action iterator', () => {
}],
},
len: 5,
- line: 0,
}, {
t: TextXActionType.DELETE,
len: 5,
- line: 0,
}]);
expect(iterator.hasNext()).toBe(true);
@@ -81,7 +79,6 @@ describe('Test action iterator', () => {
customDecorations: [],
},
len: 2,
- line: 0,
});
expect(iterator.peekType()).toBe(TextXActionType.INSERT);
@@ -103,7 +100,6 @@ describe('Test action iterator', () => {
}],
},
len: 3,
- line: 0,
});
expect(iterator.peekType()).toBe(TextXActionType.DELETE);
@@ -113,7 +109,6 @@ describe('Test action iterator', () => {
expect(action).toEqual({
t: TextXActionType.DELETE,
len: 5,
- line: 0,
});
expect(iterator.hasNext()).toBe(false);
@@ -141,7 +136,6 @@ describe('Test action iterator', () => {
}, {
t: TextXActionType.DELETE,
len: 5,
- line: 0,
}]);
expect(iterator.rest()).toEqual([{
@@ -150,7 +144,6 @@ describe('Test action iterator', () => {
}, {
t: TextXActionType.DELETE,
len: 5,
- line: 0,
}]);
iterator.next(3);
@@ -161,7 +154,6 @@ describe('Test action iterator', () => {
}, {
t: TextXActionType.DELETE,
len: 5,
- line: 0,
}]);
});
});
diff --git a/packages/core/src/docs/data-model/text-x/__tests__/apply.spec.ts b/packages/core/src/docs/data-model/text-x/__tests__/apply.spec.ts
index 29517092e4..a12209a39f 100644
--- a/packages/core/src/docs/data-model/text-x/__tests__/apply.spec.ts
+++ b/packages/core/src/docs/data-model/text-x/__tests__/apply.spec.ts
@@ -85,7 +85,6 @@ describe('apply method', () => {
{
t: TextXActionType.INSERT,
len: 1,
- line: 0,
body: {
dataStream: 'h',
},
@@ -107,7 +106,6 @@ describe('apply method', () => {
},
],
},
- segmentId: '',
},
];
@@ -136,13 +134,11 @@ describe('apply method', () => {
const actionsA: TextXAction[] = [
{
t: TextXActionType.RETAIN,
- segmentId: '',
len: 1,
},
{
t: TextXActionType.INSERT,
len: 1,
- line: 0,
body: {
dataStream: 'h',
textRuns: [
@@ -173,7 +169,6 @@ describe('apply method', () => {
},
],
},
- segmentId: '',
},
];
@@ -201,13 +196,11 @@ describe('apply method', () => {
const actionsA: TextXAction[] = [
{
t: TextXActionType.RETAIN,
- segmentId: '',
len: 1,
},
{
t: TextXActionType.INSERT,
len: 1,
- line: 0,
body: {
dataStream: 'h',
textRuns: [
@@ -238,7 +231,6 @@ describe('apply method', () => {
},
],
},
- segmentId: '',
},
];
@@ -267,11 +259,9 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
}, {
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
paragraphs: [{
@@ -288,11 +278,9 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
}, {
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
paragraphs: [{
@@ -330,11 +318,9 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
}, {
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
coverType: UpdateDocsAttributeType.REPLACE,
body: {
dataStream: '',
@@ -352,11 +338,9 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
}, {
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
coverType: UpdateDocsAttributeType.REPLACE,
body: {
dataStream: '',
@@ -395,11 +379,9 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
}, {
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
coverType: UpdateDocsAttributeType.REPLACE,
body: {
dataStream: '',
@@ -422,11 +404,9 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
}, {
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
coverType: UpdateDocsAttributeType.REPLACE,
body: {
dataStream: '',
@@ -470,11 +450,9 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
}, {
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
textRuns: [{
@@ -490,7 +468,6 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 2,
- segmentId: '',
body: {
dataStream: '',
textRuns: [{
@@ -531,12 +508,9 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
}, {
t: TextXActionType.INSERT,
len: 1,
- segmentId: '',
- line: 0,
body: {
dataStream: '\r',
paragraphs: [{
@@ -553,12 +527,9 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 2,
- segmentId: '',
}, {
t: TextXActionType.INSERT,
len: 1,
- segmentId: '',
- line: 0,
body: {
dataStream: 'X',
textRuns: [{
@@ -605,8 +576,6 @@ describe('apply method', () => {
{
t: TextXActionType.DELETE,
len: 2,
- segmentId: '',
- line: 0,
},
];
@@ -614,12 +583,9 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 2,
- segmentId: '',
}, {
t: TextXActionType.INSERT,
len: 1,
- segmentId: '',
- line: 0,
body: {
dataStream: '1',
},
@@ -627,8 +593,6 @@ describe('apply method', () => {
{
t: TextXActionType.INSERT,
len: 1,
- segmentId: '',
- line: 0,
body: {
dataStream: '1',
},
diff --git a/packages/core/src/docs/data-model/text-x/__tests__/compose.spec.ts b/packages/core/src/docs/data-model/text-x/__tests__/compose.spec.ts
index 05c7f5e459..3db21548b2 100644
--- a/packages/core/src/docs/data-model/text-x/__tests__/compose.spec.ts
+++ b/packages/core/src/docs/data-model/text-x/__tests__/compose.spec.ts
@@ -38,7 +38,6 @@ describe('compose test cases', () => {
customDecorations: [],
},
len: 5,
- line: 0,
}];
const expect_actions = actions_b;
@@ -57,7 +56,6 @@ describe('compose test cases', () => {
customDecorations: [],
},
len: 5,
- line: 0,
}];
const actions_b: TextXAction[] = [];
const expect_actions = actions_a;
@@ -72,19 +70,16 @@ describe('compose test cases', () => {
}, {
t: TextXActionType.DELETE,
len: 2,
- line: 0,
}];
const actions_b: TextXAction[] = [{
t: TextXActionType.DELETE,
len: 8,
- line: 0,
}];
const expect_actions: TextXAction[] = [{
t: TextXActionType.DELETE,
len: 10,
- line: 0,
}];
expect(TextX.compose(actions_a, actions_b)).toEqual(expect_actions);
@@ -94,19 +89,16 @@ describe('compose test cases', () => {
const actions_a: TextXAction[] = [{
t: TextXActionType.DELETE,
len: 2,
- line: 0,
}];
const actions_b: TextXAction[] = [{
t: TextXActionType.DELETE,
len: 8,
- line: 0,
}];
const expect_actions: TextXAction[] = [{
t: TextXActionType.DELETE,
len: 10,
- line: 0,
}];
expect(TextX.compose(actions_a, actions_b)).toEqual(expect_actions);
@@ -116,7 +108,6 @@ describe('compose test cases', () => {
const actions_a: TextXAction[] = [{
t: TextXActionType.DELETE,
len: 2,
- line: 0,
}];
const actions_b: TextXAction[] = [{
@@ -127,7 +118,6 @@ describe('compose test cases', () => {
const expect_actions: TextXAction[] = [{
t: TextXActionType.DELETE,
len: 2,
- line: 0,
}];
expect(TextX.compose(actions_a, actions_b)).toEqual(expect_actions);
@@ -137,7 +127,6 @@ describe('compose test cases', () => {
const actions_a: TextXAction[] = [{
t: TextXActionType.DELETE,
len: 2,
- line: 0,
}];
const actions_b: TextXAction[] = [{
@@ -146,7 +135,6 @@ describe('compose test cases', () => {
dataStream: 'h',
},
len: 1,
- line: 0,
}];
// Always put insert before delete.
@@ -158,11 +146,9 @@ describe('compose test cases', () => {
customDecorations: [],
},
len: 1,
- line: 0,
}, {
t: TextXActionType.DELETE,
len: 2,
- line: 0,
}];
expect(TextX.compose(actions_a, actions_b)).toEqual(expect_actions);
@@ -196,7 +182,6 @@ describe('compose test cases', () => {
body: {
dataStream: 'h',
},
- line: 0,
}];
const expect_actions: TextXAction[] = [{
@@ -207,7 +192,6 @@ describe('compose test cases', () => {
customRanges: [],
customDecorations: [],
},
- line: 0,
}];
expect(TextX.compose(actions_a, actions_b)).toEqual(expect_actions);
@@ -222,13 +206,11 @@ describe('compose test cases', () => {
const actions_b: TextXAction[] = [{
t: TextXActionType.DELETE,
len: 1,
- line: 0,
}];
const expect_actions: TextXAction[] = [{
t: TextXActionType.DELETE,
len: 1,
- line: 0,
}];
expect(TextX.compose(actions_a, actions_b)).toEqual(expect_actions);
@@ -241,7 +223,6 @@ describe('compose test cases', () => {
dataStream: 'h',
},
len: 1,
- line: 0,
}];
const actions_b: TextXAction[] = [{
@@ -257,7 +238,6 @@ describe('compose test cases', () => {
customDecorations: [],
},
len: 1,
- line: 0,
}];
expect(TextX.compose(actions_a, actions_b)).toEqual(expect_actions);
@@ -270,7 +250,6 @@ describe('compose test cases', () => {
dataStream: 'h',
},
len: 1,
- line: 0,
}];
const actions_b: TextXAction[] = [{
@@ -279,7 +258,6 @@ describe('compose test cases', () => {
dataStream: 'b',
},
len: 1,
- line: 0,
}];
const expect_actions: TextXAction[] = [{
@@ -288,7 +266,6 @@ describe('compose test cases', () => {
dataStream: 'bh',
},
len: 2,
- line: 0,
}];
const composed = TextX.compose(actions_a, actions_b);
@@ -303,13 +280,11 @@ describe('compose test cases', () => {
dataStream: 'h',
},
len: 1,
- line: 0,
}];
const actions_b: TextXAction[] = [{
t: TextXActionType.DELETE,
len: 1,
- line: 0,
}];
const expect_actions: TextXAction[] = [];
@@ -374,7 +349,6 @@ describe('compose test cases', () => {
dataStream: 'h',
},
len: 1,
- line: 0,
}];
const actions_b: TextXAction[] = [{
@@ -405,7 +379,6 @@ describe('compose test cases', () => {
}],
},
len: 1,
- line: 0,
}];
expect(TextX.compose(actions_a, actions_b)).toEqual(expect_actions);
@@ -462,7 +435,6 @@ describe('compose test cases', () => {
dataStream: 'h',
},
len: 1,
- line: 0,
}];
const actions_b: TextXAction[] = [{
@@ -474,11 +446,9 @@ describe('compose test cases', () => {
dataStream: 'ab',
},
len: 2,
- line: 0,
}, {
t: TextXActionType.DELETE,
len: 1,
- line: 0,
}];
const inner_actions: TextXAction[] = [{
@@ -492,7 +462,6 @@ describe('compose test cases', () => {
customDecorations: [],
},
len: 2,
- line: 0,
}];
expect(TextX.compose(actions_a, actions_b)).toEqual(inner_actions);
@@ -506,11 +475,9 @@ describe('compose test cases', () => {
dataStream: 'c',
},
len: 1,
- line: 0,
}, {
t: TextXActionType.DELETE,
len: 2,
- line: 0,
}];
const expect_actions: TextXAction[] = [{
@@ -524,7 +491,6 @@ describe('compose test cases', () => {
customDecorations: [],
},
len: 1,
- line: 0,
}];
expect(TextX.compose(inner_actions, actions_c)).toEqual(expect_actions);
diff --git a/packages/core/src/docs/data-model/text-x/__tests__/invert.spec.ts b/packages/core/src/docs/data-model/text-x/__tests__/invert.spec.ts
index 61f632b1a6..6c0c5652e1 100644
--- a/packages/core/src/docs/data-model/text-x/__tests__/invert.spec.ts
+++ b/packages/core/src/docs/data-model/text-x/__tests__/invert.spec.ts
@@ -27,20 +27,15 @@ describe('test TextX static methods invert and makeInvertible', () => {
const actions: TextXAction[] = [{
t: TextXActionType.RETAIN,
len: 5,
- segmentId: '',
}, {
t: TextXActionType.INSERT,
len: 5,
- line: 0,
- segmentId: '',
body: {
dataStream: 'hello',
},
}, {
t: TextXActionType.DELETE,
len: 5,
- line: 0,
- segmentId: '',
body: {
dataStream: 'world',
textRuns: [
@@ -56,7 +51,6 @@ describe('test TextX static methods invert and makeInvertible', () => {
}, {
t: TextXActionType.RETAIN,
len: 2,
- segmentId: '',
body: {
dataStream: '',
textRuns: [
@@ -87,20 +81,15 @@ describe('test TextX static methods invert and makeInvertible', () => {
const exceptActions = [{
t: TextXActionType.RETAIN,
len: 5,
- segmentId: '',
}, {
t: TextXActionType.DELETE,
len: 5,
- line: 0,
- segmentId: '',
body: {
dataStream: 'hello',
},
}, {
t: TextXActionType.INSERT,
len: 5,
- line: 0,
- segmentId: '',
body: {
dataStream: 'world',
textRuns: [
@@ -116,7 +105,6 @@ describe('test TextX static methods invert and makeInvertible', () => {
}, {
t: TextXActionType.RETAIN,
len: 2,
- segmentId: '',
coverType: UpdateDocsAttributeType.REPLACE,
oldBody: {
dataStream: '',
@@ -163,7 +151,7 @@ describe('test TextX static methods invert and makeInvertible', () => {
const textX = new TextX();
- textX.retain(3, '', {
+ textX.retain(3, {
dataStream: '',
textRuns: [{
st: 0,
@@ -202,7 +190,6 @@ describe('test TextX static methods invert and makeInvertible', () => {
customDecorations: [],
},
coverType: UpdateDocsAttributeType.COVER,
- segmentId: '',
}];
expect(textX.serialize()).toEqual(expectedActions);
@@ -231,12 +218,9 @@ describe('test TextX static methods invert and makeInvertible', () => {
const expectedActions: TextXAction[] = [{
t: TextXActionType.RETAIN,
len: 3,
- segmentId: '',
}, {
t: TextXActionType.DELETE,
len: 2,
- segmentId: '',
- line: 0,
body: {
dataStream: 'lo',
customRanges: [],
diff --git a/packages/core/src/docs/data-model/text-x/__tests__/text-x.spec.ts b/packages/core/src/docs/data-model/text-x/__tests__/text-x.spec.ts
index 58d585c460..00f0ea8118 100644
--- a/packages/core/src/docs/data-model/text-x/__tests__/text-x.spec.ts
+++ b/packages/core/src/docs/data-model/text-x/__tests__/text-x.spec.ts
@@ -38,7 +38,7 @@ describe('test TextX methods and branches', () => {
],
};
- textX.insert(5, body, '');
+ textX.insert(5, body);
const actions = textX.serialize();
@@ -47,8 +47,6 @@ describe('test TextX methods and branches', () => {
t: TextXActionType.INSERT,
body,
len: 5,
- line: 0,
- segmentId: '',
},
]);
});
@@ -56,7 +54,7 @@ describe('test TextX methods and branches', () => {
it('test TextX delete method', () => {
const textX = new TextX();
- textX.delete(5, '');
+ textX.delete(5);
const actions = textX.serialize();
@@ -64,8 +62,6 @@ describe('test TextX methods and branches', () => {
{
t: TextXActionType.DELETE,
len: 5,
- line: 0,
- segmentId: '',
},
]);
});
@@ -85,7 +81,7 @@ describe('test TextX methods and branches', () => {
],
};
- textX.retain(5, '', body, UpdateDocsAttributeType.COVER);
+ textX.retain(5, body, UpdateDocsAttributeType.COVER);
const actions = textX.serialize();
@@ -95,7 +91,6 @@ describe('test TextX methods and branches', () => {
body,
len: 5,
coverType: UpdateDocsAttributeType.COVER,
- segmentId: '',
},
]);
});
@@ -103,8 +98,8 @@ describe('test TextX methods and branches', () => {
it('test TextX push method and merge two delete actions', () => {
const textX = new TextX();
- textX.delete(5, '');
- textX.delete(5, '');
+ textX.delete(5);
+ textX.delete(5);
const actions = textX.serialize();
@@ -112,8 +107,6 @@ describe('test TextX methods and branches', () => {
{
t: TextXActionType.DELETE,
len: 10, // 5 + 5
- line: 0,
- segmentId: '',
},
]);
});
@@ -134,8 +127,8 @@ describe('test TextX methods and branches', () => {
],
};
- textX.delete(5, '');
- textX.insert(5, body, '');
+ textX.delete(5);
+ textX.insert(5, body);
const actions = textX.serialize();
@@ -144,14 +137,10 @@ describe('test TextX methods and branches', () => {
t: TextXActionType.INSERT,
body,
len: 5,
- line: 0,
- segmentId: '',
},
{
t: TextXActionType.DELETE,
len: 5,
- line: 0,
- segmentId: '',
},
]);
});
@@ -159,8 +148,8 @@ describe('test TextX methods and branches', () => {
it('test TextX push method and merge two simple retain action', () => {
const textX = new TextX();
- textX.retain(4, '');
- textX.retain(5, '');
+ textX.retain(4);
+ textX.retain(5);
const actions = textX.serialize();
@@ -168,7 +157,6 @@ describe('test TextX methods and branches', () => {
{
t: TextXActionType.RETAIN,
len: 9,
- segmentId: '',
},
]);
});
@@ -179,11 +167,9 @@ describe('test TextX methods and branches', () => {
textX.push({
t: TextXActionType.RETAIN,
len: 4,
- segmentId: '',
}, {
t: TextXActionType.RETAIN,
len: 5,
- segmentId: '',
});
const actions = textX.serialize();
@@ -192,7 +178,6 @@ describe('test TextX methods and branches', () => {
{
t: TextXActionType.RETAIN,
len: 9,
- segmentId: '',
},
]);
});
@@ -215,20 +200,15 @@ describe('test TextX methods and branches', () => {
textX.push({
t: TextXActionType.RETAIN,
len: 4,
- segmentId: '',
}, {
t: TextXActionType.DELETE,
len: 5,
- line: 0,
- segmentId: '',
});
textX.push({
t: TextXActionType.INSERT,
len: 5,
body,
- line: 0,
- segmentId: '',
});
const actions = textX.serialize();
@@ -246,8 +226,8 @@ describe('test TextX methods and branches', () => {
expect(TextX.isNoop(textX.serialize())).toBe(true);
- textX.retain(4, '');
- textX.delete(5, '');
+ textX.retain(4);
+ textX.delete(5);
expect(TextX.isNoop(textX.serialize())).toBe(false);
});
diff --git a/packages/core/src/docs/data-model/text-x/__tests__/transform-position.spec.ts b/packages/core/src/docs/data-model/text-x/__tests__/transform-position.spec.ts
index da2f765138..1ddba7db0b 100644
--- a/packages/core/src/docs/data-model/text-x/__tests__/transform-position.spec.ts
+++ b/packages/core/src/docs/data-model/text-x/__tests__/transform-position.spec.ts
@@ -26,7 +26,6 @@ describe('transformPosition()', () => {
{
t: TextXActionType.INSERT,
len: 1,
- line: 0,
body: {
dataStream: 'h',
},
@@ -39,13 +38,11 @@ describe('transformPosition()', () => {
const actions: TextXAction[] = [
{
t: TextXActionType.RETAIN,
- segmentId: '',
len: 1,
},
{
t: TextXActionType.INSERT,
len: 1,
- line: 0,
body: {
dataStream: 'h',
},
@@ -58,13 +55,12 @@ describe('transformPosition()', () => {
const actions: TextXAction[] = [
{
t: TextXActionType.RETAIN,
- segmentId: '',
+
len: 1,
},
{
t: TextXActionType.INSERT,
len: 1,
- line: 0,
body: {
dataStream: 'h',
},
@@ -79,9 +75,8 @@ describe('transformPosition()', () => {
const actions: TextXAction[] = [
{
t: TextXActionType.DELETE,
- segmentId: '',
+
len: 1,
- line: 0,
},
];
@@ -92,14 +87,13 @@ describe('transformPosition()', () => {
const actions: TextXAction[] = [
{
t: TextXActionType.RETAIN,
- segmentId: '',
+
len: 5,
},
{
t: TextXActionType.DELETE,
- segmentId: '',
+
len: 1,
- line: 0,
},
];
@@ -110,14 +104,13 @@ describe('transformPosition()', () => {
const actions: TextXAction[] = [
{
t: TextXActionType.RETAIN,
- segmentId: '',
+
len: 1,
},
{
t: TextXActionType.DELETE,
- segmentId: '',
+
len: 5,
- line: 0,
},
];
@@ -128,22 +121,20 @@ describe('transformPosition()', () => {
const actions: TextXAction[] = [
{
t: TextXActionType.RETAIN,
- segmentId: '',
+
len: 2,
},
{
t: TextXActionType.INSERT,
len: 1,
- line: 0,
body: {
dataStream: 'h',
},
},
{
t: TextXActionType.DELETE,
- segmentId: '',
+
len: 2,
- line: 0,
},
];
@@ -154,22 +145,20 @@ describe('transformPosition()', () => {
const actions: TextXAction[] = [
{
t: TextXActionType.RETAIN,
- segmentId: '',
+
len: 2,
},
{
t: TextXActionType.INSERT,
len: 1,
- line: 0,
body: {
dataStream: 'h',
},
},
{
t: TextXActionType.DELETE,
- segmentId: '',
+
len: 4,
- line: 0,
},
];
@@ -180,20 +169,18 @@ describe('transformPosition()', () => {
const actions: TextXAction[] = [
{
t: TextXActionType.DELETE,
- segmentId: '',
+
len: 1,
- line: 0,
},
{
t: TextXActionType.RETAIN,
- segmentId: '',
+
len: 1,
},
{
t: TextXActionType.DELETE,
- segmentId: '',
+
len: 4,
- line: 0,
},
];
diff --git a/packages/core/src/docs/data-model/text-x/__tests__/transform.spec.ts b/packages/core/src/docs/data-model/text-x/__tests__/transform.spec.ts
index 813d8ba60d..7e746b47e0 100644
--- a/packages/core/src/docs/data-model/text-x/__tests__/transform.spec.ts
+++ b/packages/core/src/docs/data-model/text-x/__tests__/transform.spec.ts
@@ -28,7 +28,6 @@ describe('transform()', () => {
{
t: TextXActionType.INSERT,
len: 1,
- line: 0,
body: {
dataStream: 'h',
customRanges: [],
@@ -40,7 +39,6 @@ describe('transform()', () => {
{
t: TextXActionType.INSERT,
len: 1,
- line: 0,
body: {
dataStream: 'e',
},
@@ -50,13 +48,11 @@ describe('transform()', () => {
const expectedActionsWithPriorityTrue: TextXAction[] = [
{
t: TextXActionType.RETAIN,
- segmentId: '',
len: 1,
},
{
t: TextXActionType.INSERT,
len: 1,
- line: 0,
body: {
dataStream: 'e',
customRanges: [],
@@ -69,7 +65,6 @@ describe('transform()', () => {
{
t: TextXActionType.INSERT,
len: 1,
- line: 0,
body: {
dataStream: 'e',
customRanges: [],
@@ -87,7 +82,6 @@ describe('transform()', () => {
{
t: TextXActionType.INSERT,
len: 1,
- line: 0,
body: {
dataStream: 'h',
},
@@ -109,13 +103,11 @@ describe('transform()', () => {
},
],
},
- segmentId: '',
},
];
const expectedActionsWithPriorityTrue = [
{
t: TextXActionType.RETAIN,
- segmentId: '',
len: 1,
},
{
@@ -135,14 +127,12 @@ describe('transform()', () => {
},
],
},
- segmentId: '',
},
];
const expectedActionsWithPriorityFalse: TextXAction[] = [
{
t: TextXActionType.RETAIN,
- segmentId: '',
len: 1,
},
{
@@ -162,7 +152,6 @@ describe('transform()', () => {
},
],
},
- segmentId: '',
},
];
@@ -175,7 +164,6 @@ describe('transform()', () => {
{
t: TextXActionType.INSERT,
len: 1,
- line: 0,
body: {
dataStream: 'h',
},
@@ -185,21 +173,16 @@ describe('transform()', () => {
{
t: TextXActionType.DELETE,
len: 1,
- line: 0,
- segmentId: '',
},
];
const expectedActionsWithPriorityTrue = [
{
t: TextXActionType.RETAIN,
- segmentId: '',
len: 1,
},
{
t: TextXActionType.DELETE,
len: 1,
- line: 0,
- segmentId: '',
},
];
@@ -211,7 +194,6 @@ describe('transform()', () => {
{
t: TextXActionType.DELETE,
len: 1,
- line: 0,
},
];
const actionsB: TextXAction[] = [
@@ -221,8 +203,6 @@ describe('transform()', () => {
body: {
dataStream: 'h',
},
- line: 0,
- segmentId: '',
},
];
const expectedActionsWithPriorityTrue: TextXAction[] = [
@@ -234,8 +214,6 @@ describe('transform()', () => {
customRanges: [],
customDecorations: [],
},
- line: 0,
- segmentId: '',
},
];
@@ -247,14 +225,12 @@ describe('transform()', () => {
{
t: TextXActionType.DELETE,
len: 1,
- line: 0,
},
];
const actionsB: TextXAction[] = [
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
},
];
const expectedActionsWithPriorityTrue: TextXAction[] = [];
@@ -267,14 +243,12 @@ describe('transform()', () => {
{
t: TextXActionType.DELETE,
len: 1,
- line: 0,
},
];
const actionsB: TextXAction[] = [
{
t: TextXActionType.DELETE,
len: 1,
- line: 0,
},
];
const expectedActionsWithPriorityTrue: TextXAction[] = [];
@@ -287,7 +261,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
},
];
const actionsB: TextXAction[] = [
@@ -297,7 +270,6 @@ describe('transform()', () => {
dataStream: 'h',
},
len: 1,
- line: 0,
},
];
const expectedActionsWithPriorityTrue: TextXAction[] = [
@@ -309,7 +281,6 @@ describe('transform()', () => {
customDecorations: [],
},
len: 1,
- line: 0,
},
];
@@ -321,7 +292,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
textRuns: [
@@ -341,7 +311,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
textRuns: [
@@ -361,7 +330,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
textRuns: [
@@ -381,7 +349,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
textRuns: [
@@ -401,7 +368,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
textRuns: [
@@ -428,7 +394,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
textRuns: [
@@ -448,7 +413,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
textRuns: [
@@ -468,7 +432,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
textRuns: [
@@ -488,7 +451,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
textRuns: [
@@ -508,7 +470,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
textRuns: [
@@ -530,7 +491,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
textRuns: [
@@ -555,7 +515,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
textRuns: [
@@ -575,8 +534,6 @@ describe('transform()', () => {
{
t: TextXActionType.DELETE,
len: 1,
- line: 0,
- segmentId: '',
},
];
@@ -584,8 +541,6 @@ describe('transform()', () => {
{
t: TextXActionType.DELETE,
len: 1,
- line: 0,
- segmentId: '',
},
];
@@ -597,7 +552,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
paragraphs: [
@@ -616,7 +570,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
paragraphs: [
@@ -636,7 +589,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
paragraphs: [
@@ -655,7 +607,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
paragraphs: [
@@ -680,7 +631,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
coverType: UpdateDocsAttributeType.REPLACE,
body: {
dataStream: '',
@@ -700,7 +650,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
coverType: UpdateDocsAttributeType.REPLACE,
body: {
dataStream: '',
@@ -721,7 +670,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
coverType: UpdateDocsAttributeType.REPLACE,
body: {
dataStream: '',
@@ -741,7 +689,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
coverType: UpdateDocsAttributeType.REPLACE,
body: {
dataStream: '',
@@ -767,7 +714,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
coverType: UpdateDocsAttributeType.REPLACE,
body: {
dataStream: '',
@@ -790,7 +736,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
coverType: UpdateDocsAttributeType.REPLACE,
body: {
dataStream: '',
@@ -813,7 +758,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
coverType: UpdateDocsAttributeType.REPLACE,
body: {
dataStream: '',
@@ -836,7 +780,6 @@ describe('transform()', () => {
{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
coverType: UpdateDocsAttributeType.REPLACE,
body: {
dataStream: '',
@@ -865,11 +808,9 @@ describe('transform()', () => {
const actionA: TextXAction[] = [{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
}, {
t: TextXActionType.INSERT,
len: 1,
- line: 0,
body: {
dataStream: 'e',
},
@@ -878,7 +819,6 @@ describe('transform()', () => {
const actionB: TextXAction[] = [{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
textRuns: [
@@ -896,11 +836,9 @@ describe('transform()', () => {
const transformedActionA: TextXAction[] = [{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
}, {
t: TextXActionType.INSERT,
len: 1,
- line: 0,
body: {
dataStream: 'e',
customRanges: [],
@@ -911,7 +849,6 @@ describe('transform()', () => {
const transformedActionB: TextXAction[] = [{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
customRanges: [],
@@ -936,7 +873,6 @@ describe('transform()', () => {
const actionA: TextXAction[] = [{
t: TextXActionType.INSERT,
len: 1,
- line: 0,
body: {
dataStream: 'e',
},
@@ -945,7 +881,6 @@ describe('transform()', () => {
const actionB: TextXAction[] = [{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
textRuns: [
@@ -963,7 +898,6 @@ describe('transform()', () => {
const transformedActionA: TextXAction[] = [{
t: TextXActionType.INSERT,
len: 1,
- line: 0,
body: {
dataStream: 'e',
customRanges: [],
@@ -974,11 +908,9 @@ describe('transform()', () => {
const transformedActionB: TextXAction[] = [{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
}, {
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
customRanges: [],
@@ -1003,11 +935,9 @@ describe('transform()', () => {
const actionA: TextXAction[] = [{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
}, {
t: TextXActionType.INSERT,
len: 1,
- line: 0,
body: {
dataStream: 'e',
},
@@ -1016,7 +946,6 @@ describe('transform()', () => {
const actionB: TextXAction[] = [{
t: TextXActionType.RETAIN,
len: 2,
- segmentId: '',
body: {
dataStream: '',
textRuns: [
@@ -1034,11 +963,9 @@ describe('transform()', () => {
const transformedActionA: TextXAction[] = [{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
}, {
t: TextXActionType.INSERT,
len: 1,
- line: 0,
body: {
dataStream: 'e',
customRanges: [],
@@ -1049,7 +976,6 @@ describe('transform()', () => {
const transformedActionB: TextXAction[] = [{
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
customRanges: [],
@@ -1067,11 +993,9 @@ describe('transform()', () => {
}, {
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
}, {
t: TextXActionType.RETAIN,
len: 1,
- segmentId: '',
body: {
dataStream: '',
customRanges: [],
diff --git a/packages/core/src/docs/data-model/text-x/action-types.ts b/packages/core/src/docs/data-model/text-x/action-types.ts
index b0b0852d6e..7f8790d69f 100644
--- a/packages/core/src/docs/data-model/text-x/action-types.ts
+++ b/packages/core/src/docs/data-model/text-x/action-types.ts
@@ -32,7 +32,6 @@ export interface IRetainAction {
body?: IDocumentBody;
oldBody?: IDocumentBody;
coverType?: UpdateDocsAttributeType;
- segmentId?: string;
}
/**
@@ -42,8 +41,6 @@ export interface IInsertAction {
t: TextXActionType.INSERT;
body: IDocumentBody;
len: number;
- line: number;
- segmentId?: string;
}
/**
@@ -52,9 +49,7 @@ export interface IInsertAction {
export interface IDeleteAction {
t: TextXActionType.DELETE;
len: number;
- line: number;
body?: IDocumentBody; // Add a body property to make this action invertible.
- segmentId?: string;
}
export type TextXAction = IRetainAction | IInsertAction | IDeleteAction;
diff --git a/packages/core/src/docs/data-model/text-x/build-utils/paragraph.ts b/packages/core/src/docs/data-model/text-x/build-utils/paragraph.ts
index 5e420f46f4..44516b530d 100644
--- a/packages/core/src/docs/data-model/text-x/build-utils/paragraph.ts
+++ b/packages/core/src/docs/data-model/text-x/build-utils/paragraph.ts
@@ -69,7 +69,6 @@ export const switchParagraphBullet = (params: ISwitchParagraphBulletParams) => {
textX.push({
t: TextXActionType.RETAIN,
len: startIndex - memoryCursor.cursor,
- segmentId,
});
textX.push({
@@ -99,7 +98,6 @@ export const switchParagraphBullet = (params: ISwitchParagraphBulletParams) => {
},
],
},
- segmentId,
coverType: UpdateDocsAttributeType.REPLACE,
});
@@ -141,7 +139,6 @@ export const toggleChecklistParagraph = (params: IToggleChecklistParagraphParams
textX.push({
t: TextXActionType.RETAIN,
len: startIndex - memoryCursor.cursor,
- segmentId,
});
textX.push({
@@ -162,7 +159,6 @@ export const toggleChecklistParagraph = (params: IToggleChecklistParagraphParams
],
},
coverType: UpdateDocsAttributeType.REPLACE,
- segmentId,
});
memoryCursor.moveCursorTo(startIndex + 1);
@@ -200,7 +196,6 @@ export const setParagraphBullet = (params: ISetParagraphBulletParams) => {
textX.push({
t: TextXActionType.RETAIN,
len: startIndex - memoryCursor.cursor,
- segmentId,
});
textX.push({
@@ -225,7 +220,6 @@ export const setParagraphBullet = (params: ISetParagraphBulletParams) => {
},
],
},
- segmentId,
coverType: UpdateDocsAttributeType.REPLACE,
});
@@ -269,7 +263,6 @@ export const changeParagraphBulletNestLevel = (params: IChangeParagraphBulletNes
textX.push({
t: TextXActionType.RETAIN,
len: startIndex - memoryCursor.cursor,
- segmentId,
});
if (bullet) {
@@ -297,7 +290,6 @@ export const changeParagraphBulletNestLevel = (params: IChangeParagraphBulletNes
},
],
},
- segmentId,
coverType: UpdateDocsAttributeType.REPLACE,
});
} else {
diff --git a/packages/core/src/docs/data-model/text-x/build-utils/selection.ts b/packages/core/src/docs/data-model/text-x/build-utils/selection.ts
index f288726a81..0836b03d6c 100644
--- a/packages/core/src/docs/data-model/text-x/build-utils/selection.ts
+++ b/packages/core/src/docs/data-model/text-x/build-utils/selection.ts
@@ -272,7 +272,6 @@ export function getRetainAndDeleteFromReplace(
dos.push({
t: TextXActionType.RETAIN,
len: textStart,
- segmentId,
});
}
@@ -284,14 +283,11 @@ export function getRetainAndDeleteFromReplace(
dos.push({
t: TextXActionType.DELETE,
len,
- line: 0,
- segmentId,
});
}
dos.push({
t: TextXActionType.RETAIN,
len: 1,
- segmentId,
});
cursor = pos + 1;
});
@@ -300,8 +296,6 @@ export function getRetainAndDeleteFromReplace(
dos.push({
t: TextXActionType.DELETE,
len: textEnd - cursor,
- line: 0,
- segmentId,
});
cursor = textEnd + 1;
}
diff --git a/packages/core/src/docs/data-model/text-x/build-utils/text-x-utils.ts b/packages/core/src/docs/data-model/text-x/build-utils/text-x-utils.ts
index c4572256a7..abe7eb373b 100644
--- a/packages/core/src/docs/data-model/text-x/build-utils/text-x-utils.ts
+++ b/packages/core/src/docs/data-model/text-x/build-utils/text-x-utils.ts
@@ -51,15 +51,12 @@ export function deleteCustomRangeTextX(accessor: IAccessor, params: IDeleteCusto
textX.push({
t: TextXActionType.RETAIN,
len: startIndex,
- segmentId,
});
}
textX.push({
t: TextXActionType.DELETE,
len: 1,
- segmentId,
- line: 0,
});
if (textRange) {
if (textRange.index > startIndex) {
@@ -71,15 +68,12 @@ export function deleteCustomRangeTextX(accessor: IAccessor, params: IDeleteCusto
textX.push({
t: TextXActionType.RETAIN,
len: len - 2,
- segmentId,
});
}
textX.push({
t: TextXActionType.DELETE,
len: 1,
- segmentId,
- line: 0,
});
if (textRange) {
@@ -93,8 +87,6 @@ export function deleteCustomRangeTextX(accessor: IAccessor, params: IDeleteCusto
body: insert,
t: TextXActionType.INSERT,
len: insert.dataStream.length,
- segmentId,
- line: 1,
});
if (textRange) {
@@ -165,7 +157,6 @@ export function addCustomRangeTextX(param: IAddCustomRangeTextXParam) {
textX.push({
t: TextXActionType.RETAIN,
len: range.startOffset - cursor,
- segmentId,
});
cursor = range.startOffset;
}
@@ -175,8 +166,6 @@ export function addCustomRangeTextX(param: IAddCustomRangeTextXParam) {
dataStream: DataStreamTreeTokenType.CUSTOM_RANGE_START,
},
len: 1,
- line: 0,
- segmentId,
});
deletes.forEach((index) => {
@@ -184,15 +173,12 @@ export function addCustomRangeTextX(param: IAddCustomRangeTextXParam) {
textX.push({
t: TextXActionType.RETAIN,
len: index - cursor,
- segmentId,
});
cursor = index;
}
textX.push({
t: TextXActionType.DELETE,
len: 1,
- line: 0,
- segmentId,
});
cursor++;
});
@@ -201,7 +187,6 @@ export function addCustomRangeTextX(param: IAddCustomRangeTextXParam) {
textX.push({
t: TextXActionType.RETAIN,
len: range.endOffset - cursor,
- segmentId,
});
cursor = range.endOffset;
}
@@ -224,8 +209,6 @@ export function addCustomRangeTextX(param: IAddCustomRangeTextXParam) {
],
},
len: 1,
- line: 0,
- segmentId,
});
};
const relativeParagraphs = (body.paragraphs ?? []).filter((p) => p.startIndex < endOffset && p.startIndex > startOffset);
@@ -280,7 +263,6 @@ export function getRetainAndDeleteAndExcludeLineBreak(
dos.push({
t: TextXActionType.RETAIN,
len: textStart,
- segmentId,
});
}
@@ -300,14 +282,11 @@ export function getRetainAndDeleteAndExcludeLineBreak(
dos.push({
t: TextXActionType.DELETE,
len,
- line: 0,
- segmentId,
});
}
dos.push({
t: TextXActionType.RETAIN,
len: 1,
- segmentId,
});
cursor = pos + 1;
});
@@ -316,8 +295,6 @@ export function getRetainAndDeleteAndExcludeLineBreak(
dos.push({
t: TextXActionType.DELETE,
len: textEnd - cursor,
- line: 0,
- segmentId,
});
cursor = textEnd;
}
@@ -329,7 +306,6 @@ export function getRetainAndDeleteAndExcludeLineBreak(
dos.push({
t: TextXActionType.RETAIN,
len: nextParagraph.startIndex - cursor,
- segmentId,
});
cursor = nextParagraph.startIndex;
}
@@ -337,7 +313,6 @@ export function getRetainAndDeleteAndExcludeLineBreak(
dos.push({
t: TextXActionType.RETAIN,
len: 1,
- segmentId,
body: {
dataStream: '',
paragraphs: [
@@ -387,8 +362,6 @@ export const replaceSelectionTextX = (params: IReplaceSelectionTextXParams) => {
t: TextXActionType.INSERT,
body: insertBody,
len: insertBody.dataStream.length,
- line: 0,
- segmentId,
});
return textX;
diff --git a/packages/core/src/docs/data-model/text-x/text-x.ts b/packages/core/src/docs/data-model/text-x/text-x.ts
index a0eb4accda..2157a585d0 100644
--- a/packages/core/src/docs/data-model/text-x/text-x.ts
+++ b/packages/core/src/docs/data-model/text-x/text-x.ts
@@ -136,7 +136,7 @@ export class TextX {
(priority === 'left' || otherIter.peekType() !== TextXActionType.INSERT)
) {
const thisAction = thisIter.next();
- textX.retain(thisAction.len, thisAction.segmentId ?? '');
+ textX.retain(thisAction.len);
} else if (otherIter.peekType() === TextXActionType.INSERT) {
textX.push(otherIter.next());
} else {
@@ -210,9 +210,7 @@ export class TextX {
invertedActions.push({
t: TextXActionType.DELETE,
len: action.len,
- line: 0, // hardcode
body: action.body,
- segmentId: action.segmentId,
});
} else if (action.t === TextXActionType.DELETE) {
if (action.body == null) {
@@ -223,8 +221,6 @@ export class TextX {
t: TextXActionType.INSERT,
body: action.body,
len: action.len,
- line: 0, // hardcode
- segmentId: action.segmentId,
});
} else {
if (action.body != null) {
@@ -238,7 +234,6 @@ export class TextX {
oldBody: action.body,
len: action.len,
coverType: UpdateDocsAttributeType.REPLACE,
- segmentId: action.segmentId,
});
} else {
invertedActions.push(action);
@@ -283,24 +278,21 @@ export class TextX {
private _actions: TextXAction[] = [];
- insert(len: number, body: IDocumentBody, segmentId = ''): this {
+ insert(len: number, body: IDocumentBody): this {
const insertAction: IInsertAction = {
t: TextXActionType.INSERT,
body,
len,
- line: 0, // hardcode
- segmentId,
};
this.push(insertAction);
return this;
}
- retain(len: number, segmentId = '', body?: IDocumentBody, coverType?: UpdateDocsAttributeType): this {
+ retain(len: number, body?: IDocumentBody, coverType?: UpdateDocsAttributeType): this {
const retainAction: IRetainAction = {
t: TextXActionType.RETAIN,
len,
- segmentId,
};
if (body != null) {
@@ -316,12 +308,10 @@ export class TextX {
return this;
}
- delete(len: number, segmentId = ''): this {
+ delete(len: number): this {
const deleteAction: IDeleteAction = {
t: TextXActionType.DELETE,
len,
- line: 0, // hardcode
- segmentId,
};
this.push(deleteAction);
diff --git a/packages/docs-drawing-ui/src/commands/commands/insert-doc-drawing.command.ts b/packages/docs-drawing-ui/src/commands/commands/insert-doc-drawing.command.ts
index f450686a08..9991bd4763 100644
--- a/packages/docs-drawing-ui/src/commands/commands/insert-doc-drawing.command.ts
+++ b/packages/docs-drawing-ui/src/commands/commands/insert-doc-drawing.command.ts
@@ -14,6 +14,9 @@
* limitations under the License.
*/
+import type { IAccessor, ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
+import type { IRichTextEditingMutationParams } from '@univerjs/docs';
+import type { IInsertDrawingCommandParams } from './interfaces';
import {
BuildTextUtils,
CommandType,
@@ -25,9 +28,6 @@ import {
} from '@univerjs/core';
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
import { getCustomBlockIdsInSelections, getRichTextEditPath } from '@univerjs/docs-ui';
-import type { IAccessor, ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
-import type { IRichTextEditingMutationParams } from '@univerjs/docs';
-import type { IInsertDrawingCommandParams } from './interfaces';
/**
* The command to insert new drawings
@@ -74,7 +74,6 @@ export const InsertDocDrawingCommand: ICommand = {
textX.push({
t: TextXActionType.RETAIN,
len: startOffset,
- segmentId,
});
}
} else {
@@ -123,8 +122,6 @@ export const InsertDocDrawingCommand: ICommand = {
})),
},
len: drawings.length,
- line: 0,
- segmentId,
});
const path = getRichTextEditPath(documentDataModel, segmentId);
diff --git a/packages/docs-drawing-ui/src/commands/commands/remove-doc-drawing.command.ts b/packages/docs-drawing-ui/src/commands/commands/remove-doc-drawing.command.ts
index 7e11a981c1..2de72513f1 100644
--- a/packages/docs-drawing-ui/src/commands/commands/remove-doc-drawing.command.ts
+++ b/packages/docs-drawing-ui/src/commands/commands/remove-doc-drawing.command.ts
@@ -14,6 +14,9 @@
* limitations under the License.
*/
+import type { IAccessor, ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
+import type { IRichTextEditingMutationParams } from '@univerjs/docs';
+import type { IDeleteDrawingCommandParams } from './interfaces';
import {
CommandType,
ICommandService,
@@ -26,9 +29,6 @@ import {
import { RichTextEditingMutation } from '@univerjs/docs';
import { DocSelectionRenderService, getRichTextEditPath } from '@univerjs/docs-ui';
import { IRenderManagerService, type ITextRangeWithStyle } from '@univerjs/engine-render';
-import type { IAccessor, ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
-import type { IRichTextEditingMutationParams } from '@univerjs/docs';
-import type { IDeleteDrawingCommandParams } from './interfaces';
/**
* The command to remove new sheet image
@@ -93,15 +93,12 @@ export const RemoveDocDrawingCommand: ICommand = {
textX.push({
t: TextXActionType.RETAIN,
len: startIndex - memoryCursor.cursor,
- segmentId: '',
});
}
textX.push({
t: TextXActionType.DELETE,
len: 1,
- line: 0,
- segmentId: '',
});
memoryCursor.moveCursorTo(startIndex + 1);
diff --git a/packages/docs-drawing-ui/src/commands/commands/update-doc-drawing.command.ts b/packages/docs-drawing-ui/src/commands/commands/update-doc-drawing.command.ts
index 898ea3a817..74b45605ce 100644
--- a/packages/docs-drawing-ui/src/commands/commands/update-doc-drawing.command.ts
+++ b/packages/docs-drawing-ui/src/commands/commands/update-doc-drawing.command.ts
@@ -14,6 +14,9 @@
* limitations under the License.
*/
+import type { DocumentDataModel, IAccessor, ICommand, IDocDrawingBase, IDocDrawingPosition, IMutationInfo, IObjectPositionH, IObjectPositionV, ISize, JSONXActions, WrapTextType } from '@univerjs/core';
+import type { IRichTextEditingMutationParams } from '@univerjs/docs';
+import type { IDocDrawing } from '@univerjs/docs-drawing';
import {
BooleanNumber,
CommandType,
@@ -30,9 +33,6 @@ import {
import { DocSkeletonManagerService, RichTextEditingMutation } from '@univerjs/docs';
import { DocSelectionRenderService, getRichTextEditPath } from '@univerjs/docs-ui';
import { DocumentEditArea, IRenderManagerService } from '@univerjs/engine-render';
-import type { DocumentDataModel, IAccessor, ICommand, IDocDrawingBase, IDocDrawingPosition, IMutationInfo, IObjectPositionH, IObjectPositionV, ISize, JSONXActions, WrapTextType } from '@univerjs/core';
-import type { IRichTextEditingMutationParams } from '@univerjs/docs';
-import type { IDocDrawing } from '@univerjs/docs-drawing';
import { DocRefreshDrawingsService } from '../../services/doc-refresh-drawings.service';
export enum TextWrappingStyle {
@@ -88,7 +88,6 @@ function getDeleteAndInsertCustomBlockActions(
textX.push({
t: TextXActionType.RETAIN,
len: offset,
- segmentId: oldSegmentId,
});
}
@@ -102,21 +101,16 @@ function getDeleteAndInsertCustomBlockActions(
}],
},
len: 1,
- line: 0,
- segmentId: oldSegmentId,
});
textX.push({
t: TextXActionType.RETAIN,
len: oldOffset - offset,
- segmentId: oldSegmentId,
});
textX.push({
t: TextXActionType.DELETE,
len: 1,
- line: 0,
- segmentId: '',
});
} else {
// Delete first.
@@ -124,22 +118,18 @@ function getDeleteAndInsertCustomBlockActions(
textX.push({
t: TextXActionType.RETAIN,
len: oldOffset,
- segmentId: oldSegmentId,
});
}
textX.push({
t: TextXActionType.DELETE,
len: 1,
- line: 0,
- segmentId: '',
});
if (offset - oldOffset - 1 > 0) {
textX.push({
t: TextXActionType.RETAIN,
len: offset - oldOffset - 1,
- segmentId: oldSegmentId,
});
}
@@ -153,8 +143,6 @@ function getDeleteAndInsertCustomBlockActions(
}],
},
len: 1,
- line: 0,
- segmentId: oldSegmentId,
});
}
@@ -168,15 +156,12 @@ function getDeleteAndInsertCustomBlockActions(
textX.push({
t: TextXActionType.RETAIN,
len: oldOffset,
- segmentId: oldSegmentId,
});
}
textX.push({
t: TextXActionType.DELETE,
len: 1,
- line: 0,
- segmentId: '',
});
let path = getRichTextEditPath(documentDataModel, oldSegmentId);
@@ -189,7 +174,6 @@ function getDeleteAndInsertCustomBlockActions(
textX.push({
t: TextXActionType.RETAIN,
len: offset,
- segmentId,
});
}
@@ -203,8 +187,6 @@ function getDeleteAndInsertCustomBlockActions(
}],
},
len: 1,
- line: 0,
- segmentId,
});
path = getRichTextEditPath(documentDataModel, segmentId);
diff --git a/packages/docs-ui/src/basics/custom-decoration-factory.ts b/packages/docs-ui/src/basics/custom-decoration-factory.ts
index 92cf7ba7d5..49573c8375 100644
--- a/packages/docs-ui/src/basics/custom-decoration-factory.ts
+++ b/packages/docs-ui/src/basics/custom-decoration-factory.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import { getBodySlice, IUniverInstanceService, JSONX, TextX, TextXActionType, Tools, UniverInstanceType, UpdateDocsAttributeType } from '@univerjs/core';
-import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
import type { CustomDecorationType, DocumentDataModel, IAccessor, IMutationInfo } from '@univerjs/core';
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
+import { getBodySlice, IUniverInstanceService, JSONX, TextX, TextXActionType, Tools, UniverInstanceType, UpdateDocsAttributeType } from '@univerjs/core';
+import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
interface IAddCustomDecorationParam {
unitId: string;
@@ -51,7 +51,6 @@ export function addCustomDecorationFactory(param: IAddCustomDecorationParam) {
textX.push({
t: TextXActionType.RETAIN,
len: start - cursor,
- segmentId,
});
}
@@ -67,7 +66,6 @@ export function addCustomDecorationFactory(param: IAddCustomDecorationParam) {
}],
},
len: end - start,
- segmentId,
});
cursor = end;
@@ -169,14 +167,12 @@ export function deleteCustomDecorationFactory(accessor: IAccessor, params: IDele
textX.push({
t: TextXActionType.RETAIN,
len: decoration.startIndex - cursor,
- segmentId,
});
}
cursor = (decoration.startIndex);
textX.push({
t: TextXActionType.RETAIN,
len: decoration.endIndex - decoration.startIndex + 1,
- segmentId,
body: bodySlice,
oldBody,
coverType: UpdateDocsAttributeType.REPLACE,
diff --git a/packages/docs-ui/src/commands/commands/clipboard.inner.command.ts b/packages/docs-ui/src/commands/commands/clipboard.inner.command.ts
index 7c04c8270c..9e33dc3a87 100644
--- a/packages/docs-ui/src/commands/commands/clipboard.inner.command.ts
+++ b/packages/docs-ui/src/commands/commands/clipboard.inner.command.ts
@@ -189,7 +189,6 @@ export const InnerPasteCommand: ICommand<IInnerPasteCommandParams> = {
textX.push({
t: TextXActionType.RETAIN,
len,
- segmentId,
});
} else {
const { dos } = BuildTextUtils.selection.getDeleteActions(selection, segmentId, memoryCursor.cursor, originBody);
@@ -200,8 +199,6 @@ export const InnerPasteCommand: ICommand<IInnerPasteCommandParams> = {
t: TextXActionType.INSERT,
body: cloneBody,
len: body.dataStream.length,
- line: 0,
- segmentId,
});
memoryCursor.reset();
@@ -256,7 +253,6 @@ function getCutActionsFromTextRanges(
textX.push({
t: TextXActionType.RETAIN,
len,
- segmentId,
});
} else {
textX.push(...BuildTextUtils.selection.getDeleteExcludeLastLineBreakActions(selection, originBody, segmentId, memoryCursor.cursor, false));
@@ -341,15 +337,12 @@ function getCutActionsFromRectRanges(
textX.push({
t: TextXActionType.RETAIN,
len: offset - memoryCursor.cursor,
- segmentId,
});
}
textX.push({
t: TextXActionType.DELETE,
len,
- line: 0,
- segmentId,
});
const action = jsonX.removeOp(['tableSource', tableId]);
@@ -369,15 +362,12 @@ function getCutActionsFromRectRanges(
textX.push({
t: TextXActionType.RETAIN,
len: offset - memoryCursor.cursor,
- segmentId,
});
}
textX.push({
t: TextXActionType.DELETE,
len,
- line: 0,
- segmentId,
});
// Step 3: delete table rows;
@@ -402,15 +392,12 @@ function getCutActionsFromRectRanges(
textX.push({
t: TextXActionType.RETAIN,
len: retain - memoryCursor.cursor,
- segmentId,
});
}
textX.push({
t: TextXActionType.DELETE,
len: delLen,
- line: 0,
- segmentId,
});
memoryCursor.moveCursorTo(retain + delLen);
diff --git a/packages/docs-ui/src/commands/commands/core-editing.command.ts b/packages/docs-ui/src/commands/commands/core-editing.command.ts
index 951932ed50..92788c4c65 100644
--- a/packages/docs-ui/src/commands/commands/core-editing.command.ts
+++ b/packages/docs-ui/src/commands/commands/core-editing.command.ts
@@ -49,7 +49,6 @@ export const InsertCommand: ICommand<IInsertCommandParams> = {
type: CommandType.COMMAND,
- // eslint-disable-next-line max-lines-per-function
handler: async (accessor, params: IInsertCommandParams) => {
const commandService = accessor.get(ICommandService);
const { range, segmentId, body, unitId, cursorOffset, extendLastRange } = params;
@@ -100,7 +99,6 @@ export const InsertCommand: ICommand<IInsertCommandParams> = {
textX.push({
t: TextXActionType.RETAIN,
len: startOffset,
- segmentId,
});
}
} else {
@@ -119,8 +117,6 @@ export const InsertCommand: ICommand<IInsertCommandParams> = {
t: TextXActionType.INSERT,
body,
len: body.dataStream.length,
- line: 0,
- segmentId,
});
const path = getRichTextEditPath(docDataModel, segmentId);
@@ -199,14 +195,11 @@ export const DeleteCommand: ICommand<IDeleteCommandParams> = {
textX.push({
t: TextXActionType.RETAIN,
len: deleteIndex - cursor,
- segmentId,
});
}
textX.push({
t: TextXActionType.DELETE,
len: 1,
- segmentId,
- line: 0,
});
cursor = deleteIndex + 1;
}
@@ -267,14 +260,12 @@ export const UpdateCommand: ICommand<IUpdateCommandParams> = {
textX.push({
t: TextXActionType.RETAIN,
len: startOffset,
- segmentId,
});
textX.push({
t: TextXActionType.RETAIN,
body: updateBody,
len: endOffset - startOffset,
- segmentId,
coverType,
});
diff --git a/packages/docs-ui/src/commands/commands/doc-delete.command.ts b/packages/docs-ui/src/commands/commands/doc-delete.command.ts
index e55910ea77..f6382b9a87 100644
--- a/packages/docs-ui/src/commands/commands/doc-delete.command.ts
+++ b/packages/docs-ui/src/commands/commands/doc-delete.command.ts
@@ -99,15 +99,12 @@ export const DeleteCustomBlockCommand: ICommand<IDeleteCustomBlockParams> = {
textX.push({
t: TextXActionType.RETAIN,
len: direction === DeleteDirection.LEFT ? startOffset - 1 : startOffset,
- segmentId,
});
}
textX.push({
t: TextXActionType.DELETE,
len: 1,
- line: 0,
- segmentId,
});
const path = getRichTextEditPath(documentDataModel, segmentId);
@@ -219,29 +216,24 @@ export const MergeTwoParagraphCommand: ICommand<IMergeTwoParagraphParams> = {
textX.push({
t: TextXActionType.RETAIN,
len: curParagraph.startIndex,
- segmentId,
});
}
textX.push({
t: TextXActionType.DELETE,
len: 1,
- line: 0,
- segmentId,
});
if (nextParagraph.startIndex > curParagraph.startIndex + 1) {
textX.push({
t: TextXActionType.RETAIN,
len: nextParagraph.startIndex - curParagraph.startIndex - 1,
- segmentId,
});
}
textX.push({
t: TextXActionType.RETAIN,
len: 1,
- segmentId,
coverType: UpdateDocsAttributeType.REPLACE,
body: {
dataStream: '',
diff --git a/packages/docs-ui/src/commands/commands/doc-paragraph-setting.command.ts b/packages/docs-ui/src/commands/commands/doc-paragraph-setting.command.ts
index be7bd08022..bc7f74af19 100644
--- a/packages/docs-ui/src/commands/commands/doc-paragraph-setting.command.ts
+++ b/packages/docs-ui/src/commands/commands/doc-paragraph-setting.command.ts
@@ -68,7 +68,6 @@ export const DocParagraphSettingCommand: ICommand<IDocParagraphSettingCommandPar
textX.push({
t: TextXActionType.RETAIN,
len: startIndex - memoryCursor.cursor,
- segmentId,
});
// See: univer/packages/engine-render/src/components/docs/block/paragraph/layout-ruler.ts line:802 comments.
const paragraphStyle: IParagraphStyle = {
@@ -88,7 +87,6 @@ export const DocParagraphSettingCommand: ICommand<IDocParagraphSettingCommandPar
},
],
},
- segmentId,
coverType: UpdateDocsAttributeType.REPLACE,
});
diff --git a/packages/docs-ui/src/commands/commands/ime-input.command.ts b/packages/docs-ui/src/commands/commands/ime-input.command.ts
index 7fae00ebc7..e102244cf9 100644
--- a/packages/docs-ui/src/commands/commands/ime-input.command.ts
+++ b/packages/docs-ui/src/commands/commands/ime-input.command.ts
@@ -108,7 +108,6 @@ export const IMEInputCommand: ICommand<IIMEInputCommandParams> = {
textX.push({
t: TextXActionType.RETAIN,
len: startOffset,
- segmentId,
});
}
@@ -116,8 +115,6 @@ export const IMEInputCommand: ICommand<IIMEInputCommandParams> = {
textX.push({
t: TextXActionType.DELETE,
len: oldTextLen,
- line: 0,
- segmentId,
});
}
@@ -134,8 +131,6 @@ export const IMEInputCommand: ICommand<IIMEInputCommandParams> = {
: [],
},
len: newText.length,
- line: 0,
- segmentId,
});
const path = getRichTextEditPath(docDataModel, segmentId);
diff --git a/packages/docs-ui/src/commands/commands/inline-format.command.ts b/packages/docs-ui/src/commands/commands/inline-format.command.ts
index 0db35fab0e..27ef51ea52 100644
--- a/packages/docs-ui/src/commands/commands/inline-format.command.ts
+++ b/packages/docs-ui/src/commands/commands/inline-format.command.ts
@@ -348,7 +348,6 @@ export const SetInlineFormatCommand: ICommand<ISetInlineFormatCommandParams> = {
textX.push({
t: TextXActionType.RETAIN,
len,
- segmentId,
});
}
@@ -356,7 +355,6 @@ export const SetInlineFormatCommand: ICommand<ISetInlineFormatCommandParams> = {
t: TextXActionType.RETAIN,
body,
len: endOffset - startOffset,
- segmentId,
});
memoryCursor.reset();
diff --git a/packages/docs-ui/src/commands/commands/list.command.ts b/packages/docs-ui/src/commands/commands/list.command.ts
index 89526d3a1d..7e2825cfdd 100644
--- a/packages/docs-ui/src/commands/commands/list.command.ts
+++ b/packages/docs-ui/src/commands/commands/list.command.ts
@@ -429,7 +429,6 @@ export const QuickListCommand: ICommand<IQuickListCommandParams> = {
textX.push({
t: TextXActionType.DELETE,
len: paragraphEnd - paragraphStart,
- line: 1,
});
textX.push({
diff --git a/packages/docs-ui/src/commands/commands/paragraph-align.command.ts b/packages/docs-ui/src/commands/commands/paragraph-align.command.ts
index e713a47d55..6f4b9bb290 100644
--- a/packages/docs-ui/src/commands/commands/paragraph-align.command.ts
+++ b/packages/docs-ui/src/commands/commands/paragraph-align.command.ts
@@ -14,6 +14,9 @@
* limitations under the License.
*/
+import type { ICommand, IMutationInfo, IParagraphStyle } from '@univerjs/core';
+import type { IRichTextEditingMutationParams } from '@univerjs/docs';
+
import {
CommandType, HorizontalAlign,
ICommandService,
@@ -25,9 +28,6 @@ import {
UpdateDocsAttributeType,
} from '@univerjs/core';
import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
-
-import type { ICommand, IMutationInfo, IParagraphStyle } from '@univerjs/core';
-import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import { getRichTextEditPath } from '../util';
import { getParagraphsInRanges } from './list.command';
@@ -92,7 +92,6 @@ export const AlignOperationCommand: ICommand<IAlignOperationCommandParams> = {
textX.push({
t: TextXActionType.RETAIN,
len: startIndex - memoryCursor.cursor,
- segmentId,
});
// See: univer/packages/engine-render/src/components/docs/block/paragraph/layout-ruler.ts line:802 comments.
@@ -114,7 +113,6 @@ export const AlignOperationCommand: ICommand<IAlignOperationCommandParams> = {
},
],
},
- segmentId,
coverType: UpdateDocsAttributeType.REPLACE,
});
diff --git a/packages/docs-ui/src/commands/commands/replace-content.command.ts b/packages/docs-ui/src/commands/commands/replace-content.command.ts
index 07df1025fd..61832307a7 100644
--- a/packages/docs-ui/src/commands/commands/replace-content.command.ts
+++ b/packages/docs-ui/src/commands/commands/replace-content.command.ts
@@ -259,8 +259,6 @@ function getMutationActions(segmentId: string, docDatModel: DocumentDataModel, p
textX.push({
t: TextXActionType.DELETE,
len: deleteLen,
- line: 0,
- segmentId,
});
}
@@ -269,8 +267,6 @@ function getMutationActions(segmentId: string, docDatModel: DocumentDataModel, p
t: TextXActionType.INSERT,
body,
len: body.dataStream.length,
- line: 0,
- segmentId,
});
}
@@ -344,7 +340,6 @@ export const ReplaceSelectionCommand: ICommand<IReplaceSelectionCommandParams> =
t: TextXActionType.INSERT,
body: insertBody,
len: insertBody.dataStream.length,
- line: 0,
});
doMutation.params.actions = jsonX.editOp(textX.serialize());
diff --git a/packages/docs-ui/src/commands/commands/table/doc-table-create.command.ts b/packages/docs-ui/src/commands/commands/table/doc-table-create.command.ts
index 7733ced200..68ba027f0e 100644
--- a/packages/docs-ui/src/commands/commands/table/doc-table-create.command.ts
+++ b/packages/docs-ui/src/commands/commands/table/doc-table-create.command.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import { BuildTextUtils, CommandType, DataStreamTreeTokenType, ICommandService, IUniverInstanceService, JSONX, TextX, TextXActionType } from '@univerjs/core';
-import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
import type { ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
+import { BuildTextUtils, CommandType, DataStreamTreeTokenType, ICommandService, IUniverInstanceService, JSONX, TextX, TextXActionType } from '@univerjs/core';
+import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
import { getCommandSkeleton, getRichTextEditPath } from '../../util';
import { generateParagraphs } from '../break-line.command';
import { genEmptyTable, genTableSource } from './table';
@@ -103,7 +103,6 @@ export const CreateDocTableCommand: ICommand<ICreateDocTableCommandParams> = {
textX.push({
t: TextXActionType.RETAIN,
len: startOffset,
- segmentId,
});
}
@@ -115,8 +114,6 @@ export const CreateDocTableCommand: ICommand<ICreateDocTableCommandParams> = {
paragraphs: generateParagraphs(DataStreamTreeTokenType.PARAGRAPH, prevParagraph),
},
len: 1,
- line: 0,
- segmentId,
});
}
@@ -144,8 +141,6 @@ export const CreateDocTableCommand: ICommand<ICreateDocTableCommandParams> = {
],
},
len: tableDataStream.length,
- line: 0,
- segmentId,
});
const path = getRichTextEditPath(docDataModel, segmentId);
diff --git a/packages/docs-ui/src/commands/commands/table/doc-table-delete.command.ts b/packages/docs-ui/src/commands/commands/table/doc-table-delete.command.ts
index 2d684eaa5c..c8b1eff45e 100644
--- a/packages/docs-ui/src/commands/commands/table/doc-table-delete.command.ts
+++ b/packages/docs-ui/src/commands/commands/table/doc-table-delete.command.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import { CommandType, ICommandService, IUniverInstanceService, JSONX, TextX, TextXActionType } from '@univerjs/core';
-import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
import type { ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
+import { CommandType, ICommandService, IUniverInstanceService, JSONX, TextX, TextXActionType } from '@univerjs/core';
+import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
import { getCommandSkeleton, getRichTextEditPath } from '../../util';
import { getDeleteColumnsActionParams, getDeleteRowsActionsParams, getDeleteTableActionParams, getRangeInfoFromRanges } from './table';
@@ -95,15 +95,12 @@ export const DocTableDeleteRowsCommand: ICommand<IDocTableDeleteRowsCommandParam
textX.push({
t: TextXActionType.RETAIN,
len: offset,
- segmentId,
});
}
textX.push({
t: TextXActionType.DELETE,
len,
- line: 0,
- segmentId,
});
const path = getRichTextEditPath(docDataModel, segmentId);
@@ -203,15 +200,12 @@ export const DocTableDeleteColumnsCommand: ICommand<IDocTableDeleteColumnsComman
textX.push({
t: TextXActionType.RETAIN,
len: retain,
- segmentId,
});
}
textX.push({
t: TextXActionType.DELETE,
len: deleteLen,
- line: 0,
- segmentId,
});
}
@@ -313,15 +307,12 @@ export const DocTableDeleteTableCommand: ICommand<IDocTableDeleteTableCommandPar
textX.push({
t: TextXActionType.RETAIN,
len: offset,
- segmentId,
});
}
textX.push({
t: TextXActionType.DELETE,
len,
- line: 0,
- segmentId,
});
const path = getRichTextEditPath(docDataModel, segmentId);
diff --git a/packages/docs-ui/src/commands/commands/table/doc-table-insert.command.ts b/packages/docs-ui/src/commands/commands/table/doc-table-insert.command.ts
index 31c3580c98..b739190b3f 100644
--- a/packages/docs-ui/src/commands/commands/table/doc-table-insert.command.ts
+++ b/packages/docs-ui/src/commands/commands/table/doc-table-insert.command.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import { CommandType, ICommandService, IUniverInstanceService, JSONX, TextX, TextXActionType, UniverInstanceType } from '@univerjs/core';
-import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
import type { DocumentDataModel, ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';
import type { IRichTextEditingMutationParams } from '@univerjs/docs';
import type { ITextRangeWithStyle } from '@univerjs/engine-render';
+import { CommandType, ICommandService, IUniverInstanceService, JSONX, TextX, TextXActionType, UniverInstanceType } from '@univerjs/core';
+import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';
import { getCommandSkeleton, getRichTextEditPath } from '../../util';
import { getColumnWidths, getEmptyTableCell, getEmptyTableRow, getInsertColumnActionsParams, getInsertColumnBody, getInsertRowActionsParams, getInsertRowBody, getRangeInfoFromRanges, getTableColumn, INSERT_COLUMN_POSITION, INSERT_ROW_POSITION } from './table';
@@ -160,7 +160,6 @@ export const DocTableInsertRowCommand: ICommand<IDocTableInsertRowCommandParams>
textX.push({
t: TextXActionType.RETAIN,
len: offset,
- segmentId,
});
}
@@ -170,8 +169,6 @@ export const DocTableInsertRowCommand: ICommand<IDocTableInsertRowCommandParams>
t: TextXActionType.INSERT,
body: insertBody,
len: insertBody.dataStream.length,
- line: 0,
- segmentId,
});
const path = getRichTextEditPath(docDataModel, segmentId);
@@ -271,7 +268,6 @@ export const DocTableInsertColumnCommand: ICommand<IDocTableInsertColumnCommandP
textX.push({
t: TextXActionType.RETAIN,
len: offset,
- segmentId,
});
const insertBody = getInsertColumnBody();
@@ -280,8 +276,6 @@ export const DocTableInsertColumnCommand: ICommand<IDocTableInsertColumnCommandP
t: TextXActionType.INSERT,
body: insertBody,
len: insertBody.dataStream.length,
- line: 0,
- segmentId,
});
}