@univerjs/docs-ui 1.0.0-alpha.6 → 1.0.0-alpha.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.
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { ICustomDecoration, ICustomRange, ICustomTable, IDocumentBody, IParagraph, ITextRun, ITextStyle, Nullable } from '@univerjs/core';
17
+ export declare function isTopLevelStructuralGap(dataStream: string, offset: number): boolean;
17
18
  export declare function hasParagraphInTable(paragraph: IParagraph, tables: ICustomTable[]): boolean;
18
19
  export declare function getTextRunAtPosition(body: IDocumentBody, position: number, defaultStyle: ITextStyle, cacheStyle: Nullable<ITextStyle>, isCellEditor?: boolean): ITextRun;
19
20
  export declare function getCustomRangeAtPosition(customRanges: ICustomRange[], position: number, extendRange?: boolean): ICustomRange<Record<string, any>> | null | undefined;
@@ -0,0 +1,19 @@
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 { ICommand } from '@univerjs/core';
17
+ export declare const InsertSpecialCharacterCommand: ICommand<{
18
+ value: string;
19
+ }>;
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { ICommand } from '@univerjs/core';
17
+ import type { ITextRangeWithStyle } from '@univerjs/engine-render';
17
18
  export interface IDocTableDeleteRowsCommandParams {
18
19
  }
19
20
  export declare const DocTableDeleteRowsCommand: ICommand<IDocTableDeleteRowsCommandParams>;
@@ -21,5 +22,6 @@ export interface IDocTableDeleteColumnsCommandParams {
21
22
  }
22
23
  export declare const DocTableDeleteColumnsCommand: ICommand<IDocTableDeleteColumnsCommandParams>;
23
24
  export interface IDocTableDeleteTableCommandParams {
25
+ targetRange?: ITextRangeWithStyle;
24
26
  }
25
27
  export declare const DocTableDeleteTableCommand: ICommand<IDocTableDeleteTableCommandParams>;
@@ -84,8 +84,9 @@ export { menuSchema as DocsUIMenuSchema } from './menu/schema';
84
84
  export { UniverDocsUIPlugin } from './plugin';
85
85
  export * from './services';
86
86
  export { IDocClipboardService } from './services/clipboard/clipboard.service';
87
+ export type { IDocClipboardHook } from './services/clipboard/clipboard.service';
87
88
  export { DocClipboardPasteAdapterService, IDocClipboardPasteAdapterService, } from './services/clipboard/doc-paste-mutation-adapter.service';
88
- export type { IDocClipboardPasteAdapter, IDocClipboardPasteCustomBlockMapping, IDocClipboardPasteMutationInfoParams, IDocClipboardPasteMutationInfos, } from './services/clipboard/doc-paste-mutation-adapter.service';
89
+ export type { IDocClipboardPasteAdapter, IDocClipboardPasteBlockRangeMapping, IDocClipboardPasteCustomBlockMapping, IDocClipboardPasteMutationInfoParams, IDocClipboardPasteMutationInfos, } from './services/clipboard/doc-paste-mutation-adapter.service';
89
90
  export { convertBodyToHtml } from './services/clipboard/udm-to-html/convertor';
90
91
  export { DocHtmlExportService } from './services/clipboard/udm-to-html/doc-html-export.service';
91
92
  export type { DocHtmlExportTransformer } from './services/clipboard/udm-to-html/doc-html-export.service';
@@ -21,6 +21,10 @@ import { Observable } from 'rxjs';
21
21
  export declare function shouldSuppressDocMenuStateRefresh(accessor: IAccessor): boolean;
22
22
  export declare function disableMenuWhenHeaderFooterEditing(accessor: IAccessor): Observable<boolean>;
23
23
  export declare function disableMenuWhenNoDocRange(accessor: IAccessor): Observable<boolean>;
24
+ export declare const DOC_INSERT_EMOJI_MENU_ID = "doc.menu.insert-emoji";
25
+ export declare const DOC_INSERT_SYMBOL_MENU_ID = "doc.menu.insert-symbol";
26
+ export declare function EmojiPickerMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<string, string, string>;
27
+ export declare function SymbolPickerMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<string, string, string>;
24
28
  export declare function isTextRangeInAnyBlockRange(document: Nullable<DocumentDataModel>, range: ITextRangeParam): boolean;
25
29
  export declare function hideMenuWhenSelectionInBlockRange(accessor: IAccessor): Observable<boolean>;
26
30
  export declare function BoldMenuItemFactory(accessor: IAccessor): IMenuButtonItem<LocaleKey>;
@@ -37,7 +37,7 @@ export interface IDocClipboardHook {
37
37
  export interface IDocClipboardService {
38
38
  copy(sliceType?: SliceBodyType, ranges?: ITextRangeWithStyle[]): Promise<boolean>;
39
39
  cut(ranges?: ITextRangeWithStyle[]): Promise<boolean>;
40
- paste(items: ClipboardItem[]): Promise<boolean>;
40
+ paste(items?: ClipboardItem[]): Promise<boolean>;
41
41
  legacyPaste(options: {
42
42
  html?: string;
43
43
  text?: string;
@@ -55,12 +55,13 @@ export declare class DocClipboardService extends Disposable implements IDocClipb
55
55
  private readonly _clipboardInterfaceService;
56
56
  private readonly _docSelectionManagerService;
57
57
  private _clipboardHooks;
58
+ private _memoryClipboardData;
58
59
  private _htmlToUDM;
59
60
  private readonly _umdToHtml;
60
61
  constructor(_univerInstanceService: IUniverInstanceService, _logService: ILogService, _commandService: ICommandService, _clipboardInterfaceService: IClipboardInterfaceService, docHtmlExportService: DocHtmlExportService, _docSelectionManagerService: DocSelectionManagerService);
61
62
  copy(sliceType?: SliceBodyType, ranges?: ITextRangeWithStyle[]): Promise<boolean>;
62
63
  cut(ranges?: ITextRangeWithStyle[]): Promise<boolean>;
63
- paste(items: ClipboardItem[]): Promise<boolean>;
64
+ paste(items?: ClipboardItem[]): Promise<boolean>;
64
65
  legacyPaste(options: {
65
66
  html?: string;
66
67
  internalJson?: string;
@@ -13,19 +13,24 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { IDisposable, IDocumentBody, IDocumentData, IDrawingParam, IMutationInfo } from '@univerjs/core';
16
+ import type { IDisposable, IDocumentBlockRange, IDocumentBody, IDocumentData, IDrawingParam, IMutationInfo } from '@univerjs/core';
17
17
  export interface IDocClipboardPasteCustomBlockMapping {
18
18
  sourceBlockId: string;
19
19
  targetBlockId: string;
20
20
  sourceDrawing: IDrawingParam;
21
21
  targetDrawing: IDrawingParam;
22
22
  }
23
+ export interface IDocClipboardPasteBlockRangeMapping {
24
+ sourceBlockRange: IDocumentBlockRange;
25
+ targetBlockRange: IDocumentBlockRange;
26
+ }
23
27
  export interface IDocClipboardPasteMutationInfoParams {
24
28
  unitId: string;
25
29
  segmentId: string;
26
30
  doc: Partial<IDocumentData>;
27
31
  sourceBody: IDocumentBody;
28
32
  targetBody: IDocumentBody;
33
+ blockRangeMappings: IDocClipboardPasteBlockRangeMapping[];
29
34
  customBlockMappings: IDocClipboardPasteCustomBlockMapping[];
30
35
  }
31
36
  export interface IDocClipboardPasteMutationInfos {
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import type { DocumentDataModel, IDisposable, Nullable } from '@univerjs/core';
17
17
  import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
18
- import { Disposable, IUniverInstanceService } from '@univerjs/core';
18
+ import { Disposable, IContextService, IUniverInstanceService } from '@univerjs/core';
19
19
  import { DocSelectionManagerService } from '@univerjs/docs';
20
20
  import { DocCanvasPopManagerService } from './doc-popup-manager.service';
21
21
  import { DocSelectionRenderService } from './selection/doc-selection-render.service';
@@ -25,14 +25,17 @@ export declare class DocFloatMenuService extends Disposable implements IRenderMo
25
25
  private readonly _docCanvasPopManagerService;
26
26
  private readonly _univerInstanceService;
27
27
  private readonly _docSelectionRenderService;
28
+ private readonly _contextService;
28
29
  private _floatMenu;
29
- constructor(_context: IRenderContext<DocumentDataModel>, _docSelectionManagerService: DocSelectionManagerService, _docCanvasPopManagerService: DocCanvasPopManagerService, _univerInstanceService: IUniverInstanceService, _docSelectionRenderService: DocSelectionRenderService);
30
+ private _suppressed;
31
+ constructor(_context: IRenderContext<DocumentDataModel>, _docSelectionManagerService: DocSelectionManagerService, _docCanvasPopManagerService: DocCanvasPopManagerService, _univerInstanceService: IUniverInstanceService, _docSelectionRenderService: DocSelectionRenderService, _contextService: IContextService);
30
32
  get floatMenu(): Nullable<{
31
33
  disposable: IDisposable;
32
34
  start: number;
33
35
  end: number;
34
36
  }>;
35
37
  hideFloatMenu(): void;
38
+ setSuppressed(suppressed: boolean): void;
36
39
  private _initSelectionChange;
37
40
  private _hideFloatMenu;
38
41
  private _showFloatMenu;
@@ -69,7 +69,7 @@ export declare class NodePositionConvertToCursor {
69
69
  };
70
70
  private _getCaretGlyph;
71
71
  private _findTextLikeGlyph;
72
- private _isNonInlineEmbedCustomBlockGlyph;
72
+ private _isNonInlineDrawingGlyph;
73
73
  private _isValidPosition;
74
74
  private _resetCurrentNodePositionState;
75
75
  private _setNodePositionState;
@@ -100,7 +100,9 @@ export declare class DocSelectionRenderService extends RxDisposable implements I
100
100
  }): void;
101
101
  setCursorManually(evtOffsetX: number, evtOffsetY: number): void;
102
102
  sync(): void;
103
+ setInputPosition(x: number, y: number): void;
103
104
  activate(x: number, y: number, force?: boolean): void;
105
+ private _positionInput;
104
106
  hasFocus(): boolean;
105
107
  focus(): void;
106
108
  blur(): void;
@@ -70,6 +70,7 @@ export declare function buildUnwrapBlockRangeActions(previousBody: IDocumentBody
70
70
  export declare function getParagraphFormattingRange(target: IDocBlockMenuTarget | null | undefined, paragraph?: IMutiPageParagraphBound | null): ITextRangeWithStyle | null;
71
71
  export declare function getParagraphMenuCommandTargetRange(commandId: string | undefined, targetRange?: ITextRangeWithStyle | null, formattingRange?: ITextRangeWithStyle | null): ITextRangeWithStyle | null | undefined;
72
72
  export declare function finishParagraphMenuCommand(docParagraphMenuService: Pick<DocParagraphMenuService, 'hideParagraphMenu'> | null | undefined, layoutService: Pick<ILayoutService, 'focus'>, hideMenu: () => void): void;
73
+ export declare function getBlockRangeClipboardTargetRange(commandId: string, target: IDocBlockMenuTarget | null | undefined, paragraph?: IMutiPageParagraphBound | null | void): ITextRangeWithStyle | null;
73
74
  export declare const ParagraphMenu: ({ popup }: {
74
75
  popup: IPopup;
75
76
  }) => import("react").JSX.Element;
@@ -15,11 +15,18 @@
15
15
  */
16
16
  import type { IMenuManagerService as IMenuManagerServiceType, IMenuSchema } from '@univerjs/ui';
17
17
  interface IFloatToolbarProps {
18
- avaliableMenus?: string[];
18
+ avaliableMenus?: Array<string | IFloatToolbarMenuConfig>;
19
+ }
20
+ interface IFloatToolbarMenuConfig {
21
+ id: string;
22
+ iconColor?: string;
23
+ }
24
+ interface IFloatToolbarMenuSchema extends IMenuSchema {
25
+ iconColor?: string;
19
26
  }
20
27
  export declare const FLOAT_MENU_COMPONENT_KEY = "univer.doc.float-menu";
21
- export declare function resolveFloatToolbarMenus(menuManagerService: IMenuManagerServiceType, avaliableMenus: string[]): {
22
- menus: IMenuSchema[];
28
+ export declare function resolveFloatToolbarMenus(menuManagerService: IMenuManagerServiceType, avaliableMenus: Array<string | IFloatToolbarMenuConfig>): {
29
+ menus: IFloatToolbarMenuSchema[];
23
30
  extraMenus: IMenuSchema[];
24
31
  };
25
32
  export declare function FloatToolbar(props: IFloatToolbarProps): import("react").JSX.Element;