@univerjs/slides-ui 0.5.4 → 0.5.5-experimental.20250123-34738ff
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 +2 -10
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/index.js +1497 -1521
- package/lib/es/locale/en-US.js +2 -2
- package/lib/es/locale/fa-IR.js +2 -2
- package/lib/es/locale/fr-FR.js +2 -2
- package/lib/es/locale/ru-RU.js +3 -3
- package/lib/es/locale/vi-VN.js +3 -3
- package/lib/es/locale/zh-CN.js +2 -2
- package/lib/es/locale/zh-TW.js +3 -3
- package/lib/index.css +1 -1
- package/lib/types/components/panels/ArrangePanel.d.ts +16 -2
- package/lib/types/components/panels/FillPanel.d.ts +16 -2
- package/lib/types/components/panels/TransformPanel.d.ts +16 -2
- package/lib/types/components/sidebar/Sidebar.d.ts +16 -2
- package/lib/types/components/slide-bar/SlideBar.d.ts +16 -2
- package/lib/types/controllers/slide-editing.render-controller.d.ts +3 -4
- package/lib/types/services/slide-editor-bridge.service.d.ts +4 -4
- package/lib/umd/index.js +2 -10
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +13 -13
- package/LICENSE +0 -176
package/lib/es/index.js
CHANGED
|
@@ -1,42 +1,44 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
5
|
+
import { Inject, Injector, RxDisposable, UniverInstanceType, debounce, getColorStyle, IUniverInstanceService, CommandType, Tools, useDependency, LocaleService, ICommandService, generateRandomId, PageElementType, BasicShapes, Disposable, DisposableCollection, toDisposable, FOCUSING_COMMON_DRAWINGS, IContextService, createInternalEditorID, createIdentifier, EDITOR_ACTIVATED, FOCUSING_EDITOR_STANDALONE, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, DocumentDataModel, VerticalAlign, HorizontalAlign, WrapStrategy, FOCUSING_EDITOR_BUT_HIDDEN, DEFAULT_EMPTY_DOCUMENT_VALUE, Direction, IUndoRedoService, DocumentFlavor, FOCUSING_UNIVER_EDITOR, FORMULA_EDITOR_ACTIVATED, connectInjector, Plugin, merge, mergeOverrideWithDependencies, IConfigService } from "@univerjs/core";
|
|
6
|
+
import { Viewport, ScrollBar, Slide, Rect, Scene, IRenderManagerService, ObjectType, pxToNum, DeviceInputEventType, convertTextRotation, FIX_ONE_PIXEL_BLUR_OFFSET, fixLineWidthByScale } from "@univerjs/engine-render";
|
|
7
|
+
import { ObjectProvider, SLIDE_KEY } from "@univerjs/slides";
|
|
8
|
+
import { ISidebarService, ICanvasPopupService, KeyCode, ILayoutService, ILocalFileService, useObservable, DISABLE_AUTO_FOCUS_KEY, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, MetaKeys, ComponentManager, BuiltInUIPart, IMenuManagerService, IUIPartsService, IShortcutService } from "@univerjs/ui";
|
|
9
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
10
|
+
import { Button, InputNumber, DropdownLegacy, ColorPicker, Scrollbar } from "@univerjs/design";
|
|
11
|
+
import React, { forwardRef, useRef, createElement, useState, useEffect, useMemo, useCallback } from "react";
|
|
12
|
+
import { BehaviorSubject, Subject, filter, takeUntil } from "rxjs";
|
|
13
|
+
import { DocSelectionManagerService, DocSkeletonManagerService, RichTextEditingMutation } from "@univerjs/docs";
|
|
14
|
+
import { IEditorService, DocSelectionRenderService, VIEWPORT_KEY, DOCS_COMPONENT_MAIN_LAYER_INDEX, MoveSelectionOperation, MoveCursorOperation, DOCS_VIEW_KEY, DeleteLeftCommand } from "@univerjs/docs-ui";
|
|
15
|
+
import { DRAWING_IMAGE_ALLOW_IMAGE_LIST, IImageIoService, getImageSize } from "@univerjs/drawing";
|
|
16
|
+
var __defProp$9 = Object.defineProperty, __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor, __decorateClass$9 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
17
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
18
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
19
|
+
return kind && result && __defProp$9(target, key, result), result;
|
|
20
|
+
}, "__decorateClass$9"), __decorateParam$9 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$9"), _a;
|
|
21
|
+
let SlideRenderController = (_a = class extends RxDisposable {
|
|
22
|
+
constructor(_renderContext, _injector, _univerInstanceService, _renderManagerService) {
|
|
21
23
|
super();
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
__publicField(this, "_objectProvider", null);
|
|
25
|
+
__publicField(this, "_refreshThumb", debounce(() => {
|
|
24
26
|
this.createThumbs();
|
|
25
27
|
}, 300));
|
|
26
|
-
this._renderContext =
|
|
28
|
+
this._renderContext = _renderContext, this._injector = _injector, this._univerInstanceService = _univerInstanceService, this._renderManagerService = _renderManagerService, this._objectProvider = this._injector.createInstance(ObjectProvider), this._addNewRender();
|
|
27
29
|
}
|
|
28
30
|
_addNewRender() {
|
|
29
|
-
const { unitId
|
|
30
|
-
if (!
|
|
31
|
-
const
|
|
32
|
-
this._scrollToCenter(),
|
|
31
|
+
const { unitId, engine, scene } = this._renderContext, slideDataModel = this._getCurrUnitModel();
|
|
32
|
+
if (!slideDataModel) return;
|
|
33
|
+
const observer = engine.onTransformChange$.subscribeEvent(() => {
|
|
34
|
+
this._scrollToCenter(), observer == null || observer.unsubscribe();
|
|
33
35
|
});
|
|
34
|
-
|
|
36
|
+
engine.onTransformChange$.subscribeEvent(() => {
|
|
35
37
|
setTimeout(() => {
|
|
36
38
|
this.createThumbs();
|
|
37
39
|
}, 300);
|
|
38
40
|
});
|
|
39
|
-
const
|
|
41
|
+
const viewMain = new Viewport(SLIDE_KEY.VIEW, scene, {
|
|
40
42
|
left: 0,
|
|
41
43
|
top: 0,
|
|
42
44
|
bottom: 0,
|
|
@@ -45,97 +47,97 @@ let pe = class extends fe {
|
|
|
45
47
|
explicitViewportHeightSet: !1,
|
|
46
48
|
isWheelPreventDefaultX: !0
|
|
47
49
|
});
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
const
|
|
52
|
-
let
|
|
53
|
-
|
|
50
|
+
scene.attachControl(), scene.onMouseWheel$.subscribeEvent((evt, state) => {
|
|
51
|
+
const e = evt;
|
|
52
|
+
if (e.ctrlKey) {
|
|
53
|
+
const deltaFactor = Math.abs(e.deltaX);
|
|
54
|
+
let scrollNum = deltaFactor < 40 ? 0.2 : deltaFactor < 80 ? 0.4 : 0.2;
|
|
55
|
+
scrollNum *= e.deltaY > 0 ? -1 : 1, scene.scaleX < 1 && (scrollNum /= 2), scene.scaleX + scrollNum > 4 ? scene.scale(4, 4) : scene.scaleX + scrollNum < 0.1 ? scene.scale(0.1, 0.1) : (e.deltaY > 0, e.preventDefault());
|
|
54
56
|
} else
|
|
55
|
-
|
|
56
|
-
}),
|
|
57
|
+
viewMain.onMouseWheel(e, state);
|
|
58
|
+
}), scene.onFileLoaded$.subscribeEvent(() => {
|
|
57
59
|
this._refreshThumb();
|
|
58
|
-
}),
|
|
59
|
-
const
|
|
60
|
-
this._renderContext.mainComponent =
|
|
61
|
-
|
|
60
|
+
}), ScrollBar.attachTo(viewMain), this._renderManagerService.setCurrent(unitId);
|
|
61
|
+
const slide = this._createSlide(scene);
|
|
62
|
+
this._renderContext.mainComponent = slide, this._createSlidePages(slideDataModel, slide), this.createThumbs(), engine.runRenderLoop(() => {
|
|
63
|
+
scene.render();
|
|
62
64
|
});
|
|
63
65
|
}
|
|
64
66
|
_scrollToCenter() {
|
|
65
|
-
var
|
|
66
|
-
const
|
|
67
|
-
if (!
|
|
68
|
-
const { left:
|
|
69
|
-
|
|
70
|
-
x
|
|
71
|
-
y
|
|
67
|
+
var _a11;
|
|
68
|
+
const mainScene = (_a11 = this._currentRender()) == null ? void 0 : _a11.scene, viewMain = mainScene == null ? void 0 : mainScene.getViewport(SLIDE_KEY.VIEW), getCenterPositionViewPort = this._getCenterPositionViewPort(mainScene);
|
|
69
|
+
if (!viewMain || !getCenterPositionViewPort) return;
|
|
70
|
+
const { left: viewPortLeft, top: viewPortTop } = getCenterPositionViewPort, { x, y } = viewMain.transViewportScroll2ScrollValue(viewPortLeft, viewPortTop);
|
|
71
|
+
viewMain.scrollToBarPos({
|
|
72
|
+
x,
|
|
73
|
+
y
|
|
72
74
|
});
|
|
73
75
|
}
|
|
74
76
|
_currentRender() {
|
|
75
|
-
return this._renderManagerService.getCurrentTypeOfRenderer(
|
|
77
|
+
return this._renderManagerService.getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_SLIDE);
|
|
76
78
|
}
|
|
77
79
|
/**
|
|
78
80
|
* @param mainScene
|
|
79
81
|
*/
|
|
80
|
-
_createSlide(
|
|
81
|
-
const
|
|
82
|
-
left: (
|
|
83
|
-
top: (
|
|
84
|
-
width
|
|
85
|
-
height
|
|
82
|
+
_createSlide(mainScene) {
|
|
83
|
+
const model = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SLIDE), { width: sceneWidth, height: sceneHeight } = mainScene, pageSize = model.getPageSize(), { width = 100, height = 100 } = pageSize, slideComponent = new Slide(SLIDE_KEY.COMPONENT, {
|
|
84
|
+
left: (sceneWidth - width) / 2,
|
|
85
|
+
top: (sceneHeight - height) / 2,
|
|
86
|
+
width,
|
|
87
|
+
height,
|
|
86
88
|
zIndex: 10
|
|
87
89
|
});
|
|
88
|
-
return
|
|
90
|
+
return slideComponent.enableSelectedClipElement(), mainScene.addObject(slideComponent), slideComponent;
|
|
89
91
|
}
|
|
90
|
-
_addBackgroundRect(
|
|
91
|
-
const
|
|
92
|
+
_addBackgroundRect(scene, fill) {
|
|
93
|
+
const pageSize = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SLIDE).getPageSize(), { width: pageWidth = 0, height: pageHeight = 0 } = pageSize, page = new Rect("canvas", {
|
|
92
94
|
left: 0,
|
|
93
95
|
top: 0,
|
|
94
|
-
width:
|
|
95
|
-
height:
|
|
96
|
+
width: pageWidth,
|
|
97
|
+
height: pageHeight,
|
|
96
98
|
strokeWidth: 1,
|
|
97
99
|
stroke: "rgba(198,198,198,1)",
|
|
98
|
-
fill:
|
|
100
|
+
fill: getColorStyle(fill) || "rgba(255,255,255,1)",
|
|
99
101
|
zIndex: 0,
|
|
100
102
|
evented: !1
|
|
101
103
|
});
|
|
102
|
-
|
|
104
|
+
scene.addObject(page, 0);
|
|
103
105
|
}
|
|
104
|
-
_getCenterPositionViewPort(
|
|
105
|
-
if (!
|
|
106
|
-
const { width
|
|
106
|
+
_getCenterPositionViewPort(mainScene) {
|
|
107
|
+
if (!mainScene) return { left: 0, top: 0 };
|
|
108
|
+
const { width, height } = mainScene, engine = mainScene.getEngine(), canvasWidth = (engine == null ? void 0 : engine.width) || 0, canvasHeight = (engine == null ? void 0 : engine.height) || 0;
|
|
107
109
|
return {
|
|
108
|
-
left: (
|
|
109
|
-
top: (
|
|
110
|
+
left: (width - canvasWidth) / 2,
|
|
111
|
+
top: (height - canvasHeight) / 2
|
|
110
112
|
};
|
|
111
113
|
}
|
|
112
|
-
_thumbSceneRender(
|
|
113
|
-
const
|
|
114
|
-
if (
|
|
114
|
+
_thumbSceneRender(pageId, slide) {
|
|
115
|
+
const render2 = this._renderManagerService.getRenderById(pageId);
|
|
116
|
+
if (render2 == null)
|
|
115
117
|
return;
|
|
116
|
-
const { engine:
|
|
117
|
-
if (
|
|
118
|
+
const { engine: thumbEngine } = render2;
|
|
119
|
+
if (thumbEngine == null)
|
|
118
120
|
return;
|
|
119
|
-
const { width
|
|
120
|
-
|
|
121
|
+
const { width, height } = slide, { width: pageWidth = width, height: pageHeight = height } = thumbEngine, thumbContext = thumbEngine.getCanvas().getContext();
|
|
122
|
+
slide.renderToThumb(thumbContext, pageId, pageWidth / width, pageHeight / height);
|
|
121
123
|
}
|
|
122
124
|
/**
|
|
123
125
|
* CreateScene by pages, and activate first one.
|
|
124
126
|
* @param slideDataModel
|
|
125
127
|
* @param slide
|
|
126
128
|
*/
|
|
127
|
-
_createSlidePages(
|
|
128
|
-
const
|
|
129
|
-
if (!(!
|
|
130
|
-
for (let
|
|
131
|
-
const
|
|
132
|
-
this.createPageScene(
|
|
129
|
+
_createSlidePages(slideDataModel, slide) {
|
|
130
|
+
const pages = slideDataModel.getPages(), pageOrder = slideDataModel.getPageOrder();
|
|
131
|
+
if (!(!pages || !pageOrder) && pageOrder.length !== 0) {
|
|
132
|
+
for (let i = 0, len = pageOrder.length; i < len; i++) {
|
|
133
|
+
const pageId = pageOrder[i];
|
|
134
|
+
this.createPageScene(pageId, pages[pageId]), this._createThumb(pageId);
|
|
133
135
|
}
|
|
134
|
-
|
|
136
|
+
slide.activeFirstPage();
|
|
135
137
|
}
|
|
136
138
|
}
|
|
137
|
-
_createThumb(
|
|
138
|
-
this._renderManagerService.createRender(
|
|
139
|
+
_createThumb(pageId) {
|
|
140
|
+
this._renderManagerService.createRender(pageId);
|
|
139
141
|
}
|
|
140
142
|
/**
|
|
141
143
|
* SlideDataModel is UnitModel
|
|
@@ -143,34 +145,34 @@ let pe = class extends fe {
|
|
|
143
145
|
_getCurrUnitModel() {
|
|
144
146
|
return this._renderContext.unit;
|
|
145
147
|
}
|
|
146
|
-
activePage(
|
|
147
|
-
let
|
|
148
|
-
const
|
|
149
|
-
let
|
|
150
|
-
if (
|
|
151
|
-
|
|
148
|
+
activePage(_pageId) {
|
|
149
|
+
let pageId = _pageId;
|
|
150
|
+
const model = this._getCurrUnitModel();
|
|
151
|
+
let page;
|
|
152
|
+
if (pageId)
|
|
153
|
+
page = model.getPage(pageId);
|
|
152
154
|
else {
|
|
153
|
-
const
|
|
154
|
-
if (
|
|
155
|
+
const pageElements = model.getPages(), pageOrder = model.getPageOrder();
|
|
156
|
+
if (pageOrder == null || pageElements == null)
|
|
155
157
|
return;
|
|
156
|
-
|
|
158
|
+
page = pageElements[pageOrder[0]], pageId = page.id;
|
|
157
159
|
}
|
|
158
|
-
const
|
|
159
|
-
if (
|
|
160
|
+
const render2 = this._currentRender();
|
|
161
|
+
if (page == null || render2 == null || render2.mainComponent == null)
|
|
160
162
|
return;
|
|
161
|
-
const { id
|
|
162
|
-
if (
|
|
163
|
-
|
|
163
|
+
const { id } = page, slide = render2.mainComponent;
|
|
164
|
+
if (model.setActivePage(page), slide != null && slide.hasPage(id)) {
|
|
165
|
+
slide.changePage(id);
|
|
164
166
|
return;
|
|
165
167
|
}
|
|
166
|
-
this.createPageScene(
|
|
168
|
+
this.createPageScene(id, page);
|
|
167
169
|
}
|
|
168
170
|
createThumbs() {
|
|
169
|
-
const
|
|
170
|
-
if (!(!
|
|
171
|
-
for (let
|
|
172
|
-
const
|
|
173
|
-
this._thumbSceneRender(
|
|
171
|
+
const pageOrder = this._getCurrUnitModel().getPageOrder(), render2 = this._currentRender();
|
|
172
|
+
if (!(!pageOrder || !render2) && pageOrder.length !== 0)
|
|
173
|
+
for (let i = 0, len = pageOrder.length; i < len; i++) {
|
|
174
|
+
const pageId = pageOrder[i];
|
|
175
|
+
this._thumbSceneRender(pageId, render2.mainComponent);
|
|
174
176
|
}
|
|
175
177
|
}
|
|
176
178
|
/**
|
|
@@ -178,15 +180,15 @@ let pe = class extends fe {
|
|
|
178
180
|
* @param pageId
|
|
179
181
|
* @param page
|
|
180
182
|
*/
|
|
181
|
-
createPageScene(
|
|
182
|
-
const
|
|
183
|
-
if (!
|
|
183
|
+
createPageScene(pageId, page) {
|
|
184
|
+
const render2 = this._renderContext;
|
|
185
|
+
if (!render2 || !this._objectProvider)
|
|
184
186
|
return;
|
|
185
|
-
const { scene:
|
|
186
|
-
width
|
|
187
|
-
height
|
|
187
|
+
const { scene: mainScene, mainComponent } = render2, slide = mainComponent, { width, height } = slide, pageScene = new Scene(pageId, slide, {
|
|
188
|
+
width,
|
|
189
|
+
height
|
|
188
190
|
});
|
|
189
|
-
new
|
|
191
|
+
new Viewport(`PageViewer_${pageId}`, pageScene, {
|
|
190
192
|
left: 0,
|
|
191
193
|
top: 0,
|
|
192
194
|
bottom: 0,
|
|
@@ -194,529 +196,511 @@ let pe = class extends fe {
|
|
|
194
196
|
explicitViewportWidthSet: !1,
|
|
195
197
|
explicitViewportHeightSet: !1
|
|
196
198
|
}).closeClip();
|
|
197
|
-
const { pageElements
|
|
198
|
-
if (!
|
|
199
|
-
this._addBackgroundRect(
|
|
200
|
-
|
|
199
|
+
const { pageElements, pageBackgroundFill } = page, objects = this._objectProvider.convertToRenderObjects(pageElements, mainScene);
|
|
200
|
+
if (!objects || !slide) return;
|
|
201
|
+
this._addBackgroundRect(pageScene, pageBackgroundFill), pageScene.addObjects(objects), pageScene.initTransformer(), objects.forEach((object) => {
|
|
202
|
+
pageScene.attachTransformerTo(object);
|
|
201
203
|
});
|
|
202
|
-
const
|
|
203
|
-
return
|
|
204
|
-
this._thumbSceneRender(
|
|
205
|
-
}),
|
|
206
|
-
this._thumbSceneRender(
|
|
207
|
-
}),
|
|
204
|
+
const transformer = pageScene.getTransformer();
|
|
205
|
+
return transformer == null || transformer.changeEnd$.subscribe(() => {
|
|
206
|
+
this._thumbSceneRender(pageId, slide);
|
|
207
|
+
}), transformer == null || transformer.clearControl$.subscribe(() => {
|
|
208
|
+
this._thumbSceneRender(pageId, slide);
|
|
209
|
+
}), slide.addPageScene(pageScene), pageScene;
|
|
208
210
|
}
|
|
209
211
|
/**
|
|
210
212
|
* Get pageScene from Slide.
|
|
211
213
|
* @param pageId
|
|
212
214
|
* @returns {Scene, Engine, UnitModel} scene & engine & unit from renderContext
|
|
213
215
|
*/
|
|
214
|
-
getPageRenderUnit(
|
|
215
|
-
const
|
|
216
|
+
getPageRenderUnit(pageId) {
|
|
217
|
+
const pageScene = this._renderContext.mainComponent.getSubScenes().get(pageId), { engine, unit } = this._renderContext;
|
|
216
218
|
return {
|
|
217
|
-
scene:
|
|
218
|
-
engine
|
|
219
|
-
unit
|
|
219
|
+
scene: pageScene,
|
|
220
|
+
engine,
|
|
221
|
+
unit
|
|
220
222
|
};
|
|
221
223
|
}
|
|
222
|
-
createObjectToPage(
|
|
223
|
-
const { scene
|
|
224
|
-
if (!
|
|
224
|
+
createObjectToPage(element2, pageID) {
|
|
225
|
+
const { scene } = this.getPageRenderUnit(pageID);
|
|
226
|
+
if (!scene || !this._objectProvider)
|
|
225
227
|
return;
|
|
226
|
-
const
|
|
227
|
-
if (
|
|
228
|
-
return
|
|
229
|
-
}
|
|
230
|
-
setObjectActiveByPage(
|
|
231
|
-
const { scene
|
|
232
|
-
if (!
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
removeObjectById(
|
|
237
|
-
const { scene
|
|
238
|
-
if (!
|
|
239
|
-
|
|
240
|
-
const
|
|
241
|
-
|
|
228
|
+
const object = this._objectProvider.convertToRenderObject(element2, scene);
|
|
229
|
+
if (object)
|
|
230
|
+
return scene.addObject(object), scene.attachTransformerTo(object), scene.getLayer().makeDirty(), object;
|
|
231
|
+
}
|
|
232
|
+
setObjectActiveByPage(obj, pageID) {
|
|
233
|
+
const { scene } = this.getPageRenderUnit(pageID);
|
|
234
|
+
if (!scene) return;
|
|
235
|
+
const transformer = scene.getTransformer();
|
|
236
|
+
transformer == null || transformer.activeAnObject(obj);
|
|
237
|
+
}
|
|
238
|
+
removeObjectById(id, pageID) {
|
|
239
|
+
const { scene } = this.getPageRenderUnit(pageID);
|
|
240
|
+
if (!scene) return;
|
|
241
|
+
scene.removeObject(id);
|
|
242
|
+
const transformer = scene.getTransformer();
|
|
243
|
+
transformer == null || transformer.clearControls();
|
|
242
244
|
}
|
|
243
245
|
appendPage() {
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
246
|
+
const model = this._getCurrUnitModel(), page = model.getBlankPage(), render2 = this._currentRender();
|
|
247
|
+
if (page == null || render2 == null || render2.mainComponent == null)
|
|
246
248
|
return;
|
|
247
|
-
const { id:
|
|
248
|
-
|
|
249
|
+
const { id: pageId } = page, slide = render2.mainComponent, scene = this.createPageScene(pageId, page);
|
|
250
|
+
slide && scene && slide.addPageScene(scene), model.appendPage(page), model.setActivePage(page);
|
|
249
251
|
}
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
],
|
|
256
|
-
var
|
|
257
|
-
for (var
|
|
258
|
-
(
|
|
259
|
-
return
|
|
260
|
-
},
|
|
261
|
-
let
|
|
262
|
-
constructor(
|
|
263
|
-
super(), this._renderManagerService =
|
|
252
|
+
}, __name(_a, "SlideRenderController"), _a);
|
|
253
|
+
SlideRenderController = __decorateClass$9([
|
|
254
|
+
__decorateParam$9(1, Inject(Injector)),
|
|
255
|
+
__decorateParam$9(2, IUniverInstanceService),
|
|
256
|
+
__decorateParam$9(3, IRenderManagerService)
|
|
257
|
+
], SlideRenderController);
|
|
258
|
+
var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor, __decorateClass$8 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
259
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
260
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
261
|
+
return kind && result && __defProp$8(target, key, result), result;
|
|
262
|
+
}, "__decorateClass$8"), __decorateParam$8 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$8"), _a2;
|
|
263
|
+
let CanvasView = (_a2 = class extends RxDisposable {
|
|
264
|
+
constructor(_renderManagerService) {
|
|
265
|
+
super(), this._renderManagerService = _renderManagerService;
|
|
264
266
|
}
|
|
265
|
-
_getSlideRenderControllerFromRenderUnit(
|
|
266
|
-
return this._renderManagerService.getRenderById(
|
|
267
|
+
_getSlideRenderControllerFromRenderUnit(unitId) {
|
|
268
|
+
return this._renderManagerService.getRenderById(unitId).with(SlideRenderController);
|
|
267
269
|
}
|
|
268
|
-
createThumbs(
|
|
269
|
-
this._getSlideRenderControllerFromRenderUnit(
|
|
270
|
+
createThumbs(unitId) {
|
|
271
|
+
this._getSlideRenderControllerFromRenderUnit(unitId).createThumbs();
|
|
270
272
|
}
|
|
271
|
-
activePage(
|
|
272
|
-
this._getSlideRenderControllerFromRenderUnit(
|
|
273
|
+
activePage(pageId, unitId) {
|
|
274
|
+
this._getSlideRenderControllerFromRenderUnit(unitId).activePage(pageId);
|
|
273
275
|
}
|
|
274
|
-
getRenderUnitByPageId(
|
|
275
|
-
return this._getSlideRenderControllerFromRenderUnit(
|
|
276
|
+
getRenderUnitByPageId(pageId, unitId) {
|
|
277
|
+
return this._getSlideRenderControllerFromRenderUnit(unitId).getPageRenderUnit(pageId);
|
|
276
278
|
}
|
|
277
|
-
createObjectToPage(
|
|
278
|
-
return this._getSlideRenderControllerFromRenderUnit(
|
|
279
|
+
createObjectToPage(element2, pageID, unitId) {
|
|
280
|
+
return this._getSlideRenderControllerFromRenderUnit(unitId).createObjectToPage(element2, pageID);
|
|
279
281
|
}
|
|
280
|
-
setObjectActiveByPage(
|
|
281
|
-
return this._getSlideRenderControllerFromRenderUnit(
|
|
282
|
+
setObjectActiveByPage(obj, pageID, unitId) {
|
|
283
|
+
return this._getSlideRenderControllerFromRenderUnit(unitId).setObjectActiveByPage(obj, pageID);
|
|
282
284
|
}
|
|
283
|
-
removeObjectById(
|
|
284
|
-
this._getSlideRenderControllerFromRenderUnit(
|
|
285
|
+
removeObjectById(id, pageID, unitId) {
|
|
286
|
+
this._getSlideRenderControllerFromRenderUnit(unitId).removeObjectById(id, pageID);
|
|
285
287
|
}
|
|
286
288
|
/**
|
|
287
289
|
* append blank page
|
|
288
290
|
*/
|
|
289
|
-
appendPage(
|
|
290
|
-
this._getSlideRenderControllerFromRenderUnit(
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
],
|
|
296
|
-
const
|
|
291
|
+
appendPage(unitId) {
|
|
292
|
+
this._getSlideRenderControllerFromRenderUnit(unitId).appendPage();
|
|
293
|
+
}
|
|
294
|
+
}, __name(_a2, "CanvasView"), _a2);
|
|
295
|
+
CanvasView = __decorateClass$8([
|
|
296
|
+
__decorateParam$8(0, IRenderManagerService)
|
|
297
|
+
], CanvasView);
|
|
298
|
+
const SLIDES_UI_PLUGIN_CONFIG_KEY = "slides-ui.config", defaultPluginConfig = {}, DeleteSlideElementOperation = {
|
|
297
299
|
id: "slide.operation.delete-element",
|
|
298
|
-
type:
|
|
299
|
-
handler: (
|
|
300
|
-
if (!(
|
|
301
|
-
const
|
|
302
|
-
if (!
|
|
303
|
-
const
|
|
304
|
-
return delete
|
|
305
|
-
}
|
|
300
|
+
type: CommandType.OPERATION,
|
|
301
|
+
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
302
|
+
if (!(params != null && params.id)) return !1;
|
|
303
|
+
const unitId = params.unitId, slideData = accessor.get(IUniverInstanceService).getUnit(unitId);
|
|
304
|
+
if (!slideData) return !1;
|
|
305
|
+
const activePage = slideData.getActivePage();
|
|
306
|
+
return delete activePage.pageElements[params.id], slideData.updatePage(activePage.id, activePage), accessor.get(CanvasView).removeObjectById(params.id, activePage.id, unitId), !0;
|
|
307
|
+
}, "handler")
|
|
306
308
|
};
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
* This source code is licensed under the MIT license found in the
|
|
315
|
-
* LICENSE file in the root directory of this source tree.
|
|
316
|
-
*/
|
|
317
|
-
var Ct;
|
|
318
|
-
function gi() {
|
|
319
|
-
if (Ct) return me;
|
|
320
|
-
Ct = 1;
|
|
321
|
-
var i = ke, e = Symbol.for("react.element"), t = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, r = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
322
|
-
function o(a, c, g) {
|
|
323
|
-
var l, u = {}, h = null, C = null;
|
|
324
|
-
g !== void 0 && (h = "" + g), c.key !== void 0 && (h = "" + c.key), c.ref !== void 0 && (C = c.ref);
|
|
325
|
-
for (l in c) n.call(c, l) && !s.hasOwnProperty(l) && (u[l] = c[l]);
|
|
326
|
-
if (a && a.defaultProps) for (l in c = a.defaultProps, c) u[l] === void 0 && (u[l] = c[l]);
|
|
327
|
-
return { $$typeof: e, type: a, key: h, ref: C, props: u, _owner: r.current };
|
|
328
|
-
}
|
|
329
|
-
return me.Fragment = t, me.jsx = o, me.jsxs = o, me;
|
|
330
|
-
}
|
|
331
|
-
var vt;
|
|
332
|
-
function hi() {
|
|
333
|
-
return vt || (vt = 1, Be.exports = gi()), Be.exports;
|
|
334
|
-
}
|
|
335
|
-
var d = hi();
|
|
336
|
-
function $t(i) {
|
|
337
|
-
var e, t, n = "";
|
|
338
|
-
if (typeof i == "string" || typeof i == "number") n += i;
|
|
339
|
-
else if (typeof i == "object") if (Array.isArray(i)) {
|
|
340
|
-
var r = i.length;
|
|
341
|
-
for (e = 0; e < r; e++) i[e] && (t = $t(i[e])) && (n && (n += " "), n += t);
|
|
342
|
-
} else for (t in i) i[t] && (n && (n += " "), n += t);
|
|
309
|
+
function r(e) {
|
|
310
|
+
var t, f, n = "";
|
|
311
|
+
if (typeof e == "string" || typeof e == "number") n += e;
|
|
312
|
+
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
313
|
+
var o = e.length;
|
|
314
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
315
|
+
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
343
316
|
return n;
|
|
344
317
|
}
|
|
345
|
-
|
|
346
|
-
|
|
318
|
+
__name(r, "r");
|
|
319
|
+
function clsx() {
|
|
320
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
347
321
|
return n;
|
|
348
322
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
323
|
+
__name(clsx, "clsx");
|
|
324
|
+
var __assign = function() {
|
|
325
|
+
return __assign = Object.assign || function(t) {
|
|
326
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
327
|
+
s = arguments[i];
|
|
328
|
+
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && (t[p] = s[p]);
|
|
354
329
|
}
|
|
355
|
-
return
|
|
356
|
-
},
|
|
357
|
-
},
|
|
330
|
+
return t;
|
|
331
|
+
}, __assign.apply(this, arguments);
|
|
332
|
+
}, __rest = function(s, e) {
|
|
358
333
|
var t = {};
|
|
359
|
-
for (var
|
|
360
|
-
if (
|
|
361
|
-
for (var
|
|
362
|
-
e.indexOf(
|
|
334
|
+
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
|
|
335
|
+
if (s != null && typeof Object.getOwnPropertySymbols == "function")
|
|
336
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
|
|
337
|
+
e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
|
|
363
338
|
return t;
|
|
364
|
-
},
|
|
365
|
-
var
|
|
366
|
-
return
|
|
339
|
+
}, IconBase = forwardRef(function(props, ref) {
|
|
340
|
+
var icon = props.icon, id = props.id, className = props.className, extend = props.extend, restProps = __rest(props, ["icon", "id", "className", "extend"]), cls = "univerjs-icon univerjs-icon-".concat(id, " ").concat(className || "").trim(), idSuffix = useRef("_".concat(generateShortUuid()));
|
|
341
|
+
return render(icon, "".concat(id), { defIds: icon.defIds, idSuffix: idSuffix.current }, __assign({ ref, className: cls }, restProps), extend);
|
|
367
342
|
});
|
|
368
|
-
function
|
|
369
|
-
return
|
|
370
|
-
return
|
|
343
|
+
function render(node, id, runtimeProps, rootProps, extend) {
|
|
344
|
+
return createElement(node.tag, __assign(__assign({ key: id }, replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend)), rootProps), (replaceRuntimeIdsInDefs(node, runtimeProps).children || []).map(function(child, index) {
|
|
345
|
+
return render(child, "".concat(id, "-").concat(node.tag, "-").concat(index), runtimeProps, void 0, extend);
|
|
371
346
|
}));
|
|
372
347
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
348
|
+
__name(render, "render");
|
|
349
|
+
function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
|
|
350
|
+
var attrs = __assign({}, node.attrs);
|
|
351
|
+
extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
|
|
352
|
+
var defIds = runtimeProps.defIds;
|
|
353
|
+
return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a11) {
|
|
354
|
+
var key = _a11[0], value = _a11[1];
|
|
355
|
+
typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
|
|
356
|
+
})), attrs;
|
|
381
357
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
358
|
+
__name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
|
|
359
|
+
function replaceRuntimeIdsInDefs(node, runtimeProps) {
|
|
360
|
+
var _a11, defIds = runtimeProps.defIds;
|
|
361
|
+
return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a11 = node.children) === null || _a11 === void 0) && _a11.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
|
|
362
|
+
return typeof child.attrs.id == "string" && defIds && defIds.indexOf(child.attrs.id) > -1 ? __assign(__assign({}, child), { attrs: __assign(__assign({}, child.attrs), { id: child.attrs.id + runtimeProps.idSuffix }) }) : child;
|
|
363
|
+
}) }) : node;
|
|
387
364
|
}
|
|
388
|
-
|
|
365
|
+
__name(replaceRuntimeIdsInDefs, "replaceRuntimeIdsInDefs");
|
|
366
|
+
function generateShortUuid() {
|
|
389
367
|
return Math.random().toString(36).substring(2, 8);
|
|
390
368
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
369
|
+
__name(generateShortUuid, "generateShortUuid");
|
|
370
|
+
IconBase.displayName = "UniverIcon";
|
|
371
|
+
var element$9 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.2498 3.65005C2.2498 2.87685 2.87661 2.25005 3.64981 2.25005H7.9998C8.33118 2.25005 8.5998 1.98142 8.5998 1.65005C8.5998 1.31868 8.33118 1.05005 7.9998 1.05005H3.64981C2.21387 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V8.00005C14.9498 7.66868 14.6812 7.40005 14.3498 7.40005C14.0184 7.40005 13.7498 7.66868 13.7498 8.00005V9.23974L12.2385 8.1063C11.7252 7.72129 11.0068 7.7723 10.5531 8.22605L9.00869 9.77041L6.73916 7.8251C6.24387 7.40055 5.5095 7.41278 5.02864 7.85359L2.2498 10.4009V3.65005ZM2.2498 12.0287V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.7397L11.5186 9.06631C11.4829 9.03956 11.433 9.04314 11.4016 9.07458L9.92249 10.5537L11.1015 11.5642C11.3531 11.7799 11.3822 12.1587 11.1666 12.4103C10.9509 12.6619 10.5721 12.691 10.3205 12.4753L5.9582 8.7362C5.92384 8.70674 5.87288 8.70758 5.83952 8.73816L2.2498 12.0287Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M11.8097 1.14783C12.1411 1.14783 12.4097 1.41646 12.4097 1.74783V3.297H14.1541C14.4855 3.297 14.7541 3.56563 14.7541 3.897C14.7541 4.22837 14.4855 4.497 14.1541 4.497H12.4097V6.24167C12.4097 6.57304 12.1411 6.84167 11.8097 6.84167C11.4783 6.84167 11.2097 6.57304 11.2097 6.24167V4.497H9.6603C9.32893 4.497 9.0603 4.22837 9.0603 3.897C9.0603 3.56563 9.32893 3.297 9.6603 3.297H11.2097V1.74783C11.2097 1.41646 11.4783 1.14783 11.8097 1.14783Z" } }] }, AddImageSingle = forwardRef(function(props, ref) {
|
|
372
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
394
373
|
id: "add-image-single",
|
|
395
|
-
ref
|
|
396
|
-
icon:
|
|
374
|
+
ref,
|
|
375
|
+
icon: element$9
|
|
397
376
|
}));
|
|
398
377
|
});
|
|
399
|
-
|
|
400
|
-
var
|
|
401
|
-
return
|
|
378
|
+
AddImageSingle.displayName = "AddImageSingle";
|
|
379
|
+
var element$8 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "colorChannel1", d: "M11.0363 12.2367V14.0367C11.0363 14.3681 11.3049 14.6367 11.6363 14.6367C11.9676 14.6367 12.2363 14.3681 12.2363 14.0367V12.2367H14.0364C14.3677 12.2367 14.6364 11.9681 14.6364 11.6367C14.6364 11.3054 14.3677 11.0367 14.0364 11.0367H12.2363V9.23672C12.2363 8.90535 11.9676 8.63672 11.6363 8.63672C11.3049 8.63672 11.0363 8.90535 11.0363 9.23672V11.0367H9.23635C8.90498 11.0367 8.63635 11.3054 8.63635 11.6367C8.63635 11.9681 8.90498 12.2367 9.23635 12.2367H11.0363Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M2.56365 1.36377C1.90091 1.36377 1.36365 1.90103 1.36365 2.56377V6.16377C1.36365 6.82651 1.90091 7.36377 2.56365 7.36377H6.16365C6.82639 7.36377 7.36365 6.82651 7.36365 6.16377V2.56377C7.36365 1.90103 6.82639 1.36377 6.16365 1.36377H2.56365zM6.16365 2.56377H2.56365L2.56365 6.16377H6.16365V2.56377zM2.56365 8.63647C1.90091 8.63647 1.36365 9.17373 1.36365 9.83647V13.4365C1.36365 14.0992 1.90091 14.6365 2.56365 14.6365H6.16365C6.82639 14.6365 7.36365 14.0992 7.36365 13.4365V9.83647C7.36365 9.17373 6.82639 8.63647 6.16365 8.63647H2.56365zM6.16365 9.83647H2.56365L2.56365 13.4365H6.16365V9.83647zM9.83635 7.36377C9.17361 7.36377 8.63635 6.82651 8.63635 6.16377V2.56377C8.63635 1.90103 9.17361 1.36377 9.83635 1.36377H13.4364C14.0991 1.36377 14.6364 1.90103 14.6364 2.56377V6.16377C14.6364 6.82651 14.0991 7.36377 13.4364 7.36377H9.83635zM9.83635 6.16377V2.56377L13.4364 2.56377V6.16377H9.83635z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Autofill = forwardRef(function(props, ref) {
|
|
380
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
402
381
|
id: "autofill",
|
|
403
|
-
ref
|
|
404
|
-
icon:
|
|
382
|
+
ref,
|
|
383
|
+
icon: element$8
|
|
405
384
|
}));
|
|
406
385
|
});
|
|
407
|
-
|
|
408
|
-
var
|
|
409
|
-
return
|
|
386
|
+
Autofill.displayName = "Autofill";
|
|
387
|
+
var element$7 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.0045 4.4334C14.8881 4.4334 15.6045 3.71705 15.6045 2.8334 15.6045 1.94974 14.8881 1.2334 14.0045 1.2334H3.70449C2.82084 1.2334 2.10449 1.94974 2.10449 2.8334 2.10449 3.71705 2.82084 4.4334 3.70449 4.4334H14.0045zM14.4045 2.8334C14.4045 3.05431 14.2254 3.2334 14.0045 3.2334H3.70449C3.48358 3.2334 3.30449 3.05431 3.30449 2.8334 3.30449 2.61248 3.48358 2.4334 3.70449 2.4334H14.0045C14.2254 2.4334 14.4045 2.61249 14.4045 2.8334zM14.1544 8.5999C15.038 8.5999 15.7544 7.88356 15.7544 6.9999 15.7544 6.11625 15.038 5.3999 14.1544 5.3999H3.85439C2.97074 5.3999 2.25439 6.11625 2.25439 6.9999 2.25439 7.88356 2.97074 8.5999 3.85439 8.5999H14.1544zM14.5544 6.9999C14.5544 7.22082 14.3753 7.3999 14.1544 7.3999H3.85439C3.63348 7.3999 3.45439 7.22082 3.45439 6.9999 3.45439 6.77899 3.63348 6.5999 3.85439 6.5999H14.1544C14.3753 6.5999 14.5544 6.77899 14.5544 6.9999z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M8.57975 14.5902L6.58023 12.5907C6.34591 12.3564 6.34591 11.9765 6.58023 11.7421 6.81454 11.5078 7.19444 11.5078 7.42876 11.7421L8.40449 12.7179V10.1664C8.40449 9.83504 8.67312 9.56641 9.00449 9.56641 9.33586 9.56641 9.60449 9.83504 9.60449 10.1664V12.7179L10.5802 11.7421C10.8145 11.5078 11.1944 11.5078 11.4288 11.7421 11.6631 11.9765 11.6631 12.3564 11.4288 12.5907L9.42923 14.5902M8.57975 14.5902C8.58121 14.5917 8.58268 14.5931 8.58416 14.5946 8.64077 14.6502 8.70566 14.6923 8.77482 14.7209 8.84557 14.7502 8.92314 14.7664 9.00449 14.7664 9.08585 14.7664 9.16342 14.7502 9.23416 14.7209 9.30332 14.6923 9.36821 14.6502 9.42482 14.5946" } }] }, BottomSingle = forwardRef(function(props, ref) {
|
|
388
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
410
389
|
id: "bottom-single",
|
|
411
|
-
ref
|
|
412
|
-
icon:
|
|
390
|
+
ref,
|
|
391
|
+
icon: element$7
|
|
413
392
|
}));
|
|
414
393
|
});
|
|
415
|
-
|
|
416
|
-
var
|
|
417
|
-
return
|
|
394
|
+
BottomSingle.displayName = "BottomSingle";
|
|
395
|
+
var element$6 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "g", attrs: { clipPath: "url(#graph-single_clip0_1293_28)" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M6.29541 11.1896C3.83208 10.7489 1.9624 8.59552 1.9624 6.00544C1.9624 3.09673 4.32036 0.73877 7.22907 0.73877C9.93483 0.73877 12.164 2.77918 12.4619 5.40527H13.5621C14.998 5.40527 16.1621 6.56933 16.1621 8.00527V12.6719C16.1621 14.1079 14.998 15.2719 13.5621 15.2719H8.89541C7.45947 15.2719 6.29541 14.1079 6.29541 12.6719V11.1896ZM3.1624 6.00544C3.1624 3.75947 4.98311 1.93877 7.22907 1.93877C9.27112 1.93877 10.9616 3.44388 11.2518 5.40527H8.89541C7.45947 5.40527 6.29541 6.56933 6.29541 8.00527V9.96442C4.49946 9.5425 3.1624 7.93012 3.1624 6.00544ZM7.49541 8.00527C7.49541 7.23207 8.12221 6.60527 8.89541 6.60527H13.5621C14.3353 6.60527 14.9621 7.23207 14.9621 8.00527V12.6719C14.9621 13.4451 14.3353 14.0719 13.5621 14.0719H8.89541C8.12221 14.0719 7.49541 13.4451 7.49541 12.6719V8.00527Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, { tag: "defs", attrs: {}, children: [{ tag: "clipPath", attrs: { id: "graph-single_clip0_1293_28" }, children: [{ tag: "path", attrs: { fill: "#fff", d: "M0 0H16V16H0z", transform: "translate(.9)" } }] }] }], defIds: ["graph-single_clip0_1293_28"] }, GraphSingle = forwardRef(function(props, ref) {
|
|
396
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
418
397
|
id: "graph-single",
|
|
419
|
-
ref
|
|
420
|
-
icon:
|
|
398
|
+
ref,
|
|
399
|
+
icon: element$6
|
|
421
400
|
}));
|
|
422
401
|
});
|
|
423
|
-
|
|
424
|
-
var
|
|
425
|
-
return
|
|
402
|
+
GraphSingle.displayName = "GraphSingle";
|
|
403
|
+
var element$5 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, MoreDownSingle = forwardRef(function(props, ref) {
|
|
404
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
426
405
|
id: "more-down-single",
|
|
427
|
-
ref
|
|
428
|
-
icon:
|
|
406
|
+
ref,
|
|
407
|
+
icon: element$5
|
|
429
408
|
}));
|
|
430
409
|
});
|
|
431
|
-
|
|
432
|
-
var
|
|
433
|
-
return
|
|
410
|
+
MoreDownSingle.displayName = "MoreDownSingle";
|
|
411
|
+
var element$4 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.25 2.96401C1.25 3.84767 1.96634 4.56401 2.85 4.56401H13.15C14.0337 4.56401 14.75 3.84767 14.75 2.96401C14.75 2.08036 14.0337 1.36401 13.15 1.36401H2.85C1.96635 1.36401 1.25 2.08036 1.25 2.96401ZM2.85 3.36401C2.62909 3.36401 2.45 3.18493 2.45 2.96401C2.45 2.7431 2.62909 2.56401 2.85 2.56401H13.15C13.3709 2.56401 13.55 2.7431 13.55 2.96401C13.55 3.18493 13.3709 3.36401 13.15 3.36401H2.85Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M5.57564 11.6118C5.80995 11.3774 6.18985 11.3774 6.42417 11.6118L7.3999 12.5875V6.36951C7.3999 6.03814 7.66853 5.76951 7.9999 5.76951C8.33127 5.76951 8.5999 6.03814 8.5999 6.36951V12.5875L9.57564 11.6118C9.80995 11.3774 10.1899 11.3774 10.4242 11.6118C10.6585 11.8461 10.6585 12.226 10.4242 12.4603L8.4324 14.452C8.32324 14.5655 8.16982 14.6362 7.9999 14.6362C7.82998 14.6362 7.67655 14.5655 7.56739 14.452L5.57564 12.4603C5.34132 12.226 5.34132 11.8461 5.57564 11.6118Z" } }] }, MoveDownSingle = forwardRef(function(props, ref) {
|
|
412
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
434
413
|
id: "move-down-single",
|
|
435
|
-
ref
|
|
436
|
-
icon:
|
|
414
|
+
ref,
|
|
415
|
+
icon: element$4
|
|
437
416
|
}));
|
|
438
417
|
});
|
|
439
|
-
|
|
440
|
-
var
|
|
441
|
-
return
|
|
418
|
+
MoveDownSingle.displayName = "MoveDownSingle";
|
|
419
|
+
var element$3 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.25 13.036C1.25 12.1523 1.96634 11.436 2.85 11.436H13.15C14.0337 11.436 14.75 12.1523 14.75 13.036C14.75 13.9196 14.0337 14.636 13.15 14.636H2.85C1.96635 14.636 1.25 13.9196 1.25 13.036ZM2.85 12.636C2.62909 12.636 2.45 12.8151 2.45 13.036C2.45 13.2569 2.62909 13.436 2.85 13.436H13.15C13.3709 13.436 13.55 13.2569 13.55 13.036C13.55 12.8151 13.3709 12.636 13.15 12.636H2.85Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M5.57564 4.38825C5.80995 4.62256 6.18985 4.62256 6.42417 4.38825L7.3999 3.41251V9.63049C7.3999 9.96186 7.66853 10.2305 7.9999 10.2305C8.33127 10.2305 8.5999 9.96186 8.5999 9.63049V3.41251L9.57564 4.38825C9.80995 4.62256 10.1899 4.62256 10.4242 4.38825C10.6585 4.15393 10.6585 3.77403 10.4242 3.53972L8.4324 1.54796C8.32324 1.43445 8.16982 1.36382 7.9999 1.36382C7.82998 1.36382 7.67655 1.43446 7.56739 1.54797L5.57564 3.53972C5.34132 3.77403 5.34132 4.15393 5.57564 4.38825Z" } }] }, MoveUpSingle = forwardRef(function(props, ref) {
|
|
420
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
442
421
|
id: "move-up-single",
|
|
443
|
-
ref
|
|
444
|
-
icon:
|
|
422
|
+
ref,
|
|
423
|
+
icon: element$3
|
|
445
424
|
}));
|
|
446
425
|
});
|
|
447
|
-
|
|
448
|
-
var
|
|
449
|
-
return
|
|
426
|
+
MoveUpSingle.displayName = "MoveUpSingle";
|
|
427
|
+
var element$2 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_102_1204", style: { maskType: "alpha" }, width: 16, height: 16, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#DCDCDC", d: "M0 0H16V16H0z" } }] }, { tag: "g", attrs: { mask: "url(#mask0_102_1204)" }, children: [{ tag: "rect", attrs: { width: 12.62, height: 2.79, x: 1.69, y: 12.25, fill: "colorChannel1", rx: 1.4 } }, { tag: "path", attrs: { fill: "currentColor", d: "M7.74646 2.1642C7.34284 1.65121 6.85947 1.28205 6.38447 1.09593C5.86863 0.893787 5.15166 0.852126 4.70047 1.42917C4.29842 1.94344 4.33082 2.70249 4.57691 3.50395C4.68808 3.8661 4.86846 4.22254 5.12522 4.56617C5.13695 4.58185 5.14927 4.5968 5.16211 4.61102C5.17152 4.6214 5.18122 4.63139 5.19115 4.64096C5.20459 4.65393 5.21855 4.66618 5.23296 4.6777L3.5064 6.40422C3.26756 6.64306 3.26756 7.03033 3.5064 7.26919L7.23756 11.0004C7.47648 11.2392 7.86375 11.2392 8.1026 11.0004L12.8329 6.27001C13.0717 6.03117 13.0717 5.6439 12.8329 5.40505L9.10172 1.67387C8.86288 1.43503 8.47561 1.43503 8.23676 1.67387L7.74646 2.1642ZM7.46162 4.50638C7.47252 4.57574 7.48163 4.64652 7.4888 4.71868C7.52232 5.05481 7.82194 5.30013 8.15807 5.26661C8.4942 5.23311 8.73954 4.93345 8.70601 4.59732C8.65786 4.11463 8.54251 3.6666 8.37892 3.26169L8.66928 2.97135L11.5354 5.83753L10.6106 6.76237H4.87824L7.40802 4.2326C7.42885 4.32128 7.44684 4.41255 7.46162 4.50638ZM6.87284 3.03784C6.57441 2.62008 6.22261 2.34634 5.93815 2.23487C5.80233 2.18165 5.71528 2.17827 5.67638 2.18335C5.6725 2.18387 5.66929 2.18443 5.6666 2.18497L5.6619 2.18607C5.64166 2.21954 5.53594 2.45979 5.74626 3.1449C5.81241 3.36036 5.92262 3.58602 6.09307 3.81761L6.87284 3.03784Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M12.1932 11.5463C12.6454 11.5463 13.012 11.1797 13.012 10.7275C13.012 10.4475 12.6981 9.92821 12.459 9.5733C12.3299 9.38173 12.0564 9.38174 11.9274 9.57331C11.6883 9.92822 11.3744 10.4475 11.3744 10.7275C11.3744 11.1797 11.741 11.5463 12.1932 11.5463Z" } }] }] }, PaintBucket = forwardRef(function(props, ref) {
|
|
428
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
450
429
|
id: "paint-bucket",
|
|
451
|
-
ref
|
|
452
|
-
icon:
|
|
430
|
+
ref,
|
|
431
|
+
icon: element$2
|
|
453
432
|
}));
|
|
454
433
|
});
|
|
455
|
-
|
|
456
|
-
var
|
|
457
|
-
return
|
|
434
|
+
PaintBucket.displayName = "PaintBucket";
|
|
435
|
+
var element$1 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "g", attrs: { fill: "currentColor", clipPath: "url(#text-single_clip0_1293_26)" }, children: [{ tag: "path", attrs: { d: "M2.22891 2.07227C1.89754 2.07227 1.62891 2.34089 1.62891 2.67227C1.62891 3.00364 1.89754 3.27227 2.22891 3.27227H6.29541V14.0056C6.29541 14.337 6.56404 14.6056 6.89541 14.6056C7.22678 14.6056 7.49541 14.337 7.49541 14.0056V3.27227H11.5622C11.8936 3.27227 12.1622 3.00364 12.1622 2.67227C12.1622 2.34089 11.8936 2.07227 11.5622 2.07227H2.22891Z" } }, { tag: "path", attrs: { d: "M10.2289 6.40552C9.89754 6.40552 9.62891 6.67415 9.62891 7.00552C9.62891 7.33689 9.89754 7.60552 10.2289 7.60552H12.2954V14.0055C12.2954 14.3369 12.564 14.6055 12.8954 14.6055C13.2268 14.6055 13.4954 14.3369 13.4954 14.0055V7.60552H15.5622C15.8936 7.60552 16.1622 7.33689 16.1622 7.00552C16.1622 6.67415 15.8936 6.40552 15.5622 6.40552H10.2289Z" } }] }, { tag: "defs", attrs: {}, children: [{ tag: "clipPath", attrs: { id: "text-single_clip0_1293_26" }, children: [{ tag: "path", attrs: { fill: "#fff", d: "M0 0H16V16H0z", transform: "translate(.9)" } }] }] }], defIds: ["text-single_clip0_1293_26"] }, TextSingle = forwardRef(function(props, ref) {
|
|
436
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
458
437
|
id: "text-single",
|
|
459
|
-
ref
|
|
460
|
-
icon:
|
|
438
|
+
ref,
|
|
439
|
+
icon: element$1
|
|
461
440
|
}));
|
|
462
441
|
});
|
|
463
|
-
|
|
464
|
-
var
|
|
465
|
-
return
|
|
442
|
+
TextSingle.displayName = "TextSingle";
|
|
443
|
+
var element = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M7.82994 1.40913C7.88746 1.35161 7.95376 1.30821 8.02453 1.27893C8.09527 1.24959 8.17285 1.2334 8.2542 1.2334C8.33555 1.2334 8.41313 1.24959 8.48387 1.27893C8.55464 1.30821 8.62094 1.35161 8.67846 1.40913L10.6785 3.40913C10.9128 3.64345 10.9128 4.02335 10.6785 4.25766C10.4441 4.49198 10.0642 4.49198 9.82994 4.25766L8.8542 3.28193V5.8334C8.8542 6.16477 8.58557 6.4334 8.2542 6.4334C7.92283 6.4334 7.6542 6.16477 7.6542 5.8334V3.28193L6.67846 4.25766C6.44415 4.49198 6.06425 4.49198 5.82994 4.25766C5.59562 4.02335 5.59562 3.64345 5.82994 3.40913L7.82994 1.40913Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.50439 9C1.50439 8.11634 2.22074 7.4 3.10439 7.4H13.4044C14.288 7.4 15.0044 8.11634 15.0044 9 15.0044 9.88366 14.2881 10.6 13.4044 10.6H3.1044C2.22074 10.6 1.50439 9.88366 1.50439 9zM3.10439 8.6C2.88348 8.6 2.70439 8.77909 2.70439 9 2.70439 9.22091 2.88348 9.4 3.1044 9.4H13.4044C13.6253 9.4 13.8044 9.22091 13.8044 9 13.8044 8.77909 13.6253 8.6 13.4044 8.6H3.10439zM1.6543 13.1665C1.6543 12.2828 2.37064 11.5665 3.2543 11.5665H13.5543C14.438 11.5665 15.1543 12.2828 15.1543 13.1665 15.1543 14.0502 14.438 14.7665 13.5543 14.7665H3.2543C2.37064 14.7665 1.6543 14.0502 1.6543 13.1665zM3.2543 12.7665C3.03338 12.7665 2.8543 12.9456 2.8543 13.1665 2.8543 13.3874 3.03338 13.5665 3.2543 13.5665H13.5543C13.7752 13.5665 13.9543 13.3874 13.9543 13.1665 13.9543 12.9456 13.7752 12.7665 13.5543 12.7665H3.2543z", fillRule: "evenodd", clipRule: "evenodd" } }] }, TopmostSingle = forwardRef(function(props, ref) {
|
|
444
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
466
445
|
id: "topmost-single",
|
|
467
|
-
ref
|
|
468
|
-
icon:
|
|
446
|
+
ref,
|
|
447
|
+
icon: element
|
|
469
448
|
}));
|
|
470
449
|
});
|
|
471
|
-
|
|
472
|
-
const
|
|
450
|
+
TopmostSingle.displayName = "TopmostSingle";
|
|
451
|
+
const UpdateSlideElementOperation = {
|
|
473
452
|
id: "slide.operation.update-element",
|
|
474
|
-
type:
|
|
475
|
-
handler: (
|
|
476
|
-
const { oKey
|
|
477
|
-
if (!
|
|
478
|
-
const
|
|
479
|
-
return
|
|
480
|
-
}
|
|
481
|
-
},
|
|
482
|
-
imageCommonPanel:
|
|
483
|
-
imageCommonPanelGrid:
|
|
484
|
-
imageCommonPanelBorder:
|
|
485
|
-
imageCommonPanelTitle:
|
|
486
|
-
imageCommonPanelSubtitle:
|
|
487
|
-
imageCommonPanelRow:
|
|
488
|
-
imageCommonPanelRowVertical:
|
|
489
|
-
imageCommonPanelColumn:
|
|
490
|
-
imageCommonPanelColumnCenter:
|
|
491
|
-
imageCommonPanelInline:
|
|
492
|
-
imageCommonPanelSpan2:
|
|
493
|
-
imageCommonPanelSpan3: $
|
|
494
|
-
imageCommonPanelInput:
|
|
495
|
-
slidePanelColorPicker
|
|
453
|
+
type: CommandType.OPERATION,
|
|
454
|
+
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
455
|
+
const { oKey, props } = params, univerInstanceService = accessor.get(IUniverInstanceService), unitId = params == null ? void 0 : params.unitId, slideData = univerInstanceService.getUnit(unitId);
|
|
456
|
+
if (!slideData) return !1;
|
|
457
|
+
const activePage = slideData.getActivePage();
|
|
458
|
+
return activePage.pageElements[oKey] = Tools.deepMerge(activePage.pageElements[oKey], props), slideData.updatePage(activePage.id, activePage), !0;
|
|
459
|
+
}, "handler")
|
|
460
|
+
}, imageCommonPanel$1 = "univer-image-common-panel", imageCommonPanelGrid$1 = "univer-image-common-panel-grid", imageCommonPanelBorder$1 = "univer-image-common-panel-border", imageCommonPanelTitle$1 = "univer-image-common-panel-title", imageCommonPanelSubtitle$1 = "univer-image-common-panel-subtitle", imageCommonPanelRow$1 = "univer-image-common-panel-row", imageCommonPanelRowVertical$1 = "univer-image-common-panel-row-vertical", imageCommonPanelColumn$1 = "univer-image-common-panel-column", imageCommonPanelColumnCenter$1 = "univer-image-common-panel-column-center", imageCommonPanelInline$1 = "univer-image-common-panel-inline", imageCommonPanelSpan2$1 = "univer-image-common-panel-span2", imageCommonPanelSpan3$1 = "univer-image-common-panel-span3", imageCommonPanelInput$1 = "univer-image-common-panel-input", slidePanelColorPicker = "univer-slide-panel-color-picker", styles$4 = {
|
|
461
|
+
imageCommonPanel: imageCommonPanel$1,
|
|
462
|
+
imageCommonPanelGrid: imageCommonPanelGrid$1,
|
|
463
|
+
imageCommonPanelBorder: imageCommonPanelBorder$1,
|
|
464
|
+
imageCommonPanelTitle: imageCommonPanelTitle$1,
|
|
465
|
+
imageCommonPanelSubtitle: imageCommonPanelSubtitle$1,
|
|
466
|
+
imageCommonPanelRow: imageCommonPanelRow$1,
|
|
467
|
+
imageCommonPanelRowVertical: imageCommonPanelRowVertical$1,
|
|
468
|
+
imageCommonPanelColumn: imageCommonPanelColumn$1,
|
|
469
|
+
imageCommonPanelColumnCenter: imageCommonPanelColumnCenter$1,
|
|
470
|
+
imageCommonPanelInline: imageCommonPanelInline$1,
|
|
471
|
+
imageCommonPanelSpan2: imageCommonPanelSpan2$1,
|
|
472
|
+
imageCommonPanelSpan3: imageCommonPanelSpan3$1,
|
|
473
|
+
imageCommonPanelInput: imageCommonPanelInput$1,
|
|
474
|
+
slidePanelColorPicker
|
|
496
475
|
};
|
|
497
|
-
function
|
|
498
|
-
const { pageId
|
|
499
|
-
if (!
|
|
500
|
-
const
|
|
501
|
-
if (!
|
|
502
|
-
const
|
|
503
|
-
if (!
|
|
504
|
-
const
|
|
505
|
-
const
|
|
506
|
-
const
|
|
507
|
-
return [
|
|
476
|
+
function ArrangePanel$1(props) {
|
|
477
|
+
const { pageId, unitId } = props, localeService = useDependency(LocaleService), canvasView = useDependency(CanvasView), commandService = useDependency(ICommandService), page = canvasView.getRenderUnitByPageId(pageId, unitId), scene = page == null ? void 0 : page.scene;
|
|
478
|
+
if (!scene) return null;
|
|
479
|
+
const transformer = scene.getTransformer();
|
|
480
|
+
if (!transformer) return null;
|
|
481
|
+
const object = transformer.getSelectedObjectMap().values().next().value;
|
|
482
|
+
if (!object) return null;
|
|
483
|
+
const onArrangeBtnClick = /* @__PURE__ */ __name((arrangeType) => {
|
|
484
|
+
const allObjects = scene.getAllObjects(), [minZIndex, maxZIndex] = allObjects.reduce(([min, max], obj) => {
|
|
485
|
+
const zIndex2 = obj.zIndex, minZIndex2 = zIndex2 < min ? zIndex2 : min, maxZIndex2 = zIndex2 > max ? zIndex2 : max;
|
|
486
|
+
return [minZIndex2, maxZIndex2];
|
|
508
487
|
}, [0, 0]);
|
|
509
|
-
let
|
|
510
|
-
|
|
511
|
-
zIndex
|
|
512
|
-
}),
|
|
513
|
-
unitId
|
|
514
|
-
oKey:
|
|
488
|
+
let zIndex = object.zIndex;
|
|
489
|
+
arrangeType === 3 ? zIndex = minZIndex - 1 : arrangeType === 2 ? zIndex = maxZIndex + 1 : arrangeType === 0 ? zIndex = object.zIndex + 1 : arrangeType === 1 && (zIndex = object.zIndex - 1), object.setProps({
|
|
490
|
+
zIndex
|
|
491
|
+
}), commandService.executeCommand(UpdateSlideElementOperation.id, {
|
|
492
|
+
unitId,
|
|
493
|
+
oKey: object == null ? void 0 : object.oKey,
|
|
515
494
|
props: {
|
|
516
|
-
zIndex
|
|
495
|
+
zIndex
|
|
517
496
|
}
|
|
518
497
|
});
|
|
519
|
-
};
|
|
520
|
-
return /* @__PURE__ */
|
|
521
|
-
/* @__PURE__ */
|
|
522
|
-
/* @__PURE__ */
|
|
523
|
-
/* @__PURE__ */
|
|
524
|
-
|
|
498
|
+
}, "onArrangeBtnClick");
|
|
499
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$4.imageCommonPanelGrid, children: [
|
|
500
|
+
/* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelTitle), children: /* @__PURE__ */ jsx("div", { children: localeService.t("image-panel.arrange.title") }) }) }),
|
|
501
|
+
/* @__PURE__ */ jsxs("div", { className: styles$4.imageCommonPanelRow, children: [
|
|
502
|
+
/* @__PURE__ */ jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelSpan2), children: /* @__PURE__ */ jsx(Button, { size: "small", onClick: /* @__PURE__ */ __name(() => {
|
|
503
|
+
onArrangeBtnClick(
|
|
525
504
|
0
|
|
526
505
|
/* forward */
|
|
527
506
|
);
|
|
528
|
-
}, children: /* @__PURE__ */
|
|
529
|
-
/* @__PURE__ */
|
|
530
|
-
|
|
507
|
+
}, "onClick"), children: /* @__PURE__ */ jsxs("span", { className: styles$4.imageCommonPanelInline, children: [
|
|
508
|
+
/* @__PURE__ */ jsx(MoveUpSingle, {}),
|
|
509
|
+
localeService.t("image-panel.arrange.forward")
|
|
531
510
|
] }) }) }),
|
|
532
|
-
/* @__PURE__ */
|
|
533
|
-
|
|
511
|
+
/* @__PURE__ */ jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelSpan2), children: /* @__PURE__ */ jsx(Button, { size: "small", onClick: /* @__PURE__ */ __name(() => {
|
|
512
|
+
onArrangeBtnClick(
|
|
534
513
|
1
|
|
535
514
|
/* backward */
|
|
536
515
|
);
|
|
537
|
-
}, children: /* @__PURE__ */
|
|
538
|
-
/* @__PURE__ */
|
|
539
|
-
|
|
516
|
+
}, "onClick"), children: /* @__PURE__ */ jsxs("span", { className: styles$4.imageCommonPanelInline, children: [
|
|
517
|
+
/* @__PURE__ */ jsx(MoveDownSingle, {}),
|
|
518
|
+
localeService.t("image-panel.arrange.backward")
|
|
540
519
|
] }) }) })
|
|
541
520
|
] }),
|
|
542
|
-
/* @__PURE__ */
|
|
543
|
-
/* @__PURE__ */
|
|
544
|
-
|
|
521
|
+
/* @__PURE__ */ jsxs("div", { className: styles$4.imageCommonPanelRow, children: [
|
|
522
|
+
/* @__PURE__ */ jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelSpan2), children: /* @__PURE__ */ jsx(Button, { size: "small", onClick: /* @__PURE__ */ __name(() => {
|
|
523
|
+
onArrangeBtnClick(
|
|
545
524
|
2
|
|
546
525
|
/* front */
|
|
547
526
|
);
|
|
548
|
-
}, children: /* @__PURE__ */
|
|
549
|
-
/* @__PURE__ */
|
|
550
|
-
|
|
527
|
+
}, "onClick"), children: /* @__PURE__ */ jsxs("span", { className: styles$4.imageCommonPanelInline, children: [
|
|
528
|
+
/* @__PURE__ */ jsx(TopmostSingle, {}),
|
|
529
|
+
localeService.t("image-panel.arrange.front")
|
|
551
530
|
] }) }) }),
|
|
552
|
-
/* @__PURE__ */
|
|
553
|
-
|
|
531
|
+
/* @__PURE__ */ jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelSpan2), children: /* @__PURE__ */ jsx(Button, { size: "small", onClick: /* @__PURE__ */ __name(() => {
|
|
532
|
+
onArrangeBtnClick(
|
|
554
533
|
3
|
|
555
534
|
/* back */
|
|
556
535
|
);
|
|
557
|
-
}, children: /* @__PURE__ */
|
|
558
|
-
/* @__PURE__ */
|
|
559
|
-
|
|
536
|
+
}, "onClick"), children: /* @__PURE__ */ jsxs("span", { className: styles$4.imageCommonPanelInline, children: [
|
|
537
|
+
/* @__PURE__ */ jsx(BottomSingle, {}),
|
|
538
|
+
localeService.t("image-panel.arrange.back")
|
|
560
539
|
] }) }) })
|
|
561
540
|
] })
|
|
562
541
|
] });
|
|
563
542
|
}
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
543
|
+
__name(ArrangePanel$1, "ArrangePanel$1");
|
|
544
|
+
function TransformPanel(props) {
|
|
545
|
+
const { pageId, unitId } = props, localeService = useDependency(LocaleService), canvasView = useDependency(CanvasView), commandService = useDependency(ICommandService), page = canvasView.getRenderUnitByPageId(pageId, unitId), scene = page == null ? void 0 : page.scene;
|
|
546
|
+
if (!scene) return null;
|
|
547
|
+
const transformer = scene.getTransformer();
|
|
548
|
+
if (!transformer) return null;
|
|
549
|
+
const object = transformer.getSelectedObjectMap().values().next().value;
|
|
550
|
+
if (!object) return null;
|
|
571
551
|
const {
|
|
572
|
-
width:
|
|
573
|
-
height:
|
|
574
|
-
left:
|
|
575
|
-
top:
|
|
576
|
-
angle:
|
|
577
|
-
} =
|
|
578
|
-
const { objects
|
|
579
|
-
width:
|
|
580
|
-
height:
|
|
581
|
-
left:
|
|
582
|
-
top:
|
|
583
|
-
angle:
|
|
584
|
-
} =
|
|
585
|
-
|
|
586
|
-
};
|
|
587
|
-
|
|
588
|
-
const
|
|
589
|
-
|
|
590
|
-
}),
|
|
591
|
-
|
|
552
|
+
width: originWidth = 0,
|
|
553
|
+
height: originHeight = 0,
|
|
554
|
+
left: originX = 0,
|
|
555
|
+
top: originY = 0,
|
|
556
|
+
angle: originRotation = 0
|
|
557
|
+
} = object, [width, setWidth] = useState(originWidth), [height, setHeight] = useState(originHeight), [xPosition, setXPosition] = useState(originX), [yPosition, setYPosition] = useState(originY), [rotation, setRotation] = useState(originRotation), changeObs = /* @__PURE__ */ __name((state) => {
|
|
558
|
+
const { objects } = state, object2 = objects.values().next().value, {
|
|
559
|
+
width: originWidth2 = 0,
|
|
560
|
+
height: originHeight2 = 0,
|
|
561
|
+
left: originX2 = 0,
|
|
562
|
+
top: originY2 = 0,
|
|
563
|
+
angle: originRotation2 = 0
|
|
564
|
+
} = object2;
|
|
565
|
+
setWidth(originWidth2), setHeight(originHeight2), setXPosition(originX2), setYPosition(originY2), setRotation(originRotation2);
|
|
566
|
+
}, "changeObs");
|
|
567
|
+
useEffect(() => {
|
|
568
|
+
const changeStartSub = transformer.changeStart$.subscribe((state) => {
|
|
569
|
+
changeObs(state);
|
|
570
|
+
}), changingSub = transformer.changing$.subscribe((state) => {
|
|
571
|
+
changeObs(state);
|
|
592
572
|
});
|
|
593
573
|
return () => {
|
|
594
|
-
|
|
574
|
+
changingSub.unsubscribe(), changeStartSub.unsubscribe();
|
|
595
575
|
};
|
|
596
576
|
}, []);
|
|
597
|
-
function
|
|
598
|
-
!
|
|
599
|
-
pageId
|
|
600
|
-
oKey:
|
|
577
|
+
function handleWidthChange(val) {
|
|
578
|
+
!val || !object || (commandService.executeCommand(UpdateSlideElementOperation.id, {
|
|
579
|
+
pageId,
|
|
580
|
+
oKey: object.oKey,
|
|
601
581
|
props: {
|
|
602
|
-
width:
|
|
582
|
+
width: val
|
|
603
583
|
}
|
|
604
|
-
}),
|
|
584
|
+
}), object == null || object.resize(val, object.height), setWidth(val), transformer == null || transformer.refreshControls());
|
|
605
585
|
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
586
|
+
__name(handleWidthChange, "handleWidthChange");
|
|
587
|
+
function handleHeightChange(val) {
|
|
588
|
+
!val || !object || (commandService.executeCommand(UpdateSlideElementOperation.id, {
|
|
589
|
+
pageId,
|
|
590
|
+
oKey: object.oKey,
|
|
610
591
|
props: {
|
|
611
|
-
height:
|
|
592
|
+
height: val
|
|
612
593
|
}
|
|
613
|
-
}),
|
|
594
|
+
}), object == null || object.resize(object.width, val), setHeight(val), transformer == null || transformer.refreshControls());
|
|
614
595
|
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
596
|
+
__name(handleHeightChange, "handleHeightChange");
|
|
597
|
+
function handleXChange(val) {
|
|
598
|
+
!val || !object || (commandService.executeCommand(UpdateSlideElementOperation.id, {
|
|
599
|
+
pageId,
|
|
600
|
+
oKey: object.oKey,
|
|
619
601
|
props: {
|
|
620
|
-
left:
|
|
602
|
+
left: val
|
|
621
603
|
}
|
|
622
|
-
}),
|
|
604
|
+
}), object == null || object.translate(val, object.top), setXPosition(val), transformer == null || transformer.refreshControls());
|
|
623
605
|
}
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
606
|
+
__name(handleXChange, "handleXChange");
|
|
607
|
+
function handleYChange(val) {
|
|
608
|
+
!val || !object || (commandService.executeCommand(UpdateSlideElementOperation.id, {
|
|
609
|
+
pageId,
|
|
610
|
+
oKey: object.oKey,
|
|
628
611
|
props: {
|
|
629
|
-
right:
|
|
612
|
+
right: val
|
|
630
613
|
}
|
|
631
|
-
}),
|
|
614
|
+
}), object == null || object.translate(object.left, val), setYPosition(val), transformer == null || transformer.refreshControls());
|
|
632
615
|
}
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
616
|
+
__name(handleYChange, "handleYChange");
|
|
617
|
+
function handleChangeRotation(val) {
|
|
618
|
+
!val || !object || (commandService.executeCommand(UpdateSlideElementOperation.id, {
|
|
619
|
+
pageId,
|
|
620
|
+
oKey: object.oKey,
|
|
637
621
|
props: {
|
|
638
|
-
angle:
|
|
622
|
+
angle: val
|
|
639
623
|
}
|
|
640
|
-
}),
|
|
641
|
-
angle:
|
|
642
|
-
}),
|
|
624
|
+
}), object == null || object.transformByState({
|
|
625
|
+
angle: val
|
|
626
|
+
}), setRotation(val), transformer == null || transformer.refreshControls());
|
|
643
627
|
}
|
|
644
|
-
return /* @__PURE__ */
|
|
628
|
+
return __name(handleChangeRotation, "handleChangeRotation"), /* @__PURE__ */ jsxs(
|
|
645
629
|
"div",
|
|
646
630
|
{
|
|
647
|
-
className:
|
|
631
|
+
className: clsx(styles$4.imageCommonPanelGrid, styles$4.imageCommonPanelBorder),
|
|
648
632
|
children: [
|
|
649
|
-
/* @__PURE__ */
|
|
650
|
-
/* @__PURE__ */
|
|
651
|
-
/* @__PURE__ */
|
|
652
|
-
/* @__PURE__ */
|
|
653
|
-
/* @__PURE__ */
|
|
654
|
-
|
|
633
|
+
/* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelTitle), children: /* @__PURE__ */ jsx("div", { children: localeService.t("image-panel.transform.title") }) }) }),
|
|
634
|
+
/* @__PURE__ */ jsxs("div", { className: styles$4.imageCommonPanelRow, children: [
|
|
635
|
+
/* @__PURE__ */ jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelSpan3), children: /* @__PURE__ */ jsxs("label", { children: [
|
|
636
|
+
/* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelColumn, children: localeService.t("image-panel.transform.width") }) }),
|
|
637
|
+
/* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelColumn, children: /* @__PURE__ */ jsx(
|
|
638
|
+
InputNumber,
|
|
655
639
|
{
|
|
656
|
-
className:
|
|
640
|
+
className: styles$4.imageCommonPanelInput,
|
|
657
641
|
min: 1,
|
|
658
|
-
value:
|
|
659
|
-
onChange: (
|
|
660
|
-
|
|
661
|
-
}
|
|
642
|
+
value: width,
|
|
643
|
+
onChange: /* @__PURE__ */ __name((val) => {
|
|
644
|
+
handleWidthChange(val);
|
|
645
|
+
}, "onChange")
|
|
662
646
|
}
|
|
663
647
|
) }) })
|
|
664
648
|
] }) }),
|
|
665
|
-
/* @__PURE__ */
|
|
666
|
-
/* @__PURE__ */
|
|
667
|
-
/* @__PURE__ */
|
|
668
|
-
|
|
649
|
+
/* @__PURE__ */ jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelSpan3), children: /* @__PURE__ */ jsxs("label", { children: [
|
|
650
|
+
/* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelColumn, children: localeService.t("image-panel.transform.height") }) }),
|
|
651
|
+
/* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelColumn, children: /* @__PURE__ */ jsx(
|
|
652
|
+
InputNumber,
|
|
669
653
|
{
|
|
670
|
-
className:
|
|
654
|
+
className: styles$4.imageCommonPanelInput,
|
|
671
655
|
min: 1,
|
|
672
|
-
value:
|
|
673
|
-
onChange: (
|
|
674
|
-
|
|
675
|
-
}
|
|
656
|
+
value: height,
|
|
657
|
+
onChange: /* @__PURE__ */ __name((val) => {
|
|
658
|
+
handleHeightChange(val);
|
|
659
|
+
}, "onChange")
|
|
676
660
|
}
|
|
677
661
|
) }) })
|
|
678
662
|
] }) })
|
|
679
663
|
] }),
|
|
680
|
-
/* @__PURE__ */
|
|
681
|
-
/* @__PURE__ */
|
|
682
|
-
/* @__PURE__ */
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
-
|
|
664
|
+
/* @__PURE__ */ jsxs("div", { className: styles$4.imageCommonPanelRow, children: [
|
|
665
|
+
/* @__PURE__ */ jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelSpan3), children: /* @__PURE__ */ jsxs("label", { children: [
|
|
666
|
+
/* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelColumn, children: localeService.t("image-panel.transform.x") }) }),
|
|
667
|
+
/* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelColumn, children: /* @__PURE__ */ jsx(
|
|
668
|
+
InputNumber,
|
|
685
669
|
{
|
|
686
|
-
className:
|
|
670
|
+
className: styles$4.imageCommonPanelInput,
|
|
687
671
|
precision: 1,
|
|
688
672
|
min: 0,
|
|
689
|
-
value:
|
|
690
|
-
onChange: (
|
|
691
|
-
|
|
692
|
-
}
|
|
673
|
+
value: xPosition,
|
|
674
|
+
onChange: /* @__PURE__ */ __name((val) => {
|
|
675
|
+
handleXChange(val);
|
|
676
|
+
}, "onChange")
|
|
693
677
|
}
|
|
694
678
|
) }) })
|
|
695
679
|
] }) }),
|
|
696
|
-
/* @__PURE__ */
|
|
697
|
-
/* @__PURE__ */
|
|
698
|
-
/* @__PURE__ */
|
|
699
|
-
|
|
680
|
+
/* @__PURE__ */ jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelSpan3), children: /* @__PURE__ */ jsxs("label", { children: [
|
|
681
|
+
/* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelColumn, children: localeService.t("image-panel.transform.y") }) }),
|
|
682
|
+
/* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelColumn, children: /* @__PURE__ */ jsx(
|
|
683
|
+
InputNumber,
|
|
700
684
|
{
|
|
701
|
-
className:
|
|
685
|
+
className: styles$4.imageCommonPanelInput,
|
|
702
686
|
precision: 1,
|
|
703
687
|
min: 0,
|
|
704
|
-
value:
|
|
705
|
-
onChange: (
|
|
706
|
-
|
|
707
|
-
}
|
|
688
|
+
value: yPosition,
|
|
689
|
+
onChange: /* @__PURE__ */ __name((val) => {
|
|
690
|
+
handleYChange(val);
|
|
691
|
+
}, "onChange")
|
|
708
692
|
}
|
|
709
693
|
) }) })
|
|
710
694
|
] }) }),
|
|
711
|
-
/* @__PURE__ */
|
|
712
|
-
/* @__PURE__ */
|
|
713
|
-
/* @__PURE__ */
|
|
714
|
-
|
|
695
|
+
/* @__PURE__ */ jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelSpan3), children: /* @__PURE__ */ jsxs("label", { children: [
|
|
696
|
+
/* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelColumn, children: localeService.t("image-panel.transform.rotate") }) }),
|
|
697
|
+
/* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelColumn, children: /* @__PURE__ */ jsx(
|
|
698
|
+
InputNumber,
|
|
715
699
|
{
|
|
716
|
-
className:
|
|
700
|
+
className: styles$4.imageCommonPanelInput,
|
|
717
701
|
precision: 1,
|
|
718
|
-
value:
|
|
719
|
-
onChange:
|
|
702
|
+
value: rotation,
|
|
703
|
+
onChange: handleChangeRotation
|
|
720
704
|
}
|
|
721
705
|
) }) })
|
|
722
706
|
] }) })
|
|
@@ -725,54 +709,55 @@ function Wi(i) {
|
|
|
725
709
|
}
|
|
726
710
|
);
|
|
727
711
|
}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
712
|
+
__name(TransformPanel, "TransformPanel");
|
|
713
|
+
function ArrangePanel(props) {
|
|
714
|
+
var _a11, _b;
|
|
715
|
+
const { pageId, unitId } = props, localeService = useDependency(LocaleService), canvasView = useDependency(CanvasView), commandService = useDependency(ICommandService), page = canvasView.getRenderUnitByPageId(pageId, unitId), scene = page == null ? void 0 : page.scene;
|
|
716
|
+
if (!scene) return null;
|
|
717
|
+
const transformer = scene.getTransformer();
|
|
718
|
+
if (!transformer) return null;
|
|
719
|
+
const object = transformer.getSelectedObjectMap().values().next().value;
|
|
720
|
+
if (!object) return null;
|
|
721
|
+
const [color, setColor] = React.useState((_b = (_a11 = object.fill) == null ? void 0 : _a11.toString()) != null ? _b : "");
|
|
722
|
+
function handleChangeColor(color2) {
|
|
723
|
+
object == null || object.setProps({
|
|
724
|
+
fill: color2
|
|
725
|
+
}), commandService.executeCommand(UpdateSlideElementOperation.id, {
|
|
726
|
+
unitId,
|
|
727
|
+
oKey: object == null ? void 0 : object.oKey,
|
|
743
728
|
props: {
|
|
744
729
|
shape: {
|
|
745
730
|
shapeProperties: {
|
|
746
731
|
shapeBackgroundFill: {
|
|
747
|
-
rgb:
|
|
732
|
+
rgb: color2
|
|
748
733
|
}
|
|
749
734
|
}
|
|
750
735
|
}
|
|
751
736
|
}
|
|
752
|
-
}),
|
|
737
|
+
}), setColor(color2);
|
|
753
738
|
}
|
|
754
|
-
return /* @__PURE__ */
|
|
739
|
+
return __name(handleChangeColor, "handleChangeColor"), /* @__PURE__ */ jsx(
|
|
755
740
|
"div",
|
|
756
741
|
{
|
|
757
|
-
className:
|
|
758
|
-
children: /* @__PURE__ */
|
|
759
|
-
/* @__PURE__ */
|
|
760
|
-
/* @__PURE__ */
|
|
761
|
-
|
|
742
|
+
className: clsx(styles$4.imageCommonPanelGrid, styles$4.imageCommonPanelBorder),
|
|
743
|
+
children: /* @__PURE__ */ jsxs("div", { className: styles$4.imageCommonPanelGrid, children: [
|
|
744
|
+
/* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelTitle), children: /* @__PURE__ */ jsx("div", { children: localeService.t("slide.panel.fill.title") }) }) }),
|
|
745
|
+
/* @__PURE__ */ jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelSpan2), children: /* @__PURE__ */ jsx(
|
|
746
|
+
DropdownLegacy,
|
|
762
747
|
{
|
|
763
748
|
align: {
|
|
764
749
|
offset: [0, 18]
|
|
765
750
|
},
|
|
766
|
-
overlay: /* @__PURE__ */
|
|
767
|
-
|
|
751
|
+
overlay: /* @__PURE__ */ jsx("section", { className: styles$4.slidePanelColorPicker, children: /* @__PURE__ */ jsx(
|
|
752
|
+
ColorPicker,
|
|
768
753
|
{
|
|
769
754
|
value: "#fff",
|
|
770
|
-
onChange:
|
|
755
|
+
onChange: handleChangeColor
|
|
771
756
|
}
|
|
772
757
|
) }),
|
|
773
|
-
children: /* @__PURE__ */
|
|
774
|
-
/* @__PURE__ */
|
|
775
|
-
/* @__PURE__ */
|
|
758
|
+
children: /* @__PURE__ */ jsxs("a", { className: styles$4.uiPluginSheetsBorderPanelButton, children: [
|
|
759
|
+
/* @__PURE__ */ jsx(PaintBucket, { extend: { colorChannel1: color != null ? color : "rgb(var(--primary-color))" } }),
|
|
760
|
+
/* @__PURE__ */ jsx("span", { className: styles$4.uiPluginSheetsBorderPanelMoreIcon, children: /* @__PURE__ */ jsx(MoreDownSingle, {}) })
|
|
776
761
|
] })
|
|
777
762
|
}
|
|
778
763
|
) }) })
|
|
@@ -780,63 +765,65 @@ function Ki(i) {
|
|
|
780
765
|
}
|
|
781
766
|
);
|
|
782
767
|
}
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
768
|
+
__name(ArrangePanel, "ArrangePanel");
|
|
769
|
+
const imageCommonPanel = "univer-image-common-panel", imageCommonPanelGrid = "univer-image-common-panel-grid", imageCommonPanelBorder = "univer-image-common-panel-border", imageCommonPanelTitle = "univer-image-common-panel-title", imageCommonPanelSubtitle = "univer-image-common-panel-subtitle", imageCommonPanelRow = "univer-image-common-panel-row", imageCommonPanelRowVertical = "univer-image-common-panel-row-vertical", imageCommonPanelColumn = "univer-image-common-panel-column", imageCommonPanelColumnCenter = "univer-image-common-panel-column-center", imageCommonPanelInline = "univer-image-common-panel-inline", imageCommonPanelSpan2 = "univer-image-common-panel-span2", imageCommonPanelSpan3 = "univer-image-common-panel-span3", imageCommonPanelInput = "univer-image-common-panel-input", styles$3 = {
|
|
770
|
+
imageCommonPanel,
|
|
771
|
+
imageCommonPanelGrid,
|
|
772
|
+
imageCommonPanelBorder,
|
|
773
|
+
imageCommonPanelTitle,
|
|
774
|
+
imageCommonPanelSubtitle,
|
|
775
|
+
imageCommonPanelRow,
|
|
776
|
+
imageCommonPanelRowVertical,
|
|
777
|
+
imageCommonPanelColumn,
|
|
778
|
+
imageCommonPanelColumnCenter,
|
|
779
|
+
imageCommonPanelInline,
|
|
780
|
+
imageCommonPanelSpan2,
|
|
781
|
+
imageCommonPanelSpan3,
|
|
782
|
+
imageCommonPanelInput
|
|
783
|
+
}, COMPONENT_SLIDE_SIDEBAR = "COMPONENT_SLIDE_SIDEBAR";
|
|
784
|
+
function RectSidebar() {
|
|
785
|
+
var _a11, _b, _c;
|
|
786
|
+
const univerInstanceService = useDependency(IUniverInstanceService), canvasView = useDependency(CanvasView), currentSlide = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SLIDE), pageId = (_a11 = currentSlide == null ? void 0 : currentSlide.getActivePage()) == null ? void 0 : _a11.id;
|
|
787
|
+
if (!pageId) return null;
|
|
788
|
+
const transformer = (_b = canvasView.getRenderUnitByPageId(pageId, pageId).scene) == null ? void 0 : _b.getTransformer();
|
|
789
|
+
if (!transformer) return null;
|
|
790
|
+
const object = transformer.getSelectedObjectMap().values().next().value;
|
|
791
|
+
if (!object)
|
|
806
792
|
return null;
|
|
807
|
-
const
|
|
808
|
-
return /* @__PURE__ */
|
|
809
|
-
/* @__PURE__ */
|
|
810
|
-
/* @__PURE__ */
|
|
811
|
-
|
|
793
|
+
const unitId = ((_c = univerInstanceService.getFocusedUnit()) == null ? void 0 : _c.getUnitId()) || "";
|
|
794
|
+
return /* @__PURE__ */ jsxs("section", { className: styles$3.imageCommonPanel, children: [
|
|
795
|
+
/* @__PURE__ */ jsx(ArrangePanel$1, { pageId, unitId }),
|
|
796
|
+
/* @__PURE__ */ jsx(TransformPanel, { pageId, unitId }),
|
|
797
|
+
object.objectType === ObjectType.RECT && /* @__PURE__ */ jsx(ArrangePanel, { pageId, unitId })
|
|
812
798
|
] });
|
|
813
799
|
}
|
|
814
|
-
|
|
800
|
+
__name(RectSidebar, "RectSidebar");
|
|
801
|
+
const InsertSlideShapeRectangleCommand = {
|
|
815
802
|
id: "slide.command.insert-float-shape",
|
|
816
|
-
type:
|
|
817
|
-
handler: async (
|
|
818
|
-
var
|
|
819
|
-
const
|
|
820
|
-
return
|
|
821
|
-
}
|
|
822
|
-
},
|
|
803
|
+
type: CommandType.COMMAND,
|
|
804
|
+
handler: /* @__PURE__ */ __name(async (accessor) => {
|
|
805
|
+
var _a11;
|
|
806
|
+
const commandService = accessor.get(ICommandService), unitId = (_a11 = accessor.get(IUniverInstanceService).getFocusedUnit()) == null ? void 0 : _a11.getUnitId();
|
|
807
|
+
return commandService.executeCommand(InsertSlideShapeRectangleOperation.id, { unitId });
|
|
808
|
+
}, "handler")
|
|
809
|
+
}, InsertSlideShapeRectangleOperation = {
|
|
823
810
|
id: "slide.operation.insert-float-shape",
|
|
824
|
-
type:
|
|
825
|
-
handler: async (
|
|
826
|
-
const
|
|
827
|
-
if (!
|
|
828
|
-
const
|
|
829
|
-
id
|
|
830
|
-
zIndex:
|
|
811
|
+
type: CommandType.OPERATION,
|
|
812
|
+
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
813
|
+
const id = generateRandomId(6), univerInstanceService = accessor.get(IUniverInstanceService), unitId = params.unitId, slideData = univerInstanceService.getUnit(unitId);
|
|
814
|
+
if (!slideData) return !1;
|
|
815
|
+
const activePage = slideData.getActivePage(), elements = Object.values(activePage.pageElements), maxIndex = elements != null && elements.length ? Math.max(...elements.map((element2) => element2.zIndex)) : 20, data = {
|
|
816
|
+
id,
|
|
817
|
+
zIndex: maxIndex + 1,
|
|
831
818
|
left: 378,
|
|
832
819
|
top: 142,
|
|
833
820
|
width: 250,
|
|
834
821
|
height: 250,
|
|
835
|
-
title:
|
|
822
|
+
title: id,
|
|
836
823
|
description: "",
|
|
837
|
-
type:
|
|
824
|
+
type: PageElementType.SHAPE,
|
|
838
825
|
shape: {
|
|
839
|
-
shapeType:
|
|
826
|
+
shapeType: BasicShapes.Rect,
|
|
840
827
|
text: "",
|
|
841
828
|
shapeProperties: {
|
|
842
829
|
shapeBackgroundFill: {
|
|
@@ -845,252 +832,256 @@ const Je = {
|
|
|
845
832
|
}
|
|
846
833
|
}
|
|
847
834
|
};
|
|
848
|
-
|
|
849
|
-
const
|
|
850
|
-
return
|
|
851
|
-
}
|
|
852
|
-
},
|
|
835
|
+
activePage.pageElements[id] = data, slideData.updatePage(activePage.id, activePage);
|
|
836
|
+
const canvasview = accessor.get(CanvasView), sceneObject = canvasview.createObjectToPage(data, activePage.id, unitId);
|
|
837
|
+
return sceneObject && canvasview.setObjectActiveByPage(sceneObject, activePage.id, unitId), !0;
|
|
838
|
+
}, "handler")
|
|
839
|
+
}, ToggleSlideEditSidebarOperation = {
|
|
853
840
|
id: "sidebar.operation.slide-shape",
|
|
854
|
-
type:
|
|
855
|
-
handler: async (
|
|
856
|
-
const { visible
|
|
857
|
-
let
|
|
858
|
-
return
|
|
859
|
-
header: { title:
|
|
860
|
-
children: { label:
|
|
861
|
-
onClose: () => {
|
|
862
|
-
},
|
|
841
|
+
type: CommandType.COMMAND,
|
|
842
|
+
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
843
|
+
const { visible, objectType } = params, sidebarService = accessor.get(ISidebarService), localeService = accessor.get(LocaleService);
|
|
844
|
+
let title = "", children = "";
|
|
845
|
+
return objectType === ObjectType.RECT ? (title = "slide.sidebar.shape", children = COMPONENT_SLIDE_SIDEBAR) : objectType === ObjectType.IMAGE ? (title = "slide.sidebar.image", children = COMPONENT_SLIDE_SIDEBAR) : objectType === ObjectType.RICH_TEXT && (title = "slide.sidebar.text", children = COMPONENT_SLIDE_SIDEBAR), visible ? sidebarService.open({
|
|
846
|
+
header: { title: localeService.t(title) },
|
|
847
|
+
children: { label: children },
|
|
848
|
+
onClose: /* @__PURE__ */ __name(() => {
|
|
849
|
+
}, "onClose"),
|
|
863
850
|
width: 360
|
|
864
|
-
}) :
|
|
865
|
-
}
|
|
866
|
-
},
|
|
867
|
-
var
|
|
868
|
-
for (var
|
|
869
|
-
(
|
|
870
|
-
return
|
|
871
|
-
},
|
|
872
|
-
function
|
|
873
|
-
const
|
|
851
|
+
}) : sidebarService.close(), !0;
|
|
852
|
+
}, "handler")
|
|
853
|
+
}, COMPONENT_SLIDE_IMAGE_POPUP_MENU = "COMPONENT_SLIDE_IMAGE_POPUP_MENU";
|
|
854
|
+
var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor, __decorateClass$7 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
855
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
856
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
857
|
+
return kind && result && __defProp$7(target, key, result), result;
|
|
858
|
+
}, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7");
|
|
859
|
+
function transformBound2OffsetBound(originBound, scene) {
|
|
860
|
+
const topLeft = transformPosition2Offset(originBound.left, originBound.top, scene), bottomRight = transformPosition2Offset(originBound.right, originBound.bottom, scene);
|
|
874
861
|
return {
|
|
875
|
-
left:
|
|
876
|
-
top:
|
|
877
|
-
right:
|
|
878
|
-
bottom:
|
|
862
|
+
left: topLeft.x,
|
|
863
|
+
top: topLeft.y,
|
|
864
|
+
right: bottomRight.x,
|
|
865
|
+
bottom: bottomRight.y
|
|
879
866
|
};
|
|
880
867
|
}
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
868
|
+
__name(transformBound2OffsetBound, "transformBound2OffsetBound");
|
|
869
|
+
function transformPosition2Offset(x, y, scene) {
|
|
870
|
+
const { scaleX, scaleY } = scene.getAncestorScale(), viewMain = scene.getViewport(SLIDE_KEY.VIEW);
|
|
871
|
+
if (!viewMain)
|
|
884
872
|
return {
|
|
885
|
-
x
|
|
886
|
-
y
|
|
873
|
+
x,
|
|
874
|
+
y
|
|
887
875
|
};
|
|
888
|
-
const { viewportScrollX:
|
|
876
|
+
const { viewportScrollX: actualScrollX, viewportScrollY: actualScrollY } = viewMain, offsetX = (x - actualScrollX) * scaleX, offsetY = (y - actualScrollY) * scaleY;
|
|
889
877
|
return {
|
|
890
|
-
x:
|
|
891
|
-
y:
|
|
878
|
+
x: offsetX,
|
|
879
|
+
y: offsetY
|
|
892
880
|
};
|
|
893
881
|
}
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
882
|
+
__name(transformPosition2Offset, "transformPosition2Offset");
|
|
883
|
+
var _a3;
|
|
884
|
+
let SlideCanvasPopMangerService = (_a3 = class extends Disposable {
|
|
885
|
+
constructor(_globalPopupManagerService, _renderManagerService, _univerInstanceService, _commandService) {
|
|
886
|
+
super(), this._globalPopupManagerService = _globalPopupManagerService, this._renderManagerService = _renderManagerService, this._univerInstanceService = _univerInstanceService, this._commandService = _commandService;
|
|
887
|
+
}
|
|
888
|
+
_createObjectPositionObserver(targetObject, currentRender) {
|
|
889
|
+
const position = (/* @__PURE__ */ __name(() => {
|
|
890
|
+
var _a11, _b, _c, _d;
|
|
891
|
+
const { scene, engine } = currentRender, { left, top, width, height } = targetObject, horizontalOffset = (scene.width - ((_b = (_a11 = currentRender.mainComponent) == null ? void 0 : _a11.width) != null ? _b : 0)) / 2, verticalOffset = (scene.height - ((_d = (_c = currentRender.mainComponent) == null ? void 0 : _c.height) != null ? _d : 0)) / 2, bound = {
|
|
892
|
+
left,
|
|
893
|
+
right: left + width,
|
|
894
|
+
top,
|
|
895
|
+
bottom: top + height
|
|
896
|
+
}, canvasElement = engine.getCanvasElement(), canvasClientRect = canvasElement.getBoundingClientRect(), widthOfCanvas = pxToNum(canvasElement.style.width), { scaleX, scaleY } = scene.getAncestorScale(), offsetBound = transformBound2OffsetBound(bound, scene), { top: topOffset, left: leftOffset, width: domWidth } = canvasClientRect, scaleAdjust = domWidth / widthOfCanvas;
|
|
907
897
|
return {
|
|
908
|
-
left:
|
|
909
|
-
right:
|
|
910
|
-
top:
|
|
911
|
-
bottom:
|
|
898
|
+
left: offsetBound.left * scaleAdjust * scaleX + leftOffset + horizontalOffset,
|
|
899
|
+
right: offsetBound.right * scaleAdjust * scaleX + leftOffset + horizontalOffset,
|
|
900
|
+
top: offsetBound.top * scaleAdjust * scaleY + topOffset + verticalOffset,
|
|
901
|
+
bottom: offsetBound.bottom * scaleAdjust * scaleY + topOffset + verticalOffset
|
|
912
902
|
};
|
|
913
|
-
})(),
|
|
903
|
+
}, "calc"))(), position$ = new BehaviorSubject(position), disposable = new DisposableCollection();
|
|
914
904
|
return {
|
|
915
|
-
position
|
|
916
|
-
position
|
|
917
|
-
disposable
|
|
905
|
+
position,
|
|
906
|
+
position$,
|
|
907
|
+
disposable
|
|
918
908
|
};
|
|
919
909
|
}
|
|
920
|
-
attachPopupToObject(
|
|
921
|
-
const
|
|
922
|
-
if (!
|
|
910
|
+
attachPopupToObject(targetObject, popup) {
|
|
911
|
+
const unitId = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SLIDE).getUnitId(), currentRender = this._renderManagerService.getRenderById(unitId);
|
|
912
|
+
if (!currentRender)
|
|
923
913
|
return {
|
|
924
|
-
dispose: () => {
|
|
925
|
-
}
|
|
914
|
+
dispose: /* @__PURE__ */ __name(() => {
|
|
915
|
+
}, "dispose")
|
|
926
916
|
};
|
|
927
|
-
const { position
|
|
928
|
-
...
|
|
929
|
-
unitId
|
|
917
|
+
const { position, position$, disposable } = this._createObjectPositionObserver(targetObject, currentRender), id = this._globalPopupManagerService.addPopup({
|
|
918
|
+
...popup,
|
|
919
|
+
unitId,
|
|
930
920
|
subUnitId: "default",
|
|
931
|
-
anchorRect:
|
|
932
|
-
anchorRect$:
|
|
933
|
-
canvasElement:
|
|
921
|
+
anchorRect: position,
|
|
922
|
+
anchorRect$: position$,
|
|
923
|
+
canvasElement: currentRender.engine.getCanvasElement()
|
|
934
924
|
});
|
|
935
925
|
return {
|
|
936
|
-
dispose: () => {
|
|
937
|
-
this._globalPopupManagerService.removePopup(
|
|
938
|
-
}
|
|
926
|
+
dispose: /* @__PURE__ */ __name(() => {
|
|
927
|
+
this._globalPopupManagerService.removePopup(id), position$.complete(), disposable.dispose();
|
|
928
|
+
}, "dispose")
|
|
939
929
|
};
|
|
940
930
|
}
|
|
941
|
-
};
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
],
|
|
948
|
-
var
|
|
949
|
-
for (var
|
|
950
|
-
(
|
|
951
|
-
return
|
|
952
|
-
},
|
|
953
|
-
let
|
|
954
|
-
constructor(
|
|
931
|
+
}, __name(_a3, "SlideCanvasPopMangerService"), _a3);
|
|
932
|
+
SlideCanvasPopMangerService = __decorateClass$7([
|
|
933
|
+
__decorateParam$7(0, Inject(ICanvasPopupService)),
|
|
934
|
+
__decorateParam$7(1, IRenderManagerService),
|
|
935
|
+
__decorateParam$7(2, IUniverInstanceService),
|
|
936
|
+
__decorateParam$7(3, ICommandService)
|
|
937
|
+
], SlideCanvasPopMangerService);
|
|
938
|
+
var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor, __decorateClass$6 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
939
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
940
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
941
|
+
return kind && result && __defProp$6(target, key, result), result;
|
|
942
|
+
}, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6"), _a4;
|
|
943
|
+
let SlidePopupMenuController = (_a4 = class extends RxDisposable {
|
|
944
|
+
constructor(_canvasPopManagerService, _renderManagerService, _univerInstanceService, _contextService, _canvasView, _sidebarService, _commandService) {
|
|
955
945
|
super();
|
|
956
|
-
|
|
957
|
-
this._canvasPopManagerService =
|
|
946
|
+
__publicField(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
|
|
947
|
+
this._canvasPopManagerService = _canvasPopManagerService, this._renderManagerService = _renderManagerService, this._univerInstanceService = _univerInstanceService, this._contextService = _contextService, this._canvasView = _canvasView, this._sidebarService = _sidebarService, this._commandService = _commandService, this._init();
|
|
958
948
|
}
|
|
959
949
|
_init() {
|
|
960
|
-
this._univerInstanceService.getAllUnitsForType(
|
|
950
|
+
this._univerInstanceService.getAllUnitsForType(UniverInstanceType.UNIVER_SLIDE).forEach((slide) => this._create(slide));
|
|
961
951
|
}
|
|
962
|
-
_create(
|
|
963
|
-
if (!
|
|
952
|
+
_create(slide) {
|
|
953
|
+
if (!slide)
|
|
964
954
|
return;
|
|
965
|
-
const
|
|
966
|
-
this._renderManagerService.has(
|
|
955
|
+
const unitId = slide.getUnitId();
|
|
956
|
+
this._renderManagerService.has(unitId) && !this._initImagePopupMenu.has(unitId) && (this._popupMenuListener(unitId), this._initImagePopupMenu.add(unitId));
|
|
967
957
|
}
|
|
968
|
-
_hasCropObject(
|
|
958
|
+
_hasCropObject(scene) {
|
|
969
959
|
}
|
|
970
960
|
// eslint-disable-next-line max-lines-per-function
|
|
971
|
-
_popupMenuListener(
|
|
972
|
-
var
|
|
973
|
-
const
|
|
974
|
-
Object.keys(
|
|
975
|
-
var
|
|
976
|
-
const
|
|
977
|
-
if (!
|
|
978
|
-
let
|
|
961
|
+
_popupMenuListener(unitId) {
|
|
962
|
+
var _a11;
|
|
963
|
+
const model = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SLIDE), pages = (_a11 = model == null ? void 0 : model.getPages()) != null ? _a11 : {};
|
|
964
|
+
Object.keys(pages).forEach((pageId) => {
|
|
965
|
+
var _a12;
|
|
966
|
+
const transformer = (_a12 = this._canvasView.getRenderUnitByPageId(pageId, unitId).scene) == null ? void 0 : _a12.getTransformer();
|
|
967
|
+
if (!transformer) return;
|
|
968
|
+
let singletonPopupDisposer;
|
|
979
969
|
this.disposeWithMe(
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
const
|
|
983
|
-
if (
|
|
984
|
-
|
|
970
|
+
toDisposable(
|
|
971
|
+
transformer.createControl$.subscribe(() => {
|
|
972
|
+
const selectedObjects = transformer.getSelectedObjectMap();
|
|
973
|
+
if (selectedObjects.size > 1) {
|
|
974
|
+
singletonPopupDisposer == null || singletonPopupDisposer.dispose();
|
|
985
975
|
return;
|
|
986
976
|
}
|
|
987
|
-
const
|
|
988
|
-
if (!
|
|
977
|
+
const object = selectedObjects.values().next().value;
|
|
978
|
+
if (!object)
|
|
989
979
|
return;
|
|
990
|
-
const
|
|
991
|
-
|
|
992
|
-
componentKey:
|
|
980
|
+
const oKey = object.oKey;
|
|
981
|
+
singletonPopupDisposer == null || singletonPopupDisposer.dispose(), singletonPopupDisposer = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(object, {
|
|
982
|
+
componentKey: COMPONENT_SLIDE_IMAGE_POPUP_MENU,
|
|
993
983
|
direction: "horizontal",
|
|
994
984
|
offset: [2, 0],
|
|
995
985
|
extraProps: {
|
|
996
|
-
menuItems: this._getMenuItemsByObjectType(
|
|
986
|
+
menuItems: this._getMenuItemsByObjectType(object.objectType, oKey, unitId)
|
|
997
987
|
}
|
|
998
|
-
})), this._sidebarService.visible && this._commandService.executeCommand(
|
|
988
|
+
})), this._sidebarService.visible && this._commandService.executeCommand(ToggleSlideEditSidebarOperation.id, {
|
|
999
989
|
visible: !0,
|
|
1000
|
-
objectType:
|
|
990
|
+
objectType: object.objectType
|
|
1001
991
|
});
|
|
1002
992
|
})
|
|
1003
993
|
)
|
|
1004
994
|
), this.disposeWithMe(
|
|
1005
|
-
|
|
1006
|
-
|
|
995
|
+
transformer.clearControl$.subscribe(() => {
|
|
996
|
+
singletonPopupDisposer == null || singletonPopupDisposer.dispose(), this._contextService.setContextValue(FOCUSING_COMMON_DRAWINGS, !1);
|
|
1007
997
|
})
|
|
1008
998
|
), this.disposeWithMe(
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
const
|
|
1012
|
-
if (
|
|
1013
|
-
|
|
999
|
+
transformer.changing$.subscribe(() => {
|
|
1000
|
+
singletonPopupDisposer == null || singletonPopupDisposer.dispose();
|
|
1001
|
+
const selectedObjects = transformer.getSelectedObjectMap();
|
|
1002
|
+
if (selectedObjects.size > 1) {
|
|
1003
|
+
singletonPopupDisposer == null || singletonPopupDisposer.dispose();
|
|
1014
1004
|
return;
|
|
1015
1005
|
}
|
|
1016
|
-
const
|
|
1017
|
-
|
|
1018
|
-
unitId
|
|
1019
|
-
oKey:
|
|
1006
|
+
const object = selectedObjects.values().next().value;
|
|
1007
|
+
object && this._commandService.executeCommand(UpdateSlideElementOperation.id, {
|
|
1008
|
+
unitId,
|
|
1009
|
+
oKey: object.oKey,
|
|
1020
1010
|
props: {
|
|
1021
|
-
width:
|
|
1022
|
-
height:
|
|
1023
|
-
left:
|
|
1024
|
-
top:
|
|
1011
|
+
width: object.width,
|
|
1012
|
+
height: object.height,
|
|
1013
|
+
left: object.left,
|
|
1014
|
+
top: object.top
|
|
1025
1015
|
}
|
|
1026
1016
|
});
|
|
1027
1017
|
})
|
|
1028
1018
|
);
|
|
1029
1019
|
});
|
|
1030
1020
|
}
|
|
1031
|
-
_getMenuItemsByObjectType(
|
|
1021
|
+
_getMenuItemsByObjectType(objectType, oKey, unitId) {
|
|
1032
1022
|
return [{
|
|
1033
1023
|
label: "slide.popup.edit",
|
|
1034
1024
|
index: 0,
|
|
1035
|
-
commandId:
|
|
1025
|
+
commandId: ToggleSlideEditSidebarOperation.id,
|
|
1036
1026
|
commandParams: {
|
|
1037
1027
|
visible: !0,
|
|
1038
|
-
objectType
|
|
1028
|
+
objectType
|
|
1039
1029
|
},
|
|
1040
1030
|
disable: !1
|
|
1041
1031
|
}, {
|
|
1042
1032
|
label: "slide.popup.delete",
|
|
1043
1033
|
index: 5,
|
|
1044
|
-
commandId:
|
|
1034
|
+
commandId: DeleteSlideElementOperation.id,
|
|
1045
1035
|
commandParams: {
|
|
1046
|
-
id:
|
|
1047
|
-
unitId
|
|
1036
|
+
id: oKey,
|
|
1037
|
+
unitId
|
|
1048
1038
|
},
|
|
1049
1039
|
disable: !1
|
|
1050
1040
|
}];
|
|
1051
1041
|
}
|
|
1052
|
-
};
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
],
|
|
1062
|
-
const
|
|
1042
|
+
}, __name(_a4, "SlidePopupMenuController"), _a4);
|
|
1043
|
+
SlidePopupMenuController = __decorateClass$6([
|
|
1044
|
+
__decorateParam$6(0, Inject(SlideCanvasPopMangerService)),
|
|
1045
|
+
__decorateParam$6(1, IRenderManagerService),
|
|
1046
|
+
__decorateParam$6(2, IUniverInstanceService),
|
|
1047
|
+
__decorateParam$6(3, IContextService),
|
|
1048
|
+
__decorateParam$6(4, Inject(CanvasView)),
|
|
1049
|
+
__decorateParam$6(5, ISidebarService),
|
|
1050
|
+
__decorateParam$6(6, ICommandService)
|
|
1051
|
+
], SlidePopupMenuController);
|
|
1052
|
+
const SetTextEditArrowOperation = {
|
|
1063
1053
|
id: "slide.operation.edit-arrow",
|
|
1064
|
-
type:
|
|
1065
|
-
handler: () => !0
|
|
1066
|
-
},
|
|
1067
|
-
var
|
|
1068
|
-
for (var
|
|
1069
|
-
(
|
|
1070
|
-
return
|
|
1071
|
-
},
|
|
1072
|
-
const
|
|
1073
|
-
|
|
1074
|
-
|
|
1054
|
+
type: CommandType.OPERATION,
|
|
1055
|
+
handler: /* @__PURE__ */ __name(() => !0, "handler")
|
|
1056
|
+
}, SLIDE_EDITOR_ID = createInternalEditorID("SLIDE_EDITOR");
|
|
1057
|
+
var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor, __decorateClass$5 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
1058
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1059
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
1060
|
+
return kind && result && __defProp$5(target, key, result), result;
|
|
1061
|
+
}, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5");
|
|
1062
|
+
const ISlideEditorBridgeService = createIdentifier("univer.slide-editor-bridge.service");
|
|
1063
|
+
var _a5;
|
|
1064
|
+
let SlideEditorBridgeService = (_a5 = class extends Disposable {
|
|
1065
|
+
constructor(_editorService, _contextService, _renderManagerService) {
|
|
1075
1066
|
super();
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1067
|
+
__publicField(this, "_editorUnitId", SLIDE_EDITOR_ID);
|
|
1068
|
+
__publicField(this, "_isForceKeepVisible", !1);
|
|
1069
|
+
__publicField(this, "_editorIsDirty", !1);
|
|
1070
|
+
__publicField(this, "_currentEditRectState", null);
|
|
1071
|
+
__publicField(this, "_currentEditRectState$", new BehaviorSubject(null));
|
|
1072
|
+
__publicField(this, "currentEditRectState$", this._currentEditRectState$.asObservable());
|
|
1073
|
+
__publicField(this, "_visibleParam", {
|
|
1083
1074
|
visible: !1,
|
|
1084
|
-
eventType:
|
|
1075
|
+
eventType: DeviceInputEventType.Dblclick,
|
|
1085
1076
|
unitId: ""
|
|
1086
1077
|
});
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
this._editorService =
|
|
1078
|
+
__publicField(this, "_visible$", new BehaviorSubject(this._visibleParam));
|
|
1079
|
+
__publicField(this, "visible$", this._visible$.asObservable());
|
|
1080
|
+
__publicField(this, "_afterVisible$", new BehaviorSubject(this._visibleParam));
|
|
1081
|
+
__publicField(this, "afterVisible$", this._afterVisible$.asObservable());
|
|
1082
|
+
__publicField(this, "endEditing$", new Subject());
|
|
1083
|
+
__publicField(this, "_currentEditRectInfo");
|
|
1084
|
+
this._editorService = _editorService, this._contextService = _contextService, this._renderManagerService = _renderManagerService;
|
|
1094
1085
|
}
|
|
1095
1086
|
dispose() {
|
|
1096
1087
|
super.dispose();
|
|
@@ -1102,13 +1093,13 @@ let Fe = class extends Ue {
|
|
|
1102
1093
|
* 1st part of startEditing.
|
|
1103
1094
|
* @editorInfo editorInfo
|
|
1104
1095
|
*/
|
|
1105
|
-
setEditorRect(
|
|
1106
|
-
this._currentEditRectInfo =
|
|
1107
|
-
const
|
|
1108
|
-
this._currentEditRectState =
|
|
1096
|
+
setEditorRect(editorInfo) {
|
|
1097
|
+
this._currentEditRectInfo = editorInfo, this._editorService.getFocusEditor() || (this._editorService.focus(SLIDE_EDITOR_ID), this._contextService.setContextValue(EDITOR_ACTIVATED, !1), this._contextService.setContextValue(FOCUSING_EDITOR_STANDALONE, !1), this._contextService.setContextValue(FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, !1));
|
|
1098
|
+
const editRectState = this.getEditRectState();
|
|
1099
|
+
this._currentEditRectState = editRectState, this._currentEditRectState$.next(editRectState);
|
|
1109
1100
|
}
|
|
1110
|
-
changeVisible(
|
|
1111
|
-
this._visibleParam =
|
|
1101
|
+
changeVisible(param) {
|
|
1102
|
+
this._visibleParam = param, param.visible && (this._editorIsDirty = !1), this._visible$.next(this._visibleParam), this._afterVisible$.next(this._visibleParam);
|
|
1112
1103
|
}
|
|
1113
1104
|
/**
|
|
1114
1105
|
* get info from _currentEditRectInfo
|
|
@@ -1117,43 +1108,43 @@ let Fe = class extends Ue {
|
|
|
1117
1108
|
* && this@setEditorRect
|
|
1118
1109
|
*/
|
|
1119
1110
|
getEditRectState() {
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1122
|
-
...
|
|
1123
|
-
pageSize: { width:
|
|
1111
|
+
const editorUnitId = SLIDE_EDITOR_ID, editorRectInfo = this._currentEditRectInfo, unitId = editorRectInfo.unitId, docData = editorRectInfo.richTextObj.documentData;
|
|
1112
|
+
docData.id = editorUnitId, docData.documentStyle = {
|
|
1113
|
+
...docData.documentStyle,
|
|
1114
|
+
pageSize: { width: editorRectInfo.richTextObj.width, height: 1 / 0 }
|
|
1124
1115
|
};
|
|
1125
|
-
const
|
|
1126
|
-
documentModel: new
|
|
1116
|
+
const documentLayoutObject = {
|
|
1117
|
+
documentModel: new DocumentDataModel(docData),
|
|
1127
1118
|
fontString: "document",
|
|
1128
1119
|
textRotation: { a: 0, v: 0 },
|
|
1129
1120
|
wrapStrategy: 0,
|
|
1130
|
-
verticalAlign:
|
|
1131
|
-
horizontalAlign:
|
|
1121
|
+
verticalAlign: VerticalAlign.TOP,
|
|
1122
|
+
horizontalAlign: HorizontalAlign.LEFT,
|
|
1132
1123
|
paddingData: { t: 0, b: 1, l: 2, r: 2 }
|
|
1133
|
-
},
|
|
1124
|
+
}, editorWidth = editorRectInfo.richTextObj.width, editorHeight = editorRectInfo.richTextObj.height, left = editorRectInfo.richTextObj.left, top = editorRectInfo.richTextObj.top, canvasOffset = {
|
|
1134
1125
|
left: 0,
|
|
1135
1126
|
top: 0
|
|
1136
|
-
},
|
|
1137
|
-
x: (
|
|
1138
|
-
y: (
|
|
1139
|
-
},
|
|
1140
|
-
return
|
|
1127
|
+
}, renderUnit = this._renderManagerService.getRenderById(unitId), mainScene = renderUnit == null ? void 0 : renderUnit.scene, mainViewport = mainScene == null ? void 0 : mainScene.getViewport(SLIDE_KEY.VIEW), slideMainRect = mainScene == null ? void 0 : mainScene.getObject(SLIDE_KEY.COMPONENT), slidePos = {
|
|
1128
|
+
x: (slideMainRect == null ? void 0 : slideMainRect.left) || 0,
|
|
1129
|
+
y: (slideMainRect == null ? void 0 : slideMainRect.top) || 0
|
|
1130
|
+
}, scrollX = (mainViewport == null ? void 0 : mainViewport.viewportScrollX) || 0, scrollY = (mainViewport == null ? void 0 : mainViewport.viewportScrollY) || 0;
|
|
1131
|
+
return canvasOffset.left = slidePos.x - scrollX, canvasOffset.top = slidePos.y - scrollY, {
|
|
1141
1132
|
position: {
|
|
1142
|
-
startX:
|
|
1143
|
-
startY:
|
|
1144
|
-
endX:
|
|
1145
|
-
endY:
|
|
1133
|
+
startX: left,
|
|
1134
|
+
startY: top,
|
|
1135
|
+
endX: left + editorWidth,
|
|
1136
|
+
endY: top + editorHeight
|
|
1146
1137
|
},
|
|
1147
1138
|
scaleX: 1,
|
|
1148
1139
|
scaleY: 1,
|
|
1149
|
-
slideCardOffset:
|
|
1150
|
-
unitId
|
|
1151
|
-
editorUnitId
|
|
1152
|
-
documentLayoutObject
|
|
1140
|
+
slideCardOffset: canvasOffset,
|
|
1141
|
+
unitId,
|
|
1142
|
+
editorUnitId,
|
|
1143
|
+
documentLayoutObject
|
|
1153
1144
|
};
|
|
1154
1145
|
}
|
|
1155
|
-
changeEditorDirty(
|
|
1156
|
-
this._editorIsDirty =
|
|
1146
|
+
changeEditorDirty(dirtyStatus) {
|
|
1147
|
+
this._editorIsDirty = dirtyStatus;
|
|
1157
1148
|
}
|
|
1158
1149
|
isVisible() {
|
|
1159
1150
|
return this._visibleParam.visible;
|
|
@@ -1167,14 +1158,14 @@ let Fe = class extends Ue {
|
|
|
1167
1158
|
/**
|
|
1168
1159
|
* @deprecated
|
|
1169
1160
|
*/
|
|
1170
|
-
genDocData(
|
|
1171
|
-
const
|
|
1161
|
+
genDocData(target) {
|
|
1162
|
+
const editorUnitId = this.getCurrentEditorId(), content = target.text, fontSize = target.fs;
|
|
1172
1163
|
return {
|
|
1173
|
-
id:
|
|
1164
|
+
id: editorUnitId,
|
|
1174
1165
|
body: {
|
|
1175
|
-
dataStream: `${
|
|
1166
|
+
dataStream: `${content}\r
|
|
1176
1167
|
`,
|
|
1177
|
-
textRuns: [{ st: 0, ed:
|
|
1168
|
+
textRuns: [{ st: 0, ed: content.length }],
|
|
1178
1169
|
paragraphs: [{
|
|
1179
1170
|
paragraphStyle: {
|
|
1180
1171
|
// no use
|
|
@@ -1182,9 +1173,9 @@ let Fe = class extends Ue {
|
|
|
1182
1173
|
// horizontalAlign: HorizontalAlign.CENTER,
|
|
1183
1174
|
// verticalAlign: VerticalAlign.MIDDLE,
|
|
1184
1175
|
},
|
|
1185
|
-
startIndex:
|
|
1176
|
+
startIndex: content.length + 1
|
|
1186
1177
|
}],
|
|
1187
|
-
sectionBreaks: [{ startIndex:
|
|
1178
|
+
sectionBreaks: [{ startIndex: content.length + 2 }]
|
|
1188
1179
|
},
|
|
1189
1180
|
documentStyle: {
|
|
1190
1181
|
marginBottom: 0,
|
|
@@ -1192,10 +1183,10 @@ let Fe = class extends Ue {
|
|
|
1192
1183
|
marginRight: 0,
|
|
1193
1184
|
marginTop: 0,
|
|
1194
1185
|
pageSize: { width: 1 / 0, height: 1 / 0 },
|
|
1195
|
-
textStyle: { fs:
|
|
1186
|
+
textStyle: { fs: fontSize },
|
|
1196
1187
|
renderConfig: {
|
|
1197
1188
|
// horizontalAlign: HorizontalAlign.CENTER,
|
|
1198
|
-
verticalAlign:
|
|
1189
|
+
verticalAlign: VerticalAlign.MIDDLE,
|
|
1199
1190
|
centerAngle: 0,
|
|
1200
1191
|
vertexAngle: 0,
|
|
1201
1192
|
wrapStrategy: 0
|
|
@@ -1206,70 +1197,73 @@ let Fe = class extends Ue {
|
|
|
1206
1197
|
settings: { zoomRatio: 1 }
|
|
1207
1198
|
};
|
|
1208
1199
|
}
|
|
1209
|
-
};
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
],
|
|
1215
|
-
class
|
|
1200
|
+
}, __name(_a5, "SlideEditorBridgeService"), _a5);
|
|
1201
|
+
SlideEditorBridgeService = __decorateClass$5([
|
|
1202
|
+
__decorateParam$5(0, IEditorService),
|
|
1203
|
+
__decorateParam$5(1, IContextService),
|
|
1204
|
+
__decorateParam$5(2, IRenderManagerService)
|
|
1205
|
+
], SlideEditorBridgeService);
|
|
1206
|
+
const _SlideEditorManagerService = class _SlideEditorManagerService {
|
|
1216
1207
|
constructor() {
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1208
|
+
__publicField(this, "_state", null);
|
|
1209
|
+
__publicField(this, "_rect", null);
|
|
1210
|
+
__publicField(this, "_state$", new BehaviorSubject(null));
|
|
1211
|
+
__publicField(this, "state$", this._state$.asObservable());
|
|
1212
|
+
__publicField(this, "_rect$", new BehaviorSubject(null));
|
|
1213
|
+
__publicField(this, "rect$", this._rect$.asObservable());
|
|
1214
|
+
__publicField(this, "_focus", !1);
|
|
1215
|
+
__publicField(this, "_focus$", new BehaviorSubject(this._focus));
|
|
1216
|
+
__publicField(this, "focus$", this._focus$.asObservable());
|
|
1226
1217
|
}
|
|
1227
1218
|
dispose() {
|
|
1228
1219
|
this._state$.complete(), this._state = null, this._rect$.complete(), this._rect = null;
|
|
1229
1220
|
}
|
|
1230
|
-
setState(
|
|
1231
|
-
this._state =
|
|
1221
|
+
setState(param) {
|
|
1222
|
+
this._state = param, this._refresh(param);
|
|
1232
1223
|
}
|
|
1233
1224
|
getRect() {
|
|
1234
1225
|
return this._rect;
|
|
1235
1226
|
}
|
|
1236
|
-
setRect(
|
|
1237
|
-
this._rect =
|
|
1227
|
+
setRect(param) {
|
|
1228
|
+
this._rect = param, this._rect$.next(param);
|
|
1238
1229
|
}
|
|
1239
1230
|
getState() {
|
|
1240
1231
|
return this._state;
|
|
1241
1232
|
}
|
|
1242
|
-
setFocus(
|
|
1243
|
-
this._focus =
|
|
1233
|
+
setFocus(param = !1) {
|
|
1234
|
+
this._focus = param, this._focus$.next(param);
|
|
1244
1235
|
}
|
|
1245
|
-
_refresh(
|
|
1246
|
-
this._state$.next(
|
|
1236
|
+
_refresh(param) {
|
|
1237
|
+
this._state$.next(param);
|
|
1247
1238
|
}
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1239
|
+
};
|
|
1240
|
+
__name(_SlideEditorManagerService, "SlideEditorManagerService");
|
|
1241
|
+
let SlideEditorManagerService = _SlideEditorManagerService;
|
|
1242
|
+
const ISlideEditorManagerService = createIdentifier(
|
|
1250
1243
|
"univer.slide-editor-manager.service"
|
|
1251
1244
|
);
|
|
1252
|
-
var
|
|
1253
|
-
for (var
|
|
1254
|
-
(
|
|
1255
|
-
return
|
|
1256
|
-
},
|
|
1257
|
-
const
|
|
1258
|
-
|
|
1259
|
-
|
|
1245
|
+
var CursorChange = /* @__PURE__ */ ((_CursorChange) => (_CursorChange[_CursorChange.InitialState = 0] = "InitialState", _CursorChange[_CursorChange.StartEditor = 1] = "StartEditor", _CursorChange[_CursorChange.CursorChange = 2] = "CursorChange", _CursorChange))(CursorChange || {}), __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
1246
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1247
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
1248
|
+
return kind && result && __defProp$4(target, key, result), result;
|
|
1249
|
+
}, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4");
|
|
1250
|
+
const HIDDEN_EDITOR_POSITION$1 = -1e3, EDITOR_INPUT_SELF_EXTEND_GAP = 5, EDITOR_BORDER_SIZE = 2;
|
|
1251
|
+
var _a6;
|
|
1252
|
+
let SlideEditingRenderController = (_a6 = class extends Disposable {
|
|
1253
|
+
constructor(_renderContext, _layoutService, _undoRedoService, _contextService, _instanceSrv, _renderManagerService, _editorBridgeService, _cellEditorManagerService, _textSelectionManagerService, _commandService, _localService, _editorService) {
|
|
1260
1254
|
super();
|
|
1261
1255
|
/**
|
|
1262
1256
|
* It is used to distinguish whether the user has actively moved the cursor in the editor, mainly through mouse clicks.
|
|
1263
1257
|
*/
|
|
1264
|
-
|
|
1258
|
+
__publicField(this, "_cursorChange", CursorChange.InitialState);
|
|
1265
1259
|
/** If the corresponding unit is active and prepared for editing. */
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
this._renderContext =
|
|
1269
|
-
|
|
1260
|
+
__publicField(this, "_isUnitEditing", !1);
|
|
1261
|
+
__publicField(this, "_d");
|
|
1262
|
+
this._renderContext = _renderContext, this._layoutService = _layoutService, this._undoRedoService = _undoRedoService, this._contextService = _contextService, this._instanceSrv = _instanceSrv, this._renderManagerService = _renderManagerService, this._editorBridgeService = _editorBridgeService, this._cellEditorManagerService = _cellEditorManagerService, this._textSelectionManagerService = _textSelectionManagerService, this._commandService = _commandService, this._localService = _localService, this._editorService = _editorService, this.disposeWithMe(this._instanceSrv.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SLIDE).subscribe((slideDataModel) => {
|
|
1263
|
+
slideDataModel && slideDataModel.getUnitId() === this._renderContext.unitId ? this._d = this._init() : (this._disposeCurrent(), this._isUnitEditing && (this._handleEditorInvisible({
|
|
1270
1264
|
visible: !1,
|
|
1271
|
-
eventType:
|
|
1272
|
-
keycode:
|
|
1265
|
+
eventType: DeviceInputEventType.Keyboard,
|
|
1266
|
+
keycode: KeyCode.ESC,
|
|
1273
1267
|
unitId: this._renderContext.unitId
|
|
1274
1268
|
}), this._isUnitEditing = !1));
|
|
1275
1269
|
})), this._initEditorVisibilityListener();
|
|
@@ -1278,61 +1272,61 @@ let ze = class extends Ue {
|
|
|
1278
1272
|
super.dispose(), this._disposeCurrent();
|
|
1279
1273
|
}
|
|
1280
1274
|
_disposeCurrent() {
|
|
1281
|
-
var
|
|
1282
|
-
(
|
|
1275
|
+
var _a11;
|
|
1276
|
+
(_a11 = this._d) == null || _a11.dispose(), this._d = null;
|
|
1283
1277
|
}
|
|
1284
1278
|
_init() {
|
|
1285
|
-
const
|
|
1286
|
-
return this._subscribeToCurrentCell(
|
|
1287
|
-
this._cursorStateListener(
|
|
1288
|
-
}, 1e3),
|
|
1279
|
+
const d = new DisposableCollection();
|
|
1280
|
+
return this._subscribeToCurrentCell(d), this._initialKeyboardListener(d), this._initialCursorSync(d), this._listenEditorFocus(d), this._commandExecutedListener(d), setTimeout(() => {
|
|
1281
|
+
this._cursorStateListener(d);
|
|
1282
|
+
}, 1e3), d;
|
|
1289
1283
|
}
|
|
1290
1284
|
_initEditorVisibilityListener() {
|
|
1291
|
-
this.disposeWithMe(this._editorBridgeService.visible$.subscribe((
|
|
1292
|
-
|
|
1285
|
+
this.disposeWithMe(this._editorBridgeService.visible$.subscribe((param) => {
|
|
1286
|
+
param.visible ? (this._isUnitEditing = !0, this._handleEditorVisible(param)) : this._isUnitEditing && (this._handleEditorInvisible(param), this._isUnitEditing = !1);
|
|
1293
1287
|
}));
|
|
1294
1288
|
}
|
|
1295
|
-
_listenEditorFocus(
|
|
1296
|
-
const
|
|
1297
|
-
|
|
1289
|
+
_listenEditorFocus(d) {
|
|
1290
|
+
const renderConfig = this._getEditorObject();
|
|
1291
|
+
renderConfig && d.add(renderConfig.document.onPointerDown$.subscribeEvent(() => {
|
|
1298
1292
|
}));
|
|
1299
1293
|
}
|
|
1300
|
-
_getEditorSkeleton(
|
|
1301
|
-
var
|
|
1302
|
-
return (
|
|
1294
|
+
_getEditorSkeleton(editorId) {
|
|
1295
|
+
var _a11;
|
|
1296
|
+
return (_a11 = this._renderManagerService.getRenderById(editorId)) == null ? void 0 : _a11.with(DocSkeletonManagerService).getSkeleton();
|
|
1303
1297
|
}
|
|
1304
|
-
_getEditorViewModel(
|
|
1305
|
-
var
|
|
1306
|
-
return (
|
|
1298
|
+
_getEditorViewModel(editorId) {
|
|
1299
|
+
var _a11;
|
|
1300
|
+
return (_a11 = this._renderManagerService.getRenderById(editorId)) == null ? void 0 : _a11.with(DocSkeletonManagerService).getViewModel();
|
|
1307
1301
|
}
|
|
1308
|
-
_initialCursorSync(
|
|
1309
|
-
|
|
1310
|
-
var
|
|
1311
|
-
const
|
|
1312
|
-
|
|
1302
|
+
_initialCursorSync(d) {
|
|
1303
|
+
d.add(this._cellEditorManagerService.focus$.pipe(filter((f) => !!f)).subscribe(() => {
|
|
1304
|
+
var _a11;
|
|
1305
|
+
const docSelectionRenderManager = (_a11 = this._renderManagerService.getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_DOC)) == null ? void 0 : _a11.with(DocSelectionRenderService);
|
|
1306
|
+
docSelectionRenderManager && docSelectionRenderManager.sync();
|
|
1313
1307
|
}));
|
|
1314
1308
|
}
|
|
1315
1309
|
/**
|
|
1316
1310
|
* Set editorUnitId to curr doc.
|
|
1317
1311
|
* @param d DisposableCollection
|
|
1318
1312
|
*/
|
|
1319
|
-
_subscribeToCurrentCell(
|
|
1320
|
-
|
|
1321
|
-
var
|
|
1322
|
-
if (
|
|
1313
|
+
_subscribeToCurrentCell(d) {
|
|
1314
|
+
d.add(this._editorBridgeService.currentEditRectState$.subscribe((editCellState) => {
|
|
1315
|
+
var _a11;
|
|
1316
|
+
if (editCellState == null || this._contextService.getContextValue(FOCUSING_EDITOR_STANDALONE) || this._contextService.getContextValue(FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE))
|
|
1323
1317
|
return;
|
|
1324
1318
|
const {
|
|
1325
|
-
position: { startX
|
|
1326
|
-
documentLayoutObject: { textRotation
|
|
1327
|
-
scaleX
|
|
1328
|
-
editorUnitId
|
|
1329
|
-
} =
|
|
1330
|
-
|
|
1319
|
+
position: { startX, endX },
|
|
1320
|
+
documentLayoutObject: { textRotation, wrapStrategy, documentModel },
|
|
1321
|
+
scaleX,
|
|
1322
|
+
editorUnitId
|
|
1323
|
+
} = editCellState, { vertexAngle: angle } = convertTextRotation(textRotation);
|
|
1324
|
+
documentModel.updateDocumentId(editorUnitId), wrapStrategy === WrapStrategy.WRAP && angle === 0 && documentModel.updateDocumentDataPageSize((endX - startX) / scaleX), this._instanceSrv.changeDoc(editorUnitId, documentModel), this._contextService.setContextValue(FOCUSING_EDITOR_BUT_HIDDEN, !0), this._textSelectionManagerService.replaceTextRanges([{
|
|
1331
1325
|
startOffset: 0,
|
|
1332
1326
|
endOffset: 0
|
|
1333
1327
|
}]);
|
|
1334
|
-
const
|
|
1335
|
-
|
|
1328
|
+
const docSelectionRenderManager = (_a11 = this._renderManagerService.getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_DOC)) == null ? void 0 : _a11.with(DocSelectionRenderService);
|
|
1329
|
+
docSelectionRenderManager && docSelectionRenderManager.activate(HIDDEN_EDITOR_POSITION$1, HIDDEN_EDITOR_POSITION$1);
|
|
1336
1330
|
}));
|
|
1337
1331
|
}
|
|
1338
1332
|
/**
|
|
@@ -1344,112 +1338,113 @@ let ze = class extends Ue {
|
|
|
1344
1338
|
* @param scaleX
|
|
1345
1339
|
* @param scaleY
|
|
1346
1340
|
*/
|
|
1347
|
-
_fitTextSize(
|
|
1348
|
-
const { startX
|
|
1349
|
-
if (
|
|
1341
|
+
_fitTextSize(positionFromEditRectState, canvasOffset, documentSkeleton, documentLayoutObject, scaleX = 1, scaleY = 1) {
|
|
1342
|
+
const { startX, startY, endX, endY } = positionFromEditRectState, documentDataModel = documentLayoutObject.documentModel;
|
|
1343
|
+
if (documentDataModel == null)
|
|
1350
1344
|
return;
|
|
1351
|
-
const { actualWidth
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
), { verticalAlign
|
|
1359
|
-
let
|
|
1360
|
-
if (
|
|
1361
|
-
|
|
1345
|
+
const { actualWidth, actualHeight } = this._predictingSize(
|
|
1346
|
+
positionFromEditRectState,
|
|
1347
|
+
canvasOffset,
|
|
1348
|
+
documentSkeleton,
|
|
1349
|
+
documentLayoutObject,
|
|
1350
|
+
scaleX,
|
|
1351
|
+
scaleY
|
|
1352
|
+
), { verticalAlign, paddingData, fill } = documentLayoutObject;
|
|
1353
|
+
let editorWidth = endX - startX, editorHeight = endY - startY;
|
|
1354
|
+
if (editorWidth < actualWidth && (editorWidth = actualWidth), editorHeight < actualHeight)
|
|
1355
|
+
editorHeight = actualHeight, documentDataModel.updateDocumentDataMargin(paddingData);
|
|
1362
1356
|
else {
|
|
1363
|
-
let
|
|
1364
|
-
|
|
1365
|
-
t:
|
|
1357
|
+
let offsetTop = 0;
|
|
1358
|
+
verticalAlign === VerticalAlign.MIDDLE ? offsetTop = (editorHeight - actualHeight) / 2 / scaleY : verticalAlign === VerticalAlign.TOP ? offsetTop = paddingData.t || 0 : offsetTop = (editorHeight - actualHeight) / scaleY - (paddingData.b || 0), offsetTop = offsetTop < (paddingData.t || 0) ? paddingData.t || 0 : offsetTop, documentDataModel.updateDocumentDataMargin({
|
|
1359
|
+
t: offsetTop
|
|
1366
1360
|
});
|
|
1367
1361
|
}
|
|
1368
|
-
|
|
1362
|
+
documentSkeleton.calculate(), this._editAreaProcessing(editorWidth, editorHeight, positionFromEditRectState, canvasOffset, fill, scaleX, scaleY);
|
|
1369
1363
|
}
|
|
1370
1364
|
/**
|
|
1371
1365
|
* Mainly used to pre-calculate the width of the editor,
|
|
1372
1366
|
* to determine whether it needs to be automatically widened.
|
|
1373
1367
|
*/
|
|
1374
|
-
_predictingSize(
|
|
1375
|
-
const { startX
|
|
1376
|
-
if (
|
|
1377
|
-
const { actualWidth
|
|
1368
|
+
_predictingSize(actualRangeWithCoord, canvasOffset, documentSkeleton, documentLayoutObject, scaleX = 1, scaleY = 1) {
|
|
1369
|
+
const { startX, endX } = actualRangeWithCoord, { textRotation, wrapStrategy } = documentLayoutObject, documentDataModel = documentLayoutObject.documentModel, { vertexAngle: angle } = convertTextRotation(textRotation), clientWidth = document.body.clientWidth;
|
|
1370
|
+
if (wrapStrategy === WrapStrategy.WRAP && angle === 0) {
|
|
1371
|
+
const { actualWidth, actualHeight } = documentSkeleton.getActualSize();
|
|
1378
1372
|
return {
|
|
1379
|
-
actualWidth:
|
|
1380
|
-
actualHeight:
|
|
1373
|
+
actualWidth: actualWidth * scaleX,
|
|
1374
|
+
actualHeight: actualHeight * scaleY
|
|
1381
1375
|
};
|
|
1382
1376
|
}
|
|
1383
|
-
|
|
1384
|
-
const
|
|
1385
|
-
let
|
|
1386
|
-
return
|
|
1387
|
-
horizontalAlign:
|
|
1377
|
+
documentDataModel == null || documentDataModel.updateDocumentDataPageSize((clientWidth - startX - canvasOffset.left) / scaleX), documentSkeleton.calculate();
|
|
1378
|
+
const size = documentSkeleton.getActualSize();
|
|
1379
|
+
let editorWidth = endX - startX;
|
|
1380
|
+
return editorWidth < size.actualWidth * scaleX + EDITOR_INPUT_SELF_EXTEND_GAP * scaleX && (editorWidth = size.actualWidth * scaleX + EDITOR_INPUT_SELF_EXTEND_GAP * scaleX), documentDataModel == null || documentDataModel.updateDocumentDataPageSize(editorWidth / scaleX), documentDataModel == null || documentDataModel.updateDocumentRenderConfig({
|
|
1381
|
+
horizontalAlign: HorizontalAlign.UNSPECIFIED,
|
|
1388
1382
|
cellValueType: void 0
|
|
1389
1383
|
}), {
|
|
1390
|
-
actualWidth:
|
|
1391
|
-
actualHeight:
|
|
1384
|
+
actualWidth: editorWidth,
|
|
1385
|
+
actualHeight: size.actualHeight * scaleY
|
|
1392
1386
|
};
|
|
1393
1387
|
}
|
|
1394
1388
|
/**
|
|
1395
1389
|
* control the size of editing area
|
|
1396
1390
|
*/
|
|
1397
1391
|
// eslint-disable-next-line max-lines-per-function
|
|
1398
|
-
_editAreaProcessing(
|
|
1399
|
-
var
|
|
1400
|
-
const
|
|
1401
|
-
if (
|
|
1392
|
+
_editAreaProcessing(editorWidth, editorHeight, positionFromEditRectState, canvasOffset, fill, scaleX = 1, scaleY = 1) {
|
|
1393
|
+
var _a11;
|
|
1394
|
+
const editorObject = this._getEditorObject();
|
|
1395
|
+
if (editorObject == null)
|
|
1402
1396
|
return;
|
|
1403
|
-
function
|
|
1404
|
-
return Number.parseInt(
|
|
1397
|
+
function pxToNum2(width2) {
|
|
1398
|
+
return Number.parseInt(width2.replace("px", ""));
|
|
1405
1399
|
}
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1400
|
+
__name(pxToNum2, "pxToNum");
|
|
1401
|
+
const canvasElement = this._renderContext.engine.getCanvasElement(), canvasClientRect = canvasElement.getBoundingClientRect(), widthOfCanvas = pxToNum2(canvasElement.style.width), { top, left, width } = canvasClientRect, scaleAdjust = width / widthOfCanvas;
|
|
1402
|
+
let { startX, startY } = positionFromEditRectState;
|
|
1403
|
+
startX += canvasOffset.left, startY += canvasOffset.top;
|
|
1404
|
+
const { document: documentComponent, scene: editorScene, engine: docEngine } = editorObject, viewportMain = editorScene.getViewport(VIEWPORT_KEY.VIEW_MAIN), clientHeight = document.body.clientHeight - startY - canvasOffset.top - EDITOR_BORDER_SIZE * 2, clientWidth = document.body.clientWidth - startX - canvasOffset.left;
|
|
1405
|
+
let physicHeight = editorHeight, scrollBar = viewportMain == null ? void 0 : viewportMain.getScrollBar();
|
|
1406
|
+
physicHeight > clientHeight ? (physicHeight = clientHeight, scrollBar == null ? viewportMain && new ScrollBar(viewportMain, { enableHorizontal: !1, barSize: 8 }) : viewportMain == null || viewportMain.resetCanvasSizeAndUpdateScroll()) : (scrollBar = null, (_a11 = viewportMain == null ? void 0 : viewportMain.getScrollBar()) == null || _a11.dispose()), editorWidth += (scrollBar == null ? void 0 : scrollBar.barSize) || 0, editorWidth = Math.min(editorWidth, clientWidth), startX -= FIX_ONE_PIXEL_BLUR_OFFSET, startY -= FIX_ONE_PIXEL_BLUR_OFFSET, this._addBackground(editorScene, editorWidth / scaleX, editorHeight / scaleY, fill);
|
|
1407
|
+
const { scaleX: precisionScaleX, scaleY: precisionScaleY } = editorScene.getPrecisionScale();
|
|
1408
|
+
editorScene.transformByState({
|
|
1409
|
+
width: editorWidth * scaleAdjust / scaleX,
|
|
1410
|
+
height: editorHeight * scaleAdjust / scaleY,
|
|
1411
|
+
scaleX: scaleX * scaleAdjust,
|
|
1412
|
+
scaleY: scaleY * scaleAdjust
|
|
1413
|
+
}), documentComponent.resize(editorWidth / scaleX, editorHeight / scaleY), setTimeout(() => {
|
|
1414
|
+
docEngine.resizeBySize(
|
|
1415
|
+
fixLineWidthByScale(editorWidth, precisionScaleX),
|
|
1416
|
+
fixLineWidthByScale(physicHeight, precisionScaleY)
|
|
1422
1417
|
);
|
|
1423
1418
|
}, 0);
|
|
1424
|
-
const
|
|
1425
|
-
|
|
1426
|
-
startX
|
|
1427
|
-
startY
|
|
1428
|
-
endX:
|
|
1429
|
-
endY:
|
|
1419
|
+
const contentBoundingRect = this._layoutService.getContentElement().getBoundingClientRect(), canvasBoundingRect = canvasElement.getBoundingClientRect();
|
|
1420
|
+
startX = startX * scaleAdjust + (canvasBoundingRect.left - contentBoundingRect.left), startY = startY * scaleAdjust + (canvasBoundingRect.top - contentBoundingRect.top), this._cellEditorManagerService.setState({
|
|
1421
|
+
startX,
|
|
1422
|
+
startY,
|
|
1423
|
+
endX: editorWidth * scaleAdjust + startX,
|
|
1424
|
+
endY: physicHeight * scaleAdjust + startY,
|
|
1430
1425
|
show: !0
|
|
1431
1426
|
});
|
|
1432
1427
|
}
|
|
1433
1428
|
/**
|
|
1434
1429
|
* Since the document does not support cell background color, an additional rect needs to be added.
|
|
1435
1430
|
*/
|
|
1436
|
-
_addBackground(
|
|
1437
|
-
const
|
|
1438
|
-
|
|
1431
|
+
_addBackground(scene, editorWidth, editorHeight, fill) {
|
|
1432
|
+
const fillRectKey = "_backgroundRectHelperColor_", rect = scene.getObject(fillRectKey);
|
|
1433
|
+
rect == null && fill == null || (rect == null ? scene.addObjects(
|
|
1439
1434
|
[
|
|
1440
|
-
new
|
|
1441
|
-
width:
|
|
1442
|
-
height:
|
|
1443
|
-
fill
|
|
1435
|
+
new Rect(fillRectKey, {
|
|
1436
|
+
width: editorWidth,
|
|
1437
|
+
height: editorHeight,
|
|
1438
|
+
fill,
|
|
1444
1439
|
evented: !1
|
|
1445
1440
|
})
|
|
1446
1441
|
],
|
|
1447
|
-
|
|
1448
|
-
) :
|
|
1449
|
-
fill
|
|
1450
|
-
}),
|
|
1451
|
-
width:
|
|
1452
|
-
height:
|
|
1442
|
+
DOCS_COMPONENT_MAIN_LAYER_INDEX
|
|
1443
|
+
) : fill == null ? rect.dispose() : (rect.setProps({
|
|
1444
|
+
fill
|
|
1445
|
+
}), rect.transformByState({
|
|
1446
|
+
width: editorWidth,
|
|
1447
|
+
height: editorHeight
|
|
1453
1448
|
})));
|
|
1454
1449
|
}
|
|
1455
1450
|
/**
|
|
@@ -1460,119 +1455,114 @@ let ze = class extends Ue {
|
|
|
1460
1455
|
// handleVisible is the 2nd part of editing.
|
|
1461
1456
|
// first part: startEditing --> _updateEditor
|
|
1462
1457
|
// 2nd part: startEditing --> changeVisible --> slide-editor-bridge.render-controller.ts@changeVisible --> _editorBridgeService.changeVisible
|
|
1463
|
-
_handleEditorVisible(
|
|
1464
|
-
var
|
|
1465
|
-
const { eventType
|
|
1466
|
-
this._cursorChange = [
|
|
1467
|
-
const
|
|
1468
|
-
if (
|
|
1458
|
+
_handleEditorVisible(param) {
|
|
1459
|
+
var _a11, _b;
|
|
1460
|
+
const { eventType } = param;
|
|
1461
|
+
this._cursorChange = [DeviceInputEventType.PointerDown, DeviceInputEventType.Dblclick].includes(eventType) ? CursorChange.CursorChange : CursorChange.StartEditor;
|
|
1462
|
+
const editCellState = this._editorBridgeService.getEditRectState();
|
|
1463
|
+
if (editCellState == null)
|
|
1469
1464
|
return;
|
|
1470
1465
|
const {
|
|
1471
|
-
position
|
|
1472
|
-
documentLayoutObject
|
|
1473
|
-
slideCardOffset:
|
|
1474
|
-
scaleX
|
|
1475
|
-
scaleY
|
|
1476
|
-
editorUnitId
|
|
1477
|
-
unitId
|
|
1478
|
-
} =
|
|
1479
|
-
if (
|
|
1466
|
+
position,
|
|
1467
|
+
documentLayoutObject,
|
|
1468
|
+
slideCardOffset: canvasOffset,
|
|
1469
|
+
scaleX,
|
|
1470
|
+
scaleY,
|
|
1471
|
+
editorUnitId,
|
|
1472
|
+
unitId
|
|
1473
|
+
} = editCellState, editorObject = this._getEditorObject();
|
|
1474
|
+
if (editorObject == null)
|
|
1480
1475
|
return;
|
|
1481
|
-
const { scene
|
|
1482
|
-
this._contextService.setContextValue(
|
|
1483
|
-
const { documentModel:
|
|
1484
|
-
if (!
|
|
1476
|
+
const { scene } = editorObject;
|
|
1477
|
+
this._contextService.setContextValue(EDITOR_ACTIVATED, !0);
|
|
1478
|
+
const { documentModel: documentDataModel } = documentLayoutObject, skeleton = this._getEditorSkeleton(editorUnitId);
|
|
1479
|
+
if (!skeleton || !documentDataModel)
|
|
1485
1480
|
return;
|
|
1486
|
-
this._fitTextSize(
|
|
1487
|
-
const
|
|
1488
|
-
(
|
|
1481
|
+
this._fitTextSize(position, canvasOffset, skeleton, documentLayoutObject, scaleX, scaleY);
|
|
1482
|
+
const cursor = documentDataModel.getBody().dataStream.length - 2 || 0;
|
|
1483
|
+
(_a11 = scene.getViewport(VIEWPORT_KEY.VIEW_MAIN)) == null || _a11.scrollToViewportPos({
|
|
1489
1484
|
viewportScrollX: Number.POSITIVE_INFINITY
|
|
1490
1485
|
}), this._textSelectionManagerService.replaceTextRanges([
|
|
1491
1486
|
{
|
|
1492
|
-
startOffset:
|
|
1493
|
-
endOffset:
|
|
1487
|
+
startOffset: cursor,
|
|
1488
|
+
endOffset: cursor
|
|
1494
1489
|
}
|
|
1495
|
-
]), (
|
|
1490
|
+
]), (_b = this._renderManagerService.getRenderById(unitId)) == null || _b.scene.resetCursor();
|
|
1496
1491
|
}
|
|
1497
|
-
_resetBodyStyle(
|
|
1498
|
-
|
|
1492
|
+
_resetBodyStyle(body, removeStyle = !1) {
|
|
1493
|
+
body.dataStream = DEFAULT_EMPTY_DOCUMENT_VALUE, body.textRuns != null && (body.textRuns.length === 1 && !removeStyle ? (body.textRuns[0].st = 0, body.textRuns[0].ed = 1) : body.textRuns = void 0), body.paragraphs != null && (body.paragraphs.length === 1 ? body.paragraphs[0].startIndex = 0 : body.paragraphs = [
|
|
1499
1494
|
{
|
|
1500
1495
|
startIndex: 0
|
|
1501
1496
|
}
|
|
1502
|
-
]),
|
|
1497
|
+
]), body.sectionBreaks != null && (body.sectionBreaks = void 0), body.tables != null && (body.tables = void 0), body.customRanges != null && (body.customRanges = void 0), body.customBlocks != null && (body.customBlocks = void 0);
|
|
1503
1498
|
}
|
|
1504
1499
|
/**
|
|
1505
1500
|
* Should activate the editor when the user inputs text.
|
|
1506
1501
|
* @param d DisposableCollection
|
|
1507
1502
|
*/
|
|
1508
|
-
_initialKeyboardListener(
|
|
1503
|
+
_initialKeyboardListener(d) {
|
|
1509
1504
|
}
|
|
1510
|
-
_showEditorByKeyboard(
|
|
1505
|
+
_showEditorByKeyboard(config) {
|
|
1511
1506
|
}
|
|
1512
|
-
_commandExecutedListener(
|
|
1513
|
-
const
|
|
1514
|
-
|
|
1515
|
-
this._editorService.getFocusId() ===
|
|
1507
|
+
_commandExecutedListener(d) {
|
|
1508
|
+
const moveCursorOP = [SetTextEditArrowOperation.id], editedMutations = [RichTextEditingMutation.id];
|
|
1509
|
+
d.add(this._commandService.onCommandExecuted((command) => {
|
|
1510
|
+
this._editorService.getFocusId() === SLIDE_EDITOR_ID && (moveCursorOP.includes(command.id) && this._moveCursorCmdHandler(command), editedMutations.includes(command.id) && this._editorBridgeService.isVisible() && this._editingChangedHandler());
|
|
1516
1511
|
}));
|
|
1517
1512
|
}
|
|
1518
|
-
_moveCursorCmdHandler(
|
|
1519
|
-
const
|
|
1520
|
-
|
|
1513
|
+
_moveCursorCmdHandler(command) {
|
|
1514
|
+
const params = command.params, { keycode, isShift } = params;
|
|
1515
|
+
keycode != null && this._cursorChange === CursorChange.CursorChange ? this._moveInEditor(keycode, isShift) : this._editorBridgeService.changeVisible(params);
|
|
1521
1516
|
}
|
|
1522
1517
|
_editingChangedHandler() {
|
|
1523
|
-
const
|
|
1524
|
-
if (!
|
|
1518
|
+
const editRect = this._editorBridgeService.getEditorRect();
|
|
1519
|
+
if (!editRect)
|
|
1525
1520
|
return;
|
|
1526
|
-
const
|
|
1527
|
-
|
|
1528
|
-
const { unitId
|
|
1529
|
-
this._handleEditorVisible({ visible: !0, eventType: 3, unitId
|
|
1530
|
-
}
|
|
1531
|
-
_setOpenForCurrent(e, t) {
|
|
1532
|
-
const n = this._editorService.getAllEditor();
|
|
1533
|
-
for (const [r, s] of n)
|
|
1534
|
-
s.setOpenForSheetUnitId(e), s.setOpenForSheetSubUnitId(t);
|
|
1521
|
+
const editingRichText = editRect.richTextObj;
|
|
1522
|
+
editingRichText.refreshDocumentByDocData(), editingRichText.resizeToContentSize();
|
|
1523
|
+
const { unitId } = this._renderContext;
|
|
1524
|
+
this._handleEditorVisible({ visible: !0, eventType: 3, unitId });
|
|
1535
1525
|
}
|
|
1536
1526
|
_getEditorObject() {
|
|
1537
|
-
return
|
|
1527
|
+
return getEditorObject(this._editorBridgeService.getCurrentEditorId(), this._renderManagerService);
|
|
1538
1528
|
}
|
|
1539
|
-
async _handleEditorInvisible(
|
|
1540
|
-
const { keycode
|
|
1541
|
-
if (this.
|
|
1529
|
+
async _handleEditorInvisible(param) {
|
|
1530
|
+
const { keycode } = param;
|
|
1531
|
+
if (this._cursorChange = CursorChange.InitialState, this._exitInput(param), this._editorBridgeService.getEditRectState() == null)
|
|
1542
1532
|
return;
|
|
1543
1533
|
if (this._editorBridgeService.getEditorDirty() === !1) {
|
|
1544
|
-
this._moveCursor(
|
|
1534
|
+
this._moveCursor(keycode);
|
|
1545
1535
|
return;
|
|
1546
1536
|
}
|
|
1547
|
-
this._moveCursor(
|
|
1537
|
+
this._moveCursor(keycode);
|
|
1548
1538
|
}
|
|
1549
|
-
_exitInput(
|
|
1550
|
-
this._contextService.setContextValue(
|
|
1551
|
-
show:
|
|
1539
|
+
_exitInput(param) {
|
|
1540
|
+
this._contextService.setContextValue(EDITOR_ACTIVATED, !1), this._cellEditorManagerService.setState({
|
|
1541
|
+
show: param.visible
|
|
1552
1542
|
});
|
|
1553
|
-
const
|
|
1554
|
-
|
|
1555
|
-
}
|
|
1556
|
-
_moveCursor(
|
|
1557
|
-
if (
|
|
1558
|
-
switch (
|
|
1559
|
-
case
|
|
1560
|
-
|
|
1543
|
+
const editorUnitId = this._editorBridgeService.getCurrentEditorId();
|
|
1544
|
+
editorUnitId != null && this._undoRedoService.clearUndoRedo(editorUnitId);
|
|
1545
|
+
}
|
|
1546
|
+
_moveCursor(keycode) {
|
|
1547
|
+
if (keycode != null)
|
|
1548
|
+
switch (Direction.LEFT, keycode) {
|
|
1549
|
+
case KeyCode.ENTER:
|
|
1550
|
+
Direction.DOWN;
|
|
1561
1551
|
break;
|
|
1562
|
-
case
|
|
1563
|
-
|
|
1552
|
+
case KeyCode.TAB:
|
|
1553
|
+
Direction.RIGHT;
|
|
1564
1554
|
break;
|
|
1565
|
-
case
|
|
1566
|
-
|
|
1555
|
+
case KeyCode.ARROW_DOWN:
|
|
1556
|
+
Direction.DOWN;
|
|
1567
1557
|
break;
|
|
1568
|
-
case
|
|
1569
|
-
|
|
1558
|
+
case KeyCode.ARROW_UP:
|
|
1559
|
+
Direction.UP;
|
|
1570
1560
|
break;
|
|
1571
|
-
case
|
|
1572
|
-
|
|
1561
|
+
case KeyCode.ARROW_LEFT:
|
|
1562
|
+
Direction.LEFT;
|
|
1573
1563
|
break;
|
|
1574
|
-
case
|
|
1575
|
-
|
|
1564
|
+
case KeyCode.ARROW_RIGHT:
|
|
1565
|
+
Direction.RIGHT;
|
|
1576
1566
|
break;
|
|
1577
1567
|
}
|
|
1578
1568
|
}
|
|
@@ -1580,56 +1570,60 @@ let ze = class extends Ue {
|
|
|
1580
1570
|
* The user's operations follow the sequence of opening the editor and then moving the cursor.
|
|
1581
1571
|
* The logic here predicts the user's first cursor movement behavior based on this rule
|
|
1582
1572
|
*/
|
|
1583
|
-
_cursorStateListener(
|
|
1584
|
-
const
|
|
1585
|
-
|
|
1586
|
-
|
|
1573
|
+
_cursorStateListener(d) {
|
|
1574
|
+
const editorObject = this._getEditorObject();
|
|
1575
|
+
if (!editorObject)
|
|
1576
|
+
return;
|
|
1577
|
+
const { document: documentComponent } = editorObject;
|
|
1578
|
+
d.add(toDisposable(documentComponent.onPointerDown$.subscribeEvent(() => {
|
|
1579
|
+
this._cursorChange === CursorChange.StartEditor && (this._cursorChange = CursorChange.CursorChange);
|
|
1587
1580
|
})));
|
|
1588
1581
|
}
|
|
1589
1582
|
// TODO: @JOCS, is it necessary to move these commands MoveSelectionOperation\MoveCursorOperation to shortcut? and use multi-commands?
|
|
1590
|
-
_moveInEditor(
|
|
1591
|
-
let
|
|
1592
|
-
|
|
1593
|
-
direction
|
|
1594
|
-
}) : this._commandService.executeCommand(
|
|
1595
|
-
direction
|
|
1583
|
+
_moveInEditor(keycode, isShift) {
|
|
1584
|
+
let direction = Direction.LEFT;
|
|
1585
|
+
keycode === KeyCode.ARROW_DOWN ? direction = Direction.DOWN : keycode === KeyCode.ARROW_UP ? direction = Direction.UP : keycode === KeyCode.ARROW_RIGHT && (direction = Direction.RIGHT), isShift ? this._commandService.executeCommand(MoveSelectionOperation.id, {
|
|
1586
|
+
direction
|
|
1587
|
+
}) : this._commandService.executeCommand(MoveCursorOperation.id, {
|
|
1588
|
+
direction
|
|
1596
1589
|
});
|
|
1597
1590
|
}
|
|
1598
|
-
};
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
],
|
|
1612
|
-
function
|
|
1613
|
-
if (
|
|
1591
|
+
}, __name(_a6, "SlideEditingRenderController"), _a6);
|
|
1592
|
+
SlideEditingRenderController = __decorateClass$4([
|
|
1593
|
+
__decorateParam$4(1, ILayoutService),
|
|
1594
|
+
__decorateParam$4(2, IUndoRedoService),
|
|
1595
|
+
__decorateParam$4(3, IContextService),
|
|
1596
|
+
__decorateParam$4(4, IUniverInstanceService),
|
|
1597
|
+
__decorateParam$4(5, IRenderManagerService),
|
|
1598
|
+
__decorateParam$4(6, ISlideEditorBridgeService),
|
|
1599
|
+
__decorateParam$4(7, ISlideEditorManagerService),
|
|
1600
|
+
__decorateParam$4(8, Inject(DocSelectionManagerService)),
|
|
1601
|
+
__decorateParam$4(9, ICommandService),
|
|
1602
|
+
__decorateParam$4(10, Inject(LocaleService)),
|
|
1603
|
+
__decorateParam$4(11, IEditorService)
|
|
1604
|
+
], SlideEditingRenderController);
|
|
1605
|
+
function getEditorObject(unitId, renderManagerService) {
|
|
1606
|
+
if (unitId == null)
|
|
1614
1607
|
return;
|
|
1615
|
-
const
|
|
1616
|
-
if (
|
|
1608
|
+
const currentRender = renderManagerService.getRenderById(unitId);
|
|
1609
|
+
if (currentRender == null)
|
|
1617
1610
|
return;
|
|
1618
|
-
const { mainComponent
|
|
1611
|
+
const { mainComponent, scene, engine, components } = currentRender, document2 = mainComponent, docBackground = components.get(DOCS_VIEW_KEY.BACKGROUND);
|
|
1619
1612
|
return {
|
|
1620
|
-
document:
|
|
1621
|
-
docBackground
|
|
1622
|
-
scene
|
|
1623
|
-
engine
|
|
1613
|
+
document: document2,
|
|
1614
|
+
docBackground,
|
|
1615
|
+
scene,
|
|
1616
|
+
engine
|
|
1624
1617
|
};
|
|
1625
1618
|
}
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1619
|
+
__name(getEditorObject, "getEditorObject");
|
|
1620
|
+
var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
1621
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1622
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
1623
|
+
return kind && result && __defProp$3(target, key, result), result;
|
|
1624
|
+
}, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a7;
|
|
1625
|
+
let SlideEditorBridgeRenderController = (_a7 = class extends RxDisposable {
|
|
1626
|
+
constructor(_renderContext, _instanceSrv, _commandService, _editorBridgeService) {
|
|
1633
1627
|
super();
|
|
1634
1628
|
/**
|
|
1635
1629
|
* It is used to distinguish whether the user has actively moved the cursor in the editor, mainly through mouse clicks.
|
|
@@ -1637,54 +1631,54 @@ let We = class extends fe {
|
|
|
1637
1631
|
// private _cursorChange: CursorChange = CursorChange.InitialState;
|
|
1638
1632
|
/** If the corresponding unit is active and prepared for editing. */
|
|
1639
1633
|
// private _isUnitEditing = false;
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
this._renderContext =
|
|
1644
|
-
|
|
1634
|
+
__publicField(this, "setSlideTextEditor$", new Subject());
|
|
1635
|
+
__publicField(this, "_curRichText", null);
|
|
1636
|
+
__publicField(this, "_d");
|
|
1637
|
+
this._renderContext = _renderContext, this._instanceSrv = _instanceSrv, this._commandService = _commandService, this._editorBridgeService = _editorBridgeService, this.disposeWithMe(this._instanceSrv.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SLIDE).subscribe((slideDataModel) => {
|
|
1638
|
+
slideDataModel && slideDataModel.getUnitId() === this._renderContext.unitId ? this._d = this._init() : this._disposeCurrent();
|
|
1645
1639
|
}));
|
|
1646
1640
|
}
|
|
1647
1641
|
_init() {
|
|
1648
|
-
const
|
|
1649
|
-
return this._initEventListener(
|
|
1642
|
+
const d = new DisposableCollection();
|
|
1643
|
+
return this._initEventListener(d), d;
|
|
1650
1644
|
}
|
|
1651
1645
|
_disposeCurrent() {
|
|
1652
|
-
var
|
|
1653
|
-
(
|
|
1654
|
-
}
|
|
1655
|
-
_setEditorRect(
|
|
1656
|
-
this._curRichText =
|
|
1657
|
-
const { scene
|
|
1658
|
-
scene
|
|
1659
|
-
engine
|
|
1660
|
-
unitId
|
|
1661
|
-
pageId
|
|
1662
|
-
richTextObj:
|
|
1646
|
+
var _a11;
|
|
1647
|
+
(_a11 = this._d) == null || _a11.dispose(), this._d = null;
|
|
1648
|
+
}
|
|
1649
|
+
_setEditorRect(pageId, targetObject) {
|
|
1650
|
+
this._curRichText = targetObject;
|
|
1651
|
+
const { scene, engine } = this._renderContext, unitId = this._renderContext.unitId, setEditorRect = {
|
|
1652
|
+
scene,
|
|
1653
|
+
engine,
|
|
1654
|
+
unitId,
|
|
1655
|
+
pageId,
|
|
1656
|
+
richTextObj: targetObject
|
|
1663
1657
|
};
|
|
1664
|
-
this._editorBridgeService.setEditorRect(
|
|
1658
|
+
this._editorBridgeService.setEditorRect(setEditorRect);
|
|
1665
1659
|
}
|
|
1666
|
-
_initEventListener(
|
|
1667
|
-
const
|
|
1668
|
-
const
|
|
1669
|
-
|
|
1660
|
+
_initEventListener(d) {
|
|
1661
|
+
const listenersForPageScene = /* @__PURE__ */ __name((scene) => {
|
|
1662
|
+
const transformer = scene.getTransformer();
|
|
1663
|
+
transformer && (d.add(transformer.clearControl$.subscribe(() => {
|
|
1670
1664
|
this.setEditorVisible(!1), this.pickOtherObjects();
|
|
1671
|
-
})),
|
|
1665
|
+
})), d.add(transformer.createControl$.subscribe(() => {
|
|
1672
1666
|
this.setEditorVisible(!1);
|
|
1673
|
-
})),
|
|
1674
|
-
|
|
1675
|
-
const
|
|
1676
|
-
|
|
1677
|
-
})),
|
|
1667
|
+
})), d.add(scene.onDblclick$.subscribeEvent(() => {
|
|
1668
|
+
transformer.clearControls();
|
|
1669
|
+
const object = transformer.getSelectedObjectMap().values().next().value;
|
|
1670
|
+
object && (object.objectType !== ObjectType.RICH_TEXT ? this.pickOtherObjects() : this.startEditing(scene.sceneKey, object));
|
|
1671
|
+
})), d.add(this._instanceSrv.focused$.subscribe((fc) => {
|
|
1678
1672
|
this.endEditing();
|
|
1679
1673
|
})));
|
|
1680
|
-
}, { mainComponent
|
|
1681
|
-
|
|
1682
|
-
|
|
1674
|
+
}, "listenersForPageScene"), { mainComponent } = this._renderContext;
|
|
1675
|
+
mainComponent.subSceneChanged$.subscribeEvent((pageScene) => {
|
|
1676
|
+
listenersForPageScene(pageScene);
|
|
1683
1677
|
});
|
|
1684
|
-
const
|
|
1685
|
-
for (let
|
|
1686
|
-
const
|
|
1687
|
-
|
|
1678
|
+
const pageSceneList = Array.from(mainComponent.getSubScenes().values());
|
|
1679
|
+
for (let i = 0; i < pageSceneList.length; i++) {
|
|
1680
|
+
const pageScene = pageSceneList[i];
|
|
1681
|
+
listenersForPageScene(pageScene);
|
|
1688
1682
|
}
|
|
1689
1683
|
}
|
|
1690
1684
|
pickOtherObjects() {
|
|
@@ -1696,26 +1690,26 @@ let We = class extends fe {
|
|
|
1696
1690
|
* save editing state to curr richText.
|
|
1697
1691
|
*/
|
|
1698
1692
|
endEditing() {
|
|
1699
|
-
var
|
|
1693
|
+
var _a11;
|
|
1700
1694
|
if (!this._curRichText) return;
|
|
1701
1695
|
this.setEditorVisible(!1);
|
|
1702
|
-
const
|
|
1703
|
-
if (!this._instanceSrv.getCurrentUnitForType(
|
|
1704
|
-
|
|
1705
|
-
const
|
|
1696
|
+
const curRichText = this._curRichText;
|
|
1697
|
+
if (!this._instanceSrv.getCurrentUnitForType(UniverInstanceType.UNIVER_SLIDE)) return !1;
|
|
1698
|
+
curRichText.refreshDocumentByDocData(), curRichText.resizeToContentSize(), this._editorBridgeService.endEditing$.next(curRichText);
|
|
1699
|
+
const richText = {
|
|
1706
1700
|
bl: 1,
|
|
1707
|
-
fs:
|
|
1708
|
-
text:
|
|
1709
|
-
},
|
|
1710
|
-
if (
|
|
1711
|
-
const
|
|
1712
|
-
|
|
1701
|
+
fs: curRichText.fs,
|
|
1702
|
+
text: curRichText.text
|
|
1703
|
+
}, textRuns = (_a11 = curRichText.documentData.body) == null ? void 0 : _a11.textRuns;
|
|
1704
|
+
if (textRuns && textRuns.length) {
|
|
1705
|
+
const ts = textRuns[0].ts;
|
|
1706
|
+
richText.cl = ts == null ? void 0 : ts.cl;
|
|
1713
1707
|
}
|
|
1714
|
-
this._commandService.executeCommand(
|
|
1708
|
+
this._commandService.executeCommand(UpdateSlideElementOperation.id, {
|
|
1715
1709
|
unitId: this._renderContext.unitId,
|
|
1716
|
-
oKey:
|
|
1710
|
+
oKey: curRichText == null ? void 0 : curRichText.oKey,
|
|
1717
1711
|
props: {
|
|
1718
|
-
richText
|
|
1712
|
+
richText
|
|
1719
1713
|
}
|
|
1720
1714
|
}), this._curRichText = null;
|
|
1721
1715
|
}
|
|
@@ -1726,106 +1720,106 @@ let We = class extends fe {
|
|
|
1726
1720
|
* TODO @lumixraku need scale param
|
|
1727
1721
|
* @param target
|
|
1728
1722
|
*/
|
|
1729
|
-
startEditing(
|
|
1730
|
-
this._setEditorRect(
|
|
1731
|
-
}
|
|
1732
|
-
setEditorVisible(
|
|
1733
|
-
var
|
|
1734
|
-
|
|
1735
|
-
const { unitId
|
|
1736
|
-
this._editorBridgeService.changeVisible({ visible
|
|
1737
|
-
}
|
|
1738
|
-
};
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
],
|
|
1744
|
-
const
|
|
1723
|
+
startEditing(pageId, target) {
|
|
1724
|
+
this._setEditorRect(pageId, target), this.setEditorVisible(!0);
|
|
1725
|
+
}
|
|
1726
|
+
setEditorVisible(visible) {
|
|
1727
|
+
var _a11, _b;
|
|
1728
|
+
visible ? (_a11 = this._curRichText) == null || _a11.hide() : (_b = this._curRichText) == null || _b.show();
|
|
1729
|
+
const { unitId } = this._renderContext;
|
|
1730
|
+
this._editorBridgeService.changeVisible({ visible, eventType: DeviceInputEventType.PointerDown, unitId });
|
|
1731
|
+
}
|
|
1732
|
+
}, __name(_a7, "SlideEditorBridgeRenderController"), _a7);
|
|
1733
|
+
SlideEditorBridgeRenderController = __decorateClass$3([
|
|
1734
|
+
__decorateParam$3(1, IUniverInstanceService),
|
|
1735
|
+
__decorateParam$3(2, ICommandService),
|
|
1736
|
+
__decorateParam$3(3, ISlideEditorBridgeService)
|
|
1737
|
+
], SlideEditorBridgeRenderController);
|
|
1738
|
+
const ActivateSlidePageOperation = {
|
|
1745
1739
|
id: "slide.operation.activate-slide",
|
|
1746
|
-
type:
|
|
1747
|
-
handler: (
|
|
1748
|
-
var
|
|
1749
|
-
const
|
|
1750
|
-
if (!
|
|
1751
|
-
const
|
|
1752
|
-
if (!
|
|
1753
|
-
const
|
|
1754
|
-
return
|
|
1755
|
-
}
|
|
1756
|
-
},
|
|
1740
|
+
type: CommandType.OPERATION,
|
|
1741
|
+
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
1742
|
+
var _a11, _b;
|
|
1743
|
+
const unitId = params.unitId, canvasView = accessor.get(CanvasView), model = accessor.get(IUniverInstanceService).getUnit(unitId), pageId = (_a11 = model == null ? void 0 : model.getActivePage()) == null ? void 0 : _a11.id;
|
|
1744
|
+
if (!pageId) return !1;
|
|
1745
|
+
const page = canvasView.getRenderUnitByPageId(pageId, unitId);
|
|
1746
|
+
if (!page) return !1;
|
|
1747
|
+
const transformer = (_b = page.scene) == null ? void 0 : _b.getTransformer();
|
|
1748
|
+
return transformer && transformer.clearControls(), canvasView.activePage(params.id, unitId), !0;
|
|
1749
|
+
}, "handler")
|
|
1750
|
+
}, AppendSlideOperation = {
|
|
1757
1751
|
id: "slide.operation.append-slide",
|
|
1758
|
-
type:
|
|
1759
|
-
handler: (
|
|
1760
|
-
const
|
|
1761
|
-
return
|
|
1762
|
-
}
|
|
1763
|
-
},
|
|
1752
|
+
type: CommandType.OPERATION,
|
|
1753
|
+
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
1754
|
+
const unitId = params.unitId;
|
|
1755
|
+
return accessor.get(IUniverInstanceService).getUnit(unitId) ? (accessor.get(CanvasView).appendPage(unitId), !0) : !1;
|
|
1756
|
+
}, "handler")
|
|
1757
|
+
}, InsertSlideFloatImageCommand = {
|
|
1764
1758
|
id: "slide.command.insert-float-image",
|
|
1765
|
-
type:
|
|
1766
|
-
handler: async (
|
|
1767
|
-
var
|
|
1768
|
-
const
|
|
1769
|
-
if (!
|
|
1770
|
-
const
|
|
1759
|
+
type: CommandType.COMMAND,
|
|
1760
|
+
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
1761
|
+
var _a11;
|
|
1762
|
+
const univerInstanceService = accessor.get(IUniverInstanceService), unitId = (_a11 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SLIDE)) == null ? void 0 : _a11.getUnitId();
|
|
1763
|
+
if (!unitId) return !1;
|
|
1764
|
+
const files = await accessor.get(ILocalFileService).openFile({
|
|
1771
1765
|
multiple: !0,
|
|
1772
|
-
accept:
|
|
1766
|
+
accept: DRAWING_IMAGE_ALLOW_IMAGE_LIST.map((image2) => `.${image2.replace("image/", "")}`).join(",")
|
|
1773
1767
|
});
|
|
1774
|
-
if (
|
|
1775
|
-
const
|
|
1776
|
-
if (!
|
|
1777
|
-
const { imageId
|
|
1778
|
-
if (!
|
|
1779
|
-
const
|
|
1780
|
-
id:
|
|
1781
|
-
zIndex:
|
|
1768
|
+
if (files.length !== 1) return !1;
|
|
1769
|
+
const imageParam = await accessor.get(IImageIoService).saveImage(files[0]);
|
|
1770
|
+
if (!imageParam) return !1;
|
|
1771
|
+
const { imageId, imageSourceType, source, base64Cache } = imageParam, { width, height, image } = await getImageSize(base64Cache || ""), slideData = univerInstanceService.getUnit(unitId);
|
|
1772
|
+
if (!slideData) return !1;
|
|
1773
|
+
const activePage = slideData.getActivePage(), elements = Object.values(activePage.pageElements), maxIndex = elements != null && elements.length ? Math.max(...elements.map((element2) => element2.zIndex)) : 20, data = {
|
|
1774
|
+
id: imageId,
|
|
1775
|
+
zIndex: maxIndex + 1,
|
|
1782
1776
|
left: 0,
|
|
1783
1777
|
top: 0,
|
|
1784
|
-
width
|
|
1785
|
-
height
|
|
1778
|
+
width,
|
|
1779
|
+
height,
|
|
1786
1780
|
title: "",
|
|
1787
1781
|
description: "",
|
|
1788
|
-
type:
|
|
1782
|
+
type: PageElementType.IMAGE,
|
|
1789
1783
|
image: {
|
|
1790
1784
|
imageProperties: {
|
|
1791
|
-
contentUrl:
|
|
1792
|
-
imageSourceType
|
|
1793
|
-
source
|
|
1794
|
-
base64Cache
|
|
1795
|
-
image
|
|
1785
|
+
contentUrl: base64Cache,
|
|
1786
|
+
imageSourceType,
|
|
1787
|
+
source,
|
|
1788
|
+
base64Cache,
|
|
1789
|
+
image
|
|
1796
1790
|
}
|
|
1797
1791
|
}
|
|
1798
1792
|
};
|
|
1799
|
-
|
|
1800
|
-
const
|
|
1801
|
-
return
|
|
1802
|
-
}
|
|
1803
|
-
},
|
|
1793
|
+
activePage.pageElements[imageId] = data, slideData.updatePage(activePage.id, activePage);
|
|
1794
|
+
const canvasView = accessor.get(CanvasView), sceneObject = canvasView.createObjectToPage(data, activePage.id, unitId);
|
|
1795
|
+
return sceneObject && canvasView.setObjectActiveByPage(sceneObject, activePage.id, unitId), !0;
|
|
1796
|
+
}, "handler")
|
|
1797
|
+
}, SlideAddTextCommand = {
|
|
1804
1798
|
id: "slide.command.add-text",
|
|
1805
|
-
type:
|
|
1806
|
-
handler: async (
|
|
1807
|
-
var
|
|
1808
|
-
const
|
|
1809
|
-
return await
|
|
1810
|
-
}
|
|
1811
|
-
},
|
|
1799
|
+
type: CommandType.COMMAND,
|
|
1800
|
+
handler: /* @__PURE__ */ __name(async (accessor) => {
|
|
1801
|
+
var _a11;
|
|
1802
|
+
const commandService = accessor.get(ICommandService), unitId = (_a11 = accessor.get(IUniverInstanceService).getFocusedUnit()) == null ? void 0 : _a11.getUnitId();
|
|
1803
|
+
return await commandService.executeCommand(SlideAddTextOperation.id, { unitId });
|
|
1804
|
+
}, "handler")
|
|
1805
|
+
}, SlideAddTextOperation = {
|
|
1812
1806
|
id: "slide.operation.add-text",
|
|
1813
|
-
type:
|
|
1814
|
-
handler: async (
|
|
1815
|
-
const
|
|
1816
|
-
if (!
|
|
1817
|
-
const
|
|
1818
|
-
id:
|
|
1819
|
-
zIndex:
|
|
1820
|
-
left
|
|
1821
|
-
top
|
|
1822
|
-
width:
|
|
1823
|
-
height:
|
|
1807
|
+
type: CommandType.OPERATION,
|
|
1808
|
+
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
1809
|
+
const unitId = params.unitId, elementId = generateRandomId(6), defaultWidth = 220, defaultheight = 40, left = 230, top = 142, textContent = (params == null ? void 0 : params.text) || "A New Text", slideData = accessor.get(IUniverInstanceService).getUnit(unitId);
|
|
1810
|
+
if (!slideData) return !1;
|
|
1811
|
+
const activePage = slideData.getActivePage(), elements = Object.values(activePage.pageElements), maxIndex = elements != null && elements.length ? Math.max(...elements.map((element2) => element2.zIndex)) : 21, elementData = {
|
|
1812
|
+
id: elementId,
|
|
1813
|
+
zIndex: maxIndex + 1,
|
|
1814
|
+
left,
|
|
1815
|
+
top,
|
|
1816
|
+
width: defaultWidth,
|
|
1817
|
+
height: defaultheight,
|
|
1824
1818
|
title: "text",
|
|
1825
1819
|
description: "",
|
|
1826
|
-
type:
|
|
1820
|
+
type: PageElementType.TEXT,
|
|
1827
1821
|
richText: {
|
|
1828
|
-
text:
|
|
1822
|
+
text: textContent,
|
|
1829
1823
|
fs: 30,
|
|
1830
1824
|
cl: {
|
|
1831
1825
|
rgb: "rgb(51, 51, 51)"
|
|
@@ -1833,72 +1827,72 @@ const Qt = {
|
|
|
1833
1827
|
bl: 1
|
|
1834
1828
|
}
|
|
1835
1829
|
};
|
|
1836
|
-
|
|
1837
|
-
const
|
|
1838
|
-
return
|
|
1839
|
-
}
|
|
1840
|
-
},
|
|
1830
|
+
activePage.pageElements[elementId] = elementData, slideData.updatePage(activePage.id, activePage);
|
|
1831
|
+
const canvasview = accessor.get(CanvasView), sceneObject = canvasview.createObjectToPage(elementData, activePage.id, unitId);
|
|
1832
|
+
return sceneObject && canvasview.setObjectActiveByPage(sceneObject, activePage.id, unitId), !0;
|
|
1833
|
+
}, "handler")
|
|
1834
|
+
}, SetSlidePageThumbOperation = {
|
|
1841
1835
|
id: "slide.operation.set-slide-page-thumb",
|
|
1842
|
-
type:
|
|
1843
|
-
handler: (
|
|
1844
|
-
},
|
|
1845
|
-
imagePopupMenu
|
|
1846
|
-
imagePopupMenuItem
|
|
1847
|
-
imagePopupMenuItemIcon
|
|
1848
|
-
imagePopupMenuItemTitle
|
|
1849
|
-
imagePopupMenuItemHide
|
|
1850
|
-
btnContainer
|
|
1851
|
-
btnContainerExpand
|
|
1852
|
-
},
|
|
1853
|
-
var
|
|
1854
|
-
const
|
|
1855
|
-
if (!
|
|
1836
|
+
type: CommandType.OPERATION,
|
|
1837
|
+
handler: /* @__PURE__ */ __name((accessor, params) => (accessor.get(CanvasView).createThumbs(params.unitId), !0), "handler")
|
|
1838
|
+
}, imagePopupMenu = "univer-image-popup-menu", imagePopupMenuItem = "univer-image-popup-menu-item", imagePopupMenuItemIcon = "univer-image-popup-menu-item-icon", imagePopupMenuItemTitle = "univer-image-popup-menu-item-title", imagePopupMenuItemHide = "univer-image-popup-menu-item-hide", btnContainer = "univer-btn-container", btnContainerExpand = "univer-btn-container-expand", styles$2 = {
|
|
1839
|
+
imagePopupMenu,
|
|
1840
|
+
imagePopupMenuItem,
|
|
1841
|
+
imagePopupMenuItemIcon,
|
|
1842
|
+
imagePopupMenuItemTitle,
|
|
1843
|
+
imagePopupMenuItemHide,
|
|
1844
|
+
btnContainer,
|
|
1845
|
+
btnContainerExpand
|
|
1846
|
+
}, SlideImagePopupMenu = /* @__PURE__ */ __name((props) => {
|
|
1847
|
+
var _a11, _b;
|
|
1848
|
+
const menuItems = (_b = (_a11 = props.popup) == null ? void 0 : _a11.extraProps) == null ? void 0 : _b.menuItems;
|
|
1849
|
+
if (!menuItems)
|
|
1856
1850
|
return null;
|
|
1857
|
-
const
|
|
1858
|
-
|
|
1859
|
-
},
|
|
1860
|
-
|
|
1861
|
-
},
|
|
1862
|
-
|
|
1863
|
-
},
|
|
1864
|
-
|
|
1865
|
-
},
|
|
1866
|
-
return /* @__PURE__ */
|
|
1851
|
+
const commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), [visible, setVisible] = useState(!1), [isHovered, setHovered] = useState(!1), handleMouseEnter = /* @__PURE__ */ __name(() => {
|
|
1852
|
+
setHovered(!0);
|
|
1853
|
+
}, "handleMouseEnter"), handleMouseLeave = /* @__PURE__ */ __name(() => {
|
|
1854
|
+
setHovered(!1);
|
|
1855
|
+
}, "handleMouseLeave"), onVisibleChange = /* @__PURE__ */ __name((visible2) => {
|
|
1856
|
+
setVisible(visible2);
|
|
1857
|
+
}, "onVisibleChange"), handleClick = /* @__PURE__ */ __name((item) => {
|
|
1858
|
+
commandService.executeCommand(item.commandId, item.commandParams), setVisible(!1);
|
|
1859
|
+
}, "handleClick"), showMore = visible || isHovered, availableMenu = menuItems.filter((item) => !item.disable);
|
|
1860
|
+
return /* @__PURE__ */ jsx(
|
|
1867
1861
|
"div",
|
|
1868
1862
|
{
|
|
1869
|
-
onMouseEnter:
|
|
1870
|
-
onMouseLeave:
|
|
1871
|
-
children: /* @__PURE__ */
|
|
1872
|
-
|
|
1863
|
+
onMouseEnter: handleMouseEnter,
|
|
1864
|
+
onMouseLeave: handleMouseLeave,
|
|
1865
|
+
children: /* @__PURE__ */ jsx(
|
|
1866
|
+
DropdownLegacy,
|
|
1873
1867
|
{
|
|
1874
1868
|
placement: "bottomLeft",
|
|
1875
1869
|
trigger: ["click"],
|
|
1876
|
-
overlay: /* @__PURE__ */
|
|
1870
|
+
overlay: /* @__PURE__ */ jsx("ul", { className: styles$2.imagePopupMenu, children: availableMenu.map((item) => /* @__PURE__ */ jsx(
|
|
1877
1871
|
"li",
|
|
1878
1872
|
{
|
|
1879
|
-
onClick: () =>
|
|
1880
|
-
className:
|
|
1881
|
-
children: /* @__PURE__ */
|
|
1873
|
+
onClick: /* @__PURE__ */ __name(() => handleClick(item), "onClick"),
|
|
1874
|
+
className: styles$2.imagePopupMenuItem,
|
|
1875
|
+
children: /* @__PURE__ */ jsx("span", { className: styles$2.imagePopupMenuItemTitle, children: localeService.t(item.label) })
|
|
1882
1876
|
},
|
|
1883
|
-
|
|
1877
|
+
item.index
|
|
1884
1878
|
)) }),
|
|
1885
|
-
visible
|
|
1886
|
-
onVisibleChange
|
|
1887
|
-
children: /* @__PURE__ */
|
|
1879
|
+
visible,
|
|
1880
|
+
onVisibleChange,
|
|
1881
|
+
children: /* @__PURE__ */ jsxs(
|
|
1888
1882
|
"div",
|
|
1889
1883
|
{
|
|
1890
|
-
className:
|
|
1891
|
-
[
|
|
1884
|
+
className: clsx(styles$2.btnContainer, {
|
|
1885
|
+
[styles$2.btnContainerExpand]: visible
|
|
1892
1886
|
}),
|
|
1893
1887
|
children: [
|
|
1894
|
-
/* @__PURE__ */
|
|
1895
|
-
|
|
1888
|
+
/* @__PURE__ */ jsx(
|
|
1889
|
+
Autofill,
|
|
1896
1890
|
{
|
|
1897
1891
|
style: { color: "#35322B" },
|
|
1898
1892
|
extend: { colorChannel1: "rgb(var(--green-700, #409f11))" }
|
|
1899
1893
|
}
|
|
1900
1894
|
),
|
|
1901
|
-
|
|
1895
|
+
showMore && /* @__PURE__ */ jsx(MoreDownSingle, { style: { color: "#CCCCCC", fontSize: "8px", marginLeft: "8px" } })
|
|
1902
1896
|
]
|
|
1903
1897
|
}
|
|
1904
1898
|
)
|
|
@@ -1906,452 +1900,434 @@ const Qt = {
|
|
|
1906
1900
|
)
|
|
1907
1901
|
}
|
|
1908
1902
|
);
|
|
1909
|
-
},
|
|
1910
|
-
slideBar
|
|
1911
|
-
slideBarContent
|
|
1912
|
-
slideBarContentHeader
|
|
1913
|
-
slideBarItem
|
|
1914
|
-
slideBarBox
|
|
1915
|
-
slideBarItemActive
|
|
1916
|
-
slideAddButton
|
|
1903
|
+
}, "SlideImagePopupMenu"), slideBar = "univer-slide-bar", slideBarContent = "univer-slide-bar-content", slideBarContentHeader = "univer-slide-bar-content-header", slideBarItem = "univer-slide-bar-item", slideBarBox = "univer-slide-bar-box", slideBarItemActive = "univer-slide-bar-item-active", slideAddButton = "univer-slide-add-button", styles$1 = {
|
|
1904
|
+
slideBar,
|
|
1905
|
+
slideBarContent,
|
|
1906
|
+
slideBarContentHeader,
|
|
1907
|
+
slideBarItem,
|
|
1908
|
+
slideBarBox,
|
|
1909
|
+
slideBarItemActive,
|
|
1910
|
+
slideAddButton
|
|
1917
1911
|
};
|
|
1918
|
-
function
|
|
1919
|
-
var
|
|
1920
|
-
const
|
|
1921
|
-
if (!
|
|
1912
|
+
function SlideSideBar() {
|
|
1913
|
+
var _a11, _b;
|
|
1914
|
+
const univerInstanceService = useDependency(IUniverInstanceService), commandService = useDependency(ICommandService), renderManagerService = useDependency(IRenderManagerService), localeService = useDependency(LocaleService), slideBarRef = useRef(null), currentSlide = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SLIDE), pages = currentSlide == null ? void 0 : currentSlide.getPages(), pageOrder = currentSlide == null ? void 0 : currentSlide.getPageOrder();
|
|
1915
|
+
if (!pages || !pageOrder)
|
|
1922
1916
|
return null;
|
|
1923
|
-
const
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
const b = (E = I == null ? void 0 : I.id) != null ? E : null;
|
|
1930
|
-
b && h(b);
|
|
1917
|
+
const slideList = pageOrder.map((id) => pages[id]), [activatePageId, setActivatePageId] = useState((_b = (_a11 = currentSlide == null ? void 0 : currentSlide.getActivePage()) == null ? void 0 : _a11.id) != null ? _b : null), divRefs = useMemo(() => slideList.map(() => React.createRef()), [slideList]);
|
|
1918
|
+
useEffect(() => {
|
|
1919
|
+
const subscriber = currentSlide == null ? void 0 : currentSlide.activePage$.subscribe((page) => {
|
|
1920
|
+
var _a12;
|
|
1921
|
+
const id = (_a12 = page == null ? void 0 : page.id) != null ? _a12 : null;
|
|
1922
|
+
id && setActivatePageId(id);
|
|
1931
1923
|
});
|
|
1932
1924
|
return () => {
|
|
1933
|
-
|
|
1925
|
+
subscriber == null || subscriber.unsubscribe();
|
|
1934
1926
|
};
|
|
1935
|
-
}, []),
|
|
1936
|
-
|
|
1937
|
-
var
|
|
1938
|
-
if (
|
|
1939
|
-
const
|
|
1940
|
-
(
|
|
1927
|
+
}, []), useEffect(() => {
|
|
1928
|
+
divRefs.forEach((ref, index) => {
|
|
1929
|
+
var _a12;
|
|
1930
|
+
if (ref.current) {
|
|
1931
|
+
const slide = slideList[index];
|
|
1932
|
+
(_a12 = renderManagerService.getRenderById(slide.id)) == null || _a12.engine.setContainer(ref.current);
|
|
1941
1933
|
}
|
|
1942
|
-
}),
|
|
1943
|
-
}, [
|
|
1944
|
-
const
|
|
1945
|
-
|
|
1946
|
-
}, [
|
|
1947
|
-
|
|
1948
|
-
}, [
|
|
1949
|
-
return /* @__PURE__ */
|
|
1950
|
-
/* @__PURE__ */
|
|
1951
|
-
|
|
1934
|
+
}), divRefs.length > 0 && commandService.syncExecuteCommand(SetSlidePageThumbOperation.id, { unitId: currentSlide == null ? void 0 : currentSlide.getUnitId() });
|
|
1935
|
+
}, [divRefs, slideList, renderManagerService, commandService, currentSlide]);
|
|
1936
|
+
const activatePage = useCallback((page) => {
|
|
1937
|
+
commandService.syncExecuteCommand(ActivateSlidePageOperation.id, { id: page, unitId: currentSlide == null ? void 0 : currentSlide.getUnitId() });
|
|
1938
|
+
}, [commandService, currentSlide]), handleAppendSlide = useCallback(() => {
|
|
1939
|
+
commandService.syncExecuteCommand(AppendSlideOperation.id, { unitId: currentSlide == null ? void 0 : currentSlide.getUnitId() });
|
|
1940
|
+
}, [commandService, currentSlide]);
|
|
1941
|
+
return /* @__PURE__ */ jsx("aside", { className: styles$1.slideBar, ref: slideBarRef, children: /* @__PURE__ */ jsx(Scrollbar, { children: /* @__PURE__ */ jsxs("div", { className: styles$1.slideBarContent, children: [
|
|
1942
|
+
/* @__PURE__ */ jsx("header", { className: styles$1.slideBarContentHeader, children: /* @__PURE__ */ jsx("a", { onClick: handleAppendSlide, children: localeService.t("slide.append") }) }),
|
|
1943
|
+
slideList.map((item, index) => /* @__PURE__ */ jsxs(
|
|
1952
1944
|
"div",
|
|
1953
1945
|
{
|
|
1954
|
-
className:
|
|
1955
|
-
[
|
|
1946
|
+
className: clsx(styles$1.slideBarItem, {
|
|
1947
|
+
[styles$1.slideBarItemActive]: item.id === activatePageId
|
|
1956
1948
|
}),
|
|
1957
|
-
onClick: () =>
|
|
1949
|
+
onClick: /* @__PURE__ */ __name(() => activatePage(item.id), "onClick"),
|
|
1958
1950
|
children: [
|
|
1959
|
-
/* @__PURE__ */
|
|
1960
|
-
/* @__PURE__ */
|
|
1951
|
+
/* @__PURE__ */ jsx("span", { children: index + 1 }),
|
|
1952
|
+
/* @__PURE__ */ jsx("div", { ref: divRefs[index], className: styles$1.slideBarBox })
|
|
1961
1953
|
]
|
|
1962
1954
|
},
|
|
1963
|
-
|
|
1955
|
+
item.id
|
|
1964
1956
|
))
|
|
1965
1957
|
] }) }) });
|
|
1966
1958
|
}
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1959
|
+
__name(SlideSideBar, "SlideSideBar");
|
|
1960
|
+
const slideEditorContainer = "univer-slide-editor-container", editorInput = "univer-editor-input", styles = {
|
|
1961
|
+
slideEditorContainer,
|
|
1962
|
+
editorInput
|
|
1963
|
+
}, HIDDEN_EDITOR_POSITION = -1e3, EDITOR_DEFAULT_POSITION = {
|
|
1971
1964
|
width: 0,
|
|
1972
1965
|
height: 0,
|
|
1973
|
-
top:
|
|
1974
|
-
left:
|
|
1975
|
-
},
|
|
1976
|
-
const [
|
|
1977
|
-
...
|
|
1978
|
-
}),
|
|
1979
|
-
() =>
|
|
1966
|
+
top: HIDDEN_EDITOR_POSITION,
|
|
1967
|
+
left: HIDDEN_EDITOR_POSITION
|
|
1968
|
+
}, SlideEditorContainer = /* @__PURE__ */ __name(() => {
|
|
1969
|
+
const [state, setState] = useState({
|
|
1970
|
+
...EDITOR_DEFAULT_POSITION
|
|
1971
|
+
}), slideEditorManagerService = useDependency(ISlideEditorManagerService), editorService = useDependency(IEditorService), contextService = useDependency(IContextService), disableAutoFocus = useObservable(
|
|
1972
|
+
() => contextService.subscribeContextValue$(DISABLE_AUTO_FOCUS_KEY),
|
|
1980
1973
|
!1,
|
|
1981
1974
|
void 0,
|
|
1982
|
-
[
|
|
1983
|
-
)
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
textRuns: [],
|
|
1988
|
-
paragraphs: [
|
|
1989
|
-
{
|
|
1990
|
-
startIndex: 0
|
|
1991
|
-
}
|
|
1992
|
-
]
|
|
1993
|
-
},
|
|
1994
|
-
documentStyle: {
|
|
1995
|
-
documentFlavor: Rn.UNSPECIFIED
|
|
1996
|
-
}
|
|
1997
|
-
};
|
|
1998
|
-
return ae(() => {
|
|
1999
|
-
t.state$.subscribe((a) => {
|
|
2000
|
-
if (a == null)
|
|
1975
|
+
[contextService, DISABLE_AUTO_FOCUS_KEY]
|
|
1976
|
+
);
|
|
1977
|
+
return `${DEFAULT_EMPTY_DOCUMENT_VALUE}`, DocumentFlavor.UNSPECIFIED, useEffect(() => {
|
|
1978
|
+
slideEditorManagerService.state$.subscribe((param) => {
|
|
1979
|
+
if (param == null)
|
|
2001
1980
|
return;
|
|
2002
1981
|
const {
|
|
2003
|
-
startX
|
|
2004
|
-
startY
|
|
2005
|
-
endX
|
|
2006
|
-
endY
|
|
2007
|
-
show
|
|
2008
|
-
} =
|
|
2009
|
-
if (!
|
|
2010
|
-
|
|
2011
|
-
...
|
|
1982
|
+
startX = HIDDEN_EDITOR_POSITION,
|
|
1983
|
+
startY = HIDDEN_EDITOR_POSITION,
|
|
1984
|
+
endX = 0,
|
|
1985
|
+
endY = 0,
|
|
1986
|
+
show = !1
|
|
1987
|
+
} = param;
|
|
1988
|
+
if (!show)
|
|
1989
|
+
setState({
|
|
1990
|
+
...EDITOR_DEFAULT_POSITION
|
|
2012
1991
|
});
|
|
2013
1992
|
else {
|
|
2014
|
-
|
|
2015
|
-
width:
|
|
2016
|
-
height:
|
|
2017
|
-
left:
|
|
2018
|
-
top:
|
|
1993
|
+
setState({
|
|
1994
|
+
width: endX - startX - FIX_ONE_PIXEL_BLUR_OFFSET + 2,
|
|
1995
|
+
height: endY - startY - FIX_ONE_PIXEL_BLUR_OFFSET + 2,
|
|
1996
|
+
left: startX + FIX_ONE_PIXEL_BLUR_OFFSET,
|
|
1997
|
+
top: startY + FIX_ONE_PIXEL_BLUR_OFFSET
|
|
2019
1998
|
});
|
|
2020
|
-
const
|
|
2021
|
-
if (
|
|
1999
|
+
const editor = editorService.getEditor(SLIDE_EDITOR_ID);
|
|
2000
|
+
if (editor == null)
|
|
2022
2001
|
return;
|
|
2023
|
-
const { left
|
|
2024
|
-
|
|
2002
|
+
const { left, top, width, height } = editor.getBoundingClientRect();
|
|
2003
|
+
slideEditorManagerService.setRect({ left, top, width, height });
|
|
2025
2004
|
}
|
|
2026
2005
|
});
|
|
2027
|
-
}, []),
|
|
2028
|
-
|
|
2029
|
-
}, [
|
|
2006
|
+
}, []), useEffect(() => {
|
|
2007
|
+
disableAutoFocus || slideEditorManagerService.setFocus(!0);
|
|
2008
|
+
}, [disableAutoFocus, state]), /* @__PURE__ */ jsx(
|
|
2030
2009
|
"div",
|
|
2031
2010
|
{
|
|
2032
|
-
className:
|
|
2011
|
+
className: styles.slideEditorContainer,
|
|
2033
2012
|
style: {
|
|
2034
|
-
left:
|
|
2035
|
-
top:
|
|
2036
|
-
width:
|
|
2037
|
-
height:
|
|
2038
|
-
}
|
|
2039
|
-
children: /* @__PURE__ */ d.jsx(
|
|
2040
|
-
ei,
|
|
2041
|
-
{
|
|
2042
|
-
id: Q,
|
|
2043
|
-
className: Pt.editorInput,
|
|
2044
|
-
snapshot: o,
|
|
2045
|
-
cancelDefaultResizeListener: !1,
|
|
2046
|
-
isSheetEditor: !1,
|
|
2047
|
-
isSingle: !1
|
|
2048
|
-
}
|
|
2049
|
-
)
|
|
2013
|
+
left: state.left,
|
|
2014
|
+
top: state.top,
|
|
2015
|
+
width: state.width,
|
|
2016
|
+
height: state.height
|
|
2017
|
+
}
|
|
2050
2018
|
}
|
|
2051
2019
|
);
|
|
2052
|
-
},
|
|
2053
|
-
function
|
|
2020
|
+
}, "SlideEditorContainer"), IMAGE_UPLOAD_ICON = "addition-and-subtraction-single", SLIDES_IMAGE_MENU_ID = "slide.menu.image";
|
|
2021
|
+
function SlideImageMenuFactory(accessor) {
|
|
2054
2022
|
return {
|
|
2055
|
-
id:
|
|
2056
|
-
type:
|
|
2057
|
-
icon:
|
|
2023
|
+
id: SLIDES_IMAGE_MENU_ID,
|
|
2024
|
+
type: MenuItemType.SUBITEMS,
|
|
2025
|
+
icon: IMAGE_UPLOAD_ICON,
|
|
2058
2026
|
tooltip: "slide.image.insert.title",
|
|
2059
|
-
hidden$:
|
|
2027
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SLIDE)
|
|
2060
2028
|
};
|
|
2061
2029
|
}
|
|
2062
|
-
|
|
2030
|
+
__name(SlideImageMenuFactory, "SlideImageMenuFactory");
|
|
2031
|
+
function UploadSlideFloatImageMenuFactory(_accessor) {
|
|
2063
2032
|
return {
|
|
2064
|
-
id:
|
|
2033
|
+
id: InsertSlideFloatImageCommand.id,
|
|
2065
2034
|
title: "slide.image.insert.float",
|
|
2066
|
-
type:
|
|
2067
|
-
hidden$:
|
|
2035
|
+
type: MenuItemType.BUTTON,
|
|
2036
|
+
hidden$: getMenuHiddenObservable(_accessor, UniverInstanceType.UNIVER_SLIDE)
|
|
2068
2037
|
};
|
|
2069
2038
|
}
|
|
2070
|
-
|
|
2071
|
-
|
|
2039
|
+
__name(UploadSlideFloatImageMenuFactory, "UploadSlideFloatImageMenuFactory");
|
|
2040
|
+
const GRAPH_SINGLE_ICON = "graph-single", SHAPE_MENU_ID = "slide.menu.shape";
|
|
2041
|
+
function SlideShapeMenuFactory(accessor) {
|
|
2072
2042
|
return {
|
|
2073
|
-
id:
|
|
2074
|
-
type:
|
|
2075
|
-
icon:
|
|
2043
|
+
id: SHAPE_MENU_ID,
|
|
2044
|
+
type: MenuItemType.SUBITEMS,
|
|
2045
|
+
icon: GRAPH_SINGLE_ICON,
|
|
2076
2046
|
tooltip: "slide.shape.insert.title",
|
|
2077
|
-
hidden$:
|
|
2047
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SLIDE)
|
|
2078
2048
|
// disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] }),
|
|
2079
2049
|
};
|
|
2080
2050
|
}
|
|
2081
|
-
|
|
2051
|
+
__name(SlideShapeMenuFactory, "SlideShapeMenuFactory");
|
|
2052
|
+
function UploadSlideFloatShapeMenuFactory(_accessor) {
|
|
2082
2053
|
return {
|
|
2083
|
-
id:
|
|
2054
|
+
id: InsertSlideShapeRectangleCommand.id,
|
|
2084
2055
|
title: "slide.shape.insert.rectangle",
|
|
2085
|
-
type:
|
|
2086
|
-
hidden$:
|
|
2056
|
+
type: MenuItemType.BUTTON,
|
|
2057
|
+
hidden$: getMenuHiddenObservable(_accessor, UniverInstanceType.UNIVER_SLIDE)
|
|
2087
2058
|
};
|
|
2088
2059
|
}
|
|
2089
|
-
|
|
2090
|
-
|
|
2060
|
+
__name(UploadSlideFloatShapeMenuFactory, "UploadSlideFloatShapeMenuFactory");
|
|
2061
|
+
const TEXT_ICON_ID = "text-single";
|
|
2062
|
+
function SlideAddTextMenuItemFactory(_accessor) {
|
|
2091
2063
|
return {
|
|
2092
|
-
id:
|
|
2093
|
-
type:
|
|
2094
|
-
icon:
|
|
2064
|
+
id: SlideAddTextCommand.id,
|
|
2065
|
+
type: MenuItemType.BUTTON,
|
|
2066
|
+
icon: TEXT_ICON_ID,
|
|
2095
2067
|
tooltip: "slide.text.insert.title",
|
|
2096
|
-
hidden$:
|
|
2068
|
+
hidden$: getMenuHiddenObservable(_accessor, UniverInstanceType.UNIVER_SLIDE)
|
|
2097
2069
|
};
|
|
2098
2070
|
}
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2071
|
+
__name(SlideAddTextMenuItemFactory, "SlideAddTextMenuItemFactory");
|
|
2072
|
+
const menuSchema = {
|
|
2073
|
+
[RibbonStartGroup.FORMAT]: {
|
|
2074
|
+
[SlideAddTextCommand.id]: {
|
|
2102
2075
|
order: 0,
|
|
2103
|
-
menuItemFactory:
|
|
2076
|
+
menuItemFactory: SlideAddTextMenuItemFactory
|
|
2104
2077
|
},
|
|
2105
|
-
[
|
|
2078
|
+
[SLIDES_IMAGE_MENU_ID]: {
|
|
2106
2079
|
order: 0,
|
|
2107
|
-
menuItemFactory:
|
|
2108
|
-
[
|
|
2080
|
+
menuItemFactory: SlideImageMenuFactory,
|
|
2081
|
+
[InsertSlideFloatImageCommand.id]: {
|
|
2109
2082
|
order: 0,
|
|
2110
|
-
menuItemFactory:
|
|
2083
|
+
menuItemFactory: UploadSlideFloatImageMenuFactory
|
|
2111
2084
|
}
|
|
2112
2085
|
},
|
|
2113
|
-
[
|
|
2086
|
+
[SHAPE_MENU_ID]: {
|
|
2114
2087
|
order: 0,
|
|
2115
|
-
menuItemFactory:
|
|
2116
|
-
[
|
|
2088
|
+
menuItemFactory: SlideShapeMenuFactory,
|
|
2089
|
+
[InsertSlideShapeRectangleCommand.id]: {
|
|
2117
2090
|
order: 0,
|
|
2118
|
-
menuItemFactory:
|
|
2091
|
+
menuItemFactory: UploadSlideFloatShapeMenuFactory
|
|
2119
2092
|
}
|
|
2120
2093
|
}
|
|
2121
2094
|
}
|
|
2122
2095
|
};
|
|
2123
|
-
function
|
|
2124
|
-
return
|
|
2096
|
+
function whenEditorActivated(contextService) {
|
|
2097
|
+
return contextService.getContextValue(FOCUSING_UNIVER_EDITOR) && contextService.getContextValue(EDITOR_ACTIVATED);
|
|
2125
2098
|
}
|
|
2126
|
-
|
|
2127
|
-
|
|
2099
|
+
__name(whenEditorActivated, "whenEditorActivated");
|
|
2100
|
+
function whenFormulaEditorFocused(contextService) {
|
|
2101
|
+
return contextService.getContextValue(FORMULA_EDITOR_ACTIVATED) && contextService.getContextValue(FOCUSING_UNIVER_EDITOR);
|
|
2128
2102
|
}
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2103
|
+
__name(whenFormulaEditorFocused, "whenFormulaEditorFocused");
|
|
2104
|
+
const ARROW_SELECTION_KEYCODE_LIST = [
|
|
2105
|
+
KeyCode.ARROW_DOWN,
|
|
2106
|
+
KeyCode.ARROW_UP,
|
|
2107
|
+
KeyCode.ARROW_LEFT,
|
|
2108
|
+
KeyCode.ARROW_RIGHT
|
|
2134
2109
|
];
|
|
2135
|
-
[
|
|
2136
|
-
function
|
|
2137
|
-
const
|
|
2138
|
-
for (const
|
|
2139
|
-
|
|
2140
|
-
id:
|
|
2141
|
-
binding:
|
|
2142
|
-
preconditions: (
|
|
2110
|
+
[KeyCode.ENTER, KeyCode.TAB, ...ARROW_SELECTION_KEYCODE_LIST];
|
|
2111
|
+
function generateArrowSelectionShortCutItem() {
|
|
2112
|
+
const shortcutList = [];
|
|
2113
|
+
for (const keycode of ARROW_SELECTION_KEYCODE_LIST)
|
|
2114
|
+
shortcutList.push({
|
|
2115
|
+
id: SetTextEditArrowOperation.id,
|
|
2116
|
+
binding: keycode,
|
|
2117
|
+
preconditions: /* @__PURE__ */ __name((contextService) => whenEditorActivated(contextService), "preconditions"),
|
|
2143
2118
|
staticParameters: {
|
|
2144
2119
|
visible: !1,
|
|
2145
|
-
eventType:
|
|
2146
|
-
keycode
|
|
2120
|
+
eventType: DeviceInputEventType.Keyboard,
|
|
2121
|
+
keycode,
|
|
2147
2122
|
isShift: !1
|
|
2148
2123
|
}
|
|
2149
|
-
}),
|
|
2150
|
-
id:
|
|
2151
|
-
binding:
|
|
2152
|
-
preconditions: (
|
|
2124
|
+
}), shortcutList.push({
|
|
2125
|
+
id: SetTextEditArrowOperation.id,
|
|
2126
|
+
binding: keycode | MetaKeys.SHIFT,
|
|
2127
|
+
preconditions: /* @__PURE__ */ __name((contextService) => whenEditorActivated(contextService), "preconditions"),
|
|
2153
2128
|
staticParameters: {
|
|
2154
2129
|
visible: !1,
|
|
2155
|
-
eventType:
|
|
2156
|
-
keycode
|
|
2130
|
+
eventType: DeviceInputEventType.Keyboard,
|
|
2131
|
+
keycode,
|
|
2157
2132
|
isShift: !0
|
|
2158
2133
|
}
|
|
2159
2134
|
});
|
|
2160
|
-
return
|
|
2135
|
+
return shortcutList;
|
|
2161
2136
|
}
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2137
|
+
__name(generateArrowSelectionShortCutItem, "generateArrowSelectionShortCutItem");
|
|
2138
|
+
const EditorDeleteLeftShortcut = {
|
|
2139
|
+
id: DeleteLeftCommand.id,
|
|
2140
|
+
preconditions: /* @__PURE__ */ __name((contextService) => whenEditorActivated(contextService) || whenFormulaEditorFocused(contextService), "preconditions"),
|
|
2141
|
+
binding: KeyCode.BACKSPACE
|
|
2166
2142
|
};
|
|
2167
|
-
var
|
|
2168
|
-
for (var
|
|
2169
|
-
(
|
|
2170
|
-
return
|
|
2171
|
-
},
|
|
2172
|
-
let
|
|
2173
|
-
constructor(
|
|
2174
|
-
super(), this._injector =
|
|
2143
|
+
var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2144
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2145
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
2146
|
+
return kind && result && __defProp$2(target, key, result), result;
|
|
2147
|
+
}, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a8;
|
|
2148
|
+
let SlidesUIController = (_a8 = class extends Disposable {
|
|
2149
|
+
constructor(_injector, _menuManagerService, _componentManager, _uiPartsService, _commandService, _shortcutService) {
|
|
2150
|
+
super(), this._injector = _injector, this._menuManagerService = _menuManagerService, this._componentManager = _componentManager, this._uiPartsService = _uiPartsService, this._commandService = _commandService, this._shortcutService = _shortcutService, this._initCommands(), this._initCustomComponents(), this._initUIComponents(), this._initMenus(), this._initShortcuts();
|
|
2175
2151
|
}
|
|
2176
2152
|
_initMenus() {
|
|
2177
|
-
this._menuManagerService.mergeMenu(
|
|
2153
|
+
this._menuManagerService.mergeMenu(menuSchema);
|
|
2178
2154
|
}
|
|
2179
2155
|
_initCustomComponents() {
|
|
2180
|
-
const
|
|
2181
|
-
this.disposeWithMe(
|
|
2156
|
+
const componentManager = this._componentManager;
|
|
2157
|
+
this.disposeWithMe(componentManager.register(IMAGE_UPLOAD_ICON, AddImageSingle)), this.disposeWithMe(componentManager.register(TEXT_ICON_ID, TextSingle)), this.disposeWithMe(componentManager.register(GRAPH_SINGLE_ICON, GraphSingle)), this.disposeWithMe(componentManager.register(COMPONENT_SLIDE_IMAGE_POPUP_MENU, SlideImagePopupMenu)), this.disposeWithMe(componentManager.register(COMPONENT_SLIDE_SIDEBAR, RectSidebar));
|
|
2182
2158
|
}
|
|
2183
2159
|
_initCommands() {
|
|
2184
2160
|
[
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2161
|
+
AppendSlideOperation,
|
|
2162
|
+
ActivateSlidePageOperation,
|
|
2163
|
+
SetSlidePageThumbOperation,
|
|
2164
|
+
InsertSlideFloatImageCommand,
|
|
2165
|
+
SlideAddTextOperation,
|
|
2166
|
+
SlideAddTextCommand,
|
|
2167
|
+
InsertSlideShapeRectangleOperation,
|
|
2168
|
+
InsertSlideShapeRectangleCommand,
|
|
2169
|
+
ToggleSlideEditSidebarOperation,
|
|
2170
|
+
DeleteSlideElementOperation,
|
|
2171
|
+
UpdateSlideElementOperation,
|
|
2196
2172
|
// commands for editor
|
|
2197
|
-
|
|
2198
|
-
].forEach((
|
|
2173
|
+
SetTextEditArrowOperation
|
|
2174
|
+
].forEach((command) => this.disposeWithMe(this._commandService.registerCommand(command)));
|
|
2199
2175
|
}
|
|
2200
2176
|
_initUIComponents() {
|
|
2201
2177
|
this.disposeWithMe(
|
|
2202
|
-
this._uiPartsService.registerComponent(
|
|
2178
|
+
this._uiPartsService.registerComponent(BuiltInUIPart.LEFT_SIDEBAR, () => connectInjector(SlideSideBar, this._injector))
|
|
2203
2179
|
), this.disposeWithMe(
|
|
2204
|
-
this._uiPartsService.registerComponent(
|
|
2180
|
+
this._uiPartsService.registerComponent(BuiltInUIPart.CONTENT, () => connectInjector(SlideEditorContainer, this._injector))
|
|
2205
2181
|
);
|
|
2206
2182
|
}
|
|
2207
2183
|
_initShortcuts() {
|
|
2208
2184
|
[
|
|
2209
|
-
|
|
2210
|
-
...
|
|
2211
|
-
].forEach((
|
|
2212
|
-
this.disposeWithMe(this._shortcutService.registerShortcut(
|
|
2185
|
+
EditorDeleteLeftShortcut,
|
|
2186
|
+
...generateArrowSelectionShortCutItem()
|
|
2187
|
+
].forEach((item) => {
|
|
2188
|
+
this.disposeWithMe(this._shortcutService.registerShortcut(item));
|
|
2213
2189
|
});
|
|
2214
2190
|
}
|
|
2215
|
-
};
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
],
|
|
2224
|
-
var
|
|
2225
|
-
for (var
|
|
2226
|
-
(
|
|
2227
|
-
return
|
|
2228
|
-
}, $
|
|
2229
|
-
let
|
|
2191
|
+
}, __name(_a8, "SlidesUIController"), _a8);
|
|
2192
|
+
SlidesUIController = __decorateClass$2([
|
|
2193
|
+
__decorateParam$2(0, Inject(Injector)),
|
|
2194
|
+
__decorateParam$2(1, IMenuManagerService),
|
|
2195
|
+
__decorateParam$2(2, Inject(ComponentManager)),
|
|
2196
|
+
__decorateParam$2(3, IUIPartsService),
|
|
2197
|
+
__decorateParam$2(4, ICommandService),
|
|
2198
|
+
__decorateParam$2(5, IShortcutService)
|
|
2199
|
+
], SlidesUIController);
|
|
2200
|
+
var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2201
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2202
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
2203
|
+
return kind && result && __defProp$1(target, key, result), result;
|
|
2204
|
+
}, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a9;
|
|
2205
|
+
let SlideRenderService = (_a9 = class extends RxDisposable {
|
|
2230
2206
|
// private _skeletonChangeMutations = new Set<string>();
|
|
2231
|
-
constructor(
|
|
2232
|
-
super(), this._contextService =
|
|
2207
|
+
constructor(_contextService, _instanceSrv, _renderManagerService) {
|
|
2208
|
+
super(), this._contextService = _contextService, this._instanceSrv = _instanceSrv, this._renderManagerService = _renderManagerService, Promise.resolve().then(() => this._init());
|
|
2233
2209
|
}
|
|
2234
2210
|
_init() {
|
|
2235
2211
|
this._initSlideDataListener(), this._initContextListener();
|
|
2236
2212
|
}
|
|
2237
2213
|
_initSlideDataListener() {
|
|
2238
|
-
this._instanceSrv.getTypeOfUnitAdded$(
|
|
2239
|
-
this._createRenderer(
|
|
2240
|
-
}), this._instanceSrv.getAllUnitsForType(
|
|
2241
|
-
this._createRenderer(
|
|
2242
|
-
}), this._instanceSrv.getTypeOfUnitDisposed$(
|
|
2214
|
+
this._instanceSrv.getTypeOfUnitAdded$(UniverInstanceType.UNIVER_SLIDE).pipe(takeUntil(this.dispose$)).subscribe((slideModel) => {
|
|
2215
|
+
this._createRenderer(slideModel == null ? void 0 : slideModel.getUnitId());
|
|
2216
|
+
}), this._instanceSrv.getAllUnitsForType(UniverInstanceType.UNIVER_SLIDE).forEach((slideModel) => {
|
|
2217
|
+
this._createRenderer(slideModel.getUnitId());
|
|
2218
|
+
}), this._instanceSrv.getTypeOfUnitDisposed$(UniverInstanceType.UNIVER_SLIDE).pipe(takeUntil(this.dispose$)).subscribe((workbook) => this._disposeRenderer(workbook));
|
|
2243
2219
|
}
|
|
2244
|
-
_createRenderer(
|
|
2245
|
-
|
|
2220
|
+
_createRenderer(unitId) {
|
|
2221
|
+
unitId == null || this._instanceSrv.getUnit(unitId, UniverInstanceType.UNIVER_SLIDE) == null || (this._renderManagerService.createRender(unitId), this._renderManagerService.setCurrent(unitId));
|
|
2246
2222
|
}
|
|
2247
|
-
_disposeRenderer(
|
|
2248
|
-
const
|
|
2249
|
-
this._renderManagerService.removeRender(
|
|
2223
|
+
_disposeRenderer(workbook) {
|
|
2224
|
+
const unitId = workbook.getUnitId();
|
|
2225
|
+
this._renderManagerService.removeRender(unitId);
|
|
2250
2226
|
}
|
|
2251
2227
|
_initContextListener() {
|
|
2252
2228
|
}
|
|
2253
|
-
};
|
|
2254
|
-
|
|
2255
|
-
$
|
|
2256
|
-
$
|
|
2257
|
-
$
|
|
2258
|
-
],
|
|
2259
|
-
var
|
|
2260
|
-
for (var
|
|
2261
|
-
(
|
|
2262
|
-
return
|
|
2263
|
-
},
|
|
2264
|
-
const
|
|
2265
|
-
var
|
|
2266
|
-
let
|
|
2267
|
-
constructor(
|
|
2268
|
-
super(), this._config =
|
|
2269
|
-
const { menu
|
|
2229
|
+
}, __name(_a9, "SlideRenderService"), _a9);
|
|
2230
|
+
SlideRenderService = __decorateClass$1([
|
|
2231
|
+
__decorateParam$1(0, IContextService),
|
|
2232
|
+
__decorateParam$1(1, IUniverInstanceService),
|
|
2233
|
+
__decorateParam$1(2, IRenderManagerService)
|
|
2234
|
+
], SlideRenderService);
|
|
2235
|
+
var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2236
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2237
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
2238
|
+
return kind && result && __defProp2(target, key, result), result;
|
|
2239
|
+
}, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam");
|
|
2240
|
+
const SLIDE_UI_PLUGIN_NAME = "SLIDE_UI";
|
|
2241
|
+
var _a10;
|
|
2242
|
+
let UniverSlidesUIPlugin = (_a10 = class extends Plugin {
|
|
2243
|
+
constructor(_config = defaultPluginConfig, _injector, _renderManagerService, _univerInstanceService, _configService) {
|
|
2244
|
+
super(), this._config = _config, this._injector = _injector, this._renderManagerService = _renderManagerService, this._univerInstanceService = _univerInstanceService, this._configService = _configService;
|
|
2245
|
+
const { menu, ...rest } = merge(
|
|
2270
2246
|
{},
|
|
2271
|
-
|
|
2247
|
+
defaultPluginConfig,
|
|
2272
2248
|
this._config
|
|
2273
2249
|
);
|
|
2274
|
-
|
|
2250
|
+
menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(SLIDES_UI_PLUGIN_CONFIG_KEY, rest);
|
|
2275
2251
|
}
|
|
2276
2252
|
onStarting() {
|
|
2277
|
-
|
|
2278
|
-
[
|
|
2279
|
-
[
|
|
2253
|
+
mergeOverrideWithDependencies([
|
|
2254
|
+
[SlideRenderService],
|
|
2255
|
+
[ISlideEditorBridgeService, { useClass: SlideEditorBridgeService }],
|
|
2280
2256
|
// used by SlideUIController --> EditorContainer
|
|
2281
|
-
[
|
|
2282
|
-
[
|
|
2283
|
-
], this._config.override).forEach((
|
|
2257
|
+
[ISlideEditorManagerService, { useClass: SlideEditorManagerService }],
|
|
2258
|
+
[SlideCanvasPopMangerService]
|
|
2259
|
+
], this._config.override).forEach((d) => this._injector.add(d));
|
|
2284
2260
|
}
|
|
2285
2261
|
onReady() {
|
|
2286
2262
|
[
|
|
2287
2263
|
// SlideRenderService will be init in ready stage, and then calling RenderManagerService@createRender --> init all deps in this rendering register block.
|
|
2288
|
-
[
|
|
2289
|
-
].forEach((
|
|
2290
|
-
this.disposeWithMe(this._renderManagerService.registerRenderModule(
|
|
2291
|
-
}),
|
|
2292
|
-
[
|
|
2264
|
+
[SlideRenderController]
|
|
2265
|
+
].forEach((m) => {
|
|
2266
|
+
this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SLIDE, m));
|
|
2267
|
+
}), mergeOverrideWithDependencies([
|
|
2268
|
+
[CanvasView],
|
|
2293
2269
|
// cannot register in _renderManagerService now.
|
|
2294
2270
|
// [ISlideEditorBridgeService, { useClass: SlideEditorBridgeService }],
|
|
2295
2271
|
// // used by SlideUIController --> EditorContainer
|
|
2296
2272
|
// [ISlideEditorManagerService, { useClass: SlideEditorManagerService }],
|
|
2297
2273
|
// SlidesUIController controller should be registered in Ready stage.
|
|
2298
2274
|
// SlidesUIController controller would add a new RenderUnit (__INTERNAL_EDITOR__DOCS_NORMAL)
|
|
2299
|
-
[
|
|
2275
|
+
[SlidesUIController],
|
|
2300
2276
|
// editor service was create in renderManagerService
|
|
2301
|
-
[
|
|
2302
|
-
[
|
|
2303
|
-
], this._config.override).forEach((
|
|
2304
|
-
this._injector.add(
|
|
2305
|
-
}), this._injector.get(
|
|
2277
|
+
[SlideRenderController],
|
|
2278
|
+
[SlidePopupMenuController]
|
|
2279
|
+
], this._config.override).forEach((m) => {
|
|
2280
|
+
this._injector.add(m);
|
|
2281
|
+
}), this._injector.get(CanvasView), this._injector.get(SlideRenderService);
|
|
2306
2282
|
}
|
|
2307
2283
|
onRendered() {
|
|
2308
2284
|
[
|
|
2309
2285
|
// need slideEditorBridgeService
|
|
2310
2286
|
// need TextSelectionRenderService which init by EditorContainer
|
|
2311
|
-
[
|
|
2312
|
-
[
|
|
2313
|
-
].forEach((
|
|
2314
|
-
this.disposeWithMe(this._renderManagerService.registerRenderModule(
|
|
2315
|
-
}), this._markSlideAsFocused(), this._injector.get(
|
|
2287
|
+
[SlideEditorBridgeRenderController],
|
|
2288
|
+
[SlideEditingRenderController]
|
|
2289
|
+
].forEach((m) => {
|
|
2290
|
+
this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SLIDE, m));
|
|
2291
|
+
}), this._markSlideAsFocused(), this._injector.get(SlidesUIController);
|
|
2316
2292
|
}
|
|
2317
2293
|
onSteady() {
|
|
2318
|
-
this._injector.get(
|
|
2294
|
+
this._injector.get(SlidePopupMenuController);
|
|
2319
2295
|
}
|
|
2320
2296
|
_markSlideAsFocused() {
|
|
2321
|
-
const
|
|
2297
|
+
const currentService = this._univerInstanceService;
|
|
2322
2298
|
try {
|
|
2323
|
-
const
|
|
2324
|
-
|
|
2299
|
+
const slideDataModel = currentService.getCurrentUnitForType(UniverInstanceType.UNIVER_SLIDE);
|
|
2300
|
+
currentService.focusUnit(slideDataModel.getUnitId());
|
|
2325
2301
|
} catch {
|
|
2326
2302
|
}
|
|
2327
2303
|
}
|
|
2328
|
-
},
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
],
|
|
2304
|
+
}, __name(_a10, "UniverSlidesUIPlugin"), __publicField(_a10, "pluginName", SLIDE_UI_PLUGIN_NAME), __publicField(_a10, "type", UniverInstanceType.UNIVER_SLIDE), _a10);
|
|
2305
|
+
UniverSlidesUIPlugin = __decorateClass([
|
|
2306
|
+
__decorateParam(1, Inject(Injector)),
|
|
2307
|
+
__decorateParam(2, IRenderManagerService),
|
|
2308
|
+
__decorateParam(3, IUniverInstanceService),
|
|
2309
|
+
__decorateParam(4, IConfigService)
|
|
2310
|
+
], UniverSlidesUIPlugin);
|
|
2335
2311
|
export {
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2312
|
+
ActivateSlidePageOperation,
|
|
2313
|
+
AppendSlideOperation,
|
|
2314
|
+
CanvasView,
|
|
2315
|
+
DeleteSlideElementOperation,
|
|
2316
|
+
ISlideEditorBridgeService,
|
|
2317
|
+
InsertSlideFloatImageCommand,
|
|
2318
|
+
InsertSlideShapeRectangleCommand,
|
|
2319
|
+
InsertSlideShapeRectangleOperation,
|
|
2320
|
+
SHAPE_MENU_ID,
|
|
2321
|
+
SLIDES_IMAGE_MENU_ID,
|
|
2322
|
+
SLIDE_EDITOR_ID,
|
|
2323
|
+
SetSlidePageThumbOperation,
|
|
2324
|
+
SlideAddTextCommand,
|
|
2325
|
+
SlideAddTextOperation,
|
|
2326
|
+
SlideCanvasPopMangerService,
|
|
2327
|
+
SlideEditorContainer,
|
|
2328
|
+
SlideSideBar,
|
|
2329
|
+
SlidesUIController,
|
|
2330
|
+
menuSchema as SlidesUIMenuSchema,
|
|
2331
|
+
UniverSlidesUIPlugin,
|
|
2332
|
+
UpdateSlideElementOperation
|
|
2357
2333
|
};
|