@univerjs/docs 0.2.5 → 0.2.7
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 +4 -1
- package/lib/es/index.js +3808 -2183
- package/lib/types/basics/custom-decoration-factory.d.ts +1 -1
- package/lib/types/basics/custom-range.d.ts +2 -1
- package/lib/types/basics/selection.d.ts +2 -5
- package/lib/types/basics/table.d.ts +19 -0
- package/lib/types/commands/commands/__tests__/mock-text-selection-render-manager.d.ts +2 -2
- package/lib/types/commands/commands/auto-format.command.d.ts +8 -0
- package/lib/types/commands/commands/break-line.command.d.ts +2 -1
- package/lib/types/commands/commands/clipboard.inner.command.d.ts +2 -2
- package/lib/types/commands/commands/delete.command.d.ts +3 -2
- package/lib/types/commands/commands/inline-format.command.d.ts +0 -1
- package/lib/types/commands/commands/list.command.d.ts +28 -2
- package/lib/types/commands/commands/table/doc-table-create.command.d.ts +11 -0
- package/lib/types/commands/commands/table/doc-table-delete.command.d.ts +11 -0
- package/lib/types/commands/commands/table/doc-table-insert.command.d.ts +35 -0
- package/lib/types/commands/commands/table/doc-table-tab.command.d.ts +8 -0
- package/lib/types/commands/commands/table/table.d.ts +85 -0
- package/lib/types/commands/mutations/docs-rename.mutation.d.ts +7 -0
- package/lib/types/controllers/ime-input.controller.d.ts +3 -1
- package/lib/types/index.d.ts +23 -7
- package/lib/types/services/doc-auto-format.service.d.ts +38 -0
- package/lib/types/services/text-selection-manager.service.d.ts +14 -11
- package/lib/umd/index.js +4 -1
- package/package.json +10 -9
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ICustomRange, DataStreamTreeTokenType } from '@univerjs/core';
|
|
1
|
+
import { ICustomRange, ITextRange, DataStreamTreeTokenType } from '@univerjs/core';
|
|
2
2
|
|
|
3
3
|
export declare function isCustomRangeSplitSymbol(text: string): text is DataStreamTreeTokenType.CUSTOM_RANGE_START | DataStreamTreeTokenType.CUSTOM_RANGE_END;
|
|
4
4
|
export declare function isIntersecting(line1Start: number, line1End: number, line2Start: number, line2End: number): boolean;
|
|
5
5
|
export declare function shouldDeleteCustomRange(deleteStart: number, deleteLen: number, customRange: ICustomRange, dataStream: string): boolean;
|
|
6
|
+
export declare function getCustomRangesIntesetsWithRange(range: ITextRange, customRanges: ICustomRange[]): ICustomRange[];
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { IDocumentBody, ITextRange, Nullable } from '@univerjs/core';
|
|
2
2
|
import { DeleteDirection } from '../types/enums/delete-direction';
|
|
3
3
|
|
|
4
|
-
export declare function
|
|
5
|
-
|
|
6
|
-
endOffset: number;
|
|
7
|
-
collapsed: boolean;
|
|
8
|
-
};
|
|
4
|
+
export declare function makeSelection(startOffset: number, endOffset?: number): ITextRange;
|
|
5
|
+
export declare function normalizeSelection(selection: ITextRange): ITextRange;
|
|
9
6
|
export declare function getSelectionWithSymbolMax(selection: ITextRange, body: IDocumentBody): {
|
|
10
7
|
startOffset: number;
|
|
11
8
|
endOffset: number;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Nullable } from '@univerjs/core';
|
|
2
|
+
import { IDocumentSkeletonLine, IDocumentSkeletonPage, IDocumentSkeletonTable } from '@univerjs/engine-render';
|
|
3
|
+
|
|
4
|
+
export declare function firstLineInTable(table: IDocumentSkeletonTable): IDocumentSkeletonLine;
|
|
5
|
+
export declare function lastLineInTable(table: IDocumentSkeletonTable): IDocumentSkeletonLine | undefined;
|
|
6
|
+
export declare function findTableAfterLine(line: IDocumentSkeletonLine, page: IDocumentSkeletonPage): IDocumentSkeletonTable | null;
|
|
7
|
+
export declare function findLineBeforeAndAfterTable(table: Nullable<IDocumentSkeletonTable>): {
|
|
8
|
+
lineBeforeTable: null;
|
|
9
|
+
lineAfterTable: null;
|
|
10
|
+
};
|
|
11
|
+
export declare function findBellowCell(cell: IDocumentSkeletonPage): IDocumentSkeletonPage | undefined;
|
|
12
|
+
export declare function findAboveCell(cell: IDocumentSkeletonPage): IDocumentSkeletonPage | undefined;
|
|
13
|
+
export declare function findNextCell(cell: IDocumentSkeletonPage): void;
|
|
14
|
+
export declare function findPrevCell(cell: IDocumentSkeletonPage): void;
|
|
15
|
+
export declare function findTableBeforeLine(line: IDocumentSkeletonLine, page: IDocumentSkeletonPage): IDocumentSkeletonTable | null;
|
|
16
|
+
export declare function firstLineInCell(cell: IDocumentSkeletonPage): IDocumentSkeletonLine;
|
|
17
|
+
export declare function lastLineInCell(cell: IDocumentSkeletonPage): IDocumentSkeletonLine | undefined;
|
|
18
|
+
export declare function isFirstLineInCell(line: IDocumentSkeletonLine, cell: IDocumentSkeletonPage): boolean;
|
|
19
|
+
export declare function isLastLineInCell(line: IDocumentSkeletonLine, cell: IDocumentSkeletonPage): boolean;
|
|
@@ -4,7 +4,7 @@ import { ITextSelectionInnerParam } from '@univerjs/engine-render';
|
|
|
4
4
|
export declare class TextSelectionRenderManager {
|
|
5
5
|
private readonly _textSelectionInner$;
|
|
6
6
|
readonly textSelectionInner$: import('rxjs').Observable<Nullable<ITextSelectionInnerParam>>;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
removeAllRanges(): void;
|
|
8
|
+
addDocRanges(): void;
|
|
9
9
|
}
|
|
10
10
|
export declare const ITextSelectionRenderManager: import('@univerjs/core').IdentifierDecorator<TextSelectionRenderManager>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ICommand } from '@univerjs/core';
|
|
2
|
+
|
|
3
|
+
export interface ITabCommandParams {
|
|
4
|
+
shift?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const TabCommand: ICommand<ITabCommandParams>;
|
|
7
|
+
export declare const AfterSpaceCommand: ICommand;
|
|
8
|
+
export declare const EnterCommand: ICommand;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ICommand,
|
|
1
|
+
import { ICommand, IDocumentData, ITextRange } from '@univerjs/core';
|
|
2
2
|
import { ITextRangeWithStyle } from '@univerjs/engine-render';
|
|
3
3
|
|
|
4
4
|
export interface IInnerPasteCommandParams {
|
|
5
5
|
segmentId: string;
|
|
6
|
-
|
|
6
|
+
doc: Partial<IDocumentData>;
|
|
7
7
|
textRanges: ITextRangeWithStyle[];
|
|
8
8
|
}
|
|
9
9
|
export declare const InnerPasteCommand: ICommand<IInnerPasteCommandParams>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ICommand } from '@univerjs/core';
|
|
2
|
-
import { IActiveTextRange } from '@univerjs/engine-render';
|
|
1
|
+
import { ICommand, Nullable } from '@univerjs/core';
|
|
2
|
+
import { IActiveTextRange, RectRange, TextRange } from '@univerjs/engine-render';
|
|
3
3
|
import { DeleteDirection } from '../../types/enums/delete-direction';
|
|
4
4
|
|
|
5
5
|
export interface IDeleteCustomBlockParams {
|
|
@@ -14,6 +14,7 @@ interface IMergeTwoParagraphParams {
|
|
|
14
14
|
range: IActiveTextRange;
|
|
15
15
|
}
|
|
16
16
|
export declare const MergeTwoParagraphCommand: ICommand<IMergeTwoParagraphParams>;
|
|
17
|
+
export declare function getCursorWhenDelete(textRanges: Readonly<Nullable<TextRange[]>>, rectRanges: readonly RectRange[]): number;
|
|
17
18
|
export declare const DeleteLeftCommand: ICommand;
|
|
18
19
|
export declare const DeleteRightCommand: ICommand;
|
|
19
20
|
export {};
|
|
@@ -1,16 +1,42 @@
|
|
|
1
|
-
import { ICommand, IParagraph, ISectionBreak, PresetListType } from '@univerjs/core';
|
|
2
|
-
import { IActiveTextRange } from '@univerjs/engine-render';
|
|
1
|
+
import { ICommand, IParagraph, IParagraphRange, ISectionBreak, PresetListType } from '@univerjs/core';
|
|
2
|
+
import { IActiveTextRange, IDocRange } from '@univerjs/engine-render';
|
|
3
3
|
|
|
4
4
|
interface IListOperationCommandParams {
|
|
5
5
|
listType: PresetListType;
|
|
6
6
|
}
|
|
7
7
|
export declare const ListOperationCommand: ICommand<IListOperationCommandParams>;
|
|
8
|
+
interface IChangeListTypeCommandParams {
|
|
9
|
+
listType: PresetListType;
|
|
10
|
+
}
|
|
11
|
+
export declare const ChangeListTypeCommand: ICommand<IChangeListTypeCommandParams>;
|
|
12
|
+
export declare enum ChangeListNestingLevelType {
|
|
13
|
+
increase = 1,
|
|
14
|
+
decrease = -1
|
|
15
|
+
}
|
|
16
|
+
interface IChangeListNestingLevelCommandParams {
|
|
17
|
+
type: ChangeListNestingLevelType;
|
|
18
|
+
}
|
|
19
|
+
export declare const ChangeListNestingLevelCommand: ICommand<IChangeListNestingLevelCommandParams>;
|
|
8
20
|
interface IBulletListCommandParams {
|
|
21
|
+
value?: PresetListType;
|
|
9
22
|
}
|
|
10
23
|
export declare const BulletListCommand: ICommand<IBulletListCommandParams>;
|
|
24
|
+
export declare const CheckListCommand: ICommand<IBulletListCommandParams>;
|
|
25
|
+
export interface IToggleCheckListCommandParams {
|
|
26
|
+
index: number;
|
|
27
|
+
}
|
|
28
|
+
export declare const ToggleCheckListCommand: ICommand<IToggleCheckListCommandParams>;
|
|
11
29
|
interface IOrderListCommandParams {
|
|
30
|
+
value?: PresetListType;
|
|
12
31
|
}
|
|
13
32
|
export declare const OrderListCommand: ICommand<IOrderListCommandParams>;
|
|
33
|
+
interface IQuickListCommandParams {
|
|
34
|
+
listType: PresetListType;
|
|
35
|
+
paragraph: IParagraphRange;
|
|
36
|
+
}
|
|
37
|
+
export declare const QuickListCommand: ICommand<IQuickListCommandParams>;
|
|
14
38
|
export declare function getParagraphsInRange(activeRange: IActiveTextRange, paragraphs: IParagraph[]): IParagraph[];
|
|
39
|
+
export declare function getParagraphsRelative(ranges: IDocRange[], paragraphs: IParagraph[]): IParagraph[];
|
|
40
|
+
export declare function getParagraphsInRanges(ranges: IDocRange[], paragraphs: IParagraph[]): IParagraph[];
|
|
15
41
|
export declare function findNearestSectionBreak(currentIndex: number, sectionBreaks: ISectionBreak[]): ISectionBreak | undefined;
|
|
16
42
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ICommand } from '@univerjs/core';
|
|
2
|
+
|
|
3
|
+
export declare const CreateDocTableCommandId = "doc.command.create-table";
|
|
4
|
+
export interface ICreateDocTableCommandParams {
|
|
5
|
+
rowCount: number;
|
|
6
|
+
colCount: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The command to create a table at cursor point.
|
|
10
|
+
*/
|
|
11
|
+
export declare const CreateDocTableCommand: ICommand<ICreateDocTableCommandParams>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ICommand } from '@univerjs/core';
|
|
2
|
+
|
|
3
|
+
export interface IDocTableDeleteRowsCommandParams {
|
|
4
|
+
}
|
|
5
|
+
export declare const DocTableDeleteRowsCommand: ICommand<IDocTableDeleteRowsCommandParams>;
|
|
6
|
+
export interface IDocTableDeleteColumnsCommandParams {
|
|
7
|
+
}
|
|
8
|
+
export declare const DocTableDeleteColumnsCommand: ICommand<IDocTableDeleteColumnsCommandParams>;
|
|
9
|
+
export interface IDocTableDeleteTableCommandParams {
|
|
10
|
+
}
|
|
11
|
+
export declare const DocTableDeleteTableCommand: ICommand<IDocTableDeleteTableCommandParams>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ICommand } from '@univerjs/core';
|
|
2
|
+
import { INSERT_COLUMN_POSITION, INSERT_ROW_POSITION } from './table';
|
|
3
|
+
|
|
4
|
+
export declare const DocTableInsertRowCommandId = "doc.command.table-insert-row";
|
|
5
|
+
export declare const DocTableInsertColumnCommandId = "doc.command.table-insert-column";
|
|
6
|
+
export declare const DocTableInsertRowAboveCommandId = "doc.command.table-insert-row-above";
|
|
7
|
+
export declare const DocTableInsertRowBellowCommandId = "doc.command.table-insert-row-bellow";
|
|
8
|
+
export declare const DocTableInsertColumnLeftCommandId = "doc.command.table-insert-column-left";
|
|
9
|
+
export declare const DocTableInsertColumnRightCommandId = "doc.command.table-insert-column-right";
|
|
10
|
+
export interface IDocTableInsertRowAboveCommandParams {
|
|
11
|
+
}
|
|
12
|
+
export declare const DocTableInsertRowAboveCommand: ICommand<IDocTableInsertRowAboveCommandParams>;
|
|
13
|
+
export interface IDocTableInsertRowBellowCommandParams {
|
|
14
|
+
}
|
|
15
|
+
export declare const DocTableInsertRowBellowCommand: ICommand<IDocTableInsertRowBellowCommandParams>;
|
|
16
|
+
export interface IDocTableInsertColumnLeftCommandParams {
|
|
17
|
+
}
|
|
18
|
+
export declare const DocTableInsertColumnLeftCommand: ICommand<IDocTableInsertColumnLeftCommandParams>;
|
|
19
|
+
export interface IDocTableInsertColumnRightCommandParams {
|
|
20
|
+
}
|
|
21
|
+
export declare const DocTableInsertColumnRightCommand: ICommand<IDocTableInsertColumnRightCommandParams>;
|
|
22
|
+
export interface IDocTableInsertRowCommandParams {
|
|
23
|
+
position: INSERT_ROW_POSITION;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The command to insert table row.
|
|
27
|
+
*/
|
|
28
|
+
export declare const DocTableInsertRowCommand: ICommand<IDocTableInsertRowCommandParams>;
|
|
29
|
+
export interface IDocTableInsertColumnCommandParams {
|
|
30
|
+
position: INSERT_COLUMN_POSITION;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The command to insert table column.
|
|
34
|
+
*/
|
|
35
|
+
export declare const DocTableInsertColumnCommand: ICommand<IDocTableInsertColumnCommandParams>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ICommand } from '@univerjs/core';
|
|
2
|
+
|
|
3
|
+
export interface IDocTableTabCommandParams {
|
|
4
|
+
}
|
|
5
|
+
export declare const DocTableTabCommand: ICommand<IDocTableTabCommandParams>;
|
|
6
|
+
export interface IDocTableShiftTabCommandParams {
|
|
7
|
+
}
|
|
8
|
+
export declare const DocTableShiftTabCommand: ICommand<IDocTableShiftTabCommandParams>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { IParagraph, ISectionBreak, ITable, ITableCell, ITableColumn, ITableRow, Nullable } from '@univerjs/core';
|
|
2
|
+
import { DocumentViewModel, RectRange, TextRange } from '@univerjs/engine-render';
|
|
3
|
+
|
|
4
|
+
export declare enum INSERT_ROW_POSITION {
|
|
5
|
+
ABOVE = 0,
|
|
6
|
+
BELLOW = 1
|
|
7
|
+
}
|
|
8
|
+
export declare enum INSERT_COLUMN_POSITION {
|
|
9
|
+
LEFT = 0,
|
|
10
|
+
RIGHT = 1
|
|
11
|
+
}
|
|
12
|
+
export declare function genEmptyTable(rowCount: number, colCount: number): {
|
|
13
|
+
dataStream: string;
|
|
14
|
+
paragraphs: IParagraph[];
|
|
15
|
+
sectionBreaks: ISectionBreak[];
|
|
16
|
+
};
|
|
17
|
+
export declare function getEmptyTableCell(): ITableCell;
|
|
18
|
+
export declare function getEmptyTableRow(col: number): ITableRow;
|
|
19
|
+
export declare function getTableColumn(width: number): ITableColumn;
|
|
20
|
+
export declare function genTableSource(rowCount: number, colCount: number, pageContentWidth: number): ITable;
|
|
21
|
+
interface IRangeInfo {
|
|
22
|
+
startOffset: number;
|
|
23
|
+
endOffset: number;
|
|
24
|
+
segmentId: string;
|
|
25
|
+
}
|
|
26
|
+
export declare function getRangeInfoFromRanges(textRange: Nullable<TextRange>, rectRanges: Readonly<Nullable<RectRange[]>>): Nullable<IRangeInfo>;
|
|
27
|
+
export declare function getInsertRowBody(col: number): {
|
|
28
|
+
dataStream: string;
|
|
29
|
+
paragraphs: IParagraph[];
|
|
30
|
+
sectionBreaks: ISectionBreak[];
|
|
31
|
+
};
|
|
32
|
+
export declare function getInsertColumnBody(): {
|
|
33
|
+
dataStream: string;
|
|
34
|
+
paragraphs: IParagraph[];
|
|
35
|
+
sectionBreaks: ISectionBreak[];
|
|
36
|
+
};
|
|
37
|
+
export declare function getInsertRowActionsParams(rangeInfo: IRangeInfo, position: INSERT_ROW_POSITION, viewModel: DocumentViewModel): {
|
|
38
|
+
offset: number;
|
|
39
|
+
colCount: number;
|
|
40
|
+
tableId: string;
|
|
41
|
+
insertRowIndex: number;
|
|
42
|
+
} | null;
|
|
43
|
+
export declare function getInsertColumnActionsParams(rangeInfo: IRangeInfo, position: INSERT_COLUMN_POSITION, viewModel: DocumentViewModel): {
|
|
44
|
+
offsets: number[];
|
|
45
|
+
tableId: string;
|
|
46
|
+
columnIndex: number;
|
|
47
|
+
rowCount: number;
|
|
48
|
+
} | null;
|
|
49
|
+
export declare function getColumnWidths(pageWidth: number, tableColumns: ITableColumn[], insertColumnIndex: number): {
|
|
50
|
+
widths: number[];
|
|
51
|
+
newColWidth: number;
|
|
52
|
+
};
|
|
53
|
+
export declare function getDeleteRowsActionsParams(rangeInfo: IRangeInfo, viewModel: DocumentViewModel): {
|
|
54
|
+
tableId: string;
|
|
55
|
+
rowIndexes: number[];
|
|
56
|
+
offset: number;
|
|
57
|
+
len: number;
|
|
58
|
+
cursor: number;
|
|
59
|
+
selectWholeTable: boolean;
|
|
60
|
+
} | null;
|
|
61
|
+
interface IRetainDeleteOffset {
|
|
62
|
+
retain: number;
|
|
63
|
+
delete: number;
|
|
64
|
+
}
|
|
65
|
+
export declare function getDeleteColumnsActionParams(rangeInfo: IRangeInfo, viewModel: DocumentViewModel): {
|
|
66
|
+
offsets: IRetainDeleteOffset[];
|
|
67
|
+
tableId: string;
|
|
68
|
+
columnIndexes: number[];
|
|
69
|
+
cursor: number;
|
|
70
|
+
selectWholeTable: boolean;
|
|
71
|
+
rowCount: number;
|
|
72
|
+
} | null;
|
|
73
|
+
export declare function getDeleteTableActionParams(rangeInfo: IRangeInfo, viewModel: DocumentViewModel): {
|
|
74
|
+
tableId: string;
|
|
75
|
+
offset: number;
|
|
76
|
+
len: number;
|
|
77
|
+
cursor: number;
|
|
78
|
+
} | null;
|
|
79
|
+
export declare function getDeleteRowContentActionParams(rangeInfo: IRangeInfo, viewModel: DocumentViewModel): {
|
|
80
|
+
offsets: IRetainDeleteOffset[];
|
|
81
|
+
tableId: string;
|
|
82
|
+
cursor: number;
|
|
83
|
+
rowCount: number;
|
|
84
|
+
} | null;
|
|
85
|
+
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
|
|
2
2
|
import { IRenderManagerService, ITextSelectionRenderManager } from '@univerjs/engine-render';
|
|
3
3
|
import { IMEInputManagerService } from '../services/ime-input-manager.service';
|
|
4
|
+
import { TextSelectionManagerService } from '../services/text-selection-manager.service';
|
|
4
5
|
|
|
5
6
|
export declare class IMEInputController extends Disposable {
|
|
6
7
|
private readonly _univerInstanceService;
|
|
7
8
|
private readonly _renderManagerSrv;
|
|
8
9
|
private readonly _textSelectionRenderManager;
|
|
10
|
+
private readonly _textSelectionManagerService;
|
|
9
11
|
private readonly _imeInputManagerService;
|
|
10
12
|
private readonly _commandService;
|
|
11
13
|
private _previousIMEContent;
|
|
@@ -13,7 +15,7 @@ export declare class IMEInputController extends Disposable {
|
|
|
13
15
|
private _onStartSubscription;
|
|
14
16
|
private _onUpdateSubscription;
|
|
15
17
|
private _onEndSubscription;
|
|
16
|
-
constructor(_univerInstanceService: IUniverInstanceService, _renderManagerSrv: IRenderManagerService, _textSelectionRenderManager: ITextSelectionRenderManager, _imeInputManagerService: IMEInputManagerService, _commandService: ICommandService);
|
|
18
|
+
constructor(_univerInstanceService: IUniverInstanceService, _renderManagerSrv: IRenderManagerService, _textSelectionRenderManager: ITextSelectionRenderManager, _textSelectionManagerService: TextSelectionManagerService, _imeInputManagerService: IMEInputManagerService, _commandService: ICommandService);
|
|
17
19
|
dispose(): void;
|
|
18
20
|
private _initialize;
|
|
19
21
|
private _initialOnCompositionstart;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -13,14 +13,15 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
export { getParagraphsInRange, getParagraphsInRanges } from './commands/commands/list.command';
|
|
16
17
|
export { replaceSelectionFactory } from './basics/replace';
|
|
17
|
-
export { getSelectionText, getDeleteSelection, getInsertSelection, isSegmentIntersects } from './basics/selection';
|
|
18
|
+
export { makeSelection, getSelectionText, getDeleteSelection, getInsertSelection, isSegmentIntersects } from './basics/selection';
|
|
18
19
|
export type { IDocObjectParam } from './basics/component-tools';
|
|
19
20
|
export { getDocObject, neoGetDocObject, getDocObjectById } from './basics/component-tools';
|
|
20
21
|
export * from './basics/docs-view-key';
|
|
21
22
|
export { type IUniverDocsConfig, UniverDocsPlugin } from './doc-plugin';
|
|
22
23
|
export { DocSkeletonManagerService } from './services/doc-skeleton-manager.service';
|
|
23
|
-
export { TextSelectionManagerService,
|
|
24
|
+
export { TextSelectionManagerService, serializeDocRange } from './services/text-selection-manager.service';
|
|
24
25
|
export { DocStateChangeManagerService, type IDocStateChangeParams } from './services/doc-state-change-manager.service';
|
|
25
26
|
export { IMEInputManagerService } from './services/ime-input-manager.service';
|
|
26
27
|
export { DocCustomRangeService, type ICustomRangeHook } from './services/doc-custom-range.service';
|
|
@@ -30,14 +31,11 @@ export { InsertCommand, DeleteCommand, UpdateCommand, EditorInsertTextCommandId,
|
|
|
30
31
|
export { DeleteLeftCommand, DeleteRightCommand, DeleteCustomBlockCommand, MergeTwoParagraphCommand, type IDeleteCustomBlockParams } from './commands/commands/delete.command';
|
|
31
32
|
export { IMEInputCommand, type IIMEInputCommandParams } from './commands/commands/ime-input.command';
|
|
32
33
|
export { SetInlineFormatBoldCommand, SetInlineFormatItalicCommand, SetInlineFormatUnderlineCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatFontSizeCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatTextColorCommand, SetInlineFormatTextBackgroundColorCommand, ResetInlineFormatTextBackgroundColorCommand, SetInlineFormatCommand, } from './commands/commands/inline-format.command';
|
|
33
|
-
export { ListOperationCommand, BulletListCommand, OrderListCommand } from './commands/commands/list.command';
|
|
34
|
+
export { ListOperationCommand, BulletListCommand, OrderListCommand, ChangeListNestingLevelCommand, ChangeListTypeCommand, CheckListCommand, ToggleCheckListCommand, QuickListCommand, } from './commands/commands/list.command';
|
|
34
35
|
export { AlignOperationCommand, AlignLeftCommand, AlignCenterCommand, AlignRightCommand, AlignJustifyCommand, } from './commands/commands/paragraph-align.command';
|
|
35
36
|
export { ReplaceContentCommand, CoverContentCommand } from './commands/commands/replace-content.command';
|
|
36
37
|
export { SetDocZoomRatioCommand } from './commands/commands/set-doc-zoom-ratio.command';
|
|
37
|
-
export {
|
|
38
|
-
export { addCustomDecorationBySelectionFactory, addCustomDecorationFactory, deleteCustomDecorationFactory } from './basics/custom-decoration-factory';
|
|
39
|
-
export { DocInterceptorService } from './services/doc-interceptor/doc-interceptor.service';
|
|
40
|
-
export { DOC_INTERCEPTOR_POINT } from './services/doc-interceptor/interceptor-const';
|
|
38
|
+
export { AfterSpaceCommand, TabCommand, EnterCommand, type ITabCommandParams } from './commands/commands/auto-format.command';
|
|
41
39
|
export { RichTextEditingMutation, type IRichTextEditingMutationParams, } from './commands/mutations/core-editing.mutation';
|
|
42
40
|
export { MoveCursorOperation, MoveSelectionOperation } from './commands/operations/cursor.operation';
|
|
43
41
|
export { SelectAllOperation } from './commands/operations/select-all.operation';
|
|
@@ -46,3 +44,21 @@ export { SetTextSelectionsOperation, type ISetTextSelectionsOperationParams, } f
|
|
|
46
44
|
export { getRetainAndDeleteFromReplace } from './basics/retain-delete-params';
|
|
47
45
|
export { getRichTextEditPath } from './commands/util';
|
|
48
46
|
export { getPlainTextFormDocument } from './basics/plain-text';
|
|
47
|
+
export { addCustomRangeFactory, addCustomRangeBySelectionFactory, deleteCustomRangeFactory } from './basics/custom-range-factory';
|
|
48
|
+
export { addCustomDecorationBySelectionFactory, addCustomDecorationFactory, deleteCustomDecorationFactory } from './basics/custom-decoration-factory';
|
|
49
|
+
export { DocInterceptorService } from './services/doc-interceptor/doc-interceptor.service';
|
|
50
|
+
export { DOC_INTERCEPTOR_POINT } from './services/doc-interceptor/interceptor-const';
|
|
51
|
+
export { DocAutoFormatService } from './services/doc-auto-format.service';
|
|
52
|
+
export { ChangeListNestingLevelType } from './commands/commands/list.command';
|
|
53
|
+
export { getCommandSkeleton } from './commands/util';
|
|
54
|
+
export { generateParagraphs } from './commands/commands/break-line.command';
|
|
55
|
+
export type { IInnerCutCommandParams } from './commands/commands/clipboard.inner.command';
|
|
56
|
+
export { CreateDocTableCommand, type ICreateDocTableCommandParams } from './commands/commands/table/doc-table-create.command';
|
|
57
|
+
export { DocTableDeleteRowsCommand, DocTableDeleteColumnsCommand, DocTableDeleteTableCommand } from './commands/commands/table/doc-table-delete.command';
|
|
58
|
+
export type { IDocTableDeleteRowsCommandParams, IDocTableDeleteColumnsCommandParams, IDocTableDeleteTableCommandParams } from './commands/commands/table/doc-table-delete.command';
|
|
59
|
+
export type { IDocTableInsertColumnCommandParams, IDocTableInsertRowCommandParams, IDocTableInsertColumnRightCommandParams, IDocTableInsertRowAboveCommandParams, IDocTableInsertRowBellowCommandParams, IDocTableInsertColumnLeftCommandParams } from './commands/commands/table/doc-table-insert.command';
|
|
60
|
+
export { DocTableInsertColumnCommand, DocTableInsertRowCommand, DocTableInsertColumnRightCommand, DocTableInsertRowAboveCommand, DocTableInsertRowBellowCommand, DocTableInsertColumnLeftCommand } from './commands/commands/table/doc-table-insert.command';
|
|
61
|
+
export type { IDocTableShiftTabCommandParams, IDocTableTabCommandParams } from './commands/commands/table/doc-table-tab.command';
|
|
62
|
+
export { DocTableTabCommand, DocTableShiftTabCommand } from './commands/commands/table/doc-table-tab.command';
|
|
63
|
+
export { genTableSource, getEmptyTableRow, getEmptyTableCell, getTableColumn } from './commands/commands/table/table';
|
|
64
|
+
export { getCursorWhenDelete } from './commands/commands/delete.command';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DocumentDataModel, ICommandInfo, ICustomRange, IDisposable, IParagraphRange, ITextRange, Nullable, Disposable, IUniverInstanceService } from '@univerjs/core';
|
|
2
|
+
import { TextSelectionManagerService } from './text-selection-manager.service';
|
|
3
|
+
|
|
4
|
+
export interface IAutoFormatContext {
|
|
5
|
+
unit: DocumentDataModel;
|
|
6
|
+
selection: ITextRange;
|
|
7
|
+
/**
|
|
8
|
+
* is selection at doc body
|
|
9
|
+
*/
|
|
10
|
+
isBody: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* selection relative paragraphs
|
|
13
|
+
*/
|
|
14
|
+
paragraphs: IParagraphRange[];
|
|
15
|
+
/**
|
|
16
|
+
* selection relative custom ranges
|
|
17
|
+
*/
|
|
18
|
+
customRanges: ICustomRange[];
|
|
19
|
+
commandId: string;
|
|
20
|
+
commandParams: Nullable<object>;
|
|
21
|
+
}
|
|
22
|
+
export interface IAutoFormat {
|
|
23
|
+
id: string;
|
|
24
|
+
match: (context: IAutoFormatContext) => boolean;
|
|
25
|
+
getMutations: (context: IAutoFormatContext) => ICommandInfo[];
|
|
26
|
+
priority?: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* service for auto-formating, handle shortcut like `Space` or `Tab`
|
|
30
|
+
*/
|
|
31
|
+
export declare class DocAutoFormatService extends Disposable {
|
|
32
|
+
private readonly _univerInstanceService;
|
|
33
|
+
private readonly _textSelectionManagerService;
|
|
34
|
+
private _matches;
|
|
35
|
+
constructor(_univerInstanceService: IUniverInstanceService, _textSelectionManagerService: TextSelectionManagerService);
|
|
36
|
+
registerAutoFormat(match: IAutoFormat): IDisposable;
|
|
37
|
+
onAutoFormat(id: string, params: Nullable<object>): ICommandInfo[];
|
|
38
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Nullable, ICommandService, RxDisposable } from '@univerjs/core';
|
|
2
|
-
import { INodePosition,
|
|
2
|
+
import { IDocRange, INodePosition, ISuccinctDocRangeParam, ITextRangeWithStyle, ITextSelectionInnerParam, ITextSelectionStyle, RANGE_DIRECTION, RectRange, TextRange, ITextSelectionRenderManager } from '@univerjs/engine-render';
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
interface IDocSelectionManagerSearchParam {
|
|
5
5
|
unitId: string;
|
|
6
6
|
subUnitId: string;
|
|
7
7
|
}
|
|
@@ -16,9 +16,9 @@ export interface ITextActiveRange {
|
|
|
16
16
|
style: ITextSelectionStyle;
|
|
17
17
|
segmentPage: number;
|
|
18
18
|
}
|
|
19
|
-
interface ITextSelectionManagerInsertParam extends
|
|
19
|
+
interface ITextSelectionManagerInsertParam extends IDocSelectionManagerSearchParam, ITextSelectionInnerParam {
|
|
20
20
|
}
|
|
21
|
-
export declare function
|
|
21
|
+
export declare function serializeDocRange(textRange: IDocRange): ITextRangeWithStyle;
|
|
22
22
|
/**
|
|
23
23
|
* This service is for text selection.
|
|
24
24
|
*/
|
|
@@ -30,17 +30,20 @@ export declare class TextSelectionManagerService extends RxDisposable {
|
|
|
30
30
|
private readonly _textSelection$;
|
|
31
31
|
readonly textSelection$: import('rxjs').Observable<Nullable<ITextSelectionManagerInsertParam>>;
|
|
32
32
|
constructor(_textSelectionRenderManager: ITextSelectionRenderManager, _commandService: ICommandService);
|
|
33
|
-
getCurrentSelection(): Nullable<
|
|
33
|
+
getCurrentSelection(): Nullable<IDocSelectionManagerSearchParam>;
|
|
34
34
|
getCurrentSelectionInfo(): ITextSelectionInnerParam | undefined;
|
|
35
35
|
dispose(): void;
|
|
36
36
|
refreshSelection(): void;
|
|
37
|
-
setCurrentSelection(param:
|
|
38
|
-
setCurrentSelectionNotRefresh(param:
|
|
39
|
-
|
|
37
|
+
setCurrentSelection(param: IDocSelectionManagerSearchParam): void;
|
|
38
|
+
setCurrentSelectionNotRefresh(param: IDocSelectionManagerSearchParam): void;
|
|
39
|
+
getCurrentTextRanges(): Readonly<Nullable<TextRange[]>>;
|
|
40
|
+
getCurrentRectRanges(): Readonly<Nullable<RectRange[]>>;
|
|
41
|
+
getDocRanges(): (TextRange | RectRange)[];
|
|
40
42
|
getActiveTextRange(): Nullable<TextRange>;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
getActiveRectRange(): Nullable<RectRange>;
|
|
44
|
+
getActiveTextRangeWithStyle(): Nullable<ITextActiveRange>;
|
|
45
|
+
add(textRanges: ISuccinctDocRangeParam[], isEditing?: boolean): void;
|
|
46
|
+
replaceTextRanges(docRanges: ISuccinctDocRangeParam[], isEditing?: boolean, options?: {
|
|
44
47
|
[key: string]: boolean;
|
|
45
48
|
}): void;
|
|
46
49
|
private _syncSelectionFromRenderService;
|