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: add rect ranges to share cursor (#2942)
Ran Luo1d5d42face54
diff --git a/packages/docs/src/services/text-selection-manager.service.ts b/packages/docs/src/services/text-selection-manager.service.tsindex 29bf68b9c4..b51bc08710 100644--- a/packages/docs/src/services/text-selection-manager.service.ts+++ b/packages/docs/src/services/text-selection-manager.service.ts@@ -256,7 +256,20 @@ export class TextSelectionManagerService extends RxDisposable {// Broadcast textSelection changes, this should be used within the application.this._textSelection$.next(params);- const { unitId, subUnitId, segmentId, style, textRanges, isEditing } = params;+ const { unitId, subUnitId, segmentId, style, textRanges, rectRanges, isEditing } = params;++ const ranges = [...textRanges, ...rectRanges]+ .filter((range) => range.startOffset != null && range.endOffset != null)+ .sort((a, b) => {+ if (a.startOffset! > b.startOffset!) {+ return 1;+ } else if (a.startOffset! < b.startOffset!) {+ return -1;+ } else {+ return 0;+ }+ })+ .map(serializeDocRange);// For menu status.this._commandService.executeCommand(SetTextSelectionsOperation.id, {@@ -265,7 +278,7 @@ export class TextSelectionManagerService extends RxDisposable {segmentId,style,isEditing,- ranges: textRanges.map(serializeDocRange),+ ranges,});}