pptx-react-viewer 2.0.0 → 2.1.0
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 +24 -0
- package/README.md +1 -1
- package/dist/{AiChatPanel-BRGQCYZM.mjs → AiChatPanel-RFBZWMUE.mjs} +2 -2
- package/dist/AiChatPanel-RFBZWMUE.mjs.br +0 -0
- package/dist/AiChatPanel-RFBZWMUE.mjs.gz +0 -0
- package/dist/{AiChatPanel-PW5OT25Z.js → AiChatPanel-VCCVHAAI.js} +10 -10
- package/dist/AiChatPanel-VCCVHAAI.js.br +0 -0
- package/dist/AiChatPanel-VCCVHAAI.js.gz +0 -0
- package/dist/{Model3DScene-TEF362W2.mjs → Model3DScene-2M6HVWTE.mjs} +1 -1
- package/dist/{Model3DScene-TEF362W2.mjs.br → Model3DScene-2M6HVWTE.mjs.br} +0 -0
- package/dist/Model3DScene-2M6HVWTE.mjs.gz +0 -0
- package/dist/{Model3DScene-JCGYRKXM.js → Model3DScene-RQIGSYGQ.js} +2 -2
- package/dist/{Model3DScene-JCGYRKXM.js.br → Model3DScene-RQIGSYGQ.js.br} +0 -0
- package/dist/Model3DScene-RQIGSYGQ.js.gz +0 -0
- package/dist/PowerPointViewer-gmU5rc7K.d.ts.map +1 -1
- package/dist/{SurfaceChart3DScene-2SHCYZVC.js → SurfaceChart3DScene-2FVASQGC.js} +2 -2
- package/dist/SurfaceChart3DScene-2FVASQGC.js.br +0 -0
- package/dist/SurfaceChart3DScene-2FVASQGC.js.gz +0 -0
- package/dist/{SurfaceChart3DScene-UPDCIMJM.mjs → SurfaceChart3DScene-EGMWY4CZ.mjs} +1 -1
- package/dist/{SurfaceChart3DScene-UPDCIMJM.mjs.br → SurfaceChart3DScene-EGMWY4CZ.mjs.br} +0 -0
- package/dist/SurfaceChart3DScene-EGMWY4CZ.mjs.gz +0 -0
- package/dist/{chunk-R2N2UYT7.mjs → chunk-27XBWVO5.mjs} +310 -3
- package/dist/chunk-27XBWVO5.mjs.br +0 -0
- package/dist/{chunk-R2N2UYT7.mjs.gz → chunk-27XBWVO5.mjs.gz} +0 -0
- package/dist/{chunk-OKOJVSKJ.js → chunk-46Z6MNRS.js} +315 -2
- package/dist/chunk-46Z6MNRS.js.br +0 -0
- package/dist/{chunk-OKOJVSKJ.js.gz → chunk-46Z6MNRS.js.gz} +0 -0
- package/dist/{chunk-B6NRDUHJ.mjs → chunk-7DQHWPIB.mjs} +2 -2
- package/dist/chunk-7DQHWPIB.mjs.br +0 -0
- package/dist/chunk-7DQHWPIB.mjs.gz +0 -0
- package/dist/{chunk-ZKDE3HJI.js → chunk-LDF77JJD.js} +208 -208
- package/dist/chunk-LDF77JJD.js.br +0 -0
- package/dist/chunk-LDF77JJD.js.gz +0 -0
- package/dist/{chunk-5XLLRPMV.mjs → chunk-NGE7YQTF.mjs} +110 -14
- package/dist/chunk-NGE7YQTF.mjs.br +0 -0
- package/dist/chunk-NGE7YQTF.mjs.gz +0 -0
- package/dist/{chunk-LFXG7SGG.js → chunk-VHO53ZXZ.js} +764 -756
- package/dist/chunk-VHO53ZXZ.js.br +0 -0
- package/dist/chunk-VHO53ZXZ.js.gz +0 -0
- package/dist/{chunk-L63RAVM7.mjs → chunk-Y4OSELBT.mjs} +16 -8
- package/dist/chunk-Y4OSELBT.mjs.br +0 -0
- package/dist/chunk-Y4OSELBT.mjs.gz +0 -0
- package/dist/{chunk-ZB4NZRCI.js → chunk-ZRY7NLKS.js} +354 -257
- package/dist/chunk-ZRY7NLKS.js.br +0 -0
- package/dist/chunk-ZRY7NLKS.js.gz +0 -0
- package/dist/{index-a8wcFjRJ.d.ts → index-nAyIdGqF.d.ts} +2 -2
- package/dist/{index-a8wcFjRJ.d.ts.map → index-nAyIdGqF.d.ts.map} +1 -1
- package/dist/index.js +33 -33
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.br +0 -0
- package/dist/index.mjs.gz +0 -0
- package/dist/internals.d.ts +100 -0
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +78 -78
- package/dist/internals.js.br +0 -0
- package/dist/internals.js.gz +0 -0
- package/dist/internals.mjs +3 -3
- package/dist/internals.mjs.br +0 -0
- package/dist/internals.mjs.gz +0 -0
- package/dist/viewer/index.js +20 -20
- package/dist/viewer/index.js.br +0 -0
- package/dist/viewer/index.js.gz +0 -0
- package/dist/viewer/index.mjs +4 -4
- package/dist/viewer/index.mjs.br +0 -0
- package/dist/viewer/index.mjs.gz +0 -0
- package/package.json +5 -3
- package/dist/AiChatPanel-BRGQCYZM.mjs.br +0 -0
- package/dist/AiChatPanel-BRGQCYZM.mjs.gz +0 -0
- package/dist/AiChatPanel-PW5OT25Z.js.br +0 -0
- package/dist/AiChatPanel-PW5OT25Z.js.gz +0 -0
- package/dist/Model3DScene-JCGYRKXM.js.gz +0 -0
- package/dist/Model3DScene-TEF362W2.mjs.gz +0 -0
- package/dist/SurfaceChart3DScene-2SHCYZVC.js.br +0 -0
- package/dist/SurfaceChart3DScene-2SHCYZVC.js.gz +0 -0
- package/dist/SurfaceChart3DScene-UPDCIMJM.mjs.gz +0 -0
- package/dist/chunk-5XLLRPMV.mjs.br +0 -0
- package/dist/chunk-5XLLRPMV.mjs.gz +0 -0
- package/dist/chunk-B6NRDUHJ.mjs.br +0 -0
- package/dist/chunk-B6NRDUHJ.mjs.gz +0 -0
- package/dist/chunk-L63RAVM7.mjs.br +0 -0
- package/dist/chunk-L63RAVM7.mjs.gz +0 -0
- package/dist/chunk-LFXG7SGG.js.br +0 -0
- package/dist/chunk-LFXG7SGG.js.gz +0 -0
- package/dist/chunk-OKOJVSKJ.js.br +0 -0
- package/dist/chunk-R2N2UYT7.mjs.br +0 -0
- package/dist/chunk-ZB4NZRCI.js.br +0 -0
- package/dist/chunk-ZB4NZRCI.js.gz +0 -0
- package/dist/chunk-ZKDE3HJI.js.br +0 -0
- package/dist/chunk-ZKDE3HJI.js.gz +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkLDF77JJD_js = require('./chunk-LDF77JJD.js');
|
|
4
|
+
var chunk46Z6MNRS_js = require('./chunk-46Z6MNRS.js');
|
|
5
5
|
var chunkCUUYYYC5_js = require('./chunk-CUUYYYC5.js');
|
|
6
6
|
var chunkCLNGAVNH_js = require('./chunk-CLNGAVNH.js');
|
|
7
7
|
var react = require('react');
|
|
@@ -15,7 +15,7 @@ var JSZip__default = /*#__PURE__*/_interopDefault(JSZip);
|
|
|
15
15
|
function useVirtualizedSlides({
|
|
16
16
|
totalItems,
|
|
17
17
|
itemHeight,
|
|
18
|
-
overscan =
|
|
18
|
+
overscan = chunk46Z6MNRS_js.DEFAULT_VIRTUAL_OVERSCAN
|
|
19
19
|
}) {
|
|
20
20
|
const scrollContainerRef = react.useRef(null);
|
|
21
21
|
const [scrollTop, setScrollTop] = react.useState(0);
|
|
@@ -45,7 +45,7 @@ function useVirtualizedSlides({
|
|
|
45
45
|
resizeObserver?.disconnect();
|
|
46
46
|
};
|
|
47
47
|
}, []);
|
|
48
|
-
const range =
|
|
48
|
+
const range = chunk46Z6MNRS_js.computeVirtualRange(totalItems, itemHeight, scrollTop, viewportHeight, overscan);
|
|
49
49
|
const safeItemHeight = Math.max(itemHeight, 1);
|
|
50
50
|
const scrollToIndex = react.useCallback(
|
|
51
51
|
(index, behavior = "smooth") => {
|
|
@@ -108,7 +108,7 @@ function usePresenceTracking({
|
|
|
108
108
|
awareness.setLocalStateField("presence", state);
|
|
109
109
|
lastBroadcastRef.current = Date.now();
|
|
110
110
|
};
|
|
111
|
-
if (elapsed >=
|
|
111
|
+
if (elapsed >= chunk46Z6MNRS_js.BROADCAST_THROTTLE_MS) {
|
|
112
112
|
if (pendingBroadcastRef.current) {
|
|
113
113
|
clearTimeout(pendingBroadcastRef.current);
|
|
114
114
|
pendingBroadcastRef.current = null;
|
|
@@ -118,7 +118,7 @@ function usePresenceTracking({
|
|
|
118
118
|
pendingBroadcastRef.current = setTimeout(() => {
|
|
119
119
|
pendingBroadcastRef.current = null;
|
|
120
120
|
flush();
|
|
121
|
-
},
|
|
121
|
+
}, chunk46Z6MNRS_js.BROADCAST_THROTTLE_MS - elapsed);
|
|
122
122
|
}
|
|
123
123
|
},
|
|
124
124
|
[awareness, userName, userColor, userAvatar, role]
|
|
@@ -143,7 +143,7 @@ function usePresenceTracking({
|
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
145
|
const handleChange = () => {
|
|
146
|
-
const users =
|
|
146
|
+
const users = chunk46Z6MNRS_js.derivePresenceList(
|
|
147
147
|
awareness.getStates(),
|
|
148
148
|
localClientId,
|
|
149
149
|
canvasWidth,
|
|
@@ -192,9 +192,10 @@ function useYjsProvider({ config }) {
|
|
|
192
192
|
const [synced, setSynced] = react.useState(false);
|
|
193
193
|
const cleanupRef = react.useRef(null);
|
|
194
194
|
const timeoutRef = react.useRef(null);
|
|
195
|
+
const departureRef = react.useRef(null);
|
|
195
196
|
const gateRef = react.useRef(null);
|
|
196
197
|
if (!gateRef.current) {
|
|
197
|
-
gateRef.current =
|
|
198
|
+
gateRef.current = chunk46Z6MNRS_js.createSyncGate(() => setSynced(true));
|
|
198
199
|
}
|
|
199
200
|
const teardown = react.useCallback(() => {
|
|
200
201
|
if (timeoutRef.current) {
|
|
@@ -206,8 +207,15 @@ function useYjsProvider({ config }) {
|
|
|
206
207
|
cleanupRef.current?.();
|
|
207
208
|
cleanupRef.current = null;
|
|
208
209
|
}, []);
|
|
210
|
+
const announceDeparture = react.useCallback(() => {
|
|
211
|
+
departureRef.current?.announce();
|
|
212
|
+
departureRef.current?.dispose();
|
|
213
|
+
departureRef.current = null;
|
|
214
|
+
}, []);
|
|
209
215
|
const buildCleanup = react.useCallback(
|
|
210
216
|
(provider, yDoc) => () => {
|
|
217
|
+
announceDeparture();
|
|
218
|
+
chunk46Z6MNRS_js.clearLocalAwareness(provider.awareness);
|
|
211
219
|
provider.destroy();
|
|
212
220
|
yDoc.destroy();
|
|
213
221
|
setDoc(null);
|
|
@@ -215,7 +223,7 @@ function useYjsProvider({ config }) {
|
|
|
215
223
|
setClientId(null);
|
|
216
224
|
setStatus("disconnected");
|
|
217
225
|
},
|
|
218
|
-
[]
|
|
226
|
+
[announceDeparture]
|
|
219
227
|
);
|
|
220
228
|
const initWebrtc = react.useCallback(async () => {
|
|
221
229
|
if (!config) {
|
|
@@ -232,7 +240,9 @@ function useYjsProvider({ config }) {
|
|
|
232
240
|
if (config.authToken) {
|
|
233
241
|
opts.password = config.authToken;
|
|
234
242
|
}
|
|
235
|
-
const
|
|
243
|
+
const roomId = chunk46Z6MNRS_js.validateRoomId(config.roomId);
|
|
244
|
+
const provider = new WebrtcProvider(roomId, yDoc, opts);
|
|
245
|
+
departureRef.current = chunk46Z6MNRS_js.createDepartureChannel(roomId, provider.awareness);
|
|
236
246
|
setDoc(yDoc);
|
|
237
247
|
setAwareness(provider.awareness);
|
|
238
248
|
setClientId(provider.awareness.clientID);
|
|
@@ -274,13 +284,13 @@ function useYjsProvider({ config }) {
|
|
|
274
284
|
if (!config) {
|
|
275
285
|
return;
|
|
276
286
|
}
|
|
277
|
-
const roomId =
|
|
278
|
-
const transport = config.transport ??
|
|
287
|
+
const roomId = chunk46Z6MNRS_js.validateRoomId(config.roomId);
|
|
288
|
+
const transport = config.transport ?? chunk46Z6MNRS_js.resolveTransportForServerUrl(config.serverUrl);
|
|
279
289
|
if (transport === "webrtc") {
|
|
280
290
|
await initWebrtc();
|
|
281
291
|
return;
|
|
282
292
|
}
|
|
283
|
-
if (
|
|
293
|
+
if (chunk46Z6MNRS_js.isMixedContentBlocked(config.serverUrl)) {
|
|
284
294
|
console.warn(
|
|
285
295
|
`[pptx-viewer] Refusing to connect: insecure ws:// server "${config.serverUrl}" is blocked from a secure (https) page. Use a wss:// URL.`
|
|
286
296
|
);
|
|
@@ -294,6 +304,7 @@ function useYjsProvider({ config }) {
|
|
|
294
304
|
const provider = new WebsocketProvider(config.serverUrl, roomId, yDoc, {
|
|
295
305
|
params: config.authToken ? { token: config.authToken } : void 0
|
|
296
306
|
});
|
|
307
|
+
departureRef.current = chunk46Z6MNRS_js.createDepartureChannel(roomId, provider.awareness);
|
|
297
308
|
let connected = false;
|
|
298
309
|
const handleStatus = (event) => {
|
|
299
310
|
if (event.status === "connected") {
|
|
@@ -332,6 +343,8 @@ function useYjsProvider({ config }) {
|
|
|
332
343
|
if (!connected) {
|
|
333
344
|
provider.off("status", handleStatus);
|
|
334
345
|
provider.off("sync", handleSynced);
|
|
346
|
+
announceDeparture();
|
|
347
|
+
chunk46Z6MNRS_js.clearLocalAwareness(provider.awareness);
|
|
335
348
|
provider.destroy();
|
|
336
349
|
yDoc.destroy();
|
|
337
350
|
setDoc(null);
|
|
@@ -340,7 +353,7 @@ function useYjsProvider({ config }) {
|
|
|
340
353
|
cleanupRef.current = null;
|
|
341
354
|
setStatus("error");
|
|
342
355
|
}
|
|
343
|
-
},
|
|
356
|
+
}, chunk46Z6MNRS_js.CONNECTION_TIMEOUT_MS);
|
|
344
357
|
}
|
|
345
358
|
setDoc(yDoc);
|
|
346
359
|
setAwareness(provider.awareness);
|
|
@@ -348,6 +361,8 @@ function useYjsProvider({ config }) {
|
|
|
348
361
|
cleanupRef.current = () => {
|
|
349
362
|
provider.off("status", handleStatus);
|
|
350
363
|
provider.off("sync", handleSynced);
|
|
364
|
+
announceDeparture();
|
|
365
|
+
chunk46Z6MNRS_js.clearLocalAwareness(provider.awareness);
|
|
351
366
|
provider.destroy();
|
|
352
367
|
yDoc.destroy();
|
|
353
368
|
setDoc(null);
|
|
@@ -367,12 +382,20 @@ function useYjsProvider({ config }) {
|
|
|
367
382
|
config?.serverUrl,
|
|
368
383
|
config?.authToken,
|
|
369
384
|
config?.transport,
|
|
385
|
+
announceDeparture,
|
|
370
386
|
initWebrtc,
|
|
371
387
|
teardown
|
|
372
388
|
]);
|
|
373
389
|
react.useEffect(() => {
|
|
374
390
|
init();
|
|
375
|
-
|
|
391
|
+
const disposeTeardown = chunk46Z6MNRS_js.registerCollaborationTeardown({
|
|
392
|
+
leave: teardown,
|
|
393
|
+
rejoin: init
|
|
394
|
+
});
|
|
395
|
+
return () => {
|
|
396
|
+
disposeTeardown();
|
|
397
|
+
teardown();
|
|
398
|
+
};
|
|
376
399
|
}, [init, teardown]);
|
|
377
400
|
const retry = react.useCallback(() => {
|
|
378
401
|
init();
|
|
@@ -386,7 +409,7 @@ function useCollaborativeState({
|
|
|
386
409
|
canvasWidth,
|
|
387
410
|
canvasHeight
|
|
388
411
|
}) {
|
|
389
|
-
const userColor =
|
|
412
|
+
const userColor = chunk46Z6MNRS_js.sanitizeColor(config?.userColor, "#6366f1");
|
|
390
413
|
const { status, awareness, doc, clientId, synced, retry } = useYjsProvider({ config });
|
|
391
414
|
const { remoteUsers, broadcastPresence } = usePresenceTracking({
|
|
392
415
|
awareness,
|
|
@@ -495,8 +518,8 @@ function useEditorHistory(input) {
|
|
|
495
518
|
width: canvasSize.width,
|
|
496
519
|
height: canvasSize.height,
|
|
497
520
|
activeSlideIndex,
|
|
498
|
-
slides: slides.map(
|
|
499
|
-
templateElementsBySlideId:
|
|
521
|
+
slides: slides.map(chunk46Z6MNRS_js.cloneSlide),
|
|
522
|
+
templateElementsBySlideId: chunk46Z6MNRS_js.cloneTemplateElementsBySlideId(templateElementsBySlideId),
|
|
500
523
|
...actionLabel ? { actionLabel } : {}
|
|
501
524
|
};
|
|
502
525
|
},
|
|
@@ -509,9 +532,9 @@ function useEditorHistory(input) {
|
|
|
509
532
|
width: snapshot.width,
|
|
510
533
|
height: snapshot.height
|
|
511
534
|
});
|
|
512
|
-
setSlides(snapshot.slides.map(
|
|
535
|
+
setSlides(snapshot.slides.map(chunk46Z6MNRS_js.cloneSlide));
|
|
513
536
|
setTemplateElementsBySlideId(
|
|
514
|
-
|
|
537
|
+
chunk46Z6MNRS_js.cloneTemplateElementsBySlideId(snapshot.templateElementsBySlideId)
|
|
515
538
|
);
|
|
516
539
|
setActiveSlideIndex(Math.min(snapshot.activeSlideIndex, maxSlideIndex));
|
|
517
540
|
setSelectedElementIds([]);
|
|
@@ -545,8 +568,8 @@ function useEditorHistory(input) {
|
|
|
545
568
|
const currentSnapshot = buildHistorySnapshot();
|
|
546
569
|
historyFutureRef.current.push(currentSnapshot);
|
|
547
570
|
isApplyingHistoryRef.current = true;
|
|
548
|
-
const nextSnapshot =
|
|
549
|
-
lastHistorySnapshotRef.current =
|
|
571
|
+
const nextSnapshot = chunkLDF77JJD_js.cloneHistorySnapshot(previousSnapshot);
|
|
572
|
+
lastHistorySnapshotRef.current = chunkLDF77JJD_js.cloneHistorySnapshot(nextSnapshot);
|
|
550
573
|
lastHistorySerializedRef.current = JSON.stringify(nextSnapshot);
|
|
551
574
|
applyHistorySnapshot(nextSnapshot);
|
|
552
575
|
updateHistoryAvailability();
|
|
@@ -567,8 +590,8 @@ function useEditorHistory(input) {
|
|
|
567
590
|
const currentSnapshot = buildHistorySnapshot();
|
|
568
591
|
historyPastRef.current.push(currentSnapshot);
|
|
569
592
|
isApplyingHistoryRef.current = true;
|
|
570
|
-
const targetSnapshot =
|
|
571
|
-
lastHistorySnapshotRef.current =
|
|
593
|
+
const targetSnapshot = chunkLDF77JJD_js.cloneHistorySnapshot(nextSnapshot);
|
|
594
|
+
lastHistorySnapshotRef.current = chunkLDF77JJD_js.cloneHistorySnapshot(targetSnapshot);
|
|
572
595
|
lastHistorySerializedRef.current = JSON.stringify(targetSnapshot);
|
|
573
596
|
applyHistorySnapshot(targetSnapshot);
|
|
574
597
|
updateHistoryAvailability();
|
|
@@ -586,7 +609,7 @@ function useEditorHistory(input) {
|
|
|
586
609
|
historyPastRef.current = [];
|
|
587
610
|
historyFutureRef.current = [];
|
|
588
611
|
if (initialSnapshot) {
|
|
589
|
-
const clonedInitial =
|
|
612
|
+
const clonedInitial = chunkLDF77JJD_js.cloneHistorySnapshot(initialSnapshot);
|
|
590
613
|
lastHistorySnapshotRef.current = clonedInitial;
|
|
591
614
|
lastHistorySerializedRef.current = JSON.stringify(clonedInitial);
|
|
592
615
|
} else {
|
|
@@ -627,18 +650,18 @@ function useEditorHistory(input) {
|
|
|
627
650
|
}
|
|
628
651
|
const previousSnapshot = lastHistorySnapshotRef.current;
|
|
629
652
|
if (!previousSnapshot) {
|
|
630
|
-
lastHistorySnapshotRef.current =
|
|
653
|
+
lastHistorySnapshotRef.current = chunkLDF77JJD_js.cloneHistorySnapshot(snapshot);
|
|
631
654
|
lastHistorySerializedRef.current = serialized;
|
|
632
655
|
lastCheapHashRef.current = cheapHash;
|
|
633
656
|
updateHistoryAvailability();
|
|
634
657
|
return;
|
|
635
658
|
}
|
|
636
|
-
historyPastRef.current.push(
|
|
659
|
+
historyPastRef.current.push(chunkLDF77JJD_js.cloneHistorySnapshot(previousSnapshot));
|
|
637
660
|
while (historyPastRef.current.length > Math.max(1, maxHistoryEntries)) {
|
|
638
661
|
historyPastRef.current.shift();
|
|
639
662
|
}
|
|
640
663
|
historyFutureRef.current = [];
|
|
641
|
-
lastHistorySnapshotRef.current =
|
|
664
|
+
lastHistorySnapshotRef.current = chunkLDF77JJD_js.cloneHistorySnapshot(snapshot);
|
|
642
665
|
lastHistorySerializedRef.current = serialized;
|
|
643
666
|
lastCheapHashRef.current = cheapHash;
|
|
644
667
|
updateHistoryAvailability();
|
|
@@ -727,7 +750,7 @@ function useZoomViewport({
|
|
|
727
750
|
if (!wrapper || !canvasViewport) {
|
|
728
751
|
return;
|
|
729
752
|
}
|
|
730
|
-
const boundedScale = Math.min(Math.max(nextScale,
|
|
753
|
+
const boundedScale = Math.min(Math.max(nextScale, chunkLDF77JJD_js.MIN_ZOOM_SCALE), chunkLDF77JJD_js.MAX_ZOOM_SCALE);
|
|
731
754
|
const nextEditorScale = fitScale * boundedScale;
|
|
732
755
|
const centerX = (bounds.minX + bounds.maxX) / 2;
|
|
733
756
|
const centerY = (bounds.minY + bounds.maxY) / 2;
|
|
@@ -742,10 +765,10 @@ function useZoomViewport({
|
|
|
742
765
|
[fitScale]
|
|
743
766
|
);
|
|
744
767
|
const handleZoomIn = react.useCallback(() => {
|
|
745
|
-
setScale((currentScale) => Math.min(currentScale + 0.1,
|
|
768
|
+
setScale((currentScale) => Math.min(currentScale + 0.1, chunkLDF77JJD_js.MAX_ZOOM_SCALE));
|
|
746
769
|
}, []);
|
|
747
770
|
const handleZoomOut = react.useCallback(() => {
|
|
748
|
-
setScale((currentScale) => Math.max(currentScale - 0.1,
|
|
771
|
+
setScale((currentScale) => Math.max(currentScale - 0.1, chunkLDF77JJD_js.MIN_ZOOM_SCALE));
|
|
749
772
|
}, []);
|
|
750
773
|
const handleResetZoom = react.useCallback(() => {
|
|
751
774
|
setScale(1);
|
|
@@ -764,22 +787,22 @@ function useZoomViewport({
|
|
|
764
787
|
selectedElements.forEach((element) => {
|
|
765
788
|
minX = Math.min(minX, element.x);
|
|
766
789
|
minY = Math.min(minY, element.y);
|
|
767
|
-
maxX = Math.max(maxX, element.x + Math.max(element.width,
|
|
768
|
-
maxY = Math.max(maxY, element.y + Math.max(element.height,
|
|
790
|
+
maxX = Math.max(maxX, element.x + Math.max(element.width, chunkLDF77JJD_js.MIN_ELEMENT_SIZE));
|
|
791
|
+
maxY = Math.max(maxY, element.y + Math.max(element.height, chunkLDF77JJD_js.MIN_ELEMENT_SIZE));
|
|
769
792
|
});
|
|
770
793
|
if (!Number.isFinite(minX) || !Number.isFinite(minY) || !Number.isFinite(maxX) || !Number.isFinite(maxY)) {
|
|
771
794
|
return;
|
|
772
795
|
}
|
|
773
796
|
const selectionBounds = { minX, minY, maxX, maxY };
|
|
774
|
-
const boundsWidth = Math.max(selectionBounds.maxX - selectionBounds.minX,
|
|
775
|
-
const boundsHeight = Math.max(selectionBounds.maxY - selectionBounds.minY,
|
|
797
|
+
const boundsWidth = Math.max(selectionBounds.maxX - selectionBounds.minX, chunkLDF77JJD_js.MIN_ELEMENT_SIZE);
|
|
798
|
+
const boundsHeight = Math.max(selectionBounds.maxY - selectionBounds.minY, chunkLDF77JJD_js.MIN_ELEMENT_SIZE);
|
|
776
799
|
const availableWidth = Math.max(
|
|
777
|
-
effectiveEditorDimensions.width -
|
|
778
|
-
|
|
800
|
+
effectiveEditorDimensions.width - chunkLDF77JJD_js.ZOOM_TO_SELECTION_PADDING,
|
|
801
|
+
chunkLDF77JJD_js.MIN_ELEMENT_SIZE
|
|
779
802
|
);
|
|
780
803
|
const availableHeight = Math.max(
|
|
781
|
-
effectiveEditorDimensions.height -
|
|
782
|
-
|
|
804
|
+
effectiveEditorDimensions.height - chunkLDF77JJD_js.ZOOM_TO_SELECTION_PADDING,
|
|
805
|
+
chunkLDF77JJD_js.MIN_ELEMENT_SIZE
|
|
783
806
|
);
|
|
784
807
|
const targetEditorScale = Math.min(
|
|
785
808
|
availableWidth / boundsWidth,
|
|
@@ -787,8 +810,8 @@ function useZoomViewport({
|
|
|
787
810
|
);
|
|
788
811
|
const safeFitScale = fitScale > Number.EPSILON ? fitScale : Number.EPSILON;
|
|
789
812
|
const nextScale = Math.min(
|
|
790
|
-
Math.max(targetEditorScale / safeFitScale,
|
|
791
|
-
|
|
813
|
+
Math.max(targetEditorScale / safeFitScale, chunkLDF77JJD_js.MIN_ZOOM_SCALE),
|
|
814
|
+
chunkLDF77JJD_js.MAX_ZOOM_SCALE
|
|
792
815
|
);
|
|
793
816
|
setScale(nextScale);
|
|
794
817
|
window.requestAnimationFrame(() => {
|
|
@@ -810,7 +833,7 @@ function useZoomViewport({
|
|
|
810
833
|
event.preventDefault();
|
|
811
834
|
const delta = event.deltaY * -1e-3;
|
|
812
835
|
setScale(
|
|
813
|
-
(currentScale) => Math.min(Math.max(currentScale + delta,
|
|
836
|
+
(currentScale) => Math.min(Math.max(currentScale + delta, chunkLDF77JJD_js.MIN_ZOOM_SCALE), chunkLDF77JJD_js.MAX_ZOOM_SCALE)
|
|
814
837
|
);
|
|
815
838
|
}, []);
|
|
816
839
|
react.useEffect(() => {
|
|
@@ -888,7 +911,7 @@ function applyAnimationGroupSteps(group, onPlayActionSound, setPresentationEleme
|
|
|
888
911
|
const command = step.command;
|
|
889
912
|
const timer = window.setTimeout(
|
|
890
913
|
() => {
|
|
891
|
-
|
|
914
|
+
chunkLDF77JJD_js.executeMediaCommand(command);
|
|
892
915
|
},
|
|
893
916
|
Math.max(0, step.delayMs)
|
|
894
917
|
);
|
|
@@ -1003,7 +1026,7 @@ function useAnimationPlayback(input) {
|
|
|
1003
1026
|
(controller, group) => {
|
|
1004
1027
|
driveBuildReveal(
|
|
1005
1028
|
controller,
|
|
1006
|
-
|
|
1029
|
+
chunk46Z6MNRS_js.PresentationAnimationController.collectBuildStepIds(group),
|
|
1007
1030
|
setPresentationElementStates,
|
|
1008
1031
|
buildRafRef
|
|
1009
1032
|
);
|
|
@@ -1066,7 +1089,7 @@ function useAnimationPlayback(input) {
|
|
|
1066
1089
|
setHoverTriggerShapeIds(/* @__PURE__ */ new Set());
|
|
1067
1090
|
return;
|
|
1068
1091
|
}
|
|
1069
|
-
const controller =
|
|
1092
|
+
const controller = chunk46Z6MNRS_js.PresentationAnimationController.fromSlide(slide);
|
|
1070
1093
|
controllerRef.current = controller;
|
|
1071
1094
|
setPresentationKeyframesCss(controller.keyframesCss);
|
|
1072
1095
|
setInteractiveTriggerShapeIds(controller.interactiveTriggerShapeIds);
|
|
@@ -1203,7 +1226,7 @@ function useAnimationPlayback(input) {
|
|
|
1203
1226
|
}))
|
|
1204
1227
|
);
|
|
1205
1228
|
entranceAnimations.forEach((animation, animationIndex) => {
|
|
1206
|
-
const delay =
|
|
1229
|
+
const delay = chunk46Z6MNRS_js.computeEntranceAnimationDelay(animation.delayMs, animationIndex);
|
|
1207
1230
|
const timer = window.setTimeout(() => {
|
|
1208
1231
|
setPresentationAnimations(
|
|
1209
1232
|
(previousAnimations) => previousAnimations.map(
|
|
@@ -1239,12 +1262,12 @@ function useAnimationPlayback(input) {
|
|
|
1239
1262
|
presentationTimersRef
|
|
1240
1263
|
};
|
|
1241
1264
|
}
|
|
1242
|
-
var PRESENTER_CHANNEL_NAME =
|
|
1243
|
-
var AUDIENCE_HASH =
|
|
1244
|
-
var PRESENTER_MSG_ORIGIN =
|
|
1245
|
-
var AUDIENCE_NONCE_KEY =
|
|
1265
|
+
var PRESENTER_CHANNEL_NAME = chunk46Z6MNRS_js.PRESENTATION_CHANNEL_NAME;
|
|
1266
|
+
var AUDIENCE_HASH = chunk46Z6MNRS_js.PRESENTATION_HASH;
|
|
1267
|
+
var PRESENTER_MSG_ORIGIN = chunk46Z6MNRS_js.PRESENTATION_MESSAGE_ORIGIN;
|
|
1268
|
+
var AUDIENCE_NONCE_KEY = chunk46Z6MNRS_js.PRESENTATION_NONCE_KEY;
|
|
1246
1269
|
function generateSessionId() {
|
|
1247
|
-
return
|
|
1270
|
+
return chunk46Z6MNRS_js.createPresentationSessionId();
|
|
1248
1271
|
}
|
|
1249
1272
|
function parseAudienceNonce() {
|
|
1250
1273
|
const hash = window.location.hash;
|
|
@@ -1280,7 +1303,7 @@ function usePresenterWindow(input) {
|
|
|
1280
1303
|
}, []);
|
|
1281
1304
|
const swapDisplays = react.useCallback(async () => {
|
|
1282
1305
|
const audience = audienceWindowRef.current;
|
|
1283
|
-
return audience && !audience.closed ?
|
|
1306
|
+
return audience && !audience.closed ? chunk46Z6MNRS_js.swapPresentationWindows(window, audience) : false;
|
|
1284
1307
|
}, []);
|
|
1285
1308
|
const syncSlideToAudience = react.useCallback(
|
|
1286
1309
|
(slideIndex) => {
|
|
@@ -1344,7 +1367,7 @@ function usePresenterWindow(input) {
|
|
|
1344
1367
|
pollTimerRef.current = null;
|
|
1345
1368
|
}
|
|
1346
1369
|
if (closingSessionId) {
|
|
1347
|
-
void
|
|
1370
|
+
void chunk46Z6MNRS_js.clearAudienceContent(closingSessionId);
|
|
1348
1371
|
}
|
|
1349
1372
|
}, [getChannel]);
|
|
1350
1373
|
const openAudienceWindow = react.useCallback(() => {
|
|
@@ -1362,10 +1385,10 @@ function usePresenterWindow(input) {
|
|
|
1362
1385
|
audienceWindowRef.current = blankWin;
|
|
1363
1386
|
const sessionId = generateSessionId();
|
|
1364
1387
|
sessionIdRef.current = sessionId;
|
|
1365
|
-
const audienceUrl =
|
|
1366
|
-
void
|
|
1388
|
+
const audienceUrl = chunk46Z6MNRS_js.buildPresentationAudienceUrl(window.location.href, sessionId);
|
|
1389
|
+
void chunk46Z6MNRS_js.resolveAudienceScreenPlacement(window).then((placement) => {
|
|
1367
1390
|
if (placement && audienceWindowRef.current === blankWin && !blankWin.closed) {
|
|
1368
|
-
|
|
1391
|
+
chunk46Z6MNRS_js.placeAudienceWindow(blankWin, placement);
|
|
1369
1392
|
}
|
|
1370
1393
|
return void 0;
|
|
1371
1394
|
});
|
|
@@ -1395,7 +1418,7 @@ function usePresenterWindow(input) {
|
|
|
1395
1418
|
}
|
|
1396
1419
|
};
|
|
1397
1420
|
if (content) {
|
|
1398
|
-
void
|
|
1421
|
+
void chunk46Z6MNRS_js.storeAudienceContent(content, sessionId).then(() => navigateOrClose(true)).catch(() => navigateOrClose(false));
|
|
1399
1422
|
} else {
|
|
1400
1423
|
navigateOrClose(true);
|
|
1401
1424
|
}
|
|
@@ -1421,7 +1444,7 @@ function usePresenterWindow(input) {
|
|
|
1421
1444
|
}
|
|
1422
1445
|
const handleMessage = (event) => {
|
|
1423
1446
|
const message = event.data;
|
|
1424
|
-
if (
|
|
1447
|
+
if (chunk46Z6MNRS_js.isPresentationSessionMessage(message) && message.type === "audience-ready" && message.sessionId === sessionIdRef.current) {
|
|
1425
1448
|
syncStateToAudience(snapshotRef.current);
|
|
1426
1449
|
}
|
|
1427
1450
|
};
|
|
@@ -1450,7 +1473,7 @@ function usePresenterWindow(input) {
|
|
|
1450
1473
|
react.useEffect(() => {
|
|
1451
1474
|
const handleBeforeUnload = () => {
|
|
1452
1475
|
if (sessionIdRef.current) {
|
|
1453
|
-
void
|
|
1476
|
+
void chunk46Z6MNRS_js.clearAudienceContent(sessionIdRef.current);
|
|
1454
1477
|
}
|
|
1455
1478
|
};
|
|
1456
1479
|
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
@@ -1503,7 +1526,7 @@ function useAudienceMode(input) {
|
|
|
1503
1526
|
}
|
|
1504
1527
|
channel.onmessage = (event) => {
|
|
1505
1528
|
const data = event.data;
|
|
1506
|
-
if (!
|
|
1529
|
+
if (!chunk46Z6MNRS_js.isPresentationSessionMessage(data) || data.origin !== PRESENTER_MSG_ORIGIN) {
|
|
1507
1530
|
return;
|
|
1508
1531
|
}
|
|
1509
1532
|
if (expectedSessionId && data.sessionId !== expectedSessionId) {
|
|
@@ -1518,7 +1541,7 @@ function useAudienceMode(input) {
|
|
|
1518
1541
|
}
|
|
1519
1542
|
if (data.type === "presenter-exit") {
|
|
1520
1543
|
if (expectedSessionId) {
|
|
1521
|
-
void
|
|
1544
|
+
void chunk46Z6MNRS_js.clearAudienceContent(expectedSessionId);
|
|
1522
1545
|
}
|
|
1523
1546
|
onSetMode("edit");
|
|
1524
1547
|
try {
|
|
@@ -1529,7 +1552,7 @@ function useAudienceMode(input) {
|
|
|
1529
1552
|
};
|
|
1530
1553
|
if (expectedSessionId) {
|
|
1531
1554
|
channel.postMessage({
|
|
1532
|
-
origin:
|
|
1555
|
+
origin: chunk46Z6MNRS_js.PRESENTATION_MESSAGE_ORIGIN,
|
|
1533
1556
|
type: "audience-ready",
|
|
1534
1557
|
sessionId: expectedSessionId
|
|
1535
1558
|
});
|
|
@@ -1794,7 +1817,7 @@ function handlePresentationActionImpl(action, deps) {
|
|
|
1794
1817
|
return;
|
|
1795
1818
|
}
|
|
1796
1819
|
if (action.url && !actionStr.includes("hlinksldjump")) {
|
|
1797
|
-
if (
|
|
1820
|
+
if (chunk46Z6MNRS_js.isUrlSafe(action.url)) {
|
|
1798
1821
|
window.open(action.url, "_blank", "noopener,noreferrer");
|
|
1799
1822
|
}
|
|
1800
1823
|
}
|
|
@@ -1804,7 +1827,7 @@ function handlePresentationActionImpl(action, deps) {
|
|
|
1804
1827
|
function executeSlideTransition(nextSlideIndex, deps) {
|
|
1805
1828
|
const incomingSlide = deps.slides[nextSlideIndex];
|
|
1806
1829
|
const transition = incomingSlide?.transition;
|
|
1807
|
-
const durationMs = deps.playTransition ?
|
|
1830
|
+
const durationMs = deps.playTransition ? chunk46Z6MNRS_js.resolveTransitionDurationMs(transition) : 0;
|
|
1808
1831
|
deps.clearPresentationTimers();
|
|
1809
1832
|
deps.setPresentationSlideIndex(nextSlideIndex);
|
|
1810
1833
|
deps.onSetActiveSlideIndex(nextSlideIndex);
|
|
@@ -2050,17 +2073,17 @@ function useZoomNavigation(input) {
|
|
|
2050
2073
|
};
|
|
2051
2074
|
}
|
|
2052
2075
|
function usePresenterConsole(slideIndex) {
|
|
2053
|
-
const timerRef = react.useRef(
|
|
2054
|
-
const [snapshot, setSnapshot] = react.useState(() =>
|
|
2076
|
+
const timerRef = react.useRef(chunk46Z6MNRS_js.createPresenterTimer());
|
|
2077
|
+
const [snapshot, setSnapshot] = react.useState(() => chunk46Z6MNRS_js.createInitialPresentationSnapshot(slideIndex));
|
|
2055
2078
|
const patch = react.useCallback((value) => {
|
|
2056
|
-
setSnapshot((current) =>
|
|
2079
|
+
setSnapshot((current) => chunk46Z6MNRS_js.mergePresentationSnapshot(current, value));
|
|
2057
2080
|
}, []);
|
|
2058
2081
|
react.useEffect(() => patch({ slideIndex }), [patch, slideIndex]);
|
|
2059
2082
|
react.useEffect(() => {
|
|
2060
2083
|
const timer = window.setInterval(() => {
|
|
2061
2084
|
patch({
|
|
2062
2085
|
paused: timerRef.current.paused,
|
|
2063
|
-
elapsedMs:
|
|
2086
|
+
elapsedMs: chunk46Z6MNRS_js.presenterElapsed(timerRef.current)
|
|
2064
2087
|
});
|
|
2065
2088
|
}, 1e3);
|
|
2066
2089
|
return () => window.clearInterval(timer);
|
|
@@ -2070,19 +2093,19 @@ function usePresenterConsole(slideIndex) {
|
|
|
2070
2093
|
applyAudienceSnapshot: setSnapshot,
|
|
2071
2094
|
setBlackout: (blackout) => patch({ blackout }),
|
|
2072
2095
|
toggleTimer: () => {
|
|
2073
|
-
timerRef.current =
|
|
2096
|
+
timerRef.current = chunk46Z6MNRS_js.togglePresenterTimer(timerRef.current);
|
|
2074
2097
|
patch({
|
|
2075
2098
|
paused: timerRef.current.paused,
|
|
2076
|
-
elapsedMs:
|
|
2099
|
+
elapsedMs: chunk46Z6MNRS_js.presenterElapsed(timerRef.current)
|
|
2077
2100
|
});
|
|
2078
2101
|
},
|
|
2079
2102
|
resetTimer: () => {
|
|
2080
|
-
timerRef.current =
|
|
2103
|
+
timerRef.current = chunk46Z6MNRS_js.resetPresenterTimer();
|
|
2081
2104
|
patch({ paused: false, elapsedMs: 0 });
|
|
2082
2105
|
},
|
|
2083
2106
|
stepZoom: (direction) => setSnapshot(
|
|
2084
|
-
(current) =>
|
|
2085
|
-
zoom:
|
|
2107
|
+
(current) => chunk46Z6MNRS_js.mergePresentationSnapshot(current, {
|
|
2108
|
+
zoom: chunk46Z6MNRS_js.stepPresenterZoom(
|
|
2086
2109
|
current.zoom ?? { scale: 1, originX: 0.5, originY: 0.5 },
|
|
2087
2110
|
direction
|
|
2088
2111
|
)
|
|
@@ -3299,14 +3322,17 @@ function useViewerCoreState(_input) {
|
|
|
3299
3322
|
const shapeAdjustmentDragStateRef = react.useRef(null);
|
|
3300
3323
|
const marqueeStateRef = react.useRef(null);
|
|
3301
3324
|
const isDrawingRef = react.useRef(false);
|
|
3325
|
+
const livePatcher = react.useMemo(() => chunk46Z6MNRS_js.createCollaborationLivePatcher(), []);
|
|
3326
|
+
react.useEffect(() => () => livePatcher.dispose(), [livePatcher]);
|
|
3327
|
+
const slidesRef = react.useRef([]);
|
|
3302
3328
|
const [mode, setMode] = react.useState("edit");
|
|
3303
3329
|
const [loading, setLoading] = react.useState(true);
|
|
3304
3330
|
const [error, setError] = react.useState(null);
|
|
3305
3331
|
const [slides, setSlides] = react.useState([]);
|
|
3306
3332
|
const [templateElementsBySlideId, setTemplateElementsBySlideId] = react.useState({});
|
|
3307
3333
|
const [canvasSize, setCanvasSize] = react.useState({
|
|
3308
|
-
width:
|
|
3309
|
-
height:
|
|
3334
|
+
width: chunkLDF77JJD_js.DEFAULT_CANVAS_WIDTH,
|
|
3335
|
+
height: chunkLDF77JJD_js.DEFAULT_CANVAS_HEIGHT
|
|
3310
3336
|
});
|
|
3311
3337
|
const [activeSlideIndex, setActiveSlideIndex] = react.useState(0);
|
|
3312
3338
|
const [selectedElementId, setSelectedElementId] = react.useState(null);
|
|
@@ -3326,8 +3352,14 @@ function useViewerCoreState(_input) {
|
|
|
3326
3352
|
const resolved = typeof value === "function" ? value(inlineEditingTextRef.current) : value;
|
|
3327
3353
|
inlineEditingTextRef.current = resolved;
|
|
3328
3354
|
setInlineEditingTextBase(value);
|
|
3355
|
+
chunk46Z6MNRS_js.publishLiveInlineText(
|
|
3356
|
+
livePatcher,
|
|
3357
|
+
slidesRef.current[activeSlideIndexRef.current],
|
|
3358
|
+
inlineEditingElementIdRef.current,
|
|
3359
|
+
resolved
|
|
3360
|
+
);
|
|
3329
3361
|
},
|
|
3330
|
-
[]
|
|
3362
|
+
[livePatcher]
|
|
3331
3363
|
);
|
|
3332
3364
|
const [editTemplateMode, setEditTemplateMode] = react.useState(false);
|
|
3333
3365
|
const [newShapeType, setNewShapeType] = react.useState("rect");
|
|
@@ -3361,6 +3393,7 @@ function useViewerCoreState(_input) {
|
|
|
3361
3393
|
const [preMasterMode, setPreMasterMode] = react.useState("edit");
|
|
3362
3394
|
const [masterViewTab, setMasterViewTab] = react.useState("slides");
|
|
3363
3395
|
const [handoutSlidesPerPage, setHandoutSlidesPerPage] = react.useState(4);
|
|
3396
|
+
slidesRef.current = slides;
|
|
3364
3397
|
const derived = useDerivedElementState({
|
|
3365
3398
|
slides,
|
|
3366
3399
|
activeSlideIndex,
|
|
@@ -3385,6 +3418,7 @@ function useViewerCoreState(_input) {
|
|
|
3385
3418
|
shapeAdjustmentDragStateRef,
|
|
3386
3419
|
marqueeStateRef,
|
|
3387
3420
|
isDrawingRef,
|
|
3421
|
+
livePatcher,
|
|
3388
3422
|
mode,
|
|
3389
3423
|
setMode,
|
|
3390
3424
|
loading,
|
|
@@ -3655,7 +3689,7 @@ function useLoadContent({
|
|
|
3655
3689
|
handlerRef.current = null;
|
|
3656
3690
|
const mediaElements = [];
|
|
3657
3691
|
for (const slide of parsed.slides) {
|
|
3658
|
-
|
|
3692
|
+
chunk46Z6MNRS_js.collectMediaElements(slide.elements, mediaElements);
|
|
3659
3693
|
}
|
|
3660
3694
|
for (const url of mediaDataUrls.values()) {
|
|
3661
3695
|
if (url.startsWith("blob:")) {
|
|
@@ -3696,7 +3730,7 @@ function useLoadContent({
|
|
|
3696
3730
|
}
|
|
3697
3731
|
})
|
|
3698
3732
|
);
|
|
3699
|
-
const { paths: imagePaths, refs: imageRefs } =
|
|
3733
|
+
const { paths: imagePaths, refs: imageRefs } = chunk46Z6MNRS_js.collectImagePaths(parsed.slides);
|
|
3700
3734
|
let nextSlides = parsed.slides;
|
|
3701
3735
|
if (imagePaths.size > 0) {
|
|
3702
3736
|
const resolvedMap = /* @__PURE__ */ new Map();
|
|
@@ -3751,12 +3785,12 @@ function useLoadContent({
|
|
|
3751
3785
|
}
|
|
3752
3786
|
}
|
|
3753
3787
|
handlerRef.current = handler;
|
|
3754
|
-
const partition =
|
|
3788
|
+
const partition = chunkLDF77JJD_js.partitionTemplateElements(nextSlides);
|
|
3755
3789
|
setSlides(partition.slides);
|
|
3756
3790
|
setTemplateElementsBySlideId(partition.templateElementsBySlideId);
|
|
3757
3791
|
setCanvasSize({
|
|
3758
|
-
width: parsed.width ??
|
|
3759
|
-
height: parsed.height ??
|
|
3792
|
+
width: parsed.width ?? chunkLDF77JJD_js.DEFAULT_CANVAS_WIDTH,
|
|
3793
|
+
height: parsed.height ?? chunkLDF77JJD_js.DEFAULT_CANVAS_HEIGHT
|
|
3760
3794
|
});
|
|
3761
3795
|
setHeaderFooter(parsed.headerFooter ?? {});
|
|
3762
3796
|
setLayoutOptions(parsed.layoutOptions ?? []);
|
|
@@ -3785,7 +3819,7 @@ function useLoadContent({
|
|
|
3785
3819
|
setHasMacros(parsed.hasMacros === true);
|
|
3786
3820
|
setHasDigitalSignatures(parsed.hasDigitalSignatures === true);
|
|
3787
3821
|
setDigitalSignatureCount(parsed.digitalSignatureCount ?? 0);
|
|
3788
|
-
setGuides(
|
|
3822
|
+
setGuides(chunk46Z6MNRS_js.buildInitialGuides(parsed.presentationGuides, parsed.slides[0]?.guides));
|
|
3789
3823
|
setActiveSlideIndex(0);
|
|
3790
3824
|
clearSelection();
|
|
3791
3825
|
setIsDirty(false);
|
|
@@ -3870,7 +3904,7 @@ function useAutosave(input) {
|
|
|
3870
3904
|
isSavingRef.current = false;
|
|
3871
3905
|
return;
|
|
3872
3906
|
}
|
|
3873
|
-
await
|
|
3907
|
+
await chunk46Z6MNRS_js.saveAutosaveSnapshot(filePathRef.current, data);
|
|
3874
3908
|
setAutosaveStatus({ state: "saved", timestamp: Date.now() });
|
|
3875
3909
|
} catch (err) {
|
|
3876
3910
|
setAutosaveStatus({
|
|
@@ -3935,7 +3969,7 @@ function useElementOperations(input) {
|
|
|
3935
3969
|
}, [applySelection, setInlineEditingElementId, setContextMenuState]);
|
|
3936
3970
|
const updateElementById = react.useCallback(
|
|
3937
3971
|
(elementId, updates) => {
|
|
3938
|
-
if (
|
|
3972
|
+
if (chunk46Z6MNRS_js.isTemplateElementId(elementId)) {
|
|
3939
3973
|
const slideId = activeSlide?.id;
|
|
3940
3974
|
if (slideId) {
|
|
3941
3975
|
setTemplateElementsBySlideId((prev) => ({
|
|
@@ -3989,14 +4023,14 @@ function useElementOperations(input) {
|
|
|
3989
4023
|
if (!selectedElement || !chunkCLNGAVNH_js.hasTextProperties(selectedElement)) {
|
|
3990
4024
|
return;
|
|
3991
4025
|
}
|
|
3992
|
-
const inlineSel =
|
|
4026
|
+
const inlineSel = chunk46Z6MNRS_js.getInlineEditorSelection(selectedElement.textSegments);
|
|
3993
4027
|
if (inlineSel && selectedElement.textSegments) {
|
|
3994
|
-
const { newSegments: newSegments2, newSelection } =
|
|
4028
|
+
const { newSegments: newSegments2, newSelection } = chunk46Z6MNRS_js.applyStyleToSelectedSegments(
|
|
3995
4029
|
selectedElement.textSegments,
|
|
3996
4030
|
inlineSel,
|
|
3997
4031
|
updates
|
|
3998
4032
|
);
|
|
3999
|
-
|
|
4033
|
+
chunk46Z6MNRS_js.setPendingSelectionRestore(newSelection);
|
|
4000
4034
|
updateSelectedElement({
|
|
4001
4035
|
textSegments: newSegments2
|
|
4002
4036
|
});
|
|
@@ -4019,9 +4053,9 @@ function useElementOperations(input) {
|
|
|
4019
4053
|
if (!selectedElement || !chunkCLNGAVNH_js.hasTextProperties(selectedElement)) {
|
|
4020
4054
|
return;
|
|
4021
4055
|
}
|
|
4022
|
-
const inlineSel =
|
|
4056
|
+
const inlineSel = chunk46Z6MNRS_js.getInlineEditorSelection(selectedElement.textSegments);
|
|
4023
4057
|
if (inlineSel && selectedElement.textSegments) {
|
|
4024
|
-
const newSegments =
|
|
4058
|
+
const newSegments = chunk46Z6MNRS_js.applyCaseTransformToSegments(
|
|
4025
4059
|
selectedElement.textSegments,
|
|
4026
4060
|
inlineSel,
|
|
4027
4061
|
mode
|
|
@@ -4031,14 +4065,14 @@ function useElementOperations(input) {
|
|
|
4031
4065
|
}
|
|
4032
4066
|
const updates = {};
|
|
4033
4067
|
if (selectedElement.textSegments && selectedElement.textSegments.length > 0) {
|
|
4034
|
-
updates.textSegments =
|
|
4068
|
+
updates.textSegments = chunk46Z6MNRS_js.applyCaseTransformToSegments(
|
|
4035
4069
|
selectedElement.textSegments,
|
|
4036
4070
|
null,
|
|
4037
4071
|
mode
|
|
4038
4072
|
);
|
|
4039
4073
|
}
|
|
4040
4074
|
if (typeof selectedElement.text === "string") {
|
|
4041
|
-
updates.text =
|
|
4075
|
+
updates.text = chunk46Z6MNRS_js.transformTextCase(selectedElement.text, mode);
|
|
4042
4076
|
}
|
|
4043
4077
|
updateSelectedElement(updates);
|
|
4044
4078
|
},
|
|
@@ -4093,7 +4127,7 @@ function useSectionOperations(input) {
|
|
|
4093
4127
|
const { sections, setSections, slides, setSlides, markDirty } = input;
|
|
4094
4128
|
const addSection2 = react.useCallback(
|
|
4095
4129
|
(name, afterSlideIndex) => {
|
|
4096
|
-
const result =
|
|
4130
|
+
const result = chunk46Z6MNRS_js.addSection(sections, slides, name, afterSlideIndex);
|
|
4097
4131
|
setSlides(result.slides);
|
|
4098
4132
|
setSections(result.sections);
|
|
4099
4133
|
markDirty();
|
|
@@ -4102,7 +4136,7 @@ function useSectionOperations(input) {
|
|
|
4102
4136
|
);
|
|
4103
4137
|
const renameSection2 = react.useCallback(
|
|
4104
4138
|
(sectionId, newName) => {
|
|
4105
|
-
const result =
|
|
4139
|
+
const result = chunk46Z6MNRS_js.renameSection(sections, slides, sectionId, newName);
|
|
4106
4140
|
setSections(result.sections);
|
|
4107
4141
|
setSlides(result.slides);
|
|
4108
4142
|
markDirty();
|
|
@@ -4111,7 +4145,7 @@ function useSectionOperations(input) {
|
|
|
4111
4145
|
);
|
|
4112
4146
|
const deleteSection2 = react.useCallback(
|
|
4113
4147
|
(sectionId) => {
|
|
4114
|
-
const result =
|
|
4148
|
+
const result = chunk46Z6MNRS_js.deleteSection(sections, slides, sectionId);
|
|
4115
4149
|
setSections(result.sections);
|
|
4116
4150
|
setSlides(result.slides);
|
|
4117
4151
|
markDirty();
|
|
@@ -4120,21 +4154,21 @@ function useSectionOperations(input) {
|
|
|
4120
4154
|
);
|
|
4121
4155
|
const moveSectionUp2 = react.useCallback(
|
|
4122
4156
|
(sectionId) => {
|
|
4123
|
-
setSections(
|
|
4157
|
+
setSections(chunk46Z6MNRS_js.moveSectionUp(sections, sectionId));
|
|
4124
4158
|
markDirty();
|
|
4125
4159
|
},
|
|
4126
4160
|
[sections, setSections, markDirty]
|
|
4127
4161
|
);
|
|
4128
4162
|
const moveSectionDown2 = react.useCallback(
|
|
4129
4163
|
(sectionId) => {
|
|
4130
|
-
setSections(
|
|
4164
|
+
setSections(chunk46Z6MNRS_js.moveSectionDown(sections, sectionId));
|
|
4131
4165
|
markDirty();
|
|
4132
4166
|
},
|
|
4133
4167
|
[sections, setSections, markDirty]
|
|
4134
4168
|
);
|
|
4135
4169
|
const moveSlidesToSection2 = react.useCallback(
|
|
4136
4170
|
(slideIndexes, targetSectionId) => {
|
|
4137
|
-
const result =
|
|
4171
|
+
const result = chunk46Z6MNRS_js.moveSlidesToSection(sections, slides, slideIndexes, targetSectionId);
|
|
4138
4172
|
setSlides(result.slides);
|
|
4139
4173
|
setSections(result.sections);
|
|
4140
4174
|
markDirty();
|
|
@@ -4153,25 +4187,32 @@ function useSectionOperations(input) {
|
|
|
4153
4187
|
|
|
4154
4188
|
// src/viewer/hooks/pointer-move-handlers.ts
|
|
4155
4189
|
function computeResizeGeometry(handle, startX, startY, startWidth, startHeight, dx, dy, snapToGrid, gridSpacingPx) {
|
|
4156
|
-
const resized =
|
|
4190
|
+
const resized = chunk46Z6MNRS_js.applyResize(
|
|
4157
4191
|
{ x: startX, y: startY, width: startWidth, height: startHeight },
|
|
4158
4192
|
handle,
|
|
4159
4193
|
dx,
|
|
4160
4194
|
dy,
|
|
4161
4195
|
1,
|
|
4162
|
-
{ minSize:
|
|
4196
|
+
{ minSize: chunkLDF77JJD_js.MIN_ELEMENT_SIZE }
|
|
4163
4197
|
);
|
|
4164
4198
|
const box = { x: resized.x, y: resized.y, width: resized.width, height: resized.height };
|
|
4165
4199
|
if (!snapToGrid) {
|
|
4166
4200
|
return box;
|
|
4167
4201
|
}
|
|
4168
|
-
return
|
|
4202
|
+
return chunk46Z6MNRS_js.snapBoxToGrid(box, handle, gridSpacingPx, chunkLDF77JJD_js.MIN_ELEMENT_SIZE);
|
|
4169
4203
|
}
|
|
4170
4204
|
function computeAdjustmentValue(startAdjustment, dx, startWidth) {
|
|
4171
4205
|
const range = startWidth || 200;
|
|
4172
4206
|
const delta = dx / range;
|
|
4173
4207
|
return Math.max(0, Math.min(1, startAdjustment + delta));
|
|
4174
4208
|
}
|
|
4209
|
+
function resolveLiveTarget(input) {
|
|
4210
|
+
const { livePatcher, editTemplateMode, activeSlide } = input;
|
|
4211
|
+
if (!livePatcher || editTemplateMode || !livePatcher.isActive()) {
|
|
4212
|
+
return void 0;
|
|
4213
|
+
}
|
|
4214
|
+
return { patcher: livePatcher, slideId: activeSlide?.id };
|
|
4215
|
+
}
|
|
4175
4216
|
function processPointerMove(e, input, tracker) {
|
|
4176
4217
|
const {
|
|
4177
4218
|
editorScale,
|
|
@@ -4220,13 +4261,14 @@ function processPointerMove(e, input, tracker) {
|
|
|
4220
4261
|
guides,
|
|
4221
4262
|
elementLookup,
|
|
4222
4263
|
tracker,
|
|
4223
|
-
setSnapLines
|
|
4264
|
+
setSnapLines,
|
|
4265
|
+
resolveLiveTarget(input)
|
|
4224
4266
|
);
|
|
4225
4267
|
return;
|
|
4226
4268
|
}
|
|
4227
4269
|
const rs = resizeStateRef.current;
|
|
4228
4270
|
if (rs) {
|
|
4229
|
-
processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx);
|
|
4271
|
+
processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx, resolveLiveTarget(input));
|
|
4230
4272
|
return;
|
|
4231
4273
|
}
|
|
4232
4274
|
const adj = shapeAdjustmentDragStateRef.current;
|
|
@@ -4244,7 +4286,7 @@ function processMarqueeMove(e, marquee, canvasStageRef, canvasSize, editorScale,
|
|
|
4244
4286
|
marquee.currentY = Math.max(0, Math.min(canvasSize.height, (e.clientY - rect.top) / editorScale));
|
|
4245
4287
|
setMarqueeSelectionState({ ...marquee });
|
|
4246
4288
|
}
|
|
4247
|
-
function processDragMove(e, drag, editorScale, snapToGrid, snapToShape, gridSpacingPx, editTemplateMode, templateElements, activeSlide, guides, elementLookup, tracker, setSnapLines) {
|
|
4289
|
+
function processDragMove(e, drag, editorScale, snapToGrid, snapToShape, gridSpacingPx, editTemplateMode, templateElements, activeSlide, guides, elementLookup, tracker, setSnapLines, live) {
|
|
4248
4290
|
const dx = (e.clientX - drag.startClientX) / editorScale;
|
|
4249
4291
|
const dy = (e.clientY - drag.startClientY) / editorScale;
|
|
4250
4292
|
if (!drag.moved && (Math.abs(dx) > 2 || Math.abs(dy) > 2)) {
|
|
@@ -4275,7 +4317,7 @@ function processDragMove(e, drag, editorScale, snapToGrid, snapToShape, gridSpac
|
|
|
4275
4317
|
width: el.width,
|
|
4276
4318
|
height: el.height
|
|
4277
4319
|
}));
|
|
4278
|
-
const snapResult =
|
|
4320
|
+
const snapResult = chunk46Z6MNRS_js.computeSnapToShape(
|
|
4279
4321
|
targetX,
|
|
4280
4322
|
targetY,
|
|
4281
4323
|
primaryEl.width,
|
|
@@ -4311,8 +4353,17 @@ function processDragMove(e, drag, editorScale, snapToGrid, snapToShape, gridSpac
|
|
|
4311
4353
|
domEl.style.top = `${start.y + appliedDy}px`;
|
|
4312
4354
|
}
|
|
4313
4355
|
}
|
|
4356
|
+
if (live) {
|
|
4357
|
+
for (const id of Object.keys(drag.startPositionsById)) {
|
|
4358
|
+
const start = drag.startPositionsById[id];
|
|
4359
|
+
chunk46Z6MNRS_js.publishLiveGeometry(live.patcher, live.slideId, id, {
|
|
4360
|
+
x: start.x + appliedDx,
|
|
4361
|
+
y: start.y + appliedDy
|
|
4362
|
+
});
|
|
4363
|
+
}
|
|
4364
|
+
}
|
|
4314
4365
|
}
|
|
4315
|
-
function processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx) {
|
|
4366
|
+
function processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx, live) {
|
|
4316
4367
|
const dx = (e.clientX - rs.startClientX) / editorScale;
|
|
4317
4368
|
const dy = (e.clientY - rs.startClientY) / editorScale;
|
|
4318
4369
|
if (!rs.moved && (Math.abs(dx) > 2 || Math.abs(dy) > 2)) {
|
|
@@ -4339,8 +4390,16 @@ function processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx) {
|
|
|
4339
4390
|
if (rs.domEl) {
|
|
4340
4391
|
rs.domEl.style.left = `${geo.x}px`;
|
|
4341
4392
|
rs.domEl.style.top = `${geo.y}px`;
|
|
4342
|
-
rs.domEl.style.width = `${Math.max(geo.width,
|
|
4343
|
-
rs.domEl.style.height = `${Math.max(geo.height,
|
|
4393
|
+
rs.domEl.style.width = `${Math.max(geo.width, chunkLDF77JJD_js.MIN_ELEMENT_SIZE)}px`;
|
|
4394
|
+
rs.domEl.style.height = `${Math.max(geo.height, chunkLDF77JJD_js.MIN_ELEMENT_SIZE)}px`;
|
|
4395
|
+
}
|
|
4396
|
+
if (live) {
|
|
4397
|
+
chunk46Z6MNRS_js.publishLiveGeometry(live.patcher, live.slideId, rs.elementId, {
|
|
4398
|
+
x: geo.x,
|
|
4399
|
+
y: geo.y,
|
|
4400
|
+
width: Math.max(geo.width, chunkLDF77JJD_js.MIN_ELEMENT_SIZE),
|
|
4401
|
+
height: Math.max(geo.height, chunkLDF77JJD_js.MIN_ELEMENT_SIZE)
|
|
4402
|
+
});
|
|
4344
4403
|
}
|
|
4345
4404
|
}
|
|
4346
4405
|
function processAdjustmentMove(e, adj, editorScale, updateElementById) {
|
|
@@ -4375,7 +4434,8 @@ function processPointerUp(input) {
|
|
|
4375
4434
|
clearSelection,
|
|
4376
4435
|
updateSlides,
|
|
4377
4436
|
updateElementById,
|
|
4378
|
-
markDirty
|
|
4437
|
+
markDirty,
|
|
4438
|
+
livePatcher
|
|
4379
4439
|
} = input;
|
|
4380
4440
|
const marquee = marqueeStateRef.current;
|
|
4381
4441
|
const drag = dragStateRef.current;
|
|
@@ -4418,18 +4478,21 @@ function processPointerUp(input) {
|
|
|
4418
4478
|
if (i !== activeSlideIndex) {
|
|
4419
4479
|
return s;
|
|
4420
4480
|
}
|
|
4421
|
-
const rerouted =
|
|
4481
|
+
const rerouted = chunk46Z6MNRS_js.rerouteConnectorsForMovedElements(s.elements, movedIds);
|
|
4422
4482
|
if (rerouted.length === 0) {
|
|
4423
4483
|
return s;
|
|
4424
4484
|
}
|
|
4425
4485
|
return {
|
|
4426
4486
|
...s,
|
|
4427
|
-
elements:
|
|
4487
|
+
elements: chunk46Z6MNRS_js.applyReroutedConnectors(s.elements, rerouted)
|
|
4428
4488
|
};
|
|
4429
4489
|
})
|
|
4430
4490
|
);
|
|
4431
4491
|
}
|
|
4432
4492
|
const wasMoved = drag?.moved || rs?.moved || adj?.moved;
|
|
4493
|
+
if (wasMoved) {
|
|
4494
|
+
livePatcher?.flush();
|
|
4495
|
+
}
|
|
4433
4496
|
marqueeStateRef.current = null;
|
|
4434
4497
|
dragStateRef.current = null;
|
|
4435
4498
|
resizeStateRef.current = null;
|
|
@@ -4443,9 +4506,9 @@ function processPointerUp(input) {
|
|
|
4443
4506
|
}
|
|
4444
4507
|
function commitMarquee(marquee, editTemplateMode, templateElements, activeSlide, applySelection, clearSelection) {
|
|
4445
4508
|
const sourceElements = editTemplateMode ? templateElements : activeSlide?.elements ?? [];
|
|
4446
|
-
const hitIds =
|
|
4509
|
+
const hitIds = chunk46Z6MNRS_js.computeMarqueeHitIds(marquee, sourceElements);
|
|
4447
4510
|
if (marquee.additive) {
|
|
4448
|
-
const merged =
|
|
4511
|
+
const merged = chunk46Z6MNRS_js.mergeAdditiveSelection(marquee.baseSelectionIds, hitIds);
|
|
4449
4512
|
if (merged.length > 0) {
|
|
4450
4513
|
applySelection(merged[0], merged);
|
|
4451
4514
|
} else {
|
|
@@ -4468,8 +4531,8 @@ function commitDrag(drag, editTemplateMode, activeSlide, activeSlideIndex, setTe
|
|
|
4468
4531
|
}
|
|
4469
4532
|
return { ...el, x: start.x + dx, y: start.y + dy };
|
|
4470
4533
|
});
|
|
4471
|
-
const rerouted =
|
|
4472
|
-
return
|
|
4534
|
+
const rerouted = chunk46Z6MNRS_js.rerouteConnectorsForMovedElements(movedElements, movedIds);
|
|
4535
|
+
return chunk46Z6MNRS_js.applyReroutedConnectors(movedElements, rerouted);
|
|
4473
4536
|
};
|
|
4474
4537
|
if (editTemplateMode) {
|
|
4475
4538
|
const slideId = activeSlide?.id;
|
|
@@ -4514,7 +4577,8 @@ function usePointerHandlers(input) {
|
|
|
4514
4577
|
clearSelection,
|
|
4515
4578
|
updateSlides,
|
|
4516
4579
|
updateElementById,
|
|
4517
|
-
markDirty
|
|
4580
|
+
markDirty,
|
|
4581
|
+
livePatcher
|
|
4518
4582
|
} = input;
|
|
4519
4583
|
react.useEffect(() => {
|
|
4520
4584
|
const tracker = {
|
|
@@ -4578,6 +4642,7 @@ function usePointerHandlers(input) {
|
|
|
4578
4642
|
updateSlides,
|
|
4579
4643
|
updateElementById,
|
|
4580
4644
|
markDirty,
|
|
4645
|
+
livePatcher,
|
|
4581
4646
|
input
|
|
4582
4647
|
]);
|
|
4583
4648
|
}
|
|
@@ -4622,7 +4687,7 @@ function useCanvasInteractions(input) {
|
|
|
4622
4687
|
const el = elementLookup.get(editId);
|
|
4623
4688
|
if (el && chunkCLNGAVNH_js.hasTextProperties(el)) {
|
|
4624
4689
|
const committedText = transformCommittedText ? transformCommittedText(inlineEditingText) : inlineEditingText;
|
|
4625
|
-
const newSegments =
|
|
4690
|
+
const newSegments = chunk46Z6MNRS_js.remapTextToSegments(committedText, el.textSegments, el.textStyle);
|
|
4626
4691
|
ops.updateElementById(editId, {
|
|
4627
4692
|
text: committedText,
|
|
4628
4693
|
textSegments: newSegments
|
|
@@ -4871,7 +4936,7 @@ function createFileHandlers(deps) {
|
|
|
4871
4936
|
h = Math.round(h * scale);
|
|
4872
4937
|
}
|
|
4873
4938
|
addElement({
|
|
4874
|
-
id:
|
|
4939
|
+
id: chunk46Z6MNRS_js.generateElementId(),
|
|
4875
4940
|
type: "image",
|
|
4876
4941
|
x: Math.round((canvasSize.width - w) / 2),
|
|
4877
4942
|
y: Math.round((canvasSize.height - h) / 2),
|
|
@@ -4882,7 +4947,7 @@ function createFileHandlers(deps) {
|
|
|
4882
4947
|
};
|
|
4883
4948
|
img.onerror = () => {
|
|
4884
4949
|
addElement({
|
|
4885
|
-
id:
|
|
4950
|
+
id: chunk46Z6MNRS_js.generateElementId(),
|
|
4886
4951
|
type: "image",
|
|
4887
4952
|
x: 100,
|
|
4888
4953
|
y: 100,
|
|
@@ -4908,7 +4973,7 @@ function createFileHandlers(deps) {
|
|
|
4908
4973
|
const elFilePath = file.path;
|
|
4909
4974
|
const insertMediaElement = (mediaSourceUrl, width, height) => {
|
|
4910
4975
|
addElement({
|
|
4911
|
-
id:
|
|
4976
|
+
id: chunk46Z6MNRS_js.generateElementId(),
|
|
4912
4977
|
type: "media",
|
|
4913
4978
|
mediaType,
|
|
4914
4979
|
mediaMimeType: file.type || void 0,
|
|
@@ -5083,13 +5148,13 @@ function createStructuredElementHandlers(deps) {
|
|
|
5083
5148
|
return;
|
|
5084
5149
|
}
|
|
5085
5150
|
addElement({
|
|
5086
|
-
id:
|
|
5151
|
+
id: chunk46Z6MNRS_js.generateElementId(),
|
|
5087
5152
|
type: "smartArt",
|
|
5088
5153
|
x: 100,
|
|
5089
5154
|
y: 120,
|
|
5090
5155
|
width: 600,
|
|
5091
5156
|
height: 340,
|
|
5092
|
-
smartArtData:
|
|
5157
|
+
smartArtData: chunk46Z6MNRS_js.buildSmartArtPresetData(
|
|
5093
5158
|
layout,
|
|
5094
5159
|
defaultItems,
|
|
5095
5160
|
(i) => `node-${Date.now()}-${i}-${Math.random().toString(36).slice(2, 8)}`
|
|
@@ -5101,7 +5166,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5101
5166
|
return;
|
|
5102
5167
|
}
|
|
5103
5168
|
addElement({
|
|
5104
|
-
id:
|
|
5169
|
+
id: chunk46Z6MNRS_js.generateElementId(),
|
|
5105
5170
|
type: "shape",
|
|
5106
5171
|
x: 120,
|
|
5107
5172
|
y: 200,
|
|
@@ -5160,7 +5225,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5160
5225
|
const displayText = value || fieldTexts[fieldType] || fieldType;
|
|
5161
5226
|
const fieldGuid = `{${crypto.randomUUID().toUpperCase()}}`;
|
|
5162
5227
|
addElement({
|
|
5163
|
-
id:
|
|
5228
|
+
id: chunk46Z6MNRS_js.generateElementId(),
|
|
5164
5229
|
type: "shape",
|
|
5165
5230
|
x: 120,
|
|
5166
5231
|
y: 200,
|
|
@@ -5182,7 +5247,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5182
5247
|
if (!activeSlide) {
|
|
5183
5248
|
return;
|
|
5184
5249
|
}
|
|
5185
|
-
const preset =
|
|
5250
|
+
const preset = chunk46Z6MNRS_js.ACTION_BUTTON_PRESETS.find((p) => p.shapeType === shapeType);
|
|
5186
5251
|
if (!preset) {
|
|
5187
5252
|
return;
|
|
5188
5253
|
}
|
|
@@ -5195,7 +5260,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5195
5260
|
defaultPptxAction.highlightClick = true;
|
|
5196
5261
|
}
|
|
5197
5262
|
addElement({
|
|
5198
|
-
id:
|
|
5263
|
+
id: chunk46Z6MNRS_js.generateElementId(),
|
|
5199
5264
|
type: "shape",
|
|
5200
5265
|
x: 150,
|
|
5201
5266
|
y: 150,
|
|
@@ -5262,14 +5327,14 @@ function useInsertElements(input) {
|
|
|
5262
5327
|
return;
|
|
5263
5328
|
}
|
|
5264
5329
|
addElement({
|
|
5265
|
-
id:
|
|
5330
|
+
id: chunk46Z6MNRS_js.generateElementId(),
|
|
5266
5331
|
type: "text",
|
|
5267
5332
|
x: 100,
|
|
5268
5333
|
y: 100,
|
|
5269
5334
|
width: 300,
|
|
5270
5335
|
height: 60,
|
|
5271
5336
|
text: "",
|
|
5272
|
-
textStyle: { fontSize:
|
|
5337
|
+
textStyle: { fontSize: chunkLDF77JJD_js.DEFAULT_TEXT_FONT_SIZE }
|
|
5273
5338
|
});
|
|
5274
5339
|
};
|
|
5275
5340
|
const handleAddShape = () => {
|
|
@@ -5277,7 +5342,7 @@ function useInsertElements(input) {
|
|
|
5277
5342
|
return;
|
|
5278
5343
|
}
|
|
5279
5344
|
addElement({
|
|
5280
|
-
id:
|
|
5345
|
+
id: chunk46Z6MNRS_js.generateElementId(),
|
|
5281
5346
|
type: "shape",
|
|
5282
5347
|
x: 150,
|
|
5283
5348
|
y: 150,
|
|
@@ -5296,15 +5361,15 @@ function useInsertElements(input) {
|
|
|
5296
5361
|
return;
|
|
5297
5362
|
}
|
|
5298
5363
|
addElement({
|
|
5299
|
-
...
|
|
5300
|
-
id:
|
|
5364
|
+
...chunk46Z6MNRS_js.newTableElement(chunkLDF77JJD_js.DEFAULT_TABLE_ROWS, chunkLDF77JJD_js.DEFAULT_TABLE_COLUMNS, 100, 200),
|
|
5365
|
+
id: chunk46Z6MNRS_js.generateElementId()
|
|
5301
5366
|
});
|
|
5302
5367
|
};
|
|
5303
5368
|
const handleAddChart = (chartType) => {
|
|
5304
5369
|
if (!activeSlide) {
|
|
5305
5370
|
return;
|
|
5306
5371
|
}
|
|
5307
|
-
addElement(
|
|
5372
|
+
addElement(chunk46Z6MNRS_js.createDefaultChartElement(chartType));
|
|
5308
5373
|
};
|
|
5309
5374
|
const structured = createStructuredElementHandlers({
|
|
5310
5375
|
activeSlide,
|
|
@@ -5374,7 +5439,7 @@ function useClipboardHandlers(input) {
|
|
|
5374
5439
|
if (!selectedElement) {
|
|
5375
5440
|
return;
|
|
5376
5441
|
}
|
|
5377
|
-
setClipboardPayload(
|
|
5442
|
+
setClipboardPayload(chunk46Z6MNRS_js.buildElementClipboardPayload(selectedElement, editTemplateMode));
|
|
5378
5443
|
};
|
|
5379
5444
|
const handleDelete = () => {
|
|
5380
5445
|
const idsToDelete = effectiveSelectedIds;
|
|
@@ -5391,7 +5456,7 @@ function useClipboardHandlers(input) {
|
|
|
5391
5456
|
handleDelete();
|
|
5392
5457
|
};
|
|
5393
5458
|
const insertClone = (source) => {
|
|
5394
|
-
const clone =
|
|
5459
|
+
const clone = chunk46Z6MNRS_js.cloneElementForPaste(source, { intoTemplate: editTemplateMode });
|
|
5395
5460
|
ops.updateActiveElements((els) => [...els, clone]);
|
|
5396
5461
|
ops.applySelection(clone.id);
|
|
5397
5462
|
history.markDirty();
|
|
@@ -5601,7 +5666,7 @@ function useMergeShapesHandler(input) {
|
|
|
5601
5666
|
bounds.height
|
|
5602
5667
|
);
|
|
5603
5668
|
const newEl = {
|
|
5604
|
-
id:
|
|
5669
|
+
id: chunk46Z6MNRS_js.generateElementId(),
|
|
5605
5670
|
type: "shape",
|
|
5606
5671
|
x: bounds.x,
|
|
5607
5672
|
y: bounds.y,
|
|
@@ -5660,7 +5725,7 @@ function useMergeShapesHandler(input) {
|
|
|
5660
5725
|
);
|
|
5661
5726
|
const primary = targets[0];
|
|
5662
5727
|
const newEl = {
|
|
5663
|
-
id:
|
|
5728
|
+
id: chunk46Z6MNRS_js.generateElementId(),
|
|
5664
5729
|
type: "shape",
|
|
5665
5730
|
x: bounds.x,
|
|
5666
5731
|
y: bounds.y,
|
|
@@ -5723,7 +5788,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
5723
5788
|
if (ids.length < 2 || !activeSlide) {
|
|
5724
5789
|
return;
|
|
5725
5790
|
}
|
|
5726
|
-
const { elements, groupId } =
|
|
5791
|
+
const { elements, groupId } = chunk46Z6MNRS_js.groupElements(ops.activeElements, ids, chunk46Z6MNRS_js.generateElementId());
|
|
5727
5792
|
if (groupId === null) {
|
|
5728
5793
|
return;
|
|
5729
5794
|
}
|
|
@@ -5736,12 +5801,12 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
5736
5801
|
return;
|
|
5737
5802
|
}
|
|
5738
5803
|
const group = selectedElement;
|
|
5739
|
-
const intoTemplate =
|
|
5804
|
+
const intoTemplate = chunk46Z6MNRS_js.isTemplateElementId(group.id);
|
|
5740
5805
|
const ungrouped = group.children.map((child) => ({
|
|
5741
5806
|
...structuredClone(child),
|
|
5742
5807
|
// Keep child ids in the same store as the group so later edits route
|
|
5743
5808
|
// correctly: template groups yield template-prefixed child ids.
|
|
5744
|
-
id: intoTemplate ?
|
|
5809
|
+
id: intoTemplate ? chunk46Z6MNRS_js.makeCloneId(true, child.id || group.id) : child.id || chunk46Z6MNRS_js.generateElementId(),
|
|
5745
5810
|
x: child.x + group.x,
|
|
5746
5811
|
y: child.y + group.y
|
|
5747
5812
|
}));
|
|
@@ -5765,7 +5830,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
5765
5830
|
if (!edge) {
|
|
5766
5831
|
return;
|
|
5767
5832
|
}
|
|
5768
|
-
const positions =
|
|
5833
|
+
const positions = chunk46Z6MNRS_js.alignElements(selectedElements, edge);
|
|
5769
5834
|
for (const [id, pos] of positions) {
|
|
5770
5835
|
const el = elementLookup.get(id);
|
|
5771
5836
|
if (!el) {
|
|
@@ -5783,7 +5848,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
5783
5848
|
if (!distAxis) {
|
|
5784
5849
|
return;
|
|
5785
5850
|
}
|
|
5786
|
-
const positions =
|
|
5851
|
+
const positions = chunk46Z6MNRS_js.distributeElements(selectedElements, distAxis);
|
|
5787
5852
|
for (const [id, pos] of positions) {
|
|
5788
5853
|
const el = elementLookup.get(id);
|
|
5789
5854
|
if (!el) {
|
|
@@ -5800,7 +5865,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
5800
5865
|
}
|
|
5801
5866
|
const id = selectedElement.id;
|
|
5802
5867
|
ops.updateActiveElements(
|
|
5803
|
-
(els) => direction === "forward" ?
|
|
5868
|
+
(els) => direction === "forward" ? chunk46Z6MNRS_js.bringForward(els, id) : direction === "backward" ? chunk46Z6MNRS_js.sendBackward(els, id) : els
|
|
5804
5869
|
);
|
|
5805
5870
|
history.markDirty();
|
|
5806
5871
|
};
|
|
@@ -5810,7 +5875,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
5810
5875
|
}
|
|
5811
5876
|
const id = selectedElement.id;
|
|
5812
5877
|
ops.updateActiveElements(
|
|
5813
|
-
(els) => direction === "front" ?
|
|
5878
|
+
(els) => direction === "front" ? chunk46Z6MNRS_js.bringToFront(els, id) : chunk46Z6MNRS_js.sendToBack(els, id)
|
|
5814
5879
|
);
|
|
5815
5880
|
history.markDirty();
|
|
5816
5881
|
};
|
|
@@ -5932,7 +5997,7 @@ function insertSlideFromLayoutUpdater(slides, activeIndex, draft) {
|
|
|
5932
5997
|
function useSlideManagement(input) {
|
|
5933
5998
|
const { slides, activeSlideIndex, setActiveSlideIndex, ops, history, handlerRef } = input;
|
|
5934
5999
|
const handleAddSlide = () => {
|
|
5935
|
-
const newSlide =
|
|
6000
|
+
const newSlide = chunk46Z6MNRS_js.createBlankSlide(slides.length + 1);
|
|
5936
6001
|
ops.updateSlides((prev) => {
|
|
5937
6002
|
const next = [...prev];
|
|
5938
6003
|
next.splice(activeSlideIndex + 1, 0, newSlide);
|
|
@@ -5995,7 +6060,7 @@ function useSlideManagement(input) {
|
|
|
5995
6060
|
}
|
|
5996
6061
|
const clone = {
|
|
5997
6062
|
...src,
|
|
5998
|
-
id:
|
|
6063
|
+
id: chunk46Z6MNRS_js.makeSlideId(),
|
|
5999
6064
|
elements: src.elements.map((el) => ({
|
|
6000
6065
|
...el,
|
|
6001
6066
|
id: `${el.id}-dup-${Math.random().toString(36).slice(2, 6)}`
|
|
@@ -6027,7 +6092,7 @@ function useSlideManagement(input) {
|
|
|
6027
6092
|
const handleInsertSlideFromLayout = (layoutPath, layoutName) => {
|
|
6028
6093
|
const insertAt = activeSlideIndex + 1;
|
|
6029
6094
|
const draft = {
|
|
6030
|
-
...
|
|
6095
|
+
...chunk46Z6MNRS_js.createBlankSlide(slides.length + 1),
|
|
6031
6096
|
layoutPath,
|
|
6032
6097
|
...layoutName ? { layoutName } : {}
|
|
6033
6098
|
};
|
|
@@ -6088,7 +6153,7 @@ function createTableMergeHandlers(input) {
|
|
|
6088
6153
|
if (!nextCell || nextCell.hMerge || nextCell.vMerge) {
|
|
6089
6154
|
return;
|
|
6090
6155
|
}
|
|
6091
|
-
const newTableData =
|
|
6156
|
+
const newTableData = chunk46Z6MNRS_js.mergeCells(
|
|
6092
6157
|
[
|
|
6093
6158
|
{ row: rowIndex, col: columnIndex },
|
|
6094
6159
|
{ row: rowIndex, col: nextColIdx }
|
|
@@ -6122,7 +6187,7 @@ function createTableMergeHandlers(input) {
|
|
|
6122
6187
|
if (!targetNextCell || targetNextCell.hMerge || targetNextCell.vMerge) {
|
|
6123
6188
|
return;
|
|
6124
6189
|
}
|
|
6125
|
-
const newTableData =
|
|
6190
|
+
const newTableData = chunk46Z6MNRS_js.mergeCells(
|
|
6126
6191
|
[
|
|
6127
6192
|
{ row: rowIndex, col: columnIndex },
|
|
6128
6193
|
{ row: targetNextRowIdx, col: columnIndex }
|
|
@@ -6145,7 +6210,7 @@ function createTableMergeHandlers(input) {
|
|
|
6145
6210
|
return;
|
|
6146
6211
|
}
|
|
6147
6212
|
const td = selectedElement.tableData;
|
|
6148
|
-
const newTableData =
|
|
6213
|
+
const newTableData = chunk46Z6MNRS_js.mergeCells(ts.selectedCells, td);
|
|
6149
6214
|
const updates = { tableData: newTableData };
|
|
6150
6215
|
const newRawXml = chunkCLNGAVNH_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6151
6216
|
if (newRawXml) {
|
|
@@ -6164,7 +6229,7 @@ function createTableMergeHandlers(input) {
|
|
|
6164
6229
|
}
|
|
6165
6230
|
const { rowIndex, columnIndex } = ts;
|
|
6166
6231
|
const td = selectedElement.tableData;
|
|
6167
|
-
const newTableData =
|
|
6232
|
+
const newTableData = chunk46Z6MNRS_js.splitCell(rowIndex, columnIndex, td);
|
|
6168
6233
|
const updates = { tableData: newTableData };
|
|
6169
6234
|
const newRawXml = chunkCLNGAVNH_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6170
6235
|
if (newRawXml) {
|
|
@@ -6298,7 +6363,7 @@ function createTableStructHandlers(input) {
|
|
|
6298
6363
|
return;
|
|
6299
6364
|
}
|
|
6300
6365
|
const rowIdx = ts?.rowIndex ?? 0;
|
|
6301
|
-
const newTableData =
|
|
6366
|
+
const newTableData = chunk46Z6MNRS_js.insertTableRow(selectedElement.tableData, rowIdx, position);
|
|
6302
6367
|
const updates = { tableData: newTableData };
|
|
6303
6368
|
const newRawXml = chunkCLNGAVNH_js.rebuildTableStructureInRawXml(selectedElement, newTableData);
|
|
6304
6369
|
if (newRawXml) {
|
|
@@ -6313,7 +6378,7 @@ function createTableStructHandlers(input) {
|
|
|
6313
6378
|
}
|
|
6314
6379
|
const td = selectedElement.tableData;
|
|
6315
6380
|
const rowIdx = ts?.rowIndex ?? 0;
|
|
6316
|
-
const newTableData =
|
|
6381
|
+
const newTableData = chunk46Z6MNRS_js.deleteTableRow(td, rowIdx);
|
|
6317
6382
|
if (newTableData === td) {
|
|
6318
6383
|
return;
|
|
6319
6384
|
}
|
|
@@ -6330,7 +6395,7 @@ function createTableStructHandlers(input) {
|
|
|
6330
6395
|
return;
|
|
6331
6396
|
}
|
|
6332
6397
|
const colIdx = ts?.columnIndex ?? 0;
|
|
6333
|
-
const newTableData =
|
|
6398
|
+
const newTableData = chunk46Z6MNRS_js.insertTableColumn(selectedElement.tableData, colIdx, position);
|
|
6334
6399
|
const updates = { tableData: newTableData };
|
|
6335
6400
|
const newRawXml = chunkCLNGAVNH_js.rebuildTableStructureInRawXml(selectedElement, newTableData);
|
|
6336
6401
|
if (newRawXml) {
|
|
@@ -6345,7 +6410,7 @@ function createTableStructHandlers(input) {
|
|
|
6345
6410
|
}
|
|
6346
6411
|
const td = selectedElement.tableData;
|
|
6347
6412
|
const colIdx = ts?.columnIndex ?? 0;
|
|
6348
|
-
const newTableData =
|
|
6413
|
+
const newTableData = chunk46Z6MNRS_js.deleteTableColumn(td, colIdx);
|
|
6349
6414
|
if (newTableData === td) {
|
|
6350
6415
|
return;
|
|
6351
6416
|
}
|
|
@@ -6386,8 +6451,8 @@ async function renderToCanvas(element, options = {}) {
|
|
|
6386
6451
|
return html2canvasPro(element, {
|
|
6387
6452
|
...options,
|
|
6388
6453
|
onclone: async (doc, clonedEl) => {
|
|
6389
|
-
await
|
|
6390
|
-
|
|
6454
|
+
await chunk46Z6MNRS_js.normalizeColorsForCapture(doc, clonedEl);
|
|
6455
|
+
chunk46Z6MNRS_js.preprocessCssForCapture(clonedEl);
|
|
6391
6456
|
if (typeof userOnClone === "function") {
|
|
6392
6457
|
userOnClone(doc, clonedEl);
|
|
6393
6458
|
}
|
|
@@ -6443,7 +6508,7 @@ async function exportSlideToPngBlob(slideElement, options = {}) {
|
|
|
6443
6508
|
}
|
|
6444
6509
|
async function exportSlideAsPng(slideElement, slideIndex, options = {}) {
|
|
6445
6510
|
const blob = await exportSlideToPngBlob(slideElement, options);
|
|
6446
|
-
|
|
6511
|
+
chunk46Z6MNRS_js.downloadBlob(blob, `slide-${slideIndex + 1}.png`);
|
|
6447
6512
|
}
|
|
6448
6513
|
async function copySlideToClipboard(slideElement, options = {}) {
|
|
6449
6514
|
const blob = await exportSlideToPngBlob(slideElement, options);
|
|
@@ -6465,15 +6530,15 @@ async function exportAllSlidesAsPdf(slideStageRef, totalSlides, setActiveSlide,
|
|
|
6465
6530
|
continue;
|
|
6466
6531
|
}
|
|
6467
6532
|
const canvas = await renderElementToCanvas(stageEl, scale);
|
|
6468
|
-
images.push(
|
|
6533
|
+
images.push(chunk46Z6MNRS_js.canvasToJpegData(canvas));
|
|
6469
6534
|
}
|
|
6470
6535
|
onProgress?.(totalSlides, totalSlides);
|
|
6471
6536
|
setActiveSlide(currentSlideIndex);
|
|
6472
6537
|
if (images.length === 0) {
|
|
6473
6538
|
throw new Error(chunkCUUYYYC5_js.translationsEn["pptx.export.errorNoSlidesPdf"]);
|
|
6474
6539
|
}
|
|
6475
|
-
const pdfBlobUrl =
|
|
6476
|
-
|
|
6540
|
+
const pdfBlobUrl = chunkLDF77JJD_js.buildPdfFromImageData(images);
|
|
6541
|
+
chunk46Z6MNRS_js.downloadDataUrl(pdfBlobUrl, filename);
|
|
6477
6542
|
}
|
|
6478
6543
|
async function captureAllSlidesAsPngDataUrls(slideStageRef, totalSlides, setActiveSlide, currentSlideIndex, options = {}) {
|
|
6479
6544
|
const { scale = 2, onProgress } = options;
|
|
@@ -6521,8 +6586,8 @@ async function exportAllSlidesAsNotesPdf(slideStageRef, totalSlides, setActiveSl
|
|
|
6521
6586
|
if (pages.length === 0) {
|
|
6522
6587
|
throw new Error(chunkCUUYYYC5_js.translationsEn["pptx.export.errorNoSlidesNotesPdf"]);
|
|
6523
6588
|
}
|
|
6524
|
-
const pdfDataUrl =
|
|
6525
|
-
|
|
6589
|
+
const pdfDataUrl = chunkLDF77JJD_js.buildNotesPdf(pages);
|
|
6590
|
+
chunk46Z6MNRS_js.downloadDataUrl(pdfDataUrl, filename);
|
|
6526
6591
|
}
|
|
6527
6592
|
|
|
6528
6593
|
// src/viewer/utils/export-video.ts
|
|
@@ -6566,7 +6631,7 @@ async function exportAllSlidesAsVideo(slideStageRef, totalSlides, setActiveSlide
|
|
|
6566
6631
|
const fps = 30;
|
|
6567
6632
|
const stream = recordingCanvas.captureStream(fps);
|
|
6568
6633
|
const recorder = new MediaRecorder(stream, {
|
|
6569
|
-
mimeType:
|
|
6634
|
+
mimeType: chunk46Z6MNRS_js.pickSupportedMimeType([...chunk46Z6MNRS_js.WEBM_MIME_CANDIDATES]),
|
|
6570
6635
|
videoBitsPerSecond: 5e6
|
|
6571
6636
|
});
|
|
6572
6637
|
const chunks = [];
|
|
@@ -6589,8 +6654,8 @@ async function exportAllSlidesAsVideo(slideStageRef, totalSlides, setActiveSlide
|
|
|
6589
6654
|
const duration = slideTimingsMs?.[i] ?? slideDurationMs;
|
|
6590
6655
|
ctx.clearRect(0, 0, recordingCanvas.width, recordingCanvas.height);
|
|
6591
6656
|
ctx.drawImage(slideCanvases[i], 0, 0);
|
|
6592
|
-
const frameInterval =
|
|
6593
|
-
const framesNeeded =
|
|
6657
|
+
const frameInterval = chunk46Z6MNRS_js.fpsToFrameIntervalMs(fps);
|
|
6658
|
+
const framesNeeded = chunk46Z6MNRS_js.segmentFrameCount(duration, fps);
|
|
6594
6659
|
for (let f = 0; f < framesNeeded; f++) {
|
|
6595
6660
|
if (signal?.aborted) {
|
|
6596
6661
|
recorder.stop();
|
|
@@ -6639,7 +6704,7 @@ async function exportAllSlidesAsGif(slideStageRef, totalSlides, setActiveSlide,
|
|
|
6639
6704
|
if (frames.length === 0) {
|
|
6640
6705
|
throw new Error(chunkCUUYYYC5_js.translationsEn["pptx.export.errorNoSlidesGif"]);
|
|
6641
6706
|
}
|
|
6642
|
-
const gifBytes =
|
|
6707
|
+
const gifBytes = chunk46Z6MNRS_js.encodeGif(frames, Math.round(slideDurationMs / 10));
|
|
6643
6708
|
onProgress?.(totalSlides, totalSlides);
|
|
6644
6709
|
const buf = new ArrayBuffer(gifBytes.length);
|
|
6645
6710
|
new Uint8Array(buf).set(gifBytes);
|
|
@@ -6753,7 +6818,7 @@ function useExportSaveAs(input) {
|
|
|
6753
6818
|
}
|
|
6754
6819
|
setExportProgress(70);
|
|
6755
6820
|
setExportStatusMessage("Writing README...");
|
|
6756
|
-
const readme =
|
|
6821
|
+
const readme = chunk46Z6MNRS_js.generatePackageReadme(pptxFilename);
|
|
6757
6822
|
pkgFolder.file("README.txt", readme);
|
|
6758
6823
|
if (abortCtrl.signal.aborted) {
|
|
6759
6824
|
throw new DOMException("Export cancelled", "AbortError");
|
|
@@ -6764,7 +6829,7 @@ function useExportSaveAs(input) {
|
|
|
6764
6829
|
setExportProgress(95);
|
|
6765
6830
|
setExportStatusMessage("Downloading...");
|
|
6766
6831
|
const baseName = pptxFilename.replace(/\.[^.]+$/u, "");
|
|
6767
|
-
|
|
6832
|
+
chunk46Z6MNRS_js.downloadBlob(zipBlob, `${baseName}-package.zip`);
|
|
6768
6833
|
setExportProgress(100);
|
|
6769
6834
|
} catch (err) {
|
|
6770
6835
|
if (err.name !== "AbortError") {
|
|
@@ -6787,7 +6852,7 @@ function useExportSaveAs(input) {
|
|
|
6787
6852
|
const blob = new Blob([data], {
|
|
6788
6853
|
type: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
6789
6854
|
});
|
|
6790
|
-
|
|
6855
|
+
chunk46Z6MNRS_js.downloadBlob(blob, `${baseName}.${ext}`);
|
|
6791
6856
|
} catch (err) {
|
|
6792
6857
|
console.error(`[PowerPointViewer] Save as .${ext} failed:`, err);
|
|
6793
6858
|
}
|
|
@@ -6807,7 +6872,7 @@ function useExportSaveAs(input) {
|
|
|
6807
6872
|
guides: pptxGuides.length > 0 ? pptxGuides : void 0
|
|
6808
6873
|
};
|
|
6809
6874
|
});
|
|
6810
|
-
const slidesToSave =
|
|
6875
|
+
const slidesToSave = chunkLDF77JJD_js.buildSaveSlides(slidesWithGuides, templateElementsBySlideId);
|
|
6811
6876
|
const saveOptions = {
|
|
6812
6877
|
headerFooter,
|
|
6813
6878
|
presentationProperties,
|
|
@@ -6864,7 +6929,7 @@ function safeConfirm(message) {
|
|
|
6864
6929
|
}
|
|
6865
6930
|
}
|
|
6866
6931
|
function downloadBlob2(blob, filename) {
|
|
6867
|
-
|
|
6932
|
+
chunk46Z6MNRS_js.downloadBlob(blob, chunk46Z6MNRS_js.sanitizeDownloadFilename(filename));
|
|
6868
6933
|
}
|
|
6869
6934
|
|
|
6870
6935
|
// src/viewer/hooks/useExportHandlers.ts
|
|
@@ -6965,21 +7030,21 @@ function useExportHandlers(input) {
|
|
|
6965
7030
|
{
|
|
6966
7031
|
scale: 2,
|
|
6967
7032
|
onProgress: (current, total) => {
|
|
6968
|
-
setExportProgress(
|
|
6969
|
-
setExportStatusMessage(
|
|
7033
|
+
setExportProgress(chunk46Z6MNRS_js.slideProgressPercent(current, total));
|
|
7034
|
+
setExportStatusMessage(chunk46Z6MNRS_js.slideStatusLabel("Rendering", current, total));
|
|
6970
7035
|
},
|
|
6971
7036
|
signal: abortCtrl.signal
|
|
6972
7037
|
}
|
|
6973
7038
|
);
|
|
6974
|
-
setExportProgress(
|
|
7039
|
+
setExportProgress(chunk46Z6MNRS_js.EXPORT_ASSEMBLING_PERCENT);
|
|
6975
7040
|
setExportStatusMessage("Building PDF...");
|
|
6976
7041
|
await new Promise((r) => {
|
|
6977
7042
|
setTimeout(r, 100);
|
|
6978
7043
|
});
|
|
6979
|
-
setExportProgress(
|
|
7044
|
+
setExportProgress(chunk46Z6MNRS_js.EXPORT_DONE_PERCENT);
|
|
6980
7045
|
setExportStatusMessage("Done!");
|
|
6981
7046
|
} catch (err) {
|
|
6982
|
-
if (!
|
|
7047
|
+
if (!chunk46Z6MNRS_js.isExportAbortError(err)) {
|
|
6983
7048
|
console.error("[PowerPointViewer] PDF export failed:", err);
|
|
6984
7049
|
}
|
|
6985
7050
|
} finally {
|
|
@@ -7009,21 +7074,21 @@ function useExportHandlers(input) {
|
|
|
7009
7074
|
{
|
|
7010
7075
|
scale: 2,
|
|
7011
7076
|
onProgress: (current, total) => {
|
|
7012
|
-
setExportProgress(
|
|
7013
|
-
setExportStatusMessage(
|
|
7077
|
+
setExportProgress(chunk46Z6MNRS_js.slideProgressPercent(current, total));
|
|
7078
|
+
setExportStatusMessage(chunk46Z6MNRS_js.slideStatusLabel("Rendering", current, total));
|
|
7014
7079
|
},
|
|
7015
7080
|
signal: abortCtrl.signal
|
|
7016
7081
|
}
|
|
7017
7082
|
);
|
|
7018
|
-
setExportProgress(
|
|
7083
|
+
setExportProgress(chunk46Z6MNRS_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7019
7084
|
setExportStatusMessage("Building PDF...");
|
|
7020
7085
|
await new Promise((r) => {
|
|
7021
7086
|
setTimeout(r, 100);
|
|
7022
7087
|
});
|
|
7023
|
-
setExportProgress(
|
|
7088
|
+
setExportProgress(chunk46Z6MNRS_js.EXPORT_DONE_PERCENT);
|
|
7024
7089
|
setExportStatusMessage("Done!");
|
|
7025
7090
|
} catch (err) {
|
|
7026
|
-
if (!
|
|
7091
|
+
if (!chunk46Z6MNRS_js.isExportAbortError(err)) {
|
|
7027
7092
|
console.error("[PowerPointViewer] Notes PDF export failed:", err);
|
|
7028
7093
|
}
|
|
7029
7094
|
} finally {
|
|
@@ -7064,22 +7129,22 @@ function useExportHandlers(input) {
|
|
|
7064
7129
|
scale: 1,
|
|
7065
7130
|
slideDurationMs: 3e3,
|
|
7066
7131
|
onProgress: (current, total) => {
|
|
7067
|
-
setExportProgress(
|
|
7068
|
-
setExportStatusMessage(
|
|
7132
|
+
setExportProgress(chunk46Z6MNRS_js.slideProgressPercent(current, total, 45));
|
|
7133
|
+
setExportStatusMessage(chunk46Z6MNRS_js.slideStatusLabel("Capturing", current, total));
|
|
7069
7134
|
},
|
|
7070
7135
|
onRecordProgress: (current, total) => {
|
|
7071
|
-
setExportProgress(
|
|
7072
|
-
setExportStatusMessage(
|
|
7136
|
+
setExportProgress(chunk46Z6MNRS_js.recordProgressPercent(current, total));
|
|
7137
|
+
setExportStatusMessage(chunk46Z6MNRS_js.slideStatusLabel("Recording", current, total));
|
|
7073
7138
|
},
|
|
7074
7139
|
signal: abortCtrl.signal
|
|
7075
7140
|
}
|
|
7076
7141
|
);
|
|
7077
|
-
setExportProgress(
|
|
7142
|
+
setExportProgress(chunk46Z6MNRS_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7078
7143
|
setExportStatusMessage("Saving file...");
|
|
7079
7144
|
downloadBlob2(blob, "presentation.webm");
|
|
7080
|
-
setExportProgress(
|
|
7145
|
+
setExportProgress(chunk46Z6MNRS_js.EXPORT_DONE_PERCENT);
|
|
7081
7146
|
} catch (err) {
|
|
7082
|
-
if (!
|
|
7147
|
+
if (!chunk46Z6MNRS_js.isExportAbortError(err)) {
|
|
7083
7148
|
console.error("[PowerPointViewer] Video export failed:", err);
|
|
7084
7149
|
}
|
|
7085
7150
|
} finally {
|
|
@@ -7107,18 +7172,18 @@ function useExportHandlers(input) {
|
|
|
7107
7172
|
scale: 0.5,
|
|
7108
7173
|
slideDurationMs: 2e3,
|
|
7109
7174
|
onProgress: (current, total) => {
|
|
7110
|
-
setExportProgress(
|
|
7111
|
-
setExportStatusMessage(
|
|
7175
|
+
setExportProgress(chunk46Z6MNRS_js.slideProgressPercent(current, total));
|
|
7176
|
+
setExportStatusMessage(chunk46Z6MNRS_js.slideStatusLabel("Encoding", current, total));
|
|
7112
7177
|
},
|
|
7113
7178
|
signal: abortCtrl.signal
|
|
7114
7179
|
}
|
|
7115
7180
|
);
|
|
7116
|
-
setExportProgress(
|
|
7181
|
+
setExportProgress(chunk46Z6MNRS_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7117
7182
|
setExportStatusMessage("Saving file...");
|
|
7118
7183
|
downloadBlob2(blob, "presentation.gif");
|
|
7119
|
-
setExportProgress(
|
|
7184
|
+
setExportProgress(chunk46Z6MNRS_js.EXPORT_DONE_PERCENT);
|
|
7120
7185
|
} catch (err) {
|
|
7121
|
-
if (!
|
|
7186
|
+
if (!chunk46Z6MNRS_js.isExportAbortError(err)) {
|
|
7122
7187
|
console.error("[PowerPointViewer] GIF export failed:", err);
|
|
7123
7188
|
}
|
|
7124
7189
|
} finally {
|
|
@@ -7158,7 +7223,7 @@ function openPrintWindow(title, bodyHtml, orientation, colorFilter, frameSlides)
|
|
|
7158
7223
|
}
|
|
7159
7224
|
printWindow.document.open();
|
|
7160
7225
|
printWindow.document.write(
|
|
7161
|
-
|
|
7226
|
+
chunk46Z6MNRS_js.buildPrintHtmlDocument({ title, bodyHtml, orientation, colorFilter, frameSlides })
|
|
7162
7227
|
);
|
|
7163
7228
|
printWindow.document.close();
|
|
7164
7229
|
printWindow.focus();
|
|
@@ -7219,7 +7284,7 @@ function usePrintHandlers(input) {
|
|
|
7219
7284
|
if (svgs.length === 0) {
|
|
7220
7285
|
return;
|
|
7221
7286
|
}
|
|
7222
|
-
const printDoc =
|
|
7287
|
+
const printDoc = chunk46Z6MNRS_js.buildPrintDocument(svgs, pptxData.width, pptxData.height, {
|
|
7223
7288
|
title: "Slides (Vector)",
|
|
7224
7289
|
orientation: settings.orientation,
|
|
7225
7290
|
colorFilter
|
|
@@ -7255,7 +7320,7 @@ function usePrintHandlers(input) {
|
|
|
7255
7320
|
if (settings.printWhat === "outline") {
|
|
7256
7321
|
openPrintWindow(
|
|
7257
7322
|
"Outline",
|
|
7258
|
-
`<div class="outline-page">${
|
|
7323
|
+
`<div class="outline-page">${chunk46Z6MNRS_js.buildOutlineHtml(slideIndices, slides)}</div>`,
|
|
7259
7324
|
settings.orientation,
|
|
7260
7325
|
colorFilter,
|
|
7261
7326
|
settings.frameSlides
|
|
@@ -7280,7 +7345,7 @@ function usePrintHandlers(input) {
|
|
|
7280
7345
|
if (settings.printWhat === "slides") {
|
|
7281
7346
|
openPrintWindow(
|
|
7282
7347
|
"Slides",
|
|
7283
|
-
|
|
7348
|
+
chunk46Z6MNRS_js.buildSlidesHtml(slideImages, slideIndices),
|
|
7284
7349
|
settings.orientation,
|
|
7285
7350
|
colorFilter,
|
|
7286
7351
|
settings.frameSlides
|
|
@@ -7290,7 +7355,7 @@ function usePrintHandlers(input) {
|
|
|
7290
7355
|
if (settings.printWhat === "notes") {
|
|
7291
7356
|
openPrintWindow(
|
|
7292
7357
|
"Notes Pages",
|
|
7293
|
-
|
|
7358
|
+
chunk46Z6MNRS_js.buildNotesHtml(slideImages, slideIndices, slides),
|
|
7294
7359
|
"portrait",
|
|
7295
7360
|
colorFilter,
|
|
7296
7361
|
settings.frameSlides
|
|
@@ -7301,7 +7366,7 @@ function usePrintHandlers(input) {
|
|
|
7301
7366
|
const spp = settings.slidesPerPage;
|
|
7302
7367
|
openPrintWindow(
|
|
7303
7368
|
`Handout ${spp} per page`,
|
|
7304
|
-
|
|
7369
|
+
chunk46Z6MNRS_js.buildHandoutsHtml(slideImages, slideIndices, spp),
|
|
7305
7370
|
"portrait",
|
|
7306
7371
|
colorFilter,
|
|
7307
7372
|
settings.frameSlides
|
|
@@ -7590,7 +7655,7 @@ function usePropertyHandlers(input) {
|
|
|
7590
7655
|
width: canvasSize.width,
|
|
7591
7656
|
height: canvasSize.height
|
|
7592
7657
|
};
|
|
7593
|
-
setCompareResult(
|
|
7658
|
+
setCompareResult(chunk46Z6MNRS_js.comparePresentation(cur, other));
|
|
7594
7659
|
setIsComparePanelOpen(true);
|
|
7595
7660
|
} catch (err) {
|
|
7596
7661
|
console.warn("Compare failed:", err);
|
|
@@ -7607,7 +7672,7 @@ function usePropertyHandlers(input) {
|
|
|
7607
7672
|
if (!diff || diff.status === "unchanged") {
|
|
7608
7673
|
return;
|
|
7609
7674
|
}
|
|
7610
|
-
setSlides((prev) =>
|
|
7675
|
+
setSlides((prev) => chunk46Z6MNRS_js.applyAcceptSlide(prev, diff));
|
|
7611
7676
|
setIsDirty(true);
|
|
7612
7677
|
},
|
|
7613
7678
|
[compareResult, setSlides, setIsDirty]
|
|
@@ -7618,10 +7683,10 @@ function usePropertyHandlers(input) {
|
|
|
7618
7683
|
if (!compareResult) {
|
|
7619
7684
|
return;
|
|
7620
7685
|
}
|
|
7621
|
-
setSlides((prev) =>
|
|
7686
|
+
setSlides((prev) => chunk46Z6MNRS_js.applyAcceptAllSlides(prev, compareResult));
|
|
7622
7687
|
setIsDirty(true);
|
|
7623
7688
|
}, [compareResult, setSlides, setIsDirty]);
|
|
7624
|
-
const usedFontFamilies = react.useMemo(() =>
|
|
7689
|
+
const usedFontFamilies = react.useMemo(() => chunk46Z6MNRS_js.collectUsedFonts(slides), [slides]);
|
|
7625
7690
|
return {
|
|
7626
7691
|
handleUpdateNotes,
|
|
7627
7692
|
handleUpdateSlide,
|
|
@@ -7740,7 +7805,7 @@ function useIsMobile(input) {
|
|
|
7740
7805
|
const containerRef = input?.containerRef;
|
|
7741
7806
|
const isTouchDevice = react.useSyncExternalStore(
|
|
7742
7807
|
subscribeTouchCapability,
|
|
7743
|
-
|
|
7808
|
+
chunk46Z6MNRS_js.detectTouchDevice,
|
|
7744
7809
|
() => false
|
|
7745
7810
|
// server snapshot
|
|
7746
7811
|
);
|
|
@@ -7756,7 +7821,7 @@ function useIsMobile(input) {
|
|
|
7756
7821
|
}
|
|
7757
7822
|
return containerRef?.current?.clientHeight ?? window.innerHeight;
|
|
7758
7823
|
});
|
|
7759
|
-
const [orientation, setOrientation] = react.useState(
|
|
7824
|
+
const [orientation, setOrientation] = react.useState(chunk46Z6MNRS_js.detectOrientation);
|
|
7760
7825
|
const [isVirtualKeyboardOpen, setIsVirtualKeyboardOpen] = react.useState(false);
|
|
7761
7826
|
const [initialViewportHeight] = react.useState(
|
|
7762
7827
|
() => typeof window !== "undefined" ? window.innerHeight : 800
|
|
@@ -7800,7 +7865,7 @@ function useIsMobile(input) {
|
|
|
7800
7865
|
return;
|
|
7801
7866
|
}
|
|
7802
7867
|
const handleOrientationChange = () => {
|
|
7803
|
-
setOrientation(
|
|
7868
|
+
setOrientation(chunk46Z6MNRS_js.detectOrientation());
|
|
7804
7869
|
};
|
|
7805
7870
|
if (screen.orientation) {
|
|
7806
7871
|
screen.orientation.addEventListener("change", handleOrientationChange);
|
|
@@ -7830,9 +7895,9 @@ function useIsMobile(input) {
|
|
|
7830
7895
|
window.addEventListener("resize", handleResize);
|
|
7831
7896
|
return () => window.removeEventListener("resize", handleResize);
|
|
7832
7897
|
}, [isTouchDevice, initialViewportHeight]);
|
|
7833
|
-
const isMobile =
|
|
7834
|
-
const isTablet = !isMobile && containerWidth >=
|
|
7835
|
-
const isDesktop = !isMobile && containerWidth >=
|
|
7898
|
+
const isMobile = chunk46Z6MNRS_js.isMobileViewport(containerWidth, containerHeight, isTouchDevice);
|
|
7899
|
+
const isTablet = !isMobile && containerWidth >= chunk46Z6MNRS_js.MOBILE_BREAKPOINT && containerWidth < chunk46Z6MNRS_js.TABLET_BREAKPOINT;
|
|
7900
|
+
const isDesktop = !isMobile && containerWidth >= chunk46Z6MNRS_js.TABLET_BREAKPOINT;
|
|
7836
7901
|
return {
|
|
7837
7902
|
isMobile,
|
|
7838
7903
|
isTablet,
|
|
@@ -7893,11 +7958,11 @@ function useViewerDialogs(input) {
|
|
|
7893
7958
|
);
|
|
7894
7959
|
const [embedFontsEnabled, setEmbedFontsEnabled] = react.useState(false);
|
|
7895
7960
|
const [isNarrowViewport, setIsNarrowViewport] = react.useState(
|
|
7896
|
-
() => typeof window !== "undefined" ?
|
|
7961
|
+
() => typeof window !== "undefined" ? chunk46Z6MNRS_js.isMobileViewport(window.innerWidth, window.innerHeight, viewportIsTouch()) : false
|
|
7897
7962
|
);
|
|
7898
7963
|
react.useEffect(() => {
|
|
7899
7964
|
const handleWindow = () => setIsNarrowViewport(
|
|
7900
|
-
|
|
7965
|
+
chunk46Z6MNRS_js.isMobileViewport(window.innerWidth, window.innerHeight, viewportIsTouch())
|
|
7901
7966
|
);
|
|
7902
7967
|
let observer = null;
|
|
7903
7968
|
let raf = 0;
|
|
@@ -7911,12 +7976,12 @@ function useViewerDialogs(input) {
|
|
|
7911
7976
|
const entry = entries[0];
|
|
7912
7977
|
if (entry) {
|
|
7913
7978
|
setIsNarrowViewport(
|
|
7914
|
-
|
|
7979
|
+
chunk46Z6MNRS_js.isMobileViewport(entry.contentRect.width, entry.contentRect.height, viewportIsTouch())
|
|
7915
7980
|
);
|
|
7916
7981
|
}
|
|
7917
7982
|
});
|
|
7918
7983
|
observer.observe(el);
|
|
7919
|
-
setIsNarrowViewport(
|
|
7984
|
+
setIsNarrowViewport(chunk46Z6MNRS_js.isMobileViewport(el.clientWidth, el.clientHeight, viewportIsTouch()));
|
|
7920
7985
|
};
|
|
7921
7986
|
attach();
|
|
7922
7987
|
window.addEventListener("resize", handleWindow);
|
|
@@ -8074,12 +8139,12 @@ function useViewerDialogs(input) {
|
|
|
8074
8139
|
}
|
|
8075
8140
|
function computeGridSpacingPx(presentationGridSpacing) {
|
|
8076
8141
|
if (presentationGridSpacing) {
|
|
8077
|
-
const px = Math.round(presentationGridSpacing.cx /
|
|
8142
|
+
const px = Math.round(presentationGridSpacing.cx / chunkLDF77JJD_js.EMU_PER_PX);
|
|
8078
8143
|
if (px > 0) {
|
|
8079
8144
|
return px;
|
|
8080
8145
|
}
|
|
8081
8146
|
}
|
|
8082
|
-
return
|
|
8147
|
+
return chunkLDF77JJD_js.GRID_SIZE;
|
|
8083
8148
|
}
|
|
8084
8149
|
function computeVisibleSlideIndexes(slides, activeCustomShowId, customShows) {
|
|
8085
8150
|
if (activeCustomShowId) {
|
|
@@ -8093,8 +8158,8 @@ function computeVisibleSlideIndexes(slides, activeCustomShowId, customShows) {
|
|
|
8093
8158
|
return slides.map((_, i) => i).filter((i) => !slides[i]?.hidden);
|
|
8094
8159
|
}
|
|
8095
8160
|
function computeSlideSectionGroups(slides, sections) {
|
|
8096
|
-
return
|
|
8097
|
-
id: group.section?.id ?? (sections.length > 0 ?
|
|
8161
|
+
return chunk46Z6MNRS_js.groupSlidesBySection(sections, slides).map((group) => ({
|
|
8162
|
+
id: group.section?.id ?? (sections.length > 0 ? chunkLDF77JJD_js.UNGROUPED_SECTION_ID : "default"),
|
|
8098
8163
|
label: group.section?.name ?? (sections.length > 0 ? "Ungrouped Slides" : "Slides"),
|
|
8099
8164
|
slideIndexes: group.slideIndexes,
|
|
8100
8165
|
...group.section?.color !== void 0 ? { color: group.section.color } : {},
|
|
@@ -8149,7 +8214,7 @@ function useDerivedSlideState(input) {
|
|
|
8149
8214
|
);
|
|
8150
8215
|
const slideSectionGroups = react.useMemo(
|
|
8151
8216
|
() => computeSlideSectionGroups(slides, sections).map((group) => {
|
|
8152
|
-
if (group.id ===
|
|
8217
|
+
if (group.id === chunkLDF77JJD_js.UNGROUPED_SECTION_ID && group.label === "Ungrouped Slides") {
|
|
8153
8218
|
return { ...group, label: t("pptx.slides.ungroupedSlides") };
|
|
8154
8219
|
}
|
|
8155
8220
|
if (group.id === "default" && group.label === "Slides") {
|
|
@@ -8255,7 +8320,7 @@ function useAnnotationHandlers(input) {
|
|
|
8255
8320
|
if (nextMode === "present") {
|
|
8256
8321
|
presentation.enterPresentMode();
|
|
8257
8322
|
} else if (mode === "present" && annotations.hasAnyAnnotations) {
|
|
8258
|
-
|
|
8323
|
+
chunkLDF77JJD_js.stopAllPersistentAudio();
|
|
8259
8324
|
pendingModeAfterAnnotationsRef.current = nextMode;
|
|
8260
8325
|
if (promptKeepInkAnnotations) {
|
|
8261
8326
|
setShowKeepAnnotationsDialog(true);
|
|
@@ -8264,7 +8329,7 @@ function useAnnotationHandlers(input) {
|
|
|
8264
8329
|
}
|
|
8265
8330
|
} else {
|
|
8266
8331
|
if (mode === "present") {
|
|
8267
|
-
|
|
8332
|
+
chunkLDF77JJD_js.stopAllPersistentAudio();
|
|
8268
8333
|
}
|
|
8269
8334
|
setMode(nextMode);
|
|
8270
8335
|
}
|
|
@@ -8336,7 +8401,7 @@ function useSerialize(input) {
|
|
|
8336
8401
|
return {
|
|
8337
8402
|
...el,
|
|
8338
8403
|
text: pendingEditText,
|
|
8339
|
-
textSegments:
|
|
8404
|
+
textSegments: chunk46Z6MNRS_js.remapTextToSegments(pendingEditText, el.textSegments, el.textStyle)
|
|
8340
8405
|
};
|
|
8341
8406
|
});
|
|
8342
8407
|
if (updatedElements.some((el, i) => el !== slide.elements[i])) {
|
|
@@ -8356,7 +8421,7 @@ function useSerialize(input) {
|
|
|
8356
8421
|
guides: pptxGuides.length > 0 ? pptxGuides : void 0
|
|
8357
8422
|
};
|
|
8358
8423
|
});
|
|
8359
|
-
const slidesToSave =
|
|
8424
|
+
const slidesToSave = chunkLDF77JJD_js.buildSaveSlides(slidesWithGuides, templateElementsBySlideId);
|
|
8360
8425
|
const saveOptions = {
|
|
8361
8426
|
headerFooter,
|
|
8362
8427
|
presentationProperties,
|
|
@@ -8530,7 +8595,7 @@ function usePresentationSetup(input) {
|
|
|
8530
8595
|
setShowKeepAnnotationsDialog(true);
|
|
8531
8596
|
} else {
|
|
8532
8597
|
if (mode === "present" && nextMode !== "present") {
|
|
8533
|
-
|
|
8598
|
+
chunkLDF77JJD_js.stopAllPersistentAudio();
|
|
8534
8599
|
stopAnimationSound();
|
|
8535
8600
|
}
|
|
8536
8601
|
setMode(nextMode);
|
|
@@ -8583,10 +8648,10 @@ function usePresentationSetup(input) {
|
|
|
8583
8648
|
onToggleEraser: () => annotations.setPresentationTool("eraser"),
|
|
8584
8649
|
onToggleToolbar: () => annotations.setToolbarVisible(!annotations.toolbarVisible),
|
|
8585
8650
|
onSaveRehearsalTimings: (timings) => {
|
|
8586
|
-
setSlides((prev) =>
|
|
8651
|
+
setSlides((prev) => chunk46Z6MNRS_js.applyRehearsalTimings(prev, timings));
|
|
8587
8652
|
history.markDirty();
|
|
8588
8653
|
},
|
|
8589
|
-
loopContinuously:
|
|
8654
|
+
loopContinuously: chunk46Z6MNRS_js.shouldLoopContinuously(presentationProperties),
|
|
8590
8655
|
showWithAnimation: presentationProperties.showWithAnimation,
|
|
8591
8656
|
useTimings: presentationProperties.advanceMode !== "manual",
|
|
8592
8657
|
endWithBlackSlide
|
|
@@ -8748,7 +8813,7 @@ function useEditorOperations(input) {
|
|
|
8748
8813
|
const { formatPainterActive, setFormatPainterActive, elementLookup } = state;
|
|
8749
8814
|
react.useEffect(() => {
|
|
8750
8815
|
if (formatPainterActive && !prevFormatPainterRef.current && selectedElement) {
|
|
8751
|
-
copiedFormatRef.current =
|
|
8816
|
+
copiedFormatRef.current = chunk46Z6MNRS_js.copyFormatFromElement(selectedElement);
|
|
8752
8817
|
} else if (!formatPainterActive) {
|
|
8753
8818
|
copiedFormatRef.current = null;
|
|
8754
8819
|
}
|
|
@@ -8774,7 +8839,7 @@ function useEditorOperations(input) {
|
|
|
8774
8839
|
e.stopPropagation();
|
|
8775
8840
|
const element = elementLookup.get(elementId);
|
|
8776
8841
|
if (element) {
|
|
8777
|
-
const updated =
|
|
8842
|
+
const updated = chunk46Z6MNRS_js.applyFormatToElement(element, copiedFormatRef.current);
|
|
8778
8843
|
const updates = {};
|
|
8779
8844
|
if (chunkCLNGAVNH_js.hasShapeProperties(updated)) {
|
|
8780
8845
|
updates.shapeStyle = updated.shapeStyle;
|
|
@@ -9397,7 +9462,8 @@ function useViewerIntegration(input) {
|
|
|
9397
9462
|
clearSelection: editorOps.ops.clearSelection,
|
|
9398
9463
|
updateSlides: editorOps.ops.updateSlides,
|
|
9399
9464
|
updateElementById: editorOps.ops.updateElementById,
|
|
9400
|
-
markDirty: history.markDirty
|
|
9465
|
+
markDirty: history.markDirty,
|
|
9466
|
+
livePatcher: state.livePatcher
|
|
9401
9467
|
});
|
|
9402
9468
|
const [isEncryptedDialogOpen, setIsEncryptedDialogOpen] = react.useState(false);
|
|
9403
9469
|
const [loadVersion, setLoadVersion] = react.useState(0);
|
|
@@ -9494,7 +9560,7 @@ function useViewerIntegration(input) {
|
|
|
9494
9560
|
return zoom.scale;
|
|
9495
9561
|
},
|
|
9496
9562
|
setZoom(level) {
|
|
9497
|
-
zoom.setScale(Math.min(Math.max(level,
|
|
9563
|
+
zoom.setScale(Math.min(Math.max(level, chunkLDF77JJD_js.MIN_ZOOM_SCALE), chunkLDF77JJD_js.MAX_ZOOM_SCALE));
|
|
9498
9564
|
},
|
|
9499
9565
|
zoomIn() {
|
|
9500
9566
|
zoom.handleZoomIn();
|
|
@@ -9709,7 +9775,7 @@ function useReducedMotion() {
|
|
|
9709
9775
|
}
|
|
9710
9776
|
function useViewerOptions() {
|
|
9711
9777
|
const storeRef = react.useRef(null);
|
|
9712
|
-
storeRef.current ??=
|
|
9778
|
+
storeRef.current ??= chunk46Z6MNRS_js.createViewerOptionsStore();
|
|
9713
9779
|
const store = storeRef.current;
|
|
9714
9780
|
const options = react.useSyncExternalStore(
|
|
9715
9781
|
(onStoreChange) => store.subscribe(onStoreChange),
|
|
@@ -9718,9 +9784,9 @@ function useViewerOptions() {
|
|
|
9718
9784
|
);
|
|
9719
9785
|
return { optionsStore: store, options };
|
|
9720
9786
|
}
|
|
9721
|
-
var KNOWN_TAB_IDS = new Set(
|
|
9787
|
+
var KNOWN_TAB_IDS = new Set(chunk46Z6MNRS_js.TOOLBAR_TABS.map((tab) => tab.id));
|
|
9722
9788
|
function computeToolbarVisibility(hiddenActions) {
|
|
9723
|
-
const isHidden = (id) =>
|
|
9789
|
+
const isHidden = (id) => chunk46Z6MNRS_js.isActionHidden(id, hiddenActions);
|
|
9724
9790
|
const isTabVisible = (id) => !KNOWN_TAB_IDS.has(id) || !isHidden(id);
|
|
9725
9791
|
return { isHidden, isTabVisible };
|
|
9726
9792
|
}
|
|
@@ -9808,10 +9874,10 @@ function useYjsDocumentSync({
|
|
|
9808
9874
|
const { PptxHandler: PptxHandler2 } = await import('./dist-4LUVI3SW.js');
|
|
9809
9875
|
const handler = new PptxHandler2();
|
|
9810
9876
|
await handler.load(sourceBytes.buffer);
|
|
9811
|
-
const currentSlides =
|
|
9877
|
+
const currentSlides = chunk46Z6MNRS_js.readSlidesFromYDoc(
|
|
9812
9878
|
doc
|
|
9813
9879
|
);
|
|
9814
|
-
const slidesToSave =
|
|
9880
|
+
const slidesToSave = chunkLDF77JJD_js.buildSaveSlides(currentSlides, templateElementsBySlideId);
|
|
9815
9881
|
const bytes = await handler.save(slidesToSave);
|
|
9816
9882
|
config.onWriteBack(bytes);
|
|
9817
9883
|
} catch {
|
|
@@ -9826,7 +9892,7 @@ function useYjsDocumentSync({
|
|
|
9826
9892
|
if (!doc || !isConnected) {
|
|
9827
9893
|
return;
|
|
9828
9894
|
}
|
|
9829
|
-
const docSlides =
|
|
9895
|
+
const docSlides = chunk46Z6MNRS_js.readSlidesFromYDoc(
|
|
9830
9896
|
doc
|
|
9831
9897
|
);
|
|
9832
9898
|
if (docSlides.length === 0) {
|
|
@@ -9848,11 +9914,11 @@ function useYjsDocumentSync({
|
|
|
9848
9914
|
lastSyncedRef.current = serialized;
|
|
9849
9915
|
void (async () => {
|
|
9850
9916
|
const factories = await getFactories();
|
|
9851
|
-
|
|
9917
|
+
chunk46Z6MNRS_js.reconcileSlidesInYDoc(
|
|
9852
9918
|
slides,
|
|
9853
9919
|
doc,
|
|
9854
9920
|
factories,
|
|
9855
|
-
|
|
9921
|
+
chunk46Z6MNRS_js.LOCAL_SYNC_ORIGIN
|
|
9856
9922
|
);
|
|
9857
9923
|
scheduleWriteBack();
|
|
9858
9924
|
})();
|
|
@@ -9866,10 +9932,10 @@ function useYjsDocumentSync({
|
|
|
9866
9932
|
return;
|
|
9867
9933
|
}
|
|
9868
9934
|
const handleChange = (_events, transaction) => {
|
|
9869
|
-
if (transaction?.origin ===
|
|
9935
|
+
if (transaction?.origin === chunk46Z6MNRS_js.LOCAL_SYNC_ORIGIN) {
|
|
9870
9936
|
return;
|
|
9871
9937
|
}
|
|
9872
|
-
const remoteSlides =
|
|
9938
|
+
const remoteSlides = chunk46Z6MNRS_js.readSlidesFromYDoc(
|
|
9873
9939
|
doc
|
|
9874
9940
|
);
|
|
9875
9941
|
if (remoteSlides.length === 0) {
|
|
@@ -9885,7 +9951,7 @@ function useYjsDocumentSync({
|
|
|
9885
9951
|
isApplyingRemoteRef.current = false;
|
|
9886
9952
|
scheduleWriteBack();
|
|
9887
9953
|
};
|
|
9888
|
-
const unobserve =
|
|
9954
|
+
const unobserve = chunk46Z6MNRS_js.observeYDocSlides(
|
|
9889
9955
|
doc,
|
|
9890
9956
|
handleChange
|
|
9891
9957
|
);
|
|
@@ -9923,7 +9989,7 @@ function useBroadcastFollower({
|
|
|
9923
9989
|
if (!broadcaster) {
|
|
9924
9990
|
return;
|
|
9925
9991
|
}
|
|
9926
|
-
if (!
|
|
9992
|
+
if (!chunk46Z6MNRS_js.shouldAutoFollowBroadcaster({
|
|
9927
9993
|
localRole: collab.config.role,
|
|
9928
9994
|
broadcasterRole: broadcaster.role
|
|
9929
9995
|
})) {
|
|
@@ -9982,6 +10048,36 @@ function useFollowMode({
|
|
|
9982
10048
|
}, [activeSlideIndex, followedClientId]);
|
|
9983
10049
|
return { followedClientId, followUser };
|
|
9984
10050
|
}
|
|
10051
|
+
function useCollaborationLivePatch({
|
|
10052
|
+
patcher,
|
|
10053
|
+
doc,
|
|
10054
|
+
isConnected,
|
|
10055
|
+
isSynced = true
|
|
10056
|
+
}) {
|
|
10057
|
+
react.useEffect(() => {
|
|
10058
|
+
if (!doc || !isConnected || !isSynced) {
|
|
10059
|
+
patcher.configure(null, null);
|
|
10060
|
+
return;
|
|
10061
|
+
}
|
|
10062
|
+
let cancelled = false;
|
|
10063
|
+
void (async () => {
|
|
10064
|
+
const Y = await import('./yjs-HBLSEMHP.js');
|
|
10065
|
+
if (cancelled) {
|
|
10066
|
+
return;
|
|
10067
|
+
}
|
|
10068
|
+
const factories = {
|
|
10069
|
+
createMap: () => new Y.Map(),
|
|
10070
|
+
createArray: () => new Y.Array(),
|
|
10071
|
+
createText: () => new Y.Text()
|
|
10072
|
+
};
|
|
10073
|
+
patcher.configure(doc, factories);
|
|
10074
|
+
})();
|
|
10075
|
+
return () => {
|
|
10076
|
+
cancelled = true;
|
|
10077
|
+
patcher.configure(null, null);
|
|
10078
|
+
};
|
|
10079
|
+
}, [patcher, doc, isConnected, isSynced]);
|
|
10080
|
+
}
|
|
9985
10081
|
function useLayoutSwitching(input) {
|
|
9986
10082
|
const { handler, slides, activeSlideIndex, ops, history } = input;
|
|
9987
10083
|
const [availableLayouts, setAvailableLayouts] = react.useState([]);
|
|
@@ -10053,10 +10149,10 @@ function useTouchGestures(input) {
|
|
|
10053
10149
|
if (!el || !enabled) {
|
|
10054
10150
|
return;
|
|
10055
10151
|
}
|
|
10056
|
-
const recognizer =
|
|
10152
|
+
const recognizer = chunk46Z6MNRS_js.createTouchGestureRecognizer({
|
|
10057
10153
|
getScale: () => scaleRef.current,
|
|
10058
|
-
minScale:
|
|
10059
|
-
maxScale:
|
|
10154
|
+
minScale: chunkLDF77JJD_js.MIN_ZOOM_SCALE,
|
|
10155
|
+
maxScale: chunkLDF77JJD_js.MAX_ZOOM_SCALE,
|
|
10060
10156
|
callbacks: {
|
|
10061
10157
|
onPinchZoom: (newScale) => callbacksRef.current.onPinchZoom?.(newScale),
|
|
10062
10158
|
onSwipe: (direction) => callbacksRef.current.onSwipe?.(direction),
|
|
@@ -10096,7 +10192,7 @@ function scrollFocusedIntoView(keyboardInset) {
|
|
|
10096
10192
|
return;
|
|
10097
10193
|
}
|
|
10098
10194
|
const rect = active.getBoundingClientRect();
|
|
10099
|
-
const delta =
|
|
10195
|
+
const delta = chunk46Z6MNRS_js.computeScrollDelta(
|
|
10100
10196
|
{ top: rect.top, bottom: rect.bottom },
|
|
10101
10197
|
window.innerHeight,
|
|
10102
10198
|
keyboardInset
|
|
@@ -10116,8 +10212,8 @@ function useKeyboardInsets(enabled = true) {
|
|
|
10116
10212
|
return;
|
|
10117
10213
|
}
|
|
10118
10214
|
const update = () => {
|
|
10119
|
-
const metrics =
|
|
10120
|
-
const inset = metrics ?
|
|
10215
|
+
const metrics = chunk46Z6MNRS_js.readViewportMetrics(window);
|
|
10216
|
+
const inset = metrics ? chunk46Z6MNRS_js.computeKeyboardInset(metrics) : 0;
|
|
10121
10217
|
setKeyboardInset(inset);
|
|
10122
10218
|
if (inset > 0) {
|
|
10123
10219
|
window.requestAnimationFrame(() => scrollFocusedIntoView(inset));
|
|
@@ -10128,8 +10224,8 @@ function useKeyboardInsets(enabled = true) {
|
|
|
10128
10224
|
vv.addEventListener("scroll", update);
|
|
10129
10225
|
const onFocusIn = () => {
|
|
10130
10226
|
window.requestAnimationFrame(() => {
|
|
10131
|
-
const metrics =
|
|
10132
|
-
const inset = metrics ?
|
|
10227
|
+
const metrics = chunk46Z6MNRS_js.readViewportMetrics(window);
|
|
10228
|
+
const inset = metrics ? chunk46Z6MNRS_js.computeKeyboardInset(metrics) : 0;
|
|
10133
10229
|
if (inset > 0) {
|
|
10134
10230
|
scrollFocusedIntoView(inset);
|
|
10135
10231
|
}
|
|
@@ -10142,7 +10238,7 @@ function useKeyboardInsets(enabled = true) {
|
|
|
10142
10238
|
document.removeEventListener("focusin", onFocusIn);
|
|
10143
10239
|
};
|
|
10144
10240
|
}, [enabled]);
|
|
10145
|
-
return { keyboardInset, isKeyboardOpen:
|
|
10241
|
+
return { keyboardInset, isKeyboardOpen: chunk46Z6MNRS_js.isKeyboardOpen(keyboardInset) };
|
|
10146
10242
|
}
|
|
10147
10243
|
|
|
10148
10244
|
// src/viewer/hooks/useViewerBuildingBlocks-canvas-props.ts
|
|
@@ -10197,13 +10293,13 @@ function buildCanvasProps(input) {
|
|
|
10197
10293
|
if (mode === "present") {
|
|
10198
10294
|
presentation.handlePresentationAction(action);
|
|
10199
10295
|
} else if (action.url) {
|
|
10200
|
-
|
|
10296
|
+
chunk46Z6MNRS_js.safeOpenUrl(action.url);
|
|
10201
10297
|
}
|
|
10202
10298
|
};
|
|
10203
10299
|
const handleHyperlinkClick = (url) => {
|
|
10204
|
-
if (
|
|
10300
|
+
if (chunk46Z6MNRS_js.isPpactionUrl(url)) {
|
|
10205
10301
|
if (mode === "present") {
|
|
10206
|
-
const parsed =
|
|
10302
|
+
const parsed = chunk46Z6MNRS_js.parsePpactionUrl(url);
|
|
10207
10303
|
if (parsed) {
|
|
10208
10304
|
presentation.handlePresentationAction({
|
|
10209
10305
|
action: parsed.action,
|
|
@@ -10213,7 +10309,7 @@ function buildCanvasProps(input) {
|
|
|
10213
10309
|
}
|
|
10214
10310
|
return;
|
|
10215
10311
|
}
|
|
10216
|
-
|
|
10312
|
+
chunk46Z6MNRS_js.safeOpenUrl(url);
|
|
10217
10313
|
};
|
|
10218
10314
|
return {
|
|
10219
10315
|
activeSlide: effectiveSlide,
|
|
@@ -10533,7 +10629,7 @@ function buildToolbarProps(input) {
|
|
|
10533
10629
|
onOpenFile,
|
|
10534
10630
|
onOpenRecentFile,
|
|
10535
10631
|
onCreatePresentation: (templateId) => {
|
|
10536
|
-
s.setSlides(
|
|
10632
|
+
s.setSlides(chunk46Z6MNRS_js.createBackstagePresentation(templateId));
|
|
10537
10633
|
s.setActiveSlideIndex(0);
|
|
10538
10634
|
s.setSelectedElementId(null);
|
|
10539
10635
|
s.setSelectedElementIds([]);
|
|
@@ -10588,7 +10684,7 @@ function buildToolbarProps(input) {
|
|
|
10588
10684
|
isCommentsPanelOpen: s.isInspectorPaneOpen,
|
|
10589
10685
|
slideCommentCount: activeSlide?.comments?.length ?? 0,
|
|
10590
10686
|
formatPainterActive: s.formatPainterActive,
|
|
10591
|
-
canActivateFormatPainter:
|
|
10687
|
+
canActivateFormatPainter: chunk46Z6MNRS_js.hasCopyableFormat(selectedElement),
|
|
10592
10688
|
onToggleFormatPainter: () => s.setFormatPainterActive((p) => !p),
|
|
10593
10689
|
isSelectionPaneOpen: s.isSelectionPaneOpen,
|
|
10594
10690
|
onToggleSelectionPane: () => s.setIsSelectionPaneOpen((p) => !p),
|
|
@@ -10851,7 +10947,7 @@ function useViewerBuildingBlocks(input) {
|
|
|
10851
10947
|
}, [incomingContent]);
|
|
10852
10948
|
const onOpenFile = react.useCallback(() => {
|
|
10853
10949
|
void (async () => {
|
|
10854
|
-
const picked = await
|
|
10950
|
+
const picked = await chunk46Z6MNRS_js.openPptxFile();
|
|
10855
10951
|
if (picked) {
|
|
10856
10952
|
setContent(picked.buffer);
|
|
10857
10953
|
}
|
|
@@ -10859,7 +10955,7 @@ function useViewerBuildingBlocks(input) {
|
|
|
10859
10955
|
}, []);
|
|
10860
10956
|
const onOpenRecentFile = react.useCallback((key) => {
|
|
10861
10957
|
void (async () => {
|
|
10862
|
-
const bytes = await
|
|
10958
|
+
const bytes = await chunk46Z6MNRS_js.readBackstageRecentFile(key);
|
|
10863
10959
|
if (bytes) {
|
|
10864
10960
|
setContent(bytes);
|
|
10865
10961
|
}
|
|
@@ -11046,6 +11142,7 @@ exports.useAutosave = useAutosave;
|
|
|
11046
11142
|
exports.useBroadcastFollower = useBroadcastFollower;
|
|
11047
11143
|
exports.useCanvasInteractions = useCanvasInteractions;
|
|
11048
11144
|
exports.useClipboardHandlers = useClipboardHandlers;
|
|
11145
|
+
exports.useCollaborationLivePatch = useCollaborationLivePatch;
|
|
11049
11146
|
exports.useCollaborativeHistory = useCollaborativeHistory;
|
|
11050
11147
|
exports.useCollaborativeState = useCollaborativeState;
|
|
11051
11148
|
exports.useComments = useComments;
|