pptx-react-viewer 3.1.1 → 3.1.3
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/CHANGELOG.md +22 -0
- package/dist/{AiChatPanel-EIENGCKW.mjs → AiChatPanel-5JAQBLTU.mjs} +4 -4
- package/dist/AiChatPanel-5JAQBLTU.mjs.br +0 -0
- package/dist/AiChatPanel-5JAQBLTU.mjs.gz +0 -0
- package/dist/{AiChatPanel-6PERJN7M.js → AiChatPanel-C3E7UV7T.js} +24 -24
- package/dist/AiChatPanel-C3E7UV7T.js.br +0 -0
- package/dist/AiChatPanel-C3E7UV7T.js.gz +0 -0
- package/dist/{Area3DChartScene-W6SVC235.mjs → Area3DChartScene-KE434ERF.mjs} +1 -1
- package/dist/{Area3DChartScene-W6SVC235.mjs.br → Area3DChartScene-KE434ERF.mjs.br} +0 -0
- package/dist/Area3DChartScene-KE434ERF.mjs.gz +0 -0
- package/dist/{Area3DChartScene-TXCLQLBQ.js → Area3DChartScene-XY2PKRMA.js} +2 -2
- package/dist/Area3DChartScene-XY2PKRMA.js.br +0 -0
- package/dist/Area3DChartScene-XY2PKRMA.js.gz +0 -0
- package/dist/{Bar3DChartScene-FCVUZIJ3.mjs → Bar3DChartScene-2KQABQZM.mjs} +1 -1
- package/dist/{Bar3DChartScene-FCVUZIJ3.mjs.br → Bar3DChartScene-2KQABQZM.mjs.br} +0 -0
- package/dist/Bar3DChartScene-2KQABQZM.mjs.gz +0 -0
- package/dist/{Bar3DChartScene-6RHPFLZT.js → Bar3DChartScene-YMADUUZN.js} +2 -2
- package/dist/Bar3DChartScene-YMADUUZN.js.br +0 -0
- package/dist/Bar3DChartScene-YMADUUZN.js.gz +0 -0
- package/dist/{Line3DChartScene-2ZFE53KO.js → Line3DChartScene-AB7N6ORX.js} +2 -2
- package/dist/Line3DChartScene-AB7N6ORX.js.br +0 -0
- package/dist/Line3DChartScene-AB7N6ORX.js.gz +0 -0
- package/dist/{Line3DChartScene-MJXFXSPW.mjs → Line3DChartScene-K3BSK6BB.mjs} +1 -1
- package/dist/{Line3DChartScene-MJXFXSPW.mjs.br → Line3DChartScene-K3BSK6BB.mjs.br} +0 -0
- package/dist/Line3DChartScene-K3BSK6BB.mjs.gz +0 -0
- package/dist/{Model3DScene-A5RV3KNJ.mjs → Model3DScene-NT5RRIB5.mjs} +1 -1
- package/dist/{Model3DScene-A5RV3KNJ.mjs.br → Model3DScene-NT5RRIB5.mjs.br} +0 -0
- package/dist/Model3DScene-NT5RRIB5.mjs.gz +0 -0
- package/dist/{Model3DScene-7VQNRY5B.js → Model3DScene-VSLGUWC7.js} +2 -2
- package/dist/{Model3DScene-7VQNRY5B.js.br → Model3DScene-VSLGUWC7.js.br} +0 -0
- package/dist/Model3DScene-VSLGUWC7.js.gz +0 -0
- package/dist/{PieChart3DScene-JTHZESS3.js → PieChart3DScene-6MUFRFYJ.js} +2 -2
- package/dist/PieChart3DScene-6MUFRFYJ.js.br +0 -0
- package/dist/PieChart3DScene-6MUFRFYJ.js.gz +0 -0
- package/dist/{PieChart3DScene-UEVFZZVW.mjs → PieChart3DScene-NFRBKII7.mjs} +1 -1
- package/dist/PieChart3DScene-NFRBKII7.mjs.br +0 -0
- package/dist/PieChart3DScene-NFRBKII7.mjs.gz +0 -0
- package/dist/PowerPointViewer-Cl6jBPNw.d.ts.map +1 -1
- package/dist/{SurfaceChart3DScene-FXUNT5OK.js → SurfaceChart3DScene-2UQOKVFB.js} +2 -2
- package/dist/SurfaceChart3DScene-2UQOKVFB.js.br +0 -0
- package/dist/SurfaceChart3DScene-2UQOKVFB.js.gz +0 -0
- package/dist/{SurfaceChart3DScene-WD65PAG4.mjs → SurfaceChart3DScene-UKIOTKJC.mjs} +1 -1
- package/dist/{SurfaceChart3DScene-WD65PAG4.mjs.br → SurfaceChart3DScene-UKIOTKJC.mjs.br} +0 -0
- package/dist/SurfaceChart3DScene-UKIOTKJC.mjs.gz +0 -0
- package/dist/{chunk-ICAYXQVJ.mjs → chunk-5WH6UVWC.mjs} +289 -135
- package/dist/chunk-5WH6UVWC.mjs.br +0 -0
- package/dist/chunk-5WH6UVWC.mjs.gz +0 -0
- package/dist/{chunk-OUX4O5XK.mjs → chunk-ACVLIDUS.mjs} +2 -2
- package/dist/chunk-ACVLIDUS.mjs.br +0 -0
- package/dist/chunk-ACVLIDUS.mjs.gz +0 -0
- package/dist/{chunk-MKPSUHUH.mjs → chunk-ARJE3V6V.mjs} +5 -6
- package/dist/chunk-ARJE3V6V.mjs.br +0 -0
- package/dist/chunk-ARJE3V6V.mjs.gz +0 -0
- package/dist/{chunk-MAOUVROK.mjs → chunk-BZ6OM3H5.mjs} +360 -338
- package/dist/chunk-BZ6OM3H5.mjs.br +0 -0
- package/dist/chunk-BZ6OM3H5.mjs.gz +0 -0
- package/dist/{chunk-GIFQWIW5.js → chunk-GCOGKBK3.js} +1368 -1214
- package/dist/chunk-GCOGKBK3.js.br +0 -0
- package/dist/chunk-GCOGKBK3.js.gz +0 -0
- package/dist/{chunk-IDTNKL4S.js → chunk-HMZA25W2.js} +300 -45
- package/dist/chunk-HMZA25W2.js.br +0 -0
- package/dist/chunk-HMZA25W2.js.gz +0 -0
- package/dist/{chunk-OZGFMZEX.js → chunk-K4DUVYZ7.js} +3 -3
- package/dist/chunk-K4DUVYZ7.js.br +0 -0
- package/dist/chunk-K4DUVYZ7.js.gz +0 -0
- package/dist/{chunk-GCE2TYHF.js → chunk-OABOL32L.js} +157 -157
- package/dist/chunk-OABOL32L.js.br +0 -0
- package/dist/chunk-OABOL32L.js.gz +0 -0
- package/dist/{chunk-ISDTM2V3.mjs → chunk-SRAXNEJX.mjs} +286 -45
- package/dist/chunk-SRAXNEJX.mjs.br +0 -0
- package/dist/chunk-SRAXNEJX.mjs.gz +0 -0
- package/dist/{chunk-PIUB7R2K.js → chunk-SWRY3SI5.js} +5 -6
- package/dist/chunk-SWRY3SI5.js.br +0 -0
- package/dist/chunk-SWRY3SI5.js.gz +0 -0
- package/dist/{chunk-OTBQBTTQ.js → chunk-XBR7W47W.js} +726 -706
- package/dist/chunk-XBR7W47W.js.br +0 -0
- package/dist/chunk-XBR7W47W.js.gz +0 -0
- package/dist/{chunk-5ERW2B25.mjs → chunk-Z3DEULRJ.mjs} +1 -1
- package/dist/chunk-Z3DEULRJ.mjs.br +0 -0
- package/dist/chunk-Z3DEULRJ.mjs.gz +0 -0
- package/dist/i18n.js +4 -4
- package/dist/i18n.js.br +0 -0
- package/dist/i18n.js.gz +0 -0
- package/dist/i18n.mjs +1 -1
- package/dist/i18n.mjs.br +0 -0
- package/dist/i18n.mjs.gz +0 -0
- package/dist/index.d.ts +27 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +47 -47
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.br +0 -0
- package/dist/index.mjs.gz +0 -0
- package/dist/internals.d.ts +99 -22
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +79 -79
- package/dist/internals.js.br +0 -0
- package/dist/internals.js.gz +0 -0
- package/dist/internals.mjs +4 -4
- package/dist/internals.mjs.br +0 -0
- package/dist/internals.mjs.gz +0 -0
- package/dist/pptx-viewer.css +1 -1
- package/dist/pptx-viewer.css.br +0 -0
- package/dist/pptx-viewer.css.gz +0 -0
- package/dist/{useViewerBuildingBlocks-DC1O_op4.d.ts → useViewerBuildingBlocks-X1L8BjsQ.d.ts} +19 -2
- package/dist/useViewerBuildingBlocks-X1L8BjsQ.d.ts.map +1 -0
- package/dist/viewer/index.js +27 -27
- package/dist/viewer/index.js.br +0 -0
- package/dist/viewer/index.js.gz +0 -0
- package/dist/viewer/index.mjs +6 -6
- package/dist/viewer/index.mjs.br +0 -0
- package/dist/viewer/index.mjs.gz +0 -0
- package/package.json +1 -1
- package/dist/AiChatPanel-6PERJN7M.js.br +0 -0
- package/dist/AiChatPanel-6PERJN7M.js.gz +0 -0
- package/dist/AiChatPanel-EIENGCKW.mjs.br +0 -0
- package/dist/AiChatPanel-EIENGCKW.mjs.gz +0 -0
- package/dist/Area3DChartScene-TXCLQLBQ.js.br +0 -0
- package/dist/Area3DChartScene-TXCLQLBQ.js.gz +0 -0
- package/dist/Area3DChartScene-W6SVC235.mjs.gz +0 -0
- package/dist/Bar3DChartScene-6RHPFLZT.js.br +0 -0
- package/dist/Bar3DChartScene-6RHPFLZT.js.gz +0 -0
- package/dist/Bar3DChartScene-FCVUZIJ3.mjs.gz +0 -0
- package/dist/Line3DChartScene-2ZFE53KO.js.br +0 -0
- package/dist/Line3DChartScene-2ZFE53KO.js.gz +0 -0
- package/dist/Line3DChartScene-MJXFXSPW.mjs.gz +0 -0
- package/dist/Model3DScene-7VQNRY5B.js.gz +0 -0
- package/dist/Model3DScene-A5RV3KNJ.mjs.gz +0 -0
- package/dist/PieChart3DScene-JTHZESS3.js.br +0 -0
- package/dist/PieChart3DScene-JTHZESS3.js.gz +0 -0
- package/dist/PieChart3DScene-UEVFZZVW.mjs.br +0 -0
- package/dist/PieChart3DScene-UEVFZZVW.mjs.gz +0 -0
- package/dist/SurfaceChart3DScene-FXUNT5OK.js.br +0 -0
- package/dist/SurfaceChart3DScene-FXUNT5OK.js.gz +0 -0
- package/dist/SurfaceChart3DScene-WD65PAG4.mjs.gz +0 -0
- package/dist/chunk-5ERW2B25.mjs.br +0 -0
- package/dist/chunk-5ERW2B25.mjs.gz +0 -0
- package/dist/chunk-GCE2TYHF.js.br +0 -0
- package/dist/chunk-GCE2TYHF.js.gz +0 -0
- package/dist/chunk-GIFQWIW5.js.br +0 -0
- package/dist/chunk-GIFQWIW5.js.gz +0 -0
- package/dist/chunk-ICAYXQVJ.mjs.br +0 -0
- package/dist/chunk-ICAYXQVJ.mjs.gz +0 -0
- package/dist/chunk-IDTNKL4S.js.br +0 -0
- package/dist/chunk-IDTNKL4S.js.gz +0 -0
- package/dist/chunk-ISDTM2V3.mjs.br +0 -0
- package/dist/chunk-ISDTM2V3.mjs.gz +0 -0
- package/dist/chunk-MAOUVROK.mjs.br +0 -0
- package/dist/chunk-MAOUVROK.mjs.gz +0 -0
- package/dist/chunk-MKPSUHUH.mjs.br +0 -0
- package/dist/chunk-MKPSUHUH.mjs.gz +0 -0
- package/dist/chunk-OTBQBTTQ.js.br +0 -0
- package/dist/chunk-OTBQBTTQ.js.gz +0 -0
- package/dist/chunk-OUX4O5XK.mjs.br +0 -0
- package/dist/chunk-OUX4O5XK.mjs.gz +0 -0
- package/dist/chunk-OZGFMZEX.js.br +0 -0
- package/dist/chunk-OZGFMZEX.js.gz +0 -0
- package/dist/chunk-PIUB7R2K.js.br +0 -0
- package/dist/chunk-PIUB7R2K.js.gz +0 -0
- package/dist/useViewerBuildingBlocks-DC1O_op4.d.ts.map +0 -1
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkOABOL32L_js = require('./chunk-OABOL32L.js');
|
|
4
|
+
var chunkSWRY3SI5_js = require('./chunk-SWRY3SI5.js');
|
|
5
|
+
var chunkHMZA25W2_js = require('./chunk-HMZA25W2.js');
|
|
6
6
|
var react = require('react');
|
|
7
|
-
var JSZip = require('jszip');
|
|
8
7
|
var reactI18next = require('react-i18next');
|
|
9
8
|
|
|
10
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
|
|
12
|
-
var JSZip__default = /*#__PURE__*/_interopDefault(JSZip);
|
|
13
|
-
|
|
14
9
|
function useVirtualizedSlides({
|
|
15
10
|
totalItems,
|
|
16
11
|
itemHeight,
|
|
17
|
-
overscan =
|
|
12
|
+
overscan = chunkHMZA25W2_js.DEFAULT_VIRTUAL_OVERSCAN
|
|
18
13
|
}) {
|
|
19
14
|
const scrollContainerRef = react.useRef(null);
|
|
20
15
|
const [scrollTop, setScrollTop] = react.useState(0);
|
|
@@ -44,7 +39,7 @@ function useVirtualizedSlides({
|
|
|
44
39
|
resizeObserver?.disconnect();
|
|
45
40
|
};
|
|
46
41
|
}, []);
|
|
47
|
-
const range =
|
|
42
|
+
const range = chunkHMZA25W2_js.computeVirtualRange(totalItems, itemHeight, scrollTop, viewportHeight, overscan);
|
|
48
43
|
const safeItemHeight = Math.max(itemHeight, 1);
|
|
49
44
|
const scrollToIndex = react.useCallback(
|
|
50
45
|
(index, behavior = "smooth") => {
|
|
@@ -85,7 +80,7 @@ function usePresenceTracking({
|
|
|
85
80
|
}) {
|
|
86
81
|
const [remoteUsers, setRemoteUsers] = react.useState([]);
|
|
87
82
|
const projectorRef = react.useRef(null);
|
|
88
|
-
projectorRef.current ??=
|
|
83
|
+
projectorRef.current ??= chunkHMZA25W2_js.createPresenceProjector();
|
|
89
84
|
const projector = projectorRef.current;
|
|
90
85
|
const lastBroadcastRef = react.useRef(0);
|
|
91
86
|
const pendingBroadcastRef = react.useRef(null);
|
|
@@ -110,7 +105,7 @@ function usePresenceTracking({
|
|
|
110
105
|
awareness.setLocalStateField("presence", state);
|
|
111
106
|
lastBroadcastRef.current = Date.now();
|
|
112
107
|
};
|
|
113
|
-
if (elapsed >=
|
|
108
|
+
if (elapsed >= chunkHMZA25W2_js.BROADCAST_THROTTLE_MS) {
|
|
114
109
|
if (pendingBroadcastRef.current) {
|
|
115
110
|
clearTimeout(pendingBroadcastRef.current);
|
|
116
111
|
pendingBroadcastRef.current = null;
|
|
@@ -120,7 +115,7 @@ function usePresenceTracking({
|
|
|
120
115
|
pendingBroadcastRef.current = setTimeout(() => {
|
|
121
116
|
pendingBroadcastRef.current = null;
|
|
122
117
|
flush();
|
|
123
|
-
},
|
|
118
|
+
}, chunkHMZA25W2_js.BROADCAST_THROTTLE_MS - elapsed);
|
|
124
119
|
}
|
|
125
120
|
},
|
|
126
121
|
[awareness, userName, userColor, userAvatar, role]
|
|
@@ -200,7 +195,7 @@ function useYjsProvider({ config }) {
|
|
|
200
195
|
const departureRef = react.useRef(null);
|
|
201
196
|
const gateRef = react.useRef(null);
|
|
202
197
|
if (!gateRef.current) {
|
|
203
|
-
gateRef.current =
|
|
198
|
+
gateRef.current = chunkHMZA25W2_js.createSyncGate(() => setSynced(true));
|
|
204
199
|
}
|
|
205
200
|
const teardown = react.useCallback(() => {
|
|
206
201
|
if (timeoutRef.current) {
|
|
@@ -220,7 +215,7 @@ function useYjsProvider({ config }) {
|
|
|
220
215
|
const buildCleanup = react.useCallback(
|
|
221
216
|
(provider, yDoc) => () => {
|
|
222
217
|
announceDeparture();
|
|
223
|
-
|
|
218
|
+
chunkHMZA25W2_js.clearLocalAwareness(provider.awareness);
|
|
224
219
|
provider.destroy();
|
|
225
220
|
yDoc.destroy();
|
|
226
221
|
setDoc(null);
|
|
@@ -245,9 +240,9 @@ function useYjsProvider({ config }) {
|
|
|
245
240
|
if (config.authToken) {
|
|
246
241
|
opts.password = config.authToken;
|
|
247
242
|
}
|
|
248
|
-
const roomId =
|
|
243
|
+
const roomId = chunkHMZA25W2_js.validateRoomId(config.roomId);
|
|
249
244
|
const provider = new WebrtcProvider(roomId, yDoc, opts);
|
|
250
|
-
departureRef.current =
|
|
245
|
+
departureRef.current = chunkHMZA25W2_js.createDepartureChannel(roomId, provider.awareness);
|
|
251
246
|
setDoc(yDoc);
|
|
252
247
|
setAwareness(provider.awareness);
|
|
253
248
|
setClientId(provider.awareness.clientID);
|
|
@@ -289,13 +284,13 @@ function useYjsProvider({ config }) {
|
|
|
289
284
|
if (!config) {
|
|
290
285
|
return;
|
|
291
286
|
}
|
|
292
|
-
const roomId =
|
|
293
|
-
const transport = config.transport ??
|
|
287
|
+
const roomId = chunkHMZA25W2_js.validateRoomId(config.roomId);
|
|
288
|
+
const transport = config.transport ?? chunkHMZA25W2_js.resolveTransportForServerUrl(config.serverUrl);
|
|
294
289
|
if (transport === "webrtc") {
|
|
295
290
|
await initWebrtc();
|
|
296
291
|
return;
|
|
297
292
|
}
|
|
298
|
-
if (
|
|
293
|
+
if (chunkHMZA25W2_js.isMixedContentBlocked(config.serverUrl)) {
|
|
299
294
|
console.warn(
|
|
300
295
|
`[pptx-viewer] Refusing to connect: insecure ws:// server "${config.serverUrl}" is blocked from a secure (https) page. Use a wss:// URL.`
|
|
301
296
|
);
|
|
@@ -309,7 +304,7 @@ function useYjsProvider({ config }) {
|
|
|
309
304
|
const provider = new WebsocketProvider(config.serverUrl, roomId, yDoc, {
|
|
310
305
|
params: config.authToken ? { token: config.authToken } : void 0
|
|
311
306
|
});
|
|
312
|
-
departureRef.current =
|
|
307
|
+
departureRef.current = chunkHMZA25W2_js.createDepartureChannel(roomId, provider.awareness);
|
|
313
308
|
let connected = false;
|
|
314
309
|
const handleStatus = (event) => {
|
|
315
310
|
if (event.status === "connected") {
|
|
@@ -349,7 +344,7 @@ function useYjsProvider({ config }) {
|
|
|
349
344
|
provider.off("status", handleStatus);
|
|
350
345
|
provider.off("sync", handleSynced);
|
|
351
346
|
announceDeparture();
|
|
352
|
-
|
|
347
|
+
chunkHMZA25W2_js.clearLocalAwareness(provider.awareness);
|
|
353
348
|
provider.destroy();
|
|
354
349
|
yDoc.destroy();
|
|
355
350
|
setDoc(null);
|
|
@@ -358,7 +353,7 @@ function useYjsProvider({ config }) {
|
|
|
358
353
|
cleanupRef.current = null;
|
|
359
354
|
setStatus("error");
|
|
360
355
|
}
|
|
361
|
-
},
|
|
356
|
+
}, chunkHMZA25W2_js.CONNECTION_TIMEOUT_MS);
|
|
362
357
|
}
|
|
363
358
|
setDoc(yDoc);
|
|
364
359
|
setAwareness(provider.awareness);
|
|
@@ -367,7 +362,7 @@ function useYjsProvider({ config }) {
|
|
|
367
362
|
provider.off("status", handleStatus);
|
|
368
363
|
provider.off("sync", handleSynced);
|
|
369
364
|
announceDeparture();
|
|
370
|
-
|
|
365
|
+
chunkHMZA25W2_js.clearLocalAwareness(provider.awareness);
|
|
371
366
|
provider.destroy();
|
|
372
367
|
yDoc.destroy();
|
|
373
368
|
setDoc(null);
|
|
@@ -393,7 +388,7 @@ function useYjsProvider({ config }) {
|
|
|
393
388
|
]);
|
|
394
389
|
react.useEffect(() => {
|
|
395
390
|
init();
|
|
396
|
-
const disposeTeardown =
|
|
391
|
+
const disposeTeardown = chunkHMZA25W2_js.registerCollaborationTeardown({
|
|
397
392
|
leave: teardown,
|
|
398
393
|
rejoin: init
|
|
399
394
|
});
|
|
@@ -414,7 +409,7 @@ function useCollaborativeState({
|
|
|
414
409
|
canvasWidth,
|
|
415
410
|
canvasHeight
|
|
416
411
|
}) {
|
|
417
|
-
const userColor =
|
|
412
|
+
const userColor = chunkHMZA25W2_js.sanitizeColor(config?.userColor, "#6366f1");
|
|
418
413
|
const { status, awareness, doc, clientId, synced, retry } = useYjsProvider({ config });
|
|
419
414
|
const { remoteUsers, broadcastPresence } = usePresenceTracking({
|
|
420
415
|
awareness,
|
|
@@ -532,8 +527,8 @@ function useEditorHistory(input) {
|
|
|
532
527
|
width: canvasSize.width,
|
|
533
528
|
height: canvasSize.height,
|
|
534
529
|
activeSlideIndex,
|
|
535
|
-
slides: slides.map(
|
|
536
|
-
templateElementsBySlideId:
|
|
530
|
+
slides: slides.map(chunkHMZA25W2_js.cloneSlide),
|
|
531
|
+
templateElementsBySlideId: chunkHMZA25W2_js.cloneTemplateElementsBySlideId(templateElementsBySlideId),
|
|
537
532
|
...actionLabel ? { actionLabel } : {}
|
|
538
533
|
};
|
|
539
534
|
},
|
|
@@ -546,9 +541,9 @@ function useEditorHistory(input) {
|
|
|
546
541
|
width: snapshot.width,
|
|
547
542
|
height: snapshot.height
|
|
548
543
|
});
|
|
549
|
-
setSlides(snapshot.slides.map(
|
|
544
|
+
setSlides(snapshot.slides.map(chunkHMZA25W2_js.cloneSlide));
|
|
550
545
|
setTemplateElementsBySlideId(
|
|
551
|
-
|
|
546
|
+
chunkHMZA25W2_js.cloneTemplateElementsBySlideId(snapshot.templateElementsBySlideId)
|
|
552
547
|
);
|
|
553
548
|
setActiveSlideIndex(Math.min(snapshot.activeSlideIndex, maxSlideIndex));
|
|
554
549
|
setSelectedElementIds([]);
|
|
@@ -587,8 +582,8 @@ function useEditorHistory(input) {
|
|
|
587
582
|
const currentSnapshot = buildHistorySnapshot();
|
|
588
583
|
historyFutureRef.current.push(currentSnapshot);
|
|
589
584
|
isApplyingHistoryRef.current = true;
|
|
590
|
-
const nextSnapshot =
|
|
591
|
-
lastHistorySnapshotRef.current =
|
|
585
|
+
const nextSnapshot = chunkOABOL32L_js.cloneHistorySnapshot(previousSnapshot);
|
|
586
|
+
lastHistorySnapshotRef.current = chunkOABOL32L_js.cloneHistorySnapshot(nextSnapshot);
|
|
592
587
|
lastHistorySerializedRef.current = serializeDocument(nextSnapshot);
|
|
593
588
|
applyHistorySnapshot(nextSnapshot);
|
|
594
589
|
updateHistoryAvailability();
|
|
@@ -609,8 +604,8 @@ function useEditorHistory(input) {
|
|
|
609
604
|
const currentSnapshot = buildHistorySnapshot();
|
|
610
605
|
historyPastRef.current.push(currentSnapshot);
|
|
611
606
|
isApplyingHistoryRef.current = true;
|
|
612
|
-
const targetSnapshot =
|
|
613
|
-
lastHistorySnapshotRef.current =
|
|
607
|
+
const targetSnapshot = chunkOABOL32L_js.cloneHistorySnapshot(nextSnapshot);
|
|
608
|
+
lastHistorySnapshotRef.current = chunkOABOL32L_js.cloneHistorySnapshot(targetSnapshot);
|
|
614
609
|
lastHistorySerializedRef.current = serializeDocument(targetSnapshot);
|
|
615
610
|
applyHistorySnapshot(targetSnapshot);
|
|
616
611
|
updateHistoryAvailability();
|
|
@@ -628,7 +623,7 @@ function useEditorHistory(input) {
|
|
|
628
623
|
historyPastRef.current = [];
|
|
629
624
|
historyFutureRef.current = [];
|
|
630
625
|
if (initialSnapshot) {
|
|
631
|
-
const clonedInitial =
|
|
626
|
+
const clonedInitial = chunkOABOL32L_js.cloneHistorySnapshot(initialSnapshot);
|
|
632
627
|
lastHistorySnapshotRef.current = clonedInitial;
|
|
633
628
|
lastHistorySerializedRef.current = serializeDocument(clonedInitial);
|
|
634
629
|
} else {
|
|
@@ -676,19 +671,19 @@ function useEditorHistory(input) {
|
|
|
676
671
|
}
|
|
677
672
|
const previousSnapshot = lastHistorySnapshotRef.current;
|
|
678
673
|
if (!previousSnapshot) {
|
|
679
|
-
lastHistorySnapshotRef.current =
|
|
674
|
+
lastHistorySnapshotRef.current = chunkOABOL32L_js.cloneHistorySnapshot(snapshot);
|
|
680
675
|
lastHistorySerializedRef.current = serialized;
|
|
681
676
|
lastCheapHashRef.current = cheapHash;
|
|
682
677
|
updateHistoryAvailability();
|
|
683
678
|
return;
|
|
684
679
|
}
|
|
685
680
|
onDirtyRef.current?.();
|
|
686
|
-
historyPastRef.current.push(
|
|
681
|
+
historyPastRef.current.push(chunkOABOL32L_js.cloneHistorySnapshot(previousSnapshot));
|
|
687
682
|
while (historyPastRef.current.length > Math.max(1, maxHistoryEntries)) {
|
|
688
683
|
historyPastRef.current.shift();
|
|
689
684
|
}
|
|
690
685
|
historyFutureRef.current = [];
|
|
691
|
-
lastHistorySnapshotRef.current =
|
|
686
|
+
lastHistorySnapshotRef.current = chunkOABOL32L_js.cloneHistorySnapshot(snapshot);
|
|
692
687
|
lastHistorySerializedRef.current = serialized;
|
|
693
688
|
lastCheapHashRef.current = cheapHash;
|
|
694
689
|
updateHistoryAvailability();
|
|
@@ -748,9 +743,9 @@ function useZoomViewport({
|
|
|
748
743
|
const canvasStageRef = react.useRef(null);
|
|
749
744
|
const canvasViewportRef = react.useRef(null);
|
|
750
745
|
const renderScaleRef = react.useRef(1);
|
|
751
|
-
const wheelBufferRef = react.useRef(
|
|
746
|
+
const wheelBufferRef = react.useRef(chunkHMZA25W2_js.createWheelStepBuffer());
|
|
752
747
|
const storeRef = react.useRef(null);
|
|
753
|
-
storeRef.current ??=
|
|
748
|
+
storeRef.current ??= chunkHMZA25W2_js.createViewerZoomStore();
|
|
754
749
|
const store = storeRef.current;
|
|
755
750
|
const scale = useViewerStore(store, selectZoom);
|
|
756
751
|
const setScale = react.useCallback(
|
|
@@ -811,7 +806,7 @@ function useZoomViewport({
|
|
|
811
806
|
if (!wrapper || !canvasViewport) {
|
|
812
807
|
return;
|
|
813
808
|
}
|
|
814
|
-
const boundedScale =
|
|
809
|
+
const boundedScale = chunkHMZA25W2_js.clampZoomScale(nextScale);
|
|
815
810
|
const nextEditorScale = fitScale * boundedScale;
|
|
816
811
|
const centerX = (bounds.minX + bounds.maxX) / 2;
|
|
817
812
|
const centerY = (bounds.minY + bounds.maxY) / 2;
|
|
@@ -848,29 +843,29 @@ function useZoomViewport({
|
|
|
848
843
|
selectedElements.forEach((element) => {
|
|
849
844
|
minX = Math.min(minX, element.x);
|
|
850
845
|
minY = Math.min(minY, element.y);
|
|
851
|
-
maxX = Math.max(maxX, element.x + Math.max(element.width,
|
|
852
|
-
maxY = Math.max(maxY, element.y + Math.max(element.height,
|
|
846
|
+
maxX = Math.max(maxX, element.x + Math.max(element.width, chunkOABOL32L_js.MIN_ELEMENT_SIZE));
|
|
847
|
+
maxY = Math.max(maxY, element.y + Math.max(element.height, chunkOABOL32L_js.MIN_ELEMENT_SIZE));
|
|
853
848
|
});
|
|
854
849
|
if (!Number.isFinite(minX) || !Number.isFinite(minY) || !Number.isFinite(maxX) || !Number.isFinite(maxY)) {
|
|
855
850
|
return;
|
|
856
851
|
}
|
|
857
852
|
const selectionBounds = { minX, minY, maxX, maxY };
|
|
858
|
-
const boundsWidth = Math.max(selectionBounds.maxX - selectionBounds.minX,
|
|
859
|
-
const boundsHeight = Math.max(selectionBounds.maxY - selectionBounds.minY,
|
|
853
|
+
const boundsWidth = Math.max(selectionBounds.maxX - selectionBounds.minX, chunkOABOL32L_js.MIN_ELEMENT_SIZE);
|
|
854
|
+
const boundsHeight = Math.max(selectionBounds.maxY - selectionBounds.minY, chunkOABOL32L_js.MIN_ELEMENT_SIZE);
|
|
860
855
|
const availableWidth = Math.max(
|
|
861
|
-
effectiveEditorDimensions.width -
|
|
862
|
-
|
|
856
|
+
effectiveEditorDimensions.width - chunkOABOL32L_js.ZOOM_TO_SELECTION_PADDING,
|
|
857
|
+
chunkOABOL32L_js.MIN_ELEMENT_SIZE
|
|
863
858
|
);
|
|
864
859
|
const availableHeight = Math.max(
|
|
865
|
-
effectiveEditorDimensions.height -
|
|
866
|
-
|
|
860
|
+
effectiveEditorDimensions.height - chunkOABOL32L_js.ZOOM_TO_SELECTION_PADDING,
|
|
861
|
+
chunkOABOL32L_js.MIN_ELEMENT_SIZE
|
|
867
862
|
);
|
|
868
863
|
const targetEditorScale = Math.min(
|
|
869
864
|
availableWidth / boundsWidth,
|
|
870
865
|
availableHeight / boundsHeight
|
|
871
866
|
);
|
|
872
867
|
const safeFitScale = fitScale > Number.EPSILON ? fitScale : Number.EPSILON;
|
|
873
|
-
const nextScale =
|
|
868
|
+
const nextScale = chunkHMZA25W2_js.clampZoomScale(targetEditorScale / safeFitScale);
|
|
874
869
|
setScale(nextScale);
|
|
875
870
|
window.requestAnimationFrame(() => {
|
|
876
871
|
window.requestAnimationFrame(() => {
|
|
@@ -887,14 +882,14 @@ function useZoomViewport({
|
|
|
887
882
|
]);
|
|
888
883
|
const handleWheel = react.useCallback(
|
|
889
884
|
(event) => {
|
|
890
|
-
const mapped =
|
|
885
|
+
const mapped = chunkHMZA25W2_js.mapEditingWheel(event, wheelBufferRef.current, true);
|
|
891
886
|
if (mapped.intent !== "zoom") {
|
|
892
887
|
return;
|
|
893
888
|
}
|
|
894
889
|
event.preventDefault();
|
|
895
890
|
store.dispatch({
|
|
896
891
|
type: "set-zoom",
|
|
897
|
-
zoom:
|
|
892
|
+
zoom: chunkHMZA25W2_js.clampZoomScale(store.getState().zoom + mapped.deltaScale)
|
|
898
893
|
});
|
|
899
894
|
},
|
|
900
895
|
[store]
|
|
@@ -982,7 +977,7 @@ function applyAnimationGroupSteps(group, onPlayActionSound, setPresentationEleme
|
|
|
982
977
|
const command = step.command;
|
|
983
978
|
const timer = window.setTimeout(
|
|
984
979
|
() => {
|
|
985
|
-
|
|
980
|
+
chunkOABOL32L_js.executeMediaCommand(command);
|
|
986
981
|
},
|
|
987
982
|
Math.max(0, step.delayMs)
|
|
988
983
|
);
|
|
@@ -1119,7 +1114,7 @@ function scheduleEntranceAnimationTimers(slide, setPresentationAnimations, prese
|
|
|
1119
1114
|
}))
|
|
1120
1115
|
);
|
|
1121
1116
|
entranceAnimations.forEach((animation, animationIndex) => {
|
|
1122
|
-
const delay =
|
|
1117
|
+
const delay = chunkHMZA25W2_js.computeEntranceAnimationDelay(animation.delayMs, animationIndex);
|
|
1123
1118
|
const timer = window.setTimeout(() => {
|
|
1124
1119
|
setPresentationAnimations(
|
|
1125
1120
|
(previousAnimations) => previousAnimations.map(
|
|
@@ -1151,7 +1146,7 @@ function useAnimationPlayback(input) {
|
|
|
1151
1146
|
(controller, group) => {
|
|
1152
1147
|
driveBuildReveal(
|
|
1153
1148
|
controller,
|
|
1154
|
-
|
|
1149
|
+
chunkHMZA25W2_js.PresentationAnimationController.collectBuildStepIds(group),
|
|
1155
1150
|
setPresentationElementStates,
|
|
1156
1151
|
buildRafRef
|
|
1157
1152
|
);
|
|
@@ -1220,7 +1215,7 @@ function useAnimationPlayback(input) {
|
|
|
1220
1215
|
setHoverTriggerShapeIds(/* @__PURE__ */ new Set());
|
|
1221
1216
|
return;
|
|
1222
1217
|
}
|
|
1223
|
-
const controller =
|
|
1218
|
+
const controller = chunkHMZA25W2_js.PresentationAnimationController.fromSlide(slide);
|
|
1224
1219
|
controllerRef.current = controller;
|
|
1225
1220
|
setPresentationKeyframesCss(controller.keyframesCss);
|
|
1226
1221
|
setInteractiveTriggerShapeIds(controller.interactiveTriggerShapeIds);
|
|
@@ -1378,12 +1373,12 @@ function useAnimationPlayback(input) {
|
|
|
1378
1373
|
presentationTimersRef
|
|
1379
1374
|
};
|
|
1380
1375
|
}
|
|
1381
|
-
var PRESENTER_CHANNEL_NAME =
|
|
1382
|
-
var AUDIENCE_HASH =
|
|
1383
|
-
var PRESENTER_MSG_ORIGIN =
|
|
1384
|
-
var AUDIENCE_NONCE_KEY =
|
|
1376
|
+
var PRESENTER_CHANNEL_NAME = chunkHMZA25W2_js.PRESENTATION_CHANNEL_NAME;
|
|
1377
|
+
var AUDIENCE_HASH = chunkHMZA25W2_js.PRESENTATION_HASH;
|
|
1378
|
+
var PRESENTER_MSG_ORIGIN = chunkHMZA25W2_js.PRESENTATION_MESSAGE_ORIGIN;
|
|
1379
|
+
var AUDIENCE_NONCE_KEY = chunkHMZA25W2_js.PRESENTATION_NONCE_KEY;
|
|
1385
1380
|
function generateSessionId() {
|
|
1386
|
-
return
|
|
1381
|
+
return chunkHMZA25W2_js.createPresentationSessionId();
|
|
1387
1382
|
}
|
|
1388
1383
|
function parseAudienceNonce() {
|
|
1389
1384
|
const hash = window.location.hash;
|
|
@@ -1419,7 +1414,7 @@ function usePresenterWindow(input) {
|
|
|
1419
1414
|
}, []);
|
|
1420
1415
|
const swapDisplays = react.useCallback(async () => {
|
|
1421
1416
|
const audience = audienceWindowRef.current;
|
|
1422
|
-
return audience && !audience.closed ?
|
|
1417
|
+
return audience && !audience.closed ? chunkHMZA25W2_js.swapPresentationWindows(window, audience) : false;
|
|
1423
1418
|
}, []);
|
|
1424
1419
|
const syncSlideToAudience = react.useCallback(
|
|
1425
1420
|
(slideIndex) => {
|
|
@@ -1483,7 +1478,7 @@ function usePresenterWindow(input) {
|
|
|
1483
1478
|
pollTimerRef.current = null;
|
|
1484
1479
|
}
|
|
1485
1480
|
if (closingSessionId) {
|
|
1486
|
-
void
|
|
1481
|
+
void chunkHMZA25W2_js.clearAudienceContent(closingSessionId);
|
|
1487
1482
|
}
|
|
1488
1483
|
}, [getChannel]);
|
|
1489
1484
|
const openAudienceWindow = react.useCallback(() => {
|
|
@@ -1501,10 +1496,10 @@ function usePresenterWindow(input) {
|
|
|
1501
1496
|
audienceWindowRef.current = blankWin;
|
|
1502
1497
|
const sessionId = generateSessionId();
|
|
1503
1498
|
sessionIdRef.current = sessionId;
|
|
1504
|
-
const audienceUrl =
|
|
1505
|
-
void
|
|
1499
|
+
const audienceUrl = chunkHMZA25W2_js.buildPresentationAudienceUrl(window.location.href, sessionId);
|
|
1500
|
+
void chunkHMZA25W2_js.resolveAudienceScreenPlacement(window).then((placement) => {
|
|
1506
1501
|
if (placement && audienceWindowRef.current === blankWin && !blankWin.closed) {
|
|
1507
|
-
|
|
1502
|
+
chunkHMZA25W2_js.placeAudienceWindow(blankWin, placement);
|
|
1508
1503
|
}
|
|
1509
1504
|
return void 0;
|
|
1510
1505
|
});
|
|
@@ -1534,7 +1529,7 @@ function usePresenterWindow(input) {
|
|
|
1534
1529
|
}
|
|
1535
1530
|
};
|
|
1536
1531
|
if (content) {
|
|
1537
|
-
void
|
|
1532
|
+
void chunkHMZA25W2_js.storeAudienceContent(content, sessionId).then(() => navigateOrClose(true)).catch(() => navigateOrClose(false));
|
|
1538
1533
|
} else {
|
|
1539
1534
|
navigateOrClose(true);
|
|
1540
1535
|
}
|
|
@@ -1560,7 +1555,7 @@ function usePresenterWindow(input) {
|
|
|
1560
1555
|
}
|
|
1561
1556
|
const handleMessage = (event) => {
|
|
1562
1557
|
const message = event.data;
|
|
1563
|
-
if (
|
|
1558
|
+
if (chunkHMZA25W2_js.isPresentationSessionMessage(message) && message.type === "audience-ready" && message.sessionId === sessionIdRef.current) {
|
|
1564
1559
|
syncStateToAudience(snapshotRef.current);
|
|
1565
1560
|
}
|
|
1566
1561
|
};
|
|
@@ -1589,7 +1584,7 @@ function usePresenterWindow(input) {
|
|
|
1589
1584
|
react.useEffect(() => {
|
|
1590
1585
|
const handleBeforeUnload = () => {
|
|
1591
1586
|
if (sessionIdRef.current) {
|
|
1592
|
-
void
|
|
1587
|
+
void chunkHMZA25W2_js.clearAudienceContent(sessionIdRef.current);
|
|
1593
1588
|
}
|
|
1594
1589
|
};
|
|
1595
1590
|
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
@@ -1651,7 +1646,7 @@ function useAudienceMode(input) {
|
|
|
1651
1646
|
}
|
|
1652
1647
|
channel.onmessage = (event) => {
|
|
1653
1648
|
const data = event.data;
|
|
1654
|
-
if (!
|
|
1649
|
+
if (!chunkHMZA25W2_js.isPresentationSessionMessage(data) || data.origin !== PRESENTER_MSG_ORIGIN) {
|
|
1655
1650
|
return;
|
|
1656
1651
|
}
|
|
1657
1652
|
if (expectedSessionId && data.sessionId !== expectedSessionId) {
|
|
@@ -1667,16 +1662,16 @@ function useAudienceMode(input) {
|
|
|
1667
1662
|
}
|
|
1668
1663
|
if (data.type === "presenter-exit") {
|
|
1669
1664
|
if (expectedSessionId) {
|
|
1670
|
-
void
|
|
1665
|
+
void chunkHMZA25W2_js.clearAudienceContent(expectedSessionId);
|
|
1671
1666
|
}
|
|
1672
|
-
if (
|
|
1667
|
+
if (chunkHMZA25W2_js.endAudienceDisplay(window)) {
|
|
1673
1668
|
handlers.onPresenterEnded?.();
|
|
1674
1669
|
}
|
|
1675
1670
|
}
|
|
1676
1671
|
};
|
|
1677
1672
|
if (expectedSessionId) {
|
|
1678
1673
|
channel.postMessage({
|
|
1679
|
-
origin:
|
|
1674
|
+
origin: chunkHMZA25W2_js.PRESENTATION_MESSAGE_ORIGIN,
|
|
1680
1675
|
type: "audience-ready",
|
|
1681
1676
|
sessionId: expectedSessionId
|
|
1682
1677
|
});
|
|
@@ -1690,7 +1685,7 @@ function useAudienceMode(input) {
|
|
|
1690
1685
|
}, []);
|
|
1691
1686
|
}
|
|
1692
1687
|
function usePresentationKeyboard(input) {
|
|
1693
|
-
const wheelBufferRef = react.useRef(
|
|
1688
|
+
const wheelBufferRef = react.useRef(chunkHMZA25W2_js.createWheelStepBuffer());
|
|
1694
1689
|
const {
|
|
1695
1690
|
mode,
|
|
1696
1691
|
movePresentationSlide,
|
|
@@ -1711,14 +1706,14 @@ function usePresentationKeyboard(input) {
|
|
|
1711
1706
|
presentationSlideIndex,
|
|
1712
1707
|
setShowRehearsalSummary
|
|
1713
1708
|
} = input;
|
|
1714
|
-
const keyBufferRef = react.useRef(
|
|
1709
|
+
const keyBufferRef = react.useRef(chunkHMZA25W2_js.createPresentationKeyBuffer());
|
|
1715
1710
|
react.useEffect(() => {
|
|
1716
|
-
if (mode !== "present" || !
|
|
1717
|
-
keyBufferRef.current =
|
|
1711
|
+
if (mode !== "present" || !chunkHMZA25W2_js.acceptsPresentationInput()) {
|
|
1712
|
+
keyBufferRef.current = chunkHMZA25W2_js.createPresentationKeyBuffer();
|
|
1718
1713
|
return;
|
|
1719
1714
|
}
|
|
1720
1715
|
const handleKeyDown = (event) => {
|
|
1721
|
-
const mapped =
|
|
1716
|
+
const mapped = chunkHMZA25W2_js.mapPresentationKey(event, keyBufferRef.current);
|
|
1722
1717
|
if (mapped.action === "none") {
|
|
1723
1718
|
return;
|
|
1724
1719
|
}
|
|
@@ -1738,12 +1733,12 @@ function usePresentationKeyboard(input) {
|
|
|
1738
1733
|
movePresentationSlide(-1);
|
|
1739
1734
|
return;
|
|
1740
1735
|
case "first": {
|
|
1741
|
-
const first =
|
|
1736
|
+
const first = chunkHMZA25W2_js.firstShowSlideIndex(showSlideIndexes);
|
|
1742
1737
|
navigateToSlide(first ?? 0);
|
|
1743
1738
|
return;
|
|
1744
1739
|
}
|
|
1745
1740
|
case "last": {
|
|
1746
|
-
const last =
|
|
1741
|
+
const last = chunkHMZA25W2_js.lastShowSlideIndex(showSlideIndexes);
|
|
1747
1742
|
navigateToSlide(last ?? Math.max(0, slideCount - 1));
|
|
1748
1743
|
return;
|
|
1749
1744
|
}
|
|
@@ -1781,10 +1776,10 @@ function usePresentationKeyboard(input) {
|
|
|
1781
1776
|
}
|
|
1782
1777
|
};
|
|
1783
1778
|
const handleWheel = (event) => {
|
|
1784
|
-
if (mode !== "present" || !
|
|
1779
|
+
if (mode !== "present" || !chunkHMZA25W2_js.acceptsPresentationInput()) {
|
|
1785
1780
|
return;
|
|
1786
1781
|
}
|
|
1787
|
-
const mapped =
|
|
1782
|
+
const mapped = chunkHMZA25W2_js.mapPresentationWheel(event, wheelBufferRef.current);
|
|
1788
1783
|
if (mapped.intent === "next-slide") {
|
|
1789
1784
|
event.preventDefault();
|
|
1790
1785
|
movePresentationSlide(1);
|
|
@@ -1917,7 +1912,7 @@ function useRehearsalTimings(input) {
|
|
|
1917
1912
|
|
|
1918
1913
|
// src/viewer/hooks/presentation-mode/presentation-actions.ts
|
|
1919
1914
|
function handlePresentationActionImpl(action, deps) {
|
|
1920
|
-
|
|
1915
|
+
chunkHMZA25W2_js.runPresentationAction(
|
|
1921
1916
|
action,
|
|
1922
1917
|
{ slideCount: deps.slidesLength },
|
|
1923
1918
|
{
|
|
@@ -1939,7 +1934,7 @@ function handlePresentationActionImpl(action, deps) {
|
|
|
1939
1934
|
function executeSlideTransition(nextSlideIndex, deps) {
|
|
1940
1935
|
const incomingSlide = deps.slides[nextSlideIndex];
|
|
1941
1936
|
const transition = incomingSlide?.transition;
|
|
1942
|
-
const durationMs = deps.playTransition ?
|
|
1937
|
+
const durationMs = deps.playTransition ? chunkHMZA25W2_js.resolveTransitionDurationMs(transition) : 0;
|
|
1943
1938
|
deps.clearPresentationTimers();
|
|
1944
1939
|
deps.setPresentationSlideIndex(nextSlideIndex);
|
|
1945
1940
|
deps.onSetActiveSlideIndex(nextSlideIndex);
|
|
@@ -1998,7 +1993,7 @@ function useSlideNavigation(input) {
|
|
|
1998
1993
|
});
|
|
1999
1994
|
const scheduleAutoAdvanceForSlide = react.useCallback(
|
|
2000
1995
|
(slideIndex) => {
|
|
2001
|
-
const delayMs =
|
|
1996
|
+
const delayMs = chunkHMZA25W2_js.resolveAutoAdvanceDelayMs(slides[slideIndex], { useTimings });
|
|
2002
1997
|
if (delayMs === void 0) {
|
|
2003
1998
|
return;
|
|
2004
1999
|
}
|
|
@@ -2021,7 +2016,7 @@ function useSlideNavigation(input) {
|
|
|
2021
2016
|
if (availableSlideIndexes.length === 0) {
|
|
2022
2017
|
return;
|
|
2023
2018
|
}
|
|
2024
|
-
const pastLastSlide = direction === 1 && !
|
|
2019
|
+
const pastLastSlide = direction === 1 && !chunkHMZA25W2_js.hasShowSlideAfter(presentationSlideIndex, availableSlideIndexes);
|
|
2025
2020
|
if (rehearsing && pastLastSlide) {
|
|
2026
2021
|
recordCurrentSlideTime(presentationSlideIndex);
|
|
2027
2022
|
try {
|
|
@@ -2039,9 +2034,9 @@ function useSlideNavigation(input) {
|
|
|
2039
2034
|
onAdvancePastLastSlide();
|
|
2040
2035
|
return;
|
|
2041
2036
|
}
|
|
2042
|
-
const nextSlideIndex = direction === 1 ?
|
|
2037
|
+
const nextSlideIndex = direction === 1 ? chunkHMZA25W2_js.nextShowSlideIndex(presentationSlideIndex, availableSlideIndexes, {
|
|
2043
2038
|
loop: Boolean(loopContinuously) && !rehearsing
|
|
2044
|
-
}) :
|
|
2039
|
+
}) : chunkHMZA25W2_js.previousShowSlideIndex(presentationSlideIndex, availableSlideIndexes);
|
|
2045
2040
|
if (nextSlideIndex === void 0 || nextSlideIndex === presentationSlideIndex) {
|
|
2046
2041
|
return;
|
|
2047
2042
|
}
|
|
@@ -2186,22 +2181,22 @@ function useZoomNavigation(input) {
|
|
|
2186
2181
|
};
|
|
2187
2182
|
}
|
|
2188
2183
|
function usePresenterConsole(slideIndex, active) {
|
|
2189
|
-
const timerRef = react.useRef(
|
|
2190
|
-
const [snapshot, setSnapshot] = react.useState(() =>
|
|
2184
|
+
const timerRef = react.useRef(chunkHMZA25W2_js.createPresenterTimer());
|
|
2185
|
+
const [snapshot, setSnapshot] = react.useState(() => chunkHMZA25W2_js.createInitialPresentationSnapshot(slideIndex));
|
|
2191
2186
|
const patch = react.useCallback((value) => {
|
|
2192
|
-
setSnapshot((current) =>
|
|
2187
|
+
setSnapshot((current) => chunkHMZA25W2_js.mergePresentationSnapshot(current, value));
|
|
2193
2188
|
}, []);
|
|
2194
2189
|
react.useEffect(() => patch({ slideIndex }), [patch, slideIndex]);
|
|
2195
2190
|
react.useEffect(() => {
|
|
2196
2191
|
if (!active) {
|
|
2197
2192
|
return;
|
|
2198
2193
|
}
|
|
2199
|
-
timerRef.current =
|
|
2194
|
+
timerRef.current = chunkHMZA25W2_js.resetPresenterTimer();
|
|
2200
2195
|
patch({ paused: false, elapsedMs: 0 });
|
|
2201
2196
|
const timer = window.setInterval(() => {
|
|
2202
2197
|
patch({
|
|
2203
2198
|
paused: timerRef.current.paused,
|
|
2204
|
-
elapsedMs:
|
|
2199
|
+
elapsedMs: chunkHMZA25W2_js.presenterElapsed(timerRef.current)
|
|
2205
2200
|
});
|
|
2206
2201
|
}, 1e3);
|
|
2207
2202
|
return () => window.clearInterval(timer);
|
|
@@ -2211,19 +2206,19 @@ function usePresenterConsole(slideIndex, active) {
|
|
|
2211
2206
|
applyAudienceSnapshot: setSnapshot,
|
|
2212
2207
|
setBlackout: (blackout) => patch({ blackout }),
|
|
2213
2208
|
toggleTimer: () => {
|
|
2214
|
-
timerRef.current =
|
|
2209
|
+
timerRef.current = chunkHMZA25W2_js.togglePresenterTimer(timerRef.current);
|
|
2215
2210
|
patch({
|
|
2216
2211
|
paused: timerRef.current.paused,
|
|
2217
|
-
elapsedMs:
|
|
2212
|
+
elapsedMs: chunkHMZA25W2_js.presenterElapsed(timerRef.current)
|
|
2218
2213
|
});
|
|
2219
2214
|
},
|
|
2220
2215
|
resetTimer: () => {
|
|
2221
|
-
timerRef.current =
|
|
2216
|
+
timerRef.current = chunkHMZA25W2_js.resetPresenterTimer();
|
|
2222
2217
|
patch({ paused: false, elapsedMs: 0 });
|
|
2223
2218
|
},
|
|
2224
2219
|
stepZoom: (direction) => setSnapshot(
|
|
2225
|
-
(current) =>
|
|
2226
|
-
zoom:
|
|
2220
|
+
(current) => chunkHMZA25W2_js.mergePresentationSnapshot(current, {
|
|
2221
|
+
zoom: chunkHMZA25W2_js.stepPresenterZoom(
|
|
2227
2222
|
current.zoom ?? { scale: 1, originX: 0.5, originY: 0.5 },
|
|
2228
2223
|
direction
|
|
2229
2224
|
)
|
|
@@ -2269,7 +2264,7 @@ function usePresentationMode(input) {
|
|
|
2269
2264
|
const [allSlidesOpen, setAllSlidesOpen] = react.useState(false);
|
|
2270
2265
|
const [endOfShowVisible, setEndOfShowVisible] = react.useState(false);
|
|
2271
2266
|
const [presentationStartTime, setPresentationStartTime] = react.useState(null);
|
|
2272
|
-
const showGuard = react.useMemo(() =>
|
|
2267
|
+
const showGuard = react.useMemo(() => chunkHMZA25W2_js.createPresenterShowGuard(), []);
|
|
2273
2268
|
const {
|
|
2274
2269
|
presentationAnimations,
|
|
2275
2270
|
presentationElementStates,
|
|
@@ -2348,7 +2343,7 @@ function usePresentationMode(input) {
|
|
|
2348
2343
|
});
|
|
2349
2344
|
const movePresentationSlide = react.useCallback(
|
|
2350
2345
|
(direction, trigger = "explicit") => {
|
|
2351
|
-
if (!
|
|
2346
|
+
if (!chunkHMZA25W2_js.acceptsPresentationInput()) {
|
|
2352
2347
|
return;
|
|
2353
2348
|
}
|
|
2354
2349
|
if (endOfShowVisible) {
|
|
@@ -2486,7 +2481,7 @@ function usePresentationMode(input) {
|
|
|
2486
2481
|
if (mode !== "present") {
|
|
2487
2482
|
return;
|
|
2488
2483
|
}
|
|
2489
|
-
return
|
|
2484
|
+
return chunkHMZA25W2_js.attachPresentationVisibilityPause({
|
|
2490
2485
|
root: containerRef.current ?? void 0,
|
|
2491
2486
|
onHidden: () => clearPresentationTimersRef.current(),
|
|
2492
2487
|
onVisible: () => scheduleAutoAdvanceRef.current(presentationSlideIndexRef.current)
|
|
@@ -2566,11 +2561,11 @@ function usePresentationMode(input) {
|
|
|
2566
2561
|
if (!transitionOverlay || transitionOverlay.transition.type !== "morph") {
|
|
2567
2562
|
return void 0;
|
|
2568
2563
|
}
|
|
2569
|
-
return
|
|
2564
|
+
return chunkHMZA25W2_js.buildMorphTransitionPlan(
|
|
2570
2565
|
slides[transitionOverlay.outgoingSlideIndex],
|
|
2571
2566
|
slides[transitionOverlay.incomingSlideIndex],
|
|
2572
2567
|
transitionOverlay.durationMs,
|
|
2573
|
-
|
|
2568
|
+
chunkHMZA25W2_js.morphOptionToMode(transitionOverlay.transition.morphOption)
|
|
2574
2569
|
);
|
|
2575
2570
|
}, [transitionOverlay, slides]);
|
|
2576
2571
|
const morphedElementStates = react.useMemo(() => {
|
|
@@ -2591,7 +2586,7 @@ function usePresentationMode(input) {
|
|
|
2591
2586
|
if (!morphPlan) {
|
|
2592
2587
|
return presentationKeyframesCss;
|
|
2593
2588
|
}
|
|
2594
|
-
const imageRules =
|
|
2589
|
+
const imageRules = chunkHMZA25W2_js.buildMorphAnimationRules(morphPlan, "", "incoming", "image");
|
|
2595
2590
|
return `${presentationKeyframesCss ?? ""}
|
|
2596
2591
|
${morphPlan.keyframesCss}
|
|
2597
2592
|
${imageRules}`;
|
|
@@ -2887,7 +2882,7 @@ function useFindReplace({
|
|
|
2887
2882
|
const [findResults, setFindResults] = react.useState([]);
|
|
2888
2883
|
const [findResultIndex, setFindResultIndex] = react.useState(-1);
|
|
2889
2884
|
const performFind = react.useCallback(() => {
|
|
2890
|
-
const results =
|
|
2885
|
+
const results = chunkHMZA25W2_js.findInSlides(slides, findQuery, { matchCase: findMatchCase });
|
|
2891
2886
|
if (!findQuery) {
|
|
2892
2887
|
setFindResults([]);
|
|
2893
2888
|
setFindResultIndex(-1);
|
|
@@ -2921,7 +2916,7 @@ function useFindReplace({
|
|
|
2921
2916
|
return;
|
|
2922
2917
|
}
|
|
2923
2918
|
onUpdateSlides(
|
|
2924
|
-
(prevSlides) =>
|
|
2919
|
+
(prevSlides) => chunkHMZA25W2_js.applyFindReplacements(prevSlides, toReplace, replaceQuery).slides
|
|
2925
2920
|
);
|
|
2926
2921
|
onMarkDirty();
|
|
2927
2922
|
},
|
|
@@ -2943,9 +2938,9 @@ function useFindReplace({
|
|
|
2943
2938
|
}, [findResults, applyReplacements, performFind]);
|
|
2944
2939
|
react.useEffect(() => {
|
|
2945
2940
|
const handler = (event) => {
|
|
2946
|
-
const { action } =
|
|
2941
|
+
const { action } = chunkHMZA25W2_js.mapEditorKey(event, {
|
|
2947
2942
|
canEdit: mode === "edit",
|
|
2948
|
-
isTextInputTarget:
|
|
2943
|
+
isTextInputTarget: chunkHMZA25W2_js.isEditorTextInputTarget(event.target)
|
|
2949
2944
|
});
|
|
2950
2945
|
if (action !== "find") {
|
|
2951
2946
|
return;
|
|
@@ -3024,7 +3019,7 @@ function addCommentToSlide(slides, slideIndex, text, authorName, elementId) {
|
|
|
3024
3019
|
if (!slide) {
|
|
3025
3020
|
return { slides, didAdd: false };
|
|
3026
3021
|
}
|
|
3027
|
-
const next =
|
|
3022
|
+
const next = chunkHMZA25W2_js.addCommentToList(
|
|
3028
3023
|
slide.comments || [],
|
|
3029
3024
|
text,
|
|
3030
3025
|
authorName,
|
|
@@ -3042,7 +3037,7 @@ function removeCommentFromSlide(slides, slideIndex, commentId) {
|
|
|
3042
3037
|
if (!slide) {
|
|
3043
3038
|
return { slides, didDelete: false };
|
|
3044
3039
|
}
|
|
3045
|
-
const next =
|
|
3040
|
+
const next = chunkHMZA25W2_js.removeCommentFromList(slide.comments || [], commentId);
|
|
3046
3041
|
if (!next) {
|
|
3047
3042
|
return { slides, didDelete: false };
|
|
3048
3043
|
}
|
|
@@ -3053,7 +3048,7 @@ function editCommentInSlide(slides, slideIndex, commentId, newText) {
|
|
|
3053
3048
|
if (!slide) {
|
|
3054
3049
|
return { slides, didUpdate: false };
|
|
3055
3050
|
}
|
|
3056
|
-
const next =
|
|
3051
|
+
const next = chunkHMZA25W2_js.editCommentInList(slide.comments || [], commentId, newText);
|
|
3057
3052
|
if (!next) {
|
|
3058
3053
|
return { slides, didUpdate: false };
|
|
3059
3054
|
}
|
|
@@ -3064,7 +3059,7 @@ function toggleResolvedInSlide(slides, slideIndex, commentId) {
|
|
|
3064
3059
|
if (!slide) {
|
|
3065
3060
|
return { slides, didUpdate: false };
|
|
3066
3061
|
}
|
|
3067
|
-
const next =
|
|
3062
|
+
const next = chunkHMZA25W2_js.toggleCommentResolvedInList(slide.comments || [], commentId);
|
|
3068
3063
|
if (!next) {
|
|
3069
3064
|
return { slides, didUpdate: false };
|
|
3070
3065
|
}
|
|
@@ -3075,7 +3070,7 @@ function addReplyToSlide(slides, slideIndex, parentId, text, authorName) {
|
|
|
3075
3070
|
if (!slide) {
|
|
3076
3071
|
return { slides, didAdd: false };
|
|
3077
3072
|
}
|
|
3078
|
-
const next =
|
|
3073
|
+
const next = chunkHMZA25W2_js.replyToCommentInList(slide.comments || [], parentId, text, authorName);
|
|
3079
3074
|
if (!next) {
|
|
3080
3075
|
return { slides, didAdd: false };
|
|
3081
3076
|
}
|
|
@@ -3449,7 +3444,7 @@ function useViewerCoreState(_input) {
|
|
|
3449
3444
|
const marqueeStateRef = react.useRef(null);
|
|
3450
3445
|
const isDrawingRef = react.useRef(false);
|
|
3451
3446
|
const justInteractedRef = react.useRef(false);
|
|
3452
|
-
const livePatcher = react.useMemo(() =>
|
|
3447
|
+
const livePatcher = react.useMemo(() => chunkHMZA25W2_js.createCollaborationLivePatcher(), []);
|
|
3453
3448
|
react.useEffect(() => () => livePatcher.dispose(), [livePatcher]);
|
|
3454
3449
|
const slidesRef = react.useRef([]);
|
|
3455
3450
|
const [mode, setMode] = react.useState("edit");
|
|
@@ -3458,8 +3453,8 @@ function useViewerCoreState(_input) {
|
|
|
3458
3453
|
const [slides, setSlides] = react.useState([]);
|
|
3459
3454
|
const [templateElementsBySlideId, setTemplateElementsBySlideId] = react.useState({});
|
|
3460
3455
|
const [canvasSize, setCanvasSize] = react.useState({
|
|
3461
|
-
width:
|
|
3462
|
-
height:
|
|
3456
|
+
width: chunkOABOL32L_js.DEFAULT_CANVAS_WIDTH,
|
|
3457
|
+
height: chunkOABOL32L_js.DEFAULT_CANVAS_HEIGHT
|
|
3463
3458
|
});
|
|
3464
3459
|
const [slideSizeEmu, setSlideSizeEmu] = react.useState();
|
|
3465
3460
|
const [activeSlideIndex, setActiveSlideIndex] = react.useState(0);
|
|
@@ -3480,7 +3475,7 @@ function useViewerCoreState(_input) {
|
|
|
3480
3475
|
const resolved = typeof value === "function" ? value(inlineEditingTextRef.current) : value;
|
|
3481
3476
|
inlineEditingTextRef.current = resolved;
|
|
3482
3477
|
setInlineEditingTextBase(value);
|
|
3483
|
-
|
|
3478
|
+
chunkHMZA25W2_js.publishLiveInlineText(
|
|
3484
3479
|
livePatcher,
|
|
3485
3480
|
slidesRef.current[activeSlideIndexRef.current],
|
|
3486
3481
|
inlineEditingElementIdRef.current,
|
|
@@ -3798,7 +3793,8 @@ function useLoadContent({
|
|
|
3798
3793
|
setError,
|
|
3799
3794
|
setIsDirty,
|
|
3800
3795
|
setIsEncrypted,
|
|
3801
|
-
onContentApplied
|
|
3796
|
+
onContentApplied,
|
|
3797
|
+
allowExternalImages
|
|
3802
3798
|
}) {
|
|
3803
3799
|
const handlerRef = react.useRef(null);
|
|
3804
3800
|
const originalBufferRef = react.useRef(null);
|
|
@@ -3823,8 +3819,8 @@ function useLoadContent({
|
|
|
3823
3819
|
);
|
|
3824
3820
|
}
|
|
3825
3821
|
const previousHandler = handlerRef.current;
|
|
3826
|
-
const handler = new
|
|
3827
|
-
const parsed = await handler.load(buffer);
|
|
3822
|
+
const handler = new chunkHMZA25W2_js.PptxHandler();
|
|
3823
|
+
const parsed = await handler.load(buffer, { allowExternalImages });
|
|
3828
3824
|
if (cancelled || token !== renderTokenRef.current) {
|
|
3829
3825
|
handler.dispose();
|
|
3830
3826
|
return;
|
|
@@ -3835,7 +3831,7 @@ function useLoadContent({
|
|
|
3835
3831
|
handlerRef.current = null;
|
|
3836
3832
|
const mediaElements = [];
|
|
3837
3833
|
for (const slide of parsed.slides) {
|
|
3838
|
-
|
|
3834
|
+
chunkHMZA25W2_js.collectMediaElements(slide.elements, mediaElements);
|
|
3839
3835
|
}
|
|
3840
3836
|
for (const url of mediaDataUrls.values()) {
|
|
3841
3837
|
if (url.startsWith("blob:")) {
|
|
@@ -3876,7 +3872,7 @@ function useLoadContent({
|
|
|
3876
3872
|
}
|
|
3877
3873
|
})
|
|
3878
3874
|
);
|
|
3879
|
-
const { paths: imagePaths, refs: imageRefs } =
|
|
3875
|
+
const { paths: imagePaths, refs: imageRefs } = chunkHMZA25W2_js.collectImagePaths(parsed.slides);
|
|
3880
3876
|
let nextSlides = parsed.slides;
|
|
3881
3877
|
if (imagePaths.size > 0) {
|
|
3882
3878
|
const resolvedMap = /* @__PURE__ */ new Map();
|
|
@@ -3930,7 +3926,7 @@ function useLoadContent({
|
|
|
3930
3926
|
});
|
|
3931
3927
|
}
|
|
3932
3928
|
}
|
|
3933
|
-
const { paths: tableImagePaths, refs: tableImageRefs } =
|
|
3929
|
+
const { paths: tableImagePaths, refs: tableImageRefs } = chunkHMZA25W2_js.collectTableCellImagePaths(nextSlides);
|
|
3934
3930
|
if (tableImagePaths.size > 0) {
|
|
3935
3931
|
const resolvedTableMap = /* @__PURE__ */ new Map();
|
|
3936
3932
|
await Promise.all(
|
|
@@ -3946,7 +3942,7 @@ function useLoadContent({
|
|
|
3946
3942
|
);
|
|
3947
3943
|
if (resolvedTableMap.size > 0) {
|
|
3948
3944
|
nextSlides = nextSlides.map((s) => {
|
|
3949
|
-
const newElements =
|
|
3945
|
+
const newElements = chunkHMZA25W2_js.applyTableCellImagePatches(
|
|
3950
3946
|
s.elements,
|
|
3951
3947
|
resolvedTableMap,
|
|
3952
3948
|
tableImageRefs
|
|
@@ -3956,7 +3952,7 @@ function useLoadContent({
|
|
|
3956
3952
|
}
|
|
3957
3953
|
}
|
|
3958
3954
|
let nextTableStyleMap = parsed.tableStyleMap;
|
|
3959
|
-
const { paths: tableStyleImagePaths, refs: tableStyleImageRefs } =
|
|
3955
|
+
const { paths: tableStyleImagePaths, refs: tableStyleImageRefs } = chunkHMZA25W2_js.collectTableStyleImagePaths(nextTableStyleMap);
|
|
3960
3956
|
if (tableStyleImagePaths.size > 0) {
|
|
3961
3957
|
const resolvedStyleMap = /* @__PURE__ */ new Map();
|
|
3962
3958
|
await Promise.all(
|
|
@@ -3971,7 +3967,7 @@ function useLoadContent({
|
|
|
3971
3967
|
})
|
|
3972
3968
|
);
|
|
3973
3969
|
if (resolvedStyleMap.size > 0 && nextTableStyleMap) {
|
|
3974
|
-
nextTableStyleMap =
|
|
3970
|
+
nextTableStyleMap = chunkHMZA25W2_js.applyTableStyleImagePatches(
|
|
3975
3971
|
nextTableStyleMap,
|
|
3976
3972
|
resolvedStyleMap,
|
|
3977
3973
|
tableStyleImageRefs
|
|
@@ -3979,12 +3975,12 @@ function useLoadContent({
|
|
|
3979
3975
|
}
|
|
3980
3976
|
}
|
|
3981
3977
|
handlerRef.current = handler;
|
|
3982
|
-
const partition =
|
|
3978
|
+
const partition = chunkHMZA25W2_js.partitionTemplateElements(nextSlides);
|
|
3983
3979
|
setSlides(partition.slides);
|
|
3984
3980
|
setTemplateElementsBySlideId(partition.templateElementsBySlideId);
|
|
3985
3981
|
setCanvasSize({
|
|
3986
|
-
width: parsed.width ??
|
|
3987
|
-
height: parsed.height ??
|
|
3982
|
+
width: parsed.width ?? chunkOABOL32L_js.DEFAULT_CANVAS_WIDTH,
|
|
3983
|
+
height: parsed.height ?? chunkOABOL32L_js.DEFAULT_CANVAS_HEIGHT
|
|
3988
3984
|
});
|
|
3989
3985
|
setSlideSizeEmu(
|
|
3990
3986
|
typeof parsed.widthEmu === "number" && typeof parsed.heightEmu === "number" && parsed.widthEmu > 0 && parsed.heightEmu > 0 ? {
|
|
@@ -4001,7 +3997,7 @@ function useLoadContent({
|
|
|
4001
3997
|
setThemeOptions(parsed.themeOptions ?? []);
|
|
4002
3998
|
setCustomShows(parsed.customShows ?? []);
|
|
4003
3999
|
setActiveCustomShowId(
|
|
4004
|
-
|
|
4000
|
+
chunkHMZA25W2_js.resolveAuthoredCustomShowId(parsed.presentationProperties, parsed.customShows) ?? null
|
|
4005
4001
|
);
|
|
4006
4002
|
setSections(parsed.sections ?? []);
|
|
4007
4003
|
setPresentationProperties(parsed.presentationProperties ?? {});
|
|
@@ -4024,7 +4020,7 @@ function useLoadContent({
|
|
|
4024
4020
|
setHasMacros(parsed.hasMacros === true);
|
|
4025
4021
|
setHasDigitalSignatures(parsed.hasDigitalSignatures === true);
|
|
4026
4022
|
setDigitalSignatureCount(parsed.digitalSignatureCount ?? 0);
|
|
4027
|
-
setGuides(
|
|
4023
|
+
setGuides(chunkHMZA25W2_js.buildInitialGuides(parsed.presentationGuides, parsed.slides[0]?.guides));
|
|
4028
4024
|
setActiveSlideIndex(0);
|
|
4029
4025
|
clearSelection();
|
|
4030
4026
|
setIsDirty(false);
|
|
@@ -4032,7 +4028,7 @@ function useLoadContent({
|
|
|
4032
4028
|
onContentApplied?.();
|
|
4033
4029
|
} catch (err) {
|
|
4034
4030
|
if (!cancelled && token === renderTokenRef.current) {
|
|
4035
|
-
if (err instanceof
|
|
4031
|
+
if (err instanceof chunkHMZA25W2_js.EncryptedFileError) {
|
|
4036
4032
|
setIsEncrypted(true);
|
|
4037
4033
|
} else {
|
|
4038
4034
|
console.error("[pptx] Failed to load presentation content:", err);
|
|
@@ -4060,7 +4056,7 @@ function useLoadContent({
|
|
|
4060
4056
|
}
|
|
4061
4057
|
function useAutosave(input) {
|
|
4062
4058
|
const { isDirty, filePath, serializeSlides, enabled = true, getChangeSources } = input;
|
|
4063
|
-
const intervalMs =
|
|
4059
|
+
const intervalMs = chunkHMZA25W2_js.resolveAutosaveIntervalMs({
|
|
4064
4060
|
hostIntervalMs: input.intervalMs,
|
|
4065
4061
|
optionsIntervalSeconds: input.intervalSeconds
|
|
4066
4062
|
});
|
|
@@ -4091,7 +4087,7 @@ function useAutosave(input) {
|
|
|
4091
4087
|
return;
|
|
4092
4088
|
}
|
|
4093
4089
|
const sources = changeSourcesRef.current?.() ?? [];
|
|
4094
|
-
if (!
|
|
4090
|
+
if (!chunkHMZA25W2_js.shouldWriteAutosaveSnapshot({
|
|
4095
4091
|
filePath: path,
|
|
4096
4092
|
isDirty: isDirtyRef.current,
|
|
4097
4093
|
saving: isSavingRef.current,
|
|
@@ -4109,8 +4105,8 @@ function useAutosave(input) {
|
|
|
4109
4105
|
isSavingRef.current = false;
|
|
4110
4106
|
return;
|
|
4111
4107
|
}
|
|
4112
|
-
await
|
|
4113
|
-
lastSnapshotRef.current =
|
|
4108
|
+
await chunkHMZA25W2_js.saveAutosaveSnapshot(path, data);
|
|
4109
|
+
lastSnapshotRef.current = chunkHMZA25W2_js.autosaveSnapshotMark(path, sources);
|
|
4114
4110
|
setAutosaveStatus({ state: "saved", timestamp: Date.now() });
|
|
4115
4111
|
} catch (err) {
|
|
4116
4112
|
setAutosaveStatus({
|
|
@@ -4196,11 +4192,11 @@ function useElementOperations(input) {
|
|
|
4196
4192
|
(elementId, updates) => {
|
|
4197
4193
|
if (masterView?.target) {
|
|
4198
4194
|
applyMasterViewWrite(
|
|
4199
|
-
|
|
4195
|
+
chunkHMZA25W2_js.updateMasterViewElement(masterView, masterView.target, elementId, updates)
|
|
4200
4196
|
);
|
|
4201
4197
|
return;
|
|
4202
4198
|
}
|
|
4203
|
-
if (
|
|
4199
|
+
if (chunkHMZA25W2_js.isTemplateElementId(elementId)) {
|
|
4204
4200
|
const slideId = activeSlide?.id;
|
|
4205
4201
|
if (slideId) {
|
|
4206
4202
|
setTemplateElementsBySlideId((prev) => ({
|
|
@@ -4248,7 +4244,7 @@ function useElementOperations(input) {
|
|
|
4248
4244
|
);
|
|
4249
4245
|
const updateSelectedShapeStyle = react.useCallback(
|
|
4250
4246
|
(updates) => {
|
|
4251
|
-
if (!selectedElement || !
|
|
4247
|
+
if (!selectedElement || !chunkHMZA25W2_js.hasShapeProperties(selectedElement)) {
|
|
4252
4248
|
return;
|
|
4253
4249
|
}
|
|
4254
4250
|
updateSelectedElement({
|
|
@@ -4259,17 +4255,17 @@ function useElementOperations(input) {
|
|
|
4259
4255
|
);
|
|
4260
4256
|
const updateSelectedTextStyle = react.useCallback(
|
|
4261
4257
|
(updates) => {
|
|
4262
|
-
if (!selectedElement || !
|
|
4258
|
+
if (!selectedElement || !chunkHMZA25W2_js.hasTextProperties(selectedElement)) {
|
|
4263
4259
|
return;
|
|
4264
4260
|
}
|
|
4265
|
-
const inlineSel =
|
|
4261
|
+
const inlineSel = chunkHMZA25W2_js.getInlineEditorSelection(selectedElement.textSegments);
|
|
4266
4262
|
if (inlineSel && selectedElement.textSegments) {
|
|
4267
|
-
const { newSegments: newSegments2, newSelection } =
|
|
4263
|
+
const { newSegments: newSegments2, newSelection } = chunkHMZA25W2_js.applyStyleToSelectedSegments(
|
|
4268
4264
|
selectedElement.textSegments,
|
|
4269
4265
|
inlineSel,
|
|
4270
4266
|
updates
|
|
4271
4267
|
);
|
|
4272
|
-
|
|
4268
|
+
chunkHMZA25W2_js.setPendingSelectionRestore(newSelection);
|
|
4273
4269
|
updateSelectedElement({
|
|
4274
4270
|
textSegments: newSegments2
|
|
4275
4271
|
});
|
|
@@ -4289,12 +4285,12 @@ function useElementOperations(input) {
|
|
|
4289
4285
|
);
|
|
4290
4286
|
const updateSelectedTextCase = react.useCallback(
|
|
4291
4287
|
(mode) => {
|
|
4292
|
-
if (!selectedElement || !
|
|
4288
|
+
if (!selectedElement || !chunkHMZA25W2_js.hasTextProperties(selectedElement)) {
|
|
4293
4289
|
return;
|
|
4294
4290
|
}
|
|
4295
|
-
const inlineSel =
|
|
4291
|
+
const inlineSel = chunkHMZA25W2_js.getInlineEditorSelection(selectedElement.textSegments);
|
|
4296
4292
|
if (inlineSel && selectedElement.textSegments) {
|
|
4297
|
-
const newSegments =
|
|
4293
|
+
const newSegments = chunkHMZA25W2_js.applyCaseTransformToSegments(
|
|
4298
4294
|
selectedElement.textSegments,
|
|
4299
4295
|
inlineSel,
|
|
4300
4296
|
mode
|
|
@@ -4304,14 +4300,14 @@ function useElementOperations(input) {
|
|
|
4304
4300
|
}
|
|
4305
4301
|
const updates = {};
|
|
4306
4302
|
if (selectedElement.textSegments && selectedElement.textSegments.length > 0) {
|
|
4307
|
-
updates.textSegments =
|
|
4303
|
+
updates.textSegments = chunkHMZA25W2_js.applyCaseTransformToSegments(
|
|
4308
4304
|
selectedElement.textSegments,
|
|
4309
4305
|
null,
|
|
4310
4306
|
mode
|
|
4311
4307
|
);
|
|
4312
4308
|
}
|
|
4313
4309
|
if (typeof selectedElement.text === "string") {
|
|
4314
|
-
updates.text =
|
|
4310
|
+
updates.text = chunkHMZA25W2_js.transformTextCase(selectedElement.text, mode);
|
|
4315
4311
|
}
|
|
4316
4312
|
updateSelectedElement(updates);
|
|
4317
4313
|
},
|
|
@@ -4324,15 +4320,15 @@ function useElementOperations(input) {
|
|
|
4324
4320
|
[setSlides]
|
|
4325
4321
|
);
|
|
4326
4322
|
const masterViewTarget = masterView?.target ?? null;
|
|
4327
|
-
const activeElements = masterViewTarget ?
|
|
4323
|
+
const activeElements = masterViewTarget ? chunkHMZA25W2_js.masterViewElements(masterView, masterViewTarget) : editTemplateMode ? templateElements : activeSlide?.elements ?? [];
|
|
4328
4324
|
const updateActiveElements = react.useCallback(
|
|
4329
4325
|
(updater) => {
|
|
4330
4326
|
if (masterView?.target) {
|
|
4331
4327
|
applyMasterViewWrite(
|
|
4332
|
-
|
|
4328
|
+
chunkHMZA25W2_js.replaceMasterViewElements(
|
|
4333
4329
|
masterView,
|
|
4334
4330
|
masterView.target,
|
|
4335
|
-
updater(
|
|
4331
|
+
updater(chunkHMZA25W2_js.masterViewElements(masterView, masterView.target))
|
|
4336
4332
|
)
|
|
4337
4333
|
);
|
|
4338
4334
|
return;
|
|
@@ -4385,7 +4381,7 @@ function useSectionOperations(input) {
|
|
|
4385
4381
|
const { sections, setSections, slides, setSlides, markDirty } = input;
|
|
4386
4382
|
const addSection2 = react.useCallback(
|
|
4387
4383
|
(name, afterSlideIndex) => {
|
|
4388
|
-
const result =
|
|
4384
|
+
const result = chunkHMZA25W2_js.addSection(sections, slides, name, afterSlideIndex);
|
|
4389
4385
|
setSlides(result.slides);
|
|
4390
4386
|
setSections(result.sections);
|
|
4391
4387
|
markDirty();
|
|
@@ -4394,7 +4390,7 @@ function useSectionOperations(input) {
|
|
|
4394
4390
|
);
|
|
4395
4391
|
const renameSection2 = react.useCallback(
|
|
4396
4392
|
(sectionId, newName) => {
|
|
4397
|
-
const result =
|
|
4393
|
+
const result = chunkHMZA25W2_js.renameSection(sections, slides, sectionId, newName);
|
|
4398
4394
|
setSections(result.sections);
|
|
4399
4395
|
setSlides(result.slides);
|
|
4400
4396
|
markDirty();
|
|
@@ -4403,7 +4399,7 @@ function useSectionOperations(input) {
|
|
|
4403
4399
|
);
|
|
4404
4400
|
const deleteSection2 = react.useCallback(
|
|
4405
4401
|
(sectionId) => {
|
|
4406
|
-
const result =
|
|
4402
|
+
const result = chunkHMZA25W2_js.deleteSection(sections, slides, sectionId);
|
|
4407
4403
|
setSections(result.sections);
|
|
4408
4404
|
setSlides(result.slides);
|
|
4409
4405
|
markDirty();
|
|
@@ -4412,21 +4408,21 @@ function useSectionOperations(input) {
|
|
|
4412
4408
|
);
|
|
4413
4409
|
const moveSectionUp2 = react.useCallback(
|
|
4414
4410
|
(sectionId) => {
|
|
4415
|
-
setSections(
|
|
4411
|
+
setSections(chunkHMZA25W2_js.moveSectionUp(sections, sectionId));
|
|
4416
4412
|
markDirty();
|
|
4417
4413
|
},
|
|
4418
4414
|
[sections, setSections, markDirty]
|
|
4419
4415
|
);
|
|
4420
4416
|
const moveSectionDown2 = react.useCallback(
|
|
4421
4417
|
(sectionId) => {
|
|
4422
|
-
setSections(
|
|
4418
|
+
setSections(chunkHMZA25W2_js.moveSectionDown(sections, sectionId));
|
|
4423
4419
|
markDirty();
|
|
4424
4420
|
},
|
|
4425
4421
|
[sections, setSections, markDirty]
|
|
4426
4422
|
);
|
|
4427
4423
|
const moveSlidesToSection2 = react.useCallback(
|
|
4428
4424
|
(slideIndexes, targetSectionId) => {
|
|
4429
|
-
const result =
|
|
4425
|
+
const result = chunkHMZA25W2_js.moveSlidesToSection(sections, slides, slideIndexes, targetSectionId);
|
|
4430
4426
|
setSlides(result.slides);
|
|
4431
4427
|
setSections(result.sections);
|
|
4432
4428
|
markDirty();
|
|
@@ -4455,19 +4451,19 @@ function useSectionOperations(input) {
|
|
|
4455
4451
|
|
|
4456
4452
|
// src/viewer/hooks/pointer-move-handlers.ts
|
|
4457
4453
|
function computeResizeGeometry(handle, startX, startY, startWidth, startHeight, dx, dy, snapToGrid, gridSpacingPx) {
|
|
4458
|
-
const resized =
|
|
4454
|
+
const resized = chunkHMZA25W2_js.applyResize(
|
|
4459
4455
|
{ x: startX, y: startY, width: startWidth, height: startHeight },
|
|
4460
4456
|
handle,
|
|
4461
4457
|
dx,
|
|
4462
4458
|
dy,
|
|
4463
4459
|
1,
|
|
4464
|
-
{ minSize:
|
|
4460
|
+
{ minSize: chunkOABOL32L_js.MIN_ELEMENT_SIZE }
|
|
4465
4461
|
);
|
|
4466
4462
|
const box = { x: resized.x, y: resized.y, width: resized.width, height: resized.height };
|
|
4467
4463
|
if (!snapToGrid) {
|
|
4468
4464
|
return box;
|
|
4469
4465
|
}
|
|
4470
|
-
return
|
|
4466
|
+
return chunkHMZA25W2_js.snapBoxToGrid(box, handle, gridSpacingPx, chunkOABOL32L_js.MIN_ELEMENT_SIZE);
|
|
4471
4467
|
}
|
|
4472
4468
|
function resolveLiveTarget(input) {
|
|
4473
4469
|
const { livePatcher, editTemplateMode, activeSlide } = input;
|
|
@@ -4580,7 +4576,7 @@ function processDragMove(e, drag, editorScale, snapToGrid, snapToShape, gridSpac
|
|
|
4580
4576
|
width: el.width,
|
|
4581
4577
|
height: el.height
|
|
4582
4578
|
}));
|
|
4583
|
-
const snapResult =
|
|
4579
|
+
const snapResult = chunkHMZA25W2_js.computeSnapToShape(
|
|
4584
4580
|
targetX,
|
|
4585
4581
|
targetY,
|
|
4586
4582
|
primaryEl.width,
|
|
@@ -4619,7 +4615,7 @@ function processDragMove(e, drag, editorScale, snapToGrid, snapToShape, gridSpac
|
|
|
4619
4615
|
if (live) {
|
|
4620
4616
|
for (const id of Object.keys(drag.startPositionsById)) {
|
|
4621
4617
|
const start = drag.startPositionsById[id];
|
|
4622
|
-
|
|
4618
|
+
chunkHMZA25W2_js.publishLiveGeometry(live.patcher, live.slideId, id, {
|
|
4623
4619
|
x: start.x + appliedDx,
|
|
4624
4620
|
y: start.y + appliedDy
|
|
4625
4621
|
});
|
|
@@ -4653,22 +4649,22 @@ function processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx, live)
|
|
|
4653
4649
|
if (rs.domEl) {
|
|
4654
4650
|
rs.domEl.style.left = `${geo.x}px`;
|
|
4655
4651
|
rs.domEl.style.top = `${geo.y}px`;
|
|
4656
|
-
rs.domEl.style.width = `${Math.max(geo.width,
|
|
4657
|
-
rs.domEl.style.height = `${Math.max(geo.height,
|
|
4652
|
+
rs.domEl.style.width = `${Math.max(geo.width, chunkOABOL32L_js.MIN_ELEMENT_SIZE)}px`;
|
|
4653
|
+
rs.domEl.style.height = `${Math.max(geo.height, chunkOABOL32L_js.MIN_ELEMENT_SIZE)}px`;
|
|
4658
4654
|
}
|
|
4659
4655
|
if (live) {
|
|
4660
|
-
|
|
4656
|
+
chunkHMZA25W2_js.publishLiveGeometry(live.patcher, live.slideId, rs.elementId, {
|
|
4661
4657
|
x: geo.x,
|
|
4662
4658
|
y: geo.y,
|
|
4663
|
-
width: Math.max(geo.width,
|
|
4664
|
-
height: Math.max(geo.height,
|
|
4659
|
+
width: Math.max(geo.width, chunkOABOL32L_js.MIN_ELEMENT_SIZE),
|
|
4660
|
+
height: Math.max(geo.height, chunkOABOL32L_js.MIN_ELEMENT_SIZE)
|
|
4665
4661
|
});
|
|
4666
4662
|
}
|
|
4667
4663
|
}
|
|
4668
4664
|
function processAdjustmentMove(e, adj, editorScale, updateElementById) {
|
|
4669
4665
|
const dx = (e.clientX - adj.startClientX) / editorScale;
|
|
4670
4666
|
const dy = (e.clientY - adj.startClientY) / editorScale;
|
|
4671
|
-
const adjustments =
|
|
4667
|
+
const adjustments = chunkHMZA25W2_js.getDraggedShapeAdjustments(adj, dx, dy);
|
|
4672
4668
|
if (!adj.moved && Math.hypot(dx, dy) > 2) {
|
|
4673
4669
|
adj.moved = true;
|
|
4674
4670
|
}
|
|
@@ -4743,13 +4739,13 @@ function processPointerUp(input) {
|
|
|
4743
4739
|
if (i !== activeSlideIndex) {
|
|
4744
4740
|
return s;
|
|
4745
4741
|
}
|
|
4746
|
-
const rerouted =
|
|
4742
|
+
const rerouted = chunkHMZA25W2_js.rerouteConnectorsForMovedElements(s.elements, movedIds);
|
|
4747
4743
|
if (rerouted.length === 0) {
|
|
4748
4744
|
return s;
|
|
4749
4745
|
}
|
|
4750
4746
|
return {
|
|
4751
4747
|
...s,
|
|
4752
|
-
elements:
|
|
4748
|
+
elements: chunkHMZA25W2_js.applyReroutedConnectors(s.elements, rerouted)
|
|
4753
4749
|
};
|
|
4754
4750
|
})
|
|
4755
4751
|
);
|
|
@@ -4774,9 +4770,9 @@ function processPointerUp(input) {
|
|
|
4774
4770
|
}
|
|
4775
4771
|
function commitMarquee(marquee, editTemplateMode, templateElements, activeSlide, applySelection, clearSelection) {
|
|
4776
4772
|
const sourceElements = editTemplateMode ? templateElements : activeSlide?.elements ?? [];
|
|
4777
|
-
const hitIds =
|
|
4773
|
+
const hitIds = chunkHMZA25W2_js.computeMarqueeHitIds(marquee, sourceElements);
|
|
4778
4774
|
if (marquee.additive) {
|
|
4779
|
-
const merged =
|
|
4775
|
+
const merged = chunkHMZA25W2_js.mergeAdditiveSelection(marquee.baseSelectionIds, hitIds);
|
|
4780
4776
|
if (merged.length > 0) {
|
|
4781
4777
|
applySelection(merged[0], merged);
|
|
4782
4778
|
} else {
|
|
@@ -4799,8 +4795,8 @@ function commitDrag(drag, editTemplateMode, activeSlide, activeSlideIndex, setTe
|
|
|
4799
4795
|
}
|
|
4800
4796
|
return { ...el, x: start.x + dx, y: start.y + dy };
|
|
4801
4797
|
});
|
|
4802
|
-
const rerouted =
|
|
4803
|
-
return
|
|
4798
|
+
const rerouted = chunkHMZA25W2_js.rerouteConnectorsForMovedElements(movedElements, movedIds);
|
|
4799
|
+
return chunkHMZA25W2_js.applyReroutedConnectors(movedElements, rerouted);
|
|
4804
4800
|
};
|
|
4805
4801
|
if (editTemplateMode) {
|
|
4806
4802
|
const slideId = activeSlide?.id;
|
|
@@ -4910,8 +4906,7 @@ function usePointerHandlers(input) {
|
|
|
4910
4906
|
updateSlides,
|
|
4911
4907
|
updateElementById,
|
|
4912
4908
|
markDirty,
|
|
4913
|
-
livePatcher
|
|
4914
|
-
input
|
|
4909
|
+
livePatcher
|
|
4915
4910
|
]);
|
|
4916
4911
|
}
|
|
4917
4912
|
function mouseDownStartsSelectionDrag(event) {
|
|
@@ -4957,11 +4952,11 @@ function useCanvasInteractions(input) {
|
|
|
4957
4952
|
return;
|
|
4958
4953
|
}
|
|
4959
4954
|
const el = elementLookup.get(editId);
|
|
4960
|
-
if (el &&
|
|
4955
|
+
if (el && chunkHMZA25W2_js.hasTextProperties(el)) {
|
|
4961
4956
|
const committedText = transformCommittedText ? transformCommittedText(inlineEditingText) : inlineEditingText;
|
|
4962
|
-
const newSegments =
|
|
4957
|
+
const newSegments = chunkHMZA25W2_js.remapTextToSegments(committedText, el.textSegments, el.textStyle);
|
|
4963
4958
|
const editorEl = document.querySelector("[data-inline-editor]");
|
|
4964
|
-
const newHeight =
|
|
4959
|
+
const newHeight = chunkHMZA25W2_js.resolveInlineEditAutoFitHeight(el.textStyle, el.height, editorEl);
|
|
4965
4960
|
ops.updateElementById(editId, {
|
|
4966
4961
|
text: committedText,
|
|
4967
4962
|
textSegments: newSegments,
|
|
@@ -4973,7 +4968,7 @@ function useCanvasInteractions(input) {
|
|
|
4973
4968
|
setInlineEditingText("");
|
|
4974
4969
|
};
|
|
4975
4970
|
const openEquationEditorForElement = (el) => {
|
|
4976
|
-
if (!
|
|
4971
|
+
if (!chunkHMZA25W2_js.hasTextProperties(el)) {
|
|
4977
4972
|
return false;
|
|
4978
4973
|
}
|
|
4979
4974
|
const eqSeg = el.textSegments?.find((seg) => seg.equationXml);
|
|
@@ -5003,7 +4998,7 @@ function useCanvasInteractions(input) {
|
|
|
5003
4998
|
justInteractedRef.current = false;
|
|
5004
4999
|
} else {
|
|
5005
5000
|
const el = elementLookup.get(elementId);
|
|
5006
|
-
if (el &&
|
|
5001
|
+
if (el && chunkHMZA25W2_js.hasTextProperties(el) && chunkHMZA25W2_js.canInteractWithElement(el, "textEdit")) {
|
|
5007
5002
|
if (!openEquationEditorForElement(el)) {
|
|
5008
5003
|
setInlineEditingElementId(elementId);
|
|
5009
5004
|
setInlineEditingText(el.text ?? "");
|
|
@@ -5022,7 +5017,7 @@ function useCanvasInteractions(input) {
|
|
|
5022
5017
|
if (openEquationEditorForElement(el)) {
|
|
5023
5018
|
return;
|
|
5024
5019
|
}
|
|
5025
|
-
if (
|
|
5020
|
+
if (chunkHMZA25W2_js.hasTextProperties(el) && chunkHMZA25W2_js.canInteractWithElement(el, "textEdit")) {
|
|
5026
5021
|
setInlineEditingElementId(elementId);
|
|
5027
5022
|
setInlineEditingText(el.text ?? "");
|
|
5028
5023
|
}
|
|
@@ -5045,7 +5040,7 @@ function useCanvasInteractions(input) {
|
|
|
5045
5040
|
justSelectedRef.current = false;
|
|
5046
5041
|
}
|
|
5047
5042
|
const ids = !wasSelected ? [elementId] : effectiveSelectedIds.length ? effectiveSelectedIds : [elementId];
|
|
5048
|
-
const movableIds =
|
|
5043
|
+
const movableIds = chunkHMZA25W2_js.filterInteractableIds(ids, (id) => elementLookup.get(id), "move");
|
|
5049
5044
|
if (movableIds.length === 0) {
|
|
5050
5045
|
return;
|
|
5051
5046
|
}
|
|
@@ -5115,7 +5110,7 @@ function useCanvasInteractions(input) {
|
|
|
5115
5110
|
const handleResizePointerDown = (elementId, e, handle) => {
|
|
5116
5111
|
e.stopPropagation();
|
|
5117
5112
|
const el = elementLookup.get(elementId);
|
|
5118
|
-
if (!el || !
|
|
5113
|
+
if (!el || !chunkHMZA25W2_js.canInteractWithElement(el, "resize")) {
|
|
5119
5114
|
return;
|
|
5120
5115
|
}
|
|
5121
5116
|
resizeStateRef.current = {
|
|
@@ -5137,7 +5132,7 @@ function useCanvasInteractions(input) {
|
|
|
5137
5132
|
};
|
|
5138
5133
|
const handleRotate = (elementId, rotationDeg) => {
|
|
5139
5134
|
const el = elementLookup.get(elementId);
|
|
5140
|
-
if (!el || !
|
|
5135
|
+
if (!el || !chunkHMZA25W2_js.canInteractWithElement(el, "rotate")) {
|
|
5141
5136
|
return;
|
|
5142
5137
|
}
|
|
5143
5138
|
ops.updateElementById(elementId, { rotation: rotationDeg });
|
|
@@ -5157,10 +5152,10 @@ function useCanvasInteractions(input) {
|
|
|
5157
5152
|
const handleAdjustmentPointerDown = (elementId, e, descriptor) => {
|
|
5158
5153
|
e.stopPropagation();
|
|
5159
5154
|
const el = elementLookup.get(elementId);
|
|
5160
|
-
if (!el || !
|
|
5155
|
+
if (!el || !chunkHMZA25W2_js.canInteractWithElement(el, "adjustHandle")) {
|
|
5161
5156
|
return;
|
|
5162
5157
|
}
|
|
5163
|
-
shapeAdjustmentDragStateRef.current =
|
|
5158
|
+
shapeAdjustmentDragStateRef.current = chunkHMZA25W2_js.beginShapeAdjustment(
|
|
5164
5159
|
el,
|
|
5165
5160
|
descriptor,
|
|
5166
5161
|
e.clientX,
|
|
@@ -5207,7 +5202,7 @@ function createFileHandlers(deps) {
|
|
|
5207
5202
|
h = Math.round(h * scale);
|
|
5208
5203
|
}
|
|
5209
5204
|
addElement({
|
|
5210
|
-
id:
|
|
5205
|
+
id: chunkHMZA25W2_js.generateElementId(),
|
|
5211
5206
|
type: "image",
|
|
5212
5207
|
x: Math.round((canvasSize.width - w) / 2),
|
|
5213
5208
|
y: Math.round((canvasSize.height - h) / 2),
|
|
@@ -5218,7 +5213,7 @@ function createFileHandlers(deps) {
|
|
|
5218
5213
|
};
|
|
5219
5214
|
img.onerror = () => {
|
|
5220
5215
|
addElement({
|
|
5221
|
-
id:
|
|
5216
|
+
id: chunkHMZA25W2_js.generateElementId(),
|
|
5222
5217
|
type: "image",
|
|
5223
5218
|
x: 100,
|
|
5224
5219
|
y: 100,
|
|
@@ -5237,14 +5232,14 @@ function createFileHandlers(deps) {
|
|
|
5237
5232
|
return;
|
|
5238
5233
|
}
|
|
5239
5234
|
e.target.value = "";
|
|
5240
|
-
const mediaType =
|
|
5235
|
+
const mediaType = chunkHMZA25W2_js.classifyMediaType(file.type);
|
|
5241
5236
|
if (!mediaType) {
|
|
5242
5237
|
return;
|
|
5243
5238
|
}
|
|
5244
5239
|
const elFilePath = file.path;
|
|
5245
5240
|
const insertMediaElement = (mediaSourceUrl, width, height) => {
|
|
5246
5241
|
addElement({
|
|
5247
|
-
id:
|
|
5242
|
+
id: chunkHMZA25W2_js.generateElementId(),
|
|
5248
5243
|
type: "media",
|
|
5249
5244
|
mediaType,
|
|
5250
5245
|
mediaMimeType: file.type || void 0,
|
|
@@ -5419,13 +5414,13 @@ function createStructuredElementHandlers(deps) {
|
|
|
5419
5414
|
return;
|
|
5420
5415
|
}
|
|
5421
5416
|
addElement({
|
|
5422
|
-
id:
|
|
5417
|
+
id: chunkHMZA25W2_js.generateElementId(),
|
|
5423
5418
|
type: "smartArt",
|
|
5424
5419
|
x: 100,
|
|
5425
5420
|
y: 120,
|
|
5426
5421
|
width: 600,
|
|
5427
5422
|
height: 340,
|
|
5428
|
-
smartArtData:
|
|
5423
|
+
smartArtData: chunkHMZA25W2_js.buildSmartArtPresetData(
|
|
5429
5424
|
layout,
|
|
5430
5425
|
defaultItems,
|
|
5431
5426
|
(i) => `node-${Date.now()}-${i}-${Math.random().toString(36).slice(2, 8)}`
|
|
@@ -5437,7 +5432,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5437
5432
|
return;
|
|
5438
5433
|
}
|
|
5439
5434
|
addElement({
|
|
5440
|
-
id:
|
|
5435
|
+
id: chunkHMZA25W2_js.generateElementId(),
|
|
5441
5436
|
type: "shape",
|
|
5442
5437
|
x: 120,
|
|
5443
5438
|
y: 200,
|
|
@@ -5475,7 +5470,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5475
5470
|
return;
|
|
5476
5471
|
}
|
|
5477
5472
|
const resolved = resolveHyperlinkEditResult(data);
|
|
5478
|
-
if (resolved.url && !
|
|
5473
|
+
if (resolved.url && !chunkHMZA25W2_js.isUrlSafe(resolved.url)) {
|
|
5479
5474
|
return;
|
|
5480
5475
|
}
|
|
5481
5476
|
const actionClick = {
|
|
@@ -5499,7 +5494,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5499
5494
|
const displayText = value || fieldTexts[fieldType] || fieldType;
|
|
5500
5495
|
const fieldGuid = `{${crypto.randomUUID().toUpperCase()}}`;
|
|
5501
5496
|
addElement({
|
|
5502
|
-
id:
|
|
5497
|
+
id: chunkHMZA25W2_js.generateElementId(),
|
|
5503
5498
|
type: "shape",
|
|
5504
5499
|
x: 120,
|
|
5505
5500
|
y: 200,
|
|
@@ -5521,11 +5516,11 @@ function createStructuredElementHandlers(deps) {
|
|
|
5521
5516
|
if (!activeSlide) {
|
|
5522
5517
|
return;
|
|
5523
5518
|
}
|
|
5524
|
-
const preset =
|
|
5519
|
+
const preset = chunkHMZA25W2_js.ACTION_BUTTON_PRESETS.find((p) => p.shapeType === shapeType);
|
|
5525
5520
|
if (!preset) {
|
|
5526
5521
|
return;
|
|
5527
5522
|
}
|
|
5528
|
-
const defaultPptxAction =
|
|
5523
|
+
const defaultPptxAction = chunkHMZA25W2_js.elementActionToPptxAction({
|
|
5529
5524
|
trigger: "click",
|
|
5530
5525
|
type: preset.defaultAction
|
|
5531
5526
|
});
|
|
@@ -5534,7 +5529,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5534
5529
|
defaultPptxAction.highlightClick = true;
|
|
5535
5530
|
}
|
|
5536
5531
|
addElement({
|
|
5537
|
-
id:
|
|
5532
|
+
id: chunkHMZA25W2_js.generateElementId(),
|
|
5538
5533
|
type: "shape",
|
|
5539
5534
|
x: 150,
|
|
5540
5535
|
y: 150,
|
|
@@ -5601,14 +5596,14 @@ function useInsertElements(input) {
|
|
|
5601
5596
|
return;
|
|
5602
5597
|
}
|
|
5603
5598
|
addElement({
|
|
5604
|
-
id:
|
|
5599
|
+
id: chunkHMZA25W2_js.generateElementId(),
|
|
5605
5600
|
type: "text",
|
|
5606
5601
|
x: 100,
|
|
5607
5602
|
y: 100,
|
|
5608
5603
|
width: 300,
|
|
5609
5604
|
height: 60,
|
|
5610
5605
|
text: "",
|
|
5611
|
-
textStyle: { fontSize:
|
|
5606
|
+
textStyle: { fontSize: chunkOABOL32L_js.DEFAULT_TEXT_FONT_SIZE }
|
|
5612
5607
|
});
|
|
5613
5608
|
};
|
|
5614
5609
|
const handleAddShape = () => {
|
|
@@ -5616,7 +5611,7 @@ function useInsertElements(input) {
|
|
|
5616
5611
|
return;
|
|
5617
5612
|
}
|
|
5618
5613
|
addElement({
|
|
5619
|
-
id:
|
|
5614
|
+
id: chunkHMZA25W2_js.generateElementId(),
|
|
5620
5615
|
type: "shape",
|
|
5621
5616
|
x: 150,
|
|
5622
5617
|
y: 150,
|
|
@@ -5635,15 +5630,15 @@ function useInsertElements(input) {
|
|
|
5635
5630
|
return;
|
|
5636
5631
|
}
|
|
5637
5632
|
addElement({
|
|
5638
|
-
...
|
|
5639
|
-
id:
|
|
5633
|
+
...chunkHMZA25W2_js.newTableElement(chunkOABOL32L_js.DEFAULT_TABLE_ROWS, chunkOABOL32L_js.DEFAULT_TABLE_COLUMNS, 100, 200),
|
|
5634
|
+
id: chunkHMZA25W2_js.generateElementId()
|
|
5640
5635
|
});
|
|
5641
5636
|
};
|
|
5642
5637
|
const handleAddChart = (chartKind) => {
|
|
5643
5638
|
if (!activeSlide) {
|
|
5644
5639
|
return;
|
|
5645
5640
|
}
|
|
5646
|
-
addElement(
|
|
5641
|
+
addElement(chunkHMZA25W2_js.createDefaultChartElement(chartKind));
|
|
5647
5642
|
};
|
|
5648
5643
|
const structured = createStructuredElementHandlers({
|
|
5649
5644
|
activeSlide,
|
|
@@ -5713,7 +5708,7 @@ function useClipboardHandlers(input) {
|
|
|
5713
5708
|
if (!selectedElement) {
|
|
5714
5709
|
return;
|
|
5715
5710
|
}
|
|
5716
|
-
setClipboardPayload(
|
|
5711
|
+
setClipboardPayload(chunkHMZA25W2_js.buildElementClipboardPayload(selectedElement, editTemplateMode));
|
|
5717
5712
|
};
|
|
5718
5713
|
const handleDelete = () => {
|
|
5719
5714
|
const idsToDelete = effectiveSelectedIds;
|
|
@@ -5730,7 +5725,7 @@ function useClipboardHandlers(input) {
|
|
|
5730
5725
|
handleDelete();
|
|
5731
5726
|
};
|
|
5732
5727
|
const insertClone = (source) => {
|
|
5733
|
-
const clone =
|
|
5728
|
+
const clone = chunkHMZA25W2_js.cloneElementForPaste(source, { intoTemplate: editTemplateMode });
|
|
5734
5729
|
ops.updateActiveElements((els) => [...els, clone]);
|
|
5735
5730
|
ops.applySelection(clone.id);
|
|
5736
5731
|
history.markDirty();
|
|
@@ -5765,7 +5760,7 @@ function resolveShapePath(el) {
|
|
|
5765
5760
|
return el.pathData;
|
|
5766
5761
|
}
|
|
5767
5762
|
if ("shapeType" in el && typeof el.shapeType === "string") {
|
|
5768
|
-
const clipPath =
|
|
5763
|
+
const clipPath = chunkHMZA25W2_js.getPresetShapeClipPath(el.shapeType);
|
|
5769
5764
|
if (clipPath) {
|
|
5770
5765
|
const svgPath = clipPathToSvgPath(clipPath, el.width, el.height);
|
|
5771
5766
|
if (svgPath) {
|
|
@@ -5816,7 +5811,7 @@ function clipPathToSvgPath(clipPath, width, height) {
|
|
|
5816
5811
|
return parts.join(" ");
|
|
5817
5812
|
}
|
|
5818
5813
|
function transformPathToGlobal(pathData, el) {
|
|
5819
|
-
const polys =
|
|
5814
|
+
const polys = chunkHMZA25W2_js.svgPathToPolygons(pathData);
|
|
5820
5815
|
if (polys.length === 0) {
|
|
5821
5816
|
return pathData;
|
|
5822
5817
|
}
|
|
@@ -5836,10 +5831,10 @@ function transformPathToGlobal(pathData, el) {
|
|
|
5836
5831
|
y: pt.y * scaleY + el.y
|
|
5837
5832
|
}))
|
|
5838
5833
|
);
|
|
5839
|
-
return
|
|
5834
|
+
return chunkHMZA25W2_js.polygonsToSvgPath(transformed);
|
|
5840
5835
|
}
|
|
5841
5836
|
function transformPathToLocal(pathData, x, y, _width, _height) {
|
|
5842
|
-
const polys =
|
|
5837
|
+
const polys = chunkHMZA25W2_js.svgPathToPolygons(pathData);
|
|
5843
5838
|
if (polys.length === 0) {
|
|
5844
5839
|
return pathData;
|
|
5845
5840
|
}
|
|
@@ -5849,10 +5844,10 @@ function transformPathToLocal(pathData, x, y, _width, _height) {
|
|
|
5849
5844
|
y: pt.y - y
|
|
5850
5845
|
}))
|
|
5851
5846
|
);
|
|
5852
|
-
return
|
|
5847
|
+
return chunkHMZA25W2_js.polygonsToSvgPath(transformed);
|
|
5853
5848
|
}
|
|
5854
5849
|
function pathBounds(pathData) {
|
|
5855
|
-
const polys =
|
|
5850
|
+
const polys = chunkHMZA25W2_js.svgPathToPolygons(pathData);
|
|
5856
5851
|
let minX = Infinity;
|
|
5857
5852
|
let minY = Infinity;
|
|
5858
5853
|
let maxX = -Infinity;
|
|
@@ -5911,7 +5906,7 @@ function useMergeShapesHandler(input) {
|
|
|
5911
5906
|
let allFragments = [];
|
|
5912
5907
|
let remaining = globalPaths[0];
|
|
5913
5908
|
for (let i = 1; i < globalPaths.length; i++) {
|
|
5914
|
-
const frags =
|
|
5909
|
+
const frags = chunkHMZA25W2_js.mergeShapes("fragment", remaining, globalPaths[i]);
|
|
5915
5910
|
if (Array.isArray(frags)) {
|
|
5916
5911
|
allFragments = frags;
|
|
5917
5912
|
}
|
|
@@ -5940,7 +5935,7 @@ function useMergeShapesHandler(input) {
|
|
|
5940
5935
|
bounds.height
|
|
5941
5936
|
);
|
|
5942
5937
|
const newEl = {
|
|
5943
|
-
id:
|
|
5938
|
+
id: chunkHMZA25W2_js.generateElementId(),
|
|
5944
5939
|
type: "shape",
|
|
5945
5940
|
x: bounds.x,
|
|
5946
5941
|
y: bounds.y,
|
|
@@ -5978,7 +5973,7 @@ function useMergeShapesHandler(input) {
|
|
|
5978
5973
|
} else {
|
|
5979
5974
|
let resultPath = globalPaths[0];
|
|
5980
5975
|
for (let i = 1; i < globalPaths.length; i++) {
|
|
5981
|
-
const result =
|
|
5976
|
+
const result = chunkHMZA25W2_js.mergeShapes(operation, resultPath, globalPaths[i]);
|
|
5982
5977
|
if (typeof result === "string") {
|
|
5983
5978
|
resultPath = result;
|
|
5984
5979
|
}
|
|
@@ -5999,7 +5994,7 @@ function useMergeShapesHandler(input) {
|
|
|
5999
5994
|
);
|
|
6000
5995
|
const primary = targets[0];
|
|
6001
5996
|
const newEl = {
|
|
6002
|
-
id:
|
|
5997
|
+
id: chunkHMZA25W2_js.generateElementId(),
|
|
6003
5998
|
type: "shape",
|
|
6004
5999
|
x: bounds.x,
|
|
6005
6000
|
y: bounds.y,
|
|
@@ -6062,7 +6057,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6062
6057
|
if (ids.length < 2 || !activeSlide) {
|
|
6063
6058
|
return;
|
|
6064
6059
|
}
|
|
6065
|
-
const { elements, groupId } =
|
|
6060
|
+
const { elements, groupId } = chunkHMZA25W2_js.groupElements(ops.activeElements, ids, chunkHMZA25W2_js.generateElementId());
|
|
6066
6061
|
if (groupId === null) {
|
|
6067
6062
|
return;
|
|
6068
6063
|
}
|
|
@@ -6075,11 +6070,11 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6075
6070
|
return;
|
|
6076
6071
|
}
|
|
6077
6072
|
const group = selectedElement;
|
|
6078
|
-
const intoTemplate =
|
|
6073
|
+
const intoTemplate = chunkHMZA25W2_js.isTemplateElementId(group.id);
|
|
6079
6074
|
const childIds = group.children.map(
|
|
6080
|
-
(child) => intoTemplate ?
|
|
6075
|
+
(child) => intoTemplate ? chunkHMZA25W2_js.makeCloneId(true, child.id || group.id) : child.id || chunkHMZA25W2_js.generateElementId()
|
|
6081
6076
|
);
|
|
6082
|
-
const { elements, childIds: usedIds } =
|
|
6077
|
+
const { elements, childIds: usedIds } = chunkHMZA25W2_js.ungroupElements(
|
|
6083
6078
|
ops.activeElements,
|
|
6084
6079
|
group.id,
|
|
6085
6080
|
childIds,
|
|
@@ -6108,7 +6103,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6108
6103
|
if (!edge) {
|
|
6109
6104
|
return;
|
|
6110
6105
|
}
|
|
6111
|
-
const positions =
|
|
6106
|
+
const positions = chunkHMZA25W2_js.alignElements(selectedElements, edge);
|
|
6112
6107
|
for (const [id, pos] of positions) {
|
|
6113
6108
|
const el = elementLookup.get(id);
|
|
6114
6109
|
if (!el) {
|
|
@@ -6126,7 +6121,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6126
6121
|
if (!distAxis) {
|
|
6127
6122
|
return;
|
|
6128
6123
|
}
|
|
6129
|
-
const positions =
|
|
6124
|
+
const positions = chunkHMZA25W2_js.distributeElements(selectedElements, distAxis);
|
|
6130
6125
|
for (const [id, pos] of positions) {
|
|
6131
6126
|
const el = elementLookup.get(id);
|
|
6132
6127
|
if (!el) {
|
|
@@ -6143,7 +6138,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6143
6138
|
}
|
|
6144
6139
|
const id = selectedElement.id;
|
|
6145
6140
|
ops.updateActiveElements(
|
|
6146
|
-
(els) => direction === "forward" ?
|
|
6141
|
+
(els) => direction === "forward" ? chunkHMZA25W2_js.bringForward(els, id) : direction === "backward" ? chunkHMZA25W2_js.sendBackward(els, id) : els
|
|
6147
6142
|
);
|
|
6148
6143
|
history.markDirty();
|
|
6149
6144
|
};
|
|
@@ -6153,7 +6148,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6153
6148
|
}
|
|
6154
6149
|
const id = selectedElement.id;
|
|
6155
6150
|
ops.updateActiveElements(
|
|
6156
|
-
(els) => direction === "front" ?
|
|
6151
|
+
(els) => direction === "front" ? chunkHMZA25W2_js.bringToFront(els, id) : chunkHMZA25W2_js.sendToBack(els, id)
|
|
6157
6152
|
);
|
|
6158
6153
|
history.markDirty();
|
|
6159
6154
|
};
|
|
@@ -6284,7 +6279,7 @@ function useSlideManagement(input) {
|
|
|
6284
6279
|
theme
|
|
6285
6280
|
} = input;
|
|
6286
6281
|
const handleAddSlide = () => {
|
|
6287
|
-
const newSlide =
|
|
6282
|
+
const newSlide = chunkHMZA25W2_js.createBlankSlide(slides.length + 1);
|
|
6288
6283
|
ops.updateSlides((prev) => {
|
|
6289
6284
|
const next = [...prev];
|
|
6290
6285
|
next.splice(activeSlideIndex + 1, 0, newSlide);
|
|
@@ -6347,7 +6342,7 @@ function useSlideManagement(input) {
|
|
|
6347
6342
|
}
|
|
6348
6343
|
const clone = {
|
|
6349
6344
|
...src,
|
|
6350
|
-
id:
|
|
6345
|
+
id: chunkHMZA25W2_js.makeSlideId(),
|
|
6351
6346
|
elements: src.elements.map((el) => ({
|
|
6352
6347
|
...el,
|
|
6353
6348
|
id: `${el.id}-dup-${Math.random().toString(36).slice(2, 6)}`
|
|
@@ -6379,7 +6374,7 @@ function useSlideManagement(input) {
|
|
|
6379
6374
|
const handleInsertSlideFromLayout = (layoutPath, layoutName) => {
|
|
6380
6375
|
const insertAt = activeSlideIndex + 1;
|
|
6381
6376
|
const draft = {
|
|
6382
|
-
...
|
|
6377
|
+
...chunkHMZA25W2_js.createBlankSlide(slides.length + 1),
|
|
6383
6378
|
layoutPath,
|
|
6384
6379
|
...layoutName ? { layoutName } : {}
|
|
6385
6380
|
};
|
|
@@ -6412,9 +6407,9 @@ function useSlideManagement(input) {
|
|
|
6412
6407
|
};
|
|
6413
6408
|
const handleInsertSlideFromTemplate = (templateId) => {
|
|
6414
6409
|
const insertAt = activeSlideIndex + 1;
|
|
6415
|
-
const draft =
|
|
6410
|
+
const draft = chunkHMZA25W2_js.buildSlideTemplateSlide(templateId, chunkHMZA25W2_js.makeSlideId(), slides.length + 1, {
|
|
6416
6411
|
...canvasSize ? { slideWidth: canvasSize.width, slideHeight: canvasSize.height } : {},
|
|
6417
|
-
scheme:
|
|
6412
|
+
scheme: chunkHMZA25W2_js.templateSchemeFromTheme(theme?.colorScheme)
|
|
6418
6413
|
});
|
|
6419
6414
|
ops.updateSlides((prev) => insertSlideFromLayoutUpdater(prev, activeSlideIndex, draft));
|
|
6420
6415
|
setActiveSlideIndex(insertAt);
|
|
@@ -6451,7 +6446,7 @@ function createTableMergeHandlers(input) {
|
|
|
6451
6446
|
if (!nextCell || nextCell.hMerge || nextCell.vMerge) {
|
|
6452
6447
|
return;
|
|
6453
6448
|
}
|
|
6454
|
-
const newTableData =
|
|
6449
|
+
const newTableData = chunkHMZA25W2_js.mergeCells(
|
|
6455
6450
|
[
|
|
6456
6451
|
{ row: rowIndex, col: columnIndex },
|
|
6457
6452
|
{ row: rowIndex, col: nextColIdx }
|
|
@@ -6459,7 +6454,7 @@ function createTableMergeHandlers(input) {
|
|
|
6459
6454
|
td
|
|
6460
6455
|
);
|
|
6461
6456
|
const updates = { tableData: newTableData };
|
|
6462
|
-
const newRawXml =
|
|
6457
|
+
const newRawXml = chunkHMZA25W2_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6463
6458
|
if (newRawXml) {
|
|
6464
6459
|
updates.rawXml = newRawXml;
|
|
6465
6460
|
}
|
|
@@ -6485,7 +6480,7 @@ function createTableMergeHandlers(input) {
|
|
|
6485
6480
|
if (!targetNextCell || targetNextCell.hMerge || targetNextCell.vMerge) {
|
|
6486
6481
|
return;
|
|
6487
6482
|
}
|
|
6488
|
-
const newTableData =
|
|
6483
|
+
const newTableData = chunkHMZA25W2_js.mergeCells(
|
|
6489
6484
|
[
|
|
6490
6485
|
{ row: rowIndex, col: columnIndex },
|
|
6491
6486
|
{ row: targetNextRowIdx, col: columnIndex }
|
|
@@ -6493,7 +6488,7 @@ function createTableMergeHandlers(input) {
|
|
|
6493
6488
|
td
|
|
6494
6489
|
);
|
|
6495
6490
|
const updates = { tableData: newTableData };
|
|
6496
|
-
const newRawXml =
|
|
6491
|
+
const newRawXml = chunkHMZA25W2_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6497
6492
|
if (newRawXml) {
|
|
6498
6493
|
updates.rawXml = newRawXml;
|
|
6499
6494
|
}
|
|
@@ -6508,9 +6503,9 @@ function createTableMergeHandlers(input) {
|
|
|
6508
6503
|
return;
|
|
6509
6504
|
}
|
|
6510
6505
|
const td = selectedElement.tableData;
|
|
6511
|
-
const newTableData =
|
|
6506
|
+
const newTableData = chunkHMZA25W2_js.mergeCells(ts.selectedCells, td);
|
|
6512
6507
|
const updates = { tableData: newTableData };
|
|
6513
|
-
const newRawXml =
|
|
6508
|
+
const newRawXml = chunkHMZA25W2_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6514
6509
|
if (newRawXml) {
|
|
6515
6510
|
updates.rawXml = newRawXml;
|
|
6516
6511
|
}
|
|
@@ -6527,9 +6522,9 @@ function createTableMergeHandlers(input) {
|
|
|
6527
6522
|
}
|
|
6528
6523
|
const { rowIndex, columnIndex } = ts;
|
|
6529
6524
|
const td = selectedElement.tableData;
|
|
6530
|
-
const newTableData =
|
|
6525
|
+
const newTableData = chunkHMZA25W2_js.splitCell(rowIndex, columnIndex, td);
|
|
6531
6526
|
const updates = { tableData: newTableData };
|
|
6532
|
-
const newRawXml =
|
|
6527
|
+
const newRawXml = chunkHMZA25W2_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6533
6528
|
if (newRawXml) {
|
|
6534
6529
|
updates.rawXml = newRawXml;
|
|
6535
6530
|
}
|
|
@@ -6552,19 +6547,21 @@ function createTableStructHandlers(input) {
|
|
|
6552
6547
|
elementLookup,
|
|
6553
6548
|
setTableEditorState,
|
|
6554
6549
|
ops,
|
|
6555
|
-
history
|
|
6550
|
+
history,
|
|
6551
|
+
transformCommittedText
|
|
6556
6552
|
} = input;
|
|
6557
|
-
const handleCommitCellEdit = (elementId, rowIndex, colIndex,
|
|
6553
|
+
const handleCommitCellEdit = (elementId, rowIndex, colIndex, rawText) => {
|
|
6558
6554
|
const el = elementLookup.get(elementId);
|
|
6559
6555
|
if (!el || el.type !== "table") {
|
|
6560
6556
|
return;
|
|
6561
6557
|
}
|
|
6558
|
+
const text = transformCommittedText ? transformCommittedText(rawText) : rawText;
|
|
6562
6559
|
const updates = {};
|
|
6563
6560
|
if (el.tableData) {
|
|
6564
|
-
updates.tableData =
|
|
6561
|
+
updates.tableData = chunkHMZA25W2_js.setCellText(el, rowIndex, colIndex, text).tableData;
|
|
6565
6562
|
}
|
|
6566
6563
|
if (el.rawXml) {
|
|
6567
|
-
const newRawXml =
|
|
6564
|
+
const newRawXml = chunkHMZA25W2_js.updateCellTextInRawXml(el, rowIndex, colIndex, text);
|
|
6568
6565
|
if (newRawXml) {
|
|
6569
6566
|
updates.rawXml = newRawXml;
|
|
6570
6567
|
}
|
|
@@ -6588,7 +6585,7 @@ function createTableStructHandlers(input) {
|
|
|
6588
6585
|
const { rowIndex, columnIndex: colIndex } = ts;
|
|
6589
6586
|
const updates = {};
|
|
6590
6587
|
if (selectedElement.rawXml) {
|
|
6591
|
-
const newRawXml =
|
|
6588
|
+
const newRawXml = chunkHMZA25W2_js.updateCellTextStyleInRawXml(
|
|
6592
6589
|
selectedElement,
|
|
6593
6590
|
rowIndex,
|
|
6594
6591
|
colIndex,
|
|
@@ -6652,9 +6649,9 @@ function createTableStructHandlers(input) {
|
|
|
6652
6649
|
return;
|
|
6653
6650
|
}
|
|
6654
6651
|
const rowIdx = ts?.rowIndex ?? 0;
|
|
6655
|
-
const newTableData =
|
|
6652
|
+
const newTableData = chunkHMZA25W2_js.insertTableRow(selectedElement.tableData, rowIdx, position);
|
|
6656
6653
|
const updates = { tableData: newTableData };
|
|
6657
|
-
const newRawXml =
|
|
6654
|
+
const newRawXml = chunkHMZA25W2_js.rebuildTableStructureInRawXml(selectedElement, newTableData);
|
|
6658
6655
|
if (newRawXml) {
|
|
6659
6656
|
updates.rawXml = newRawXml;
|
|
6660
6657
|
}
|
|
@@ -6667,12 +6664,12 @@ function createTableStructHandlers(input) {
|
|
|
6667
6664
|
}
|
|
6668
6665
|
const td = selectedElement.tableData;
|
|
6669
6666
|
const rowIdx = ts?.rowIndex ?? 0;
|
|
6670
|
-
const newTableData =
|
|
6667
|
+
const newTableData = chunkHMZA25W2_js.deleteTableRow(td, rowIdx);
|
|
6671
6668
|
if (newTableData === td) {
|
|
6672
6669
|
return;
|
|
6673
6670
|
}
|
|
6674
6671
|
const updates = { tableData: newTableData };
|
|
6675
|
-
const newRawXml =
|
|
6672
|
+
const newRawXml = chunkHMZA25W2_js.rebuildTableStructureInRawXml(selectedElement, newTableData);
|
|
6676
6673
|
if (newRawXml) {
|
|
6677
6674
|
updates.rawXml = newRawXml;
|
|
6678
6675
|
}
|
|
@@ -6684,9 +6681,9 @@ function createTableStructHandlers(input) {
|
|
|
6684
6681
|
return;
|
|
6685
6682
|
}
|
|
6686
6683
|
const colIdx = ts?.columnIndex ?? 0;
|
|
6687
|
-
const newTableData =
|
|
6684
|
+
const newTableData = chunkHMZA25W2_js.insertTableColumn(selectedElement.tableData, colIdx, position);
|
|
6688
6685
|
const updates = { tableData: newTableData };
|
|
6689
|
-
const newRawXml =
|
|
6686
|
+
const newRawXml = chunkHMZA25W2_js.rebuildTableStructureInRawXml(selectedElement, newTableData);
|
|
6690
6687
|
if (newRawXml) {
|
|
6691
6688
|
updates.rawXml = newRawXml;
|
|
6692
6689
|
}
|
|
@@ -6699,12 +6696,12 @@ function createTableStructHandlers(input) {
|
|
|
6699
6696
|
}
|
|
6700
6697
|
const td = selectedElement.tableData;
|
|
6701
6698
|
const colIdx = ts?.columnIndex ?? 0;
|
|
6702
|
-
const newTableData =
|
|
6699
|
+
const newTableData = chunkHMZA25W2_js.deleteTableColumn(td, colIdx);
|
|
6703
6700
|
if (newTableData === td) {
|
|
6704
6701
|
return;
|
|
6705
6702
|
}
|
|
6706
6703
|
const updates = { tableData: newTableData };
|
|
6707
|
-
const newRawXml =
|
|
6704
|
+
const newRawXml = chunkHMZA25W2_js.rebuildTableStructureInRawXml(selectedElement, newTableData);
|
|
6708
6705
|
if (newRawXml) {
|
|
6709
6706
|
updates.rawXml = newRawXml;
|
|
6710
6707
|
}
|
|
@@ -6740,8 +6737,8 @@ async function renderToCanvas(element, options = {}) {
|
|
|
6740
6737
|
return html2canvasPro(element, {
|
|
6741
6738
|
...options,
|
|
6742
6739
|
onclone: async (doc, clonedEl) => {
|
|
6743
|
-
await
|
|
6744
|
-
|
|
6740
|
+
await chunkHMZA25W2_js.normalizeColorsForCapture(doc, clonedEl);
|
|
6741
|
+
chunkHMZA25W2_js.preprocessCssForCapture(clonedEl);
|
|
6745
6742
|
if (typeof userOnClone === "function") {
|
|
6746
6743
|
userOnClone(doc, clonedEl);
|
|
6747
6744
|
}
|
|
@@ -6749,6 +6746,144 @@ async function renderToCanvas(element, options = {}) {
|
|
|
6749
6746
|
});
|
|
6750
6747
|
}
|
|
6751
6748
|
|
|
6749
|
+
// src/viewer/hooks/useExportSaveAs.ts
|
|
6750
|
+
function useExportSaveAs(input) {
|
|
6751
|
+
const {
|
|
6752
|
+
slides,
|
|
6753
|
+
templateElementsBySlideId,
|
|
6754
|
+
filePath,
|
|
6755
|
+
handlerRef,
|
|
6756
|
+
headerFooter,
|
|
6757
|
+
presentationProperties,
|
|
6758
|
+
customShows,
|
|
6759
|
+
sections,
|
|
6760
|
+
coreProperties,
|
|
6761
|
+
appProperties,
|
|
6762
|
+
customProperties,
|
|
6763
|
+
tagCollections,
|
|
6764
|
+
slideMasters,
|
|
6765
|
+
notesMaster,
|
|
6766
|
+
handoutMaster,
|
|
6767
|
+
guides,
|
|
6768
|
+
activeSlideIndexForGuides,
|
|
6769
|
+
theme,
|
|
6770
|
+
canvasSize,
|
|
6771
|
+
slideSizeEmu,
|
|
6772
|
+
password
|
|
6773
|
+
} = input;
|
|
6774
|
+
const handleSaveAsFormat = async (format) => {
|
|
6775
|
+
const handler = handlerRef.current;
|
|
6776
|
+
if (!handler) {
|
|
6777
|
+
return;
|
|
6778
|
+
}
|
|
6779
|
+
const downloadName = chunkHMZA25W2_js.savedPresentationFileName(filePath, format);
|
|
6780
|
+
try {
|
|
6781
|
+
const data = await buildSaveAsData(handler, format);
|
|
6782
|
+
const blob = new Blob([data], {
|
|
6783
|
+
type: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
6784
|
+
});
|
|
6785
|
+
chunkHMZA25W2_js.downloadBlob(blob, downloadName);
|
|
6786
|
+
} catch (err) {
|
|
6787
|
+
console.error(`[PowerPointViewer] Save as .${format} failed:`, err);
|
|
6788
|
+
}
|
|
6789
|
+
};
|
|
6790
|
+
const buildSaveAsData = async (handler, format) => {
|
|
6791
|
+
const slidesWithGuides = slides.map((slide, idx) => {
|
|
6792
|
+
if (idx !== activeSlideIndexForGuides) {
|
|
6793
|
+
return slide;
|
|
6794
|
+
}
|
|
6795
|
+
const pptxGuides = guides.map((g) => ({
|
|
6796
|
+
id: g.id,
|
|
6797
|
+
orientation: g.axis === "h" ? "horz" : "vert",
|
|
6798
|
+
positionEmu: chunkHMZA25W2_js.guidePxToEmu(g.position)
|
|
6799
|
+
}));
|
|
6800
|
+
return {
|
|
6801
|
+
...slide,
|
|
6802
|
+
guides: pptxGuides.length > 0 ? pptxGuides : void 0
|
|
6803
|
+
};
|
|
6804
|
+
});
|
|
6805
|
+
const slidesToSave = chunkHMZA25W2_js.buildSaveSlides(slidesWithGuides, templateElementsBySlideId);
|
|
6806
|
+
const saveOptions = {
|
|
6807
|
+
// Save As shares Save's slide-size decision; leaving it out here is how
|
|
6808
|
+
// a preset picked in the inspector reached one save path and not the other.
|
|
6809
|
+
slideSize: chunkHMZA25W2_js.resolveSlideSizeSelection({ current: slideSizeEmu, canvas: canvasSize }).size,
|
|
6810
|
+
headerFooter,
|
|
6811
|
+
presentationProperties,
|
|
6812
|
+
customShows: customShows.length > 0 ? customShows : void 0,
|
|
6813
|
+
sections: sections.length > 0 ? sections : void 0,
|
|
6814
|
+
coreProperties: coreProperties ?? void 0,
|
|
6815
|
+
appProperties: appProperties ?? void 0,
|
|
6816
|
+
customProperties: customProperties.length > 0 ? customProperties : void 0,
|
|
6817
|
+
tags: tagCollections.length > 0 ? tagCollections : void 0,
|
|
6818
|
+
slideMasters,
|
|
6819
|
+
notesMaster,
|
|
6820
|
+
handoutMaster,
|
|
6821
|
+
outputFormat: format
|
|
6822
|
+
};
|
|
6823
|
+
return chunkHMZA25W2_js.saveDeckWithPassword(handler, slidesToSave, saveOptions, password);
|
|
6824
|
+
};
|
|
6825
|
+
const handleExportJson = () => {
|
|
6826
|
+
const sourceName = filePath ? filePath.replace(/\\/gu, "/").split("/").pop() : void 0;
|
|
6827
|
+
const slideSize = chunkHMZA25W2_js.resolveSlideSizeSelection({ current: slideSizeEmu, canvas: canvasSize }).size;
|
|
6828
|
+
const data = {
|
|
6829
|
+
slides: chunkHMZA25W2_js.buildSaveSlides(slides, templateElementsBySlideId),
|
|
6830
|
+
width: canvasSize.width,
|
|
6831
|
+
height: canvasSize.height,
|
|
6832
|
+
widthEmu: slideSize.widthEmu,
|
|
6833
|
+
heightEmu: slideSize.heightEmu,
|
|
6834
|
+
slideSizeType: slideSize.type === "" ? void 0 : slideSize.type,
|
|
6835
|
+
theme,
|
|
6836
|
+
headerFooter,
|
|
6837
|
+
presentationProperties,
|
|
6838
|
+
customShows: customShows.length > 0 ? customShows : void 0,
|
|
6839
|
+
sections: sections.length > 0 ? sections : void 0,
|
|
6840
|
+
coreProperties: coreProperties ?? void 0,
|
|
6841
|
+
appProperties: appProperties ?? void 0,
|
|
6842
|
+
customProperties: customProperties.length > 0 ? customProperties : void 0,
|
|
6843
|
+
tags: tagCollections.length > 0 ? tagCollections : void 0,
|
|
6844
|
+
notesMaster,
|
|
6845
|
+
handoutMaster
|
|
6846
|
+
};
|
|
6847
|
+
try {
|
|
6848
|
+
chunkHMZA25W2_js.exportDeckJson(data, sourceName);
|
|
6849
|
+
} catch (err) {
|
|
6850
|
+
console.error("[PowerPointViewer] JSON export failed:", err);
|
|
6851
|
+
}
|
|
6852
|
+
};
|
|
6853
|
+
const handleSaveAsPptx = () => {
|
|
6854
|
+
void handleSaveAsFormat("pptx");
|
|
6855
|
+
};
|
|
6856
|
+
const handleSaveAsPpsx = () => {
|
|
6857
|
+
void handleSaveAsFormat("ppsx");
|
|
6858
|
+
};
|
|
6859
|
+
const handleSaveAsPptm = () => {
|
|
6860
|
+
void handleSaveAsFormat("pptm");
|
|
6861
|
+
};
|
|
6862
|
+
return {
|
|
6863
|
+
handleExportJson,
|
|
6864
|
+
handleSaveAsFormat,
|
|
6865
|
+
handleSaveAsPptx,
|
|
6866
|
+
handleSaveAsPpsx,
|
|
6867
|
+
handleSaveAsPptm
|
|
6868
|
+
};
|
|
6869
|
+
}
|
|
6870
|
+
|
|
6871
|
+
// src/viewer/utils/dom-helpers.ts
|
|
6872
|
+
function safePrompt(message, defaultValue) {
|
|
6873
|
+
try {
|
|
6874
|
+
return window.prompt(message, defaultValue);
|
|
6875
|
+
} catch {
|
|
6876
|
+
return null;
|
|
6877
|
+
}
|
|
6878
|
+
}
|
|
6879
|
+
function safeConfirm(message) {
|
|
6880
|
+
try {
|
|
6881
|
+
return window.confirm(message);
|
|
6882
|
+
} catch {
|
|
6883
|
+
return false;
|
|
6884
|
+
}
|
|
6885
|
+
}
|
|
6886
|
+
|
|
6752
6887
|
// src/viewer/utils/export-helpers.ts
|
|
6753
6888
|
async function renderElementToCanvas(element, scale = 2, backgroundColor) {
|
|
6754
6889
|
const canvas = await renderToCanvas(element, {
|
|
@@ -6797,7 +6932,7 @@ async function exportSlideToPngBlob(slideElement, options = {}) {
|
|
|
6797
6932
|
}
|
|
6798
6933
|
async function exportSlideAsPng(slideElement, slideIndex, options = {}) {
|
|
6799
6934
|
const blob = await exportSlideToPngBlob(slideElement, options);
|
|
6800
|
-
|
|
6935
|
+
chunkHMZA25W2_js.downloadBlob(blob, `slide-${slideIndex + 1}.png`);
|
|
6801
6936
|
}
|
|
6802
6937
|
async function copySlideToClipboard(slideElement, options = {}) {
|
|
6803
6938
|
const blob = await exportSlideToPngBlob(slideElement, options);
|
|
@@ -6819,15 +6954,15 @@ async function exportAllSlidesAsPdf(slideStageRef, totalSlides, setActiveSlide,
|
|
|
6819
6954
|
continue;
|
|
6820
6955
|
}
|
|
6821
6956
|
const canvas = await renderElementToCanvas(stageEl, scale);
|
|
6822
|
-
images.push(
|
|
6957
|
+
images.push(chunkHMZA25W2_js.canvasToJpegData(canvas));
|
|
6823
6958
|
}
|
|
6824
6959
|
onProgress?.(totalSlides, totalSlides);
|
|
6825
6960
|
setActiveSlide(currentSlideIndex);
|
|
6826
6961
|
if (images.length === 0) {
|
|
6827
|
-
throw new Error(
|
|
6962
|
+
throw new Error(chunkSWRY3SI5_js.translationsEn["pptx.export.errorNoSlidesPdf"]);
|
|
6828
6963
|
}
|
|
6829
|
-
const pdfBlobUrl =
|
|
6830
|
-
|
|
6964
|
+
const pdfBlobUrl = chunkOABOL32L_js.buildPdfFromImageData(images);
|
|
6965
|
+
chunkHMZA25W2_js.downloadDataUrl(pdfBlobUrl, filename);
|
|
6831
6966
|
}
|
|
6832
6967
|
async function captureAllSlidesAsPngDataUrls(slideStageRef, totalSlides, setActiveSlide, currentSlideIndex, options = {}) {
|
|
6833
6968
|
const { scale = 2, onProgress } = options;
|
|
@@ -6873,10 +7008,10 @@ async function exportAllSlidesAsNotesPdf(slideStageRef, totalSlides, setActiveSl
|
|
|
6873
7008
|
onProgress?.(totalSlides, totalSlides);
|
|
6874
7009
|
setActiveSlide(currentSlideIndex);
|
|
6875
7010
|
if (pages.length === 0) {
|
|
6876
|
-
throw new Error(
|
|
7011
|
+
throw new Error(chunkSWRY3SI5_js.translationsEn["pptx.export.errorNoSlidesNotesPdf"]);
|
|
6877
7012
|
}
|
|
6878
|
-
const pdfDataUrl =
|
|
6879
|
-
|
|
7013
|
+
const pdfDataUrl = chunkOABOL32L_js.buildNotesPdf(pages);
|
|
7014
|
+
chunkHMZA25W2_js.downloadDataUrl(pdfDataUrl, filename);
|
|
6880
7015
|
}
|
|
6881
7016
|
|
|
6882
7017
|
// src/viewer/utils/export-video.ts
|
|
@@ -6907,7 +7042,7 @@ async function exportAllSlidesAsVideo(slideStageRef, totalSlides, setActiveSlide
|
|
|
6907
7042
|
}
|
|
6908
7043
|
setActiveSlide(currentSlideIndex);
|
|
6909
7044
|
if (slideCanvases.length === 0) {
|
|
6910
|
-
throw new Error(
|
|
7045
|
+
throw new Error(chunkSWRY3SI5_js.translationsEn["pptx.export.errorNoSlidesVideo"]);
|
|
6911
7046
|
}
|
|
6912
7047
|
const firstCanvas = slideCanvases[0];
|
|
6913
7048
|
const recordingCanvas = document.createElement("canvas");
|
|
@@ -6915,12 +7050,12 @@ async function exportAllSlidesAsVideo(slideStageRef, totalSlides, setActiveSlide
|
|
|
6915
7050
|
recordingCanvas.height = firstCanvas.height;
|
|
6916
7051
|
const ctx = recordingCanvas.getContext("2d");
|
|
6917
7052
|
if (!ctx) {
|
|
6918
|
-
throw new Error(
|
|
7053
|
+
throw new Error(chunkSWRY3SI5_js.translationsEn["pptx.export.errorNo2dContext"]);
|
|
6919
7054
|
}
|
|
6920
7055
|
const fps = 30;
|
|
6921
7056
|
const stream = recordingCanvas.captureStream(fps);
|
|
6922
7057
|
const recorder = new MediaRecorder(stream, {
|
|
6923
|
-
mimeType:
|
|
7058
|
+
mimeType: chunkHMZA25W2_js.pickSupportedMimeType([...chunkHMZA25W2_js.WEBM_MIME_CANDIDATES]),
|
|
6924
7059
|
videoBitsPerSecond: 5e6
|
|
6925
7060
|
});
|
|
6926
7061
|
const chunks = [];
|
|
@@ -6943,8 +7078,8 @@ async function exportAllSlidesAsVideo(slideStageRef, totalSlides, setActiveSlide
|
|
|
6943
7078
|
const duration = slideTimingsMs?.[i] ?? slideDurationMs;
|
|
6944
7079
|
ctx.clearRect(0, 0, recordingCanvas.width, recordingCanvas.height);
|
|
6945
7080
|
ctx.drawImage(slideCanvases[i], 0, 0);
|
|
6946
|
-
const frameInterval =
|
|
6947
|
-
const framesNeeded =
|
|
7081
|
+
const frameInterval = chunkHMZA25W2_js.fpsToFrameIntervalMs(fps);
|
|
7082
|
+
const framesNeeded = chunkHMZA25W2_js.segmentFrameCount(duration, fps);
|
|
6948
7083
|
for (let f = 0; f < framesNeeded; f++) {
|
|
6949
7084
|
if (signal?.aborted) {
|
|
6950
7085
|
recorder.stop();
|
|
@@ -6991,9 +7126,9 @@ async function exportAllSlidesAsGif(slideStageRef, totalSlides, setActiveSlide,
|
|
|
6991
7126
|
}
|
|
6992
7127
|
setActiveSlide(currentSlideIndex);
|
|
6993
7128
|
if (frames.length === 0) {
|
|
6994
|
-
throw new Error(
|
|
7129
|
+
throw new Error(chunkSWRY3SI5_js.translationsEn["pptx.export.errorNoSlidesGif"]);
|
|
6995
7130
|
}
|
|
6996
|
-
const gifBytes =
|
|
7131
|
+
const gifBytes = chunkHMZA25W2_js.encodeGif(frames, Math.round(slideDurationMs / 10));
|
|
6997
7132
|
onProgress?.(totalSlides, totalSlides);
|
|
6998
7133
|
const buf = new ArrayBuffer(gifBytes.length);
|
|
6999
7134
|
new Uint8Array(buf).set(gifBytes);
|
|
@@ -7047,7 +7182,7 @@ function exportAllSlidesToSvg(data, options = {}) {
|
|
|
7047
7182
|
continue;
|
|
7048
7183
|
}
|
|
7049
7184
|
onProgress?.(processedCount, data.slides.length);
|
|
7050
|
-
let svg =
|
|
7185
|
+
let svg = chunkHMZA25W2_js.SvgExporter.exportSlide(slide, data.width, data.height, svgOptions);
|
|
7051
7186
|
if (embedFonts && fontFaces?.length) {
|
|
7052
7187
|
svg = injectFontFaces(svg, fontFaces);
|
|
7053
7188
|
}
|
|
@@ -7058,194 +7193,6 @@ function exportAllSlidesToSvg(data, options = {}) {
|
|
|
7058
7193
|
return results;
|
|
7059
7194
|
}
|
|
7060
7195
|
|
|
7061
|
-
// src/viewer/hooks/useExportSaveAs.ts
|
|
7062
|
-
function useExportSaveAs(input) {
|
|
7063
|
-
const {
|
|
7064
|
-
slides,
|
|
7065
|
-
templateElementsBySlideId,
|
|
7066
|
-
filePath,
|
|
7067
|
-
handlerRef,
|
|
7068
|
-
serializeSlides,
|
|
7069
|
-
headerFooter,
|
|
7070
|
-
presentationProperties,
|
|
7071
|
-
customShows,
|
|
7072
|
-
sections,
|
|
7073
|
-
coreProperties,
|
|
7074
|
-
appProperties,
|
|
7075
|
-
customProperties,
|
|
7076
|
-
tagCollections,
|
|
7077
|
-
slideMasters,
|
|
7078
|
-
notesMaster,
|
|
7079
|
-
handoutMaster,
|
|
7080
|
-
guides,
|
|
7081
|
-
activeSlideIndexForGuides,
|
|
7082
|
-
theme,
|
|
7083
|
-
canvasSize,
|
|
7084
|
-
slideSizeEmu,
|
|
7085
|
-
modalControls,
|
|
7086
|
-
password
|
|
7087
|
-
} = input;
|
|
7088
|
-
const {
|
|
7089
|
-
setExportModalOpen,
|
|
7090
|
-
setExportModalTitle,
|
|
7091
|
-
setExportProgress,
|
|
7092
|
-
setExportStatusMessage,
|
|
7093
|
-
exportAbortRef
|
|
7094
|
-
} = modalControls;
|
|
7095
|
-
const handlePackageForSharing = async () => {
|
|
7096
|
-
const abortCtrl = new AbortController();
|
|
7097
|
-
exportAbortRef.current = abortCtrl;
|
|
7098
|
-
setExportModalTitle("Package for Sharing");
|
|
7099
|
-
setExportStatusMessage("Preparing package...");
|
|
7100
|
-
setExportProgress(0);
|
|
7101
|
-
setExportModalOpen(true);
|
|
7102
|
-
try {
|
|
7103
|
-
const zip = new JSZip__default.default();
|
|
7104
|
-
const pkgFolder = zip.folder("presentation-package");
|
|
7105
|
-
setExportProgress(10);
|
|
7106
|
-
setExportStatusMessage("Adding presentation...");
|
|
7107
|
-
const pptxData = await serializeSlides();
|
|
7108
|
-
const pptxFilename = chunkIDTNKL4S_js.savedPresentationFileName(filePath);
|
|
7109
|
-
if (pptxData) {
|
|
7110
|
-
pkgFolder.file(pptxFilename, pptxData);
|
|
7111
|
-
}
|
|
7112
|
-
setExportProgress(70);
|
|
7113
|
-
setExportStatusMessage("Writing README...");
|
|
7114
|
-
const readme = chunkIDTNKL4S_js.generatePackageReadme(pptxFilename);
|
|
7115
|
-
pkgFolder.file("README.txt", readme);
|
|
7116
|
-
if (abortCtrl.signal.aborted) {
|
|
7117
|
-
throw new DOMException("Export cancelled", "AbortError");
|
|
7118
|
-
}
|
|
7119
|
-
setExportProgress(85);
|
|
7120
|
-
setExportStatusMessage("Generating ZIP...");
|
|
7121
|
-
const zipBlob = await zip.generateAsync({ type: "blob" });
|
|
7122
|
-
setExportProgress(95);
|
|
7123
|
-
setExportStatusMessage("Downloading...");
|
|
7124
|
-
chunkIDTNKL4S_js.downloadBlob(zipBlob, `${chunkIDTNKL4S_js.presentationBaseName(pptxFilename)}-package.zip`);
|
|
7125
|
-
setExportProgress(100);
|
|
7126
|
-
} catch (err) {
|
|
7127
|
-
if (err.name !== "AbortError") {
|
|
7128
|
-
console.error("[PowerPointViewer] Package export failed:", err);
|
|
7129
|
-
}
|
|
7130
|
-
} finally {
|
|
7131
|
-
exportAbortRef.current = null;
|
|
7132
|
-
setExportModalOpen(false);
|
|
7133
|
-
}
|
|
7134
|
-
};
|
|
7135
|
-
const handleSaveAsFormat = async (format) => {
|
|
7136
|
-
const handler = handlerRef.current;
|
|
7137
|
-
if (!handler) {
|
|
7138
|
-
return;
|
|
7139
|
-
}
|
|
7140
|
-
const downloadName = chunkIDTNKL4S_js.savedPresentationFileName(filePath, format);
|
|
7141
|
-
try {
|
|
7142
|
-
const data = await buildSaveAsData(handler, format);
|
|
7143
|
-
const blob = new Blob([data], {
|
|
7144
|
-
type: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
7145
|
-
});
|
|
7146
|
-
chunkIDTNKL4S_js.downloadBlob(blob, downloadName);
|
|
7147
|
-
} catch (err) {
|
|
7148
|
-
console.error(`[PowerPointViewer] Save as .${format} failed:`, err);
|
|
7149
|
-
}
|
|
7150
|
-
};
|
|
7151
|
-
const buildSaveAsData = async (handler, format) => {
|
|
7152
|
-
const slidesWithGuides = slides.map((slide, idx) => {
|
|
7153
|
-
if (idx !== activeSlideIndexForGuides) {
|
|
7154
|
-
return slide;
|
|
7155
|
-
}
|
|
7156
|
-
const pptxGuides = guides.map((g) => ({
|
|
7157
|
-
id: g.id,
|
|
7158
|
-
orientation: g.axis === "h" ? "horz" : "vert",
|
|
7159
|
-
positionEmu: chunkIDTNKL4S_js.guidePxToEmu(g.position)
|
|
7160
|
-
}));
|
|
7161
|
-
return {
|
|
7162
|
-
...slide,
|
|
7163
|
-
guides: pptxGuides.length > 0 ? pptxGuides : void 0
|
|
7164
|
-
};
|
|
7165
|
-
});
|
|
7166
|
-
const slidesToSave = chunkIDTNKL4S_js.buildSaveSlides(slidesWithGuides, templateElementsBySlideId);
|
|
7167
|
-
const saveOptions = {
|
|
7168
|
-
// Save As shares Save's slide-size decision; leaving it out here is how
|
|
7169
|
-
// a preset picked in the inspector reached one save path and not the other.
|
|
7170
|
-
slideSize: chunkIDTNKL4S_js.resolveSlideSizeSelection({ current: slideSizeEmu, canvas: canvasSize }).size,
|
|
7171
|
-
headerFooter,
|
|
7172
|
-
presentationProperties,
|
|
7173
|
-
customShows: customShows.length > 0 ? customShows : void 0,
|
|
7174
|
-
sections: sections.length > 0 ? sections : void 0,
|
|
7175
|
-
coreProperties: coreProperties ?? void 0,
|
|
7176
|
-
appProperties: appProperties ?? void 0,
|
|
7177
|
-
customProperties: customProperties.length > 0 ? customProperties : void 0,
|
|
7178
|
-
tags: tagCollections.length > 0 ? tagCollections : void 0,
|
|
7179
|
-
slideMasters,
|
|
7180
|
-
notesMaster,
|
|
7181
|
-
handoutMaster,
|
|
7182
|
-
outputFormat: format
|
|
7183
|
-
};
|
|
7184
|
-
return chunkIDTNKL4S_js.saveDeckWithPassword(handler, slidesToSave, saveOptions, password);
|
|
7185
|
-
};
|
|
7186
|
-
const handleExportJson = () => {
|
|
7187
|
-
const sourceName = filePath ? filePath.replace(/\\/gu, "/").split("/").pop() : void 0;
|
|
7188
|
-
const slideSize = chunkIDTNKL4S_js.resolveSlideSizeSelection({ current: slideSizeEmu, canvas: canvasSize }).size;
|
|
7189
|
-
const data = {
|
|
7190
|
-
slides: chunkIDTNKL4S_js.buildSaveSlides(slides, templateElementsBySlideId),
|
|
7191
|
-
width: canvasSize.width,
|
|
7192
|
-
height: canvasSize.height,
|
|
7193
|
-
widthEmu: slideSize.widthEmu,
|
|
7194
|
-
heightEmu: slideSize.heightEmu,
|
|
7195
|
-
slideSizeType: slideSize.type === "" ? void 0 : slideSize.type,
|
|
7196
|
-
theme,
|
|
7197
|
-
headerFooter,
|
|
7198
|
-
presentationProperties,
|
|
7199
|
-
customShows: customShows.length > 0 ? customShows : void 0,
|
|
7200
|
-
sections: sections.length > 0 ? sections : void 0,
|
|
7201
|
-
coreProperties: coreProperties ?? void 0,
|
|
7202
|
-
appProperties: appProperties ?? void 0,
|
|
7203
|
-
customProperties: customProperties.length > 0 ? customProperties : void 0,
|
|
7204
|
-
tags: tagCollections.length > 0 ? tagCollections : void 0,
|
|
7205
|
-
notesMaster,
|
|
7206
|
-
handoutMaster
|
|
7207
|
-
};
|
|
7208
|
-
try {
|
|
7209
|
-
chunkIDTNKL4S_js.exportDeckJson(data, sourceName);
|
|
7210
|
-
} catch (err) {
|
|
7211
|
-
console.error("[PowerPointViewer] JSON export failed:", err);
|
|
7212
|
-
}
|
|
7213
|
-
};
|
|
7214
|
-
const handleSaveAsPptx = () => {
|
|
7215
|
-
void handleSaveAsFormat("pptx");
|
|
7216
|
-
};
|
|
7217
|
-
const handleSaveAsPpsx = () => {
|
|
7218
|
-
void handleSaveAsFormat("ppsx");
|
|
7219
|
-
};
|
|
7220
|
-
const handleSaveAsPptm = () => {
|
|
7221
|
-
void handleSaveAsFormat("pptm");
|
|
7222
|
-
};
|
|
7223
|
-
return {
|
|
7224
|
-
handleExportJson,
|
|
7225
|
-
handlePackageForSharing,
|
|
7226
|
-
handleSaveAsFormat,
|
|
7227
|
-
handleSaveAsPptx,
|
|
7228
|
-
handleSaveAsPpsx,
|
|
7229
|
-
handleSaveAsPptm
|
|
7230
|
-
};
|
|
7231
|
-
}
|
|
7232
|
-
|
|
7233
|
-
// src/viewer/utils/dom-helpers.ts
|
|
7234
|
-
function safePrompt(message, defaultValue) {
|
|
7235
|
-
try {
|
|
7236
|
-
return window.prompt(message, defaultValue);
|
|
7237
|
-
} catch {
|
|
7238
|
-
return null;
|
|
7239
|
-
}
|
|
7240
|
-
}
|
|
7241
|
-
function safeConfirm(message) {
|
|
7242
|
-
try {
|
|
7243
|
-
return window.confirm(message);
|
|
7244
|
-
} catch {
|
|
7245
|
-
return false;
|
|
7246
|
-
}
|
|
7247
|
-
}
|
|
7248
|
-
|
|
7249
7196
|
// src/viewer/hooks/useExportHandlers.ts
|
|
7250
7197
|
function useExportHandlers(input) {
|
|
7251
7198
|
const {
|
|
@@ -7257,7 +7204,6 @@ function useExportHandlers(input) {
|
|
|
7257
7204
|
canvasStageRef,
|
|
7258
7205
|
setActiveSlideIndex,
|
|
7259
7206
|
handlerRef,
|
|
7260
|
-
serializeSlides,
|
|
7261
7207
|
headerFooter,
|
|
7262
7208
|
presentationProperties,
|
|
7263
7209
|
customShows,
|
|
@@ -7274,23 +7220,16 @@ function useExportHandlers(input) {
|
|
|
7274
7220
|
theme,
|
|
7275
7221
|
canvasSize,
|
|
7276
7222
|
slideSizeEmu,
|
|
7277
|
-
password
|
|
7223
|
+
password,
|
|
7224
|
+
imageExportScale
|
|
7278
7225
|
} = input;
|
|
7279
7226
|
const [exportModalOpen, setExportModalOpen] = react.useState(false);
|
|
7280
7227
|
const [exportModalTitle, setExportModalTitle] = react.useState("");
|
|
7281
7228
|
const [exportProgress, setExportProgress] = react.useState(0);
|
|
7282
7229
|
const [exportStatusMessage, setExportStatusMessage] = react.useState("");
|
|
7283
7230
|
const exportAbortRef = react.useRef(null);
|
|
7284
|
-
const modalControls = {
|
|
7285
|
-
setExportModalOpen,
|
|
7286
|
-
setExportModalTitle,
|
|
7287
|
-
setExportProgress,
|
|
7288
|
-
setExportStatusMessage,
|
|
7289
|
-
exportAbortRef
|
|
7290
|
-
};
|
|
7291
7231
|
const {
|
|
7292
7232
|
handleExportJson,
|
|
7293
|
-
handlePackageForSharing,
|
|
7294
7233
|
handleSaveAsFormat,
|
|
7295
7234
|
handleSaveAsPptx,
|
|
7296
7235
|
handleSaveAsPpsx,
|
|
@@ -7300,7 +7239,6 @@ function useExportHandlers(input) {
|
|
|
7300
7239
|
templateElementsBySlideId,
|
|
7301
7240
|
filePath,
|
|
7302
7241
|
handlerRef,
|
|
7303
|
-
serializeSlides,
|
|
7304
7242
|
headerFooter,
|
|
7305
7243
|
presentationProperties,
|
|
7306
7244
|
customShows,
|
|
@@ -7317,7 +7255,6 @@ function useExportHandlers(input) {
|
|
|
7317
7255
|
theme,
|
|
7318
7256
|
canvasSize,
|
|
7319
7257
|
slideSizeEmu,
|
|
7320
|
-
modalControls,
|
|
7321
7258
|
password
|
|
7322
7259
|
});
|
|
7323
7260
|
const handleExportPng = react.useCallback(async () => {
|
|
@@ -7327,12 +7264,13 @@ function useExportHandlers(input) {
|
|
|
7327
7264
|
}
|
|
7328
7265
|
try {
|
|
7329
7266
|
await exportSlideAsPng(stageEl, activeSlideIndex, {
|
|
7330
|
-
backgroundColor: activeSlide?.backgroundColor
|
|
7267
|
+
backgroundColor: activeSlide?.backgroundColor,
|
|
7268
|
+
scale: imageExportScale
|
|
7331
7269
|
});
|
|
7332
7270
|
} catch (err) {
|
|
7333
7271
|
console.error("[PowerPointViewer] PNG export failed:", err);
|
|
7334
7272
|
}
|
|
7335
|
-
}, [canvasStageRef, activeSlideIndex, activeSlide?.backgroundColor]);
|
|
7273
|
+
}, [canvasStageRef, activeSlideIndex, activeSlide?.backgroundColor, imageExportScale]);
|
|
7336
7274
|
const handleExportPdf = react.useCallback(async () => {
|
|
7337
7275
|
if (!canvasStageRef.current) {
|
|
7338
7276
|
return;
|
|
@@ -7351,30 +7289,30 @@ function useExportHandlers(input) {
|
|
|
7351
7289
|
activeSlideIndex,
|
|
7352
7290
|
"presentation.pdf",
|
|
7353
7291
|
{
|
|
7354
|
-
scale:
|
|
7292
|
+
scale: imageExportScale,
|
|
7355
7293
|
onProgress: (current, total) => {
|
|
7356
|
-
setExportProgress(
|
|
7357
|
-
setExportStatusMessage(
|
|
7294
|
+
setExportProgress(chunkHMZA25W2_js.slideProgressPercent(current, total));
|
|
7295
|
+
setExportStatusMessage(chunkHMZA25W2_js.slideStatusLabel("Rendering", current, total));
|
|
7358
7296
|
},
|
|
7359
7297
|
signal: abortCtrl.signal
|
|
7360
7298
|
}
|
|
7361
7299
|
);
|
|
7362
|
-
setExportProgress(
|
|
7300
|
+
setExportProgress(chunkHMZA25W2_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7363
7301
|
setExportStatusMessage("Building PDF...");
|
|
7364
7302
|
await new Promise((r) => {
|
|
7365
7303
|
setTimeout(r, 100);
|
|
7366
7304
|
});
|
|
7367
|
-
setExportProgress(
|
|
7305
|
+
setExportProgress(chunkHMZA25W2_js.EXPORT_DONE_PERCENT);
|
|
7368
7306
|
setExportStatusMessage("Done!");
|
|
7369
7307
|
} catch (err) {
|
|
7370
|
-
if (!
|
|
7308
|
+
if (!chunkHMZA25W2_js.isExportAbortError(err)) {
|
|
7371
7309
|
console.error("[PowerPointViewer] PDF export failed:", err);
|
|
7372
7310
|
}
|
|
7373
7311
|
} finally {
|
|
7374
7312
|
exportAbortRef.current = null;
|
|
7375
7313
|
setExportModalOpen(false);
|
|
7376
7314
|
}
|
|
7377
|
-
}, [canvasStageRef, slides.length, setActiveSlideIndex, activeSlideIndex]);
|
|
7315
|
+
}, [canvasStageRef, slides.length, setActiveSlideIndex, activeSlideIndex, imageExportScale]);
|
|
7378
7316
|
const handleExportNotesPdf = react.useCallback(async () => {
|
|
7379
7317
|
if (!canvasStageRef.current) {
|
|
7380
7318
|
return;
|
|
@@ -7395,30 +7333,30 @@ function useExportHandlers(input) {
|
|
|
7395
7333
|
slideNotes,
|
|
7396
7334
|
"presentation-notes.pdf",
|
|
7397
7335
|
{
|
|
7398
|
-
scale:
|
|
7336
|
+
scale: imageExportScale,
|
|
7399
7337
|
onProgress: (current, total) => {
|
|
7400
|
-
setExportProgress(
|
|
7401
|
-
setExportStatusMessage(
|
|
7338
|
+
setExportProgress(chunkHMZA25W2_js.slideProgressPercent(current, total));
|
|
7339
|
+
setExportStatusMessage(chunkHMZA25W2_js.slideStatusLabel("Rendering", current, total));
|
|
7402
7340
|
},
|
|
7403
7341
|
signal: abortCtrl.signal
|
|
7404
7342
|
}
|
|
7405
7343
|
);
|
|
7406
|
-
setExportProgress(
|
|
7344
|
+
setExportProgress(chunkHMZA25W2_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7407
7345
|
setExportStatusMessage("Building PDF...");
|
|
7408
7346
|
await new Promise((r) => {
|
|
7409
7347
|
setTimeout(r, 100);
|
|
7410
7348
|
});
|
|
7411
|
-
setExportProgress(
|
|
7349
|
+
setExportProgress(chunkHMZA25W2_js.EXPORT_DONE_PERCENT);
|
|
7412
7350
|
setExportStatusMessage("Done!");
|
|
7413
7351
|
} catch (err) {
|
|
7414
|
-
if (!
|
|
7352
|
+
if (!chunkHMZA25W2_js.isExportAbortError(err)) {
|
|
7415
7353
|
console.error("[PowerPointViewer] Notes PDF export failed:", err);
|
|
7416
7354
|
}
|
|
7417
7355
|
} finally {
|
|
7418
7356
|
exportAbortRef.current = null;
|
|
7419
7357
|
setExportModalOpen(false);
|
|
7420
7358
|
}
|
|
7421
|
-
}, [canvasStageRef, slides, setActiveSlideIndex, activeSlideIndex]);
|
|
7359
|
+
}, [canvasStageRef, slides, setActiveSlideIndex, activeSlideIndex, imageExportScale]);
|
|
7422
7360
|
const handleCopySlideAsImage = react.useCallback(async () => {
|
|
7423
7361
|
const stageEl = canvasStageRef.current;
|
|
7424
7362
|
if (!stageEl) {
|
|
@@ -7426,12 +7364,13 @@ function useExportHandlers(input) {
|
|
|
7426
7364
|
}
|
|
7427
7365
|
try {
|
|
7428
7366
|
await copySlideToClipboard(stageEl, {
|
|
7429
|
-
backgroundColor: activeSlide?.backgroundColor
|
|
7367
|
+
backgroundColor: activeSlide?.backgroundColor,
|
|
7368
|
+
scale: imageExportScale
|
|
7430
7369
|
});
|
|
7431
7370
|
} catch (err) {
|
|
7432
7371
|
console.error("[PowerPointViewer] Copy slide as image failed:", err);
|
|
7433
7372
|
}
|
|
7434
|
-
}, [canvasStageRef, activeSlide?.backgroundColor]);
|
|
7373
|
+
}, [canvasStageRef, activeSlide?.backgroundColor, imageExportScale]);
|
|
7435
7374
|
const handleExportVideo = react.useCallback(async () => {
|
|
7436
7375
|
if (!canvasStageRef.current) {
|
|
7437
7376
|
return;
|
|
@@ -7452,22 +7391,22 @@ function useExportHandlers(input) {
|
|
|
7452
7391
|
scale: 1,
|
|
7453
7392
|
slideDurationMs: 3e3,
|
|
7454
7393
|
onProgress: (current, total) => {
|
|
7455
|
-
setExportProgress(
|
|
7456
|
-
setExportStatusMessage(
|
|
7394
|
+
setExportProgress(chunkHMZA25W2_js.slideProgressPercent(current, total, 45));
|
|
7395
|
+
setExportStatusMessage(chunkHMZA25W2_js.slideStatusLabel("Capturing", current, total));
|
|
7457
7396
|
},
|
|
7458
7397
|
onRecordProgress: (current, total) => {
|
|
7459
|
-
setExportProgress(
|
|
7460
|
-
setExportStatusMessage(
|
|
7398
|
+
setExportProgress(chunkHMZA25W2_js.recordProgressPercent(current, total));
|
|
7399
|
+
setExportStatusMessage(chunkHMZA25W2_js.slideStatusLabel("Recording", current, total));
|
|
7461
7400
|
},
|
|
7462
7401
|
signal: abortCtrl.signal
|
|
7463
7402
|
}
|
|
7464
7403
|
);
|
|
7465
|
-
setExportProgress(
|
|
7404
|
+
setExportProgress(chunkHMZA25W2_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7466
7405
|
setExportStatusMessage("Saving file...");
|
|
7467
|
-
|
|
7468
|
-
setExportProgress(
|
|
7406
|
+
chunkHMZA25W2_js.downloadBlob(blob, "presentation.webm");
|
|
7407
|
+
setExportProgress(chunkHMZA25W2_js.EXPORT_DONE_PERCENT);
|
|
7469
7408
|
} catch (err) {
|
|
7470
|
-
if (!
|
|
7409
|
+
if (!chunkHMZA25W2_js.isExportAbortError(err)) {
|
|
7471
7410
|
console.error("[PowerPointViewer] Video export failed:", err);
|
|
7472
7411
|
}
|
|
7473
7412
|
} finally {
|
|
@@ -7495,18 +7434,18 @@ function useExportHandlers(input) {
|
|
|
7495
7434
|
scale: 0.5,
|
|
7496
7435
|
slideDurationMs: 2e3,
|
|
7497
7436
|
onProgress: (current, total) => {
|
|
7498
|
-
setExportProgress(
|
|
7499
|
-
setExportStatusMessage(
|
|
7437
|
+
setExportProgress(chunkHMZA25W2_js.slideProgressPercent(current, total));
|
|
7438
|
+
setExportStatusMessage(chunkHMZA25W2_js.slideStatusLabel("Encoding", current, total));
|
|
7500
7439
|
},
|
|
7501
7440
|
signal: abortCtrl.signal
|
|
7502
7441
|
}
|
|
7503
7442
|
);
|
|
7504
|
-
setExportProgress(
|
|
7443
|
+
setExportProgress(chunkHMZA25W2_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7505
7444
|
setExportStatusMessage("Saving file...");
|
|
7506
|
-
|
|
7507
|
-
setExportProgress(
|
|
7445
|
+
chunkHMZA25W2_js.downloadBlob(blob, "presentation.gif");
|
|
7446
|
+
setExportProgress(chunkHMZA25W2_js.EXPORT_DONE_PERCENT);
|
|
7508
7447
|
} catch (err) {
|
|
7509
|
-
if (!
|
|
7448
|
+
if (!chunkHMZA25W2_js.isExportAbortError(err)) {
|
|
7510
7449
|
console.error("[PowerPointViewer] GIF export failed:", err);
|
|
7511
7450
|
}
|
|
7512
7451
|
} finally {
|
|
@@ -7528,7 +7467,6 @@ function useExportHandlers(input) {
|
|
|
7528
7467
|
handleExportVideo,
|
|
7529
7468
|
handleExportGif,
|
|
7530
7469
|
handleExportJson,
|
|
7531
|
-
handlePackageForSharing,
|
|
7532
7470
|
handleSaveAsFormat,
|
|
7533
7471
|
handleSaveAsPptx,
|
|
7534
7472
|
handleSaveAsPpsx,
|
|
@@ -7540,95 +7478,96 @@ function useExportHandlers(input) {
|
|
|
7540
7478
|
exportStatusMessage
|
|
7541
7479
|
};
|
|
7542
7480
|
}
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
|
|
7546
|
-
return false;
|
|
7547
|
-
}
|
|
7548
|
-
printWindow.document.open();
|
|
7549
|
-
printWindow.document.write(
|
|
7550
|
-
chunkIDTNKL4S_js.buildPrintHtmlDocument({ title, bodyHtml, orientation, colorFilter, frameSlides })
|
|
7551
|
-
);
|
|
7552
|
-
printWindow.document.close();
|
|
7553
|
-
printWindow.focus();
|
|
7554
|
-
setTimeout(() => {
|
|
7555
|
-
printWindow.print();
|
|
7556
|
-
}, 300);
|
|
7557
|
-
return true;
|
|
7558
|
-
}
|
|
7559
|
-
function openPrintWindowWithDocument(htmlDocument) {
|
|
7560
|
-
const printWindow = window.open("", "_blank", "noopener,noreferrer");
|
|
7561
|
-
if (!printWindow) {
|
|
7562
|
-
return false;
|
|
7563
|
-
}
|
|
7564
|
-
printWindow.document.open();
|
|
7565
|
-
printWindow.document.write(htmlDocument);
|
|
7566
|
-
printWindow.document.close();
|
|
7567
|
-
printWindow.focus();
|
|
7568
|
-
setTimeout(() => {
|
|
7569
|
-
printWindow.print();
|
|
7570
|
-
}, 300);
|
|
7571
|
-
return true;
|
|
7481
|
+
var ViewerOptionsContext = react.createContext(chunkHMZA25W2_js.DEFAULT_VIEWER_OPTIONS);
|
|
7482
|
+
function useViewerOptionsContext() {
|
|
7483
|
+
return react.useContext(ViewerOptionsContext);
|
|
7572
7484
|
}
|
|
7485
|
+
|
|
7486
|
+
// src/viewer/hooks/usePrintHandlers.ts
|
|
7573
7487
|
function usePrintHandlers(input) {
|
|
7574
7488
|
const { slides, activeSlideIndex, canvasStageRef, setActiveSlideIndex, pptxData } = input;
|
|
7575
7489
|
const [isPrintDialogOpen, setIsPrintDialogOpen] = react.useState(false);
|
|
7490
|
+
const { t } = reactI18next.useTranslation();
|
|
7491
|
+
const viewerOptions = useViewerOptionsContext();
|
|
7492
|
+
const includeHiddenSlides = viewerOptions.advanced.printHiddenSlides;
|
|
7493
|
+
const printRasterScale = (viewerOptions.advanced.printHighQuality ? 4 : 3) * chunkHMZA25W2_js.resolveImageResolutionScale(viewerOptions);
|
|
7576
7494
|
const handlePrint = () => {
|
|
7577
7495
|
setIsPrintDialogOpen(true);
|
|
7578
7496
|
};
|
|
7579
7497
|
const handlePrintSvg = async (settings) => {
|
|
7580
7498
|
setIsPrintDialogOpen(false);
|
|
7499
|
+
const printWindow = chunkHMZA25W2_js.openPendingPrintWindow(t("pptx.print.preparingToPrint"));
|
|
7500
|
+
if (!printWindow) {
|
|
7501
|
+
console.warn(
|
|
7502
|
+
"[PowerPointViewer] Print window was blocked by the browser. Allow popups for this site to print."
|
|
7503
|
+
);
|
|
7504
|
+
return;
|
|
7505
|
+
}
|
|
7581
7506
|
if (!pptxData || settings.printWhat !== "slides") {
|
|
7582
|
-
return
|
|
7507
|
+
return runRasterPrint(printWindow, settings);
|
|
7583
7508
|
}
|
|
7584
|
-
const colorFilter =
|
|
7585
|
-
const slideIndices =
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7509
|
+
const colorFilter = chunkHMZA25W2_js.computeColorFilter(settings.colorMode);
|
|
7510
|
+
const slideIndices = chunkHMZA25W2_js.filterHiddenSlideIndices(
|
|
7511
|
+
chunkHMZA25W2_js.computeSlideIndices(
|
|
7512
|
+
settings.slideRange,
|
|
7513
|
+
activeSlideIndex,
|
|
7514
|
+
slides.length,
|
|
7515
|
+
settings.customRangeFrom,
|
|
7516
|
+
settings.customRangeTo
|
|
7517
|
+
),
|
|
7518
|
+
slides,
|
|
7519
|
+
includeHiddenSlides
|
|
7591
7520
|
);
|
|
7592
7521
|
try {
|
|
7593
7522
|
const svgs = exportAllSlidesToSvg(pptxData, {
|
|
7594
7523
|
slideIndices
|
|
7595
7524
|
});
|
|
7596
7525
|
if (svgs.length === 0) {
|
|
7526
|
+
printWindow.close();
|
|
7597
7527
|
return;
|
|
7598
7528
|
}
|
|
7599
|
-
const printDoc =
|
|
7529
|
+
const printDoc = chunkHMZA25W2_js.buildPrintDocument(svgs, pptxData.width, pptxData.height, {
|
|
7600
7530
|
title: "Slides (Vector)",
|
|
7601
7531
|
orientation: settings.orientation,
|
|
7602
|
-
colorFilter
|
|
7532
|
+
colorFilter,
|
|
7533
|
+
scaleToFit: settings.scaleToFit
|
|
7603
7534
|
});
|
|
7604
|
-
|
|
7535
|
+
chunkHMZA25W2_js.finishPrintWindow(printWindow, printDoc);
|
|
7605
7536
|
} catch (err) {
|
|
7606
7537
|
console.warn("[PowerPointViewer] SVG print path failed, falling back to raster:", err);
|
|
7607
|
-
return
|
|
7538
|
+
return runRasterPrint(printWindow, settings);
|
|
7608
7539
|
}
|
|
7609
7540
|
};
|
|
7610
|
-
const
|
|
7611
|
-
|
|
7612
|
-
const
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7541
|
+
const runRasterPrint = async (printWindow, settings) => {
|
|
7542
|
+
const colorFilter = chunkHMZA25W2_js.computeColorFilter(settings.colorMode);
|
|
7543
|
+
const slideIndices = chunkHMZA25W2_js.filterHiddenSlideIndices(
|
|
7544
|
+
chunkHMZA25W2_js.computeSlideIndices(
|
|
7545
|
+
settings.slideRange,
|
|
7546
|
+
activeSlideIndex,
|
|
7547
|
+
slides.length,
|
|
7548
|
+
settings.customRangeFrom,
|
|
7549
|
+
settings.customRangeTo
|
|
7550
|
+
),
|
|
7551
|
+
slides,
|
|
7552
|
+
includeHiddenSlides
|
|
7619
7553
|
);
|
|
7620
7554
|
if (settings.printWhat === "outline") {
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7555
|
+
chunkHMZA25W2_js.finishPrintWindow(
|
|
7556
|
+
printWindow,
|
|
7557
|
+
chunkHMZA25W2_js.buildPrintHtmlDocument({
|
|
7558
|
+
title: "Outline",
|
|
7559
|
+
bodyHtml: `<div class="outline-page">${chunkHMZA25W2_js.buildOutlineHtml(slideIndices, slides)}</div>`,
|
|
7560
|
+
orientation: settings.orientation,
|
|
7561
|
+
colorFilter,
|
|
7562
|
+
frameSlides: settings.frameSlides,
|
|
7563
|
+
scaleToFit: settings.scaleToFit
|
|
7564
|
+
})
|
|
7627
7565
|
);
|
|
7628
7566
|
return;
|
|
7629
7567
|
}
|
|
7630
7568
|
try {
|
|
7631
7569
|
if (!canvasStageRef.current) {
|
|
7570
|
+
printWindow.close();
|
|
7632
7571
|
return;
|
|
7633
7572
|
}
|
|
7634
7573
|
const allImages = await captureAllSlidesAsPngDataUrls(
|
|
@@ -7636,46 +7575,70 @@ function usePrintHandlers(input) {
|
|
|
7636
7575
|
slides.length,
|
|
7637
7576
|
setActiveSlideIndex,
|
|
7638
7577
|
activeSlideIndex,
|
|
7639
|
-
{ scale:
|
|
7578
|
+
{ scale: printRasterScale }
|
|
7640
7579
|
);
|
|
7641
7580
|
if (allImages.length === 0) {
|
|
7581
|
+
printWindow.close();
|
|
7642
7582
|
return;
|
|
7643
7583
|
}
|
|
7644
7584
|
const slideImages = slideIndices.map((idx) => allImages[idx]).filter(Boolean);
|
|
7645
7585
|
if (settings.printWhat === "slides") {
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
|
|
7586
|
+
chunkHMZA25W2_js.finishPrintWindow(
|
|
7587
|
+
printWindow,
|
|
7588
|
+
chunkHMZA25W2_js.buildPrintHtmlDocument({
|
|
7589
|
+
title: "Slides",
|
|
7590
|
+
bodyHtml: chunkHMZA25W2_js.buildSlidesHtml(slideImages, slideIndices),
|
|
7591
|
+
orientation: settings.orientation,
|
|
7592
|
+
colorFilter,
|
|
7593
|
+
frameSlides: settings.frameSlides,
|
|
7594
|
+
scaleToFit: settings.scaleToFit
|
|
7595
|
+
})
|
|
7652
7596
|
);
|
|
7653
7597
|
return;
|
|
7654
7598
|
}
|
|
7655
7599
|
if (settings.printWhat === "notes") {
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
|
|
7600
|
+
chunkHMZA25W2_js.finishPrintWindow(
|
|
7601
|
+
printWindow,
|
|
7602
|
+
chunkHMZA25W2_js.buildPrintHtmlDocument({
|
|
7603
|
+
title: "Notes Pages",
|
|
7604
|
+
bodyHtml: chunkHMZA25W2_js.buildNotesHtml(slideImages, slideIndices, slides),
|
|
7605
|
+
orientation: "portrait",
|
|
7606
|
+
colorFilter,
|
|
7607
|
+
frameSlides: settings.frameSlides,
|
|
7608
|
+
scaleToFit: settings.scaleToFit
|
|
7609
|
+
})
|
|
7662
7610
|
);
|
|
7663
7611
|
return;
|
|
7664
7612
|
}
|
|
7665
7613
|
if (settings.printWhat === "handouts") {
|
|
7666
7614
|
const spp = settings.slidesPerPage;
|
|
7667
|
-
|
|
7668
|
-
|
|
7669
|
-
|
|
7670
|
-
|
|
7671
|
-
|
|
7672
|
-
|
|
7615
|
+
chunkHMZA25W2_js.finishPrintWindow(
|
|
7616
|
+
printWindow,
|
|
7617
|
+
chunkHMZA25W2_js.buildPrintHtmlDocument({
|
|
7618
|
+
title: `Handout ${spp} per page`,
|
|
7619
|
+
bodyHtml: chunkHMZA25W2_js.buildHandoutsHtml(slideImages, slideIndices, spp),
|
|
7620
|
+
orientation: "portrait",
|
|
7621
|
+
colorFilter,
|
|
7622
|
+
frameSlides: settings.frameSlides,
|
|
7623
|
+
scaleToFit: settings.scaleToFit
|
|
7624
|
+
})
|
|
7673
7625
|
);
|
|
7674
7626
|
}
|
|
7675
7627
|
} catch (err) {
|
|
7676
7628
|
console.error("[PowerPointViewer] Print layout failed:", err);
|
|
7677
7629
|
}
|
|
7678
7630
|
};
|
|
7631
|
+
const handlePrintWithSettings = async (settings) => {
|
|
7632
|
+
setIsPrintDialogOpen(false);
|
|
7633
|
+
const printWindow = chunkHMZA25W2_js.openPendingPrintWindow(t("pptx.print.preparingToPrint"));
|
|
7634
|
+
if (!printWindow) {
|
|
7635
|
+
console.warn(
|
|
7636
|
+
"[PowerPointViewer] Print window was blocked by the browser. Allow popups for this site to print."
|
|
7637
|
+
);
|
|
7638
|
+
return;
|
|
7639
|
+
}
|
|
7640
|
+
return runRasterPrint(printWindow, settings);
|
|
7641
|
+
};
|
|
7679
7642
|
return {
|
|
7680
7643
|
handlePrint,
|
|
7681
7644
|
handlePrintWithSettings,
|
|
@@ -7730,8 +7693,8 @@ function useThemeHandlers(input) {
|
|
|
7730
7693
|
return;
|
|
7731
7694
|
}
|
|
7732
7695
|
await handler.updateThemeColorScheme(colorScheme);
|
|
7733
|
-
const previousMap = theme?.colorScheme ?
|
|
7734
|
-
setSlides((prev) =>
|
|
7696
|
+
const previousMap = theme?.colorScheme ? chunkHMZA25W2_js.buildThemeColorMap(theme.colorScheme) : {};
|
|
7697
|
+
setSlides((prev) => chunkHMZA25W2_js.reResolveSlideColors(prev, previousMap, colorScheme));
|
|
7735
7698
|
setTheme((prev) => prev ? { ...prev, colorScheme } : { colorScheme });
|
|
7736
7699
|
bumpHistory();
|
|
7737
7700
|
history.markDirty();
|
|
@@ -7836,7 +7799,7 @@ function useThemeSwitching(input) {
|
|
|
7836
7799
|
}
|
|
7837
7800
|
try {
|
|
7838
7801
|
await handler.applyTheme(preset.colorScheme, preset.fontScheme, preset.name);
|
|
7839
|
-
const newData =
|
|
7802
|
+
const newData = chunkHMZA25W2_js.applyThemeToData(data, preset.colorScheme, preset.fontScheme, preset.name);
|
|
7840
7803
|
onDataChange(newData);
|
|
7841
7804
|
onThemeChanged?.(preset);
|
|
7842
7805
|
} catch (error) {
|
|
@@ -7853,7 +7816,7 @@ function useThemeSwitching(input) {
|
|
|
7853
7816
|
}
|
|
7854
7817
|
try {
|
|
7855
7818
|
await handler.applyTheme(colorScheme, fontScheme ?? {}, themeName);
|
|
7856
|
-
const newData =
|
|
7819
|
+
const newData = chunkHMZA25W2_js.applyThemeToData(data, colorScheme, fontScheme, themeName);
|
|
7857
7820
|
onDataChange(newData);
|
|
7858
7821
|
} catch (error) {
|
|
7859
7822
|
console.error("Failed to switch to custom theme:", error);
|
|
@@ -7865,12 +7828,12 @@ function useThemeSwitching(input) {
|
|
|
7865
7828
|
if (!data?.theme?.colorScheme) {
|
|
7866
7829
|
return void 0;
|
|
7867
7830
|
}
|
|
7868
|
-
return
|
|
7869
|
-
(p) =>
|
|
7831
|
+
return chunkHMZA25W2_js.THEME_PRESETS.find(
|
|
7832
|
+
(p) => chunkHMZA25W2_js.themeColorSchemesEqual(data.theme?.colorScheme, p.colorScheme)
|
|
7870
7833
|
);
|
|
7871
7834
|
}, [data?.theme?.colorScheme]);
|
|
7872
7835
|
return {
|
|
7873
|
-
presets:
|
|
7836
|
+
presets: chunkHMZA25W2_js.THEME_PRESETS,
|
|
7874
7837
|
switchToPreset,
|
|
7875
7838
|
switchToCustom,
|
|
7876
7839
|
currentPreset
|
|
@@ -7945,7 +7908,7 @@ function usePropertyHandlers(input) {
|
|
|
7945
7908
|
}
|
|
7946
7909
|
try {
|
|
7947
7910
|
const ab = await file.arrayBuffer();
|
|
7948
|
-
const h = new
|
|
7911
|
+
const h = new chunkHMZA25W2_js.PptxHandler();
|
|
7949
7912
|
const other = await h.load(ab);
|
|
7950
7913
|
if (!other) {
|
|
7951
7914
|
return;
|
|
@@ -7955,7 +7918,7 @@ function usePropertyHandlers(input) {
|
|
|
7955
7918
|
width: canvasSize.width,
|
|
7956
7919
|
height: canvasSize.height
|
|
7957
7920
|
};
|
|
7958
|
-
setCompareResult(
|
|
7921
|
+
setCompareResult(chunkHMZA25W2_js.comparePresentation(cur, other));
|
|
7959
7922
|
setIsComparePanelOpen(true);
|
|
7960
7923
|
} catch (err) {
|
|
7961
7924
|
console.warn("Compare failed:", err);
|
|
@@ -7972,7 +7935,7 @@ function usePropertyHandlers(input) {
|
|
|
7972
7935
|
if (!diff || diff.status === "unchanged") {
|
|
7973
7936
|
return;
|
|
7974
7937
|
}
|
|
7975
|
-
setSlides((prev) =>
|
|
7938
|
+
setSlides((prev) => chunkHMZA25W2_js.applyAcceptSlide(prev, diff));
|
|
7976
7939
|
setIsDirty(true);
|
|
7977
7940
|
},
|
|
7978
7941
|
[compareResult, setSlides, setIsDirty]
|
|
@@ -7983,10 +7946,10 @@ function usePropertyHandlers(input) {
|
|
|
7983
7946
|
if (!compareResult) {
|
|
7984
7947
|
return;
|
|
7985
7948
|
}
|
|
7986
|
-
setSlides((prev) =>
|
|
7949
|
+
setSlides((prev) => chunkHMZA25W2_js.applyAcceptAllSlides(prev, compareResult));
|
|
7987
7950
|
setIsDirty(true);
|
|
7988
7951
|
}, [compareResult, setSlides, setIsDirty]);
|
|
7989
|
-
const usedFontFamilies = react.useMemo(() =>
|
|
7952
|
+
const usedFontFamilies = react.useMemo(() => chunkHMZA25W2_js.collectUsedFonts(slides), [slides]);
|
|
7990
7953
|
return {
|
|
7991
7954
|
handleUpdateNotes,
|
|
7992
7955
|
handleUpdateSlide,
|
|
@@ -8141,7 +8104,7 @@ function useViewerDialogs(input) {
|
|
|
8141
8104
|
);
|
|
8142
8105
|
const embeddedFontKey = (embeddedFontFamilies ?? []).join("\0");
|
|
8143
8106
|
const fontEmbedding = react.useMemo(
|
|
8144
|
-
() =>
|
|
8107
|
+
() => chunkHMZA25W2_js.describeFontEmbedding(embeddedFontKey ? embeddedFontKey.split("\0") : []),
|
|
8145
8108
|
[embeddedFontKey]
|
|
8146
8109
|
);
|
|
8147
8110
|
const [embedFontsEnabled, setEmbedFontsEnabled] = react.useState(fontEmbedding.initialEnabled);
|
|
@@ -8151,11 +8114,11 @@ function useViewerDialogs(input) {
|
|
|
8151
8114
|
setEmbedFontsEnabled(fontEmbedding.initialEnabled);
|
|
8152
8115
|
}
|
|
8153
8116
|
const [isNarrowViewport, setIsNarrowViewport] = react.useState(
|
|
8154
|
-
() => typeof window !== "undefined" ?
|
|
8117
|
+
() => typeof window !== "undefined" ? chunkHMZA25W2_js.isMobileViewport(window.innerWidth, window.innerHeight, viewportIsTouch()) : false
|
|
8155
8118
|
);
|
|
8156
8119
|
react.useEffect(() => {
|
|
8157
8120
|
const handleWindow = () => setIsNarrowViewport(
|
|
8158
|
-
|
|
8121
|
+
chunkHMZA25W2_js.isMobileViewport(window.innerWidth, window.innerHeight, viewportIsTouch())
|
|
8159
8122
|
);
|
|
8160
8123
|
window.addEventListener("resize", handleWindow);
|
|
8161
8124
|
return () => window.removeEventListener("resize", handleWindow);
|
|
@@ -8308,15 +8271,15 @@ function useViewerDialogs(input) {
|
|
|
8308
8271
|
};
|
|
8309
8272
|
}
|
|
8310
8273
|
function computeGridSpacingPx2(documentGridSpacing) {
|
|
8311
|
-
return
|
|
8274
|
+
return chunkHMZA25W2_js.computeGridSpacingPx(documentGridSpacing, chunkOABOL32L_js.GRID_SIZE);
|
|
8312
8275
|
}
|
|
8313
8276
|
function computeVisibleSlideIndexes(slides, activeCustomShowId, customShows) {
|
|
8314
8277
|
const activeShow = activeCustomShowId ? customShows.find((show) => show.id === activeCustomShowId) : void 0;
|
|
8315
|
-
return
|
|
8278
|
+
return chunkHMZA25W2_js.resolveShowSlideIndexes(slides, activeShow);
|
|
8316
8279
|
}
|
|
8317
8280
|
function computeSlideSectionGroups(slides, sections) {
|
|
8318
|
-
return
|
|
8319
|
-
id: group.section?.id ?? (sections.length > 0 ?
|
|
8281
|
+
return chunkHMZA25W2_js.groupSlidesBySection(sections, slides).map((group) => ({
|
|
8282
|
+
id: group.section?.id ?? (sections.length > 0 ? chunkOABOL32L_js.UNGROUPED_SECTION_ID : chunkOABOL32L_js.DEFAULT_SECTION_GROUP_ID),
|
|
8320
8283
|
label: group.section?.name ?? (sections.length > 0 ? "Ungrouped Slides" : "Slides"),
|
|
8321
8284
|
slideIndexes: group.slideIndexes,
|
|
8322
8285
|
...group.section?.color !== void 0 ? { color: group.section.color } : {},
|
|
@@ -8328,7 +8291,7 @@ function computeMasterPseudoSlide(mode, activeLayout, activeMaster) {
|
|
|
8328
8291
|
return void 0;
|
|
8329
8292
|
}
|
|
8330
8293
|
const document2 = activeLayout ? { slideMasters: [{ ...activeMaster, layouts: [activeLayout] }] } : { slideMasters: [activeMaster] };
|
|
8331
|
-
return
|
|
8294
|
+
return chunkHMZA25W2_js.masterViewPseudoSlide(document2, {
|
|
8332
8295
|
tab: "slides",
|
|
8333
8296
|
masterIndex: 0,
|
|
8334
8297
|
layoutIndex: activeLayout ? 0 : null
|
|
@@ -8356,10 +8319,10 @@ function useDerivedSlideState(input) {
|
|
|
8356
8319
|
);
|
|
8357
8320
|
const slideSectionGroups = react.useMemo(
|
|
8358
8321
|
() => computeSlideSectionGroups(slides, sections).map((group) => {
|
|
8359
|
-
if (group.id ===
|
|
8322
|
+
if (group.id === chunkOABOL32L_js.UNGROUPED_SECTION_ID && group.label === "Ungrouped Slides") {
|
|
8360
8323
|
return { ...group, label: t("pptx.slides.ungroupedSlides") };
|
|
8361
8324
|
}
|
|
8362
|
-
if (group.id ===
|
|
8325
|
+
if (group.id === chunkOABOL32L_js.DEFAULT_SECTION_GROUP_ID && group.label === "Slides") {
|
|
8363
8326
|
return { ...group, label: t("pptx.sections.slides") };
|
|
8364
8327
|
}
|
|
8365
8328
|
return group;
|
|
@@ -8459,34 +8422,28 @@ function useAnnotationHandlers(input) {
|
|
|
8459
8422
|
}, [annotations, setMode, setSlides, history]);
|
|
8460
8423
|
const handleSetMode = react.useCallback(
|
|
8461
8424
|
(nextMode) => {
|
|
8462
|
-
if (mode === "present" && nextMode !== "present" && !
|
|
8425
|
+
if (mode === "present" && nextMode !== "present" && !chunkHMZA25W2_js.mayLeaveSlideShow()) {
|
|
8463
8426
|
return;
|
|
8464
8427
|
}
|
|
8465
8428
|
if (nextMode === "present") {
|
|
8466
8429
|
presentation.enterPresentMode();
|
|
8467
8430
|
} else if (mode === "present" && annotations.hasAnyAnnotations) {
|
|
8468
|
-
|
|
8469
|
-
pendingModeAfterAnnotationsRef.current = nextMode;
|
|
8431
|
+
chunkHMZA25W2_js.stopAllPersistentAudio();
|
|
8470
8432
|
if (promptKeepInkAnnotations) {
|
|
8433
|
+
pendingModeAfterAnnotationsRef.current = nextMode;
|
|
8471
8434
|
setShowKeepAnnotationsDialog(true);
|
|
8472
8435
|
} else {
|
|
8473
|
-
|
|
8436
|
+
annotations.clearAllAnnotations();
|
|
8437
|
+
setMode(nextMode);
|
|
8474
8438
|
}
|
|
8475
8439
|
} else {
|
|
8476
8440
|
if (mode === "present") {
|
|
8477
|
-
|
|
8441
|
+
chunkHMZA25W2_js.stopAllPersistentAudio();
|
|
8478
8442
|
}
|
|
8479
8443
|
setMode(nextMode);
|
|
8480
8444
|
}
|
|
8481
8445
|
},
|
|
8482
|
-
[
|
|
8483
|
-
presentation,
|
|
8484
|
-
mode,
|
|
8485
|
-
annotations.hasAnyAnnotations,
|
|
8486
|
-
promptKeepInkAnnotations,
|
|
8487
|
-
handleKeepAnnotations,
|
|
8488
|
-
setMode
|
|
8489
|
-
]
|
|
8446
|
+
[presentation, mode, annotations, promptKeepInkAnnotations, setMode]
|
|
8490
8447
|
);
|
|
8491
8448
|
const handleDiscardAnnotations = react.useCallback(() => {
|
|
8492
8449
|
annotations.clearAllAnnotations();
|
|
@@ -8545,13 +8502,13 @@ function useSerialize(input) {
|
|
|
8545
8502
|
let processedSlide = slide;
|
|
8546
8503
|
if (pendingEditId) {
|
|
8547
8504
|
const updatedElements = slide.elements.map((el) => {
|
|
8548
|
-
if (el.id !== pendingEditId || !
|
|
8505
|
+
if (el.id !== pendingEditId || !chunkHMZA25W2_js.hasTextProperties(el)) {
|
|
8549
8506
|
return el;
|
|
8550
8507
|
}
|
|
8551
8508
|
return {
|
|
8552
8509
|
...el,
|
|
8553
8510
|
text: pendingEditText,
|
|
8554
|
-
textSegments:
|
|
8511
|
+
textSegments: chunkHMZA25W2_js.remapTextToSegments(pendingEditText, el.textSegments, el.textStyle)
|
|
8555
8512
|
};
|
|
8556
8513
|
});
|
|
8557
8514
|
if (updatedElements.some((el, i) => el !== slide.elements[i])) {
|
|
@@ -8564,19 +8521,19 @@ function useSerialize(input) {
|
|
|
8564
8521
|
const pptxGuides = guides.map((g) => ({
|
|
8565
8522
|
id: g.id,
|
|
8566
8523
|
orientation: g.axis === "h" ? "horz" : "vert",
|
|
8567
|
-
positionEmu:
|
|
8524
|
+
positionEmu: chunkHMZA25W2_js.guidePxToEmu(g.position)
|
|
8568
8525
|
}));
|
|
8569
8526
|
return {
|
|
8570
8527
|
...processedSlide,
|
|
8571
8528
|
guides: pptxGuides.length > 0 ? pptxGuides : void 0
|
|
8572
8529
|
};
|
|
8573
8530
|
});
|
|
8574
|
-
const slidesToSave =
|
|
8531
|
+
const slidesToSave = chunkHMZA25W2_js.buildSaveSlides(slidesWithGuides, templateElementsBySlideId);
|
|
8575
8532
|
const saveOptions = {
|
|
8576
8533
|
// Without this the Slide Size card edited a viewer-only pixel value and
|
|
8577
8534
|
// the saved `p:sldSz` never moved: passing `slideSize` is the only way a
|
|
8578
8535
|
// slide-size edit reaches the file.
|
|
8579
|
-
slideSize:
|
|
8536
|
+
slideSize: chunkHMZA25W2_js.resolveSlideSizeSelection({ current: slideSizeEmu, canvas: canvasSize }).size,
|
|
8580
8537
|
headerFooter,
|
|
8581
8538
|
presentationProperties,
|
|
8582
8539
|
customShows: customShows.length > 0 ? customShows : void 0,
|
|
@@ -8588,9 +8545,9 @@ function useSerialize(input) {
|
|
|
8588
8545
|
slideMasters,
|
|
8589
8546
|
notesMaster,
|
|
8590
8547
|
handoutMaster,
|
|
8591
|
-
...
|
|
8548
|
+
...chunkHMZA25W2_js.embeddedFontSaveOptions(embedFonts)
|
|
8592
8549
|
};
|
|
8593
|
-
return
|
|
8550
|
+
return chunkHMZA25W2_js.saveDeckWithPassword(handler, slidesToSave, saveOptions, { password, purpose });
|
|
8594
8551
|
}, [
|
|
8595
8552
|
slides,
|
|
8596
8553
|
templateElementsBySlideId,
|
|
@@ -8625,7 +8582,7 @@ function useRecoveryDetection(input) {
|
|
|
8625
8582
|
const onRestore = input.onRestore;
|
|
8626
8583
|
const openVersionHistory = input.openVersionHistory;
|
|
8627
8584
|
react.useEffect(() => {
|
|
8628
|
-
if (!
|
|
8585
|
+
if (!chunkHMZA25W2_js.shouldProbeAutosaveRecovery({
|
|
8629
8586
|
alreadyChecked: recoveryCheckedRef.current,
|
|
8630
8587
|
filePath,
|
|
8631
8588
|
loading,
|
|
@@ -8637,7 +8594,7 @@ function useRecoveryDetection(input) {
|
|
|
8637
8594
|
}
|
|
8638
8595
|
recoveryCheckedRef.current = true;
|
|
8639
8596
|
void (async () => {
|
|
8640
|
-
const offer = await
|
|
8597
|
+
const offer = await chunkHMZA25W2_js.probeAutosaveRecovery(filePath);
|
|
8641
8598
|
if (!offer) {
|
|
8642
8599
|
return;
|
|
8643
8600
|
}
|
|
@@ -8650,7 +8607,7 @@ function useRecoveryDetection(input) {
|
|
|
8650
8607
|
const record = recordRef.current;
|
|
8651
8608
|
setPrompt(null);
|
|
8652
8609
|
if (record && onRestore) {
|
|
8653
|
-
onRestore(
|
|
8610
|
+
onRestore(chunkHMZA25W2_js.acceptAutosaveRecovery(record));
|
|
8654
8611
|
}
|
|
8655
8612
|
recordRef.current = null;
|
|
8656
8613
|
}, [onRestore]);
|
|
@@ -8659,7 +8616,7 @@ function useRecoveryDetection(input) {
|
|
|
8659
8616
|
setPrompt(null);
|
|
8660
8617
|
recordRef.current = null;
|
|
8661
8618
|
if (record) {
|
|
8662
|
-
void
|
|
8619
|
+
void chunkHMZA25W2_js.discardAutosaveRecovery(record);
|
|
8663
8620
|
}
|
|
8664
8621
|
}, []);
|
|
8665
8622
|
return { prompt, restore, discard };
|
|
@@ -8684,8 +8641,7 @@ function usePresentationSetup(input) {
|
|
|
8684
8641
|
onToggleSubtitles
|
|
8685
8642
|
} = input;
|
|
8686
8643
|
const actionSoundHandlerRef = react.useRef(null);
|
|
8687
|
-
const
|
|
8688
|
-
const pendingModeRef = react.useRef("edit");
|
|
8644
|
+
const exitModeHandlerRef = react.useRef(null);
|
|
8689
8645
|
const annotations = usePresentationAnnotations({
|
|
8690
8646
|
isActive: mode === "present",
|
|
8691
8647
|
activeSlideIndex,
|
|
@@ -8699,19 +8655,22 @@ function usePresentationSetup(input) {
|
|
|
8699
8655
|
containerRef,
|
|
8700
8656
|
content,
|
|
8701
8657
|
onSetMode: (nextMode) => {
|
|
8702
|
-
if (mode === "present" && nextMode !== "present" && !
|
|
8658
|
+
if (mode === "present" && nextMode !== "present" && !chunkHMZA25W2_js.mayLeaveSlideShow()) {
|
|
8703
8659
|
return;
|
|
8704
8660
|
}
|
|
8705
|
-
if (mode === "present" && nextMode !== "present"
|
|
8706
|
-
|
|
8707
|
-
|
|
8708
|
-
|
|
8709
|
-
if (
|
|
8710
|
-
|
|
8711
|
-
|
|
8661
|
+
if (mode === "present" && nextMode !== "present") {
|
|
8662
|
+
chunkHMZA25W2_js.stopAllPersistentAudio();
|
|
8663
|
+
stopAnimationSound();
|
|
8664
|
+
const exitHandler = exitModeHandlerRef.current;
|
|
8665
|
+
if (exitHandler) {
|
|
8666
|
+
exitHandler(nextMode);
|
|
8667
|
+
return;
|
|
8668
|
+
}
|
|
8669
|
+
if (annotations.hasAnyAnnotations && !promptKeepInkAnnotations) {
|
|
8670
|
+
annotations.clearAllAnnotations();
|
|
8712
8671
|
}
|
|
8713
|
-
setMode(nextMode);
|
|
8714
8672
|
}
|
|
8673
|
+
setMode(nextMode);
|
|
8715
8674
|
},
|
|
8716
8675
|
onSetActiveSlideIndex: setActiveSlideIndex,
|
|
8717
8676
|
onPlayActionSound: (soundPath, options) => {
|
|
@@ -8762,15 +8721,22 @@ function usePresentationSetup(input) {
|
|
|
8762
8721
|
onToggleToolbar: () => annotations.setToolbarVisible(!annotations.toolbarVisible),
|
|
8763
8722
|
onToggleSubtitles,
|
|
8764
8723
|
onSaveRehearsalTimings: (timings) => {
|
|
8765
|
-
setSlides((prev) =>
|
|
8724
|
+
setSlides((prev) => chunkHMZA25W2_js.applyRehearsalTimings(prev, timings));
|
|
8766
8725
|
history.markDirty();
|
|
8767
8726
|
},
|
|
8768
|
-
loopContinuously:
|
|
8727
|
+
loopContinuously: chunkHMZA25W2_js.shouldLoopContinuously(presentationProperties),
|
|
8769
8728
|
showWithAnimation: presentationProperties.showWithAnimation,
|
|
8770
8729
|
useTimings: presentationProperties.advanceMode !== "manual",
|
|
8771
8730
|
endWithBlackSlide
|
|
8772
8731
|
});
|
|
8773
|
-
return {
|
|
8732
|
+
return {
|
|
8733
|
+
presentation,
|
|
8734
|
+
annotations,
|
|
8735
|
+
actionSoundHandlerRef,
|
|
8736
|
+
setExitModeHandler: (handler) => {
|
|
8737
|
+
exitModeHandlerRef.current = handler;
|
|
8738
|
+
}
|
|
8739
|
+
};
|
|
8774
8740
|
}
|
|
8775
8741
|
function useEditorOperations(input) {
|
|
8776
8742
|
const {
|
|
@@ -8934,7 +8900,8 @@ function useEditorOperations(input) {
|
|
|
8934
8900
|
tableEditorState: state.tableEditorState,
|
|
8935
8901
|
setTableEditorState: state.setTableEditorState,
|
|
8936
8902
|
ops,
|
|
8937
|
-
history
|
|
8903
|
+
history,
|
|
8904
|
+
transformCommittedText
|
|
8938
8905
|
});
|
|
8939
8906
|
const combinedUpdateTextStyle = react.useCallback(
|
|
8940
8907
|
(updates) => {
|
|
@@ -8958,7 +8925,7 @@ function useEditorOperations(input) {
|
|
|
8958
8925
|
const { formatPainterActive, setFormatPainterActive, elementLookup } = state;
|
|
8959
8926
|
react.useEffect(() => {
|
|
8960
8927
|
if (formatPainterActive && !prevFormatPainterRef.current && selectedElement) {
|
|
8961
|
-
copiedFormatRef.current =
|
|
8928
|
+
copiedFormatRef.current = chunkHMZA25W2_js.copyFormatFromElement(selectedElement);
|
|
8962
8929
|
} else if (!formatPainterActive) {
|
|
8963
8930
|
copiedFormatRef.current = null;
|
|
8964
8931
|
}
|
|
@@ -8984,12 +8951,12 @@ function useEditorOperations(input) {
|
|
|
8984
8951
|
e.stopPropagation();
|
|
8985
8952
|
const element = elementLookup.get(elementId);
|
|
8986
8953
|
if (element) {
|
|
8987
|
-
const updated =
|
|
8954
|
+
const updated = chunkHMZA25W2_js.applyFormatToElement(element, copiedFormatRef.current);
|
|
8988
8955
|
const updates = {};
|
|
8989
|
-
if (
|
|
8956
|
+
if (chunkHMZA25W2_js.hasShapeProperties(updated)) {
|
|
8990
8957
|
updates.shapeStyle = updated.shapeStyle;
|
|
8991
8958
|
}
|
|
8992
|
-
if (
|
|
8959
|
+
if (chunkHMZA25W2_js.hasTextProperties(updated)) {
|
|
8993
8960
|
updates.textStyle = updated.textStyle;
|
|
8994
8961
|
}
|
|
8995
8962
|
ops.updateElementById(elementId, updates);
|
|
@@ -9036,11 +9003,11 @@ function useIOHandlers(input) {
|
|
|
9036
9003
|
ops,
|
|
9037
9004
|
zoom,
|
|
9038
9005
|
handlerRef,
|
|
9039
|
-
serializeSlides,
|
|
9040
9006
|
serializeForRecovery,
|
|
9041
9007
|
setContent,
|
|
9042
9008
|
onContentChange,
|
|
9043
|
-
password
|
|
9009
|
+
password,
|
|
9010
|
+
imageExportScale
|
|
9044
9011
|
} = input;
|
|
9045
9012
|
const exportHandlers = useExportHandlers({
|
|
9046
9013
|
slides,
|
|
@@ -9051,7 +9018,6 @@ function useIOHandlers(input) {
|
|
|
9051
9018
|
canvasStageRef: zoom.canvasStageRef,
|
|
9052
9019
|
setActiveSlideIndex: state.setActiveSlideIndex,
|
|
9053
9020
|
handlerRef,
|
|
9054
|
-
serializeSlides,
|
|
9055
9021
|
headerFooter: state.headerFooter,
|
|
9056
9022
|
presentationProperties: state.presentationProperties,
|
|
9057
9023
|
customShows: state.customShows,
|
|
@@ -9068,7 +9034,8 @@ function useIOHandlers(input) {
|
|
|
9068
9034
|
theme: state.theme,
|
|
9069
9035
|
canvasSize,
|
|
9070
9036
|
slideSizeEmu: state.slideSizeEmu,
|
|
9071
|
-
password
|
|
9037
|
+
password,
|
|
9038
|
+
imageExportScale
|
|
9072
9039
|
});
|
|
9073
9040
|
const printHandlers = usePrintHandlers({
|
|
9074
9041
|
slides,
|
|
@@ -9143,7 +9110,7 @@ function collectReferencedFontFamilies(slides) {
|
|
|
9143
9110
|
const families = /* @__PURE__ */ new Set();
|
|
9144
9111
|
for (const slide of slides) {
|
|
9145
9112
|
for (const el of slide.elements) {
|
|
9146
|
-
if (
|
|
9113
|
+
if (chunkHMZA25W2_js.hasTextProperties(el) && el.textSegments) {
|
|
9147
9114
|
for (const seg of el.textSegments) {
|
|
9148
9115
|
if (seg.style.fontFamily) {
|
|
9149
9116
|
families.add(seg.style.fontFamily);
|
|
@@ -9282,7 +9249,8 @@ function useContentLifecycle(input) {
|
|
|
9282
9249
|
actionSoundHandlerRef,
|
|
9283
9250
|
setIsEncryptedDialogOpen,
|
|
9284
9251
|
password,
|
|
9285
|
-
onContentApplied
|
|
9252
|
+
onContentApplied,
|
|
9253
|
+
allowExternalImages
|
|
9286
9254
|
} = input;
|
|
9287
9255
|
const { handlerRef } = useLoadContent({
|
|
9288
9256
|
content,
|
|
@@ -9321,7 +9289,8 @@ function useContentLifecycle(input) {
|
|
|
9321
9289
|
setError: state.setError,
|
|
9322
9290
|
setIsDirty: state.setIsDirty,
|
|
9323
9291
|
setIsEncrypted: setIsEncryptedDialogOpen,
|
|
9324
|
-
onContentApplied
|
|
9292
|
+
onContentApplied,
|
|
9293
|
+
allowExternalImages
|
|
9325
9294
|
});
|
|
9326
9295
|
react.useEffect(() => {
|
|
9327
9296
|
actionSoundHandlerRef.current = handlerRef.current;
|
|
@@ -9391,7 +9360,7 @@ function useKeyboardShortcuts(input) {
|
|
|
9391
9360
|
inputRef.current = input;
|
|
9392
9361
|
const handleKeyDown = react.useCallback((e) => {
|
|
9393
9362
|
const current = inputRef.current;
|
|
9394
|
-
const { action, dx, dy } =
|
|
9363
|
+
const { action, dx, dy } = chunkHMZA25W2_js.mapEditorKey(e, {
|
|
9395
9364
|
canEdit: current.canEdit,
|
|
9396
9365
|
// The Slide Master view is an editing surface, not a viewing one.
|
|
9397
9366
|
// Gating on `mode !== 'edit'` alone made `mapEditorKey` return
|
|
@@ -9404,7 +9373,7 @@ function useKeyboardShortcuts(input) {
|
|
|
9404
9373
|
hasSelection: current.hasSelection,
|
|
9405
9374
|
isEditingText: Boolean(current.inlineEditingElementId || current.tableEditorState?.isEditing),
|
|
9406
9375
|
isDrawing: current.activeTool !== "select",
|
|
9407
|
-
isTextInputTarget:
|
|
9376
|
+
isTextInputTarget: chunkHMZA25W2_js.isEditorTextInputTarget(e.target)
|
|
9408
9377
|
});
|
|
9409
9378
|
if (action === null) {
|
|
9410
9379
|
return;
|
|
@@ -9560,7 +9529,10 @@ function useViewerIntegration(input) {
|
|
|
9560
9529
|
autosaveEnabled,
|
|
9561
9530
|
autosaveAllowed = true,
|
|
9562
9531
|
autosaveIntervalMs,
|
|
9532
|
+
allowExternalImages,
|
|
9563
9533
|
canEdit,
|
|
9534
|
+
promptKeepInkAnnotations,
|
|
9535
|
+
imageExportScale,
|
|
9564
9536
|
mode,
|
|
9565
9537
|
slides,
|
|
9566
9538
|
activeSlide,
|
|
@@ -9625,7 +9597,8 @@ function useViewerIntegration(input) {
|
|
|
9625
9597
|
actionSoundHandlerRef,
|
|
9626
9598
|
setIsEncryptedDialogOpen,
|
|
9627
9599
|
password: dialogs.presentationPassword ?? void 0,
|
|
9628
|
-
onContentApplied: () => setLoadVersion((v) => v + 1)
|
|
9600
|
+
onContentApplied: () => setLoadVersion((v) => v + 1),
|
|
9601
|
+
allowExternalImages
|
|
9629
9602
|
}
|
|
9630
9603
|
);
|
|
9631
9604
|
const { exportHandlers, printHandlers, themeHandlers, propertyHandlers } = useIOHandlers({
|
|
@@ -9638,11 +9611,11 @@ function useViewerIntegration(input) {
|
|
|
9638
9611
|
ops: editorOps.ops,
|
|
9639
9612
|
zoom,
|
|
9640
9613
|
handlerRef,
|
|
9641
|
-
serializeSlides,
|
|
9642
9614
|
serializeForRecovery,
|
|
9643
9615
|
setContent,
|
|
9644
9616
|
onContentChange,
|
|
9645
|
-
password: dialogs.presentationPassword ?? void 0
|
|
9617
|
+
password: dialogs.presentationPassword ?? void 0,
|
|
9618
|
+
imageExportScale
|
|
9646
9619
|
});
|
|
9647
9620
|
const {
|
|
9648
9621
|
showKeepAnnotationsDialog,
|
|
@@ -9657,7 +9630,8 @@ function useViewerIntegration(input) {
|
|
|
9657
9630
|
annotations,
|
|
9658
9631
|
history,
|
|
9659
9632
|
setMode: state.setMode,
|
|
9660
|
-
setSlides: state.setSlides
|
|
9633
|
+
setSlides: state.setSlides,
|
|
9634
|
+
promptKeepInkAnnotations
|
|
9661
9635
|
});
|
|
9662
9636
|
const recovery = useRecoveryDetection({
|
|
9663
9637
|
filePath,
|
|
@@ -9710,7 +9684,7 @@ function useViewerIntegration(input) {
|
|
|
9710
9684
|
return zoom.scale;
|
|
9711
9685
|
},
|
|
9712
9686
|
setZoom(level) {
|
|
9713
|
-
zoom.setScale(
|
|
9687
|
+
zoom.setScale(chunkHMZA25W2_js.clampZoomScale(level));
|
|
9714
9688
|
},
|
|
9715
9689
|
zoomIn() {
|
|
9716
9690
|
zoom.handleZoomIn();
|
|
@@ -9926,7 +9900,7 @@ function useReducedMotion() {
|
|
|
9926
9900
|
}
|
|
9927
9901
|
function useViewerOptions() {
|
|
9928
9902
|
const storeRef = react.useRef(null);
|
|
9929
|
-
storeRef.current ??=
|
|
9903
|
+
storeRef.current ??= chunkHMZA25W2_js.createViewerOptionsStore();
|
|
9930
9904
|
const store = storeRef.current;
|
|
9931
9905
|
const options = react.useSyncExternalStore(
|
|
9932
9906
|
(onStoreChange) => store.subscribe(onStoreChange),
|
|
@@ -9935,14 +9909,20 @@ function useViewerOptions() {
|
|
|
9935
9909
|
);
|
|
9936
9910
|
return { optionsStore: store, options };
|
|
9937
9911
|
}
|
|
9938
|
-
var KNOWN_TAB_IDS = new Set(
|
|
9939
|
-
function computeToolbarVisibility(hiddenActions) {
|
|
9940
|
-
const isHidden = (id) =>
|
|
9941
|
-
const
|
|
9912
|
+
var KNOWN_TAB_IDS = new Set(chunkHMZA25W2_js.TOOLBAR_TABS.map((tab) => tab.id));
|
|
9913
|
+
function computeToolbarVisibility(hiddenActions, hiddenTabIds = []) {
|
|
9914
|
+
const isHidden = (id) => chunkHMZA25W2_js.isActionHidden(id, hiddenActions);
|
|
9915
|
+
const userHidden = new Set(hiddenTabIds);
|
|
9916
|
+
userHidden.delete("file");
|
|
9917
|
+
const isTabVisible = (id) => !KNOWN_TAB_IDS.has(id) || !isHidden(id) && !userHidden.has(id);
|
|
9942
9918
|
return { isHidden, isTabVisible };
|
|
9943
9919
|
}
|
|
9944
9920
|
function useToolbarVisibility(hiddenActions) {
|
|
9945
|
-
|
|
9921
|
+
const hiddenTabIds = useViewerOptionsContext().ribbon.hiddenTabIds;
|
|
9922
|
+
return react.useMemo(
|
|
9923
|
+
() => computeToolbarVisibility(hiddenActions, hiddenTabIds),
|
|
9924
|
+
[hiddenActions, hiddenTabIds]
|
|
9925
|
+
);
|
|
9946
9926
|
}
|
|
9947
9927
|
function useCollaborativeHistory({
|
|
9948
9928
|
localClientId: _localClientId,
|
|
@@ -10023,12 +10003,12 @@ function useYjsDocumentSync({
|
|
|
10023
10003
|
return;
|
|
10024
10004
|
}
|
|
10025
10005
|
try {
|
|
10026
|
-
const handler = new
|
|
10006
|
+
const handler = new chunkHMZA25W2_js.PptxHandler();
|
|
10027
10007
|
await handler.load(sourceBytes.buffer);
|
|
10028
|
-
const currentSlides =
|
|
10008
|
+
const currentSlides = chunkHMZA25W2_js.readSlidesFromYDoc(
|
|
10029
10009
|
doc
|
|
10030
10010
|
);
|
|
10031
|
-
const slidesToSave =
|
|
10011
|
+
const slidesToSave = chunkHMZA25W2_js.buildSaveSlides(currentSlides, templateElementsBySlideId);
|
|
10032
10012
|
const bytes = await handler.save(slidesToSave);
|
|
10033
10013
|
config.onWriteBack(bytes);
|
|
10034
10014
|
} catch {
|
|
@@ -10043,10 +10023,10 @@ function useYjsDocumentSync({
|
|
|
10043
10023
|
if (!doc || !isConnected) {
|
|
10044
10024
|
return;
|
|
10045
10025
|
}
|
|
10046
|
-
const docSlides =
|
|
10026
|
+
const docSlides = chunkHMZA25W2_js.readSlidesFromYDoc(
|
|
10047
10027
|
doc
|
|
10048
10028
|
);
|
|
10049
|
-
if (!
|
|
10029
|
+
if (!chunkHMZA25W2_js.shouldRoomSlidesReplaceLoad(loadOrigin, docSlides.length)) {
|
|
10050
10030
|
return;
|
|
10051
10031
|
}
|
|
10052
10032
|
lastSyncedRef.current = JSON.stringify(docSlides);
|
|
@@ -10065,11 +10045,11 @@ function useYjsDocumentSync({
|
|
|
10065
10045
|
lastSyncedRef.current = serialized;
|
|
10066
10046
|
void (async () => {
|
|
10067
10047
|
const factories = await getFactories();
|
|
10068
|
-
|
|
10048
|
+
chunkHMZA25W2_js.reconcileSlidesInYDoc(
|
|
10069
10049
|
slides,
|
|
10070
10050
|
doc,
|
|
10071
10051
|
factories,
|
|
10072
|
-
|
|
10052
|
+
chunkHMZA25W2_js.LOCAL_SYNC_ORIGIN
|
|
10073
10053
|
);
|
|
10074
10054
|
scheduleWriteBack();
|
|
10075
10055
|
})();
|
|
@@ -10083,10 +10063,10 @@ function useYjsDocumentSync({
|
|
|
10083
10063
|
return;
|
|
10084
10064
|
}
|
|
10085
10065
|
const handleChange = (_events, transaction) => {
|
|
10086
|
-
if (transaction?.origin ===
|
|
10066
|
+
if (transaction?.origin === chunkHMZA25W2_js.LOCAL_SYNC_ORIGIN) {
|
|
10087
10067
|
return;
|
|
10088
10068
|
}
|
|
10089
|
-
const remoteSlides =
|
|
10069
|
+
const remoteSlides = chunkHMZA25W2_js.readSlidesFromYDoc(
|
|
10090
10070
|
doc
|
|
10091
10071
|
);
|
|
10092
10072
|
if (remoteSlides.length === 0) {
|
|
@@ -10102,7 +10082,7 @@ function useYjsDocumentSync({
|
|
|
10102
10082
|
isApplyingRemoteRef.current = false;
|
|
10103
10083
|
scheduleWriteBack();
|
|
10104
10084
|
};
|
|
10105
|
-
const unobserve =
|
|
10085
|
+
const unobserve = chunkHMZA25W2_js.observeYDocSlides(
|
|
10106
10086
|
doc,
|
|
10107
10087
|
handleChange
|
|
10108
10088
|
);
|
|
@@ -10140,7 +10120,7 @@ function useBroadcastFollower({
|
|
|
10140
10120
|
if (!broadcaster) {
|
|
10141
10121
|
return;
|
|
10142
10122
|
}
|
|
10143
|
-
if (!
|
|
10123
|
+
if (!chunkHMZA25W2_js.shouldAutoFollowBroadcaster({
|
|
10144
10124
|
localRole: collab.config.role,
|
|
10145
10125
|
broadcasterRole: broadcaster.role
|
|
10146
10126
|
})) {
|
|
@@ -10311,7 +10291,7 @@ function subscribeTouchCapability(callback) {
|
|
|
10311
10291
|
function useIsMobile() {
|
|
10312
10292
|
const isTouchDevice = react.useSyncExternalStore(
|
|
10313
10293
|
subscribeTouchCapability,
|
|
10314
|
-
|
|
10294
|
+
chunkHMZA25W2_js.detectTouchDevice,
|
|
10315
10295
|
() => false
|
|
10316
10296
|
// server snapshot
|
|
10317
10297
|
);
|
|
@@ -10321,7 +10301,7 @@ function useIsMobile() {
|
|
|
10321
10301
|
const [viewportHeight, setViewportHeight] = react.useState(
|
|
10322
10302
|
() => typeof window === "undefined" ? 768 : window.innerHeight
|
|
10323
10303
|
);
|
|
10324
|
-
const [orientation, setOrientation] = react.useState(
|
|
10304
|
+
const [orientation, setOrientation] = react.useState(chunkHMZA25W2_js.detectOrientation);
|
|
10325
10305
|
const [isVirtualKeyboardOpen, setIsVirtualKeyboardOpen] = react.useState(false);
|
|
10326
10306
|
const [initialViewportHeight] = react.useState(
|
|
10327
10307
|
() => typeof window !== "undefined" ? window.innerHeight : 800
|
|
@@ -10342,7 +10322,7 @@ function useIsMobile() {
|
|
|
10342
10322
|
return;
|
|
10343
10323
|
}
|
|
10344
10324
|
const handleOrientationChange = () => {
|
|
10345
|
-
setOrientation(
|
|
10325
|
+
setOrientation(chunkHMZA25W2_js.detectOrientation());
|
|
10346
10326
|
};
|
|
10347
10327
|
if (screen.orientation) {
|
|
10348
10328
|
screen.orientation.addEventListener("change", handleOrientationChange);
|
|
@@ -10372,7 +10352,7 @@ function useIsMobile() {
|
|
|
10372
10352
|
window.addEventListener("resize", handleResize);
|
|
10373
10353
|
return () => window.removeEventListener("resize", handleResize);
|
|
10374
10354
|
}, [isTouchDevice, initialViewportHeight]);
|
|
10375
|
-
const { isMobile, isTablet, isDesktop } =
|
|
10355
|
+
const { isMobile, isTablet, isDesktop } = chunkHMZA25W2_js.deriveViewportBreakpoints(
|
|
10376
10356
|
viewportWidth,
|
|
10377
10357
|
viewportHeight,
|
|
10378
10358
|
isTouchDevice
|
|
@@ -10403,10 +10383,10 @@ function useTouchGestures(input) {
|
|
|
10403
10383
|
if (!el || !enabled) {
|
|
10404
10384
|
return;
|
|
10405
10385
|
}
|
|
10406
|
-
const recognizer =
|
|
10386
|
+
const recognizer = chunkHMZA25W2_js.createTouchGestureRecognizer({
|
|
10407
10387
|
getScale: () => scaleRef.current,
|
|
10408
|
-
minScale:
|
|
10409
|
-
maxScale:
|
|
10388
|
+
minScale: chunkHMZA25W2_js.MIN_ZOOM_SCALE,
|
|
10389
|
+
maxScale: chunkHMZA25W2_js.MAX_ZOOM_SCALE,
|
|
10410
10390
|
callbacks: {
|
|
10411
10391
|
onPinchZoom: (newScale) => callbacksRef.current.onPinchZoom?.(newScale),
|
|
10412
10392
|
onSwipe: (direction) => callbacksRef.current.onSwipe?.(direction),
|
|
@@ -10446,7 +10426,7 @@ function scrollFocusedIntoView(keyboardInset) {
|
|
|
10446
10426
|
return;
|
|
10447
10427
|
}
|
|
10448
10428
|
const rect = active.getBoundingClientRect();
|
|
10449
|
-
const delta =
|
|
10429
|
+
const delta = chunkHMZA25W2_js.computeScrollDelta(
|
|
10450
10430
|
{ top: rect.top, bottom: rect.bottom },
|
|
10451
10431
|
window.innerHeight,
|
|
10452
10432
|
keyboardInset
|
|
@@ -10466,8 +10446,8 @@ function useKeyboardInsets(enabled = true) {
|
|
|
10466
10446
|
return;
|
|
10467
10447
|
}
|
|
10468
10448
|
const update = () => {
|
|
10469
|
-
const metrics =
|
|
10470
|
-
const inset = metrics ?
|
|
10449
|
+
const metrics = chunkHMZA25W2_js.readViewportMetrics(window);
|
|
10450
|
+
const inset = metrics ? chunkHMZA25W2_js.computeKeyboardInset(metrics) : 0;
|
|
10471
10451
|
setKeyboardInset(inset);
|
|
10472
10452
|
if (inset > 0) {
|
|
10473
10453
|
window.requestAnimationFrame(() => scrollFocusedIntoView(inset));
|
|
@@ -10478,8 +10458,8 @@ function useKeyboardInsets(enabled = true) {
|
|
|
10478
10458
|
vv.addEventListener("scroll", update);
|
|
10479
10459
|
const onFocusIn = () => {
|
|
10480
10460
|
window.requestAnimationFrame(() => {
|
|
10481
|
-
const metrics =
|
|
10482
|
-
const inset = metrics ?
|
|
10461
|
+
const metrics = chunkHMZA25W2_js.readViewportMetrics(window);
|
|
10462
|
+
const inset = metrics ? chunkHMZA25W2_js.computeKeyboardInset(metrics) : 0;
|
|
10483
10463
|
if (inset > 0) {
|
|
10484
10464
|
scrollFocusedIntoView(inset);
|
|
10485
10465
|
}
|
|
@@ -10492,7 +10472,7 @@ function useKeyboardInsets(enabled = true) {
|
|
|
10492
10472
|
document.removeEventListener("focusin", onFocusIn);
|
|
10493
10473
|
};
|
|
10494
10474
|
}, [enabled]);
|
|
10495
|
-
return { keyboardInset, isKeyboardOpen:
|
|
10475
|
+
return { keyboardInset, isKeyboardOpen: chunkHMZA25W2_js.isKeyboardOpen(keyboardInset) };
|
|
10496
10476
|
}
|
|
10497
10477
|
|
|
10498
10478
|
// src/viewer/hooks/useViewerBuildingBlocks-canvas-props.ts
|
|
@@ -10515,27 +10495,40 @@ function buildCanvasProps(input) {
|
|
|
10515
10495
|
tableOps,
|
|
10516
10496
|
presentation,
|
|
10517
10497
|
findResults,
|
|
10518
|
-
findResultIndex
|
|
10498
|
+
findResultIndex,
|
|
10499
|
+
viewerOptions,
|
|
10500
|
+
buildHyperlinkConfirmMessage
|
|
10519
10501
|
} = input;
|
|
10520
10502
|
const effectiveSlide = mode === "master" ? masterPseudoSlide : activeSlide;
|
|
10521
10503
|
const effectiveTemplateElements = mode === "master" ? s.activeLayout ? s.activeMaster?.elements ?? [] : [] : templateElements;
|
|
10522
|
-
const fieldContext =
|
|
10504
|
+
const fieldContext = chunkHMZA25W2_js.buildFieldSubstitutionContext({
|
|
10523
10505
|
headerFooter: s.headerFooter,
|
|
10524
10506
|
customProperties: s.customProperties,
|
|
10525
10507
|
slide: activeSlide
|
|
10526
10508
|
});
|
|
10527
10509
|
const tableStyleContext = s.theme || s.tableStyleMap ? { theme: s.theme, tableStyleMap: s.tableStyleMap } : void 0;
|
|
10510
|
+
const openExternalUrl = (url) => {
|
|
10511
|
+
if (chunkHMZA25W2_js.shouldConfirmExternalHyperlink(viewerOptions, url) && !window.confirm(buildHyperlinkConfirmMessage(url))) {
|
|
10512
|
+
return;
|
|
10513
|
+
}
|
|
10514
|
+
chunkHMZA25W2_js.safeOpenUrl(url);
|
|
10515
|
+
};
|
|
10528
10516
|
const handleActionClick = (_elementId, action) => {
|
|
10529
10517
|
if (mode === "present") {
|
|
10518
|
+
const resolved = chunkHMZA25W2_js.resolvePresentationAction(action, { slideCount: slides.length });
|
|
10519
|
+
if (resolved.intent.kind === "openUrl") {
|
|
10520
|
+
openExternalUrl(resolved.intent.url);
|
|
10521
|
+
return;
|
|
10522
|
+
}
|
|
10530
10523
|
presentation.handlePresentationAction(action);
|
|
10531
10524
|
} else if (action.url) {
|
|
10532
|
-
|
|
10525
|
+
openExternalUrl(action.url);
|
|
10533
10526
|
}
|
|
10534
10527
|
};
|
|
10535
10528
|
const handleHyperlinkClick = (url) => {
|
|
10536
|
-
if (
|
|
10529
|
+
if (chunkHMZA25W2_js.isPpactionUrl(url)) {
|
|
10537
10530
|
if (mode === "present") {
|
|
10538
|
-
const parsed =
|
|
10531
|
+
const parsed = chunkHMZA25W2_js.parsePpactionUrl(url);
|
|
10539
10532
|
if (parsed) {
|
|
10540
10533
|
presentation.handlePresentationAction({
|
|
10541
10534
|
action: parsed.action,
|
|
@@ -10545,7 +10538,7 @@ function buildCanvasProps(input) {
|
|
|
10545
10538
|
}
|
|
10546
10539
|
return;
|
|
10547
10540
|
}
|
|
10548
|
-
|
|
10541
|
+
openExternalUrl(url);
|
|
10549
10542
|
};
|
|
10550
10543
|
return {
|
|
10551
10544
|
activeSlide: effectiveSlide,
|
|
@@ -10641,7 +10634,7 @@ function buildCanvasProps(input) {
|
|
|
10641
10634
|
|
|
10642
10635
|
// src/viewer/hooks/useScopedLayoutOptions.ts
|
|
10643
10636
|
function scopeLayoutOptionsToActiveSlide(options, activeSlide) {
|
|
10644
|
-
return
|
|
10637
|
+
return chunkHMZA25W2_js.scopeLayoutOptionsToSlide(options, activeSlide?.layoutPath);
|
|
10645
10638
|
}
|
|
10646
10639
|
|
|
10647
10640
|
// src/viewer/hooks/useViewerBuildingBlocks-toolbar-handlers.ts
|
|
@@ -10654,7 +10647,7 @@ function buildToolbarAnimationHandlers(input) {
|
|
|
10654
10647
|
const current = activeSlide.animations ?? [];
|
|
10655
10648
|
if (group === "motionPath") {
|
|
10656
10649
|
propertyHandlers.handleUpdateSlide({
|
|
10657
|
-
animations:
|
|
10650
|
+
animations: chunkHMZA25W2_js.applyMotionPathPreset(current, selectedElement.id, preset)
|
|
10658
10651
|
});
|
|
10659
10652
|
return;
|
|
10660
10653
|
}
|
|
@@ -10845,11 +10838,10 @@ function buildToolbarProps(input) {
|
|
|
10845
10838
|
onExportVideo: exportHandlers.handleExportVideo,
|
|
10846
10839
|
onExportGif: exportHandlers.handleExportGif,
|
|
10847
10840
|
onExportJson: exportHandlers.handleExportJson,
|
|
10848
|
-
onPackageForSharing: exportHandlers.handlePackageForSharing,
|
|
10849
10841
|
onOpenFile,
|
|
10850
10842
|
onOpenRecentFile,
|
|
10851
10843
|
onCreatePresentation: (templateId) => {
|
|
10852
|
-
s.setSlides(
|
|
10844
|
+
s.setSlides(chunkHMZA25W2_js.createBackstagePresentation(templateId));
|
|
10853
10845
|
s.setActiveSlideIndex(0);
|
|
10854
10846
|
s.setSelectedElementId(null);
|
|
10855
10847
|
s.setSelectedElementIds([]);
|
|
@@ -10878,7 +10870,7 @@ function buildToolbarProps(input) {
|
|
|
10878
10870
|
loadLayoutPreviews: input.loadLayoutPreviews,
|
|
10879
10871
|
onInsertSlideFromLayout: slideOps.handleInsertSlideFromLayout,
|
|
10880
10872
|
onInsertSlideFromTemplate: slideOps.handleInsertSlideFromTemplate,
|
|
10881
|
-
templateScheme:
|
|
10873
|
+
templateScheme: chunkHMZA25W2_js.templateSchemeFromTheme(s.theme?.colorScheme),
|
|
10882
10874
|
customShows: s.customShows,
|
|
10883
10875
|
activeCustomShowId: s.activeCustomShowId,
|
|
10884
10876
|
onSetActiveCustomShowId: s.setActiveCustomShowId,
|
|
@@ -10919,7 +10911,7 @@ function buildToolbarProps(input) {
|
|
|
10919
10911
|
isCommentsPanelOpen: s.isInspectorPaneOpen,
|
|
10920
10912
|
slideCommentCount: activeSlide?.comments?.length ?? 0,
|
|
10921
10913
|
formatPainterActive: s.formatPainterActive,
|
|
10922
|
-
canActivateFormatPainter:
|
|
10914
|
+
canActivateFormatPainter: chunkHMZA25W2_js.hasCopyableFormat(selectedElement),
|
|
10923
10915
|
onToggleFormatPainter: () => s.setFormatPainterActive((p) => !p),
|
|
10924
10916
|
isSelectionPaneOpen: s.isSelectionPaneOpen,
|
|
10925
10917
|
onToggleSelectionPane: () => s.setIsSelectionPaneOpen((p) => !p),
|
|
@@ -10983,6 +10975,7 @@ function useViewerBuildingBlocksCore(input) {
|
|
|
10983
10975
|
]
|
|
10984
10976
|
);
|
|
10985
10977
|
const zoom = useZoomViewport({ canvasSize, selectedElements: state.selectedElements });
|
|
10978
|
+
const { options: viewerOptions } = useViewerOptions();
|
|
10986
10979
|
const history = useEditorHistory({
|
|
10987
10980
|
slides,
|
|
10988
10981
|
canvasSize,
|
|
@@ -10992,6 +10985,7 @@ function useViewerBuildingBlocksCore(input) {
|
|
|
10992
10985
|
headerFooter: state.headerFooter,
|
|
10993
10986
|
loading,
|
|
10994
10987
|
error,
|
|
10988
|
+
maxHistoryEntries: chunkHMZA25W2_js.resolveHistoryDepth(viewerOptions),
|
|
10995
10989
|
hasActivePointerInteraction,
|
|
10996
10990
|
pointerCommitNonce: state.pointerCommitNonce,
|
|
10997
10991
|
setSlides: state.setSlides,
|
|
@@ -11013,12 +11007,15 @@ function useViewerBuildingBlocksCore(input) {
|
|
|
11013
11007
|
activeMaster: state.activeMaster,
|
|
11014
11008
|
documentGridSpacing: state.viewProperties?.gridSpacing
|
|
11015
11009
|
});
|
|
11016
|
-
const {
|
|
11017
|
-
const { presentation, annotations, actionSoundHandlerRef } = usePresentationSetup({
|
|
11010
|
+
const { presentation, annotations, actionSoundHandlerRef, setExitModeHandler } = usePresentationSetup({
|
|
11018
11011
|
mode,
|
|
11019
11012
|
slides,
|
|
11020
11013
|
visibleSlideIndexes,
|
|
11021
11014
|
endWithBlackSlide: viewerOptions.advanced.slideShowEndWithBlackSlide,
|
|
11015
|
+
// File > Options > Advanced > "Prompt to keep ink annotations when
|
|
11016
|
+
// exiting" / "Show popup toolbar" while presenting.
|
|
11017
|
+
promptKeepInkAnnotations: viewerOptions.advanced.slideShowPromptKeepInkAnnotations,
|
|
11018
|
+
popupToolbarEnabled: viewerOptions.advanced.slideShowShowPopupToolbar,
|
|
11022
11019
|
activeSlideIndex,
|
|
11023
11020
|
containerRef,
|
|
11024
11021
|
content,
|
|
@@ -11048,8 +11045,13 @@ function useViewerBuildingBlocksCore(input) {
|
|
|
11048
11045
|
presentation,
|
|
11049
11046
|
annotations,
|
|
11050
11047
|
actionSoundHandlerRef,
|
|
11048
|
+
setExitModeHandler,
|
|
11051
11049
|
masterPseudoSlide,
|
|
11052
|
-
gridSpacingPx
|
|
11050
|
+
gridSpacingPx,
|
|
11051
|
+
// Multiplied against the pre-existing 2x baseline; see the matching
|
|
11052
|
+
// comment in `PowerPointViewer.tsx`.
|
|
11053
|
+
imageExportScale: 2 * chunkHMZA25W2_js.resolveImageResolutionScale(viewerOptions),
|
|
11054
|
+
viewerOptions
|
|
11053
11055
|
};
|
|
11054
11056
|
}
|
|
11055
11057
|
function useViewerBuildingBlocksState(input) {
|
|
@@ -11077,7 +11079,10 @@ function useViewerBuildingBlocksState(input) {
|
|
|
11077
11079
|
presentation,
|
|
11078
11080
|
annotations,
|
|
11079
11081
|
actionSoundHandlerRef,
|
|
11080
|
-
gridSpacingPx
|
|
11082
|
+
gridSpacingPx,
|
|
11083
|
+
imageExportScale,
|
|
11084
|
+
setExitModeHandler,
|
|
11085
|
+
viewerOptions
|
|
11081
11086
|
} = core;
|
|
11082
11087
|
const dialogs = useViewerDialogs({
|
|
11083
11088
|
mode,
|
|
@@ -11148,7 +11153,13 @@ function useViewerBuildingBlocksState(input) {
|
|
|
11148
11153
|
content,
|
|
11149
11154
|
filePath,
|
|
11150
11155
|
autosaveEnabled,
|
|
11156
|
+
// Trust Center > "Allow external content": same gate `PowerPointViewer`
|
|
11157
|
+
// applies, so the headless building-blocks API loads http(s) images
|
|
11158
|
+
// under the same default-off, core-side SSRF/privacy guard.
|
|
11159
|
+
allowExternalImages: viewerOptions.trust.allowExternalContent,
|
|
11151
11160
|
canEdit,
|
|
11161
|
+
promptKeepInkAnnotations: viewerOptions.advanced.slideShowPromptKeepInkAnnotations,
|
|
11162
|
+
imageExportScale,
|
|
11152
11163
|
mode,
|
|
11153
11164
|
slides,
|
|
11154
11165
|
activeSlide,
|
|
@@ -11166,6 +11177,7 @@ function useViewerBuildingBlocksState(input) {
|
|
|
11166
11177
|
onSelectionChange,
|
|
11167
11178
|
onSlideCountChange
|
|
11168
11179
|
});
|
|
11180
|
+
setExitModeHandler(handleSetMode);
|
|
11169
11181
|
return {
|
|
11170
11182
|
dialogs,
|
|
11171
11183
|
editorOps,
|
|
@@ -11201,13 +11213,14 @@ function useViewerBuildingBlocks(input) {
|
|
|
11201
11213
|
onOpenHeaderFooter,
|
|
11202
11214
|
onOpenShareDialog
|
|
11203
11215
|
} = input;
|
|
11216
|
+
const { t } = reactI18next.useTranslation();
|
|
11204
11217
|
const [content, setContent] = react.useState(incomingContent ?? null);
|
|
11205
11218
|
react.useEffect(() => {
|
|
11206
11219
|
setContent(incomingContent ?? null);
|
|
11207
11220
|
}, [incomingContent]);
|
|
11208
11221
|
const onOpenFile = react.useCallback(() => {
|
|
11209
11222
|
void (async () => {
|
|
11210
|
-
const picked = await
|
|
11223
|
+
const picked = await chunkHMZA25W2_js.openPptxFile();
|
|
11211
11224
|
if (picked) {
|
|
11212
11225
|
setContent(picked.buffer);
|
|
11213
11226
|
}
|
|
@@ -11215,7 +11228,7 @@ function useViewerBuildingBlocks(input) {
|
|
|
11215
11228
|
}, []);
|
|
11216
11229
|
const onOpenRecentFile = react.useCallback((key) => {
|
|
11217
11230
|
void (async () => {
|
|
11218
|
-
const bytes = await
|
|
11231
|
+
const bytes = await chunkHMZA25W2_js.readBackstageRecentFile(key);
|
|
11219
11232
|
if (bytes) {
|
|
11220
11233
|
setContent(bytes);
|
|
11221
11234
|
}
|
|
@@ -11235,7 +11248,8 @@ function useViewerBuildingBlocks(input) {
|
|
|
11235
11248
|
history,
|
|
11236
11249
|
presentation,
|
|
11237
11250
|
masterPseudoSlide,
|
|
11238
|
-
gridSpacingPx
|
|
11251
|
+
gridSpacingPx,
|
|
11252
|
+
viewerOptions
|
|
11239
11253
|
} = core;
|
|
11240
11254
|
const {
|
|
11241
11255
|
dialogs,
|
|
@@ -11311,7 +11325,11 @@ function useViewerBuildingBlocks(input) {
|
|
|
11311
11325
|
tableOps: editorOps.tableOps,
|
|
11312
11326
|
presentation,
|
|
11313
11327
|
findResults: editorOps.findReplace.findResults,
|
|
11314
|
-
findResultIndex: editorOps.findReplace.findResultIndex
|
|
11328
|
+
findResultIndex: editorOps.findReplace.findResultIndex,
|
|
11329
|
+
viewerOptions,
|
|
11330
|
+
buildHyperlinkConfirmMessage: (url) => `${t("pptx.options.trust.confirmHyperlinks")}
|
|
11331
|
+
|
|
11332
|
+
${url}`
|
|
11315
11333
|
});
|
|
11316
11334
|
return { toolbarProps, canvasProps, mode, loading, error, autosaveStatus };
|
|
11317
11335
|
}
|
|
@@ -11387,6 +11405,7 @@ function useResizablePanels() {
|
|
|
11387
11405
|
|
|
11388
11406
|
exports.ACTION_VERB_MAP = ACTION_VERB_MAP;
|
|
11389
11407
|
exports.MIN_TOUCH_TARGET = MIN_TOUCH_TARGET;
|
|
11408
|
+
exports.ViewerOptionsContext = ViewerOptionsContext;
|
|
11390
11409
|
exports.computeToolbarVisibility = computeToolbarVisibility;
|
|
11391
11410
|
exports.detectTargetType = detectTargetType;
|
|
11392
11411
|
exports.isAudienceTab = isAudienceTab;
|
|
@@ -11459,6 +11478,7 @@ exports.useViewerCoreState = useViewerCoreState;
|
|
|
11459
11478
|
exports.useViewerDialogs = useViewerDialogs;
|
|
11460
11479
|
exports.useViewerIntegration = useViewerIntegration;
|
|
11461
11480
|
exports.useViewerOptions = useViewerOptions;
|
|
11481
|
+
exports.useViewerOptionsContext = useViewerOptionsContext;
|
|
11462
11482
|
exports.useViewerState = useViewerState;
|
|
11463
11483
|
exports.useViewerUIState = useViewerUIState;
|
|
11464
11484
|
exports.useVirtualizedSlides = useVirtualizedSlides;
|