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: export is active for share cursor use (#1420)
Ran Luoba5197191cb8
diff --git a/packages/core/src/types/interfaces/i-selection-data.ts b/packages/core/src/types/interfaces/i-selection-data.tsindex fcfed6f468..524a0fcad8 100644--- a/packages/core/src/types/interfaces/i-selection-data.ts+++ b/packages/core/src/types/interfaces/i-selection-data.ts@@ -63,4 +63,5 @@ export interface ITextRange extends ITextRangeStart {export interface ITextRangeParam extends ITextRange {segmentId?: string; //The ID of the header, footer or footnote the location is in. An empty segment ID signifies the document's body.+ isActive?: boolean; // Whether the text range is active or current range.}diff --git a/packages/docs/src/commands/operations/text-selection.operation.ts b/packages/docs/src/commands/operations/text-selection.operation.tsindex 148d992cfc..9b51e63459 100644--- a/packages/docs/src/commands/operations/text-selection.operation.ts+++ b/packages/docs/src/commands/operations/text-selection.operation.ts@@ -16,14 +16,14 @@import type { IOperation } from '@univerjs/core';import { CommandType } from '@univerjs/core';-import type { ITextSelectionStyle, TextRange } from '@univerjs/engine-render';+import type { ITextRangeWithStyle, ITextSelectionStyle } from '@univerjs/engine-render';export interface ISetTextSelectionsOperationParams {unitId: string;subUnitId: string;segmentId: string;style: ITextSelectionStyle;- ranges: TextRange[];+ ranges: ITextRangeWithStyle[];}export const SetTextSelectionsOperation: IOperation<ISetTextSelectionsOperationParams> = {@@ -32,7 +32,7 @@ export const SetTextSelectionsOperation: IOperation<ISetTextSelectionsOperationPtype: CommandType.OPERATION,handler: (accessor, prams) => {- // for live share only.+ // for live share and share cursor.return true;},};diff --git a/packages/docs/src/services/text-selection-manager.service.ts b/packages/docs/src/services/text-selection-manager.service.tsindex d4958c8da3..a852a63ef3 100644--- a/packages/docs/src/services/text-selection-manager.service.ts+++ b/packages/docs/src/services/text-selection-manager.service.ts@@ -53,11 +53,17 @@ type ITextSelectionInfo = Map<string, Map<string, ITextSelectionInnerParam>>;export function serializeTextRange(textRange: TextRange): ITextRangeWithStyle {const { startOffset, endOffset, collapsed } = textRange;- return {+ const serializedTextRange: ITextRangeWithStyle = {startOffset: startOffset!,endOffset: endOffset!,collapsed,};++ if (typeof textRange.isActive === 'function') {+ serializedTextRange.isActive = textRange.isActive();+ }++ return serializedTextRange;}/**