@univerjs/docs 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +10 -10
- package/lib/cjs/index.js +62 -39
- package/lib/es/facade.js +6 -6
- package/lib/es/index.js +56 -33
- package/lib/facade.js +6 -6
- package/lib/index.js +56 -33
- package/lib/types/services/doc-skeleton-manager.service.d.ts +3 -2
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +2 -2
- package/package.json +7 -7
package/lib/es/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlignTypeH, BooleanNumber, BuildTextUtils, ColumnSeparatorType, CommandType, CustomCommandExecutionError, CustomRangeType, DEFAULT_STYLES, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DataStreamTreeTokenType, DeleteDirection, DependentOn, Disposable, DisposableCollection, DocumentDataModel, DocumentFlavor, DocxBreakType, DrawingTypeEnum, ErrorService, ICommandService, IConfigService, ILogService, IPermissionService, IResourceManagerService, IUndoRedoService, IUniverInstanceService, Inject, Injector, JSON1, JSONX, LocaleService, MemoryCursor, ObjectPermissionRuleModel, ObjectPermissionService, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PAGE_SIZE, PageOrientType, PaperType, PermissionStatus, Plugin, PositionedObjectLayoutType, RESTORE_INSERTED_PARAGRAPH_IDS, RedoCommandId, RxDisposable, SectionType, TRADITIONAL_DOCUMENT_DEFAULT_MARGIN, TextX, TextXActionType, Tools, UndoCommandId, UniverInstanceType, UpdateDocsAttributeType, composeInterceptors, containsInteriorInsertionOffset, createIdentifier, createInterceptorKey, createParagraphId, createSectionId, generateRandomId, getBlockRangeInterval, getColumnGroupRangeInterval, getParagraphContentStartOffset, getParagraphContentStartOffsets, getRichTextEditPath, getSdtBindingKey, getSdtBindingValue, getSectionHeaderFooterReferenceKey, getTableRangeInterval, isInternalEditorID, merge, remove, requestImmediateMacroTask, resolveSectionHeaderFooterReference, toDisposable, validateDocBodyStructure, validateDocumentStructure } from "@univerjs/core";
|
|
1
|
+
import { AlignTypeH, BooleanNumber, BuildTextUtils, ColumnSeparatorType, CommandType, CustomCommandExecutionError, CustomRangeType, DEFAULT_STYLES, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DataStreamTreeTokenType, DeleteDirection, DependentOn, Disposable, DisposableCollection, DocumentDataModel, DocumentFlavor, DocxBreakType, DrawingTypeEnum, ErrorService, ICommandService, IConfigService, ILogService, IPermissionService, IResourceManagerService, IUndoRedoService, IUniverInstanceService, Inject, Injector, JSON1, JSONX, LocaleService, MODERN_DOCUMENT_DEFAULT_MARGIN, MODERN_DOCUMENT_WIDTH, MemoryCursor, ModernDocumentWidthMode, ObjectPermissionRuleModel, ObjectPermissionService, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PAGE_SIZE, PageOrientType, PaperType, PermissionStatus, Plugin, PositionedObjectLayoutType, RESTORE_INSERTED_PARAGRAPH_IDS, RedoCommandId, RxDisposable, SHEET_TEXT_LINE_GAP, SectionType, TRADITIONAL_DOCUMENT_DEFAULT_MARGIN, TextX, TextXActionType, Tools, UndoCommandId, UniverInstanceType, UpdateDocsAttributeType, composeInterceptors, containsInteriorInsertionOffset, createIdentifier, createInterceptorKey, createParagraphId, createSectionId, generateRandomId, getBlockRangeInterval, getColumnGroupRangeInterval, getParagraphContentStartOffset, getParagraphContentStartOffsets, getRichTextEditPath, getSdtBindingKey, getSdtBindingValue, getSectionHeaderFooterReferenceKey, getTableRangeInterval, isInternalEditorID, merge, remove, requestImmediateMacroTask, resolveSectionHeaderFooterReference, toDisposable, validateDocBodyStructure, validateDocumentStructure } from "@univerjs/core";
|
|
2
2
|
import { DocumentLayoutSession, DocumentSkeleton, DocumentViewModel, FontCache, IRenderManagerService, NORMAL_TEXT_SELECTION_PLUGIN_STYLE, getDocsCustomBlockRenderViewport, getDocumentLayoutPresentation, getFontStyleString, setDocsCustomBlockRenderViewportProvider } from "@univerjs/engine-render";
|
|
3
3
|
import { BehaviorSubject, Observable, Subject, shareReplay, takeUntil } from "rxjs";
|
|
4
4
|
import { UnitAction, UnitObject } from "@univerjs/protocol";
|
|
@@ -14,7 +14,7 @@ const SetTextSelectionsOperation = {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
//#endregion
|
|
17
|
-
//#region \0@oxc-project+runtime@0.
|
|
17
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
|
|
18
18
|
function _typeof(o) {
|
|
19
19
|
"@babel/helpers - typeof";
|
|
20
20
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -25,7 +25,7 @@ function _typeof(o) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
//#endregion
|
|
28
|
-
//#region \0@oxc-project+runtime@0.
|
|
28
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
|
|
29
29
|
function toPrimitive(t, r) {
|
|
30
30
|
if ("object" != _typeof(t) || !t) return t;
|
|
31
31
|
var e = t[Symbol.toPrimitive];
|
|
@@ -38,14 +38,14 @@ function toPrimitive(t, r) {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
//#endregion
|
|
41
|
-
//#region \0@oxc-project+runtime@0.
|
|
41
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
|
|
42
42
|
function toPropertyKey(t) {
|
|
43
43
|
var i = toPrimitive(t, "string");
|
|
44
44
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
//#endregion
|
|
48
|
-
//#region \0@oxc-project+runtime@0.
|
|
48
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
|
|
49
49
|
function _defineProperty(e, r, t) {
|
|
50
50
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
51
51
|
value: t,
|
|
@@ -56,7 +56,7 @@ function _defineProperty(e, r, t) {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
//#endregion
|
|
59
|
-
//#region \0@oxc-project+runtime@0.
|
|
59
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
|
|
60
60
|
function __decorateParam(paramIndex, decorator) {
|
|
61
61
|
return function(target, key) {
|
|
62
62
|
decorator(target, key, paramIndex);
|
|
@@ -64,7 +64,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
//#endregion
|
|
67
|
-
//#region \0@oxc-project+runtime@0.
|
|
67
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
68
68
|
function __decorate(decorators, target, key, desc) {
|
|
69
69
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
70
70
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -159,7 +159,10 @@ let DocSelectionManagerService = class DocSelectionManagerService extends RxDisp
|
|
|
159
159
|
subUnitId,
|
|
160
160
|
docRanges,
|
|
161
161
|
isEditing,
|
|
162
|
-
options
|
|
162
|
+
options: {
|
|
163
|
+
...options,
|
|
164
|
+
preserveInputStyle: false
|
|
165
|
+
}
|
|
163
166
|
});
|
|
164
167
|
}
|
|
165
168
|
/**
|
|
@@ -179,7 +182,13 @@ let DocSelectionManagerService = class DocSelectionManagerService extends RxDisp
|
|
|
179
182
|
...textSelectionInfo,
|
|
180
183
|
...search
|
|
181
184
|
};
|
|
182
|
-
this._replaceByParam(
|
|
185
|
+
this._replaceByParam({
|
|
186
|
+
...params,
|
|
187
|
+
options: {
|
|
188
|
+
...params.options,
|
|
189
|
+
preserveInputStyle: true
|
|
190
|
+
}
|
|
191
|
+
});
|
|
183
192
|
this._textSelection$.next(params);
|
|
184
193
|
const { unitId, subUnitId, segmentId, style, textRanges, rectRanges, isEditing } = params;
|
|
185
194
|
const ranges = [...textRanges, ...rectRanges].filter((range) => range.startOffset != null && range.endOffset != null).sort((a, b) => {
|
|
@@ -220,10 +229,11 @@ let DocSelectionManagerService = class DocSelectionManagerService extends RxDisp
|
|
|
220
229
|
subUnitId,
|
|
221
230
|
docRanges,
|
|
222
231
|
isEditing,
|
|
223
|
-
options:
|
|
232
|
+
options: {
|
|
224
233
|
...options,
|
|
225
|
-
forceFocus: false
|
|
226
|
-
|
|
234
|
+
forceFocus: false,
|
|
235
|
+
preserveInputStyle: (options === null || options === void 0 ? void 0 : options.preserveInputStyle) ?? true
|
|
236
|
+
}
|
|
227
237
|
});
|
|
228
238
|
}
|
|
229
239
|
_replaceByParam(insertParam) {
|
|
@@ -373,9 +383,15 @@ function createCustomRangePresentationPatch(previous, current) {
|
|
|
373
383
|
function isRichTextEditingMutationParams(value) {
|
|
374
384
|
return typeof value === "object" && value != null && "unitId" in value && typeof value.unitId === "string" && "actions" in value;
|
|
375
385
|
}
|
|
376
|
-
function collectCustomBlockViewports(dataModel) {
|
|
386
|
+
function collectCustomBlockViewports(dataModel, options) {
|
|
387
|
+
var _documentStyle$pageSi, _documentStyle$pageSi2;
|
|
377
388
|
const snapshot = dataModel.getSnapshot();
|
|
378
389
|
const documentStyle = snapshot.documentStyle;
|
|
390
|
+
const isModern = documentStyle.documentFlavor === DocumentFlavor.MODERN;
|
|
391
|
+
const modernMargin = options.modernHorizontalMargin ?? MODERN_DOCUMENT_DEFAULT_MARGIN;
|
|
392
|
+
const pageMarginLeft = isModern ? modernMargin : documentStyle.marginLeft;
|
|
393
|
+
const pageMarginRight = isModern ? modernMargin : documentStyle.marginRight;
|
|
394
|
+
const pageWidth = isModern ? options.modernPageWidth ?? ((_documentStyle$pageSi = documentStyle.pageSize) === null || _documentStyle$pageSi === void 0 ? void 0 : _documentStyle$pageSi.width) ?? MODERN_DOCUMENT_WIDTH[ModernDocumentWidthMode.MEDIUM] : (_documentStyle$pageSi2 = documentStyle.pageSize) === null || _documentStyle$pageSi2 === void 0 ? void 0 : _documentStyle$pageSi2.width;
|
|
379
395
|
const viewports = {};
|
|
380
396
|
const bodies = [
|
|
381
397
|
snapshot.body,
|
|
@@ -383,15 +399,15 @@ function collectCustomBlockViewports(dataModel) {
|
|
|
383
399
|
...Object.values(snapshot.footers ?? {}).map((footer) => footer.body)
|
|
384
400
|
];
|
|
385
401
|
for (const customBlock of bodies.flatMap((body) => (body === null || body === void 0 ? void 0 : body.customBlocks) ?? [])) {
|
|
386
|
-
var _snapshot$drawings
|
|
402
|
+
var _snapshot$drawings;
|
|
387
403
|
const drawing = (_snapshot$drawings = snapshot.drawings) === null || _snapshot$drawings === void 0 ? void 0 : _snapshot$drawings[customBlock.blockId];
|
|
388
404
|
if (drawing == null) continue;
|
|
389
405
|
const viewport = getDocsCustomBlockRenderViewport(dataModel.getUnitId(), customBlock.blockId, {
|
|
390
406
|
fallbackHeight: drawing.docTransform.size.height ?? 0,
|
|
391
407
|
fallbackWidth: drawing.docTransform.size.width ?? 0,
|
|
392
|
-
pageMarginLeft
|
|
393
|
-
pageMarginRight
|
|
394
|
-
pageWidth
|
|
408
|
+
pageMarginLeft,
|
|
409
|
+
pageMarginRight,
|
|
410
|
+
pageWidth
|
|
395
411
|
});
|
|
396
412
|
if (viewport != null) viewports[customBlock.blockId] = { ...viewport };
|
|
397
413
|
}
|
|
@@ -677,7 +693,7 @@ let DocLayoutExecutorService = _DocLayoutExecutorService = class DocLayoutExecut
|
|
|
677
693
|
}
|
|
678
694
|
if (session.latestStarts.get(mountId) !== startIdentity) return { status: "superseded" };
|
|
679
695
|
const mutations = session.pendingMutations.slice();
|
|
680
|
-
const projections = this._createLayoutProjectionPayload(session, identity, this._getRequiredModel(unitId));
|
|
696
|
+
const projections = this._createLayoutProjectionPayload(session, identity, this._getRequiredModel(unitId), options);
|
|
681
697
|
const request = {
|
|
682
698
|
...identity,
|
|
683
699
|
metricsRevision: startId,
|
|
@@ -707,8 +723,8 @@ let DocLayoutExecutorService = _DocLayoutExecutorService = class DocLayoutExecut
|
|
|
707
723
|
});
|
|
708
724
|
return startTask;
|
|
709
725
|
}
|
|
710
|
-
_createLayoutProjectionPayload(session, identity, dataModel) {
|
|
711
|
-
const customBlockViewports = collectCustomBlockViewports(dataModel);
|
|
726
|
+
_createLayoutProjectionPayload(session, identity, dataModel, options) {
|
|
727
|
+
const customBlockViewports = collectCustomBlockViewports(dataModel, options);
|
|
712
728
|
const previousCustomBlockViewports = session.customBlockViewportsByMount.get(identity.mountId);
|
|
713
729
|
const customRangePresentations = this._collectCustomRangePresentations(dataModel);
|
|
714
730
|
const customRangePresentationMap = toCustomRangePresentationMap(customRangePresentations);
|
|
@@ -893,12 +909,13 @@ DocLayoutExecutorService = _DocLayoutExecutorService = __decorate([
|
|
|
893
909
|
//#endregion
|
|
894
910
|
//#region src/services/doc-skeleton-manager.service.ts
|
|
895
911
|
let DocSkeletonManagerService = class DocSkeletonManagerService extends RxDisposable {
|
|
896
|
-
constructor(_context, _localeService, _univerInstanceService, _docLayoutExecutorService) {
|
|
912
|
+
constructor(_context, _localeService, _univerInstanceService, _docLayoutExecutorService, _configService) {
|
|
897
913
|
super();
|
|
898
914
|
this._context = _context;
|
|
899
915
|
this._localeService = _localeService;
|
|
900
916
|
this._univerInstanceService = _univerInstanceService;
|
|
901
917
|
this._docLayoutExecutorService = _docLayoutExecutorService;
|
|
918
|
+
this._configService = _configService;
|
|
902
919
|
_defineProperty(this, "_skeleton", void 0);
|
|
903
920
|
_defineProperty(this, "_docViewModel", void 0);
|
|
904
921
|
_defineProperty(this, "_currentSkeleton$", new BehaviorSubject(null));
|
|
@@ -958,7 +975,8 @@ let DocSkeletonManagerService = class DocSkeletonManagerService extends RxDispos
|
|
|
958
975
|
this._currentViewModel$.next(this._docViewModel);
|
|
959
976
|
}
|
|
960
977
|
_buildSkeleton(documentViewModel) {
|
|
961
|
-
|
|
978
|
+
const isSheetEditor = this._context.unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY || this._context.unitId === DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY;
|
|
979
|
+
return DocumentSkeleton.create(documentViewModel, this._localeService, { lineGap: isSheetEditor ? this._configService.getConfig(SHEET_TEXT_LINE_GAP) : void 0 });
|
|
962
980
|
}
|
|
963
981
|
_buildDocViewModel(documentDataModel) {
|
|
964
982
|
return new DocumentViewModel(documentDataModel);
|
|
@@ -967,7 +985,8 @@ let DocSkeletonManagerService = class DocSkeletonManagerService extends RxDispos
|
|
|
967
985
|
DocSkeletonManagerService = __decorate([
|
|
968
986
|
__decorateParam(1, Inject(LocaleService)),
|
|
969
987
|
__decorateParam(2, IUniverInstanceService),
|
|
970
|
-
__decorateParam(3, Inject(DocLayoutExecutorService))
|
|
988
|
+
__decorateParam(3, Inject(DocLayoutExecutorService)),
|
|
989
|
+
__decorateParam(4, IConfigService)
|
|
971
990
|
], DocSkeletonManagerService);
|
|
972
991
|
|
|
973
992
|
//#endregion
|
|
@@ -1366,13 +1385,15 @@ function scheduleDocumentSelectionUpdate(selectionManager, params, isSync) {
|
|
|
1366
1385
|
textRanges: logicalTextRanges,
|
|
1367
1386
|
rectRanges: [],
|
|
1368
1387
|
isEditing,
|
|
1369
|
-
options:
|
|
1388
|
+
options: {
|
|
1389
|
+
...params.options,
|
|
1390
|
+
preserveInputStyle: false
|
|
1391
|
+
}
|
|
1370
1392
|
}, selectionTarget);
|
|
1371
1393
|
const updatedSelection = selectionManager.getSelectionInfo(selectionTarget);
|
|
1372
1394
|
queueMicrotask(() => {
|
|
1373
1395
|
if (selectionManager.getSelectionInfo(selectionTarget) !== updatedSelection) return;
|
|
1374
|
-
|
|
1375
|
-
else selectionManager.refreshSelection(selectionTarget, isEditing);
|
|
1396
|
+
selectionManager.replaceDocRanges(logicalTextRanges, selectionTarget, isEditing, params.options);
|
|
1376
1397
|
});
|
|
1377
1398
|
}
|
|
1378
1399
|
/**
|
|
@@ -2780,7 +2801,7 @@ function composeActions(actions) {
|
|
|
2780
2801
|
//#endregion
|
|
2781
2802
|
//#region package.json
|
|
2782
2803
|
var name = "@univerjs/docs";
|
|
2783
|
-
var version = "1.0
|
|
2804
|
+
var version = "1.1.0";
|
|
2784
2805
|
|
|
2785
2806
|
//#endregion
|
|
2786
2807
|
//#region src/config/config.ts
|
|
@@ -2813,11 +2834,12 @@ let DocCustomRangeController = class DocCustomRangeController extends Disposable
|
|
|
2813
2834
|
this._univerInstanceService = _univerInstanceService;
|
|
2814
2835
|
this._initSelectionChange();
|
|
2815
2836
|
}
|
|
2816
|
-
_transformCustomRange(doc, selection) {
|
|
2817
|
-
var _doc$
|
|
2837
|
+
_transformCustomRange(doc, selection, segmentId) {
|
|
2838
|
+
var _doc$getSelfOrHeaderF;
|
|
2818
2839
|
const { startOffset, endOffset, collapsed } = selection;
|
|
2819
|
-
const customRanges = (_doc$
|
|
2820
|
-
|
|
2840
|
+
const customRanges = (_doc$getSelfOrHeaderF = doc.getSelfOrHeaderFooterModel(selection.segmentId ?? segmentId)) === null || _doc$getSelfOrHeaderF === void 0 || (_doc$getSelfOrHeaderF = _doc$getSelfOrHeaderF.getBody()) === null || _doc$getSelfOrHeaderF === void 0 || (_doc$getSelfOrHeaderF = _doc$getSelfOrHeaderF.customRanges) === null || _doc$getSelfOrHeaderF === void 0 ? void 0 : _doc$getSelfOrHeaderF.filter((range) => {
|
|
2841
|
+
const selectsFieldResult = range.rangeType === CustomRangeType.FIELD && !collapsed && startOffset <= range.startIndex + 1 && endOffset >= range.endIndex;
|
|
2842
|
+
if (!range.wholeEntity && !selectsFieldResult) return false;
|
|
2821
2843
|
if (startOffset <= range.startIndex && endOffset > range.endIndex) return false;
|
|
2822
2844
|
if (collapsed) return range.startIndex < startOffset && range.endIndex >= endOffset;
|
|
2823
2845
|
return BuildTextUtils.range.isIntersects(startOffset, endOffset - 1, range.startIndex, range.endIndex);
|
|
@@ -2841,10 +2863,11 @@ let DocCustomRangeController = class DocCustomRangeController extends Disposable
|
|
|
2841
2863
|
_initSelectionChange() {
|
|
2842
2864
|
this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
|
|
2843
2865
|
if (commandInfo.id === SetTextSelectionsOperation.id) {
|
|
2844
|
-
const
|
|
2866
|
+
const params = commandInfo.params;
|
|
2867
|
+
const { unitId, ranges, isEditing } = params;
|
|
2845
2868
|
const doc = this._univerInstanceService.getUnit(unitId);
|
|
2846
2869
|
if (!doc) return;
|
|
2847
|
-
const transformedRanges = ranges.map((range) => this._transformCustomRange(doc, range));
|
|
2870
|
+
const transformedRanges = ranges.map((range) => this._transformCustomRange(doc, range, params.segmentId));
|
|
2848
2871
|
if (transformedRanges.some((range, i) => ranges[i] !== range)) this._textSelectionManagerService.replaceDocRanges(transformedRanges, void 0, isEditing);
|
|
2849
2872
|
}
|
|
2850
2873
|
}));
|
package/lib/facade.js
CHANGED
|
@@ -303,7 +303,7 @@ function stripBlockTokens(text) {
|
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
//#endregion
|
|
306
|
-
//#region \0@oxc-project+runtime@0.
|
|
306
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
|
|
307
307
|
function __decorateParam(paramIndex, decorator) {
|
|
308
308
|
return function(target, key) {
|
|
309
309
|
decorator(target, key, paramIndex);
|
|
@@ -311,7 +311,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
//#endregion
|
|
314
|
-
//#region \0@oxc-project+runtime@0.
|
|
314
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
315
315
|
function __decorate(decorators, target, key, desc) {
|
|
316
316
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
317
317
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1453,7 +1453,7 @@ let FDocumentSection = class FDocumentSection {
|
|
|
1453
1453
|
FDocumentSection = __decorate([__decorateParam(2, ICommandService), __decorateParam(3, IPermissionService)], FDocumentSection);
|
|
1454
1454
|
|
|
1455
1455
|
//#endregion
|
|
1456
|
-
//#region \0@oxc-project+runtime@0.
|
|
1456
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
|
|
1457
1457
|
function _typeof(o) {
|
|
1458
1458
|
"@babel/helpers - typeof";
|
|
1459
1459
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -1464,7 +1464,7 @@ function _typeof(o) {
|
|
|
1464
1464
|
}
|
|
1465
1465
|
|
|
1466
1466
|
//#endregion
|
|
1467
|
-
//#region \0@oxc-project+runtime@0.
|
|
1467
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
|
|
1468
1468
|
function toPrimitive(t, r) {
|
|
1469
1469
|
if ("object" != _typeof(t) || !t) return t;
|
|
1470
1470
|
var e = t[Symbol.toPrimitive];
|
|
@@ -1477,14 +1477,14 @@ function toPrimitive(t, r) {
|
|
|
1477
1477
|
}
|
|
1478
1478
|
|
|
1479
1479
|
//#endregion
|
|
1480
|
-
//#region \0@oxc-project+runtime@0.
|
|
1480
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
|
|
1481
1481
|
function toPropertyKey(t) {
|
|
1482
1482
|
var i = toPrimitive(t, "string");
|
|
1483
1483
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
1484
1484
|
}
|
|
1485
1485
|
|
|
1486
1486
|
//#endregion
|
|
1487
|
-
//#region \0@oxc-project+runtime@0.
|
|
1487
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
|
|
1488
1488
|
function _defineProperty(e, r, t) {
|
|
1489
1489
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
1490
1490
|
value: t,
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlignTypeH, BooleanNumber, BuildTextUtils, ColumnSeparatorType, CommandType, CustomCommandExecutionError, CustomRangeType, DEFAULT_STYLES, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DataStreamTreeTokenType, DeleteDirection, DependentOn, Disposable, DisposableCollection, DocumentDataModel, DocumentFlavor, DocxBreakType, DrawingTypeEnum, ErrorService, ICommandService, IConfigService, ILogService, IPermissionService, IResourceManagerService, IUndoRedoService, IUniverInstanceService, Inject, Injector, JSON1, JSONX, LocaleService, MemoryCursor, ObjectPermissionRuleModel, ObjectPermissionService, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PAGE_SIZE, PageOrientType, PaperType, PermissionStatus, Plugin, PositionedObjectLayoutType, RESTORE_INSERTED_PARAGRAPH_IDS, RedoCommandId, RxDisposable, SectionType, TRADITIONAL_DOCUMENT_DEFAULT_MARGIN, TextX, TextXActionType, Tools, UndoCommandId, UniverInstanceType, UpdateDocsAttributeType, composeInterceptors, containsInteriorInsertionOffset, createIdentifier, createInterceptorKey, createParagraphId, createSectionId, generateRandomId, getBlockRangeInterval, getColumnGroupRangeInterval, getParagraphContentStartOffset, getParagraphContentStartOffsets, getRichTextEditPath, getSdtBindingKey, getSdtBindingValue, getSectionHeaderFooterReferenceKey, getTableRangeInterval, isInternalEditorID, merge, remove, requestImmediateMacroTask, resolveSectionHeaderFooterReference, toDisposable, validateDocBodyStructure, validateDocumentStructure } from "@univerjs/core";
|
|
1
|
+
import { AlignTypeH, BooleanNumber, BuildTextUtils, ColumnSeparatorType, CommandType, CustomCommandExecutionError, CustomRangeType, DEFAULT_STYLES, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DataStreamTreeTokenType, DeleteDirection, DependentOn, Disposable, DisposableCollection, DocumentDataModel, DocumentFlavor, DocxBreakType, DrawingTypeEnum, ErrorService, ICommandService, IConfigService, ILogService, IPermissionService, IResourceManagerService, IUndoRedoService, IUniverInstanceService, Inject, Injector, JSON1, JSONX, LocaleService, MODERN_DOCUMENT_DEFAULT_MARGIN, MODERN_DOCUMENT_WIDTH, MemoryCursor, ModernDocumentWidthMode, ObjectPermissionRuleModel, ObjectPermissionService, ObjectRelativeFromH, ObjectRelativeFromV, Optional, PAGE_SIZE, PageOrientType, PaperType, PermissionStatus, Plugin, PositionedObjectLayoutType, RESTORE_INSERTED_PARAGRAPH_IDS, RedoCommandId, RxDisposable, SHEET_TEXT_LINE_GAP, SectionType, TRADITIONAL_DOCUMENT_DEFAULT_MARGIN, TextX, TextXActionType, Tools, UndoCommandId, UniverInstanceType, UpdateDocsAttributeType, composeInterceptors, containsInteriorInsertionOffset, createIdentifier, createInterceptorKey, createParagraphId, createSectionId, generateRandomId, getBlockRangeInterval, getColumnGroupRangeInterval, getParagraphContentStartOffset, getParagraphContentStartOffsets, getRichTextEditPath, getSdtBindingKey, getSdtBindingValue, getSectionHeaderFooterReferenceKey, getTableRangeInterval, isInternalEditorID, merge, remove, requestImmediateMacroTask, resolveSectionHeaderFooterReference, toDisposable, validateDocBodyStructure, validateDocumentStructure } from "@univerjs/core";
|
|
2
2
|
import { DocumentLayoutSession, DocumentSkeleton, DocumentViewModel, FontCache, IRenderManagerService, NORMAL_TEXT_SELECTION_PLUGIN_STYLE, getDocsCustomBlockRenderViewport, getDocumentLayoutPresentation, getFontStyleString, setDocsCustomBlockRenderViewportProvider } from "@univerjs/engine-render";
|
|
3
3
|
import { BehaviorSubject, Observable, Subject, shareReplay, takeUntil } from "rxjs";
|
|
4
4
|
import { UnitAction, UnitObject } from "@univerjs/protocol";
|
|
@@ -14,7 +14,7 @@ const SetTextSelectionsOperation = {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
//#endregion
|
|
17
|
-
//#region \0@oxc-project+runtime@0.
|
|
17
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
|
|
18
18
|
function _typeof(o) {
|
|
19
19
|
"@babel/helpers - typeof";
|
|
20
20
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -25,7 +25,7 @@ function _typeof(o) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
//#endregion
|
|
28
|
-
//#region \0@oxc-project+runtime@0.
|
|
28
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
|
|
29
29
|
function toPrimitive(t, r) {
|
|
30
30
|
if ("object" != _typeof(t) || !t) return t;
|
|
31
31
|
var e = t[Symbol.toPrimitive];
|
|
@@ -38,14 +38,14 @@ function toPrimitive(t, r) {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
//#endregion
|
|
41
|
-
//#region \0@oxc-project+runtime@0.
|
|
41
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
|
|
42
42
|
function toPropertyKey(t) {
|
|
43
43
|
var i = toPrimitive(t, "string");
|
|
44
44
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
//#endregion
|
|
48
|
-
//#region \0@oxc-project+runtime@0.
|
|
48
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
|
|
49
49
|
function _defineProperty(e, r, t) {
|
|
50
50
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
51
51
|
value: t,
|
|
@@ -56,7 +56,7 @@ function _defineProperty(e, r, t) {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
//#endregion
|
|
59
|
-
//#region \0@oxc-project+runtime@0.
|
|
59
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
|
|
60
60
|
function __decorateParam(paramIndex, decorator) {
|
|
61
61
|
return function(target, key) {
|
|
62
62
|
decorator(target, key, paramIndex);
|
|
@@ -64,7 +64,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
//#endregion
|
|
67
|
-
//#region \0@oxc-project+runtime@0.
|
|
67
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
68
68
|
function __decorate(decorators, target, key, desc) {
|
|
69
69
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
70
70
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -159,7 +159,10 @@ let DocSelectionManagerService = class DocSelectionManagerService extends RxDisp
|
|
|
159
159
|
subUnitId,
|
|
160
160
|
docRanges,
|
|
161
161
|
isEditing,
|
|
162
|
-
options
|
|
162
|
+
options: {
|
|
163
|
+
...options,
|
|
164
|
+
preserveInputStyle: false
|
|
165
|
+
}
|
|
163
166
|
});
|
|
164
167
|
}
|
|
165
168
|
/**
|
|
@@ -179,7 +182,13 @@ let DocSelectionManagerService = class DocSelectionManagerService extends RxDisp
|
|
|
179
182
|
...textSelectionInfo,
|
|
180
183
|
...search
|
|
181
184
|
};
|
|
182
|
-
this._replaceByParam(
|
|
185
|
+
this._replaceByParam({
|
|
186
|
+
...params,
|
|
187
|
+
options: {
|
|
188
|
+
...params.options,
|
|
189
|
+
preserveInputStyle: true
|
|
190
|
+
}
|
|
191
|
+
});
|
|
183
192
|
this._textSelection$.next(params);
|
|
184
193
|
const { unitId, subUnitId, segmentId, style, textRanges, rectRanges, isEditing } = params;
|
|
185
194
|
const ranges = [...textRanges, ...rectRanges].filter((range) => range.startOffset != null && range.endOffset != null).sort((a, b) => {
|
|
@@ -220,10 +229,11 @@ let DocSelectionManagerService = class DocSelectionManagerService extends RxDisp
|
|
|
220
229
|
subUnitId,
|
|
221
230
|
docRanges,
|
|
222
231
|
isEditing,
|
|
223
|
-
options:
|
|
232
|
+
options: {
|
|
224
233
|
...options,
|
|
225
|
-
forceFocus: false
|
|
226
|
-
|
|
234
|
+
forceFocus: false,
|
|
235
|
+
preserveInputStyle: (options === null || options === void 0 ? void 0 : options.preserveInputStyle) ?? true
|
|
236
|
+
}
|
|
227
237
|
});
|
|
228
238
|
}
|
|
229
239
|
_replaceByParam(insertParam) {
|
|
@@ -373,9 +383,15 @@ function createCustomRangePresentationPatch(previous, current) {
|
|
|
373
383
|
function isRichTextEditingMutationParams(value) {
|
|
374
384
|
return typeof value === "object" && value != null && "unitId" in value && typeof value.unitId === "string" && "actions" in value;
|
|
375
385
|
}
|
|
376
|
-
function collectCustomBlockViewports(dataModel) {
|
|
386
|
+
function collectCustomBlockViewports(dataModel, options) {
|
|
387
|
+
var _documentStyle$pageSi, _documentStyle$pageSi2;
|
|
377
388
|
const snapshot = dataModel.getSnapshot();
|
|
378
389
|
const documentStyle = snapshot.documentStyle;
|
|
390
|
+
const isModern = documentStyle.documentFlavor === DocumentFlavor.MODERN;
|
|
391
|
+
const modernMargin = options.modernHorizontalMargin ?? MODERN_DOCUMENT_DEFAULT_MARGIN;
|
|
392
|
+
const pageMarginLeft = isModern ? modernMargin : documentStyle.marginLeft;
|
|
393
|
+
const pageMarginRight = isModern ? modernMargin : documentStyle.marginRight;
|
|
394
|
+
const pageWidth = isModern ? options.modernPageWidth ?? ((_documentStyle$pageSi = documentStyle.pageSize) === null || _documentStyle$pageSi === void 0 ? void 0 : _documentStyle$pageSi.width) ?? MODERN_DOCUMENT_WIDTH[ModernDocumentWidthMode.MEDIUM] : (_documentStyle$pageSi2 = documentStyle.pageSize) === null || _documentStyle$pageSi2 === void 0 ? void 0 : _documentStyle$pageSi2.width;
|
|
379
395
|
const viewports = {};
|
|
380
396
|
const bodies = [
|
|
381
397
|
snapshot.body,
|
|
@@ -383,15 +399,15 @@ function collectCustomBlockViewports(dataModel) {
|
|
|
383
399
|
...Object.values(snapshot.footers ?? {}).map((footer) => footer.body)
|
|
384
400
|
];
|
|
385
401
|
for (const customBlock of bodies.flatMap((body) => (body === null || body === void 0 ? void 0 : body.customBlocks) ?? [])) {
|
|
386
|
-
var _snapshot$drawings
|
|
402
|
+
var _snapshot$drawings;
|
|
387
403
|
const drawing = (_snapshot$drawings = snapshot.drawings) === null || _snapshot$drawings === void 0 ? void 0 : _snapshot$drawings[customBlock.blockId];
|
|
388
404
|
if (drawing == null) continue;
|
|
389
405
|
const viewport = getDocsCustomBlockRenderViewport(dataModel.getUnitId(), customBlock.blockId, {
|
|
390
406
|
fallbackHeight: drawing.docTransform.size.height ?? 0,
|
|
391
407
|
fallbackWidth: drawing.docTransform.size.width ?? 0,
|
|
392
|
-
pageMarginLeft
|
|
393
|
-
pageMarginRight
|
|
394
|
-
pageWidth
|
|
408
|
+
pageMarginLeft,
|
|
409
|
+
pageMarginRight,
|
|
410
|
+
pageWidth
|
|
395
411
|
});
|
|
396
412
|
if (viewport != null) viewports[customBlock.blockId] = { ...viewport };
|
|
397
413
|
}
|
|
@@ -677,7 +693,7 @@ let DocLayoutExecutorService = _DocLayoutExecutorService = class DocLayoutExecut
|
|
|
677
693
|
}
|
|
678
694
|
if (session.latestStarts.get(mountId) !== startIdentity) return { status: "superseded" };
|
|
679
695
|
const mutations = session.pendingMutations.slice();
|
|
680
|
-
const projections = this._createLayoutProjectionPayload(session, identity, this._getRequiredModel(unitId));
|
|
696
|
+
const projections = this._createLayoutProjectionPayload(session, identity, this._getRequiredModel(unitId), options);
|
|
681
697
|
const request = {
|
|
682
698
|
...identity,
|
|
683
699
|
metricsRevision: startId,
|
|
@@ -707,8 +723,8 @@ let DocLayoutExecutorService = _DocLayoutExecutorService = class DocLayoutExecut
|
|
|
707
723
|
});
|
|
708
724
|
return startTask;
|
|
709
725
|
}
|
|
710
|
-
_createLayoutProjectionPayload(session, identity, dataModel) {
|
|
711
|
-
const customBlockViewports = collectCustomBlockViewports(dataModel);
|
|
726
|
+
_createLayoutProjectionPayload(session, identity, dataModel, options) {
|
|
727
|
+
const customBlockViewports = collectCustomBlockViewports(dataModel, options);
|
|
712
728
|
const previousCustomBlockViewports = session.customBlockViewportsByMount.get(identity.mountId);
|
|
713
729
|
const customRangePresentations = this._collectCustomRangePresentations(dataModel);
|
|
714
730
|
const customRangePresentationMap = toCustomRangePresentationMap(customRangePresentations);
|
|
@@ -893,12 +909,13 @@ DocLayoutExecutorService = _DocLayoutExecutorService = __decorate([
|
|
|
893
909
|
//#endregion
|
|
894
910
|
//#region src/services/doc-skeleton-manager.service.ts
|
|
895
911
|
let DocSkeletonManagerService = class DocSkeletonManagerService extends RxDisposable {
|
|
896
|
-
constructor(_context, _localeService, _univerInstanceService, _docLayoutExecutorService) {
|
|
912
|
+
constructor(_context, _localeService, _univerInstanceService, _docLayoutExecutorService, _configService) {
|
|
897
913
|
super();
|
|
898
914
|
this._context = _context;
|
|
899
915
|
this._localeService = _localeService;
|
|
900
916
|
this._univerInstanceService = _univerInstanceService;
|
|
901
917
|
this._docLayoutExecutorService = _docLayoutExecutorService;
|
|
918
|
+
this._configService = _configService;
|
|
902
919
|
_defineProperty(this, "_skeleton", void 0);
|
|
903
920
|
_defineProperty(this, "_docViewModel", void 0);
|
|
904
921
|
_defineProperty(this, "_currentSkeleton$", new BehaviorSubject(null));
|
|
@@ -958,7 +975,8 @@ let DocSkeletonManagerService = class DocSkeletonManagerService extends RxDispos
|
|
|
958
975
|
this._currentViewModel$.next(this._docViewModel);
|
|
959
976
|
}
|
|
960
977
|
_buildSkeleton(documentViewModel) {
|
|
961
|
-
|
|
978
|
+
const isSheetEditor = this._context.unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY || this._context.unitId === DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY;
|
|
979
|
+
return DocumentSkeleton.create(documentViewModel, this._localeService, { lineGap: isSheetEditor ? this._configService.getConfig(SHEET_TEXT_LINE_GAP) : void 0 });
|
|
962
980
|
}
|
|
963
981
|
_buildDocViewModel(documentDataModel) {
|
|
964
982
|
return new DocumentViewModel(documentDataModel);
|
|
@@ -967,7 +985,8 @@ let DocSkeletonManagerService = class DocSkeletonManagerService extends RxDispos
|
|
|
967
985
|
DocSkeletonManagerService = __decorate([
|
|
968
986
|
__decorateParam(1, Inject(LocaleService)),
|
|
969
987
|
__decorateParam(2, IUniverInstanceService),
|
|
970
|
-
__decorateParam(3, Inject(DocLayoutExecutorService))
|
|
988
|
+
__decorateParam(3, Inject(DocLayoutExecutorService)),
|
|
989
|
+
__decorateParam(4, IConfigService)
|
|
971
990
|
], DocSkeletonManagerService);
|
|
972
991
|
|
|
973
992
|
//#endregion
|
|
@@ -1366,13 +1385,15 @@ function scheduleDocumentSelectionUpdate(selectionManager, params, isSync) {
|
|
|
1366
1385
|
textRanges: logicalTextRanges,
|
|
1367
1386
|
rectRanges: [],
|
|
1368
1387
|
isEditing,
|
|
1369
|
-
options:
|
|
1388
|
+
options: {
|
|
1389
|
+
...params.options,
|
|
1390
|
+
preserveInputStyle: false
|
|
1391
|
+
}
|
|
1370
1392
|
}, selectionTarget);
|
|
1371
1393
|
const updatedSelection = selectionManager.getSelectionInfo(selectionTarget);
|
|
1372
1394
|
queueMicrotask(() => {
|
|
1373
1395
|
if (selectionManager.getSelectionInfo(selectionTarget) !== updatedSelection) return;
|
|
1374
|
-
|
|
1375
|
-
else selectionManager.refreshSelection(selectionTarget, isEditing);
|
|
1396
|
+
selectionManager.replaceDocRanges(logicalTextRanges, selectionTarget, isEditing, params.options);
|
|
1376
1397
|
});
|
|
1377
1398
|
}
|
|
1378
1399
|
/**
|
|
@@ -2780,7 +2801,7 @@ function composeActions(actions) {
|
|
|
2780
2801
|
//#endregion
|
|
2781
2802
|
//#region package.json
|
|
2782
2803
|
var name = "@univerjs/docs";
|
|
2783
|
-
var version = "1.0
|
|
2804
|
+
var version = "1.1.0";
|
|
2784
2805
|
|
|
2785
2806
|
//#endregion
|
|
2786
2807
|
//#region src/config/config.ts
|
|
@@ -2813,11 +2834,12 @@ let DocCustomRangeController = class DocCustomRangeController extends Disposable
|
|
|
2813
2834
|
this._univerInstanceService = _univerInstanceService;
|
|
2814
2835
|
this._initSelectionChange();
|
|
2815
2836
|
}
|
|
2816
|
-
_transformCustomRange(doc, selection) {
|
|
2817
|
-
var _doc$
|
|
2837
|
+
_transformCustomRange(doc, selection, segmentId) {
|
|
2838
|
+
var _doc$getSelfOrHeaderF;
|
|
2818
2839
|
const { startOffset, endOffset, collapsed } = selection;
|
|
2819
|
-
const customRanges = (_doc$
|
|
2820
|
-
|
|
2840
|
+
const customRanges = (_doc$getSelfOrHeaderF = doc.getSelfOrHeaderFooterModel(selection.segmentId ?? segmentId)) === null || _doc$getSelfOrHeaderF === void 0 || (_doc$getSelfOrHeaderF = _doc$getSelfOrHeaderF.getBody()) === null || _doc$getSelfOrHeaderF === void 0 || (_doc$getSelfOrHeaderF = _doc$getSelfOrHeaderF.customRanges) === null || _doc$getSelfOrHeaderF === void 0 ? void 0 : _doc$getSelfOrHeaderF.filter((range) => {
|
|
2841
|
+
const selectsFieldResult = range.rangeType === CustomRangeType.FIELD && !collapsed && startOffset <= range.startIndex + 1 && endOffset >= range.endIndex;
|
|
2842
|
+
if (!range.wholeEntity && !selectsFieldResult) return false;
|
|
2821
2843
|
if (startOffset <= range.startIndex && endOffset > range.endIndex) return false;
|
|
2822
2844
|
if (collapsed) return range.startIndex < startOffset && range.endIndex >= endOffset;
|
|
2823
2845
|
return BuildTextUtils.range.isIntersects(startOffset, endOffset - 1, range.startIndex, range.endIndex);
|
|
@@ -2841,10 +2863,11 @@ let DocCustomRangeController = class DocCustomRangeController extends Disposable
|
|
|
2841
2863
|
_initSelectionChange() {
|
|
2842
2864
|
this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
|
|
2843
2865
|
if (commandInfo.id === SetTextSelectionsOperation.id) {
|
|
2844
|
-
const
|
|
2866
|
+
const params = commandInfo.params;
|
|
2867
|
+
const { unitId, ranges, isEditing } = params;
|
|
2845
2868
|
const doc = this._univerInstanceService.getUnit(unitId);
|
|
2846
2869
|
if (!doc) return;
|
|
2847
|
-
const transformedRanges = ranges.map((range) => this._transformCustomRange(doc, range));
|
|
2870
|
+
const transformedRanges = ranges.map((range) => this._transformCustomRange(doc, range, params.segmentId));
|
|
2848
2871
|
if (transformedRanges.some((range, i) => ranges[i] !== range)) this._textSelectionManagerService.replaceDocRanges(transformedRanges, void 0, isEditing);
|
|
2849
2872
|
}
|
|
2850
2873
|
}));
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { DocumentDataModel, Nullable } from '@univerjs/core';
|
|
17
17
|
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
18
|
-
import { IUniverInstanceService, LocaleService, RxDisposable } from '@univerjs/core';
|
|
18
|
+
import { IConfigService, IUniverInstanceService, LocaleService, RxDisposable } from '@univerjs/core';
|
|
19
19
|
import { DocumentSkeleton, DocumentViewModel } from '@univerjs/engine-render';
|
|
20
20
|
import { DocLayoutExecutorService } from './doc-layout-executor.service';
|
|
21
21
|
/**
|
|
@@ -27,6 +27,7 @@ export declare class DocSkeletonManagerService extends RxDisposable implements I
|
|
|
27
27
|
private readonly _localeService;
|
|
28
28
|
private readonly _univerInstanceService;
|
|
29
29
|
private readonly _docLayoutExecutorService;
|
|
30
|
+
private readonly _configService;
|
|
30
31
|
private _skeleton;
|
|
31
32
|
private _docViewModel;
|
|
32
33
|
private readonly _currentSkeleton$;
|
|
@@ -35,7 +36,7 @@ export declare class DocSkeletonManagerService extends RxDisposable implements I
|
|
|
35
36
|
readonly currentSkeletonBefore$: import("rxjs").Observable<Nullable<DocumentSkeleton>>;
|
|
36
37
|
private readonly _currentViewModel$;
|
|
37
38
|
readonly currentViewModel$: import("rxjs").Observable<Nullable<DocumentViewModel>>;
|
|
38
|
-
constructor(_context: Pick<IRenderContext<DocumentDataModel>, 'type' | 'unit' | 'unitId'>, _localeService: LocaleService, _univerInstanceService: IUniverInstanceService, _docLayoutExecutorService: DocLayoutExecutorService);
|
|
39
|
+
constructor(_context: Pick<IRenderContext<DocumentDataModel>, 'type' | 'unit' | 'unitId'>, _localeService: LocaleService, _univerInstanceService: IUniverInstanceService, _docLayoutExecutorService: DocLayoutExecutorService, _configService: IConfigService);
|
|
39
40
|
dispose(): void;
|
|
40
41
|
getSkeleton(): DocumentSkeleton;
|
|
41
42
|
getViewModel(): DocumentViewModel;
|