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(docs-ui): set table cell style (#3937)
Ran Luo4e5323b37db4
diff --git a/packages/docs-ui/src/commands/commands/inline-format.command.ts b/packages/docs-ui/src/commands/commands/inline-format.command.tsindex 27ef51ea52..a2dfd23848 100644--- a/packages/docs-ui/src/commands/commands/inline-format.command.ts+++ b/packages/docs-ui/src/commands/commands/inline-format.command.ts@@ -22,6 +22,7 @@ import type { IRichTextEditingMutationParams } from '@univerjs/docs';import type { ITextRangeWithStyle } from '@univerjs/engine-render';import {BaselineOffset, BooleanNumber, CommandType,+ DOC_RANGE_TYPE,ICommandService, IUniverInstanceService,JSONX, MemoryCursor,TextX, TextXActionType,@@ -244,7 +245,7 @@ export const SetInlineFormatCommand: ICommand<ISetInlineFormatCommandParams> = {return false;}- const segmentId = docRanges[0].segmentId;+ const { segmentId } = docRanges[0];const docDataModel = univerInstanceService.getCurrentUnitForType<DocumentDataModel>(UniverInstanceType.UNIVER_DOC);if (docDataModel == null) {@@ -313,12 +314,17 @@ export const SetInlineFormatCommand: ICommand<ISetInlineFormatCommandParams> = {memoryCursor.reset();for (const range of docRanges) {- const { startOffset, endOffset } = range;+ let { startOffset, endOffset, rangeType } = range;if (startOffset == null || endOffset == null) {continue;}+ // Use to fix https://github.com/dream-num/univer-pro/issues/3101+ if (rangeType === DOC_RANGE_TYPE.RECT) {+ startOffset = startOffset - 1;+ }+if (startOffset === endOffset) {// Cache the menu style for next input.docMenuStyleService.setStyleCache(