@univerjs/docs 0.2.11 → 0.2.12
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/index.js +3 -3
- package/lib/es/index.js +68 -67
- package/lib/types/basics/custom-range-factory.d.ts +2 -1
- package/lib/types/basics/custom-range.d.ts +9 -1
- package/lib/types/controllers/config.schema.d.ts +20 -0
- package/lib/types/doc-plugin.d.ts +5 -5
- package/lib/types/index.d.ts +3 -4
- package/lib/umd/index.js +3 -3
- package/package.json +7 -7
- package/lib/types/services/doc-custom-range.service.d.ts +0 -19
package/lib/es/index.js
CHANGED
|
@@ -2,42 +2,10 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
5
|
-
import {
|
|
5
|
+
import { CommandType, RxDisposable, ICommandService, Inject, IUndoRedoService, UndoCommandId, RedoCommandId, JSONX, IUniverInstanceService, LocaleService, UniverInstanceType, isInternalEditorID, Tools, PresetListType, MemoryCursor, TextX, PRESET_LIST_TYPE, GridType, TextXActionType, UpdateDocsAttributeType, sortRulesFactory, generateRandomId, DataStreamTreeTokenType, normalizeBody, getBodySlice, updateAttributeByInsert, BooleanNumber, TableCellHeightRule, TableSizeType, TableAlignmentType, TableTextWrapType, ObjectRelativeFromH, ObjectRelativeFromV, PositionedObjectLayoutType, getCustomRangeSlice, getCustomDecorationSlice, BaselineOffset, OnLifecycle, LifecycleStages, Disposable, Direction, toDisposable, sequenceExecuteAsync, HorizontalAlign, Plugin, Injector, IConfigService, createInterceptorKey, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DisposableCollection, remove, composeInterceptors } from "@univerjs/core";
|
|
6
6
|
import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE, ITextSelectionRenderManager, DocumentSkeleton, DocumentViewModel, IRenderManagerService, getCharSpaceApply, getNumberUnitValue, hasListGlyph, isIndentByGlyph, isFirstGlyph, getParagraphByGlyph, DocumentSkeletonPageType, lineIterator, getLastLine, RANGE_DIRECTION, NodePositionConvertToCursor, TextSelectionRenderManager } from "@univerjs/engine-render";
|
|
7
7
|
import { BehaviorSubject, takeUntil } from "rxjs";
|
|
8
8
|
import { TextSelectionManagerService as TextSelectionManagerService$1, getCommandSkeleton as getCommandSkeleton$1, getInsertSelection as getInsertSelection$1, RichTextEditingMutation as RichTextEditingMutation$1, generateParagraphs as generateParagraphs$1, getRichTextEditPath as getRichTextEditPath$1 } from "@univerjs/docs";
|
|
9
|
-
function isCustomRangeSplitSymbol(text) {
|
|
10
|
-
return text === DataStreamTreeTokenType.CUSTOM_RANGE_END || text === DataStreamTreeTokenType.CUSTOM_RANGE_START;
|
|
11
|
-
}
|
|
12
|
-
__name(isCustomRangeSplitSymbol, "isCustomRangeSplitSymbol");
|
|
13
|
-
function isIntersecting(line1Start, line1End, line2Start, line2End) {
|
|
14
|
-
return line1Start <= line2Start && line1End >= line2Start || line1Start >= line2Start && line1Start <= line2End;
|
|
15
|
-
}
|
|
16
|
-
__name(isIntersecting, "isIntersecting");
|
|
17
|
-
function shouldDeleteCustomRange(deleteStart, deleteLen, customRange, dataStream) {
|
|
18
|
-
const dataStreamSlice = dataStream.slice(customRange.startIndex + 1, customRange.endIndex), start = Math.max(deleteStart - (customRange.startIndex + 1), 0), end = deleteStart + deleteLen - 1 - (customRange.startIndex + 1);
|
|
19
|
-
if (end < 0)
|
|
20
|
-
return !1;
|
|
21
|
-
if (start === 0 && end >= dataStreamSlice.length)
|
|
22
|
-
return !0;
|
|
23
|
-
const result = dataStreamSlice.slice(0, start) + dataStreamSlice.slice(start + deleteLen);
|
|
24
|
-
for (let i = 0, len = result.length; i < len; i++) {
|
|
25
|
-
const letter = result[i];
|
|
26
|
-
if (!isCustomRangeSplitSymbol(letter))
|
|
27
|
-
return !1;
|
|
28
|
-
}
|
|
29
|
-
return !0;
|
|
30
|
-
}
|
|
31
|
-
__name(shouldDeleteCustomRange, "shouldDeleteCustomRange");
|
|
32
|
-
function getCustomRangesInterestsWithRange(range, customRanges) {
|
|
33
|
-
const result = [];
|
|
34
|
-
for (let i = 0, len = customRanges.length; i < len; i++) {
|
|
35
|
-
const customRange = customRanges[i];
|
|
36
|
-
range.collapsed ? customRange.startIndex < range.startOffset && range.startOffset <= customRange.endIndex && result.push(customRange) : isIntersecting(range.startOffset, range.endOffset, customRange.startIndex, customRange.endIndex) && result.push(customRange);
|
|
37
|
-
}
|
|
38
|
-
return result;
|
|
39
|
-
}
|
|
40
|
-
__name(getCustomRangesInterestsWithRange, "getCustomRangesInterestsWithRange");
|
|
41
9
|
const SetTextSelectionsOperation = {
|
|
42
10
|
id: "doc.operation.set-selections",
|
|
43
11
|
type: CommandType.OPERATION,
|
|
@@ -906,6 +874,45 @@ function findNearestSectionBreak(currentIndex, sectionBreaks) {
|
|
|
906
874
|
}
|
|
907
875
|
}
|
|
908
876
|
__name(findNearestSectionBreak, "findNearestSectionBreak");
|
|
877
|
+
function isCustomRangeSplitSymbol(text) {
|
|
878
|
+
return text === DataStreamTreeTokenType.CUSTOM_RANGE_END || text === DataStreamTreeTokenType.CUSTOM_RANGE_START;
|
|
879
|
+
}
|
|
880
|
+
__name(isCustomRangeSplitSymbol, "isCustomRangeSplitSymbol");
|
|
881
|
+
function isIntersecting(line1Start, line1End, line2Start, line2End) {
|
|
882
|
+
return line1Start <= line2Start && line1End >= line2Start || line1Start >= line2Start && line1Start <= line2End;
|
|
883
|
+
}
|
|
884
|
+
__name(isIntersecting, "isIntersecting");
|
|
885
|
+
function shouldDeleteCustomRange(deleteStart, deleteLen, customRange, dataStream) {
|
|
886
|
+
const dataStreamSlice = dataStream.slice(customRange.startIndex + 1, customRange.endIndex), start = Math.max(deleteStart - (customRange.startIndex + 1), 0), end = deleteStart + deleteLen - 1 - (customRange.startIndex + 1);
|
|
887
|
+
if (end < 0)
|
|
888
|
+
return !1;
|
|
889
|
+
if (start === 0 && end >= dataStreamSlice.length)
|
|
890
|
+
return !0;
|
|
891
|
+
const result = dataStreamSlice.slice(0, start) + dataStreamSlice.slice(start + deleteLen);
|
|
892
|
+
for (let i = 0, len = result.length; i < len; i++) {
|
|
893
|
+
const letter = result[i];
|
|
894
|
+
if (!isCustomRangeSplitSymbol(letter))
|
|
895
|
+
return !1;
|
|
896
|
+
}
|
|
897
|
+
return !0;
|
|
898
|
+
}
|
|
899
|
+
__name(shouldDeleteCustomRange, "shouldDeleteCustomRange");
|
|
900
|
+
function getCustomRangesInterestsWithRange(range, customRanges) {
|
|
901
|
+
const result = [];
|
|
902
|
+
for (let i = 0, len = customRanges.length; i < len; i++) {
|
|
903
|
+
const customRange = customRanges[i];
|
|
904
|
+
range.collapsed ? customRange.startIndex < range.startOffset && range.startOffset <= customRange.endIndex && result.push(customRange) : isIntersecting(range.startOffset, range.endOffset, customRange.startIndex, customRange.endIndex) && result.push(customRange);
|
|
905
|
+
}
|
|
906
|
+
return result;
|
|
907
|
+
}
|
|
908
|
+
__name(getCustomRangesInterestsWithRange, "getCustomRangesInterestsWithRange");
|
|
909
|
+
function copyCustomRange(range) {
|
|
910
|
+
return {
|
|
911
|
+
...Tools.deepClone(range),
|
|
912
|
+
rangeId: generateRandomId()
|
|
913
|
+
};
|
|
914
|
+
}
|
|
915
|
+
__name(copyCustomRange, "copyCustomRange");
|
|
909
916
|
var DeleteDirection = /* @__PURE__ */ ((DeleteDirection2) => (DeleteDirection2[DeleteDirection2.LEFT = 0] = "LEFT", DeleteDirection2[DeleteDirection2.RIGHT = 1] = "RIGHT", DeleteDirection2))(DeleteDirection || {});
|
|
910
917
|
function makeSelection(startOffset, endOffset) {
|
|
911
918
|
if (typeof endOffset > "u")
|
|
@@ -1185,25 +1192,6 @@ function getDocObjectById(unitId, renderManagerService) {
|
|
|
1185
1192
|
};
|
|
1186
1193
|
}
|
|
1187
1194
|
__name(getDocObjectById, "getDocObjectById");
|
|
1188
|
-
const _DocCustomRangeService = class _DocCustomRangeService {
|
|
1189
|
-
constructor() {
|
|
1190
|
-
__publicField(this, "_customRangeHooks", []);
|
|
1191
|
-
}
|
|
1192
|
-
addClipboardHook(hook) {
|
|
1193
|
-
return this._customRangeHooks.push(hook), toDisposable(() => {
|
|
1194
|
-
const index = this._customRangeHooks.indexOf(hook);
|
|
1195
|
-
index > -1 && this._customRangeHooks.splice(index, 1);
|
|
1196
|
-
});
|
|
1197
|
-
}
|
|
1198
|
-
copyCustomRange(unitId, range) {
|
|
1199
|
-
let copy = { ...range };
|
|
1200
|
-
return this._customRangeHooks.forEach((hook) => {
|
|
1201
|
-
hook.onCopyCustomRange && (copy = hook.onCopyCustomRange(unitId, copy));
|
|
1202
|
-
}), copy;
|
|
1203
|
-
}
|
|
1204
|
-
};
|
|
1205
|
-
__name(_DocCustomRangeService, "DocCustomRangeService");
|
|
1206
|
-
let DocCustomRangeService = _DocCustomRangeService;
|
|
1207
1195
|
function getRetainAndDeleteFromReplace(range, segmentId = "", memoryCursor, body) {
|
|
1208
1196
|
var _a11;
|
|
1209
1197
|
const { startOffset, endOffset } = range, dos = [], textStart = startOffset - memoryCursor, textEnd = endOffset - memoryCursor, dataStream = body.dataStream, relativeCustomRanges = (_a11 = body.customRanges) == null ? void 0 : _a11.filter((customRange) => isIntersecting(customRange.startIndex, customRange.endIndex, startOffset, endOffset)), toDeleteRanges = new Set(relativeCustomRanges == null ? void 0 : relativeCustomRanges.filter((customRange) => shouldDeleteCustomRange(startOffset, endOffset - startOffset, customRange, dataStream))), retainPoints = /* @__PURE__ */ new Set();
|
|
@@ -1385,7 +1373,7 @@ const BreakLineCommand = {
|
|
|
1385
1373
|
type: CommandType.COMMAND,
|
|
1386
1374
|
handler: /* @__PURE__ */ __name(async (accessor) => {
|
|
1387
1375
|
var _a11, _b;
|
|
1388
|
-
const textSelectionManagerService = accessor.get(TextSelectionManagerService), univerInstanceService = accessor.get(IUniverInstanceService), commandService = accessor.get(ICommandService),
|
|
1376
|
+
const textSelectionManagerService = accessor.get(TextSelectionManagerService), univerInstanceService = accessor.get(IUniverInstanceService), commandService = accessor.get(ICommandService), activeTextRange = textSelectionManagerService.getActiveTextRangeWithStyle(), rectRanges = textSelectionManagerService.getCurrentRectRanges();
|
|
1389
1377
|
if (activeTextRange == null)
|
|
1390
1378
|
return !1;
|
|
1391
1379
|
if (rectRanges && rectRanges.length) {
|
|
@@ -1401,7 +1389,7 @@ const BreakLineCommand = {
|
|
|
1401
1389
|
const unitId = docDataModel.getUnitId(), { startOffset, endOffset } = getInsertSelection(activeTextRange, body), prevParagraph = ((_a11 = body.paragraphs) != null ? _a11 : []).find((p) => p.startIndex >= startOffset);
|
|
1402
1390
|
if (prevParagraph && prevParagraph.startIndex > endOffset) {
|
|
1403
1391
|
const bodyAfter = normalizeBody(getBodySlice(body, endOffset, prevParagraph.startIndex + 1));
|
|
1404
|
-
bodyAfter.customRanges = (_b = bodyAfter.customRanges) == null ? void 0 : _b.map(
|
|
1392
|
+
bodyAfter.customRanges = (_b = bodyAfter.customRanges) == null ? void 0 : _b.map(copyCustomRange);
|
|
1405
1393
|
const deleteRange = {
|
|
1406
1394
|
startOffset,
|
|
1407
1395
|
endOffset: prevParagraph.startIndex + 1,
|
|
@@ -2483,9 +2471,12 @@ const DeleteLeftCommand = {
|
|
|
2483
2471
|
}, "handler")
|
|
2484
2472
|
};
|
|
2485
2473
|
function getParagraphBody(accessor, unitId, body, start, end) {
|
|
2486
|
-
const { textRuns: originTextRuns = [], customBlocks: originCustomBlocks = [] } = body,
|
|
2487
|
-
dataStream,
|
|
2488
|
-
customRanges: getCustomRangeSlice(body, start, end).customRanges.map((range) =>
|
|
2474
|
+
const { textRuns: originTextRuns = [], customBlocks: originCustomBlocks = [] } = body, bodySlice = {
|
|
2475
|
+
dataStream: body.dataStream.substring(start, end),
|
|
2476
|
+
customRanges: getCustomRangeSlice(body, start, end).customRanges.map((range) => ({
|
|
2477
|
+
...Tools.deepClone(range),
|
|
2478
|
+
rangeId: generateRandomId()
|
|
2479
|
+
})),
|
|
2489
2480
|
customDecorations: getCustomDecorationSlice(body, start, end)
|
|
2490
2481
|
}, textRuns = [];
|
|
2491
2482
|
for (const textRun of originTextRuns) {
|
|
@@ -4087,7 +4078,7 @@ const DocsRenameMutation = {
|
|
|
4087
4078
|
position: INSERT_ROW_POSITION.BELLOW
|
|
4088
4079
|
}) : !0;
|
|
4089
4080
|
}, "handler")
|
|
4090
|
-
};
|
|
4081
|
+
}, PLUGIN_CONFIG_KEY = "docs.config", defaultPluginConfig = {};
|
|
4091
4082
|
var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
4092
4083
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4093
4084
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
@@ -4096,8 +4087,10 @@ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPrope
|
|
|
4096
4087
|
const PLUGIN_NAME = "DOCS_PLUGIN";
|
|
4097
4088
|
var _a9;
|
|
4098
4089
|
let UniverDocsPlugin = (_a9 = class extends Plugin {
|
|
4099
|
-
constructor(_config =
|
|
4100
|
-
super(), this.
|
|
4090
|
+
constructor(_config = defaultPluginConfig, _injector, _configService) {
|
|
4091
|
+
super(), this._config = _config, this._injector = _injector, this._configService = _configService;
|
|
4092
|
+
const { ...rest } = this._config;
|
|
4093
|
+
this._configService.setConfig(PLUGIN_CONFIG_KEY, rest), this._initializeDependencies(_injector), this._initializeCommands();
|
|
4101
4094
|
}
|
|
4102
4095
|
_initializeCommands() {
|
|
4103
4096
|
[
|
|
@@ -4175,7 +4168,6 @@ let UniverDocsPlugin = (_a9 = class extends Plugin {
|
|
|
4175
4168
|
}
|
|
4176
4169
|
],
|
|
4177
4170
|
[TextSelectionManagerService],
|
|
4178
|
-
[DocCustomRangeService],
|
|
4179
4171
|
[DocAutoFormatService],
|
|
4180
4172
|
// controllers
|
|
4181
4173
|
[NormalInputController],
|
|
@@ -4186,7 +4178,8 @@ let UniverDocsPlugin = (_a9 = class extends Plugin {
|
|
|
4186
4178
|
}
|
|
4187
4179
|
}, __name(_a9, "UniverDocsPlugin"), __publicField(_a9, "pluginName", PLUGIN_NAME), __publicField(_a9, "type", UniverInstanceType.UNIVER_DOC), _a9);
|
|
4188
4180
|
UniverDocsPlugin = __decorateClass$1([
|
|
4189
|
-
__decorateParam$1(1, Inject(Injector))
|
|
4181
|
+
__decorateParam$1(1, Inject(Injector)),
|
|
4182
|
+
__decorateParam$1(2, IConfigService)
|
|
4190
4183
|
], UniverDocsPlugin);
|
|
4191
4184
|
const getPlainTextFormBody = /* @__PURE__ */ __name((body) => {
|
|
4192
4185
|
let str = body.dataStream;
|
|
@@ -4234,7 +4227,10 @@ function addCustomRangeTextX(param, body) {
|
|
|
4234
4227
|
}), textX;
|
|
4235
4228
|
}
|
|
4236
4229
|
__name(addCustomRangeTextX, "addCustomRangeTextX");
|
|
4237
|
-
function addCustomRangeFactory(param, body) {
|
|
4230
|
+
function addCustomRangeFactory(accessor, param, body) {
|
|
4231
|
+
const { unitId, segmentId } = param, documentDataModel = accessor.get(IUniverInstanceService).getUnit(unitId);
|
|
4232
|
+
if (!documentDataModel)
|
|
4233
|
+
return !1;
|
|
4238
4234
|
const doMutation = {
|
|
4239
4235
|
id: RichTextEditingMutation.id,
|
|
4240
4236
|
params: {
|
|
@@ -4243,12 +4239,15 @@ function addCustomRangeFactory(param, body) {
|
|
|
4243
4239
|
textRanges: void 0
|
|
4244
4240
|
}
|
|
4245
4241
|
}, jsonX = JSONX.getInstance(), textX = addCustomRangeTextX(param, body);
|
|
4246
|
-
|
|
4242
|
+
if (!textX)
|
|
4243
|
+
return !1;
|
|
4244
|
+
const path = getRichTextEditPath(documentDataModel, segmentId);
|
|
4245
|
+
return doMutation.params.actions = jsonX.editOp(textX.serialize(), path), doMutation;
|
|
4247
4246
|
}
|
|
4248
4247
|
__name(addCustomRangeFactory, "addCustomRangeFactory");
|
|
4249
4248
|
function addCustomRangeBySelectionFactory(accessor, param) {
|
|
4250
4249
|
var _a11;
|
|
4251
|
-
const { rangeId, rangeType, wholeEntity } = param, textSelectionManagerService = accessor.get(TextSelectionManagerService), univerInstanceService = accessor.get(IUniverInstanceService), selection = textSelectionManagerService.getActiveTextRangeWithStyle(), segmentId = selection == null ? void 0 : selection.segmentId;
|
|
4250
|
+
const { rangeId, rangeType, wholeEntity, properties } = param, textSelectionManagerService = accessor.get(TextSelectionManagerService), univerInstanceService = accessor.get(IUniverInstanceService), selection = textSelectionManagerService.getActiveTextRangeWithStyle(), segmentId = selection == null ? void 0 : selection.segmentId;
|
|
4252
4251
|
if (!selection)
|
|
4253
4252
|
return !1;
|
|
4254
4253
|
const documentDataModel = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
|
|
@@ -4306,7 +4305,8 @@ function addCustomRangeBySelectionFactory(accessor, param) {
|
|
|
4306
4305
|
rangeType,
|
|
4307
4306
|
startIndex: -(range.endOffset - range.startOffset - deletes.length + 1),
|
|
4308
4307
|
endIndex: 0,
|
|
4309
|
-
wholeEntity
|
|
4308
|
+
wholeEntity,
|
|
4309
|
+
properties
|
|
4310
4310
|
}
|
|
4311
4311
|
]
|
|
4312
4312
|
},
|
|
@@ -4568,7 +4568,6 @@ export {
|
|
|
4568
4568
|
DeleteLeftCommand,
|
|
4569
4569
|
DeleteRightCommand,
|
|
4570
4570
|
DocAutoFormatService,
|
|
4571
|
-
DocCustomRangeService,
|
|
4572
4571
|
DocInterceptorService,
|
|
4573
4572
|
DocSkeletonManagerService,
|
|
4574
4573
|
DocStateChangeManagerService,
|
|
@@ -4623,8 +4622,10 @@ export {
|
|
|
4623
4622
|
addCustomDecorationFactory,
|
|
4624
4623
|
addCustomRangeBySelectionFactory,
|
|
4625
4624
|
addCustomRangeFactory,
|
|
4625
|
+
copyCustomRange,
|
|
4626
4626
|
deleteCustomDecorationFactory,
|
|
4627
4627
|
deleteCustomRangeFactory,
|
|
4628
|
+
findNearestSectionBreak,
|
|
4628
4629
|
genTableSource,
|
|
4629
4630
|
generateParagraphs,
|
|
4630
4631
|
getCommandSkeleton,
|
|
@@ -7,11 +7,12 @@ interface IAddCustomRangeParam {
|
|
|
7
7
|
rangeId: string;
|
|
8
8
|
rangeType: CustomRangeType;
|
|
9
9
|
}
|
|
10
|
-
export declare function addCustomRangeFactory(param: IAddCustomRangeParam, body: IDocumentBody): false | IMutationInfo<IRichTextEditingMutationParams>;
|
|
10
|
+
export declare function addCustomRangeFactory(accessor: IAccessor, param: IAddCustomRangeParam, body: IDocumentBody): false | IMutationInfo<IRichTextEditingMutationParams>;
|
|
11
11
|
interface IAddCustomRangeFactoryParam {
|
|
12
12
|
rangeId: string;
|
|
13
13
|
rangeType: CustomRangeType;
|
|
14
14
|
wholeEntity?: boolean;
|
|
15
|
+
properties?: Record<string, any>;
|
|
15
16
|
}
|
|
16
17
|
export declare function addCustomRangeBySelectionFactory(accessor: IAccessor, param: IAddCustomRangeFactoryParam): false | IMutationInfo<IRichTextEditingMutationParams>;
|
|
17
18
|
export interface IDeleteCustomRangeParam {
|
|
@@ -2,4 +2,12 @@ import { ICustomRange, ITextRange, DataStreamTreeTokenType } from '@univerjs/cor
|
|
|
2
2
|
export declare function isCustomRangeSplitSymbol(text: string): text is DataStreamTreeTokenType.CUSTOM_RANGE_START | DataStreamTreeTokenType.CUSTOM_RANGE_END;
|
|
3
3
|
export declare function isIntersecting(line1Start: number, line1End: number, line2Start: number, line2End: number): boolean;
|
|
4
4
|
export declare function shouldDeleteCustomRange(deleteStart: number, deleteLen: number, customRange: ICustomRange, dataStream: string): boolean;
|
|
5
|
-
export declare function getCustomRangesInterestsWithRange(range: ITextRange, customRanges: ICustomRange[]): ICustomRange[];
|
|
5
|
+
export declare function getCustomRangesInterestsWithRange(range: ITextRange, customRanges: ICustomRange[]): ICustomRange<Record<string, any>>[];
|
|
6
|
+
export declare function copyCustomRange(range: ICustomRange): {
|
|
7
|
+
rangeId: string;
|
|
8
|
+
startIndex: number;
|
|
9
|
+
endIndex: number;
|
|
10
|
+
rangeType: import('@univerjs/core').CustomRangeType | number;
|
|
11
|
+
wholeEntity?: boolean;
|
|
12
|
+
properties?: Record<string, any> | undefined;
|
|
13
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare const PLUGIN_CONFIG_KEY = "docs.config";
|
|
17
|
+
export declare const configSymbol: unique symbol;
|
|
18
|
+
export interface IUniverDocsConfig {
|
|
19
|
+
}
|
|
20
|
+
export declare const defaultPluginConfig: IUniverDocsConfig;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Injector, Plugin, UniverInstanceType } from '@univerjs/core';
|
|
2
|
-
|
|
3
|
-
hasScroll?: boolean;
|
|
4
|
-
}
|
|
1
|
+
import { IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
|
|
2
|
+
import { IUniverDocsConfig } from './controllers/config.schema';
|
|
5
3
|
export declare class UniverDocsPlugin extends Plugin {
|
|
4
|
+
private readonly _config;
|
|
6
5
|
_injector: Injector;
|
|
6
|
+
private readonly _configService;
|
|
7
7
|
static pluginName: string;
|
|
8
8
|
static type: UniverInstanceType;
|
|
9
|
-
constructor(_config: Partial<IUniverDocsConfig
|
|
9
|
+
constructor(_config: Partial<IUniverDocsConfig>, _injector: Injector, _configService: IConfigService);
|
|
10
10
|
private _initializeCommands;
|
|
11
11
|
private _initializeDependencies;
|
|
12
12
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -13,20 +13,18 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export {
|
|
17
|
-
export { getParagraphsInRange, getParagraphsInRanges } from './commands/commands/list.command';
|
|
16
|
+
export { getParagraphsInRange, getParagraphsInRanges, findNearestSectionBreak } from './commands/commands/list.command';
|
|
18
17
|
export { replaceSelectionFactory } from './basics/replace';
|
|
19
18
|
export { makeSelection, getSelectionText, getDeleteSelection, getInsertSelection, isSegmentIntersects } from './basics/selection';
|
|
20
19
|
export { hasParagraphInTable } from './basics/paragraph';
|
|
21
20
|
export type { IDocObjectParam } from './basics/component-tools';
|
|
22
21
|
export { getDocObject, neoGetDocObject, getDocObjectById } from './basics/component-tools';
|
|
23
22
|
export * from './basics/docs-view-key';
|
|
24
|
-
export {
|
|
23
|
+
export { UniverDocsPlugin } from './doc-plugin';
|
|
25
24
|
export { DocSkeletonManagerService } from './services/doc-skeleton-manager.service';
|
|
26
25
|
export { TextSelectionManagerService, serializeDocRange } from './services/text-selection-manager.service';
|
|
27
26
|
export { DocStateChangeManagerService, type IDocStateChangeParams } from './services/doc-state-change-manager.service';
|
|
28
27
|
export { IMEInputManagerService } from './services/ime-input-manager.service';
|
|
29
|
-
export { DocCustomRangeService, type ICustomRangeHook } from './services/doc-custom-range.service';
|
|
30
28
|
export { BreakLineCommand } from './commands/commands/break-line.command';
|
|
31
29
|
export { CutContentCommand, InnerPasteCommand } from './commands/commands/clipboard.inner.command';
|
|
32
30
|
export { InsertCommand, DeleteCommand, UpdateCommand, EditorInsertTextCommandId, type ICoverCommandParams, type IDeleteCommandParams, type IInsertCommandParams, type IUpdateCommandParams, } from './commands/commands/core-editing.command';
|
|
@@ -48,6 +46,7 @@ export { getRichTextEditPath } from './commands/util';
|
|
|
48
46
|
export { getPlainTextFormDocument, getPlainTextFormBody } from './basics/plain-text';
|
|
49
47
|
export { addCustomRangeFactory, addCustomRangeBySelectionFactory, deleteCustomRangeFactory } from './basics/custom-range-factory';
|
|
50
48
|
export { addCustomDecorationBySelectionFactory, addCustomDecorationFactory, deleteCustomDecorationFactory } from './basics/custom-decoration-factory';
|
|
49
|
+
export { getCustomRangesInterestsWithRange, copyCustomRange } from './basics/custom-range';
|
|
51
50
|
export { DocInterceptorService } from './services/doc-interceptor/doc-interceptor.service';
|
|
52
51
|
export { DOC_INTERCEPTOR_POINT } from './services/doc-interceptor/interceptor-const';
|
|
53
52
|
export { DocAutoFormatService } from './services/doc-auto-format.service';
|