@univerjs/slides-ui 0.5.5-nightly.202501210734 → 0.5.5-nightly.202501210925
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/es/index.js +1515 -1480
- 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/package.json +9 -9
package/lib/es/index.js
CHANGED
|
@@ -1,42 +1,43 @@
|
|
|
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 React, { forwardRef, useRef, createElement, useState, useEffect, useCallback } from "react";
|
|
10
|
+
import { Button, InputNumber, DropdownLegacy, ColorPicker, Scrollbar } from "@univerjs/design";
|
|
11
|
+
import { BehaviorSubject, Subject, filter, takeUntil } from "rxjs";
|
|
12
|
+
import { DocSelectionManagerService, DocSkeletonManagerService, RichTextEditingMutation } from "@univerjs/docs";
|
|
13
|
+
import { IEditorService, DocSelectionRenderService, VIEWPORT_KEY, DOCS_COMPONENT_MAIN_LAYER_INDEX, MoveSelectionOperation, MoveCursorOperation, DOCS_VIEW_KEY, DeleteLeftCommand } from "@univerjs/docs-ui";
|
|
14
|
+
import { DRAWING_IMAGE_ALLOW_IMAGE_LIST, IImageIoService, getImageSize } from "@univerjs/drawing";
|
|
15
|
+
var __defProp$9 = Object.defineProperty, __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor, __decorateClass$9 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
16
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
17
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
18
|
+
return kind && result && __defProp$9(target, key, result), result;
|
|
19
|
+
}, "__decorateClass$9"), __decorateParam$9 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$9"), _a;
|
|
20
|
+
let SlideRenderController = (_a = class extends RxDisposable {
|
|
21
|
+
constructor(_renderContext, _injector, _univerInstanceService, _renderManagerService) {
|
|
21
22
|
super();
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
__publicField(this, "_objectProvider", null);
|
|
24
|
+
__publicField(this, "_refreshThumb", debounce(() => {
|
|
24
25
|
this.createThumbs();
|
|
25
26
|
}, 300));
|
|
26
|
-
this._renderContext =
|
|
27
|
+
this._renderContext = _renderContext, this._injector = _injector, this._univerInstanceService = _univerInstanceService, this._renderManagerService = _renderManagerService, this._objectProvider = this._injector.createInstance(ObjectProvider), this._addNewRender();
|
|
27
28
|
}
|
|
28
29
|
_addNewRender() {
|
|
29
|
-
const { unitId
|
|
30
|
-
if (!
|
|
31
|
-
const
|
|
32
|
-
this._scrollToCenter(),
|
|
30
|
+
const { unitId, engine, scene } = this._renderContext, slideDataModel = this._getCurrUnitModel();
|
|
31
|
+
if (!slideDataModel) return;
|
|
32
|
+
const observer = engine.onTransformChange$.subscribeEvent(() => {
|
|
33
|
+
this._scrollToCenter(), observer == null || observer.unsubscribe();
|
|
33
34
|
});
|
|
34
|
-
|
|
35
|
+
engine.onTransformChange$.subscribeEvent(() => {
|
|
35
36
|
setTimeout(() => {
|
|
36
37
|
this.createThumbs();
|
|
37
38
|
}, 300);
|
|
38
39
|
});
|
|
39
|
-
const
|
|
40
|
+
const viewMain = new Viewport(SLIDE_KEY.VIEW, scene, {
|
|
40
41
|
left: 0,
|
|
41
42
|
top: 0,
|
|
42
43
|
bottom: 0,
|
|
@@ -45,97 +46,97 @@ let pe = class extends fe {
|
|
|
45
46
|
explicitViewportHeightSet: !1,
|
|
46
47
|
isWheelPreventDefaultX: !0
|
|
47
48
|
});
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
const
|
|
52
|
-
let
|
|
53
|
-
|
|
49
|
+
scene.attachControl(), scene.onMouseWheel$.subscribeEvent((evt, state) => {
|
|
50
|
+
const e = evt;
|
|
51
|
+
if (e.ctrlKey) {
|
|
52
|
+
const deltaFactor = Math.abs(e.deltaX);
|
|
53
|
+
let scrollNum = deltaFactor < 40 ? 0.2 : deltaFactor < 80 ? 0.4 : 0.2;
|
|
54
|
+
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
55
|
} else
|
|
55
|
-
|
|
56
|
-
}),
|
|
56
|
+
viewMain.onMouseWheel(e, state);
|
|
57
|
+
}), scene.onFileLoaded$.subscribeEvent(() => {
|
|
57
58
|
this._refreshThumb();
|
|
58
|
-
}),
|
|
59
|
-
const
|
|
60
|
-
this._renderContext.mainComponent =
|
|
61
|
-
|
|
59
|
+
}), ScrollBar.attachTo(viewMain), this._renderManagerService.setCurrent(unitId);
|
|
60
|
+
const slide = this._createSlide(scene);
|
|
61
|
+
this._renderContext.mainComponent = slide, this._createSlidePages(slideDataModel, slide), this.createThumbs(), engine.runRenderLoop(() => {
|
|
62
|
+
scene.render();
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
65
|
_scrollToCenter() {
|
|
65
|
-
var
|
|
66
|
-
const
|
|
67
|
-
if (!
|
|
68
|
-
const { left:
|
|
69
|
-
|
|
70
|
-
x
|
|
71
|
-
y
|
|
66
|
+
var _a11;
|
|
67
|
+
const mainScene = (_a11 = this._currentRender()) == null ? void 0 : _a11.scene, viewMain = mainScene == null ? void 0 : mainScene.getViewport(SLIDE_KEY.VIEW), getCenterPositionViewPort = this._getCenterPositionViewPort(mainScene);
|
|
68
|
+
if (!viewMain || !getCenterPositionViewPort) return;
|
|
69
|
+
const { left: viewPortLeft, top: viewPortTop } = getCenterPositionViewPort, { x, y } = viewMain.transViewportScroll2ScrollValue(viewPortLeft, viewPortTop);
|
|
70
|
+
viewMain.scrollToBarPos({
|
|
71
|
+
x,
|
|
72
|
+
y
|
|
72
73
|
});
|
|
73
74
|
}
|
|
74
75
|
_currentRender() {
|
|
75
|
-
return this._renderManagerService.getCurrentTypeOfRenderer(
|
|
76
|
+
return this._renderManagerService.getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_SLIDE);
|
|
76
77
|
}
|
|
77
78
|
/**
|
|
78
79
|
* @param mainScene
|
|
79
80
|
*/
|
|
80
|
-
_createSlide(
|
|
81
|
-
const
|
|
82
|
-
left: (
|
|
83
|
-
top: (
|
|
84
|
-
width
|
|
85
|
-
height
|
|
81
|
+
_createSlide(mainScene) {
|
|
82
|
+
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, {
|
|
83
|
+
left: (sceneWidth - width) / 2,
|
|
84
|
+
top: (sceneHeight - height) / 2,
|
|
85
|
+
width,
|
|
86
|
+
height,
|
|
86
87
|
zIndex: 10
|
|
87
88
|
});
|
|
88
|
-
return
|
|
89
|
+
return slideComponent.enableSelectedClipElement(), mainScene.addObject(slideComponent), slideComponent;
|
|
89
90
|
}
|
|
90
|
-
_addBackgroundRect(
|
|
91
|
-
const
|
|
91
|
+
_addBackgroundRect(scene, fill) {
|
|
92
|
+
const pageSize = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SLIDE).getPageSize(), { width: pageWidth = 0, height: pageHeight = 0 } = pageSize, page = new Rect("canvas", {
|
|
92
93
|
left: 0,
|
|
93
94
|
top: 0,
|
|
94
|
-
width:
|
|
95
|
-
height:
|
|
95
|
+
width: pageWidth,
|
|
96
|
+
height: pageHeight,
|
|
96
97
|
strokeWidth: 1,
|
|
97
98
|
stroke: "rgba(198,198,198,1)",
|
|
98
|
-
fill:
|
|
99
|
+
fill: getColorStyle(fill) || "rgba(255,255,255,1)",
|
|
99
100
|
zIndex: 0,
|
|
100
101
|
evented: !1
|
|
101
102
|
});
|
|
102
|
-
|
|
103
|
+
scene.addObject(page, 0);
|
|
103
104
|
}
|
|
104
|
-
_getCenterPositionViewPort(
|
|
105
|
-
if (!
|
|
106
|
-
const { width
|
|
105
|
+
_getCenterPositionViewPort(mainScene) {
|
|
106
|
+
if (!mainScene) return { left: 0, top: 0 };
|
|
107
|
+
const { width, height } = mainScene, engine = mainScene.getEngine(), canvasWidth = (engine == null ? void 0 : engine.width) || 0, canvasHeight = (engine == null ? void 0 : engine.height) || 0;
|
|
107
108
|
return {
|
|
108
|
-
left: (
|
|
109
|
-
top: (
|
|
109
|
+
left: (width - canvasWidth) / 2,
|
|
110
|
+
top: (height - canvasHeight) / 2
|
|
110
111
|
};
|
|
111
112
|
}
|
|
112
|
-
_thumbSceneRender(
|
|
113
|
-
const
|
|
114
|
-
if (
|
|
113
|
+
_thumbSceneRender(pageId, slide) {
|
|
114
|
+
const render2 = this._renderManagerService.getRenderById(pageId);
|
|
115
|
+
if (render2 == null)
|
|
115
116
|
return;
|
|
116
|
-
const { engine:
|
|
117
|
-
if (
|
|
117
|
+
const { engine: thumbEngine } = render2;
|
|
118
|
+
if (thumbEngine == null)
|
|
118
119
|
return;
|
|
119
|
-
const { width
|
|
120
|
-
|
|
120
|
+
const { width, height } = slide, { width: pageWidth = width, height: pageHeight = height } = thumbEngine, thumbContext = thumbEngine.getCanvas().getContext();
|
|
121
|
+
slide.renderToThumb(thumbContext, pageId, pageWidth / width, pageHeight / height);
|
|
121
122
|
}
|
|
122
123
|
/**
|
|
123
124
|
* CreateScene by pages, and activate first one.
|
|
124
125
|
* @param slideDataModel
|
|
125
126
|
* @param slide
|
|
126
127
|
*/
|
|
127
|
-
_createSlidePages(
|
|
128
|
-
const
|
|
129
|
-
if (!(!
|
|
130
|
-
for (let
|
|
131
|
-
const
|
|
132
|
-
this.createPageScene(
|
|
128
|
+
_createSlidePages(slideDataModel, slide) {
|
|
129
|
+
const pages = slideDataModel.getPages(), pageOrder = slideDataModel.getPageOrder();
|
|
130
|
+
if (!(!pages || !pageOrder) && pageOrder.length !== 0) {
|
|
131
|
+
for (let i = 0, len = pageOrder.length; i < len; i++) {
|
|
132
|
+
const pageId = pageOrder[i];
|
|
133
|
+
this.createPageScene(pageId, pages[pageId]), this._createThumb(pageId);
|
|
133
134
|
}
|
|
134
|
-
|
|
135
|
+
slide.activeFirstPage();
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
|
-
_createThumb(
|
|
138
|
-
this._renderManagerService.createRender(
|
|
138
|
+
_createThumb(pageId) {
|
|
139
|
+
this._renderManagerService.createRender(pageId);
|
|
139
140
|
}
|
|
140
141
|
/**
|
|
141
142
|
* SlideDataModel is UnitModel
|
|
@@ -143,34 +144,34 @@ let pe = class extends fe {
|
|
|
143
144
|
_getCurrUnitModel() {
|
|
144
145
|
return this._renderContext.unit;
|
|
145
146
|
}
|
|
146
|
-
activePage(
|
|
147
|
-
let
|
|
148
|
-
const
|
|
149
|
-
let
|
|
150
|
-
if (
|
|
151
|
-
|
|
147
|
+
activePage(_pageId) {
|
|
148
|
+
let pageId = _pageId;
|
|
149
|
+
const model = this._getCurrUnitModel();
|
|
150
|
+
let page;
|
|
151
|
+
if (pageId)
|
|
152
|
+
page = model.getPage(pageId);
|
|
152
153
|
else {
|
|
153
|
-
const
|
|
154
|
-
if (
|
|
154
|
+
const pageElements = model.getPages(), pageOrder = model.getPageOrder();
|
|
155
|
+
if (pageOrder == null || pageElements == null)
|
|
155
156
|
return;
|
|
156
|
-
|
|
157
|
+
page = pageElements[pageOrder[0]], pageId = page.id;
|
|
157
158
|
}
|
|
158
|
-
const
|
|
159
|
-
if (
|
|
159
|
+
const render2 = this._currentRender();
|
|
160
|
+
if (page == null || render2 == null || render2.mainComponent == null)
|
|
160
161
|
return;
|
|
161
|
-
const { id
|
|
162
|
-
if (
|
|
163
|
-
|
|
162
|
+
const { id } = page, slide = render2.mainComponent;
|
|
163
|
+
if (model.setActivePage(page), slide != null && slide.hasPage(id)) {
|
|
164
|
+
slide.changePage(id);
|
|
164
165
|
return;
|
|
165
166
|
}
|
|
166
|
-
this.createPageScene(
|
|
167
|
+
this.createPageScene(id, page);
|
|
167
168
|
}
|
|
168
169
|
createThumbs() {
|
|
169
|
-
const
|
|
170
|
-
if (!(!
|
|
171
|
-
for (let
|
|
172
|
-
const
|
|
173
|
-
this._thumbSceneRender(
|
|
170
|
+
const pageOrder = this._getCurrUnitModel().getPageOrder(), render2 = this._currentRender();
|
|
171
|
+
if (!(!pageOrder || !render2) && pageOrder.length !== 0)
|
|
172
|
+
for (let i = 0, len = pageOrder.length; i < len; i++) {
|
|
173
|
+
const pageId = pageOrder[i];
|
|
174
|
+
this._thumbSceneRender(pageId, render2.mainComponent);
|
|
174
175
|
}
|
|
175
176
|
}
|
|
176
177
|
/**
|
|
@@ -178,15 +179,15 @@ let pe = class extends fe {
|
|
|
178
179
|
* @param pageId
|
|
179
180
|
* @param page
|
|
180
181
|
*/
|
|
181
|
-
createPageScene(
|
|
182
|
-
const
|
|
183
|
-
if (!
|
|
182
|
+
createPageScene(pageId, page) {
|
|
183
|
+
const render2 = this._renderContext;
|
|
184
|
+
if (!render2 || !this._objectProvider)
|
|
184
185
|
return;
|
|
185
|
-
const { scene:
|
|
186
|
-
width
|
|
187
|
-
height
|
|
186
|
+
const { scene: mainScene, mainComponent } = render2, slide = mainComponent, { width, height } = slide, pageScene = new Scene(pageId, slide, {
|
|
187
|
+
width,
|
|
188
|
+
height
|
|
188
189
|
});
|
|
189
|
-
new
|
|
190
|
+
new Viewport(`PageViewer_${pageId}`, pageScene, {
|
|
190
191
|
left: 0,
|
|
191
192
|
top: 0,
|
|
192
193
|
bottom: 0,
|
|
@@ -194,117 +195,117 @@ let pe = class extends fe {
|
|
|
194
195
|
explicitViewportWidthSet: !1,
|
|
195
196
|
explicitViewportHeightSet: !1
|
|
196
197
|
}).closeClip();
|
|
197
|
-
const { pageElements
|
|
198
|
-
if (!
|
|
199
|
-
this._addBackgroundRect(
|
|
200
|
-
|
|
198
|
+
const { pageElements, pageBackgroundFill } = page, objects = this._objectProvider.convertToRenderObjects(pageElements, mainScene);
|
|
199
|
+
if (!objects || !slide) return;
|
|
200
|
+
this._addBackgroundRect(pageScene, pageBackgroundFill), pageScene.addObjects(objects), pageScene.initTransformer(), objects.forEach((object) => {
|
|
201
|
+
pageScene.attachTransformerTo(object);
|
|
201
202
|
});
|
|
202
|
-
const
|
|
203
|
-
return
|
|
204
|
-
this._thumbSceneRender(
|
|
205
|
-
}),
|
|
206
|
-
this._thumbSceneRender(
|
|
207
|
-
}),
|
|
203
|
+
const transformer = pageScene.getTransformer();
|
|
204
|
+
return transformer == null || transformer.changeEnd$.subscribe(() => {
|
|
205
|
+
this._thumbSceneRender(pageId, slide);
|
|
206
|
+
}), transformer == null || transformer.clearControl$.subscribe(() => {
|
|
207
|
+
this._thumbSceneRender(pageId, slide);
|
|
208
|
+
}), slide.addPageScene(pageScene), pageScene;
|
|
208
209
|
}
|
|
209
210
|
/**
|
|
210
211
|
* Get pageScene from Slide.
|
|
211
212
|
* @param pageId
|
|
212
213
|
* @returns {Scene, Engine, UnitModel} scene & engine & unit from renderContext
|
|
213
214
|
*/
|
|
214
|
-
getPageRenderUnit(
|
|
215
|
-
const
|
|
215
|
+
getPageRenderUnit(pageId) {
|
|
216
|
+
const pageScene = this._renderContext.mainComponent.getSubScenes().get(pageId), { engine, unit } = this._renderContext;
|
|
216
217
|
return {
|
|
217
|
-
scene:
|
|
218
|
-
engine
|
|
219
|
-
unit
|
|
218
|
+
scene: pageScene,
|
|
219
|
+
engine,
|
|
220
|
+
unit
|
|
220
221
|
};
|
|
221
222
|
}
|
|
222
|
-
createObjectToPage(
|
|
223
|
-
const { scene
|
|
224
|
-
if (!
|
|
223
|
+
createObjectToPage(element2, pageID) {
|
|
224
|
+
const { scene } = this.getPageRenderUnit(pageID);
|
|
225
|
+
if (!scene || !this._objectProvider)
|
|
225
226
|
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
|
-
|
|
227
|
+
const object = this._objectProvider.convertToRenderObject(element2, scene);
|
|
228
|
+
if (object)
|
|
229
|
+
return scene.addObject(object), scene.attachTransformerTo(object), scene.getLayer().makeDirty(), object;
|
|
230
|
+
}
|
|
231
|
+
setObjectActiveByPage(obj, pageID) {
|
|
232
|
+
const { scene } = this.getPageRenderUnit(pageID);
|
|
233
|
+
if (!scene) return;
|
|
234
|
+
const transformer = scene.getTransformer();
|
|
235
|
+
transformer == null || transformer.activeAnObject(obj);
|
|
236
|
+
}
|
|
237
|
+
removeObjectById(id, pageID) {
|
|
238
|
+
const { scene } = this.getPageRenderUnit(pageID);
|
|
239
|
+
if (!scene) return;
|
|
240
|
+
scene.removeObject(id);
|
|
241
|
+
const transformer = scene.getTransformer();
|
|
242
|
+
transformer == null || transformer.clearControls();
|
|
242
243
|
}
|
|
243
244
|
appendPage() {
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
245
|
+
const model = this._getCurrUnitModel(), page = model.getBlankPage(), render2 = this._currentRender();
|
|
246
|
+
if (page == null || render2 == null || render2.mainComponent == null)
|
|
246
247
|
return;
|
|
247
|
-
const { id:
|
|
248
|
-
|
|
248
|
+
const { id: pageId } = page, slide = render2.mainComponent, scene = this.createPageScene(pageId, page);
|
|
249
|
+
slide && scene && slide.addPageScene(scene), model.appendPage(page), model.setActivePage(page);
|
|
249
250
|
}
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
],
|
|
256
|
-
var
|
|
257
|
-
for (var
|
|
258
|
-
(
|
|
259
|
-
return
|
|
260
|
-
},
|
|
261
|
-
let
|
|
262
|
-
constructor(
|
|
263
|
-
super(), this._renderManagerService =
|
|
251
|
+
}, __name(_a, "SlideRenderController"), _a);
|
|
252
|
+
SlideRenderController = __decorateClass$9([
|
|
253
|
+
__decorateParam$9(1, Inject(Injector)),
|
|
254
|
+
__decorateParam$9(2, IUniverInstanceService),
|
|
255
|
+
__decorateParam$9(3, IRenderManagerService)
|
|
256
|
+
], SlideRenderController);
|
|
257
|
+
var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor, __decorateClass$8 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
258
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
259
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
260
|
+
return kind && result && __defProp$8(target, key, result), result;
|
|
261
|
+
}, "__decorateClass$8"), __decorateParam$8 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$8"), _a2;
|
|
262
|
+
let CanvasView = (_a2 = class extends RxDisposable {
|
|
263
|
+
constructor(_renderManagerService) {
|
|
264
|
+
super(), this._renderManagerService = _renderManagerService;
|
|
264
265
|
}
|
|
265
|
-
_getSlideRenderControllerFromRenderUnit(
|
|
266
|
-
return this._renderManagerService.getRenderById(
|
|
266
|
+
_getSlideRenderControllerFromRenderUnit(unitId) {
|
|
267
|
+
return this._renderManagerService.getRenderById(unitId).with(SlideRenderController);
|
|
267
268
|
}
|
|
268
|
-
createThumbs(
|
|
269
|
-
this._getSlideRenderControllerFromRenderUnit(
|
|
269
|
+
createThumbs(unitId) {
|
|
270
|
+
this._getSlideRenderControllerFromRenderUnit(unitId).createThumbs();
|
|
270
271
|
}
|
|
271
|
-
activePage(
|
|
272
|
-
this._getSlideRenderControllerFromRenderUnit(
|
|
272
|
+
activePage(pageId, unitId) {
|
|
273
|
+
this._getSlideRenderControllerFromRenderUnit(unitId).activePage(pageId);
|
|
273
274
|
}
|
|
274
|
-
getRenderUnitByPageId(
|
|
275
|
-
return this._getSlideRenderControllerFromRenderUnit(
|
|
275
|
+
getRenderUnitByPageId(pageId, unitId) {
|
|
276
|
+
return this._getSlideRenderControllerFromRenderUnit(unitId).getPageRenderUnit(pageId);
|
|
276
277
|
}
|
|
277
|
-
createObjectToPage(
|
|
278
|
-
return this._getSlideRenderControllerFromRenderUnit(
|
|
278
|
+
createObjectToPage(element2, pageID, unitId) {
|
|
279
|
+
return this._getSlideRenderControllerFromRenderUnit(unitId).createObjectToPage(element2, pageID);
|
|
279
280
|
}
|
|
280
|
-
setObjectActiveByPage(
|
|
281
|
-
return this._getSlideRenderControllerFromRenderUnit(
|
|
281
|
+
setObjectActiveByPage(obj, pageID, unitId) {
|
|
282
|
+
return this._getSlideRenderControllerFromRenderUnit(unitId).setObjectActiveByPage(obj, pageID);
|
|
282
283
|
}
|
|
283
|
-
removeObjectById(
|
|
284
|
-
this._getSlideRenderControllerFromRenderUnit(
|
|
284
|
+
removeObjectById(id, pageID, unitId) {
|
|
285
|
+
this._getSlideRenderControllerFromRenderUnit(unitId).removeObjectById(id, pageID);
|
|
285
286
|
}
|
|
286
287
|
/**
|
|
287
288
|
* append blank page
|
|
288
289
|
*/
|
|
289
|
-
appendPage(
|
|
290
|
-
this._getSlideRenderControllerFromRenderUnit(
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
],
|
|
296
|
-
const
|
|
290
|
+
appendPage(unitId) {
|
|
291
|
+
this._getSlideRenderControllerFromRenderUnit(unitId).appendPage();
|
|
292
|
+
}
|
|
293
|
+
}, __name(_a2, "CanvasView"), _a2);
|
|
294
|
+
CanvasView = __decorateClass$8([
|
|
295
|
+
__decorateParam$8(0, IRenderManagerService)
|
|
296
|
+
], CanvasView);
|
|
297
|
+
const SLIDES_UI_PLUGIN_CONFIG_KEY = "slides-ui.config", defaultPluginConfig = {}, DeleteSlideElementOperation = {
|
|
297
298
|
id: "slide.operation.delete-element",
|
|
298
|
-
type:
|
|
299
|
-
handler: (
|
|
300
|
-
if (!(
|
|
301
|
-
const
|
|
302
|
-
if (!
|
|
303
|
-
const
|
|
304
|
-
return delete
|
|
305
|
-
}
|
|
299
|
+
type: CommandType.OPERATION,
|
|
300
|
+
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
301
|
+
if (!(params != null && params.id)) return !1;
|
|
302
|
+
const unitId = params.unitId, slideData = accessor.get(IUniverInstanceService).getUnit(unitId);
|
|
303
|
+
if (!slideData) return !1;
|
|
304
|
+
const activePage = slideData.getActivePage();
|
|
305
|
+
return delete activePage.pageElements[params.id], slideData.updatePage(activePage.id, activePage), accessor.get(CanvasView).removeObjectById(params.id, activePage.id, unitId), !0;
|
|
306
|
+
}, "handler")
|
|
306
307
|
};
|
|
307
|
-
var
|
|
308
|
+
var jsxRuntime = { exports: {} }, reactJsxRuntime_production_min = {};
|
|
308
309
|
/**
|
|
309
310
|
* @license React
|
|
310
311
|
* react-jsx-runtime.production.min.js
|
|
@@ -314,409 +315,422 @@ var Be = { exports: {} }, me = {};
|
|
|
314
315
|
* This source code is licensed under the MIT license found in the
|
|
315
316
|
* LICENSE file in the root directory of this source tree.
|
|
316
317
|
*/
|
|
317
|
-
var
|
|
318
|
-
function
|
|
319
|
-
if (
|
|
320
|
-
|
|
321
|
-
var
|
|
322
|
-
function
|
|
323
|
-
var
|
|
324
|
-
g !== void 0 && (
|
|
325
|
-
for (
|
|
326
|
-
if (
|
|
327
|
-
return { $$typeof:
|
|
328
|
-
}
|
|
329
|
-
return
|
|
318
|
+
var hasRequiredReactJsxRuntime_production_min;
|
|
319
|
+
function requireReactJsxRuntime_production_min() {
|
|
320
|
+
if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
|
|
321
|
+
hasRequiredReactJsxRuntime_production_min = 1;
|
|
322
|
+
var f = React, k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
323
|
+
function q(c, a, g) {
|
|
324
|
+
var b, d = {}, e = null, h = null;
|
|
325
|
+
g !== void 0 && (e = "" + g), a.key !== void 0 && (e = "" + a.key), a.ref !== void 0 && (h = a.ref);
|
|
326
|
+
for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
|
|
327
|
+
if (c && c.defaultProps) for (b in a = c.defaultProps, a) d[b] === void 0 && (d[b] = a[b]);
|
|
328
|
+
return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
|
|
329
|
+
}
|
|
330
|
+
return __name(q, "q"), reactJsxRuntime_production_min.Fragment = l, reactJsxRuntime_production_min.jsx = q, reactJsxRuntime_production_min.jsxs = q, reactJsxRuntime_production_min;
|
|
330
331
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
332
|
+
__name(requireReactJsxRuntime_production_min, "requireReactJsxRuntime_production_min");
|
|
333
|
+
var hasRequiredJsxRuntime;
|
|
334
|
+
function requireJsxRuntime() {
|
|
335
|
+
return hasRequiredJsxRuntime || (hasRequiredJsxRuntime = 1, jsxRuntime.exports = requireReactJsxRuntime_production_min()), jsxRuntime.exports;
|
|
334
336
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
337
|
+
__name(requireJsxRuntime, "requireJsxRuntime");
|
|
338
|
+
var jsxRuntimeExports = requireJsxRuntime();
|
|
339
|
+
function r(e) {
|
|
340
|
+
var t, f, n = "";
|
|
341
|
+
if (typeof e == "string" || typeof e == "number") n += e;
|
|
342
|
+
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
343
|
+
var o = e.length;
|
|
344
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
345
|
+
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
343
346
|
return n;
|
|
344
347
|
}
|
|
345
|
-
|
|
346
|
-
|
|
348
|
+
__name(r, "r");
|
|
349
|
+
function clsx() {
|
|
350
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
347
351
|
return n;
|
|
348
352
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
353
|
+
__name(clsx, "clsx");
|
|
354
|
+
var __assign = function() {
|
|
355
|
+
return __assign = Object.assign || function(t) {
|
|
356
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
357
|
+
s = arguments[i];
|
|
358
|
+
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && (t[p] = s[p]);
|
|
354
359
|
}
|
|
355
|
-
return
|
|
356
|
-
},
|
|
357
|
-
},
|
|
360
|
+
return t;
|
|
361
|
+
}, __assign.apply(this, arguments);
|
|
362
|
+
}, __rest = function(s, e) {
|
|
358
363
|
var t = {};
|
|
359
|
-
for (var
|
|
360
|
-
if (
|
|
361
|
-
for (var
|
|
362
|
-
e.indexOf(
|
|
364
|
+
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
|
|
365
|
+
if (s != null && typeof Object.getOwnPropertySymbols == "function")
|
|
366
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
|
|
367
|
+
e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
|
|
363
368
|
return t;
|
|
364
|
-
},
|
|
365
|
-
var
|
|
366
|
-
return
|
|
369
|
+
}, IconBase = forwardRef(function(props, ref) {
|
|
370
|
+
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()));
|
|
371
|
+
return render(icon, "".concat(id), { defIds: icon.defIds, idSuffix: idSuffix.current }, __assign({ ref, className: cls }, restProps), extend);
|
|
367
372
|
});
|
|
368
|
-
function
|
|
369
|
-
return
|
|
370
|
-
return
|
|
373
|
+
function render(node, id, runtimeProps, rootProps, extend) {
|
|
374
|
+
return createElement(node.tag, __assign(__assign({ key: id }, replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend)), rootProps), (replaceRuntimeIdsInDefs(node, runtimeProps).children || []).map(function(child, index) {
|
|
375
|
+
return render(child, "".concat(id, "-").concat(node.tag, "-").concat(index), runtimeProps, void 0, extend);
|
|
371
376
|
}));
|
|
372
377
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
378
|
+
__name(render, "render");
|
|
379
|
+
function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
|
|
380
|
+
var attrs = __assign({}, node.attrs);
|
|
381
|
+
extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
|
|
382
|
+
var defIds = runtimeProps.defIds;
|
|
383
|
+
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) {
|
|
384
|
+
var key = _a11[0], value = _a11[1];
|
|
385
|
+
typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
|
|
386
|
+
})), attrs;
|
|
381
387
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
388
|
+
__name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
|
|
389
|
+
function replaceRuntimeIdsInDefs(node, runtimeProps) {
|
|
390
|
+
var _a11, defIds = runtimeProps.defIds;
|
|
391
|
+
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) {
|
|
392
|
+
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;
|
|
393
|
+
}) }) : node;
|
|
387
394
|
}
|
|
388
|
-
|
|
395
|
+
__name(replaceRuntimeIdsInDefs, "replaceRuntimeIdsInDefs");
|
|
396
|
+
function generateShortUuid() {
|
|
389
397
|
return Math.random().toString(36).substring(2, 8);
|
|
390
398
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
399
|
+
__name(generateShortUuid, "generateShortUuid");
|
|
400
|
+
IconBase.displayName = "UniverIcon";
|
|
401
|
+
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) {
|
|
402
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
394
403
|
id: "add-image-single",
|
|
395
|
-
ref
|
|
396
|
-
icon:
|
|
404
|
+
ref,
|
|
405
|
+
icon: element$9
|
|
397
406
|
}));
|
|
398
407
|
});
|
|
399
|
-
|
|
400
|
-
var
|
|
401
|
-
return
|
|
408
|
+
AddImageSingle.displayName = "AddImageSingle";
|
|
409
|
+
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) {
|
|
410
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
402
411
|
id: "autofill",
|
|
403
|
-
ref
|
|
404
|
-
icon:
|
|
412
|
+
ref,
|
|
413
|
+
icon: element$8
|
|
405
414
|
}));
|
|
406
415
|
});
|
|
407
|
-
|
|
408
|
-
var
|
|
409
|
-
return
|
|
416
|
+
Autofill.displayName = "Autofill";
|
|
417
|
+
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) {
|
|
418
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
410
419
|
id: "bottom-single",
|
|
411
|
-
ref
|
|
412
|
-
icon:
|
|
420
|
+
ref,
|
|
421
|
+
icon: element$7
|
|
413
422
|
}));
|
|
414
423
|
});
|
|
415
|
-
|
|
416
|
-
var
|
|
417
|
-
return
|
|
424
|
+
BottomSingle.displayName = "BottomSingle";
|
|
425
|
+
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) {
|
|
426
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
418
427
|
id: "graph-single",
|
|
419
|
-
ref
|
|
420
|
-
icon:
|
|
428
|
+
ref,
|
|
429
|
+
icon: element$6
|
|
421
430
|
}));
|
|
422
431
|
});
|
|
423
|
-
|
|
424
|
-
var
|
|
425
|
-
return
|
|
432
|
+
GraphSingle.displayName = "GraphSingle";
|
|
433
|
+
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) {
|
|
434
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
426
435
|
id: "more-down-single",
|
|
427
|
-
ref
|
|
428
|
-
icon:
|
|
436
|
+
ref,
|
|
437
|
+
icon: element$5
|
|
429
438
|
}));
|
|
430
439
|
});
|
|
431
|
-
|
|
432
|
-
var
|
|
433
|
-
return
|
|
440
|
+
MoreDownSingle.displayName = "MoreDownSingle";
|
|
441
|
+
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) {
|
|
442
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
434
443
|
id: "move-down-single",
|
|
435
|
-
ref
|
|
436
|
-
icon:
|
|
444
|
+
ref,
|
|
445
|
+
icon: element$4
|
|
437
446
|
}));
|
|
438
447
|
});
|
|
439
|
-
|
|
440
|
-
var
|
|
441
|
-
return
|
|
448
|
+
MoveDownSingle.displayName = "MoveDownSingle";
|
|
449
|
+
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) {
|
|
450
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
442
451
|
id: "move-up-single",
|
|
443
|
-
ref
|
|
444
|
-
icon:
|
|
452
|
+
ref,
|
|
453
|
+
icon: element$3
|
|
445
454
|
}));
|
|
446
455
|
});
|
|
447
|
-
|
|
448
|
-
var
|
|
449
|
-
return
|
|
456
|
+
MoveUpSingle.displayName = "MoveUpSingle";
|
|
457
|
+
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) {
|
|
458
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
450
459
|
id: "paint-bucket",
|
|
451
|
-
ref
|
|
452
|
-
icon:
|
|
460
|
+
ref,
|
|
461
|
+
icon: element$2
|
|
453
462
|
}));
|
|
454
463
|
});
|
|
455
|
-
|
|
456
|
-
var
|
|
457
|
-
return
|
|
464
|
+
PaintBucket.displayName = "PaintBucket";
|
|
465
|
+
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) {
|
|
466
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
458
467
|
id: "text-single",
|
|
459
|
-
ref
|
|
460
|
-
icon:
|
|
468
|
+
ref,
|
|
469
|
+
icon: element$1
|
|
461
470
|
}));
|
|
462
471
|
});
|
|
463
|
-
|
|
464
|
-
var
|
|
465
|
-
return
|
|
472
|
+
TextSingle.displayName = "TextSingle";
|
|
473
|
+
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) {
|
|
474
|
+
return createElement(IconBase, Object.assign({}, props, {
|
|
466
475
|
id: "topmost-single",
|
|
467
|
-
ref
|
|
468
|
-
icon:
|
|
476
|
+
ref,
|
|
477
|
+
icon: element
|
|
469
478
|
}));
|
|
470
479
|
});
|
|
471
|
-
|
|
472
|
-
const
|
|
480
|
+
TopmostSingle.displayName = "TopmostSingle";
|
|
481
|
+
const UpdateSlideElementOperation = {
|
|
473
482
|
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
|
|
483
|
+
type: CommandType.OPERATION,
|
|
484
|
+
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
485
|
+
const { oKey, props } = params, univerInstanceService = accessor.get(IUniverInstanceService), unitId = params == null ? void 0 : params.unitId, slideData = univerInstanceService.getUnit(unitId);
|
|
486
|
+
if (!slideData) return !1;
|
|
487
|
+
const activePage = slideData.getActivePage();
|
|
488
|
+
return activePage.pageElements[oKey] = Tools.deepMerge(activePage.pageElements[oKey], props), slideData.updatePage(activePage.id, activePage), !0;
|
|
489
|
+
}, "handler")
|
|
490
|
+
}, 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 = {
|
|
491
|
+
imageCommonPanel: imageCommonPanel$1,
|
|
492
|
+
imageCommonPanelGrid: imageCommonPanelGrid$1,
|
|
493
|
+
imageCommonPanelBorder: imageCommonPanelBorder$1,
|
|
494
|
+
imageCommonPanelTitle: imageCommonPanelTitle$1,
|
|
495
|
+
imageCommonPanelSubtitle: imageCommonPanelSubtitle$1,
|
|
496
|
+
imageCommonPanelRow: imageCommonPanelRow$1,
|
|
497
|
+
imageCommonPanelRowVertical: imageCommonPanelRowVertical$1,
|
|
498
|
+
imageCommonPanelColumn: imageCommonPanelColumn$1,
|
|
499
|
+
imageCommonPanelColumnCenter: imageCommonPanelColumnCenter$1,
|
|
500
|
+
imageCommonPanelInline: imageCommonPanelInline$1,
|
|
501
|
+
imageCommonPanelSpan2: imageCommonPanelSpan2$1,
|
|
502
|
+
imageCommonPanelSpan3: imageCommonPanelSpan3$1,
|
|
503
|
+
imageCommonPanelInput: imageCommonPanelInput$1,
|
|
504
|
+
slidePanelColorPicker
|
|
496
505
|
};
|
|
497
|
-
function
|
|
498
|
-
const { pageId
|
|
499
|
-
if (!
|
|
500
|
-
const
|
|
501
|
-
if (!
|
|
502
|
-
const
|
|
503
|
-
if (!
|
|
504
|
-
const
|
|
505
|
-
const
|
|
506
|
-
const
|
|
507
|
-
return [
|
|
506
|
+
function ArrangePanel$1(props) {
|
|
507
|
+
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;
|
|
508
|
+
if (!scene) return null;
|
|
509
|
+
const transformer = scene.getTransformer();
|
|
510
|
+
if (!transformer) return null;
|
|
511
|
+
const object = transformer.getSelectedObjectMap().values().next().value;
|
|
512
|
+
if (!object) return null;
|
|
513
|
+
const onArrangeBtnClick = /* @__PURE__ */ __name((arrangeType) => {
|
|
514
|
+
const allObjects = scene.getAllObjects(), [minZIndex, maxZIndex] = allObjects.reduce(([min, max], obj) => {
|
|
515
|
+
const zIndex2 = obj.zIndex, minZIndex2 = zIndex2 < min ? zIndex2 : min, maxZIndex2 = zIndex2 > max ? zIndex2 : max;
|
|
516
|
+
return [minZIndex2, maxZIndex2];
|
|
508
517
|
}, [0, 0]);
|
|
509
|
-
let
|
|
510
|
-
|
|
511
|
-
zIndex
|
|
512
|
-
}),
|
|
513
|
-
unitId
|
|
514
|
-
oKey:
|
|
518
|
+
let zIndex = object.zIndex;
|
|
519
|
+
arrangeType === 3 ? zIndex = minZIndex - 1 : arrangeType === 2 ? zIndex = maxZIndex + 1 : arrangeType === 0 ? zIndex = object.zIndex + 1 : arrangeType === 1 && (zIndex = object.zIndex - 1), object.setProps({
|
|
520
|
+
zIndex
|
|
521
|
+
}), commandService.executeCommand(UpdateSlideElementOperation.id, {
|
|
522
|
+
unitId,
|
|
523
|
+
oKey: object == null ? void 0 : object.oKey,
|
|
515
524
|
props: {
|
|
516
|
-
zIndex
|
|
525
|
+
zIndex
|
|
517
526
|
}
|
|
518
527
|
});
|
|
519
|
-
};
|
|
520
|
-
return /* @__PURE__ */
|
|
521
|
-
/* @__PURE__ */
|
|
522
|
-
/* @__PURE__ */
|
|
523
|
-
/* @__PURE__ */
|
|
524
|
-
|
|
528
|
+
}, "onArrangeBtnClick");
|
|
529
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$4.imageCommonPanelGrid, children: [
|
|
530
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelTitle), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("image-panel.arrange.title") }) }) }),
|
|
531
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$4.imageCommonPanelRow, children: [
|
|
532
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelSpan2), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "small", onClick: /* @__PURE__ */ __name(() => {
|
|
533
|
+
onArrangeBtnClick(
|
|
525
534
|
0
|
|
526
535
|
/* forward */
|
|
527
536
|
);
|
|
528
|
-
}, children: /* @__PURE__ */
|
|
529
|
-
/* @__PURE__ */
|
|
530
|
-
|
|
537
|
+
}, "onClick"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: styles$4.imageCommonPanelInline, children: [
|
|
538
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(MoveUpSingle, {}),
|
|
539
|
+
localeService.t("image-panel.arrange.forward")
|
|
531
540
|
] }) }) }),
|
|
532
|
-
/* @__PURE__ */
|
|
533
|
-
|
|
541
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelSpan2), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "small", onClick: /* @__PURE__ */ __name(() => {
|
|
542
|
+
onArrangeBtnClick(
|
|
534
543
|
1
|
|
535
544
|
/* backward */
|
|
536
545
|
);
|
|
537
|
-
}, children: /* @__PURE__ */
|
|
538
|
-
/* @__PURE__ */
|
|
539
|
-
|
|
546
|
+
}, "onClick"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: styles$4.imageCommonPanelInline, children: [
|
|
547
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(MoveDownSingle, {}),
|
|
548
|
+
localeService.t("image-panel.arrange.backward")
|
|
540
549
|
] }) }) })
|
|
541
550
|
] }),
|
|
542
|
-
/* @__PURE__ */
|
|
543
|
-
/* @__PURE__ */
|
|
544
|
-
|
|
551
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$4.imageCommonPanelRow, children: [
|
|
552
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelSpan2), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "small", onClick: /* @__PURE__ */ __name(() => {
|
|
553
|
+
onArrangeBtnClick(
|
|
545
554
|
2
|
|
546
555
|
/* front */
|
|
547
556
|
);
|
|
548
|
-
}, children: /* @__PURE__ */
|
|
549
|
-
/* @__PURE__ */
|
|
550
|
-
|
|
557
|
+
}, "onClick"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: styles$4.imageCommonPanelInline, children: [
|
|
558
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TopmostSingle, {}),
|
|
559
|
+
localeService.t("image-panel.arrange.front")
|
|
551
560
|
] }) }) }),
|
|
552
|
-
/* @__PURE__ */
|
|
553
|
-
|
|
561
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelSpan2), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "small", onClick: /* @__PURE__ */ __name(() => {
|
|
562
|
+
onArrangeBtnClick(
|
|
554
563
|
3
|
|
555
564
|
/* back */
|
|
556
565
|
);
|
|
557
|
-
}, children: /* @__PURE__ */
|
|
558
|
-
/* @__PURE__ */
|
|
559
|
-
|
|
566
|
+
}, "onClick"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: styles$4.imageCommonPanelInline, children: [
|
|
567
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BottomSingle, {}),
|
|
568
|
+
localeService.t("image-panel.arrange.back")
|
|
560
569
|
] }) }) })
|
|
561
570
|
] })
|
|
562
571
|
] });
|
|
563
572
|
}
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
573
|
+
__name(ArrangePanel$1, "ArrangePanel$1");
|
|
574
|
+
function TransformPanel(props) {
|
|
575
|
+
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;
|
|
576
|
+
if (!scene) return null;
|
|
577
|
+
const transformer = scene.getTransformer();
|
|
578
|
+
if (!transformer) return null;
|
|
579
|
+
const object = transformer.getSelectedObjectMap().values().next().value;
|
|
580
|
+
if (!object) return null;
|
|
571
581
|
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
|
-
|
|
582
|
+
width: originWidth = 0,
|
|
583
|
+
height: originHeight = 0,
|
|
584
|
+
left: originX = 0,
|
|
585
|
+
top: originY = 0,
|
|
586
|
+
angle: originRotation = 0
|
|
587
|
+
} = 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) => {
|
|
588
|
+
const { objects } = state, object2 = objects.values().next().value, {
|
|
589
|
+
width: originWidth2 = 0,
|
|
590
|
+
height: originHeight2 = 0,
|
|
591
|
+
left: originX2 = 0,
|
|
592
|
+
top: originY2 = 0,
|
|
593
|
+
angle: originRotation2 = 0
|
|
594
|
+
} = object2;
|
|
595
|
+
setWidth(originWidth2), setHeight(originHeight2), setXPosition(originX2), setYPosition(originY2), setRotation(originRotation2);
|
|
596
|
+
}, "changeObs");
|
|
597
|
+
useEffect(() => {
|
|
598
|
+
const changeStartSub = transformer.changeStart$.subscribe((state) => {
|
|
599
|
+
changeObs(state);
|
|
600
|
+
}), changingSub = transformer.changing$.subscribe((state) => {
|
|
601
|
+
changeObs(state);
|
|
592
602
|
});
|
|
593
603
|
return () => {
|
|
594
|
-
|
|
604
|
+
changingSub.unsubscribe(), changeStartSub.unsubscribe();
|
|
595
605
|
};
|
|
596
606
|
}, []);
|
|
597
|
-
function
|
|
598
|
-
!
|
|
599
|
-
pageId
|
|
600
|
-
oKey:
|
|
607
|
+
function handleWidthChange(val) {
|
|
608
|
+
!val || !object || (commandService.executeCommand(UpdateSlideElementOperation.id, {
|
|
609
|
+
pageId,
|
|
610
|
+
oKey: object.oKey,
|
|
601
611
|
props: {
|
|
602
|
-
width:
|
|
612
|
+
width: val
|
|
603
613
|
}
|
|
604
|
-
}),
|
|
614
|
+
}), object == null || object.resize(val, object.height), setWidth(val), transformer == null || transformer.refreshControls());
|
|
605
615
|
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
616
|
+
__name(handleWidthChange, "handleWidthChange");
|
|
617
|
+
function handleHeightChange(val) {
|
|
618
|
+
!val || !object || (commandService.executeCommand(UpdateSlideElementOperation.id, {
|
|
619
|
+
pageId,
|
|
620
|
+
oKey: object.oKey,
|
|
610
621
|
props: {
|
|
611
|
-
height:
|
|
622
|
+
height: val
|
|
612
623
|
}
|
|
613
|
-
}),
|
|
624
|
+
}), object == null || object.resize(object.width, val), setHeight(val), transformer == null || transformer.refreshControls());
|
|
614
625
|
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
626
|
+
__name(handleHeightChange, "handleHeightChange");
|
|
627
|
+
function handleXChange(val) {
|
|
628
|
+
!val || !object || (commandService.executeCommand(UpdateSlideElementOperation.id, {
|
|
629
|
+
pageId,
|
|
630
|
+
oKey: object.oKey,
|
|
619
631
|
props: {
|
|
620
|
-
left:
|
|
632
|
+
left: val
|
|
621
633
|
}
|
|
622
|
-
}),
|
|
634
|
+
}), object == null || object.translate(val, object.top), setXPosition(val), transformer == null || transformer.refreshControls());
|
|
623
635
|
}
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
636
|
+
__name(handleXChange, "handleXChange");
|
|
637
|
+
function handleYChange(val) {
|
|
638
|
+
!val || !object || (commandService.executeCommand(UpdateSlideElementOperation.id, {
|
|
639
|
+
pageId,
|
|
640
|
+
oKey: object.oKey,
|
|
628
641
|
props: {
|
|
629
|
-
right:
|
|
642
|
+
right: val
|
|
630
643
|
}
|
|
631
|
-
}),
|
|
644
|
+
}), object == null || object.translate(object.left, val), setYPosition(val), transformer == null || transformer.refreshControls());
|
|
632
645
|
}
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
646
|
+
__name(handleYChange, "handleYChange");
|
|
647
|
+
function handleChangeRotation(val) {
|
|
648
|
+
!val || !object || (commandService.executeCommand(UpdateSlideElementOperation.id, {
|
|
649
|
+
pageId,
|
|
650
|
+
oKey: object.oKey,
|
|
637
651
|
props: {
|
|
638
|
-
angle:
|
|
652
|
+
angle: val
|
|
639
653
|
}
|
|
640
|
-
}),
|
|
641
|
-
angle:
|
|
642
|
-
}),
|
|
654
|
+
}), object == null || object.transformByState({
|
|
655
|
+
angle: val
|
|
656
|
+
}), setRotation(val), transformer == null || transformer.refreshControls());
|
|
643
657
|
}
|
|
644
|
-
return /* @__PURE__ */
|
|
658
|
+
return __name(handleChangeRotation, "handleChangeRotation"), /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
645
659
|
"div",
|
|
646
660
|
{
|
|
647
|
-
className:
|
|
661
|
+
className: clsx(styles$4.imageCommonPanelGrid, styles$4.imageCommonPanelBorder),
|
|
648
662
|
children: [
|
|
649
|
-
/* @__PURE__ */
|
|
650
|
-
/* @__PURE__ */
|
|
651
|
-
/* @__PURE__ */
|
|
652
|
-
/* @__PURE__ */
|
|
653
|
-
/* @__PURE__ */
|
|
654
|
-
|
|
663
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelTitle), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("image-panel.transform.title") }) }) }),
|
|
664
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$4.imageCommonPanelRow, children: [
|
|
665
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelSpan3), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { children: [
|
|
666
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelColumn, children: localeService.t("image-panel.transform.width") }) }),
|
|
667
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelColumn, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
668
|
+
InputNumber,
|
|
655
669
|
{
|
|
656
|
-
className:
|
|
670
|
+
className: styles$4.imageCommonPanelInput,
|
|
657
671
|
min: 1,
|
|
658
|
-
value:
|
|
659
|
-
onChange: (
|
|
660
|
-
|
|
661
|
-
}
|
|
672
|
+
value: width,
|
|
673
|
+
onChange: /* @__PURE__ */ __name((val) => {
|
|
674
|
+
handleWidthChange(val);
|
|
675
|
+
}, "onChange")
|
|
662
676
|
}
|
|
663
677
|
) }) })
|
|
664
678
|
] }) }),
|
|
665
|
-
/* @__PURE__ */
|
|
666
|
-
/* @__PURE__ */
|
|
667
|
-
/* @__PURE__ */
|
|
668
|
-
|
|
679
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelSpan3), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { children: [
|
|
680
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelColumn, children: localeService.t("image-panel.transform.height") }) }),
|
|
681
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelColumn, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
682
|
+
InputNumber,
|
|
669
683
|
{
|
|
670
|
-
className:
|
|
684
|
+
className: styles$4.imageCommonPanelInput,
|
|
671
685
|
min: 1,
|
|
672
|
-
value:
|
|
673
|
-
onChange: (
|
|
674
|
-
|
|
675
|
-
}
|
|
686
|
+
value: height,
|
|
687
|
+
onChange: /* @__PURE__ */ __name((val) => {
|
|
688
|
+
handleHeightChange(val);
|
|
689
|
+
}, "onChange")
|
|
676
690
|
}
|
|
677
691
|
) }) })
|
|
678
692
|
] }) })
|
|
679
693
|
] }),
|
|
680
|
-
/* @__PURE__ */
|
|
681
|
-
/* @__PURE__ */
|
|
682
|
-
/* @__PURE__ */
|
|
683
|
-
/* @__PURE__ */
|
|
684
|
-
|
|
694
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$4.imageCommonPanelRow, children: [
|
|
695
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelSpan3), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { children: [
|
|
696
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelColumn, children: localeService.t("image-panel.transform.x") }) }),
|
|
697
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelColumn, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
698
|
+
InputNumber,
|
|
685
699
|
{
|
|
686
|
-
className:
|
|
700
|
+
className: styles$4.imageCommonPanelInput,
|
|
687
701
|
precision: 1,
|
|
688
702
|
min: 0,
|
|
689
|
-
value:
|
|
690
|
-
onChange: (
|
|
691
|
-
|
|
692
|
-
}
|
|
703
|
+
value: xPosition,
|
|
704
|
+
onChange: /* @__PURE__ */ __name((val) => {
|
|
705
|
+
handleXChange(val);
|
|
706
|
+
}, "onChange")
|
|
693
707
|
}
|
|
694
708
|
) }) })
|
|
695
709
|
] }) }),
|
|
696
|
-
/* @__PURE__ */
|
|
697
|
-
/* @__PURE__ */
|
|
698
|
-
/* @__PURE__ */
|
|
699
|
-
|
|
710
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelSpan3), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { children: [
|
|
711
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelColumn, children: localeService.t("image-panel.transform.y") }) }),
|
|
712
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelColumn, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
713
|
+
InputNumber,
|
|
700
714
|
{
|
|
701
|
-
className:
|
|
715
|
+
className: styles$4.imageCommonPanelInput,
|
|
702
716
|
precision: 1,
|
|
703
717
|
min: 0,
|
|
704
|
-
value:
|
|
705
|
-
onChange: (
|
|
706
|
-
|
|
707
|
-
}
|
|
718
|
+
value: yPosition,
|
|
719
|
+
onChange: /* @__PURE__ */ __name((val) => {
|
|
720
|
+
handleYChange(val);
|
|
721
|
+
}, "onChange")
|
|
708
722
|
}
|
|
709
723
|
) }) })
|
|
710
724
|
] }) }),
|
|
711
|
-
/* @__PURE__ */
|
|
712
|
-
/* @__PURE__ */
|
|
713
|
-
/* @__PURE__ */
|
|
714
|
-
|
|
725
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelSpan3), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { children: [
|
|
726
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelColumn, children: localeService.t("image-panel.transform.rotate") }) }),
|
|
727
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelColumn, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
728
|
+
InputNumber,
|
|
715
729
|
{
|
|
716
|
-
className:
|
|
730
|
+
className: styles$4.imageCommonPanelInput,
|
|
717
731
|
precision: 1,
|
|
718
|
-
value:
|
|
719
|
-
onChange:
|
|
732
|
+
value: rotation,
|
|
733
|
+
onChange: handleChangeRotation
|
|
720
734
|
}
|
|
721
735
|
) }) })
|
|
722
736
|
] }) })
|
|
@@ -725,54 +739,55 @@ function Fi(i) {
|
|
|
725
739
|
}
|
|
726
740
|
);
|
|
727
741
|
}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
742
|
+
__name(TransformPanel, "TransformPanel");
|
|
743
|
+
function ArrangePanel(props) {
|
|
744
|
+
var _a11, _b;
|
|
745
|
+
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;
|
|
746
|
+
if (!scene) return null;
|
|
747
|
+
const transformer = scene.getTransformer();
|
|
748
|
+
if (!transformer) return null;
|
|
749
|
+
const object = transformer.getSelectedObjectMap().values().next().value;
|
|
750
|
+
if (!object) return null;
|
|
751
|
+
const [color, setColor] = React.useState((_b = (_a11 = object.fill) == null ? void 0 : _a11.toString()) != null ? _b : "");
|
|
752
|
+
function handleChangeColor(color2) {
|
|
753
|
+
object == null || object.setProps({
|
|
754
|
+
fill: color2
|
|
755
|
+
}), commandService.executeCommand(UpdateSlideElementOperation.id, {
|
|
756
|
+
unitId,
|
|
757
|
+
oKey: object == null ? void 0 : object.oKey,
|
|
743
758
|
props: {
|
|
744
759
|
shape: {
|
|
745
760
|
shapeProperties: {
|
|
746
761
|
shapeBackgroundFill: {
|
|
747
|
-
rgb:
|
|
762
|
+
rgb: color2
|
|
748
763
|
}
|
|
749
764
|
}
|
|
750
765
|
}
|
|
751
766
|
}
|
|
752
|
-
}),
|
|
767
|
+
}), setColor(color2);
|
|
753
768
|
}
|
|
754
|
-
return /* @__PURE__ */
|
|
769
|
+
return __name(handleChangeColor, "handleChangeColor"), /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
755
770
|
"div",
|
|
756
771
|
{
|
|
757
|
-
className:
|
|
758
|
-
children: /* @__PURE__ */
|
|
759
|
-
/* @__PURE__ */
|
|
760
|
-
/* @__PURE__ */
|
|
761
|
-
|
|
772
|
+
className: clsx(styles$4.imageCommonPanelGrid, styles$4.imageCommonPanelBorder),
|
|
773
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$4.imageCommonPanelGrid, children: [
|
|
774
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelTitle), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: localeService.t("slide.panel.fill.title") }) }) }),
|
|
775
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$4.imageCommonPanelRow, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx(styles$4.imageCommonPanelColumn, styles$4.imageCommonPanelSpan2), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
776
|
+
DropdownLegacy,
|
|
762
777
|
{
|
|
763
778
|
align: {
|
|
764
779
|
offset: [0, 18]
|
|
765
780
|
},
|
|
766
|
-
overlay: /* @__PURE__ */
|
|
767
|
-
|
|
781
|
+
overlay: /* @__PURE__ */ jsxRuntimeExports.jsx("section", { className: styles$4.slidePanelColorPicker, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
782
|
+
ColorPicker,
|
|
768
783
|
{
|
|
769
784
|
value: "#fff",
|
|
770
|
-
onChange:
|
|
785
|
+
onChange: handleChangeColor
|
|
771
786
|
}
|
|
772
787
|
) }),
|
|
773
|
-
children: /* @__PURE__ */
|
|
774
|
-
/* @__PURE__ */
|
|
775
|
-
/* @__PURE__ */
|
|
788
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("a", { className: styles$4.uiPluginSheetsBorderPanelButton, children: [
|
|
789
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(PaintBucket, { extend: { colorChannel1: color != null ? color : "rgb(var(--primary-color))" } }),
|
|
790
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: styles$4.uiPluginSheetsBorderPanelMoreIcon, children: /* @__PURE__ */ jsxRuntimeExports.jsx(MoreDownSingle, {}) })
|
|
776
791
|
] })
|
|
777
792
|
}
|
|
778
793
|
) }) })
|
|
@@ -780,63 +795,65 @@ function zi(i) {
|
|
|
780
795
|
}
|
|
781
796
|
);
|
|
782
797
|
}
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
798
|
+
__name(ArrangePanel, "ArrangePanel");
|
|
799
|
+
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 = {
|
|
800
|
+
imageCommonPanel,
|
|
801
|
+
imageCommonPanelGrid,
|
|
802
|
+
imageCommonPanelBorder,
|
|
803
|
+
imageCommonPanelTitle,
|
|
804
|
+
imageCommonPanelSubtitle,
|
|
805
|
+
imageCommonPanelRow,
|
|
806
|
+
imageCommonPanelRowVertical,
|
|
807
|
+
imageCommonPanelColumn,
|
|
808
|
+
imageCommonPanelColumnCenter,
|
|
809
|
+
imageCommonPanelInline,
|
|
810
|
+
imageCommonPanelSpan2,
|
|
811
|
+
imageCommonPanelSpan3,
|
|
812
|
+
imageCommonPanelInput
|
|
813
|
+
}, COMPONENT_SLIDE_SIDEBAR = "COMPONENT_SLIDE_SIDEBAR";
|
|
814
|
+
function RectSidebar() {
|
|
815
|
+
var _a11, _b, _c;
|
|
816
|
+
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;
|
|
817
|
+
if (!pageId) return null;
|
|
818
|
+
const transformer = (_b = canvasView.getRenderUnitByPageId(pageId, pageId).scene) == null ? void 0 : _b.getTransformer();
|
|
819
|
+
if (!transformer) return null;
|
|
820
|
+
const object = transformer.getSelectedObjectMap().values().next().value;
|
|
821
|
+
if (!object)
|
|
806
822
|
return null;
|
|
807
|
-
const
|
|
808
|
-
return /* @__PURE__ */
|
|
809
|
-
/* @__PURE__ */
|
|
810
|
-
/* @__PURE__ */
|
|
811
|
-
|
|
823
|
+
const unitId = ((_c = univerInstanceService.getFocusedUnit()) == null ? void 0 : _c.getUnitId()) || "";
|
|
824
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: styles$3.imageCommonPanel, children: [
|
|
825
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ArrangePanel$1, { pageId, unitId }),
|
|
826
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TransformPanel, { pageId, unitId }),
|
|
827
|
+
object.objectType === ObjectType.RECT && /* @__PURE__ */ jsxRuntimeExports.jsx(ArrangePanel, { pageId, unitId })
|
|
812
828
|
] });
|
|
813
829
|
}
|
|
814
|
-
|
|
830
|
+
__name(RectSidebar, "RectSidebar");
|
|
831
|
+
const InsertSlideShapeRectangleCommand = {
|
|
815
832
|
id: "slide.command.insert-float-shape",
|
|
816
|
-
type:
|
|
817
|
-
handler: async (
|
|
818
|
-
var
|
|
819
|
-
const
|
|
820
|
-
return
|
|
821
|
-
}
|
|
822
|
-
},
|
|
833
|
+
type: CommandType.COMMAND,
|
|
834
|
+
handler: /* @__PURE__ */ __name(async (accessor) => {
|
|
835
|
+
var _a11;
|
|
836
|
+
const commandService = accessor.get(ICommandService), unitId = (_a11 = accessor.get(IUniverInstanceService).getFocusedUnit()) == null ? void 0 : _a11.getUnitId();
|
|
837
|
+
return commandService.executeCommand(InsertSlideShapeRectangleOperation.id, { unitId });
|
|
838
|
+
}, "handler")
|
|
839
|
+
}, InsertSlideShapeRectangleOperation = {
|
|
823
840
|
id: "slide.operation.insert-float-shape",
|
|
824
|
-
type:
|
|
825
|
-
handler: async (
|
|
826
|
-
const
|
|
827
|
-
if (!
|
|
828
|
-
const
|
|
829
|
-
id
|
|
830
|
-
zIndex:
|
|
841
|
+
type: CommandType.OPERATION,
|
|
842
|
+
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
843
|
+
const id = generateRandomId(6), univerInstanceService = accessor.get(IUniverInstanceService), unitId = params.unitId, slideData = univerInstanceService.getUnit(unitId);
|
|
844
|
+
if (!slideData) return !1;
|
|
845
|
+
const activePage = slideData.getActivePage(), elements = Object.values(activePage.pageElements), maxIndex = elements != null && elements.length ? Math.max(...elements.map((element2) => element2.zIndex)) : 20, data = {
|
|
846
|
+
id,
|
|
847
|
+
zIndex: maxIndex + 1,
|
|
831
848
|
left: 378,
|
|
832
849
|
top: 142,
|
|
833
850
|
width: 250,
|
|
834
851
|
height: 250,
|
|
835
|
-
title:
|
|
852
|
+
title: id,
|
|
836
853
|
description: "",
|
|
837
|
-
type:
|
|
854
|
+
type: PageElementType.SHAPE,
|
|
838
855
|
shape: {
|
|
839
|
-
shapeType:
|
|
856
|
+
shapeType: BasicShapes.Rect,
|
|
840
857
|
text: "",
|
|
841
858
|
shapeProperties: {
|
|
842
859
|
shapeBackgroundFill: {
|
|
@@ -845,252 +862,256 @@ const Je = {
|
|
|
845
862
|
}
|
|
846
863
|
}
|
|
847
864
|
};
|
|
848
|
-
|
|
849
|
-
const
|
|
850
|
-
return
|
|
851
|
-
}
|
|
852
|
-
},
|
|
865
|
+
activePage.pageElements[id] = data, slideData.updatePage(activePage.id, activePage);
|
|
866
|
+
const canvasview = accessor.get(CanvasView), sceneObject = canvasview.createObjectToPage(data, activePage.id, unitId);
|
|
867
|
+
return sceneObject && canvasview.setObjectActiveByPage(sceneObject, activePage.id, unitId), !0;
|
|
868
|
+
}, "handler")
|
|
869
|
+
}, ToggleSlideEditSidebarOperation = {
|
|
853
870
|
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
|
-
},
|
|
871
|
+
type: CommandType.COMMAND,
|
|
872
|
+
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
873
|
+
const { visible, objectType } = params, sidebarService = accessor.get(ISidebarService), localeService = accessor.get(LocaleService);
|
|
874
|
+
let title = "", children = "";
|
|
875
|
+
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({
|
|
876
|
+
header: { title: localeService.t(title) },
|
|
877
|
+
children: { label: children },
|
|
878
|
+
onClose: /* @__PURE__ */ __name(() => {
|
|
879
|
+
}, "onClose"),
|
|
863
880
|
width: 360
|
|
864
|
-
}) :
|
|
865
|
-
}
|
|
866
|
-
},
|
|
867
|
-
var
|
|
868
|
-
for (var
|
|
869
|
-
(
|
|
870
|
-
return
|
|
871
|
-
},
|
|
872
|
-
function
|
|
873
|
-
const
|
|
881
|
+
}) : sidebarService.close(), !0;
|
|
882
|
+
}, "handler")
|
|
883
|
+
}, COMPONENT_SLIDE_IMAGE_POPUP_MENU = "COMPONENT_SLIDE_IMAGE_POPUP_MENU";
|
|
884
|
+
var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor, __decorateClass$7 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
885
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
886
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
887
|
+
return kind && result && __defProp$7(target, key, result), result;
|
|
888
|
+
}, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7");
|
|
889
|
+
function transformBound2OffsetBound(originBound, scene) {
|
|
890
|
+
const topLeft = transformPosition2Offset(originBound.left, originBound.top, scene), bottomRight = transformPosition2Offset(originBound.right, originBound.bottom, scene);
|
|
874
891
|
return {
|
|
875
|
-
left:
|
|
876
|
-
top:
|
|
877
|
-
right:
|
|
878
|
-
bottom:
|
|
892
|
+
left: topLeft.x,
|
|
893
|
+
top: topLeft.y,
|
|
894
|
+
right: bottomRight.x,
|
|
895
|
+
bottom: bottomRight.y
|
|
879
896
|
};
|
|
880
897
|
}
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
898
|
+
__name(transformBound2OffsetBound, "transformBound2OffsetBound");
|
|
899
|
+
function transformPosition2Offset(x, y, scene) {
|
|
900
|
+
const { scaleX, scaleY } = scene.getAncestorScale(), viewMain = scene.getViewport(SLIDE_KEY.VIEW);
|
|
901
|
+
if (!viewMain)
|
|
884
902
|
return {
|
|
885
|
-
x
|
|
886
|
-
y
|
|
903
|
+
x,
|
|
904
|
+
y
|
|
887
905
|
};
|
|
888
|
-
const { viewportScrollX:
|
|
906
|
+
const { viewportScrollX: actualScrollX, viewportScrollY: actualScrollY } = viewMain, offsetX = (x - actualScrollX) * scaleX, offsetY = (y - actualScrollY) * scaleY;
|
|
889
907
|
return {
|
|
890
|
-
x:
|
|
891
|
-
y:
|
|
908
|
+
x: offsetX,
|
|
909
|
+
y: offsetY
|
|
892
910
|
};
|
|
893
911
|
}
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
912
|
+
__name(transformPosition2Offset, "transformPosition2Offset");
|
|
913
|
+
var _a3;
|
|
914
|
+
let SlideCanvasPopMangerService = (_a3 = class extends Disposable {
|
|
915
|
+
constructor(_globalPopupManagerService, _renderManagerService, _univerInstanceService, _commandService) {
|
|
916
|
+
super(), this._globalPopupManagerService = _globalPopupManagerService, this._renderManagerService = _renderManagerService, this._univerInstanceService = _univerInstanceService, this._commandService = _commandService;
|
|
917
|
+
}
|
|
918
|
+
_createObjectPositionObserver(targetObject, currentRender) {
|
|
919
|
+
const position = (/* @__PURE__ */ __name(() => {
|
|
920
|
+
var _a11, _b, _c, _d;
|
|
921
|
+
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 = {
|
|
922
|
+
left,
|
|
923
|
+
right: left + width,
|
|
924
|
+
top,
|
|
925
|
+
bottom: top + height
|
|
926
|
+
}, 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
927
|
return {
|
|
908
|
-
left:
|
|
909
|
-
right:
|
|
910
|
-
top:
|
|
911
|
-
bottom:
|
|
928
|
+
left: offsetBound.left * scaleAdjust * scaleX + leftOffset + horizontalOffset,
|
|
929
|
+
right: offsetBound.right * scaleAdjust * scaleX + leftOffset + horizontalOffset,
|
|
930
|
+
top: offsetBound.top * scaleAdjust * scaleY + topOffset + verticalOffset,
|
|
931
|
+
bottom: offsetBound.bottom * scaleAdjust * scaleY + topOffset + verticalOffset
|
|
912
932
|
};
|
|
913
|
-
})(),
|
|
933
|
+
}, "calc"))(), position$ = new BehaviorSubject(position), disposable = new DisposableCollection();
|
|
914
934
|
return {
|
|
915
|
-
position
|
|
916
|
-
position
|
|
917
|
-
disposable
|
|
935
|
+
position,
|
|
936
|
+
position$,
|
|
937
|
+
disposable
|
|
918
938
|
};
|
|
919
939
|
}
|
|
920
|
-
attachPopupToObject(
|
|
921
|
-
const
|
|
922
|
-
if (!
|
|
940
|
+
attachPopupToObject(targetObject, popup) {
|
|
941
|
+
const unitId = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SLIDE).getUnitId(), currentRender = this._renderManagerService.getRenderById(unitId);
|
|
942
|
+
if (!currentRender)
|
|
923
943
|
return {
|
|
924
|
-
dispose: () => {
|
|
925
|
-
}
|
|
944
|
+
dispose: /* @__PURE__ */ __name(() => {
|
|
945
|
+
}, "dispose")
|
|
926
946
|
};
|
|
927
|
-
const { position
|
|
928
|
-
...
|
|
929
|
-
unitId
|
|
947
|
+
const { position, position$, disposable } = this._createObjectPositionObserver(targetObject, currentRender), id = this._globalPopupManagerService.addPopup({
|
|
948
|
+
...popup,
|
|
949
|
+
unitId,
|
|
930
950
|
subUnitId: "default",
|
|
931
|
-
anchorRect:
|
|
932
|
-
anchorRect$:
|
|
933
|
-
canvasElement:
|
|
951
|
+
anchorRect: position,
|
|
952
|
+
anchorRect$: position$,
|
|
953
|
+
canvasElement: currentRender.engine.getCanvasElement()
|
|
934
954
|
});
|
|
935
955
|
return {
|
|
936
|
-
dispose: () => {
|
|
937
|
-
this._globalPopupManagerService.removePopup(
|
|
938
|
-
}
|
|
956
|
+
dispose: /* @__PURE__ */ __name(() => {
|
|
957
|
+
this._globalPopupManagerService.removePopup(id), position$.complete(), disposable.dispose();
|
|
958
|
+
}, "dispose")
|
|
939
959
|
};
|
|
940
960
|
}
|
|
941
|
-
};
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
],
|
|
948
|
-
var
|
|
949
|
-
for (var
|
|
950
|
-
(
|
|
951
|
-
return
|
|
952
|
-
},
|
|
953
|
-
let
|
|
954
|
-
constructor(
|
|
961
|
+
}, __name(_a3, "SlideCanvasPopMangerService"), _a3);
|
|
962
|
+
SlideCanvasPopMangerService = __decorateClass$7([
|
|
963
|
+
__decorateParam$7(0, Inject(ICanvasPopupService)),
|
|
964
|
+
__decorateParam$7(1, IRenderManagerService),
|
|
965
|
+
__decorateParam$7(2, IUniverInstanceService),
|
|
966
|
+
__decorateParam$7(3, ICommandService)
|
|
967
|
+
], SlideCanvasPopMangerService);
|
|
968
|
+
var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor, __decorateClass$6 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
969
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
970
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
971
|
+
return kind && result && __defProp$6(target, key, result), result;
|
|
972
|
+
}, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6"), _a4;
|
|
973
|
+
let SlidePopupMenuController = (_a4 = class extends RxDisposable {
|
|
974
|
+
constructor(_canvasPopManagerService, _renderManagerService, _univerInstanceService, _contextService, _canvasView, _sidebarService, _commandService) {
|
|
955
975
|
super();
|
|
956
|
-
|
|
957
|
-
this._canvasPopManagerService =
|
|
976
|
+
__publicField(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
|
|
977
|
+
this._canvasPopManagerService = _canvasPopManagerService, this._renderManagerService = _renderManagerService, this._univerInstanceService = _univerInstanceService, this._contextService = _contextService, this._canvasView = _canvasView, this._sidebarService = _sidebarService, this._commandService = _commandService, this._init();
|
|
958
978
|
}
|
|
959
979
|
_init() {
|
|
960
|
-
this._univerInstanceService.getAllUnitsForType(
|
|
980
|
+
this._univerInstanceService.getAllUnitsForType(UniverInstanceType.UNIVER_SLIDE).forEach((slide) => this._create(slide));
|
|
961
981
|
}
|
|
962
|
-
_create(
|
|
963
|
-
if (!
|
|
982
|
+
_create(slide) {
|
|
983
|
+
if (!slide)
|
|
964
984
|
return;
|
|
965
|
-
const
|
|
966
|
-
this._renderManagerService.has(
|
|
985
|
+
const unitId = slide.getUnitId();
|
|
986
|
+
this._renderManagerService.has(unitId) && !this._initImagePopupMenu.has(unitId) && (this._popupMenuListener(unitId), this._initImagePopupMenu.add(unitId));
|
|
967
987
|
}
|
|
968
|
-
_hasCropObject(
|
|
988
|
+
_hasCropObject(scene) {
|
|
969
989
|
}
|
|
970
990
|
// 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
|
|
991
|
+
_popupMenuListener(unitId) {
|
|
992
|
+
var _a11;
|
|
993
|
+
const model = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SLIDE), pages = (_a11 = model == null ? void 0 : model.getPages()) != null ? _a11 : {};
|
|
994
|
+
Object.keys(pages).forEach((pageId) => {
|
|
995
|
+
var _a12;
|
|
996
|
+
const transformer = (_a12 = this._canvasView.getRenderUnitByPageId(pageId, unitId).scene) == null ? void 0 : _a12.getTransformer();
|
|
997
|
+
if (!transformer) return;
|
|
998
|
+
let singletonPopupDisposer;
|
|
979
999
|
this.disposeWithMe(
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
const
|
|
983
|
-
if (
|
|
984
|
-
|
|
1000
|
+
toDisposable(
|
|
1001
|
+
transformer.createControl$.subscribe(() => {
|
|
1002
|
+
const selectedObjects = transformer.getSelectedObjectMap();
|
|
1003
|
+
if (selectedObjects.size > 1) {
|
|
1004
|
+
singletonPopupDisposer == null || singletonPopupDisposer.dispose();
|
|
985
1005
|
return;
|
|
986
1006
|
}
|
|
987
|
-
const
|
|
988
|
-
if (!
|
|
1007
|
+
const object = selectedObjects.values().next().value;
|
|
1008
|
+
if (!object)
|
|
989
1009
|
return;
|
|
990
|
-
const
|
|
991
|
-
|
|
992
|
-
componentKey:
|
|
1010
|
+
const oKey = object.oKey;
|
|
1011
|
+
singletonPopupDisposer == null || singletonPopupDisposer.dispose(), singletonPopupDisposer = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(object, {
|
|
1012
|
+
componentKey: COMPONENT_SLIDE_IMAGE_POPUP_MENU,
|
|
993
1013
|
direction: "horizontal",
|
|
994
1014
|
offset: [2, 0],
|
|
995
1015
|
extraProps: {
|
|
996
|
-
menuItems: this._getMenuItemsByObjectType(
|
|
1016
|
+
menuItems: this._getMenuItemsByObjectType(object.objectType, oKey, unitId)
|
|
997
1017
|
}
|
|
998
|
-
})), this._sidebarService.visible && this._commandService.executeCommand(
|
|
1018
|
+
})), this._sidebarService.visible && this._commandService.executeCommand(ToggleSlideEditSidebarOperation.id, {
|
|
999
1019
|
visible: !0,
|
|
1000
|
-
objectType:
|
|
1020
|
+
objectType: object.objectType
|
|
1001
1021
|
});
|
|
1002
1022
|
})
|
|
1003
1023
|
)
|
|
1004
1024
|
), this.disposeWithMe(
|
|
1005
|
-
|
|
1006
|
-
|
|
1025
|
+
transformer.clearControl$.subscribe(() => {
|
|
1026
|
+
singletonPopupDisposer == null || singletonPopupDisposer.dispose(), this._contextService.setContextValue(FOCUSING_COMMON_DRAWINGS, !1);
|
|
1007
1027
|
})
|
|
1008
1028
|
), this.disposeWithMe(
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
const
|
|
1012
|
-
if (
|
|
1013
|
-
|
|
1029
|
+
transformer.changing$.subscribe(() => {
|
|
1030
|
+
singletonPopupDisposer == null || singletonPopupDisposer.dispose();
|
|
1031
|
+
const selectedObjects = transformer.getSelectedObjectMap();
|
|
1032
|
+
if (selectedObjects.size > 1) {
|
|
1033
|
+
singletonPopupDisposer == null || singletonPopupDisposer.dispose();
|
|
1014
1034
|
return;
|
|
1015
1035
|
}
|
|
1016
|
-
const
|
|
1017
|
-
|
|
1018
|
-
unitId
|
|
1019
|
-
oKey:
|
|
1036
|
+
const object = selectedObjects.values().next().value;
|
|
1037
|
+
object && this._commandService.executeCommand(UpdateSlideElementOperation.id, {
|
|
1038
|
+
unitId,
|
|
1039
|
+
oKey: object.oKey,
|
|
1020
1040
|
props: {
|
|
1021
|
-
width:
|
|
1022
|
-
height:
|
|
1023
|
-
left:
|
|
1024
|
-
top:
|
|
1041
|
+
width: object.width,
|
|
1042
|
+
height: object.height,
|
|
1043
|
+
left: object.left,
|
|
1044
|
+
top: object.top
|
|
1025
1045
|
}
|
|
1026
1046
|
});
|
|
1027
1047
|
})
|
|
1028
1048
|
);
|
|
1029
1049
|
});
|
|
1030
1050
|
}
|
|
1031
|
-
_getMenuItemsByObjectType(
|
|
1051
|
+
_getMenuItemsByObjectType(objectType, oKey, unitId) {
|
|
1032
1052
|
return [{
|
|
1033
1053
|
label: "slide.popup.edit",
|
|
1034
1054
|
index: 0,
|
|
1035
|
-
commandId:
|
|
1055
|
+
commandId: ToggleSlideEditSidebarOperation.id,
|
|
1036
1056
|
commandParams: {
|
|
1037
1057
|
visible: !0,
|
|
1038
|
-
objectType
|
|
1058
|
+
objectType
|
|
1039
1059
|
},
|
|
1040
1060
|
disable: !1
|
|
1041
1061
|
}, {
|
|
1042
1062
|
label: "slide.popup.delete",
|
|
1043
1063
|
index: 5,
|
|
1044
|
-
commandId:
|
|
1064
|
+
commandId: DeleteSlideElementOperation.id,
|
|
1045
1065
|
commandParams: {
|
|
1046
|
-
id:
|
|
1047
|
-
unitId
|
|
1066
|
+
id: oKey,
|
|
1067
|
+
unitId
|
|
1048
1068
|
},
|
|
1049
1069
|
disable: !1
|
|
1050
1070
|
}];
|
|
1051
1071
|
}
|
|
1052
|
-
};
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
],
|
|
1062
|
-
const
|
|
1072
|
+
}, __name(_a4, "SlidePopupMenuController"), _a4);
|
|
1073
|
+
SlidePopupMenuController = __decorateClass$6([
|
|
1074
|
+
__decorateParam$6(0, Inject(SlideCanvasPopMangerService)),
|
|
1075
|
+
__decorateParam$6(1, IRenderManagerService),
|
|
1076
|
+
__decorateParam$6(2, IUniverInstanceService),
|
|
1077
|
+
__decorateParam$6(3, IContextService),
|
|
1078
|
+
__decorateParam$6(4, Inject(CanvasView)),
|
|
1079
|
+
__decorateParam$6(5, ISidebarService),
|
|
1080
|
+
__decorateParam$6(6, ICommandService)
|
|
1081
|
+
], SlidePopupMenuController);
|
|
1082
|
+
const SetTextEditArrowOperation = {
|
|
1063
1083
|
id: "slide.operation.edit-arrow",
|
|
1064
|
-
type:
|
|
1065
|
-
handler: () => !0
|
|
1066
|
-
},
|
|
1067
|
-
var
|
|
1068
|
-
for (var
|
|
1069
|
-
(
|
|
1070
|
-
return
|
|
1071
|
-
},
|
|
1072
|
-
const
|
|
1073
|
-
|
|
1074
|
-
|
|
1084
|
+
type: CommandType.OPERATION,
|
|
1085
|
+
handler: /* @__PURE__ */ __name(() => !0, "handler")
|
|
1086
|
+
}, SLIDE_EDITOR_ID = createInternalEditorID("SLIDE_EDITOR");
|
|
1087
|
+
var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor, __decorateClass$5 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
1088
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1089
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
1090
|
+
return kind && result && __defProp$5(target, key, result), result;
|
|
1091
|
+
}, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5");
|
|
1092
|
+
const ISlideEditorBridgeService = createIdentifier("univer.slide-editor-bridge.service");
|
|
1093
|
+
var _a5;
|
|
1094
|
+
let SlideEditorBridgeService = (_a5 = class extends Disposable {
|
|
1095
|
+
constructor(_editorService, _contextService, _renderManagerService) {
|
|
1075
1096
|
super();
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1097
|
+
__publicField(this, "_editorUnitId", SLIDE_EDITOR_ID);
|
|
1098
|
+
__publicField(this, "_isForceKeepVisible", !1);
|
|
1099
|
+
__publicField(this, "_editorIsDirty", !1);
|
|
1100
|
+
__publicField(this, "_currentEditRectState", null);
|
|
1101
|
+
__publicField(this, "_currentEditRectState$", new BehaviorSubject(null));
|
|
1102
|
+
__publicField(this, "currentEditRectState$", this._currentEditRectState$.asObservable());
|
|
1103
|
+
__publicField(this, "_visibleParam", {
|
|
1083
1104
|
visible: !1,
|
|
1084
|
-
eventType:
|
|
1105
|
+
eventType: DeviceInputEventType.Dblclick,
|
|
1085
1106
|
unitId: ""
|
|
1086
1107
|
});
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
this._editorService =
|
|
1108
|
+
__publicField(this, "_visible$", new BehaviorSubject(this._visibleParam));
|
|
1109
|
+
__publicField(this, "visible$", this._visible$.asObservable());
|
|
1110
|
+
__publicField(this, "_afterVisible$", new BehaviorSubject(this._visibleParam));
|
|
1111
|
+
__publicField(this, "afterVisible$", this._afterVisible$.asObservable());
|
|
1112
|
+
__publicField(this, "endEditing$", new Subject());
|
|
1113
|
+
__publicField(this, "_currentEditRectInfo");
|
|
1114
|
+
this._editorService = _editorService, this._contextService = _contextService, this._renderManagerService = _renderManagerService;
|
|
1094
1115
|
}
|
|
1095
1116
|
dispose() {
|
|
1096
1117
|
super.dispose();
|
|
@@ -1102,13 +1123,13 @@ let Fe = class extends Ue {
|
|
|
1102
1123
|
* 1st part of startEditing.
|
|
1103
1124
|
* @editorInfo editorInfo
|
|
1104
1125
|
*/
|
|
1105
|
-
setEditorRect(
|
|
1106
|
-
this._currentEditRectInfo =
|
|
1107
|
-
const
|
|
1108
|
-
this._currentEditRectState =
|
|
1126
|
+
setEditorRect(editorInfo) {
|
|
1127
|
+
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));
|
|
1128
|
+
const editRectState = this.getEditRectState();
|
|
1129
|
+
this._currentEditRectState = editRectState, this._currentEditRectState$.next(editRectState);
|
|
1109
1130
|
}
|
|
1110
|
-
changeVisible(
|
|
1111
|
-
this._visibleParam =
|
|
1131
|
+
changeVisible(param) {
|
|
1132
|
+
this._visibleParam = param, param.visible && (this._editorIsDirty = !1), this._visible$.next(this._visibleParam), this._afterVisible$.next(this._visibleParam);
|
|
1112
1133
|
}
|
|
1113
1134
|
/**
|
|
1114
1135
|
* get info from _currentEditRectInfo
|
|
@@ -1117,43 +1138,43 @@ let Fe = class extends Ue {
|
|
|
1117
1138
|
* && this@setEditorRect
|
|
1118
1139
|
*/
|
|
1119
1140
|
getEditRectState() {
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1122
|
-
...
|
|
1123
|
-
pageSize: { width:
|
|
1141
|
+
const editorUnitId = SLIDE_EDITOR_ID, editorRectInfo = this._currentEditRectInfo, unitId = editorRectInfo.unitId, docData = editorRectInfo.richTextObj.documentData;
|
|
1142
|
+
docData.id = editorUnitId, docData.documentStyle = {
|
|
1143
|
+
...docData.documentStyle,
|
|
1144
|
+
pageSize: { width: editorRectInfo.richTextObj.width, height: 1 / 0 }
|
|
1124
1145
|
};
|
|
1125
|
-
const
|
|
1126
|
-
documentModel: new
|
|
1146
|
+
const documentLayoutObject = {
|
|
1147
|
+
documentModel: new DocumentDataModel(docData),
|
|
1127
1148
|
fontString: "document",
|
|
1128
1149
|
textRotation: { a: 0, v: 0 },
|
|
1129
1150
|
wrapStrategy: 0,
|
|
1130
|
-
verticalAlign:
|
|
1131
|
-
horizontalAlign:
|
|
1151
|
+
verticalAlign: VerticalAlign.TOP,
|
|
1152
|
+
horizontalAlign: HorizontalAlign.LEFT,
|
|
1132
1153
|
paddingData: { t: 0, b: 1, l: 2, r: 2 }
|
|
1133
|
-
},
|
|
1154
|
+
}, editorWidth = editorRectInfo.richTextObj.width, editorHeight = editorRectInfo.richTextObj.height, left = editorRectInfo.richTextObj.left, top = editorRectInfo.richTextObj.top, canvasOffset = {
|
|
1134
1155
|
left: 0,
|
|
1135
1156
|
top: 0
|
|
1136
|
-
},
|
|
1137
|
-
x: (
|
|
1138
|
-
y: (
|
|
1139
|
-
},
|
|
1140
|
-
return
|
|
1157
|
+
}, 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 = {
|
|
1158
|
+
x: (slideMainRect == null ? void 0 : slideMainRect.left) || 0,
|
|
1159
|
+
y: (slideMainRect == null ? void 0 : slideMainRect.top) || 0
|
|
1160
|
+
}, scrollX = (mainViewport == null ? void 0 : mainViewport.viewportScrollX) || 0, scrollY = (mainViewport == null ? void 0 : mainViewport.viewportScrollY) || 0;
|
|
1161
|
+
return canvasOffset.left = slidePos.x - scrollX, canvasOffset.top = slidePos.y - scrollY, {
|
|
1141
1162
|
position: {
|
|
1142
|
-
startX:
|
|
1143
|
-
startY:
|
|
1144
|
-
endX:
|
|
1145
|
-
endY:
|
|
1163
|
+
startX: left,
|
|
1164
|
+
startY: top,
|
|
1165
|
+
endX: left + editorWidth,
|
|
1166
|
+
endY: top + editorHeight
|
|
1146
1167
|
},
|
|
1147
1168
|
scaleX: 1,
|
|
1148
1169
|
scaleY: 1,
|
|
1149
|
-
slideCardOffset:
|
|
1150
|
-
unitId
|
|
1151
|
-
editorUnitId
|
|
1152
|
-
documentLayoutObject
|
|
1170
|
+
slideCardOffset: canvasOffset,
|
|
1171
|
+
unitId,
|
|
1172
|
+
editorUnitId,
|
|
1173
|
+
documentLayoutObject
|
|
1153
1174
|
};
|
|
1154
1175
|
}
|
|
1155
|
-
changeEditorDirty(
|
|
1156
|
-
this._editorIsDirty =
|
|
1176
|
+
changeEditorDirty(dirtyStatus) {
|
|
1177
|
+
this._editorIsDirty = dirtyStatus;
|
|
1157
1178
|
}
|
|
1158
1179
|
isVisible() {
|
|
1159
1180
|
return this._visibleParam.visible;
|
|
@@ -1167,14 +1188,14 @@ let Fe = class extends Ue {
|
|
|
1167
1188
|
/**
|
|
1168
1189
|
* @deprecated
|
|
1169
1190
|
*/
|
|
1170
|
-
genDocData(
|
|
1171
|
-
const
|
|
1191
|
+
genDocData(target) {
|
|
1192
|
+
const editorUnitId = this.getCurrentEditorId(), content = target.text, fontSize = target.fs;
|
|
1172
1193
|
return {
|
|
1173
|
-
id:
|
|
1194
|
+
id: editorUnitId,
|
|
1174
1195
|
body: {
|
|
1175
|
-
dataStream: `${
|
|
1196
|
+
dataStream: `${content}\r
|
|
1176
1197
|
`,
|
|
1177
|
-
textRuns: [{ st: 0, ed:
|
|
1198
|
+
textRuns: [{ st: 0, ed: content.length }],
|
|
1178
1199
|
paragraphs: [{
|
|
1179
1200
|
paragraphStyle: {
|
|
1180
1201
|
// no use
|
|
@@ -1182,9 +1203,9 @@ let Fe = class extends Ue {
|
|
|
1182
1203
|
// horizontalAlign: HorizontalAlign.CENTER,
|
|
1183
1204
|
// verticalAlign: VerticalAlign.MIDDLE,
|
|
1184
1205
|
},
|
|
1185
|
-
startIndex:
|
|
1206
|
+
startIndex: content.length + 1
|
|
1186
1207
|
}],
|
|
1187
|
-
sectionBreaks: [{ startIndex:
|
|
1208
|
+
sectionBreaks: [{ startIndex: content.length + 2 }]
|
|
1188
1209
|
},
|
|
1189
1210
|
documentStyle: {
|
|
1190
1211
|
marginBottom: 0,
|
|
@@ -1192,10 +1213,10 @@ let Fe = class extends Ue {
|
|
|
1192
1213
|
marginRight: 0,
|
|
1193
1214
|
marginTop: 0,
|
|
1194
1215
|
pageSize: { width: 1 / 0, height: 1 / 0 },
|
|
1195
|
-
textStyle: { fs:
|
|
1216
|
+
textStyle: { fs: fontSize },
|
|
1196
1217
|
renderConfig: {
|
|
1197
1218
|
// horizontalAlign: HorizontalAlign.CENTER,
|
|
1198
|
-
verticalAlign:
|
|
1219
|
+
verticalAlign: VerticalAlign.MIDDLE,
|
|
1199
1220
|
centerAngle: 0,
|
|
1200
1221
|
vertexAngle: 0,
|
|
1201
1222
|
wrapStrategy: 0
|
|
@@ -1206,70 +1227,73 @@ let Fe = class extends Ue {
|
|
|
1206
1227
|
settings: { zoomRatio: 1 }
|
|
1207
1228
|
};
|
|
1208
1229
|
}
|
|
1209
|
-
};
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
],
|
|
1215
|
-
class
|
|
1230
|
+
}, __name(_a5, "SlideEditorBridgeService"), _a5);
|
|
1231
|
+
SlideEditorBridgeService = __decorateClass$5([
|
|
1232
|
+
__decorateParam$5(0, IEditorService),
|
|
1233
|
+
__decorateParam$5(1, IContextService),
|
|
1234
|
+
__decorateParam$5(2, IRenderManagerService)
|
|
1235
|
+
], SlideEditorBridgeService);
|
|
1236
|
+
const _SlideEditorManagerService = class _SlideEditorManagerService {
|
|
1216
1237
|
constructor() {
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1238
|
+
__publicField(this, "_state", null);
|
|
1239
|
+
__publicField(this, "_rect", null);
|
|
1240
|
+
__publicField(this, "_state$", new BehaviorSubject(null));
|
|
1241
|
+
__publicField(this, "state$", this._state$.asObservable());
|
|
1242
|
+
__publicField(this, "_rect$", new BehaviorSubject(null));
|
|
1243
|
+
__publicField(this, "rect$", this._rect$.asObservable());
|
|
1244
|
+
__publicField(this, "_focus", !1);
|
|
1245
|
+
__publicField(this, "_focus$", new BehaviorSubject(this._focus));
|
|
1246
|
+
__publicField(this, "focus$", this._focus$.asObservable());
|
|
1226
1247
|
}
|
|
1227
1248
|
dispose() {
|
|
1228
1249
|
this._state$.complete(), this._state = null, this._rect$.complete(), this._rect = null;
|
|
1229
1250
|
}
|
|
1230
|
-
setState(
|
|
1231
|
-
this._state =
|
|
1251
|
+
setState(param) {
|
|
1252
|
+
this._state = param, this._refresh(param);
|
|
1232
1253
|
}
|
|
1233
1254
|
getRect() {
|
|
1234
1255
|
return this._rect;
|
|
1235
1256
|
}
|
|
1236
|
-
setRect(
|
|
1237
|
-
this._rect =
|
|
1257
|
+
setRect(param) {
|
|
1258
|
+
this._rect = param, this._rect$.next(param);
|
|
1238
1259
|
}
|
|
1239
1260
|
getState() {
|
|
1240
1261
|
return this._state;
|
|
1241
1262
|
}
|
|
1242
|
-
setFocus(
|
|
1243
|
-
this._focus =
|
|
1263
|
+
setFocus(param = !1) {
|
|
1264
|
+
this._focus = param, this._focus$.next(param);
|
|
1244
1265
|
}
|
|
1245
|
-
_refresh(
|
|
1246
|
-
this._state$.next(
|
|
1266
|
+
_refresh(param) {
|
|
1267
|
+
this._state$.next(param);
|
|
1247
1268
|
}
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1269
|
+
};
|
|
1270
|
+
__name(_SlideEditorManagerService, "SlideEditorManagerService");
|
|
1271
|
+
let SlideEditorManagerService = _SlideEditorManagerService;
|
|
1272
|
+
const ISlideEditorManagerService = createIdentifier(
|
|
1250
1273
|
"univer.slide-editor-manager.service"
|
|
1251
1274
|
);
|
|
1252
|
-
var
|
|
1253
|
-
for (var
|
|
1254
|
-
(
|
|
1255
|
-
return
|
|
1256
|
-
},
|
|
1257
|
-
const
|
|
1258
|
-
|
|
1259
|
-
|
|
1275
|
+
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) => {
|
|
1276
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1277
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
1278
|
+
return kind && result && __defProp$4(target, key, result), result;
|
|
1279
|
+
}, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4");
|
|
1280
|
+
const HIDDEN_EDITOR_POSITION$1 = -1e3, EDITOR_INPUT_SELF_EXTEND_GAP = 5, EDITOR_BORDER_SIZE = 2;
|
|
1281
|
+
var _a6;
|
|
1282
|
+
let SlideEditingRenderController = (_a6 = class extends Disposable {
|
|
1283
|
+
constructor(_renderContext, _layoutService, _undoRedoService, _contextService, _instanceSrv, _renderManagerService, _editorBridgeService, _cellEditorManagerService, _textSelectionManagerService, _commandService, _localService, _editorService) {
|
|
1260
1284
|
super();
|
|
1261
1285
|
/**
|
|
1262
1286
|
* It is used to distinguish whether the user has actively moved the cursor in the editor, mainly through mouse clicks.
|
|
1263
1287
|
*/
|
|
1264
|
-
|
|
1288
|
+
__publicField(this, "_cursorChange", CursorChange.InitialState);
|
|
1265
1289
|
/** If the corresponding unit is active and prepared for editing. */
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
this._renderContext =
|
|
1269
|
-
|
|
1290
|
+
__publicField(this, "_isUnitEditing", !1);
|
|
1291
|
+
__publicField(this, "_d");
|
|
1292
|
+
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) => {
|
|
1293
|
+
slideDataModel && slideDataModel.getUnitId() === this._renderContext.unitId ? this._d = this._init() : (this._disposeCurrent(), this._isUnitEditing && (this._handleEditorInvisible({
|
|
1270
1294
|
visible: !1,
|
|
1271
|
-
eventType:
|
|
1272
|
-
keycode:
|
|
1295
|
+
eventType: DeviceInputEventType.Keyboard,
|
|
1296
|
+
keycode: KeyCode.ESC,
|
|
1273
1297
|
unitId: this._renderContext.unitId
|
|
1274
1298
|
}), this._isUnitEditing = !1));
|
|
1275
1299
|
})), this._initEditorVisibilityListener();
|
|
@@ -1278,61 +1302,61 @@ let ze = class extends Ue {
|
|
|
1278
1302
|
super.dispose(), this._disposeCurrent();
|
|
1279
1303
|
}
|
|
1280
1304
|
_disposeCurrent() {
|
|
1281
|
-
var
|
|
1282
|
-
(
|
|
1305
|
+
var _a11;
|
|
1306
|
+
(_a11 = this._d) == null || _a11.dispose(), this._d = null;
|
|
1283
1307
|
}
|
|
1284
1308
|
_init() {
|
|
1285
|
-
const
|
|
1286
|
-
return this._subscribeToCurrentCell(
|
|
1287
|
-
this._cursorStateListener(
|
|
1288
|
-
}, 1e3),
|
|
1309
|
+
const d = new DisposableCollection();
|
|
1310
|
+
return this._subscribeToCurrentCell(d), this._initialKeyboardListener(d), this._initialCursorSync(d), this._listenEditorFocus(d), this._commandExecutedListener(d), setTimeout(() => {
|
|
1311
|
+
this._cursorStateListener(d);
|
|
1312
|
+
}, 1e3), d;
|
|
1289
1313
|
}
|
|
1290
1314
|
_initEditorVisibilityListener() {
|
|
1291
|
-
this.disposeWithMe(this._editorBridgeService.visible$.subscribe((
|
|
1292
|
-
|
|
1315
|
+
this.disposeWithMe(this._editorBridgeService.visible$.subscribe((param) => {
|
|
1316
|
+
param.visible ? (this._isUnitEditing = !0, this._handleEditorVisible(param)) : this._isUnitEditing && (this._handleEditorInvisible(param), this._isUnitEditing = !1);
|
|
1293
1317
|
}));
|
|
1294
1318
|
}
|
|
1295
|
-
_listenEditorFocus(
|
|
1296
|
-
const
|
|
1297
|
-
|
|
1319
|
+
_listenEditorFocus(d) {
|
|
1320
|
+
const renderConfig = this._getEditorObject();
|
|
1321
|
+
renderConfig && d.add(renderConfig.document.onPointerDown$.subscribeEvent(() => {
|
|
1298
1322
|
}));
|
|
1299
1323
|
}
|
|
1300
|
-
_getEditorSkeleton(
|
|
1301
|
-
var
|
|
1302
|
-
return (
|
|
1324
|
+
_getEditorSkeleton(editorId) {
|
|
1325
|
+
var _a11;
|
|
1326
|
+
return (_a11 = this._renderManagerService.getRenderById(editorId)) == null ? void 0 : _a11.with(DocSkeletonManagerService).getSkeleton();
|
|
1303
1327
|
}
|
|
1304
|
-
_getEditorViewModel(
|
|
1305
|
-
var
|
|
1306
|
-
return (
|
|
1328
|
+
_getEditorViewModel(editorId) {
|
|
1329
|
+
var _a11;
|
|
1330
|
+
return (_a11 = this._renderManagerService.getRenderById(editorId)) == null ? void 0 : _a11.with(DocSkeletonManagerService).getViewModel();
|
|
1307
1331
|
}
|
|
1308
|
-
_initialCursorSync(
|
|
1309
|
-
|
|
1310
|
-
var
|
|
1311
|
-
const
|
|
1312
|
-
|
|
1332
|
+
_initialCursorSync(d) {
|
|
1333
|
+
d.add(this._cellEditorManagerService.focus$.pipe(filter((f) => !!f)).subscribe(() => {
|
|
1334
|
+
var _a11;
|
|
1335
|
+
const docSelectionRenderManager = (_a11 = this._renderManagerService.getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_DOC)) == null ? void 0 : _a11.with(DocSelectionRenderService);
|
|
1336
|
+
docSelectionRenderManager && docSelectionRenderManager.sync();
|
|
1313
1337
|
}));
|
|
1314
1338
|
}
|
|
1315
1339
|
/**
|
|
1316
1340
|
* Set editorUnitId to curr doc.
|
|
1317
1341
|
* @param d DisposableCollection
|
|
1318
1342
|
*/
|
|
1319
|
-
_subscribeToCurrentCell(
|
|
1320
|
-
|
|
1321
|
-
var
|
|
1322
|
-
if (
|
|
1343
|
+
_subscribeToCurrentCell(d) {
|
|
1344
|
+
d.add(this._editorBridgeService.currentEditRectState$.subscribe((editCellState) => {
|
|
1345
|
+
var _a11;
|
|
1346
|
+
if (editCellState == null || this._contextService.getContextValue(FOCUSING_EDITOR_STANDALONE) || this._contextService.getContextValue(FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE))
|
|
1323
1347
|
return;
|
|
1324
1348
|
const {
|
|
1325
|
-
position: { startX
|
|
1326
|
-
documentLayoutObject: { textRotation
|
|
1327
|
-
scaleX
|
|
1328
|
-
editorUnitId
|
|
1329
|
-
} =
|
|
1330
|
-
|
|
1349
|
+
position: { startX, endX },
|
|
1350
|
+
documentLayoutObject: { textRotation, wrapStrategy, documentModel },
|
|
1351
|
+
scaleX,
|
|
1352
|
+
editorUnitId
|
|
1353
|
+
} = editCellState, { vertexAngle: angle } = convertTextRotation(textRotation);
|
|
1354
|
+
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
1355
|
startOffset: 0,
|
|
1332
1356
|
endOffset: 0
|
|
1333
1357
|
}]);
|
|
1334
|
-
const
|
|
1335
|
-
|
|
1358
|
+
const docSelectionRenderManager = (_a11 = this._renderManagerService.getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_DOC)) == null ? void 0 : _a11.with(DocSelectionRenderService);
|
|
1359
|
+
docSelectionRenderManager && docSelectionRenderManager.activate(HIDDEN_EDITOR_POSITION$1, HIDDEN_EDITOR_POSITION$1);
|
|
1336
1360
|
}));
|
|
1337
1361
|
}
|
|
1338
1362
|
/**
|
|
@@ -1344,112 +1368,113 @@ let ze = class extends Ue {
|
|
|
1344
1368
|
* @param scaleX
|
|
1345
1369
|
* @param scaleY
|
|
1346
1370
|
*/
|
|
1347
|
-
_fitTextSize(
|
|
1348
|
-
const { startX
|
|
1349
|
-
if (
|
|
1371
|
+
_fitTextSize(positionFromEditRectState, canvasOffset, documentSkeleton, documentLayoutObject, scaleX = 1, scaleY = 1) {
|
|
1372
|
+
const { startX, startY, endX, endY } = positionFromEditRectState, documentDataModel = documentLayoutObject.documentModel;
|
|
1373
|
+
if (documentDataModel == null)
|
|
1350
1374
|
return;
|
|
1351
|
-
const { actualWidth
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
), { verticalAlign
|
|
1359
|
-
let
|
|
1360
|
-
if (
|
|
1361
|
-
|
|
1375
|
+
const { actualWidth, actualHeight } = this._predictingSize(
|
|
1376
|
+
positionFromEditRectState,
|
|
1377
|
+
canvasOffset,
|
|
1378
|
+
documentSkeleton,
|
|
1379
|
+
documentLayoutObject,
|
|
1380
|
+
scaleX,
|
|
1381
|
+
scaleY
|
|
1382
|
+
), { verticalAlign, paddingData, fill } = documentLayoutObject;
|
|
1383
|
+
let editorWidth = endX - startX, editorHeight = endY - startY;
|
|
1384
|
+
if (editorWidth < actualWidth && (editorWidth = actualWidth), editorHeight < actualHeight)
|
|
1385
|
+
editorHeight = actualHeight, documentDataModel.updateDocumentDataMargin(paddingData);
|
|
1362
1386
|
else {
|
|
1363
|
-
let
|
|
1364
|
-
|
|
1365
|
-
t:
|
|
1387
|
+
let offsetTop = 0;
|
|
1388
|
+
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({
|
|
1389
|
+
t: offsetTop
|
|
1366
1390
|
});
|
|
1367
1391
|
}
|
|
1368
|
-
|
|
1392
|
+
documentSkeleton.calculate(), this._editAreaProcessing(editorWidth, editorHeight, positionFromEditRectState, canvasOffset, fill, scaleX, scaleY);
|
|
1369
1393
|
}
|
|
1370
1394
|
/**
|
|
1371
1395
|
* Mainly used to pre-calculate the width of the editor,
|
|
1372
1396
|
* to determine whether it needs to be automatically widened.
|
|
1373
1397
|
*/
|
|
1374
|
-
_predictingSize(
|
|
1375
|
-
const { startX
|
|
1376
|
-
if (
|
|
1377
|
-
const { actualWidth
|
|
1398
|
+
_predictingSize(actualRangeWithCoord, canvasOffset, documentSkeleton, documentLayoutObject, scaleX = 1, scaleY = 1) {
|
|
1399
|
+
const { startX, endX } = actualRangeWithCoord, { textRotation, wrapStrategy } = documentLayoutObject, documentDataModel = documentLayoutObject.documentModel, { vertexAngle: angle } = convertTextRotation(textRotation), clientWidth = document.body.clientWidth;
|
|
1400
|
+
if (wrapStrategy === WrapStrategy.WRAP && angle === 0) {
|
|
1401
|
+
const { actualWidth, actualHeight } = documentSkeleton.getActualSize();
|
|
1378
1402
|
return {
|
|
1379
|
-
actualWidth:
|
|
1380
|
-
actualHeight:
|
|
1403
|
+
actualWidth: actualWidth * scaleX,
|
|
1404
|
+
actualHeight: actualHeight * scaleY
|
|
1381
1405
|
};
|
|
1382
1406
|
}
|
|
1383
|
-
|
|
1384
|
-
const
|
|
1385
|
-
let
|
|
1386
|
-
return
|
|
1387
|
-
horizontalAlign:
|
|
1407
|
+
documentDataModel == null || documentDataModel.updateDocumentDataPageSize((clientWidth - startX - canvasOffset.left) / scaleX), documentSkeleton.calculate();
|
|
1408
|
+
const size = documentSkeleton.getActualSize();
|
|
1409
|
+
let editorWidth = endX - startX;
|
|
1410
|
+
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({
|
|
1411
|
+
horizontalAlign: HorizontalAlign.UNSPECIFIED,
|
|
1388
1412
|
cellValueType: void 0
|
|
1389
1413
|
}), {
|
|
1390
|
-
actualWidth:
|
|
1391
|
-
actualHeight:
|
|
1414
|
+
actualWidth: editorWidth,
|
|
1415
|
+
actualHeight: size.actualHeight * scaleY
|
|
1392
1416
|
};
|
|
1393
1417
|
}
|
|
1394
1418
|
/**
|
|
1395
1419
|
* control the size of editing area
|
|
1396
1420
|
*/
|
|
1397
1421
|
// eslint-disable-next-line max-lines-per-function
|
|
1398
|
-
_editAreaProcessing(
|
|
1399
|
-
var
|
|
1400
|
-
const
|
|
1401
|
-
if (
|
|
1422
|
+
_editAreaProcessing(editorWidth, editorHeight, positionFromEditRectState, canvasOffset, fill, scaleX = 1, scaleY = 1) {
|
|
1423
|
+
var _a11;
|
|
1424
|
+
const editorObject = this._getEditorObject();
|
|
1425
|
+
if (editorObject == null)
|
|
1402
1426
|
return;
|
|
1403
|
-
function
|
|
1404
|
-
return Number.parseInt(
|
|
1427
|
+
function pxToNum2(width2) {
|
|
1428
|
+
return Number.parseInt(width2.replace("px", ""));
|
|
1405
1429
|
}
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1430
|
+
__name(pxToNum2, "pxToNum");
|
|
1431
|
+
const canvasElement = this._renderContext.engine.getCanvasElement(), canvasClientRect = canvasElement.getBoundingClientRect(), widthOfCanvas = pxToNum2(canvasElement.style.width), { top, left, width } = canvasClientRect, scaleAdjust = width / widthOfCanvas;
|
|
1432
|
+
let { startX, startY } = positionFromEditRectState;
|
|
1433
|
+
startX += canvasOffset.left, startY += canvasOffset.top;
|
|
1434
|
+
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;
|
|
1435
|
+
let physicHeight = editorHeight, scrollBar = viewportMain == null ? void 0 : viewportMain.getScrollBar();
|
|
1436
|
+
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);
|
|
1437
|
+
const { scaleX: precisionScaleX, scaleY: precisionScaleY } = editorScene.getPrecisionScale();
|
|
1438
|
+
editorScene.transformByState({
|
|
1439
|
+
width: editorWidth * scaleAdjust / scaleX,
|
|
1440
|
+
height: editorHeight * scaleAdjust / scaleY,
|
|
1441
|
+
scaleX: scaleX * scaleAdjust,
|
|
1442
|
+
scaleY: scaleY * scaleAdjust
|
|
1443
|
+
}), documentComponent.resize(editorWidth / scaleX, editorHeight / scaleY), setTimeout(() => {
|
|
1444
|
+
docEngine.resizeBySize(
|
|
1445
|
+
fixLineWidthByScale(editorWidth, precisionScaleX),
|
|
1446
|
+
fixLineWidthByScale(physicHeight, precisionScaleY)
|
|
1422
1447
|
);
|
|
1423
1448
|
}, 0);
|
|
1424
|
-
const
|
|
1425
|
-
|
|
1426
|
-
startX
|
|
1427
|
-
startY
|
|
1428
|
-
endX:
|
|
1429
|
-
endY:
|
|
1449
|
+
const contentBoundingRect = this._layoutService.getContentElement().getBoundingClientRect(), canvasBoundingRect = canvasElement.getBoundingClientRect();
|
|
1450
|
+
startX = startX * scaleAdjust + (canvasBoundingRect.left - contentBoundingRect.left), startY = startY * scaleAdjust + (canvasBoundingRect.top - contentBoundingRect.top), this._cellEditorManagerService.setState({
|
|
1451
|
+
startX,
|
|
1452
|
+
startY,
|
|
1453
|
+
endX: editorWidth * scaleAdjust + startX,
|
|
1454
|
+
endY: physicHeight * scaleAdjust + startY,
|
|
1430
1455
|
show: !0
|
|
1431
1456
|
});
|
|
1432
1457
|
}
|
|
1433
1458
|
/**
|
|
1434
1459
|
* Since the document does not support cell background color, an additional rect needs to be added.
|
|
1435
1460
|
*/
|
|
1436
|
-
_addBackground(
|
|
1437
|
-
const
|
|
1438
|
-
|
|
1461
|
+
_addBackground(scene, editorWidth, editorHeight, fill) {
|
|
1462
|
+
const fillRectKey = "_backgroundRectHelperColor_", rect = scene.getObject(fillRectKey);
|
|
1463
|
+
rect == null && fill == null || (rect == null ? scene.addObjects(
|
|
1439
1464
|
[
|
|
1440
|
-
new
|
|
1441
|
-
width:
|
|
1442
|
-
height:
|
|
1443
|
-
fill
|
|
1465
|
+
new Rect(fillRectKey, {
|
|
1466
|
+
width: editorWidth,
|
|
1467
|
+
height: editorHeight,
|
|
1468
|
+
fill,
|
|
1444
1469
|
evented: !1
|
|
1445
1470
|
})
|
|
1446
1471
|
],
|
|
1447
|
-
|
|
1448
|
-
) :
|
|
1449
|
-
fill
|
|
1450
|
-
}),
|
|
1451
|
-
width:
|
|
1452
|
-
height:
|
|
1472
|
+
DOCS_COMPONENT_MAIN_LAYER_INDEX
|
|
1473
|
+
) : fill == null ? rect.dispose() : (rect.setProps({
|
|
1474
|
+
fill
|
|
1475
|
+
}), rect.transformByState({
|
|
1476
|
+
width: editorWidth,
|
|
1477
|
+
height: editorHeight
|
|
1453
1478
|
})));
|
|
1454
1479
|
}
|
|
1455
1480
|
/**
|
|
@@ -1460,114 +1485,114 @@ let ze = class extends Ue {
|
|
|
1460
1485
|
// handleVisible is the 2nd part of editing.
|
|
1461
1486
|
// first part: startEditing --> _updateEditor
|
|
1462
1487
|
// 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 (
|
|
1488
|
+
_handleEditorVisible(param) {
|
|
1489
|
+
var _a11, _b;
|
|
1490
|
+
const { eventType } = param;
|
|
1491
|
+
this._cursorChange = [DeviceInputEventType.PointerDown, DeviceInputEventType.Dblclick].includes(eventType) ? CursorChange.CursorChange : CursorChange.StartEditor;
|
|
1492
|
+
const editCellState = this._editorBridgeService.getEditRectState();
|
|
1493
|
+
if (editCellState == null)
|
|
1469
1494
|
return;
|
|
1470
1495
|
const {
|
|
1471
|
-
position
|
|
1472
|
-
documentLayoutObject
|
|
1473
|
-
slideCardOffset:
|
|
1474
|
-
scaleX
|
|
1475
|
-
scaleY
|
|
1476
|
-
editorUnitId
|
|
1477
|
-
unitId
|
|
1478
|
-
} =
|
|
1479
|
-
if (
|
|
1496
|
+
position,
|
|
1497
|
+
documentLayoutObject,
|
|
1498
|
+
slideCardOffset: canvasOffset,
|
|
1499
|
+
scaleX,
|
|
1500
|
+
scaleY,
|
|
1501
|
+
editorUnitId,
|
|
1502
|
+
unitId
|
|
1503
|
+
} = editCellState, editorObject = this._getEditorObject();
|
|
1504
|
+
if (editorObject == null)
|
|
1480
1505
|
return;
|
|
1481
|
-
const { scene
|
|
1482
|
-
this._contextService.setContextValue(
|
|
1483
|
-
const { documentModel:
|
|
1484
|
-
if (!
|
|
1506
|
+
const { scene } = editorObject;
|
|
1507
|
+
this._contextService.setContextValue(EDITOR_ACTIVATED, !0);
|
|
1508
|
+
const { documentModel: documentDataModel } = documentLayoutObject, skeleton = this._getEditorSkeleton(editorUnitId);
|
|
1509
|
+
if (!skeleton || !documentDataModel)
|
|
1485
1510
|
return;
|
|
1486
|
-
this._fitTextSize(
|
|
1487
|
-
const
|
|
1488
|
-
(
|
|
1511
|
+
this._fitTextSize(position, canvasOffset, skeleton, documentLayoutObject, scaleX, scaleY);
|
|
1512
|
+
const cursor = documentDataModel.getBody().dataStream.length - 2 || 0;
|
|
1513
|
+
(_a11 = scene.getViewport(VIEWPORT_KEY.VIEW_MAIN)) == null || _a11.scrollToViewportPos({
|
|
1489
1514
|
viewportScrollX: Number.POSITIVE_INFINITY
|
|
1490
1515
|
}), this._textSelectionManagerService.replaceTextRanges([
|
|
1491
1516
|
{
|
|
1492
|
-
startOffset:
|
|
1493
|
-
endOffset:
|
|
1517
|
+
startOffset: cursor,
|
|
1518
|
+
endOffset: cursor
|
|
1494
1519
|
}
|
|
1495
|
-
]), (
|
|
1520
|
+
]), (_b = this._renderManagerService.getRenderById(unitId)) == null || _b.scene.resetCursor();
|
|
1496
1521
|
}
|
|
1497
|
-
_resetBodyStyle(
|
|
1498
|
-
|
|
1522
|
+
_resetBodyStyle(body, removeStyle = !1) {
|
|
1523
|
+
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
1524
|
{
|
|
1500
1525
|
startIndex: 0
|
|
1501
1526
|
}
|
|
1502
|
-
]),
|
|
1527
|
+
]), 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
1528
|
}
|
|
1504
1529
|
/**
|
|
1505
1530
|
* Should activate the editor when the user inputs text.
|
|
1506
1531
|
* @param d DisposableCollection
|
|
1507
1532
|
*/
|
|
1508
|
-
_initialKeyboardListener(
|
|
1533
|
+
_initialKeyboardListener(d) {
|
|
1509
1534
|
}
|
|
1510
|
-
_showEditorByKeyboard(
|
|
1535
|
+
_showEditorByKeyboard(config) {
|
|
1511
1536
|
}
|
|
1512
|
-
_commandExecutedListener(
|
|
1513
|
-
const
|
|
1514
|
-
|
|
1515
|
-
this._editorService.getFocusId() ===
|
|
1537
|
+
_commandExecutedListener(d) {
|
|
1538
|
+
const moveCursorOP = [SetTextEditArrowOperation.id], editedMutations = [RichTextEditingMutation.id];
|
|
1539
|
+
d.add(this._commandService.onCommandExecuted((command) => {
|
|
1540
|
+
this._editorService.getFocusId() === SLIDE_EDITOR_ID && (moveCursorOP.includes(command.id) && this._moveCursorCmdHandler(command), editedMutations.includes(command.id) && this._editorBridgeService.isVisible() && this._editingChangedHandler());
|
|
1516
1541
|
}));
|
|
1517
1542
|
}
|
|
1518
|
-
_moveCursorCmdHandler(
|
|
1519
|
-
const
|
|
1520
|
-
|
|
1543
|
+
_moveCursorCmdHandler(command) {
|
|
1544
|
+
const params = command.params, { keycode, isShift } = params;
|
|
1545
|
+
keycode != null && this._cursorChange === CursorChange.CursorChange ? this._moveInEditor(keycode, isShift) : this._editorBridgeService.changeVisible(params);
|
|
1521
1546
|
}
|
|
1522
1547
|
_editingChangedHandler() {
|
|
1523
|
-
const
|
|
1524
|
-
if (!
|
|
1548
|
+
const editRect = this._editorBridgeService.getEditorRect();
|
|
1549
|
+
if (!editRect)
|
|
1525
1550
|
return;
|
|
1526
|
-
const
|
|
1527
|
-
|
|
1528
|
-
const { unitId
|
|
1529
|
-
this._handleEditorVisible({ visible: !0, eventType: 3, unitId
|
|
1551
|
+
const editingRichText = editRect.richTextObj;
|
|
1552
|
+
editingRichText.refreshDocumentByDocData(), editingRichText.resizeToContentSize();
|
|
1553
|
+
const { unitId } = this._renderContext;
|
|
1554
|
+
this._handleEditorVisible({ visible: !0, eventType: 3, unitId });
|
|
1530
1555
|
}
|
|
1531
1556
|
_getEditorObject() {
|
|
1532
|
-
return
|
|
1557
|
+
return getEditorObject(this._editorBridgeService.getCurrentEditorId(), this._renderManagerService);
|
|
1533
1558
|
}
|
|
1534
|
-
async _handleEditorInvisible(
|
|
1535
|
-
const { keycode
|
|
1536
|
-
if (this._cursorChange =
|
|
1559
|
+
async _handleEditorInvisible(param) {
|
|
1560
|
+
const { keycode } = param;
|
|
1561
|
+
if (this._cursorChange = CursorChange.InitialState, this._exitInput(param), this._editorBridgeService.getEditRectState() == null)
|
|
1537
1562
|
return;
|
|
1538
1563
|
if (this._editorBridgeService.getEditorDirty() === !1) {
|
|
1539
|
-
this._moveCursor(
|
|
1564
|
+
this._moveCursor(keycode);
|
|
1540
1565
|
return;
|
|
1541
1566
|
}
|
|
1542
|
-
this._moveCursor(
|
|
1567
|
+
this._moveCursor(keycode);
|
|
1543
1568
|
}
|
|
1544
|
-
_exitInput(
|
|
1545
|
-
this._contextService.setContextValue(
|
|
1546
|
-
show:
|
|
1569
|
+
_exitInput(param) {
|
|
1570
|
+
this._contextService.setContextValue(EDITOR_ACTIVATED, !1), this._cellEditorManagerService.setState({
|
|
1571
|
+
show: param.visible
|
|
1547
1572
|
});
|
|
1548
|
-
const
|
|
1549
|
-
|
|
1550
|
-
}
|
|
1551
|
-
_moveCursor(
|
|
1552
|
-
if (
|
|
1553
|
-
switch (
|
|
1554
|
-
case
|
|
1555
|
-
|
|
1573
|
+
const editorUnitId = this._editorBridgeService.getCurrentEditorId();
|
|
1574
|
+
editorUnitId != null && this._undoRedoService.clearUndoRedo(editorUnitId);
|
|
1575
|
+
}
|
|
1576
|
+
_moveCursor(keycode) {
|
|
1577
|
+
if (keycode != null)
|
|
1578
|
+
switch (Direction.LEFT, keycode) {
|
|
1579
|
+
case KeyCode.ENTER:
|
|
1580
|
+
Direction.DOWN;
|
|
1556
1581
|
break;
|
|
1557
|
-
case
|
|
1558
|
-
|
|
1582
|
+
case KeyCode.TAB:
|
|
1583
|
+
Direction.RIGHT;
|
|
1559
1584
|
break;
|
|
1560
|
-
case
|
|
1561
|
-
|
|
1585
|
+
case KeyCode.ARROW_DOWN:
|
|
1586
|
+
Direction.DOWN;
|
|
1562
1587
|
break;
|
|
1563
|
-
case
|
|
1564
|
-
|
|
1588
|
+
case KeyCode.ARROW_UP:
|
|
1589
|
+
Direction.UP;
|
|
1565
1590
|
break;
|
|
1566
|
-
case
|
|
1567
|
-
|
|
1591
|
+
case KeyCode.ARROW_LEFT:
|
|
1592
|
+
Direction.LEFT;
|
|
1568
1593
|
break;
|
|
1569
|
-
case
|
|
1570
|
-
|
|
1594
|
+
case KeyCode.ARROW_RIGHT:
|
|
1595
|
+
Direction.RIGHT;
|
|
1571
1596
|
break;
|
|
1572
1597
|
}
|
|
1573
1598
|
}
|
|
@@ -1575,59 +1600,60 @@ let ze = class extends Ue {
|
|
|
1575
1600
|
* The user's operations follow the sequence of opening the editor and then moving the cursor.
|
|
1576
1601
|
* The logic here predicts the user's first cursor movement behavior based on this rule
|
|
1577
1602
|
*/
|
|
1578
|
-
_cursorStateListener(
|
|
1579
|
-
const
|
|
1580
|
-
if (!
|
|
1603
|
+
_cursorStateListener(d) {
|
|
1604
|
+
const editorObject = this._getEditorObject();
|
|
1605
|
+
if (!editorObject)
|
|
1581
1606
|
return;
|
|
1582
|
-
const { document:
|
|
1583
|
-
|
|
1584
|
-
this._cursorChange ===
|
|
1607
|
+
const { document: documentComponent } = editorObject;
|
|
1608
|
+
d.add(toDisposable(documentComponent.onPointerDown$.subscribeEvent(() => {
|
|
1609
|
+
this._cursorChange === CursorChange.StartEditor && (this._cursorChange = CursorChange.CursorChange);
|
|
1585
1610
|
})));
|
|
1586
1611
|
}
|
|
1587
1612
|
// TODO: @JOCS, is it necessary to move these commands MoveSelectionOperation\MoveCursorOperation to shortcut? and use multi-commands?
|
|
1588
|
-
_moveInEditor(
|
|
1589
|
-
let
|
|
1590
|
-
|
|
1591
|
-
direction
|
|
1592
|
-
}) : this._commandService.executeCommand(
|
|
1593
|
-
direction
|
|
1613
|
+
_moveInEditor(keycode, isShift) {
|
|
1614
|
+
let direction = Direction.LEFT;
|
|
1615
|
+
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, {
|
|
1616
|
+
direction
|
|
1617
|
+
}) : this._commandService.executeCommand(MoveCursorOperation.id, {
|
|
1618
|
+
direction
|
|
1594
1619
|
});
|
|
1595
1620
|
}
|
|
1596
|
-
};
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
],
|
|
1610
|
-
function
|
|
1611
|
-
if (
|
|
1621
|
+
}, __name(_a6, "SlideEditingRenderController"), _a6);
|
|
1622
|
+
SlideEditingRenderController = __decorateClass$4([
|
|
1623
|
+
__decorateParam$4(1, ILayoutService),
|
|
1624
|
+
__decorateParam$4(2, IUndoRedoService),
|
|
1625
|
+
__decorateParam$4(3, IContextService),
|
|
1626
|
+
__decorateParam$4(4, IUniverInstanceService),
|
|
1627
|
+
__decorateParam$4(5, IRenderManagerService),
|
|
1628
|
+
__decorateParam$4(6, ISlideEditorBridgeService),
|
|
1629
|
+
__decorateParam$4(7, ISlideEditorManagerService),
|
|
1630
|
+
__decorateParam$4(8, Inject(DocSelectionManagerService)),
|
|
1631
|
+
__decorateParam$4(9, ICommandService),
|
|
1632
|
+
__decorateParam$4(10, Inject(LocaleService)),
|
|
1633
|
+
__decorateParam$4(11, IEditorService)
|
|
1634
|
+
], SlideEditingRenderController);
|
|
1635
|
+
function getEditorObject(unitId, renderManagerService) {
|
|
1636
|
+
if (unitId == null)
|
|
1612
1637
|
return;
|
|
1613
|
-
const
|
|
1614
|
-
if (
|
|
1638
|
+
const currentRender = renderManagerService.getRenderById(unitId);
|
|
1639
|
+
if (currentRender == null)
|
|
1615
1640
|
return;
|
|
1616
|
-
const { mainComponent
|
|
1641
|
+
const { mainComponent, scene, engine, components } = currentRender, document2 = mainComponent, docBackground = components.get(DOCS_VIEW_KEY.BACKGROUND);
|
|
1617
1642
|
return {
|
|
1618
|
-
document:
|
|
1619
|
-
docBackground
|
|
1620
|
-
scene
|
|
1621
|
-
engine
|
|
1643
|
+
document: document2,
|
|
1644
|
+
docBackground,
|
|
1645
|
+
scene,
|
|
1646
|
+
engine
|
|
1622
1647
|
};
|
|
1623
1648
|
}
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1649
|
+
__name(getEditorObject, "getEditorObject");
|
|
1650
|
+
var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
1651
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
1652
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
1653
|
+
return kind && result && __defProp$3(target, key, result), result;
|
|
1654
|
+
}, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3"), _a7;
|
|
1655
|
+
let SlideEditorBridgeRenderController = (_a7 = class extends RxDisposable {
|
|
1656
|
+
constructor(_renderContext, _instanceSrv, _commandService, _editorBridgeService) {
|
|
1631
1657
|
super();
|
|
1632
1658
|
/**
|
|
1633
1659
|
* It is used to distinguish whether the user has actively moved the cursor in the editor, mainly through mouse clicks.
|
|
@@ -1635,54 +1661,54 @@ let We = class extends fe {
|
|
|
1635
1661
|
// private _cursorChange: CursorChange = CursorChange.InitialState;
|
|
1636
1662
|
/** If the corresponding unit is active and prepared for editing. */
|
|
1637
1663
|
// private _isUnitEditing = false;
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
this._renderContext =
|
|
1642
|
-
|
|
1664
|
+
__publicField(this, "setSlideTextEditor$", new Subject());
|
|
1665
|
+
__publicField(this, "_curRichText", null);
|
|
1666
|
+
__publicField(this, "_d");
|
|
1667
|
+
this._renderContext = _renderContext, this._instanceSrv = _instanceSrv, this._commandService = _commandService, this._editorBridgeService = _editorBridgeService, this.disposeWithMe(this._instanceSrv.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SLIDE).subscribe((slideDataModel) => {
|
|
1668
|
+
slideDataModel && slideDataModel.getUnitId() === this._renderContext.unitId ? this._d = this._init() : this._disposeCurrent();
|
|
1643
1669
|
}));
|
|
1644
1670
|
}
|
|
1645
1671
|
_init() {
|
|
1646
|
-
const
|
|
1647
|
-
return this._initEventListener(
|
|
1672
|
+
const d = new DisposableCollection();
|
|
1673
|
+
return this._initEventListener(d), d;
|
|
1648
1674
|
}
|
|
1649
1675
|
_disposeCurrent() {
|
|
1650
|
-
var
|
|
1651
|
-
(
|
|
1652
|
-
}
|
|
1653
|
-
_setEditorRect(
|
|
1654
|
-
this._curRichText =
|
|
1655
|
-
const { scene
|
|
1656
|
-
scene
|
|
1657
|
-
engine
|
|
1658
|
-
unitId
|
|
1659
|
-
pageId
|
|
1660
|
-
richTextObj:
|
|
1676
|
+
var _a11;
|
|
1677
|
+
(_a11 = this._d) == null || _a11.dispose(), this._d = null;
|
|
1678
|
+
}
|
|
1679
|
+
_setEditorRect(pageId, targetObject) {
|
|
1680
|
+
this._curRichText = targetObject;
|
|
1681
|
+
const { scene, engine } = this._renderContext, unitId = this._renderContext.unitId, setEditorRect = {
|
|
1682
|
+
scene,
|
|
1683
|
+
engine,
|
|
1684
|
+
unitId,
|
|
1685
|
+
pageId,
|
|
1686
|
+
richTextObj: targetObject
|
|
1661
1687
|
};
|
|
1662
|
-
this._editorBridgeService.setEditorRect(
|
|
1688
|
+
this._editorBridgeService.setEditorRect(setEditorRect);
|
|
1663
1689
|
}
|
|
1664
|
-
_initEventListener(
|
|
1665
|
-
const
|
|
1666
|
-
const
|
|
1667
|
-
|
|
1690
|
+
_initEventListener(d) {
|
|
1691
|
+
const listenersForPageScene = /* @__PURE__ */ __name((scene) => {
|
|
1692
|
+
const transformer = scene.getTransformer();
|
|
1693
|
+
transformer && (d.add(transformer.clearControl$.subscribe(() => {
|
|
1668
1694
|
this.setEditorVisible(!1), this.pickOtherObjects();
|
|
1669
|
-
})),
|
|
1695
|
+
})), d.add(transformer.createControl$.subscribe(() => {
|
|
1670
1696
|
this.setEditorVisible(!1);
|
|
1671
|
-
})),
|
|
1672
|
-
|
|
1673
|
-
const
|
|
1674
|
-
|
|
1675
|
-
})),
|
|
1697
|
+
})), d.add(scene.onDblclick$.subscribeEvent(() => {
|
|
1698
|
+
transformer.clearControls();
|
|
1699
|
+
const object = transformer.getSelectedObjectMap().values().next().value;
|
|
1700
|
+
object && (object.objectType !== ObjectType.RICH_TEXT ? this.pickOtherObjects() : this.startEditing(scene.sceneKey, object));
|
|
1701
|
+
})), d.add(this._instanceSrv.focused$.subscribe((fc) => {
|
|
1676
1702
|
this.endEditing();
|
|
1677
1703
|
})));
|
|
1678
|
-
}, { mainComponent
|
|
1679
|
-
|
|
1680
|
-
|
|
1704
|
+
}, "listenersForPageScene"), { mainComponent } = this._renderContext;
|
|
1705
|
+
mainComponent.subSceneChanged$.subscribeEvent((pageScene) => {
|
|
1706
|
+
listenersForPageScene(pageScene);
|
|
1681
1707
|
});
|
|
1682
|
-
const
|
|
1683
|
-
for (let
|
|
1684
|
-
const
|
|
1685
|
-
|
|
1708
|
+
const pageSceneList = Array.from(mainComponent.getSubScenes().values());
|
|
1709
|
+
for (let i = 0; i < pageSceneList.length; i++) {
|
|
1710
|
+
const pageScene = pageSceneList[i];
|
|
1711
|
+
listenersForPageScene(pageScene);
|
|
1686
1712
|
}
|
|
1687
1713
|
}
|
|
1688
1714
|
pickOtherObjects() {
|
|
@@ -1694,26 +1720,26 @@ let We = class extends fe {
|
|
|
1694
1720
|
* save editing state to curr richText.
|
|
1695
1721
|
*/
|
|
1696
1722
|
endEditing() {
|
|
1697
|
-
var
|
|
1723
|
+
var _a11;
|
|
1698
1724
|
if (!this._curRichText) return;
|
|
1699
1725
|
this.setEditorVisible(!1);
|
|
1700
|
-
const
|
|
1701
|
-
if (!this._instanceSrv.getCurrentUnitForType(
|
|
1702
|
-
|
|
1703
|
-
const
|
|
1726
|
+
const curRichText = this._curRichText;
|
|
1727
|
+
if (!this._instanceSrv.getCurrentUnitForType(UniverInstanceType.UNIVER_SLIDE)) return !1;
|
|
1728
|
+
curRichText.refreshDocumentByDocData(), curRichText.resizeToContentSize(), this._editorBridgeService.endEditing$.next(curRichText);
|
|
1729
|
+
const richText = {
|
|
1704
1730
|
bl: 1,
|
|
1705
|
-
fs:
|
|
1706
|
-
text:
|
|
1707
|
-
},
|
|
1708
|
-
if (
|
|
1709
|
-
const
|
|
1710
|
-
|
|
1731
|
+
fs: curRichText.fs,
|
|
1732
|
+
text: curRichText.text
|
|
1733
|
+
}, textRuns = (_a11 = curRichText.documentData.body) == null ? void 0 : _a11.textRuns;
|
|
1734
|
+
if (textRuns && textRuns.length) {
|
|
1735
|
+
const ts = textRuns[0].ts;
|
|
1736
|
+
richText.cl = ts == null ? void 0 : ts.cl;
|
|
1711
1737
|
}
|
|
1712
|
-
this._commandService.executeCommand(
|
|
1738
|
+
this._commandService.executeCommand(UpdateSlideElementOperation.id, {
|
|
1713
1739
|
unitId: this._renderContext.unitId,
|
|
1714
|
-
oKey:
|
|
1740
|
+
oKey: curRichText == null ? void 0 : curRichText.oKey,
|
|
1715
1741
|
props: {
|
|
1716
|
-
richText
|
|
1742
|
+
richText
|
|
1717
1743
|
}
|
|
1718
1744
|
}), this._curRichText = null;
|
|
1719
1745
|
}
|
|
@@ -1724,106 +1750,106 @@ let We = class extends fe {
|
|
|
1724
1750
|
* TODO @lumixraku need scale param
|
|
1725
1751
|
* @param target
|
|
1726
1752
|
*/
|
|
1727
|
-
startEditing(
|
|
1728
|
-
this._setEditorRect(
|
|
1729
|
-
}
|
|
1730
|
-
setEditorVisible(
|
|
1731
|
-
var
|
|
1732
|
-
|
|
1733
|
-
const { unitId
|
|
1734
|
-
this._editorBridgeService.changeVisible({ visible
|
|
1735
|
-
}
|
|
1736
|
-
};
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
],
|
|
1742
|
-
const
|
|
1753
|
+
startEditing(pageId, target) {
|
|
1754
|
+
this._setEditorRect(pageId, target), this.setEditorVisible(!0);
|
|
1755
|
+
}
|
|
1756
|
+
setEditorVisible(visible) {
|
|
1757
|
+
var _a11, _b;
|
|
1758
|
+
visible ? (_a11 = this._curRichText) == null || _a11.hide() : (_b = this._curRichText) == null || _b.show();
|
|
1759
|
+
const { unitId } = this._renderContext;
|
|
1760
|
+
this._editorBridgeService.changeVisible({ visible, eventType: DeviceInputEventType.PointerDown, unitId });
|
|
1761
|
+
}
|
|
1762
|
+
}, __name(_a7, "SlideEditorBridgeRenderController"), _a7);
|
|
1763
|
+
SlideEditorBridgeRenderController = __decorateClass$3([
|
|
1764
|
+
__decorateParam$3(1, IUniverInstanceService),
|
|
1765
|
+
__decorateParam$3(2, ICommandService),
|
|
1766
|
+
__decorateParam$3(3, ISlideEditorBridgeService)
|
|
1767
|
+
], SlideEditorBridgeRenderController);
|
|
1768
|
+
const ActivateSlidePageOperation = {
|
|
1743
1769
|
id: "slide.operation.activate-slide",
|
|
1744
|
-
type:
|
|
1745
|
-
handler: (
|
|
1746
|
-
var
|
|
1747
|
-
const
|
|
1748
|
-
if (!
|
|
1749
|
-
const
|
|
1750
|
-
if (!
|
|
1751
|
-
const
|
|
1752
|
-
return
|
|
1753
|
-
}
|
|
1754
|
-
},
|
|
1770
|
+
type: CommandType.OPERATION,
|
|
1771
|
+
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
1772
|
+
var _a11, _b;
|
|
1773
|
+
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;
|
|
1774
|
+
if (!pageId) return !1;
|
|
1775
|
+
const page = canvasView.getRenderUnitByPageId(pageId, unitId);
|
|
1776
|
+
if (!page) return !1;
|
|
1777
|
+
const transformer = (_b = page.scene) == null ? void 0 : _b.getTransformer();
|
|
1778
|
+
return transformer && transformer.clearControls(), canvasView.activePage(params.id, unitId), !0;
|
|
1779
|
+
}, "handler")
|
|
1780
|
+
}, AppendSlideOperation = {
|
|
1755
1781
|
id: "slide.operation.append-slide",
|
|
1756
|
-
type:
|
|
1757
|
-
handler: (
|
|
1758
|
-
const
|
|
1759
|
-
return
|
|
1760
|
-
}
|
|
1761
|
-
},
|
|
1782
|
+
type: CommandType.OPERATION,
|
|
1783
|
+
handler: /* @__PURE__ */ __name((accessor, params) => {
|
|
1784
|
+
const unitId = params.unitId;
|
|
1785
|
+
return accessor.get(IUniverInstanceService).getUnit(unitId) ? (accessor.get(CanvasView).appendPage(unitId), !0) : !1;
|
|
1786
|
+
}, "handler")
|
|
1787
|
+
}, InsertSlideFloatImageCommand = {
|
|
1762
1788
|
id: "slide.command.insert-float-image",
|
|
1763
|
-
type:
|
|
1764
|
-
handler: async (
|
|
1765
|
-
var
|
|
1766
|
-
const
|
|
1767
|
-
if (!
|
|
1768
|
-
const
|
|
1789
|
+
type: CommandType.COMMAND,
|
|
1790
|
+
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
1791
|
+
var _a11;
|
|
1792
|
+
const univerInstanceService = accessor.get(IUniverInstanceService), unitId = (_a11 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SLIDE)) == null ? void 0 : _a11.getUnitId();
|
|
1793
|
+
if (!unitId) return !1;
|
|
1794
|
+
const files = await accessor.get(ILocalFileService).openFile({
|
|
1769
1795
|
multiple: !0,
|
|
1770
|
-
accept:
|
|
1796
|
+
accept: DRAWING_IMAGE_ALLOW_IMAGE_LIST.map((image2) => `.${image2.replace("image/", "")}`).join(",")
|
|
1771
1797
|
});
|
|
1772
|
-
if (
|
|
1773
|
-
const
|
|
1774
|
-
if (!
|
|
1775
|
-
const { imageId
|
|
1776
|
-
if (!
|
|
1777
|
-
const
|
|
1778
|
-
id:
|
|
1779
|
-
zIndex:
|
|
1798
|
+
if (files.length !== 1) return !1;
|
|
1799
|
+
const imageParam = await accessor.get(IImageIoService).saveImage(files[0]);
|
|
1800
|
+
if (!imageParam) return !1;
|
|
1801
|
+
const { imageId, imageSourceType, source, base64Cache } = imageParam, { width, height, image } = await getImageSize(base64Cache || ""), slideData = univerInstanceService.getUnit(unitId);
|
|
1802
|
+
if (!slideData) return !1;
|
|
1803
|
+
const activePage = slideData.getActivePage(), elements = Object.values(activePage.pageElements), maxIndex = elements != null && elements.length ? Math.max(...elements.map((element2) => element2.zIndex)) : 20, data = {
|
|
1804
|
+
id: imageId,
|
|
1805
|
+
zIndex: maxIndex + 1,
|
|
1780
1806
|
left: 0,
|
|
1781
1807
|
top: 0,
|
|
1782
|
-
width
|
|
1783
|
-
height
|
|
1808
|
+
width,
|
|
1809
|
+
height,
|
|
1784
1810
|
title: "",
|
|
1785
1811
|
description: "",
|
|
1786
|
-
type:
|
|
1812
|
+
type: PageElementType.IMAGE,
|
|
1787
1813
|
image: {
|
|
1788
1814
|
imageProperties: {
|
|
1789
|
-
contentUrl:
|
|
1790
|
-
imageSourceType
|
|
1791
|
-
source
|
|
1792
|
-
base64Cache
|
|
1793
|
-
image
|
|
1815
|
+
contentUrl: base64Cache,
|
|
1816
|
+
imageSourceType,
|
|
1817
|
+
source,
|
|
1818
|
+
base64Cache,
|
|
1819
|
+
image
|
|
1794
1820
|
}
|
|
1795
1821
|
}
|
|
1796
1822
|
};
|
|
1797
|
-
|
|
1798
|
-
const
|
|
1799
|
-
return
|
|
1800
|
-
}
|
|
1801
|
-
},
|
|
1823
|
+
activePage.pageElements[imageId] = data, slideData.updatePage(activePage.id, activePage);
|
|
1824
|
+
const canvasView = accessor.get(CanvasView), sceneObject = canvasView.createObjectToPage(data, activePage.id, unitId);
|
|
1825
|
+
return sceneObject && canvasView.setObjectActiveByPage(sceneObject, activePage.id, unitId), !0;
|
|
1826
|
+
}, "handler")
|
|
1827
|
+
}, SlideAddTextCommand = {
|
|
1802
1828
|
id: "slide.command.add-text",
|
|
1803
|
-
type:
|
|
1804
|
-
handler: async (
|
|
1805
|
-
var
|
|
1806
|
-
const
|
|
1807
|
-
return await
|
|
1808
|
-
}
|
|
1809
|
-
},
|
|
1829
|
+
type: CommandType.COMMAND,
|
|
1830
|
+
handler: /* @__PURE__ */ __name(async (accessor) => {
|
|
1831
|
+
var _a11;
|
|
1832
|
+
const commandService = accessor.get(ICommandService), unitId = (_a11 = accessor.get(IUniverInstanceService).getFocusedUnit()) == null ? void 0 : _a11.getUnitId();
|
|
1833
|
+
return await commandService.executeCommand(SlideAddTextOperation.id, { unitId });
|
|
1834
|
+
}, "handler")
|
|
1835
|
+
}, SlideAddTextOperation = {
|
|
1810
1836
|
id: "slide.operation.add-text",
|
|
1811
|
-
type:
|
|
1812
|
-
handler: async (
|
|
1813
|
-
const
|
|
1814
|
-
if (!
|
|
1815
|
-
const
|
|
1816
|
-
id:
|
|
1817
|
-
zIndex:
|
|
1818
|
-
left
|
|
1819
|
-
top
|
|
1820
|
-
width:
|
|
1821
|
-
height:
|
|
1837
|
+
type: CommandType.OPERATION,
|
|
1838
|
+
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
1839
|
+
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);
|
|
1840
|
+
if (!slideData) return !1;
|
|
1841
|
+
const activePage = slideData.getActivePage(), elements = Object.values(activePage.pageElements), maxIndex = elements != null && elements.length ? Math.max(...elements.map((element2) => element2.zIndex)) : 21, elementData = {
|
|
1842
|
+
id: elementId,
|
|
1843
|
+
zIndex: maxIndex + 1,
|
|
1844
|
+
left,
|
|
1845
|
+
top,
|
|
1846
|
+
width: defaultWidth,
|
|
1847
|
+
height: defaultheight,
|
|
1822
1848
|
title: "text",
|
|
1823
1849
|
description: "",
|
|
1824
|
-
type:
|
|
1850
|
+
type: PageElementType.TEXT,
|
|
1825
1851
|
richText: {
|
|
1826
|
-
text:
|
|
1852
|
+
text: textContent,
|
|
1827
1853
|
fs: 30,
|
|
1828
1854
|
cl: {
|
|
1829
1855
|
rgb: "rgb(51, 51, 51)"
|
|
@@ -1831,72 +1857,72 @@ const Jt = {
|
|
|
1831
1857
|
bl: 1
|
|
1832
1858
|
}
|
|
1833
1859
|
};
|
|
1834
|
-
|
|
1835
|
-
const
|
|
1836
|
-
return
|
|
1837
|
-
}
|
|
1838
|
-
},
|
|
1860
|
+
activePage.pageElements[elementId] = elementData, slideData.updatePage(activePage.id, activePage);
|
|
1861
|
+
const canvasview = accessor.get(CanvasView), sceneObject = canvasview.createObjectToPage(elementData, activePage.id, unitId);
|
|
1862
|
+
return sceneObject && canvasview.setObjectActiveByPage(sceneObject, activePage.id, unitId), !0;
|
|
1863
|
+
}, "handler")
|
|
1864
|
+
}, SetSlidePageThumbOperation = {
|
|
1839
1865
|
id: "slide.operation.set-slide-page-thumb",
|
|
1840
|
-
type:
|
|
1841
|
-
handler: (
|
|
1842
|
-
},
|
|
1843
|
-
imagePopupMenu
|
|
1844
|
-
imagePopupMenuItem
|
|
1845
|
-
imagePopupMenuItemIcon
|
|
1846
|
-
imagePopupMenuItemTitle
|
|
1847
|
-
imagePopupMenuItemHide
|
|
1848
|
-
btnContainer
|
|
1849
|
-
btnContainerExpand
|
|
1850
|
-
},
|
|
1851
|
-
var
|
|
1852
|
-
const
|
|
1853
|
-
if (!
|
|
1866
|
+
type: CommandType.OPERATION,
|
|
1867
|
+
handler: /* @__PURE__ */ __name((accessor, params) => (accessor.get(CanvasView).createThumbs(params.unitId), !0), "handler")
|
|
1868
|
+
}, 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 = {
|
|
1869
|
+
imagePopupMenu,
|
|
1870
|
+
imagePopupMenuItem,
|
|
1871
|
+
imagePopupMenuItemIcon,
|
|
1872
|
+
imagePopupMenuItemTitle,
|
|
1873
|
+
imagePopupMenuItemHide,
|
|
1874
|
+
btnContainer,
|
|
1875
|
+
btnContainerExpand
|
|
1876
|
+
}, SlideImagePopupMenu = /* @__PURE__ */ __name((props) => {
|
|
1877
|
+
var _a11, _b;
|
|
1878
|
+
const menuItems = (_b = (_a11 = props.popup) == null ? void 0 : _a11.extraProps) == null ? void 0 : _b.menuItems;
|
|
1879
|
+
if (!menuItems)
|
|
1854
1880
|
return null;
|
|
1855
|
-
const
|
|
1856
|
-
|
|
1857
|
-
},
|
|
1858
|
-
|
|
1859
|
-
},
|
|
1860
|
-
|
|
1861
|
-
},
|
|
1862
|
-
|
|
1863
|
-
},
|
|
1864
|
-
return /* @__PURE__ */
|
|
1881
|
+
const commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), [visible, setVisible] = useState(!1), [isHovered, setHovered] = useState(!1), handleMouseEnter = /* @__PURE__ */ __name(() => {
|
|
1882
|
+
setHovered(!0);
|
|
1883
|
+
}, "handleMouseEnter"), handleMouseLeave = /* @__PURE__ */ __name(() => {
|
|
1884
|
+
setHovered(!1);
|
|
1885
|
+
}, "handleMouseLeave"), onVisibleChange = /* @__PURE__ */ __name((visible2) => {
|
|
1886
|
+
setVisible(visible2);
|
|
1887
|
+
}, "onVisibleChange"), handleClick = /* @__PURE__ */ __name((item) => {
|
|
1888
|
+
commandService.executeCommand(item.commandId, item.commandParams), setVisible(!1);
|
|
1889
|
+
}, "handleClick"), showMore = visible || isHovered, availableMenu = menuItems.filter((item) => !item.disable);
|
|
1890
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1865
1891
|
"div",
|
|
1866
1892
|
{
|
|
1867
|
-
onMouseEnter:
|
|
1868
|
-
onMouseLeave:
|
|
1869
|
-
children: /* @__PURE__ */
|
|
1870
|
-
|
|
1893
|
+
onMouseEnter: handleMouseEnter,
|
|
1894
|
+
onMouseLeave: handleMouseLeave,
|
|
1895
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1896
|
+
DropdownLegacy,
|
|
1871
1897
|
{
|
|
1872
1898
|
placement: "bottomLeft",
|
|
1873
1899
|
trigger: ["click"],
|
|
1874
|
-
overlay: /* @__PURE__ */
|
|
1900
|
+
overlay: /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: styles$2.imagePopupMenu, children: availableMenu.map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1875
1901
|
"li",
|
|
1876
1902
|
{
|
|
1877
|
-
onClick: () =>
|
|
1878
|
-
className:
|
|
1879
|
-
children: /* @__PURE__ */
|
|
1903
|
+
onClick: /* @__PURE__ */ __name(() => handleClick(item), "onClick"),
|
|
1904
|
+
className: styles$2.imagePopupMenuItem,
|
|
1905
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: styles$2.imagePopupMenuItemTitle, children: localeService.t(item.label) })
|
|
1880
1906
|
},
|
|
1881
|
-
|
|
1907
|
+
item.index
|
|
1882
1908
|
)) }),
|
|
1883
|
-
visible
|
|
1884
|
-
onVisibleChange
|
|
1885
|
-
children: /* @__PURE__ */
|
|
1909
|
+
visible,
|
|
1910
|
+
onVisibleChange,
|
|
1911
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
1886
1912
|
"div",
|
|
1887
1913
|
{
|
|
1888
|
-
className:
|
|
1889
|
-
[
|
|
1914
|
+
className: clsx(styles$2.btnContainer, {
|
|
1915
|
+
[styles$2.btnContainerExpand]: visible
|
|
1890
1916
|
}),
|
|
1891
1917
|
children: [
|
|
1892
|
-
/* @__PURE__ */
|
|
1893
|
-
|
|
1918
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1919
|
+
Autofill,
|
|
1894
1920
|
{
|
|
1895
1921
|
style: { color: "#35322B" },
|
|
1896
1922
|
extend: { colorChannel1: "rgb(var(--green-700, #409f11))" }
|
|
1897
1923
|
}
|
|
1898
1924
|
),
|
|
1899
|
-
|
|
1925
|
+
showMore && /* @__PURE__ */ jsxRuntimeExports.jsx(MoreDownSingle, { style: { color: "#CCCCCC", fontSize: "8px", marginLeft: "8px" } })
|
|
1900
1926
|
]
|
|
1901
1927
|
}
|
|
1902
1928
|
)
|
|
@@ -1904,427 +1930,436 @@ const Jt = {
|
|
|
1904
1930
|
)
|
|
1905
1931
|
}
|
|
1906
1932
|
);
|
|
1907
|
-
},
|
|
1908
|
-
slideBar
|
|
1909
|
-
slideBarContent
|
|
1910
|
-
slideBarContentHeader
|
|
1911
|
-
slideBarItem
|
|
1912
|
-
slideBarBox
|
|
1913
|
-
slideBarItemActive
|
|
1914
|
-
slideAddButton
|
|
1933
|
+
}, "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 = {
|
|
1934
|
+
slideBar,
|
|
1935
|
+
slideBarContent,
|
|
1936
|
+
slideBarContentHeader,
|
|
1937
|
+
slideBarItem,
|
|
1938
|
+
slideBarBox,
|
|
1939
|
+
slideBarItemActive,
|
|
1940
|
+
slideAddButton
|
|
1915
1941
|
};
|
|
1916
|
-
function
|
|
1917
|
-
var
|
|
1918
|
-
const
|
|
1919
|
-
if (!
|
|
1942
|
+
function SlideSideBar() {
|
|
1943
|
+
var _a11, _b;
|
|
1944
|
+
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();
|
|
1945
|
+
if (!pages || !pageOrder)
|
|
1920
1946
|
return null;
|
|
1921
|
-
const
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
}, [
|
|
1925
|
-
const
|
|
1926
|
-
var
|
|
1927
|
-
const
|
|
1928
|
-
|
|
1947
|
+
const slideList = pageOrder.map((id) => pages[id]), [divRefs, setDivRefs] = useState([]), [activatePageId, setActivatePageId] = useState((_b = (_a11 = currentSlide == null ? void 0 : currentSlide.getActivePage()) == null ? void 0 : _a11.id) != null ? _b : null);
|
|
1948
|
+
useEffect(() => {
|
|
1949
|
+
setDivRefs(slideList.map((_) => React.createRef()));
|
|
1950
|
+
}, [slideList.length]), useEffect(() => {
|
|
1951
|
+
const subscriber = currentSlide == null ? void 0 : currentSlide.activePage$.subscribe((page) => {
|
|
1952
|
+
var _a12;
|
|
1953
|
+
const id = (_a12 = page == null ? void 0 : page.id) != null ? _a12 : null;
|
|
1954
|
+
id && setActivatePageId(id);
|
|
1929
1955
|
});
|
|
1930
1956
|
return () => {
|
|
1931
|
-
|
|
1957
|
+
subscriber == null || subscriber.unsubscribe();
|
|
1932
1958
|
};
|
|
1933
|
-
}, []),
|
|
1934
|
-
|
|
1935
|
-
var
|
|
1936
|
-
if (
|
|
1937
|
-
const
|
|
1938
|
-
(
|
|
1959
|
+
}, []), useEffect(() => {
|
|
1960
|
+
divRefs.forEach((ref, index) => {
|
|
1961
|
+
var _a12;
|
|
1962
|
+
if (ref.current) {
|
|
1963
|
+
const slide = slideList[index];
|
|
1964
|
+
(_a12 = renderManagerService.getRenderById(slide.id)) == null || _a12.engine.setContainer(ref.current);
|
|
1939
1965
|
}
|
|
1940
|
-
}),
|
|
1941
|
-
}, [
|
|
1942
|
-
const
|
|
1943
|
-
|
|
1944
|
-
}, [
|
|
1945
|
-
|
|
1946
|
-
}, [
|
|
1947
|
-
return /* @__PURE__ */
|
|
1948
|
-
/* @__PURE__ */
|
|
1949
|
-
|
|
1966
|
+
}), divRefs.length > 0 && commandService.syncExecuteCommand(SetSlidePageThumbOperation.id, { unitId: currentSlide == null ? void 0 : currentSlide.getUnitId() });
|
|
1967
|
+
}, [divRefs, slideList, renderManagerService, commandService, currentSlide]);
|
|
1968
|
+
const activatePage = useCallback((page) => {
|
|
1969
|
+
commandService.syncExecuteCommand(ActivateSlidePageOperation.id, { id: page, unitId: currentSlide == null ? void 0 : currentSlide.getUnitId() });
|
|
1970
|
+
}, [commandService, currentSlide]), handleAppendSlide = useCallback(() => {
|
|
1971
|
+
commandService.syncExecuteCommand(AppendSlideOperation.id, { unitId: currentSlide == null ? void 0 : currentSlide.getUnitId() });
|
|
1972
|
+
}, [commandService, currentSlide]);
|
|
1973
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("aside", { className: styles$1.slideBar, ref: slideBarRef, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Scrollbar, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$1.slideBarContent, children: [
|
|
1974
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("header", { className: styles$1.slideBarContentHeader, children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { onClick: handleAppendSlide, children: localeService.t("slide.append") }) }),
|
|
1975
|
+
slideList.map((item, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
1950
1976
|
"div",
|
|
1951
1977
|
{
|
|
1952
|
-
className:
|
|
1953
|
-
[
|
|
1978
|
+
className: clsx(styles$1.slideBarItem, {
|
|
1979
|
+
[styles$1.slideBarItemActive]: item.id === activatePageId
|
|
1954
1980
|
}),
|
|
1955
|
-
onClick: () =>
|
|
1981
|
+
onClick: /* @__PURE__ */ __name(() => activatePage(item.id), "onClick"),
|
|
1956
1982
|
children: [
|
|
1957
|
-
/* @__PURE__ */
|
|
1958
|
-
/* @__PURE__ */
|
|
1983
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: index + 1 }),
|
|
1984
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: divRefs[index], className: styles$1.slideBarBox })
|
|
1959
1985
|
]
|
|
1960
1986
|
},
|
|
1961
|
-
|
|
1987
|
+
item.id
|
|
1962
1988
|
))
|
|
1963
1989
|
] }) }) });
|
|
1964
1990
|
}
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1991
|
+
__name(SlideSideBar, "SlideSideBar");
|
|
1992
|
+
const slideEditorContainer = "univer-slide-editor-container", editorInput = "univer-editor-input", styles = {
|
|
1993
|
+
slideEditorContainer,
|
|
1994
|
+
editorInput
|
|
1995
|
+
}, HIDDEN_EDITOR_POSITION = -1e3, EDITOR_DEFAULT_POSITION = {
|
|
1969
1996
|
width: 0,
|
|
1970
1997
|
height: 0,
|
|
1971
|
-
top:
|
|
1972
|
-
left:
|
|
1973
|
-
},
|
|
1974
|
-
const [
|
|
1975
|
-
...
|
|
1976
|
-
}),
|
|
1977
|
-
() =>
|
|
1998
|
+
top: HIDDEN_EDITOR_POSITION,
|
|
1999
|
+
left: HIDDEN_EDITOR_POSITION
|
|
2000
|
+
}, SlideEditorContainer = /* @__PURE__ */ __name(() => {
|
|
2001
|
+
const [state, setState] = useState({
|
|
2002
|
+
...EDITOR_DEFAULT_POSITION
|
|
2003
|
+
}), slideEditorManagerService = useDependency(ISlideEditorManagerService), editorService = useDependency(IEditorService), contextService = useDependency(IContextService), disableAutoFocus = useObservable(
|
|
2004
|
+
() => contextService.subscribeContextValue$(DISABLE_AUTO_FOCUS_KEY),
|
|
1978
2005
|
!1,
|
|
1979
2006
|
void 0,
|
|
1980
|
-
[
|
|
2007
|
+
[contextService, DISABLE_AUTO_FOCUS_KEY]
|
|
1981
2008
|
);
|
|
1982
|
-
return `${
|
|
1983
|
-
|
|
1984
|
-
if (
|
|
2009
|
+
return `${DEFAULT_EMPTY_DOCUMENT_VALUE}`, DocumentFlavor.UNSPECIFIED, useEffect(() => {
|
|
2010
|
+
slideEditorManagerService.state$.subscribe((param) => {
|
|
2011
|
+
if (param == null)
|
|
1985
2012
|
return;
|
|
1986
2013
|
const {
|
|
1987
|
-
startX
|
|
1988
|
-
startY
|
|
1989
|
-
endX
|
|
1990
|
-
endY
|
|
1991
|
-
show
|
|
1992
|
-
} =
|
|
1993
|
-
if (!
|
|
1994
|
-
|
|
1995
|
-
...
|
|
2014
|
+
startX = HIDDEN_EDITOR_POSITION,
|
|
2015
|
+
startY = HIDDEN_EDITOR_POSITION,
|
|
2016
|
+
endX = 0,
|
|
2017
|
+
endY = 0,
|
|
2018
|
+
show = !1
|
|
2019
|
+
} = param;
|
|
2020
|
+
if (!show)
|
|
2021
|
+
setState({
|
|
2022
|
+
...EDITOR_DEFAULT_POSITION
|
|
1996
2023
|
});
|
|
1997
2024
|
else {
|
|
1998
|
-
|
|
1999
|
-
width:
|
|
2000
|
-
height:
|
|
2001
|
-
left:
|
|
2002
|
-
top:
|
|
2025
|
+
setState({
|
|
2026
|
+
width: endX - startX - FIX_ONE_PIXEL_BLUR_OFFSET + 2,
|
|
2027
|
+
height: endY - startY - FIX_ONE_PIXEL_BLUR_OFFSET + 2,
|
|
2028
|
+
left: startX + FIX_ONE_PIXEL_BLUR_OFFSET,
|
|
2029
|
+
top: startY + FIX_ONE_PIXEL_BLUR_OFFSET
|
|
2003
2030
|
});
|
|
2004
|
-
const
|
|
2005
|
-
if (
|
|
2031
|
+
const editor = editorService.getEditor(SLIDE_EDITOR_ID);
|
|
2032
|
+
if (editor == null)
|
|
2006
2033
|
return;
|
|
2007
|
-
const { left
|
|
2008
|
-
|
|
2034
|
+
const { left, top, width, height } = editor.getBoundingClientRect();
|
|
2035
|
+
slideEditorManagerService.setRect({ left, top, width, height });
|
|
2009
2036
|
}
|
|
2010
2037
|
});
|
|
2011
|
-
}, []),
|
|
2012
|
-
|
|
2013
|
-
}, [
|
|
2038
|
+
}, []), useEffect(() => {
|
|
2039
|
+
disableAutoFocus || slideEditorManagerService.setFocus(!0);
|
|
2040
|
+
}, [disableAutoFocus, state]), /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2014
2041
|
"div",
|
|
2015
2042
|
{
|
|
2016
|
-
className:
|
|
2043
|
+
className: styles.slideEditorContainer,
|
|
2017
2044
|
style: {
|
|
2018
|
-
left:
|
|
2019
|
-
top:
|
|
2020
|
-
width:
|
|
2021
|
-
height:
|
|
2045
|
+
left: state.left,
|
|
2046
|
+
top: state.top,
|
|
2047
|
+
width: state.width,
|
|
2048
|
+
height: state.height
|
|
2022
2049
|
}
|
|
2023
2050
|
}
|
|
2024
2051
|
);
|
|
2025
|
-
},
|
|
2026
|
-
function
|
|
2052
|
+
}, "SlideEditorContainer"), IMAGE_UPLOAD_ICON = "addition-and-subtraction-single", SLIDES_IMAGE_MENU_ID = "slide.menu.image";
|
|
2053
|
+
function SlideImageMenuFactory(accessor) {
|
|
2027
2054
|
return {
|
|
2028
|
-
id:
|
|
2029
|
-
type:
|
|
2030
|
-
icon:
|
|
2055
|
+
id: SLIDES_IMAGE_MENU_ID,
|
|
2056
|
+
type: MenuItemType.SUBITEMS,
|
|
2057
|
+
icon: IMAGE_UPLOAD_ICON,
|
|
2031
2058
|
tooltip: "slide.image.insert.title",
|
|
2032
|
-
hidden$:
|
|
2059
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SLIDE)
|
|
2033
2060
|
};
|
|
2034
2061
|
}
|
|
2035
|
-
|
|
2062
|
+
__name(SlideImageMenuFactory, "SlideImageMenuFactory");
|
|
2063
|
+
function UploadSlideFloatImageMenuFactory(_accessor) {
|
|
2036
2064
|
return {
|
|
2037
|
-
id:
|
|
2065
|
+
id: InsertSlideFloatImageCommand.id,
|
|
2038
2066
|
title: "slide.image.insert.float",
|
|
2039
|
-
type:
|
|
2040
|
-
hidden$:
|
|
2067
|
+
type: MenuItemType.BUTTON,
|
|
2068
|
+
hidden$: getMenuHiddenObservable(_accessor, UniverInstanceType.UNIVER_SLIDE)
|
|
2041
2069
|
};
|
|
2042
2070
|
}
|
|
2043
|
-
|
|
2044
|
-
|
|
2071
|
+
__name(UploadSlideFloatImageMenuFactory, "UploadSlideFloatImageMenuFactory");
|
|
2072
|
+
const GRAPH_SINGLE_ICON = "graph-single", SHAPE_MENU_ID = "slide.menu.shape";
|
|
2073
|
+
function SlideShapeMenuFactory(accessor) {
|
|
2045
2074
|
return {
|
|
2046
|
-
id:
|
|
2047
|
-
type:
|
|
2048
|
-
icon:
|
|
2075
|
+
id: SHAPE_MENU_ID,
|
|
2076
|
+
type: MenuItemType.SUBITEMS,
|
|
2077
|
+
icon: GRAPH_SINGLE_ICON,
|
|
2049
2078
|
tooltip: "slide.shape.insert.title",
|
|
2050
|
-
hidden$:
|
|
2079
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_SLIDE)
|
|
2051
2080
|
// disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] }),
|
|
2052
2081
|
};
|
|
2053
2082
|
}
|
|
2054
|
-
|
|
2083
|
+
__name(SlideShapeMenuFactory, "SlideShapeMenuFactory");
|
|
2084
|
+
function UploadSlideFloatShapeMenuFactory(_accessor) {
|
|
2055
2085
|
return {
|
|
2056
|
-
id:
|
|
2086
|
+
id: InsertSlideShapeRectangleCommand.id,
|
|
2057
2087
|
title: "slide.shape.insert.rectangle",
|
|
2058
|
-
type:
|
|
2059
|
-
hidden$:
|
|
2088
|
+
type: MenuItemType.BUTTON,
|
|
2089
|
+
hidden$: getMenuHiddenObservable(_accessor, UniverInstanceType.UNIVER_SLIDE)
|
|
2060
2090
|
};
|
|
2061
2091
|
}
|
|
2062
|
-
|
|
2063
|
-
|
|
2092
|
+
__name(UploadSlideFloatShapeMenuFactory, "UploadSlideFloatShapeMenuFactory");
|
|
2093
|
+
const TEXT_ICON_ID = "text-single";
|
|
2094
|
+
function SlideAddTextMenuItemFactory(_accessor) {
|
|
2064
2095
|
return {
|
|
2065
|
-
id:
|
|
2066
|
-
type:
|
|
2067
|
-
icon:
|
|
2096
|
+
id: SlideAddTextCommand.id,
|
|
2097
|
+
type: MenuItemType.BUTTON,
|
|
2098
|
+
icon: TEXT_ICON_ID,
|
|
2068
2099
|
tooltip: "slide.text.insert.title",
|
|
2069
|
-
hidden$:
|
|
2100
|
+
hidden$: getMenuHiddenObservable(_accessor, UniverInstanceType.UNIVER_SLIDE)
|
|
2070
2101
|
};
|
|
2071
2102
|
}
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2103
|
+
__name(SlideAddTextMenuItemFactory, "SlideAddTextMenuItemFactory");
|
|
2104
|
+
const menuSchema = {
|
|
2105
|
+
[RibbonStartGroup.FORMAT]: {
|
|
2106
|
+
[SlideAddTextCommand.id]: {
|
|
2075
2107
|
order: 0,
|
|
2076
|
-
menuItemFactory:
|
|
2108
|
+
menuItemFactory: SlideAddTextMenuItemFactory
|
|
2077
2109
|
},
|
|
2078
|
-
[
|
|
2110
|
+
[SLIDES_IMAGE_MENU_ID]: {
|
|
2079
2111
|
order: 0,
|
|
2080
|
-
menuItemFactory:
|
|
2081
|
-
[
|
|
2112
|
+
menuItemFactory: SlideImageMenuFactory,
|
|
2113
|
+
[InsertSlideFloatImageCommand.id]: {
|
|
2082
2114
|
order: 0,
|
|
2083
|
-
menuItemFactory:
|
|
2115
|
+
menuItemFactory: UploadSlideFloatImageMenuFactory
|
|
2084
2116
|
}
|
|
2085
2117
|
},
|
|
2086
|
-
[
|
|
2118
|
+
[SHAPE_MENU_ID]: {
|
|
2087
2119
|
order: 0,
|
|
2088
|
-
menuItemFactory:
|
|
2089
|
-
[
|
|
2120
|
+
menuItemFactory: SlideShapeMenuFactory,
|
|
2121
|
+
[InsertSlideShapeRectangleCommand.id]: {
|
|
2090
2122
|
order: 0,
|
|
2091
|
-
menuItemFactory:
|
|
2123
|
+
menuItemFactory: UploadSlideFloatShapeMenuFactory
|
|
2092
2124
|
}
|
|
2093
2125
|
}
|
|
2094
2126
|
}
|
|
2095
2127
|
};
|
|
2096
|
-
function
|
|
2097
|
-
return
|
|
2128
|
+
function whenEditorActivated(contextService) {
|
|
2129
|
+
return contextService.getContextValue(FOCUSING_UNIVER_EDITOR) && contextService.getContextValue(EDITOR_ACTIVATED);
|
|
2098
2130
|
}
|
|
2099
|
-
|
|
2100
|
-
|
|
2131
|
+
__name(whenEditorActivated, "whenEditorActivated");
|
|
2132
|
+
function whenFormulaEditorFocused(contextService) {
|
|
2133
|
+
return contextService.getContextValue(FORMULA_EDITOR_ACTIVATED) && contextService.getContextValue(FOCUSING_UNIVER_EDITOR);
|
|
2101
2134
|
}
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2135
|
+
__name(whenFormulaEditorFocused, "whenFormulaEditorFocused");
|
|
2136
|
+
const ARROW_SELECTION_KEYCODE_LIST = [
|
|
2137
|
+
KeyCode.ARROW_DOWN,
|
|
2138
|
+
KeyCode.ARROW_UP,
|
|
2139
|
+
KeyCode.ARROW_LEFT,
|
|
2140
|
+
KeyCode.ARROW_RIGHT
|
|
2107
2141
|
];
|
|
2108
|
-
[
|
|
2109
|
-
function
|
|
2110
|
-
const
|
|
2111
|
-
for (const
|
|
2112
|
-
|
|
2113
|
-
id:
|
|
2114
|
-
binding:
|
|
2115
|
-
preconditions: (
|
|
2142
|
+
[KeyCode.ENTER, KeyCode.TAB, ...ARROW_SELECTION_KEYCODE_LIST];
|
|
2143
|
+
function generateArrowSelectionShortCutItem() {
|
|
2144
|
+
const shortcutList = [];
|
|
2145
|
+
for (const keycode of ARROW_SELECTION_KEYCODE_LIST)
|
|
2146
|
+
shortcutList.push({
|
|
2147
|
+
id: SetTextEditArrowOperation.id,
|
|
2148
|
+
binding: keycode,
|
|
2149
|
+
preconditions: /* @__PURE__ */ __name((contextService) => whenEditorActivated(contextService), "preconditions"),
|
|
2116
2150
|
staticParameters: {
|
|
2117
2151
|
visible: !1,
|
|
2118
|
-
eventType:
|
|
2119
|
-
keycode
|
|
2152
|
+
eventType: DeviceInputEventType.Keyboard,
|
|
2153
|
+
keycode,
|
|
2120
2154
|
isShift: !1
|
|
2121
2155
|
}
|
|
2122
|
-
}),
|
|
2123
|
-
id:
|
|
2124
|
-
binding:
|
|
2125
|
-
preconditions: (
|
|
2156
|
+
}), shortcutList.push({
|
|
2157
|
+
id: SetTextEditArrowOperation.id,
|
|
2158
|
+
binding: keycode | MetaKeys.SHIFT,
|
|
2159
|
+
preconditions: /* @__PURE__ */ __name((contextService) => whenEditorActivated(contextService), "preconditions"),
|
|
2126
2160
|
staticParameters: {
|
|
2127
2161
|
visible: !1,
|
|
2128
|
-
eventType:
|
|
2129
|
-
keycode
|
|
2162
|
+
eventType: DeviceInputEventType.Keyboard,
|
|
2163
|
+
keycode,
|
|
2130
2164
|
isShift: !0
|
|
2131
2165
|
}
|
|
2132
2166
|
});
|
|
2133
|
-
return
|
|
2167
|
+
return shortcutList;
|
|
2134
2168
|
}
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2169
|
+
__name(generateArrowSelectionShortCutItem, "generateArrowSelectionShortCutItem");
|
|
2170
|
+
const EditorDeleteLeftShortcut = {
|
|
2171
|
+
id: DeleteLeftCommand.id,
|
|
2172
|
+
preconditions: /* @__PURE__ */ __name((contextService) => whenEditorActivated(contextService) || whenFormulaEditorFocused(contextService), "preconditions"),
|
|
2173
|
+
binding: KeyCode.BACKSPACE
|
|
2139
2174
|
};
|
|
2140
|
-
var
|
|
2141
|
-
for (var
|
|
2142
|
-
(
|
|
2143
|
-
return
|
|
2144
|
-
},
|
|
2145
|
-
let
|
|
2146
|
-
constructor(
|
|
2147
|
-
super(), this._injector =
|
|
2175
|
+
var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2176
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2177
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
2178
|
+
return kind && result && __defProp$2(target, key, result), result;
|
|
2179
|
+
}, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a8;
|
|
2180
|
+
let SlidesUIController = (_a8 = class extends Disposable {
|
|
2181
|
+
constructor(_injector, _menuManagerService, _componentManager, _uiPartsService, _commandService, _shortcutService) {
|
|
2182
|
+
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();
|
|
2148
2183
|
}
|
|
2149
2184
|
_initMenus() {
|
|
2150
|
-
this._menuManagerService.mergeMenu(
|
|
2185
|
+
this._menuManagerService.mergeMenu(menuSchema);
|
|
2151
2186
|
}
|
|
2152
2187
|
_initCustomComponents() {
|
|
2153
|
-
const
|
|
2154
|
-
this.disposeWithMe(
|
|
2188
|
+
const componentManager = this._componentManager;
|
|
2189
|
+
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));
|
|
2155
2190
|
}
|
|
2156
2191
|
_initCommands() {
|
|
2157
2192
|
[
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2193
|
+
AppendSlideOperation,
|
|
2194
|
+
ActivateSlidePageOperation,
|
|
2195
|
+
SetSlidePageThumbOperation,
|
|
2196
|
+
InsertSlideFloatImageCommand,
|
|
2197
|
+
SlideAddTextOperation,
|
|
2198
|
+
SlideAddTextCommand,
|
|
2199
|
+
InsertSlideShapeRectangleOperation,
|
|
2200
|
+
InsertSlideShapeRectangleCommand,
|
|
2201
|
+
ToggleSlideEditSidebarOperation,
|
|
2202
|
+
DeleteSlideElementOperation,
|
|
2203
|
+
UpdateSlideElementOperation,
|
|
2169
2204
|
// commands for editor
|
|
2170
|
-
|
|
2171
|
-
].forEach((
|
|
2205
|
+
SetTextEditArrowOperation
|
|
2206
|
+
].forEach((command) => this.disposeWithMe(this._commandService.registerCommand(command)));
|
|
2172
2207
|
}
|
|
2173
2208
|
_initUIComponents() {
|
|
2174
2209
|
this.disposeWithMe(
|
|
2175
|
-
this._uiPartsService.registerComponent(
|
|
2210
|
+
this._uiPartsService.registerComponent(BuiltInUIPart.LEFT_SIDEBAR, () => connectInjector(SlideSideBar, this._injector))
|
|
2176
2211
|
), this.disposeWithMe(
|
|
2177
|
-
this._uiPartsService.registerComponent(
|
|
2212
|
+
this._uiPartsService.registerComponent(BuiltInUIPart.CONTENT, () => connectInjector(SlideEditorContainer, this._injector))
|
|
2178
2213
|
);
|
|
2179
2214
|
}
|
|
2180
2215
|
_initShortcuts() {
|
|
2181
2216
|
[
|
|
2182
|
-
|
|
2183
|
-
...
|
|
2184
|
-
].forEach((
|
|
2185
|
-
this.disposeWithMe(this._shortcutService.registerShortcut(
|
|
2217
|
+
EditorDeleteLeftShortcut,
|
|
2218
|
+
...generateArrowSelectionShortCutItem()
|
|
2219
|
+
].forEach((item) => {
|
|
2220
|
+
this.disposeWithMe(this._shortcutService.registerShortcut(item));
|
|
2186
2221
|
});
|
|
2187
2222
|
}
|
|
2188
|
-
};
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
],
|
|
2197
|
-
var
|
|
2198
|
-
for (var
|
|
2199
|
-
(
|
|
2200
|
-
return
|
|
2201
|
-
}, $
|
|
2202
|
-
let
|
|
2223
|
+
}, __name(_a8, "SlidesUIController"), _a8);
|
|
2224
|
+
SlidesUIController = __decorateClass$2([
|
|
2225
|
+
__decorateParam$2(0, Inject(Injector)),
|
|
2226
|
+
__decorateParam$2(1, IMenuManagerService),
|
|
2227
|
+
__decorateParam$2(2, Inject(ComponentManager)),
|
|
2228
|
+
__decorateParam$2(3, IUIPartsService),
|
|
2229
|
+
__decorateParam$2(4, ICommandService),
|
|
2230
|
+
__decorateParam$2(5, IShortcutService)
|
|
2231
|
+
], SlidesUIController);
|
|
2232
|
+
var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2233
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2234
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
2235
|
+
return kind && result && __defProp$1(target, key, result), result;
|
|
2236
|
+
}, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a9;
|
|
2237
|
+
let SlideRenderService = (_a9 = class extends RxDisposable {
|
|
2203
2238
|
// private _skeletonChangeMutations = new Set<string>();
|
|
2204
|
-
constructor(
|
|
2205
|
-
super(), this._contextService =
|
|
2239
|
+
constructor(_contextService, _instanceSrv, _renderManagerService) {
|
|
2240
|
+
super(), this._contextService = _contextService, this._instanceSrv = _instanceSrv, this._renderManagerService = _renderManagerService, Promise.resolve().then(() => this._init());
|
|
2206
2241
|
}
|
|
2207
2242
|
_init() {
|
|
2208
2243
|
this._initSlideDataListener(), this._initContextListener();
|
|
2209
2244
|
}
|
|
2210
2245
|
_initSlideDataListener() {
|
|
2211
|
-
this._instanceSrv.getTypeOfUnitAdded$(
|
|
2212
|
-
this._createRenderer(
|
|
2213
|
-
}), this._instanceSrv.getAllUnitsForType(
|
|
2214
|
-
this._createRenderer(
|
|
2215
|
-
}), this._instanceSrv.getTypeOfUnitDisposed$(
|
|
2246
|
+
this._instanceSrv.getTypeOfUnitAdded$(UniverInstanceType.UNIVER_SLIDE).pipe(takeUntil(this.dispose$)).subscribe((slideModel) => {
|
|
2247
|
+
this._createRenderer(slideModel == null ? void 0 : slideModel.getUnitId());
|
|
2248
|
+
}), this._instanceSrv.getAllUnitsForType(UniverInstanceType.UNIVER_SLIDE).forEach((slideModel) => {
|
|
2249
|
+
this._createRenderer(slideModel.getUnitId());
|
|
2250
|
+
}), this._instanceSrv.getTypeOfUnitDisposed$(UniverInstanceType.UNIVER_SLIDE).pipe(takeUntil(this.dispose$)).subscribe((workbook) => this._disposeRenderer(workbook));
|
|
2216
2251
|
}
|
|
2217
|
-
_createRenderer(
|
|
2218
|
-
|
|
2252
|
+
_createRenderer(unitId) {
|
|
2253
|
+
unitId == null || this._instanceSrv.getUnit(unitId, UniverInstanceType.UNIVER_SLIDE) == null || (this._renderManagerService.createRender(unitId), this._renderManagerService.setCurrent(unitId));
|
|
2219
2254
|
}
|
|
2220
|
-
_disposeRenderer(
|
|
2221
|
-
const
|
|
2222
|
-
this._renderManagerService.removeRender(
|
|
2255
|
+
_disposeRenderer(workbook) {
|
|
2256
|
+
const unitId = workbook.getUnitId();
|
|
2257
|
+
this._renderManagerService.removeRender(unitId);
|
|
2223
2258
|
}
|
|
2224
2259
|
_initContextListener() {
|
|
2225
2260
|
}
|
|
2226
|
-
};
|
|
2227
|
-
|
|
2228
|
-
$
|
|
2229
|
-
$
|
|
2230
|
-
$
|
|
2231
|
-
],
|
|
2232
|
-
var
|
|
2233
|
-
for (var
|
|
2234
|
-
(
|
|
2235
|
-
return
|
|
2236
|
-
},
|
|
2237
|
-
const
|
|
2238
|
-
var
|
|
2239
|
-
let
|
|
2240
|
-
constructor(
|
|
2241
|
-
super(), this._config =
|
|
2242
|
-
const { menu
|
|
2261
|
+
}, __name(_a9, "SlideRenderService"), _a9);
|
|
2262
|
+
SlideRenderService = __decorateClass$1([
|
|
2263
|
+
__decorateParam$1(0, IContextService),
|
|
2264
|
+
__decorateParam$1(1, IUniverInstanceService),
|
|
2265
|
+
__decorateParam$1(2, IRenderManagerService)
|
|
2266
|
+
], SlideRenderService);
|
|
2267
|
+
var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
2268
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2269
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
2270
|
+
return kind && result && __defProp2(target, key, result), result;
|
|
2271
|
+
}, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam");
|
|
2272
|
+
const SLIDE_UI_PLUGIN_NAME = "SLIDE_UI";
|
|
2273
|
+
var _a10;
|
|
2274
|
+
let UniverSlidesUIPlugin = (_a10 = class extends Plugin {
|
|
2275
|
+
constructor(_config = defaultPluginConfig, _injector, _renderManagerService, _univerInstanceService, _configService) {
|
|
2276
|
+
super(), this._config = _config, this._injector = _injector, this._renderManagerService = _renderManagerService, this._univerInstanceService = _univerInstanceService, this._configService = _configService;
|
|
2277
|
+
const { menu, ...rest } = merge(
|
|
2243
2278
|
{},
|
|
2244
|
-
|
|
2279
|
+
defaultPluginConfig,
|
|
2245
2280
|
this._config
|
|
2246
2281
|
);
|
|
2247
|
-
|
|
2282
|
+
menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(SLIDES_UI_PLUGIN_CONFIG_KEY, rest);
|
|
2248
2283
|
}
|
|
2249
2284
|
onStarting() {
|
|
2250
|
-
|
|
2251
|
-
[
|
|
2252
|
-
[
|
|
2285
|
+
mergeOverrideWithDependencies([
|
|
2286
|
+
[SlideRenderService],
|
|
2287
|
+
[ISlideEditorBridgeService, { useClass: SlideEditorBridgeService }],
|
|
2253
2288
|
// used by SlideUIController --> EditorContainer
|
|
2254
|
-
[
|
|
2255
|
-
[
|
|
2256
|
-
], this._config.override).forEach((
|
|
2289
|
+
[ISlideEditorManagerService, { useClass: SlideEditorManagerService }],
|
|
2290
|
+
[SlideCanvasPopMangerService]
|
|
2291
|
+
], this._config.override).forEach((d) => this._injector.add(d));
|
|
2257
2292
|
}
|
|
2258
2293
|
onReady() {
|
|
2259
2294
|
[
|
|
2260
2295
|
// SlideRenderService will be init in ready stage, and then calling RenderManagerService@createRender --> init all deps in this rendering register block.
|
|
2261
|
-
[
|
|
2262
|
-
].forEach((
|
|
2263
|
-
this.disposeWithMe(this._renderManagerService.registerRenderModule(
|
|
2264
|
-
}),
|
|
2265
|
-
[
|
|
2296
|
+
[SlideRenderController]
|
|
2297
|
+
].forEach((m) => {
|
|
2298
|
+
this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SLIDE, m));
|
|
2299
|
+
}), mergeOverrideWithDependencies([
|
|
2300
|
+
[CanvasView],
|
|
2266
2301
|
// cannot register in _renderManagerService now.
|
|
2267
2302
|
// [ISlideEditorBridgeService, { useClass: SlideEditorBridgeService }],
|
|
2268
2303
|
// // used by SlideUIController --> EditorContainer
|
|
2269
2304
|
// [ISlideEditorManagerService, { useClass: SlideEditorManagerService }],
|
|
2270
2305
|
// SlidesUIController controller should be registered in Ready stage.
|
|
2271
2306
|
// SlidesUIController controller would add a new RenderUnit (__INTERNAL_EDITOR__DOCS_NORMAL)
|
|
2272
|
-
[
|
|
2307
|
+
[SlidesUIController],
|
|
2273
2308
|
// editor service was create in renderManagerService
|
|
2274
|
-
[
|
|
2275
|
-
[
|
|
2276
|
-
], this._config.override).forEach((
|
|
2277
|
-
this._injector.add(
|
|
2278
|
-
}), this._injector.get(
|
|
2309
|
+
[SlideRenderController],
|
|
2310
|
+
[SlidePopupMenuController]
|
|
2311
|
+
], this._config.override).forEach((m) => {
|
|
2312
|
+
this._injector.add(m);
|
|
2313
|
+
}), this._injector.get(CanvasView), this._injector.get(SlideRenderService);
|
|
2279
2314
|
}
|
|
2280
2315
|
onRendered() {
|
|
2281
2316
|
[
|
|
2282
2317
|
// need slideEditorBridgeService
|
|
2283
2318
|
// need TextSelectionRenderService which init by EditorContainer
|
|
2284
|
-
[
|
|
2285
|
-
[
|
|
2286
|
-
].forEach((
|
|
2287
|
-
this.disposeWithMe(this._renderManagerService.registerRenderModule(
|
|
2288
|
-
}), this._markSlideAsFocused(), this._injector.get(
|
|
2319
|
+
[SlideEditorBridgeRenderController],
|
|
2320
|
+
[SlideEditingRenderController]
|
|
2321
|
+
].forEach((m) => {
|
|
2322
|
+
this.disposeWithMe(this._renderManagerService.registerRenderModule(UniverInstanceType.UNIVER_SLIDE, m));
|
|
2323
|
+
}), this._markSlideAsFocused(), this._injector.get(SlidesUIController);
|
|
2289
2324
|
}
|
|
2290
2325
|
onSteady() {
|
|
2291
|
-
this._injector.get(
|
|
2326
|
+
this._injector.get(SlidePopupMenuController);
|
|
2292
2327
|
}
|
|
2293
2328
|
_markSlideAsFocused() {
|
|
2294
|
-
const
|
|
2329
|
+
const currentService = this._univerInstanceService;
|
|
2295
2330
|
try {
|
|
2296
|
-
const
|
|
2297
|
-
|
|
2331
|
+
const slideDataModel = currentService.getCurrentUnitForType(UniverInstanceType.UNIVER_SLIDE);
|
|
2332
|
+
currentService.focusUnit(slideDataModel.getUnitId());
|
|
2298
2333
|
} catch {
|
|
2299
2334
|
}
|
|
2300
2335
|
}
|
|
2301
|
-
},
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
],
|
|
2336
|
+
}, __name(_a10, "UniverSlidesUIPlugin"), __publicField(_a10, "pluginName", SLIDE_UI_PLUGIN_NAME), __publicField(_a10, "type", UniverInstanceType.UNIVER_SLIDE), _a10);
|
|
2337
|
+
UniverSlidesUIPlugin = __decorateClass([
|
|
2338
|
+
__decorateParam(1, Inject(Injector)),
|
|
2339
|
+
__decorateParam(2, IRenderManagerService),
|
|
2340
|
+
__decorateParam(3, IUniverInstanceService),
|
|
2341
|
+
__decorateParam(4, IConfigService)
|
|
2342
|
+
], UniverSlidesUIPlugin);
|
|
2308
2343
|
export {
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2344
|
+
ActivateSlidePageOperation,
|
|
2345
|
+
AppendSlideOperation,
|
|
2346
|
+
CanvasView,
|
|
2347
|
+
DeleteSlideElementOperation,
|
|
2348
|
+
ISlideEditorBridgeService,
|
|
2349
|
+
InsertSlideFloatImageCommand,
|
|
2350
|
+
InsertSlideShapeRectangleCommand,
|
|
2351
|
+
InsertSlideShapeRectangleOperation,
|
|
2352
|
+
SHAPE_MENU_ID,
|
|
2353
|
+
SLIDES_IMAGE_MENU_ID,
|
|
2354
|
+
SLIDE_EDITOR_ID,
|
|
2355
|
+
SetSlidePageThumbOperation,
|
|
2356
|
+
SlideAddTextCommand,
|
|
2357
|
+
SlideAddTextOperation,
|
|
2358
|
+
SlideCanvasPopMangerService,
|
|
2359
|
+
SlideEditorContainer,
|
|
2360
|
+
SlideSideBar,
|
|
2361
|
+
SlidesUIController,
|
|
2362
|
+
menuSchema as SlidesUIMenuSchema,
|
|
2363
|
+
UniverSlidesUIPlugin,
|
|
2364
|
+
UpdateSlideElementOperation
|
|
2330
2365
|
};
|