@univerjs/docs-ui 1.2.0 → 1.3.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 +297 -139
- package/lib/es/index.js +299 -142
- package/lib/index.css +4 -0
- package/lib/index.js +299 -142
- package/lib/types/index.d.ts +1 -0
- package/lib/types/menu/menu.d.ts +1 -1
- package/lib/types/menu/mobile-schema.d.ts +41 -2
- package/lib/types/services/doc-paragraph-menu.service.d.ts +4 -2
- package/lib/types/services/mobile/doc-selection-render.service.d.ts +1 -0
- package/lib/types/services/selection/doc-selection-render.service.d.ts +2 -1
- package/lib/types/views/EditorColorPicker.d.ts +20 -0
- package/lib/types/views/paragraph-menu/paragraph-menu-position.d.ts +21 -0
- package/lib/types/views/rich-text-editor/hooks/editor-undo-redo-keyboard.d.ts +5 -1
- package/lib/umd/index.js +16 -17
- package/package.json +10 -10
package/lib/types/index.d.ts
CHANGED
|
@@ -131,6 +131,7 @@ export { getCanvasOffsetByEngine, getTextRangeFromCharIndex } from './services/s
|
|
|
131
131
|
export { getAnchorBounding, getLineBounding, TEXT_RANGE_LAYER_INDEX, TextRange } from './services/selection/text-range';
|
|
132
132
|
export { whenDocAndEditorFocused } from './shortcuts/utils';
|
|
133
133
|
export { DOC_VERTICAL_PADDING } from './types/const/padding';
|
|
134
|
+
export { EditorColorPicker } from './views/EditorColorPicker';
|
|
134
135
|
export { BulletListTypePicker, OrderListTypePicker } from './views/list-type-picker/Picker';
|
|
135
136
|
export { MOBILE_DOC_ELEMENT_MENU, MobileDocElementMenu } from './views/mobile-element-menu/MobileDocElementMenu';
|
|
136
137
|
export { MobileRichTextEditor } from './views/mobile-rich-text-editor/MobileRichTextEditor';
|
package/lib/types/menu/menu.d.ts
CHANGED
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { DocumentDataModel, IAccessor, ITextRangeParam, Nullable } from '@univerjs/core';
|
|
17
17
|
import type { IMenuButtonItem, IMenuItem, IMenuSelectorItem } from '@univerjs/ui';
|
|
18
|
-
import type { LocaleKey } from '../locale/types';
|
|
19
18
|
import { HorizontalAlign, NamedStyleType, PresetListType } from '@univerjs/core';
|
|
20
19
|
import { UnitAction } from '@univerjs/protocol';
|
|
21
20
|
import { Observable } from 'rxjs';
|
|
21
|
+
import type { LocaleKey } from '../locale/types';
|
|
22
22
|
export declare function shouldSuppressDocMenuStateRefresh(accessor: IAccessor): boolean;
|
|
23
23
|
export declare function disableMenuWhenHeaderFooterEditing(accessor: IAccessor): Observable<boolean>;
|
|
24
24
|
export declare function disableMenuWhenNoDocRange(accessor: IAccessor): Observable<boolean>;
|
|
@@ -13,5 +13,44 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import
|
|
17
|
-
|
|
16
|
+
import { DocPasteCommand, DocPasteSpecialCommand } from '../commands/commands/clipboard.command';
|
|
17
|
+
import { DocSelectAllCommand, DocSelectWordCommand } from '../commands/commands/doc-select-all.command';
|
|
18
|
+
import { PasteMenuFactory, PasteSpecialMenuFactory, SelectAllMenuFactory, SelectWordMenuFactory } from './context-menu';
|
|
19
|
+
export declare const mobileMenuSchema: {
|
|
20
|
+
"contextMenu.mainArea": {
|
|
21
|
+
"contextMenu.quick": {
|
|
22
|
+
[DocSelectWordCommand.id]: {
|
|
23
|
+
order: number;
|
|
24
|
+
menuItemFactory: typeof SelectWordMenuFactory;
|
|
25
|
+
};
|
|
26
|
+
[DocSelectAllCommand.id]: {
|
|
27
|
+
order: number;
|
|
28
|
+
menuItemFactory: typeof SelectAllMenuFactory;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
"docs.contextMenu.caret": {
|
|
33
|
+
"contextMenu.quick": {
|
|
34
|
+
[DocPasteCommand.id]: {
|
|
35
|
+
order: number;
|
|
36
|
+
menuItemFactory: typeof PasteMenuFactory;
|
|
37
|
+
};
|
|
38
|
+
[DocSelectWordCommand.id]: {
|
|
39
|
+
order: number;
|
|
40
|
+
menuItemFactory: typeof SelectWordMenuFactory;
|
|
41
|
+
};
|
|
42
|
+
[DocSelectAllCommand.id]: {
|
|
43
|
+
order: number;
|
|
44
|
+
menuItemFactory: typeof SelectAllMenuFactory;
|
|
45
|
+
};
|
|
46
|
+
quickLayout: "tile";
|
|
47
|
+
};
|
|
48
|
+
"contextMenu.format": {
|
|
49
|
+
[DocPasteSpecialCommand.id]: {
|
|
50
|
+
order: number;
|
|
51
|
+
menuItemFactory: typeof PasteSpecialMenuFactory;
|
|
52
|
+
};
|
|
53
|
+
order: number;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
@@ -73,6 +73,7 @@ export declare class DocParagraphMenuService extends Disposable implements IRend
|
|
|
73
73
|
private _docLayoutInteractionService;
|
|
74
74
|
private readonly _contextService;
|
|
75
75
|
private _paragraphMenu;
|
|
76
|
+
private _paragraphMenuHideTimer;
|
|
76
77
|
private readonly _activeTarget$;
|
|
77
78
|
readonly activeTarget$: import("rxjs").Observable<IDocBlockMenuTarget | null>;
|
|
78
79
|
private _focusedTableMenu;
|
|
@@ -93,7 +94,6 @@ export declare class DocParagraphMenuService extends Disposable implements IRend
|
|
|
93
94
|
setBlockMenuDragging(isDragging: boolean): void;
|
|
94
95
|
get isBlockMenuDragging(): boolean;
|
|
95
96
|
constructor(_context: IRenderContext<DocumentDataModel>, _docSelectionManagerService: DocSelectionManagerService, _docEventManagerService: DocEventManagerService, _docPopupManagerService: DocCanvasPopManagerService, _docSkeletonManagerService: DocSkeletonManagerService, _floatMenuService: DocFloatMenuService, _docSelectionRenderService: DocSelectionRenderService, _permissionService: IPermissionService, _docLayoutInteractionService: DocLayoutInteractionService, _contextService: IContextService);
|
|
96
|
-
private _isCursorInActiveParagraph;
|
|
97
97
|
private _getExpandedSelectionState;
|
|
98
98
|
private _hasExpandedSelectionRanges;
|
|
99
99
|
private _hasExpandedTextSelection;
|
|
@@ -110,13 +110,15 @@ export declare class DocParagraphMenuService extends Disposable implements IRend
|
|
|
110
110
|
private _getSlashMenuAnchorRect;
|
|
111
111
|
showParagraphMenu(paragraph: IMutiPageParagraphBound): void;
|
|
112
112
|
showTableMenu(tableBound: ITableBound, focused?: boolean): void;
|
|
113
|
-
private
|
|
113
|
+
private _showHoverMenu;
|
|
114
114
|
private _showFocusedTableMenu;
|
|
115
115
|
private _shouldKeepCurrentCellMenuForTable;
|
|
116
116
|
getDropTargetFromClientPoint(clientX: number, clientY: number, sourceRange: {
|
|
117
117
|
startOffset: number;
|
|
118
118
|
endOffset: number;
|
|
119
119
|
}): IDocBlockDropTarget | null;
|
|
120
|
+
private _cancelParagraphMenuHide;
|
|
121
|
+
private _scheduleParagraphMenuHide;
|
|
120
122
|
hideParagraphMenu(force?: boolean): void;
|
|
121
123
|
hideFocusedTableMenu(): void;
|
|
122
124
|
private _canEditDocument;
|
|
@@ -38,6 +38,7 @@ export declare class MobileDocSelectionRenderService extends DocSelectionRenderS
|
|
|
38
38
|
readonly mobileEditMode$: import("rxjs").Observable<boolean>;
|
|
39
39
|
get isMobileEditMode(): boolean;
|
|
40
40
|
constructor(context: IRenderContext<DocumentDataModel>, layoutService: ILayoutService, logService: ILogService, contextService: IContextService, univerInstanceService: IUniverInstanceService, _mobileDocSkeletonManagerService: DocSkeletonManagerService, docSelectionManagerService: DocSelectionManagerService, embedInteractionBoundaryService?: IDocEmbedInteractionBoundaryService, embedRuntimeFocusCoordinator?: IDocEmbedRuntimeFocusCoordinator);
|
|
41
|
+
focus(): void;
|
|
41
42
|
cancelPointerSelection(): void;
|
|
42
43
|
enterMobileEditMode(shouldFocusInput?: boolean): boolean;
|
|
43
44
|
suspendMobileEditingInput(): void;
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { DocumentDataModel, Nullable } from '@univerjs/core';
|
|
17
17
|
import type { IDocSelectionInnerParam, IMouseEvent, INodePosition, IPointerEvent, IRenderContext, IRenderModule, ISuccinctDocRangeParam, ITextRangeWithStyle } from '@univerjs/engine-render';
|
|
18
|
-
import type { RectRange } from './rect-range';
|
|
19
18
|
import { IContextService, ILogService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
|
|
20
19
|
import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
|
|
21
20
|
import { ILayoutService } from '@univerjs/ui';
|
|
21
|
+
import type { RectRange } from './rect-range';
|
|
22
22
|
import { IDocEmbedInteractionBoundaryService, IDocEmbedRuntimeFocusCoordinator } from '../doc-embed-integration.service';
|
|
23
23
|
import { TextRange } from './text-range';
|
|
24
24
|
export interface IEditorInputConfig {
|
|
@@ -192,6 +192,7 @@ export declare class DocSelectionRenderService extends RxDisposable implements I
|
|
|
192
192
|
private _getTransformCoordForDocumentOffset;
|
|
193
193
|
private _findNodeByCoord;
|
|
194
194
|
private _shouldPreserveExternalFocus;
|
|
195
|
+
private _isInUnfocusedFrame;
|
|
195
196
|
private _isAnotherEditorFocused;
|
|
196
197
|
private _containsCurrentEmbedRuntimeElement;
|
|
197
198
|
private _getCurrentEmbedOwner;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
import type { IColorPickerProps } from '@univerjs/design';
|
|
17
|
+
export declare function EditorColorPicker(props: IColorPickerProps): import("react").JSX.Element;
|
|
18
|
+
export declare namespace EditorColorPicker {
|
|
19
|
+
var componentKey: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
import type { IPopup } from '@univerjs/ui';
|
|
17
|
+
import type { Observable } from 'rxjs';
|
|
18
|
+
import { DocumentBlockType } from '@univerjs/core';
|
|
19
|
+
export declare function observeParagraphMenuPosition(element: HTMLElement, popup: IPopup, targets$: Observable<{
|
|
20
|
+
kind: DocumentBlockType;
|
|
21
|
+
} | null>): () => void;
|
|
@@ -13,18 +13,22 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { ICommandService, IUniverInstanceService } from '@univerjs/core';
|
|
16
|
+
import type { ICommandService, IContextService, IUniverInstanceService } from '@univerjs/core';
|
|
17
17
|
import type { IKeyboardEventConfig } from './use-keyboard-event';
|
|
18
18
|
export interface IExecuteEditorUndoRedoCommandOptions {
|
|
19
19
|
commandId: string;
|
|
20
20
|
commandService: ICommandService;
|
|
21
21
|
editorUnitId: string;
|
|
22
22
|
univerInstanceService: IUniverInstanceService;
|
|
23
|
+
contextService?: IContextService;
|
|
24
|
+
preserveHostFocus?: boolean;
|
|
23
25
|
}
|
|
24
26
|
export interface ICreateEditorUndoRedoKeyboardConfigOptions {
|
|
25
27
|
commandService: ICommandService;
|
|
26
28
|
univerInstanceService: IUniverInstanceService;
|
|
27
29
|
editorUnitId: string;
|
|
30
|
+
contextService?: IContextService;
|
|
31
|
+
preserveHostFocus?: boolean;
|
|
28
32
|
keyCodes?: IKeyboardEventConfig['keyCodes'];
|
|
29
33
|
handler?: IKeyboardEventConfig['handler'];
|
|
30
34
|
}
|