pptx-react-viewer 2.0.0 → 2.2.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 +30 -0
- package/README.md +1 -1
- package/dist/{AiChatPanel-BRGQCYZM.mjs → AiChatPanel-JFCJCR3O.mjs} +3 -3
- package/dist/AiChatPanel-JFCJCR3O.mjs.br +0 -0
- package/dist/AiChatPanel-JFCJCR3O.mjs.gz +0 -0
- package/dist/{AiChatPanel-PW5OT25Z.js → AiChatPanel-S3FWARWG.js} +11 -11
- package/dist/AiChatPanel-S3FWARWG.js.br +0 -0
- package/dist/AiChatPanel-S3FWARWG.js.gz +0 -0
- package/dist/{Model3DScene-JCGYRKXM.js → Model3DScene-BZK4UHL4.js} +2 -2
- package/dist/Model3DScene-BZK4UHL4.js.br +0 -0
- package/dist/Model3DScene-BZK4UHL4.js.gz +0 -0
- package/dist/{Model3DScene-TEF362W2.mjs → Model3DScene-RCZCBW52.mjs} +1 -1
- package/dist/{Model3DScene-TEF362W2.mjs.br → Model3DScene-RCZCBW52.mjs.br} +0 -0
- package/dist/Model3DScene-RCZCBW52.mjs.gz +0 -0
- package/dist/PowerPointViewer-gmU5rc7K.d.ts.map +1 -1
- package/dist/{SurfaceChart3DScene-2SHCYZVC.js → SurfaceChart3DScene-EGPAMPX4.js} +2 -2
- package/dist/SurfaceChart3DScene-EGPAMPX4.js.br +0 -0
- package/dist/SurfaceChart3DScene-EGPAMPX4.js.gz +0 -0
- package/dist/{SurfaceChart3DScene-UPDCIMJM.mjs → SurfaceChart3DScene-IRLH4ADG.mjs} +1 -1
- package/dist/{SurfaceChart3DScene-UPDCIMJM.mjs.br → SurfaceChart3DScene-IRLH4ADG.mjs.br} +0 -0
- package/dist/SurfaceChart3DScene-IRLH4ADG.mjs.gz +0 -0
- package/dist/{chunk-LFXG7SGG.js → chunk-3KD6S6VM.js} +1111 -830
- package/dist/chunk-3KD6S6VM.js.br +0 -0
- package/dist/chunk-3KD6S6VM.js.gz +0 -0
- package/dist/{chunk-L63RAVM7.mjs → chunk-6BUR4MJO.mjs} +358 -77
- package/dist/chunk-6BUR4MJO.mjs.br +0 -0
- package/dist/chunk-6BUR4MJO.mjs.gz +0 -0
- package/dist/{chunk-ZB4NZRCI.js → chunk-JPJBOVU7.js} +423 -332
- package/dist/chunk-JPJBOVU7.js.br +0 -0
- package/dist/chunk-JPJBOVU7.js.gz +0 -0
- package/dist/{chunk-5XLLRPMV.mjs → chunk-L4ETDT4F.mjs} +174 -84
- package/dist/chunk-L4ETDT4F.mjs.br +0 -0
- package/dist/chunk-L4ETDT4F.mjs.gz +0 -0
- package/dist/{chunk-2X72MOPZ.mjs → chunk-PZTPX3HK.mjs} +10 -1
- package/dist/chunk-PZTPX3HK.mjs.br +0 -0
- package/dist/chunk-PZTPX3HK.mjs.gz +0 -0
- package/dist/{chunk-R2N2UYT7.mjs → chunk-RLK72AOU.mjs} +403 -3
- package/dist/chunk-RLK72AOU.mjs.br +0 -0
- package/dist/{chunk-R2N2UYT7.mjs.gz → chunk-RLK72AOU.mjs.gz} +0 -0
- package/dist/{chunk-ZKDE3HJI.js → chunk-RNZJKGA7.js} +219 -219
- package/dist/chunk-RNZJKGA7.js.br +0 -0
- package/dist/chunk-RNZJKGA7.js.gz +0 -0
- package/dist/{chunk-B6NRDUHJ.mjs → chunk-SOHIKHL4.mjs} +3 -3
- package/dist/chunk-SOHIKHL4.mjs.br +0 -0
- package/dist/chunk-SOHIKHL4.mjs.gz +0 -0
- package/dist/{chunk-OKOJVSKJ.js → chunk-UTTXH3GH.js} +410 -2
- package/dist/chunk-UTTXH3GH.js.br +0 -0
- package/dist/{chunk-OKOJVSKJ.js.gz → chunk-UTTXH3GH.js.gz} +0 -0
- package/dist/{chunk-CUUYYYC5.js → chunk-YIFO3WQO.js} +10 -1
- package/dist/chunk-YIFO3WQO.js.br +0 -0
- package/dist/chunk-YIFO3WQO.js.gz +0 -0
- package/dist/i18n.js +4 -4
- package/dist/i18n.js.br +0 -0
- package/dist/i18n.js.gz +0 -0
- package/dist/i18n.mjs +1 -1
- package/dist/i18n.mjs.br +0 -0
- package/dist/i18n.mjs.gz +0 -0
- package/dist/{index-a8wcFjRJ.d.ts → index-CDCSXtK3.d.ts} +32 -16
- package/dist/index-CDCSXtK3.d.ts.map +1 -0
- package/dist/index.js +35 -35
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.br +0 -0
- package/dist/index.mjs.gz +0 -0
- package/dist/internals.d.ts +142 -14
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +79 -79
- package/dist/internals.js.br +0 -0
- package/dist/internals.js.gz +0 -0
- package/dist/internals.mjs +4 -4
- package/dist/internals.mjs.br +0 -0
- package/dist/internals.mjs.gz +0 -0
- package/dist/pptx-viewer.css +1 -1
- package/dist/pptx-viewer.css.br +0 -0
- package/dist/pptx-viewer.css.gz +0 -0
- package/dist/viewer/index.js +21 -21
- package/dist/viewer/index.js.br +0 -0
- package/dist/viewer/index.js.gz +0 -0
- package/dist/viewer/index.mjs +5 -5
- 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.br +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-2X72MOPZ.mjs.br +0 -0
- package/dist/chunk-2X72MOPZ.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-CUUYYYC5.js.br +0 -0
- package/dist/chunk-CUUYYYC5.js.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
- package/dist/index-a8wcFjRJ.d.ts.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkRNZJKGA7_js = require('./chunk-RNZJKGA7.js');
|
|
4
|
+
var chunkUTTXH3GH_js = require('./chunk-UTTXH3GH.js');
|
|
5
|
+
var chunkYIFO3WQO_js = require('./chunk-YIFO3WQO.js');
|
|
6
6
|
var chunkCLNGAVNH_js = require('./chunk-CLNGAVNH.js');
|
|
7
7
|
var react = require('react');
|
|
8
8
|
var JSZip = require('jszip');
|
|
@@ -15,7 +15,7 @@ var JSZip__default = /*#__PURE__*/_interopDefault(JSZip);
|
|
|
15
15
|
function useVirtualizedSlides({
|
|
16
16
|
totalItems,
|
|
17
17
|
itemHeight,
|
|
18
|
-
overscan =
|
|
18
|
+
overscan = chunkUTTXH3GH_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 = chunkUTTXH3GH_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 >= chunkUTTXH3GH_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
|
+
}, chunkUTTXH3GH_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 = chunkUTTXH3GH_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 = chunkUTTXH3GH_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
|
+
chunkUTTXH3GH_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 = chunkUTTXH3GH_js.validateRoomId(config.roomId);
|
|
244
|
+
const provider = new WebrtcProvider(roomId, yDoc, opts);
|
|
245
|
+
departureRef.current = chunkUTTXH3GH_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 = chunkUTTXH3GH_js.validateRoomId(config.roomId);
|
|
288
|
+
const transport = config.transport ?? chunkUTTXH3GH_js.resolveTransportForServerUrl(config.serverUrl);
|
|
279
289
|
if (transport === "webrtc") {
|
|
280
290
|
await initWebrtc();
|
|
281
291
|
return;
|
|
282
292
|
}
|
|
283
|
-
if (
|
|
293
|
+
if (chunkUTTXH3GH_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 = chunkUTTXH3GH_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
|
+
chunkUTTXH3GH_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
|
+
}, chunkUTTXH3GH_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
|
+
chunkUTTXH3GH_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 = chunkUTTXH3GH_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 = chunkUTTXH3GH_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(chunkUTTXH3GH_js.cloneSlide),
|
|
522
|
+
templateElementsBySlideId: chunkUTTXH3GH_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(chunkUTTXH3GH_js.cloneSlide));
|
|
513
536
|
setTemplateElementsBySlideId(
|
|
514
|
-
|
|
537
|
+
chunkUTTXH3GH_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 = chunkRNZJKGA7_js.cloneHistorySnapshot(previousSnapshot);
|
|
572
|
+
lastHistorySnapshotRef.current = chunkRNZJKGA7_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 = chunkRNZJKGA7_js.cloneHistorySnapshot(nextSnapshot);
|
|
594
|
+
lastHistorySnapshotRef.current = chunkRNZJKGA7_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 = chunkRNZJKGA7_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 = chunkRNZJKGA7_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(chunkRNZJKGA7_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 = chunkRNZJKGA7_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, chunkRNZJKGA7_js.MIN_ZOOM_SCALE), chunkRNZJKGA7_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, chunkRNZJKGA7_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, chunkRNZJKGA7_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, chunkRNZJKGA7_js.MIN_ELEMENT_SIZE));
|
|
791
|
+
maxY = Math.max(maxY, element.y + Math.max(element.height, chunkRNZJKGA7_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, chunkRNZJKGA7_js.MIN_ELEMENT_SIZE);
|
|
798
|
+
const boundsHeight = Math.max(selectionBounds.maxY - selectionBounds.minY, chunkRNZJKGA7_js.MIN_ELEMENT_SIZE);
|
|
776
799
|
const availableWidth = Math.max(
|
|
777
|
-
effectiveEditorDimensions.width -
|
|
778
|
-
|
|
800
|
+
effectiveEditorDimensions.width - chunkRNZJKGA7_js.ZOOM_TO_SELECTION_PADDING,
|
|
801
|
+
chunkRNZJKGA7_js.MIN_ELEMENT_SIZE
|
|
779
802
|
);
|
|
780
803
|
const availableHeight = Math.max(
|
|
781
|
-
effectiveEditorDimensions.height -
|
|
782
|
-
|
|
804
|
+
effectiveEditorDimensions.height - chunkRNZJKGA7_js.ZOOM_TO_SELECTION_PADDING,
|
|
805
|
+
chunkRNZJKGA7_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, chunkRNZJKGA7_js.MIN_ZOOM_SCALE),
|
|
814
|
+
chunkRNZJKGA7_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, chunkRNZJKGA7_js.MIN_ZOOM_SCALE), chunkRNZJKGA7_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
|
+
chunkRNZJKGA7_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
|
+
chunkUTTXH3GH_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 = chunkUTTXH3GH_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 = chunkUTTXH3GH_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 = chunkUTTXH3GH_js.PRESENTATION_CHANNEL_NAME;
|
|
1266
|
+
var AUDIENCE_HASH = chunkUTTXH3GH_js.PRESENTATION_HASH;
|
|
1267
|
+
var PRESENTER_MSG_ORIGIN = chunkUTTXH3GH_js.PRESENTATION_MESSAGE_ORIGIN;
|
|
1268
|
+
var AUDIENCE_NONCE_KEY = chunkUTTXH3GH_js.PRESENTATION_NONCE_KEY;
|
|
1246
1269
|
function generateSessionId() {
|
|
1247
|
-
return
|
|
1270
|
+
return chunkUTTXH3GH_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 ? chunkUTTXH3GH_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 chunkUTTXH3GH_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 = chunkUTTXH3GH_js.buildPresentationAudienceUrl(window.location.href, sessionId);
|
|
1389
|
+
void chunkUTTXH3GH_js.resolveAudienceScreenPlacement(window).then((placement) => {
|
|
1367
1390
|
if (placement && audienceWindowRef.current === blankWin && !blankWin.closed) {
|
|
1368
|
-
|
|
1391
|
+
chunkUTTXH3GH_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 chunkUTTXH3GH_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 (chunkUTTXH3GH_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 chunkUTTXH3GH_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 (!chunkUTTXH3GH_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 chunkUTTXH3GH_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: chunkUTTXH3GH_js.PRESENTATION_MESSAGE_ORIGIN,
|
|
1533
1556
|
type: "audience-ready",
|
|
1534
1557
|
sessionId: expectedSessionId
|
|
1535
1558
|
});
|
|
@@ -1542,53 +1565,18 @@ function useAudienceMode(input) {
|
|
|
1542
1565
|
};
|
|
1543
1566
|
}, [onSetMode, onSetActiveSlideIndex, onSnapshot]);
|
|
1544
1567
|
}
|
|
1545
|
-
|
|
1546
|
-
// src/viewer/hooks/presentation-mode/keyboard-helpers.ts
|
|
1547
|
-
function mapKeyToPresentationAction(key, ctrlKey) {
|
|
1548
|
-
if (key === "Escape") {
|
|
1549
|
-
return { action: "exit" };
|
|
1550
|
-
}
|
|
1551
|
-
if (key === "ArrowRight" || key === "PageDown" || key === " ") {
|
|
1552
|
-
return { action: "next" };
|
|
1553
|
-
}
|
|
1554
|
-
if (key === "ArrowLeft" || key === "PageUp") {
|
|
1555
|
-
return { action: "prev" };
|
|
1556
|
-
}
|
|
1557
|
-
if (key === "l" || key === "L") {
|
|
1558
|
-
return { action: "toggleLaser" };
|
|
1559
|
-
}
|
|
1560
|
-
if (key === "p" || key === "P") {
|
|
1561
|
-
return { action: "togglePen" };
|
|
1562
|
-
}
|
|
1563
|
-
if (key === "e" || key === "E") {
|
|
1564
|
-
return { action: "toggleEraser" };
|
|
1565
|
-
}
|
|
1566
|
-
if (key === "b" || key === "B") {
|
|
1567
|
-
return { action: "toggleBlackScreen" };
|
|
1568
|
-
}
|
|
1569
|
-
if (key === "w" || key === "W") {
|
|
1570
|
-
return { action: "toggleWhiteScreen" };
|
|
1571
|
-
}
|
|
1572
|
-
if (key === "m" && ctrlKey) {
|
|
1573
|
-
return { action: "toggleToolbar" };
|
|
1574
|
-
}
|
|
1575
|
-
if (key === "n" || key === "N") {
|
|
1576
|
-
return { action: "togglePresenterView" };
|
|
1577
|
-
}
|
|
1578
|
-
return { action: "none" };
|
|
1579
|
-
}
|
|
1580
|
-
|
|
1581
|
-
// src/viewer/hooks/presentation-mode/usePresentationKeyboard.ts
|
|
1582
1568
|
function usePresentationKeyboard(input) {
|
|
1583
1569
|
const {
|
|
1584
1570
|
mode,
|
|
1585
1571
|
movePresentationSlide,
|
|
1572
|
+
navigateToSlide,
|
|
1573
|
+
slideCount,
|
|
1586
1574
|
onSetMode,
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1575
|
+
onSetPointerTool,
|
|
1576
|
+
onEraseAnnotations,
|
|
1577
|
+
onToggleInkMarkup,
|
|
1590
1578
|
onToggleToolbar,
|
|
1591
|
-
|
|
1579
|
+
onShowAllSlides,
|
|
1592
1580
|
onToggleBlackScreen,
|
|
1593
1581
|
onToggleWhiteScreen,
|
|
1594
1582
|
rehearsing,
|
|
@@ -1596,18 +1584,20 @@ function usePresentationKeyboard(input) {
|
|
|
1596
1584
|
presentationSlideIndex,
|
|
1597
1585
|
setShowRehearsalSummary
|
|
1598
1586
|
} = input;
|
|
1587
|
+
const keyBufferRef = react.useRef(chunkUTTXH3GH_js.createPresentationKeyBuffer());
|
|
1599
1588
|
react.useEffect(() => {
|
|
1600
1589
|
if (mode !== "present") {
|
|
1590
|
+
keyBufferRef.current = chunkUTTXH3GH_js.createPresentationKeyBuffer();
|
|
1601
1591
|
return;
|
|
1602
1592
|
}
|
|
1603
1593
|
const handleKeyDown = (event) => {
|
|
1604
|
-
const mapped =
|
|
1594
|
+
const mapped = chunkUTTXH3GH_js.mapPresentationKey(event, keyBufferRef.current);
|
|
1605
1595
|
if (mapped.action === "none") {
|
|
1606
1596
|
return;
|
|
1607
1597
|
}
|
|
1608
1598
|
event.preventDefault();
|
|
1609
1599
|
switch (mapped.action) {
|
|
1610
|
-
case "
|
|
1600
|
+
case "end":
|
|
1611
1601
|
if (rehearsing) {
|
|
1612
1602
|
recordCurrentSlideTime(presentationSlideIndex);
|
|
1613
1603
|
setShowRehearsalSummary(true);
|
|
@@ -1617,27 +1607,40 @@ function usePresentationKeyboard(input) {
|
|
|
1617
1607
|
case "next":
|
|
1618
1608
|
movePresentationSlide(1);
|
|
1619
1609
|
return;
|
|
1620
|
-
case "
|
|
1610
|
+
case "previous":
|
|
1621
1611
|
movePresentationSlide(-1);
|
|
1622
1612
|
return;
|
|
1623
|
-
case "
|
|
1624
|
-
|
|
1613
|
+
case "first":
|
|
1614
|
+
navigateToSlide(0);
|
|
1615
|
+
return;
|
|
1616
|
+
case "last":
|
|
1617
|
+
navigateToSlide(Math.max(0, slideCount - 1));
|
|
1618
|
+
return;
|
|
1619
|
+
case "goto": {
|
|
1620
|
+
const index = mapped.slideNumber - 1;
|
|
1621
|
+
if (index >= 0 && index < slideCount) {
|
|
1622
|
+
navigateToSlide(index);
|
|
1623
|
+
}
|
|
1624
|
+
return;
|
|
1625
|
+
}
|
|
1626
|
+
case "pointerTool":
|
|
1627
|
+
onSetPointerTool?.(mapped.tool);
|
|
1625
1628
|
return;
|
|
1626
|
-
case "
|
|
1627
|
-
|
|
1629
|
+
case "eraseAnnotations":
|
|
1630
|
+
onEraseAnnotations?.();
|
|
1628
1631
|
return;
|
|
1629
|
-
case "
|
|
1630
|
-
|
|
1632
|
+
case "toggleInkMarkup":
|
|
1633
|
+
onToggleInkMarkup?.();
|
|
1631
1634
|
return;
|
|
1632
|
-
case "
|
|
1635
|
+
case "toggleChrome":
|
|
1633
1636
|
onToggleToolbar?.();
|
|
1634
1637
|
return;
|
|
1635
|
-
case "
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
+
case "showAllSlides":
|
|
1639
|
+
onShowAllSlides?.();
|
|
1640
|
+
return;
|
|
1638
1641
|
case "toggleBlackScreen":
|
|
1639
1642
|
onToggleBlackScreen?.();
|
|
1640
|
-
|
|
1643
|
+
return;
|
|
1641
1644
|
case "toggleWhiteScreen":
|
|
1642
1645
|
onToggleWhiteScreen?.();
|
|
1643
1646
|
break;
|
|
@@ -1650,12 +1653,14 @@ function usePresentationKeyboard(input) {
|
|
|
1650
1653
|
}, [
|
|
1651
1654
|
mode,
|
|
1652
1655
|
movePresentationSlide,
|
|
1656
|
+
navigateToSlide,
|
|
1657
|
+
slideCount,
|
|
1653
1658
|
onSetMode,
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1659
|
+
onSetPointerTool,
|
|
1660
|
+
onEraseAnnotations,
|
|
1661
|
+
onToggleInkMarkup,
|
|
1657
1662
|
onToggleToolbar,
|
|
1658
|
-
|
|
1663
|
+
onShowAllSlides,
|
|
1659
1664
|
onToggleBlackScreen,
|
|
1660
1665
|
onToggleWhiteScreen,
|
|
1661
1666
|
rehearsing,
|
|
@@ -1794,7 +1799,7 @@ function handlePresentationActionImpl(action, deps) {
|
|
|
1794
1799
|
return;
|
|
1795
1800
|
}
|
|
1796
1801
|
if (action.url && !actionStr.includes("hlinksldjump")) {
|
|
1797
|
-
if (
|
|
1802
|
+
if (chunkUTTXH3GH_js.isUrlSafe(action.url)) {
|
|
1798
1803
|
window.open(action.url, "_blank", "noopener,noreferrer");
|
|
1799
1804
|
}
|
|
1800
1805
|
}
|
|
@@ -1804,7 +1809,7 @@ function handlePresentationActionImpl(action, deps) {
|
|
|
1804
1809
|
function executeSlideTransition(nextSlideIndex, deps) {
|
|
1805
1810
|
const incomingSlide = deps.slides[nextSlideIndex];
|
|
1806
1811
|
const transition = incomingSlide?.transition;
|
|
1807
|
-
const durationMs = deps.playTransition ?
|
|
1812
|
+
const durationMs = deps.playTransition ? chunkUTTXH3GH_js.resolveTransitionDurationMs(transition) : 0;
|
|
1808
1813
|
deps.clearPresentationTimers();
|
|
1809
1814
|
deps.setPresentationSlideIndex(nextSlideIndex);
|
|
1810
1815
|
deps.onSetActiveSlideIndex(nextSlideIndex);
|
|
@@ -2050,17 +2055,17 @@ function useZoomNavigation(input) {
|
|
|
2050
2055
|
};
|
|
2051
2056
|
}
|
|
2052
2057
|
function usePresenterConsole(slideIndex) {
|
|
2053
|
-
const timerRef = react.useRef(
|
|
2054
|
-
const [snapshot, setSnapshot] = react.useState(() =>
|
|
2058
|
+
const timerRef = react.useRef(chunkUTTXH3GH_js.createPresenterTimer());
|
|
2059
|
+
const [snapshot, setSnapshot] = react.useState(() => chunkUTTXH3GH_js.createInitialPresentationSnapshot(slideIndex));
|
|
2055
2060
|
const patch = react.useCallback((value) => {
|
|
2056
|
-
setSnapshot((current) =>
|
|
2061
|
+
setSnapshot((current) => chunkUTTXH3GH_js.mergePresentationSnapshot(current, value));
|
|
2057
2062
|
}, []);
|
|
2058
2063
|
react.useEffect(() => patch({ slideIndex }), [patch, slideIndex]);
|
|
2059
2064
|
react.useEffect(() => {
|
|
2060
2065
|
const timer = window.setInterval(() => {
|
|
2061
2066
|
patch({
|
|
2062
2067
|
paused: timerRef.current.paused,
|
|
2063
|
-
elapsedMs:
|
|
2068
|
+
elapsedMs: chunkUTTXH3GH_js.presenterElapsed(timerRef.current)
|
|
2064
2069
|
});
|
|
2065
2070
|
}, 1e3);
|
|
2066
2071
|
return () => window.clearInterval(timer);
|
|
@@ -2070,19 +2075,19 @@ function usePresenterConsole(slideIndex) {
|
|
|
2070
2075
|
applyAudienceSnapshot: setSnapshot,
|
|
2071
2076
|
setBlackout: (blackout) => patch({ blackout }),
|
|
2072
2077
|
toggleTimer: () => {
|
|
2073
|
-
timerRef.current =
|
|
2078
|
+
timerRef.current = chunkUTTXH3GH_js.togglePresenterTimer(timerRef.current);
|
|
2074
2079
|
patch({
|
|
2075
2080
|
paused: timerRef.current.paused,
|
|
2076
|
-
elapsedMs:
|
|
2081
|
+
elapsedMs: chunkUTTXH3GH_js.presenterElapsed(timerRef.current)
|
|
2077
2082
|
});
|
|
2078
2083
|
},
|
|
2079
2084
|
resetTimer: () => {
|
|
2080
|
-
timerRef.current =
|
|
2085
|
+
timerRef.current = chunkUTTXH3GH_js.resetPresenterTimer();
|
|
2081
2086
|
patch({ paused: false, elapsedMs: 0 });
|
|
2082
2087
|
},
|
|
2083
2088
|
stepZoom: (direction) => setSnapshot(
|
|
2084
|
-
(current) =>
|
|
2085
|
-
zoom:
|
|
2089
|
+
(current) => chunkUTTXH3GH_js.mergePresentationSnapshot(current, {
|
|
2090
|
+
zoom: chunkUTTXH3GH_js.stepPresenterZoom(
|
|
2086
2091
|
current.zoom ?? { scale: 1, originX: 0.5, originY: 0.5 },
|
|
2087
2092
|
direction
|
|
2088
2093
|
)
|
|
@@ -2107,9 +2112,9 @@ function usePresentationMode(input) {
|
|
|
2107
2112
|
onSetMode,
|
|
2108
2113
|
onSetActiveSlideIndex,
|
|
2109
2114
|
onPlayActionSound,
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2115
|
+
onSetPointerTool,
|
|
2116
|
+
onEraseAnnotations,
|
|
2117
|
+
onToggleInkMarkup,
|
|
2113
2118
|
onToggleToolbar,
|
|
2114
2119
|
onSaveRehearsalTimings,
|
|
2115
2120
|
loopContinuously,
|
|
@@ -2124,6 +2129,7 @@ function usePresentationMode(input) {
|
|
|
2124
2129
|
setTransitionOverlay(null);
|
|
2125
2130
|
}, []);
|
|
2126
2131
|
const [presenterMode, setPresenterMode] = react.useState(false);
|
|
2132
|
+
const [allSlidesOpen, setAllSlidesOpen] = react.useState(false);
|
|
2127
2133
|
const [endOfShowVisible, setEndOfShowVisible] = react.useState(false);
|
|
2128
2134
|
const [presentationStartTime, setPresentationStartTime] = react.useState(null);
|
|
2129
2135
|
const switchingToPresenterRef = react.useRef(false);
|
|
@@ -2208,6 +2214,8 @@ function usePresentationMode(input) {
|
|
|
2208
2214
|
[endOfShowVisible, moveNavigationSlide, onSetMode]
|
|
2209
2215
|
);
|
|
2210
2216
|
const { handleZoomClick, zoomReturnSlideIndex, returnToZoomSlide, clearZoomReturn } = useZoomNavigation({ navigateToSlide });
|
|
2217
|
+
const openAllSlides = react.useCallback(() => setAllSlidesOpen(true), []);
|
|
2218
|
+
const closeAllSlides = react.useCallback(() => setAllSlidesOpen(false), []);
|
|
2211
2219
|
const presenterConsole = usePresenterConsole(presentationSlideIndex);
|
|
2212
2220
|
const {
|
|
2213
2221
|
openAudienceWindow,
|
|
@@ -2280,12 +2288,14 @@ function usePresentationMode(input) {
|
|
|
2280
2288
|
usePresentationKeyboard({
|
|
2281
2289
|
mode,
|
|
2282
2290
|
movePresentationSlide,
|
|
2291
|
+
navigateToSlide,
|
|
2292
|
+
slideCount: slides.length,
|
|
2283
2293
|
onSetMode,
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2294
|
+
onSetPointerTool,
|
|
2295
|
+
onEraseAnnotations,
|
|
2296
|
+
onToggleInkMarkup,
|
|
2287
2297
|
onToggleToolbar,
|
|
2288
|
-
|
|
2298
|
+
onShowAllSlides: openAllSlides,
|
|
2289
2299
|
onToggleBlackScreen: () => presenterConsole.setBlackout(
|
|
2290
2300
|
presenterConsole.snapshot.blackout === "black" ? "none" : "black"
|
|
2291
2301
|
),
|
|
@@ -2385,6 +2395,9 @@ function usePresentationMode(input) {
|
|
|
2385
2395
|
clearPresentationTimers,
|
|
2386
2396
|
runPresentationEntranceAnimations,
|
|
2387
2397
|
endOfShowVisible,
|
|
2398
|
+
allSlidesOpen,
|
|
2399
|
+
openAllSlides,
|
|
2400
|
+
closeAllSlides,
|
|
2388
2401
|
movePresentationSlide,
|
|
2389
2402
|
navigateToSlide,
|
|
2390
2403
|
handlePresentationAction,
|
|
@@ -2445,6 +2458,7 @@ function usePresentationAnnotations(input) {
|
|
|
2445
2458
|
const [currentStroke, setCurrentStroke] = react.useState(null);
|
|
2446
2459
|
const [laserPosition, setLaserPosition] = react.useState(null);
|
|
2447
2460
|
const [toolbarVisible, setToolbarVisible] = react.useState(false);
|
|
2461
|
+
const [inkMarkupVisible, setInkMarkupVisible] = react.useState(true);
|
|
2448
2462
|
const slideAnnotationsRef = react.useRef(/* @__PURE__ */ new Map());
|
|
2449
2463
|
const [annotationStrokes, setAnnotationStrokes] = react.useState([]);
|
|
2450
2464
|
const [annotationVersion, setAnnotationVersion] = react.useState(0);
|
|
@@ -2630,6 +2644,8 @@ function usePresentationAnnotations(input) {
|
|
|
2630
2644
|
laserPosition,
|
|
2631
2645
|
toolbarVisible,
|
|
2632
2646
|
setToolbarVisible,
|
|
2647
|
+
inkMarkupVisible,
|
|
2648
|
+
setInkMarkupVisible,
|
|
2633
2649
|
handlePointerDown,
|
|
2634
2650
|
handlePointerMove,
|
|
2635
2651
|
handlePointerUp,
|
|
@@ -3299,14 +3315,17 @@ function useViewerCoreState(_input) {
|
|
|
3299
3315
|
const shapeAdjustmentDragStateRef = react.useRef(null);
|
|
3300
3316
|
const marqueeStateRef = react.useRef(null);
|
|
3301
3317
|
const isDrawingRef = react.useRef(false);
|
|
3318
|
+
const livePatcher = react.useMemo(() => chunkUTTXH3GH_js.createCollaborationLivePatcher(), []);
|
|
3319
|
+
react.useEffect(() => () => livePatcher.dispose(), [livePatcher]);
|
|
3320
|
+
const slidesRef = react.useRef([]);
|
|
3302
3321
|
const [mode, setMode] = react.useState("edit");
|
|
3303
3322
|
const [loading, setLoading] = react.useState(true);
|
|
3304
3323
|
const [error, setError] = react.useState(null);
|
|
3305
3324
|
const [slides, setSlides] = react.useState([]);
|
|
3306
3325
|
const [templateElementsBySlideId, setTemplateElementsBySlideId] = react.useState({});
|
|
3307
3326
|
const [canvasSize, setCanvasSize] = react.useState({
|
|
3308
|
-
width:
|
|
3309
|
-
height:
|
|
3327
|
+
width: chunkRNZJKGA7_js.DEFAULT_CANVAS_WIDTH,
|
|
3328
|
+
height: chunkRNZJKGA7_js.DEFAULT_CANVAS_HEIGHT
|
|
3310
3329
|
});
|
|
3311
3330
|
const [activeSlideIndex, setActiveSlideIndex] = react.useState(0);
|
|
3312
3331
|
const [selectedElementId, setSelectedElementId] = react.useState(null);
|
|
@@ -3326,8 +3345,14 @@ function useViewerCoreState(_input) {
|
|
|
3326
3345
|
const resolved = typeof value === "function" ? value(inlineEditingTextRef.current) : value;
|
|
3327
3346
|
inlineEditingTextRef.current = resolved;
|
|
3328
3347
|
setInlineEditingTextBase(value);
|
|
3348
|
+
chunkUTTXH3GH_js.publishLiveInlineText(
|
|
3349
|
+
livePatcher,
|
|
3350
|
+
slidesRef.current[activeSlideIndexRef.current],
|
|
3351
|
+
inlineEditingElementIdRef.current,
|
|
3352
|
+
resolved
|
|
3353
|
+
);
|
|
3329
3354
|
},
|
|
3330
|
-
[]
|
|
3355
|
+
[livePatcher]
|
|
3331
3356
|
);
|
|
3332
3357
|
const [editTemplateMode, setEditTemplateMode] = react.useState(false);
|
|
3333
3358
|
const [newShapeType, setNewShapeType] = react.useState("rect");
|
|
@@ -3361,6 +3386,7 @@ function useViewerCoreState(_input) {
|
|
|
3361
3386
|
const [preMasterMode, setPreMasterMode] = react.useState("edit");
|
|
3362
3387
|
const [masterViewTab, setMasterViewTab] = react.useState("slides");
|
|
3363
3388
|
const [handoutSlidesPerPage, setHandoutSlidesPerPage] = react.useState(4);
|
|
3389
|
+
slidesRef.current = slides;
|
|
3364
3390
|
const derived = useDerivedElementState({
|
|
3365
3391
|
slides,
|
|
3366
3392
|
activeSlideIndex,
|
|
@@ -3385,6 +3411,7 @@ function useViewerCoreState(_input) {
|
|
|
3385
3411
|
shapeAdjustmentDragStateRef,
|
|
3386
3412
|
marqueeStateRef,
|
|
3387
3413
|
isDrawingRef,
|
|
3414
|
+
livePatcher,
|
|
3388
3415
|
mode,
|
|
3389
3416
|
setMode,
|
|
3390
3417
|
loading,
|
|
@@ -3655,7 +3682,7 @@ function useLoadContent({
|
|
|
3655
3682
|
handlerRef.current = null;
|
|
3656
3683
|
const mediaElements = [];
|
|
3657
3684
|
for (const slide of parsed.slides) {
|
|
3658
|
-
|
|
3685
|
+
chunkUTTXH3GH_js.collectMediaElements(slide.elements, mediaElements);
|
|
3659
3686
|
}
|
|
3660
3687
|
for (const url of mediaDataUrls.values()) {
|
|
3661
3688
|
if (url.startsWith("blob:")) {
|
|
@@ -3696,7 +3723,7 @@ function useLoadContent({
|
|
|
3696
3723
|
}
|
|
3697
3724
|
})
|
|
3698
3725
|
);
|
|
3699
|
-
const { paths: imagePaths, refs: imageRefs } =
|
|
3726
|
+
const { paths: imagePaths, refs: imageRefs } = chunkUTTXH3GH_js.collectImagePaths(parsed.slides);
|
|
3700
3727
|
let nextSlides = parsed.slides;
|
|
3701
3728
|
if (imagePaths.size > 0) {
|
|
3702
3729
|
const resolvedMap = /* @__PURE__ */ new Map();
|
|
@@ -3751,12 +3778,12 @@ function useLoadContent({
|
|
|
3751
3778
|
}
|
|
3752
3779
|
}
|
|
3753
3780
|
handlerRef.current = handler;
|
|
3754
|
-
const partition =
|
|
3781
|
+
const partition = chunkRNZJKGA7_js.partitionTemplateElements(nextSlides);
|
|
3755
3782
|
setSlides(partition.slides);
|
|
3756
3783
|
setTemplateElementsBySlideId(partition.templateElementsBySlideId);
|
|
3757
3784
|
setCanvasSize({
|
|
3758
|
-
width: parsed.width ??
|
|
3759
|
-
height: parsed.height ??
|
|
3785
|
+
width: parsed.width ?? chunkRNZJKGA7_js.DEFAULT_CANVAS_WIDTH,
|
|
3786
|
+
height: parsed.height ?? chunkRNZJKGA7_js.DEFAULT_CANVAS_HEIGHT
|
|
3760
3787
|
});
|
|
3761
3788
|
setHeaderFooter(parsed.headerFooter ?? {});
|
|
3762
3789
|
setLayoutOptions(parsed.layoutOptions ?? []);
|
|
@@ -3785,7 +3812,7 @@ function useLoadContent({
|
|
|
3785
3812
|
setHasMacros(parsed.hasMacros === true);
|
|
3786
3813
|
setHasDigitalSignatures(parsed.hasDigitalSignatures === true);
|
|
3787
3814
|
setDigitalSignatureCount(parsed.digitalSignatureCount ?? 0);
|
|
3788
|
-
setGuides(
|
|
3815
|
+
setGuides(chunkUTTXH3GH_js.buildInitialGuides(parsed.presentationGuides, parsed.slides[0]?.guides));
|
|
3789
3816
|
setActiveSlideIndex(0);
|
|
3790
3817
|
clearSelection();
|
|
3791
3818
|
setIsDirty(false);
|
|
@@ -3870,7 +3897,7 @@ function useAutosave(input) {
|
|
|
3870
3897
|
isSavingRef.current = false;
|
|
3871
3898
|
return;
|
|
3872
3899
|
}
|
|
3873
|
-
await
|
|
3900
|
+
await chunkUTTXH3GH_js.saveAutosaveSnapshot(filePathRef.current, data);
|
|
3874
3901
|
setAutosaveStatus({ state: "saved", timestamp: Date.now() });
|
|
3875
3902
|
} catch (err) {
|
|
3876
3903
|
setAutosaveStatus({
|
|
@@ -3935,7 +3962,7 @@ function useElementOperations(input) {
|
|
|
3935
3962
|
}, [applySelection, setInlineEditingElementId, setContextMenuState]);
|
|
3936
3963
|
const updateElementById = react.useCallback(
|
|
3937
3964
|
(elementId, updates) => {
|
|
3938
|
-
if (
|
|
3965
|
+
if (chunkUTTXH3GH_js.isTemplateElementId(elementId)) {
|
|
3939
3966
|
const slideId = activeSlide?.id;
|
|
3940
3967
|
if (slideId) {
|
|
3941
3968
|
setTemplateElementsBySlideId((prev) => ({
|
|
@@ -3989,14 +4016,14 @@ function useElementOperations(input) {
|
|
|
3989
4016
|
if (!selectedElement || !chunkCLNGAVNH_js.hasTextProperties(selectedElement)) {
|
|
3990
4017
|
return;
|
|
3991
4018
|
}
|
|
3992
|
-
const inlineSel =
|
|
4019
|
+
const inlineSel = chunkUTTXH3GH_js.getInlineEditorSelection(selectedElement.textSegments);
|
|
3993
4020
|
if (inlineSel && selectedElement.textSegments) {
|
|
3994
|
-
const { newSegments: newSegments2, newSelection } =
|
|
4021
|
+
const { newSegments: newSegments2, newSelection } = chunkUTTXH3GH_js.applyStyleToSelectedSegments(
|
|
3995
4022
|
selectedElement.textSegments,
|
|
3996
4023
|
inlineSel,
|
|
3997
4024
|
updates
|
|
3998
4025
|
);
|
|
3999
|
-
|
|
4026
|
+
chunkUTTXH3GH_js.setPendingSelectionRestore(newSelection);
|
|
4000
4027
|
updateSelectedElement({
|
|
4001
4028
|
textSegments: newSegments2
|
|
4002
4029
|
});
|
|
@@ -4019,9 +4046,9 @@ function useElementOperations(input) {
|
|
|
4019
4046
|
if (!selectedElement || !chunkCLNGAVNH_js.hasTextProperties(selectedElement)) {
|
|
4020
4047
|
return;
|
|
4021
4048
|
}
|
|
4022
|
-
const inlineSel =
|
|
4049
|
+
const inlineSel = chunkUTTXH3GH_js.getInlineEditorSelection(selectedElement.textSegments);
|
|
4023
4050
|
if (inlineSel && selectedElement.textSegments) {
|
|
4024
|
-
const newSegments =
|
|
4051
|
+
const newSegments = chunkUTTXH3GH_js.applyCaseTransformToSegments(
|
|
4025
4052
|
selectedElement.textSegments,
|
|
4026
4053
|
inlineSel,
|
|
4027
4054
|
mode
|
|
@@ -4031,14 +4058,14 @@ function useElementOperations(input) {
|
|
|
4031
4058
|
}
|
|
4032
4059
|
const updates = {};
|
|
4033
4060
|
if (selectedElement.textSegments && selectedElement.textSegments.length > 0) {
|
|
4034
|
-
updates.textSegments =
|
|
4061
|
+
updates.textSegments = chunkUTTXH3GH_js.applyCaseTransformToSegments(
|
|
4035
4062
|
selectedElement.textSegments,
|
|
4036
4063
|
null,
|
|
4037
4064
|
mode
|
|
4038
4065
|
);
|
|
4039
4066
|
}
|
|
4040
4067
|
if (typeof selectedElement.text === "string") {
|
|
4041
|
-
updates.text =
|
|
4068
|
+
updates.text = chunkUTTXH3GH_js.transformTextCase(selectedElement.text, mode);
|
|
4042
4069
|
}
|
|
4043
4070
|
updateSelectedElement(updates);
|
|
4044
4071
|
},
|
|
@@ -4093,7 +4120,7 @@ function useSectionOperations(input) {
|
|
|
4093
4120
|
const { sections, setSections, slides, setSlides, markDirty } = input;
|
|
4094
4121
|
const addSection2 = react.useCallback(
|
|
4095
4122
|
(name, afterSlideIndex) => {
|
|
4096
|
-
const result =
|
|
4123
|
+
const result = chunkUTTXH3GH_js.addSection(sections, slides, name, afterSlideIndex);
|
|
4097
4124
|
setSlides(result.slides);
|
|
4098
4125
|
setSections(result.sections);
|
|
4099
4126
|
markDirty();
|
|
@@ -4102,7 +4129,7 @@ function useSectionOperations(input) {
|
|
|
4102
4129
|
);
|
|
4103
4130
|
const renameSection2 = react.useCallback(
|
|
4104
4131
|
(sectionId, newName) => {
|
|
4105
|
-
const result =
|
|
4132
|
+
const result = chunkUTTXH3GH_js.renameSection(sections, slides, sectionId, newName);
|
|
4106
4133
|
setSections(result.sections);
|
|
4107
4134
|
setSlides(result.slides);
|
|
4108
4135
|
markDirty();
|
|
@@ -4111,7 +4138,7 @@ function useSectionOperations(input) {
|
|
|
4111
4138
|
);
|
|
4112
4139
|
const deleteSection2 = react.useCallback(
|
|
4113
4140
|
(sectionId) => {
|
|
4114
|
-
const result =
|
|
4141
|
+
const result = chunkUTTXH3GH_js.deleteSection(sections, slides, sectionId);
|
|
4115
4142
|
setSections(result.sections);
|
|
4116
4143
|
setSlides(result.slides);
|
|
4117
4144
|
markDirty();
|
|
@@ -4120,21 +4147,21 @@ function useSectionOperations(input) {
|
|
|
4120
4147
|
);
|
|
4121
4148
|
const moveSectionUp2 = react.useCallback(
|
|
4122
4149
|
(sectionId) => {
|
|
4123
|
-
setSections(
|
|
4150
|
+
setSections(chunkUTTXH3GH_js.moveSectionUp(sections, sectionId));
|
|
4124
4151
|
markDirty();
|
|
4125
4152
|
},
|
|
4126
4153
|
[sections, setSections, markDirty]
|
|
4127
4154
|
);
|
|
4128
4155
|
const moveSectionDown2 = react.useCallback(
|
|
4129
4156
|
(sectionId) => {
|
|
4130
|
-
setSections(
|
|
4157
|
+
setSections(chunkUTTXH3GH_js.moveSectionDown(sections, sectionId));
|
|
4131
4158
|
markDirty();
|
|
4132
4159
|
},
|
|
4133
4160
|
[sections, setSections, markDirty]
|
|
4134
4161
|
);
|
|
4135
4162
|
const moveSlidesToSection2 = react.useCallback(
|
|
4136
4163
|
(slideIndexes, targetSectionId) => {
|
|
4137
|
-
const result =
|
|
4164
|
+
const result = chunkUTTXH3GH_js.moveSlidesToSection(sections, slides, slideIndexes, targetSectionId);
|
|
4138
4165
|
setSlides(result.slides);
|
|
4139
4166
|
setSections(result.sections);
|
|
4140
4167
|
markDirty();
|
|
@@ -4153,25 +4180,32 @@ function useSectionOperations(input) {
|
|
|
4153
4180
|
|
|
4154
4181
|
// src/viewer/hooks/pointer-move-handlers.ts
|
|
4155
4182
|
function computeResizeGeometry(handle, startX, startY, startWidth, startHeight, dx, dy, snapToGrid, gridSpacingPx) {
|
|
4156
|
-
const resized =
|
|
4183
|
+
const resized = chunkUTTXH3GH_js.applyResize(
|
|
4157
4184
|
{ x: startX, y: startY, width: startWidth, height: startHeight },
|
|
4158
4185
|
handle,
|
|
4159
4186
|
dx,
|
|
4160
4187
|
dy,
|
|
4161
4188
|
1,
|
|
4162
|
-
{ minSize:
|
|
4189
|
+
{ minSize: chunkRNZJKGA7_js.MIN_ELEMENT_SIZE }
|
|
4163
4190
|
);
|
|
4164
4191
|
const box = { x: resized.x, y: resized.y, width: resized.width, height: resized.height };
|
|
4165
4192
|
if (!snapToGrid) {
|
|
4166
4193
|
return box;
|
|
4167
4194
|
}
|
|
4168
|
-
return
|
|
4195
|
+
return chunkUTTXH3GH_js.snapBoxToGrid(box, handle, gridSpacingPx, chunkRNZJKGA7_js.MIN_ELEMENT_SIZE);
|
|
4169
4196
|
}
|
|
4170
4197
|
function computeAdjustmentValue(startAdjustment, dx, startWidth) {
|
|
4171
4198
|
const range = startWidth || 200;
|
|
4172
4199
|
const delta = dx / range;
|
|
4173
4200
|
return Math.max(0, Math.min(1, startAdjustment + delta));
|
|
4174
4201
|
}
|
|
4202
|
+
function resolveLiveTarget(input) {
|
|
4203
|
+
const { livePatcher, editTemplateMode, activeSlide } = input;
|
|
4204
|
+
if (!livePatcher || editTemplateMode || !livePatcher.isActive()) {
|
|
4205
|
+
return void 0;
|
|
4206
|
+
}
|
|
4207
|
+
return { patcher: livePatcher, slideId: activeSlide?.id };
|
|
4208
|
+
}
|
|
4175
4209
|
function processPointerMove(e, input, tracker) {
|
|
4176
4210
|
const {
|
|
4177
4211
|
editorScale,
|
|
@@ -4220,13 +4254,14 @@ function processPointerMove(e, input, tracker) {
|
|
|
4220
4254
|
guides,
|
|
4221
4255
|
elementLookup,
|
|
4222
4256
|
tracker,
|
|
4223
|
-
setSnapLines
|
|
4257
|
+
setSnapLines,
|
|
4258
|
+
resolveLiveTarget(input)
|
|
4224
4259
|
);
|
|
4225
4260
|
return;
|
|
4226
4261
|
}
|
|
4227
4262
|
const rs = resizeStateRef.current;
|
|
4228
4263
|
if (rs) {
|
|
4229
|
-
processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx);
|
|
4264
|
+
processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx, resolveLiveTarget(input));
|
|
4230
4265
|
return;
|
|
4231
4266
|
}
|
|
4232
4267
|
const adj = shapeAdjustmentDragStateRef.current;
|
|
@@ -4244,7 +4279,7 @@ function processMarqueeMove(e, marquee, canvasStageRef, canvasSize, editorScale,
|
|
|
4244
4279
|
marquee.currentY = Math.max(0, Math.min(canvasSize.height, (e.clientY - rect.top) / editorScale));
|
|
4245
4280
|
setMarqueeSelectionState({ ...marquee });
|
|
4246
4281
|
}
|
|
4247
|
-
function processDragMove(e, drag, editorScale, snapToGrid, snapToShape, gridSpacingPx, editTemplateMode, templateElements, activeSlide, guides, elementLookup, tracker, setSnapLines) {
|
|
4282
|
+
function processDragMove(e, drag, editorScale, snapToGrid, snapToShape, gridSpacingPx, editTemplateMode, templateElements, activeSlide, guides, elementLookup, tracker, setSnapLines, live) {
|
|
4248
4283
|
const dx = (e.clientX - drag.startClientX) / editorScale;
|
|
4249
4284
|
const dy = (e.clientY - drag.startClientY) / editorScale;
|
|
4250
4285
|
if (!drag.moved && (Math.abs(dx) > 2 || Math.abs(dy) > 2)) {
|
|
@@ -4275,7 +4310,7 @@ function processDragMove(e, drag, editorScale, snapToGrid, snapToShape, gridSpac
|
|
|
4275
4310
|
width: el.width,
|
|
4276
4311
|
height: el.height
|
|
4277
4312
|
}));
|
|
4278
|
-
const snapResult =
|
|
4313
|
+
const snapResult = chunkUTTXH3GH_js.computeSnapToShape(
|
|
4279
4314
|
targetX,
|
|
4280
4315
|
targetY,
|
|
4281
4316
|
primaryEl.width,
|
|
@@ -4311,8 +4346,17 @@ function processDragMove(e, drag, editorScale, snapToGrid, snapToShape, gridSpac
|
|
|
4311
4346
|
domEl.style.top = `${start.y + appliedDy}px`;
|
|
4312
4347
|
}
|
|
4313
4348
|
}
|
|
4349
|
+
if (live) {
|
|
4350
|
+
for (const id of Object.keys(drag.startPositionsById)) {
|
|
4351
|
+
const start = drag.startPositionsById[id];
|
|
4352
|
+
chunkUTTXH3GH_js.publishLiveGeometry(live.patcher, live.slideId, id, {
|
|
4353
|
+
x: start.x + appliedDx,
|
|
4354
|
+
y: start.y + appliedDy
|
|
4355
|
+
});
|
|
4356
|
+
}
|
|
4357
|
+
}
|
|
4314
4358
|
}
|
|
4315
|
-
function processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx) {
|
|
4359
|
+
function processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx, live) {
|
|
4316
4360
|
const dx = (e.clientX - rs.startClientX) / editorScale;
|
|
4317
4361
|
const dy = (e.clientY - rs.startClientY) / editorScale;
|
|
4318
4362
|
if (!rs.moved && (Math.abs(dx) > 2 || Math.abs(dy) > 2)) {
|
|
@@ -4339,8 +4383,16 @@ function processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx) {
|
|
|
4339
4383
|
if (rs.domEl) {
|
|
4340
4384
|
rs.domEl.style.left = `${geo.x}px`;
|
|
4341
4385
|
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,
|
|
4386
|
+
rs.domEl.style.width = `${Math.max(geo.width, chunkRNZJKGA7_js.MIN_ELEMENT_SIZE)}px`;
|
|
4387
|
+
rs.domEl.style.height = `${Math.max(geo.height, chunkRNZJKGA7_js.MIN_ELEMENT_SIZE)}px`;
|
|
4388
|
+
}
|
|
4389
|
+
if (live) {
|
|
4390
|
+
chunkUTTXH3GH_js.publishLiveGeometry(live.patcher, live.slideId, rs.elementId, {
|
|
4391
|
+
x: geo.x,
|
|
4392
|
+
y: geo.y,
|
|
4393
|
+
width: Math.max(geo.width, chunkRNZJKGA7_js.MIN_ELEMENT_SIZE),
|
|
4394
|
+
height: Math.max(geo.height, chunkRNZJKGA7_js.MIN_ELEMENT_SIZE)
|
|
4395
|
+
});
|
|
4344
4396
|
}
|
|
4345
4397
|
}
|
|
4346
4398
|
function processAdjustmentMove(e, adj, editorScale, updateElementById) {
|
|
@@ -4375,7 +4427,8 @@ function processPointerUp(input) {
|
|
|
4375
4427
|
clearSelection,
|
|
4376
4428
|
updateSlides,
|
|
4377
4429
|
updateElementById,
|
|
4378
|
-
markDirty
|
|
4430
|
+
markDirty,
|
|
4431
|
+
livePatcher
|
|
4379
4432
|
} = input;
|
|
4380
4433
|
const marquee = marqueeStateRef.current;
|
|
4381
4434
|
const drag = dragStateRef.current;
|
|
@@ -4418,18 +4471,21 @@ function processPointerUp(input) {
|
|
|
4418
4471
|
if (i !== activeSlideIndex) {
|
|
4419
4472
|
return s;
|
|
4420
4473
|
}
|
|
4421
|
-
const rerouted =
|
|
4474
|
+
const rerouted = chunkUTTXH3GH_js.rerouteConnectorsForMovedElements(s.elements, movedIds);
|
|
4422
4475
|
if (rerouted.length === 0) {
|
|
4423
4476
|
return s;
|
|
4424
4477
|
}
|
|
4425
4478
|
return {
|
|
4426
4479
|
...s,
|
|
4427
|
-
elements:
|
|
4480
|
+
elements: chunkUTTXH3GH_js.applyReroutedConnectors(s.elements, rerouted)
|
|
4428
4481
|
};
|
|
4429
4482
|
})
|
|
4430
4483
|
);
|
|
4431
4484
|
}
|
|
4432
4485
|
const wasMoved = drag?.moved || rs?.moved || adj?.moved;
|
|
4486
|
+
if (wasMoved) {
|
|
4487
|
+
livePatcher?.flush();
|
|
4488
|
+
}
|
|
4433
4489
|
marqueeStateRef.current = null;
|
|
4434
4490
|
dragStateRef.current = null;
|
|
4435
4491
|
resizeStateRef.current = null;
|
|
@@ -4443,9 +4499,9 @@ function processPointerUp(input) {
|
|
|
4443
4499
|
}
|
|
4444
4500
|
function commitMarquee(marquee, editTemplateMode, templateElements, activeSlide, applySelection, clearSelection) {
|
|
4445
4501
|
const sourceElements = editTemplateMode ? templateElements : activeSlide?.elements ?? [];
|
|
4446
|
-
const hitIds =
|
|
4502
|
+
const hitIds = chunkUTTXH3GH_js.computeMarqueeHitIds(marquee, sourceElements);
|
|
4447
4503
|
if (marquee.additive) {
|
|
4448
|
-
const merged =
|
|
4504
|
+
const merged = chunkUTTXH3GH_js.mergeAdditiveSelection(marquee.baseSelectionIds, hitIds);
|
|
4449
4505
|
if (merged.length > 0) {
|
|
4450
4506
|
applySelection(merged[0], merged);
|
|
4451
4507
|
} else {
|
|
@@ -4468,8 +4524,8 @@ function commitDrag(drag, editTemplateMode, activeSlide, activeSlideIndex, setTe
|
|
|
4468
4524
|
}
|
|
4469
4525
|
return { ...el, x: start.x + dx, y: start.y + dy };
|
|
4470
4526
|
});
|
|
4471
|
-
const rerouted =
|
|
4472
|
-
return
|
|
4527
|
+
const rerouted = chunkUTTXH3GH_js.rerouteConnectorsForMovedElements(movedElements, movedIds);
|
|
4528
|
+
return chunkUTTXH3GH_js.applyReroutedConnectors(movedElements, rerouted);
|
|
4473
4529
|
};
|
|
4474
4530
|
if (editTemplateMode) {
|
|
4475
4531
|
const slideId = activeSlide?.id;
|
|
@@ -4514,7 +4570,8 @@ function usePointerHandlers(input) {
|
|
|
4514
4570
|
clearSelection,
|
|
4515
4571
|
updateSlides,
|
|
4516
4572
|
updateElementById,
|
|
4517
|
-
markDirty
|
|
4573
|
+
markDirty,
|
|
4574
|
+
livePatcher
|
|
4518
4575
|
} = input;
|
|
4519
4576
|
react.useEffect(() => {
|
|
4520
4577
|
const tracker = {
|
|
@@ -4578,6 +4635,7 @@ function usePointerHandlers(input) {
|
|
|
4578
4635
|
updateSlides,
|
|
4579
4636
|
updateElementById,
|
|
4580
4637
|
markDirty,
|
|
4638
|
+
livePatcher,
|
|
4581
4639
|
input
|
|
4582
4640
|
]);
|
|
4583
4641
|
}
|
|
@@ -4622,7 +4680,7 @@ function useCanvasInteractions(input) {
|
|
|
4622
4680
|
const el = elementLookup.get(editId);
|
|
4623
4681
|
if (el && chunkCLNGAVNH_js.hasTextProperties(el)) {
|
|
4624
4682
|
const committedText = transformCommittedText ? transformCommittedText(inlineEditingText) : inlineEditingText;
|
|
4625
|
-
const newSegments =
|
|
4683
|
+
const newSegments = chunkUTTXH3GH_js.remapTextToSegments(committedText, el.textSegments, el.textStyle);
|
|
4626
4684
|
ops.updateElementById(editId, {
|
|
4627
4685
|
text: committedText,
|
|
4628
4686
|
textSegments: newSegments
|
|
@@ -4871,7 +4929,7 @@ function createFileHandlers(deps) {
|
|
|
4871
4929
|
h = Math.round(h * scale);
|
|
4872
4930
|
}
|
|
4873
4931
|
addElement({
|
|
4874
|
-
id:
|
|
4932
|
+
id: chunkUTTXH3GH_js.generateElementId(),
|
|
4875
4933
|
type: "image",
|
|
4876
4934
|
x: Math.round((canvasSize.width - w) / 2),
|
|
4877
4935
|
y: Math.round((canvasSize.height - h) / 2),
|
|
@@ -4882,7 +4940,7 @@ function createFileHandlers(deps) {
|
|
|
4882
4940
|
};
|
|
4883
4941
|
img.onerror = () => {
|
|
4884
4942
|
addElement({
|
|
4885
|
-
id:
|
|
4943
|
+
id: chunkUTTXH3GH_js.generateElementId(),
|
|
4886
4944
|
type: "image",
|
|
4887
4945
|
x: 100,
|
|
4888
4946
|
y: 100,
|
|
@@ -4908,7 +4966,7 @@ function createFileHandlers(deps) {
|
|
|
4908
4966
|
const elFilePath = file.path;
|
|
4909
4967
|
const insertMediaElement = (mediaSourceUrl, width, height) => {
|
|
4910
4968
|
addElement({
|
|
4911
|
-
id:
|
|
4969
|
+
id: chunkUTTXH3GH_js.generateElementId(),
|
|
4912
4970
|
type: "media",
|
|
4913
4971
|
mediaType,
|
|
4914
4972
|
mediaMimeType: file.type || void 0,
|
|
@@ -5083,13 +5141,13 @@ function createStructuredElementHandlers(deps) {
|
|
|
5083
5141
|
return;
|
|
5084
5142
|
}
|
|
5085
5143
|
addElement({
|
|
5086
|
-
id:
|
|
5144
|
+
id: chunkUTTXH3GH_js.generateElementId(),
|
|
5087
5145
|
type: "smartArt",
|
|
5088
5146
|
x: 100,
|
|
5089
5147
|
y: 120,
|
|
5090
5148
|
width: 600,
|
|
5091
5149
|
height: 340,
|
|
5092
|
-
smartArtData:
|
|
5150
|
+
smartArtData: chunkUTTXH3GH_js.buildSmartArtPresetData(
|
|
5093
5151
|
layout,
|
|
5094
5152
|
defaultItems,
|
|
5095
5153
|
(i) => `node-${Date.now()}-${i}-${Math.random().toString(36).slice(2, 8)}`
|
|
@@ -5101,7 +5159,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5101
5159
|
return;
|
|
5102
5160
|
}
|
|
5103
5161
|
addElement({
|
|
5104
|
-
id:
|
|
5162
|
+
id: chunkUTTXH3GH_js.generateElementId(),
|
|
5105
5163
|
type: "shape",
|
|
5106
5164
|
x: 120,
|
|
5107
5165
|
y: 200,
|
|
@@ -5160,7 +5218,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5160
5218
|
const displayText = value || fieldTexts[fieldType] || fieldType;
|
|
5161
5219
|
const fieldGuid = `{${crypto.randomUUID().toUpperCase()}}`;
|
|
5162
5220
|
addElement({
|
|
5163
|
-
id:
|
|
5221
|
+
id: chunkUTTXH3GH_js.generateElementId(),
|
|
5164
5222
|
type: "shape",
|
|
5165
5223
|
x: 120,
|
|
5166
5224
|
y: 200,
|
|
@@ -5182,7 +5240,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5182
5240
|
if (!activeSlide) {
|
|
5183
5241
|
return;
|
|
5184
5242
|
}
|
|
5185
|
-
const preset =
|
|
5243
|
+
const preset = chunkUTTXH3GH_js.ACTION_BUTTON_PRESETS.find((p) => p.shapeType === shapeType);
|
|
5186
5244
|
if (!preset) {
|
|
5187
5245
|
return;
|
|
5188
5246
|
}
|
|
@@ -5195,7 +5253,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5195
5253
|
defaultPptxAction.highlightClick = true;
|
|
5196
5254
|
}
|
|
5197
5255
|
addElement({
|
|
5198
|
-
id:
|
|
5256
|
+
id: chunkUTTXH3GH_js.generateElementId(),
|
|
5199
5257
|
type: "shape",
|
|
5200
5258
|
x: 150,
|
|
5201
5259
|
y: 150,
|
|
@@ -5262,14 +5320,14 @@ function useInsertElements(input) {
|
|
|
5262
5320
|
return;
|
|
5263
5321
|
}
|
|
5264
5322
|
addElement({
|
|
5265
|
-
id:
|
|
5323
|
+
id: chunkUTTXH3GH_js.generateElementId(),
|
|
5266
5324
|
type: "text",
|
|
5267
5325
|
x: 100,
|
|
5268
5326
|
y: 100,
|
|
5269
5327
|
width: 300,
|
|
5270
5328
|
height: 60,
|
|
5271
5329
|
text: "",
|
|
5272
|
-
textStyle: { fontSize:
|
|
5330
|
+
textStyle: { fontSize: chunkRNZJKGA7_js.DEFAULT_TEXT_FONT_SIZE }
|
|
5273
5331
|
});
|
|
5274
5332
|
};
|
|
5275
5333
|
const handleAddShape = () => {
|
|
@@ -5277,7 +5335,7 @@ function useInsertElements(input) {
|
|
|
5277
5335
|
return;
|
|
5278
5336
|
}
|
|
5279
5337
|
addElement({
|
|
5280
|
-
id:
|
|
5338
|
+
id: chunkUTTXH3GH_js.generateElementId(),
|
|
5281
5339
|
type: "shape",
|
|
5282
5340
|
x: 150,
|
|
5283
5341
|
y: 150,
|
|
@@ -5296,15 +5354,15 @@ function useInsertElements(input) {
|
|
|
5296
5354
|
return;
|
|
5297
5355
|
}
|
|
5298
5356
|
addElement({
|
|
5299
|
-
...
|
|
5300
|
-
id:
|
|
5357
|
+
...chunkUTTXH3GH_js.newTableElement(chunkRNZJKGA7_js.DEFAULT_TABLE_ROWS, chunkRNZJKGA7_js.DEFAULT_TABLE_COLUMNS, 100, 200),
|
|
5358
|
+
id: chunkUTTXH3GH_js.generateElementId()
|
|
5301
5359
|
});
|
|
5302
5360
|
};
|
|
5303
5361
|
const handleAddChart = (chartType) => {
|
|
5304
5362
|
if (!activeSlide) {
|
|
5305
5363
|
return;
|
|
5306
5364
|
}
|
|
5307
|
-
addElement(
|
|
5365
|
+
addElement(chunkUTTXH3GH_js.createDefaultChartElement(chartType));
|
|
5308
5366
|
};
|
|
5309
5367
|
const structured = createStructuredElementHandlers({
|
|
5310
5368
|
activeSlide,
|
|
@@ -5374,7 +5432,7 @@ function useClipboardHandlers(input) {
|
|
|
5374
5432
|
if (!selectedElement) {
|
|
5375
5433
|
return;
|
|
5376
5434
|
}
|
|
5377
|
-
setClipboardPayload(
|
|
5435
|
+
setClipboardPayload(chunkUTTXH3GH_js.buildElementClipboardPayload(selectedElement, editTemplateMode));
|
|
5378
5436
|
};
|
|
5379
5437
|
const handleDelete = () => {
|
|
5380
5438
|
const idsToDelete = effectiveSelectedIds;
|
|
@@ -5391,7 +5449,7 @@ function useClipboardHandlers(input) {
|
|
|
5391
5449
|
handleDelete();
|
|
5392
5450
|
};
|
|
5393
5451
|
const insertClone = (source) => {
|
|
5394
|
-
const clone =
|
|
5452
|
+
const clone = chunkUTTXH3GH_js.cloneElementForPaste(source, { intoTemplate: editTemplateMode });
|
|
5395
5453
|
ops.updateActiveElements((els) => [...els, clone]);
|
|
5396
5454
|
ops.applySelection(clone.id);
|
|
5397
5455
|
history.markDirty();
|
|
@@ -5601,7 +5659,7 @@ function useMergeShapesHandler(input) {
|
|
|
5601
5659
|
bounds.height
|
|
5602
5660
|
);
|
|
5603
5661
|
const newEl = {
|
|
5604
|
-
id:
|
|
5662
|
+
id: chunkUTTXH3GH_js.generateElementId(),
|
|
5605
5663
|
type: "shape",
|
|
5606
5664
|
x: bounds.x,
|
|
5607
5665
|
y: bounds.y,
|
|
@@ -5660,7 +5718,7 @@ function useMergeShapesHandler(input) {
|
|
|
5660
5718
|
);
|
|
5661
5719
|
const primary = targets[0];
|
|
5662
5720
|
const newEl = {
|
|
5663
|
-
id:
|
|
5721
|
+
id: chunkUTTXH3GH_js.generateElementId(),
|
|
5664
5722
|
type: "shape",
|
|
5665
5723
|
x: bounds.x,
|
|
5666
5724
|
y: bounds.y,
|
|
@@ -5723,7 +5781,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
5723
5781
|
if (ids.length < 2 || !activeSlide) {
|
|
5724
5782
|
return;
|
|
5725
5783
|
}
|
|
5726
|
-
const { elements, groupId } =
|
|
5784
|
+
const { elements, groupId } = chunkUTTXH3GH_js.groupElements(ops.activeElements, ids, chunkUTTXH3GH_js.generateElementId());
|
|
5727
5785
|
if (groupId === null) {
|
|
5728
5786
|
return;
|
|
5729
5787
|
}
|
|
@@ -5736,12 +5794,12 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
5736
5794
|
return;
|
|
5737
5795
|
}
|
|
5738
5796
|
const group = selectedElement;
|
|
5739
|
-
const intoTemplate =
|
|
5797
|
+
const intoTemplate = chunkUTTXH3GH_js.isTemplateElementId(group.id);
|
|
5740
5798
|
const ungrouped = group.children.map((child) => ({
|
|
5741
5799
|
...structuredClone(child),
|
|
5742
5800
|
// Keep child ids in the same store as the group so later edits route
|
|
5743
5801
|
// correctly: template groups yield template-prefixed child ids.
|
|
5744
|
-
id: intoTemplate ?
|
|
5802
|
+
id: intoTemplate ? chunkUTTXH3GH_js.makeCloneId(true, child.id || group.id) : child.id || chunkUTTXH3GH_js.generateElementId(),
|
|
5745
5803
|
x: child.x + group.x,
|
|
5746
5804
|
y: child.y + group.y
|
|
5747
5805
|
}));
|
|
@@ -5765,7 +5823,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
5765
5823
|
if (!edge) {
|
|
5766
5824
|
return;
|
|
5767
5825
|
}
|
|
5768
|
-
const positions =
|
|
5826
|
+
const positions = chunkUTTXH3GH_js.alignElements(selectedElements, edge);
|
|
5769
5827
|
for (const [id, pos] of positions) {
|
|
5770
5828
|
const el = elementLookup.get(id);
|
|
5771
5829
|
if (!el) {
|
|
@@ -5783,7 +5841,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
5783
5841
|
if (!distAxis) {
|
|
5784
5842
|
return;
|
|
5785
5843
|
}
|
|
5786
|
-
const positions =
|
|
5844
|
+
const positions = chunkUTTXH3GH_js.distributeElements(selectedElements, distAxis);
|
|
5787
5845
|
for (const [id, pos] of positions) {
|
|
5788
5846
|
const el = elementLookup.get(id);
|
|
5789
5847
|
if (!el) {
|
|
@@ -5800,7 +5858,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
5800
5858
|
}
|
|
5801
5859
|
const id = selectedElement.id;
|
|
5802
5860
|
ops.updateActiveElements(
|
|
5803
|
-
(els) => direction === "forward" ?
|
|
5861
|
+
(els) => direction === "forward" ? chunkUTTXH3GH_js.bringForward(els, id) : direction === "backward" ? chunkUTTXH3GH_js.sendBackward(els, id) : els
|
|
5804
5862
|
);
|
|
5805
5863
|
history.markDirty();
|
|
5806
5864
|
};
|
|
@@ -5810,7 +5868,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
5810
5868
|
}
|
|
5811
5869
|
const id = selectedElement.id;
|
|
5812
5870
|
ops.updateActiveElements(
|
|
5813
|
-
(els) => direction === "front" ?
|
|
5871
|
+
(els) => direction === "front" ? chunkUTTXH3GH_js.bringToFront(els, id) : chunkUTTXH3GH_js.sendToBack(els, id)
|
|
5814
5872
|
);
|
|
5815
5873
|
history.markDirty();
|
|
5816
5874
|
};
|
|
@@ -5932,7 +5990,7 @@ function insertSlideFromLayoutUpdater(slides, activeIndex, draft) {
|
|
|
5932
5990
|
function useSlideManagement(input) {
|
|
5933
5991
|
const { slides, activeSlideIndex, setActiveSlideIndex, ops, history, handlerRef } = input;
|
|
5934
5992
|
const handleAddSlide = () => {
|
|
5935
|
-
const newSlide =
|
|
5993
|
+
const newSlide = chunkUTTXH3GH_js.createBlankSlide(slides.length + 1);
|
|
5936
5994
|
ops.updateSlides((prev) => {
|
|
5937
5995
|
const next = [...prev];
|
|
5938
5996
|
next.splice(activeSlideIndex + 1, 0, newSlide);
|
|
@@ -5995,7 +6053,7 @@ function useSlideManagement(input) {
|
|
|
5995
6053
|
}
|
|
5996
6054
|
const clone = {
|
|
5997
6055
|
...src,
|
|
5998
|
-
id:
|
|
6056
|
+
id: chunkUTTXH3GH_js.makeSlideId(),
|
|
5999
6057
|
elements: src.elements.map((el) => ({
|
|
6000
6058
|
...el,
|
|
6001
6059
|
id: `${el.id}-dup-${Math.random().toString(36).slice(2, 6)}`
|
|
@@ -6027,7 +6085,7 @@ function useSlideManagement(input) {
|
|
|
6027
6085
|
const handleInsertSlideFromLayout = (layoutPath, layoutName) => {
|
|
6028
6086
|
const insertAt = activeSlideIndex + 1;
|
|
6029
6087
|
const draft = {
|
|
6030
|
-
...
|
|
6088
|
+
...chunkUTTXH3GH_js.createBlankSlide(slides.length + 1),
|
|
6031
6089
|
layoutPath,
|
|
6032
6090
|
...layoutName ? { layoutName } : {}
|
|
6033
6091
|
};
|
|
@@ -6088,7 +6146,7 @@ function createTableMergeHandlers(input) {
|
|
|
6088
6146
|
if (!nextCell || nextCell.hMerge || nextCell.vMerge) {
|
|
6089
6147
|
return;
|
|
6090
6148
|
}
|
|
6091
|
-
const newTableData =
|
|
6149
|
+
const newTableData = chunkUTTXH3GH_js.mergeCells(
|
|
6092
6150
|
[
|
|
6093
6151
|
{ row: rowIndex, col: columnIndex },
|
|
6094
6152
|
{ row: rowIndex, col: nextColIdx }
|
|
@@ -6122,7 +6180,7 @@ function createTableMergeHandlers(input) {
|
|
|
6122
6180
|
if (!targetNextCell || targetNextCell.hMerge || targetNextCell.vMerge) {
|
|
6123
6181
|
return;
|
|
6124
6182
|
}
|
|
6125
|
-
const newTableData =
|
|
6183
|
+
const newTableData = chunkUTTXH3GH_js.mergeCells(
|
|
6126
6184
|
[
|
|
6127
6185
|
{ row: rowIndex, col: columnIndex },
|
|
6128
6186
|
{ row: targetNextRowIdx, col: columnIndex }
|
|
@@ -6145,7 +6203,7 @@ function createTableMergeHandlers(input) {
|
|
|
6145
6203
|
return;
|
|
6146
6204
|
}
|
|
6147
6205
|
const td = selectedElement.tableData;
|
|
6148
|
-
const newTableData =
|
|
6206
|
+
const newTableData = chunkUTTXH3GH_js.mergeCells(ts.selectedCells, td);
|
|
6149
6207
|
const updates = { tableData: newTableData };
|
|
6150
6208
|
const newRawXml = chunkCLNGAVNH_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6151
6209
|
if (newRawXml) {
|
|
@@ -6164,7 +6222,7 @@ function createTableMergeHandlers(input) {
|
|
|
6164
6222
|
}
|
|
6165
6223
|
const { rowIndex, columnIndex } = ts;
|
|
6166
6224
|
const td = selectedElement.tableData;
|
|
6167
|
-
const newTableData =
|
|
6225
|
+
const newTableData = chunkUTTXH3GH_js.splitCell(rowIndex, columnIndex, td);
|
|
6168
6226
|
const updates = { tableData: newTableData };
|
|
6169
6227
|
const newRawXml = chunkCLNGAVNH_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6170
6228
|
if (newRawXml) {
|
|
@@ -6298,7 +6356,7 @@ function createTableStructHandlers(input) {
|
|
|
6298
6356
|
return;
|
|
6299
6357
|
}
|
|
6300
6358
|
const rowIdx = ts?.rowIndex ?? 0;
|
|
6301
|
-
const newTableData =
|
|
6359
|
+
const newTableData = chunkUTTXH3GH_js.insertTableRow(selectedElement.tableData, rowIdx, position);
|
|
6302
6360
|
const updates = { tableData: newTableData };
|
|
6303
6361
|
const newRawXml = chunkCLNGAVNH_js.rebuildTableStructureInRawXml(selectedElement, newTableData);
|
|
6304
6362
|
if (newRawXml) {
|
|
@@ -6313,7 +6371,7 @@ function createTableStructHandlers(input) {
|
|
|
6313
6371
|
}
|
|
6314
6372
|
const td = selectedElement.tableData;
|
|
6315
6373
|
const rowIdx = ts?.rowIndex ?? 0;
|
|
6316
|
-
const newTableData =
|
|
6374
|
+
const newTableData = chunkUTTXH3GH_js.deleteTableRow(td, rowIdx);
|
|
6317
6375
|
if (newTableData === td) {
|
|
6318
6376
|
return;
|
|
6319
6377
|
}
|
|
@@ -6330,7 +6388,7 @@ function createTableStructHandlers(input) {
|
|
|
6330
6388
|
return;
|
|
6331
6389
|
}
|
|
6332
6390
|
const colIdx = ts?.columnIndex ?? 0;
|
|
6333
|
-
const newTableData =
|
|
6391
|
+
const newTableData = chunkUTTXH3GH_js.insertTableColumn(selectedElement.tableData, colIdx, position);
|
|
6334
6392
|
const updates = { tableData: newTableData };
|
|
6335
6393
|
const newRawXml = chunkCLNGAVNH_js.rebuildTableStructureInRawXml(selectedElement, newTableData);
|
|
6336
6394
|
if (newRawXml) {
|
|
@@ -6345,7 +6403,7 @@ function createTableStructHandlers(input) {
|
|
|
6345
6403
|
}
|
|
6346
6404
|
const td = selectedElement.tableData;
|
|
6347
6405
|
const colIdx = ts?.columnIndex ?? 0;
|
|
6348
|
-
const newTableData =
|
|
6406
|
+
const newTableData = chunkUTTXH3GH_js.deleteTableColumn(td, colIdx);
|
|
6349
6407
|
if (newTableData === td) {
|
|
6350
6408
|
return;
|
|
6351
6409
|
}
|
|
@@ -6386,8 +6444,8 @@ async function renderToCanvas(element, options = {}) {
|
|
|
6386
6444
|
return html2canvasPro(element, {
|
|
6387
6445
|
...options,
|
|
6388
6446
|
onclone: async (doc, clonedEl) => {
|
|
6389
|
-
await
|
|
6390
|
-
|
|
6447
|
+
await chunkUTTXH3GH_js.normalizeColorsForCapture(doc, clonedEl);
|
|
6448
|
+
chunkUTTXH3GH_js.preprocessCssForCapture(clonedEl);
|
|
6391
6449
|
if (typeof userOnClone === "function") {
|
|
6392
6450
|
userOnClone(doc, clonedEl);
|
|
6393
6451
|
}
|
|
@@ -6443,7 +6501,7 @@ async function exportSlideToPngBlob(slideElement, options = {}) {
|
|
|
6443
6501
|
}
|
|
6444
6502
|
async function exportSlideAsPng(slideElement, slideIndex, options = {}) {
|
|
6445
6503
|
const blob = await exportSlideToPngBlob(slideElement, options);
|
|
6446
|
-
|
|
6504
|
+
chunkUTTXH3GH_js.downloadBlob(blob, `slide-${slideIndex + 1}.png`);
|
|
6447
6505
|
}
|
|
6448
6506
|
async function copySlideToClipboard(slideElement, options = {}) {
|
|
6449
6507
|
const blob = await exportSlideToPngBlob(slideElement, options);
|
|
@@ -6465,15 +6523,15 @@ async function exportAllSlidesAsPdf(slideStageRef, totalSlides, setActiveSlide,
|
|
|
6465
6523
|
continue;
|
|
6466
6524
|
}
|
|
6467
6525
|
const canvas = await renderElementToCanvas(stageEl, scale);
|
|
6468
|
-
images.push(
|
|
6526
|
+
images.push(chunkUTTXH3GH_js.canvasToJpegData(canvas));
|
|
6469
6527
|
}
|
|
6470
6528
|
onProgress?.(totalSlides, totalSlides);
|
|
6471
6529
|
setActiveSlide(currentSlideIndex);
|
|
6472
6530
|
if (images.length === 0) {
|
|
6473
|
-
throw new Error(
|
|
6531
|
+
throw new Error(chunkYIFO3WQO_js.translationsEn["pptx.export.errorNoSlidesPdf"]);
|
|
6474
6532
|
}
|
|
6475
|
-
const pdfBlobUrl =
|
|
6476
|
-
|
|
6533
|
+
const pdfBlobUrl = chunkRNZJKGA7_js.buildPdfFromImageData(images);
|
|
6534
|
+
chunkUTTXH3GH_js.downloadDataUrl(pdfBlobUrl, filename);
|
|
6477
6535
|
}
|
|
6478
6536
|
async function captureAllSlidesAsPngDataUrls(slideStageRef, totalSlides, setActiveSlide, currentSlideIndex, options = {}) {
|
|
6479
6537
|
const { scale = 2, onProgress } = options;
|
|
@@ -6519,10 +6577,10 @@ async function exportAllSlidesAsNotesPdf(slideStageRef, totalSlides, setActiveSl
|
|
|
6519
6577
|
onProgress?.(totalSlides, totalSlides);
|
|
6520
6578
|
setActiveSlide(currentSlideIndex);
|
|
6521
6579
|
if (pages.length === 0) {
|
|
6522
|
-
throw new Error(
|
|
6580
|
+
throw new Error(chunkYIFO3WQO_js.translationsEn["pptx.export.errorNoSlidesNotesPdf"]);
|
|
6523
6581
|
}
|
|
6524
|
-
const pdfDataUrl =
|
|
6525
|
-
|
|
6582
|
+
const pdfDataUrl = chunkRNZJKGA7_js.buildNotesPdf(pages);
|
|
6583
|
+
chunkUTTXH3GH_js.downloadDataUrl(pdfDataUrl, filename);
|
|
6526
6584
|
}
|
|
6527
6585
|
|
|
6528
6586
|
// src/viewer/utils/export-video.ts
|
|
@@ -6553,7 +6611,7 @@ async function exportAllSlidesAsVideo(slideStageRef, totalSlides, setActiveSlide
|
|
|
6553
6611
|
}
|
|
6554
6612
|
setActiveSlide(currentSlideIndex);
|
|
6555
6613
|
if (slideCanvases.length === 0) {
|
|
6556
|
-
throw new Error(
|
|
6614
|
+
throw new Error(chunkYIFO3WQO_js.translationsEn["pptx.export.errorNoSlidesVideo"]);
|
|
6557
6615
|
}
|
|
6558
6616
|
const firstCanvas = slideCanvases[0];
|
|
6559
6617
|
const recordingCanvas = document.createElement("canvas");
|
|
@@ -6561,12 +6619,12 @@ async function exportAllSlidesAsVideo(slideStageRef, totalSlides, setActiveSlide
|
|
|
6561
6619
|
recordingCanvas.height = firstCanvas.height;
|
|
6562
6620
|
const ctx = recordingCanvas.getContext("2d");
|
|
6563
6621
|
if (!ctx) {
|
|
6564
|
-
throw new Error(
|
|
6622
|
+
throw new Error(chunkYIFO3WQO_js.translationsEn["pptx.export.errorNo2dContext"]);
|
|
6565
6623
|
}
|
|
6566
6624
|
const fps = 30;
|
|
6567
6625
|
const stream = recordingCanvas.captureStream(fps);
|
|
6568
6626
|
const recorder = new MediaRecorder(stream, {
|
|
6569
|
-
mimeType:
|
|
6627
|
+
mimeType: chunkUTTXH3GH_js.pickSupportedMimeType([...chunkUTTXH3GH_js.WEBM_MIME_CANDIDATES]),
|
|
6570
6628
|
videoBitsPerSecond: 5e6
|
|
6571
6629
|
});
|
|
6572
6630
|
const chunks = [];
|
|
@@ -6589,8 +6647,8 @@ async function exportAllSlidesAsVideo(slideStageRef, totalSlides, setActiveSlide
|
|
|
6589
6647
|
const duration = slideTimingsMs?.[i] ?? slideDurationMs;
|
|
6590
6648
|
ctx.clearRect(0, 0, recordingCanvas.width, recordingCanvas.height);
|
|
6591
6649
|
ctx.drawImage(slideCanvases[i], 0, 0);
|
|
6592
|
-
const frameInterval =
|
|
6593
|
-
const framesNeeded =
|
|
6650
|
+
const frameInterval = chunkUTTXH3GH_js.fpsToFrameIntervalMs(fps);
|
|
6651
|
+
const framesNeeded = chunkUTTXH3GH_js.segmentFrameCount(duration, fps);
|
|
6594
6652
|
for (let f = 0; f < framesNeeded; f++) {
|
|
6595
6653
|
if (signal?.aborted) {
|
|
6596
6654
|
recorder.stop();
|
|
@@ -6637,9 +6695,9 @@ async function exportAllSlidesAsGif(slideStageRef, totalSlides, setActiveSlide,
|
|
|
6637
6695
|
}
|
|
6638
6696
|
setActiveSlide(currentSlideIndex);
|
|
6639
6697
|
if (frames.length === 0) {
|
|
6640
|
-
throw new Error(
|
|
6698
|
+
throw new Error(chunkYIFO3WQO_js.translationsEn["pptx.export.errorNoSlidesGif"]);
|
|
6641
6699
|
}
|
|
6642
|
-
const gifBytes =
|
|
6700
|
+
const gifBytes = chunkUTTXH3GH_js.encodeGif(frames, Math.round(slideDurationMs / 10));
|
|
6643
6701
|
onProgress?.(totalSlides, totalSlides);
|
|
6644
6702
|
const buf = new ArrayBuffer(gifBytes.length);
|
|
6645
6703
|
new Uint8Array(buf).set(gifBytes);
|
|
@@ -6753,7 +6811,7 @@ function useExportSaveAs(input) {
|
|
|
6753
6811
|
}
|
|
6754
6812
|
setExportProgress(70);
|
|
6755
6813
|
setExportStatusMessage("Writing README...");
|
|
6756
|
-
const readme =
|
|
6814
|
+
const readme = chunkUTTXH3GH_js.generatePackageReadme(pptxFilename);
|
|
6757
6815
|
pkgFolder.file("README.txt", readme);
|
|
6758
6816
|
if (abortCtrl.signal.aborted) {
|
|
6759
6817
|
throw new DOMException("Export cancelled", "AbortError");
|
|
@@ -6764,7 +6822,7 @@ function useExportSaveAs(input) {
|
|
|
6764
6822
|
setExportProgress(95);
|
|
6765
6823
|
setExportStatusMessage("Downloading...");
|
|
6766
6824
|
const baseName = pptxFilename.replace(/\.[^.]+$/u, "");
|
|
6767
|
-
|
|
6825
|
+
chunkUTTXH3GH_js.downloadBlob(zipBlob, `${baseName}-package.zip`);
|
|
6768
6826
|
setExportProgress(100);
|
|
6769
6827
|
} catch (err) {
|
|
6770
6828
|
if (err.name !== "AbortError") {
|
|
@@ -6787,7 +6845,7 @@ function useExportSaveAs(input) {
|
|
|
6787
6845
|
const blob = new Blob([data], {
|
|
6788
6846
|
type: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
6789
6847
|
});
|
|
6790
|
-
|
|
6848
|
+
chunkUTTXH3GH_js.downloadBlob(blob, `${baseName}.${ext}`);
|
|
6791
6849
|
} catch (err) {
|
|
6792
6850
|
console.error(`[PowerPointViewer] Save as .${ext} failed:`, err);
|
|
6793
6851
|
}
|
|
@@ -6807,7 +6865,7 @@ function useExportSaveAs(input) {
|
|
|
6807
6865
|
guides: pptxGuides.length > 0 ? pptxGuides : void 0
|
|
6808
6866
|
};
|
|
6809
6867
|
});
|
|
6810
|
-
const slidesToSave =
|
|
6868
|
+
const slidesToSave = chunkRNZJKGA7_js.buildSaveSlides(slidesWithGuides, templateElementsBySlideId);
|
|
6811
6869
|
const saveOptions = {
|
|
6812
6870
|
headerFooter,
|
|
6813
6871
|
presentationProperties,
|
|
@@ -6864,7 +6922,7 @@ function safeConfirm(message) {
|
|
|
6864
6922
|
}
|
|
6865
6923
|
}
|
|
6866
6924
|
function downloadBlob2(blob, filename) {
|
|
6867
|
-
|
|
6925
|
+
chunkUTTXH3GH_js.downloadBlob(blob, chunkUTTXH3GH_js.sanitizeDownloadFilename(filename));
|
|
6868
6926
|
}
|
|
6869
6927
|
|
|
6870
6928
|
// src/viewer/hooks/useExportHandlers.ts
|
|
@@ -6965,21 +7023,21 @@ function useExportHandlers(input) {
|
|
|
6965
7023
|
{
|
|
6966
7024
|
scale: 2,
|
|
6967
7025
|
onProgress: (current, total) => {
|
|
6968
|
-
setExportProgress(
|
|
6969
|
-
setExportStatusMessage(
|
|
7026
|
+
setExportProgress(chunkUTTXH3GH_js.slideProgressPercent(current, total));
|
|
7027
|
+
setExportStatusMessage(chunkUTTXH3GH_js.slideStatusLabel("Rendering", current, total));
|
|
6970
7028
|
},
|
|
6971
7029
|
signal: abortCtrl.signal
|
|
6972
7030
|
}
|
|
6973
7031
|
);
|
|
6974
|
-
setExportProgress(
|
|
7032
|
+
setExportProgress(chunkUTTXH3GH_js.EXPORT_ASSEMBLING_PERCENT);
|
|
6975
7033
|
setExportStatusMessage("Building PDF...");
|
|
6976
7034
|
await new Promise((r) => {
|
|
6977
7035
|
setTimeout(r, 100);
|
|
6978
7036
|
});
|
|
6979
|
-
setExportProgress(
|
|
7037
|
+
setExportProgress(chunkUTTXH3GH_js.EXPORT_DONE_PERCENT);
|
|
6980
7038
|
setExportStatusMessage("Done!");
|
|
6981
7039
|
} catch (err) {
|
|
6982
|
-
if (!
|
|
7040
|
+
if (!chunkUTTXH3GH_js.isExportAbortError(err)) {
|
|
6983
7041
|
console.error("[PowerPointViewer] PDF export failed:", err);
|
|
6984
7042
|
}
|
|
6985
7043
|
} finally {
|
|
@@ -7009,21 +7067,21 @@ function useExportHandlers(input) {
|
|
|
7009
7067
|
{
|
|
7010
7068
|
scale: 2,
|
|
7011
7069
|
onProgress: (current, total) => {
|
|
7012
|
-
setExportProgress(
|
|
7013
|
-
setExportStatusMessage(
|
|
7070
|
+
setExportProgress(chunkUTTXH3GH_js.slideProgressPercent(current, total));
|
|
7071
|
+
setExportStatusMessage(chunkUTTXH3GH_js.slideStatusLabel("Rendering", current, total));
|
|
7014
7072
|
},
|
|
7015
7073
|
signal: abortCtrl.signal
|
|
7016
7074
|
}
|
|
7017
7075
|
);
|
|
7018
|
-
setExportProgress(
|
|
7076
|
+
setExportProgress(chunkUTTXH3GH_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7019
7077
|
setExportStatusMessage("Building PDF...");
|
|
7020
7078
|
await new Promise((r) => {
|
|
7021
7079
|
setTimeout(r, 100);
|
|
7022
7080
|
});
|
|
7023
|
-
setExportProgress(
|
|
7081
|
+
setExportProgress(chunkUTTXH3GH_js.EXPORT_DONE_PERCENT);
|
|
7024
7082
|
setExportStatusMessage("Done!");
|
|
7025
7083
|
} catch (err) {
|
|
7026
|
-
if (!
|
|
7084
|
+
if (!chunkUTTXH3GH_js.isExportAbortError(err)) {
|
|
7027
7085
|
console.error("[PowerPointViewer] Notes PDF export failed:", err);
|
|
7028
7086
|
}
|
|
7029
7087
|
} finally {
|
|
@@ -7064,22 +7122,22 @@ function useExportHandlers(input) {
|
|
|
7064
7122
|
scale: 1,
|
|
7065
7123
|
slideDurationMs: 3e3,
|
|
7066
7124
|
onProgress: (current, total) => {
|
|
7067
|
-
setExportProgress(
|
|
7068
|
-
setExportStatusMessage(
|
|
7125
|
+
setExportProgress(chunkUTTXH3GH_js.slideProgressPercent(current, total, 45));
|
|
7126
|
+
setExportStatusMessage(chunkUTTXH3GH_js.slideStatusLabel("Capturing", current, total));
|
|
7069
7127
|
},
|
|
7070
7128
|
onRecordProgress: (current, total) => {
|
|
7071
|
-
setExportProgress(
|
|
7072
|
-
setExportStatusMessage(
|
|
7129
|
+
setExportProgress(chunkUTTXH3GH_js.recordProgressPercent(current, total));
|
|
7130
|
+
setExportStatusMessage(chunkUTTXH3GH_js.slideStatusLabel("Recording", current, total));
|
|
7073
7131
|
},
|
|
7074
7132
|
signal: abortCtrl.signal
|
|
7075
7133
|
}
|
|
7076
7134
|
);
|
|
7077
|
-
setExportProgress(
|
|
7135
|
+
setExportProgress(chunkUTTXH3GH_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7078
7136
|
setExportStatusMessage("Saving file...");
|
|
7079
7137
|
downloadBlob2(blob, "presentation.webm");
|
|
7080
|
-
setExportProgress(
|
|
7138
|
+
setExportProgress(chunkUTTXH3GH_js.EXPORT_DONE_PERCENT);
|
|
7081
7139
|
} catch (err) {
|
|
7082
|
-
if (!
|
|
7140
|
+
if (!chunkUTTXH3GH_js.isExportAbortError(err)) {
|
|
7083
7141
|
console.error("[PowerPointViewer] Video export failed:", err);
|
|
7084
7142
|
}
|
|
7085
7143
|
} finally {
|
|
@@ -7107,18 +7165,18 @@ function useExportHandlers(input) {
|
|
|
7107
7165
|
scale: 0.5,
|
|
7108
7166
|
slideDurationMs: 2e3,
|
|
7109
7167
|
onProgress: (current, total) => {
|
|
7110
|
-
setExportProgress(
|
|
7111
|
-
setExportStatusMessage(
|
|
7168
|
+
setExportProgress(chunkUTTXH3GH_js.slideProgressPercent(current, total));
|
|
7169
|
+
setExportStatusMessage(chunkUTTXH3GH_js.slideStatusLabel("Encoding", current, total));
|
|
7112
7170
|
},
|
|
7113
7171
|
signal: abortCtrl.signal
|
|
7114
7172
|
}
|
|
7115
7173
|
);
|
|
7116
|
-
setExportProgress(
|
|
7174
|
+
setExportProgress(chunkUTTXH3GH_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7117
7175
|
setExportStatusMessage("Saving file...");
|
|
7118
7176
|
downloadBlob2(blob, "presentation.gif");
|
|
7119
|
-
setExportProgress(
|
|
7177
|
+
setExportProgress(chunkUTTXH3GH_js.EXPORT_DONE_PERCENT);
|
|
7120
7178
|
} catch (err) {
|
|
7121
|
-
if (!
|
|
7179
|
+
if (!chunkUTTXH3GH_js.isExportAbortError(err)) {
|
|
7122
7180
|
console.error("[PowerPointViewer] GIF export failed:", err);
|
|
7123
7181
|
}
|
|
7124
7182
|
} finally {
|
|
@@ -7158,7 +7216,7 @@ function openPrintWindow(title, bodyHtml, orientation, colorFilter, frameSlides)
|
|
|
7158
7216
|
}
|
|
7159
7217
|
printWindow.document.open();
|
|
7160
7218
|
printWindow.document.write(
|
|
7161
|
-
|
|
7219
|
+
chunkUTTXH3GH_js.buildPrintHtmlDocument({ title, bodyHtml, orientation, colorFilter, frameSlides })
|
|
7162
7220
|
);
|
|
7163
7221
|
printWindow.document.close();
|
|
7164
7222
|
printWindow.focus();
|
|
@@ -7219,7 +7277,7 @@ function usePrintHandlers(input) {
|
|
|
7219
7277
|
if (svgs.length === 0) {
|
|
7220
7278
|
return;
|
|
7221
7279
|
}
|
|
7222
|
-
const printDoc =
|
|
7280
|
+
const printDoc = chunkUTTXH3GH_js.buildPrintDocument(svgs, pptxData.width, pptxData.height, {
|
|
7223
7281
|
title: "Slides (Vector)",
|
|
7224
7282
|
orientation: settings.orientation,
|
|
7225
7283
|
colorFilter
|
|
@@ -7255,7 +7313,7 @@ function usePrintHandlers(input) {
|
|
|
7255
7313
|
if (settings.printWhat === "outline") {
|
|
7256
7314
|
openPrintWindow(
|
|
7257
7315
|
"Outline",
|
|
7258
|
-
`<div class="outline-page">${
|
|
7316
|
+
`<div class="outline-page">${chunkUTTXH3GH_js.buildOutlineHtml(slideIndices, slides)}</div>`,
|
|
7259
7317
|
settings.orientation,
|
|
7260
7318
|
colorFilter,
|
|
7261
7319
|
settings.frameSlides
|
|
@@ -7280,7 +7338,7 @@ function usePrintHandlers(input) {
|
|
|
7280
7338
|
if (settings.printWhat === "slides") {
|
|
7281
7339
|
openPrintWindow(
|
|
7282
7340
|
"Slides",
|
|
7283
|
-
|
|
7341
|
+
chunkUTTXH3GH_js.buildSlidesHtml(slideImages, slideIndices),
|
|
7284
7342
|
settings.orientation,
|
|
7285
7343
|
colorFilter,
|
|
7286
7344
|
settings.frameSlides
|
|
@@ -7290,7 +7348,7 @@ function usePrintHandlers(input) {
|
|
|
7290
7348
|
if (settings.printWhat === "notes") {
|
|
7291
7349
|
openPrintWindow(
|
|
7292
7350
|
"Notes Pages",
|
|
7293
|
-
|
|
7351
|
+
chunkUTTXH3GH_js.buildNotesHtml(slideImages, slideIndices, slides),
|
|
7294
7352
|
"portrait",
|
|
7295
7353
|
colorFilter,
|
|
7296
7354
|
settings.frameSlides
|
|
@@ -7301,7 +7359,7 @@ function usePrintHandlers(input) {
|
|
|
7301
7359
|
const spp = settings.slidesPerPage;
|
|
7302
7360
|
openPrintWindow(
|
|
7303
7361
|
`Handout ${spp} per page`,
|
|
7304
|
-
|
|
7362
|
+
chunkUTTXH3GH_js.buildHandoutsHtml(slideImages, slideIndices, spp),
|
|
7305
7363
|
"portrait",
|
|
7306
7364
|
colorFilter,
|
|
7307
7365
|
settings.frameSlides
|
|
@@ -7590,7 +7648,7 @@ function usePropertyHandlers(input) {
|
|
|
7590
7648
|
width: canvasSize.width,
|
|
7591
7649
|
height: canvasSize.height
|
|
7592
7650
|
};
|
|
7593
|
-
setCompareResult(
|
|
7651
|
+
setCompareResult(chunkUTTXH3GH_js.comparePresentation(cur, other));
|
|
7594
7652
|
setIsComparePanelOpen(true);
|
|
7595
7653
|
} catch (err) {
|
|
7596
7654
|
console.warn("Compare failed:", err);
|
|
@@ -7607,7 +7665,7 @@ function usePropertyHandlers(input) {
|
|
|
7607
7665
|
if (!diff || diff.status === "unchanged") {
|
|
7608
7666
|
return;
|
|
7609
7667
|
}
|
|
7610
|
-
setSlides((prev) =>
|
|
7668
|
+
setSlides((prev) => chunkUTTXH3GH_js.applyAcceptSlide(prev, diff));
|
|
7611
7669
|
setIsDirty(true);
|
|
7612
7670
|
},
|
|
7613
7671
|
[compareResult, setSlides, setIsDirty]
|
|
@@ -7618,10 +7676,10 @@ function usePropertyHandlers(input) {
|
|
|
7618
7676
|
if (!compareResult) {
|
|
7619
7677
|
return;
|
|
7620
7678
|
}
|
|
7621
|
-
setSlides((prev) =>
|
|
7679
|
+
setSlides((prev) => chunkUTTXH3GH_js.applyAcceptAllSlides(prev, compareResult));
|
|
7622
7680
|
setIsDirty(true);
|
|
7623
7681
|
}, [compareResult, setSlides, setIsDirty]);
|
|
7624
|
-
const usedFontFamilies = react.useMemo(() =>
|
|
7682
|
+
const usedFontFamilies = react.useMemo(() => chunkUTTXH3GH_js.collectUsedFonts(slides), [slides]);
|
|
7625
7683
|
return {
|
|
7626
7684
|
handleUpdateNotes,
|
|
7627
7685
|
handleUpdateSlide,
|
|
@@ -7740,7 +7798,7 @@ function useIsMobile(input) {
|
|
|
7740
7798
|
const containerRef = input?.containerRef;
|
|
7741
7799
|
const isTouchDevice = react.useSyncExternalStore(
|
|
7742
7800
|
subscribeTouchCapability,
|
|
7743
|
-
|
|
7801
|
+
chunkUTTXH3GH_js.detectTouchDevice,
|
|
7744
7802
|
() => false
|
|
7745
7803
|
// server snapshot
|
|
7746
7804
|
);
|
|
@@ -7756,7 +7814,7 @@ function useIsMobile(input) {
|
|
|
7756
7814
|
}
|
|
7757
7815
|
return containerRef?.current?.clientHeight ?? window.innerHeight;
|
|
7758
7816
|
});
|
|
7759
|
-
const [orientation, setOrientation] = react.useState(
|
|
7817
|
+
const [orientation, setOrientation] = react.useState(chunkUTTXH3GH_js.detectOrientation);
|
|
7760
7818
|
const [isVirtualKeyboardOpen, setIsVirtualKeyboardOpen] = react.useState(false);
|
|
7761
7819
|
const [initialViewportHeight] = react.useState(
|
|
7762
7820
|
() => typeof window !== "undefined" ? window.innerHeight : 800
|
|
@@ -7800,7 +7858,7 @@ function useIsMobile(input) {
|
|
|
7800
7858
|
return;
|
|
7801
7859
|
}
|
|
7802
7860
|
const handleOrientationChange = () => {
|
|
7803
|
-
setOrientation(
|
|
7861
|
+
setOrientation(chunkUTTXH3GH_js.detectOrientation());
|
|
7804
7862
|
};
|
|
7805
7863
|
if (screen.orientation) {
|
|
7806
7864
|
screen.orientation.addEventListener("change", handleOrientationChange);
|
|
@@ -7830,9 +7888,9 @@ function useIsMobile(input) {
|
|
|
7830
7888
|
window.addEventListener("resize", handleResize);
|
|
7831
7889
|
return () => window.removeEventListener("resize", handleResize);
|
|
7832
7890
|
}, [isTouchDevice, initialViewportHeight]);
|
|
7833
|
-
const isMobile =
|
|
7834
|
-
const isTablet = !isMobile && containerWidth >=
|
|
7835
|
-
const isDesktop = !isMobile && containerWidth >=
|
|
7891
|
+
const isMobile = chunkUTTXH3GH_js.isMobileViewport(containerWidth, containerHeight, isTouchDevice);
|
|
7892
|
+
const isTablet = !isMobile && containerWidth >= chunkUTTXH3GH_js.MOBILE_BREAKPOINT && containerWidth < chunkUTTXH3GH_js.TABLET_BREAKPOINT;
|
|
7893
|
+
const isDesktop = !isMobile && containerWidth >= chunkUTTXH3GH_js.TABLET_BREAKPOINT;
|
|
7836
7894
|
return {
|
|
7837
7895
|
isMobile,
|
|
7838
7896
|
isTablet,
|
|
@@ -7893,11 +7951,11 @@ function useViewerDialogs(input) {
|
|
|
7893
7951
|
);
|
|
7894
7952
|
const [embedFontsEnabled, setEmbedFontsEnabled] = react.useState(false);
|
|
7895
7953
|
const [isNarrowViewport, setIsNarrowViewport] = react.useState(
|
|
7896
|
-
() => typeof window !== "undefined" ?
|
|
7954
|
+
() => typeof window !== "undefined" ? chunkUTTXH3GH_js.isMobileViewport(window.innerWidth, window.innerHeight, viewportIsTouch()) : false
|
|
7897
7955
|
);
|
|
7898
7956
|
react.useEffect(() => {
|
|
7899
7957
|
const handleWindow = () => setIsNarrowViewport(
|
|
7900
|
-
|
|
7958
|
+
chunkUTTXH3GH_js.isMobileViewport(window.innerWidth, window.innerHeight, viewportIsTouch())
|
|
7901
7959
|
);
|
|
7902
7960
|
let observer = null;
|
|
7903
7961
|
let raf = 0;
|
|
@@ -7911,12 +7969,12 @@ function useViewerDialogs(input) {
|
|
|
7911
7969
|
const entry = entries[0];
|
|
7912
7970
|
if (entry) {
|
|
7913
7971
|
setIsNarrowViewport(
|
|
7914
|
-
|
|
7972
|
+
chunkUTTXH3GH_js.isMobileViewport(entry.contentRect.width, entry.contentRect.height, viewportIsTouch())
|
|
7915
7973
|
);
|
|
7916
7974
|
}
|
|
7917
7975
|
});
|
|
7918
7976
|
observer.observe(el);
|
|
7919
|
-
setIsNarrowViewport(
|
|
7977
|
+
setIsNarrowViewport(chunkUTTXH3GH_js.isMobileViewport(el.clientWidth, el.clientHeight, viewportIsTouch()));
|
|
7920
7978
|
};
|
|
7921
7979
|
attach();
|
|
7922
7980
|
window.addEventListener("resize", handleWindow);
|
|
@@ -8074,12 +8132,12 @@ function useViewerDialogs(input) {
|
|
|
8074
8132
|
}
|
|
8075
8133
|
function computeGridSpacingPx(presentationGridSpacing) {
|
|
8076
8134
|
if (presentationGridSpacing) {
|
|
8077
|
-
const px = Math.round(presentationGridSpacing.cx /
|
|
8135
|
+
const px = Math.round(presentationGridSpacing.cx / chunkRNZJKGA7_js.EMU_PER_PX);
|
|
8078
8136
|
if (px > 0) {
|
|
8079
8137
|
return px;
|
|
8080
8138
|
}
|
|
8081
8139
|
}
|
|
8082
|
-
return
|
|
8140
|
+
return chunkRNZJKGA7_js.GRID_SIZE;
|
|
8083
8141
|
}
|
|
8084
8142
|
function computeVisibleSlideIndexes(slides, activeCustomShowId, customShows) {
|
|
8085
8143
|
if (activeCustomShowId) {
|
|
@@ -8093,8 +8151,8 @@ function computeVisibleSlideIndexes(slides, activeCustomShowId, customShows) {
|
|
|
8093
8151
|
return slides.map((_, i) => i).filter((i) => !slides[i]?.hidden);
|
|
8094
8152
|
}
|
|
8095
8153
|
function computeSlideSectionGroups(slides, sections) {
|
|
8096
|
-
return
|
|
8097
|
-
id: group.section?.id ?? (sections.length > 0 ?
|
|
8154
|
+
return chunkUTTXH3GH_js.groupSlidesBySection(sections, slides).map((group) => ({
|
|
8155
|
+
id: group.section?.id ?? (sections.length > 0 ? chunkRNZJKGA7_js.UNGROUPED_SECTION_ID : "default"),
|
|
8098
8156
|
label: group.section?.name ?? (sections.length > 0 ? "Ungrouped Slides" : "Slides"),
|
|
8099
8157
|
slideIndexes: group.slideIndexes,
|
|
8100
8158
|
...group.section?.color !== void 0 ? { color: group.section.color } : {},
|
|
@@ -8149,7 +8207,7 @@ function useDerivedSlideState(input) {
|
|
|
8149
8207
|
);
|
|
8150
8208
|
const slideSectionGroups = react.useMemo(
|
|
8151
8209
|
() => computeSlideSectionGroups(slides, sections).map((group) => {
|
|
8152
|
-
if (group.id ===
|
|
8210
|
+
if (group.id === chunkRNZJKGA7_js.UNGROUPED_SECTION_ID && group.label === "Ungrouped Slides") {
|
|
8153
8211
|
return { ...group, label: t("pptx.slides.ungroupedSlides") };
|
|
8154
8212
|
}
|
|
8155
8213
|
if (group.id === "default" && group.label === "Slides") {
|
|
@@ -8255,7 +8313,7 @@ function useAnnotationHandlers(input) {
|
|
|
8255
8313
|
if (nextMode === "present") {
|
|
8256
8314
|
presentation.enterPresentMode();
|
|
8257
8315
|
} else if (mode === "present" && annotations.hasAnyAnnotations) {
|
|
8258
|
-
|
|
8316
|
+
chunkRNZJKGA7_js.stopAllPersistentAudio();
|
|
8259
8317
|
pendingModeAfterAnnotationsRef.current = nextMode;
|
|
8260
8318
|
if (promptKeepInkAnnotations) {
|
|
8261
8319
|
setShowKeepAnnotationsDialog(true);
|
|
@@ -8264,7 +8322,7 @@ function useAnnotationHandlers(input) {
|
|
|
8264
8322
|
}
|
|
8265
8323
|
} else {
|
|
8266
8324
|
if (mode === "present") {
|
|
8267
|
-
|
|
8325
|
+
chunkRNZJKGA7_js.stopAllPersistentAudio();
|
|
8268
8326
|
}
|
|
8269
8327
|
setMode(nextMode);
|
|
8270
8328
|
}
|
|
@@ -8336,7 +8394,7 @@ function useSerialize(input) {
|
|
|
8336
8394
|
return {
|
|
8337
8395
|
...el,
|
|
8338
8396
|
text: pendingEditText,
|
|
8339
|
-
textSegments:
|
|
8397
|
+
textSegments: chunkUTTXH3GH_js.remapTextToSegments(pendingEditText, el.textSegments, el.textStyle)
|
|
8340
8398
|
};
|
|
8341
8399
|
});
|
|
8342
8400
|
if (updatedElements.some((el, i) => el !== slide.elements[i])) {
|
|
@@ -8356,7 +8414,7 @@ function useSerialize(input) {
|
|
|
8356
8414
|
guides: pptxGuides.length > 0 ? pptxGuides : void 0
|
|
8357
8415
|
};
|
|
8358
8416
|
});
|
|
8359
|
-
const slidesToSave =
|
|
8417
|
+
const slidesToSave = chunkRNZJKGA7_js.buildSaveSlides(slidesWithGuides, templateElementsBySlideId);
|
|
8360
8418
|
const saveOptions = {
|
|
8361
8419
|
headerFooter,
|
|
8362
8420
|
presentationProperties,
|
|
@@ -8530,7 +8588,7 @@ function usePresentationSetup(input) {
|
|
|
8530
8588
|
setShowKeepAnnotationsDialog(true);
|
|
8531
8589
|
} else {
|
|
8532
8590
|
if (mode === "present" && nextMode !== "present") {
|
|
8533
|
-
|
|
8591
|
+
chunkRNZJKGA7_js.stopAllPersistentAudio();
|
|
8534
8592
|
stopAnimationSound();
|
|
8535
8593
|
}
|
|
8536
8594
|
setMode(nextMode);
|
|
@@ -8578,15 +8636,16 @@ function usePresentationSetup(input) {
|
|
|
8578
8636
|
}
|
|
8579
8637
|
})();
|
|
8580
8638
|
},
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8639
|
+
// PowerPoint's Ctrl+A "arrow" is the plain pointer, i.e. no active tool.
|
|
8640
|
+
onSetPointerTool: (tool) => annotations.setPresentationTool(tool === "arrow" ? "none" : tool),
|
|
8641
|
+
onEraseAnnotations: () => annotations.clearAnnotations(),
|
|
8642
|
+
onToggleInkMarkup: () => annotations.setInkMarkupVisible(!annotations.inkMarkupVisible),
|
|
8584
8643
|
onToggleToolbar: () => annotations.setToolbarVisible(!annotations.toolbarVisible),
|
|
8585
8644
|
onSaveRehearsalTimings: (timings) => {
|
|
8586
|
-
setSlides((prev) =>
|
|
8645
|
+
setSlides((prev) => chunkUTTXH3GH_js.applyRehearsalTimings(prev, timings));
|
|
8587
8646
|
history.markDirty();
|
|
8588
8647
|
},
|
|
8589
|
-
loopContinuously:
|
|
8648
|
+
loopContinuously: chunkUTTXH3GH_js.shouldLoopContinuously(presentationProperties),
|
|
8590
8649
|
showWithAnimation: presentationProperties.showWithAnimation,
|
|
8591
8650
|
useTimings: presentationProperties.advanceMode !== "manual",
|
|
8592
8651
|
endWithBlackSlide
|
|
@@ -8748,7 +8807,7 @@ function useEditorOperations(input) {
|
|
|
8748
8807
|
const { formatPainterActive, setFormatPainterActive, elementLookup } = state;
|
|
8749
8808
|
react.useEffect(() => {
|
|
8750
8809
|
if (formatPainterActive && !prevFormatPainterRef.current && selectedElement) {
|
|
8751
|
-
copiedFormatRef.current =
|
|
8810
|
+
copiedFormatRef.current = chunkUTTXH3GH_js.copyFormatFromElement(selectedElement);
|
|
8752
8811
|
} else if (!formatPainterActive) {
|
|
8753
8812
|
copiedFormatRef.current = null;
|
|
8754
8813
|
}
|
|
@@ -8774,7 +8833,7 @@ function useEditorOperations(input) {
|
|
|
8774
8833
|
e.stopPropagation();
|
|
8775
8834
|
const element = elementLookup.get(elementId);
|
|
8776
8835
|
if (element) {
|
|
8777
|
-
const updated =
|
|
8836
|
+
const updated = chunkUTTXH3GH_js.applyFormatToElement(element, copiedFormatRef.current);
|
|
8778
8837
|
const updates = {};
|
|
8779
8838
|
if (chunkCLNGAVNH_js.hasShapeProperties(updated)) {
|
|
8780
8839
|
updates.shapeStyle = updated.shapeStyle;
|
|
@@ -9397,7 +9456,8 @@ function useViewerIntegration(input) {
|
|
|
9397
9456
|
clearSelection: editorOps.ops.clearSelection,
|
|
9398
9457
|
updateSlides: editorOps.ops.updateSlides,
|
|
9399
9458
|
updateElementById: editorOps.ops.updateElementById,
|
|
9400
|
-
markDirty: history.markDirty
|
|
9459
|
+
markDirty: history.markDirty,
|
|
9460
|
+
livePatcher: state.livePatcher
|
|
9401
9461
|
});
|
|
9402
9462
|
const [isEncryptedDialogOpen, setIsEncryptedDialogOpen] = react.useState(false);
|
|
9403
9463
|
const [loadVersion, setLoadVersion] = react.useState(0);
|
|
@@ -9494,7 +9554,7 @@ function useViewerIntegration(input) {
|
|
|
9494
9554
|
return zoom.scale;
|
|
9495
9555
|
},
|
|
9496
9556
|
setZoom(level) {
|
|
9497
|
-
zoom.setScale(Math.min(Math.max(level,
|
|
9557
|
+
zoom.setScale(Math.min(Math.max(level, chunkRNZJKGA7_js.MIN_ZOOM_SCALE), chunkRNZJKGA7_js.MAX_ZOOM_SCALE));
|
|
9498
9558
|
},
|
|
9499
9559
|
zoomIn() {
|
|
9500
9560
|
zoom.handleZoomIn();
|
|
@@ -9709,7 +9769,7 @@ function useReducedMotion() {
|
|
|
9709
9769
|
}
|
|
9710
9770
|
function useViewerOptions() {
|
|
9711
9771
|
const storeRef = react.useRef(null);
|
|
9712
|
-
storeRef.current ??=
|
|
9772
|
+
storeRef.current ??= chunkUTTXH3GH_js.createViewerOptionsStore();
|
|
9713
9773
|
const store = storeRef.current;
|
|
9714
9774
|
const options = react.useSyncExternalStore(
|
|
9715
9775
|
(onStoreChange) => store.subscribe(onStoreChange),
|
|
@@ -9718,9 +9778,9 @@ function useViewerOptions() {
|
|
|
9718
9778
|
);
|
|
9719
9779
|
return { optionsStore: store, options };
|
|
9720
9780
|
}
|
|
9721
|
-
var KNOWN_TAB_IDS = new Set(
|
|
9781
|
+
var KNOWN_TAB_IDS = new Set(chunkUTTXH3GH_js.TOOLBAR_TABS.map((tab) => tab.id));
|
|
9722
9782
|
function computeToolbarVisibility(hiddenActions) {
|
|
9723
|
-
const isHidden = (id) =>
|
|
9783
|
+
const isHidden = (id) => chunkUTTXH3GH_js.isActionHidden(id, hiddenActions);
|
|
9724
9784
|
const isTabVisible = (id) => !KNOWN_TAB_IDS.has(id) || !isHidden(id);
|
|
9725
9785
|
return { isHidden, isTabVisible };
|
|
9726
9786
|
}
|
|
@@ -9808,10 +9868,10 @@ function useYjsDocumentSync({
|
|
|
9808
9868
|
const { PptxHandler: PptxHandler2 } = await import('./dist-4LUVI3SW.js');
|
|
9809
9869
|
const handler = new PptxHandler2();
|
|
9810
9870
|
await handler.load(sourceBytes.buffer);
|
|
9811
|
-
const currentSlides =
|
|
9871
|
+
const currentSlides = chunkUTTXH3GH_js.readSlidesFromYDoc(
|
|
9812
9872
|
doc
|
|
9813
9873
|
);
|
|
9814
|
-
const slidesToSave =
|
|
9874
|
+
const slidesToSave = chunkRNZJKGA7_js.buildSaveSlides(currentSlides, templateElementsBySlideId);
|
|
9815
9875
|
const bytes = await handler.save(slidesToSave);
|
|
9816
9876
|
config.onWriteBack(bytes);
|
|
9817
9877
|
} catch {
|
|
@@ -9826,7 +9886,7 @@ function useYjsDocumentSync({
|
|
|
9826
9886
|
if (!doc || !isConnected) {
|
|
9827
9887
|
return;
|
|
9828
9888
|
}
|
|
9829
|
-
const docSlides =
|
|
9889
|
+
const docSlides = chunkUTTXH3GH_js.readSlidesFromYDoc(
|
|
9830
9890
|
doc
|
|
9831
9891
|
);
|
|
9832
9892
|
if (docSlides.length === 0) {
|
|
@@ -9848,11 +9908,11 @@ function useYjsDocumentSync({
|
|
|
9848
9908
|
lastSyncedRef.current = serialized;
|
|
9849
9909
|
void (async () => {
|
|
9850
9910
|
const factories = await getFactories();
|
|
9851
|
-
|
|
9911
|
+
chunkUTTXH3GH_js.reconcileSlidesInYDoc(
|
|
9852
9912
|
slides,
|
|
9853
9913
|
doc,
|
|
9854
9914
|
factories,
|
|
9855
|
-
|
|
9915
|
+
chunkUTTXH3GH_js.LOCAL_SYNC_ORIGIN
|
|
9856
9916
|
);
|
|
9857
9917
|
scheduleWriteBack();
|
|
9858
9918
|
})();
|
|
@@ -9866,10 +9926,10 @@ function useYjsDocumentSync({
|
|
|
9866
9926
|
return;
|
|
9867
9927
|
}
|
|
9868
9928
|
const handleChange = (_events, transaction) => {
|
|
9869
|
-
if (transaction?.origin ===
|
|
9929
|
+
if (transaction?.origin === chunkUTTXH3GH_js.LOCAL_SYNC_ORIGIN) {
|
|
9870
9930
|
return;
|
|
9871
9931
|
}
|
|
9872
|
-
const remoteSlides =
|
|
9932
|
+
const remoteSlides = chunkUTTXH3GH_js.readSlidesFromYDoc(
|
|
9873
9933
|
doc
|
|
9874
9934
|
);
|
|
9875
9935
|
if (remoteSlides.length === 0) {
|
|
@@ -9885,7 +9945,7 @@ function useYjsDocumentSync({
|
|
|
9885
9945
|
isApplyingRemoteRef.current = false;
|
|
9886
9946
|
scheduleWriteBack();
|
|
9887
9947
|
};
|
|
9888
|
-
const unobserve =
|
|
9948
|
+
const unobserve = chunkUTTXH3GH_js.observeYDocSlides(
|
|
9889
9949
|
doc,
|
|
9890
9950
|
handleChange
|
|
9891
9951
|
);
|
|
@@ -9923,7 +9983,7 @@ function useBroadcastFollower({
|
|
|
9923
9983
|
if (!broadcaster) {
|
|
9924
9984
|
return;
|
|
9925
9985
|
}
|
|
9926
|
-
if (!
|
|
9986
|
+
if (!chunkUTTXH3GH_js.shouldAutoFollowBroadcaster({
|
|
9927
9987
|
localRole: collab.config.role,
|
|
9928
9988
|
broadcasterRole: broadcaster.role
|
|
9929
9989
|
})) {
|
|
@@ -9982,6 +10042,36 @@ function useFollowMode({
|
|
|
9982
10042
|
}, [activeSlideIndex, followedClientId]);
|
|
9983
10043
|
return { followedClientId, followUser };
|
|
9984
10044
|
}
|
|
10045
|
+
function useCollaborationLivePatch({
|
|
10046
|
+
patcher,
|
|
10047
|
+
doc,
|
|
10048
|
+
isConnected,
|
|
10049
|
+
isSynced = true
|
|
10050
|
+
}) {
|
|
10051
|
+
react.useEffect(() => {
|
|
10052
|
+
if (!doc || !isConnected || !isSynced) {
|
|
10053
|
+
patcher.configure(null, null);
|
|
10054
|
+
return;
|
|
10055
|
+
}
|
|
10056
|
+
let cancelled = false;
|
|
10057
|
+
void (async () => {
|
|
10058
|
+
const Y = await import('./yjs-HBLSEMHP.js');
|
|
10059
|
+
if (cancelled) {
|
|
10060
|
+
return;
|
|
10061
|
+
}
|
|
10062
|
+
const factories = {
|
|
10063
|
+
createMap: () => new Y.Map(),
|
|
10064
|
+
createArray: () => new Y.Array(),
|
|
10065
|
+
createText: () => new Y.Text()
|
|
10066
|
+
};
|
|
10067
|
+
patcher.configure(doc, factories);
|
|
10068
|
+
})();
|
|
10069
|
+
return () => {
|
|
10070
|
+
cancelled = true;
|
|
10071
|
+
patcher.configure(null, null);
|
|
10072
|
+
};
|
|
10073
|
+
}, [patcher, doc, isConnected, isSynced]);
|
|
10074
|
+
}
|
|
9985
10075
|
function useLayoutSwitching(input) {
|
|
9986
10076
|
const { handler, slides, activeSlideIndex, ops, history } = input;
|
|
9987
10077
|
const [availableLayouts, setAvailableLayouts] = react.useState([]);
|
|
@@ -10053,10 +10143,10 @@ function useTouchGestures(input) {
|
|
|
10053
10143
|
if (!el || !enabled) {
|
|
10054
10144
|
return;
|
|
10055
10145
|
}
|
|
10056
|
-
const recognizer =
|
|
10146
|
+
const recognizer = chunkUTTXH3GH_js.createTouchGestureRecognizer({
|
|
10057
10147
|
getScale: () => scaleRef.current,
|
|
10058
|
-
minScale:
|
|
10059
|
-
maxScale:
|
|
10148
|
+
minScale: chunkRNZJKGA7_js.MIN_ZOOM_SCALE,
|
|
10149
|
+
maxScale: chunkRNZJKGA7_js.MAX_ZOOM_SCALE,
|
|
10060
10150
|
callbacks: {
|
|
10061
10151
|
onPinchZoom: (newScale) => callbacksRef.current.onPinchZoom?.(newScale),
|
|
10062
10152
|
onSwipe: (direction) => callbacksRef.current.onSwipe?.(direction),
|
|
@@ -10096,7 +10186,7 @@ function scrollFocusedIntoView(keyboardInset) {
|
|
|
10096
10186
|
return;
|
|
10097
10187
|
}
|
|
10098
10188
|
const rect = active.getBoundingClientRect();
|
|
10099
|
-
const delta =
|
|
10189
|
+
const delta = chunkUTTXH3GH_js.computeScrollDelta(
|
|
10100
10190
|
{ top: rect.top, bottom: rect.bottom },
|
|
10101
10191
|
window.innerHeight,
|
|
10102
10192
|
keyboardInset
|
|
@@ -10116,8 +10206,8 @@ function useKeyboardInsets(enabled = true) {
|
|
|
10116
10206
|
return;
|
|
10117
10207
|
}
|
|
10118
10208
|
const update = () => {
|
|
10119
|
-
const metrics =
|
|
10120
|
-
const inset = metrics ?
|
|
10209
|
+
const metrics = chunkUTTXH3GH_js.readViewportMetrics(window);
|
|
10210
|
+
const inset = metrics ? chunkUTTXH3GH_js.computeKeyboardInset(metrics) : 0;
|
|
10121
10211
|
setKeyboardInset(inset);
|
|
10122
10212
|
if (inset > 0) {
|
|
10123
10213
|
window.requestAnimationFrame(() => scrollFocusedIntoView(inset));
|
|
@@ -10128,8 +10218,8 @@ function useKeyboardInsets(enabled = true) {
|
|
|
10128
10218
|
vv.addEventListener("scroll", update);
|
|
10129
10219
|
const onFocusIn = () => {
|
|
10130
10220
|
window.requestAnimationFrame(() => {
|
|
10131
|
-
const metrics =
|
|
10132
|
-
const inset = metrics ?
|
|
10221
|
+
const metrics = chunkUTTXH3GH_js.readViewportMetrics(window);
|
|
10222
|
+
const inset = metrics ? chunkUTTXH3GH_js.computeKeyboardInset(metrics) : 0;
|
|
10133
10223
|
if (inset > 0) {
|
|
10134
10224
|
scrollFocusedIntoView(inset);
|
|
10135
10225
|
}
|
|
@@ -10142,7 +10232,7 @@ function useKeyboardInsets(enabled = true) {
|
|
|
10142
10232
|
document.removeEventListener("focusin", onFocusIn);
|
|
10143
10233
|
};
|
|
10144
10234
|
}, [enabled]);
|
|
10145
|
-
return { keyboardInset, isKeyboardOpen:
|
|
10235
|
+
return { keyboardInset, isKeyboardOpen: chunkUTTXH3GH_js.isKeyboardOpen(keyboardInset) };
|
|
10146
10236
|
}
|
|
10147
10237
|
|
|
10148
10238
|
// src/viewer/hooks/useViewerBuildingBlocks-canvas-props.ts
|
|
@@ -10197,13 +10287,13 @@ function buildCanvasProps(input) {
|
|
|
10197
10287
|
if (mode === "present") {
|
|
10198
10288
|
presentation.handlePresentationAction(action);
|
|
10199
10289
|
} else if (action.url) {
|
|
10200
|
-
|
|
10290
|
+
chunkUTTXH3GH_js.safeOpenUrl(action.url);
|
|
10201
10291
|
}
|
|
10202
10292
|
};
|
|
10203
10293
|
const handleHyperlinkClick = (url) => {
|
|
10204
|
-
if (
|
|
10294
|
+
if (chunkUTTXH3GH_js.isPpactionUrl(url)) {
|
|
10205
10295
|
if (mode === "present") {
|
|
10206
|
-
const parsed =
|
|
10296
|
+
const parsed = chunkUTTXH3GH_js.parsePpactionUrl(url);
|
|
10207
10297
|
if (parsed) {
|
|
10208
10298
|
presentation.handlePresentationAction({
|
|
10209
10299
|
action: parsed.action,
|
|
@@ -10213,7 +10303,7 @@ function buildCanvasProps(input) {
|
|
|
10213
10303
|
}
|
|
10214
10304
|
return;
|
|
10215
10305
|
}
|
|
10216
|
-
|
|
10306
|
+
chunkUTTXH3GH_js.safeOpenUrl(url);
|
|
10217
10307
|
};
|
|
10218
10308
|
return {
|
|
10219
10309
|
activeSlide: effectiveSlide,
|
|
@@ -10533,7 +10623,7 @@ function buildToolbarProps(input) {
|
|
|
10533
10623
|
onOpenFile,
|
|
10534
10624
|
onOpenRecentFile,
|
|
10535
10625
|
onCreatePresentation: (templateId) => {
|
|
10536
|
-
s.setSlides(
|
|
10626
|
+
s.setSlides(chunkUTTXH3GH_js.createBackstagePresentation(templateId));
|
|
10537
10627
|
s.setActiveSlideIndex(0);
|
|
10538
10628
|
s.setSelectedElementId(null);
|
|
10539
10629
|
s.setSelectedElementIds([]);
|
|
@@ -10588,7 +10678,7 @@ function buildToolbarProps(input) {
|
|
|
10588
10678
|
isCommentsPanelOpen: s.isInspectorPaneOpen,
|
|
10589
10679
|
slideCommentCount: activeSlide?.comments?.length ?? 0,
|
|
10590
10680
|
formatPainterActive: s.formatPainterActive,
|
|
10591
|
-
canActivateFormatPainter:
|
|
10681
|
+
canActivateFormatPainter: chunkUTTXH3GH_js.hasCopyableFormat(selectedElement),
|
|
10592
10682
|
onToggleFormatPainter: () => s.setFormatPainterActive((p) => !p),
|
|
10593
10683
|
isSelectionPaneOpen: s.isSelectionPaneOpen,
|
|
10594
10684
|
onToggleSelectionPane: () => s.setIsSelectionPaneOpen((p) => !p),
|
|
@@ -10851,7 +10941,7 @@ function useViewerBuildingBlocks(input) {
|
|
|
10851
10941
|
}, [incomingContent]);
|
|
10852
10942
|
const onOpenFile = react.useCallback(() => {
|
|
10853
10943
|
void (async () => {
|
|
10854
|
-
const picked = await
|
|
10944
|
+
const picked = await chunkUTTXH3GH_js.openPptxFile();
|
|
10855
10945
|
if (picked) {
|
|
10856
10946
|
setContent(picked.buffer);
|
|
10857
10947
|
}
|
|
@@ -10859,7 +10949,7 @@ function useViewerBuildingBlocks(input) {
|
|
|
10859
10949
|
}, []);
|
|
10860
10950
|
const onOpenRecentFile = react.useCallback((key) => {
|
|
10861
10951
|
void (async () => {
|
|
10862
|
-
const bytes = await
|
|
10952
|
+
const bytes = await chunkUTTXH3GH_js.readBackstageRecentFile(key);
|
|
10863
10953
|
if (bytes) {
|
|
10864
10954
|
setContent(bytes);
|
|
10865
10955
|
}
|
|
@@ -11046,6 +11136,7 @@ exports.useAutosave = useAutosave;
|
|
|
11046
11136
|
exports.useBroadcastFollower = useBroadcastFollower;
|
|
11047
11137
|
exports.useCanvasInteractions = useCanvasInteractions;
|
|
11048
11138
|
exports.useClipboardHandlers = useClipboardHandlers;
|
|
11139
|
+
exports.useCollaborationLivePatch = useCollaborationLivePatch;
|
|
11049
11140
|
exports.useCollaborativeHistory = useCollaborativeHistory;
|
|
11050
11141
|
exports.useCollaborativeState = useCollaborativeState;
|
|
11051
11142
|
exports.useComments = useComments;
|