@univerjs/docs 1.0.4 → 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 +40 -25
- package/lib/es/facade.js +6 -6
- package/lib/es/index.js +34 -19
- package/lib/facade.js +6 -6
- package/lib/index.js +34 -19
- 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/cjs/facade.js
CHANGED
|
@@ -304,7 +304,7 @@ function stripBlockTokens(text) {
|
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
//#endregion
|
|
307
|
-
//#region \0@oxc-project+runtime@0.
|
|
307
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
|
|
308
308
|
function __decorateParam(paramIndex, decorator) {
|
|
309
309
|
return function(target, key) {
|
|
310
310
|
decorator(target, key, paramIndex);
|
|
@@ -312,7 +312,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
//#endregion
|
|
315
|
-
//#region \0@oxc-project+runtime@0.
|
|
315
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
316
316
|
function __decorate(decorators, target, key, desc) {
|
|
317
317
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
318
318
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1454,7 +1454,7 @@ let FDocumentSection = class FDocumentSection {
|
|
|
1454
1454
|
FDocumentSection = __decorate([__decorateParam(2, _univerjs_core.ICommandService), __decorateParam(3, _univerjs_core.IPermissionService)], FDocumentSection);
|
|
1455
1455
|
|
|
1456
1456
|
//#endregion
|
|
1457
|
-
//#region \0@oxc-project+runtime@0.
|
|
1457
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
|
|
1458
1458
|
function _typeof(o) {
|
|
1459
1459
|
"@babel/helpers - typeof";
|
|
1460
1460
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -1465,7 +1465,7 @@ function _typeof(o) {
|
|
|
1465
1465
|
}
|
|
1466
1466
|
|
|
1467
1467
|
//#endregion
|
|
1468
|
-
//#region \0@oxc-project+runtime@0.
|
|
1468
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
|
|
1469
1469
|
function toPrimitive(t, r) {
|
|
1470
1470
|
if ("object" != _typeof(t) || !t) return t;
|
|
1471
1471
|
var e = t[Symbol.toPrimitive];
|
|
@@ -1478,14 +1478,14 @@ function toPrimitive(t, r) {
|
|
|
1478
1478
|
}
|
|
1479
1479
|
|
|
1480
1480
|
//#endregion
|
|
1481
|
-
//#region \0@oxc-project+runtime@0.
|
|
1481
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
|
|
1482
1482
|
function toPropertyKey(t) {
|
|
1483
1483
|
var i = toPrimitive(t, "string");
|
|
1484
1484
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
1485
1485
|
}
|
|
1486
1486
|
|
|
1487
1487
|
//#endregion
|
|
1488
|
-
//#region \0@oxc-project+runtime@0.
|
|
1488
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
|
|
1489
1489
|
function _defineProperty(e, r, t) {
|
|
1490
1490
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
1491
1491
|
value: t,
|
|
@@ -2318,27 +2318,27 @@ _univerjs_core_facade.FEnum.extend(FDocsEnumMixin);
|
|
|
2318
2318
|
//#endregion
|
|
2319
2319
|
exports.DocsSectionUnsupportedDocumentFlavorError = DocsSectionUnsupportedDocumentFlavorError;
|
|
2320
2320
|
exports.FDocsEnumMixin = FDocsEnumMixin;
|
|
2321
|
-
Object.defineProperty(exports,
|
|
2321
|
+
Object.defineProperty(exports, "FDocument", {
|
|
2322
2322
|
enumerable: true,
|
|
2323
2323
|
get: function () {
|
|
2324
2324
|
return FDocument;
|
|
2325
2325
|
}
|
|
2326
2326
|
});
|
|
2327
2327
|
exports.FDocumentObjectPermission = FDocumentObjectPermission;
|
|
2328
|
-
Object.defineProperty(exports,
|
|
2328
|
+
Object.defineProperty(exports, "FDocumentParagraph", {
|
|
2329
2329
|
enumerable: true,
|
|
2330
2330
|
get: function () {
|
|
2331
2331
|
return FDocumentParagraph;
|
|
2332
2332
|
}
|
|
2333
2333
|
});
|
|
2334
2334
|
exports.FDocumentPermission = FDocumentPermission;
|
|
2335
|
-
Object.defineProperty(exports,
|
|
2335
|
+
Object.defineProperty(exports, "FDocumentSection", {
|
|
2336
2336
|
enumerable: true,
|
|
2337
2337
|
get: function () {
|
|
2338
2338
|
return FDocumentSection;
|
|
2339
2339
|
}
|
|
2340
2340
|
});
|
|
2341
|
-
Object.defineProperty(exports,
|
|
2341
|
+
Object.defineProperty(exports, "FDocumentTextRange", {
|
|
2342
2342
|
enumerable: true,
|
|
2343
2343
|
get: function () {
|
|
2344
2344
|
return FDocumentTextRange;
|
package/lib/cjs/index.js
CHANGED
|
@@ -15,7 +15,7 @@ const SetTextSelectionsOperation = {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
18
|
-
//#region \0@oxc-project+runtime@0.
|
|
18
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
|
|
19
19
|
function _typeof(o) {
|
|
20
20
|
"@babel/helpers - typeof";
|
|
21
21
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -26,7 +26,7 @@ function _typeof(o) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
//#endregion
|
|
29
|
-
//#region \0@oxc-project+runtime@0.
|
|
29
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
|
|
30
30
|
function toPrimitive(t, r) {
|
|
31
31
|
if ("object" != _typeof(t) || !t) return t;
|
|
32
32
|
var e = t[Symbol.toPrimitive];
|
|
@@ -39,14 +39,14 @@ function toPrimitive(t, r) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
//#endregion
|
|
42
|
-
//#region \0@oxc-project+runtime@0.
|
|
42
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
|
|
43
43
|
function toPropertyKey(t) {
|
|
44
44
|
var i = toPrimitive(t, "string");
|
|
45
45
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
//#endregion
|
|
49
|
-
//#region \0@oxc-project+runtime@0.
|
|
49
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
|
|
50
50
|
function _defineProperty(e, r, t) {
|
|
51
51
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
52
52
|
value: t,
|
|
@@ -57,7 +57,7 @@ function _defineProperty(e, r, t) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
//#endregion
|
|
60
|
-
//#region \0@oxc-project+runtime@0.
|
|
60
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
|
|
61
61
|
function __decorateParam(paramIndex, decorator) {
|
|
62
62
|
return function(target, key) {
|
|
63
63
|
decorator(target, key, paramIndex);
|
|
@@ -65,7 +65,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
//#endregion
|
|
68
|
-
//#region \0@oxc-project+runtime@0.
|
|
68
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
69
69
|
function __decorate(decorators, target, key, desc) {
|
|
70
70
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
71
71
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -160,7 +160,10 @@ let DocSelectionManagerService = class DocSelectionManagerService extends _unive
|
|
|
160
160
|
subUnitId,
|
|
161
161
|
docRanges,
|
|
162
162
|
isEditing,
|
|
163
|
-
options
|
|
163
|
+
options: {
|
|
164
|
+
...options,
|
|
165
|
+
preserveInputStyle: false
|
|
166
|
+
}
|
|
164
167
|
});
|
|
165
168
|
}
|
|
166
169
|
/**
|
|
@@ -180,7 +183,13 @@ let DocSelectionManagerService = class DocSelectionManagerService extends _unive
|
|
|
180
183
|
...textSelectionInfo,
|
|
181
184
|
...search
|
|
182
185
|
};
|
|
183
|
-
this._replaceByParam(
|
|
186
|
+
this._replaceByParam({
|
|
187
|
+
...params,
|
|
188
|
+
options: {
|
|
189
|
+
...params.options,
|
|
190
|
+
preserveInputStyle: true
|
|
191
|
+
}
|
|
192
|
+
});
|
|
184
193
|
this._textSelection$.next(params);
|
|
185
194
|
const { unitId, subUnitId, segmentId, style, textRanges, rectRanges, isEditing } = params;
|
|
186
195
|
const ranges = [...textRanges, ...rectRanges].filter((range) => range.startOffset != null && range.endOffset != null).sort((a, b) => {
|
|
@@ -221,10 +230,11 @@ let DocSelectionManagerService = class DocSelectionManagerService extends _unive
|
|
|
221
230
|
subUnitId,
|
|
222
231
|
docRanges,
|
|
223
232
|
isEditing,
|
|
224
|
-
options:
|
|
233
|
+
options: {
|
|
225
234
|
...options,
|
|
226
|
-
forceFocus: false
|
|
227
|
-
|
|
235
|
+
forceFocus: false,
|
|
236
|
+
preserveInputStyle: (options === null || options === void 0 ? void 0 : options.preserveInputStyle) ?? true
|
|
237
|
+
}
|
|
228
238
|
});
|
|
229
239
|
}
|
|
230
240
|
_replaceByParam(insertParam) {
|
|
@@ -900,12 +910,13 @@ DocLayoutExecutorService = _DocLayoutExecutorService = __decorate([
|
|
|
900
910
|
//#endregion
|
|
901
911
|
//#region src/services/doc-skeleton-manager.service.ts
|
|
902
912
|
let DocSkeletonManagerService = class DocSkeletonManagerService extends _univerjs_core.RxDisposable {
|
|
903
|
-
constructor(_context, _localeService, _univerInstanceService, _docLayoutExecutorService) {
|
|
913
|
+
constructor(_context, _localeService, _univerInstanceService, _docLayoutExecutorService, _configService) {
|
|
904
914
|
super();
|
|
905
915
|
this._context = _context;
|
|
906
916
|
this._localeService = _localeService;
|
|
907
917
|
this._univerInstanceService = _univerInstanceService;
|
|
908
918
|
this._docLayoutExecutorService = _docLayoutExecutorService;
|
|
919
|
+
this._configService = _configService;
|
|
909
920
|
_defineProperty(this, "_skeleton", void 0);
|
|
910
921
|
_defineProperty(this, "_docViewModel", void 0);
|
|
911
922
|
_defineProperty(this, "_currentSkeleton$", new rxjs.BehaviorSubject(null));
|
|
@@ -965,7 +976,8 @@ let DocSkeletonManagerService = class DocSkeletonManagerService extends _univerj
|
|
|
965
976
|
this._currentViewModel$.next(this._docViewModel);
|
|
966
977
|
}
|
|
967
978
|
_buildSkeleton(documentViewModel) {
|
|
968
|
-
|
|
979
|
+
const isSheetEditor = this._context.unitId === _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY || this._context.unitId === _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY;
|
|
980
|
+
return _univerjs_engine_render.DocumentSkeleton.create(documentViewModel, this._localeService, { lineGap: isSheetEditor ? this._configService.getConfig(_univerjs_core.SHEET_TEXT_LINE_GAP) : void 0 });
|
|
969
981
|
}
|
|
970
982
|
_buildDocViewModel(documentDataModel) {
|
|
971
983
|
return new _univerjs_engine_render.DocumentViewModel(documentDataModel);
|
|
@@ -974,7 +986,8 @@ let DocSkeletonManagerService = class DocSkeletonManagerService extends _univerj
|
|
|
974
986
|
DocSkeletonManagerService = __decorate([
|
|
975
987
|
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService)),
|
|
976
988
|
__decorateParam(2, _univerjs_core.IUniverInstanceService),
|
|
977
|
-
__decorateParam(3, (0, _univerjs_core.Inject)(DocLayoutExecutorService))
|
|
989
|
+
__decorateParam(3, (0, _univerjs_core.Inject)(DocLayoutExecutorService)),
|
|
990
|
+
__decorateParam(4, _univerjs_core.IConfigService)
|
|
978
991
|
], DocSkeletonManagerService);
|
|
979
992
|
|
|
980
993
|
//#endregion
|
|
@@ -1373,13 +1386,15 @@ function scheduleDocumentSelectionUpdate(selectionManager, params, isSync) {
|
|
|
1373
1386
|
textRanges: logicalTextRanges,
|
|
1374
1387
|
rectRanges: [],
|
|
1375
1388
|
isEditing,
|
|
1376
|
-
options:
|
|
1389
|
+
options: {
|
|
1390
|
+
...params.options,
|
|
1391
|
+
preserveInputStyle: false
|
|
1392
|
+
}
|
|
1377
1393
|
}, selectionTarget);
|
|
1378
1394
|
const updatedSelection = selectionManager.getSelectionInfo(selectionTarget);
|
|
1379
1395
|
queueMicrotask(() => {
|
|
1380
1396
|
if (selectionManager.getSelectionInfo(selectionTarget) !== updatedSelection) return;
|
|
1381
|
-
|
|
1382
|
-
else selectionManager.refreshSelection(selectionTarget, isEditing);
|
|
1397
|
+
selectionManager.replaceDocRanges(logicalTextRanges, selectionTarget, isEditing, params.options);
|
|
1383
1398
|
});
|
|
1384
1399
|
}
|
|
1385
1400
|
/**
|
|
@@ -2787,7 +2802,7 @@ function composeActions(actions) {
|
|
|
2787
2802
|
//#endregion
|
|
2788
2803
|
//#region package.json
|
|
2789
2804
|
var name = "@univerjs/docs";
|
|
2790
|
-
var version = "1.0
|
|
2805
|
+
var version = "1.1.0";
|
|
2791
2806
|
|
|
2792
2807
|
//#endregion
|
|
2793
2808
|
//#region src/config/config.ts
|
|
@@ -4803,13 +4818,13 @@ exports.DeleteTextCommand = DeleteTextCommand;
|
|
|
4803
4818
|
exports.DocBlockMoveValidatorService = DocBlockMoveValidatorService;
|
|
4804
4819
|
exports.DocContentInsertService = DocContentInsertService;
|
|
4805
4820
|
exports.DocHistoryAction = DocHistoryAction;
|
|
4806
|
-
Object.defineProperty(exports,
|
|
4821
|
+
Object.defineProperty(exports, "DocInterceptorService", {
|
|
4807
4822
|
enumerable: true,
|
|
4808
4823
|
get: function () {
|
|
4809
4824
|
return DocInterceptorService;
|
|
4810
4825
|
}
|
|
4811
4826
|
});
|
|
4812
|
-
Object.defineProperty(exports,
|
|
4827
|
+
Object.defineProperty(exports, "DocLayoutExecutorService", {
|
|
4813
4828
|
enumerable: true,
|
|
4814
4829
|
get: function () {
|
|
4815
4830
|
return DocLayoutExecutorService;
|
|
@@ -4818,19 +4833,19 @@ Object.defineProperty(exports, 'DocLayoutExecutorService', {
|
|
|
4818
4833
|
exports.DocLayoutExecutorState = DocLayoutExecutorState;
|
|
4819
4834
|
exports.DocLayoutExecutorType = DocLayoutExecutorType;
|
|
4820
4835
|
exports.DocLayoutSessionStatus = DocLayoutSessionStatus;
|
|
4821
|
-
Object.defineProperty(exports,
|
|
4836
|
+
Object.defineProperty(exports, "DocSelectionManagerService", {
|
|
4822
4837
|
enumerable: true,
|
|
4823
4838
|
get: function () {
|
|
4824
4839
|
return DocSelectionManagerService;
|
|
4825
4840
|
}
|
|
4826
4841
|
});
|
|
4827
|
-
Object.defineProperty(exports,
|
|
4842
|
+
Object.defineProperty(exports, "DocSkeletonManagerService", {
|
|
4828
4843
|
enumerable: true,
|
|
4829
4844
|
get: function () {
|
|
4830
4845
|
return DocSkeletonManagerService;
|
|
4831
4846
|
}
|
|
4832
4847
|
});
|
|
4833
|
-
Object.defineProperty(exports,
|
|
4848
|
+
Object.defineProperty(exports, "DocStateChangeManagerService", {
|
|
4834
4849
|
enumerable: true,
|
|
4835
4850
|
get: function () {
|
|
4836
4851
|
return DocStateChangeManagerService;
|
|
@@ -4855,13 +4870,13 @@ exports.SetDocumentPermissionRulesMutation = SetDocumentPermissionRulesMutation;
|
|
|
4855
4870
|
exports.SetDocumentPermissionsCommand = SetDocumentPermissionsCommand;
|
|
4856
4871
|
exports.SetSectionHeaderFooterLinkCommand = SetSectionHeaderFooterLinkCommand;
|
|
4857
4872
|
exports.SetTextSelectionsOperation = SetTextSelectionsOperation;
|
|
4858
|
-
Object.defineProperty(exports,
|
|
4873
|
+
Object.defineProperty(exports, "UniverDocsLayoutWorkerPlugin", {
|
|
4859
4874
|
enumerable: true,
|
|
4860
4875
|
get: function () {
|
|
4861
4876
|
return UniverDocsLayoutWorkerPlugin;
|
|
4862
4877
|
}
|
|
4863
4878
|
});
|
|
4864
|
-
Object.defineProperty(exports,
|
|
4879
|
+
Object.defineProperty(exports, "UniverDocsPlugin", {
|
|
4865
4880
|
enumerable: true,
|
|
4866
4881
|
get: function () {
|
|
4867
4882
|
return UniverDocsPlugin;
|
package/lib/es/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/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, 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, 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) {
|
|
@@ -899,12 +909,13 @@ DocLayoutExecutorService = _DocLayoutExecutorService = __decorate([
|
|
|
899
909
|
//#endregion
|
|
900
910
|
//#region src/services/doc-skeleton-manager.service.ts
|
|
901
911
|
let DocSkeletonManagerService = class DocSkeletonManagerService extends RxDisposable {
|
|
902
|
-
constructor(_context, _localeService, _univerInstanceService, _docLayoutExecutorService) {
|
|
912
|
+
constructor(_context, _localeService, _univerInstanceService, _docLayoutExecutorService, _configService) {
|
|
903
913
|
super();
|
|
904
914
|
this._context = _context;
|
|
905
915
|
this._localeService = _localeService;
|
|
906
916
|
this._univerInstanceService = _univerInstanceService;
|
|
907
917
|
this._docLayoutExecutorService = _docLayoutExecutorService;
|
|
918
|
+
this._configService = _configService;
|
|
908
919
|
_defineProperty(this, "_skeleton", void 0);
|
|
909
920
|
_defineProperty(this, "_docViewModel", void 0);
|
|
910
921
|
_defineProperty(this, "_currentSkeleton$", new BehaviorSubject(null));
|
|
@@ -964,7 +975,8 @@ let DocSkeletonManagerService = class DocSkeletonManagerService extends RxDispos
|
|
|
964
975
|
this._currentViewModel$.next(this._docViewModel);
|
|
965
976
|
}
|
|
966
977
|
_buildSkeleton(documentViewModel) {
|
|
967
|
-
|
|
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 });
|
|
968
980
|
}
|
|
969
981
|
_buildDocViewModel(documentDataModel) {
|
|
970
982
|
return new DocumentViewModel(documentDataModel);
|
|
@@ -973,7 +985,8 @@ let DocSkeletonManagerService = class DocSkeletonManagerService extends RxDispos
|
|
|
973
985
|
DocSkeletonManagerService = __decorate([
|
|
974
986
|
__decorateParam(1, Inject(LocaleService)),
|
|
975
987
|
__decorateParam(2, IUniverInstanceService),
|
|
976
|
-
__decorateParam(3, Inject(DocLayoutExecutorService))
|
|
988
|
+
__decorateParam(3, Inject(DocLayoutExecutorService)),
|
|
989
|
+
__decorateParam(4, IConfigService)
|
|
977
990
|
], DocSkeletonManagerService);
|
|
978
991
|
|
|
979
992
|
//#endregion
|
|
@@ -1372,13 +1385,15 @@ function scheduleDocumentSelectionUpdate(selectionManager, params, isSync) {
|
|
|
1372
1385
|
textRanges: logicalTextRanges,
|
|
1373
1386
|
rectRanges: [],
|
|
1374
1387
|
isEditing,
|
|
1375
|
-
options:
|
|
1388
|
+
options: {
|
|
1389
|
+
...params.options,
|
|
1390
|
+
preserveInputStyle: false
|
|
1391
|
+
}
|
|
1376
1392
|
}, selectionTarget);
|
|
1377
1393
|
const updatedSelection = selectionManager.getSelectionInfo(selectionTarget);
|
|
1378
1394
|
queueMicrotask(() => {
|
|
1379
1395
|
if (selectionManager.getSelectionInfo(selectionTarget) !== updatedSelection) return;
|
|
1380
|
-
|
|
1381
|
-
else selectionManager.refreshSelection(selectionTarget, isEditing);
|
|
1396
|
+
selectionManager.replaceDocRanges(logicalTextRanges, selectionTarget, isEditing, params.options);
|
|
1382
1397
|
});
|
|
1383
1398
|
}
|
|
1384
1399
|
/**
|
|
@@ -2786,7 +2801,7 @@ function composeActions(actions) {
|
|
|
2786
2801
|
//#endregion
|
|
2787
2802
|
//#region package.json
|
|
2788
2803
|
var name = "@univerjs/docs";
|
|
2789
|
-
var version = "1.0
|
|
2804
|
+
var version = "1.1.0";
|
|
2790
2805
|
|
|
2791
2806
|
//#endregion
|
|
2792
2807
|
//#region src/config/config.ts
|
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,
|