@univerjs/docs 0.2.8 → 0.2.10
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 -2
- package/lib/es/index.js +238 -173
- package/lib/types/basics/custom-range-factory.d.ts +0 -1
- package/lib/types/basics/custom-range.d.ts +1 -1
- package/lib/types/basics/paragraph.d.ts +2 -0
- package/lib/types/basics/plain-text.d.ts +5 -1
- package/lib/types/basics/replace.d.ts +2 -2
- package/lib/types/basics/selection.d.ts +1 -1
- package/lib/types/basics/table.d.ts +0 -2
- package/lib/types/commands/commands/clipboard.inner.command.d.ts +4 -2
- package/lib/types/commands/commands/core-editing.command.d.ts +0 -1
- package/lib/types/commands/commands/list.command.d.ts +1 -0
- package/lib/types/commands/commands/table/doc-table-tab.command.d.ts +1 -3
- package/lib/types/commands/commands/table/table.d.ts +10 -0
- package/lib/types/index.d.ts +6 -3
- package/lib/types/services/doc-auto-format.service.d.ts +4 -4
- package/lib/types/services/doc-interceptor/doc-interceptor.service.d.ts +2 -2
- package/lib/umd/index.js +3 -2
- package/package.json +8 -8
|
@@ -9,7 +9,6 @@ interface IAddCustomRangeParam {
|
|
|
9
9
|
}
|
|
10
10
|
export declare function addCustomRangeFactory(param: IAddCustomRangeParam, body: IDocumentBody): false | IMutationInfo<IRichTextEditingMutationParams>;
|
|
11
11
|
interface IAddCustomRangeFactoryParam {
|
|
12
|
-
segmentId?: string;
|
|
13
12
|
rangeId: string;
|
|
14
13
|
rangeType: CustomRangeType;
|
|
15
14
|
wholeEntity?: boolean;
|
|
@@ -2,4 +2,4 @@ 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
|
|
5
|
+
export declare function getCustomRangesInterestsWithRange(range: ITextRange, customRanges: ICustomRange[]): ICustomRange[];
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import { IDocumentData } from '@univerjs/core';
|
|
1
|
+
import { IDocumentBody, IDocumentData } from '@univerjs/core';
|
|
2
|
+
/**
|
|
3
|
+
* get plain text from rich-text
|
|
4
|
+
*/
|
|
5
|
+
export declare const getPlainTextFormBody: (body: IDocumentBody) => string;
|
|
2
6
|
/**
|
|
3
7
|
* get plain text from rich-text
|
|
4
8
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { IAccessor, IDeleteAction, IDocumentBody, IMutationInfo, IRetainAction, ITextRange } from '@univerjs/core';
|
|
1
|
+
import { IAccessor, IDeleteAction, IDocumentBody, IMutationInfo, IRetainAction, ITextRange, ITextRangeParam } from '@univerjs/core';
|
|
2
2
|
import { ITextRangeWithStyle } from '@univerjs/engine-render';
|
|
3
3
|
import { IRichTextEditingMutationParams } from '../commands/mutations/core-editing.mutation';
|
|
4
4
|
export declare function getRetainAndDeleteAndExcludeLineBreak(selection: ITextRange, body: IDocumentBody, segmentId?: string, memoryCursor?: number, preserveLineBreak?: boolean): Array<IRetainAction | IDeleteAction>;
|
|
5
5
|
export interface IReplaceSelectionFactoryParams {
|
|
6
6
|
unitId: string;
|
|
7
|
-
selection?:
|
|
7
|
+
selection?: ITextRangeParam;
|
|
8
8
|
originBody?: IDocumentBody;
|
|
9
9
|
/** Body to be inserted at the given position. */
|
|
10
10
|
body: IDocumentBody;
|
|
@@ -11,7 +11,7 @@ export declare function getSelectionWithNoSymbolSide(selection: ITextRange, body
|
|
|
11
11
|
endOffset: number;
|
|
12
12
|
};
|
|
13
13
|
export declare function getDeleteSelection<T extends ITextRange>(selection: T, body: IDocumentBody, direction?: DeleteDirection): T;
|
|
14
|
-
export declare function getInsertSelection(selection:
|
|
14
|
+
export declare function getInsertSelection<T extends ITextRange>(selection: T, body: IDocumentBody): T;
|
|
15
15
|
/**
|
|
16
16
|
* Ensure custom-range has a correct order,
|
|
17
17
|
* when range contains range, it won't be present as intersect. <br/>
|
|
@@ -9,8 +9,6 @@ export declare function findLineBeforeAndAfterTable(table: Nullable<IDocumentSke
|
|
|
9
9
|
};
|
|
10
10
|
export declare function findBellowCell(cell: IDocumentSkeletonPage): IDocumentSkeletonPage | undefined;
|
|
11
11
|
export declare function findAboveCell(cell: IDocumentSkeletonPage): IDocumentSkeletonPage | undefined;
|
|
12
|
-
export declare function findNextCell(cell: IDocumentSkeletonPage): void;
|
|
13
|
-
export declare function findPrevCell(cell: IDocumentSkeletonPage): void;
|
|
14
12
|
export declare function findTableBeforeLine(line: IDocumentSkeletonLine, page: IDocumentSkeletonPage): IDocumentSkeletonTable | null;
|
|
15
13
|
export declare function firstLineInCell(cell: IDocumentSkeletonPage): IDocumentSkeletonLine;
|
|
16
14
|
export declare function lastLineInCell(cell: IDocumentSkeletonPage): IDocumentSkeletonLine | undefined;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { ICommand, IDocumentData, ITextRange } from '@univerjs/core';
|
|
2
|
-
import { ITextRangeWithStyle } from '@univerjs/engine-render';
|
|
1
|
+
import { DocumentDataModel, ICommand, IDocumentBody, IDocumentData, ITextRange, JSONXActions, Nullable } from '@univerjs/core';
|
|
2
|
+
import { DocumentViewModel, ITextRangeWithStyle, RectRange, TextRange } from '@univerjs/engine-render';
|
|
3
|
+
export declare function getCustomBlockIdsInSelections(body: IDocumentBody, selections: ITextRange[]): string[];
|
|
3
4
|
export interface IInnerPasteCommandParams {
|
|
4
5
|
segmentId: string;
|
|
5
6
|
doc: Partial<IDocumentData>;
|
|
6
7
|
textRanges: ITextRangeWithStyle[];
|
|
7
8
|
}
|
|
8
9
|
export declare const InnerPasteCommand: ICommand<IInnerPasteCommandParams>;
|
|
10
|
+
export declare function getCutActionsFromDocRanges(textRanges: Readonly<Nullable<(ITextRange | TextRange)[]>>, rectRanges: Readonly<Nullable<RectRange[]>>, docDataModel: DocumentDataModel, viewModel: DocumentViewModel, segmentId: string): JSONXActions;
|
|
9
11
|
export interface IInnerCutCommandParams {
|
|
10
12
|
segmentId: string;
|
|
11
13
|
textRanges: ITextRangeWithStyle[];
|
|
@@ -23,6 +23,7 @@ export declare const BulletListCommand: ICommand<IBulletListCommandParams>;
|
|
|
23
23
|
export declare const CheckListCommand: ICommand<IBulletListCommandParams>;
|
|
24
24
|
export interface IToggleCheckListCommandParams {
|
|
25
25
|
index: number;
|
|
26
|
+
segmentId?: string;
|
|
26
27
|
}
|
|
27
28
|
export declare const ToggleCheckListCommand: ICommand<IToggleCheckListCommandParams>;
|
|
28
29
|
interface IOrderListCommandParams {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { ICommand } from '@univerjs/core';
|
|
2
2
|
export interface IDocTableTabCommandParams {
|
|
3
|
+
shift: boolean;
|
|
3
4
|
}
|
|
4
5
|
export declare const DocTableTabCommand: ICommand<IDocTableTabCommandParams>;
|
|
5
|
-
export interface IDocTableShiftTabCommandParams {
|
|
6
|
-
}
|
|
7
|
-
export declare const DocTableShiftTabCommand: ICommand<IDocTableShiftTabCommandParams>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IParagraph, ISectionBreak, ITable, ITableCell, ITableColumn, ITableRow, Nullable } from '@univerjs/core';
|
|
2
2
|
import { DocumentViewModel, RectRange, TextRange } from '@univerjs/engine-render';
|
|
3
|
+
import { ITextActiveRange } from '../../../services/text-selection-manager.service';
|
|
3
4
|
export declare enum INSERT_ROW_POSITION {
|
|
4
5
|
ABOVE = 0,
|
|
5
6
|
BELLOW = 1
|
|
@@ -81,4 +82,13 @@ export declare function getDeleteRowContentActionParams(rangeInfo: IRangeInfo, v
|
|
|
81
82
|
cursor: number;
|
|
82
83
|
rowCount: number;
|
|
83
84
|
} | null;
|
|
85
|
+
export interface IOffsets {
|
|
86
|
+
startOffset: number;
|
|
87
|
+
endOffset: number;
|
|
88
|
+
}
|
|
89
|
+
export declare enum CellPosition {
|
|
90
|
+
NEXT = 0,
|
|
91
|
+
PREV = 1
|
|
92
|
+
}
|
|
93
|
+
export declare function getCellOffsets(viewModel: DocumentViewModel, range: ITextActiveRange, position: CellPosition): Nullable<IOffsets>;
|
|
84
94
|
export {};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -13,9 +13,11 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
export { getCustomRangesInterestsWithRange } from './basics/custom-range';
|
|
16
17
|
export { getParagraphsInRange, getParagraphsInRanges } from './commands/commands/list.command';
|
|
17
18
|
export { replaceSelectionFactory } from './basics/replace';
|
|
18
19
|
export { makeSelection, getSelectionText, getDeleteSelection, getInsertSelection, isSegmentIntersects } from './basics/selection';
|
|
20
|
+
export { hasParagraphInTable } from './basics/paragraph';
|
|
19
21
|
export type { IDocObjectParam } from './basics/component-tools';
|
|
20
22
|
export { getDocObject, neoGetDocObject, getDocObjectById } from './basics/component-tools';
|
|
21
23
|
export * from './basics/docs-view-key';
|
|
@@ -43,7 +45,7 @@ export { SetDocZoomRatioOperation, type ISetDocZoomRatioOperationParams } from '
|
|
|
43
45
|
export { SetTextSelectionsOperation, type ISetTextSelectionsOperationParams, } from './commands/operations/text-selection.operation';
|
|
44
46
|
export { getRetainAndDeleteFromReplace } from './basics/retain-delete-params';
|
|
45
47
|
export { getRichTextEditPath } from './commands/util';
|
|
46
|
-
export { getPlainTextFormDocument } from './basics/plain-text';
|
|
48
|
+
export { getPlainTextFormDocument, getPlainTextFormBody } from './basics/plain-text';
|
|
47
49
|
export { addCustomRangeFactory, addCustomRangeBySelectionFactory, deleteCustomRangeFactory } from './basics/custom-range-factory';
|
|
48
50
|
export { addCustomDecorationBySelectionFactory, addCustomDecorationFactory, deleteCustomDecorationFactory } from './basics/custom-decoration-factory';
|
|
49
51
|
export { DocInterceptorService } from './services/doc-interceptor/doc-interceptor.service';
|
|
@@ -53,12 +55,13 @@ export { ChangeListNestingLevelType } from './commands/commands/list.command';
|
|
|
53
55
|
export { getCommandSkeleton } from './commands/util';
|
|
54
56
|
export { generateParagraphs } from './commands/commands/break-line.command';
|
|
55
57
|
export type { IInnerCutCommandParams } from './commands/commands/clipboard.inner.command';
|
|
58
|
+
export { getCutActionsFromDocRanges, getCustomBlockIdsInSelections } from './commands/commands/clipboard.inner.command';
|
|
56
59
|
export { CreateDocTableCommand, type ICreateDocTableCommandParams } from './commands/commands/table/doc-table-create.command';
|
|
57
60
|
export { DocTableDeleteRowsCommand, DocTableDeleteColumnsCommand, DocTableDeleteTableCommand } from './commands/commands/table/doc-table-delete.command';
|
|
58
61
|
export type { IDocTableDeleteRowsCommandParams, IDocTableDeleteColumnsCommandParams, IDocTableDeleteTableCommandParams } from './commands/commands/table/doc-table-delete.command';
|
|
59
62
|
export type { IDocTableInsertColumnCommandParams, IDocTableInsertRowCommandParams, IDocTableInsertColumnRightCommandParams, IDocTableInsertRowAboveCommandParams, IDocTableInsertRowBellowCommandParams, IDocTableInsertColumnLeftCommandParams } from './commands/commands/table/doc-table-insert.command';
|
|
60
63
|
export { DocTableInsertColumnCommand, DocTableInsertRowCommand, DocTableInsertColumnRightCommand, DocTableInsertRowAboveCommand, DocTableInsertRowBellowCommand, DocTableInsertColumnLeftCommand } from './commands/commands/table/doc-table-insert.command';
|
|
61
|
-
export type {
|
|
62
|
-
export { DocTableTabCommand
|
|
64
|
+
export type { IDocTableTabCommandParams } from './commands/commands/table/doc-table-tab.command';
|
|
65
|
+
export { DocTableTabCommand } from './commands/commands/table/doc-table-tab.command';
|
|
63
66
|
export { genTableSource, getEmptyTableRow, getEmptyTableCell, getTableColumn } from './commands/commands/table/table';
|
|
64
67
|
export { getCursorWhenDelete } from './commands/commands/delete.command';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DocumentDataModel, ICommandInfo, ICustomRange, IDisposable, IParagraphRange,
|
|
2
|
-
import { TextSelectionManagerService } from './text-selection-manager.service';
|
|
1
|
+
import { DocumentDataModel, ICommandInfo, ICustomRange, IDisposable, IParagraphRange, Nullable, Disposable, IUniverInstanceService } from '@univerjs/core';
|
|
2
|
+
import { ITextActiveRange, TextSelectionManagerService } from './text-selection-manager.service';
|
|
3
3
|
export interface IAutoFormatContext {
|
|
4
4
|
unit: DocumentDataModel;
|
|
5
|
-
selection:
|
|
5
|
+
selection: ITextActiveRange;
|
|
6
6
|
/**
|
|
7
7
|
* is selection at doc body
|
|
8
8
|
*/
|
|
@@ -25,7 +25,7 @@ export interface IAutoFormat {
|
|
|
25
25
|
priority?: number;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* service for auto-
|
|
28
|
+
* service for auto-formatting, handle shortcut like `Space` or `Tab`.
|
|
29
29
|
*/
|
|
30
30
|
export declare class DocAutoFormatService extends Disposable {
|
|
31
31
|
private readonly _univerInstanceService;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DocumentDataModel, IInterceptor, Disposable, DisposableCollection } from '@univerjs/core';
|
|
1
|
+
import { DocumentDataModel, IInterceptor, Nullable, Disposable, DisposableCollection } from '@univerjs/core';
|
|
2
2
|
import { DocumentViewModel, IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
3
3
|
import { DocSkeletonManagerService } from '../doc-skeleton-manager.service';
|
|
4
4
|
export declare class DocInterceptorService extends Disposable implements IRenderModule {
|
|
@@ -7,6 +7,6 @@ export declare class DocInterceptorService extends Disposable implements IRender
|
|
|
7
7
|
private _interceptorsByName;
|
|
8
8
|
constructor(_context: IRenderContext<DocumentDataModel>, _docSkeletonManagerService: DocSkeletonManagerService);
|
|
9
9
|
intercept<T extends IInterceptor<any, any>>(name: T, interceptor: T): import('@univerjs/core').IDisposable;
|
|
10
|
-
fetchThroughInterceptors<T, C>(name: IInterceptor<T, C>): (initValue:
|
|
10
|
+
fetchThroughInterceptors<T, C>(name: IInterceptor<T, C>): (initValue: Nullable<T>, initContext: C) => Nullable<T>;
|
|
11
11
|
interceptDocumentViewModel(viewModel: DocumentViewModel): DisposableCollection;
|
|
12
12
|
}
|