@univerjs/slides-ui 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.
Files changed (45) hide show
  1. package/lib/cjs/index.js +3 -2
  2. package/lib/es/index.js +1963 -120
  3. package/lib/index.css +1 -1
  4. package/lib/locale/en-US.json +33 -3
  5. package/lib/locale/ru-RU.json +33 -3
  6. package/lib/locale/vi-VN.json +33 -3
  7. package/lib/locale/zh-CN.json +33 -3
  8. package/lib/locale/zh-TW.json +33 -3
  9. package/lib/types/commands/operations/append-slide.operation.d.ts +3 -0
  10. package/lib/types/commands/operations/delete-element.operation.d.ts +6 -0
  11. package/lib/types/commands/operations/insert-image.operation.d.ts +6 -0
  12. package/lib/types/commands/operations/insert-shape.operation.d.ts +11 -0
  13. package/lib/types/commands/operations/insert-text.operation.d.ts +6 -0
  14. package/lib/types/commands/operations/text-edit.operation.d.ts +3 -0
  15. package/lib/types/commands/operations/update-element.operation.d.ts +7 -0
  16. package/lib/types/components/image-popup-menu/ImagePopupMenu.d.ts +19 -0
  17. package/lib/types/components/image-popup-menu/component-name.d.ts +16 -0
  18. package/lib/types/components/panels/ArrangePanel.d.ts +7 -0
  19. package/lib/types/components/panels/FillPanel.d.ts +7 -0
  20. package/lib/types/components/panels/TransformPanel.d.ts +7 -0
  21. package/lib/types/components/sidebar/Sidebar.d.ts +4 -0
  22. package/lib/types/components/upload-component/UploadFile.d.ts +9 -0
  23. package/lib/types/components/upload-component/component-name.d.ts +20 -0
  24. package/lib/types/controllers/image.menu.d.ts +7 -0
  25. package/lib/types/controllers/popup-menu.controller.d.ts +23 -0
  26. package/lib/types/controllers/shape.menu.d.ts +7 -0
  27. package/lib/types/controllers/shortcuts/editor.shortcuts.d.ts +6 -0
  28. package/lib/types/controllers/shortcuts/utils.d.ts +35 -0
  29. package/lib/types/controllers/slide-editing.render-controller.d.ts +108 -0
  30. package/lib/types/controllers/slide-editor-bridge.render-controller.d.ts +47 -0
  31. package/lib/types/controllers/slide-ui.controller.d.ts +20 -8
  32. package/lib/types/controllers/slide.render-controller.d.ts +10 -0
  33. package/lib/types/controllers/text.menu.d.ts +5 -0
  34. package/lib/types/index.d.ts +9 -0
  35. package/lib/types/locale/zh-CN.d.ts +33 -3
  36. package/lib/types/services/slide-editor-bridge.service.d.ts +94 -0
  37. package/lib/types/services/slide-editor-manager.service.d.ts +42 -0
  38. package/lib/types/services/slide-popup-manager.service.d.ts +22 -0
  39. package/lib/types/slides-ui-plugin.d.ts +7 -2
  40. package/lib/types/type.d.ts +31 -0
  41. package/lib/types/views/editor-container/EditorContainer.d.ts +10 -0
  42. package/lib/types/views/editor-container/index.d.ts +16 -0
  43. package/lib/umd/index.js +3 -2
  44. package/package.json +23 -15
  45. /package/lib/types/{views → components}/slide-bar/SlideBar.d.ts +0 -0
package/lib/index.css CHANGED
@@ -1 +1 @@
1
- .univer-slide-bar{display:flex;flex-direction:column;height:100%;background:#f5f7f9;border-right:1px solid #eaecf0;width:260px;overflow-x:hidden;overflow-y:auto}.univer-slide-bar .univer-slide-bar-content{padding:0 15px}.univer-slide-bar .univer-slide-bar-content .univer-slide-bar-item{display:flex;margin:15px 0}.univer-slide-bar .univer-slide-bar-content .univer-slide-bar-item span{width:15px;font-size:12px}.univer-slide-bar .univer-slide-bar-content .univer-slide-bar-item .univer-slide-bar-box{position:relative;width:212px;height:120px;margin-left:5px;background:#fff;border:2px solid #c0c0c0}.univer-slide-bar .univer-slide-bar-content .univer-slide-bar-item .univer-slide-bar-box:hover{border:2px solid #d66a2b}.univer-slide-bar .univer-slide-bar-content .univer-slide-bar-item-active span{color:#d66a2b}.univer-slide-bar .univer-slide-bar-content .univer-slide-bar-item-active .univer-slide-bar-box{border:2px solid #d66a2b}.univer-slide-bar .univer-slide-add-button{padding:10px 0;text-align:center}.univer-slide-bar .univer-slide-add-button button{width:45px;height:auto;font-size:24px;line-height:1;border-radius:10px}
1
+ .univer-slide-panel-color-picker{box-sizing:border-box;margin:0;padding:var(--padding-base);font-size:var(--font-size-xs);list-style:none;background-color:rgb(var(--bg-color-secondary));border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-lg);outline:none;box-shadow:var(--box-shadow-base)}.univer-image-common-panel{text-align:center;padding:var(--padding-sm);font-size:var(--font-size-sm)}.univer-image-common-panel-grid{position:relative;width:100%}.univer-image-common-panel-border{border-top:1px solid rgb(var(--border-color));margin-top:20px}.univer-image-common-panel-title{color:rgb(var(--text-color-secondary));text-align:left}.univer-image-common-panel-subtitle{color:rgb(var(--text-color-primary));text-align:left}.univer-image-common-panel-row{position:relative;display:flex;justify-content:flex-start;align-items:flex-start;height:100%;margin-top:10px}.univer-image-common-panel-row-vertical{justify-content:center;align-items:center;height:36px}.univer-image-common-panel-column{width:100%}.univer-image-common-panel-column-center{display:flex;justify-content:center;align-items:center}.univer-image-common-panel-inline{display:flex;align-items:center;gap:var(--margin-xxs)}.univer-image-common-panel-span2{width:50%}.univer-image-common-panel-span3{width:33.33333333%}.univer-image-common-panel-input{width:90%}.univer-image-popup-menu{display:grid;gap:var(--margin-xxs);align-items:center;box-sizing:border-box;margin-top:0;margin-bottom:0;padding:var(--padding-sm);font-size:var(--font-size-base);background-color:rgb(var(--bg-color-secondary));border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-lg);box-shadow:var(--box-shadow-lg)}.univer-image-popup-menu li{list-style:none}.univer-image-popup-menu-item{cursor:pointer;position:relative;display:flex;align-items:center;box-sizing:border-box;height:28px;font-size:var(--font-size-base);font-style:normal;line-height:20px;text-align:left;border-radius:4px;border-radius:var(--border-radius-base);transition:background .2s}.univer-image-popup-menu-item:hover{background-color:rgb(var(--bg-color-hover))}.univer-image-popup-menu-item-icon{position:absolute;top:50%;left:var(--padding-xs);transform:translateY(-50%);display:flex;align-items:center;justify-content:center}.univer-image-popup-menu-item-title{padding:var(--padding-xs) var(--padding-xs) var(--padding-xs) 0;vertical-align:middle}.univer-image-popup-menu-item-hide{color:rgb(var(--text-color-secondary))}.univer-image-popup-menu-item:hover{background:rgb(var(--grey-100))}.univer-btn-container{display:flex;align-items:center;justify-content:center;padding:3px;background:#fff;border:1px solid rgb(var(--grey-200, #e5e5e5));border-radius:4px}.univer-btn-container:hover,.univer-btn-container.univer-btn-container-expand{background:rgb(var(--grey-100, #f5f5f5))}.univer-upload-file-menu{position:absolute;height:100%;width:100%;text-align:center}.univer-upload-file-menu-input{display:none}.univer-slide-editor-container{position:absolute;z-index:10;top:200px;left:100px;display:flex;width:100px;height:50px;border:1px solid rgb(var(--primary-color));box-shadow:none;box-sizing:border-box}.univer-slide-editor-container .univer-editor-input{position:relative;display:flex;width:100%;height:100%;background:#aeaeae33}.univer-slide-editor-container .univer-editor-input canvas{position:absolute;top:-1px!important;left:-1px!important}.univer-slide-bar{display:flex;flex-direction:column;height:100%;background:#f5f7f9;border-right:1px solid #eaecf0;width:260px;overflow-x:hidden;overflow-y:auto}.univer-slide-bar .univer-slide-bar-content{padding:0 15px}.univer-slide-bar .univer-slide-bar-content-header{padding-top:var(--padding-lg);display:flex;justify-content:center}.univer-slide-bar .univer-slide-bar-content-header a{width:212px;padding:var(--padding-xs) 0;font-size:var(--font-size-sm);background:rgb(var(--bg-color-secondary));text-align:center;border:1px solid rgb(var(--border-color));border-radius:var(--border-radius-base);display:block;transition:all .25s;cursor:pointer}.univer-slide-bar .univer-slide-bar-content-header a:hover{background:rgb(var(--bg-color-hover))}.univer-slide-bar .univer-slide-bar-content .univer-slide-bar-item{display:flex;margin:var(--margin-base) 0}.univer-slide-bar .univer-slide-bar-content .univer-slide-bar-item span{width:15px;font-size:12px}.univer-slide-bar .univer-slide-bar-content .univer-slide-bar-item .univer-slide-bar-box{position:relative;width:212px;height:120px;margin-left:5px;background:#fff;border:2px solid #c0c0c0}.univer-slide-bar .univer-slide-bar-content .univer-slide-bar-item .univer-slide-bar-box:hover{border:2px solid #d66a2b}.univer-slide-bar .univer-slide-bar-content .univer-slide-bar-item-active span{color:#d66a2b}.univer-slide-bar .univer-slide-bar-content .univer-slide-bar-item-active .univer-slide-bar-box{border:2px solid #d66a2b}.univer-slide-bar .univer-slide-add-button{padding:10px 0;text-align:center}.univer-slide-bar .univer-slide-add-button button{width:45px;height:auto;font-size:24px;line-height:1;border-radius:10px}
@@ -1,6 +1,36 @@
1
1
  {
2
- "toolbar": {
3
- "undo": "Undo",
4
- "redo": "Redo"
2
+ "slide": {
3
+ "append": "Append Slide",
4
+ "text": {
5
+ "insert": {
6
+ "title": "Insert Text"
7
+ }
8
+ },
9
+ "shape": {
10
+ "insert": {
11
+ "title": "Insert Shape",
12
+ "rectangle": "Insert Rectangle"
13
+ }
14
+ },
15
+ "image": {
16
+ "insert": {
17
+ "title": "Insert Image",
18
+ "float": "Insert Float Image"
19
+ }
20
+ },
21
+ "popup": {
22
+ "edit": "Edit",
23
+ "delete": "Delete"
24
+ },
25
+ "sidebar": {
26
+ "text": "Edit Text",
27
+ "shape": "Edit Shape",
28
+ "image": "Edit Image"
29
+ },
30
+ "panel": {
31
+ "fill": {
32
+ "title": "Fill Color"
33
+ }
34
+ }
5
35
  }
6
36
  }
@@ -1,6 +1,36 @@
1
1
  {
2
- "toolbar": {
3
- "undo": "Отменить",
4
- "redo": "Повторить"
2
+ "slide": {
3
+ "append": "Append Slide",
4
+ "text": {
5
+ "insert": {
6
+ "title": "Insert Text"
7
+ }
8
+ },
9
+ "shape": {
10
+ "insert": {
11
+ "title": "Insert Shape",
12
+ "rectangle": "Insert Rectangle"
13
+ }
14
+ },
15
+ "image": {
16
+ "insert": {
17
+ "title": "Insert Image",
18
+ "float": "Insert Float Image"
19
+ }
20
+ },
21
+ "popup": {
22
+ "edit": "Edit",
23
+ "delete": "Delete"
24
+ },
25
+ "sidebar": {
26
+ "text": "Edit Text",
27
+ "shape": "Edit Shape",
28
+ "image": "Edit Image"
29
+ },
30
+ "panel": {
31
+ "fill": {
32
+ "title": "Fill Color"
33
+ }
34
+ }
5
35
  }
6
36
  }
@@ -1,6 +1,36 @@
1
1
  {
2
- "toolbar": {
3
- "undo": "Hoàn tác",
4
- "redo": "làm lại"
2
+ "slide": {
3
+ "append": "Append Slide",
4
+ "text": {
5
+ "insert": {
6
+ "title": "Insert Text"
7
+ }
8
+ },
9
+ "shape": {
10
+ "insert": {
11
+ "title": "Insert Shape",
12
+ "rectangle": "Insert Rectangle"
13
+ }
14
+ },
15
+ "image": {
16
+ "insert": {
17
+ "title": "Insert Image",
18
+ "float": "Insert Float Image"
19
+ }
20
+ },
21
+ "popup": {
22
+ "edit": "Edit",
23
+ "delete": "Delete"
24
+ },
25
+ "sidebar": {
26
+ "text": "Edit Text",
27
+ "shape": "Edit Shape",
28
+ "image": "Edit Image"
29
+ },
30
+ "panel": {
31
+ "fill": {
32
+ "title": "Fill Color"
33
+ }
34
+ }
5
35
  }
6
36
  }
@@ -1,6 +1,36 @@
1
1
  {
2
- "toolbar": {
3
- "undo": "撤销",
4
- "redo": "重做"
2
+ "slide": {
3
+ "append": "新增幻灯片",
4
+ "text": {
5
+ "insert": {
6
+ "title": "插入文本"
7
+ }
8
+ },
9
+ "shape": {
10
+ "insert": {
11
+ "title": "插入图形",
12
+ "rectangle": "插入矩形"
13
+ }
14
+ },
15
+ "image": {
16
+ "insert": {
17
+ "title": "插入图片",
18
+ "float": "插入浮动图片"
19
+ }
20
+ },
21
+ "popup": {
22
+ "edit": "编辑",
23
+ "delete": "删除"
24
+ },
25
+ "sidebar": {
26
+ "text": "编辑文本",
27
+ "shape": "编辑图形",
28
+ "image": "编辑图片"
29
+ },
30
+ "panel": {
31
+ "fill": {
32
+ "title": "填充"
33
+ }
34
+ }
5
35
  }
6
36
  }
@@ -1,6 +1,36 @@
1
1
  {
2
- "toolbar": {
3
- "undo": "撤銷",
4
- "redo": "重做"
2
+ "slide": {
3
+ "append": "Append Slide",
4
+ "text": {
5
+ "insert": {
6
+ "title": "Insert Text"
7
+ }
8
+ },
9
+ "shape": {
10
+ "insert": {
11
+ "title": "Insert Shape",
12
+ "rectangle": "Insert Rectangle"
13
+ }
14
+ },
15
+ "image": {
16
+ "insert": {
17
+ "title": "Insert Image",
18
+ "float": "Insert Float Image"
19
+ }
20
+ },
21
+ "popup": {
22
+ "edit": "Edit",
23
+ "delete": "Delete"
24
+ },
25
+ "sidebar": {
26
+ "text": "Edit Text",
27
+ "shape": "Edit Shape",
28
+ "image": "Edit Image"
29
+ },
30
+ "panel": {
31
+ "fill": {
32
+ "title": "Fill Color"
33
+ }
34
+ }
5
35
  }
6
36
  }
@@ -0,0 +1,3 @@
1
+ import { ICommand } from '@univerjs/core';
2
+
3
+ export declare const AppendSlideOperation: ICommand;
@@ -0,0 +1,6 @@
1
+ import { ICommand } from '@univerjs/core';
2
+
3
+ export interface IDeleteElementOperationParams {
4
+ id: string;
5
+ }
6
+ export declare const DeleteSlideElementOperation: ICommand<IDeleteElementOperationParams>;
@@ -0,0 +1,6 @@
1
+ import { ICommand, Nullable } from '@univerjs/core';
2
+
3
+ export interface IInsertImageOperationParams {
4
+ files: Nullable<File[]>;
5
+ }
6
+ export declare const InsertSlideFloatImageOperation: ICommand<IInsertImageOperationParams>;
@@ -0,0 +1,11 @@
1
+ import { ICommand } from '@univerjs/core';
2
+ import { ObjectType } from '@univerjs/engine-render';
3
+
4
+ export interface IInsertShapeOperationParams {
5
+ }
6
+ export declare const InsertSlideShapeRectangleOperation: ICommand<IInsertShapeOperationParams>;
7
+ export interface IToggleSlideEditSidebarOperation {
8
+ visible: string;
9
+ objectType: ObjectType;
10
+ }
11
+ export declare const ToggleSlideEditSidebarOperation: ICommand;
@@ -0,0 +1,6 @@
1
+ import { ICommand } from '@univerjs/core';
2
+
3
+ export interface ISlideAddTextParam {
4
+ text: string;
5
+ }
6
+ export declare const SlideAddTextOperation: ICommand<ISlideAddTextParam>;
@@ -0,0 +1,3 @@
1
+ import { IOperation } from '@univerjs/core';
2
+
3
+ export declare const SetTextEditArrowOperation: IOperation<any>;
@@ -0,0 +1,7 @@
1
+ import { ICommand } from '@univerjs/core';
2
+
3
+ export interface IUpdateElementOperationParams {
4
+ oKey: string;
5
+ props: Record<string, any>;
6
+ }
7
+ export declare const UpdateSlideElementOperation: ICommand<IUpdateElementOperationParams>;
@@ -0,0 +1,19 @@
1
+ import { IDrawingSearch } from '@univerjs/core';
2
+ import { default as React } from 'react';
3
+
4
+ export interface IImagePopupMenuItem {
5
+ label: string;
6
+ index: number;
7
+ commandId: string;
8
+ commandParams?: IDrawingSearch[];
9
+ disable: boolean;
10
+ }
11
+ export interface IImagePopupMenuExtraProps {
12
+ menuItems: IImagePopupMenuItem[];
13
+ }
14
+ export interface IImagePopupMenuProps {
15
+ popup: {
16
+ extraProps?: IImagePopupMenuExtraProps;
17
+ };
18
+ }
19
+ export declare const SlideImagePopupMenu: React.FC<IImagePopupMenuProps>;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
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
+ export declare const COMPONENT_SLIDE_IMAGE_POPUP_MENU = "COMPONENT_SLIDE_IMAGE_POPUP_MENU";
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+
3
+ interface IProps {
4
+ unitId: string;
5
+ }
6
+ export default function ArrangePanel(props: IProps): React.JSX.Element | null;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+
3
+ interface IProps {
4
+ unitId: string;
5
+ }
6
+ export default function ArrangePanel(props: IProps): React.JSX.Element | null;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+
3
+ interface IProps {
4
+ unitId: string;
5
+ }
6
+ export default function TransformPanel(props: IProps): React.JSX.Element | null;
7
+ export {};
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+
3
+ export declare const COMPONENT_SLIDE_SIDEBAR = "COMPONENT_SLIDE_SIDEBAR";
4
+ export default function RectSidebar(): React.JSX.Element | null;
@@ -0,0 +1,9 @@
1
+ import { Nullable } from '@univerjs/core';
2
+ import { default as React } from 'react';
3
+ import { ICustomComponentProps } from '@univerjs/ui';
4
+ import { UploadFileType } from './component-name';
5
+
6
+ export interface IUploadFileProps extends ICustomComponentProps<Nullable<File>> {
7
+ type: UploadFileType;
8
+ }
9
+ export declare const UploadFileMenu: (props: IUploadFileProps) => React.JSX.Element;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
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
+ export declare const COMPONENT_UPLOAD_FILE_MENU = "COMPONENT_UPLOAD_FILE_MENU";
17
+ export declare enum UploadFileType {
18
+ cellImage = 0,
19
+ floatImage = 1
20
+ }
@@ -0,0 +1,7 @@
1
+ import { IMenuItem } from '@univerjs/ui';
2
+ import { IAccessor } from '@univerjs/core';
3
+
4
+ export declare const IMAGE_UPLOAD_ICON = "addition-and-subtraction-single";
5
+ export declare const IMAGE_MENU_ID = "slide.menu.image";
6
+ export declare function SlideImageMenuFactory(accessor: IAccessor): IMenuItem;
7
+ export declare function UploadSlideFloatImageMenuFactory(_accessor: IAccessor): IMenuItem;
@@ -0,0 +1,23 @@
1
+ import { ICommandService, IContextService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
2
+ import { IRenderManagerService } from '@univerjs/engine-render';
3
+ import { ISidebarService } from '@univerjs/ui';
4
+ import { CanvasView } from '@univerjs/slides';
5
+ import { SlideCanvasPopMangerService } from '../services/slide-popup-manager.service';
6
+
7
+ export declare class SlidePopupMenuController extends RxDisposable {
8
+ private readonly _canvasPopManagerService;
9
+ private readonly _renderManagerService;
10
+ private readonly _univerInstanceService;
11
+ private readonly _contextService;
12
+ private readonly _canvasView;
13
+ private readonly _sidebarService;
14
+ private readonly _commandService;
15
+ private _initImagePopupMenu;
16
+ constructor(_canvasPopManagerService: SlideCanvasPopMangerService, _renderManagerService: IRenderManagerService, _univerInstanceService: IUniverInstanceService, _contextService: IContextService, _canvasView: CanvasView, _sidebarService: ISidebarService, _commandService: ICommandService);
17
+ private _init;
18
+ private _dispose;
19
+ private _create;
20
+ private _hasCropObject;
21
+ private _popupMenuListener;
22
+ private _getMenuItemsByObjectType;
23
+ }
@@ -0,0 +1,7 @@
1
+ import { IMenuButtonItem, IMenuItem } from '@univerjs/ui';
2
+ import { IAccessor } from '@univerjs/core';
3
+
4
+ export declare const GRAPH_SINGLE_ICON = "graph-single";
5
+ export declare const SHAPE_MENU_ID = "slide.menu.shape";
6
+ export declare function SlideShapeMenuFactory(accessor: IAccessor): IMenuItem;
7
+ export declare function UploadSlideFloatShapeMenuFactory(_accessor: IAccessor): IMenuButtonItem;
@@ -0,0 +1,6 @@
1
+ import { IShortcutItem, KeyCode } from '@univerjs/ui';
2
+
3
+ export declare const ARROW_SELECTION_KEYCODE_LIST: KeyCode[];
4
+ export declare const MOVE_SELECTION_KEYCODE_LIST: KeyCode[];
5
+ export declare function generateArrowSelectionShortCutItem(): IShortcutItem<object>[];
6
+ export declare const EditorDeleteLeftShortcut: IShortcutItem;
@@ -0,0 +1,35 @@
1
+ import { IContextService } from '@univerjs/core';
2
+
3
+ export declare function whenSheetFocused(contextService: IContextService): boolean;
4
+ /**
5
+ * Requires the currently focused unit to be Workbook and the sheet editor is focused but not activated.
6
+ * @param contextService
7
+ * @returns If the sheet editor is focused but not activated.
8
+ */
9
+ export declare function whenSheetEditorFocused(contextService: IContextService): boolean;
10
+ export declare function whenSheetEditorFocusedAndFxNotFocused(contextService: IContextService): boolean;
11
+ /**
12
+ * Requires the currently focused unit to be Workbook and the sheet editor is activated.
13
+ * @param contextService
14
+ * @returns If the sheet editor is activated.
15
+ */
16
+ export declare function whenSheetEditorActivated(contextService: IContextService): boolean;
17
+ export declare function whenEditorActivated(contextService: IContextService): boolean;
18
+ /**
19
+ * Requires the currently focused editor is a formula editor.
20
+ * @param contextService
21
+ * @returns If the formula editor is focused.
22
+ */
23
+ export declare function whenFormulaEditorFocused(contextService: IContextService): boolean;
24
+ /**
25
+ * Requires the currently focused editor is a formula editor, and it is activated.
26
+ * @param contextService
27
+ * @returns If the formula editor is activated.
28
+ */
29
+ export declare function whenFormulaEditorActivated(contextService: IContextService): boolean;
30
+ /**
31
+ * Requires the currently focused editor is not a formula editor, and it is activated.
32
+ * @param contextService
33
+ * @returns If the editor is activated and the editor is not the formula editor.
34
+ */
35
+ export declare function whenEditorDidNotInputFormulaActivated(contextService: IContextService): boolean;
@@ -0,0 +1,108 @@
1
+ import { Nullable, UnitModel, Disposable, ICommandService, IContextService, IResourceLoaderService, IUndoRedoService, IUniverInstanceService, LocaleService } from '@univerjs/core';
2
+ import { IDocObjectParam, TextSelectionManagerService } from '@univerjs/docs';
3
+ import { IRenderContext, IRenderModule, IRenderManagerService, ITextSelectionRenderManager } from '@univerjs/engine-render';
4
+ import { IEditorService, ILayoutService } from '@univerjs/ui';
5
+ import { ISlideEditorBridgeService } from '../services/slide-editor-bridge.service';
6
+ import { ISlideEditorManagerService } from '../services/slide-editor-manager.service';
7
+
8
+ export declare class SlideEditingRenderController extends Disposable implements IRenderModule {
9
+ private readonly _renderContext;
10
+ private readonly _layoutService;
11
+ private readonly _undoRedoService;
12
+ private readonly _contextService;
13
+ private readonly _instanceSrv;
14
+ private readonly _renderManagerService;
15
+ private readonly _editorBridgeService;
16
+ private readonly _cellEditorManagerService;
17
+ private readonly _textSelectionRenderManager;
18
+ private readonly _textSelectionManagerService;
19
+ private readonly _commandService;
20
+ protected readonly _localService: LocaleService;
21
+ private readonly _editorService;
22
+ private readonly _resourceLoaderService;
23
+ /**
24
+ * It is used to distinguish whether the user has actively moved the cursor in the editor, mainly through mouse clicks.
25
+ */
26
+ private _cursorChange;
27
+ /** If the corresponding unit is active and prepared for editing. */
28
+ private _isUnitEditing;
29
+ private _d;
30
+ constructor(_renderContext: IRenderContext<UnitModel>, _layoutService: ILayoutService, _undoRedoService: IUndoRedoService, _contextService: IContextService, _instanceSrv: IUniverInstanceService, _renderManagerService: IRenderManagerService, _editorBridgeService: ISlideEditorBridgeService, _cellEditorManagerService: ISlideEditorManagerService, _textSelectionRenderManager: ITextSelectionRenderManager, _textSelectionManagerService: TextSelectionManagerService, _commandService: ICommandService, _localService: LocaleService, _editorService: IEditorService, _resourceLoaderService: IResourceLoaderService);
31
+ dispose(): void;
32
+ private _disposeCurrent;
33
+ private _init;
34
+ private _initEditorVisibilityListener;
35
+ private _listenEditorFocus;
36
+ private _getEditorSkeleton;
37
+ private _getEditorViewModel;
38
+ private _initialCursorSync;
39
+ /**
40
+ * Set editorUnitId to curr doc.
41
+ * @param d DisposableCollection
42
+ */
43
+ private _subscribeToCurrentCell;
44
+ /**
45
+ * set size and pos of editing area
46
+ * invoked by _handleEditorVisible
47
+ *
48
+ * size & pos derives from slide-editor-bridge.service.ts@getEditRectState.position
49
+ *
50
+ * set pos of editing area
51
+ * EditorContainer.tsx cellEditorManagerService.setFocus(true) -->
52
+ * _focus$.next --> editingRenderController -->
53
+ * _textSelectionRenderManager.sync() --> _updateInputPosition --> activate(left, top)
54
+ *
55
+ * @param positionFromEditRectState
56
+ * @param canvasOffset
57
+ * @param documentSkeleton
58
+ * @param documentLayoutObject
59
+ * @param scaleX
60
+ * @param scaleY
61
+ */
62
+ private _fitTextSize;
63
+ /**
64
+ * Mainly used to pre-calculate the width of the editor,
65
+ * to determine whether it needs to be automatically widened.
66
+ */
67
+ private _predictingSize;
68
+ /**
69
+ * control the size of editing area
70
+ */
71
+ private _editAreaProcessing;
72
+ /**
73
+ * Since the document does not support cell background color, an additional rect needs to be added.
74
+ */
75
+ private _addBackground;
76
+ /**
77
+ * show input area, resize input area and then place input to right place.
78
+ * invoked when this._editorBridgeService.visible$ param.visible = true
79
+ *
80
+ * handleVisible is the 2nd part of editing.
81
+ * startEditing --> _updateEditor
82
+ * startEditing --> changeVisible --> slide-editor-bridge.render-controller.ts@changeVisible --> _editorBridgeService.changeVisible
83
+ * @param param
84
+ */
85
+ private _handleEditorVisible;
86
+ private _resetBodyStyle;
87
+ /**
88
+ * Should activate the editor when the user inputs text.
89
+ * @param d DisposableCollection
90
+ */
91
+ private _initialKeyboardListener;
92
+ private _showEditorByKeyboard;
93
+ private _commandExecutedListener;
94
+ private _moveCursorCmdHandler;
95
+ private _editingChangedHandler;
96
+ private _setOpenForCurrent;
97
+ private _getEditorObject;
98
+ private _handleEditorInvisible;
99
+ private _exitInput;
100
+ private _moveCursor;
101
+ /**
102
+ * The user's operations follow the sequence of opening the editor and then moving the cursor.
103
+ * The logic here predicts the user's first cursor movement behavior based on this rule
104
+ */
105
+ private _cursorStateListener;
106
+ private _moveInEditor;
107
+ }
108
+ export declare function getEditorObject(unitId: Nullable<string>, renderManagerService: IRenderManagerService): Nullable<IDocObjectParam>;
@@ -0,0 +1,47 @@
1
+ import { UnitModel, ICommandService, IContextService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
2
+ import { TextSelectionManagerService } from '@univerjs/docs';
3
+ import { IRenderContext, IRenderModule, RichText, ITextSelectionRenderManager } from '@univerjs/engine-render';
4
+ import { CanvasView } from '@univerjs/slides';
5
+ import { Subject } from 'rxjs';
6
+ import { ISlideEditorBridgeService } from '../services/slide-editor-bridge.service';
7
+ import { ISlideRichTextProps } from '../type';
8
+
9
+ export declare class SlideEditorBridgeRenderController extends RxDisposable implements IRenderModule {
10
+ private readonly _renderContext;
11
+ private readonly _contextService;
12
+ private readonly _instanceSrv;
13
+ private readonly _commandService;
14
+ private readonly _editorBridgeService;
15
+ private readonly _textSelectionManagerService;
16
+ private readonly _textSelectionRenderManager;
17
+ private readonly _canvasView;
18
+ /**
19
+ * It is used to distinguish whether the user has actively moved the cursor in the editor, mainly through mouse clicks.
20
+ */
21
+ private _cursorChange;
22
+ /** If the corresponding unit is active and prepared for editing. */
23
+ private _isUnitEditing;
24
+ setSlideTextEditor$: Subject<ISlideRichTextProps>;
25
+ private _curRichText;
26
+ constructor(_renderContext: IRenderContext<UnitModel>, _contextService: IContextService, _instanceSrv: IUniverInstanceService, _commandService: ICommandService, _editorBridgeService: ISlideEditorBridgeService, _textSelectionManagerService: TextSelectionManagerService, _textSelectionRenderManager: ITextSelectionRenderManager, _canvasView: CanvasView);
27
+ private _init;
28
+ private _initSubjectListener;
29
+ private _setEditorRect;
30
+ private _initEventListener;
31
+ pickOtherObjects(): void;
32
+ /**
33
+ * invoked when picking other object.
34
+ *
35
+ * save editing state to curr richText.
36
+ */
37
+ endEditing(): false | undefined;
38
+ /**
39
+ * TODO calling twice ????
40
+ * editingParam derives from RichText object.
41
+ *
42
+ * TODO @lumixraku need scale param
43
+ * @param target
44
+ */
45
+ startEditing(target: RichText): void;
46
+ setEditorVisible(visible: boolean): void;
47
+ }
@@ -1,14 +1,26 @@
1
- import { Disposable, ICommandService, Injector } from '@univerjs/core';
2
- import { IUIPartsService } from '@univerjs/ui';
1
+ import { DependencyOverride, Disposable, ICommandService, Injector } from '@univerjs/core';
2
+ import { MenuConfig, ComponentManager, IMenuService, IShortcutService, IUIPartsService } from '@univerjs/ui';
3
3
 
4
+ export interface IUniverSlidesDrawingConfig {
5
+ menu?: MenuConfig;
6
+ override?: DependencyOverride;
7
+ }
8
+ export declare const DefaultSlidesDrawingConfig: IUniverSlidesDrawingConfig;
4
9
  /**
5
10
  * This controller registers UI parts of slide workbench to the base-ui workbench.
6
11
  */
7
- export declare class SlideUIController extends Disposable {
8
- private readonly _injector;
9
- private readonly _uiPartsService;
10
- private readonly _commandService;
11
- constructor(_injector: Injector, _uiPartsService: IUIPartsService, _commandService: ICommandService);
12
+ export declare class SlidesUIController extends Disposable {
13
+ private readonly _config;
14
+ protected readonly _injector: Injector;
15
+ protected readonly _menuService: IMenuService;
16
+ protected readonly _componentManager: ComponentManager;
17
+ protected readonly _uiPartsService: IUIPartsService;
18
+ protected readonly _commandService: ICommandService;
19
+ protected readonly _shortcutService: IShortcutService;
20
+ constructor(_config: Partial<IUniverSlidesDrawingConfig>, _injector: Injector, _menuService: IMenuService, _componentManager: ComponentManager, _uiPartsService: IUIPartsService, _commandService: ICommandService, _shortcutService: IShortcutService);
21
+ private _initMenus;
22
+ private _initCustomComponents;
12
23
  private _initCommands;
13
- private _initUIComponents;
24
+ protected _initUIComponents(): void;
25
+ private _initShortcuts;
14
26
  }