@univerjs/docs-ui 0.3.0 → 0.4.0-alpha.1
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 +8 -7
- package/lib/es/index.js +332 -141
- package/lib/locale/fa-IR.json +81 -0
- package/lib/types/commands/commands/__tests__/create-command-test-bed.d.ts +2 -2
- package/lib/types/commands/commands/replace-content.command.d.ts +14 -1
- package/lib/types/components/editor/TextEditor.d.ts +2 -2
- package/lib/types/components/editor/utils.d.ts +7 -0
- package/lib/types/components/range-selector/RangeSelector.d.ts +2 -2
- package/lib/types/controllers/config.schema.d.ts +1 -1
- package/lib/types/controllers/doc-header-footer.controller.d.ts +2 -2
- package/lib/types/controllers/render-controllers/back-scroll.render-controller.d.ts +2 -2
- package/lib/types/controllers/render-controllers/doc-clipboard.controller.d.ts +4 -2
- package/lib/types/controllers/render-controllers/doc-editor-bridge.controller.d.ts +2 -2
- package/lib/types/controllers/render-controllers/doc-resize.render-controller.d.ts +1 -1
- package/lib/types/controllers/render-controllers/doc.render-controller.d.ts +2 -2
- package/lib/types/docs-ui-plugin.d.ts +1 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/types/locale/fa-IR.d.ts +3 -0
- package/lib/types/services/clipboard/clipboard.service.d.ts +1 -1
- package/lib/types/services/doc-state-change-manager.service.d.ts +1 -1
- package/lib/types/services/editor/editor-manager.service.d.ts +14 -4
- package/lib/types/services/editor/editor.d.ts +30 -18
- package/lib/types/services/selection/convert-rect-range.d.ts +1 -1
- package/lib/types/services/selection/doc-selection-render.service.d.ts +4 -2
- package/lib/types/services/selection/rect-range.d.ts +1 -1
- package/lib/types/services/selection/selection-utils.d.ts +3 -3
- package/lib/umd/index.js +8 -7
- package/package.json +14 -22
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"toolbar": {
|
|
3
|
+
"undo": "بازگرداندن",
|
|
4
|
+
"redo": "تکرار",
|
|
5
|
+
"font": "فونت",
|
|
6
|
+
"fontSize": "اندازه فونت",
|
|
7
|
+
"bold": "پررنگ",
|
|
8
|
+
"italic": "ایتالیک",
|
|
9
|
+
"strikethrough": "خطدار",
|
|
10
|
+
"subscript": "زیرنویس",
|
|
11
|
+
"superscript": "بالانویس",
|
|
12
|
+
"underline": "خطکشی",
|
|
13
|
+
"textColor": {
|
|
14
|
+
"main": "رنگ متن",
|
|
15
|
+
"right": "انتخاب رنگ"
|
|
16
|
+
},
|
|
17
|
+
"fillColor": {
|
|
18
|
+
"main": "رنگ پسزمینه متن",
|
|
19
|
+
"right": "انتخاب رنگ"
|
|
20
|
+
},
|
|
21
|
+
"table": {
|
|
22
|
+
"main": "جدول",
|
|
23
|
+
"insert": "درج جدول",
|
|
24
|
+
"colCount": "تعداد ستون",
|
|
25
|
+
"rowCount": "تعداد سطر"
|
|
26
|
+
},
|
|
27
|
+
"resetColor": "بازنشانی",
|
|
28
|
+
"order": "لیست شمارهدار",
|
|
29
|
+
"unorder": "لیست بدون شماره",
|
|
30
|
+
"checklist": "لیست وظیفه",
|
|
31
|
+
"alignLeft": "تراز چپ",
|
|
32
|
+
"alignCenter": "تراز وسط",
|
|
33
|
+
"alignRight": "تراز راست",
|
|
34
|
+
"alignJustify": "توجیه",
|
|
35
|
+
"headerFooter": "هدر و فوتر"
|
|
36
|
+
},
|
|
37
|
+
"table": {
|
|
38
|
+
"insert": "درج",
|
|
39
|
+
"insertRowAbove": "درج سطر بالاتر",
|
|
40
|
+
"insertRowBelow": "درج سطر پایینتر",
|
|
41
|
+
"insertColumnLeft": "درج ستون چپ",
|
|
42
|
+
"insertColumnRight": "درج ستون راست",
|
|
43
|
+
"delete": "حذف جدول",
|
|
44
|
+
"deleteRows": "حذف سطر",
|
|
45
|
+
"deleteColumns": "حذف ستون",
|
|
46
|
+
"deleteTable": "حذف جدول"
|
|
47
|
+
},
|
|
48
|
+
"headerFooter": {
|
|
49
|
+
"header": "هدر",
|
|
50
|
+
"footer": "فوتر",
|
|
51
|
+
"panel": "تنظیمات هدر و فوتر",
|
|
52
|
+
"firstPageCheckBox": "صفحه اول متفاوت",
|
|
53
|
+
"oddEvenCheckBox": "صفحات فرد و زوج متفاوت",
|
|
54
|
+
"headerTopMargin": "حاشیه بالای هدر(px)",
|
|
55
|
+
"footerBottomMargin": "حاشیه پایینی فوتر(px)",
|
|
56
|
+
"closeHeaderFooter": "بستن هدر و فوتر",
|
|
57
|
+
"disableText": "تنظیمات هدر و فوتر غیرفعال است"
|
|
58
|
+
},
|
|
59
|
+
"doc": {
|
|
60
|
+
"menu": {
|
|
61
|
+
"paragraphSetting": "تنظیمات پاراگراف"
|
|
62
|
+
},
|
|
63
|
+
"slider": {
|
|
64
|
+
"paragraphSetting": "تنظیمات پاراگراف"
|
|
65
|
+
},
|
|
66
|
+
"paragraphSetting": {
|
|
67
|
+
"alignment": "تراز",
|
|
68
|
+
"indentation": "تورفتگی",
|
|
69
|
+
"left": "چپ",
|
|
70
|
+
"right": "راست",
|
|
71
|
+
"firstLine": "خط اول",
|
|
72
|
+
"hanging": "آویز",
|
|
73
|
+
"spacing": "فاصلهگذاری",
|
|
74
|
+
"before": "قبل",
|
|
75
|
+
"after": "بعد",
|
|
76
|
+
"lineSpace": "فاصله خط",
|
|
77
|
+
"multiSpace": "فاصله چندگانه",
|
|
78
|
+
"fixedValue": "مقدار ثابت(px)"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Dependency, DependencyIdentifier, DocumentDataModel, IDocumentData, Nullable, Injector, IUniverInstanceService, RxDisposable, Univer } from '@univerjs/core';
|
|
2
|
+
import { DocumentSkeleton, IRender, IRenderContext, IRenderModule, DocumentViewModel, IRenderManagerService } from '@univerjs/engine-render';
|
|
3
3
|
export declare function createCommandTestBed(docData?: IDocumentData, dependencies?: Dependency[]): {
|
|
4
4
|
univer: Univer;
|
|
5
5
|
get: {
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import { ICommand, IDocumentBody, ITextRange } from '@univerjs/core';
|
|
1
|
+
import { ICommand, IDocumentBody, IDocumentData, ITextRange } from '@univerjs/core';
|
|
2
2
|
import { ITextRangeWithStyle } from '@univerjs/engine-render';
|
|
3
|
+
interface IReplaceSnapshotCommandParams {
|
|
4
|
+
unitId: string;
|
|
5
|
+
snapshot: IDocumentData;
|
|
6
|
+
textRanges: ITextRangeWithStyle[];
|
|
7
|
+
segmentId?: string;
|
|
8
|
+
options: {
|
|
9
|
+
[key: string]: boolean;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare const ReplaceSnapshotCommand: ICommand<IReplaceSnapshotCommandParams>;
|
|
3
13
|
interface IReplaceContentCommandParams {
|
|
4
14
|
unitId: string;
|
|
5
15
|
body: IDocumentBody;
|
|
@@ -9,6 +19,9 @@ interface IReplaceContentCommandParams {
|
|
|
9
19
|
[key: string]: boolean;
|
|
10
20
|
};
|
|
11
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated please use ReplaceSnapshotCommand instead.
|
|
24
|
+
*/
|
|
12
25
|
export declare const ReplaceContentCommand: ICommand<IReplaceContentCommandParams>;
|
|
13
26
|
interface ICoverContentCommandParams {
|
|
14
27
|
unitId: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
1
|
import { IDocumentData, Nullable } from '@univerjs/core';
|
|
3
2
|
import { IEditorCanvasStyle } from '../../services/editor/editor';
|
|
3
|
+
import { default as React } from 'react';
|
|
4
4
|
type MyComponentProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
5
5
|
export interface ITextEditorProps {
|
|
6
6
|
id: string;
|
|
@@ -25,7 +25,7 @@ export interface ITextEditorProps {
|
|
|
25
25
|
onValid?: (state: boolean) => void;
|
|
26
26
|
placeholder?: string;
|
|
27
27
|
isValueValid?: boolean;
|
|
28
|
-
|
|
28
|
+
disabled?: boolean;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* The component to render toolbar item label and menu item label.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
1
|
import { IUnitRangeWithName, Nullable } from '@univerjs/core';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
3
|
export interface IRangeSelectorProps {
|
|
4
4
|
id: string;
|
|
5
5
|
value?: string;
|
|
@@ -16,6 +16,6 @@ export interface IRangeSelectorProps {
|
|
|
16
16
|
className?: string;
|
|
17
17
|
textEditorClassName?: string;
|
|
18
18
|
onSelectorVisibleChange?: (visible: boolean) => void;
|
|
19
|
-
|
|
19
|
+
dialogOnly?: boolean;
|
|
20
20
|
}
|
|
21
21
|
export declare function RangeSelector(props: IRangeSelectorProps): React.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MenuConfig } from '@univerjs/ui';
|
|
2
1
|
import { DependencyOverride } from '@univerjs/core';
|
|
2
|
+
import { MenuConfig } from '@univerjs/ui';
|
|
3
3
|
import { ILayout } from '../basics';
|
|
4
4
|
export declare const PLUGIN_CONFIG_KEY = "docs-ui.config";
|
|
5
5
|
export declare const configSymbol: unique symbol;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Disposable, ICommandService, IUniverInstanceService, LocaleService
|
|
1
|
+
import { DocumentDataModel, Disposable, ICommandService, IUniverInstanceService, LocaleService } from '@univerjs/core';
|
|
2
|
+
import { IRenderContext, IRenderModule, IRenderManagerService } from '@univerjs/engine-render';
|
|
2
3
|
import { DocSkeletonManagerService } from '@univerjs/docs';
|
|
3
|
-
import { IRenderManagerService, IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
4
4
|
import { ComponentManager } from '@univerjs/ui';
|
|
5
5
|
import { IEditorService } from '../services/editor/editor-manager.service';
|
|
6
6
|
import { DocSelectionRenderService } from '../services/selection/doc-selection-render.service';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
|
|
1
|
+
import { DocumentDataModel, ITextRange, Nullable, RxDisposable } from '@univerjs/core';
|
|
3
2
|
import { INodePosition, IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
3
|
+
import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
|
|
4
4
|
import { IEditorService } from '../../services/editor/editor-manager.service';
|
|
5
5
|
export declare class DocBackScrollRenderController extends RxDisposable implements IRenderModule {
|
|
6
6
|
private readonly _context;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ICommandService, IContextService, RxDisposable
|
|
1
|
+
import { DocumentDataModel, ICommandService, IContextService, RxDisposable } from '@univerjs/core';
|
|
2
2
|
import { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
3
3
|
import { IDocClipboardService } from '../../services/clipboard/clipboard.service';
|
|
4
|
+
import { IEditorService } from '../../services/editor/editor-manager.service';
|
|
4
5
|
import { DocSelectionRenderService } from '../../services/selection/doc-selection-render.service';
|
|
5
6
|
export declare class DocClipboardController extends RxDisposable implements IRenderModule {
|
|
6
7
|
private readonly _context;
|
|
@@ -8,7 +9,8 @@ export declare class DocClipboardController extends RxDisposable implements IRen
|
|
|
8
9
|
private readonly _docClipboardService;
|
|
9
10
|
private readonly _docSelectionRenderService;
|
|
10
11
|
private readonly _contextService;
|
|
11
|
-
|
|
12
|
+
private readonly _editorService;
|
|
13
|
+
constructor(_context: IRenderContext<DocumentDataModel>, _commandService: ICommandService, _docClipboardService: IDocClipboardService, _docSelectionRenderService: DocSelectionRenderService, _contextService: IContextService, _editorService: IEditorService);
|
|
12
14
|
private _init;
|
|
13
15
|
private _initLegacyPasteCommand;
|
|
14
16
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Disposable, ICommandService, IUniverInstanceService
|
|
1
|
+
import { DocumentDataModel, Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
|
|
2
|
+
import { IRenderContext, IRenderModule, IRenderManagerService } from '@univerjs/engine-render';
|
|
2
3
|
import { DocSkeletonManagerService } from '@univerjs/docs';
|
|
3
|
-
import { IRenderManagerService, IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
4
4
|
import { IEditorService } from '../../services/editor/editor-manager.service';
|
|
5
5
|
import { DocSelectionRenderService } from '../../services/selection/doc-selection-render.service';
|
|
6
6
|
export declare class DocEditorBridgeController extends Disposable implements IRenderModule {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
1
2
|
import { Disposable } from '@univerjs/core';
|
|
2
3
|
import { DocSelectionManagerService } from '@univerjs/docs';
|
|
3
|
-
import { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
4
4
|
import { DocPageLayoutService } from '../../services/doc-page-layout.service';
|
|
5
5
|
export declare class DocResizeRenderController extends Disposable implements IRenderModule {
|
|
6
6
|
private _context;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ICommandService, IContextService, IUniverInstanceService, RxDisposable
|
|
1
|
+
import { DocumentDataModel, ICommandService, IContextService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
|
|
2
|
+
import { IRenderContext, IRenderModule, IRenderManagerService } from '@univerjs/engine-render';
|
|
2
3
|
import { DocSkeletonManagerService } from '@univerjs/docs';
|
|
3
|
-
import { IRenderManagerService, IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
4
4
|
import { IEditorService } from '../../services/editor/editor-manager.service';
|
|
5
5
|
import { DocSelectionRenderService } from '../../services/selection/doc-selection-render.service';
|
|
6
6
|
export declare class DocRenderController extends RxDisposable implements IRenderModule {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { IUniverDocsUIConfig } from './controllers/config.schema';
|
|
1
2
|
import { ICommandService, IConfigService, ILogService, Injector, Plugin } from '@univerjs/core';
|
|
2
3
|
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
3
|
-
import { IUniverDocsUIConfig } from './controllers/config.schema';
|
|
4
4
|
export declare class UniverDocsUIPlugin extends Plugin {
|
|
5
5
|
private readonly _config;
|
|
6
6
|
_injector: Injector;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ export { getParagraphsInRange, getParagraphsInRanges } from './commands/commands
|
|
|
68
68
|
export { BulletListCommand, ChangeListNestingLevelCommand, ChangeListTypeCommand, CheckListCommand, ListOperationCommand, OrderListCommand, QuickListCommand, ToggleCheckListCommand, } from './commands/commands/list.command';
|
|
69
69
|
export { ChangeListNestingLevelType } from './commands/commands/list.command';
|
|
70
70
|
export { AlignCenterCommand, AlignJustifyCommand, AlignLeftCommand, AlignOperationCommand, AlignRightCommand, } from './commands/commands/paragraph-align.command';
|
|
71
|
-
export { CoverContentCommand, ReplaceContentCommand } from './commands/commands/replace-content.command';
|
|
71
|
+
export { CoverContentCommand, ReplaceContentCommand, ReplaceSnapshotCommand } from './commands/commands/replace-content.command';
|
|
72
72
|
export { SetDocZoomRatioCommand } from './commands/commands/set-doc-zoom-ratio.command';
|
|
73
73
|
export { CreateDocTableCommand, type ICreateDocTableCommandParams } from './commands/commands/table/doc-table-create.command';
|
|
74
74
|
export { DocTableDeleteColumnsCommand, DocTableDeleteRowsCommand, DocTableDeleteTableCommand } from './commands/commands/table/doc-table-delete.command';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Disposable, ICommandService, ILogService, IUniverInstanceService, SliceBodyType
|
|
1
|
+
import { IDisposable, IDocumentBody, Disposable, ICommandService, ILogService, IUniverInstanceService, SliceBodyType } from '@univerjs/core';
|
|
2
2
|
import { DocSelectionManagerService } from '@univerjs/docs';
|
|
3
3
|
import { IClipboardInterfaceService } from '@univerjs/ui';
|
|
4
4
|
export interface IClipboardPropertyItem {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICommandService, IUndoRedoService, IUniverInstanceService, RxDisposable
|
|
1
|
+
import { Nullable, ICommandService, IUndoRedoService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
|
|
2
2
|
import { DocStateEmitService, IDocStateChangeParams } from '@univerjs/docs';
|
|
3
3
|
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
4
4
|
export declare class DocStateChangeManagerService extends RxDisposable {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IDisposable, IDocumentBody, Nullable, Disposable, ICommandService, IContextService, IUndoRedoService, IUniverInstanceService } from '@univerjs/core';
|
|
2
|
+
import { ISuccinctDocRangeParam, IRenderManagerService } from '@univerjs/engine-render';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { IEditorConfigParams, IEditorStateParams, Editor } from './editor';
|
|
2
5
|
import { DocSelectionManagerService } from '@univerjs/docs';
|
|
3
6
|
import { LexerTreeBuilder } from '@univerjs/engine-formula';
|
|
4
|
-
import { IRenderManagerService, ISuccinctDocRangeParam } from '@univerjs/engine-render';
|
|
5
|
-
import { Observable } from 'rxjs';
|
|
6
|
-
import { Editor, IEditorConfigParams, IEditorStateParams } from './editor';
|
|
7
7
|
export interface IEditorSetValueParam {
|
|
8
8
|
editorUnitId: string;
|
|
9
9
|
body: IDocumentBody;
|
|
@@ -97,6 +97,7 @@ export declare class EditorService extends Disposable implements IEditorService,
|
|
|
97
97
|
private _spreadsheetFocusState;
|
|
98
98
|
constructor(_univerInstanceService: IUniverInstanceService, _renderManagerService: IRenderManagerService, _lexerTreeBuilder: LexerTreeBuilder, _docSelectionManagerService: DocSelectionManagerService, _contextService: IContextService, _commandService: ICommandService, _undoRedoService: IUndoRedoService);
|
|
99
99
|
private _initUniverFocusListener;
|
|
100
|
+
/** @deprecated */
|
|
100
101
|
private _blurSheetEditor;
|
|
101
102
|
/** @deprecated */
|
|
102
103
|
setFocusId(id: Nullable<string>): void;
|
|
@@ -105,14 +106,19 @@ export declare class EditorService extends Disposable implements IEditorService,
|
|
|
105
106
|
/** @deprecated */
|
|
106
107
|
getFocusEditor(): Readonly<Nullable<Editor>>;
|
|
107
108
|
isEditor(editorUnitId: string): boolean;
|
|
109
|
+
/** @deprecated */
|
|
108
110
|
isSheetEditor(editorUnitId: string): boolean;
|
|
111
|
+
/** @deprecated */
|
|
109
112
|
closeRangePrompt(): void;
|
|
110
113
|
/** @deprecated */
|
|
111
114
|
changeSpreadsheetFocusState(state: boolean): void;
|
|
112
115
|
/** @deprecated */
|
|
113
116
|
getSpreadsheetFocusState(): boolean;
|
|
117
|
+
/** @deprecated */
|
|
114
118
|
focusStyle(editorUnitId: string): false | undefined;
|
|
119
|
+
/** @deprecated */
|
|
115
120
|
singleSelection(state: boolean): void;
|
|
121
|
+
/** @deprecated */
|
|
116
122
|
selectionChangingState(): boolean;
|
|
117
123
|
/** @deprecated */
|
|
118
124
|
blur(): void;
|
|
@@ -136,7 +142,9 @@ export declare class EditorService extends Disposable implements IEditorService,
|
|
|
136
142
|
getAllEditor(): Map<string, Editor>;
|
|
137
143
|
/** @deprecated */
|
|
138
144
|
getFirstEditor(): Editor;
|
|
145
|
+
/** @deprecated */
|
|
139
146
|
resize(unitId: string): void;
|
|
147
|
+
/** @deprecated */
|
|
140
148
|
isVisible(id: string): boolean | undefined;
|
|
141
149
|
/** @deprecated */
|
|
142
150
|
setOperationSheetUnitId(unitId: Nullable<string>): void;
|
|
@@ -148,7 +156,9 @@ export declare class EditorService extends Disposable implements IEditorService,
|
|
|
148
156
|
getOperationSheetSubUnitId(): Nullable<string>;
|
|
149
157
|
register(config: IEditorConfigParams, container: HTMLDivElement): IDisposable;
|
|
150
158
|
private _unRegister;
|
|
159
|
+
/** @deprecated */
|
|
151
160
|
refreshValueChange(editorUnitId: string): void;
|
|
161
|
+
/** @deprecated */
|
|
152
162
|
checkValueLegality(editorUnitId: string): boolean;
|
|
153
163
|
private _refreshValueChange;
|
|
154
164
|
private _getCurrentEditorUnitId;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
1
|
+
import { ICommandService, IDocumentData, IPosition, IUndoRedoService, IUniverInstanceService, Nullable, Disposable } from '@univerjs/core';
|
|
3
2
|
import { DocSelectionManagerService } from '@univerjs/docs';
|
|
4
3
|
import { IDocSelectionInnerParam, IRender, ISuccinctDocRangeParam, ITextRangeWithStyle } from '@univerjs/engine-render';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
5
|
import { IEditorInputConfig } from '../selection/doc-selection-render.service';
|
|
6
6
|
interface IEditorEvent {
|
|
7
7
|
target: IEditor;
|
|
@@ -36,53 +36,56 @@ export interface IEditorCanvasStyle {
|
|
|
36
36
|
fontSize?: number;
|
|
37
37
|
}
|
|
38
38
|
export interface IEditorConfigParams {
|
|
39
|
-
initialSnapshot
|
|
39
|
+
initialSnapshot: IDocumentData;
|
|
40
40
|
cancelDefaultResizeListener?: boolean;
|
|
41
41
|
canvasStyle?: IEditorCanvasStyle;
|
|
42
42
|
autofocus?: boolean;
|
|
43
43
|
readonly?: boolean;
|
|
44
|
-
|
|
44
|
+
backScrollOffset?: number;
|
|
45
|
+
editorUnitId?: string;
|
|
46
|
+
scrollBar?: boolean;
|
|
47
|
+
/** @deprecated */
|
|
48
|
+
noNeedVerticalAlign?: boolean;
|
|
45
49
|
/**
|
|
46
50
|
* @deprecated The implementer makes its own judgment.
|
|
47
51
|
*/
|
|
48
|
-
isSheetEditor
|
|
52
|
+
isSheetEditor?: boolean;
|
|
49
53
|
/**
|
|
50
54
|
* If the editor is for formula editing.
|
|
51
55
|
* @deprecated this is a temp fix before refactoring editor.
|
|
52
56
|
*/
|
|
53
|
-
isFormulaEditor
|
|
57
|
+
isFormulaEditor?: boolean;
|
|
54
58
|
/**
|
|
55
59
|
* @deprecated The implementer makes its own judgment.
|
|
56
60
|
*/
|
|
57
|
-
isSingle
|
|
61
|
+
isSingle?: boolean;
|
|
58
62
|
/**
|
|
59
63
|
* @deprecated The implementer makes its own judgment.
|
|
60
64
|
*/
|
|
61
|
-
onlyInputFormula
|
|
65
|
+
onlyInputFormula?: boolean;
|
|
62
66
|
/**
|
|
63
67
|
* @deprecated The implementer makes its own judgment.
|
|
64
68
|
*/
|
|
65
|
-
onlyInputRange
|
|
69
|
+
onlyInputRange?: boolean;
|
|
66
70
|
/**
|
|
67
71
|
* @deprecated The implementer makes its own judgment.
|
|
68
72
|
*/
|
|
69
|
-
onlyInputContent
|
|
73
|
+
onlyInputContent?: boolean;
|
|
70
74
|
/**
|
|
71
75
|
* @deprecated The implementer makes its own judgment.
|
|
72
76
|
*/
|
|
73
|
-
isSingleChoice
|
|
77
|
+
isSingleChoice?: boolean;
|
|
74
78
|
/**
|
|
75
79
|
* @deprecated The implementer makes its own judgment.
|
|
76
80
|
*/
|
|
77
|
-
openForSheetUnitId
|
|
81
|
+
openForSheetUnitId?: Nullable<string>;
|
|
78
82
|
/**
|
|
79
83
|
* @deprecated The implementer makes its own judgment.
|
|
80
84
|
*/
|
|
81
|
-
openForSheetSubUnitId
|
|
85
|
+
openForSheetSubUnitId?: Nullable<string>;
|
|
82
86
|
}
|
|
83
87
|
export interface IEditorOptions extends IEditorConfigParams, IEditorStateParams {
|
|
84
88
|
render: IRender;
|
|
85
|
-
documentDataModel: DocumentDataModel;
|
|
86
89
|
editorDom: HTMLDivElement;
|
|
87
90
|
}
|
|
88
91
|
export declare class Editor extends Disposable implements IEditor {
|
|
@@ -118,14 +121,15 @@ export declare class Editor extends Disposable implements IEditor {
|
|
|
118
121
|
getDocumentData(): IDocumentData;
|
|
119
122
|
setDocumentData(data: IDocumentData, textRanges: Nullable<ITextRangeWithStyle[]>): void;
|
|
120
123
|
clearUndoRedoHistory(): void;
|
|
124
|
+
dispose(): void;
|
|
121
125
|
/**
|
|
122
|
-
* @deprecated use
|
|
126
|
+
* @deprecated use getEditorId.
|
|
123
127
|
*/
|
|
124
|
-
get
|
|
128
|
+
get editorUnitId(): string | undefined;
|
|
125
129
|
/**
|
|
126
|
-
* @deprecated
|
|
130
|
+
* @deprecated @TODO: @JOCS remove this in the future.
|
|
127
131
|
*/
|
|
128
|
-
get
|
|
132
|
+
get params(): IEditorOptions;
|
|
129
133
|
get cancelDefaultResizeListener(): boolean | undefined;
|
|
130
134
|
get render(): IRender;
|
|
131
135
|
isSingleChoice(): boolean;
|
|
@@ -171,7 +175,15 @@ export declare class Editor extends Disposable implements IEditor {
|
|
|
171
175
|
* @deprecated.
|
|
172
176
|
*/
|
|
173
177
|
update(param: Partial<IEditorOptions>): void;
|
|
178
|
+
/**
|
|
179
|
+
* @deprecated.
|
|
180
|
+
*/
|
|
174
181
|
verticalAlign(): void;
|
|
182
|
+
/**
|
|
183
|
+
* @deprecated.
|
|
184
|
+
*/
|
|
175
185
|
updateCanvasStyle(): void;
|
|
186
|
+
private _getDocDataModel;
|
|
187
|
+
private _getEditorId;
|
|
176
188
|
}
|
|
177
189
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Nullable } from '@univerjs/core';
|
|
2
1
|
import { DocumentSkeleton, IDocumentOffsetConfig, INodePosition, IPoint } from '@univerjs/engine-render';
|
|
2
|
+
import { Nullable } from '@univerjs/core';
|
|
3
3
|
export declare function isValidRectRange(anchorNodePosition: INodePosition, focusNodePosition: INodePosition): boolean;
|
|
4
4
|
export declare function isInSameTableCell(anchorNodePosition: INodePosition, focusNodePosition: INodePosition): boolean;
|
|
5
5
|
export declare function compareNodePositionInTable(a: INodePosition, b: INodePosition): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DocumentDataModel, Nullable, ILogService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
|
|
2
|
+
import { IDocSelectionInnerParam, IMouseEvent, INodePosition, IPointerEvent, IRenderContext, IRenderModule, ISuccinctDocRangeParam, ITextRangeWithStyle } from '@univerjs/engine-render';
|
|
2
3
|
import { DocSkeletonManagerService } from '@univerjs/docs';
|
|
3
4
|
import { ILayoutService } from '@univerjs/ui';
|
|
4
|
-
import { IDocSelectionInnerParam, IMouseEvent, INodePosition, IPointerEvent, IRenderContext, IRenderModule, ISuccinctDocRangeParam, ITextRangeWithStyle } from '@univerjs/engine-render';
|
|
5
5
|
import { TextRange } from './text-range';
|
|
6
6
|
export interface IEditorInputConfig {
|
|
7
7
|
event: Event | CompositionEvent | KeyboardEvent;
|
|
@@ -96,6 +96,7 @@ export declare class DocSelectionRenderService extends RxDisposable implements I
|
|
|
96
96
|
__onPointDown(evt: IPointerEvent | IMouseEvent): void;
|
|
97
97
|
removeAllRanges(): void;
|
|
98
98
|
getActiveTextRange(): TextRange | undefined;
|
|
99
|
+
private _disposeScrollTimers;
|
|
99
100
|
private _setSystemHighlightColorToStyle;
|
|
100
101
|
private _getAllTextRanges;
|
|
101
102
|
private _getAllRectRanges;
|
|
@@ -113,6 +114,7 @@ export declare class DocSelectionRenderService extends RxDisposable implements I
|
|
|
113
114
|
private _removeAllCacheRanges;
|
|
114
115
|
private _removeAllTextRanges;
|
|
115
116
|
private _removeAllRectRanges;
|
|
117
|
+
private _removeAllCollapsedTextRanges;
|
|
116
118
|
private _deactivateAllTextRanges;
|
|
117
119
|
private _deactivateAllRectRanges;
|
|
118
120
|
private _addTextRangesToCache;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DOC_RANGE_TYPE, Nullable, RANGE_DIRECTION } from '@univerjs/core';
|
|
2
1
|
import { Documents, DocumentSkeleton, INodePosition, ITextSelectionStyle, ThinScene } from '@univerjs/engine-render';
|
|
3
2
|
import { IDocRange } from './range-interface';
|
|
3
|
+
import { DOC_RANGE_TYPE, Nullable, RANGE_DIRECTION } from '@univerjs/core';
|
|
4
4
|
export declare function convertPositionsToRectRanges(scene: ThinScene, document: Documents, docSkeleton: DocumentSkeleton, anchorNodePosition: INodePosition, focusNodePosition: INodePosition, style?: ITextSelectionStyle, segmentId?: string, segmentPage?: number): RectRange[];
|
|
5
5
|
export declare class RectRange implements IDocRange {
|
|
6
6
|
private _scene;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Nullable } from '@univerjs/core';
|
|
2
1
|
import { Documents, DocumentSkeleton, Engine, IDocumentSkeletonGlyph, INodePosition, IRectRangeWithStyle, ITextRangeWithStyle, ITextSelectionStyle, Scene } from '@univerjs/engine-render';
|
|
2
|
+
import { IDocRange } from './range-interface';
|
|
3
|
+
import { Nullable } from '@univerjs/core';
|
|
3
4
|
import { RectRange } from './rect-range';
|
|
4
5
|
import { TextRange } from './text-range';
|
|
5
|
-
import { IDocRange } from './range-interface';
|
|
6
6
|
interface IDocRangeList {
|
|
7
7
|
textRanges: TextRange[];
|
|
8
8
|
rectRanges: RectRange[];
|
|
9
9
|
}
|
|
10
|
-
export declare function getTextRangeFromCharIndex(startOffset: number, endOffset: number, scene: Scene, document: Documents, skeleton: DocumentSkeleton, style: ITextSelectionStyle, segmentId: string, segmentPage: number): Nullable<TextRange>;
|
|
10
|
+
export declare function getTextRangeFromCharIndex(startOffset: number, endOffset: number, scene: Scene, document: Documents, skeleton: DocumentSkeleton, style: ITextSelectionStyle, segmentId: string, segmentPage: number, startIsBack?: boolean, endIsBack?: boolean): Nullable<TextRange>;
|
|
11
11
|
export declare function getRectRangeFromCharIndex(startOffset: number, endOffset: number, scene: Scene, document: Documents, skeleton: DocumentSkeleton, style: ITextSelectionStyle, segmentId: string, segmentPage: number): Nullable<RectRange>;
|
|
12
12
|
export declare function getRangeListFromCharIndex(startOffset: number, endOffset: number, scene: Scene, document: Documents, skeleton: DocumentSkeleton, style: ITextSelectionStyle, segmentId: string, segmentPage: number): Nullable<IDocRangeList>;
|
|
13
13
|
export declare function getRangeListFromSelection(anchorPosition: INodePosition, focusPosition: INodePosition, scene: Scene, document: Documents, skeleton: DocumentSkeleton, style: ITextSelectionStyle, segmentId: string, segmentPage: number): Nullable<IDocRangeList>;
|