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
fix: use tab to insert new row (#3524)
Ran Luo1c34bd02321d
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.tsindex fe3ec245fa..31c3580c98 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,9 +14,9 @@* limitations under the License.*/-import { CommandType, ICommandService, IUniverInstanceService, JSONX, TextX, TextXActionType } from '@univerjs/core';+import { CommandType, ICommandService, IUniverInstanceService, JSONX, TextX, TextXActionType, UniverInstanceType } from '@univerjs/core';import { DocSelectionManagerService, RichTextEditingMutation } from '@univerjs/docs';-import type { ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';+import type { DocumentDataModel, ICommand, IMutationInfo, JSONXActions } from '@univerjs/core';import type { IRichTextEditingMutationParams } from '@univerjs/docs';import type { ITextRangeWithStyle } from '@univerjs/engine-render';import { getCommandSkeleton, getRichTextEditPath } from '../../util';@@ -112,7 +112,7 @@ export const DocTableInsertRowCommand: ICommand<IDocTableInsertRowCommandParams>const { segmentId } = rangeInfo;- const docDataModel = univerInstanceService.getCurrentUniverDocInstance();+ const docDataModel = univerInstanceService.getCurrentUnitForType<DocumentDataModel>(UniverInstanceType.UNIVER_DOC);const body = docDataModel?.getSelfOrHeaderFooterModel(segmentId).getBody();if (docDataModel == null || body == null) {diff --git a/packages/docs-ui/src/commands/commands/table/doc-table-tab.command.ts b/packages/docs-ui/src/commands/commands/table/doc-table-tab.command.tsindex b13567f705..3989c765b1 100644--- a/packages/docs-ui/src/commands/commands/table/doc-table-tab.command.ts+++ b/packages/docs-ui/src/commands/commands/table/doc-table-tab.command.ts@@ -70,7 +70,7 @@ export const DocTableTabCommand: ICommand<IDocTableTabCommandParams> = {endOffset,}];- textSelectionManager.replaceTextRanges(textRanges);+ textSelectionManager.replaceDocRanges(textRanges);return true;}diff --git a/packages/docs-ui/src/controllers/menu/menu.ts b/packages/docs-ui/src/controllers/menu/menu.tsindex 020bfd964a..366a85131b 100644--- a/packages/docs-ui/src/controllers/menu/menu.ts+++ b/packages/docs-ui/src/controllers/menu/menu.ts@@ -467,14 +467,12 @@ export function FontSizeSelectorMenuItemFactory(accessor: IAccessor): IMenuSelecif (id === SetTextSelectionsOperation.id || id === SetInlineFormatFontSizeCommand.id) {const textRun = getFontStyleAtCursor(accessor);-if (textRun == null) {subscriber.next(DEFAULT_SIZE);return;}const fs = textRun.ts?.fs;-subscriber.next(fs ?? DEFAULT_SIZE);}});diff --git a/packages/docs-ui/src/services/clipboard/html-to-udm/converter.ts b/packages/docs-ui/src/services/clipboard/html-to-udm/converter.tsindex 63a9c4669b..43dd3dbc29 100644--- a/packages/docs-ui/src/services/clipboard/html-to-udm/converter.ts+++ b/packages/docs-ui/src/services/clipboard/html-to-udm/converter.ts@@ -250,7 +250,7 @@ export class HtmlToUDMService {body.tables.push({startIndex,- endIndex: body.dataStream.length - 1,+ endIndex: body.dataStream.length,tableId: table.tableId,});