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.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
feat(doc): handle backspace in indented paragraph (#497)
Ran Luoe900bdb204c5
diff --git a/packages/base-docs/src/commands/commands/__tests__/clipboard.command.spec.ts b/packages/base-docs/src/commands/commands/__tests__/clipboard.command.spec.tsindex 428e01e538..2641fc00ce 100644--- a/packages/base-docs/src/commands/commands/__tests__/clipboard.command.spec.ts+++ b/packages/base-docs/src/commands/commands/__tests__/clipboard.command.spec.ts@@ -17,9 +17,9 @@ import { NORMAL_TEXT_SELECTION_PLUGIN_NAME } from '../../../basics/docs-view-keyimport { TextSelectionManagerService } from '../../../services/text-selection-manager.service';import { RichTextEditingMutation } from '../../mutations/core-editing.mutation';import {+ CutContentCommand,IInnerCutCommandParams,IInnerPasteCommandParams,- InnerCutCommand,InnerPasteCommand,} from '../clipboard.inner.command';import { createCommandTestBed } from './create-command-test-bed';@@ -115,7 +115,7 @@ describe('test cases in clipboard', () => {commandService = get(ICommandService);commandService.registerCommand(InnerPasteCommand);- commandService.registerCommand(InnerCutCommand);+ commandService.registerCommand(CutContentCommand);commandService.registerCommand(RichTextEditingMutation as unknown as ICommand);const selectionManager = get(TextSelectionManagerService);@@ -188,7 +188,7 @@ describe('test cases in clipboard', () => {textRanges: [], // only used to eliminate TS type check error.};- await commandService.executeCommand(InnerCutCommand.id, commandParams);+ await commandService.executeCommand(CutContentCommand.id, commandParams);expect(getTextByPosition(0, 5)).toBe(`s New`);diff --git a/packages/base-docs/src/commands/commands/clipboard.inner.command.ts b/packages/base-docs/src/commands/commands/clipboard.inner.command.tsindex b722ccb57b..07991eb5d5 100644--- a/packages/base-docs/src/commands/commands/clipboard.inner.command.ts+++ b/packages/base-docs/src/commands/commands/clipboard.inner.command.ts@@ -1,10 +1,12 @@import { ITextRangeWithStyle } from '@univerjs/base-render';import {CommandType,+ getDocsUpdateBody,ICommand,ICommandService,IDocumentBody,IMutationInfo,+ ITextRange,IUndoRedoService,IUniverInstanceService,} from '@univerjs/core';@@ -12,7 +14,12 @@ import {import { MemoryCursor } from '../../basics/memory-cursor';import { getRetainAndDeleteFromReplace } from '../../basics/retain-delete-params';import { TextSelectionManagerService } from '../../services/text-selection-manager.service';-import { IRichTextEditingMutationParams, RichTextEditingMutation } from '../mutations/core-editing.mutation';+import {+ IDeleteMutationParams,+ IRetainMutationParams,+ IRichTextEditingMutationParams,+ RichTextEditingMutation,+} from '../mutations/core-editing.mutation';export interface IInnerPasteCommandParams {segmentId: string;@@ -121,9 +128,11 @@ export interface IInnerCutCommandParams {textRanges: ITextRangeWithStyle[];}-export const InnerCutCommand: ICommand<IInnerCutCommandParams> = {+export const CutContentCommand: ICommand<IInnerCutCommandParams> = {id: 'doc.command.inner-cut',+type: CommandType.COMMAND,+handler: async (accessor, params: IInnerCutCommandParams) => {const { segmentId, textRanges } = params;const undoRedoService = accessor.get(IUndoRedoService);@@ -137,8 +146,15 @@ export const InnerCutCommand: ICommand<IInnerCutCommandParams> = {return false;}- const docsModel = currentUniverService.getCurrentUniverDocInstance();- const unitId = docsModel.getUnitId();+ const unitId = currentUniverService.getCurrentUniverDocInstance().getUnitId();++ const documentModel = currentUniverService.getUniverDocInstance(unitId);++ const originBody = getDocsUpdateBody(documentModel!.snapshot, segmentId);++ if (originBody == null) {+ return false;+ }const doMutation: IMutationInfo<IRichTextEditingMutationParams> = {id: RichTextEditingMutation.id,@@ -165,7 +181,7 @@ export const InnerCutCommand: ICommand<IInnerCutCommandParams> = {});} else {doMutation.params!.mutations.push(- ...getRetainAndDeleteFromReplace(selection, segmentId, memoryCursor.cursor)+ ...getRetainAndDeleteAndExcludeLineBreak(selection, originBody, segmentId, memoryCursor.cursor));}@@ -207,3 +223,67 @@ export const InnerCutCommand: ICommand<IInnerCutCommandParams> = {return false;},};++// If the selection contains line breaks,+// paragraph information needs to be preserved when performing the CUT operation+function getRetainAndDeleteAndExcludeLineBreak(+ range: ITextRange,+ body: IDocumentBody,+ segmentId: string = '',+ memoryCursor: number = 0+): Array<IRetainMutationParams | IDeleteMutationParams> {+ const { startOffset, endOffset } = range;+ const dos: Array<IRetainMutationParams | IDeleteMutationParams> = [];++ const { paragraphs = [] } = body;++ const textStart = startOffset - memoryCursor;+ const textEnd = endOffset - memoryCursor;++ const paragraphInRange = paragraphs?.find(+ (p) => p.startIndex - memoryCursor >= textStart && p.startIndex - memoryCursor <= textEnd+ );++ if (textStart > 0) {+ dos.push({+ t: 'r',+ len: textStart,+ segmentId,+ });+ }++ if (paragraphInRange && paragraphInRange.startIndex - memoryCursor > textStart) {+ const paragraphIndex = paragraphInRange.startIndex - memoryCursor;++ dos.push({+ t: 'd',+ len: paragraphIndex - textStart,+ line: 0,+ segmentId,+ });++ dos.push({+ t: 'r',+ len: 1,+ segmentId,+ });++ if (textEnd > paragraphIndex + 1) {+ dos.push({+ t: 'd',+ len: textEnd - paragraphIndex - 1,+ line: 0,+ segmentId,+ });+ }+ } else {+ dos.push({+ t: 'd',+ len: textEnd - textStart,+ line: 0,+ segmentId,+ });+ }++ return dos;+}diff --git a/packages/base-docs/src/commands/commands/core-editing.command.ts b/packages/base-docs/src/commands/commands/core-editing.command.tsindex 480e130f58..30112318c5 100644--- a/packages/base-docs/src/commands/commands/core-editing.command.ts+++ b/packages/base-docs/src/commands/commands/core-editing.command.ts@@ -49,7 +49,9 @@ export interface IInsertCommandParams {*/export const InsertCommand: ICommand<IInsertCommandParams> = {id: 'doc.command.insert-text',+type: CommandType.COMMAND,+handler: async (accessor, params: IInsertCommandParams) => {const undoRedoService = accessor.get(IUndoRedoService);const commandService = accessor.get(ICommandService);@@ -133,18 +135,14 @@ export interface IDeleteCommandParams {}/**- * The command to delete text, mainly used in BACKSPACE.+ * The command to delete text, mainly used in BACKSPACE and DELETE when collapsed is true.*/export const DeleteCommand: ICommand<IDeleteCommandParams> = {id: 'doc.command.delete-text',type: CommandType.COMMAND,- handler: async (accessor, params) => {- if (!params) {- throw new Error();- }-+ handler: async (accessor, params: IDeleteCommandParams) => {const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);const textSelectionManagerService = accessor.get(TextSelectionManagerService);@@ -175,6 +173,7 @@ export const DeleteCommand: ICommand<IDeleteCommandParams> = {segmentId,});} else {+ // Already handle in CutContentCommand, these code bellow will delete later?doMutation.params!.mutations.push(...getRetainAndDeleteFromReplace(range, segmentId));}@@ -229,11 +228,7 @@ export const UpdateCommand: ICommand<IUpdateCommandParams> = {type: CommandType.COMMAND,- handler: async (accessor, params) => {- if (!params) {- throw new Error();- }-+ handler: async (accessor, params: IUpdateCommandParams) => {const { range, segmentId, updateBody, coverType, unitId, textRanges } = params;const commandService = accessor.get(ICommandService);const undoRedoService = accessor.get(IUndoRedoService);@@ -278,7 +273,7 @@ export const UpdateCommand: ICommand<IUpdateCommandParams> = {undo() {commandService.syncExecuteCommand(RichTextEditingMutation.id, result);- textSelectionManagerService.replaceTextRanges([range]);+ textSelectionManagerService.replaceTextRanges(textRanges);return true;},diff --git a/packages/base-docs/src/commands/mutations/__tests__/apply-utils.spec.ts b/packages/base-docs/src/commands/mutations/__tests__/apply-utils.spec.tsindex 7459f05e3d..8379401fbe 100644--- a/packages/base-docs/src/commands/mutations/__tests__/apply-utils.spec.ts+++ b/packages/base-docs/src/commands/mutations/__tests__/apply-utils.spec.ts@@ -2,19 +2,16 @@import { BooleanNumber, IDocumentBody, ITextRun, Nullable, UpdateDocsAttributeType } from '@univerjs/core';import { afterEach, beforeEach, describe, expect, it } from 'vitest';-import { deleteTextRuns, insertTextRuns } from '../functions/common';+import { deleteParagraphs, deleteTextRuns, insertTextRuns } from '../functions/common';import { coverTextRuns } from '../functions/update-apply';-interface IMockBody {- textRuns: ITextRun[];-}-describe('test case in apply utils', () => {- let body: Nullable<IMockBody> = null;+ let body: Nullable<IDocumentBody> = null;let updateTextRuns: ITextRun[] = [];beforeEach(() => {body = {+ dataStream: 'hello\rworld hello\rworld hello\rworld he\r\n',textRuns: [{st: 0,@@ -39,6 +36,20 @@ describe('test case in apply utils', () => {},},],+ paragraphs: [+ {+ startIndex: 5,+ },+ {+ startIndex: 17,+ },+ {+ startIndex: 29,+ },+ {+ startIndex: 38,+ },+ ],};updateTextRuns = [@@ -63,46 +74,46 @@ describe('test case in apply utils', () => {const removedTextRuns = deleteTextRuns(body as IDocumentBody, 10, 20);expect(removedTextRuns.length).toBe(0);- expect(body?.textRuns[2].st).toBe(20);- expect(body?.textRuns[2].ed).toBe(30);+ expect(body?.textRuns![2].st).toBe(20);+ expect(body?.textRuns![2].ed).toBe(30);});it('the inserted textRun is bigger than one testRuns', async () => {const removeTextRuns = deleteTextRuns(body as IDocumentBody, 20, 5);expect(removeTextRuns.length).toBe(2);- expect(body?.textRuns[0].ed).toBe(5);- expect(body?.textRuns[1].st).toBe(10);- expect(body?.textRuns[1].ed).toBe(20);+ expect(body?.textRuns![0].ed).toBe(5);+ expect(body?.textRuns![1].st).toBe(10);+ expect(body?.textRuns![1].ed).toBe(20);});it('the inserted textRun is smaller than one testRuns', async () => {const removeTextRuns = deleteTextRuns(body as IDocumentBody, 2, 16);expect(removeTextRuns.length).toBe(1);- expect(body?.textRuns[1].ed).toBe(18);- expect(body?.textRuns[2].st).toBe(28);- expect(body?.textRuns[2].ed).toBe(38);+ expect(body?.textRuns![1].ed).toBe(18);+ expect(body?.textRuns![2].st).toBe(28);+ expect(body?.textRuns![2].ed).toBe(38);});it('the inserted textRun is across two testRuns', async () => {const removeTextRuns = deleteTextRuns(body as IDocumentBody, 13, 5);expect(removeTextRuns.length).toBe(2);- expect(body?.textRuns[0].ed).toBe(5);- expect(body?.textRuns[1].st).toBe(5);- expect(body?.textRuns[1].ed).toBe(7);- expect(body?.textRuns[2].st).toBe(17);- expect(body?.textRuns[2].ed).toBe(27);+ expect(body?.textRuns![0].ed).toBe(5);+ expect(body?.textRuns![1].st).toBe(5);+ expect(body?.textRuns![1].ed).toBe(7);+ expect(body?.textRuns![2].st).toBe(17);+ expect(body?.textRuns![2].ed).toBe(27);});it('the inserted textRun is across two testRuns that scattered', async () => {const removeTextRuns = deleteTextRuns(body as IDocumentBody, 20, 18);expect(removeTextRuns.length).toBe(2);- expect(body?.textRuns[1].ed).toBe(18);- expect(body?.textRuns[2].st).toBe(18);- expect(body?.textRuns[2].ed).toBe(20);+ expect(body?.textRuns![1].ed).toBe(18);+ expect(body?.textRuns![2].st).toBe(18);+ expect(body?.textRuns![2].ed).toBe(20);});});@@ -282,7 +293,7 @@ describe('test case in apply utils', () => {0);- expect(body?.textRuns.length).toBe(4);+ expect(body?.textRuns!.length).toBe(4);});it('it should pass the case when the insertTextRuns is between original testRuns', async () => {@@ -295,11 +306,11 @@ describe('test case in apply utils', () => {25);- expect(body?.textRuns.length).toBe(4);- expect(body?.textRuns[0].ts?.bl).toBe(BooleanNumber.FALSE);- expect(body?.textRuns[1].ts?.bl).toBe(BooleanNumber.FALSE);- expect(body?.textRuns[2].ts?.bl).toBe(BooleanNumber.TRUE);- expect(body?.textRuns[3].ts?.bl).toBe(BooleanNumber.FALSE);+ expect(body?.textRuns!.length).toBe(4);+ expect(body?.textRuns![0].ts?.bl).toBe(BooleanNumber.FALSE);+ expect(body?.textRuns![1].ts?.bl).toBe(BooleanNumber.FALSE);+ expect(body?.textRuns![2].ts?.bl).toBe(BooleanNumber.TRUE);+ expect(body?.textRuns![3].ts?.bl).toBe(BooleanNumber.FALSE);});it('it should pass the case when the insertTextRuns is at the end of one testRun', async () => {@@ -312,7 +323,7 @@ describe('test case in apply utils', () => {15);- expect(body?.textRuns.length).toBe(4);+ expect(body?.textRuns!.length).toBe(4);});it('it should pass the case when the insertTextRuns is at the in the middle of one testRun', async () => {@@ -325,7 +336,7 @@ describe('test case in apply utils', () => {10);- expect(body?.textRuns.length).toBe(5);+ expect(body?.textRuns!.length).toBe(5);});it('it should pass the case when the insertTextRuns has the same style with the origin textRun, and should be merged', async () => {@@ -347,10 +358,10 @@ describe('test case in apply utils', () => {10);- expect(body?.textRuns.length).toBe(3);- expect(body?.textRuns[0].ts?.bl).toBe(BooleanNumber.FALSE);- expect(body?.textRuns[1].ts?.bl).toBe(BooleanNumber.FALSE);- expect(body?.textRuns[2].ts?.bl).toBe(BooleanNumber.FALSE);+ expect(body?.textRuns!.length).toBe(3);+ expect(body?.textRuns![0].ts?.bl).toBe(BooleanNumber.FALSE);+ expect(body?.textRuns![1].ts?.bl).toBe(BooleanNumber.FALSE);+ expect(body?.textRuns![2].ts?.bl).toBe(BooleanNumber.FALSE);});it('it should pass the case when the insertTextRuns is empty', async () => {@@ -363,10 +374,10 @@ describe('test case in apply utils', () => {10);- expect(body?.textRuns.length).toBe(3);- expect(body?.textRuns[0].ts?.bl).toBe(BooleanNumber.FALSE);- expect(body?.textRuns[1].ts?.bl).toBe(BooleanNumber.FALSE);- expect(body?.textRuns[2].ts?.bl).toBe(BooleanNumber.FALSE);+ expect(body?.textRuns!.length).toBe(3);+ expect(body?.textRuns![0].ts?.bl).toBe(BooleanNumber.FALSE);+ expect(body?.textRuns![1].ts?.bl).toBe(BooleanNumber.FALSE);+ expect(body?.textRuns![2].ts?.bl).toBe(BooleanNumber.FALSE);});it(`If textRuns doesn't intersect, they shouldn't be merged`, async () => {@@ -388,11 +399,24 @@ describe('test case in apply utils', () => {25);- expect(body?.textRuns.length).toBe(4);- expect(body?.textRuns[0].ts?.bl).toBe(BooleanNumber.FALSE);- expect(body?.textRuns[1].ts?.bl).toBe(BooleanNumber.FALSE);- expect(body?.textRuns[2].ts?.bl).toBe(BooleanNumber.FALSE);- expect(body?.textRuns[3].ts?.bl).toBe(BooleanNumber.FALSE);+ expect(body?.textRuns!.length).toBe(4);+ expect(body?.textRuns![0].ts?.bl).toBe(BooleanNumber.FALSE);+ expect(body?.textRuns![1].ts?.bl).toBe(BooleanNumber.FALSE);+ expect(body?.textRuns![2].ts?.bl).toBe(BooleanNumber.FALSE);+ expect(body?.textRuns![3].ts?.bl).toBe(BooleanNumber.FALSE);+ });+ });++ describe('test cases in function deleteParagraphs', () => {+ it('it should pass the case when the delete range has no paragraphs', async () => {+ const removedParagraphs = deleteParagraphs(body!, 2, 0);+ expect(removedParagraphs.length).toBe(0);+ });++ it('it should pass the case when the delete range has one paragraphs', async () => {+ const removedParagraphs = deleteParagraphs(body!, 2, 5);+ expect(removedParagraphs.length).toBe(1);+ expect(removedParagraphs[0].startIndex).toBe(0);});});});diff --git a/packages/base-docs/src/commands/mutations/functions/common.ts b/packages/base-docs/src/commands/mutations/functions/common.tsindex b68796337b..ab1b6f36ac 100644--- a/packages/base-docs/src/commands/mutations/functions/common.ts+++ b/packages/base-docs/src/commands/mutations/functions/common.ts@@ -11,15 +11,9 @@ import {ITextRun,Nullable,sortRulesFactory,+ Tools,} from '@univerjs/core';-function hasIntersectionBetweenTextRuns(textRun1: ITextRun, textRun2: ITextRun) {- const { st: firstSt, ed: firstEd } = textRun1;- const { st: secondSt, ed: secondEd } = textRun2;-- return firstEd >= secondSt && secondEd >= firstSt;-}-export function normalizeTextRuns(textRuns: ITextRun[]) {const results: ITextRun[] = [];@@ -36,7 +30,10 @@ export function normalizeTextRuns(textRuns: ITextRun[]) {}const peak = results.pop()!;- if (isSameStyleTextRun(textRun, peak) && hasIntersectionBetweenTextRuns(peak, textRun)) {+ if (+ isSameStyleTextRun(textRun, peak) &&+ Tools.hasIntersectionBetweenTwoRanges(peak.st, peak.ed, textRun.st, textRun.ed)+ ) {results.push({...textRun,st: peak.st,@@ -437,44 +434,32 @@ export function deleteTextRuns(body: IDocumentBody, textLength: number, currentIreturn removeTextRuns;}-export function deleteParagraphs(- body: IDocumentBody,- textLength: number,- currentIndex: number,- closeRemoveAfterFirstNew = false-) {+export function deleteParagraphs(body: IDocumentBody, textLength: number, currentIndex: number) {const { paragraphs } = body;const startIndex = currentIndex;- const endIndex = currentIndex + textLength - 1;+ const endIndex = currentIndex + textLength;const removeParagraphs: IParagraph[] = [];let removeAfterFirstNew: Nullable<IParagraph> = null;let isRemove = false;+if (paragraphs) {const newParagraphs = [];for (let i = 0, len = paragraphs.length; i < len; i++) {const paragraph = paragraphs[i];const { startIndex: index } = paragraph;- // if (startIndex === endIndex && endIndex === index) {- // const nextParagraph = paragraphs[i + 1];- // const isBullet = checkParagraphHasBullet(nextParagraph);- // const isIndent = checkParagraphHasIndent(nextParagraph);- // if (isBullet && nextParagraph != null) {- // delete nextParagraph.bullet;- // } else if (isIndent && nextParagraph != null) {- // delete nextParagraph.paragraphStyle?.hanging;- // delete nextParagraph.paragraphStyle?.indentStart;- // }- // } else- if (index >= startIndex && index <= endIndex) {++ if (index >= startIndex && index < endIndex) {removeParagraphs.push({...paragraph,startIndex: index - currentIndex,});+isRemove = true;+continue;- } else if (index > endIndex) {+ } else if (index >= endIndex) {paragraph.startIndex -= textLength;}@@ -484,23 +469,27 @@ export function deleteParagraphs(removeAfterFirstNew = paragraph;}}- if (removeAfterFirstNew != null && closeRemoveAfterFirstNew === false) {- // When deleting a paragraph, the configuration of the paragraph- // in the beginning range should be retained. Due to the label design,- // the paragraph mark is located after the content, so when deleting,- // it will surround the configuration of the end range. A position update is required,- // and the undo time should also be considered Restoration of position- const removeFirst = removeParagraphs[0];- if (removeFirst) {- const newInsert = { ...removeFirst };- removeParagraphs.push(removeAfterFirstNew);- newParagraphs.splice(newParagraphs.indexOf(removeAfterFirstNew), 1, newInsert);- newInsert.startIndex = removeAfterFirstNew.startIndex;- removeAfterFirstNew.startIndex += textLength - currentIndex;- }- }+ // if (removeAfterFirstNew != null && closeRemoveAfterFirstNew === false) {+ // // When deleting a paragraph, the configuration of the paragraph+ // // in the beginning range should be retained. Due to the label design,+ // // the paragraph mark is located after the content, so when deleting,+ // // it will surround the configuration of the end range. A position update is required,+ // // and the undo time should also be considered Restoration of position+ // const removeFirst = removeParagraphs[0];++ // if (removeFirst) {+ // const newInsert = { ...removeFirst };+ // removeParagraphs.splice(removeParagraphs.indexOf(removeFirst), 1, removeAfterFirstNew);+ // newParagraphs.splice(newParagraphs.indexOf(removeAfterFirstNew), 1, newInsert);+ // const tempIndex = newInsert.startIndex;+ // newInsert.startIndex = removeAfterFirstNew.startIndex;+ // removeAfterFirstNew.startIndex = tempIndex;+ // }+ // }+body.paragraphs = newParagraphs;}+return removeParagraphs;}diff --git a/packages/base-docs/src/commands/mutations/functions/insert-apply.ts b/packages/base-docs/src/commands/mutations/functions/insert-apply.tsindex 6d5e7d88ed..748188ba49 100644--- a/packages/base-docs/src/commands/mutations/functions/insert-apply.ts+++ b/packages/base-docs/src/commands/mutations/functions/insert-apply.ts@@ -41,7 +41,7 @@ export function InsertApply(bodyModel.insert(insertBody, currentIndex);}- console.log('插入的model打印', bodyModel, textLength, currentIndex);+ // console.log('插入的model打印', bodyModel, textLength, currentIndex);}function updateAttributeByInsert(diff --git a/packages/base-docs/src/commands/mutations/functions/update-apply.ts b/packages/base-docs/src/commands/mutations/functions/update-apply.tsindex 881899dc93..6edf39d78c 100644--- a/packages/base-docs/src/commands/mutations/functions/update-apply.ts+++ b/packages/base-docs/src/commands/mutations/functions/update-apply.ts@@ -224,7 +224,7 @@ function updateParagraphs(return;}- const removeParagraphs = deleteParagraphs(body, textLength, currentIndex, true);+ const removeParagraphs = deleteParagraphs(body, textLength, currentIndex);if (coverType !== UpdateDocsAttributeType.REPLACE) {const newUpdateParagraphs: IParagraph[] = [];diff --git a/packages/base-docs/src/controllers/clipboard.controller.ts b/packages/base-docs/src/controllers/clipboard.controller.tsindex b3f179e0b9..4caea81088 100644--- a/packages/base-docs/src/controllers/clipboard.controller.ts+++ b/packages/base-docs/src/controllers/clipboard.controller.ts@@ -15,7 +15,7 @@ import {import { Inject } from '@wendellhu/redi';import { DocCopyCommand, DocCutCommand, DocPasteCommand } from '../commands/commands/clipboard.command';-import { InnerCutCommand, InnerPasteCommand } from '../commands/commands/clipboard.inner.command';+import { CutContentCommand, InnerPasteCommand } from '../commands/commands/clipboard.inner.command';import { IDocClipboardService } from '../services/clipboard/clipboard.service';import { DocSkeletonManagerService } from '../services/doc-skeleton-manager.service';import { TextSelectionManagerService } from '../services/text-selection-manager.service';@@ -40,7 +40,7 @@ export class DocClipboardController extends Disposable {[DocCopyCommand, DocCutCommand, DocPasteCommand].forEach((command) =>this.disposeWithMe(this._commandService.registerAsMultipleCommand(command)));- [InnerPasteCommand, InnerCutCommand].forEach((command) =>+ [InnerPasteCommand, CutContentCommand].forEach((command) =>this.disposeWithMe(this._commandService.registerCommand(command)));}@@ -264,7 +264,7 @@ export class DocClipboardController extends Disposable {},];- this._commandService.executeCommand(InnerCutCommand.id, { segmentId, textRanges });+ this._commandService.executeCommand(CutContentCommand.id, { segmentId, textRanges });} catch (e) {this._logService.error('[DocClipboardController] cut content failed');}diff --git a/packages/base-docs/src/controllers/delete.controller.ts b/packages/base-docs/src/controllers/delete.controller.tsindex 73af11ad7c..763d3d70dd 100644--- a/packages/base-docs/src/controllers/delete.controller.ts+++ b/packages/base-docs/src/controllers/delete.controller.ts@@ -1,7 +1,6 @@import {getParagraphBySpan,hasListSpan,- IRenderManagerService,isFirstSpan,isIndentBySpan,isSameLine,@@ -14,13 +13,12 @@ import {IParagraph,IUniverInstanceService,LifecycleStages,- Nullable,OnLifecycle,+ UpdateDocsAttributeType,} from '@univerjs/core';import { Inject } from '@wendellhu/redi';-import { Subscription } from 'rxjs';-import { getDocObject } from '../basics/component-tools';+import { CutContentCommand } from '../commands/commands/clipboard.inner.command';import {DeleteCommand,DeleteDirection,@@ -33,12 +31,9 @@ import { TextSelectionManagerService } from '../services/text-selection-manager.@OnLifecycle(LifecycleStages.Rendered, DeleteController)export class DeleteController extends Disposable {- private _onInputSubscription: Nullable<Subscription>;-constructor(@Inject(DocSkeletonManagerService) private readonly _docSkeletonManagerService: DocSkeletonManagerService,@IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,- @IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@ITextSelectionRenderManager private readonly _textSelectionRenderManager: ITextSelectionRenderManager,@Inject(TextSelectionManagerService) private readonly _textSelectionManagerService: TextSelectionManagerService,@ICommandService private readonly _commandService: ICommandService@@ -50,10 +45,6 @@ export class DeleteController extends Disposable {this._commandExecutedListener();}- override dispose(): void {- this._onInputSubscription?.unsubscribe();- }-private _initialize() {}private _commandExecutedListener() {@@ -79,6 +70,7 @@ export class DeleteController extends Disposable {);}+ // Use BACKSPACE to delete left.private _handleDeleteLeft() {const activeRange = this._textSelectionRenderManager.getActiveRange();@@ -138,9 +130,11 @@ export class DeleteController extends Disposable {}} else if (preIsIndent === true) {const bullet = paragraph.bullet;+if (bullet) {updateParagraph.bullet = bullet;}+if (paragraphStyle != null) {updateParagraph.paragraphStyle = { ...paragraphStyle };delete updateParagraph.paragraphStyle.hanging;@@ -164,11 +158,12 @@ export class DeleteController extends Disposable {paragraphs: [{ ...updateParagraph }],},range: {- startOffset: paragraphIndex + 1,+ startOffset: paragraphIndex,endOffset: paragraphIndex + 1,collapsed: true,},textRanges,+ coverType: UpdateDocsAttributeType.REPLACE,segmentId,});} else {@@ -181,10 +176,60 @@ export class DeleteController extends Disposable {}}+ if (collapsed === true) {+ const textRanges = [+ {+ startOffset: cursor,+ endOffset: cursor,+ collapsed: true,+ style,+ },+ ];+ this._commandService.executeCommand(DeleteCommand.id, {+ unitId: docsModel.getUnitId(),+ range: activeRange,+ segmentId,+ direction: DeleteDirection.LEFT,+ textRanges,+ });+ } else {+ const textRanges = this._getTextRangesWhenDelete();+ // If the selection is not closed, the effect of Delete and+ // BACKSPACE is the same as CUT, so the CUT command is executed.+ this._commandService.executeCommand(CutContentCommand.id, {+ segmentId,+ textRanges,+ });+ }+ }++ skeleton?.calculate();+ }++ // Use DELETE to delete right.+ private _handleDeleteRight() {+ const activeRange = this._textSelectionRenderManager.getActiveRange();++ const skeleton = this._docSkeletonManagerService.getCurrent()?.skeleton;++ if (activeRange == null || skeleton == null) {+ return;+ }++ const docsModel = this._currentUniverService.getCurrentUniverDocInstance();++ const { startOffset, collapsed, segmentId, style } = activeRange;++ // No need to delete when the cursor is at the last position of the last paragraph.+ if (startOffset === docsModel.getBodyModel().getBody().dataStream.length - 2 && collapsed) {+ return;+ }++ if (collapsed === true) {const textRanges = [{- startOffset: cursor,- endOffset: cursor,+ startOffset,+ endOffset: startOffset,collapsed: true,style,},@@ -194,7 +239,15 @@ export class DeleteController extends Disposable {unitId: docsModel.getUnitId(),range: activeRange,segmentId,- direction: DeleteDirection.LEFT,+ direction: DeleteDirection.RIGHT,+ textRanges,+ });+ } else {+ const textRanges = this._getTextRangesWhenDelete();+ // If the selection is not closed, the effect of Delete and+ // BACKSPACE is the same as CUT, so the CUT command is executed.+ this._commandService.executeCommand(CutContentCommand.id, {+ segmentId,textRanges,});}@@ -202,45 +255,34 @@ export class DeleteController extends Disposable {skeleton?.calculate();}- private _handleDeleteRight() {- const activeRange = this._textSelectionRenderManager.getActiveRange();+ // get cursor position when BACKSPACE/DELETE excuse the CutContentCommand.+ private _getTextRangesWhenDelete() {+ const activeRange = this._textSelectionRenderManager.getActiveRange()!;+ const ranges = this._textSelectionRenderManager.getAllTextRanges();- const skeleton = this._docSkeletonManagerService.getCurrent()?.skeleton;+ let cursor = activeRange.endOffset;- if (activeRange == null || skeleton == null) {- return;- }-- const docsModel = this._currentUniverService.getCurrentUniverDocInstance();+ for (const range of ranges) {+ const { startOffset, endOffset } = range;- const { startOffset, collapsed, segmentId, style } = activeRange;+ if (startOffset == null || endOffset == null) {+ continue;+ }- // No need to delete when the cursor is at the last position of the last paragraph.- if (startOffset === docsModel.getBodyModel().getBody().dataStream.length - 2 && collapsed) {- return;+ if (endOffset <= activeRange.endOffset) {+ cursor -= endOffset - startOffset;+ }}const textRanges = [{- startOffset,- endOffset: startOffset,+ startOffset: cursor,+ endOffset: cursor,collapsed: true,- style,+ style: activeRange.style,},];- this._commandService.executeCommand(DeleteCommand.id, {- unitId: docsModel.getUnitId(),- range: activeRange,- segmentId,- direction: DeleteDirection.RIGHT,- textRanges,- });-- skeleton?.calculate();- }-- private _getDocObject() {- return getDocObject(this._currentUniverService, this._renderManagerService);+ return textRanges;}}diff --git a/packages/common-plugin-data/src/docs/default-document-data-cn.ts b/packages/common-plugin-data/src/docs/default-document-data-cn.tsindex afcf66a68b..109e983cb2 100644--- a/packages/common-plugin-data/src/docs/default-document-data-cn.ts+++ b/packages/common-plugin-data/src/docs/default-document-data-cn.ts@@ -1,7 +1,10 @@import { BooleanNumber, IDocumentData, TextDecoration } from '@univerjs/core';+import { DEFAULT_LIST_TEST } from './default-list';+export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {id: 'd',+ lists: DEFAULT_LIST_TEST,body: {dataStream:'零. 开篇\r上标和下标:HO2 5X 删除线:我是被删除的内容 下划线:我是下划线\r这篇文章旨在帮助新人快速熟悉开源项目univer的架构及代码,也是我过去一段时间参与到 univer 开发中的学习和总结,肯定有不够准确或者理解偏差,欢迎大家评论指正\r第壹章,会聊聊我对univer架构的理解,univer是如何拆分模块,以及模块之间的依赖关系。然后将univer放入MMV的架构模式中,分别分析下其模型层、视图层、控制器的边界和职责\r第贰章,我们先来看看 univer sheet 的模型层数据结构设计,如何区分 workbook、sheet、row、column、style 等,了解他们的包含关系,这对后面深入理解代码是有帮助的\r第叁、肆章,我将从两条控制链路来分析 univer 的代码,一条链路是 univer 启动和初始化渲染的过程。在这条链路中,是从模型层到视图层的过程。另外一条链路是 univer 响应用户事件,并且触发模型层数据变更,页面重新渲染,在这条链路中,是从视图层到模型层的过程。在这两部分,我们会涉及到大量的源码分析,在保留代码主逻辑的前提,删除了边界 case 的代码。同时在每个代码块第一行,表示该代码块所在的 TS 文件,这样便于直接阅读源码\r\n',@@ -11,7 +14,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 2,ts: {fs: 24,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(255, 255, 255)',},@@ -26,7 +29,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 4,ts: {fs: 9,- ff: '"Times New Roman"',+ ff: 'Times New Roman',cl: {rgb: 'rgb(255, 255, 255)',},@@ -41,7 +44,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 6,ts: {fs: 24,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(255, 255, 255)',},@@ -56,7 +59,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 13,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -67,7 +70,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 15,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -78,7 +81,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 16,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -90,7 +93,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 18,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -101,7 +104,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 19,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -113,7 +116,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 20,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -124,7 +127,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 24,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -135,7 +138,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 33,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -149,7 +152,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 37,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -160,7 +163,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 42,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -178,7 +181,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 47,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(255, 255, 255)',},@@ -192,7 +195,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 61,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -203,7 +206,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 67,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(255, 192, 0)',},@@ -218,7 +221,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 87,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -229,7 +232,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 93,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(255, 192, 0)',},@@ -244,7 +247,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 94,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -255,7 +258,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 126,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -266,7 +269,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 130,ts: {fs: 21,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -278,7 +281,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 136,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -289,7 +292,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 142,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -300,7 +303,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 148,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -311,7 +314,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 154,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -322,7 +325,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 177,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -333,7 +336,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 183,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -348,7 +351,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 185,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -359,7 +362,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 188,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -370,7 +373,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 218,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -381,7 +384,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 222,ts: {fs: 21,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -393,7 +396,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 229,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -404,7 +407,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 243,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -415,7 +418,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 259,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -426,7 +429,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 267,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -442,7 +445,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 268,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -454,7 +457,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 273,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -470,7 +473,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 274,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -482,7 +485,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 277,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -498,7 +501,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 278,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -510,7 +513,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 284,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -526,7 +529,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 285,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -538,7 +541,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 290,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -554,7 +557,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 291,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -565,7 +568,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 318,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -576,7 +579,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 324,ts: {fs: 21,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -588,7 +591,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 337,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -599,7 +602,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 345,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -610,7 +613,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 354,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -621,7 +624,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 362,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -632,7 +635,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 401,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -643,7 +646,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 409,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -654,7 +657,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 492,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -665,7 +668,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 498,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -676,7 +679,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 523,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -687,7 +690,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 527,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -698,7 +701,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {ed: 540,ts: {fs: 14,- ff: 'Microsoft YaHei"',+ ff: 'Microsoft YaHei',cl: {rgb: 'rgb(47, 85, 151)',},@@ -725,6 +728,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {{startIndex: 126,paragraphStyle: {+ indentStart: 20,spaceAbove: 20,lineSpacing: 2,spaceBelow: 0,@@ -732,6 +736,13 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {},{startIndex: 218,+ bullet: {+ listId: 'testBullet',+ nestingLevel: 0,+ textStyle: {+ fs: 20,+ },+ },paragraphStyle: {spaceAbove: 20,lineSpacing: 2,