@univerjs/slides-ui 0.15.1 → 0.15.2-insiders.20260119-edc718c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +2 -2
- package/lib/es/index.js +767 -782
- package/lib/index.css +1 -1
- package/lib/index.js +767 -782
- package/lib/umd/index.js +2 -2
- package/package.json +10 -10
- package/LICENSE +0 -176
package/lib/es/index.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var S = (
|
|
4
|
-
import { Inject as z, Injector as ke, IUniverInstanceService as w, RxDisposable as
|
|
5
|
-
import { IRenderManagerService as K, Viewport as
|
|
6
|
-
import { ObjectProvider as
|
|
7
|
-
import { DRAWING_IMAGE_ALLOW_IMAGE_LIST as
|
|
8
|
-
import { ILocalFileService as
|
|
9
|
-
import { jsxs as
|
|
10
|
-
import { Button as Ce, clsx as k, Dropdown as Mt, ColorPicker as
|
|
11
|
-
import { useRef as
|
|
12
|
-
import { IEditorService as Ze, DeleteLeftCommand as
|
|
13
|
-
import { BehaviorSubject as q, Subject as
|
|
14
|
-
import { DocSelectionManagerService as
|
|
15
|
-
var
|
|
16
|
-
for (var r =
|
|
17
|
-
(o =
|
|
1
|
+
var cn = Object.defineProperty;
|
|
2
|
+
var an = (i, e, t) => e in i ? cn(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
+
var S = (i, e, t) => an(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Inject as z, Injector as ke, IUniverInstanceService as w, RxDisposable as pe, UniverInstanceType as E, debounce as ln, getColorStyle as dn, CommandType as D, PageElementType as De, merge as St, LocaleService as J, ICommandService as U, generateRandomId as ze, BasicShapes as It, createInternalEditorID as un, createIdentifier as bt, IContextService as fe, DocumentFlavor as hn, FOCUSING_UNIVER_EDITOR as Et, EDITOR_ACTIVATED as Re, FORMULA_EDITOR_ACTIVATED as gn, Disposable as Ue, DisposableCollection as Ke, toDisposable as Rt, FOCUSING_COMMON_DRAWINGS as vn, FOCUSING_EDITOR_STANDALONE as xt, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE as Ot, DocumentDataModel as pn, HorizontalAlign as wt, VerticalAlign as xe, IUndoRedoService as fn, WrapStrategy as tt, FOCUSING_EDITOR_BUT_HIDDEN as _n, DEFAULT_EMPTY_DOCUMENT_VALUE as mn, Direction as V, Plugin as Cn, mergeOverrideWithDependencies as nt, IConfigService as Sn } from "@univerjs/core";
|
|
5
|
+
import { IRenderManagerService as K, Viewport as it, ScrollBar as yt, getCurrentTypeOfRenderer as Le, Slide as In, Rect as Pt, Scene as bn, ObjectType as de, FIX_ONE_PIXEL_BLUR_OFFSET as ne, DeviceInputEventType as Y, pxToNum as En, convertTextRotation as rt, fixLineWidthByScale as st } from "@univerjs/engine-render";
|
|
6
|
+
import { ObjectProvider as Rn, SLIDE_KEY as ie } from "@univerjs/slides";
|
|
7
|
+
import { DRAWING_IMAGE_ALLOW_IMAGE_LIST as xn, IImageIoService as On, getImageSize as wn } from "@univerjs/drawing";
|
|
8
|
+
import { ILocalFileService as yn, useDependency as O, ISidebarService as Tt, getMenuHiddenObservable as re, MenuItemType as se, RibbonStartGroup as Pn, useObservable as Tn, DISABLE_AUTO_FOCUS_KEY as ot, KeyCode as y, MetaKeys as Mn, IMenuManagerService as Dn, ComponentManager as Un, IUIPartsService as Nn, IShortcutService as Vn, BuiltInUIPart as ct, connectInjector as at, ICanvasPopupService as jn, ILayoutService as An } from "@univerjs/ui";
|
|
9
|
+
import { jsxs as R, jsx as g } from "react/jsx-runtime";
|
|
10
|
+
import { Button as Ce, clsx as k, Dropdown as Mt, ColorPicker as Ln, borderTopClassName as Dt, InputNumber as le, borderClassName as he, scrollbarClassName as $n } from "@univerjs/design";
|
|
11
|
+
import { useRef as Ut, createElement as H, forwardRef as Z, useState as $, useEffect as ge, useMemo as Bn, createRef as Hn, useCallback as lt } from "react";
|
|
12
|
+
import { IEditorService as Ze, DeleteLeftCommand as Fn, DocSelectionRenderService as dt, VIEWPORT_KEY as ut, DOCS_COMPONENT_MAIN_LAYER_INDEX as Wn, MoveSelectionOperation as kn, MoveCursorOperation as zn, DOCS_VIEW_KEY as Kn } from "@univerjs/docs-ui";
|
|
13
|
+
import { BehaviorSubject as q, Subject as Nt, filter as Zn, takeUntil as ht } from "rxjs";
|
|
14
|
+
import { DocSelectionManagerService as Gn, DocSkeletonManagerService as gt, RichTextEditingMutation as Xn } from "@univerjs/docs";
|
|
15
|
+
var Yn = Object.getOwnPropertyDescriptor, qn = (i, e, t, n) => {
|
|
16
|
+
for (var r = n > 1 ? void 0 : n ? Yn(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
17
|
+
(o = i[s]) && (r = o(r) || r);
|
|
18
18
|
return r;
|
|
19
|
-
},
|
|
20
|
-
let ve = class extends
|
|
21
|
-
constructor(e, t,
|
|
19
|
+
}, Ne = (i, e) => (t, n) => e(t, n, i);
|
|
20
|
+
let ve = class extends pe {
|
|
21
|
+
constructor(e, t, n, r) {
|
|
22
22
|
super();
|
|
23
23
|
S(this, "_objectProvider", null);
|
|
24
|
-
S(this, "_refreshThumb",
|
|
24
|
+
S(this, "_refreshThumb", ln(() => {
|
|
25
25
|
this.createThumbs();
|
|
26
26
|
}, 300));
|
|
27
|
-
this._renderContext = e, this._injector = t, this._univerInstanceService =
|
|
27
|
+
this._renderContext = e, this._injector = t, this._univerInstanceService = n, this._renderManagerService = r, this._objectProvider = this._injector.createInstance(Rn), this._addNewRender();
|
|
28
28
|
}
|
|
29
29
|
_addNewRender() {
|
|
30
|
-
const { unitId: e, engine: t, scene:
|
|
30
|
+
const { unitId: e, engine: t, scene: n } = this._renderContext, r = this._getCurrUnitModel();
|
|
31
31
|
if (!r) return;
|
|
32
32
|
const s = t.onTransformChange$.subscribeEvent(() => {
|
|
33
33
|
this._scrollToCenter(), s == null || s.unsubscribe();
|
|
@@ -37,7 +37,7 @@ let ve = class extends fe {
|
|
|
37
37
|
this.createThumbs();
|
|
38
38
|
}, 300);
|
|
39
39
|
});
|
|
40
|
-
const o = new
|
|
40
|
+
const o = new it(ie.VIEW, n, {
|
|
41
41
|
left: 0,
|
|
42
42
|
top: 0,
|
|
43
43
|
bottom: 0,
|
|
@@ -46,27 +46,27 @@ let ve = class extends fe {
|
|
|
46
46
|
explicitViewportHeightSet: !1,
|
|
47
47
|
isWheelPreventDefaultX: !0
|
|
48
48
|
});
|
|
49
|
-
|
|
49
|
+
n.attachControl(), n.onMouseWheel$.subscribeEvent((a, u) => {
|
|
50
50
|
const l = a;
|
|
51
51
|
if (l.ctrlKey) {
|
|
52
52
|
const d = Math.abs(l.deltaX);
|
|
53
53
|
let v = d < 40 ? 0.2 : d < 80 ? 0.4 : 0.2;
|
|
54
|
-
v *= l.deltaY > 0 ? -1 : 1,
|
|
54
|
+
v *= l.deltaY > 0 ? -1 : 1, n.scaleX < 1 && (v /= 2), n.scaleX + v > 4 ? n.scale(4, 4) : n.scaleX + v < 0.1 ? n.scale(0.1, 0.1) : (l.deltaY > 0, l.preventDefault());
|
|
55
55
|
} else
|
|
56
|
-
o.onMouseWheel(l,
|
|
57
|
-
}),
|
|
56
|
+
o.onMouseWheel(l, u);
|
|
57
|
+
}), n.onFileLoaded$.subscribeEvent(() => {
|
|
58
58
|
this._refreshThumb();
|
|
59
|
-
}),
|
|
60
|
-
const c = this._createSlide(
|
|
59
|
+
}), yt.attachTo(o);
|
|
60
|
+
const c = this._createSlide(n);
|
|
61
61
|
this._renderContext.mainComponent = c, this._createSlidePages(r, c), this.createThumbs(), t.runRenderLoop(() => {
|
|
62
|
-
|
|
62
|
+
n.render();
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
_scrollToCenter() {
|
|
66
66
|
var a;
|
|
67
|
-
const e = (a = this._currentRender()) == null ? void 0 : a.scene, t = e == null ? void 0 : e.getViewport(
|
|
68
|
-
if (!t || !
|
|
69
|
-
const { left: r, top: s } =
|
|
67
|
+
const e = (a = this._currentRender()) == null ? void 0 : a.scene, t = e == null ? void 0 : e.getViewport(ie.VIEW), n = this._getCenterPositionViewPort(e);
|
|
68
|
+
if (!t || !n) return;
|
|
69
|
+
const { left: r, top: s } = n, { x: o, y: c } = t.transViewportScroll2ScrollValue(r, s);
|
|
70
70
|
t.scrollToBarPos({
|
|
71
71
|
x: o,
|
|
72
72
|
y: c
|
|
@@ -79,8 +79,8 @@ let ve = class extends fe {
|
|
|
79
79
|
* @param mainScene
|
|
80
80
|
*/
|
|
81
81
|
_createSlide(e) {
|
|
82
|
-
const t = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SLIDE), { width:
|
|
83
|
-
left: (
|
|
82
|
+
const t = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SLIDE), { width: n, height: r } = e, s = t.getPageSize(), { width: o = 100, height: c = 100 } = s, a = new In(ie.COMPONENT, {
|
|
83
|
+
left: (n - o) / 2,
|
|
84
84
|
top: (r - c) / 2,
|
|
85
85
|
width: o,
|
|
86
86
|
height: c,
|
|
@@ -89,14 +89,14 @@ let ve = class extends fe {
|
|
|
89
89
|
return a.enableSelectedClipElement(), e.addObject(a), a;
|
|
90
90
|
}
|
|
91
91
|
_addBackgroundRect(e, t) {
|
|
92
|
-
const r = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SLIDE).getPageSize(), { width: s = 0, height: o = 0 } = r, c = new
|
|
92
|
+
const r = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SLIDE).getPageSize(), { width: s = 0, height: o = 0 } = r, c = new Pt("canvas", {
|
|
93
93
|
left: 0,
|
|
94
94
|
top: 0,
|
|
95
95
|
width: s,
|
|
96
96
|
height: o,
|
|
97
97
|
strokeWidth: 1,
|
|
98
98
|
stroke: "rgba(198,198,198,1)",
|
|
99
|
-
fill:
|
|
99
|
+
fill: dn(t) || "rgba(255,255,255,1)",
|
|
100
100
|
zIndex: 0,
|
|
101
101
|
evented: !1
|
|
102
102
|
});
|
|
@@ -104,21 +104,21 @@ let ve = class extends fe {
|
|
|
104
104
|
}
|
|
105
105
|
_getCenterPositionViewPort(e) {
|
|
106
106
|
if (!e) return { left: 0, top: 0 };
|
|
107
|
-
const { width: t, height:
|
|
107
|
+
const { width: t, height: n } = e, r = e.getEngine(), s = (r == null ? void 0 : r.width) || 0, o = (r == null ? void 0 : r.height) || 0;
|
|
108
108
|
return {
|
|
109
109
|
left: (t - s) / 2,
|
|
110
|
-
top: (
|
|
110
|
+
top: (n - o) / 2
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
113
|
_thumbSceneRender(e, t) {
|
|
114
|
-
const
|
|
115
|
-
if (
|
|
114
|
+
const n = this._renderManagerService.getRenderById(e);
|
|
115
|
+
if (n == null)
|
|
116
116
|
return;
|
|
117
|
-
const { engine: r } =
|
|
117
|
+
const { engine: r } = n;
|
|
118
118
|
if (r == null)
|
|
119
119
|
return;
|
|
120
|
-
const { width: s, height: o } = t, { width: c = s, height: a = o } = r,
|
|
121
|
-
t.renderToThumb(
|
|
120
|
+
const { width: s, height: o } = t, { width: c = s, height: a = o } = r, u = r.getCanvas().getContext();
|
|
121
|
+
t.renderToThumb(u, e, c / s, a / o);
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
124
|
* CreateScene by pages, and activate first one.
|
|
@@ -126,11 +126,11 @@ let ve = class extends fe {
|
|
|
126
126
|
* @param slide
|
|
127
127
|
*/
|
|
128
128
|
_createSlidePages(e, t) {
|
|
129
|
-
const
|
|
130
|
-
if (!(!
|
|
129
|
+
const n = e.getPages(), r = e.getPageOrder();
|
|
130
|
+
if (!(!n || !r) && r.length !== 0) {
|
|
131
131
|
for (let s = 0, o = r.length; s < o; s++) {
|
|
132
132
|
const c = r[s];
|
|
133
|
-
this.createPageScene(c,
|
|
133
|
+
this.createPageScene(c, n[c]), this._createThumb(c);
|
|
134
134
|
}
|
|
135
135
|
t.activeFirstPage();
|
|
136
136
|
}
|
|
@@ -146,32 +146,32 @@ let ve = class extends fe {
|
|
|
146
146
|
}
|
|
147
147
|
activePage(e) {
|
|
148
148
|
let t = e;
|
|
149
|
-
const
|
|
149
|
+
const n = this._getCurrUnitModel();
|
|
150
150
|
let r;
|
|
151
151
|
if (t)
|
|
152
|
-
r =
|
|
152
|
+
r = n.getPage(t);
|
|
153
153
|
else {
|
|
154
|
-
const a =
|
|
155
|
-
if (
|
|
154
|
+
const a = n.getPages(), u = n.getPageOrder();
|
|
155
|
+
if (u == null || a == null)
|
|
156
156
|
return;
|
|
157
|
-
r = a[
|
|
157
|
+
r = a[u[0]], t = r.id;
|
|
158
158
|
}
|
|
159
159
|
const s = this._currentRender();
|
|
160
160
|
if (r == null || s == null || s.mainComponent == null)
|
|
161
161
|
return;
|
|
162
162
|
const { id: o } = r, c = s.mainComponent;
|
|
163
|
-
if (
|
|
163
|
+
if (n.setActivePage(r), c != null && c.hasPage(o)) {
|
|
164
164
|
c.changePage(o);
|
|
165
165
|
return;
|
|
166
166
|
}
|
|
167
167
|
this.createPageScene(o, r);
|
|
168
168
|
}
|
|
169
169
|
createThumbs() {
|
|
170
|
-
const t = this._getCurrUnitModel().getPageOrder(),
|
|
171
|
-
if (!(!t || !
|
|
170
|
+
const t = this._getCurrUnitModel().getPageOrder(), n = this._currentRender();
|
|
171
|
+
if (!(!t || !n) && t.length !== 0)
|
|
172
172
|
for (let r = 0, s = t.length; r < s; r++) {
|
|
173
173
|
const o = t[r];
|
|
174
|
-
this._thumbSceneRender(o,
|
|
174
|
+
this._thumbSceneRender(o, n.mainComponent);
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
/**
|
|
@@ -180,14 +180,14 @@ let ve = class extends fe {
|
|
|
180
180
|
* @param page
|
|
181
181
|
*/
|
|
182
182
|
createPageScene(e, t) {
|
|
183
|
-
const
|
|
184
|
-
if (!
|
|
183
|
+
const n = this._renderContext;
|
|
184
|
+
if (!n || !this._objectProvider)
|
|
185
185
|
return;
|
|
186
|
-
const { scene: r, mainComponent: s } =
|
|
186
|
+
const { scene: r, mainComponent: s } = n, o = s, { width: c, height: a } = o, u = new bn(e, o, {
|
|
187
187
|
width: c,
|
|
188
188
|
height: a
|
|
189
189
|
});
|
|
190
|
-
new
|
|
190
|
+
new it(`PageViewer_${e}`, u, {
|
|
191
191
|
left: 0,
|
|
192
192
|
top: 0,
|
|
193
193
|
bottom: 0,
|
|
@@ -195,17 +195,17 @@ let ve = class extends fe {
|
|
|
195
195
|
explicitViewportWidthSet: !1,
|
|
196
196
|
explicitViewportHeightSet: !1
|
|
197
197
|
}).closeClip();
|
|
198
|
-
const { pageElements: d, pageBackgroundFill: v } = t,
|
|
199
|
-
if (!
|
|
200
|
-
this._addBackgroundRect(
|
|
201
|
-
|
|
198
|
+
const { pageElements: d, pageBackgroundFill: v } = t, _ = this._objectProvider.convertToRenderObjects(d, r);
|
|
199
|
+
if (!_ || !o) return;
|
|
200
|
+
this._addBackgroundRect(u, v), u.addObjects(_), u.initTransformer(), _.forEach((p) => {
|
|
201
|
+
u.attachTransformerTo(p);
|
|
202
202
|
});
|
|
203
|
-
const
|
|
204
|
-
return
|
|
203
|
+
const f = u.getTransformer();
|
|
204
|
+
return f == null || f.changeEnd$.subscribe(() => {
|
|
205
205
|
this._thumbSceneRender(e, o);
|
|
206
|
-
}),
|
|
206
|
+
}), f == null || f.clearControl$.subscribe(() => {
|
|
207
207
|
this._thumbSceneRender(e, o);
|
|
208
|
-
}), o.addPageScene(
|
|
208
|
+
}), o.addPageScene(u), u;
|
|
209
209
|
}
|
|
210
210
|
/**
|
|
211
211
|
* Get pageScene from Slide.
|
|
@@ -213,204 +213,204 @@ let ve = class extends fe {
|
|
|
213
213
|
* @returns {Scene, Engine, UnitModel} scene & engine & unit from renderContext
|
|
214
214
|
*/
|
|
215
215
|
getPageRenderUnit(e) {
|
|
216
|
-
const
|
|
216
|
+
const n = this._renderContext.mainComponent.getSubScenes().get(e), { engine: r, unit: s } = this._renderContext;
|
|
217
217
|
return {
|
|
218
|
-
scene:
|
|
218
|
+
scene: n,
|
|
219
219
|
engine: r,
|
|
220
220
|
unit: s
|
|
221
221
|
};
|
|
222
222
|
}
|
|
223
223
|
createObjectToPage(e, t) {
|
|
224
|
-
const { scene:
|
|
225
|
-
if (!
|
|
224
|
+
const { scene: n } = this.getPageRenderUnit(t);
|
|
225
|
+
if (!n || !this._objectProvider)
|
|
226
226
|
return;
|
|
227
|
-
const r = this._objectProvider.convertToRenderObject(e,
|
|
227
|
+
const r = this._objectProvider.convertToRenderObject(e, n);
|
|
228
228
|
if (r)
|
|
229
|
-
return
|
|
229
|
+
return n.addObject(r), n.attachTransformerTo(r), n.getLayer().makeDirty(), r;
|
|
230
230
|
}
|
|
231
231
|
setObjectActiveByPage(e, t) {
|
|
232
|
-
const { scene:
|
|
233
|
-
if (!
|
|
234
|
-
const r =
|
|
232
|
+
const { scene: n } = this.getPageRenderUnit(t);
|
|
233
|
+
if (!n) return;
|
|
234
|
+
const r = n.getTransformer();
|
|
235
235
|
r == null || r.activeAnObject(e);
|
|
236
236
|
}
|
|
237
237
|
removeObjectById(e, t) {
|
|
238
|
-
const { scene:
|
|
239
|
-
if (!
|
|
240
|
-
|
|
241
|
-
const r =
|
|
238
|
+
const { scene: n } = this.getPageRenderUnit(t);
|
|
239
|
+
if (!n) return;
|
|
240
|
+
n.removeObject(e);
|
|
241
|
+
const r = n.getTransformer();
|
|
242
242
|
r == null || r.clearControls();
|
|
243
243
|
}
|
|
244
244
|
appendPage() {
|
|
245
|
-
const e = this._getCurrUnitModel(), t = e.getBlankPage(),
|
|
246
|
-
if (t == null ||
|
|
245
|
+
const e = this._getCurrUnitModel(), t = e.getBlankPage(), n = this._currentRender();
|
|
246
|
+
if (t == null || n == null || n.mainComponent == null)
|
|
247
247
|
return;
|
|
248
|
-
const { id: r } = t, s =
|
|
248
|
+
const { id: r } = t, s = n.mainComponent, o = this.createPageScene(r, t);
|
|
249
249
|
s && o && s.addPageScene(o), e.appendPage(t), e.setActivePage(t);
|
|
250
250
|
}
|
|
251
251
|
};
|
|
252
|
-
ve =
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
252
|
+
ve = qn([
|
|
253
|
+
Ne(1, z(ke)),
|
|
254
|
+
Ne(2, w),
|
|
255
|
+
Ne(3, K)
|
|
256
256
|
], ve);
|
|
257
|
-
var
|
|
258
|
-
for (var r =
|
|
259
|
-
(o =
|
|
257
|
+
var Jn = Object.getOwnPropertyDescriptor, Qn = (i, e, t, n) => {
|
|
258
|
+
for (var r = n > 1 ? void 0 : n ? Jn(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
259
|
+
(o = i[s]) && (r = o(r) || r);
|
|
260
260
|
return r;
|
|
261
|
-
},
|
|
262
|
-
let
|
|
263
|
-
constructor(
|
|
264
|
-
super(), this._renderManagerService =
|
|
261
|
+
}, ei = (i, e) => (t, n) => e(t, n, i);
|
|
262
|
+
let P = class extends pe {
|
|
263
|
+
constructor(i) {
|
|
264
|
+
super(), this._renderManagerService = i;
|
|
265
265
|
}
|
|
266
|
-
_getSlideRenderControllerFromRenderUnit(
|
|
267
|
-
return this._renderManagerService.getRenderById(
|
|
266
|
+
_getSlideRenderControllerFromRenderUnit(i) {
|
|
267
|
+
return this._renderManagerService.getRenderById(i).with(ve);
|
|
268
268
|
}
|
|
269
|
-
createThumbs(
|
|
270
|
-
this._getSlideRenderControllerFromRenderUnit(
|
|
269
|
+
createThumbs(i) {
|
|
270
|
+
this._getSlideRenderControllerFromRenderUnit(i).createThumbs();
|
|
271
271
|
}
|
|
272
|
-
activePage(
|
|
273
|
-
this._getSlideRenderControllerFromRenderUnit(e).activePage(
|
|
272
|
+
activePage(i, e) {
|
|
273
|
+
this._getSlideRenderControllerFromRenderUnit(e).activePage(i);
|
|
274
274
|
}
|
|
275
|
-
getRenderUnitByPageId(
|
|
276
|
-
return this._getSlideRenderControllerFromRenderUnit(e).getPageRenderUnit(
|
|
275
|
+
getRenderUnitByPageId(i, e) {
|
|
276
|
+
return this._getSlideRenderControllerFromRenderUnit(e).getPageRenderUnit(i);
|
|
277
277
|
}
|
|
278
|
-
createObjectToPage(
|
|
279
|
-
return this._getSlideRenderControllerFromRenderUnit(t).createObjectToPage(
|
|
278
|
+
createObjectToPage(i, e, t) {
|
|
279
|
+
return this._getSlideRenderControllerFromRenderUnit(t).createObjectToPage(i, e);
|
|
280
280
|
}
|
|
281
|
-
setObjectActiveByPage(
|
|
282
|
-
return this._getSlideRenderControllerFromRenderUnit(t).setObjectActiveByPage(
|
|
281
|
+
setObjectActiveByPage(i, e, t) {
|
|
282
|
+
return this._getSlideRenderControllerFromRenderUnit(t).setObjectActiveByPage(i, e);
|
|
283
283
|
}
|
|
284
|
-
removeObjectById(
|
|
285
|
-
this._getSlideRenderControllerFromRenderUnit(t).removeObjectById(
|
|
284
|
+
removeObjectById(i, e, t) {
|
|
285
|
+
this._getSlideRenderControllerFromRenderUnit(t).removeObjectById(i, e);
|
|
286
286
|
}
|
|
287
287
|
/**
|
|
288
288
|
* append blank page
|
|
289
289
|
*/
|
|
290
|
-
appendPage(
|
|
291
|
-
this._getSlideRenderControllerFromRenderUnit(
|
|
290
|
+
appendPage(i) {
|
|
291
|
+
this._getSlideRenderControllerFromRenderUnit(i).appendPage();
|
|
292
292
|
}
|
|
293
293
|
};
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
],
|
|
294
|
+
P = Qn([
|
|
295
|
+
ei(0, K)
|
|
296
|
+
], P);
|
|
297
297
|
const Vt = {
|
|
298
298
|
id: "slide.operation.activate-slide",
|
|
299
|
-
type:
|
|
300
|
-
handler: (
|
|
301
|
-
var
|
|
302
|
-
const t = e.unitId,
|
|
299
|
+
type: D.OPERATION,
|
|
300
|
+
handler: (i, e) => {
|
|
301
|
+
var u, l;
|
|
302
|
+
const t = e.unitId, n = i.get(P), s = i.get(w).getUnit(t), o = (u = s == null ? void 0 : s.getActivePage()) == null ? void 0 : u.id;
|
|
303
303
|
if (!o) return !1;
|
|
304
|
-
const c =
|
|
304
|
+
const c = n.getRenderUnitByPageId(o, t);
|
|
305
305
|
if (!c) return !1;
|
|
306
306
|
const a = (l = c.scene) == null ? void 0 : l.getTransformer();
|
|
307
|
-
return a && a.clearControls(),
|
|
307
|
+
return a && a.clearControls(), n.activePage(e.id, t), !0;
|
|
308
308
|
}
|
|
309
309
|
}, jt = {
|
|
310
310
|
id: "slide.operation.append-slide",
|
|
311
|
-
type:
|
|
312
|
-
handler: (
|
|
311
|
+
type: D.OPERATION,
|
|
312
|
+
handler: (i, e) => {
|
|
313
313
|
const t = e.unitId;
|
|
314
|
-
return
|
|
314
|
+
return i.get(w).getUnit(t) ? (i.get(P).appendPage(t), !0) : !1;
|
|
315
315
|
}
|
|
316
316
|
}, At = {
|
|
317
317
|
id: "slide.operation.delete-element",
|
|
318
|
-
type:
|
|
319
|
-
handler: (
|
|
318
|
+
type: D.OPERATION,
|
|
319
|
+
handler: (i, e) => {
|
|
320
320
|
if (!(e != null && e.id)) return !1;
|
|
321
|
-
const t = e.unitId, r =
|
|
321
|
+
const t = e.unitId, r = i.get(w).getUnit(t);
|
|
322
322
|
if (!r) return !1;
|
|
323
323
|
const s = r.getActivePage();
|
|
324
|
-
return delete s.pageElements[e.id], r.updatePage(s.id, s),
|
|
324
|
+
return delete s.pageElements[e.id], r.updatePage(s.id, s), i.get(P).removeObjectById(e.id, s.id, t), !0;
|
|
325
325
|
}
|
|
326
326
|
}, Ge = {
|
|
327
327
|
id: "slide.command.insert-float-image",
|
|
328
|
-
type:
|
|
329
|
-
handler: async (
|
|
330
|
-
var
|
|
331
|
-
const t =
|
|
332
|
-
if (!
|
|
333
|
-
const s = await
|
|
328
|
+
type: D.COMMAND,
|
|
329
|
+
handler: async (i, e) => {
|
|
330
|
+
var N;
|
|
331
|
+
const t = i.get(w), n = (N = t.getCurrentUnitForType(E.UNIVER_SLIDE)) == null ? void 0 : N.getUnitId();
|
|
332
|
+
if (!n) return !1;
|
|
333
|
+
const s = await i.get(yn).openFile({
|
|
334
334
|
multiple: !0,
|
|
335
|
-
accept:
|
|
335
|
+
accept: xn.map((x) => `.${x.replace("image/", "")}`).join(",")
|
|
336
336
|
});
|
|
337
337
|
if (s.length !== 1) return !1;
|
|
338
|
-
const c = await
|
|
338
|
+
const c = await i.get(On).saveImage(s[0]);
|
|
339
339
|
if (!c) return !1;
|
|
340
|
-
const { imageId: a, imageSourceType:
|
|
341
|
-
if (!
|
|
342
|
-
const
|
|
340
|
+
const { imageId: a, imageSourceType: u, source: l, base64Cache: d } = c, { width: v, height: _, image: f } = await wn(d || ""), p = t.getUnit(n);
|
|
341
|
+
if (!p) return !1;
|
|
342
|
+
const h = p.getActivePage(), m = Object.values(h.pageElements), I = m != null && m.length ? Math.max(...m.map((x) => x.zIndex)) : 20, b = {
|
|
343
343
|
id: a,
|
|
344
344
|
zIndex: I + 1,
|
|
345
345
|
left: 0,
|
|
346
346
|
top: 0,
|
|
347
347
|
width: v,
|
|
348
|
-
height:
|
|
348
|
+
height: _,
|
|
349
349
|
title: "",
|
|
350
350
|
description: "",
|
|
351
|
-
type:
|
|
351
|
+
type: De.IMAGE,
|
|
352
352
|
image: {
|
|
353
353
|
imageProperties: {
|
|
354
354
|
contentUrl: d,
|
|
355
|
-
imageSourceType:
|
|
355
|
+
imageSourceType: u,
|
|
356
356
|
source: l,
|
|
357
357
|
base64Cache: d,
|
|
358
|
-
image:
|
|
358
|
+
image: f
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
361
|
};
|
|
362
|
-
|
|
363
|
-
const T =
|
|
364
|
-
return M && T.setObjectActiveByPage(M,
|
|
362
|
+
h.pageElements[a] = b, p.updatePage(h.id, h);
|
|
363
|
+
const T = i.get(P), M = T.createObjectToPage(b, h.id, n);
|
|
364
|
+
return M && T.setObjectActiveByPage(M, h.id, n), !0;
|
|
365
365
|
}
|
|
366
366
|
};
|
|
367
|
-
function F({ ref:
|
|
368
|
-
const { icon: t, id:
|
|
369
|
-
return Lt(t, `${
|
|
367
|
+
function F({ ref: i, ...e }) {
|
|
368
|
+
const { icon: t, id: n, className: r, extend: s, ...o } = e, c = `univerjs-icon univerjs-icon-${n} ${r || ""}`.trim(), a = Ut(`_${ii()}`);
|
|
369
|
+
return Lt(t, `${n}`, {
|
|
370
370
|
defIds: t.defIds,
|
|
371
371
|
idSuffix: a.current
|
|
372
372
|
}, {
|
|
373
|
-
ref:
|
|
373
|
+
ref: i,
|
|
374
374
|
className: c,
|
|
375
375
|
...o
|
|
376
376
|
}, s);
|
|
377
377
|
}
|
|
378
|
-
function Lt(
|
|
379
|
-
return H(
|
|
378
|
+
function Lt(i, e, t, n, r) {
|
|
379
|
+
return H(i.tag, {
|
|
380
380
|
key: e,
|
|
381
|
-
...
|
|
382
|
-
...
|
|
383
|
-
}, (
|
|
381
|
+
...ti(i, t, r),
|
|
382
|
+
...n
|
|
383
|
+
}, (ni(i, t).children || []).map((s, o) => Lt(s, `${e}-${i.tag}-${o}`, t, void 0, r)));
|
|
384
384
|
}
|
|
385
|
-
function
|
|
386
|
-
const
|
|
387
|
-
t != null && t.colorChannel1 &&
|
|
388
|
-
s === "mask" && typeof o == "string" && (
|
|
385
|
+
function ti(i, e, t) {
|
|
386
|
+
const n = { ...i.attrs };
|
|
387
|
+
t != null && t.colorChannel1 && n.fill === "colorChannel1" && (n.fill = t.colorChannel1), i.tag === "mask" && n.id && (n.id = n.id + e.idSuffix), Object.entries(n).forEach(([s, o]) => {
|
|
388
|
+
s === "mask" && typeof o == "string" && (n[s] = o.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
|
|
389
389
|
});
|
|
390
390
|
const { defIds: r } = e;
|
|
391
|
-
return !r || r.length === 0 || (
|
|
392
|
-
typeof o == "string" && (
|
|
393
|
-
})),
|
|
391
|
+
return !r || r.length === 0 || (i.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + e.idSuffix), Object.entries(n).forEach(([s, o]) => {
|
|
392
|
+
typeof o == "string" && (n[s] = o.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
|
|
393
|
+
})), n;
|
|
394
394
|
}
|
|
395
|
-
function
|
|
396
|
-
var
|
|
395
|
+
function ni(i, e) {
|
|
396
|
+
var n;
|
|
397
397
|
const { defIds: t } = e;
|
|
398
|
-
return !t || t.length === 0 ?
|
|
399
|
-
...
|
|
400
|
-
children:
|
|
398
|
+
return !t || t.length === 0 ? i : i.tag === "defs" && ((n = i.children) != null && n.length) ? {
|
|
399
|
+
...i,
|
|
400
|
+
children: i.children.map((r) => typeof r.attrs.id == "string" && t && t.includes(r.attrs.id) ? {
|
|
401
401
|
...r,
|
|
402
402
|
attrs: {
|
|
403
403
|
...r.attrs,
|
|
404
404
|
id: r.attrs.id + e.idSuffix
|
|
405
405
|
}
|
|
406
406
|
} : r)
|
|
407
|
-
} :
|
|
407
|
+
} : i;
|
|
408
408
|
}
|
|
409
|
-
function
|
|
409
|
+
function ii() {
|
|
410
410
|
return Math.random().toString(36).substring(2, 8);
|
|
411
411
|
}
|
|
412
412
|
F.displayName = "UniverIcon";
|
|
413
|
-
const
|
|
413
|
+
const ri = {
|
|
414
414
|
tag: "svg",
|
|
415
415
|
attrs: {
|
|
416
416
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -457,11 +457,11 @@ const rn = {
|
|
|
457
457
|
return H(F, Object.assign({}, e, {
|
|
458
458
|
id: "bottom-icon",
|
|
459
459
|
ref: t,
|
|
460
|
-
icon:
|
|
460
|
+
icon: ri
|
|
461
461
|
}));
|
|
462
462
|
});
|
|
463
463
|
$t.displayName = "BottomIcon";
|
|
464
|
-
const
|
|
464
|
+
const si = {
|
|
465
465
|
tag: "svg",
|
|
466
466
|
attrs: {
|
|
467
467
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -503,11 +503,11 @@ const sn = {
|
|
|
503
503
|
return H(F, Object.assign({}, e, {
|
|
504
504
|
id: "graph-icon",
|
|
505
505
|
ref: t,
|
|
506
|
-
icon:
|
|
506
|
+
icon: si
|
|
507
507
|
}));
|
|
508
508
|
});
|
|
509
509
|
Bt.displayName = "GraphIcon";
|
|
510
|
-
const
|
|
510
|
+
const oi = {
|
|
511
511
|
tag: "svg",
|
|
512
512
|
attrs: {
|
|
513
513
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -529,11 +529,11 @@ const on = {
|
|
|
529
529
|
return H(F, Object.assign({}, e, {
|
|
530
530
|
id: "more-down-icon",
|
|
531
531
|
ref: t,
|
|
532
|
-
icon:
|
|
532
|
+
icon: oi
|
|
533
533
|
}));
|
|
534
534
|
});
|
|
535
535
|
Xe.displayName = "MoreDownIcon";
|
|
536
|
-
const
|
|
536
|
+
const ci = {
|
|
537
537
|
tag: "svg",
|
|
538
538
|
attrs: {
|
|
539
539
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -561,11 +561,11 @@ const cn = {
|
|
|
561
561
|
return H(F, Object.assign({}, e, {
|
|
562
562
|
id: "move-down-icon",
|
|
563
563
|
ref: t,
|
|
564
|
-
icon:
|
|
564
|
+
icon: ci
|
|
565
565
|
}));
|
|
566
566
|
});
|
|
567
567
|
Ht.displayName = "MoveDownIcon";
|
|
568
|
-
const
|
|
568
|
+
const ai = {
|
|
569
569
|
tag: "svg",
|
|
570
570
|
attrs: {
|
|
571
571
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -593,11 +593,11 @@ const an = {
|
|
|
593
593
|
return H(F, Object.assign({}, e, {
|
|
594
594
|
id: "move-up-icon",
|
|
595
595
|
ref: t,
|
|
596
|
-
icon:
|
|
596
|
+
icon: ai
|
|
597
597
|
}));
|
|
598
598
|
});
|
|
599
599
|
Ft.displayName = "MoveUpIcon";
|
|
600
|
-
const
|
|
600
|
+
const li = {
|
|
601
601
|
tag: "svg",
|
|
602
602
|
attrs: {
|
|
603
603
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -640,11 +640,11 @@ const ln = {
|
|
|
640
640
|
return H(F, Object.assign({}, e, {
|
|
641
641
|
id: "text-icon",
|
|
642
642
|
ref: t,
|
|
643
|
-
icon:
|
|
643
|
+
icon: li
|
|
644
644
|
}));
|
|
645
645
|
});
|
|
646
646
|
Wt.displayName = "TextIcon";
|
|
647
|
-
const
|
|
647
|
+
const di = {
|
|
648
648
|
tag: "svg",
|
|
649
649
|
attrs: {
|
|
650
650
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -684,11 +684,11 @@ const dn = {
|
|
|
684
684
|
return H(F, Object.assign({}, e, {
|
|
685
685
|
id: "topmost-icon",
|
|
686
686
|
ref: t,
|
|
687
|
-
icon:
|
|
687
|
+
icon: di
|
|
688
688
|
}));
|
|
689
689
|
});
|
|
690
690
|
kt.displayName = "TopmostIcon";
|
|
691
|
-
const
|
|
691
|
+
const ui = {
|
|
692
692
|
tag: "svg",
|
|
693
693
|
attrs: {
|
|
694
694
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -737,11 +737,11 @@ const un = {
|
|
|
737
737
|
return H(F, Object.assign({}, e, {
|
|
738
738
|
id: "autofill-double-icon",
|
|
739
739
|
ref: t,
|
|
740
|
-
icon:
|
|
740
|
+
icon: ui
|
|
741
741
|
}));
|
|
742
742
|
});
|
|
743
743
|
zt.displayName = "AutofillDoubleIcon";
|
|
744
|
-
const
|
|
744
|
+
const hi = {
|
|
745
745
|
tag: "svg",
|
|
746
746
|
attrs: {
|
|
747
747
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -779,105 +779,105 @@ const hn = {
|
|
|
779
779
|
return H(F, Object.assign({}, e, {
|
|
780
780
|
id: "paint-bucket-double-icon",
|
|
781
781
|
ref: t,
|
|
782
|
-
icon:
|
|
782
|
+
icon: hi
|
|
783
783
|
}));
|
|
784
784
|
});
|
|
785
785
|
Kt.displayName = "PaintBucketDoubleIcon";
|
|
786
786
|
const B = {
|
|
787
787
|
id: "slide.operation.update-element",
|
|
788
|
-
type:
|
|
789
|
-
handler: (
|
|
790
|
-
const { oKey: t, props:
|
|
788
|
+
type: D.OPERATION,
|
|
789
|
+
handler: (i, e) => {
|
|
790
|
+
const { oKey: t, props: n } = e, r = i.get(w), s = e == null ? void 0 : e.unitId, o = r.getUnit(s);
|
|
791
791
|
if (!o) return !1;
|
|
792
792
|
const c = o.getActivePage();
|
|
793
|
-
return c.pageElements[t] = St(c.pageElements[t],
|
|
793
|
+
return c.pageElements[t] = St(c.pageElements[t], n), o.updatePage(c.id, c), !0;
|
|
794
794
|
}
|
|
795
795
|
};
|
|
796
|
-
function
|
|
797
|
-
const { pageId: e, unitId: t } =
|
|
796
|
+
function gi(i) {
|
|
797
|
+
const { pageId: e, unitId: t } = i, n = O(J), r = O(P), s = O(U), o = r.getRenderUnitByPageId(e, t), c = o == null ? void 0 : o.scene;
|
|
798
798
|
if (!c) return null;
|
|
799
799
|
const a = c.getTransformer();
|
|
800
800
|
if (!a) return null;
|
|
801
801
|
const l = a.getSelectedObjectMap().values().next().value;
|
|
802
802
|
if (!l) return null;
|
|
803
803
|
const d = (v) => {
|
|
804
|
-
const
|
|
805
|
-
const T = b.zIndex, M = T <
|
|
806
|
-
return [M,
|
|
804
|
+
const _ = c.getAllObjects(), [f, p] = _.reduce(([m, I], b) => {
|
|
805
|
+
const T = b.zIndex, M = T < m ? T : m, N = T > I ? T : I;
|
|
806
|
+
return [M, N];
|
|
807
807
|
}, [0, 0]);
|
|
808
|
-
let
|
|
809
|
-
v === 3 ?
|
|
810
|
-
zIndex:
|
|
808
|
+
let h = l.zIndex;
|
|
809
|
+
v === 3 ? h = f - 1 : v === 2 ? h = p + 1 : v === 0 ? h = l.zIndex + 1 : v === 1 && (h = l.zIndex - 1), l.setProps({
|
|
810
|
+
zIndex: h
|
|
811
811
|
}), s.executeCommand(B.id, {
|
|
812
812
|
unitId: t,
|
|
813
813
|
oKey: l == null ? void 0 : l.oKey,
|
|
814
814
|
props: {
|
|
815
|
-
zIndex:
|
|
815
|
+
zIndex: h
|
|
816
816
|
}
|
|
817
817
|
});
|
|
818
818
|
};
|
|
819
|
-
return /* @__PURE__ */
|
|
820
|
-
/* @__PURE__ */
|
|
819
|
+
return /* @__PURE__ */ R("div", { className: "univer-relative univer-w-full", children: [
|
|
820
|
+
/* @__PURE__ */ g("div", { className: "univer-relative univer-mt-2.5 univer-flex univer-h-full", children: /* @__PURE__ */ g(
|
|
821
821
|
"div",
|
|
822
822
|
{
|
|
823
823
|
className: "univer-w-full univer-text-left univer-text-gray-600 dark:!univer-text-gray-200",
|
|
824
|
-
children: /* @__PURE__ */
|
|
824
|
+
children: /* @__PURE__ */ g("div", { children: n.t("image-panel.arrange.title") })
|
|
825
825
|
}
|
|
826
826
|
) }),
|
|
827
|
-
/* @__PURE__ */
|
|
828
|
-
/* @__PURE__ */
|
|
827
|
+
/* @__PURE__ */ R("div", { className: "univer-relative univer-mt-2.5 univer-flex univer-h-full", children: [
|
|
828
|
+
/* @__PURE__ */ g("div", { className: "univer-w-1/2", children: /* @__PURE__ */ g(Ce, { onClick: () => {
|
|
829
829
|
d(
|
|
830
830
|
0
|
|
831
831
|
/* forward */
|
|
832
832
|
);
|
|
833
|
-
}, children: /* @__PURE__ */
|
|
834
|
-
/* @__PURE__ */
|
|
835
|
-
|
|
833
|
+
}, children: /* @__PURE__ */ R("span", { className: "univer-flex univer-items-center univer-gap-1", children: [
|
|
834
|
+
/* @__PURE__ */ g(Ft, {}),
|
|
835
|
+
n.t("image-panel.arrange.forward")
|
|
836
836
|
] }) }) }),
|
|
837
|
-
/* @__PURE__ */
|
|
837
|
+
/* @__PURE__ */ g("div", { className: "univer-w-1/2", children: /* @__PURE__ */ g(Ce, { onClick: () => {
|
|
838
838
|
d(
|
|
839
839
|
1
|
|
840
840
|
/* backward */
|
|
841
841
|
);
|
|
842
|
-
}, children: /* @__PURE__ */
|
|
843
|
-
/* @__PURE__ */
|
|
844
|
-
|
|
842
|
+
}, children: /* @__PURE__ */ R("span", { className: "univer-flex univer-items-center univer-gap-1", children: [
|
|
843
|
+
/* @__PURE__ */ g(Ht, {}),
|
|
844
|
+
n.t("image-panel.arrange.backward")
|
|
845
845
|
] }) }) })
|
|
846
846
|
] }),
|
|
847
|
-
/* @__PURE__ */
|
|
848
|
-
/* @__PURE__ */
|
|
847
|
+
/* @__PURE__ */ R("div", { className: "univer-relative univer-mt-2.5 univer-flex univer-h-full", children: [
|
|
848
|
+
/* @__PURE__ */ g("div", { className: "univer-w-1/2", children: /* @__PURE__ */ g(Ce, { onClick: () => {
|
|
849
849
|
d(
|
|
850
850
|
2
|
|
851
851
|
/* front */
|
|
852
852
|
);
|
|
853
|
-
}, children: /* @__PURE__ */
|
|
854
|
-
/* @__PURE__ */
|
|
855
|
-
|
|
853
|
+
}, children: /* @__PURE__ */ R("span", { className: "univer-flex univer-items-center univer-gap-1", children: [
|
|
854
|
+
/* @__PURE__ */ g(kt, {}),
|
|
855
|
+
n.t("image-panel.arrange.front")
|
|
856
856
|
] }) }) }),
|
|
857
|
-
/* @__PURE__ */
|
|
857
|
+
/* @__PURE__ */ g("div", { className: "univer-w-1/2", children: /* @__PURE__ */ g(Ce, { onClick: () => {
|
|
858
858
|
d(
|
|
859
859
|
3
|
|
860
860
|
/* back */
|
|
861
861
|
);
|
|
862
|
-
}, children: /* @__PURE__ */
|
|
863
|
-
/* @__PURE__ */
|
|
864
|
-
|
|
862
|
+
}, children: /* @__PURE__ */ R("span", { className: "univer-flex univer-items-center univer-gap-1", children: [
|
|
863
|
+
/* @__PURE__ */ g($t, {}),
|
|
864
|
+
n.t("image-panel.arrange.back")
|
|
865
865
|
] }) }) })
|
|
866
866
|
] })
|
|
867
867
|
] });
|
|
868
868
|
}
|
|
869
|
-
function
|
|
870
|
-
var
|
|
871
|
-
const { pageId: e, unitId: t } =
|
|
869
|
+
function vi(i) {
|
|
870
|
+
var f, p;
|
|
871
|
+
const { pageId: e, unitId: t } = i, n = O(J), r = O(P), s = O(U), o = r.getRenderUnitByPageId(e, t), c = o == null ? void 0 : o.scene;
|
|
872
872
|
if (!c) return null;
|
|
873
873
|
const a = c.getTransformer();
|
|
874
874
|
if (!a) return null;
|
|
875
875
|
const l = a.getSelectedObjectMap().values().next().value;
|
|
876
876
|
if (!l) return null;
|
|
877
|
-
const [d, v] = $((
|
|
878
|
-
function
|
|
877
|
+
const [d, v] = $((p = (f = l.fill) == null ? void 0 : f.toString()) != null ? p : "");
|
|
878
|
+
function _(h) {
|
|
879
879
|
l == null || l.setProps({
|
|
880
|
-
fill:
|
|
880
|
+
fill: h
|
|
881
881
|
}), s.executeCommand(B.id, {
|
|
882
882
|
unitId: t,
|
|
883
883
|
oKey: l == null ? void 0 : l.oKey,
|
|
@@ -885,38 +885,38 @@ function vn(n) {
|
|
|
885
885
|
shape: {
|
|
886
886
|
shapeProperties: {
|
|
887
887
|
shapeBackgroundFill: {
|
|
888
|
-
rgb:
|
|
888
|
+
rgb: h
|
|
889
889
|
}
|
|
890
890
|
}
|
|
891
891
|
}
|
|
892
892
|
}
|
|
893
|
-
}), v(
|
|
893
|
+
}), v(h);
|
|
894
894
|
}
|
|
895
|
-
return /* @__PURE__ */
|
|
895
|
+
return /* @__PURE__ */ g(
|
|
896
896
|
"div",
|
|
897
897
|
{
|
|
898
|
-
className: k("univer-relative univer-bottom-0 univer-mt-5 univer-w-full",
|
|
899
|
-
children: /* @__PURE__ */
|
|
900
|
-
/* @__PURE__ */
|
|
898
|
+
className: k("univer-relative univer-bottom-0 univer-mt-5 univer-w-full", Dt),
|
|
899
|
+
children: /* @__PURE__ */ R("div", { className: "univer-relative univer-w-full", children: [
|
|
900
|
+
/* @__PURE__ */ g("div", { className: "univer-relative univer-mt-2.5 univer-flex univer-h-full", children: /* @__PURE__ */ g(
|
|
901
901
|
"div",
|
|
902
902
|
{
|
|
903
903
|
className: "univer-w-full univer-text-left univer-text-gray-600 dark:!univer-text-gray-200",
|
|
904
|
-
children: /* @__PURE__ */
|
|
904
|
+
children: /* @__PURE__ */ g("div", { children: n.t("slide.panel.fill.title") })
|
|
905
905
|
}
|
|
906
906
|
) }),
|
|
907
|
-
/* @__PURE__ */
|
|
907
|
+
/* @__PURE__ */ g("div", { className: "univer-relative univer-mt-2.5 univer-flex univer-h-full", children: /* @__PURE__ */ g("div", { className: "univer-w-1/2", children: /* @__PURE__ */ g(
|
|
908
908
|
Mt,
|
|
909
909
|
{
|
|
910
|
-
overlay: /* @__PURE__ */
|
|
911
|
-
|
|
910
|
+
overlay: /* @__PURE__ */ g("div", { className: "univer-rounded-lg univer-p-4", children: /* @__PURE__ */ g(
|
|
911
|
+
Ln,
|
|
912
912
|
{
|
|
913
913
|
value: "#fff",
|
|
914
|
-
onChange:
|
|
914
|
+
onChange: _
|
|
915
915
|
}
|
|
916
916
|
) }),
|
|
917
|
-
children: /* @__PURE__ */
|
|
918
|
-
/* @__PURE__ */
|
|
919
|
-
/* @__PURE__ */
|
|
917
|
+
children: /* @__PURE__ */ R("a", { className: "univer-flex univer-cursor-pointer univer-items-center univer-gap-1", children: [
|
|
918
|
+
/* @__PURE__ */ g(Kt, { className: "univer-fill-primary-600" }),
|
|
919
|
+
/* @__PURE__ */ g(Xe, {})
|
|
920
920
|
] })
|
|
921
921
|
}
|
|
922
922
|
) }) })
|
|
@@ -924,8 +924,8 @@ function vn(n) {
|
|
|
924
924
|
}
|
|
925
925
|
);
|
|
926
926
|
}
|
|
927
|
-
function
|
|
928
|
-
const { pageId: e, unitId: t } =
|
|
927
|
+
function pi(i) {
|
|
928
|
+
const { pageId: e, unitId: t } = i, n = O(J), r = O(P), s = O(U), o = r.getRenderUnitByPageId(e, t), c = o == null ? void 0 : o.scene;
|
|
929
929
|
if (!c) return null;
|
|
930
930
|
const a = c.getTransformer();
|
|
931
931
|
if (!a) return null;
|
|
@@ -934,18 +934,18 @@ function fn(n) {
|
|
|
934
934
|
const {
|
|
935
935
|
width: d = 0,
|
|
936
936
|
height: v = 0,
|
|
937
|
-
left:
|
|
938
|
-
top:
|
|
939
|
-
angle:
|
|
940
|
-
} = l, [
|
|
937
|
+
left: _ = 0,
|
|
938
|
+
top: f = 0,
|
|
939
|
+
angle: p = 0
|
|
940
|
+
} = l, [h, m] = $(d), [I, b] = $(v), [T, M] = $(_), [N, x] = $(f), [W, oe] = $(p), A = (C) => {
|
|
941
941
|
const { objects: ce } = C, ae = ce.values().next().value, {
|
|
942
|
-
width:
|
|
943
|
-
height:
|
|
944
|
-
left:
|
|
945
|
-
top:
|
|
946
|
-
angle:
|
|
942
|
+
width: tn = 0,
|
|
943
|
+
height: nn = 0,
|
|
944
|
+
left: rn = 0,
|
|
945
|
+
top: sn = 0,
|
|
946
|
+
angle: on = 0
|
|
947
947
|
} = ae;
|
|
948
|
-
|
|
948
|
+
m(tn), b(nn), M(rn), x(sn), oe(on);
|
|
949
949
|
};
|
|
950
950
|
ge(() => {
|
|
951
951
|
const C = a.changeStart$.subscribe((ae) => {
|
|
@@ -964,7 +964,7 @@ function fn(n) {
|
|
|
964
964
|
props: {
|
|
965
965
|
width: C
|
|
966
966
|
}
|
|
967
|
-
}), l == null || l.resize(C, l.height),
|
|
967
|
+
}), l == null || l.resize(C, l.height), m(C), a == null || a.refreshControls());
|
|
968
968
|
}
|
|
969
969
|
function Q(C) {
|
|
970
970
|
!C || !l || (s.executeCommand(B.id, {
|
|
@@ -984,16 +984,16 @@ function fn(n) {
|
|
|
984
984
|
}
|
|
985
985
|
}), l == null || l.translate(C, l.top), M(C), a == null || a.refreshControls());
|
|
986
986
|
}
|
|
987
|
-
function
|
|
987
|
+
function _e(C) {
|
|
988
988
|
!C || !l || (s.executeCommand(B.id, {
|
|
989
989
|
pageId: e,
|
|
990
990
|
oKey: l.oKey,
|
|
991
991
|
props: {
|
|
992
992
|
right: C
|
|
993
993
|
}
|
|
994
|
-
}), l == null || l.translate(l.left, C),
|
|
994
|
+
}), l == null || l.translate(l.left, C), x(C), a == null || a.refreshControls());
|
|
995
995
|
}
|
|
996
|
-
function
|
|
996
|
+
function me(C) {
|
|
997
997
|
!C || !l || (s.executeCommand(B.id, {
|
|
998
998
|
pageId: e,
|
|
999
999
|
oKey: l.oKey,
|
|
@@ -1004,125 +1004,110 @@ function fn(n) {
|
|
|
1004
1004
|
angle: C
|
|
1005
1005
|
}), oe(C), a == null || a.refreshControls());
|
|
1006
1006
|
}
|
|
1007
|
-
return /* @__PURE__ */
|
|
1007
|
+
return /* @__PURE__ */ R(
|
|
1008
1008
|
"div",
|
|
1009
1009
|
{
|
|
1010
|
-
className: k("univer-
|
|
1010
|
+
className: k("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", Dt),
|
|
1011
1011
|
children: [
|
|
1012
|
-
/* @__PURE__ */
|
|
1012
|
+
/* @__PURE__ */ g(
|
|
1013
|
+
"header",
|
|
1014
|
+
{
|
|
1015
|
+
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
1016
|
+
children: /* @__PURE__ */ g("div", { children: n.t("image-panel.transform.title") })
|
|
1017
|
+
}
|
|
1018
|
+
),
|
|
1019
|
+
/* @__PURE__ */ R(
|
|
1013
1020
|
"div",
|
|
1014
1021
|
{
|
|
1015
|
-
className: "univer-
|
|
1016
|
-
children:
|
|
1022
|
+
className: "univer-grid univer-grid-cols-3 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",
|
|
1023
|
+
children: [
|
|
1024
|
+
/* @__PURE__ */ R("div", { children: [
|
|
1025
|
+
/* @__PURE__ */ g("span", { children: n.t("image-panel.transform.width") }),
|
|
1026
|
+
/* @__PURE__ */ g(
|
|
1027
|
+
le,
|
|
1028
|
+
{
|
|
1029
|
+
min: 1,
|
|
1030
|
+
value: h,
|
|
1031
|
+
onChange: (C) => {
|
|
1032
|
+
L(C);
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
)
|
|
1036
|
+
] }),
|
|
1037
|
+
/* @__PURE__ */ R("div", { children: [
|
|
1038
|
+
/* @__PURE__ */ g("span", { children: n.t("image-panel.transform.height") }),
|
|
1039
|
+
/* @__PURE__ */ g(
|
|
1040
|
+
le,
|
|
1041
|
+
{
|
|
1042
|
+
min: 1,
|
|
1043
|
+
value: I,
|
|
1044
|
+
onChange: (C) => {
|
|
1045
|
+
Q(C);
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
)
|
|
1049
|
+
] })
|
|
1050
|
+
]
|
|
1017
1051
|
}
|
|
1018
|
-
)
|
|
1019
|
-
/* @__PURE__ */
|
|
1020
|
-
/* @__PURE__ */
|
|
1021
|
-
/* @__PURE__ */
|
|
1022
|
-
/* @__PURE__ */
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
/* @__PURE__ */ u("div", { className: "univer-relative univer-mt-2.5 univer-flex univer-h-full", children: /* @__PURE__ */ u("div", { className: "univer-w-full", children: i.t("image-panel.transform.height") }) }),
|
|
1036
|
-
/* @__PURE__ */ u("div", { className: "univer-relative univer-mt-2.5 univer-flex univer-h-full", children: /* @__PURE__ */ u("div", { className: "univer-w-full", children: /* @__PURE__ */ u(
|
|
1052
|
+
),
|
|
1053
|
+
/* @__PURE__ */ R("div", { className: "univer-relative univer-mt-2.5 univer-flex univer-h-full", children: [
|
|
1054
|
+
/* @__PURE__ */ R("div", { children: [
|
|
1055
|
+
/* @__PURE__ */ g("span", { children: n.t("image-panel.transform.x") }),
|
|
1056
|
+
/* @__PURE__ */ g(le, { min: 0, precision: 1, value: T, onChange: (C) => {
|
|
1057
|
+
ee(C);
|
|
1058
|
+
} })
|
|
1059
|
+
] }),
|
|
1060
|
+
/* @__PURE__ */ R("div", { children: [
|
|
1061
|
+
/* @__PURE__ */ g("span", { children: n.t("image-panel.transform.y") }),
|
|
1062
|
+
/* @__PURE__ */ g(le, { min: 0, precision: 1, value: N, onChange: (C) => {
|
|
1063
|
+
_e(C);
|
|
1064
|
+
} })
|
|
1065
|
+
] }),
|
|
1066
|
+
/* @__PURE__ */ R("div", { children: [
|
|
1067
|
+
/* @__PURE__ */ g("span", { children: n.t("image-panel.transform.rotate") }),
|
|
1068
|
+
/* @__PURE__ */ g(
|
|
1037
1069
|
le,
|
|
1038
1070
|
{
|
|
1039
|
-
className: "univer-w-11/12",
|
|
1040
|
-
min: 1,
|
|
1041
|
-
value: I,
|
|
1042
|
-
onChange: (C) => {
|
|
1043
|
-
Q(C);
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
) }) })
|
|
1047
|
-
] }) })
|
|
1048
|
-
] }),
|
|
1049
|
-
/* @__PURE__ */ x("div", { className: "univer-relative univer-mt-2.5 univer-flex univer-h-full", children: [
|
|
1050
|
-
/* @__PURE__ */ u("div", { className: "univer-w-1/3", children: /* @__PURE__ */ x("label", { children: [
|
|
1051
|
-
/* @__PURE__ */ u("div", { className: "univer-relative univer-mt-2.5 univer-flex univer-h-full", children: /* @__PURE__ */ u("div", { className: "univer-w-full", children: i.t("image-panel.transform.x") }) }),
|
|
1052
|
-
/* @__PURE__ */ u("div", { className: "univer-relative univer-mt-2.5 univer-flex univer-h-full", children: /* @__PURE__ */ u("div", { className: "univer-w-full", children: /* @__PURE__ */ u(
|
|
1053
|
-
le,
|
|
1054
|
-
{
|
|
1055
|
-
className: "univer-w-11/12",
|
|
1056
|
-
precision: 1,
|
|
1057
|
-
min: 0,
|
|
1058
|
-
value: T,
|
|
1059
|
-
onChange: (C) => {
|
|
1060
|
-
ee(C);
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
) }) })
|
|
1064
|
-
] }) }),
|
|
1065
|
-
/* @__PURE__ */ u("div", { className: "univer-w-1/3", children: /* @__PURE__ */ x("label", { children: [
|
|
1066
|
-
/* @__PURE__ */ u("div", { className: "univer-relative univer-mt-2.5 univer-flex univer-h-full", children: /* @__PURE__ */ u("div", { className: "univer-w-full", children: i.t("image-panel.transform.y") }) }),
|
|
1067
|
-
/* @__PURE__ */ u("div", { className: "univer-relative univer-mt-2.5 univer-flex univer-h-full", children: /* @__PURE__ */ u("div", { className: "univer-w-full", children: /* @__PURE__ */ u(
|
|
1068
|
-
le,
|
|
1069
|
-
{
|
|
1070
|
-
className: "univer-w-11/12",
|
|
1071
|
-
precision: 1,
|
|
1072
|
-
min: 0,
|
|
1073
|
-
value: U,
|
|
1074
|
-
onChange: (C) => {
|
|
1075
|
-
me(C);
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
) }) })
|
|
1079
|
-
] }) }),
|
|
1080
|
-
/* @__PURE__ */ u("div", { className: "univer-w-1/3", children: /* @__PURE__ */ x("label", { children: [
|
|
1081
|
-
/* @__PURE__ */ u("div", { className: "univer-relative univer-mt-2.5 univer-flex univer-h-full", children: /* @__PURE__ */ u("div", { className: "univer-w-full", children: i.t("image-panel.transform.rotate") }) }),
|
|
1082
|
-
/* @__PURE__ */ u("div", { className: "univer-relative univer-mt-2.5 univer-flex univer-h-full", children: /* @__PURE__ */ u("div", { className: "univer-w-full", children: /* @__PURE__ */ u(
|
|
1083
|
-
le,
|
|
1084
|
-
{
|
|
1085
|
-
className: "univer-w-11/12",
|
|
1086
1071
|
precision: 1,
|
|
1087
1072
|
value: W,
|
|
1088
|
-
onChange:
|
|
1073
|
+
onChange: me
|
|
1089
1074
|
}
|
|
1090
|
-
)
|
|
1091
|
-
] })
|
|
1075
|
+
)
|
|
1076
|
+
] })
|
|
1092
1077
|
] })
|
|
1093
1078
|
]
|
|
1094
1079
|
}
|
|
1095
1080
|
);
|
|
1096
1081
|
}
|
|
1097
1082
|
const Ee = "COMPONENT_SLIDE_SIDEBAR";
|
|
1098
|
-
function
|
|
1099
|
-
var
|
|
1100
|
-
const
|
|
1101
|
-
if (!
|
|
1102
|
-
const o = (d = e.getRenderUnitByPageId(
|
|
1083
|
+
function fi() {
|
|
1084
|
+
var u, l, d;
|
|
1085
|
+
const i = O(w), e = O(P), t = i.getCurrentUnitForType(E.UNIVER_SLIDE), n = (u = t == null ? void 0 : t.getActivePage()) == null ? void 0 : u.id, r = ((l = i.getFocusedUnit()) == null ? void 0 : l.getUnitId()) || "";
|
|
1086
|
+
if (!n || !r) return null;
|
|
1087
|
+
const o = (d = e.getRenderUnitByPageId(n, r).scene) == null ? void 0 : d.getTransformer();
|
|
1103
1088
|
if (!o) return null;
|
|
1104
1089
|
const a = o.getSelectedObjectMap().values().next().value;
|
|
1105
|
-
return a ? /* @__PURE__ */
|
|
1106
|
-
/* @__PURE__ */
|
|
1107
|
-
/* @__PURE__ */
|
|
1108
|
-
a.objectType === de.RECT && /* @__PURE__ */
|
|
1090
|
+
return a ? /* @__PURE__ */ R("section", { className: "univer-p-2 univer-text-center univer-text-sm", children: [
|
|
1091
|
+
/* @__PURE__ */ g(gi, { pageId: n, unitId: r }),
|
|
1092
|
+
/* @__PURE__ */ g(pi, { pageId: n, unitId: r }),
|
|
1093
|
+
a.objectType === de.RECT && /* @__PURE__ */ g(vi, { pageId: n, unitId: r })
|
|
1109
1094
|
] }) : null;
|
|
1110
1095
|
}
|
|
1111
1096
|
const Ye = {
|
|
1112
1097
|
id: "slide.command.insert-float-shape.rectangle",
|
|
1113
|
-
type:
|
|
1114
|
-
handler: async (
|
|
1098
|
+
type: D.COMMAND,
|
|
1099
|
+
handler: async (i) => {
|
|
1115
1100
|
var r;
|
|
1116
|
-
const e =
|
|
1117
|
-
return e.executeCommand(Zt.id, { unitId:
|
|
1101
|
+
const e = i.get(U), n = (r = i.get(w).getFocusedUnit()) == null ? void 0 : r.getUnitId();
|
|
1102
|
+
return e.executeCommand(Zt.id, { unitId: n });
|
|
1118
1103
|
}
|
|
1119
1104
|
}, Zt = {
|
|
1120
1105
|
id: "slide.operation.insert-float-shape.rectangle",
|
|
1121
|
-
type:
|
|
1122
|
-
handler: async (
|
|
1123
|
-
const t = ze(6),
|
|
1106
|
+
type: D.OPERATION,
|
|
1107
|
+
handler: async (i, e) => {
|
|
1108
|
+
const t = ze(6), n = i.get(w), r = e.unitId, s = n.getUnit(r);
|
|
1124
1109
|
if (!s) return !1;
|
|
1125
|
-
const o = s.getActivePage(), c = Object.values(o.pageElements), a = c != null && c.length ? Math.max(...c.map((v) => v.zIndex)) : 20,
|
|
1110
|
+
const o = s.getActivePage(), c = Object.values(o.pageElements), a = c != null && c.length ? Math.max(...c.map((v) => v.zIndex)) : 20, u = {
|
|
1126
1111
|
id: t,
|
|
1127
1112
|
zIndex: a + 1,
|
|
1128
1113
|
left: 378,
|
|
@@ -1131,7 +1116,7 @@ const Ye = {
|
|
|
1131
1116
|
height: 250,
|
|
1132
1117
|
title: t,
|
|
1133
1118
|
description: "",
|
|
1134
|
-
type:
|
|
1119
|
+
type: De.SHAPE,
|
|
1135
1120
|
shape: {
|
|
1136
1121
|
shapeType: It.Rect,
|
|
1137
1122
|
text: "",
|
|
@@ -1142,17 +1127,17 @@ const Ye = {
|
|
|
1142
1127
|
}
|
|
1143
1128
|
}
|
|
1144
1129
|
};
|
|
1145
|
-
o.pageElements[t] =
|
|
1146
|
-
const l =
|
|
1130
|
+
o.pageElements[t] = u, s.updatePage(o.id, o);
|
|
1131
|
+
const l = i.get(P), d = l.createObjectToPage(u, o.id, r);
|
|
1147
1132
|
return d && l.setObjectActiveByPage(d, o.id, r), !0;
|
|
1148
1133
|
}
|
|
1149
1134
|
}, $e = {
|
|
1150
1135
|
id: "sidebar.operation.slide-shape",
|
|
1151
|
-
type:
|
|
1152
|
-
handler: async (
|
|
1153
|
-
const { visible: t, objectType:
|
|
1136
|
+
type: D.COMMAND,
|
|
1137
|
+
handler: async (i, e) => {
|
|
1138
|
+
const { visible: t, objectType: n } = e, r = i.get(Tt), s = i.get(J);
|
|
1154
1139
|
let o = "", c = "";
|
|
1155
|
-
return
|
|
1140
|
+
return n === de.RECT ? (o = "slide.sidebar.shape", c = Ee) : n === de.IMAGE ? (o = "slide.sidebar.image", c = Ee) : n === de.RICH_TEXT && (o = "slide.sidebar.text", c = Ee), t ? r.open({
|
|
1156
1141
|
header: { title: s.t(o) },
|
|
1157
1142
|
children: { label: c },
|
|
1158
1143
|
onClose: () => {
|
|
@@ -1162,19 +1147,19 @@ const Ye = {
|
|
|
1162
1147
|
}
|
|
1163
1148
|
}, qe = {
|
|
1164
1149
|
id: "slide.command.insert-float-shape.ellipse",
|
|
1165
|
-
type:
|
|
1166
|
-
handler: async (
|
|
1150
|
+
type: D.COMMAND,
|
|
1151
|
+
handler: async (i) => {
|
|
1167
1152
|
var r;
|
|
1168
|
-
const e =
|
|
1169
|
-
return e.executeCommand(Gt.id, { unitId:
|
|
1153
|
+
const e = i.get(U), n = (r = i.get(w).getFocusedUnit()) == null ? void 0 : r.getUnitId();
|
|
1154
|
+
return e.executeCommand(Gt.id, { unitId: n });
|
|
1170
1155
|
}
|
|
1171
1156
|
}, Gt = {
|
|
1172
1157
|
id: "slide.operation.insert-float-shape.ellipse",
|
|
1173
|
-
type:
|
|
1174
|
-
handler: async (
|
|
1175
|
-
const t = ze(6),
|
|
1158
|
+
type: D.OPERATION,
|
|
1159
|
+
handler: async (i, e) => {
|
|
1160
|
+
const t = ze(6), n = i.get(w), r = e.unitId, s = n.getUnit(r);
|
|
1176
1161
|
if (!s) return !1;
|
|
1177
|
-
const o = s.getActivePage(), c = Object.values(o.pageElements), a = c != null && c.length ? Math.max(...c.map((v) => v.zIndex)) : 20,
|
|
1162
|
+
const o = s.getActivePage(), c = Object.values(o.pageElements), a = c != null && c.length ? Math.max(...c.map((v) => v.zIndex)) : 20, u = {
|
|
1178
1163
|
id: t,
|
|
1179
1164
|
zIndex: a + 1,
|
|
1180
1165
|
left: 378,
|
|
@@ -1183,7 +1168,7 @@ const Ye = {
|
|
|
1183
1168
|
height: 250,
|
|
1184
1169
|
title: t,
|
|
1185
1170
|
description: "",
|
|
1186
|
-
type:
|
|
1171
|
+
type: De.SHAPE,
|
|
1187
1172
|
shape: {
|
|
1188
1173
|
shapeType: It.Ellipse,
|
|
1189
1174
|
text: "",
|
|
@@ -1195,34 +1180,34 @@ const Ye = {
|
|
|
1195
1180
|
}
|
|
1196
1181
|
}
|
|
1197
1182
|
};
|
|
1198
|
-
o.pageElements[t] =
|
|
1199
|
-
const l =
|
|
1183
|
+
o.pageElements[t] = u, s.updatePage(o.id, o);
|
|
1184
|
+
const l = i.get(P), d = l.createObjectToPage(u, o.id, r);
|
|
1200
1185
|
return d && l.setObjectActiveByPage(d, o.id, r), !0;
|
|
1201
1186
|
}
|
|
1202
1187
|
}, Je = {
|
|
1203
1188
|
id: "slide.command.add-text",
|
|
1204
|
-
type:
|
|
1205
|
-
handler: async (
|
|
1189
|
+
type: D.COMMAND,
|
|
1190
|
+
handler: async (i) => {
|
|
1206
1191
|
var r;
|
|
1207
|
-
const e =
|
|
1208
|
-
return await e.executeCommand(Xt.id, { unitId:
|
|
1192
|
+
const e = i.get(U), n = (r = i.get(w).getFocusedUnit()) == null ? void 0 : r.getUnitId();
|
|
1193
|
+
return await e.executeCommand(Xt.id, { unitId: n });
|
|
1209
1194
|
}
|
|
1210
1195
|
}, Xt = {
|
|
1211
1196
|
id: "slide.operation.add-text",
|
|
1212
|
-
type:
|
|
1213
|
-
handler: async (
|
|
1214
|
-
const t = e.unitId,
|
|
1197
|
+
type: D.OPERATION,
|
|
1198
|
+
handler: async (i, e) => {
|
|
1199
|
+
const t = e.unitId, n = ze(6), r = 220, s = 40, o = 230, c = 142, a = (e == null ? void 0 : e.text) || "A New Text", l = i.get(w).getUnit(t);
|
|
1215
1200
|
if (!l) return !1;
|
|
1216
|
-
const d = l.getActivePage(), v = Object.values(d.pageElements),
|
|
1217
|
-
id:
|
|
1218
|
-
zIndex:
|
|
1201
|
+
const d = l.getActivePage(), v = Object.values(d.pageElements), _ = v != null && v.length ? Math.max(...v.map((m) => m.zIndex)) : 21, f = {
|
|
1202
|
+
id: n,
|
|
1203
|
+
zIndex: _ + 1,
|
|
1219
1204
|
left: o,
|
|
1220
1205
|
top: c,
|
|
1221
1206
|
width: r,
|
|
1222
1207
|
height: s,
|
|
1223
1208
|
title: "text",
|
|
1224
1209
|
description: "",
|
|
1225
|
-
type:
|
|
1210
|
+
type: De.TEXT,
|
|
1226
1211
|
richText: {
|
|
1227
1212
|
text: a,
|
|
1228
1213
|
fs: 30,
|
|
@@ -1232,209 +1217,209 @@ const Ye = {
|
|
|
1232
1217
|
bl: 1
|
|
1233
1218
|
}
|
|
1234
1219
|
};
|
|
1235
|
-
d.pageElements[
|
|
1236
|
-
const
|
|
1237
|
-
return
|
|
1220
|
+
d.pageElements[n] = f, l.updatePage(d.id, d);
|
|
1221
|
+
const p = i.get(P), h = p.createObjectToPage(f, d.id, t);
|
|
1222
|
+
return h && p.setObjectActiveByPage(h, d.id, t), !0;
|
|
1238
1223
|
}
|
|
1239
1224
|
}, Yt = {
|
|
1240
1225
|
id: "slide.operation.set-slide-page-thumb",
|
|
1241
|
-
type:
|
|
1242
|
-
handler: (
|
|
1226
|
+
type: D.OPERATION,
|
|
1227
|
+
handler: (i, e) => (i.get(P).createThumbs(e.unitId), !0)
|
|
1243
1228
|
};
|
|
1244
|
-
function
|
|
1245
|
-
var
|
|
1246
|
-
const
|
|
1229
|
+
function _i() {
|
|
1230
|
+
var f, p;
|
|
1231
|
+
const i = O(w), e = O(U), t = O(K), n = O(J), r = Ut(null), s = i.getCurrentUnitForType(E.UNIVER_SLIDE), o = s == null ? void 0 : s.getPages(), c = s == null ? void 0 : s.getPageOrder();
|
|
1247
1232
|
if (!o || !c)
|
|
1248
1233
|
return null;
|
|
1249
|
-
const a = c.map((
|
|
1234
|
+
const a = c.map((h) => o[h]), [u, l] = $((p = (f = s == null ? void 0 : s.getActivePage()) == null ? void 0 : f.id) != null ? p : null), d = Bn(() => a.map(() => Hn()), [a]);
|
|
1250
1235
|
ge(() => {
|
|
1251
|
-
const
|
|
1236
|
+
const h = s == null ? void 0 : s.activePage$.subscribe((m) => {
|
|
1252
1237
|
var b;
|
|
1253
|
-
const I = (b =
|
|
1238
|
+
const I = (b = m == null ? void 0 : m.id) != null ? b : null;
|
|
1254
1239
|
I && l(I);
|
|
1255
1240
|
});
|
|
1256
1241
|
return () => {
|
|
1257
|
-
|
|
1242
|
+
h == null || h.unsubscribe();
|
|
1258
1243
|
};
|
|
1259
1244
|
}, []), ge(() => {
|
|
1260
|
-
d.forEach((
|
|
1245
|
+
d.forEach((h, m) => {
|
|
1261
1246
|
var I;
|
|
1262
|
-
if (
|
|
1263
|
-
const b = a[
|
|
1264
|
-
(I = t.getRenderById(b.id)) == null || I.engine.setContainer(
|
|
1247
|
+
if (h.current) {
|
|
1248
|
+
const b = a[m];
|
|
1249
|
+
(I = t.getRenderById(b.id)) == null || I.engine.setContainer(h.current);
|
|
1265
1250
|
}
|
|
1266
1251
|
}), d.length > 0 && e.syncExecuteCommand(Yt.id, { unitId: s == null ? void 0 : s.getUnitId() });
|
|
1267
1252
|
}, [d, a, t, e, s]);
|
|
1268
|
-
const v = lt((
|
|
1269
|
-
e.syncExecuteCommand(Vt.id, { id:
|
|
1270
|
-
}, [e, s]),
|
|
1253
|
+
const v = lt((h) => {
|
|
1254
|
+
e.syncExecuteCommand(Vt.id, { id: h, unitId: s == null ? void 0 : s.getUnitId() });
|
|
1255
|
+
}, [e, s]), _ = lt(() => {
|
|
1271
1256
|
e.syncExecuteCommand(jt.id, { unitId: s == null ? void 0 : s.getUnitId() });
|
|
1272
1257
|
}, [e, s]);
|
|
1273
|
-
return /* @__PURE__ */
|
|
1258
|
+
return /* @__PURE__ */ g(
|
|
1274
1259
|
"aside",
|
|
1275
1260
|
{
|
|
1276
1261
|
ref: r,
|
|
1277
|
-
className: k("univer-flex univer-h-full univer-w-64 univer-flex-col univer-overflow-y-auto univer-overflow-x-hidden",
|
|
1278
|
-
children: /* @__PURE__ */
|
|
1279
|
-
/* @__PURE__ */
|
|
1262
|
+
className: k("univer-flex univer-h-full univer-w-64 univer-flex-col univer-overflow-y-auto univer-overflow-x-hidden", $n),
|
|
1263
|
+
children: /* @__PURE__ */ R("div", { className: "univer-px-4", children: [
|
|
1264
|
+
/* @__PURE__ */ g("header", { className: "univer-flex univer-justify-center univer-pt-4", children: /* @__PURE__ */ g(
|
|
1280
1265
|
"a",
|
|
1281
1266
|
{
|
|
1282
1267
|
className: k("univer-box-border univer-block univer-h-8 univer-w-full univer-cursor-pointer univer-rounded-md univer-bg-white univer-text-center univer-text-sm univer-leading-8 univer-transition-colors", he),
|
|
1283
|
-
onClick:
|
|
1284
|
-
children:
|
|
1268
|
+
onClick: _,
|
|
1269
|
+
children: n.t("slide.append")
|
|
1285
1270
|
}
|
|
1286
1271
|
) }),
|
|
1287
|
-
a.map((
|
|
1272
|
+
a.map((h, m) => /* @__PURE__ */ R(
|
|
1288
1273
|
"div",
|
|
1289
1274
|
{
|
|
1290
1275
|
className: k("univer-my-4 univer-flex univer-gap-2", {
|
|
1291
|
-
"[&>div]:univer-border-primary-600 [&>span]:univer-text-primary-600":
|
|
1276
|
+
"[&>div]:univer-border-primary-600 [&>span]:univer-text-primary-600": h.id === u
|
|
1292
1277
|
}),
|
|
1293
|
-
onClick: () => v(
|
|
1278
|
+
onClick: () => v(h.id),
|
|
1294
1279
|
children: [
|
|
1295
|
-
/* @__PURE__ */
|
|
1296
|
-
/* @__PURE__ */
|
|
1280
|
+
/* @__PURE__ */ g("span", { children: m + 1 }),
|
|
1281
|
+
/* @__PURE__ */ g(
|
|
1297
1282
|
"div",
|
|
1298
1283
|
{
|
|
1299
|
-
ref: d[
|
|
1284
|
+
ref: d[m],
|
|
1300
1285
|
className: k("univer-relative univer-box-border univer-h-32 univer-w-52 univer-bg-white hover:univer-border-primary-600", he)
|
|
1301
1286
|
}
|
|
1302
1287
|
)
|
|
1303
1288
|
]
|
|
1304
1289
|
},
|
|
1305
|
-
|
|
1290
|
+
h.id
|
|
1306
1291
|
))
|
|
1307
1292
|
] })
|
|
1308
1293
|
}
|
|
1309
1294
|
);
|
|
1310
1295
|
}
|
|
1311
|
-
const ue =
|
|
1312
|
-
function
|
|
1296
|
+
const ue = un("SLIDE_EDITOR"), qt = "slide.menu.image";
|
|
1297
|
+
function mi(i) {
|
|
1313
1298
|
return {
|
|
1314
1299
|
id: qt,
|
|
1315
1300
|
type: se.SUBITEMS,
|
|
1316
1301
|
icon: "AddImageIcon",
|
|
1317
1302
|
tooltip: "slide.image.insert.title",
|
|
1318
|
-
hidden$: re(
|
|
1303
|
+
hidden$: re(i, E.UNIVER_SLIDE)
|
|
1319
1304
|
};
|
|
1320
1305
|
}
|
|
1321
|
-
function
|
|
1306
|
+
function Ci(i) {
|
|
1322
1307
|
return {
|
|
1323
1308
|
id: Ge.id,
|
|
1324
1309
|
title: "slide.image.insert.float",
|
|
1325
1310
|
type: se.BUTTON,
|
|
1326
|
-
hidden$: re(
|
|
1311
|
+
hidden$: re(i, E.UNIVER_SLIDE)
|
|
1327
1312
|
};
|
|
1328
1313
|
}
|
|
1329
1314
|
const Jt = "slide.menu.shape";
|
|
1330
|
-
function
|
|
1315
|
+
function Si(i) {
|
|
1331
1316
|
return {
|
|
1332
1317
|
id: Jt,
|
|
1333
1318
|
type: se.SUBITEMS,
|
|
1334
1319
|
icon: "GraphIcon",
|
|
1335
1320
|
tooltip: "slide.shape.insert.title",
|
|
1336
|
-
hidden$: re(
|
|
1321
|
+
hidden$: re(i, E.UNIVER_SLIDE)
|
|
1337
1322
|
// disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission], rangeTypes: [RangeProtectionPermissionEditPoint] }),
|
|
1338
1323
|
};
|
|
1339
1324
|
}
|
|
1340
|
-
function
|
|
1325
|
+
function Ii(i) {
|
|
1341
1326
|
return {
|
|
1342
1327
|
id: Ye.id,
|
|
1343
1328
|
title: "slide.shape.insert.rectangle",
|
|
1344
1329
|
type: se.BUTTON,
|
|
1345
|
-
hidden$: re(
|
|
1330
|
+
hidden$: re(i, E.UNIVER_SLIDE)
|
|
1346
1331
|
};
|
|
1347
1332
|
}
|
|
1348
|
-
function
|
|
1333
|
+
function bi(i) {
|
|
1349
1334
|
return {
|
|
1350
1335
|
id: qe.id,
|
|
1351
1336
|
title: "slide.shape.insert.ellipse",
|
|
1352
1337
|
type: se.BUTTON,
|
|
1353
|
-
hidden$: re(
|
|
1338
|
+
hidden$: re(i, E.UNIVER_SLIDE)
|
|
1354
1339
|
};
|
|
1355
1340
|
}
|
|
1356
|
-
function
|
|
1341
|
+
function Ei(i) {
|
|
1357
1342
|
return {
|
|
1358
1343
|
id: Je.id,
|
|
1359
1344
|
type: se.BUTTON,
|
|
1360
1345
|
icon: "TextIcon",
|
|
1361
1346
|
tooltip: "slide.text.insert.title",
|
|
1362
|
-
hidden$: re(
|
|
1347
|
+
hidden$: re(i, E.UNIVER_SLIDE)
|
|
1363
1348
|
};
|
|
1364
1349
|
}
|
|
1365
|
-
const
|
|
1366
|
-
[
|
|
1350
|
+
const Ri = {
|
|
1351
|
+
[Pn.FORMAT]: {
|
|
1367
1352
|
[Je.id]: {
|
|
1368
1353
|
order: 0,
|
|
1369
|
-
menuItemFactory:
|
|
1354
|
+
menuItemFactory: Ei
|
|
1370
1355
|
},
|
|
1371
1356
|
[qt]: {
|
|
1372
1357
|
order: 0,
|
|
1373
|
-
menuItemFactory:
|
|
1358
|
+
menuItemFactory: mi,
|
|
1374
1359
|
[Ge.id]: {
|
|
1375
1360
|
order: 0,
|
|
1376
|
-
menuItemFactory:
|
|
1361
|
+
menuItemFactory: Ci
|
|
1377
1362
|
}
|
|
1378
1363
|
},
|
|
1379
1364
|
[Jt]: {
|
|
1380
1365
|
order: 0,
|
|
1381
|
-
menuItemFactory:
|
|
1366
|
+
menuItemFactory: Si,
|
|
1382
1367
|
[Ye.id]: {
|
|
1383
1368
|
order: 0,
|
|
1384
|
-
menuItemFactory:
|
|
1369
|
+
menuItemFactory: Ii
|
|
1385
1370
|
},
|
|
1386
1371
|
[qe.id]: {
|
|
1387
1372
|
order: 0,
|
|
1388
|
-
menuItemFactory:
|
|
1373
|
+
menuItemFactory: bi
|
|
1389
1374
|
}
|
|
1390
1375
|
}
|
|
1391
1376
|
}
|
|
1392
1377
|
}, Oe = {
|
|
1393
1378
|
id: "slide.operation.edit-arrow",
|
|
1394
|
-
type:
|
|
1379
|
+
type: D.OPERATION,
|
|
1395
1380
|
handler: () => !0
|
|
1396
1381
|
}, Qt = "COMPONENT_SLIDE_IMAGE_POPUP_MENU";
|
|
1397
|
-
function
|
|
1398
|
-
var
|
|
1399
|
-
const e = (
|
|
1382
|
+
function xi(i) {
|
|
1383
|
+
var f, p;
|
|
1384
|
+
const e = (p = (f = i.popup) == null ? void 0 : f.extraProps) == null ? void 0 : p.menuItems;
|
|
1400
1385
|
if (!e)
|
|
1401
1386
|
return null;
|
|
1402
|
-
const t = O(
|
|
1387
|
+
const t = O(U), n = O(J), [r, s] = $(!1), [o, c] = $(!1), a = () => {
|
|
1403
1388
|
c(!0);
|
|
1404
|
-
},
|
|
1389
|
+
}, u = () => {
|
|
1405
1390
|
c(!1);
|
|
1406
|
-
}, l = (
|
|
1407
|
-
s(
|
|
1408
|
-
}, d = (
|
|
1409
|
-
t.executeCommand(
|
|
1410
|
-
}, v = r || o,
|
|
1411
|
-
return /* @__PURE__ */
|
|
1391
|
+
}, l = (h) => {
|
|
1392
|
+
s(h);
|
|
1393
|
+
}, d = (h) => {
|
|
1394
|
+
t.executeCommand(h.commandId, h.commandParams), s(!1);
|
|
1395
|
+
}, v = r || o, _ = e.filter((h) => !h.disable);
|
|
1396
|
+
return /* @__PURE__ */ g(
|
|
1412
1397
|
"div",
|
|
1413
1398
|
{
|
|
1414
1399
|
onMouseEnter: a,
|
|
1415
|
-
onMouseLeave:
|
|
1416
|
-
children: /* @__PURE__ */
|
|
1400
|
+
onMouseLeave: u,
|
|
1401
|
+
children: /* @__PURE__ */ g(
|
|
1417
1402
|
Mt,
|
|
1418
1403
|
{
|
|
1419
1404
|
align: "start",
|
|
1420
|
-
overlay: /* @__PURE__ */
|
|
1405
|
+
overlay: /* @__PURE__ */ g(
|
|
1421
1406
|
"ul",
|
|
1422
1407
|
{
|
|
1423
1408
|
className: k("univer-m-0 univer-box-border univer-grid univer-list-none univer-items-center univer-gap-1 univer-rounded-lg univer-bg-white univer-p-1.5 univer-text-sm univer-shadow-lg", he),
|
|
1424
|
-
children:
|
|
1409
|
+
children: _.map((h) => /* @__PURE__ */ g(
|
|
1425
1410
|
"li",
|
|
1426
1411
|
{
|
|
1427
1412
|
className: "univer-relative univer-box-border univer-flex univer-h-8 univer-cursor-pointer univer-items-center univer-rounded univer-text-sm univer-transition-colors hover:univer-bg-gray-100",
|
|
1428
|
-
onClick: () => d(
|
|
1429
|
-
children: /* @__PURE__ */
|
|
1413
|
+
onClick: () => d(h),
|
|
1414
|
+
children: /* @__PURE__ */ g("span", { className: "univer-px-2 univer-py-1.5 univer-align-middle", children: n.t(h.label) })
|
|
1430
1415
|
},
|
|
1431
|
-
|
|
1416
|
+
h.index
|
|
1432
1417
|
))
|
|
1433
1418
|
}
|
|
1434
1419
|
),
|
|
1435
1420
|
open: r,
|
|
1436
1421
|
onOpenChange: l,
|
|
1437
|
-
children: /* @__PURE__ */
|
|
1422
|
+
children: /* @__PURE__ */ R(
|
|
1438
1423
|
"div",
|
|
1439
1424
|
{
|
|
1440
1425
|
className: k("univer-flex univer-items-center univer-gap-2 univer-rounded univer-p-1 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-800", he, {
|
|
@@ -1442,13 +1427,13 @@ function Rn(n) {
|
|
|
1442
1427
|
"univer-bg-white dark:!univer-bg-gray-900": !r
|
|
1443
1428
|
}),
|
|
1444
1429
|
children: [
|
|
1445
|
-
/* @__PURE__ */
|
|
1430
|
+
/* @__PURE__ */ g(
|
|
1446
1431
|
zt,
|
|
1447
1432
|
{
|
|
1448
1433
|
className: "univer-fill-primary-600 univer-text-gray-900 dark:!univer-text-white"
|
|
1449
1434
|
}
|
|
1450
1435
|
),
|
|
1451
|
-
v && /* @__PURE__ */
|
|
1436
|
+
v && /* @__PURE__ */ g(Xe, { className: "dark:!univer-text-white" })
|
|
1452
1437
|
]
|
|
1453
1438
|
}
|
|
1454
1439
|
)
|
|
@@ -1457,7 +1442,7 @@ function Rn(n) {
|
|
|
1457
1442
|
}
|
|
1458
1443
|
);
|
|
1459
1444
|
}
|
|
1460
|
-
class
|
|
1445
|
+
class Oi {
|
|
1461
1446
|
constructor() {
|
|
1462
1447
|
S(this, "_state", null);
|
|
1463
1448
|
S(this, "_rect", null);
|
|
@@ -1499,23 +1484,23 @@ const Qe = bt(
|
|
|
1499
1484
|
top: we,
|
|
1500
1485
|
left: we
|
|
1501
1486
|
};
|
|
1502
|
-
function
|
|
1503
|
-
const [
|
|
1487
|
+
function wi() {
|
|
1488
|
+
const [i, e] = $({
|
|
1504
1489
|
...vt
|
|
1505
|
-
}), t = O(Qe),
|
|
1490
|
+
}), t = O(Qe), n = O(Ze), r = O(fe), s = Tn(
|
|
1506
1491
|
() => r.subscribeContextValue$(ot),
|
|
1507
1492
|
!1,
|
|
1508
1493
|
void 0,
|
|
1509
1494
|
[r, ot]
|
|
1510
1495
|
);
|
|
1511
|
-
return
|
|
1496
|
+
return hn.UNSPECIFIED, ge(() => {
|
|
1512
1497
|
t.state$.subscribe((o) => {
|
|
1513
1498
|
if (o == null)
|
|
1514
1499
|
return;
|
|
1515
1500
|
const {
|
|
1516
1501
|
startX: c = we,
|
|
1517
1502
|
startY: a = we,
|
|
1518
|
-
endX:
|
|
1503
|
+
endX: u = 0,
|
|
1519
1504
|
endY: l = 0,
|
|
1520
1505
|
show: d = !1
|
|
1521
1506
|
} = o;
|
|
@@ -1525,50 +1510,50 @@ function wn() {
|
|
|
1525
1510
|
});
|
|
1526
1511
|
else {
|
|
1527
1512
|
e({
|
|
1528
|
-
width:
|
|
1529
|
-
height: l - a -
|
|
1530
|
-
left: c +
|
|
1531
|
-
top: a +
|
|
1513
|
+
width: u - c - ne + 2,
|
|
1514
|
+
height: l - a - ne + 2,
|
|
1515
|
+
left: c + ne,
|
|
1516
|
+
top: a + ne
|
|
1532
1517
|
});
|
|
1533
|
-
const v =
|
|
1518
|
+
const v = n.getEditor(ue);
|
|
1534
1519
|
if (v == null)
|
|
1535
1520
|
return;
|
|
1536
|
-
const { left:
|
|
1537
|
-
t.setRect({ left:
|
|
1521
|
+
const { left: _, top: f, width: p, height: h } = v.getBoundingClientRect();
|
|
1522
|
+
t.setRect({ left: _, top: f, width: p, height: h });
|
|
1538
1523
|
}
|
|
1539
1524
|
});
|
|
1540
1525
|
}, []), ge(() => {
|
|
1541
1526
|
s || t.setFocus(!0);
|
|
1542
|
-
}, [s,
|
|
1527
|
+
}, [s, i]), /* @__PURE__ */ g(
|
|
1543
1528
|
"div",
|
|
1544
1529
|
{
|
|
1545
1530
|
className: k("univer-absolute univer-z-10 univer-box-border univer-flex", he),
|
|
1546
1531
|
style: {
|
|
1547
|
-
left:
|
|
1548
|
-
top:
|
|
1549
|
-
width:
|
|
1550
|
-
height:
|
|
1532
|
+
left: i.left,
|
|
1533
|
+
top: i.top,
|
|
1534
|
+
width: i.width,
|
|
1535
|
+
height: i.height
|
|
1551
1536
|
}
|
|
1552
1537
|
}
|
|
1553
1538
|
);
|
|
1554
1539
|
}
|
|
1555
|
-
function Be(
|
|
1556
|
-
return
|
|
1540
|
+
function Be(i) {
|
|
1541
|
+
return i.getContextValue(Et) && i.getContextValue(Re);
|
|
1557
1542
|
}
|
|
1558
|
-
function
|
|
1559
|
-
return
|
|
1543
|
+
function yi(i) {
|
|
1544
|
+
return i.getContextValue(gn) && i.getContextValue(Et);
|
|
1560
1545
|
}
|
|
1561
|
-
const
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1546
|
+
const en = [
|
|
1547
|
+
y.ARROW_DOWN,
|
|
1548
|
+
y.ARROW_UP,
|
|
1549
|
+
y.ARROW_LEFT,
|
|
1550
|
+
y.ARROW_RIGHT
|
|
1566
1551
|
];
|
|
1567
|
-
[
|
|
1568
|
-
function
|
|
1569
|
-
const
|
|
1570
|
-
for (const e of
|
|
1571
|
-
|
|
1552
|
+
[y.ENTER, y.TAB, ...en];
|
|
1553
|
+
function Pi() {
|
|
1554
|
+
const i = [];
|
|
1555
|
+
for (const e of en)
|
|
1556
|
+
i.push({
|
|
1572
1557
|
id: Oe.id,
|
|
1573
1558
|
binding: e,
|
|
1574
1559
|
preconditions: (t) => Be(t),
|
|
@@ -1578,9 +1563,9 @@ function yn() {
|
|
|
1578
1563
|
keycode: e,
|
|
1579
1564
|
isShift: !1
|
|
1580
1565
|
}
|
|
1581
|
-
}),
|
|
1566
|
+
}), i.push({
|
|
1582
1567
|
id: Oe.id,
|
|
1583
|
-
binding: e |
|
|
1568
|
+
binding: e | Mn.SHIFT,
|
|
1584
1569
|
preconditions: (t) => Be(t),
|
|
1585
1570
|
staticParameters: {
|
|
1586
1571
|
visible: !1,
|
|
@@ -1589,28 +1574,28 @@ function yn() {
|
|
|
1589
1574
|
isShift: !0
|
|
1590
1575
|
}
|
|
1591
1576
|
});
|
|
1592
|
-
return
|
|
1577
|
+
return i;
|
|
1593
1578
|
}
|
|
1594
|
-
const
|
|
1595
|
-
id:
|
|
1596
|
-
preconditions: (
|
|
1597
|
-
binding:
|
|
1579
|
+
const Ti = {
|
|
1580
|
+
id: Fn.id,
|
|
1581
|
+
preconditions: (i) => Be(i) || yi(i),
|
|
1582
|
+
binding: y.BACKSPACE
|
|
1598
1583
|
};
|
|
1599
|
-
var
|
|
1600
|
-
for (var r =
|
|
1601
|
-
(o =
|
|
1584
|
+
var Mi = Object.getOwnPropertyDescriptor, Di = (i, e, t, n) => {
|
|
1585
|
+
for (var r = n > 1 ? void 0 : n ? Mi(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1586
|
+
(o = i[s]) && (r = o(r) || r);
|
|
1602
1587
|
return r;
|
|
1603
|
-
}, te = (
|
|
1604
|
-
let
|
|
1605
|
-
constructor(
|
|
1606
|
-
super(), this._injector =
|
|
1588
|
+
}, te = (i, e) => (t, n) => e(t, n, i);
|
|
1589
|
+
let ye = class extends Ue {
|
|
1590
|
+
constructor(i, e, t, n, r, s) {
|
|
1591
|
+
super(), this._injector = i, this._menuManagerService = e, this._componentManager = t, this._uiPartsService = n, this._commandService = r, this._shortcutService = s, this._initCommands(), this._initCustomComponents(), this._initUIComponents(), this._initMenus(), this._initShortcuts();
|
|
1607
1592
|
}
|
|
1608
1593
|
_initMenus() {
|
|
1609
|
-
this._menuManagerService.mergeMenu(
|
|
1594
|
+
this._menuManagerService.mergeMenu(Ri);
|
|
1610
1595
|
}
|
|
1611
1596
|
_initCustomComponents() {
|
|
1612
|
-
const
|
|
1613
|
-
this.disposeWithMe(
|
|
1597
|
+
const i = this._componentManager;
|
|
1598
|
+
this.disposeWithMe(i.register("TextIcon", Wt)), this.disposeWithMe(i.register("GraphIcon", Bt)), this.disposeWithMe(i.register(Qt, xi)), this.disposeWithMe(i.register(Ee, fi));
|
|
1614
1599
|
}
|
|
1615
1600
|
_initCommands() {
|
|
1616
1601
|
[
|
|
@@ -1629,96 +1614,96 @@ let Pe = class extends De {
|
|
|
1629
1614
|
B,
|
|
1630
1615
|
// commands for editor
|
|
1631
1616
|
Oe
|
|
1632
|
-
].forEach((
|
|
1617
|
+
].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
|
|
1633
1618
|
}
|
|
1634
1619
|
_initUIComponents() {
|
|
1635
1620
|
this.disposeWithMe(
|
|
1636
|
-
this._uiPartsService.registerComponent(ct.LEFT_SIDEBAR, () => at(
|
|
1621
|
+
this._uiPartsService.registerComponent(ct.LEFT_SIDEBAR, () => at(_i, this._injector))
|
|
1637
1622
|
), this.disposeWithMe(
|
|
1638
|
-
this._uiPartsService.registerComponent(ct.CONTENT, () => at(
|
|
1623
|
+
this._uiPartsService.registerComponent(ct.CONTENT, () => at(wi, this._injector))
|
|
1639
1624
|
);
|
|
1640
1625
|
}
|
|
1641
1626
|
_initShortcuts() {
|
|
1642
1627
|
[
|
|
1643
|
-
|
|
1644
|
-
...
|
|
1645
|
-
].forEach((
|
|
1646
|
-
this.disposeWithMe(this._shortcutService.registerShortcut(
|
|
1628
|
+
Ti,
|
|
1629
|
+
...Pi()
|
|
1630
|
+
].forEach((i) => {
|
|
1631
|
+
this.disposeWithMe(this._shortcutService.registerShortcut(i));
|
|
1647
1632
|
});
|
|
1648
1633
|
}
|
|
1649
1634
|
};
|
|
1650
|
-
|
|
1635
|
+
ye = Di([
|
|
1651
1636
|
te(0, z(ke)),
|
|
1652
|
-
te(1,
|
|
1653
|
-
te(2, z(
|
|
1654
|
-
te(3,
|
|
1655
|
-
te(4,
|
|
1656
|
-
te(5,
|
|
1657
|
-
],
|
|
1658
|
-
const
|
|
1659
|
-
var
|
|
1660
|
-
for (var r =
|
|
1661
|
-
(o =
|
|
1637
|
+
te(1, Dn),
|
|
1638
|
+
te(2, z(Un)),
|
|
1639
|
+
te(3, Nn),
|
|
1640
|
+
te(4, U),
|
|
1641
|
+
te(5, Vn)
|
|
1642
|
+
], ye);
|
|
1643
|
+
const Ui = "slides-ui.config", pt = {};
|
|
1644
|
+
var Ni = Object.getOwnPropertyDescriptor, Vi = (i, e, t, n) => {
|
|
1645
|
+
for (var r = n > 1 ? void 0 : n ? Ni(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1646
|
+
(o = i[s]) && (r = o(r) || r);
|
|
1662
1647
|
return r;
|
|
1663
|
-
}, Se = (
|
|
1664
|
-
function
|
|
1665
|
-
const t =
|
|
1648
|
+
}, Se = (i, e) => (t, n) => e(t, n, i);
|
|
1649
|
+
function ji(i, e) {
|
|
1650
|
+
const t = ft(i.left, i.top, e), n = ft(i.right, i.bottom, e);
|
|
1666
1651
|
return {
|
|
1667
1652
|
left: t.x,
|
|
1668
1653
|
top: t.y,
|
|
1669
|
-
right:
|
|
1670
|
-
bottom:
|
|
1654
|
+
right: n.x,
|
|
1655
|
+
bottom: n.y
|
|
1671
1656
|
};
|
|
1672
1657
|
}
|
|
1673
|
-
function
|
|
1674
|
-
const { scaleX:
|
|
1658
|
+
function ft(i, e, t) {
|
|
1659
|
+
const { scaleX: n, scaleY: r } = t.getAncestorScale(), s = t.getViewport(ie.VIEW);
|
|
1675
1660
|
if (!s)
|
|
1676
1661
|
return {
|
|
1677
|
-
x:
|
|
1662
|
+
x: i,
|
|
1678
1663
|
y: e
|
|
1679
1664
|
};
|
|
1680
|
-
const { viewportScrollX: o, viewportScrollY: c } = s, a = (
|
|
1665
|
+
const { viewportScrollX: o, viewportScrollY: c } = s, a = (i - o) * n, u = (e - c) * r;
|
|
1681
1666
|
return {
|
|
1682
1667
|
x: a,
|
|
1683
|
-
y:
|
|
1668
|
+
y: u
|
|
1684
1669
|
};
|
|
1685
1670
|
}
|
|
1686
|
-
let
|
|
1687
|
-
constructor(
|
|
1688
|
-
super(), this._globalPopupManagerService =
|
|
1671
|
+
let Pe = class extends Ue {
|
|
1672
|
+
constructor(i, e, t, n) {
|
|
1673
|
+
super(), this._globalPopupManagerService = i, this._renderManagerService = e, this._univerInstanceService = t, this._commandService = n;
|
|
1689
1674
|
}
|
|
1690
|
-
_createObjectPositionObserver(
|
|
1691
|
-
const
|
|
1675
|
+
_createObjectPositionObserver(i, e) {
|
|
1676
|
+
const n = (() => {
|
|
1692
1677
|
var A, L, Q, ee;
|
|
1693
|
-
const { scene: o, engine: c } = e, { left: a, top:
|
|
1678
|
+
const { scene: o, engine: c } = e, { left: a, top: u, width: l, height: d } = i, v = (o.width - ((L = (A = e.mainComponent) == null ? void 0 : A.width) != null ? L : 0)) / 2, _ = (o.height - ((ee = (Q = e.mainComponent) == null ? void 0 : Q.height) != null ? ee : 0)) / 2, f = {
|
|
1694
1679
|
left: a,
|
|
1695
1680
|
right: a + l,
|
|
1696
|
-
top:
|
|
1697
|
-
bottom:
|
|
1698
|
-
},
|
|
1681
|
+
top: u,
|
|
1682
|
+
bottom: u + d
|
|
1683
|
+
}, p = c.getCanvasElement(), h = p.getBoundingClientRect(), m = En(p.style.width), { scaleX: I, scaleY: b } = o.getAncestorScale(), T = ji(f, o), { top: M, left: N, width: x } = h, W = x / m;
|
|
1699
1684
|
return {
|
|
1700
|
-
left: T.left * W * I +
|
|
1701
|
-
right: T.right * W * I +
|
|
1702
|
-
top: T.top * W * b + M +
|
|
1703
|
-
bottom: T.bottom * W * b + M +
|
|
1685
|
+
left: T.left * W * I + N + v,
|
|
1686
|
+
right: T.right * W * I + N + v,
|
|
1687
|
+
top: T.top * W * b + M + _,
|
|
1688
|
+
bottom: T.bottom * W * b + M + _
|
|
1704
1689
|
};
|
|
1705
|
-
})(), r = new q(
|
|
1690
|
+
})(), r = new q(n), s = new Ke();
|
|
1706
1691
|
return {
|
|
1707
|
-
position:
|
|
1692
|
+
position: n,
|
|
1708
1693
|
position$: r,
|
|
1709
1694
|
disposable: s
|
|
1710
1695
|
};
|
|
1711
1696
|
}
|
|
1712
|
-
attachPopupToObject(
|
|
1713
|
-
const
|
|
1697
|
+
attachPopupToObject(i, e) {
|
|
1698
|
+
const n = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SLIDE).getUnitId(), r = this._renderManagerService.getRenderById(n);
|
|
1714
1699
|
if (!r)
|
|
1715
1700
|
return {
|
|
1716
1701
|
dispose: () => {
|
|
1717
1702
|
}
|
|
1718
1703
|
};
|
|
1719
|
-
const { position: s, position$: o, disposable: c } = this._createObjectPositionObserver(
|
|
1704
|
+
const { position: s, position$: o, disposable: c } = this._createObjectPositionObserver(i, r), a = this._globalPopupManagerService.addPopup({
|
|
1720
1705
|
...e,
|
|
1721
|
-
unitId:
|
|
1706
|
+
unitId: n,
|
|
1722
1707
|
subUnitId: "default",
|
|
1723
1708
|
anchorRect: s,
|
|
1724
1709
|
anchorRect$: o,
|
|
@@ -1731,22 +1716,22 @@ let ye = class extends De {
|
|
|
1731
1716
|
};
|
|
1732
1717
|
}
|
|
1733
1718
|
};
|
|
1734
|
-
|
|
1735
|
-
Se(0, z(
|
|
1719
|
+
Pe = Vi([
|
|
1720
|
+
Se(0, z(jn)),
|
|
1736
1721
|
Se(1, K),
|
|
1737
1722
|
Se(2, w),
|
|
1738
|
-
Se(3,
|
|
1739
|
-
],
|
|
1740
|
-
var
|
|
1741
|
-
for (var r =
|
|
1742
|
-
(o =
|
|
1723
|
+
Se(3, U)
|
|
1724
|
+
], Pe);
|
|
1725
|
+
var Ai = Object.getOwnPropertyDescriptor, Li = (i, e, t, n) => {
|
|
1726
|
+
for (var r = n > 1 ? void 0 : n ? Ai(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1727
|
+
(o = i[s]) && (r = o(r) || r);
|
|
1743
1728
|
return r;
|
|
1744
|
-
}, X = (
|
|
1745
|
-
let Te = class extends
|
|
1746
|
-
constructor(e, t,
|
|
1729
|
+
}, X = (i, e) => (t, n) => e(t, n, i);
|
|
1730
|
+
let Te = class extends pe {
|
|
1731
|
+
constructor(e, t, n, r, s, o, c) {
|
|
1747
1732
|
super();
|
|
1748
1733
|
S(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
|
|
1749
|
-
this._canvasPopManagerService = e, this._renderManagerService = t, this._univerInstanceService =
|
|
1734
|
+
this._canvasPopManagerService = e, this._renderManagerService = t, this._univerInstanceService = n, this._contextService = r, this._canvasView = s, this._sidebarService = o, this._commandService = c, this._init();
|
|
1750
1735
|
}
|
|
1751
1736
|
_init() {
|
|
1752
1737
|
this._univerInstanceService.getAllUnitsForType(E.UNIVER_SLIDE).forEach((e) => this._create(e));
|
|
@@ -1762,14 +1747,14 @@ let Te = class extends fe {
|
|
|
1762
1747
|
// eslint-disable-next-line max-lines-per-function
|
|
1763
1748
|
_popupMenuListener(e) {
|
|
1764
1749
|
var r;
|
|
1765
|
-
const t = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SLIDE),
|
|
1766
|
-
Object.keys(
|
|
1767
|
-
var
|
|
1768
|
-
const c = (
|
|
1750
|
+
const t = this._univerInstanceService.getCurrentUnitForType(E.UNIVER_SLIDE), n = (r = t == null ? void 0 : t.getPages()) != null ? r : {};
|
|
1751
|
+
Object.keys(n).forEach((s) => {
|
|
1752
|
+
var u;
|
|
1753
|
+
const c = (u = this._canvasView.getRenderUnitByPageId(s, e).scene) == null ? void 0 : u.getTransformer();
|
|
1769
1754
|
if (!c) return;
|
|
1770
1755
|
let a;
|
|
1771
1756
|
this.disposeWithMe(
|
|
1772
|
-
|
|
1757
|
+
Rt(
|
|
1773
1758
|
c.createControl$.subscribe(() => {
|
|
1774
1759
|
const l = c.getSelectedObjectMap();
|
|
1775
1760
|
if (l.size > 1) {
|
|
@@ -1795,7 +1780,7 @@ let Te = class extends fe {
|
|
|
1795
1780
|
)
|
|
1796
1781
|
), this.disposeWithMe(
|
|
1797
1782
|
c.clearControl$.subscribe(() => {
|
|
1798
|
-
a == null || a.dispose(), this._contextService.setContextValue(
|
|
1783
|
+
a == null || a.dispose(), this._contextService.setContextValue(vn, !1);
|
|
1799
1784
|
})
|
|
1800
1785
|
), this.disposeWithMe(
|
|
1801
1786
|
c.changing$.subscribe(() => {
|
|
@@ -1820,7 +1805,7 @@ let Te = class extends fe {
|
|
|
1820
1805
|
);
|
|
1821
1806
|
});
|
|
1822
1807
|
}
|
|
1823
|
-
_getMenuItemsByObjectType(e, t,
|
|
1808
|
+
_getMenuItemsByObjectType(e, t, n) {
|
|
1824
1809
|
return [{
|
|
1825
1810
|
label: "slide.popup.edit",
|
|
1826
1811
|
index: 0,
|
|
@@ -1836,29 +1821,29 @@ let Te = class extends fe {
|
|
|
1836
1821
|
commandId: At.id,
|
|
1837
1822
|
commandParams: {
|
|
1838
1823
|
id: t,
|
|
1839
|
-
unitId:
|
|
1824
|
+
unitId: n
|
|
1840
1825
|
},
|
|
1841
1826
|
disable: !1
|
|
1842
1827
|
}];
|
|
1843
1828
|
}
|
|
1844
1829
|
};
|
|
1845
|
-
Te =
|
|
1846
|
-
X(0, z(
|
|
1830
|
+
Te = Li([
|
|
1831
|
+
X(0, z(Pe)),
|
|
1847
1832
|
X(1, K),
|
|
1848
1833
|
X(2, w),
|
|
1849
|
-
X(3,
|
|
1850
|
-
X(4, z(
|
|
1834
|
+
X(3, fe),
|
|
1835
|
+
X(4, z(P)),
|
|
1851
1836
|
X(5, Tt),
|
|
1852
|
-
X(6,
|
|
1837
|
+
X(6, U)
|
|
1853
1838
|
], Te);
|
|
1854
|
-
var $
|
|
1855
|
-
for (var r =
|
|
1856
|
-
(o =
|
|
1839
|
+
var $i = Object.getOwnPropertyDescriptor, Bi = (i, e, t, n) => {
|
|
1840
|
+
for (var r = n > 1 ? void 0 : n ? $i(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1841
|
+
(o = i[s]) && (r = o(r) || r);
|
|
1857
1842
|
return r;
|
|
1858
|
-
}, Ve = (
|
|
1843
|
+
}, Ve = (i, e) => (t, n) => e(t, n, i);
|
|
1859
1844
|
const et = bt("univer.slide-editor-bridge.service");
|
|
1860
|
-
let He = class extends
|
|
1861
|
-
constructor(e, t,
|
|
1845
|
+
let He = class extends Ue {
|
|
1846
|
+
constructor(e, t, n) {
|
|
1862
1847
|
super();
|
|
1863
1848
|
S(this, "_editorUnitId", ue);
|
|
1864
1849
|
S(this, "_isForceKeepVisible", !1);
|
|
@@ -1875,9 +1860,9 @@ let He = class extends De {
|
|
|
1875
1860
|
S(this, "visible$", this._visible$.asObservable());
|
|
1876
1861
|
S(this, "_afterVisible$", new q(this._visibleParam));
|
|
1877
1862
|
S(this, "afterVisible$", this._afterVisible$.asObservable());
|
|
1878
|
-
S(this, "endEditing$", new
|
|
1863
|
+
S(this, "endEditing$", new Nt());
|
|
1879
1864
|
S(this, "_currentEditRectInfo");
|
|
1880
|
-
this._editorService = e, this._contextService = t, this._renderManagerService =
|
|
1865
|
+
this._editorService = e, this._contextService = t, this._renderManagerService = n;
|
|
1881
1866
|
}
|
|
1882
1867
|
dispose() {
|
|
1883
1868
|
super.dispose();
|
|
@@ -1890,7 +1875,7 @@ let He = class extends De {
|
|
|
1890
1875
|
* @editorInfo editorInfo
|
|
1891
1876
|
*/
|
|
1892
1877
|
setEditorRect(e) {
|
|
1893
|
-
this._currentEditRectInfo = e, this._editorService.getFocusEditor() || (this._editorService.focus(ue), this._contextService.setContextValue(
|
|
1878
|
+
this._currentEditRectInfo = e, this._editorService.getFocusEditor() || (this._editorService.focus(ue), this._contextService.setContextValue(Re, !1), this._contextService.setContextValue(xt, !1), this._contextService.setContextValue(Ot, !1));
|
|
1894
1879
|
const t = this.getEditRectState();
|
|
1895
1880
|
this._currentEditRectState = t, this._currentEditRectState$.next(t);
|
|
1896
1881
|
}
|
|
@@ -1904,37 +1889,37 @@ let He = class extends De {
|
|
|
1904
1889
|
* && this@setEditorRect
|
|
1905
1890
|
*/
|
|
1906
1891
|
getEditRectState() {
|
|
1907
|
-
const e = ue, t = this._currentEditRectInfo,
|
|
1892
|
+
const e = ue, t = this._currentEditRectInfo, n = t.unitId, r = t.richTextObj.documentData;
|
|
1908
1893
|
r.id = e, r.documentStyle = {
|
|
1909
1894
|
...r.documentStyle,
|
|
1910
1895
|
pageSize: { width: t.richTextObj.width, height: 1 / 0 }
|
|
1911
1896
|
};
|
|
1912
1897
|
const o = {
|
|
1913
|
-
documentModel: new
|
|
1898
|
+
documentModel: new pn(r),
|
|
1914
1899
|
fontString: "document",
|
|
1915
1900
|
textRotation: { a: 0, v: 0 },
|
|
1916
1901
|
wrapStrategy: 0,
|
|
1917
|
-
verticalAlign:
|
|
1902
|
+
verticalAlign: xe.TOP,
|
|
1918
1903
|
horizontalAlign: wt.LEFT,
|
|
1919
1904
|
paddingData: { t: 0, b: 1, l: 2, r: 2 }
|
|
1920
|
-
}, c = t.richTextObj.width, a = t.richTextObj.height,
|
|
1905
|
+
}, c = t.richTextObj.width, a = t.richTextObj.height, u = t.richTextObj.left, l = t.richTextObj.top, d = {
|
|
1921
1906
|
left: 0,
|
|
1922
1907
|
top: 0
|
|
1923
|
-
}, v = this._renderManagerService.getRenderById(
|
|
1924
|
-
x: (
|
|
1925
|
-
y: (
|
|
1926
|
-
},
|
|
1927
|
-
return d.left =
|
|
1908
|
+
}, v = this._renderManagerService.getRenderById(n), _ = v == null ? void 0 : v.scene, f = _ == null ? void 0 : _.getViewport(ie.VIEW), p = _ == null ? void 0 : _.getObject(ie.COMPONENT), h = {
|
|
1909
|
+
x: (p == null ? void 0 : p.left) || 0,
|
|
1910
|
+
y: (p == null ? void 0 : p.top) || 0
|
|
1911
|
+
}, m = (f == null ? void 0 : f.viewportScrollX) || 0, I = (f == null ? void 0 : f.viewportScrollY) || 0;
|
|
1912
|
+
return d.left = h.x - m, d.top = h.y - I, {
|
|
1928
1913
|
position: {
|
|
1929
|
-
startX:
|
|
1914
|
+
startX: u,
|
|
1930
1915
|
startY: l,
|
|
1931
|
-
endX:
|
|
1916
|
+
endX: u + c,
|
|
1932
1917
|
endY: l + a
|
|
1933
1918
|
},
|
|
1934
1919
|
scaleX: 1,
|
|
1935
1920
|
scaleY: 1,
|
|
1936
1921
|
slideCardOffset: d,
|
|
1937
|
-
unitId:
|
|
1922
|
+
unitId: n,
|
|
1938
1923
|
editorUnitId: e,
|
|
1939
1924
|
documentLayoutObject: o
|
|
1940
1925
|
};
|
|
@@ -1955,13 +1940,13 @@ let He = class extends De {
|
|
|
1955
1940
|
* @deprecated
|
|
1956
1941
|
*/
|
|
1957
1942
|
genDocData(e) {
|
|
1958
|
-
const t = this.getCurrentEditorId(),
|
|
1943
|
+
const t = this.getCurrentEditorId(), n = e.text, r = e.fs;
|
|
1959
1944
|
return {
|
|
1960
1945
|
id: t,
|
|
1961
1946
|
body: {
|
|
1962
|
-
dataStream: `${
|
|
1947
|
+
dataStream: `${n}\r
|
|
1963
1948
|
`,
|
|
1964
|
-
textRuns: [{ st: 0, ed:
|
|
1949
|
+
textRuns: [{ st: 0, ed: n.length }],
|
|
1965
1950
|
paragraphs: [{
|
|
1966
1951
|
paragraphStyle: {
|
|
1967
1952
|
// no use
|
|
@@ -1969,9 +1954,9 @@ let He = class extends De {
|
|
|
1969
1954
|
// horizontalAlign: HorizontalAlign.CENTER,
|
|
1970
1955
|
// verticalAlign: VerticalAlign.MIDDLE,
|
|
1971
1956
|
},
|
|
1972
|
-
startIndex:
|
|
1957
|
+
startIndex: n.length + 1
|
|
1973
1958
|
}],
|
|
1974
|
-
sectionBreaks: [{ startIndex:
|
|
1959
|
+
sectionBreaks: [{ startIndex: n.length + 2 }]
|
|
1975
1960
|
},
|
|
1976
1961
|
documentStyle: {
|
|
1977
1962
|
marginBottom: 0,
|
|
@@ -1982,7 +1967,7 @@ let He = class extends De {
|
|
|
1982
1967
|
textStyle: { fs: r },
|
|
1983
1968
|
renderConfig: {
|
|
1984
1969
|
// horizontalAlign: HorizontalAlign.CENTER,
|
|
1985
|
-
verticalAlign:
|
|
1970
|
+
verticalAlign: xe.MIDDLE,
|
|
1986
1971
|
centerAngle: 0,
|
|
1987
1972
|
vertexAngle: 0,
|
|
1988
1973
|
wrapStrategy: 0
|
|
@@ -1994,19 +1979,19 @@ let He = class extends De {
|
|
|
1994
1979
|
};
|
|
1995
1980
|
}
|
|
1996
1981
|
};
|
|
1997
|
-
He =
|
|
1982
|
+
He = Bi([
|
|
1998
1983
|
Ve(0, Ze),
|
|
1999
|
-
Ve(1,
|
|
1984
|
+
Ve(1, fe),
|
|
2000
1985
|
Ve(2, K)
|
|
2001
1986
|
], He);
|
|
2002
|
-
var G = /* @__PURE__ */ ((
|
|
2003
|
-
for (var r =
|
|
2004
|
-
(o =
|
|
1987
|
+
var G = /* @__PURE__ */ ((i) => (i[i.InitialState = 0] = "InitialState", i[i.StartEditor = 1] = "StartEditor", i[i.CursorChange = 2] = "CursorChange", i))(G || {}), Hi = Object.getOwnPropertyDescriptor, Fi = (i, e, t, n) => {
|
|
1988
|
+
for (var r = n > 1 ? void 0 : n ? Hi(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1989
|
+
(o = i[s]) && (r = o(r) || r);
|
|
2005
1990
|
return r;
|
|
2006
|
-
}, j = (
|
|
2007
|
-
const
|
|
2008
|
-
let Fe = class extends
|
|
2009
|
-
constructor(e, t,
|
|
1991
|
+
}, j = (i, e) => (t, n) => e(t, n, i);
|
|
1992
|
+
const _t = -1e3, mt = 5, Wi = 2;
|
|
1993
|
+
let Fe = class extends Ue {
|
|
1994
|
+
constructor(e, t, n, r, s, o, c, a, u, l, d, v) {
|
|
2010
1995
|
super();
|
|
2011
1996
|
/**
|
|
2012
1997
|
* It is used to distinguish whether the user has actively moved the cursor in the editor, mainly through mouse clicks.
|
|
@@ -2015,11 +2000,11 @@ let Fe = class extends De {
|
|
|
2015
2000
|
/** If the corresponding unit is active and prepared for editing. */
|
|
2016
2001
|
S(this, "_isUnitEditing", !1);
|
|
2017
2002
|
S(this, "_d");
|
|
2018
|
-
this._renderContext = e, this._layoutService = t, this._undoRedoService =
|
|
2019
|
-
|
|
2003
|
+
this._renderContext = e, this._layoutService = t, this._undoRedoService = n, this._contextService = r, this._instanceSrv = s, this._renderManagerService = o, this._editorBridgeService = c, this._cellEditorManagerService = a, this._textSelectionManagerService = u, this._commandService = l, this._localService = d, this._editorService = v, this.disposeWithMe(this._instanceSrv.getCurrentTypeOfUnit$(E.UNIVER_SLIDE).subscribe((_) => {
|
|
2004
|
+
_ && _.getUnitId() === this._renderContext.unitId ? this._d = this._init() : (this._disposeCurrent(), this._isUnitEditing && (this._handleEditorInvisible({
|
|
2020
2005
|
visible: !1,
|
|
2021
2006
|
eventType: Y.Keyboard,
|
|
2022
|
-
keycode:
|
|
2007
|
+
keycode: y.ESC,
|
|
2023
2008
|
unitId: this._renderContext.unitId
|
|
2024
2009
|
}), this._isUnitEditing = !1));
|
|
2025
2010
|
})), this._initEditorVisibilityListener();
|
|
@@ -2056,7 +2041,7 @@ let Fe = class extends De {
|
|
|
2056
2041
|
return (t = this._renderManagerService.getRenderById(e)) == null ? void 0 : t.with(gt).getViewModel();
|
|
2057
2042
|
}
|
|
2058
2043
|
_initialCursorSync(e) {
|
|
2059
|
-
e.add(this._cellEditorManagerService.focus$.pipe(
|
|
2044
|
+
e.add(this._cellEditorManagerService.focus$.pipe(Zn((t) => !!t)).subscribe(() => {
|
|
2060
2045
|
var t;
|
|
2061
2046
|
(t = Le(E.UNIVER_DOC, this._instanceSrv, this._renderManagerService)) == null || t.with(dt).sync();
|
|
2062
2047
|
}));
|
|
@@ -2068,18 +2053,18 @@ let Fe = class extends De {
|
|
|
2068
2053
|
_subscribeToCurrentCell(e) {
|
|
2069
2054
|
e.add(this._editorBridgeService.currentEditRectState$.subscribe((t) => {
|
|
2070
2055
|
var d;
|
|
2071
|
-
if (t == null || this._contextService.getContextValue(
|
|
2056
|
+
if (t == null || this._contextService.getContextValue(xt) || this._contextService.getContextValue(Ot))
|
|
2072
2057
|
return;
|
|
2073
2058
|
const {
|
|
2074
|
-
position: { startX:
|
|
2059
|
+
position: { startX: n, endX: r },
|
|
2075
2060
|
documentLayoutObject: { textRotation: s, wrapStrategy: o, documentModel: c },
|
|
2076
2061
|
scaleX: a,
|
|
2077
|
-
editorUnitId:
|
|
2062
|
+
editorUnitId: u
|
|
2078
2063
|
} = t, { vertexAngle: l } = rt(s);
|
|
2079
|
-
c.updateDocumentId(
|
|
2064
|
+
c.updateDocumentId(u), o === tt.WRAP && l === 0 && c.updateDocumentDataPageSize((r - n) / a), this._instanceSrv.changeDoc(u, c), this._contextService.setContextValue(_n, !0), this._textSelectionManagerService.replaceTextRanges([{
|
|
2080
2065
|
startOffset: 0,
|
|
2081
2066
|
endOffset: 0
|
|
2082
|
-
}]), (d = Le(E.UNIVER_DOC, this._instanceSrv, this._renderManagerService)) == null || d.with(dt).activate(
|
|
2067
|
+
}]), (d = Le(E.UNIVER_DOC, this._instanceSrv, this._renderManagerService)) == null || d.with(dt).activate(_t, _t);
|
|
2083
2068
|
}));
|
|
2084
2069
|
}
|
|
2085
2070
|
/**
|
|
@@ -2091,112 +2076,112 @@ let Fe = class extends De {
|
|
|
2091
2076
|
* @param scaleX
|
|
2092
2077
|
* @param scaleY
|
|
2093
2078
|
*/
|
|
2094
|
-
_fitTextSize(e, t,
|
|
2095
|
-
const { startX: c, startY: a, endX:
|
|
2079
|
+
_fitTextSize(e, t, n, r, s = 1, o = 1) {
|
|
2080
|
+
const { startX: c, startY: a, endX: u, endY: l } = e, d = r.documentModel;
|
|
2096
2081
|
if (d == null)
|
|
2097
2082
|
return;
|
|
2098
|
-
const { actualWidth: v, actualHeight:
|
|
2083
|
+
const { actualWidth: v, actualHeight: _ } = this._predictingSize(
|
|
2099
2084
|
e,
|
|
2100
2085
|
t,
|
|
2101
|
-
|
|
2086
|
+
n,
|
|
2102
2087
|
r,
|
|
2103
2088
|
s,
|
|
2104
2089
|
o
|
|
2105
|
-
), { verticalAlign:
|
|
2106
|
-
let
|
|
2107
|
-
if (
|
|
2108
|
-
I =
|
|
2090
|
+
), { verticalAlign: f, paddingData: p, fill: h } = r;
|
|
2091
|
+
let m = u - c, I = l - a;
|
|
2092
|
+
if (m < v && (m = v), I < _)
|
|
2093
|
+
I = _, d.updateDocumentDataMargin(p);
|
|
2109
2094
|
else {
|
|
2110
2095
|
let b = 0;
|
|
2111
|
-
|
|
2096
|
+
f === xe.MIDDLE ? b = (I - _) / 2 / o : f === xe.TOP ? b = p.t || 0 : b = (I - _) / o - (p.b || 0), b = b < (p.t || 0) ? p.t || 0 : b, d.updateDocumentDataMargin({
|
|
2112
2097
|
t: b
|
|
2113
2098
|
});
|
|
2114
2099
|
}
|
|
2115
|
-
|
|
2100
|
+
n.calculate(), this._editAreaProcessing(m, I, e, t, h, s, o);
|
|
2116
2101
|
}
|
|
2117
2102
|
/**
|
|
2118
2103
|
* Mainly used to pre-calculate the width of the editor,
|
|
2119
2104
|
* to determine whether it needs to be automatically widened.
|
|
2120
2105
|
*/
|
|
2121
|
-
_predictingSize(e, t,
|
|
2122
|
-
const { startX: c, endX: a } = e, { textRotation:
|
|
2106
|
+
_predictingSize(e, t, n, r, s = 1, o = 1) {
|
|
2107
|
+
const { startX: c, endX: a } = e, { textRotation: u, wrapStrategy: l } = r, d = r.documentModel, { vertexAngle: v } = rt(u), _ = document.body.clientWidth;
|
|
2123
2108
|
if (l === tt.WRAP && v === 0) {
|
|
2124
|
-
const { actualWidth:
|
|
2109
|
+
const { actualWidth: h, actualHeight: m } = n.getActualSize();
|
|
2125
2110
|
return {
|
|
2126
|
-
actualWidth:
|
|
2127
|
-
actualHeight:
|
|
2111
|
+
actualWidth: h * s,
|
|
2112
|
+
actualHeight: m * o
|
|
2128
2113
|
};
|
|
2129
2114
|
}
|
|
2130
|
-
d == null || d.updateDocumentDataPageSize((
|
|
2131
|
-
const
|
|
2132
|
-
let
|
|
2133
|
-
return
|
|
2115
|
+
d == null || d.updateDocumentDataPageSize((_ - c - t.left) / s), n.calculate();
|
|
2116
|
+
const f = n.getActualSize();
|
|
2117
|
+
let p = a - c;
|
|
2118
|
+
return p < f.actualWidth * s + mt * s && (p = f.actualWidth * s + mt * s), d == null || d.updateDocumentDataPageSize(p / s), d == null || d.updateDocumentRenderConfig({
|
|
2134
2119
|
horizontalAlign: wt.UNSPECIFIED,
|
|
2135
2120
|
cellValueType: void 0
|
|
2136
2121
|
}), {
|
|
2137
|
-
actualWidth:
|
|
2138
|
-
actualHeight:
|
|
2122
|
+
actualWidth: p,
|
|
2123
|
+
actualHeight: f.actualHeight * o
|
|
2139
2124
|
};
|
|
2140
2125
|
}
|
|
2141
2126
|
/**
|
|
2142
2127
|
* control the size of editing area
|
|
2143
2128
|
*/
|
|
2144
2129
|
// eslint-disable-next-line max-lines-per-function
|
|
2145
|
-
_editAreaProcessing(e, t,
|
|
2130
|
+
_editAreaProcessing(e, t, n, r, s, o = 1, c = 1) {
|
|
2146
2131
|
var C;
|
|
2147
2132
|
const a = this._getEditorObject();
|
|
2148
2133
|
if (a == null)
|
|
2149
2134
|
return;
|
|
2150
|
-
function
|
|
2135
|
+
function u(ce) {
|
|
2151
2136
|
return Number.parseInt(ce.replace("px", ""));
|
|
2152
2137
|
}
|
|
2153
|
-
const d = this._renderContext.engine.getCanvasElement(), v = d.getBoundingClientRect(),
|
|
2154
|
-
let { startX: I, startY: b } =
|
|
2138
|
+
const d = this._renderContext.engine.getCanvasElement(), v = d.getBoundingClientRect(), _ = u(d.style.width), { top: f, left: p, width: h } = v, m = h / _;
|
|
2139
|
+
let { startX: I, startY: b } = n;
|
|
2155
2140
|
I += r.left, b += r.top;
|
|
2156
|
-
const { document: T, scene: M, engine:
|
|
2157
|
-
let A = t, L =
|
|
2158
|
-
A > W ? (A = W, L == null ?
|
|
2141
|
+
const { document: T, scene: M, engine: N } = a, x = M.getViewport(ut.VIEW_MAIN), W = document.body.clientHeight - b - r.top - Wi * 2, oe = document.body.clientWidth - I - r.left;
|
|
2142
|
+
let A = t, L = x == null ? void 0 : x.getScrollBar();
|
|
2143
|
+
A > W ? (A = W, L == null ? x && new yt(x, { enableHorizontal: !1, barSize: 8 }) : x == null || x.resetCanvasSizeAndUpdateScroll()) : (L = null, (C = x == null ? void 0 : x.getScrollBar()) == null || C.dispose()), e += (L == null ? void 0 : L.barSize) || 0, e = Math.min(e, oe), I -= ne, b -= ne, this._addBackground(M, e / o, t / c, s);
|
|
2159
2144
|
const { scaleX: Q, scaleY: ee } = M.getPrecisionScale();
|
|
2160
2145
|
M.transformByState({
|
|
2161
|
-
width: e *
|
|
2162
|
-
height: t *
|
|
2163
|
-
scaleX: o *
|
|
2164
|
-
scaleY: c *
|
|
2146
|
+
width: e * m / o,
|
|
2147
|
+
height: t * m / c,
|
|
2148
|
+
scaleX: o * m,
|
|
2149
|
+
scaleY: c * m
|
|
2165
2150
|
}), T.resize(e / o, t / c), setTimeout(() => {
|
|
2166
|
-
|
|
2151
|
+
N.resizeBySize(
|
|
2167
2152
|
st(e, Q),
|
|
2168
2153
|
st(A, ee)
|
|
2169
2154
|
);
|
|
2170
2155
|
}, 0);
|
|
2171
|
-
const
|
|
2172
|
-
I = I *
|
|
2156
|
+
const _e = this._layoutService.getContentElement().getBoundingClientRect(), me = d.getBoundingClientRect();
|
|
2157
|
+
I = I * m + (me.left - _e.left), b = b * m + (me.top - _e.top), this._cellEditorManagerService.setState({
|
|
2173
2158
|
startX: I,
|
|
2174
2159
|
startY: b,
|
|
2175
|
-
endX: e *
|
|
2176
|
-
endY: A *
|
|
2160
|
+
endX: e * m + I,
|
|
2161
|
+
endY: A * m + b,
|
|
2177
2162
|
show: !0
|
|
2178
2163
|
});
|
|
2179
2164
|
}
|
|
2180
2165
|
/**
|
|
2181
2166
|
* Since the document does not support cell background color, an additional rect needs to be added.
|
|
2182
2167
|
*/
|
|
2183
|
-
_addBackground(e, t,
|
|
2168
|
+
_addBackground(e, t, n, r) {
|
|
2184
2169
|
const s = "_backgroundRectHelperColor_", o = e.getObject(s);
|
|
2185
2170
|
o == null && r == null || (o == null ? e.addObjects(
|
|
2186
2171
|
[
|
|
2187
|
-
new
|
|
2172
|
+
new Pt(s, {
|
|
2188
2173
|
width: t,
|
|
2189
|
-
height:
|
|
2174
|
+
height: n,
|
|
2190
2175
|
fill: r,
|
|
2191
2176
|
evented: !1
|
|
2192
2177
|
})
|
|
2193
2178
|
],
|
|
2194
|
-
|
|
2179
|
+
Wn
|
|
2195
2180
|
) : r == null ? o.dispose() : (o.setProps({
|
|
2196
2181
|
fill: r
|
|
2197
2182
|
}), o.transformByState({
|
|
2198
2183
|
width: t,
|
|
2199
|
-
height:
|
|
2184
|
+
height: n
|
|
2200
2185
|
})));
|
|
2201
2186
|
}
|
|
2202
2187
|
/**
|
|
@@ -2208,11 +2193,11 @@ let Fe = class extends De {
|
|
|
2208
2193
|
// first part: startEditing --> _updateEditor
|
|
2209
2194
|
// 2nd part: startEditing --> changeVisible --> slide-editor-bridge.render-controller.ts@changeVisible --> _editorBridgeService.changeVisible
|
|
2210
2195
|
_handleEditorVisible(e) {
|
|
2211
|
-
var
|
|
2196
|
+
var h, m;
|
|
2212
2197
|
const { eventType: t } = e;
|
|
2213
2198
|
this._cursorChange = [Y.PointerDown, Y.Dblclick].includes(t) ? G.CursorChange : G.StartEditor;
|
|
2214
|
-
const
|
|
2215
|
-
if (
|
|
2199
|
+
const n = this._editorBridgeService.getEditRectState();
|
|
2200
|
+
if (n == null)
|
|
2216
2201
|
return;
|
|
2217
2202
|
const {
|
|
2218
2203
|
position: r,
|
|
@@ -2220,29 +2205,29 @@ let Fe = class extends De {
|
|
|
2220
2205
|
slideCardOffset: o,
|
|
2221
2206
|
scaleX: c,
|
|
2222
2207
|
scaleY: a,
|
|
2223
|
-
editorUnitId:
|
|
2208
|
+
editorUnitId: u,
|
|
2224
2209
|
unitId: l
|
|
2225
|
-
} =
|
|
2210
|
+
} = n, d = this._getEditorObject();
|
|
2226
2211
|
if (d == null)
|
|
2227
2212
|
return;
|
|
2228
2213
|
const { scene: v } = d;
|
|
2229
|
-
this._contextService.setContextValue(
|
|
2230
|
-
const { documentModel:
|
|
2231
|
-
if (!
|
|
2214
|
+
this._contextService.setContextValue(Re, !0);
|
|
2215
|
+
const { documentModel: _ } = s, f = this._getEditorSkeleton(u);
|
|
2216
|
+
if (!f || !_)
|
|
2232
2217
|
return;
|
|
2233
|
-
this._fitTextSize(r, o,
|
|
2234
|
-
const
|
|
2235
|
-
(
|
|
2218
|
+
this._fitTextSize(r, o, f, s, c, a);
|
|
2219
|
+
const p = _.getBody().dataStream.length - 2 || 0;
|
|
2220
|
+
(h = v.getViewport(ut.VIEW_MAIN)) == null || h.scrollToViewportPos({
|
|
2236
2221
|
viewportScrollX: Number.POSITIVE_INFINITY
|
|
2237
2222
|
}), this._textSelectionManagerService.replaceTextRanges([
|
|
2238
2223
|
{
|
|
2239
|
-
startOffset:
|
|
2240
|
-
endOffset:
|
|
2224
|
+
startOffset: p,
|
|
2225
|
+
endOffset: p
|
|
2241
2226
|
}
|
|
2242
|
-
]), (
|
|
2227
|
+
]), (m = this._renderManagerService.getRenderById(l)) == null || m.scene.resetCursor();
|
|
2243
2228
|
}
|
|
2244
2229
|
_resetBodyStyle(e, t = !1) {
|
|
2245
|
-
e.dataStream =
|
|
2230
|
+
e.dataStream = mn, e.textRuns != null && (e.textRuns.length === 1 && !t ? (e.textRuns[0].st = 0, e.textRuns[0].ed = 1) : e.textRuns = void 0), e.paragraphs != null && (e.paragraphs.length === 1 ? e.paragraphs[0].startIndex = 0 : e.paragraphs = [
|
|
2246
2231
|
{
|
|
2247
2232
|
startIndex: 0
|
|
2248
2233
|
}
|
|
@@ -2257,14 +2242,14 @@ let Fe = class extends De {
|
|
|
2257
2242
|
_showEditorByKeyboard(e) {
|
|
2258
2243
|
}
|
|
2259
2244
|
_commandExecutedListener(e) {
|
|
2260
|
-
const t = [Oe.id],
|
|
2245
|
+
const t = [Oe.id], n = [Xn.id];
|
|
2261
2246
|
e.add(this._commandService.onCommandExecuted((r) => {
|
|
2262
|
-
this._editorService.getFocusId() === ue && (t.includes(r.id) && this._moveCursorCmdHandler(r),
|
|
2247
|
+
this._editorService.getFocusId() === ue && (t.includes(r.id) && this._moveCursorCmdHandler(r), n.includes(r.id) && this._editorBridgeService.isVisible() && this._editingChangedHandler());
|
|
2263
2248
|
}));
|
|
2264
2249
|
}
|
|
2265
2250
|
_moveCursorCmdHandler(e) {
|
|
2266
|
-
const t = e.params, { keycode:
|
|
2267
|
-
|
|
2251
|
+
const t = e.params, { keycode: n, isShift: r } = t;
|
|
2252
|
+
n != null && this._cursorChange === G.CursorChange ? this._moveInEditor(n, r) : this._editorBridgeService.changeVisible(t);
|
|
2268
2253
|
}
|
|
2269
2254
|
_editingChangedHandler() {
|
|
2270
2255
|
const e = this._editorBridgeService.getEditorRect();
|
|
@@ -2272,11 +2257,11 @@ let Fe = class extends De {
|
|
|
2272
2257
|
return;
|
|
2273
2258
|
const t = e.richTextObj;
|
|
2274
2259
|
t.refreshDocumentByDocData(), t.resizeToContentSize();
|
|
2275
|
-
const { unitId:
|
|
2276
|
-
this._handleEditorVisible({ visible: !0, eventType: 3, unitId:
|
|
2260
|
+
const { unitId: n } = this._renderContext;
|
|
2261
|
+
this._handleEditorVisible({ visible: !0, eventType: 3, unitId: n });
|
|
2277
2262
|
}
|
|
2278
2263
|
_getEditorObject() {
|
|
2279
|
-
return
|
|
2264
|
+
return ki(this._editorBridgeService.getCurrentEditorId(), this._renderManagerService);
|
|
2280
2265
|
}
|
|
2281
2266
|
async _handleEditorInvisible(e) {
|
|
2282
2267
|
const { keycode: t } = e;
|
|
@@ -2289,7 +2274,7 @@ let Fe = class extends De {
|
|
|
2289
2274
|
this._moveCursor(t);
|
|
2290
2275
|
}
|
|
2291
2276
|
_exitInput(e) {
|
|
2292
|
-
this._contextService.setContextValue(
|
|
2277
|
+
this._contextService.setContextValue(Re, !1), this._cellEditorManagerService.setState({
|
|
2293
2278
|
show: e.visible
|
|
2294
2279
|
});
|
|
2295
2280
|
const t = this._editorBridgeService.getCurrentEditorId();
|
|
@@ -2298,22 +2283,22 @@ let Fe = class extends De {
|
|
|
2298
2283
|
_moveCursor(e) {
|
|
2299
2284
|
if (e != null)
|
|
2300
2285
|
switch (V.LEFT, e) {
|
|
2301
|
-
case
|
|
2286
|
+
case y.ENTER:
|
|
2302
2287
|
V.DOWN;
|
|
2303
2288
|
break;
|
|
2304
|
-
case
|
|
2289
|
+
case y.TAB:
|
|
2305
2290
|
V.RIGHT;
|
|
2306
2291
|
break;
|
|
2307
|
-
case
|
|
2292
|
+
case y.ARROW_DOWN:
|
|
2308
2293
|
V.DOWN;
|
|
2309
2294
|
break;
|
|
2310
|
-
case
|
|
2295
|
+
case y.ARROW_UP:
|
|
2311
2296
|
V.UP;
|
|
2312
2297
|
break;
|
|
2313
|
-
case
|
|
2298
|
+
case y.ARROW_LEFT:
|
|
2314
2299
|
V.LEFT;
|
|
2315
2300
|
break;
|
|
2316
|
-
case
|
|
2301
|
+
case y.ARROW_RIGHT:
|
|
2317
2302
|
V.RIGHT;
|
|
2318
2303
|
break;
|
|
2319
2304
|
}
|
|
@@ -2326,41 +2311,41 @@ let Fe = class extends De {
|
|
|
2326
2311
|
const t = this._getEditorObject();
|
|
2327
2312
|
if (!t)
|
|
2328
2313
|
return;
|
|
2329
|
-
const { document:
|
|
2330
|
-
e.add(
|
|
2314
|
+
const { document: n } = t;
|
|
2315
|
+
e.add(Rt(n.onPointerDown$.subscribeEvent(() => {
|
|
2331
2316
|
this._cursorChange === G.StartEditor && (this._cursorChange = G.CursorChange);
|
|
2332
2317
|
})));
|
|
2333
2318
|
}
|
|
2334
2319
|
// TODO: @JOCS, is it necessary to move these commands MoveSelectionOperation\MoveCursorOperation to shortcut? and use multi-commands?
|
|
2335
2320
|
_moveInEditor(e, t) {
|
|
2336
|
-
let
|
|
2337
|
-
e ===
|
|
2338
|
-
direction:
|
|
2339
|
-
}) : this._commandService.executeCommand(
|
|
2340
|
-
direction:
|
|
2321
|
+
let n = V.LEFT;
|
|
2322
|
+
e === y.ARROW_DOWN ? n = V.DOWN : e === y.ARROW_UP ? n = V.UP : e === y.ARROW_RIGHT && (n = V.RIGHT), t ? this._commandService.executeCommand(kn.id, {
|
|
2323
|
+
direction: n
|
|
2324
|
+
}) : this._commandService.executeCommand(zn.id, {
|
|
2325
|
+
direction: n
|
|
2341
2326
|
});
|
|
2342
2327
|
}
|
|
2343
2328
|
};
|
|
2344
|
-
Fe =
|
|
2345
|
-
j(1,
|
|
2346
|
-
j(2,
|
|
2347
|
-
j(3,
|
|
2329
|
+
Fe = Fi([
|
|
2330
|
+
j(1, An),
|
|
2331
|
+
j(2, fn),
|
|
2332
|
+
j(3, fe),
|
|
2348
2333
|
j(4, w),
|
|
2349
2334
|
j(5, K),
|
|
2350
2335
|
j(6, et),
|
|
2351
2336
|
j(7, Qe),
|
|
2352
|
-
j(8, z(
|
|
2353
|
-
j(9,
|
|
2337
|
+
j(8, z(Gn)),
|
|
2338
|
+
j(9, U),
|
|
2354
2339
|
j(10, z(J)),
|
|
2355
2340
|
j(11, Ze)
|
|
2356
2341
|
], Fe);
|
|
2357
|
-
function
|
|
2358
|
-
if (
|
|
2342
|
+
function ki(i, e) {
|
|
2343
|
+
if (i == null)
|
|
2359
2344
|
return;
|
|
2360
|
-
const t = e.getRenderById(
|
|
2345
|
+
const t = e.getRenderById(i);
|
|
2361
2346
|
if (t == null)
|
|
2362
2347
|
return;
|
|
2363
|
-
const { mainComponent:
|
|
2348
|
+
const { mainComponent: n, scene: r, engine: s, components: o } = t, c = n, a = o.get(Kn.BACKGROUND);
|
|
2364
2349
|
return {
|
|
2365
2350
|
document: c,
|
|
2366
2351
|
docBackground: a,
|
|
@@ -2368,13 +2353,13 @@ function kn(n, e) {
|
|
|
2368
2353
|
engine: s
|
|
2369
2354
|
};
|
|
2370
2355
|
}
|
|
2371
|
-
var
|
|
2372
|
-
for (var r =
|
|
2373
|
-
(o =
|
|
2356
|
+
var zi = Object.getOwnPropertyDescriptor, Ki = (i, e, t, n) => {
|
|
2357
|
+
for (var r = n > 1 ? void 0 : n ? zi(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
2358
|
+
(o = i[s]) && (r = o(r) || r);
|
|
2374
2359
|
return r;
|
|
2375
|
-
}, je = (
|
|
2376
|
-
let We = class extends
|
|
2377
|
-
constructor(e, t,
|
|
2360
|
+
}, je = (i, e) => (t, n) => e(t, n, i);
|
|
2361
|
+
let We = class extends pe {
|
|
2362
|
+
constructor(e, t, n, r) {
|
|
2378
2363
|
super();
|
|
2379
2364
|
/**
|
|
2380
2365
|
* It is used to distinguish whether the user has actively moved the cursor in the editor, mainly through mouse clicks.
|
|
@@ -2382,10 +2367,10 @@ let We = class extends fe {
|
|
|
2382
2367
|
// private _cursorChange: CursorChange = CursorChange.InitialState;
|
|
2383
2368
|
/** If the corresponding unit is active and prepared for editing. */
|
|
2384
2369
|
// private _isUnitEditing = false;
|
|
2385
|
-
S(this, "setSlideTextEditor$", new
|
|
2370
|
+
S(this, "setSlideTextEditor$", new Nt());
|
|
2386
2371
|
S(this, "_curRichText", null);
|
|
2387
2372
|
S(this, "_d");
|
|
2388
|
-
this._renderContext = e, this._instanceSrv = t, this._commandService =
|
|
2373
|
+
this._renderContext = e, this._instanceSrv = t, this._commandService = n, this._editorBridgeService = r, this.disposeWithMe(this._instanceSrv.getCurrentTypeOfUnit$(E.UNIVER_SLIDE).subscribe((s) => {
|
|
2389
2374
|
s && s.getUnitId() === this._renderContext.unitId ? this._d = this._init() : this._disposeCurrent();
|
|
2390
2375
|
}));
|
|
2391
2376
|
}
|
|
@@ -2399,8 +2384,8 @@ let We = class extends fe {
|
|
|
2399
2384
|
}
|
|
2400
2385
|
_setEditorRect(e, t) {
|
|
2401
2386
|
this._curRichText = t;
|
|
2402
|
-
const { scene:
|
|
2403
|
-
scene:
|
|
2387
|
+
const { scene: n, engine: r } = this._renderContext, s = this._renderContext.unitId, o = {
|
|
2388
|
+
scene: n,
|
|
2404
2389
|
engine: r,
|
|
2405
2390
|
unitId: s,
|
|
2406
2391
|
pageId: e,
|
|
@@ -2417,16 +2402,16 @@ let We = class extends fe {
|
|
|
2417
2402
|
this.setEditorVisible(!1);
|
|
2418
2403
|
})), e.add(o.onDblclick$.subscribeEvent(() => {
|
|
2419
2404
|
c.clearControls();
|
|
2420
|
-
const
|
|
2421
|
-
|
|
2405
|
+
const u = c.getSelectedObjectMap().values().next().value;
|
|
2406
|
+
u && (u.objectType !== de.RICH_TEXT ? this.pickOtherObjects() : this.startEditing(o.sceneKey, u));
|
|
2422
2407
|
})), e.add(this._instanceSrv.focused$.subscribe((a) => {
|
|
2423
2408
|
this.endEditing();
|
|
2424
2409
|
})));
|
|
2425
|
-
}, { mainComponent:
|
|
2426
|
-
|
|
2410
|
+
}, { mainComponent: n } = this._renderContext;
|
|
2411
|
+
n.subSceneChanged$.subscribeEvent((o) => {
|
|
2427
2412
|
t(o);
|
|
2428
2413
|
});
|
|
2429
|
-
const s = Array.from(
|
|
2414
|
+
const s = Array.from(n.getSubScenes().values());
|
|
2430
2415
|
for (let o = 0; o < s.length; o++) {
|
|
2431
2416
|
const c = s[o];
|
|
2432
2417
|
t(c);
|
|
@@ -2447,20 +2432,20 @@ let We = class extends fe {
|
|
|
2447
2432
|
const e = this._curRichText;
|
|
2448
2433
|
if (!this._instanceSrv.getCurrentUnitForType(E.UNIVER_SLIDE)) return !1;
|
|
2449
2434
|
e.refreshDocumentByDocData(), e.resizeToContentSize(), this._editorBridgeService.endEditing$.next(e);
|
|
2450
|
-
const
|
|
2435
|
+
const n = {
|
|
2451
2436
|
bl: 1,
|
|
2452
2437
|
fs: e.fs,
|
|
2453
2438
|
text: e.text
|
|
2454
2439
|
}, r = (s = e.documentData.body) == null ? void 0 : s.textRuns;
|
|
2455
2440
|
if (r && r.length) {
|
|
2456
2441
|
const c = r[0].ts;
|
|
2457
|
-
|
|
2442
|
+
n.cl = c == null ? void 0 : c.cl;
|
|
2458
2443
|
}
|
|
2459
2444
|
this._commandService.executeCommand(B.id, {
|
|
2460
2445
|
unitId: this._renderContext.unitId,
|
|
2461
2446
|
oKey: e == null ? void 0 : e.oKey,
|
|
2462
2447
|
props: {
|
|
2463
|
-
richText:
|
|
2448
|
+
richText: n
|
|
2464
2449
|
}
|
|
2465
2450
|
}), this._curRichText = null;
|
|
2466
2451
|
}
|
|
@@ -2475,99 +2460,99 @@ let We = class extends fe {
|
|
|
2475
2460
|
this._setEditorRect(e, t), this.setEditorVisible(!0);
|
|
2476
2461
|
}
|
|
2477
2462
|
setEditorVisible(e) {
|
|
2478
|
-
var
|
|
2479
|
-
e ? (
|
|
2463
|
+
var n, r;
|
|
2464
|
+
e ? (n = this._curRichText) == null || n.hide() : (r = this._curRichText) == null || r.show();
|
|
2480
2465
|
const { unitId: t } = this._renderContext;
|
|
2481
2466
|
this._editorBridgeService.changeVisible({ visible: e, eventType: Y.PointerDown, unitId: t });
|
|
2482
2467
|
}
|
|
2483
2468
|
};
|
|
2484
|
-
We =
|
|
2469
|
+
We = Ki([
|
|
2485
2470
|
je(1, w),
|
|
2486
|
-
je(2,
|
|
2471
|
+
je(2, U),
|
|
2487
2472
|
je(3, et)
|
|
2488
2473
|
], We);
|
|
2489
|
-
var
|
|
2490
|
-
for (var r =
|
|
2491
|
-
(o =
|
|
2474
|
+
var Zi = Object.getOwnPropertyDescriptor, Gi = (i, e, t, n) => {
|
|
2475
|
+
for (var r = n > 1 ? void 0 : n ? Zi(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
2476
|
+
(o = i[s]) && (r = o(r) || r);
|
|
2492
2477
|
return r;
|
|
2493
|
-
}, Ae = (
|
|
2494
|
-
let Me = class extends
|
|
2478
|
+
}, Ae = (i, e) => (t, n) => e(t, n, i);
|
|
2479
|
+
let Me = class extends pe {
|
|
2495
2480
|
// private _skeletonChangeMutations = new Set<string>();
|
|
2496
|
-
constructor(
|
|
2497
|
-
super(), this._contextService =
|
|
2481
|
+
constructor(i, e, t) {
|
|
2482
|
+
super(), this._contextService = i, this._instanceSrv = e, this._renderManagerService = t, Promise.resolve().then(() => this._init());
|
|
2498
2483
|
}
|
|
2499
2484
|
_init() {
|
|
2500
2485
|
this._initSlideDataListener(), this._initContextListener();
|
|
2501
2486
|
}
|
|
2502
2487
|
_initSlideDataListener() {
|
|
2503
|
-
this._instanceSrv.getTypeOfUnitAdded$(E.UNIVER_SLIDE).pipe(ht(this.dispose$)).subscribe((
|
|
2504
|
-
this._createRenderer(
|
|
2505
|
-
}), this._instanceSrv.getAllUnitsForType(E.UNIVER_SLIDE).forEach((
|
|
2506
|
-
this._createRenderer(
|
|
2507
|
-
}), this._instanceSrv.getTypeOfUnitDisposed$(E.UNIVER_SLIDE).pipe(ht(this.dispose$)).subscribe((
|
|
2488
|
+
this._instanceSrv.getTypeOfUnitAdded$(E.UNIVER_SLIDE).pipe(ht(this.dispose$)).subscribe((i) => {
|
|
2489
|
+
this._createRenderer(i == null ? void 0 : i.getUnitId());
|
|
2490
|
+
}), this._instanceSrv.getAllUnitsForType(E.UNIVER_SLIDE).forEach((i) => {
|
|
2491
|
+
this._createRenderer(i.getUnitId());
|
|
2492
|
+
}), this._instanceSrv.getTypeOfUnitDisposed$(E.UNIVER_SLIDE).pipe(ht(this.dispose$)).subscribe((i) => this._disposeRenderer(i));
|
|
2508
2493
|
}
|
|
2509
|
-
_createRenderer(
|
|
2510
|
-
|
|
2494
|
+
_createRenderer(i) {
|
|
2495
|
+
i == null || this._instanceSrv.getUnit(i, E.UNIVER_SLIDE) == null || this._renderManagerService.createRender(i);
|
|
2511
2496
|
}
|
|
2512
|
-
_disposeRenderer(
|
|
2513
|
-
const e =
|
|
2497
|
+
_disposeRenderer(i) {
|
|
2498
|
+
const e = i.getUnitId();
|
|
2514
2499
|
this._renderManagerService.removeRender(e);
|
|
2515
2500
|
}
|
|
2516
2501
|
_initContextListener() {
|
|
2517
2502
|
}
|
|
2518
2503
|
};
|
|
2519
|
-
Me =
|
|
2520
|
-
Ae(0,
|
|
2504
|
+
Me = Gi([
|
|
2505
|
+
Ae(0, fe),
|
|
2521
2506
|
Ae(1, w),
|
|
2522
2507
|
Ae(2, K)
|
|
2523
2508
|
], Me);
|
|
2524
|
-
var
|
|
2525
|
-
for (var r =
|
|
2526
|
-
(o =
|
|
2509
|
+
var Xi = Object.getOwnPropertyDescriptor, Yi = (i, e, t, n) => {
|
|
2510
|
+
for (var r = n > 1 ? void 0 : n ? Xi(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
2511
|
+
(o = i[s]) && (r = o(r) || r);
|
|
2527
2512
|
return r;
|
|
2528
|
-
}, Ie = (
|
|
2529
|
-
const
|
|
2513
|
+
}, Ie = (i, e) => (t, n) => e(t, n, i);
|
|
2514
|
+
const qi = "SLIDE_UI";
|
|
2530
2515
|
var be;
|
|
2531
|
-
let Ct = (be = class extends
|
|
2532
|
-
constructor(
|
|
2533
|
-
super(), this._config =
|
|
2516
|
+
let Ct = (be = class extends Cn {
|
|
2517
|
+
constructor(i = pt, e, t, n, r) {
|
|
2518
|
+
super(), this._config = i, this._injector = e, this._renderManagerService = t, this._univerInstanceService = n, this._configService = r;
|
|
2534
2519
|
const { menu: s, ...o } = St(
|
|
2535
2520
|
{},
|
|
2536
|
-
|
|
2521
|
+
pt,
|
|
2537
2522
|
this._config
|
|
2538
2523
|
);
|
|
2539
|
-
s && this._configService.setConfig("menu", s, { merge: !0 }), this._configService.setConfig(
|
|
2524
|
+
s && this._configService.setConfig("menu", s, { merge: !0 }), this._configService.setConfig(Ui, o);
|
|
2540
2525
|
}
|
|
2541
2526
|
onStarting() {
|
|
2542
|
-
|
|
2527
|
+
nt([
|
|
2543
2528
|
[Me],
|
|
2544
2529
|
[et, { useClass: He }],
|
|
2545
2530
|
// used by SlideUIController --> EditorContainer
|
|
2546
|
-
[Qe, { useClass:
|
|
2547
|
-
[
|
|
2548
|
-
], this._config.override).forEach((
|
|
2531
|
+
[Qe, { useClass: Oi }],
|
|
2532
|
+
[Pe]
|
|
2533
|
+
], this._config.override).forEach((i) => this._injector.add(i));
|
|
2549
2534
|
}
|
|
2550
2535
|
onReady() {
|
|
2551
2536
|
[
|
|
2552
2537
|
// SlideRenderService will be init in ready stage, and then calling RenderManagerService@createRender --> init all deps in this rendering register block.
|
|
2553
2538
|
[ve]
|
|
2554
|
-
].forEach((
|
|
2555
|
-
this.disposeWithMe(this._renderManagerService.registerRenderModule(E.UNIVER_SLIDE,
|
|
2556
|
-
}),
|
|
2557
|
-
[
|
|
2539
|
+
].forEach((i) => {
|
|
2540
|
+
this.disposeWithMe(this._renderManagerService.registerRenderModule(E.UNIVER_SLIDE, i));
|
|
2541
|
+
}), nt([
|
|
2542
|
+
[P],
|
|
2558
2543
|
// cannot register in _renderManagerService now.
|
|
2559
2544
|
// [ISlideEditorBridgeService, { useClass: SlideEditorBridgeService }],
|
|
2560
2545
|
// // used by SlideUIController --> EditorContainer
|
|
2561
2546
|
// [ISlideEditorManagerService, { useClass: SlideEditorManagerService }],
|
|
2562
2547
|
// SlidesUIController controller should be registered in Ready stage.
|
|
2563
2548
|
// SlidesUIController controller would add a new RenderUnit (__INTERNAL_EDITOR__DOCS_NORMAL)
|
|
2564
|
-
[
|
|
2549
|
+
[ye],
|
|
2565
2550
|
// editor service was create in renderManagerService
|
|
2566
2551
|
[ve],
|
|
2567
2552
|
[Te]
|
|
2568
|
-
], this._config.override).forEach((
|
|
2569
|
-
this._injector.add(
|
|
2570
|
-
}), this._injector.get(
|
|
2553
|
+
], this._config.override).forEach((i) => {
|
|
2554
|
+
this._injector.add(i);
|
|
2555
|
+
}), this._injector.get(P), this._injector.get(Me);
|
|
2571
2556
|
}
|
|
2572
2557
|
onRendered() {
|
|
2573
2558
|
[
|
|
@@ -2575,32 +2560,32 @@ let Ct = (be = class extends _i {
|
|
|
2575
2560
|
// need TextSelectionRenderService which init by EditorContainer
|
|
2576
2561
|
[We],
|
|
2577
2562
|
[Fe]
|
|
2578
|
-
].forEach((
|
|
2579
|
-
this.disposeWithMe(this._renderManagerService.registerRenderModule(E.UNIVER_SLIDE,
|
|
2580
|
-
}), this._markSlideAsFocused(), this._injector.get(
|
|
2563
|
+
].forEach((i) => {
|
|
2564
|
+
this.disposeWithMe(this._renderManagerService.registerRenderModule(E.UNIVER_SLIDE, i));
|
|
2565
|
+
}), this._markSlideAsFocused(), this._injector.get(ye);
|
|
2581
2566
|
}
|
|
2582
2567
|
onSteady() {
|
|
2583
2568
|
this._injector.get(Te);
|
|
2584
2569
|
}
|
|
2585
2570
|
_markSlideAsFocused() {
|
|
2586
|
-
const
|
|
2571
|
+
const i = this._univerInstanceService;
|
|
2587
2572
|
try {
|
|
2588
|
-
const e =
|
|
2589
|
-
|
|
2573
|
+
const e = i.getCurrentUnitForType(E.UNIVER_SLIDE);
|
|
2574
|
+
i.focusUnit(e.getUnitId());
|
|
2590
2575
|
} catch {
|
|
2591
2576
|
}
|
|
2592
2577
|
}
|
|
2593
|
-
}, S(be, "pluginName",
|
|
2594
|
-
Ct =
|
|
2578
|
+
}, S(be, "pluginName", qi), S(be, "type", E.UNIVER_SLIDE), be);
|
|
2579
|
+
Ct = Yi([
|
|
2595
2580
|
Ie(1, z(ke)),
|
|
2596
2581
|
Ie(2, K),
|
|
2597
2582
|
Ie(3, w),
|
|
2598
|
-
Ie(4,
|
|
2583
|
+
Ie(4, Sn)
|
|
2599
2584
|
], Ct);
|
|
2600
2585
|
export {
|
|
2601
2586
|
Vt as ActivateSlidePageOperation,
|
|
2602
2587
|
jt as AppendSlideOperation,
|
|
2603
|
-
|
|
2588
|
+
P as CanvasView,
|
|
2604
2589
|
At as DeleteSlideElementOperation,
|
|
2605
2590
|
et as ISlideEditorBridgeService,
|
|
2606
2591
|
Ge as InsertSlideFloatImageCommand,
|
|
@@ -2614,11 +2599,11 @@ export {
|
|
|
2614
2599
|
Yt as SetSlidePageThumbOperation,
|
|
2615
2600
|
Je as SlideAddTextCommand,
|
|
2616
2601
|
Xt as SlideAddTextOperation,
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2602
|
+
Pe as SlideCanvasPopMangerService,
|
|
2603
|
+
wi as SlideEditorContainer,
|
|
2604
|
+
_i as SlideSideBar,
|
|
2605
|
+
ye as SlidesUIController,
|
|
2606
|
+
Ri as SlidesUIMenuSchema,
|
|
2622
2607
|
Ct as UniverSlidesUIPlugin,
|
|
2623
2608
|
B as UpdateSlideElementOperation
|
|
2624
2609
|
};
|