pptx-react-viewer 3.8.0 → 3.9.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 +8 -0
- package/dist/{AiChatPanel-XLQM4BQJ.js → AiChatPanel-3A42W7RW.js} +25 -25
- package/dist/AiChatPanel-3A42W7RW.js.br +0 -0
- package/dist/AiChatPanel-3A42W7RW.js.gz +0 -0
- package/dist/{AiChatPanel-A5DCEHTO.mjs → AiChatPanel-II6VOOAL.mjs} +4 -4
- package/dist/AiChatPanel-II6VOOAL.mjs.br +0 -0
- package/dist/AiChatPanel-II6VOOAL.mjs.gz +0 -0
- package/dist/{Area3DChartScene-5CMEMIBI.mjs → Area3DChartScene-JM3CQ3WQ.mjs} +21 -4
- package/dist/Area3DChartScene-JM3CQ3WQ.mjs.br +0 -0
- package/dist/Area3DChartScene-JM3CQ3WQ.mjs.gz +0 -0
- package/dist/{Area3DChartScene-RZ3V3WOR.js → Area3DChartScene-XJK4ZA4R.js} +21 -4
- package/dist/Area3DChartScene-XJK4ZA4R.js.br +0 -0
- package/dist/Area3DChartScene-XJK4ZA4R.js.gz +0 -0
- package/dist/{Bar3DChartScene-KHCQ6TEC.js → Bar3DChartScene-RGRZY5P6.js} +21 -4
- package/dist/Bar3DChartScene-RGRZY5P6.js.br +0 -0
- package/dist/Bar3DChartScene-RGRZY5P6.js.gz +0 -0
- package/dist/{Bar3DChartScene-H3MYUJKV.mjs → Bar3DChartScene-VNFWI2QG.mjs} +21 -4
- package/dist/Bar3DChartScene-VNFWI2QG.mjs.br +0 -0
- package/dist/Bar3DChartScene-VNFWI2QG.mjs.gz +0 -0
- package/dist/{Line3DChartScene-YFRPJHDX.mjs → Line3DChartScene-GXOWGIFJ.mjs} +21 -4
- package/dist/Line3DChartScene-GXOWGIFJ.mjs.br +0 -0
- package/dist/Line3DChartScene-GXOWGIFJ.mjs.gz +0 -0
- package/dist/{Line3DChartScene-QEACF3U3.js → Line3DChartScene-MEY42DBF.js} +21 -4
- package/dist/Line3DChartScene-MEY42DBF.js.br +0 -0
- package/dist/Line3DChartScene-MEY42DBF.js.gz +0 -0
- package/dist/{Model3DScene-QQWKGJ3T.js → Model3DScene-MWXTGHDM.js} +2 -2
- package/dist/Model3DScene-MWXTGHDM.js.br +0 -0
- package/dist/Model3DScene-MWXTGHDM.js.gz +0 -0
- package/dist/{Model3DScene-O24KP723.mjs → Model3DScene-WJ3MMIZH.mjs} +1 -1
- package/dist/Model3DScene-WJ3MMIZH.mjs.br +0 -0
- package/dist/Model3DScene-WJ3MMIZH.mjs.gz +0 -0
- package/dist/{PieChart3DScene-L3MHKQHW.js → PieChart3DScene-FJJGOQIS.js} +15 -4
- package/dist/PieChart3DScene-FJJGOQIS.js.br +0 -0
- package/dist/PieChart3DScene-FJJGOQIS.js.gz +0 -0
- package/dist/{PieChart3DScene-CI6CW22C.mjs → PieChart3DScene-WXJEDYMK.mjs} +15 -4
- package/dist/PieChart3DScene-WXJEDYMK.mjs.br +0 -0
- package/dist/PieChart3DScene-WXJEDYMK.mjs.gz +0 -0
- package/dist/{SmartArt3DScene-ZO3KFDI2.js → SmartArt3DScene-BK7QN3WT.js} +85 -23
- package/dist/SmartArt3DScene-BK7QN3WT.js.br +0 -0
- package/dist/SmartArt3DScene-BK7QN3WT.js.gz +0 -0
- package/dist/{SmartArt3DScene-XCFVGCXE.mjs → SmartArt3DScene-ODKCGJBO.mjs} +85 -23
- package/dist/SmartArt3DScene-ODKCGJBO.mjs.br +0 -0
- package/dist/SmartArt3DScene-ODKCGJBO.mjs.gz +0 -0
- package/dist/{SurfaceChart3DScene-JUXRC3K2.mjs → SurfaceChart3DScene-IKPE2SVE.mjs} +19 -4
- package/dist/SurfaceChart3DScene-IKPE2SVE.mjs.br +0 -0
- package/dist/SurfaceChart3DScene-IKPE2SVE.mjs.gz +0 -0
- package/dist/{SurfaceChart3DScene-5IER6VFW.js → SurfaceChart3DScene-VDK3F224.js} +19 -4
- package/dist/SurfaceChart3DScene-VDK3F224.js.br +0 -0
- package/dist/SurfaceChart3DScene-VDK3F224.js.gz +0 -0
- package/dist/{chunk-4222CHFH.js → chunk-3NIJ5HIZ.js} +3187 -2514
- package/dist/chunk-3NIJ5HIZ.js.br +0 -0
- package/dist/chunk-3NIJ5HIZ.js.gz +0 -0
- package/dist/{chunk-RNP5HP4L.mjs → chunk-3Y63XPIN.mjs} +1 -1
- package/dist/chunk-3Y63XPIN.mjs.br +0 -0
- package/dist/{chunk-RNP5HP4L.mjs.gz → chunk-3Y63XPIN.mjs.gz} +0 -0
- package/dist/{chunk-DE3S3UHX.js → chunk-5CPGDXD6.js} +518 -442
- package/dist/chunk-5CPGDXD6.js.br +0 -0
- package/dist/chunk-5CPGDXD6.js.gz +0 -0
- package/dist/{chunk-PFPKBNNZ.mjs → chunk-76Z3X6JX.mjs} +1189 -516
- package/dist/chunk-76Z3X6JX.mjs.br +0 -0
- package/dist/chunk-76Z3X6JX.mjs.gz +0 -0
- package/dist/chunk-DNR6CH6I.js +30 -0
- package/dist/chunk-DNR6CH6I.js.br +0 -0
- package/dist/chunk-DNR6CH6I.js.gz +0 -0
- package/dist/{chunk-SN5EUDIT.js → chunk-G3JPCRKN.js} +13644 -7350
- package/dist/chunk-G3JPCRKN.js.br +0 -0
- package/dist/chunk-G3JPCRKN.js.gz +0 -0
- package/dist/{chunk-FRZIBZTE.mjs → chunk-JBSAKP4Z.mjs} +15 -0
- package/dist/chunk-JBSAKP4Z.mjs.br +0 -0
- package/dist/{chunk-FRZIBZTE.mjs.gz → chunk-JBSAKP4Z.mjs.gz} +0 -0
- package/dist/{chunk-F5NPGNMA.js → chunk-K6Q6KLA6.js} +5 -5
- package/dist/chunk-K6Q6KLA6.js.br +0 -0
- package/dist/chunk-K6Q6KLA6.js.gz +0 -0
- package/dist/{chunk-QWA5YEIZ.js → chunk-LBJAVP3H.js} +194 -178
- package/dist/chunk-LBJAVP3H.js.br +0 -0
- package/dist/chunk-LBJAVP3H.js.gz +0 -0
- package/dist/{chunk-RHWQKZLB.mjs → chunk-NTWFXLZX.mjs} +23 -7
- package/dist/chunk-NTWFXLZX.mjs.br +0 -0
- package/dist/chunk-NTWFXLZX.mjs.gz +0 -0
- package/dist/{chunk-UPJW34YG.mjs → chunk-PCCM7NVY.mjs} +85 -9
- package/dist/chunk-PCCM7NVY.mjs.br +0 -0
- package/dist/chunk-PCCM7NVY.mjs.gz +0 -0
- package/dist/chunk-T6GFCLSM.mjs +27 -0
- package/dist/chunk-T6GFCLSM.mjs.br +4 -0
- package/dist/chunk-T6GFCLSM.mjs.gz +0 -0
- package/dist/{chunk-L3ZIBQEB.js → chunk-TEVGDXVW.js} +15 -0
- package/dist/chunk-TEVGDXVW.js.br +0 -0
- package/dist/{chunk-L3ZIBQEB.js.gz → chunk-TEVGDXVW.js.gz} +0 -0
- package/dist/{chunk-6IMB5DNJ.mjs → chunk-VQX7G75Z.mjs} +13621 -7340
- package/dist/chunk-VQX7G75Z.mjs.br +0 -0
- package/dist/chunk-VQX7G75Z.mjs.gz +0 -0
- package/dist/i18n.js +4 -4
- package/dist/i18n.js.br +0 -0
- package/dist/i18n.js.gz +0 -0
- package/dist/i18n.mjs +1 -1
- package/dist/i18n.mjs.br +0 -0
- package/dist/i18n.mjs.gz +0 -0
- package/dist/index.d.ts +388 -80
- package/dist/index.js +47 -47
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.br +0 -0
- package/dist/index.mjs.gz +0 -0
- package/dist/internals.d.ts +445 -81
- 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.d.ts +338 -43
- package/dist/viewer/index.js +27 -27
- package/dist/viewer/index.js.br +0 -0
- package/dist/viewer/index.js.gz +0 -0
- package/dist/viewer/index.mjs +6 -6
- package/dist/viewer/index.mjs.br +0 -0
- package/dist/viewer/index.mjs.gz +0 -0
- package/package.json +2 -2
- package/dist/AiChatPanel-A5DCEHTO.mjs.br +0 -0
- package/dist/AiChatPanel-A5DCEHTO.mjs.gz +0 -0
- package/dist/AiChatPanel-XLQM4BQJ.js.br +0 -0
- package/dist/AiChatPanel-XLQM4BQJ.js.gz +0 -0
- package/dist/Area3DChartScene-5CMEMIBI.mjs.br +0 -0
- package/dist/Area3DChartScene-5CMEMIBI.mjs.gz +0 -0
- package/dist/Area3DChartScene-RZ3V3WOR.js.br +0 -0
- package/dist/Area3DChartScene-RZ3V3WOR.js.gz +0 -0
- package/dist/Bar3DChartScene-H3MYUJKV.mjs.br +0 -0
- package/dist/Bar3DChartScene-H3MYUJKV.mjs.gz +0 -0
- package/dist/Bar3DChartScene-KHCQ6TEC.js.br +0 -0
- package/dist/Bar3DChartScene-KHCQ6TEC.js.gz +0 -0
- package/dist/Line3DChartScene-QEACF3U3.js.br +0 -0
- package/dist/Line3DChartScene-QEACF3U3.js.gz +0 -0
- package/dist/Line3DChartScene-YFRPJHDX.mjs.br +0 -0
- package/dist/Line3DChartScene-YFRPJHDX.mjs.gz +0 -0
- package/dist/Model3DScene-O24KP723.mjs.br +0 -0
- package/dist/Model3DScene-O24KP723.mjs.gz +0 -0
- package/dist/Model3DScene-QQWKGJ3T.js.br +0 -0
- package/dist/Model3DScene-QQWKGJ3T.js.gz +0 -0
- package/dist/PieChart3DScene-CI6CW22C.mjs.br +0 -0
- package/dist/PieChart3DScene-CI6CW22C.mjs.gz +0 -0
- package/dist/PieChart3DScene-L3MHKQHW.js.br +0 -0
- package/dist/PieChart3DScene-L3MHKQHW.js.gz +0 -0
- package/dist/SmartArt3DScene-XCFVGCXE.mjs.br +0 -0
- package/dist/SmartArt3DScene-XCFVGCXE.mjs.gz +0 -0
- package/dist/SmartArt3DScene-ZO3KFDI2.js.br +0 -0
- package/dist/SmartArt3DScene-ZO3KFDI2.js.gz +0 -0
- package/dist/SurfaceChart3DScene-5IER6VFW.js.br +0 -0
- package/dist/SurfaceChart3DScene-5IER6VFW.js.gz +0 -0
- package/dist/SurfaceChart3DScene-JUXRC3K2.mjs.br +0 -0
- package/dist/SurfaceChart3DScene-JUXRC3K2.mjs.gz +0 -0
- package/dist/chunk-4222CHFH.js.br +0 -0
- package/dist/chunk-4222CHFH.js.gz +0 -0
- package/dist/chunk-6IMB5DNJ.mjs.br +0 -0
- package/dist/chunk-6IMB5DNJ.mjs.gz +0 -0
- package/dist/chunk-DE3S3UHX.js.br +0 -0
- package/dist/chunk-DE3S3UHX.js.gz +0 -0
- package/dist/chunk-F5NPGNMA.js.br +0 -0
- package/dist/chunk-F5NPGNMA.js.gz +0 -0
- package/dist/chunk-FRZIBZTE.mjs.br +0 -0
- package/dist/chunk-L3ZIBQEB.js.br +0 -0
- package/dist/chunk-PFPKBNNZ.mjs.br +0 -0
- package/dist/chunk-PFPKBNNZ.mjs.gz +0 -0
- package/dist/chunk-QWA5YEIZ.js.br +0 -0
- package/dist/chunk-QWA5YEIZ.js.gz +0 -0
- package/dist/chunk-RHWQKZLB.mjs.br +0 -0
- package/dist/chunk-RHWQKZLB.mjs.gz +0 -0
- package/dist/chunk-RNP5HP4L.mjs.br +0 -0
- package/dist/chunk-SN5EUDIT.js.br +0 -0
- package/dist/chunk-SN5EUDIT.js.gz +0 -0
- package/dist/chunk-UPJW34YG.mjs.br +0 -0
- package/dist/chunk-UPJW34YG.mjs.gz +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkLBJAVP3H_js = require('./chunk-LBJAVP3H.js');
|
|
4
|
+
var chunkG3JPCRKN_js = require('./chunk-G3JPCRKN.js');
|
|
5
|
+
var chunkTEVGDXVW_js = require('./chunk-TEVGDXVW.js');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var reactI18next = require('react-i18next');
|
|
8
8
|
|
|
9
9
|
function useVirtualizedSlides({
|
|
10
10
|
totalItems,
|
|
11
11
|
itemHeight,
|
|
12
|
-
overscan =
|
|
12
|
+
overscan = chunkG3JPCRKN_js.DEFAULT_VIRTUAL_OVERSCAN
|
|
13
13
|
}) {
|
|
14
14
|
const scrollContainerRef = react.useRef(null);
|
|
15
15
|
const [scrollTop, setScrollTop] = react.useState(0);
|
|
@@ -39,7 +39,7 @@ function useVirtualizedSlides({
|
|
|
39
39
|
resizeObserver?.disconnect();
|
|
40
40
|
};
|
|
41
41
|
}, []);
|
|
42
|
-
const range =
|
|
42
|
+
const range = chunkG3JPCRKN_js.computeVirtualRange(totalItems, itemHeight, scrollTop, viewportHeight, overscan);
|
|
43
43
|
const safeItemHeight = Math.max(itemHeight, 1);
|
|
44
44
|
const scrollToIndex = react.useCallback(
|
|
45
45
|
(index, behavior = "smooth") => {
|
|
@@ -80,7 +80,7 @@ function usePresenceTracking({
|
|
|
80
80
|
}) {
|
|
81
81
|
const [remoteUsers, setRemoteUsers] = react.useState([]);
|
|
82
82
|
const projectorRef = react.useRef(null);
|
|
83
|
-
projectorRef.current ??=
|
|
83
|
+
projectorRef.current ??= chunkG3JPCRKN_js.createPresenceProjector();
|
|
84
84
|
const projector = projectorRef.current;
|
|
85
85
|
const lastBroadcastRef = react.useRef(0);
|
|
86
86
|
const pendingBroadcastRef = react.useRef(null);
|
|
@@ -105,7 +105,7 @@ function usePresenceTracking({
|
|
|
105
105
|
awareness.setLocalStateField("presence", state);
|
|
106
106
|
lastBroadcastRef.current = Date.now();
|
|
107
107
|
};
|
|
108
|
-
if (elapsed >=
|
|
108
|
+
if (elapsed >= chunkG3JPCRKN_js.BROADCAST_THROTTLE_MS) {
|
|
109
109
|
if (pendingBroadcastRef.current) {
|
|
110
110
|
clearTimeout(pendingBroadcastRef.current);
|
|
111
111
|
pendingBroadcastRef.current = null;
|
|
@@ -115,7 +115,7 @@ function usePresenceTracking({
|
|
|
115
115
|
pendingBroadcastRef.current = setTimeout(() => {
|
|
116
116
|
pendingBroadcastRef.current = null;
|
|
117
117
|
flush();
|
|
118
|
-
},
|
|
118
|
+
}, chunkG3JPCRKN_js.BROADCAST_THROTTLE_MS - elapsed);
|
|
119
119
|
}
|
|
120
120
|
},
|
|
121
121
|
[awareness, userName, userColor, userAvatar, role]
|
|
@@ -195,7 +195,7 @@ function useYjsProvider({ config }) {
|
|
|
195
195
|
const departureRef = react.useRef(null);
|
|
196
196
|
const gateRef = react.useRef(null);
|
|
197
197
|
if (!gateRef.current) {
|
|
198
|
-
gateRef.current =
|
|
198
|
+
gateRef.current = chunkG3JPCRKN_js.createSyncGate(() => setSynced(true));
|
|
199
199
|
}
|
|
200
200
|
const teardown = react.useCallback(() => {
|
|
201
201
|
if (timeoutRef.current) {
|
|
@@ -215,7 +215,7 @@ function useYjsProvider({ config }) {
|
|
|
215
215
|
const buildCleanup = react.useCallback(
|
|
216
216
|
(provider, yDoc) => () => {
|
|
217
217
|
announceDeparture();
|
|
218
|
-
|
|
218
|
+
chunkG3JPCRKN_js.clearLocalAwareness(provider.awareness);
|
|
219
219
|
provider.destroy();
|
|
220
220
|
yDoc.destroy();
|
|
221
221
|
setDoc(null);
|
|
@@ -240,9 +240,9 @@ function useYjsProvider({ config }) {
|
|
|
240
240
|
if (config.authToken) {
|
|
241
241
|
opts.password = config.authToken;
|
|
242
242
|
}
|
|
243
|
-
const roomId =
|
|
243
|
+
const roomId = chunkG3JPCRKN_js.validateRoomId(config.roomId);
|
|
244
244
|
const provider = new WebrtcProvider(roomId, yDoc, opts);
|
|
245
|
-
departureRef.current =
|
|
245
|
+
departureRef.current = chunkG3JPCRKN_js.createDepartureChannel(roomId, provider.awareness);
|
|
246
246
|
setDoc(yDoc);
|
|
247
247
|
setAwareness(provider.awareness);
|
|
248
248
|
setClientId(provider.awareness.clientID);
|
|
@@ -284,13 +284,13 @@ function useYjsProvider({ config }) {
|
|
|
284
284
|
if (!config) {
|
|
285
285
|
return;
|
|
286
286
|
}
|
|
287
|
-
const roomId =
|
|
288
|
-
const transport = config.transport ??
|
|
287
|
+
const roomId = chunkG3JPCRKN_js.validateRoomId(config.roomId);
|
|
288
|
+
const transport = config.transport ?? chunkG3JPCRKN_js.resolveTransportForServerUrl(config.serverUrl);
|
|
289
289
|
if (transport === "webrtc") {
|
|
290
290
|
await initWebrtc();
|
|
291
291
|
return;
|
|
292
292
|
}
|
|
293
|
-
if (
|
|
293
|
+
if (chunkG3JPCRKN_js.isMixedContentBlocked(config.serverUrl)) {
|
|
294
294
|
console.warn(
|
|
295
295
|
`[pptx-viewer] Refusing to connect: insecure ws:// server "${config.serverUrl}" is blocked from a secure (https) page. Use a wss:// URL.`
|
|
296
296
|
);
|
|
@@ -304,7 +304,7 @@ function useYjsProvider({ config }) {
|
|
|
304
304
|
const provider = new WebsocketProvider(config.serverUrl, roomId, yDoc, {
|
|
305
305
|
params: config.authToken ? { token: config.authToken } : void 0
|
|
306
306
|
});
|
|
307
|
-
departureRef.current =
|
|
307
|
+
departureRef.current = chunkG3JPCRKN_js.createDepartureChannel(roomId, provider.awareness);
|
|
308
308
|
let connected = false;
|
|
309
309
|
const handleStatus = (event) => {
|
|
310
310
|
if (event.status === "connected") {
|
|
@@ -344,7 +344,7 @@ function useYjsProvider({ config }) {
|
|
|
344
344
|
provider.off("status", handleStatus);
|
|
345
345
|
provider.off("sync", handleSynced);
|
|
346
346
|
announceDeparture();
|
|
347
|
-
|
|
347
|
+
chunkG3JPCRKN_js.clearLocalAwareness(provider.awareness);
|
|
348
348
|
provider.destroy();
|
|
349
349
|
yDoc.destroy();
|
|
350
350
|
setDoc(null);
|
|
@@ -353,7 +353,7 @@ function useYjsProvider({ config }) {
|
|
|
353
353
|
cleanupRef.current = null;
|
|
354
354
|
setStatus("error");
|
|
355
355
|
}
|
|
356
|
-
},
|
|
356
|
+
}, chunkG3JPCRKN_js.CONNECTION_TIMEOUT_MS);
|
|
357
357
|
}
|
|
358
358
|
setDoc(yDoc);
|
|
359
359
|
setAwareness(provider.awareness);
|
|
@@ -362,7 +362,7 @@ function useYjsProvider({ config }) {
|
|
|
362
362
|
provider.off("status", handleStatus);
|
|
363
363
|
provider.off("sync", handleSynced);
|
|
364
364
|
announceDeparture();
|
|
365
|
-
|
|
365
|
+
chunkG3JPCRKN_js.clearLocalAwareness(provider.awareness);
|
|
366
366
|
provider.destroy();
|
|
367
367
|
yDoc.destroy();
|
|
368
368
|
setDoc(null);
|
|
@@ -388,7 +388,7 @@ function useYjsProvider({ config }) {
|
|
|
388
388
|
]);
|
|
389
389
|
react.useEffect(() => {
|
|
390
390
|
init();
|
|
391
|
-
const disposeTeardown =
|
|
391
|
+
const disposeTeardown = chunkG3JPCRKN_js.registerCollaborationTeardown({
|
|
392
392
|
leave: teardown,
|
|
393
393
|
rejoin: init
|
|
394
394
|
});
|
|
@@ -409,7 +409,7 @@ function useCollaborativeState({
|
|
|
409
409
|
canvasWidth,
|
|
410
410
|
canvasHeight
|
|
411
411
|
}) {
|
|
412
|
-
const userColor =
|
|
412
|
+
const userColor = chunkG3JPCRKN_js.sanitizeColor(config?.userColor, "#6366f1");
|
|
413
413
|
const { status, awareness, doc, clientId, synced, retry } = useYjsProvider({ config });
|
|
414
414
|
const { remoteUsers, broadcastPresence } = usePresenceTracking({
|
|
415
415
|
awareness,
|
|
@@ -527,8 +527,8 @@ function useEditorHistory(input) {
|
|
|
527
527
|
width: canvasSize.width,
|
|
528
528
|
height: canvasSize.height,
|
|
529
529
|
activeSlideIndex,
|
|
530
|
-
slides: slides.map(
|
|
531
|
-
templateElementsBySlideId:
|
|
530
|
+
slides: slides.map(chunkG3JPCRKN_js.cloneSlide),
|
|
531
|
+
templateElementsBySlideId: chunkG3JPCRKN_js.cloneTemplateElementsBySlideId(templateElementsBySlideId),
|
|
532
532
|
...actionLabel ? { actionLabel } : {}
|
|
533
533
|
};
|
|
534
534
|
},
|
|
@@ -541,9 +541,9 @@ function useEditorHistory(input) {
|
|
|
541
541
|
width: snapshot.width,
|
|
542
542
|
height: snapshot.height
|
|
543
543
|
});
|
|
544
|
-
setSlides(snapshot.slides.map(
|
|
544
|
+
setSlides(snapshot.slides.map(chunkG3JPCRKN_js.cloneSlide));
|
|
545
545
|
setTemplateElementsBySlideId(
|
|
546
|
-
|
|
546
|
+
chunkG3JPCRKN_js.cloneTemplateElementsBySlideId(snapshot.templateElementsBySlideId)
|
|
547
547
|
);
|
|
548
548
|
setActiveSlideIndex(Math.min(snapshot.activeSlideIndex, maxSlideIndex));
|
|
549
549
|
setSelectedElementIds([]);
|
|
@@ -582,8 +582,8 @@ function useEditorHistory(input) {
|
|
|
582
582
|
const currentSnapshot = buildHistorySnapshot();
|
|
583
583
|
historyFutureRef.current.push(currentSnapshot);
|
|
584
584
|
isApplyingHistoryRef.current = true;
|
|
585
|
-
const nextSnapshot =
|
|
586
|
-
lastHistorySnapshotRef.current =
|
|
585
|
+
const nextSnapshot = chunkLBJAVP3H_js.cloneHistorySnapshot(previousSnapshot);
|
|
586
|
+
lastHistorySnapshotRef.current = chunkLBJAVP3H_js.cloneHistorySnapshot(nextSnapshot);
|
|
587
587
|
lastHistorySerializedRef.current = serializeDocument(nextSnapshot);
|
|
588
588
|
applyHistorySnapshot(nextSnapshot);
|
|
589
589
|
updateHistoryAvailability();
|
|
@@ -604,8 +604,8 @@ function useEditorHistory(input) {
|
|
|
604
604
|
const currentSnapshot = buildHistorySnapshot();
|
|
605
605
|
historyPastRef.current.push(currentSnapshot);
|
|
606
606
|
isApplyingHistoryRef.current = true;
|
|
607
|
-
const targetSnapshot =
|
|
608
|
-
lastHistorySnapshotRef.current =
|
|
607
|
+
const targetSnapshot = chunkLBJAVP3H_js.cloneHistorySnapshot(nextSnapshot);
|
|
608
|
+
lastHistorySnapshotRef.current = chunkLBJAVP3H_js.cloneHistorySnapshot(targetSnapshot);
|
|
609
609
|
lastHistorySerializedRef.current = serializeDocument(targetSnapshot);
|
|
610
610
|
applyHistorySnapshot(targetSnapshot);
|
|
611
611
|
updateHistoryAvailability();
|
|
@@ -623,7 +623,7 @@ function useEditorHistory(input) {
|
|
|
623
623
|
historyPastRef.current = [];
|
|
624
624
|
historyFutureRef.current = [];
|
|
625
625
|
if (initialSnapshot) {
|
|
626
|
-
const clonedInitial =
|
|
626
|
+
const clonedInitial = chunkLBJAVP3H_js.cloneHistorySnapshot(initialSnapshot);
|
|
627
627
|
lastHistorySnapshotRef.current = clonedInitial;
|
|
628
628
|
lastHistorySerializedRef.current = serializeDocument(clonedInitial);
|
|
629
629
|
} else {
|
|
@@ -671,19 +671,19 @@ function useEditorHistory(input) {
|
|
|
671
671
|
}
|
|
672
672
|
const previousSnapshot = lastHistorySnapshotRef.current;
|
|
673
673
|
if (!previousSnapshot) {
|
|
674
|
-
lastHistorySnapshotRef.current =
|
|
674
|
+
lastHistorySnapshotRef.current = chunkLBJAVP3H_js.cloneHistorySnapshot(snapshot);
|
|
675
675
|
lastHistorySerializedRef.current = serialized;
|
|
676
676
|
lastCheapHashRef.current = cheapHash;
|
|
677
677
|
updateHistoryAvailability();
|
|
678
678
|
return;
|
|
679
679
|
}
|
|
680
680
|
onDirtyRef.current?.();
|
|
681
|
-
historyPastRef.current.push(
|
|
681
|
+
historyPastRef.current.push(chunkLBJAVP3H_js.cloneHistorySnapshot(previousSnapshot));
|
|
682
682
|
while (historyPastRef.current.length > Math.max(1, maxHistoryEntries)) {
|
|
683
683
|
historyPastRef.current.shift();
|
|
684
684
|
}
|
|
685
685
|
historyFutureRef.current = [];
|
|
686
|
-
lastHistorySnapshotRef.current =
|
|
686
|
+
lastHistorySnapshotRef.current = chunkLBJAVP3H_js.cloneHistorySnapshot(snapshot);
|
|
687
687
|
lastHistorySerializedRef.current = serialized;
|
|
688
688
|
lastCheapHashRef.current = cheapHash;
|
|
689
689
|
updateHistoryAvailability();
|
|
@@ -743,9 +743,9 @@ function useZoomViewport({
|
|
|
743
743
|
const canvasStageRef = react.useRef(null);
|
|
744
744
|
const canvasViewportRef = react.useRef(null);
|
|
745
745
|
const renderScaleRef = react.useRef(1);
|
|
746
|
-
const wheelBufferRef = react.useRef(
|
|
746
|
+
const wheelBufferRef = react.useRef(chunkG3JPCRKN_js.createWheelStepBuffer());
|
|
747
747
|
const storeRef = react.useRef(null);
|
|
748
|
-
storeRef.current ??=
|
|
748
|
+
storeRef.current ??= chunkG3JPCRKN_js.createViewerZoomStore();
|
|
749
749
|
const store = storeRef.current;
|
|
750
750
|
const scale = useViewerStore(store, selectZoom);
|
|
751
751
|
const setScale = react.useCallback(
|
|
@@ -806,7 +806,7 @@ function useZoomViewport({
|
|
|
806
806
|
if (!wrapper || !canvasViewport) {
|
|
807
807
|
return;
|
|
808
808
|
}
|
|
809
|
-
const boundedScale =
|
|
809
|
+
const boundedScale = chunkG3JPCRKN_js.clampZoomScale(nextScale);
|
|
810
810
|
const nextEditorScale = fitScale * boundedScale;
|
|
811
811
|
const centerX = (bounds.minX + bounds.maxX) / 2;
|
|
812
812
|
const centerY = (bounds.minY + bounds.maxY) / 2;
|
|
@@ -843,29 +843,29 @@ function useZoomViewport({
|
|
|
843
843
|
selectedElements.forEach((element) => {
|
|
844
844
|
minX = Math.min(minX, element.x);
|
|
845
845
|
minY = Math.min(minY, element.y);
|
|
846
|
-
maxX = Math.max(maxX, element.x + Math.max(element.width,
|
|
847
|
-
maxY = Math.max(maxY, element.y + Math.max(element.height,
|
|
846
|
+
maxX = Math.max(maxX, element.x + Math.max(element.width, chunkLBJAVP3H_js.MIN_ELEMENT_SIZE));
|
|
847
|
+
maxY = Math.max(maxY, element.y + Math.max(element.height, chunkLBJAVP3H_js.MIN_ELEMENT_SIZE));
|
|
848
848
|
});
|
|
849
849
|
if (!Number.isFinite(minX) || !Number.isFinite(minY) || !Number.isFinite(maxX) || !Number.isFinite(maxY)) {
|
|
850
850
|
return;
|
|
851
851
|
}
|
|
852
852
|
const selectionBounds = { minX, minY, maxX, maxY };
|
|
853
|
-
const boundsWidth = Math.max(selectionBounds.maxX - selectionBounds.minX,
|
|
854
|
-
const boundsHeight = Math.max(selectionBounds.maxY - selectionBounds.minY,
|
|
853
|
+
const boundsWidth = Math.max(selectionBounds.maxX - selectionBounds.minX, chunkLBJAVP3H_js.MIN_ELEMENT_SIZE);
|
|
854
|
+
const boundsHeight = Math.max(selectionBounds.maxY - selectionBounds.minY, chunkLBJAVP3H_js.MIN_ELEMENT_SIZE);
|
|
855
855
|
const availableWidth = Math.max(
|
|
856
|
-
effectiveEditorDimensions.width -
|
|
857
|
-
|
|
856
|
+
effectiveEditorDimensions.width - chunkLBJAVP3H_js.ZOOM_TO_SELECTION_PADDING,
|
|
857
|
+
chunkLBJAVP3H_js.MIN_ELEMENT_SIZE
|
|
858
858
|
);
|
|
859
859
|
const availableHeight = Math.max(
|
|
860
|
-
effectiveEditorDimensions.height -
|
|
861
|
-
|
|
860
|
+
effectiveEditorDimensions.height - chunkLBJAVP3H_js.ZOOM_TO_SELECTION_PADDING,
|
|
861
|
+
chunkLBJAVP3H_js.MIN_ELEMENT_SIZE
|
|
862
862
|
);
|
|
863
863
|
const targetEditorScale = Math.min(
|
|
864
864
|
availableWidth / boundsWidth,
|
|
865
865
|
availableHeight / boundsHeight
|
|
866
866
|
);
|
|
867
867
|
const safeFitScale = fitScale > Number.EPSILON ? fitScale : Number.EPSILON;
|
|
868
|
-
const nextScale =
|
|
868
|
+
const nextScale = chunkG3JPCRKN_js.clampZoomScale(targetEditorScale / safeFitScale);
|
|
869
869
|
setScale(nextScale);
|
|
870
870
|
window.requestAnimationFrame(() => {
|
|
871
871
|
window.requestAnimationFrame(() => {
|
|
@@ -882,14 +882,14 @@ function useZoomViewport({
|
|
|
882
882
|
]);
|
|
883
883
|
const handleWheel = react.useCallback(
|
|
884
884
|
(event) => {
|
|
885
|
-
const mapped =
|
|
885
|
+
const mapped = chunkG3JPCRKN_js.mapEditingWheel(event, wheelBufferRef.current, true);
|
|
886
886
|
if (mapped.intent !== "zoom") {
|
|
887
887
|
return;
|
|
888
888
|
}
|
|
889
889
|
event.preventDefault();
|
|
890
890
|
store.dispatch({
|
|
891
891
|
type: "set-zoom",
|
|
892
|
-
zoom:
|
|
892
|
+
zoom: chunkG3JPCRKN_js.clampZoomScale(store.getState().zoom + mapped.deltaScale)
|
|
893
893
|
});
|
|
894
894
|
},
|
|
895
895
|
[store]
|
|
@@ -984,8 +984,8 @@ function scheduleOpeningAutoPlayGroup(controller, ctx) {
|
|
|
984
984
|
if (!group) {
|
|
985
985
|
return;
|
|
986
986
|
}
|
|
987
|
-
|
|
988
|
-
|
|
987
|
+
chunkG3JPCRKN_js.playGroup(controller, group, ctx);
|
|
988
|
+
chunkG3JPCRKN_js.scheduleAutoAdvanceChain(controller, ctx);
|
|
989
989
|
}, firstGroup.autoAdvanceDelayMs ?? 0);
|
|
990
990
|
ctx.timers.push(timer);
|
|
991
991
|
}
|
|
@@ -1004,7 +1004,7 @@ function scheduleEntranceAnimationTimers(slide, setPresentationAnimations, prese
|
|
|
1004
1004
|
}))
|
|
1005
1005
|
);
|
|
1006
1006
|
entranceAnimations.forEach((animation, animationIndex) => {
|
|
1007
|
-
const delay =
|
|
1007
|
+
const delay = chunkG3JPCRKN_js.computeEntranceAnimationDelay(animation.delayMs, animationIndex);
|
|
1008
1008
|
const timer = window.setTimeout(() => {
|
|
1009
1009
|
setPresentationAnimations(
|
|
1010
1010
|
(previousAnimations) => previousAnimations.map(
|
|
@@ -1018,7 +1018,7 @@ function scheduleEntranceAnimationTimers(slide, setPresentationAnimations, prese
|
|
|
1018
1018
|
|
|
1019
1019
|
// src/viewer/hooks/presentation-mode/useAnimationPlayback.ts
|
|
1020
1020
|
function useAnimationPlayback(input) {
|
|
1021
|
-
const { slides, onPlayActionSound, showWithAnimation } = input;
|
|
1021
|
+
const { slides, onPlayActionSound, showWithAnimation, canvasSize, themeColorMap } = input;
|
|
1022
1022
|
const animationsEnabled = showWithAnimation !== false;
|
|
1023
1023
|
const [presentationAnimations, setPresentationAnimations] = react.useState([]);
|
|
1024
1024
|
const [presentationElementStates, setPresentationElementStates] = react.useState(/* @__PURE__ */ new Map());
|
|
@@ -1030,7 +1030,7 @@ function useAnimationPlayback(input) {
|
|
|
1030
1030
|
const presentationTimersRef = react.useRef([]);
|
|
1031
1031
|
const controllerRef = react.useRef(null);
|
|
1032
1032
|
const buildRafRef = react.useRef(null);
|
|
1033
|
-
const activeAnimationGroupRef = react.useRef(
|
|
1033
|
+
const activeAnimationGroupRef = react.useRef(chunkG3JPCRKN_js.createActiveAnimationGroup());
|
|
1034
1034
|
const seededCompletedRef = react.useRef(false);
|
|
1035
1035
|
const mediaTimeNodeElementIdsRef = react.useRef(/* @__PURE__ */ new Map());
|
|
1036
1036
|
const lastSeedCompletedRef = react.useRef(false);
|
|
@@ -1047,15 +1047,15 @@ function useAnimationPlayback(input) {
|
|
|
1047
1047
|
}, [onPlayActionSound]);
|
|
1048
1048
|
react.useEffect(() => {
|
|
1049
1049
|
return () => {
|
|
1050
|
-
|
|
1050
|
+
chunkG3JPCRKN_js.cancelBuildReveal(buildRafRef);
|
|
1051
1051
|
};
|
|
1052
1052
|
}, []);
|
|
1053
1053
|
const clearPresentationTimers = react.useCallback(() => {
|
|
1054
|
-
|
|
1054
|
+
chunkG3JPCRKN_js.clearPlaybackTimers(buildPlaybackContext(), activeAnimationGroupRef.current);
|
|
1055
1055
|
}, [buildPlaybackContext]);
|
|
1056
1056
|
const resetSlideTimeline = react.useCallback(
|
|
1057
1057
|
(slideIndex) => {
|
|
1058
|
-
|
|
1058
|
+
chunkG3JPCRKN_js.cancelBuildReveal(buildRafRef);
|
|
1059
1059
|
const slide = slides[slideIndex];
|
|
1060
1060
|
if (!slide) {
|
|
1061
1061
|
controllerRef.current = null;
|
|
@@ -1066,9 +1066,13 @@ function useAnimationPlayback(input) {
|
|
|
1066
1066
|
setHoverTriggerShapeIds(/* @__PURE__ */ new Set());
|
|
1067
1067
|
return;
|
|
1068
1068
|
}
|
|
1069
|
-
const controller =
|
|
1069
|
+
const controller = chunkG3JPCRKN_js.PresentationAnimationController.fromSlide(slide, {
|
|
1070
|
+
slideHeightPx: canvasSize?.height,
|
|
1071
|
+
slideWidthPx: canvasSize?.width,
|
|
1072
|
+
themeColorMap
|
|
1073
|
+
});
|
|
1070
1074
|
controllerRef.current = controller;
|
|
1071
|
-
mediaTimeNodeElementIdsRef.current =
|
|
1075
|
+
mediaTimeNodeElementIdsRef.current = chunkG3JPCRKN_js.resolveMediaTimeNodeElementIds(
|
|
1072
1076
|
slide.nativeAnimations ?? []
|
|
1073
1077
|
);
|
|
1074
1078
|
setPresentationKeyframesCss(controller.keyframesCss);
|
|
@@ -1076,13 +1080,13 @@ function useAnimationPlayback(input) {
|
|
|
1076
1080
|
setHoverTriggerShapeIds(controller.hoverTriggerShapeIds);
|
|
1077
1081
|
setPresentationElementStates(controller.computeStates());
|
|
1078
1082
|
},
|
|
1079
|
-
[slides]
|
|
1083
|
+
[slides, canvasSize, themeColorMap]
|
|
1080
1084
|
);
|
|
1081
1085
|
const playNextAnimationGroup = react.useCallback(() => {
|
|
1082
1086
|
if (!animationsEnabled) {
|
|
1083
1087
|
return false;
|
|
1084
1088
|
}
|
|
1085
|
-
return
|
|
1089
|
+
return chunkG3JPCRKN_js.advanceMainSequence(
|
|
1086
1090
|
controllerRef.current,
|
|
1087
1091
|
buildPlaybackContext(),
|
|
1088
1092
|
activeAnimationGroupRef.current
|
|
@@ -1098,7 +1102,7 @@ function useAnimationPlayback(input) {
|
|
|
1098
1102
|
if (!group) {
|
|
1099
1103
|
return false;
|
|
1100
1104
|
}
|
|
1101
|
-
|
|
1105
|
+
chunkG3JPCRKN_js.playGroup(controller, group, buildPlaybackContext());
|
|
1102
1106
|
return true;
|
|
1103
1107
|
},
|
|
1104
1108
|
[buildPlaybackContext]
|
|
@@ -1117,7 +1121,7 @@ function useAnimationPlayback(input) {
|
|
|
1117
1121
|
if (!group) {
|
|
1118
1122
|
return false;
|
|
1119
1123
|
}
|
|
1120
|
-
|
|
1124
|
+
chunkG3JPCRKN_js.playGroup(controller, group, buildPlaybackContext());
|
|
1121
1125
|
return true;
|
|
1122
1126
|
},
|
|
1123
1127
|
[animationsEnabled, buildPlaybackContext]
|
|
@@ -1198,12 +1202,12 @@ function useAnimationPlayback(input) {
|
|
|
1198
1202
|
presentationTimersRef
|
|
1199
1203
|
};
|
|
1200
1204
|
}
|
|
1201
|
-
var PRESENTER_CHANNEL_NAME =
|
|
1202
|
-
var AUDIENCE_HASH =
|
|
1203
|
-
var PRESENTER_MSG_ORIGIN =
|
|
1204
|
-
var AUDIENCE_NONCE_KEY =
|
|
1205
|
+
var PRESENTER_CHANNEL_NAME = chunkG3JPCRKN_js.PRESENTATION_CHANNEL_NAME;
|
|
1206
|
+
var AUDIENCE_HASH = chunkG3JPCRKN_js.PRESENTATION_HASH;
|
|
1207
|
+
var PRESENTER_MSG_ORIGIN = chunkG3JPCRKN_js.PRESENTATION_MESSAGE_ORIGIN;
|
|
1208
|
+
var AUDIENCE_NONCE_KEY = chunkG3JPCRKN_js.PRESENTATION_NONCE_KEY;
|
|
1205
1209
|
function generateSessionId() {
|
|
1206
|
-
return
|
|
1210
|
+
return chunkG3JPCRKN_js.createPresentationSessionId();
|
|
1207
1211
|
}
|
|
1208
1212
|
function parseAudienceNonce() {
|
|
1209
1213
|
const hash = window.location.hash;
|
|
@@ -1239,7 +1243,7 @@ function usePresenterWindow(input) {
|
|
|
1239
1243
|
}, []);
|
|
1240
1244
|
const swapDisplays = react.useCallback(async () => {
|
|
1241
1245
|
const audience = audienceWindowRef.current;
|
|
1242
|
-
return audience && !audience.closed ?
|
|
1246
|
+
return audience && !audience.closed ? chunkG3JPCRKN_js.swapPresentationWindows(window, audience) : false;
|
|
1243
1247
|
}, []);
|
|
1244
1248
|
const syncSlideToAudience = react.useCallback(
|
|
1245
1249
|
(slideIndex) => {
|
|
@@ -1303,7 +1307,7 @@ function usePresenterWindow(input) {
|
|
|
1303
1307
|
pollTimerRef.current = null;
|
|
1304
1308
|
}
|
|
1305
1309
|
if (closingSessionId) {
|
|
1306
|
-
void
|
|
1310
|
+
void chunkG3JPCRKN_js.clearAudienceContent(closingSessionId);
|
|
1307
1311
|
}
|
|
1308
1312
|
}, [getChannel]);
|
|
1309
1313
|
const openAudienceWindow = react.useCallback(() => {
|
|
@@ -1321,10 +1325,10 @@ function usePresenterWindow(input) {
|
|
|
1321
1325
|
audienceWindowRef.current = blankWin;
|
|
1322
1326
|
const sessionId = generateSessionId();
|
|
1323
1327
|
sessionIdRef.current = sessionId;
|
|
1324
|
-
const audienceUrl =
|
|
1325
|
-
void
|
|
1328
|
+
const audienceUrl = chunkG3JPCRKN_js.buildPresentationAudienceUrl(window.location.href, sessionId);
|
|
1329
|
+
void chunkG3JPCRKN_js.resolveAudienceScreenPlacement(window).then((placement) => {
|
|
1326
1330
|
if (placement && audienceWindowRef.current === blankWin && !blankWin.closed) {
|
|
1327
|
-
|
|
1331
|
+
chunkG3JPCRKN_js.placeAudienceWindow(blankWin, placement);
|
|
1328
1332
|
}
|
|
1329
1333
|
return void 0;
|
|
1330
1334
|
});
|
|
@@ -1354,7 +1358,7 @@ function usePresenterWindow(input) {
|
|
|
1354
1358
|
}
|
|
1355
1359
|
};
|
|
1356
1360
|
if (content) {
|
|
1357
|
-
void
|
|
1361
|
+
void chunkG3JPCRKN_js.storeAudienceContent(content, sessionId).then(() => navigateOrClose(true)).catch(() => navigateOrClose(false));
|
|
1358
1362
|
} else {
|
|
1359
1363
|
navigateOrClose(true);
|
|
1360
1364
|
}
|
|
@@ -1380,7 +1384,7 @@ function usePresenterWindow(input) {
|
|
|
1380
1384
|
}
|
|
1381
1385
|
const handleMessage = (event) => {
|
|
1382
1386
|
const message = event.data;
|
|
1383
|
-
if (
|
|
1387
|
+
if (chunkG3JPCRKN_js.isPresentationSessionMessage(message) && message.type === "audience-ready" && message.sessionId === sessionIdRef.current) {
|
|
1384
1388
|
syncStateToAudience(snapshotRef.current);
|
|
1385
1389
|
}
|
|
1386
1390
|
};
|
|
@@ -1409,7 +1413,7 @@ function usePresenterWindow(input) {
|
|
|
1409
1413
|
react.useEffect(() => {
|
|
1410
1414
|
const handleBeforeUnload = () => {
|
|
1411
1415
|
if (sessionIdRef.current) {
|
|
1412
|
-
void
|
|
1416
|
+
void chunkG3JPCRKN_js.clearAudienceContent(sessionIdRef.current);
|
|
1413
1417
|
}
|
|
1414
1418
|
};
|
|
1415
1419
|
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
@@ -1471,7 +1475,7 @@ function useAudienceMode(input) {
|
|
|
1471
1475
|
}
|
|
1472
1476
|
channel.onmessage = (event) => {
|
|
1473
1477
|
const data = event.data;
|
|
1474
|
-
if (!
|
|
1478
|
+
if (!chunkG3JPCRKN_js.isPresentationSessionMessage(data) || data.origin !== PRESENTER_MSG_ORIGIN) {
|
|
1475
1479
|
return;
|
|
1476
1480
|
}
|
|
1477
1481
|
if (expectedSessionId && data.sessionId !== expectedSessionId) {
|
|
@@ -1487,16 +1491,16 @@ function useAudienceMode(input) {
|
|
|
1487
1491
|
}
|
|
1488
1492
|
if (data.type === "presenter-exit") {
|
|
1489
1493
|
if (expectedSessionId) {
|
|
1490
|
-
void
|
|
1494
|
+
void chunkG3JPCRKN_js.clearAudienceContent(expectedSessionId);
|
|
1491
1495
|
}
|
|
1492
|
-
if (
|
|
1496
|
+
if (chunkG3JPCRKN_js.endAudienceDisplay(window)) {
|
|
1493
1497
|
handlers.onPresenterEnded?.();
|
|
1494
1498
|
}
|
|
1495
1499
|
}
|
|
1496
1500
|
};
|
|
1497
1501
|
if (expectedSessionId) {
|
|
1498
1502
|
channel.postMessage({
|
|
1499
|
-
origin:
|
|
1503
|
+
origin: chunkG3JPCRKN_js.PRESENTATION_MESSAGE_ORIGIN,
|
|
1500
1504
|
type: "audience-ready",
|
|
1501
1505
|
sessionId: expectedSessionId
|
|
1502
1506
|
});
|
|
@@ -1510,7 +1514,7 @@ function useAudienceMode(input) {
|
|
|
1510
1514
|
}, []);
|
|
1511
1515
|
}
|
|
1512
1516
|
function usePresentationKeyboard(input) {
|
|
1513
|
-
const wheelBufferRef = react.useRef(
|
|
1517
|
+
const wheelBufferRef = react.useRef(chunkG3JPCRKN_js.createWheelStepBuffer());
|
|
1514
1518
|
const {
|
|
1515
1519
|
mode,
|
|
1516
1520
|
movePresentationSlide,
|
|
@@ -1531,14 +1535,14 @@ function usePresentationKeyboard(input) {
|
|
|
1531
1535
|
presentationSlideIndex,
|
|
1532
1536
|
setShowRehearsalSummary
|
|
1533
1537
|
} = input;
|
|
1534
|
-
const keyBufferRef = react.useRef(
|
|
1538
|
+
const keyBufferRef = react.useRef(chunkG3JPCRKN_js.createPresentationKeyBuffer());
|
|
1535
1539
|
react.useEffect(() => {
|
|
1536
|
-
if (mode !== "present" || !
|
|
1537
|
-
keyBufferRef.current =
|
|
1540
|
+
if (mode !== "present" || !chunkG3JPCRKN_js.acceptsPresentationInput()) {
|
|
1541
|
+
keyBufferRef.current = chunkG3JPCRKN_js.createPresentationKeyBuffer();
|
|
1538
1542
|
return;
|
|
1539
1543
|
}
|
|
1540
1544
|
const handleKeyDown = (event) => {
|
|
1541
|
-
const mapped =
|
|
1545
|
+
const mapped = chunkG3JPCRKN_js.mapPresentationKey(event, keyBufferRef.current);
|
|
1542
1546
|
if (mapped.action === "none") {
|
|
1543
1547
|
return;
|
|
1544
1548
|
}
|
|
@@ -1558,12 +1562,12 @@ function usePresentationKeyboard(input) {
|
|
|
1558
1562
|
movePresentationSlide(-1);
|
|
1559
1563
|
return;
|
|
1560
1564
|
case "first": {
|
|
1561
|
-
const first =
|
|
1565
|
+
const first = chunkG3JPCRKN_js.firstShowSlideIndex(showSlideIndexes);
|
|
1562
1566
|
navigateToSlide(first ?? 0);
|
|
1563
1567
|
return;
|
|
1564
1568
|
}
|
|
1565
1569
|
case "last": {
|
|
1566
|
-
const last =
|
|
1570
|
+
const last = chunkG3JPCRKN_js.lastShowSlideIndex(showSlideIndexes);
|
|
1567
1571
|
navigateToSlide(last ?? Math.max(0, slideCount - 1));
|
|
1568
1572
|
return;
|
|
1569
1573
|
}
|
|
@@ -1601,10 +1605,10 @@ function usePresentationKeyboard(input) {
|
|
|
1601
1605
|
}
|
|
1602
1606
|
};
|
|
1603
1607
|
const handleWheel = (event) => {
|
|
1604
|
-
if (mode !== "present" || !
|
|
1608
|
+
if (mode !== "present" || !chunkG3JPCRKN_js.acceptsPresentationInput()) {
|
|
1605
1609
|
return;
|
|
1606
1610
|
}
|
|
1607
|
-
const mapped =
|
|
1611
|
+
const mapped = chunkG3JPCRKN_js.mapPresentationWheel(event, wheelBufferRef.current);
|
|
1608
1612
|
if (mapped.intent === "next-slide") {
|
|
1609
1613
|
event.preventDefault();
|
|
1610
1614
|
movePresentationSlide(1);
|
|
@@ -1737,7 +1741,7 @@ function useRehearsalTimings(input) {
|
|
|
1737
1741
|
|
|
1738
1742
|
// src/viewer/hooks/presentation-mode/presentation-actions.ts
|
|
1739
1743
|
function handlePresentationActionImpl(action, deps) {
|
|
1740
|
-
|
|
1744
|
+
chunkG3JPCRKN_js.runPresentationAction(
|
|
1741
1745
|
action,
|
|
1742
1746
|
{ slideCount: deps.slidesLength, ...deps.elementId ? { elementId: deps.elementId } : {} },
|
|
1743
1747
|
{
|
|
@@ -1765,13 +1769,13 @@ function handlePresentationActionImpl(action, deps) {
|
|
|
1765
1769
|
function executeSlideTransition(nextSlideIndex, deps) {
|
|
1766
1770
|
const incomingSlide = deps.slides[nextSlideIndex];
|
|
1767
1771
|
const transition = deps.reverse ? deps.slides[deps.currentSlideIndex]?.transition : incomingSlide?.transition;
|
|
1768
|
-
const durationMs = deps.playTransition ?
|
|
1772
|
+
const durationMs = deps.playTransition ? chunkG3JPCRKN_js.resolveTransitionDurationMs(transition) : 0;
|
|
1769
1773
|
deps.clearPresentationTimers();
|
|
1770
1774
|
deps.setPresentationSlideIndex(nextSlideIndex);
|
|
1771
1775
|
deps.onSetActiveSlideIndex(nextSlideIndex);
|
|
1772
1776
|
deps.setPresentationSlideVisible(true);
|
|
1773
1777
|
deps.seedSlideAnimations(nextSlideIndex, { completed: deps.seedCompleted });
|
|
1774
|
-
const soundAction =
|
|
1778
|
+
const soundAction = chunkG3JPCRKN_js.resolveTransitionSoundAction(transition);
|
|
1775
1779
|
if (soundAction.kind === "play" && deps.onPlayActionSound) {
|
|
1776
1780
|
deps.onPlayActionSound(soundAction.soundPath, { loop: soundAction.loop });
|
|
1777
1781
|
} else if (soundAction.kind === "stop" && deps.onStopActionSound) {
|
|
@@ -1834,7 +1838,7 @@ function useSlideNavigation(input) {
|
|
|
1834
1838
|
});
|
|
1835
1839
|
const scheduleAutoAdvanceForSlide = react.useCallback(
|
|
1836
1840
|
(slideIndex) => {
|
|
1837
|
-
const delayMs =
|
|
1841
|
+
const delayMs = chunkG3JPCRKN_js.resolveAutoAdvanceDelayMs(slides[slideIndex], { useTimings });
|
|
1838
1842
|
if (delayMs === void 0) {
|
|
1839
1843
|
return;
|
|
1840
1844
|
}
|
|
@@ -1857,7 +1861,7 @@ function useSlideNavigation(input) {
|
|
|
1857
1861
|
if (availableSlideIndexes.length === 0) {
|
|
1858
1862
|
return;
|
|
1859
1863
|
}
|
|
1860
|
-
const pastLastSlide = direction === 1 && !
|
|
1864
|
+
const pastLastSlide = direction === 1 && !chunkG3JPCRKN_js.hasShowSlideAfter(presentationSlideIndex, availableSlideIndexes);
|
|
1861
1865
|
if (rehearsing && pastLastSlide) {
|
|
1862
1866
|
recordCurrentSlideTime(presentationSlideIndex);
|
|
1863
1867
|
try {
|
|
@@ -1875,9 +1879,9 @@ function useSlideNavigation(input) {
|
|
|
1875
1879
|
onAdvancePastLastSlide();
|
|
1876
1880
|
return;
|
|
1877
1881
|
}
|
|
1878
|
-
const nextSlideIndex = direction === 1 ?
|
|
1882
|
+
const nextSlideIndex = direction === 1 ? chunkG3JPCRKN_js.nextShowSlideIndex(presentationSlideIndex, availableSlideIndexes, {
|
|
1879
1883
|
loop: Boolean(loopContinuously) && !rehearsing
|
|
1880
|
-
}) :
|
|
1884
|
+
}) : chunkG3JPCRKN_js.previousShowSlideIndex(presentationSlideIndex, availableSlideIndexes);
|
|
1881
1885
|
if (nextSlideIndex === void 0 || nextSlideIndex === presentationSlideIndex) {
|
|
1882
1886
|
return;
|
|
1883
1887
|
}
|
|
@@ -2056,7 +2060,7 @@ function createCustomShowRunner(deps) {
|
|
|
2056
2060
|
return;
|
|
2057
2061
|
}
|
|
2058
2062
|
origin = returnAfter ? { showId: deps.getActiveCustomShowId(), slideIndex: deps.getPresentationSlideIndex() } : null;
|
|
2059
|
-
const first =
|
|
2063
|
+
const first = chunkG3JPCRKN_js.firstShowSlideIndex(chunkG3JPCRKN_js.resolveShowSlideIndexes(deps.getSlides(), target));
|
|
2060
2064
|
deps.setActiveCustomShowId(customShowId);
|
|
2061
2065
|
if (first !== void 0) {
|
|
2062
2066
|
deps.navigateToSlide(first);
|
|
@@ -2133,22 +2137,22 @@ function usePresentationActionExtensions(input) {
|
|
|
2133
2137
|
}
|
|
2134
2138
|
}, [navigateToSlideViaRef]);
|
|
2135
2139
|
const onOpenFile = react.useCallback((target) => {
|
|
2136
|
-
|
|
2140
|
+
chunkG3JPCRKN_js.safeOpenUrl(target);
|
|
2137
2141
|
}, []);
|
|
2138
2142
|
const onOpenPresentation = react.useCallback((target) => {
|
|
2139
|
-
|
|
2143
|
+
chunkG3JPCRKN_js.safeOpenUrl(target);
|
|
2140
2144
|
}, []);
|
|
2141
2145
|
const onPlayMedia = react.useCallback(
|
|
2142
2146
|
(elementId) => {
|
|
2143
|
-
|
|
2147
|
+
chunkG3JPCRKN_js.toggleStageElementMedia(containerRef.current, elementId);
|
|
2144
2148
|
},
|
|
2145
2149
|
[containerRef]
|
|
2146
2150
|
);
|
|
2147
2151
|
const onOleVerb = react.useCallback(
|
|
2148
2152
|
(verb, elementId) => {
|
|
2149
|
-
const target =
|
|
2153
|
+
const target = chunkG3JPCRKN_js.resolveOleVerbTarget(slides[presentationSlideIndex], elementId, verb);
|
|
2150
2154
|
if (target) {
|
|
2151
|
-
|
|
2155
|
+
chunkG3JPCRKN_js.openUrlInNewTab(target.url);
|
|
2152
2156
|
}
|
|
2153
2157
|
},
|
|
2154
2158
|
[slides, presentationSlideIndex]
|
|
@@ -2178,22 +2182,22 @@ function usePresentationActionExtensions(input) {
|
|
|
2178
2182
|
};
|
|
2179
2183
|
}
|
|
2180
2184
|
function usePresenterConsole(slideIndex, active) {
|
|
2181
|
-
const timerRef = react.useRef(
|
|
2182
|
-
const [snapshot, setSnapshot] = react.useState(() =>
|
|
2185
|
+
const timerRef = react.useRef(chunkG3JPCRKN_js.createPresenterTimer());
|
|
2186
|
+
const [snapshot, setSnapshot] = react.useState(() => chunkG3JPCRKN_js.createInitialPresentationSnapshot(slideIndex));
|
|
2183
2187
|
const patch = react.useCallback((value) => {
|
|
2184
|
-
setSnapshot((current) =>
|
|
2188
|
+
setSnapshot((current) => chunkG3JPCRKN_js.mergePresentationSnapshot(current, value));
|
|
2185
2189
|
}, []);
|
|
2186
2190
|
react.useEffect(() => patch({ slideIndex }), [patch, slideIndex]);
|
|
2187
2191
|
react.useEffect(() => {
|
|
2188
2192
|
if (!active) {
|
|
2189
2193
|
return;
|
|
2190
2194
|
}
|
|
2191
|
-
timerRef.current =
|
|
2195
|
+
timerRef.current = chunkG3JPCRKN_js.resetPresenterTimer();
|
|
2192
2196
|
patch({ paused: false, elapsedMs: 0 });
|
|
2193
2197
|
const timer = window.setInterval(() => {
|
|
2194
2198
|
patch({
|
|
2195
2199
|
paused: timerRef.current.paused,
|
|
2196
|
-
elapsedMs:
|
|
2200
|
+
elapsedMs: chunkG3JPCRKN_js.presenterElapsed(timerRef.current)
|
|
2197
2201
|
});
|
|
2198
2202
|
}, 1e3);
|
|
2199
2203
|
return () => window.clearInterval(timer);
|
|
@@ -2203,19 +2207,19 @@ function usePresenterConsole(slideIndex, active) {
|
|
|
2203
2207
|
applyAudienceSnapshot: setSnapshot,
|
|
2204
2208
|
setBlackout: (blackout) => patch({ blackout }),
|
|
2205
2209
|
toggleTimer: () => {
|
|
2206
|
-
timerRef.current =
|
|
2210
|
+
timerRef.current = chunkG3JPCRKN_js.togglePresenterTimer(timerRef.current);
|
|
2207
2211
|
patch({
|
|
2208
2212
|
paused: timerRef.current.paused,
|
|
2209
|
-
elapsedMs:
|
|
2213
|
+
elapsedMs: chunkG3JPCRKN_js.presenterElapsed(timerRef.current)
|
|
2210
2214
|
});
|
|
2211
2215
|
},
|
|
2212
2216
|
resetTimer: () => {
|
|
2213
|
-
timerRef.current =
|
|
2217
|
+
timerRef.current = chunkG3JPCRKN_js.resetPresenterTimer();
|
|
2214
2218
|
patch({ paused: false, elapsedMs: 0 });
|
|
2215
2219
|
},
|
|
2216
2220
|
stepZoom: (direction) => setSnapshot(
|
|
2217
|
-
(current) =>
|
|
2218
|
-
zoom:
|
|
2221
|
+
(current) => chunkG3JPCRKN_js.mergePresentationSnapshot(current, {
|
|
2222
|
+
zoom: chunkG3JPCRKN_js.stepPresenterZoom(
|
|
2219
2223
|
current.zoom ?? { scale: 1, originX: 0.5, originY: 0.5 },
|
|
2220
2224
|
direction
|
|
2221
2225
|
)
|
|
@@ -2235,6 +2239,8 @@ function usePresentationMode(input) {
|
|
|
2235
2239
|
slides,
|
|
2236
2240
|
templateElementsBySlideId,
|
|
2237
2241
|
visibleSlideIndexes,
|
|
2242
|
+
canvasSize,
|
|
2243
|
+
themeColorMap,
|
|
2238
2244
|
activeSlideIndex,
|
|
2239
2245
|
containerRef,
|
|
2240
2246
|
content,
|
|
@@ -2266,7 +2272,7 @@ function usePresentationMode(input) {
|
|
|
2266
2272
|
const [allSlidesOpen, setAllSlidesOpen] = react.useState(false);
|
|
2267
2273
|
const [endOfShowVisible, setEndOfShowVisible] = react.useState(false);
|
|
2268
2274
|
const [presentationStartTime, setPresentationStartTime] = react.useState(null);
|
|
2269
|
-
const showGuard = react.useMemo(() =>
|
|
2275
|
+
const showGuard = react.useMemo(() => chunkG3JPCRKN_js.createPresenterShowGuard(), []);
|
|
2270
2276
|
const {
|
|
2271
2277
|
presentationAnimations,
|
|
2272
2278
|
presentationElementStates,
|
|
@@ -2283,7 +2289,13 @@ function usePresentationMode(input) {
|
|
|
2283
2289
|
startSlideAnimations,
|
|
2284
2290
|
isSeededCompleted,
|
|
2285
2291
|
presentationTimersRef
|
|
2286
|
-
} = useAnimationPlayback({
|
|
2292
|
+
} = useAnimationPlayback({
|
|
2293
|
+
slides,
|
|
2294
|
+
onPlayActionSound,
|
|
2295
|
+
showWithAnimation,
|
|
2296
|
+
canvasSize,
|
|
2297
|
+
themeColorMap
|
|
2298
|
+
});
|
|
2287
2299
|
const {
|
|
2288
2300
|
rehearsing,
|
|
2289
2301
|
setRehearsing,
|
|
@@ -2357,7 +2369,7 @@ function usePresentationMode(input) {
|
|
|
2357
2369
|
actionExtensions.bindNavigateToSlide(navigateToSlide);
|
|
2358
2370
|
const movePresentationSlide = react.useCallback(
|
|
2359
2371
|
(direction, trigger = "explicit") => {
|
|
2360
|
-
if (!
|
|
2372
|
+
if (!chunkG3JPCRKN_js.acceptsPresentationInput()) {
|
|
2361
2373
|
return;
|
|
2362
2374
|
}
|
|
2363
2375
|
if (endOfShowVisible) {
|
|
@@ -2426,7 +2438,7 @@ function usePresentationMode(input) {
|
|
|
2426
2438
|
onSetMode("present");
|
|
2427
2439
|
}, [containerRef, onSetMode, setRehearsing]);
|
|
2428
2440
|
const enterPresentModeFromBeginning = react.useCallback(() => {
|
|
2429
|
-
const first =
|
|
2441
|
+
const first = chunkG3JPCRKN_js.firstShowSlideIndex(visibleSlideIndexes);
|
|
2430
2442
|
if (first !== void 0) {
|
|
2431
2443
|
onSetActiveSlideIndex(first);
|
|
2432
2444
|
}
|
|
@@ -2506,7 +2518,7 @@ function usePresentationMode(input) {
|
|
|
2506
2518
|
if (mode !== "present") {
|
|
2507
2519
|
return;
|
|
2508
2520
|
}
|
|
2509
|
-
return
|
|
2521
|
+
return chunkG3JPCRKN_js.attachPresentationVisibilityPause({
|
|
2510
2522
|
root: containerRef.current ?? void 0,
|
|
2511
2523
|
onHidden: () => clearPresentationTimersRef.current(),
|
|
2512
2524
|
onVisible: () => scheduleAutoAdvanceRef.current(presentationSlideIndexRef.current)
|
|
@@ -2514,7 +2526,7 @@ function usePresentationMode(input) {
|
|
|
2514
2526
|
}, [mode, containerRef]);
|
|
2515
2527
|
react.useLayoutEffect(() => {
|
|
2516
2528
|
if (mode === "present") {
|
|
2517
|
-
const idx =
|
|
2529
|
+
const idx = chunkG3JPCRKN_js.presentationEntrySlideIndex(
|
|
2518
2530
|
activeSlideIndexRef.current,
|
|
2519
2531
|
visibleSlideIndexesRef.current
|
|
2520
2532
|
);
|
|
@@ -2593,11 +2605,11 @@ function usePresentationMode(input) {
|
|
|
2593
2605
|
return void 0;
|
|
2594
2606
|
}
|
|
2595
2607
|
const incoming = slides[transitionOverlay.incomingSlideIndex];
|
|
2596
|
-
return
|
|
2608
|
+
return chunkG3JPCRKN_js.buildMorphTransitionPlan(
|
|
2597
2609
|
slides[transitionOverlay.outgoingSlideIndex],
|
|
2598
2610
|
incoming,
|
|
2599
2611
|
transitionOverlay.durationMs,
|
|
2600
|
-
|
|
2612
|
+
chunkG3JPCRKN_js.morphOptionToMode(transitionOverlay.transition.morphOption),
|
|
2601
2613
|
// `PresentationStage` stacks the incoming slide's elements above its
|
|
2602
2614
|
// template shapes (`zIndex = templateElements.length + index`), so a
|
|
2603
2615
|
// z-index journey has to start counting where the stage does.
|
|
@@ -2622,7 +2634,7 @@ function usePresentationMode(input) {
|
|
|
2622
2634
|
if (!morphPlan) {
|
|
2623
2635
|
return presentationKeyframesCss;
|
|
2624
2636
|
}
|
|
2625
|
-
const imageRules =
|
|
2637
|
+
const imageRules = chunkG3JPCRKN_js.buildMorphAnimationRules(morphPlan, "", "incoming", "image");
|
|
2626
2638
|
return `${presentationKeyframesCss ?? ""}
|
|
2627
2639
|
${morphPlan.keyframesCss}
|
|
2628
2640
|
${imageRules}`;
|
|
@@ -2919,7 +2931,7 @@ function useFindReplace({
|
|
|
2919
2931
|
const [findResults, setFindResults] = react.useState([]);
|
|
2920
2932
|
const [findResultIndex, setFindResultIndex] = react.useState(-1);
|
|
2921
2933
|
const performFind = react.useCallback(() => {
|
|
2922
|
-
const results =
|
|
2934
|
+
const results = chunkG3JPCRKN_js.findInSlides(slides, findQuery, { matchCase: findMatchCase });
|
|
2923
2935
|
if (!findQuery) {
|
|
2924
2936
|
setFindResults([]);
|
|
2925
2937
|
setFindResultIndex(-1);
|
|
@@ -2953,7 +2965,7 @@ function useFindReplace({
|
|
|
2953
2965
|
return;
|
|
2954
2966
|
}
|
|
2955
2967
|
onUpdateSlides(
|
|
2956
|
-
(prevSlides) =>
|
|
2968
|
+
(prevSlides) => chunkG3JPCRKN_js.applyFindReplacements(prevSlides, toReplace, replaceQuery).slides
|
|
2957
2969
|
);
|
|
2958
2970
|
onMarkDirty();
|
|
2959
2971
|
},
|
|
@@ -2975,9 +2987,9 @@ function useFindReplace({
|
|
|
2975
2987
|
}, [findResults, applyReplacements, performFind]);
|
|
2976
2988
|
react.useEffect(() => {
|
|
2977
2989
|
const handler = (event) => {
|
|
2978
|
-
const { action } =
|
|
2990
|
+
const { action } = chunkG3JPCRKN_js.mapEditorKey(event, {
|
|
2979
2991
|
canEdit: mode === "edit",
|
|
2980
|
-
isTextInputTarget:
|
|
2992
|
+
isTextInputTarget: chunkG3JPCRKN_js.isEditorTextInputTarget(event.target)
|
|
2981
2993
|
});
|
|
2982
2994
|
if (action !== "find") {
|
|
2983
2995
|
return;
|
|
@@ -3088,7 +3100,7 @@ function addCommentToSlide(slides, slideIndex, text, authorName, elementId, ment
|
|
|
3088
3100
|
if (!slide) {
|
|
3089
3101
|
return { slides, didAdd: false };
|
|
3090
3102
|
}
|
|
3091
|
-
const next =
|
|
3103
|
+
const next = chunkG3JPCRKN_js.addCommentToList(
|
|
3092
3104
|
slide.comments || [],
|
|
3093
3105
|
text,
|
|
3094
3106
|
authorName,
|
|
@@ -3109,7 +3121,7 @@ function removeCommentFromSlide(slides, slideIndex, commentId) {
|
|
|
3109
3121
|
if (!slide) {
|
|
3110
3122
|
return { slides, didDelete: false };
|
|
3111
3123
|
}
|
|
3112
|
-
const next =
|
|
3124
|
+
const next = chunkG3JPCRKN_js.removeCommentFromList(slide.comments || [], commentId);
|
|
3113
3125
|
if (!next) {
|
|
3114
3126
|
return { slides, didDelete: false };
|
|
3115
3127
|
}
|
|
@@ -3120,7 +3132,7 @@ function editCommentInSlide(slides, slideIndex, commentId, newText) {
|
|
|
3120
3132
|
if (!slide) {
|
|
3121
3133
|
return { slides, didUpdate: false };
|
|
3122
3134
|
}
|
|
3123
|
-
const next =
|
|
3135
|
+
const next = chunkG3JPCRKN_js.editCommentInList(slide.comments || [], commentId, newText);
|
|
3124
3136
|
if (!next) {
|
|
3125
3137
|
return { slides, didUpdate: false };
|
|
3126
3138
|
}
|
|
@@ -3131,7 +3143,7 @@ function toggleResolvedInSlide(slides, slideIndex, commentId) {
|
|
|
3131
3143
|
if (!slide) {
|
|
3132
3144
|
return { slides, didUpdate: false };
|
|
3133
3145
|
}
|
|
3134
|
-
const next =
|
|
3146
|
+
const next = chunkG3JPCRKN_js.toggleCommentResolvedInList(slide.comments || [], commentId);
|
|
3135
3147
|
if (!next) {
|
|
3136
3148
|
return { slides, didUpdate: false };
|
|
3137
3149
|
}
|
|
@@ -3142,7 +3154,7 @@ function addReplyToSlide(slides, slideIndex, parentId, text, authorName, mention
|
|
|
3142
3154
|
if (!slide) {
|
|
3143
3155
|
return { slides, didAdd: false };
|
|
3144
3156
|
}
|
|
3145
|
-
const next =
|
|
3157
|
+
const next = chunkG3JPCRKN_js.replyToCommentInList(slide.comments || [], parentId, text, authorName);
|
|
3146
3158
|
if (!next) {
|
|
3147
3159
|
return { slides, didAdd: false };
|
|
3148
3160
|
}
|
|
@@ -3529,7 +3541,7 @@ function useDerivedElementState(input) {
|
|
|
3529
3541
|
return [];
|
|
3530
3542
|
}
|
|
3531
3543
|
return [
|
|
3532
|
-
...
|
|
3544
|
+
...chunkG3JPCRKN_js.visibleTemplateElements(activeSlide, templateElementsBySlideId[activeSlide.id] ?? [])
|
|
3533
3545
|
];
|
|
3534
3546
|
}, [activeSlide, templateElementsBySlideId]);
|
|
3535
3547
|
const activeMaster = slideMasters[activeMasterIndex];
|
|
@@ -3596,7 +3608,7 @@ function useViewerCoreState(_input) {
|
|
|
3596
3608
|
const marqueeStateRef = react.useRef(null);
|
|
3597
3609
|
const isDrawingRef = react.useRef(false);
|
|
3598
3610
|
const justInteractedRef = react.useRef(false);
|
|
3599
|
-
const livePatcher = react.useMemo(() =>
|
|
3611
|
+
const livePatcher = react.useMemo(() => chunkG3JPCRKN_js.createCollaborationLivePatcher(), []);
|
|
3600
3612
|
react.useEffect(() => () => livePatcher.dispose(), [livePatcher]);
|
|
3601
3613
|
const slidesRef = react.useRef([]);
|
|
3602
3614
|
const [mode, setMode] = react.useState("edit");
|
|
@@ -3605,8 +3617,8 @@ function useViewerCoreState(_input) {
|
|
|
3605
3617
|
const [slides, setSlides] = react.useState([]);
|
|
3606
3618
|
const [templateElementsBySlideId, setTemplateElementsBySlideId] = react.useState({});
|
|
3607
3619
|
const [canvasSize, setCanvasSize] = react.useState({
|
|
3608
|
-
width:
|
|
3609
|
-
height:
|
|
3620
|
+
width: chunkLBJAVP3H_js.DEFAULT_CANVAS_WIDTH,
|
|
3621
|
+
height: chunkLBJAVP3H_js.DEFAULT_CANVAS_HEIGHT
|
|
3610
3622
|
});
|
|
3611
3623
|
const [slideSizeEmu, setSlideSizeEmu] = react.useState();
|
|
3612
3624
|
const [activeSlideIndex, setActiveSlideIndex] = react.useState(0);
|
|
@@ -3627,7 +3639,7 @@ function useViewerCoreState(_input) {
|
|
|
3627
3639
|
const resolved = typeof value === "function" ? value(inlineEditingTextRef.current) : value;
|
|
3628
3640
|
inlineEditingTextRef.current = resolved;
|
|
3629
3641
|
setInlineEditingTextBase(value);
|
|
3630
|
-
|
|
3642
|
+
chunkG3JPCRKN_js.publishLiveInlineText(
|
|
3631
3643
|
livePatcher,
|
|
3632
3644
|
slidesRef.current[activeSlideIndexRef.current],
|
|
3633
3645
|
inlineEditingElementIdRef.current,
|
|
@@ -3958,6 +3970,7 @@ function useLoadContent({
|
|
|
3958
3970
|
setDigitalSignatureCount,
|
|
3959
3971
|
setGuides,
|
|
3960
3972
|
setReadOnlyRecommendation,
|
|
3973
|
+
setModifyVerifier,
|
|
3961
3974
|
setCompatToasts,
|
|
3962
3975
|
setLoading,
|
|
3963
3976
|
setError,
|
|
@@ -3989,7 +4002,7 @@ function useLoadContent({
|
|
|
3989
4002
|
);
|
|
3990
4003
|
}
|
|
3991
4004
|
const previousHandler = handlerRef.current;
|
|
3992
|
-
const handler = new
|
|
4005
|
+
const handler = new chunkG3JPCRKN_js.PptxHandler();
|
|
3993
4006
|
const parsed = await handler.load(buffer, { allowExternalImages });
|
|
3994
4007
|
if (cancelled || token !== renderTokenRef.current) {
|
|
3995
4008
|
handler.dispose();
|
|
@@ -4001,7 +4014,7 @@ function useLoadContent({
|
|
|
4001
4014
|
handlerRef.current = null;
|
|
4002
4015
|
const mediaElements = [];
|
|
4003
4016
|
for (const slide of parsed.slides) {
|
|
4004
|
-
|
|
4017
|
+
chunkG3JPCRKN_js.collectMediaElements(slide.elements, mediaElements);
|
|
4005
4018
|
}
|
|
4006
4019
|
for (const url of mediaDataUrls.values()) {
|
|
4007
4020
|
if (url.startsWith("blob:")) {
|
|
@@ -4011,7 +4024,7 @@ function useLoadContent({
|
|
|
4011
4024
|
mediaDataUrls.clear();
|
|
4012
4025
|
await Promise.all(
|
|
4013
4026
|
mediaElements.map(async (mediaElement) => {
|
|
4014
|
-
const resolved = await
|
|
4027
|
+
const resolved = await chunkG3JPCRKN_js.resolveMediaElementSource(mediaElement, handler);
|
|
4015
4028
|
if (resolved.missing || !resolved.mediaPath || !resolved.url) {
|
|
4016
4029
|
mediaElement.mediaMissing = true;
|
|
4017
4030
|
return;
|
|
@@ -4022,7 +4035,7 @@ function useLoadContent({
|
|
|
4022
4035
|
}
|
|
4023
4036
|
})
|
|
4024
4037
|
);
|
|
4025
|
-
const { paths: imagePaths, refs: imageRefs } =
|
|
4038
|
+
const { paths: imagePaths, refs: imageRefs } = chunkG3JPCRKN_js.collectImagePaths(parsed.slides);
|
|
4026
4039
|
let nextSlides = parsed.slides;
|
|
4027
4040
|
if (imagePaths.size > 0) {
|
|
4028
4041
|
const resolvedMap = /* @__PURE__ */ new Map();
|
|
@@ -4038,25 +4051,25 @@ function useLoadContent({
|
|
|
4038
4051
|
})
|
|
4039
4052
|
);
|
|
4040
4053
|
nextSlides = parsed.slides.map((s) => {
|
|
4041
|
-
const newElements =
|
|
4054
|
+
const newElements = chunkG3JPCRKN_js.applyImagePathPatches(s.elements, resolvedMap, imageRefs);
|
|
4042
4055
|
return newElements === s.elements ? s : { ...s, elements: newElements };
|
|
4043
4056
|
});
|
|
4044
4057
|
}
|
|
4045
|
-
nextSlides = await
|
|
4058
|
+
nextSlides = await chunkG3JPCRKN_js.resolveTableCellImageUrls(
|
|
4046
4059
|
nextSlides,
|
|
4047
4060
|
(path) => handler.getImageData(path)
|
|
4048
4061
|
);
|
|
4049
|
-
const nextTableStyleMap = await
|
|
4062
|
+
const nextTableStyleMap = await chunkG3JPCRKN_js.resolveTableStyleImageUrls(
|
|
4050
4063
|
parsed.tableStyleMap,
|
|
4051
4064
|
(path) => handler.getImageData(path)
|
|
4052
4065
|
);
|
|
4053
4066
|
handlerRef.current = handler;
|
|
4054
|
-
const partition =
|
|
4067
|
+
const partition = chunkG3JPCRKN_js.partitionTemplateElements(nextSlides);
|
|
4055
4068
|
setSlides(partition.slides);
|
|
4056
4069
|
setTemplateElementsBySlideId(partition.templateElementsBySlideId);
|
|
4057
4070
|
setCanvasSize({
|
|
4058
|
-
width: parsed.width ??
|
|
4059
|
-
height: parsed.height ??
|
|
4071
|
+
width: parsed.width ?? chunkLBJAVP3H_js.DEFAULT_CANVAS_WIDTH,
|
|
4072
|
+
height: parsed.height ?? chunkLBJAVP3H_js.DEFAULT_CANVAS_HEIGHT
|
|
4060
4073
|
});
|
|
4061
4074
|
setSlideSizeEmu(
|
|
4062
4075
|
typeof parsed.widthEmu === "number" && typeof parsed.heightEmu === "number" && parsed.widthEmu > 0 && parsed.heightEmu > 0 ? {
|
|
@@ -4069,7 +4082,7 @@ function useLoadContent({
|
|
|
4069
4082
|
setLayoutOptions(parsed.layoutOptions ?? []);
|
|
4070
4083
|
setSlideMasters(parsed.slideMasters ?? []);
|
|
4071
4084
|
setModernCommentAuthors(parsed.modernCommentAuthors ?? []);
|
|
4072
|
-
setRecentColors(
|
|
4085
|
+
setRecentColors(chunkG3JPCRKN_js.seedRecentColors({ mruColors: parsed.mruColors }));
|
|
4073
4086
|
setTheme(parsed.theme);
|
|
4074
4087
|
setTableStyleMap(nextTableStyleMap);
|
|
4075
4088
|
setTableStylesDefaultId(parsed.tableStylesDefaultId);
|
|
@@ -4077,7 +4090,7 @@ function useLoadContent({
|
|
|
4077
4090
|
setThemeOptions(parsed.themeOptions ?? []);
|
|
4078
4091
|
setCustomShows(parsed.customShows ?? []);
|
|
4079
4092
|
setActiveCustomShowId(
|
|
4080
|
-
|
|
4093
|
+
chunkG3JPCRKN_js.resolveAuthoredCustomShowId(parsed.presentationProperties, parsed.customShows) ?? null
|
|
4081
4094
|
);
|
|
4082
4095
|
setSections(parsed.sections ?? []);
|
|
4083
4096
|
setPresentationProperties(parsed.presentationProperties ?? {});
|
|
@@ -4100,10 +4113,11 @@ function useLoadContent({
|
|
|
4100
4113
|
setHasMacros(parsed.hasMacros === true);
|
|
4101
4114
|
setHasDigitalSignatures(parsed.hasDigitalSignatures === true);
|
|
4102
4115
|
setDigitalSignatureCount(parsed.digitalSignatureCount ?? 0);
|
|
4103
|
-
setGuides(
|
|
4104
|
-
setReadOnlyRecommendation(
|
|
4116
|
+
setGuides(chunkG3JPCRKN_js.buildInitialGuides(parsed.presentationGuides, parsed.slides[0]?.guides));
|
|
4117
|
+
setReadOnlyRecommendation(chunkG3JPCRKN_js.readOnlyRecommendation(parsed));
|
|
4118
|
+
setModifyVerifier(parsed.modifyVerifier ?? void 0);
|
|
4105
4119
|
setCompatToasts(
|
|
4106
|
-
|
|
4120
|
+
chunkG3JPCRKN_js.compatibilityWarningToasts([
|
|
4107
4121
|
...parsed.warnings ?? [],
|
|
4108
4122
|
...parsed.slides.flatMap((slide) => slide.warnings ?? [])
|
|
4109
4123
|
])
|
|
@@ -4115,7 +4129,7 @@ function useLoadContent({
|
|
|
4115
4129
|
onContentApplied?.();
|
|
4116
4130
|
} catch (err) {
|
|
4117
4131
|
if (!cancelled && token === renderTokenRef.current) {
|
|
4118
|
-
if (err instanceof
|
|
4132
|
+
if (err instanceof chunkG3JPCRKN_js.EncryptedFileError) {
|
|
4119
4133
|
setIsEncrypted(true);
|
|
4120
4134
|
} else {
|
|
4121
4135
|
console.error("[pptx] Failed to load presentation content:", err);
|
|
@@ -4143,7 +4157,7 @@ function useLoadContent({
|
|
|
4143
4157
|
}
|
|
4144
4158
|
function useAutosave(input) {
|
|
4145
4159
|
const { isDirty, filePath, serializeSlides, enabled = true, getChangeSources } = input;
|
|
4146
|
-
const intervalMs =
|
|
4160
|
+
const intervalMs = chunkG3JPCRKN_js.resolveAutosaveIntervalMs({
|
|
4147
4161
|
hostIntervalMs: input.intervalMs,
|
|
4148
4162
|
optionsIntervalSeconds: input.intervalSeconds
|
|
4149
4163
|
});
|
|
@@ -4174,7 +4188,7 @@ function useAutosave(input) {
|
|
|
4174
4188
|
return;
|
|
4175
4189
|
}
|
|
4176
4190
|
const sources = changeSourcesRef.current?.() ?? [];
|
|
4177
|
-
if (!
|
|
4191
|
+
if (!chunkG3JPCRKN_js.shouldWriteAutosaveSnapshot({
|
|
4178
4192
|
filePath: path,
|
|
4179
4193
|
isDirty: isDirtyRef.current,
|
|
4180
4194
|
saving: isSavingRef.current,
|
|
@@ -4192,8 +4206,8 @@ function useAutosave(input) {
|
|
|
4192
4206
|
isSavingRef.current = false;
|
|
4193
4207
|
return;
|
|
4194
4208
|
}
|
|
4195
|
-
await
|
|
4196
|
-
lastSnapshotRef.current =
|
|
4209
|
+
await chunkG3JPCRKN_js.saveAutosaveSnapshot(path, data);
|
|
4210
|
+
lastSnapshotRef.current = chunkG3JPCRKN_js.autosaveSnapshotMark(path, sources);
|
|
4197
4211
|
setAutosaveStatus({ state: "saved", timestamp: Date.now() });
|
|
4198
4212
|
} catch (err) {
|
|
4199
4213
|
setAutosaveStatus({
|
|
@@ -4247,13 +4261,13 @@ function useElementOperations(input) {
|
|
|
4247
4261
|
inlineEditingText
|
|
4248
4262
|
} = input;
|
|
4249
4263
|
const liveTextSegments = react.useCallback(() => {
|
|
4250
|
-
if (!selectedElement || !
|
|
4264
|
+
if (!selectedElement || !chunkG3JPCRKN_js.hasTextProperties(selectedElement)) {
|
|
4251
4265
|
return void 0;
|
|
4252
4266
|
}
|
|
4253
4267
|
if (selectedElement.id !== inlineEditingElementId) {
|
|
4254
4268
|
return selectedElement.textSegments;
|
|
4255
4269
|
}
|
|
4256
|
-
return
|
|
4270
|
+
return chunkG3JPCRKN_js.remapTextToSegments(
|
|
4257
4271
|
inlineEditingText,
|
|
4258
4272
|
selectedElement.textSegments,
|
|
4259
4273
|
selectedElement.textStyle
|
|
@@ -4294,11 +4308,11 @@ function useElementOperations(input) {
|
|
|
4294
4308
|
(elementId, updates) => {
|
|
4295
4309
|
if (masterView?.target) {
|
|
4296
4310
|
applyMasterViewWrite(
|
|
4297
|
-
|
|
4311
|
+
chunkG3JPCRKN_js.updateMasterViewElement(masterView, masterView.target, elementId, updates)
|
|
4298
4312
|
);
|
|
4299
4313
|
return;
|
|
4300
4314
|
}
|
|
4301
|
-
if (
|
|
4315
|
+
if (chunkG3JPCRKN_js.isTemplateElementId(elementId)) {
|
|
4302
4316
|
const slideId = activeSlide?.id;
|
|
4303
4317
|
if (slideId) {
|
|
4304
4318
|
setTemplateElementsBySlideId((prev) => ({
|
|
@@ -4309,7 +4323,7 @@ function useElementOperations(input) {
|
|
|
4309
4323
|
}));
|
|
4310
4324
|
}
|
|
4311
4325
|
} else {
|
|
4312
|
-
setSlides((prev) =>
|
|
4326
|
+
setSlides((prev) => chunkG3JPCRKN_js.updateElement(prev, activeSlideIndex, elementId, updates));
|
|
4313
4327
|
}
|
|
4314
4328
|
history.markDirty();
|
|
4315
4329
|
},
|
|
@@ -4334,7 +4348,7 @@ function useElementOperations(input) {
|
|
|
4334
4348
|
);
|
|
4335
4349
|
const updateSelectedShapeStyle = react.useCallback(
|
|
4336
4350
|
(updates) => {
|
|
4337
|
-
if (!selectedElement || !
|
|
4351
|
+
if (!selectedElement || !chunkG3JPCRKN_js.hasShapeProperties(selectedElement)) {
|
|
4338
4352
|
return;
|
|
4339
4353
|
}
|
|
4340
4354
|
updateSelectedElement({
|
|
@@ -4345,19 +4359,19 @@ function useElementOperations(input) {
|
|
|
4345
4359
|
);
|
|
4346
4360
|
const updateSelectedTextStyle = react.useCallback(
|
|
4347
4361
|
(updates) => {
|
|
4348
|
-
if (!selectedElement || !
|
|
4362
|
+
if (!selectedElement || !chunkG3JPCRKN_js.hasTextProperties(selectedElement)) {
|
|
4349
4363
|
return;
|
|
4350
4364
|
}
|
|
4351
4365
|
const isLiveEditing = selectedElement.id === inlineEditingElementId;
|
|
4352
4366
|
const currentSegments = liveTextSegments();
|
|
4353
|
-
const inlineSel =
|
|
4367
|
+
const inlineSel = chunkG3JPCRKN_js.getInlineEditorSelection(currentSegments);
|
|
4354
4368
|
if (inlineSel && currentSegments) {
|
|
4355
|
-
const { newSegments: newSegments2, newSelection } =
|
|
4369
|
+
const { newSegments: newSegments2, newSelection } = chunkG3JPCRKN_js.applyStyleToSelectedSegments(
|
|
4356
4370
|
currentSegments,
|
|
4357
4371
|
inlineSel,
|
|
4358
4372
|
updates
|
|
4359
4373
|
);
|
|
4360
|
-
|
|
4374
|
+
chunkG3JPCRKN_js.setPendingSelectionRestore(newSelection);
|
|
4361
4375
|
updateSelectedElement({
|
|
4362
4376
|
textSegments: newSegments2,
|
|
4363
4377
|
...isLiveEditing ? { text: inlineEditingText } : {}
|
|
@@ -4385,14 +4399,14 @@ function useElementOperations(input) {
|
|
|
4385
4399
|
);
|
|
4386
4400
|
const updateSelectedTextCase = react.useCallback(
|
|
4387
4401
|
(mode) => {
|
|
4388
|
-
if (!selectedElement || !
|
|
4402
|
+
if (!selectedElement || !chunkG3JPCRKN_js.hasTextProperties(selectedElement)) {
|
|
4389
4403
|
return;
|
|
4390
4404
|
}
|
|
4391
4405
|
const isLiveEditing = selectedElement.id === inlineEditingElementId;
|
|
4392
4406
|
const currentSegments = liveTextSegments();
|
|
4393
|
-
const inlineSel =
|
|
4407
|
+
const inlineSel = chunkG3JPCRKN_js.getInlineEditorSelection(currentSegments);
|
|
4394
4408
|
if (inlineSel && currentSegments) {
|
|
4395
|
-
const newSegments =
|
|
4409
|
+
const newSegments = chunkG3JPCRKN_js.applyCaseTransformToSegments(currentSegments, inlineSel, mode);
|
|
4396
4410
|
updateSelectedElement({
|
|
4397
4411
|
textSegments: newSegments,
|
|
4398
4412
|
...isLiveEditing ? { text: inlineEditingText } : {}
|
|
@@ -4401,7 +4415,7 @@ function useElementOperations(input) {
|
|
|
4401
4415
|
}
|
|
4402
4416
|
const updates = {};
|
|
4403
4417
|
if (currentSegments && currentSegments.length > 0) {
|
|
4404
|
-
updates.textSegments =
|
|
4418
|
+
updates.textSegments = chunkG3JPCRKN_js.applyCaseTransformToSegments(
|
|
4405
4419
|
currentSegments,
|
|
4406
4420
|
null,
|
|
4407
4421
|
mode
|
|
@@ -4409,7 +4423,7 @@ function useElementOperations(input) {
|
|
|
4409
4423
|
}
|
|
4410
4424
|
const baseText = isLiveEditing ? inlineEditingText : selectedElement.text;
|
|
4411
4425
|
if (typeof baseText === "string") {
|
|
4412
|
-
updates.text =
|
|
4426
|
+
updates.text = chunkG3JPCRKN_js.transformTextCase(baseText, mode);
|
|
4413
4427
|
}
|
|
4414
4428
|
updateSelectedElement(updates);
|
|
4415
4429
|
},
|
|
@@ -4428,15 +4442,15 @@ function useElementOperations(input) {
|
|
|
4428
4442
|
[setSlides]
|
|
4429
4443
|
);
|
|
4430
4444
|
const masterViewTarget = masterView?.target ?? null;
|
|
4431
|
-
const activeElements = masterViewTarget ?
|
|
4445
|
+
const activeElements = masterViewTarget ? chunkG3JPCRKN_js.masterViewElements(masterView, masterViewTarget) : editTemplateMode ? templateElements : activeSlide?.elements ?? [];
|
|
4432
4446
|
const updateActiveElements = react.useCallback(
|
|
4433
4447
|
(updater) => {
|
|
4434
4448
|
if (masterView?.target) {
|
|
4435
4449
|
applyMasterViewWrite(
|
|
4436
|
-
|
|
4450
|
+
chunkG3JPCRKN_js.replaceMasterViewElements(
|
|
4437
4451
|
masterView,
|
|
4438
4452
|
masterView.target,
|
|
4439
|
-
updater(
|
|
4453
|
+
updater(chunkG3JPCRKN_js.masterViewElements(masterView, masterView.target))
|
|
4440
4454
|
)
|
|
4441
4455
|
);
|
|
4442
4456
|
return;
|
|
@@ -4489,7 +4503,7 @@ function useSectionOperations(input) {
|
|
|
4489
4503
|
const { sections, setSections, slides, setSlides, markDirty } = input;
|
|
4490
4504
|
const addSection2 = react.useCallback(
|
|
4491
4505
|
(name, afterSlideIndex) => {
|
|
4492
|
-
const result =
|
|
4506
|
+
const result = chunkG3JPCRKN_js.addSection(sections, slides, name, afterSlideIndex);
|
|
4493
4507
|
setSlides(result.slides);
|
|
4494
4508
|
setSections(result.sections);
|
|
4495
4509
|
markDirty();
|
|
@@ -4498,7 +4512,7 @@ function useSectionOperations(input) {
|
|
|
4498
4512
|
);
|
|
4499
4513
|
const renameSection2 = react.useCallback(
|
|
4500
4514
|
(sectionId, newName) => {
|
|
4501
|
-
const result =
|
|
4515
|
+
const result = chunkG3JPCRKN_js.renameSection(sections, slides, sectionId, newName);
|
|
4502
4516
|
setSections(result.sections);
|
|
4503
4517
|
setSlides(result.slides);
|
|
4504
4518
|
markDirty();
|
|
@@ -4507,7 +4521,7 @@ function useSectionOperations(input) {
|
|
|
4507
4521
|
);
|
|
4508
4522
|
const deleteSection2 = react.useCallback(
|
|
4509
4523
|
(sectionId) => {
|
|
4510
|
-
const result =
|
|
4524
|
+
const result = chunkG3JPCRKN_js.deleteSection(sections, slides, sectionId);
|
|
4511
4525
|
setSections(result.sections);
|
|
4512
4526
|
setSlides(result.slides);
|
|
4513
4527
|
markDirty();
|
|
@@ -4516,21 +4530,21 @@ function useSectionOperations(input) {
|
|
|
4516
4530
|
);
|
|
4517
4531
|
const moveSectionUp2 = react.useCallback(
|
|
4518
4532
|
(sectionId) => {
|
|
4519
|
-
setSections(
|
|
4533
|
+
setSections(chunkG3JPCRKN_js.moveSectionUp(sections, sectionId));
|
|
4520
4534
|
markDirty();
|
|
4521
4535
|
},
|
|
4522
4536
|
[sections, setSections, markDirty]
|
|
4523
4537
|
);
|
|
4524
4538
|
const moveSectionDown2 = react.useCallback(
|
|
4525
4539
|
(sectionId) => {
|
|
4526
|
-
setSections(
|
|
4540
|
+
setSections(chunkG3JPCRKN_js.moveSectionDown(sections, sectionId));
|
|
4527
4541
|
markDirty();
|
|
4528
4542
|
},
|
|
4529
4543
|
[sections, setSections, markDirty]
|
|
4530
4544
|
);
|
|
4531
4545
|
const moveSlidesToSection2 = react.useCallback(
|
|
4532
4546
|
(slideIndexes, targetSectionId) => {
|
|
4533
|
-
const result =
|
|
4547
|
+
const result = chunkG3JPCRKN_js.moveSlidesToSection(sections, slides, slideIndexes, targetSectionId);
|
|
4534
4548
|
setSlides(result.slides);
|
|
4535
4549
|
setSections(result.sections);
|
|
4536
4550
|
markDirty();
|
|
@@ -4596,15 +4610,15 @@ function syncSelectionHandleOverlay(elementNode, elementId, geometry) {
|
|
|
4596
4610
|
// src/viewer/hooks/pointer-move-handlers.ts
|
|
4597
4611
|
function computeResizeGeometry(handle, startX, startY, startWidth, startHeight, dx, dy, snapToGrid, gridSpacingPx, lockAspect = false) {
|
|
4598
4612
|
const startBox = { x: startX, y: startY, width: startWidth, height: startHeight };
|
|
4599
|
-
let resized =
|
|
4613
|
+
let resized = chunkG3JPCRKN_js.applyResize(startBox, handle, dx, dy, 1, { minSize: chunkLBJAVP3H_js.MIN_ELEMENT_SIZE });
|
|
4600
4614
|
if (lockAspect) {
|
|
4601
|
-
resized =
|
|
4615
|
+
resized = chunkG3JPCRKN_js.lockResizeAspect(resized, startBox, handle, chunkLBJAVP3H_js.MIN_ELEMENT_SIZE);
|
|
4602
4616
|
}
|
|
4603
4617
|
const box = { x: resized.x, y: resized.y, width: resized.width, height: resized.height };
|
|
4604
4618
|
if (!snapToGrid) {
|
|
4605
4619
|
return box;
|
|
4606
4620
|
}
|
|
4607
|
-
return
|
|
4621
|
+
return chunkG3JPCRKN_js.snapBoxToGrid(box, handle, gridSpacingPx, chunkLBJAVP3H_js.MIN_ELEMENT_SIZE);
|
|
4608
4622
|
}
|
|
4609
4623
|
function resolveLiveTarget(input) {
|
|
4610
4624
|
const { livePatcher, editTemplateMode, activeSlide } = input;
|
|
@@ -4717,7 +4731,7 @@ function processDragMove(e, drag, editorScale, snapToGrid, snapToShape, gridSpac
|
|
|
4717
4731
|
width: el.width,
|
|
4718
4732
|
height: el.height
|
|
4719
4733
|
}));
|
|
4720
|
-
const snapResult =
|
|
4734
|
+
const snapResult = chunkG3JPCRKN_js.computeSnapToShape(
|
|
4721
4735
|
targetX,
|
|
4722
4736
|
targetY,
|
|
4723
4737
|
primaryEl.width,
|
|
@@ -4759,7 +4773,7 @@ function processDragMove(e, drag, editorScale, snapToGrid, snapToShape, gridSpac
|
|
|
4759
4773
|
if (live) {
|
|
4760
4774
|
for (const id of Object.keys(drag.startPositionsById)) {
|
|
4761
4775
|
const start = drag.startPositionsById[id];
|
|
4762
|
-
|
|
4776
|
+
chunkG3JPCRKN_js.publishLiveGeometry(live.patcher, live.slideId, id, {
|
|
4763
4777
|
x: start.x + appliedDx,
|
|
4764
4778
|
y: start.y + appliedDy
|
|
4765
4779
|
});
|
|
@@ -4791,8 +4805,8 @@ function processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx, live)
|
|
|
4791
4805
|
rs.lastY = geo.y;
|
|
4792
4806
|
rs.lastWidth = geo.width;
|
|
4793
4807
|
rs.lastHeight = geo.height;
|
|
4794
|
-
const width = Math.max(geo.width,
|
|
4795
|
-
const height = Math.max(geo.height,
|
|
4808
|
+
const width = Math.max(geo.width, chunkLBJAVP3H_js.MIN_ELEMENT_SIZE);
|
|
4809
|
+
const height = Math.max(geo.height, chunkLBJAVP3H_js.MIN_ELEMENT_SIZE);
|
|
4796
4810
|
if (rs.domEl) {
|
|
4797
4811
|
rs.domEl.style.left = `${geo.x}px`;
|
|
4798
4812
|
rs.domEl.style.top = `${geo.y}px`;
|
|
@@ -4801,7 +4815,7 @@ function processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx, live)
|
|
|
4801
4815
|
syncSelectionHandleOverlay(rs.domEl, rs.elementId, { x: geo.x, y: geo.y, width, height });
|
|
4802
4816
|
}
|
|
4803
4817
|
if (live) {
|
|
4804
|
-
|
|
4818
|
+
chunkG3JPCRKN_js.publishLiveGeometry(live.patcher, live.slideId, rs.elementId, {
|
|
4805
4819
|
x: geo.x,
|
|
4806
4820
|
y: geo.y,
|
|
4807
4821
|
width,
|
|
@@ -4812,7 +4826,7 @@ function processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx, live)
|
|
|
4812
4826
|
function processAdjustmentMove(e, adj, editorScale, updateElementById) {
|
|
4813
4827
|
const dx = (e.clientX - adj.startClientX) / editorScale;
|
|
4814
4828
|
const dy = (e.clientY - adj.startClientY) / editorScale;
|
|
4815
|
-
const adjustments =
|
|
4829
|
+
const adjustments = chunkG3JPCRKN_js.getDraggedShapeAdjustments(adj, dx, dy);
|
|
4816
4830
|
if (!adj.moved && Math.hypot(dx, dy) > 2) {
|
|
4817
4831
|
adj.moved = true;
|
|
4818
4832
|
}
|
|
@@ -4887,13 +4901,13 @@ function processPointerUp(input) {
|
|
|
4887
4901
|
if (i !== activeSlideIndex) {
|
|
4888
4902
|
return s;
|
|
4889
4903
|
}
|
|
4890
|
-
const rerouted =
|
|
4904
|
+
const rerouted = chunkG3JPCRKN_js.rerouteConnectorsForMovedElements(s.elements, movedIds);
|
|
4891
4905
|
if (rerouted.length === 0) {
|
|
4892
4906
|
return s;
|
|
4893
4907
|
}
|
|
4894
4908
|
return {
|
|
4895
4909
|
...s,
|
|
4896
|
-
elements:
|
|
4910
|
+
elements: chunkG3JPCRKN_js.applyReroutedConnectors(s.elements, rerouted)
|
|
4897
4911
|
};
|
|
4898
4912
|
})
|
|
4899
4913
|
);
|
|
@@ -4918,9 +4932,9 @@ function processPointerUp(input) {
|
|
|
4918
4932
|
}
|
|
4919
4933
|
function commitMarquee(marquee, editTemplateMode, templateElements, activeSlide, applySelection, clearSelection) {
|
|
4920
4934
|
const sourceElements = editTemplateMode ? templateElements : activeSlide?.elements ?? [];
|
|
4921
|
-
const hitIds =
|
|
4935
|
+
const hitIds = chunkG3JPCRKN_js.computeMarqueeHitIds(marquee, sourceElements);
|
|
4922
4936
|
if (marquee.additive) {
|
|
4923
|
-
const merged =
|
|
4937
|
+
const merged = chunkG3JPCRKN_js.mergeAdditiveSelection(marquee.baseSelectionIds, hitIds);
|
|
4924
4938
|
if (merged.length > 0) {
|
|
4925
4939
|
applySelection(merged[0], merged);
|
|
4926
4940
|
} else {
|
|
@@ -4943,8 +4957,8 @@ function commitDrag(drag, editTemplateMode, activeSlide, activeSlideIndex, setTe
|
|
|
4943
4957
|
}
|
|
4944
4958
|
return { ...el, x: start.x + dx, y: start.y + dy };
|
|
4945
4959
|
});
|
|
4946
|
-
const rerouted =
|
|
4947
|
-
return
|
|
4960
|
+
const rerouted = chunkG3JPCRKN_js.rerouteConnectorsForMovedElements(movedElements, movedIds);
|
|
4961
|
+
return chunkG3JPCRKN_js.applyReroutedConnectors(movedElements, rerouted);
|
|
4948
4962
|
};
|
|
4949
4963
|
if (editTemplateMode) {
|
|
4950
4964
|
const slideId = activeSlide?.id;
|
|
@@ -5100,12 +5114,12 @@ function useCanvasInteractions(input) {
|
|
|
5100
5114
|
return;
|
|
5101
5115
|
}
|
|
5102
5116
|
const el = elementLookup.get(editId);
|
|
5103
|
-
if (el &&
|
|
5117
|
+
if (el && chunkG3JPCRKN_js.hasTextProperties(el)) {
|
|
5104
5118
|
const committedText = transformCommittedText ? transformCommittedText(inlineEditingText) : inlineEditingText;
|
|
5105
|
-
const newSegments =
|
|
5119
|
+
const newSegments = chunkG3JPCRKN_js.remapTextToSegments(committedText, el.textSegments, el.textStyle);
|
|
5106
5120
|
const editorEl = document.querySelector("[data-inline-editor]");
|
|
5107
|
-
const newHeight =
|
|
5108
|
-
const shrink =
|
|
5121
|
+
const newHeight = chunkG3JPCRKN_js.resolveInlineEditAutoFitHeight(el.textStyle, el.height, editorEl);
|
|
5122
|
+
const shrink = chunkG3JPCRKN_js.resolveInlineEditNormAutofitShrink(el.textStyle, el.height, editorEl);
|
|
5109
5123
|
ops.updateElementById(editId, {
|
|
5110
5124
|
text: committedText,
|
|
5111
5125
|
textSegments: newSegments,
|
|
@@ -5124,7 +5138,7 @@ function useCanvasInteractions(input) {
|
|
|
5124
5138
|
setInlineEditingText("");
|
|
5125
5139
|
};
|
|
5126
5140
|
const openEquationEditorForElement = (el) => {
|
|
5127
|
-
if (!
|
|
5141
|
+
if (!chunkG3JPCRKN_js.hasTextProperties(el)) {
|
|
5128
5142
|
return false;
|
|
5129
5143
|
}
|
|
5130
5144
|
const eqSeg = el.textSegments?.find((seg) => seg.equationXml);
|
|
@@ -5154,7 +5168,7 @@ function useCanvasInteractions(input) {
|
|
|
5154
5168
|
justInteractedRef.current = false;
|
|
5155
5169
|
} else {
|
|
5156
5170
|
const el = elementLookup.get(elementId);
|
|
5157
|
-
if (el &&
|
|
5171
|
+
if (el && chunkG3JPCRKN_js.hasTextProperties(el) && chunkG3JPCRKN_js.canInteractWithElement(el, "textEdit")) {
|
|
5158
5172
|
if (!openEquationEditorForElement(el)) {
|
|
5159
5173
|
setInlineEditingElementId(elementId);
|
|
5160
5174
|
setInlineEditingText(el.text ?? "");
|
|
@@ -5173,7 +5187,7 @@ function useCanvasInteractions(input) {
|
|
|
5173
5187
|
if (openEquationEditorForElement(el)) {
|
|
5174
5188
|
return;
|
|
5175
5189
|
}
|
|
5176
|
-
if (
|
|
5190
|
+
if (chunkG3JPCRKN_js.hasTextProperties(el) && chunkG3JPCRKN_js.canInteractWithElement(el, "textEdit")) {
|
|
5177
5191
|
setInlineEditingElementId(elementId);
|
|
5178
5192
|
setInlineEditingText(el.text ?? "");
|
|
5179
5193
|
}
|
|
@@ -5196,7 +5210,7 @@ function useCanvasInteractions(input) {
|
|
|
5196
5210
|
justSelectedRef.current = false;
|
|
5197
5211
|
}
|
|
5198
5212
|
const ids = !wasSelected ? [elementId] : effectiveSelectedIds.length ? effectiveSelectedIds : [elementId];
|
|
5199
|
-
const movableIds =
|
|
5213
|
+
const movableIds = chunkG3JPCRKN_js.filterInteractableIds(ids, (id) => elementLookup.get(id), "move");
|
|
5200
5214
|
if (movableIds.length === 0) {
|
|
5201
5215
|
return;
|
|
5202
5216
|
}
|
|
@@ -5266,7 +5280,7 @@ function useCanvasInteractions(input) {
|
|
|
5266
5280
|
const handleResizePointerDown = (elementId, e, handle) => {
|
|
5267
5281
|
e.stopPropagation();
|
|
5268
5282
|
const el = elementLookup.get(elementId);
|
|
5269
|
-
if (!el || !
|
|
5283
|
+
if (!el || !chunkG3JPCRKN_js.canInteractWithElement(el, "resize")) {
|
|
5270
5284
|
return;
|
|
5271
5285
|
}
|
|
5272
5286
|
resizeStateRef.current = {
|
|
@@ -5288,7 +5302,7 @@ function useCanvasInteractions(input) {
|
|
|
5288
5302
|
};
|
|
5289
5303
|
const handleRotate = (elementId, rotationDeg) => {
|
|
5290
5304
|
const el = elementLookup.get(elementId);
|
|
5291
|
-
if (!el || !
|
|
5305
|
+
if (!el || !chunkG3JPCRKN_js.canInteractWithElement(el, "rotate")) {
|
|
5292
5306
|
return;
|
|
5293
5307
|
}
|
|
5294
5308
|
ops.updateElementById(elementId, { rotation: rotationDeg });
|
|
@@ -5308,10 +5322,10 @@ function useCanvasInteractions(input) {
|
|
|
5308
5322
|
const handleAdjustmentPointerDown = (elementId, e, descriptor) => {
|
|
5309
5323
|
e.stopPropagation();
|
|
5310
5324
|
const el = elementLookup.get(elementId);
|
|
5311
|
-
if (!el || !
|
|
5325
|
+
if (!el || !chunkG3JPCRKN_js.canInteractWithElement(el, "adjustHandle")) {
|
|
5312
5326
|
return;
|
|
5313
5327
|
}
|
|
5314
|
-
shapeAdjustmentDragStateRef.current =
|
|
5328
|
+
shapeAdjustmentDragStateRef.current = chunkG3JPCRKN_js.beginShapeAdjustment(
|
|
5315
5329
|
el,
|
|
5316
5330
|
descriptor,
|
|
5317
5331
|
e.clientX,
|
|
@@ -5358,7 +5372,7 @@ function createFileHandlers(deps) {
|
|
|
5358
5372
|
h = Math.round(h * scale);
|
|
5359
5373
|
}
|
|
5360
5374
|
addElement({
|
|
5361
|
-
id:
|
|
5375
|
+
id: chunkG3JPCRKN_js.generateElementId(),
|
|
5362
5376
|
type: "image",
|
|
5363
5377
|
x: Math.round((canvasSize.width - w) / 2),
|
|
5364
5378
|
y: Math.round((canvasSize.height - h) / 2),
|
|
@@ -5369,7 +5383,7 @@ function createFileHandlers(deps) {
|
|
|
5369
5383
|
};
|
|
5370
5384
|
img.onerror = () => {
|
|
5371
5385
|
addElement({
|
|
5372
|
-
id:
|
|
5386
|
+
id: chunkG3JPCRKN_js.generateElementId(),
|
|
5373
5387
|
type: "image",
|
|
5374
5388
|
x: 100,
|
|
5375
5389
|
y: 100,
|
|
@@ -5388,14 +5402,14 @@ function createFileHandlers(deps) {
|
|
|
5388
5402
|
return;
|
|
5389
5403
|
}
|
|
5390
5404
|
e.target.value = "";
|
|
5391
|
-
const mediaType =
|
|
5405
|
+
const mediaType = chunkG3JPCRKN_js.classifyMediaType(file.type);
|
|
5392
5406
|
if (!mediaType) {
|
|
5393
5407
|
return;
|
|
5394
5408
|
}
|
|
5395
5409
|
const elFilePath = file.path;
|
|
5396
5410
|
const insertMediaElement = (mediaSourceUrl, width, height) => {
|
|
5397
5411
|
addElement({
|
|
5398
|
-
id:
|
|
5412
|
+
id: chunkG3JPCRKN_js.generateElementId(),
|
|
5399
5413
|
type: "media",
|
|
5400
5414
|
mediaType,
|
|
5401
5415
|
mediaMimeType: file.type || void 0,
|
|
@@ -5570,13 +5584,13 @@ function createStructuredElementHandlers(deps) {
|
|
|
5570
5584
|
return;
|
|
5571
5585
|
}
|
|
5572
5586
|
addElement({
|
|
5573
|
-
id:
|
|
5587
|
+
id: chunkG3JPCRKN_js.generateElementId(),
|
|
5574
5588
|
type: "smartArt",
|
|
5575
5589
|
x: 100,
|
|
5576
5590
|
y: 120,
|
|
5577
5591
|
width: 600,
|
|
5578
5592
|
height: 340,
|
|
5579
|
-
smartArtData:
|
|
5593
|
+
smartArtData: chunkG3JPCRKN_js.buildSmartArtPresetData(
|
|
5580
5594
|
layout,
|
|
5581
5595
|
defaultItems,
|
|
5582
5596
|
(i) => `node-${Date.now()}-${i}-${Math.random().toString(36).slice(2, 8)}`
|
|
@@ -5588,7 +5602,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5588
5602
|
return;
|
|
5589
5603
|
}
|
|
5590
5604
|
addElement({
|
|
5591
|
-
id:
|
|
5605
|
+
id: chunkG3JPCRKN_js.generateElementId(),
|
|
5592
5606
|
type: "shape",
|
|
5593
5607
|
x: 120,
|
|
5594
5608
|
y: 200,
|
|
@@ -5626,7 +5640,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5626
5640
|
return;
|
|
5627
5641
|
}
|
|
5628
5642
|
const resolved = resolveHyperlinkEditResult(data);
|
|
5629
|
-
if (resolved.url && !
|
|
5643
|
+
if (resolved.url && !chunkG3JPCRKN_js.isUrlSafe(resolved.url)) {
|
|
5630
5644
|
return;
|
|
5631
5645
|
}
|
|
5632
5646
|
const actionClick = {
|
|
@@ -5650,7 +5664,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5650
5664
|
const displayText = value || fieldTexts[fieldType] || fieldType;
|
|
5651
5665
|
const fieldGuid = `{${crypto.randomUUID().toUpperCase()}}`;
|
|
5652
5666
|
addElement({
|
|
5653
|
-
id:
|
|
5667
|
+
id: chunkG3JPCRKN_js.generateElementId(),
|
|
5654
5668
|
type: "shape",
|
|
5655
5669
|
x: 120,
|
|
5656
5670
|
y: 200,
|
|
@@ -5672,11 +5686,11 @@ function createStructuredElementHandlers(deps) {
|
|
|
5672
5686
|
if (!activeSlide) {
|
|
5673
5687
|
return;
|
|
5674
5688
|
}
|
|
5675
|
-
const preset =
|
|
5689
|
+
const preset = chunkG3JPCRKN_js.ACTION_BUTTON_PRESETS.find((p) => p.shapeType === shapeType);
|
|
5676
5690
|
if (!preset) {
|
|
5677
5691
|
return;
|
|
5678
5692
|
}
|
|
5679
|
-
const defaultPptxAction =
|
|
5693
|
+
const defaultPptxAction = chunkG3JPCRKN_js.elementActionToPptxAction({
|
|
5680
5694
|
trigger: "click",
|
|
5681
5695
|
type: preset.defaultAction
|
|
5682
5696
|
});
|
|
@@ -5685,7 +5699,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5685
5699
|
defaultPptxAction.highlightClick = true;
|
|
5686
5700
|
}
|
|
5687
5701
|
addElement({
|
|
5688
|
-
id:
|
|
5702
|
+
id: chunkG3JPCRKN_js.generateElementId(),
|
|
5689
5703
|
type: "shape",
|
|
5690
5704
|
x: 150,
|
|
5691
5705
|
y: 150,
|
|
@@ -5752,14 +5766,14 @@ function useInsertElements(input) {
|
|
|
5752
5766
|
return;
|
|
5753
5767
|
}
|
|
5754
5768
|
addElement({
|
|
5755
|
-
id:
|
|
5769
|
+
id: chunkG3JPCRKN_js.generateElementId(),
|
|
5756
5770
|
type: "text",
|
|
5757
5771
|
x: 100,
|
|
5758
5772
|
y: 100,
|
|
5759
5773
|
width: 300,
|
|
5760
5774
|
height: 60,
|
|
5761
5775
|
text: "",
|
|
5762
|
-
textStyle: { fontSize:
|
|
5776
|
+
textStyle: { fontSize: chunkLBJAVP3H_js.DEFAULT_TEXT_FONT_SIZE }
|
|
5763
5777
|
});
|
|
5764
5778
|
};
|
|
5765
5779
|
const handleAddShape = () => {
|
|
@@ -5767,7 +5781,7 @@ function useInsertElements(input) {
|
|
|
5767
5781
|
return;
|
|
5768
5782
|
}
|
|
5769
5783
|
addElement({
|
|
5770
|
-
id:
|
|
5784
|
+
id: chunkG3JPCRKN_js.generateElementId(),
|
|
5771
5785
|
type: "shape",
|
|
5772
5786
|
x: 150,
|
|
5773
5787
|
y: 150,
|
|
@@ -5786,15 +5800,15 @@ function useInsertElements(input) {
|
|
|
5786
5800
|
return;
|
|
5787
5801
|
}
|
|
5788
5802
|
addElement({
|
|
5789
|
-
...
|
|
5790
|
-
id:
|
|
5803
|
+
...chunkG3JPCRKN_js.newTableElement(chunkLBJAVP3H_js.DEFAULT_TABLE_ROWS, chunkLBJAVP3H_js.DEFAULT_TABLE_COLUMNS, 100, 200),
|
|
5804
|
+
id: chunkG3JPCRKN_js.generateElementId()
|
|
5791
5805
|
});
|
|
5792
5806
|
};
|
|
5793
5807
|
const handleAddChart = (chartKind) => {
|
|
5794
5808
|
if (!activeSlide) {
|
|
5795
5809
|
return;
|
|
5796
5810
|
}
|
|
5797
|
-
addElement(
|
|
5811
|
+
addElement(chunkG3JPCRKN_js.createDefaultChartElement(chartKind));
|
|
5798
5812
|
};
|
|
5799
5813
|
const structured = createStructuredElementHandlers({
|
|
5800
5814
|
activeSlide,
|
|
@@ -5864,7 +5878,7 @@ function useClipboardHandlers(input) {
|
|
|
5864
5878
|
if (!selectedElement) {
|
|
5865
5879
|
return;
|
|
5866
5880
|
}
|
|
5867
|
-
setClipboardPayload(
|
|
5881
|
+
setClipboardPayload(chunkG3JPCRKN_js.buildElementClipboardPayload(selectedElement, editTemplateMode));
|
|
5868
5882
|
};
|
|
5869
5883
|
const handleDelete = () => {
|
|
5870
5884
|
const idsToDelete = effectiveSelectedIds;
|
|
@@ -5881,7 +5895,7 @@ function useClipboardHandlers(input) {
|
|
|
5881
5895
|
handleDelete();
|
|
5882
5896
|
};
|
|
5883
5897
|
const insertClone = (source) => {
|
|
5884
|
-
const clone =
|
|
5898
|
+
const clone = chunkG3JPCRKN_js.cloneElementForPaste(source, { intoTemplate: editTemplateMode });
|
|
5885
5899
|
ops.updateActiveElements((els) => [...els, clone]);
|
|
5886
5900
|
ops.applySelection(clone.id);
|
|
5887
5901
|
history.markDirty();
|
|
@@ -5916,7 +5930,7 @@ function resolveShapePath(el) {
|
|
|
5916
5930
|
return el.pathData;
|
|
5917
5931
|
}
|
|
5918
5932
|
if ("shapeType" in el && typeof el.shapeType === "string") {
|
|
5919
|
-
const clipPath =
|
|
5933
|
+
const clipPath = chunkG3JPCRKN_js.getPresetShapeClipPath(el.shapeType);
|
|
5920
5934
|
if (clipPath) {
|
|
5921
5935
|
const svgPath = clipPathToSvgPath(clipPath, el.width, el.height);
|
|
5922
5936
|
if (svgPath) {
|
|
@@ -5967,7 +5981,7 @@ function clipPathToSvgPath(clipPath, width, height) {
|
|
|
5967
5981
|
return parts.join(" ");
|
|
5968
5982
|
}
|
|
5969
5983
|
function transformPathToGlobal(pathData, el) {
|
|
5970
|
-
const polys =
|
|
5984
|
+
const polys = chunkG3JPCRKN_js.svgPathToPolygons(pathData);
|
|
5971
5985
|
if (polys.length === 0) {
|
|
5972
5986
|
return pathData;
|
|
5973
5987
|
}
|
|
@@ -5987,10 +6001,10 @@ function transformPathToGlobal(pathData, el) {
|
|
|
5987
6001
|
y: pt.y * scaleY + el.y
|
|
5988
6002
|
}))
|
|
5989
6003
|
);
|
|
5990
|
-
return
|
|
6004
|
+
return chunkG3JPCRKN_js.polygonsToSvgPath(transformed);
|
|
5991
6005
|
}
|
|
5992
6006
|
function transformPathToLocal(pathData, x, y, _width, _height) {
|
|
5993
|
-
const polys =
|
|
6007
|
+
const polys = chunkG3JPCRKN_js.svgPathToPolygons(pathData);
|
|
5994
6008
|
if (polys.length === 0) {
|
|
5995
6009
|
return pathData;
|
|
5996
6010
|
}
|
|
@@ -6000,10 +6014,10 @@ function transformPathToLocal(pathData, x, y, _width, _height) {
|
|
|
6000
6014
|
y: pt.y - y
|
|
6001
6015
|
}))
|
|
6002
6016
|
);
|
|
6003
|
-
return
|
|
6017
|
+
return chunkG3JPCRKN_js.polygonsToSvgPath(transformed);
|
|
6004
6018
|
}
|
|
6005
6019
|
function pathBounds(pathData) {
|
|
6006
|
-
const polys =
|
|
6020
|
+
const polys = chunkG3JPCRKN_js.svgPathToPolygons(pathData);
|
|
6007
6021
|
let minX = Infinity;
|
|
6008
6022
|
let minY = Infinity;
|
|
6009
6023
|
let maxX = -Infinity;
|
|
@@ -6062,7 +6076,7 @@ function useMergeShapesHandler(input) {
|
|
|
6062
6076
|
let allFragments = [];
|
|
6063
6077
|
let remaining = globalPaths[0];
|
|
6064
6078
|
for (let i = 1; i < globalPaths.length; i++) {
|
|
6065
|
-
const frags =
|
|
6079
|
+
const frags = chunkG3JPCRKN_js.mergeShapes("fragment", remaining, globalPaths[i]);
|
|
6066
6080
|
if (Array.isArray(frags)) {
|
|
6067
6081
|
allFragments = frags;
|
|
6068
6082
|
}
|
|
@@ -6091,7 +6105,7 @@ function useMergeShapesHandler(input) {
|
|
|
6091
6105
|
bounds.height
|
|
6092
6106
|
);
|
|
6093
6107
|
const newEl = {
|
|
6094
|
-
id:
|
|
6108
|
+
id: chunkG3JPCRKN_js.generateElementId(),
|
|
6095
6109
|
type: "shape",
|
|
6096
6110
|
x: bounds.x,
|
|
6097
6111
|
y: bounds.y,
|
|
@@ -6129,7 +6143,7 @@ function useMergeShapesHandler(input) {
|
|
|
6129
6143
|
} else {
|
|
6130
6144
|
let resultPath = globalPaths[0];
|
|
6131
6145
|
for (let i = 1; i < globalPaths.length; i++) {
|
|
6132
|
-
const result =
|
|
6146
|
+
const result = chunkG3JPCRKN_js.mergeShapes(operation, resultPath, globalPaths[i]);
|
|
6133
6147
|
if (typeof result === "string") {
|
|
6134
6148
|
resultPath = result;
|
|
6135
6149
|
}
|
|
@@ -6150,7 +6164,7 @@ function useMergeShapesHandler(input) {
|
|
|
6150
6164
|
);
|
|
6151
6165
|
const primary = targets[0];
|
|
6152
6166
|
const newEl = {
|
|
6153
|
-
id:
|
|
6167
|
+
id: chunkG3JPCRKN_js.generateElementId(),
|
|
6154
6168
|
type: "shape",
|
|
6155
6169
|
x: bounds.x,
|
|
6156
6170
|
y: bounds.y,
|
|
@@ -6213,10 +6227,10 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6213
6227
|
if (ids.length < 2 || !activeSlide) {
|
|
6214
6228
|
return;
|
|
6215
6229
|
}
|
|
6216
|
-
if (!selectedElements.every((el) =>
|
|
6230
|
+
if (!selectedElements.every((el) => chunkG3JPCRKN_js.canInteractWithElement(el, "group"))) {
|
|
6217
6231
|
return;
|
|
6218
6232
|
}
|
|
6219
|
-
const { elements, groupId } =
|
|
6233
|
+
const { elements, groupId } = chunkG3JPCRKN_js.groupElements(ops.activeElements, ids, chunkG3JPCRKN_js.generateElementId());
|
|
6220
6234
|
if (groupId === null) {
|
|
6221
6235
|
return;
|
|
6222
6236
|
}
|
|
@@ -6228,15 +6242,15 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6228
6242
|
if (!selectedElement || selectedElement.type !== "group" || !activeSlide) {
|
|
6229
6243
|
return;
|
|
6230
6244
|
}
|
|
6231
|
-
if (!
|
|
6245
|
+
if (!chunkG3JPCRKN_js.canInteractWithElement(selectedElement, "group")) {
|
|
6232
6246
|
return;
|
|
6233
6247
|
}
|
|
6234
6248
|
const group = selectedElement;
|
|
6235
|
-
const intoTemplate =
|
|
6249
|
+
const intoTemplate = chunkG3JPCRKN_js.isTemplateElementId(group.id);
|
|
6236
6250
|
const childIds = group.children.map(
|
|
6237
|
-
(child) => intoTemplate ?
|
|
6251
|
+
(child) => intoTemplate ? chunkG3JPCRKN_js.makeCloneId(true, child.id || group.id) : child.id || chunkG3JPCRKN_js.generateElementId()
|
|
6238
6252
|
);
|
|
6239
|
-
const { elements, childIds: usedIds } =
|
|
6253
|
+
const { elements, childIds: usedIds } = chunkG3JPCRKN_js.ungroupElements(
|
|
6240
6254
|
ops.activeElements,
|
|
6241
6255
|
group.id,
|
|
6242
6256
|
childIds,
|
|
@@ -6265,7 +6279,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6265
6279
|
if (!edge) {
|
|
6266
6280
|
return;
|
|
6267
6281
|
}
|
|
6268
|
-
const positions =
|
|
6282
|
+
const positions = chunkG3JPCRKN_js.alignElements(selectedElements, edge);
|
|
6269
6283
|
for (const [id, pos] of positions) {
|
|
6270
6284
|
const el = elementLookup.get(id);
|
|
6271
6285
|
if (!el) {
|
|
@@ -6283,7 +6297,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6283
6297
|
if (!distAxis) {
|
|
6284
6298
|
return;
|
|
6285
6299
|
}
|
|
6286
|
-
const positions =
|
|
6300
|
+
const positions = chunkG3JPCRKN_js.distributeElements(selectedElements, distAxis);
|
|
6287
6301
|
for (const [id, pos] of positions) {
|
|
6288
6302
|
const el = elementLookup.get(id);
|
|
6289
6303
|
if (!el) {
|
|
@@ -6294,14 +6308,14 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6294
6308
|
history.markDirty();
|
|
6295
6309
|
};
|
|
6296
6310
|
const canDistribute = selectedElements.length >= 3;
|
|
6297
|
-
const selectionGroupable = selectedElements.every((el) =>
|
|
6311
|
+
const selectionGroupable = selectedElements.every((el) => chunkG3JPCRKN_js.canInteractWithElement(el, "group"));
|
|
6298
6312
|
const handleMoveLayer = (direction) => {
|
|
6299
6313
|
if (!selectedElement || !activeSlide) {
|
|
6300
6314
|
return;
|
|
6301
6315
|
}
|
|
6302
6316
|
const id = selectedElement.id;
|
|
6303
6317
|
ops.updateActiveElements(
|
|
6304
|
-
(els) => direction === "forward" ?
|
|
6318
|
+
(els) => direction === "forward" ? chunkG3JPCRKN_js.bringForward(els, id) : direction === "backward" ? chunkG3JPCRKN_js.sendBackward(els, id) : els
|
|
6305
6319
|
);
|
|
6306
6320
|
history.markDirty();
|
|
6307
6321
|
};
|
|
@@ -6311,7 +6325,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6311
6325
|
}
|
|
6312
6326
|
const id = selectedElement.id;
|
|
6313
6327
|
ops.updateActiveElements(
|
|
6314
|
-
(els) => direction === "front" ?
|
|
6328
|
+
(els) => direction === "front" ? chunkG3JPCRKN_js.bringToFront(els, id) : chunkG3JPCRKN_js.sendToBack(els, id)
|
|
6315
6329
|
);
|
|
6316
6330
|
history.markDirty();
|
|
6317
6331
|
};
|
|
@@ -6445,7 +6459,7 @@ function useSlideManagement(input) {
|
|
|
6445
6459
|
theme
|
|
6446
6460
|
} = input;
|
|
6447
6461
|
const handleAddSlide = () => {
|
|
6448
|
-
const newSlide =
|
|
6462
|
+
const newSlide = chunkG3JPCRKN_js.createBlankSlide(slides.length + 1);
|
|
6449
6463
|
ops.updateSlides((prev) => {
|
|
6450
6464
|
const next = [...prev];
|
|
6451
6465
|
next.splice(activeSlideIndex + 1, 0, newSlide);
|
|
@@ -6508,7 +6522,7 @@ function useSlideManagement(input) {
|
|
|
6508
6522
|
}
|
|
6509
6523
|
const clone = {
|
|
6510
6524
|
...src,
|
|
6511
|
-
id:
|
|
6525
|
+
id: chunkG3JPCRKN_js.makeSlideId(),
|
|
6512
6526
|
elements: src.elements.map((el) => ({
|
|
6513
6527
|
...el,
|
|
6514
6528
|
id: `${el.id}-dup-${Math.random().toString(36).slice(2, 6)}`
|
|
@@ -6540,7 +6554,7 @@ function useSlideManagement(input) {
|
|
|
6540
6554
|
const handleInsertSlideFromLayout = (layoutPath, layoutName) => {
|
|
6541
6555
|
const insertAt = activeSlideIndex + 1;
|
|
6542
6556
|
const draft = {
|
|
6543
|
-
...
|
|
6557
|
+
...chunkG3JPCRKN_js.createBlankSlide(slides.length + 1),
|
|
6544
6558
|
layoutPath,
|
|
6545
6559
|
...layoutName ? { layoutName } : {}
|
|
6546
6560
|
};
|
|
@@ -6573,9 +6587,9 @@ function useSlideManagement(input) {
|
|
|
6573
6587
|
};
|
|
6574
6588
|
const handleInsertSlideFromTemplate = (templateId) => {
|
|
6575
6589
|
const insertAt = activeSlideIndex + 1;
|
|
6576
|
-
const draft =
|
|
6590
|
+
const draft = chunkG3JPCRKN_js.buildSlideTemplateSlide(templateId, chunkG3JPCRKN_js.makeSlideId(), slides.length + 1, {
|
|
6577
6591
|
...canvasSize ? { slideWidth: canvasSize.width, slideHeight: canvasSize.height } : {},
|
|
6578
|
-
scheme:
|
|
6592
|
+
scheme: chunkG3JPCRKN_js.templateSchemeFromTheme(theme?.colorScheme)
|
|
6579
6593
|
});
|
|
6580
6594
|
ops.updateSlides((prev) => insertSlideFromLayoutUpdater(prev, activeSlideIndex, draft));
|
|
6581
6595
|
setActiveSlideIndex(insertAt);
|
|
@@ -6612,7 +6626,7 @@ function createTableMergeHandlers(input) {
|
|
|
6612
6626
|
if (!nextCell || nextCell.hMerge || nextCell.vMerge) {
|
|
6613
6627
|
return;
|
|
6614
6628
|
}
|
|
6615
|
-
const newTableData =
|
|
6629
|
+
const newTableData = chunkG3JPCRKN_js.mergeCells(
|
|
6616
6630
|
[
|
|
6617
6631
|
{ row: rowIndex, col: columnIndex },
|
|
6618
6632
|
{ row: rowIndex, col: nextColIdx }
|
|
@@ -6620,7 +6634,7 @@ function createTableMergeHandlers(input) {
|
|
|
6620
6634
|
td
|
|
6621
6635
|
);
|
|
6622
6636
|
const updates = { tableData: newTableData };
|
|
6623
|
-
const newRawXml =
|
|
6637
|
+
const newRawXml = chunkG3JPCRKN_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6624
6638
|
if (newRawXml) {
|
|
6625
6639
|
updates.rawXml = newRawXml;
|
|
6626
6640
|
}
|
|
@@ -6646,7 +6660,7 @@ function createTableMergeHandlers(input) {
|
|
|
6646
6660
|
if (!targetNextCell || targetNextCell.hMerge || targetNextCell.vMerge) {
|
|
6647
6661
|
return;
|
|
6648
6662
|
}
|
|
6649
|
-
const newTableData =
|
|
6663
|
+
const newTableData = chunkG3JPCRKN_js.mergeCells(
|
|
6650
6664
|
[
|
|
6651
6665
|
{ row: rowIndex, col: columnIndex },
|
|
6652
6666
|
{ row: targetNextRowIdx, col: columnIndex }
|
|
@@ -6654,7 +6668,7 @@ function createTableMergeHandlers(input) {
|
|
|
6654
6668
|
td
|
|
6655
6669
|
);
|
|
6656
6670
|
const updates = { tableData: newTableData };
|
|
6657
|
-
const newRawXml =
|
|
6671
|
+
const newRawXml = chunkG3JPCRKN_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6658
6672
|
if (newRawXml) {
|
|
6659
6673
|
updates.rawXml = newRawXml;
|
|
6660
6674
|
}
|
|
@@ -6669,9 +6683,9 @@ function createTableMergeHandlers(input) {
|
|
|
6669
6683
|
return;
|
|
6670
6684
|
}
|
|
6671
6685
|
const td = selectedElement.tableData;
|
|
6672
|
-
const newTableData =
|
|
6686
|
+
const newTableData = chunkG3JPCRKN_js.mergeCells(ts.selectedCells, td);
|
|
6673
6687
|
const updates = { tableData: newTableData };
|
|
6674
|
-
const newRawXml =
|
|
6688
|
+
const newRawXml = chunkG3JPCRKN_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6675
6689
|
if (newRawXml) {
|
|
6676
6690
|
updates.rawXml = newRawXml;
|
|
6677
6691
|
}
|
|
@@ -6688,9 +6702,9 @@ function createTableMergeHandlers(input) {
|
|
|
6688
6702
|
}
|
|
6689
6703
|
const { rowIndex, columnIndex } = ts;
|
|
6690
6704
|
const td = selectedElement.tableData;
|
|
6691
|
-
const newTableData =
|
|
6705
|
+
const newTableData = chunkG3JPCRKN_js.splitCell(rowIndex, columnIndex, td);
|
|
6692
6706
|
const updates = { tableData: newTableData };
|
|
6693
|
-
const newRawXml =
|
|
6707
|
+
const newRawXml = chunkG3JPCRKN_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6694
6708
|
if (newRawXml) {
|
|
6695
6709
|
updates.rawXml = newRawXml;
|
|
6696
6710
|
}
|
|
@@ -6724,10 +6738,10 @@ function createTableStructHandlers(input) {
|
|
|
6724
6738
|
const text = transformCommittedText ? transformCommittedText(rawText) : rawText;
|
|
6725
6739
|
const updates = {};
|
|
6726
6740
|
if (el.tableData) {
|
|
6727
|
-
updates.tableData =
|
|
6741
|
+
updates.tableData = chunkG3JPCRKN_js.setCellText(el, rowIndex, colIndex, text).tableData;
|
|
6728
6742
|
}
|
|
6729
6743
|
if (el.rawXml) {
|
|
6730
|
-
const newRawXml =
|
|
6744
|
+
const newRawXml = chunkG3JPCRKN_js.updateCellTextInRawXml(el, rowIndex, colIndex, text);
|
|
6731
6745
|
if (newRawXml) {
|
|
6732
6746
|
updates.rawXml = newRawXml;
|
|
6733
6747
|
}
|
|
@@ -6751,7 +6765,7 @@ function createTableStructHandlers(input) {
|
|
|
6751
6765
|
const { rowIndex, columnIndex: colIndex } = ts;
|
|
6752
6766
|
const updates = {};
|
|
6753
6767
|
if (selectedElement.rawXml) {
|
|
6754
|
-
const newRawXml =
|
|
6768
|
+
const newRawXml = chunkG3JPCRKN_js.updateCellTextStyleInRawXml(
|
|
6755
6769
|
selectedElement,
|
|
6756
6770
|
rowIndex,
|
|
6757
6771
|
colIndex,
|
|
@@ -6815,9 +6829,9 @@ function createTableStructHandlers(input) {
|
|
|
6815
6829
|
return;
|
|
6816
6830
|
}
|
|
6817
6831
|
const rowIdx = ts?.rowIndex ?? 0;
|
|
6818
|
-
const newTableData =
|
|
6832
|
+
const newTableData = chunkG3JPCRKN_js.insertTableRow(selectedElement.tableData, rowIdx, position);
|
|
6819
6833
|
const updates = { tableData: newTableData };
|
|
6820
|
-
const newRawXml =
|
|
6834
|
+
const newRawXml = chunkG3JPCRKN_js.rebuildTableStructureInRawXml(selectedElement, newTableData);
|
|
6821
6835
|
if (newRawXml) {
|
|
6822
6836
|
updates.rawXml = newRawXml;
|
|
6823
6837
|
}
|
|
@@ -6830,12 +6844,12 @@ function createTableStructHandlers(input) {
|
|
|
6830
6844
|
}
|
|
6831
6845
|
const td = selectedElement.tableData;
|
|
6832
6846
|
const rowIdx = ts?.rowIndex ?? 0;
|
|
6833
|
-
const newTableData =
|
|
6847
|
+
const newTableData = chunkG3JPCRKN_js.deleteTableRow(td, rowIdx);
|
|
6834
6848
|
if (newTableData === td) {
|
|
6835
6849
|
return;
|
|
6836
6850
|
}
|
|
6837
6851
|
const updates = { tableData: newTableData };
|
|
6838
|
-
const newRawXml =
|
|
6852
|
+
const newRawXml = chunkG3JPCRKN_js.rebuildTableStructureInRawXml(selectedElement, newTableData);
|
|
6839
6853
|
if (newRawXml) {
|
|
6840
6854
|
updates.rawXml = newRawXml;
|
|
6841
6855
|
}
|
|
@@ -6847,9 +6861,9 @@ function createTableStructHandlers(input) {
|
|
|
6847
6861
|
return;
|
|
6848
6862
|
}
|
|
6849
6863
|
const colIdx = ts?.columnIndex ?? 0;
|
|
6850
|
-
const newTableData =
|
|
6864
|
+
const newTableData = chunkG3JPCRKN_js.insertTableColumn(selectedElement.tableData, colIdx, position);
|
|
6851
6865
|
const updates = { tableData: newTableData };
|
|
6852
|
-
const newRawXml =
|
|
6866
|
+
const newRawXml = chunkG3JPCRKN_js.rebuildTableStructureInRawXml(selectedElement, newTableData);
|
|
6853
6867
|
if (newRawXml) {
|
|
6854
6868
|
updates.rawXml = newRawXml;
|
|
6855
6869
|
}
|
|
@@ -6862,12 +6876,12 @@ function createTableStructHandlers(input) {
|
|
|
6862
6876
|
}
|
|
6863
6877
|
const td = selectedElement.tableData;
|
|
6864
6878
|
const colIdx = ts?.columnIndex ?? 0;
|
|
6865
|
-
const newTableData =
|
|
6879
|
+
const newTableData = chunkG3JPCRKN_js.deleteTableColumn(td, colIdx);
|
|
6866
6880
|
if (newTableData === td) {
|
|
6867
6881
|
return;
|
|
6868
6882
|
}
|
|
6869
6883
|
const updates = { tableData: newTableData };
|
|
6870
|
-
const newRawXml =
|
|
6884
|
+
const newRawXml = chunkG3JPCRKN_js.rebuildTableStructureInRawXml(selectedElement, newTableData);
|
|
6871
6885
|
if (newRawXml) {
|
|
6872
6886
|
updates.rawXml = newRawXml;
|
|
6873
6887
|
}
|
|
@@ -6903,8 +6917,8 @@ async function renderToCanvas(element, options = {}) {
|
|
|
6903
6917
|
return html2canvasPro(element, {
|
|
6904
6918
|
...options,
|
|
6905
6919
|
onclone: async (doc, clonedEl) => {
|
|
6906
|
-
await
|
|
6907
|
-
|
|
6920
|
+
await chunkG3JPCRKN_js.normalizeColorsForCapture(doc, clonedEl);
|
|
6921
|
+
chunkG3JPCRKN_js.preprocessCssForCapture(clonedEl);
|
|
6908
6922
|
if (typeof userOnClone === "function") {
|
|
6909
6923
|
userOnClone(doc, clonedEl);
|
|
6910
6924
|
}
|
|
@@ -6934,7 +6948,7 @@ function useExportSaveAs(input) {
|
|
|
6934
6948
|
slideSizeEmu
|
|
6935
6949
|
} = input;
|
|
6936
6950
|
const handleSaveAsFormat = async (format) => {
|
|
6937
|
-
const downloadName =
|
|
6951
|
+
const downloadName = chunkG3JPCRKN_js.savedPresentationFileName(filePath, format);
|
|
6938
6952
|
try {
|
|
6939
6953
|
const data = await serializeSlides(format);
|
|
6940
6954
|
if (!data) {
|
|
@@ -6943,16 +6957,16 @@ function useExportSaveAs(input) {
|
|
|
6943
6957
|
const blob = new Blob([data], {
|
|
6944
6958
|
type: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
6945
6959
|
});
|
|
6946
|
-
|
|
6960
|
+
chunkG3JPCRKN_js.downloadBlob(blob, downloadName);
|
|
6947
6961
|
} catch (err) {
|
|
6948
6962
|
console.error(`[PowerPointViewer] Save as .${format} failed:`, err);
|
|
6949
6963
|
}
|
|
6950
6964
|
};
|
|
6951
6965
|
const handleExportJson = () => {
|
|
6952
6966
|
const sourceName = filePath ? filePath.replace(/\\/gu, "/").split("/").pop() : void 0;
|
|
6953
|
-
const slideSize =
|
|
6967
|
+
const slideSize = chunkG3JPCRKN_js.resolveSlideSizeSelection({ current: slideSizeEmu, canvas: canvasSize }).size;
|
|
6954
6968
|
const data = {
|
|
6955
|
-
slides:
|
|
6969
|
+
slides: chunkG3JPCRKN_js.buildSaveSlides(slides, templateElementsBySlideId),
|
|
6956
6970
|
width: canvasSize.width,
|
|
6957
6971
|
height: canvasSize.height,
|
|
6958
6972
|
widthEmu: slideSize.widthEmu,
|
|
@@ -6971,7 +6985,7 @@ function useExportSaveAs(input) {
|
|
|
6971
6985
|
handoutMaster
|
|
6972
6986
|
};
|
|
6973
6987
|
try {
|
|
6974
|
-
|
|
6988
|
+
chunkG3JPCRKN_js.exportDeckJson(data, sourceName);
|
|
6975
6989
|
} catch (err) {
|
|
6976
6990
|
console.error("[PowerPointViewer] JSON export failed:", err);
|
|
6977
6991
|
}
|
|
@@ -7058,7 +7072,7 @@ async function exportSlideToPngBlob(slideElement, options = {}) {
|
|
|
7058
7072
|
}
|
|
7059
7073
|
async function exportSlideAsPng(slideElement, slideIndex, options = {}) {
|
|
7060
7074
|
const blob = await exportSlideToPngBlob(slideElement, options);
|
|
7061
|
-
|
|
7075
|
+
chunkG3JPCRKN_js.downloadBlob(blob, `slide-${slideIndex + 1}.png`);
|
|
7062
7076
|
}
|
|
7063
7077
|
async function copySlideToClipboard(slideElement, options = {}) {
|
|
7064
7078
|
const blob = await exportSlideToPngBlob(slideElement, options);
|
|
@@ -7080,15 +7094,15 @@ async function exportAllSlidesAsPdf(slideStageRef, totalSlides, setActiveSlide,
|
|
|
7080
7094
|
continue;
|
|
7081
7095
|
}
|
|
7082
7096
|
const canvas = await renderElementToCanvas(stageEl, scale);
|
|
7083
|
-
images.push(
|
|
7097
|
+
images.push(chunkG3JPCRKN_js.canvasToJpegData(canvas));
|
|
7084
7098
|
}
|
|
7085
7099
|
onProgress?.(totalSlides, totalSlides);
|
|
7086
7100
|
setActiveSlide(currentSlideIndex);
|
|
7087
7101
|
if (images.length === 0) {
|
|
7088
|
-
throw new Error(
|
|
7102
|
+
throw new Error(chunkTEVGDXVW_js.translationsEn["pptx.export.errorNoSlidesPdf"]);
|
|
7089
7103
|
}
|
|
7090
|
-
const pdfBlobUrl =
|
|
7091
|
-
|
|
7104
|
+
const pdfBlobUrl = chunkLBJAVP3H_js.buildPdfFromImageData(images);
|
|
7105
|
+
chunkG3JPCRKN_js.downloadDataUrl(pdfBlobUrl, filename);
|
|
7092
7106
|
}
|
|
7093
7107
|
async function captureAllSlidesAsPngDataUrls(slideStageRef, totalSlides, setActiveSlide, currentSlideIndex, options = {}) {
|
|
7094
7108
|
const { scale = 2, onProgress } = options;
|
|
@@ -7134,10 +7148,10 @@ async function exportAllSlidesAsNotesPdf(slideStageRef, totalSlides, setActiveSl
|
|
|
7134
7148
|
onProgress?.(totalSlides, totalSlides);
|
|
7135
7149
|
setActiveSlide(currentSlideIndex);
|
|
7136
7150
|
if (pages.length === 0) {
|
|
7137
|
-
throw new Error(
|
|
7151
|
+
throw new Error(chunkTEVGDXVW_js.translationsEn["pptx.export.errorNoSlidesNotesPdf"]);
|
|
7138
7152
|
}
|
|
7139
|
-
const pdfDataUrl =
|
|
7140
|
-
|
|
7153
|
+
const pdfDataUrl = chunkLBJAVP3H_js.buildNotesPdf(pages);
|
|
7154
|
+
chunkG3JPCRKN_js.downloadDataUrl(pdfDataUrl, filename);
|
|
7141
7155
|
}
|
|
7142
7156
|
|
|
7143
7157
|
// src/viewer/utils/export-video.ts
|
|
@@ -7168,7 +7182,7 @@ async function exportAllSlidesAsVideo(slideStageRef, totalSlides, setActiveSlide
|
|
|
7168
7182
|
}
|
|
7169
7183
|
setActiveSlide(currentSlideIndex);
|
|
7170
7184
|
if (slideCanvases.length === 0) {
|
|
7171
|
-
throw new Error(
|
|
7185
|
+
throw new Error(chunkTEVGDXVW_js.translationsEn["pptx.export.errorNoSlidesVideo"]);
|
|
7172
7186
|
}
|
|
7173
7187
|
const firstCanvas = slideCanvases[0];
|
|
7174
7188
|
const recordingCanvas = document.createElement("canvas");
|
|
@@ -7176,12 +7190,12 @@ async function exportAllSlidesAsVideo(slideStageRef, totalSlides, setActiveSlide
|
|
|
7176
7190
|
recordingCanvas.height = firstCanvas.height;
|
|
7177
7191
|
const ctx = recordingCanvas.getContext("2d");
|
|
7178
7192
|
if (!ctx) {
|
|
7179
|
-
throw new Error(
|
|
7193
|
+
throw new Error(chunkTEVGDXVW_js.translationsEn["pptx.export.errorNo2dContext"]);
|
|
7180
7194
|
}
|
|
7181
7195
|
const fps = 30;
|
|
7182
7196
|
const stream = recordingCanvas.captureStream(fps);
|
|
7183
7197
|
const recorder = new MediaRecorder(stream, {
|
|
7184
|
-
mimeType:
|
|
7198
|
+
mimeType: chunkG3JPCRKN_js.pickSupportedMimeType([...chunkG3JPCRKN_js.WEBM_MIME_CANDIDATES]),
|
|
7185
7199
|
videoBitsPerSecond: 5e6
|
|
7186
7200
|
});
|
|
7187
7201
|
const chunks = [];
|
|
@@ -7204,8 +7218,8 @@ async function exportAllSlidesAsVideo(slideStageRef, totalSlides, setActiveSlide
|
|
|
7204
7218
|
const duration = slideTimingsMs?.[i] ?? slideDurationMs;
|
|
7205
7219
|
ctx.clearRect(0, 0, recordingCanvas.width, recordingCanvas.height);
|
|
7206
7220
|
ctx.drawImage(slideCanvases[i], 0, 0);
|
|
7207
|
-
const frameInterval =
|
|
7208
|
-
const framesNeeded =
|
|
7221
|
+
const frameInterval = chunkG3JPCRKN_js.fpsToFrameIntervalMs(fps);
|
|
7222
|
+
const framesNeeded = chunkG3JPCRKN_js.segmentFrameCount(duration, fps);
|
|
7209
7223
|
for (let f = 0; f < framesNeeded; f++) {
|
|
7210
7224
|
if (signal?.aborted) {
|
|
7211
7225
|
recorder.stop();
|
|
@@ -7252,9 +7266,9 @@ async function exportAllSlidesAsGif(slideStageRef, totalSlides, setActiveSlide,
|
|
|
7252
7266
|
}
|
|
7253
7267
|
setActiveSlide(currentSlideIndex);
|
|
7254
7268
|
if (frames.length === 0) {
|
|
7255
|
-
throw new Error(
|
|
7269
|
+
throw new Error(chunkTEVGDXVW_js.translationsEn["pptx.export.errorNoSlidesGif"]);
|
|
7256
7270
|
}
|
|
7257
|
-
const gifBytes =
|
|
7271
|
+
const gifBytes = chunkG3JPCRKN_js.encodeGif(frames, Math.round(slideDurationMs / 10));
|
|
7258
7272
|
onProgress?.(totalSlides, totalSlides);
|
|
7259
7273
|
const buf = new ArrayBuffer(gifBytes.length);
|
|
7260
7274
|
new Uint8Array(buf).set(gifBytes);
|
|
@@ -7308,7 +7322,7 @@ function exportAllSlidesToSvg(data, options = {}) {
|
|
|
7308
7322
|
continue;
|
|
7309
7323
|
}
|
|
7310
7324
|
onProgress?.(processedCount, data.slides.length);
|
|
7311
|
-
let svg =
|
|
7325
|
+
let svg = chunkG3JPCRKN_js.SvgExporter.exportSlide(slide, data.width, data.height, svgOptions);
|
|
7312
7326
|
if (embedFonts && fontFaces?.length) {
|
|
7313
7327
|
svg = injectFontFaces(svg, fontFaces);
|
|
7314
7328
|
}
|
|
@@ -7409,21 +7423,21 @@ function useExportHandlers(input) {
|
|
|
7409
7423
|
{
|
|
7410
7424
|
scale: imageExportScale,
|
|
7411
7425
|
onProgress: (current, total) => {
|
|
7412
|
-
setExportProgress(
|
|
7413
|
-
setExportStatusMessage(
|
|
7426
|
+
setExportProgress(chunkG3JPCRKN_js.slideProgressPercent(current, total));
|
|
7427
|
+
setExportStatusMessage(chunkG3JPCRKN_js.slideStatusLabel("Rendering", current, total));
|
|
7414
7428
|
},
|
|
7415
7429
|
signal: abortCtrl.signal
|
|
7416
7430
|
}
|
|
7417
7431
|
);
|
|
7418
|
-
setExportProgress(
|
|
7432
|
+
setExportProgress(chunkG3JPCRKN_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7419
7433
|
setExportStatusMessage("Building PDF...");
|
|
7420
7434
|
await new Promise((r) => {
|
|
7421
7435
|
setTimeout(r, 100);
|
|
7422
7436
|
});
|
|
7423
|
-
setExportProgress(
|
|
7437
|
+
setExportProgress(chunkG3JPCRKN_js.EXPORT_DONE_PERCENT);
|
|
7424
7438
|
setExportStatusMessage("Done!");
|
|
7425
7439
|
} catch (err) {
|
|
7426
|
-
if (!
|
|
7440
|
+
if (!chunkG3JPCRKN_js.isExportAbortError(err)) {
|
|
7427
7441
|
console.error("[PowerPointViewer] PDF export failed:", err);
|
|
7428
7442
|
}
|
|
7429
7443
|
} finally {
|
|
@@ -7453,21 +7467,21 @@ function useExportHandlers(input) {
|
|
|
7453
7467
|
{
|
|
7454
7468
|
scale: imageExportScale,
|
|
7455
7469
|
onProgress: (current, total) => {
|
|
7456
|
-
setExportProgress(
|
|
7457
|
-
setExportStatusMessage(
|
|
7470
|
+
setExportProgress(chunkG3JPCRKN_js.slideProgressPercent(current, total));
|
|
7471
|
+
setExportStatusMessage(chunkG3JPCRKN_js.slideStatusLabel("Rendering", current, total));
|
|
7458
7472
|
},
|
|
7459
7473
|
signal: abortCtrl.signal
|
|
7460
7474
|
}
|
|
7461
7475
|
);
|
|
7462
|
-
setExportProgress(
|
|
7476
|
+
setExportProgress(chunkG3JPCRKN_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7463
7477
|
setExportStatusMessage("Building PDF...");
|
|
7464
7478
|
await new Promise((r) => {
|
|
7465
7479
|
setTimeout(r, 100);
|
|
7466
7480
|
});
|
|
7467
|
-
setExportProgress(
|
|
7481
|
+
setExportProgress(chunkG3JPCRKN_js.EXPORT_DONE_PERCENT);
|
|
7468
7482
|
setExportStatusMessage("Done!");
|
|
7469
7483
|
} catch (err) {
|
|
7470
|
-
if (!
|
|
7484
|
+
if (!chunkG3JPCRKN_js.isExportAbortError(err)) {
|
|
7471
7485
|
console.error("[PowerPointViewer] Notes PDF export failed:", err);
|
|
7472
7486
|
}
|
|
7473
7487
|
} finally {
|
|
@@ -7509,22 +7523,22 @@ function useExportHandlers(input) {
|
|
|
7509
7523
|
scale: 1,
|
|
7510
7524
|
slideDurationMs: 3e3,
|
|
7511
7525
|
onProgress: (current, total) => {
|
|
7512
|
-
setExportProgress(
|
|
7513
|
-
setExportStatusMessage(
|
|
7526
|
+
setExportProgress(chunkG3JPCRKN_js.slideProgressPercent(current, total, 45));
|
|
7527
|
+
setExportStatusMessage(chunkG3JPCRKN_js.slideStatusLabel("Capturing", current, total));
|
|
7514
7528
|
},
|
|
7515
7529
|
onRecordProgress: (current, total) => {
|
|
7516
|
-
setExportProgress(
|
|
7517
|
-
setExportStatusMessage(
|
|
7530
|
+
setExportProgress(chunkG3JPCRKN_js.recordProgressPercent(current, total));
|
|
7531
|
+
setExportStatusMessage(chunkG3JPCRKN_js.slideStatusLabel("Recording", current, total));
|
|
7518
7532
|
},
|
|
7519
7533
|
signal: abortCtrl.signal
|
|
7520
7534
|
}
|
|
7521
7535
|
);
|
|
7522
|
-
setExportProgress(
|
|
7536
|
+
setExportProgress(chunkG3JPCRKN_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7523
7537
|
setExportStatusMessage("Saving file...");
|
|
7524
|
-
|
|
7525
|
-
setExportProgress(
|
|
7538
|
+
chunkG3JPCRKN_js.downloadBlob(blob, "presentation.webm");
|
|
7539
|
+
setExportProgress(chunkG3JPCRKN_js.EXPORT_DONE_PERCENT);
|
|
7526
7540
|
} catch (err) {
|
|
7527
|
-
if (!
|
|
7541
|
+
if (!chunkG3JPCRKN_js.isExportAbortError(err)) {
|
|
7528
7542
|
console.error("[PowerPointViewer] Video export failed:", err);
|
|
7529
7543
|
}
|
|
7530
7544
|
} finally {
|
|
@@ -7552,18 +7566,18 @@ function useExportHandlers(input) {
|
|
|
7552
7566
|
scale: 0.5,
|
|
7553
7567
|
slideDurationMs: 2e3,
|
|
7554
7568
|
onProgress: (current, total) => {
|
|
7555
|
-
setExportProgress(
|
|
7556
|
-
setExportStatusMessage(
|
|
7569
|
+
setExportProgress(chunkG3JPCRKN_js.slideProgressPercent(current, total));
|
|
7570
|
+
setExportStatusMessage(chunkG3JPCRKN_js.slideStatusLabel("Encoding", current, total));
|
|
7557
7571
|
},
|
|
7558
7572
|
signal: abortCtrl.signal
|
|
7559
7573
|
}
|
|
7560
7574
|
);
|
|
7561
|
-
setExportProgress(
|
|
7575
|
+
setExportProgress(chunkG3JPCRKN_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7562
7576
|
setExportStatusMessage("Saving file...");
|
|
7563
|
-
|
|
7564
|
-
setExportProgress(
|
|
7577
|
+
chunkG3JPCRKN_js.downloadBlob(blob, "presentation.gif");
|
|
7578
|
+
setExportProgress(chunkG3JPCRKN_js.EXPORT_DONE_PERCENT);
|
|
7565
7579
|
} catch (err) {
|
|
7566
|
-
if (!
|
|
7580
|
+
if (!chunkG3JPCRKN_js.isExportAbortError(err)) {
|
|
7567
7581
|
console.error("[PowerPointViewer] GIF export failed:", err);
|
|
7568
7582
|
}
|
|
7569
7583
|
} finally {
|
|
@@ -7596,7 +7610,7 @@ function useExportHandlers(input) {
|
|
|
7596
7610
|
exportStatusMessage
|
|
7597
7611
|
};
|
|
7598
7612
|
}
|
|
7599
|
-
var ViewerOptionsContext = react.createContext(
|
|
7613
|
+
var ViewerOptionsContext = react.createContext(chunkG3JPCRKN_js.DEFAULT_VIEWER_OPTIONS);
|
|
7600
7614
|
function useViewerOptionsContext() {
|
|
7601
7615
|
return react.useContext(ViewerOptionsContext);
|
|
7602
7616
|
}
|
|
@@ -7608,13 +7622,13 @@ function usePrintHandlers(input) {
|
|
|
7608
7622
|
const { t } = reactI18next.useTranslation();
|
|
7609
7623
|
const viewerOptions = useViewerOptionsContext();
|
|
7610
7624
|
const includeHiddenSlides = viewerOptions.advanced.printHiddenSlides;
|
|
7611
|
-
const printRasterScale = (viewerOptions.advanced.printHighQuality ? 4 : 3) *
|
|
7625
|
+
const printRasterScale = (viewerOptions.advanced.printHighQuality ? 4 : 3) * chunkG3JPCRKN_js.resolveImageResolutionScale(viewerOptions);
|
|
7612
7626
|
const handlePrint = () => {
|
|
7613
7627
|
setIsPrintDialogOpen(true);
|
|
7614
7628
|
};
|
|
7615
7629
|
const handlePrintSvg = async (settings) => {
|
|
7616
7630
|
setIsPrintDialogOpen(false);
|
|
7617
|
-
const printWindow =
|
|
7631
|
+
const printWindow = chunkG3JPCRKN_js.openPendingPrintWindow(t("pptx.print.preparingToPrint"));
|
|
7618
7632
|
if (!printWindow) {
|
|
7619
7633
|
console.warn(
|
|
7620
7634
|
"[PowerPointViewer] Print window was blocked by the browser. Allow popups for this site to print."
|
|
@@ -7624,9 +7638,9 @@ function usePrintHandlers(input) {
|
|
|
7624
7638
|
if (!pptxData || settings.printWhat !== "slides") {
|
|
7625
7639
|
return runRasterPrint(printWindow, settings);
|
|
7626
7640
|
}
|
|
7627
|
-
const colorFilter =
|
|
7628
|
-
const slideIndices =
|
|
7629
|
-
|
|
7641
|
+
const colorFilter = chunkG3JPCRKN_js.computeColorFilter(settings.colorMode);
|
|
7642
|
+
const slideIndices = chunkG3JPCRKN_js.filterHiddenSlideIndices(
|
|
7643
|
+
chunkG3JPCRKN_js.computeSlideIndices(
|
|
7630
7644
|
settings.slideRange,
|
|
7631
7645
|
activeSlideIndex,
|
|
7632
7646
|
slides.length,
|
|
@@ -7644,22 +7658,22 @@ function usePrintHandlers(input) {
|
|
|
7644
7658
|
printWindow.close();
|
|
7645
7659
|
return;
|
|
7646
7660
|
}
|
|
7647
|
-
const printDoc =
|
|
7661
|
+
const printDoc = chunkG3JPCRKN_js.buildPrintDocument(svgs, pptxData.width, pptxData.height, {
|
|
7648
7662
|
title: "Slides (Vector)",
|
|
7649
7663
|
orientation: settings.orientation,
|
|
7650
7664
|
colorFilter,
|
|
7651
7665
|
scaleToFit: settings.scaleToFit
|
|
7652
7666
|
});
|
|
7653
|
-
|
|
7667
|
+
chunkG3JPCRKN_js.finishPrintWindow(printWindow, printDoc);
|
|
7654
7668
|
} catch (err) {
|
|
7655
7669
|
console.warn("[PowerPointViewer] SVG print path failed, falling back to raster:", err);
|
|
7656
7670
|
return runRasterPrint(printWindow, settings);
|
|
7657
7671
|
}
|
|
7658
7672
|
};
|
|
7659
7673
|
const runRasterPrint = async (printWindow, settings) => {
|
|
7660
|
-
const colorFilter =
|
|
7661
|
-
const slideIndices =
|
|
7662
|
-
|
|
7674
|
+
const colorFilter = chunkG3JPCRKN_js.computeColorFilter(settings.colorMode);
|
|
7675
|
+
const slideIndices = chunkG3JPCRKN_js.filterHiddenSlideIndices(
|
|
7676
|
+
chunkG3JPCRKN_js.computeSlideIndices(
|
|
7663
7677
|
settings.slideRange,
|
|
7664
7678
|
activeSlideIndex,
|
|
7665
7679
|
slides.length,
|
|
@@ -7670,11 +7684,11 @@ function usePrintHandlers(input) {
|
|
|
7670
7684
|
includeHiddenSlides
|
|
7671
7685
|
);
|
|
7672
7686
|
if (settings.printWhat === "outline") {
|
|
7673
|
-
|
|
7687
|
+
chunkG3JPCRKN_js.finishPrintWindow(
|
|
7674
7688
|
printWindow,
|
|
7675
|
-
|
|
7689
|
+
chunkG3JPCRKN_js.buildPrintHtmlDocument({
|
|
7676
7690
|
title: "Outline",
|
|
7677
|
-
bodyHtml: `<div class="outline-page">${
|
|
7691
|
+
bodyHtml: `<div class="outline-page">${chunkG3JPCRKN_js.buildOutlineHtml(slideIndices, slides)}</div>`,
|
|
7678
7692
|
orientation: settings.orientation,
|
|
7679
7693
|
colorFilter,
|
|
7680
7694
|
frameSlides: settings.frameSlides,
|
|
@@ -7701,11 +7715,11 @@ function usePrintHandlers(input) {
|
|
|
7701
7715
|
}
|
|
7702
7716
|
const slideImages = slideIndices.map((idx) => allImages[idx]).filter(Boolean);
|
|
7703
7717
|
if (settings.printWhat === "slides") {
|
|
7704
|
-
|
|
7718
|
+
chunkG3JPCRKN_js.finishPrintWindow(
|
|
7705
7719
|
printWindow,
|
|
7706
|
-
|
|
7720
|
+
chunkG3JPCRKN_js.buildPrintHtmlDocument({
|
|
7707
7721
|
title: "Slides",
|
|
7708
|
-
bodyHtml:
|
|
7722
|
+
bodyHtml: chunkG3JPCRKN_js.buildSlidesHtml(slideImages, slideIndices),
|
|
7709
7723
|
orientation: settings.orientation,
|
|
7710
7724
|
colorFilter,
|
|
7711
7725
|
frameSlides: settings.frameSlides,
|
|
@@ -7715,11 +7729,11 @@ function usePrintHandlers(input) {
|
|
|
7715
7729
|
return;
|
|
7716
7730
|
}
|
|
7717
7731
|
if (settings.printWhat === "notes") {
|
|
7718
|
-
|
|
7732
|
+
chunkG3JPCRKN_js.finishPrintWindow(
|
|
7719
7733
|
printWindow,
|
|
7720
|
-
|
|
7734
|
+
chunkG3JPCRKN_js.buildPrintHtmlDocument({
|
|
7721
7735
|
title: "Notes Pages",
|
|
7722
|
-
bodyHtml:
|
|
7736
|
+
bodyHtml: chunkG3JPCRKN_js.buildNotesHtml(slideImages, slideIndices, slides),
|
|
7723
7737
|
orientation: "portrait",
|
|
7724
7738
|
colorFilter,
|
|
7725
7739
|
frameSlides: settings.frameSlides,
|
|
@@ -7730,11 +7744,11 @@ function usePrintHandlers(input) {
|
|
|
7730
7744
|
}
|
|
7731
7745
|
if (settings.printWhat === "handouts") {
|
|
7732
7746
|
const spp = settings.slidesPerPage;
|
|
7733
|
-
|
|
7747
|
+
chunkG3JPCRKN_js.finishPrintWindow(
|
|
7734
7748
|
printWindow,
|
|
7735
|
-
|
|
7749
|
+
chunkG3JPCRKN_js.buildPrintHtmlDocument({
|
|
7736
7750
|
title: `Handout ${spp} per page`,
|
|
7737
|
-
bodyHtml:
|
|
7751
|
+
bodyHtml: chunkG3JPCRKN_js.buildHandoutsHtml(slideImages, slideIndices, spp, pptxData?.handoutMaster),
|
|
7738
7752
|
orientation: "portrait",
|
|
7739
7753
|
colorFilter,
|
|
7740
7754
|
frameSlides: settings.frameSlides,
|
|
@@ -7748,7 +7762,7 @@ function usePrintHandlers(input) {
|
|
|
7748
7762
|
};
|
|
7749
7763
|
const handlePrintWithSettings = async (settings) => {
|
|
7750
7764
|
setIsPrintDialogOpen(false);
|
|
7751
|
-
const printWindow =
|
|
7765
|
+
const printWindow = chunkG3JPCRKN_js.openPendingPrintWindow(t("pptx.print.preparingToPrint"));
|
|
7752
7766
|
if (!printWindow) {
|
|
7753
7767
|
console.warn(
|
|
7754
7768
|
"[PowerPointViewer] Print window was blocked by the browser. Allow popups for this site to print."
|
|
@@ -7813,13 +7827,13 @@ function useThemeHandlers(input) {
|
|
|
7813
7827
|
return;
|
|
7814
7828
|
}
|
|
7815
7829
|
await handler.updateThemeColorScheme(colorScheme);
|
|
7816
|
-
const previousMap = theme?.colorScheme ?
|
|
7817
|
-
setSlides((prev) =>
|
|
7830
|
+
const previousMap = theme?.colorScheme ? chunkG3JPCRKN_js.buildThemeColorMap(theme.colorScheme) : {};
|
|
7831
|
+
setSlides((prev) => chunkG3JPCRKN_js.reResolveSlideColors(prev, previousMap, colorScheme));
|
|
7818
7832
|
if (Object.keys(templateElementsBySlideId).length > 0) {
|
|
7819
7833
|
setTemplateElementsBySlideId((prev) => {
|
|
7820
7834
|
const next = {};
|
|
7821
7835
|
for (const [slideId, elements] of Object.entries(prev)) {
|
|
7822
|
-
next[slideId] =
|
|
7836
|
+
next[slideId] = chunkG3JPCRKN_js.reResolveElementColors(elements, previousMap, colorScheme);
|
|
7823
7837
|
}
|
|
7824
7838
|
return next;
|
|
7825
7839
|
});
|
|
@@ -7928,7 +7942,7 @@ function useThemeSwitching(input) {
|
|
|
7928
7942
|
}
|
|
7929
7943
|
try {
|
|
7930
7944
|
await handler.applyTheme(preset.colorScheme, preset.fontScheme, preset.name);
|
|
7931
|
-
const newData =
|
|
7945
|
+
const newData = chunkG3JPCRKN_js.applyThemeToData(data, preset.colorScheme, preset.fontScheme, preset.name);
|
|
7932
7946
|
onDataChange(newData);
|
|
7933
7947
|
onThemeChanged?.(preset);
|
|
7934
7948
|
} catch (error) {
|
|
@@ -7945,7 +7959,7 @@ function useThemeSwitching(input) {
|
|
|
7945
7959
|
}
|
|
7946
7960
|
try {
|
|
7947
7961
|
await handler.applyTheme(colorScheme, fontScheme ?? {}, themeName);
|
|
7948
|
-
const newData =
|
|
7962
|
+
const newData = chunkG3JPCRKN_js.applyThemeToData(data, colorScheme, fontScheme, themeName);
|
|
7949
7963
|
onDataChange(newData);
|
|
7950
7964
|
} catch (error) {
|
|
7951
7965
|
console.error("Failed to switch to custom theme:", error);
|
|
@@ -7957,12 +7971,12 @@ function useThemeSwitching(input) {
|
|
|
7957
7971
|
if (!data?.theme?.colorScheme) {
|
|
7958
7972
|
return void 0;
|
|
7959
7973
|
}
|
|
7960
|
-
return
|
|
7961
|
-
(p) =>
|
|
7974
|
+
return chunkG3JPCRKN_js.THEME_PRESETS.find(
|
|
7975
|
+
(p) => chunkG3JPCRKN_js.themeColorSchemesEqual(data.theme?.colorScheme, p.colorScheme)
|
|
7962
7976
|
);
|
|
7963
7977
|
}, [data?.theme?.colorScheme]);
|
|
7964
7978
|
return {
|
|
7965
|
-
presets:
|
|
7979
|
+
presets: chunkG3JPCRKN_js.THEME_PRESETS,
|
|
7966
7980
|
switchToPreset,
|
|
7967
7981
|
switchToCustom,
|
|
7968
7982
|
currentPreset
|
|
@@ -8037,7 +8051,7 @@ function usePropertyHandlers(input) {
|
|
|
8037
8051
|
}
|
|
8038
8052
|
try {
|
|
8039
8053
|
const ab = await file.arrayBuffer();
|
|
8040
|
-
const h = new
|
|
8054
|
+
const h = new chunkG3JPCRKN_js.PptxHandler();
|
|
8041
8055
|
const other = await h.load(ab);
|
|
8042
8056
|
if (!other) {
|
|
8043
8057
|
return;
|
|
@@ -8047,7 +8061,7 @@ function usePropertyHandlers(input) {
|
|
|
8047
8061
|
width: canvasSize.width,
|
|
8048
8062
|
height: canvasSize.height
|
|
8049
8063
|
};
|
|
8050
|
-
setCompareResult(
|
|
8064
|
+
setCompareResult(chunkG3JPCRKN_js.comparePresentation(cur, other));
|
|
8051
8065
|
setIsComparePanelOpen(true);
|
|
8052
8066
|
} catch (err) {
|
|
8053
8067
|
console.warn("Compare failed:", err);
|
|
@@ -8064,7 +8078,7 @@ function usePropertyHandlers(input) {
|
|
|
8064
8078
|
if (!diff || diff.status === "unchanged") {
|
|
8065
8079
|
return;
|
|
8066
8080
|
}
|
|
8067
|
-
setSlides((prev) =>
|
|
8081
|
+
setSlides((prev) => chunkG3JPCRKN_js.applyAcceptSlide(prev, diff));
|
|
8068
8082
|
setIsDirty(true);
|
|
8069
8083
|
},
|
|
8070
8084
|
[compareResult, setSlides, setIsDirty]
|
|
@@ -8075,10 +8089,10 @@ function usePropertyHandlers(input) {
|
|
|
8075
8089
|
if (!compareResult) {
|
|
8076
8090
|
return;
|
|
8077
8091
|
}
|
|
8078
|
-
setSlides((prev) =>
|
|
8092
|
+
setSlides((prev) => chunkG3JPCRKN_js.applyAcceptAllSlides(prev, compareResult));
|
|
8079
8093
|
setIsDirty(true);
|
|
8080
8094
|
}, [compareResult, setSlides, setIsDirty]);
|
|
8081
|
-
const usedFontFamilies = react.useMemo(() =>
|
|
8095
|
+
const usedFontFamilies = react.useMemo(() => chunkG3JPCRKN_js.collectUsedFonts(slides), [slides]);
|
|
8082
8096
|
return {
|
|
8083
8097
|
handleUpdateNotes,
|
|
8084
8098
|
handleUpdateSlide,
|
|
@@ -8233,7 +8247,7 @@ function useViewerDialogs(input) {
|
|
|
8233
8247
|
);
|
|
8234
8248
|
const embeddedFontKey = (embeddedFontFamilies ?? []).join("\0");
|
|
8235
8249
|
const fontEmbedding = react.useMemo(
|
|
8236
|
-
() =>
|
|
8250
|
+
() => chunkG3JPCRKN_js.describeFontEmbedding(embeddedFontKey ? embeddedFontKey.split("\0") : []),
|
|
8237
8251
|
[embeddedFontKey]
|
|
8238
8252
|
);
|
|
8239
8253
|
const [embedFontsEnabled, setEmbedFontsEnabled] = react.useState(fontEmbedding.initialEnabled);
|
|
@@ -8243,11 +8257,11 @@ function useViewerDialogs(input) {
|
|
|
8243
8257
|
setEmbedFontsEnabled(fontEmbedding.initialEnabled);
|
|
8244
8258
|
}
|
|
8245
8259
|
const [isNarrowViewport, setIsNarrowViewport] = react.useState(
|
|
8246
|
-
() => typeof window !== "undefined" ?
|
|
8260
|
+
() => typeof window !== "undefined" ? chunkG3JPCRKN_js.isMobileViewport(window.innerWidth, window.innerHeight, viewportIsTouch()) : false
|
|
8247
8261
|
);
|
|
8248
8262
|
react.useEffect(() => {
|
|
8249
8263
|
const handleWindow = () => setIsNarrowViewport(
|
|
8250
|
-
|
|
8264
|
+
chunkG3JPCRKN_js.isMobileViewport(window.innerWidth, window.innerHeight, viewportIsTouch())
|
|
8251
8265
|
);
|
|
8252
8266
|
window.addEventListener("resize", handleWindow);
|
|
8253
8267
|
return () => window.removeEventListener("resize", handleWindow);
|
|
@@ -8400,16 +8414,16 @@ function useViewerDialogs(input) {
|
|
|
8400
8414
|
};
|
|
8401
8415
|
}
|
|
8402
8416
|
function computeGridSpacingPx2(documentGridSpacing) {
|
|
8403
|
-
return
|
|
8417
|
+
return chunkG3JPCRKN_js.computeGridSpacingPx(documentGridSpacing, chunkLBJAVP3H_js.GRID_SIZE);
|
|
8404
8418
|
}
|
|
8405
8419
|
function computeVisibleSlideIndexes(slides, activeCustomShowId, customShows, presentationProperties) {
|
|
8406
8420
|
const activeShow = activeCustomShowId ? customShows.find((show) => show.id === activeCustomShowId) : void 0;
|
|
8407
|
-
const authoredRange =
|
|
8408
|
-
return
|
|
8421
|
+
const authoredRange = chunkG3JPCRKN_js.resolveAuthoredSlideRange(presentationProperties, slides.length);
|
|
8422
|
+
return chunkG3JPCRKN_js.resolveShowSlideIndexes(slides, activeShow, authoredRange);
|
|
8409
8423
|
}
|
|
8410
8424
|
function computeSlideSectionGroups(slides, sections) {
|
|
8411
|
-
return
|
|
8412
|
-
id: group.section?.id ?? (sections.length > 0 ?
|
|
8425
|
+
return chunkG3JPCRKN_js.groupSlidesBySection(sections, slides).map((group) => ({
|
|
8426
|
+
id: group.section?.id ?? (sections.length > 0 ? chunkLBJAVP3H_js.UNGROUPED_SECTION_ID : chunkLBJAVP3H_js.DEFAULT_SECTION_GROUP_ID),
|
|
8413
8427
|
label: group.section?.name ?? (sections.length > 0 ? "Ungrouped Slides" : "Slides"),
|
|
8414
8428
|
slideIndexes: group.slideIndexes,
|
|
8415
8429
|
...group.section?.color !== void 0 ? { color: group.section.color } : {},
|
|
@@ -8421,7 +8435,7 @@ function computeMasterPseudoSlide(mode, activeLayout, activeMaster) {
|
|
|
8421
8435
|
return void 0;
|
|
8422
8436
|
}
|
|
8423
8437
|
const document2 = activeLayout ? { slideMasters: [{ ...activeMaster, layouts: [activeLayout] }] } : { slideMasters: [activeMaster] };
|
|
8424
|
-
return
|
|
8438
|
+
return chunkG3JPCRKN_js.masterViewPseudoSlide(document2, {
|
|
8425
8439
|
tab: "slides",
|
|
8426
8440
|
masterIndex: 0,
|
|
8427
8441
|
layoutIndex: activeLayout ? 0 : null
|
|
@@ -8449,15 +8463,15 @@ function useDerivedSlideState(input) {
|
|
|
8449
8463
|
[slides, activeCustomShowId, customShows, presentationProperties]
|
|
8450
8464
|
);
|
|
8451
8465
|
const authoredRange = react.useMemo(
|
|
8452
|
-
() =>
|
|
8466
|
+
() => chunkG3JPCRKN_js.resolveAuthoredSlideRange(presentationProperties, slides.length),
|
|
8453
8467
|
[presentationProperties, slides.length]
|
|
8454
8468
|
);
|
|
8455
8469
|
const slideSectionGroups = react.useMemo(
|
|
8456
8470
|
() => computeSlideSectionGroups(slides, sections).map((group) => {
|
|
8457
|
-
if (group.id ===
|
|
8471
|
+
if (group.id === chunkLBJAVP3H_js.UNGROUPED_SECTION_ID && group.label === "Ungrouped Slides") {
|
|
8458
8472
|
return { ...group, label: t("pptx.slides.ungroupedSlides") };
|
|
8459
8473
|
}
|
|
8460
|
-
if (group.id ===
|
|
8474
|
+
if (group.id === chunkLBJAVP3H_js.DEFAULT_SECTION_GROUP_ID && group.label === "Slides") {
|
|
8461
8475
|
return { ...group, label: t("pptx.sections.slides") };
|
|
8462
8476
|
}
|
|
8463
8477
|
return group;
|
|
@@ -8558,13 +8572,13 @@ function useAnnotationHandlers(input) {
|
|
|
8558
8572
|
}, [annotations, setMode, setSlides, history]);
|
|
8559
8573
|
const handleSetMode = react.useCallback(
|
|
8560
8574
|
(nextMode) => {
|
|
8561
|
-
if (mode === "present" && nextMode !== "present" && !
|
|
8575
|
+
if (mode === "present" && nextMode !== "present" && !chunkG3JPCRKN_js.mayLeaveSlideShow()) {
|
|
8562
8576
|
return;
|
|
8563
8577
|
}
|
|
8564
8578
|
if (nextMode === "present") {
|
|
8565
8579
|
presentation.enterPresentMode();
|
|
8566
8580
|
} else if (mode === "present" && annotations.hasAnyAnnotations) {
|
|
8567
|
-
|
|
8581
|
+
chunkG3JPCRKN_js.stopAllPersistentAudio();
|
|
8568
8582
|
if (promptKeepInkAnnotations) {
|
|
8569
8583
|
pendingModeAfterAnnotationsRef.current = nextMode;
|
|
8570
8584
|
setShowKeepAnnotationsDialog(true);
|
|
@@ -8574,7 +8588,7 @@ function useAnnotationHandlers(input) {
|
|
|
8574
8588
|
}
|
|
8575
8589
|
} else {
|
|
8576
8590
|
if (mode === "present") {
|
|
8577
|
-
|
|
8591
|
+
chunkG3JPCRKN_js.stopAllPersistentAudio();
|
|
8578
8592
|
}
|
|
8579
8593
|
setMode(nextMode);
|
|
8580
8594
|
}
|
|
@@ -8643,13 +8657,13 @@ function useSerialize(input) {
|
|
|
8643
8657
|
let processedSlide = slide;
|
|
8644
8658
|
if (pendingEditId) {
|
|
8645
8659
|
const updatedElements = slide.elements.map((el) => {
|
|
8646
|
-
if (el.id !== pendingEditId || !
|
|
8660
|
+
if (el.id !== pendingEditId || !chunkG3JPCRKN_js.hasTextProperties(el)) {
|
|
8647
8661
|
return el;
|
|
8648
8662
|
}
|
|
8649
8663
|
return {
|
|
8650
8664
|
...el,
|
|
8651
8665
|
text: pendingEditText,
|
|
8652
|
-
textSegments:
|
|
8666
|
+
textSegments: chunkG3JPCRKN_js.remapTextToSegments(pendingEditText, el.textSegments, el.textStyle)
|
|
8653
8667
|
};
|
|
8654
8668
|
});
|
|
8655
8669
|
if (updatedElements.some((el, i) => el !== slide.elements[i])) {
|
|
@@ -8662,19 +8676,19 @@ function useSerialize(input) {
|
|
|
8662
8676
|
const pptxGuides = guides.map((g) => ({
|
|
8663
8677
|
id: g.id,
|
|
8664
8678
|
orientation: g.axis === "h" ? "horz" : "vert",
|
|
8665
|
-
positionEmu:
|
|
8679
|
+
positionEmu: chunkG3JPCRKN_js.guidePxToEmu(g.position)
|
|
8666
8680
|
}));
|
|
8667
8681
|
return {
|
|
8668
8682
|
...processedSlide,
|
|
8669
8683
|
guides: pptxGuides.length > 0 ? pptxGuides : void 0
|
|
8670
8684
|
};
|
|
8671
8685
|
});
|
|
8672
|
-
const slidesToSave =
|
|
8673
|
-
const saveOptions =
|
|
8686
|
+
const slidesToSave = chunkG3JPCRKN_js.buildSaveSlides(slidesWithGuides, templateElementsBySlideId);
|
|
8687
|
+
const saveOptions = chunkG3JPCRKN_js.buildDeckSaveOptions({
|
|
8674
8688
|
// Without this the Slide Size card edited a viewer-only pixel value and
|
|
8675
8689
|
// the saved `p:sldSz` never moved: passing `slideSize` is the only way a
|
|
8676
8690
|
// slide-size edit reaches the file.
|
|
8677
|
-
slideSize:
|
|
8691
|
+
slideSize: chunkG3JPCRKN_js.resolveSlideSizeSelection({ current: slideSizeEmu, canvas: canvasSize }).size,
|
|
8678
8692
|
headerFooter,
|
|
8679
8693
|
presentationProperties,
|
|
8680
8694
|
viewProperties,
|
|
@@ -8693,7 +8707,7 @@ function useSerialize(input) {
|
|
|
8693
8707
|
embedFonts,
|
|
8694
8708
|
outputFormat: format
|
|
8695
8709
|
});
|
|
8696
|
-
return
|
|
8710
|
+
return chunkG3JPCRKN_js.saveDeckWithPassword(handler, slidesToSave, saveOptions, { password, purpose });
|
|
8697
8711
|
},
|
|
8698
8712
|
[
|
|
8699
8713
|
slides,
|
|
@@ -8734,7 +8748,7 @@ function useRecoveryDetection(input) {
|
|
|
8734
8748
|
const onRestore = input.onRestore;
|
|
8735
8749
|
const openVersionHistory = input.openVersionHistory;
|
|
8736
8750
|
react.useEffect(() => {
|
|
8737
|
-
if (!
|
|
8751
|
+
if (!chunkG3JPCRKN_js.shouldProbeAutosaveRecovery({
|
|
8738
8752
|
alreadyChecked: recoveryCheckedRef.current,
|
|
8739
8753
|
filePath,
|
|
8740
8754
|
loading,
|
|
@@ -8746,7 +8760,7 @@ function useRecoveryDetection(input) {
|
|
|
8746
8760
|
}
|
|
8747
8761
|
recoveryCheckedRef.current = true;
|
|
8748
8762
|
void (async () => {
|
|
8749
|
-
const offer = await
|
|
8763
|
+
const offer = await chunkG3JPCRKN_js.probeAutosaveRecovery(filePath);
|
|
8750
8764
|
if (!offer) {
|
|
8751
8765
|
return;
|
|
8752
8766
|
}
|
|
@@ -8759,7 +8773,7 @@ function useRecoveryDetection(input) {
|
|
|
8759
8773
|
const record = recordRef.current;
|
|
8760
8774
|
setPrompt(null);
|
|
8761
8775
|
if (record && onRestore) {
|
|
8762
|
-
onRestore(
|
|
8776
|
+
onRestore(chunkG3JPCRKN_js.acceptAutosaveRecovery(record));
|
|
8763
8777
|
}
|
|
8764
8778
|
recordRef.current = null;
|
|
8765
8779
|
}, [onRestore]);
|
|
@@ -8768,7 +8782,7 @@ function useRecoveryDetection(input) {
|
|
|
8768
8782
|
setPrompt(null);
|
|
8769
8783
|
recordRef.current = null;
|
|
8770
8784
|
if (record) {
|
|
8771
|
-
void
|
|
8785
|
+
void chunkG3JPCRKN_js.discardAutosaveRecovery(record);
|
|
8772
8786
|
}
|
|
8773
8787
|
}, []);
|
|
8774
8788
|
return { prompt, restore, discard };
|
|
@@ -8779,6 +8793,8 @@ function usePresentationSetup(input) {
|
|
|
8779
8793
|
slides,
|
|
8780
8794
|
templateElementsBySlideId,
|
|
8781
8795
|
visibleSlideIndexes,
|
|
8796
|
+
canvasSize,
|
|
8797
|
+
themeColorMap,
|
|
8782
8798
|
activeSlideIndex,
|
|
8783
8799
|
containerRef,
|
|
8784
8800
|
content,
|
|
@@ -8808,15 +8824,17 @@ function usePresentationSetup(input) {
|
|
|
8808
8824
|
slides,
|
|
8809
8825
|
templateElementsBySlideId,
|
|
8810
8826
|
visibleSlideIndexes,
|
|
8827
|
+
canvasSize,
|
|
8828
|
+
themeColorMap,
|
|
8811
8829
|
activeSlideIndex,
|
|
8812
8830
|
containerRef,
|
|
8813
8831
|
content,
|
|
8814
8832
|
onSetMode: (nextMode) => {
|
|
8815
|
-
if (mode === "present" && nextMode !== "present" && !
|
|
8833
|
+
if (mode === "present" && nextMode !== "present" && !chunkG3JPCRKN_js.mayLeaveSlideShow()) {
|
|
8816
8834
|
return;
|
|
8817
8835
|
}
|
|
8818
8836
|
if (mode === "present" && nextMode !== "present") {
|
|
8819
|
-
|
|
8837
|
+
chunkG3JPCRKN_js.stopAllPersistentAudio();
|
|
8820
8838
|
stopAnimationSound();
|
|
8821
8839
|
const exitHandler = exitModeHandlerRef.current;
|
|
8822
8840
|
if (exitHandler) {
|
|
@@ -8884,10 +8902,10 @@ function usePresentationSetup(input) {
|
|
|
8884
8902
|
onToggleToolbar: () => annotations.setToolbarVisible(!annotations.toolbarVisible),
|
|
8885
8903
|
onToggleSubtitles,
|
|
8886
8904
|
onSaveRehearsalTimings: (timings) => {
|
|
8887
|
-
setSlides((prev) =>
|
|
8905
|
+
setSlides((prev) => chunkG3JPCRKN_js.applyRehearsalTimings(prev, timings));
|
|
8888
8906
|
history.markDirty();
|
|
8889
8907
|
},
|
|
8890
|
-
loopContinuously:
|
|
8908
|
+
loopContinuously: chunkG3JPCRKN_js.shouldLoopContinuously(presentationProperties),
|
|
8891
8909
|
showWithAnimation: presentationProperties.showWithAnimation,
|
|
8892
8910
|
useTimings: presentationProperties.advanceMode !== "manual",
|
|
8893
8911
|
endWithBlackSlide,
|
|
@@ -9093,7 +9111,7 @@ function useEditorOperations(input) {
|
|
|
9093
9111
|
const { formatPainterActive, setFormatPainterActive, elementLookup } = state;
|
|
9094
9112
|
react.useEffect(() => {
|
|
9095
9113
|
if (formatPainterActive && !prevFormatPainterRef.current && selectedElement) {
|
|
9096
|
-
copiedFormatRef.current =
|
|
9114
|
+
copiedFormatRef.current = chunkG3JPCRKN_js.copyFormatFromElement(selectedElement);
|
|
9097
9115
|
} else if (!formatPainterActive) {
|
|
9098
9116
|
copiedFormatRef.current = null;
|
|
9099
9117
|
}
|
|
@@ -9119,12 +9137,12 @@ function useEditorOperations(input) {
|
|
|
9119
9137
|
e.stopPropagation();
|
|
9120
9138
|
const element = elementLookup.get(elementId);
|
|
9121
9139
|
if (element) {
|
|
9122
|
-
const updated =
|
|
9140
|
+
const updated = chunkG3JPCRKN_js.applyFormatToElement(element, copiedFormatRef.current);
|
|
9123
9141
|
const updates = {};
|
|
9124
|
-
if (
|
|
9142
|
+
if (chunkG3JPCRKN_js.hasShapeProperties(updated)) {
|
|
9125
9143
|
updates.shapeStyle = updated.shapeStyle;
|
|
9126
9144
|
}
|
|
9127
|
-
if (
|
|
9145
|
+
if (chunkG3JPCRKN_js.hasTextProperties(updated)) {
|
|
9128
9146
|
updates.textStyle = updated.textStyle;
|
|
9129
9147
|
}
|
|
9130
9148
|
ops.updateElementById(elementId, updates);
|
|
@@ -9308,10 +9326,10 @@ function useFontInjection({ embeddedFonts, slides }) {
|
|
|
9308
9326
|
}
|
|
9309
9327
|
};
|
|
9310
9328
|
}, [embeddedFonts]);
|
|
9311
|
-
const referencedFamilies = react.useMemo(() =>
|
|
9329
|
+
const referencedFamilies = react.useMemo(() => chunkG3JPCRKN_js.collectReferencedFontFamilies(slides), [slides]);
|
|
9312
9330
|
react.useEffect(() => {
|
|
9313
9331
|
let cancelled = false;
|
|
9314
|
-
void
|
|
9332
|
+
void chunkG3JPCRKN_js.resolveGoogleWebfontHref(slides, embeddedFonts).then((href) => {
|
|
9315
9333
|
if (cancelled) {
|
|
9316
9334
|
return null;
|
|
9317
9335
|
}
|
|
@@ -9379,6 +9397,7 @@ function useContentLifecycle(input) {
|
|
|
9379
9397
|
onContentApplied,
|
|
9380
9398
|
allowExternalImages,
|
|
9381
9399
|
setReadOnlyRecommendation,
|
|
9400
|
+
setModifyVerifier,
|
|
9382
9401
|
setCompatToasts
|
|
9383
9402
|
} = input;
|
|
9384
9403
|
const { handlerRef } = useLoadContent({
|
|
@@ -9419,6 +9438,7 @@ function useContentLifecycle(input) {
|
|
|
9419
9438
|
setDigitalSignatureCount: state.setDigitalSignatureCount,
|
|
9420
9439
|
setGuides: state.setGuides,
|
|
9421
9440
|
setReadOnlyRecommendation,
|
|
9441
|
+
setModifyVerifier,
|
|
9422
9442
|
setCompatToasts,
|
|
9423
9443
|
setLoading: state.setLoading,
|
|
9424
9444
|
setError: state.setError,
|
|
@@ -9499,7 +9519,7 @@ function useKeyboardShortcuts(input) {
|
|
|
9499
9519
|
inputRef.current = input;
|
|
9500
9520
|
const handleKeyDown = react.useCallback((e) => {
|
|
9501
9521
|
const current = inputRef.current;
|
|
9502
|
-
const startAction =
|
|
9522
|
+
const startAction = chunkG3JPCRKN_js.mapSlideShowStartKey(e, { isPresenting: current.mode === "present" });
|
|
9503
9523
|
if (startAction !== null) {
|
|
9504
9524
|
e.preventDefault();
|
|
9505
9525
|
if (startAction === "fromBeginning") {
|
|
@@ -9509,7 +9529,7 @@ function useKeyboardShortcuts(input) {
|
|
|
9509
9529
|
}
|
|
9510
9530
|
return;
|
|
9511
9531
|
}
|
|
9512
|
-
const { action, dx, dy } =
|
|
9532
|
+
const { action, dx, dy } = chunkG3JPCRKN_js.mapEditorKey(e, {
|
|
9513
9533
|
canEdit: current.canEdit,
|
|
9514
9534
|
// The Slide Master view is an editing surface, not a viewing one.
|
|
9515
9535
|
// Gating on `mode !== 'edit'` alone made `mapEditorKey` return
|
|
@@ -9522,7 +9542,7 @@ function useKeyboardShortcuts(input) {
|
|
|
9522
9542
|
hasSelection: current.hasSelection,
|
|
9523
9543
|
isEditingText: Boolean(current.inlineEditingElementId || current.tableEditorState?.isEditing),
|
|
9524
9544
|
isDrawing: current.activeTool !== "select",
|
|
9525
|
-
isTextInputTarget:
|
|
9545
|
+
isTextInputTarget: chunkG3JPCRKN_js.isEditorTextInputTarget(e.target)
|
|
9526
9546
|
});
|
|
9527
9547
|
if (action === null) {
|
|
9528
9548
|
return;
|
|
@@ -9693,6 +9713,7 @@ function useViewerIntegration(input) {
|
|
|
9693
9713
|
autosaveIntervalMs,
|
|
9694
9714
|
allowExternalImages,
|
|
9695
9715
|
setReadOnlyRecommendation,
|
|
9716
|
+
setModifyVerifier,
|
|
9696
9717
|
setCompatToasts,
|
|
9697
9718
|
canEdit,
|
|
9698
9719
|
promptKeepInkAnnotations,
|
|
@@ -9764,6 +9785,7 @@ function useViewerIntegration(input) {
|
|
|
9764
9785
|
onContentApplied: () => setLoadVersion((v) => v + 1),
|
|
9765
9786
|
allowExternalImages,
|
|
9766
9787
|
setReadOnlyRecommendation,
|
|
9788
|
+
setModifyVerifier,
|
|
9767
9789
|
setCompatToasts
|
|
9768
9790
|
}
|
|
9769
9791
|
);
|
|
@@ -9850,7 +9872,7 @@ function useViewerIntegration(input) {
|
|
|
9850
9872
|
return zoom.scale;
|
|
9851
9873
|
},
|
|
9852
9874
|
setZoom(level) {
|
|
9853
|
-
zoom.setScale(
|
|
9875
|
+
zoom.setScale(chunkG3JPCRKN_js.clampZoomScale(level));
|
|
9854
9876
|
},
|
|
9855
9877
|
zoomIn() {
|
|
9856
9878
|
zoom.handleZoomIn();
|
|
@@ -10068,7 +10090,7 @@ function useReducedMotion() {
|
|
|
10068
10090
|
}
|
|
10069
10091
|
function useViewerOptions() {
|
|
10070
10092
|
const storeRef = react.useRef(null);
|
|
10071
|
-
storeRef.current ??=
|
|
10093
|
+
storeRef.current ??= chunkG3JPCRKN_js.createViewerOptionsStore();
|
|
10072
10094
|
const store = storeRef.current;
|
|
10073
10095
|
const options = react.useSyncExternalStore(
|
|
10074
10096
|
(onStoreChange) => store.subscribe(onStoreChange),
|
|
@@ -10077,9 +10099,9 @@ function useViewerOptions() {
|
|
|
10077
10099
|
);
|
|
10078
10100
|
return { optionsStore: store, options };
|
|
10079
10101
|
}
|
|
10080
|
-
var KNOWN_TAB_IDS = new Set(
|
|
10102
|
+
var KNOWN_TAB_IDS = new Set(chunkG3JPCRKN_js.TOOLBAR_TABS.map((tab) => tab.id));
|
|
10081
10103
|
function computeToolbarVisibility(hiddenActions, hiddenTabIds = []) {
|
|
10082
|
-
const isHidden = (id) =>
|
|
10104
|
+
const isHidden = (id) => chunkG3JPCRKN_js.isActionHidden(id, hiddenActions);
|
|
10083
10105
|
const userHidden = new Set(hiddenTabIds);
|
|
10084
10106
|
userHidden.delete("file");
|
|
10085
10107
|
const isTabVisible = (id) => !KNOWN_TAB_IDS.has(id) || !isHidden(id) && !userHidden.has(id);
|
|
@@ -10172,12 +10194,12 @@ function useYjsDocumentSync({
|
|
|
10172
10194
|
return;
|
|
10173
10195
|
}
|
|
10174
10196
|
try {
|
|
10175
|
-
const handler = new
|
|
10197
|
+
const handler = new chunkG3JPCRKN_js.PptxHandler();
|
|
10176
10198
|
await handler.load(sourceBytes.buffer);
|
|
10177
|
-
const currentSlides =
|
|
10199
|
+
const currentSlides = chunkG3JPCRKN_js.readSlidesFromYDoc(
|
|
10178
10200
|
doc
|
|
10179
10201
|
);
|
|
10180
|
-
const slidesToSave =
|
|
10202
|
+
const slidesToSave = chunkG3JPCRKN_js.buildSaveSlides(currentSlides, templateElementsBySlideId);
|
|
10181
10203
|
const bytes = await handler.save(slidesToSave, getSaveOptions?.());
|
|
10182
10204
|
config.onWriteBack(bytes);
|
|
10183
10205
|
} catch {
|
|
@@ -10192,10 +10214,10 @@ function useYjsDocumentSync({
|
|
|
10192
10214
|
if (!doc || !isConnected) {
|
|
10193
10215
|
return;
|
|
10194
10216
|
}
|
|
10195
|
-
const docSlides =
|
|
10217
|
+
const docSlides = chunkG3JPCRKN_js.readSlidesFromYDoc(
|
|
10196
10218
|
doc
|
|
10197
10219
|
);
|
|
10198
|
-
if (!
|
|
10220
|
+
if (!chunkG3JPCRKN_js.shouldRoomSlidesReplaceLoad(loadOrigin, docSlides.length)) {
|
|
10199
10221
|
return;
|
|
10200
10222
|
}
|
|
10201
10223
|
lastSyncedRef.current = JSON.stringify(docSlides);
|
|
@@ -10214,11 +10236,11 @@ function useYjsDocumentSync({
|
|
|
10214
10236
|
lastSyncedRef.current = serialized;
|
|
10215
10237
|
void (async () => {
|
|
10216
10238
|
const factories = await getFactories();
|
|
10217
|
-
|
|
10239
|
+
chunkG3JPCRKN_js.reconcileSlidesInYDoc(
|
|
10218
10240
|
slides,
|
|
10219
10241
|
doc,
|
|
10220
10242
|
factories,
|
|
10221
|
-
|
|
10243
|
+
chunkG3JPCRKN_js.LOCAL_SYNC_ORIGIN
|
|
10222
10244
|
);
|
|
10223
10245
|
scheduleWriteBack();
|
|
10224
10246
|
})();
|
|
@@ -10232,10 +10254,10 @@ function useYjsDocumentSync({
|
|
|
10232
10254
|
return;
|
|
10233
10255
|
}
|
|
10234
10256
|
const handleChange = (_events, transaction) => {
|
|
10235
|
-
if (transaction?.origin ===
|
|
10257
|
+
if (transaction?.origin === chunkG3JPCRKN_js.LOCAL_SYNC_ORIGIN) {
|
|
10236
10258
|
return;
|
|
10237
10259
|
}
|
|
10238
|
-
const remoteSlides =
|
|
10260
|
+
const remoteSlides = chunkG3JPCRKN_js.readSlidesFromYDoc(
|
|
10239
10261
|
doc
|
|
10240
10262
|
);
|
|
10241
10263
|
if (remoteSlides.length === 0) {
|
|
@@ -10251,7 +10273,7 @@ function useYjsDocumentSync({
|
|
|
10251
10273
|
isApplyingRemoteRef.current = false;
|
|
10252
10274
|
scheduleWriteBack();
|
|
10253
10275
|
};
|
|
10254
|
-
const unobserve =
|
|
10276
|
+
const unobserve = chunkG3JPCRKN_js.observeYDocSlides(
|
|
10255
10277
|
doc,
|
|
10256
10278
|
handleChange
|
|
10257
10279
|
);
|
|
@@ -10289,7 +10311,7 @@ function useBroadcastFollower({
|
|
|
10289
10311
|
if (!broadcaster) {
|
|
10290
10312
|
return;
|
|
10291
10313
|
}
|
|
10292
|
-
if (!
|
|
10314
|
+
if (!chunkG3JPCRKN_js.shouldAutoFollowBroadcaster({
|
|
10293
10315
|
localRole: collab.config.role,
|
|
10294
10316
|
broadcasterRole: broadcaster.role
|
|
10295
10317
|
})) {
|
|
@@ -10460,7 +10482,7 @@ function subscribeTouchCapability(callback) {
|
|
|
10460
10482
|
function useIsMobile() {
|
|
10461
10483
|
const isTouchDevice = react.useSyncExternalStore(
|
|
10462
10484
|
subscribeTouchCapability,
|
|
10463
|
-
|
|
10485
|
+
chunkG3JPCRKN_js.detectTouchDevice,
|
|
10464
10486
|
() => false
|
|
10465
10487
|
// server snapshot
|
|
10466
10488
|
);
|
|
@@ -10470,7 +10492,7 @@ function useIsMobile() {
|
|
|
10470
10492
|
const [viewportHeight, setViewportHeight] = react.useState(
|
|
10471
10493
|
() => typeof window === "undefined" ? 768 : window.innerHeight
|
|
10472
10494
|
);
|
|
10473
|
-
const [orientation, setOrientation] = react.useState(
|
|
10495
|
+
const [orientation, setOrientation] = react.useState(chunkG3JPCRKN_js.detectOrientation);
|
|
10474
10496
|
const [isVirtualKeyboardOpen, setIsVirtualKeyboardOpen] = react.useState(false);
|
|
10475
10497
|
const [initialViewportHeight] = react.useState(
|
|
10476
10498
|
() => typeof window !== "undefined" ? window.innerHeight : 800
|
|
@@ -10491,7 +10513,7 @@ function useIsMobile() {
|
|
|
10491
10513
|
return;
|
|
10492
10514
|
}
|
|
10493
10515
|
const handleOrientationChange = () => {
|
|
10494
|
-
setOrientation(
|
|
10516
|
+
setOrientation(chunkG3JPCRKN_js.detectOrientation());
|
|
10495
10517
|
};
|
|
10496
10518
|
if (screen.orientation) {
|
|
10497
10519
|
screen.orientation.addEventListener("change", handleOrientationChange);
|
|
@@ -10521,7 +10543,7 @@ function useIsMobile() {
|
|
|
10521
10543
|
window.addEventListener("resize", handleResize);
|
|
10522
10544
|
return () => window.removeEventListener("resize", handleResize);
|
|
10523
10545
|
}, [isTouchDevice, initialViewportHeight]);
|
|
10524
|
-
const { isMobile, isTablet, isDesktop } =
|
|
10546
|
+
const { isMobile, isTablet, isDesktop } = chunkG3JPCRKN_js.deriveViewportBreakpoints(
|
|
10525
10547
|
viewportWidth,
|
|
10526
10548
|
viewportHeight,
|
|
10527
10549
|
isTouchDevice
|
|
@@ -10552,10 +10574,10 @@ function useTouchGestures(input) {
|
|
|
10552
10574
|
if (!el || !enabled) {
|
|
10553
10575
|
return;
|
|
10554
10576
|
}
|
|
10555
|
-
const recognizer =
|
|
10577
|
+
const recognizer = chunkG3JPCRKN_js.createTouchGestureRecognizer({
|
|
10556
10578
|
getScale: () => scaleRef.current,
|
|
10557
|
-
minScale:
|
|
10558
|
-
maxScale:
|
|
10579
|
+
minScale: chunkG3JPCRKN_js.MIN_ZOOM_SCALE,
|
|
10580
|
+
maxScale: chunkG3JPCRKN_js.MAX_ZOOM_SCALE,
|
|
10559
10581
|
callbacks: {
|
|
10560
10582
|
onPinchZoom: (newScale) => callbacksRef.current.onPinchZoom?.(newScale),
|
|
10561
10583
|
onSwipe: (direction) => callbacksRef.current.onSwipe?.(direction),
|
|
@@ -10595,7 +10617,7 @@ function scrollFocusedIntoView(keyboardInset) {
|
|
|
10595
10617
|
return;
|
|
10596
10618
|
}
|
|
10597
10619
|
const rect = active.getBoundingClientRect();
|
|
10598
|
-
const delta =
|
|
10620
|
+
const delta = chunkG3JPCRKN_js.computeScrollDelta(
|
|
10599
10621
|
{ top: rect.top, bottom: rect.bottom },
|
|
10600
10622
|
window.innerHeight,
|
|
10601
10623
|
keyboardInset
|
|
@@ -10615,8 +10637,8 @@ function useKeyboardInsets(enabled = true) {
|
|
|
10615
10637
|
return;
|
|
10616
10638
|
}
|
|
10617
10639
|
const update = () => {
|
|
10618
|
-
const metrics =
|
|
10619
|
-
const inset = metrics ?
|
|
10640
|
+
const metrics = chunkG3JPCRKN_js.readViewportMetrics(window);
|
|
10641
|
+
const inset = metrics ? chunkG3JPCRKN_js.computeKeyboardInset(metrics) : 0;
|
|
10620
10642
|
setKeyboardInset(inset);
|
|
10621
10643
|
if (inset > 0) {
|
|
10622
10644
|
window.requestAnimationFrame(() => scrollFocusedIntoView(inset));
|
|
@@ -10627,8 +10649,8 @@ function useKeyboardInsets(enabled = true) {
|
|
|
10627
10649
|
vv.addEventListener("scroll", update);
|
|
10628
10650
|
const onFocusIn = () => {
|
|
10629
10651
|
window.requestAnimationFrame(() => {
|
|
10630
|
-
const metrics =
|
|
10631
|
-
const inset = metrics ?
|
|
10652
|
+
const metrics = chunkG3JPCRKN_js.readViewportMetrics(window);
|
|
10653
|
+
const inset = metrics ? chunkG3JPCRKN_js.computeKeyboardInset(metrics) : 0;
|
|
10632
10654
|
if (inset > 0) {
|
|
10633
10655
|
scrollFocusedIntoView(inset);
|
|
10634
10656
|
}
|
|
@@ -10641,7 +10663,7 @@ function useKeyboardInsets(enabled = true) {
|
|
|
10641
10663
|
document.removeEventListener("focusin", onFocusIn);
|
|
10642
10664
|
};
|
|
10643
10665
|
}, [enabled]);
|
|
10644
|
-
return { keyboardInset, isKeyboardOpen:
|
|
10666
|
+
return { keyboardInset, isKeyboardOpen: chunkG3JPCRKN_js.isKeyboardOpen(keyboardInset) };
|
|
10645
10667
|
}
|
|
10646
10668
|
|
|
10647
10669
|
// src/viewer/hooks/useViewerBuildingBlocks-canvas-props.ts
|
|
@@ -10670,21 +10692,21 @@ function buildCanvasProps(input) {
|
|
|
10670
10692
|
} = input;
|
|
10671
10693
|
const effectiveSlide = mode === "master" ? masterPseudoSlide : activeSlide;
|
|
10672
10694
|
const effectiveTemplateElements = mode === "master" ? s.activeLayout ? s.activeMaster?.elements ?? [] : [] : templateElements;
|
|
10673
|
-
const fieldContext =
|
|
10695
|
+
const fieldContext = chunkG3JPCRKN_js.buildFieldSubstitutionContext({
|
|
10674
10696
|
headerFooter: s.headerFooter,
|
|
10675
10697
|
customProperties: s.customProperties,
|
|
10676
10698
|
slide: activeSlide
|
|
10677
10699
|
});
|
|
10678
10700
|
const tableStyleContext = s.theme || s.tableStyleMap ? { theme: s.theme, tableStyleMap: s.tableStyleMap } : void 0;
|
|
10679
10701
|
const openExternalUrl = (url, target) => {
|
|
10680
|
-
if (
|
|
10702
|
+
if (chunkG3JPCRKN_js.shouldConfirmExternalHyperlink(viewerOptions, url) && !window.confirm(buildHyperlinkConfirmMessage(url))) {
|
|
10681
10703
|
return;
|
|
10682
10704
|
}
|
|
10683
|
-
|
|
10705
|
+
chunkG3JPCRKN_js.safeOpenUrl(url, target);
|
|
10684
10706
|
};
|
|
10685
10707
|
const handleActionClick = (elementId, action) => {
|
|
10686
10708
|
if (mode === "present") {
|
|
10687
|
-
const resolved =
|
|
10709
|
+
const resolved = chunkG3JPCRKN_js.resolvePresentationAction(action, { slideCount: slides.length });
|
|
10688
10710
|
if (resolved.intent.kind === "openUrl") {
|
|
10689
10711
|
openExternalUrl(resolved.intent.url);
|
|
10690
10712
|
return;
|
|
@@ -10695,9 +10717,9 @@ function buildCanvasProps(input) {
|
|
|
10695
10717
|
}
|
|
10696
10718
|
};
|
|
10697
10719
|
const handleHyperlinkClick = (url, target) => {
|
|
10698
|
-
if (
|
|
10720
|
+
if (chunkG3JPCRKN_js.isPpactionUrl(url)) {
|
|
10699
10721
|
if (mode === "present") {
|
|
10700
|
-
const parsed =
|
|
10722
|
+
const parsed = chunkG3JPCRKN_js.parsePpactionUrl(url);
|
|
10701
10723
|
if (parsed) {
|
|
10702
10724
|
presentation.handlePresentationAction({
|
|
10703
10725
|
action: parsed.action,
|
|
@@ -10803,7 +10825,7 @@ function buildCanvasProps(input) {
|
|
|
10803
10825
|
|
|
10804
10826
|
// src/viewer/hooks/useScopedLayoutOptions.ts
|
|
10805
10827
|
function scopeLayoutOptionsToActiveSlide(options, activeSlide) {
|
|
10806
|
-
return
|
|
10828
|
+
return chunkG3JPCRKN_js.scopeLayoutOptionsToSlide(options, activeSlide?.layoutPath);
|
|
10807
10829
|
}
|
|
10808
10830
|
|
|
10809
10831
|
// src/viewer/hooks/useViewerBuildingBlocks-toolbar-handlers.ts
|
|
@@ -10816,7 +10838,7 @@ function buildToolbarAnimationHandlers(input) {
|
|
|
10816
10838
|
const current = activeSlide.animations ?? [];
|
|
10817
10839
|
if (group === "motionPath") {
|
|
10818
10840
|
propertyHandlers.handleUpdateSlide({
|
|
10819
|
-
animations:
|
|
10841
|
+
animations: chunkG3JPCRKN_js.applyMotionPathPreset(current, selectedElement.id, preset)
|
|
10820
10842
|
});
|
|
10821
10843
|
return;
|
|
10822
10844
|
}
|
|
@@ -11012,7 +11034,7 @@ function buildToolbarProps(input) {
|
|
|
11012
11034
|
onOpenFile,
|
|
11013
11035
|
onOpenRecentFile,
|
|
11014
11036
|
onCreatePresentation: (templateId) => {
|
|
11015
|
-
s.setSlides(
|
|
11037
|
+
s.setSlides(chunkG3JPCRKN_js.createBackstagePresentation(templateId));
|
|
11016
11038
|
s.setActiveSlideIndex(0);
|
|
11017
11039
|
s.setSelectedElementId(null);
|
|
11018
11040
|
s.setSelectedElementIds([]);
|
|
@@ -11041,7 +11063,7 @@ function buildToolbarProps(input) {
|
|
|
11041
11063
|
loadLayoutPreviews: input.loadLayoutPreviews,
|
|
11042
11064
|
onInsertSlideFromLayout: slideOps.handleInsertSlideFromLayout,
|
|
11043
11065
|
onInsertSlideFromTemplate: slideOps.handleInsertSlideFromTemplate,
|
|
11044
|
-
templateScheme:
|
|
11066
|
+
templateScheme: chunkG3JPCRKN_js.templateSchemeFromTheme(s.theme?.colorScheme),
|
|
11045
11067
|
customShows: s.customShows,
|
|
11046
11068
|
activeCustomShowId: s.activeCustomShowId,
|
|
11047
11069
|
onSetActiveCustomShowId: s.setActiveCustomShowId,
|
|
@@ -11082,7 +11104,7 @@ function buildToolbarProps(input) {
|
|
|
11082
11104
|
isCommentsPanelOpen: s.isInspectorPaneOpen,
|
|
11083
11105
|
slideCommentCount: activeSlide?.comments?.length ?? 0,
|
|
11084
11106
|
formatPainterActive: s.formatPainterActive,
|
|
11085
|
-
canActivateFormatPainter:
|
|
11107
|
+
canActivateFormatPainter: chunkG3JPCRKN_js.hasCopyableFormat(selectedElement),
|
|
11086
11108
|
onToggleFormatPainter: () => s.setFormatPainterActive((p) => !p),
|
|
11087
11109
|
isSelectionPaneOpen: s.isSelectionPaneOpen,
|
|
11088
11110
|
onToggleSelectionPane: () => s.setIsSelectionPaneOpen((p) => !p),
|
|
@@ -11160,7 +11182,7 @@ function useViewerBuildingBlocksCore(input) {
|
|
|
11160
11182
|
headerFooter: state.headerFooter,
|
|
11161
11183
|
loading,
|
|
11162
11184
|
error,
|
|
11163
|
-
maxHistoryEntries:
|
|
11185
|
+
maxHistoryEntries: chunkG3JPCRKN_js.resolveHistoryDepth(viewerOptions),
|
|
11164
11186
|
hasActivePointerInteraction,
|
|
11165
11187
|
pointerCommitNonce: state.pointerCommitNonce,
|
|
11166
11188
|
onDirty: markDocumentDirty,
|
|
@@ -11184,11 +11206,17 @@ function useViewerBuildingBlocksCore(input) {
|
|
|
11184
11206
|
activeMaster: state.activeMaster,
|
|
11185
11207
|
documentGridSpacing: state.viewProperties?.gridSpacing
|
|
11186
11208
|
});
|
|
11209
|
+
const themeColorMap = react.useMemo(
|
|
11210
|
+
() => state.theme?.colorScheme ? chunkG3JPCRKN_js.buildThemeColorMap(state.theme.colorScheme) : void 0,
|
|
11211
|
+
[state.theme?.colorScheme]
|
|
11212
|
+
);
|
|
11187
11213
|
const { presentation, annotations, actionSoundHandlerRef, setExitModeHandler } = usePresentationSetup({
|
|
11188
11214
|
mode,
|
|
11189
11215
|
slides,
|
|
11190
11216
|
templateElementsBySlideId,
|
|
11191
11217
|
visibleSlideIndexes,
|
|
11218
|
+
canvasSize,
|
|
11219
|
+
themeColorMap,
|
|
11192
11220
|
endWithBlackSlide: viewerOptions.advanced.slideShowEndWithBlackSlide,
|
|
11193
11221
|
// File > Options > Advanced > "Prompt to keep ink annotations when
|
|
11194
11222
|
// exiting" / "Show popup toolbar" while presenting.
|
|
@@ -11228,7 +11256,7 @@ function useViewerBuildingBlocksCore(input) {
|
|
|
11228
11256
|
gridSpacingPx,
|
|
11229
11257
|
// Multiplied against the pre-existing 2x baseline; see the matching
|
|
11230
11258
|
// comment in `PowerPointViewer.tsx`.
|
|
11231
|
-
imageExportScale: 2 *
|
|
11259
|
+
imageExportScale: 2 * chunkG3JPCRKN_js.resolveImageResolutionScale(viewerOptions),
|
|
11232
11260
|
viewerOptions
|
|
11233
11261
|
};
|
|
11234
11262
|
}
|
|
@@ -11244,29 +11272,76 @@ function useCompatibilityToastsState() {
|
|
|
11244
11272
|
}
|
|
11245
11273
|
function useReadOnlyRecommendationState(content) {
|
|
11246
11274
|
const [recommendation, setRecommendation] = react.useState(
|
|
11247
|
-
() =>
|
|
11275
|
+
() => chunkG3JPCRKN_js.readOnlyRecommendation(void 0)
|
|
11248
11276
|
);
|
|
11277
|
+
const [modifyVerifier, setModifyVerifier] = react.useState(void 0);
|
|
11249
11278
|
const [bannerHidden, setBannerHidden] = react.useState(false);
|
|
11250
11279
|
const [editAnywayActive, setEditAnywayActive] = react.useState(false);
|
|
11280
|
+
const [passwordPromptOpen, setPasswordPromptOpen] = react.useState(false);
|
|
11281
|
+
const [passwordError, setPasswordError] = react.useState(null);
|
|
11282
|
+
const [checkingPassword, setCheckingPassword] = react.useState(false);
|
|
11251
11283
|
react.useEffect(() => {
|
|
11252
11284
|
setBannerHidden(false);
|
|
11253
11285
|
setEditAnywayActive(false);
|
|
11286
|
+
setPasswordPromptOpen(false);
|
|
11287
|
+
setPasswordError(null);
|
|
11288
|
+
setCheckingPassword(false);
|
|
11254
11289
|
}, [content]);
|
|
11255
|
-
const
|
|
11290
|
+
const unlock = react.useCallback(() => {
|
|
11256
11291
|
setEditAnywayActive(true);
|
|
11257
11292
|
setBannerHidden(true);
|
|
11293
|
+
setPasswordPromptOpen(false);
|
|
11294
|
+
setPasswordError(null);
|
|
11258
11295
|
}, []);
|
|
11296
|
+
const editAnyway = react.useCallback(() => {
|
|
11297
|
+
if (recommendation.requiresPassword) {
|
|
11298
|
+
setPasswordPromptOpen(true);
|
|
11299
|
+
setPasswordError(null);
|
|
11300
|
+
return;
|
|
11301
|
+
}
|
|
11302
|
+
unlock();
|
|
11303
|
+
}, [recommendation.requiresPassword, unlock]);
|
|
11259
11304
|
const dismiss = react.useCallback(() => {
|
|
11260
11305
|
setBannerHidden(true);
|
|
11261
11306
|
}, []);
|
|
11307
|
+
const cancelPasswordPrompt = react.useCallback(() => {
|
|
11308
|
+
setPasswordPromptOpen(false);
|
|
11309
|
+
setPasswordError(null);
|
|
11310
|
+
}, []);
|
|
11311
|
+
const submitPassword = react.useCallback(
|
|
11312
|
+
async (password) => {
|
|
11313
|
+
setCheckingPassword(true);
|
|
11314
|
+
try {
|
|
11315
|
+
const result = await chunkG3JPCRKN_js.checkModifyPassword(modifyVerifier, password);
|
|
11316
|
+
if (result.ok) {
|
|
11317
|
+
unlock();
|
|
11318
|
+
} else {
|
|
11319
|
+
setPasswordError(result.reason);
|
|
11320
|
+
}
|
|
11321
|
+
} finally {
|
|
11322
|
+
setCheckingPassword(false);
|
|
11323
|
+
}
|
|
11324
|
+
},
|
|
11325
|
+
// oxlint-disable-next-line react/memo-dependencies -- see comment above
|
|
11326
|
+
[modifyVerifier, unlock]
|
|
11327
|
+
);
|
|
11262
11328
|
return {
|
|
11263
11329
|
recommendation,
|
|
11264
11330
|
setRecommendation,
|
|
11331
|
+
setModifyVerifier,
|
|
11265
11332
|
/** Whether the viewer's `canEdit` should be forced off. */
|
|
11266
11333
|
locked: recommendation.defaultReadOnly && !editAnywayActive,
|
|
11267
11334
|
bannerVisible: recommendation.kind !== null && !bannerHidden,
|
|
11268
11335
|
editAnyway,
|
|
11269
|
-
dismiss
|
|
11336
|
+
dismiss,
|
|
11337
|
+
/** Whether the inline password prompt should render in place of the banner's buttons. */
|
|
11338
|
+
passwordPromptOpen,
|
|
11339
|
+
/** Reason the last password attempt failed, or null before any attempt / after success. */
|
|
11340
|
+
passwordError,
|
|
11341
|
+
/** True while `submitPassword`'s check is in flight (disables the form). */
|
|
11342
|
+
checkingPassword,
|
|
11343
|
+
submitPassword,
|
|
11344
|
+
cancelPasswordPrompt
|
|
11270
11345
|
};
|
|
11271
11346
|
}
|
|
11272
11347
|
function useViewPreferencesSync(input) {
|
|
@@ -11282,9 +11357,9 @@ function useViewPreferencesSync(input) {
|
|
|
11282
11357
|
setShowGuides
|
|
11283
11358
|
} = input;
|
|
11284
11359
|
react.useEffect(() => {
|
|
11285
|
-
const seeded =
|
|
11360
|
+
const seeded = chunkG3JPCRKN_js.viewerPreferencesFromViewProperties(
|
|
11286
11361
|
{ viewProperties },
|
|
11287
|
-
{ ...
|
|
11362
|
+
{ ...chunkG3JPCRKN_js.DEFAULT_VIEWER_PREFERENCES, snapToGrid, snapToObjects: snapToShape, showGuides }
|
|
11288
11363
|
);
|
|
11289
11364
|
setSnapToGrid(seeded.snapToGrid);
|
|
11290
11365
|
setSnapToShape(seeded.snapToObjects ?? snapToShape);
|
|
@@ -11294,7 +11369,7 @@ function useViewPreferencesSync(input) {
|
|
|
11294
11369
|
(prefsOverride) => {
|
|
11295
11370
|
setViewProperties((prev) => {
|
|
11296
11371
|
const merged = {
|
|
11297
|
-
...
|
|
11372
|
+
...chunkG3JPCRKN_js.DEFAULT_VIEWER_PREFERENCES,
|
|
11298
11373
|
snapToGrid,
|
|
11299
11374
|
snapToObjects: snapToShape,
|
|
11300
11375
|
showGuides,
|
|
@@ -11302,7 +11377,7 @@ function useViewPreferencesSync(input) {
|
|
|
11302
11377
|
gridSpacingCy: prev?.gridSpacing?.cy,
|
|
11303
11378
|
...prefsOverride
|
|
11304
11379
|
};
|
|
11305
|
-
const patch =
|
|
11380
|
+
const patch = chunkG3JPCRKN_js.viewPropertiesPatchFromPreferences(merged);
|
|
11306
11381
|
return {
|
|
11307
11382
|
...prev,
|
|
11308
11383
|
slideViewPr: { ...prev?.slideViewPr, ...patch.slideViewPr },
|
|
@@ -11444,6 +11519,7 @@ function useViewerBuildingBlocksState(input) {
|
|
|
11444
11519
|
// under the same default-off, core-side SSRF/privacy guard.
|
|
11445
11520
|
allowExternalImages: viewerOptions.trust.allowExternalContent,
|
|
11446
11521
|
setReadOnlyRecommendation: readOnlyRec.setRecommendation,
|
|
11522
|
+
setModifyVerifier: readOnlyRec.setModifyVerifier,
|
|
11447
11523
|
setCompatToasts: compatToastsState.setToasts,
|
|
11448
11524
|
canEdit,
|
|
11449
11525
|
promptKeepInkAnnotations: viewerOptions.advanced.slideShowPromptKeepInkAnnotations,
|
|
@@ -11520,7 +11596,7 @@ function useViewerBuildingBlocks(input) {
|
|
|
11520
11596
|
}, [incomingContent]);
|
|
11521
11597
|
const onOpenFile = react.useCallback(() => {
|
|
11522
11598
|
void (async () => {
|
|
11523
|
-
const picked = await
|
|
11599
|
+
const picked = await chunkG3JPCRKN_js.openPptxFile();
|
|
11524
11600
|
if (picked) {
|
|
11525
11601
|
setContent(picked.buffer);
|
|
11526
11602
|
}
|
|
@@ -11528,7 +11604,7 @@ function useViewerBuildingBlocks(input) {
|
|
|
11528
11604
|
}, []);
|
|
11529
11605
|
const onOpenRecentFile = react.useCallback((key) => {
|
|
11530
11606
|
void (async () => {
|
|
11531
|
-
const bytes = await
|
|
11607
|
+
const bytes = await chunkG3JPCRKN_js.readBackstageRecentFile(key);
|
|
11532
11608
|
if (bytes) {
|
|
11533
11609
|
setContent(bytes);
|
|
11534
11610
|
}
|