camox 0.41.0 → 0.41.1
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/dist/core/createApp.d.ts +2 -2
- package/dist/core/createBlock.js +11 -25
- package/dist/core/createLayout.d.ts +1 -1
- package/dist/core/editing/BlockEditingRuntime.js +4 -4
- package/dist/core/editing/CompleteBlockEditingRuntime.js +5 -5
- package/dist/core/editing/createEditableBlock.js +169 -306
- package/dist/core/hooks/useIsEditable.js +4 -7
- package/dist/core/hooks/useRequireDraftSource.js +7 -11
- package/dist/features/preview/CamoxPreview.js +59 -80
- package/dist/features/preview/DerivedPreview.js +6 -9
- package/dist/features/preview/components/BlockActionsPopover.js +8 -8
- package/dist/features/preview/components/DerivedLayoutSidebar.js +4 -7
- package/dist/features/preview/components/LinkFieldEditor.js +3 -4
- package/dist/features/preview/components/MobilePreviewDrawer.js +3 -3
- package/dist/features/preview/components/Overlays.js +6 -9
- package/dist/features/preview/components/PageEditorSidebar.js +194 -203
- package/dist/features/preview/components/PageTree.js +162 -228
- package/dist/features/preview/components/PreviewPanel.js +39 -41
- package/dist/features/preview/components/PreviewToolbar.js +15 -18
- package/dist/features/preview/components/PreviewToolbarSpacer.js +43 -0
- package/dist/features/preview/components/PublicationRow.js +11 -17
- package/dist/features/preview/previewStore.js +18 -29
- package/dist/features/provider/useAdminShortcuts.js +5 -4
- package/dist/features/runtime/RuntimeChrome.js +98 -86
- package/dist/features/studio/components/UserButton.js +4 -4
- package/package.json +4 -4
- package/dist/features/preview/components/DraftSwitchDialog.js +0 -66
|
@@ -21,9 +21,6 @@ import { generateKeyBetween } from "fractional-indexing";
|
|
|
21
21
|
import * as React from "react";
|
|
22
22
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
23
23
|
import { useSelector } from "@xstate/store-react";
|
|
24
|
-
import { Popover, PopoverContent, PopoverTrigger } from "@camox/ui/popover";
|
|
25
|
-
import { Label } from "@camox/ui/label";
|
|
26
|
-
import { Input } from "@camox/ui/input";
|
|
27
24
|
import { createPortal } from "react-dom";
|
|
28
25
|
|
|
29
26
|
//#region src/core/editing/createEditableBlock.tsx
|
|
@@ -293,10 +290,10 @@ function createEditableBlock(options) {
|
|
|
293
290
|
}, fieldData) });
|
|
294
291
|
};
|
|
295
292
|
const Embed = (t0) => {
|
|
296
|
-
const $ = c(
|
|
297
|
-
if ($[0] !== "
|
|
298
|
-
for (let $i = 0; $i <
|
|
299
|
-
$[0] = "
|
|
293
|
+
const $ = c(35);
|
|
294
|
+
if ($[0] !== "d6c181312c1800a4e5ae8a8c97d5ce89a20fae6d141b3bb8b9dd5c16e3c88316") {
|
|
295
|
+
for (let $i = 0; $i < 35; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
296
|
+
$[0] = "d6c181312c1800a4e5ae8a8c97d5ce89a20fae6d141b3bb8b9dd5c16e3c88316";
|
|
300
297
|
}
|
|
301
298
|
const { name, children } = t0;
|
|
302
299
|
const blockContext = React.use(Context);
|
|
@@ -316,232 +313,145 @@ function createEditableBlock(options) {
|
|
|
316
313
|
$[4] = t2;
|
|
317
314
|
} else t2 = $[4];
|
|
318
315
|
const fieldId = t2;
|
|
319
|
-
const [isOpen, setIsOpen] = React.useState(false);
|
|
320
|
-
const [urlValue, setUrlValue] = React.useState(fieldValue);
|
|
321
316
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
322
|
-
const
|
|
317
|
+
const embedRef = React.useRef(null);
|
|
318
|
+
const itemId = repeaterContext?.itemId;
|
|
323
319
|
let t3;
|
|
324
|
-
if ($[5] !==
|
|
325
|
-
t3 =
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
320
|
+
if ($[5] !== blockId || $[6] !== isContentEditable || $[7] !== itemId || $[8] !== name) {
|
|
321
|
+
t3 = () => {
|
|
322
|
+
if (!isContentEditable) return;
|
|
323
|
+
if (itemId != null) {
|
|
324
|
+
previewStore.send({
|
|
325
|
+
type: "selectItemField",
|
|
326
|
+
blockId,
|
|
327
|
+
itemId,
|
|
328
|
+
fieldName: String(name),
|
|
329
|
+
fieldType: "Embed"
|
|
330
|
+
});
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
previewStore.send({
|
|
334
|
+
type: "selectBlockField",
|
|
335
|
+
blockId,
|
|
336
|
+
fieldName: String(name),
|
|
337
|
+
fieldType: "Embed"
|
|
338
|
+
});
|
|
339
|
+
};
|
|
340
|
+
$[5] = blockId;
|
|
341
|
+
$[6] = isContentEditable;
|
|
342
|
+
$[7] = itemId;
|
|
343
|
+
$[8] = name;
|
|
344
|
+
$[9] = t3;
|
|
345
|
+
} else t3 = $[9];
|
|
346
|
+
const selectField = t3;
|
|
330
347
|
let t4;
|
|
331
348
|
let t5;
|
|
332
|
-
if ($[
|
|
349
|
+
if ($[10] !== iframeWindow || $[11] !== isContentEditable || $[12] !== selectField) {
|
|
333
350
|
t4 = () => {
|
|
334
|
-
|
|
351
|
+
if (!isContentEditable || !iframeWindow) return;
|
|
352
|
+
let timer;
|
|
353
|
+
const handleBlur = () => {
|
|
354
|
+
iframeWindow.clearTimeout(timer);
|
|
355
|
+
timer = iframeWindow.setTimeout(() => {
|
|
356
|
+
const activeElement = iframeWindow.document.activeElement;
|
|
357
|
+
if (activeElement?.tagName !== "IFRAME") return;
|
|
358
|
+
if (embedRef.current?.contains(activeElement)) selectField();
|
|
359
|
+
}, 0);
|
|
360
|
+
};
|
|
361
|
+
iframeWindow.addEventListener("blur", handleBlur);
|
|
362
|
+
return () => {
|
|
363
|
+
iframeWindow.clearTimeout(timer);
|
|
364
|
+
iframeWindow.removeEventListener("blur", handleBlur);
|
|
365
|
+
};
|
|
335
366
|
};
|
|
336
|
-
t5 = [
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
367
|
+
t5 = [
|
|
368
|
+
isContentEditable,
|
|
369
|
+
iframeWindow,
|
|
370
|
+
selectField
|
|
371
|
+
];
|
|
372
|
+
$[10] = iframeWindow;
|
|
373
|
+
$[11] = isContentEditable;
|
|
374
|
+
$[12] = selectField;
|
|
375
|
+
$[13] = t4;
|
|
376
|
+
$[14] = t5;
|
|
340
377
|
} else {
|
|
341
|
-
t4 = $[
|
|
342
|
-
t5 = $[
|
|
378
|
+
t4 = $[13];
|
|
379
|
+
t5 = $[14];
|
|
343
380
|
}
|
|
344
381
|
React.useEffect(t4, t5);
|
|
345
382
|
let t6;
|
|
346
|
-
if ($[
|
|
347
|
-
t6 =
|
|
348
|
-
$[
|
|
349
|
-
|
|
350
|
-
|
|
383
|
+
if ($[15] !== fieldId) {
|
|
384
|
+
t6 = { fieldId };
|
|
385
|
+
$[15] = fieldId;
|
|
386
|
+
$[16] = t6;
|
|
387
|
+
} else t6 = $[16];
|
|
388
|
+
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_FIELD", "CAMOX_HOVER_FIELD_END", t6);
|
|
351
389
|
let t7;
|
|
352
|
-
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
353
|
-
t7 = repeatableItemMutations.updateContent();
|
|
354
|
-
$[11] = t7;
|
|
355
|
-
} else t7 = $[11];
|
|
356
|
-
const updateRepeatableContent = useMutation(t7);
|
|
357
390
|
let t8;
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
if (!isOpen) setUrlValue(fieldValue);
|
|
362
|
-
};
|
|
363
|
-
t9 = [fieldValue, isOpen];
|
|
364
|
-
$[12] = fieldValue;
|
|
365
|
-
$[13] = isOpen;
|
|
366
|
-
$[14] = t8;
|
|
367
|
-
$[15] = t9;
|
|
368
|
-
} else {
|
|
369
|
-
t8 = $[14];
|
|
370
|
-
t9 = $[15];
|
|
371
|
-
}
|
|
372
|
-
React.useEffect(t8, t9);
|
|
373
|
-
let t10;
|
|
374
|
-
let t11;
|
|
375
|
-
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
376
|
-
t10 = () => () => {
|
|
377
|
-
if (timerRef.current) clearTimeout(timerRef.current);
|
|
391
|
+
if ($[17] !== isHoveredFromSidebar) {
|
|
392
|
+
t7 = () => {
|
|
393
|
+
setIsHovered(isHoveredFromSidebar);
|
|
378
394
|
};
|
|
379
|
-
|
|
380
|
-
$[
|
|
381
|
-
$[
|
|
395
|
+
t8 = [isHoveredFromSidebar];
|
|
396
|
+
$[17] = isHoveredFromSidebar;
|
|
397
|
+
$[18] = t7;
|
|
398
|
+
$[19] = t8;
|
|
382
399
|
} else {
|
|
383
|
-
|
|
384
|
-
|
|
400
|
+
t7 = $[18];
|
|
401
|
+
t8 = $[19];
|
|
385
402
|
}
|
|
386
|
-
React.useEffect(
|
|
403
|
+
React.useEffect(t7, t8);
|
|
404
|
+
const t9 = isContentEditable ? fieldId : void 0;
|
|
405
|
+
const t10 = isContentEditable ? "embed" : void 0;
|
|
406
|
+
const t11 = isContentEditable && isHovered || void 0;
|
|
387
407
|
let t12;
|
|
388
|
-
if ($[
|
|
389
|
-
t12 = (
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
timerRef.current = window.setTimeout(() => {
|
|
394
|
-
if (repeaterContext?.itemId != null) updateRepeatableContent.mutate({
|
|
395
|
-
id: repeaterContext.itemId,
|
|
396
|
-
content: { [name]: newValue }
|
|
397
|
-
});
|
|
398
|
-
else updateBlockContent.mutate({
|
|
399
|
-
id: blockId,
|
|
400
|
-
content: { [name]: newValue }
|
|
401
|
-
});
|
|
402
|
-
}, 500);
|
|
403
|
-
};
|
|
404
|
-
$[18] = blockId;
|
|
405
|
-
$[19] = name;
|
|
406
|
-
$[20] = repeaterContext;
|
|
407
|
-
$[21] = updateBlockContent;
|
|
408
|
-
$[22] = updateRepeatableContent;
|
|
409
|
-
$[23] = t12;
|
|
410
|
-
} else t12 = $[23];
|
|
411
|
-
const handleUrlChange = t12;
|
|
408
|
+
if ($[20] !== isContentEditable) {
|
|
409
|
+
t12 = isContentEditable ? () => setIsHovered(true) : void 0;
|
|
410
|
+
$[20] = isContentEditable;
|
|
411
|
+
$[21] = t12;
|
|
412
|
+
} else t12 = $[21];
|
|
412
413
|
let t13;
|
|
413
|
-
if ($[
|
|
414
|
-
t13 = (
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
$[27] = t13;
|
|
434
|
-
} else t13 = $[27];
|
|
435
|
-
const handleOpenChange = t13;
|
|
436
|
-
const t14 = isContentEditable ? isOpen : false;
|
|
437
|
-
const t15 = isContentEditable ? handleOpenChange : void 0;
|
|
438
|
-
const t16 = isContentEditable ? fieldId : void 0;
|
|
439
|
-
const t17 = isContentEditable ? "embed" : void 0;
|
|
440
|
-
const t18 = isContentEditable && isHovered || void 0;
|
|
441
|
-
const t19 = isContentEditable && isOpen || void 0;
|
|
442
|
-
let t20;
|
|
443
|
-
if ($[28] !== isContentEditable) {
|
|
444
|
-
t20 = isContentEditable ? () => setIsHovered(true) : void 0;
|
|
445
|
-
$[28] = isContentEditable;
|
|
446
|
-
$[29] = t20;
|
|
447
|
-
} else t20 = $[29];
|
|
448
|
-
let t21;
|
|
449
|
-
if ($[30] !== isContentEditable) {
|
|
450
|
-
t21 = isContentEditable ? () => setIsHovered(false) : void 0;
|
|
451
|
-
$[30] = isContentEditable;
|
|
452
|
-
$[31] = t21;
|
|
453
|
-
} else t21 = $[31];
|
|
454
|
-
let t22;
|
|
455
|
-
if ($[32] !== t16 || $[33] !== t17 || $[34] !== t18 || $[35] !== t19 || $[36] !== t20 || $[37] !== t21) {
|
|
456
|
-
t22 = /* @__PURE__ */ jsx("div", {
|
|
457
|
-
"data-camox-field-id": t16,
|
|
458
|
-
"data-camox-field-type": t17,
|
|
459
|
-
"data-camox-hovered": t18,
|
|
460
|
-
"data-camox-focused": t19,
|
|
414
|
+
if ($[22] !== isContentEditable) {
|
|
415
|
+
t13 = isContentEditable ? () => setIsHovered(false) : void 0;
|
|
416
|
+
$[22] = isContentEditable;
|
|
417
|
+
$[23] = t13;
|
|
418
|
+
} else t13 = $[23];
|
|
419
|
+
let t14;
|
|
420
|
+
if ($[24] !== children || $[25] !== fieldValue) {
|
|
421
|
+
t14 = children({ src: fieldValue }, { url: fieldValue });
|
|
422
|
+
$[24] = children;
|
|
423
|
+
$[25] = fieldValue;
|
|
424
|
+
$[26] = t14;
|
|
425
|
+
} else t14 = $[26];
|
|
426
|
+
let t15;
|
|
427
|
+
if ($[27] !== selectField || $[28] !== t10 || $[29] !== t11 || $[30] !== t12 || $[31] !== t13 || $[32] !== t14 || $[33] !== t9) {
|
|
428
|
+
t15 = /* @__PURE__ */ jsx("div", {
|
|
429
|
+
ref: embedRef,
|
|
430
|
+
onClickCapture: selectField,
|
|
431
|
+
"data-camox-field-id": t9,
|
|
432
|
+
"data-camox-field-type": t10,
|
|
433
|
+
"data-camox-hovered": t11,
|
|
461
434
|
"data-camox-overlay-mode": options.synced ? "synced" : void 0,
|
|
462
|
-
onMouseEnter:
|
|
463
|
-
onMouseLeave:
|
|
464
|
-
|
|
465
|
-
$[32] = t16;
|
|
466
|
-
$[33] = t17;
|
|
467
|
-
$[34] = t18;
|
|
468
|
-
$[35] = t19;
|
|
469
|
-
$[36] = t20;
|
|
470
|
-
$[37] = t21;
|
|
471
|
-
$[38] = t22;
|
|
472
|
-
} else t22 = $[38];
|
|
473
|
-
let t23;
|
|
474
|
-
if ($[39] !== children || $[40] !== fieldValue) {
|
|
475
|
-
t23 = children({ src: fieldValue }, { url: fieldValue });
|
|
476
|
-
$[39] = children;
|
|
477
|
-
$[40] = fieldValue;
|
|
478
|
-
$[41] = t23;
|
|
479
|
-
} else t23 = $[41];
|
|
480
|
-
let t24;
|
|
481
|
-
if ($[42] !== isContentEditable) {
|
|
482
|
-
t24 = isContentEditable && /* @__PURE__ */ jsx("div", { style: {
|
|
483
|
-
position: "absolute",
|
|
484
|
-
inset: 0,
|
|
485
|
-
zIndex: 10
|
|
486
|
-
} });
|
|
487
|
-
$[42] = isContentEditable;
|
|
488
|
-
$[43] = t24;
|
|
489
|
-
} else t24 = $[43];
|
|
490
|
-
let t25;
|
|
491
|
-
if ($[44] !== t22 || $[45] !== t23 || $[46] !== t24) {
|
|
492
|
-
t25 = /* @__PURE__ */ jsxs(PopoverTrigger, {
|
|
493
|
-
render: t22,
|
|
494
|
-
nativeButton: false,
|
|
495
|
-
children: [t23, t24]
|
|
496
|
-
});
|
|
497
|
-
$[44] = t22;
|
|
498
|
-
$[45] = t23;
|
|
499
|
-
$[46] = t24;
|
|
500
|
-
$[47] = t25;
|
|
501
|
-
} else t25 = $[47];
|
|
502
|
-
let t26;
|
|
503
|
-
if ($[48] !== handleUrlChange || $[49] !== isContentEditable || $[50] !== name || $[51] !== urlValue) {
|
|
504
|
-
t26 = isContentEditable && /* @__PURE__ */ jsx(PopoverContent, {
|
|
505
|
-
className: "w-96 gap-2",
|
|
506
|
-
children: /* @__PURE__ */ jsxs("form", {
|
|
507
|
-
className: "grid gap-2",
|
|
508
|
-
children: [/* @__PURE__ */ jsx(Label, {
|
|
509
|
-
htmlFor: "url",
|
|
510
|
-
children: options.content[name]?.title ?? String(name)
|
|
511
|
-
}), /* @__PURE__ */ jsx(Input, {
|
|
512
|
-
type: "url",
|
|
513
|
-
id: "url",
|
|
514
|
-
value: urlValue,
|
|
515
|
-
onChange: handleUrlChange
|
|
516
|
-
})]
|
|
517
|
-
})
|
|
518
|
-
});
|
|
519
|
-
$[48] = handleUrlChange;
|
|
520
|
-
$[49] = isContentEditable;
|
|
521
|
-
$[50] = name;
|
|
522
|
-
$[51] = urlValue;
|
|
523
|
-
$[52] = t26;
|
|
524
|
-
} else t26 = $[52];
|
|
525
|
-
let t27;
|
|
526
|
-
if ($[53] !== t14 || $[54] !== t15 || $[55] !== t25 || $[56] !== t26) {
|
|
527
|
-
t27 = /* @__PURE__ */ jsxs(Popover, {
|
|
528
|
-
open: t14,
|
|
529
|
-
onOpenChange: t15,
|
|
530
|
-
children: [t25, t26]
|
|
435
|
+
onMouseEnter: t12,
|
|
436
|
+
onMouseLeave: t13,
|
|
437
|
+
children: t14
|
|
531
438
|
});
|
|
532
|
-
$[
|
|
533
|
-
$[
|
|
534
|
-
$[
|
|
535
|
-
$[
|
|
536
|
-
$[
|
|
537
|
-
|
|
538
|
-
|
|
439
|
+
$[27] = selectField;
|
|
440
|
+
$[28] = t10;
|
|
441
|
+
$[29] = t11;
|
|
442
|
+
$[30] = t12;
|
|
443
|
+
$[31] = t13;
|
|
444
|
+
$[32] = t14;
|
|
445
|
+
$[33] = t9;
|
|
446
|
+
$[34] = t15;
|
|
447
|
+
} else t15 = $[34];
|
|
448
|
+
return t15;
|
|
539
449
|
};
|
|
540
450
|
const Link = (t0) => {
|
|
541
|
-
const $ = c(
|
|
542
|
-
if ($[0] !== "
|
|
543
|
-
for (let $i = 0; $i <
|
|
544
|
-
$[0] = "
|
|
451
|
+
const $ = c(29);
|
|
452
|
+
if ($[0] !== "d6c181312c1800a4e5ae8a8c97d5ce89a20fae6d141b3bb8b9dd5c16e3c88316") {
|
|
453
|
+
for (let $i = 0; $i < 29; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
454
|
+
$[0] = "d6c181312c1800a4e5ae8a8c97d5ce89a20fae6d141b3bb8b9dd5c16e3c88316";
|
|
545
455
|
}
|
|
546
456
|
const { name, children } = t0;
|
|
547
457
|
const blockContext = React.use(Context);
|
|
@@ -683,17 +593,6 @@ function createEditableBlock(options) {
|
|
|
683
593
|
$[24] = t12;
|
|
684
594
|
} else t12 = $[24];
|
|
685
595
|
const handleBlur = t12;
|
|
686
|
-
let t13;
|
|
687
|
-
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
688
|
-
t13 = (e_0) => {
|
|
689
|
-
e_0.stopPropagation();
|
|
690
|
-
previewStore.send({ type: "toggleContentSheet" });
|
|
691
|
-
setIsEditorFocused(false);
|
|
692
|
-
setIsEditing(false);
|
|
693
|
-
};
|
|
694
|
-
$[25] = t13;
|
|
695
|
-
} else t13 = $[25];
|
|
696
|
-
const handleEditLink = t13;
|
|
697
596
|
const linkData = {
|
|
698
597
|
text: displayText,
|
|
699
598
|
href: resolvedHref,
|
|
@@ -705,18 +604,18 @@ function createEditableBlock(options) {
|
|
|
705
604
|
rel: fieldValue.newTab ? "noreferrer" : void 0,
|
|
706
605
|
children: fieldValue.text
|
|
707
606
|
}, linkData) });
|
|
607
|
+
let t13;
|
|
708
608
|
let t14;
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
t14 = () => setIsHovered(
|
|
712
|
-
|
|
609
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
610
|
+
t13 = () => setIsHovered(true);
|
|
611
|
+
t14 = () => setIsHovered(false);
|
|
612
|
+
$[25] = t13;
|
|
713
613
|
$[26] = t14;
|
|
714
|
-
$[27] = t15;
|
|
715
614
|
} else {
|
|
615
|
+
t13 = $[25];
|
|
716
616
|
t14 = $[26];
|
|
717
|
-
t15 = $[27];
|
|
718
617
|
}
|
|
719
|
-
const
|
|
618
|
+
const t15 = children({
|
|
720
619
|
ref: elementRef,
|
|
721
620
|
to: resolvedHref,
|
|
722
621
|
target: fieldValue.newTab ? "_blank" : void 0,
|
|
@@ -731,58 +630,25 @@ function createEditableBlock(options) {
|
|
|
731
630
|
onInput: handleInput,
|
|
732
631
|
onFocus: handleFocus,
|
|
733
632
|
onBlur: handleBlur,
|
|
734
|
-
onMouseEnter:
|
|
735
|
-
onMouseLeave:
|
|
633
|
+
onMouseEnter: t13,
|
|
634
|
+
onMouseLeave: t14,
|
|
736
635
|
onKeyDown: _temp3,
|
|
737
636
|
spellCheck: false,
|
|
738
637
|
suppressContentEditableWarning: true
|
|
739
|
-
};
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
onMouseDown: _temp4,
|
|
748
|
-
onClick: handleEditLink,
|
|
749
|
-
children: "Edit link"
|
|
750
|
-
});
|
|
751
|
-
$[28] = handleEditLink;
|
|
752
|
-
$[29] = t17;
|
|
753
|
-
} else t17 = $[29];
|
|
754
|
-
let t18;
|
|
755
|
-
if ($[30] !== elementRef || $[31] !== t17) {
|
|
756
|
-
t18 = /* @__PURE__ */ jsx(PopoverContent, {
|
|
757
|
-
className: "w-auto p-2",
|
|
758
|
-
initialFocus: false,
|
|
759
|
-
anchor: elementRef,
|
|
760
|
-
align: "end",
|
|
761
|
-
children: t17
|
|
762
|
-
});
|
|
763
|
-
$[30] = elementRef;
|
|
764
|
-
$[31] = t17;
|
|
765
|
-
$[32] = t18;
|
|
766
|
-
} else t18 = $[32];
|
|
767
|
-
let t19;
|
|
768
|
-
if ($[33] !== T0 || $[34] !== isEditorFocused || $[35] !== t16 || $[36] !== t18) {
|
|
769
|
-
t19 = /* @__PURE__ */ jsxs(T0, {
|
|
770
|
-
open: isEditorFocused,
|
|
771
|
-
children: [t16, t18]
|
|
772
|
-
});
|
|
773
|
-
$[33] = T0;
|
|
774
|
-
$[34] = isEditorFocused;
|
|
775
|
-
$[35] = t16;
|
|
776
|
-
$[36] = t18;
|
|
777
|
-
$[37] = t19;
|
|
778
|
-
} else t19 = $[37];
|
|
779
|
-
return t19;
|
|
638
|
+
}, linkData);
|
|
639
|
+
let t16;
|
|
640
|
+
if ($[27] !== t15) {
|
|
641
|
+
t16 = /* @__PURE__ */ jsx(Fragment, { children: t15 });
|
|
642
|
+
$[27] = t15;
|
|
643
|
+
$[28] = t16;
|
|
644
|
+
} else t16 = $[28];
|
|
645
|
+
return t16;
|
|
780
646
|
};
|
|
781
647
|
const Image = (t0) => {
|
|
782
648
|
const $ = c(22);
|
|
783
|
-
if ($[0] !== "
|
|
649
|
+
if ($[0] !== "d6c181312c1800a4e5ae8a8c97d5ce89a20fae6d141b3bb8b9dd5c16e3c88316") {
|
|
784
650
|
for (let $i = 0; $i < 22; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
785
|
-
$[0] = "
|
|
651
|
+
$[0] = "d6c181312c1800a4e5ae8a8c97d5ce89a20fae6d141b3bb8b9dd5c16e3c88316";
|
|
786
652
|
}
|
|
787
653
|
const { name, children } = t0;
|
|
788
654
|
const blockContext = React.use(Context);
|
|
@@ -904,9 +770,9 @@ function createEditableBlock(options) {
|
|
|
904
770
|
};
|
|
905
771
|
const File = (t0) => {
|
|
906
772
|
const $ = c(9);
|
|
907
|
-
if ($[0] !== "
|
|
773
|
+
if ($[0] !== "d6c181312c1800a4e5ae8a8c97d5ce89a20fae6d141b3bb8b9dd5c16e3c88316") {
|
|
908
774
|
for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
909
|
-
$[0] = "
|
|
775
|
+
$[0] = "d6c181312c1800a4e5ae8a8c97d5ce89a20fae6d141b3bb8b9dd5c16e3c88316";
|
|
910
776
|
}
|
|
911
777
|
const { name, children } = t0;
|
|
912
778
|
const blockContext = React.use(Context);
|
|
@@ -981,9 +847,9 @@ function createEditableBlock(options) {
|
|
|
981
847
|
const FileList = _AssetList;
|
|
982
848
|
const RepeaterItemWrapper = (t0) => {
|
|
983
849
|
const $ = c(8);
|
|
984
|
-
if ($[0] !== "
|
|
850
|
+
if ($[0] !== "d6c181312c1800a4e5ae8a8c97d5ce89a20fae6d141b3bb8b9dd5c16e3c88316") {
|
|
985
851
|
for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
986
|
-
$[0] = "
|
|
852
|
+
$[0] = "d6c181312c1800a4e5ae8a8c97d5ce89a20fae6d141b3bb8b9dd5c16e3c88316";
|
|
987
853
|
}
|
|
988
854
|
const { itemId, blockId, mode, children } = t0;
|
|
989
855
|
const isContentEditable = useIsEditable(mode);
|
|
@@ -1022,9 +888,9 @@ function createEditableBlock(options) {
|
|
|
1022
888
|
};
|
|
1023
889
|
const RepeaterHoverProvider = (t0) => {
|
|
1024
890
|
const $ = c(7);
|
|
1025
|
-
if ($[0] !== "
|
|
891
|
+
if ($[0] !== "d6c181312c1800a4e5ae8a8c97d5ce89a20fae6d141b3bb8b9dd5c16e3c88316") {
|
|
1026
892
|
for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1027
|
-
$[0] = "
|
|
893
|
+
$[0] = "d6c181312c1800a4e5ae8a8c97d5ce89a20fae6d141b3bb8b9dd5c16e3c88316";
|
|
1028
894
|
}
|
|
1029
895
|
const { blockId, fieldName, children } = t0;
|
|
1030
896
|
const isContentEditable = useIsEditable("site");
|
|
@@ -1055,9 +921,9 @@ function createEditableBlock(options) {
|
|
|
1055
921
|
};
|
|
1056
922
|
const Repeater = (t0) => {
|
|
1057
923
|
const $ = c(27);
|
|
1058
|
-
if ($[0] !== "
|
|
924
|
+
if ($[0] !== "d6c181312c1800a4e5ae8a8c97d5ce89a20fae6d141b3bb8b9dd5c16e3c88316") {
|
|
1059
925
|
for (let $i = 0; $i < 27; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1060
|
-
$[0] = "
|
|
926
|
+
$[0] = "d6c181312c1800a4e5ae8a8c97d5ce89a20fae6d141b3bb8b9dd5c16e3c88316";
|
|
1061
927
|
}
|
|
1062
928
|
const { name, children } = t0;
|
|
1063
929
|
const blockContext = React.use(Context);
|
|
@@ -1182,17 +1048,17 @@ function createEditableBlock(options) {
|
|
|
1182
1048
|
};
|
|
1183
1049
|
const BlockComponent = (t0) => {
|
|
1184
1050
|
const $ = c(70);
|
|
1185
|
-
if ($[0] !== "
|
|
1051
|
+
if ($[0] !== "d6c181312c1800a4e5ae8a8c97d5ce89a20fae6d141b3bb8b9dd5c16e3c88316") {
|
|
1186
1052
|
for (let $i = 0; $i < 70; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1187
|
-
$[0] = "
|
|
1053
|
+
$[0] = "d6c181312c1800a4e5ae8a8c97d5ce89a20fae6d141b3bb8b9dd5c16e3c88316";
|
|
1188
1054
|
}
|
|
1189
1055
|
const { blockData, mode, isFirstBlock, showAddBlockTop, showAddBlockBottom, addBlockAfterPosition } = t0;
|
|
1190
1056
|
const isContentEditable = useIsEditable(mode);
|
|
1191
1057
|
const { window: iframeWindow } = useFrame();
|
|
1192
1058
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
1193
|
-
const selection = useSelector(previewStore,
|
|
1194
|
-
const isPageEditorSidebarOpen = useSelector(previewStore,
|
|
1195
|
-
const isAddBlockSidebarOpen = useSelector(previewStore,
|
|
1059
|
+
const selection = useSelector(previewStore, _temp4);
|
|
1060
|
+
const isPageEditorSidebarOpen = useSelector(previewStore, _temp5);
|
|
1061
|
+
const isAddBlockSidebarOpen = useSelector(previewStore, _temp6);
|
|
1196
1062
|
const isBlockSelected = selection?.blockId === blockData._id;
|
|
1197
1063
|
const ref = React.useRef(null);
|
|
1198
1064
|
const [isFirstRender, setIsFirstRender] = React.useState(true);
|
|
@@ -1267,7 +1133,7 @@ function createEditableBlock(options) {
|
|
|
1267
1133
|
result = { ...blockData.content };
|
|
1268
1134
|
for (const key in result) {
|
|
1269
1135
|
const value = result[key];
|
|
1270
|
-
if (Array.isArray(value) && value.length > 0 && value[0]?.content !== void 0) result[key] = value.map(
|
|
1136
|
+
if (Array.isArray(value) && value.length > 0 && value[0]?.content !== void 0) result[key] = value.map(_temp7);
|
|
1271
1137
|
}
|
|
1272
1138
|
$[17] = blockData.content;
|
|
1273
1139
|
$[18] = result;
|
|
@@ -1485,9 +1351,9 @@ function createEditableBlock(options) {
|
|
|
1485
1351
|
*/
|
|
1486
1352
|
const Detached = (t0) => {
|
|
1487
1353
|
const $ = c(30);
|
|
1488
|
-
if ($[0] !== "
|
|
1354
|
+
if ($[0] !== "d6c181312c1800a4e5ae8a8c97d5ce89a20fae6d141b3bb8b9dd5c16e3c88316") {
|
|
1489
1355
|
for (let $i = 0; $i < 30; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1490
|
-
$[0] = "
|
|
1356
|
+
$[0] = "d6c181312c1800a4e5ae8a8c97d5ce89a20fae6d141b3bb8b9dd5c16e3c88316";
|
|
1491
1357
|
}
|
|
1492
1358
|
const { children } = t0;
|
|
1493
1359
|
const ctx = React.use(Context);
|
|
@@ -1495,8 +1361,8 @@ function createEditableBlock(options) {
|
|
|
1495
1361
|
const { blockId, mode, isHovered, setIsHovered } = ctx;
|
|
1496
1362
|
const isContentEditable = useIsEditable(mode);
|
|
1497
1363
|
const { window: iframeWindow } = useFrame();
|
|
1498
|
-
const selection = useSelector(previewStore,
|
|
1499
|
-
const isAddBlockSidebarOpen = useSelector(previewStore,
|
|
1364
|
+
const selection = useSelector(previewStore, _temp8);
|
|
1365
|
+
const isAddBlockSidebarOpen = useSelector(previewStore, _temp9);
|
|
1500
1366
|
const isBlockSelected = selection?.blockId === blockId;
|
|
1501
1367
|
const t1 = String(blockId);
|
|
1502
1368
|
let t2;
|
|
@@ -1684,31 +1550,28 @@ function createEditableBlock(options) {
|
|
|
1684
1550
|
function _temp(l) {
|
|
1685
1551
|
return l.pathname;
|
|
1686
1552
|
}
|
|
1687
|
-
function _temp2(
|
|
1688
|
-
return
|
|
1689
|
-
}
|
|
1690
|
-
function _temp3(e_2) {
|
|
1691
|
-
if (e_2.key === "Escape") e_2.target.blur();
|
|
1553
|
+
function _temp2(e_0) {
|
|
1554
|
+
return e_0.preventDefault();
|
|
1692
1555
|
}
|
|
1693
|
-
function
|
|
1694
|
-
|
|
1556
|
+
function _temp3(e_1) {
|
|
1557
|
+
if (e_1.key === "Escape") e_1.target.blur();
|
|
1695
1558
|
}
|
|
1696
|
-
function
|
|
1559
|
+
function _temp4(state) {
|
|
1697
1560
|
return state.context.selection;
|
|
1698
1561
|
}
|
|
1699
|
-
function
|
|
1562
|
+
function _temp5(state_0) {
|
|
1700
1563
|
return state_0.context.isPageEditorSidebarOpen;
|
|
1701
1564
|
}
|
|
1702
|
-
function
|
|
1565
|
+
function _temp6(state_1) {
|
|
1703
1566
|
return state_1.context.isAddBlockSidebarOpen;
|
|
1704
1567
|
}
|
|
1705
|
-
function
|
|
1568
|
+
function _temp7(item) {
|
|
1706
1569
|
return item.content;
|
|
1707
1570
|
}
|
|
1708
|
-
function
|
|
1571
|
+
function _temp8(state) {
|
|
1709
1572
|
return state.context.selection;
|
|
1710
1573
|
}
|
|
1711
|
-
function
|
|
1574
|
+
function _temp9(state_0) {
|
|
1712
1575
|
return state_0.context.isAddBlockSidebarOpen;
|
|
1713
1576
|
}
|
|
1714
1577
|
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import { useIsAuthenticated } from "../../lib/auth.js";
|
|
2
|
-
import { previewStore } from "../../features/preview/previewStore.js";
|
|
2
|
+
import { previewStore, selectIsEditMode } from "../../features/preview/previewStore.js";
|
|
3
3
|
import { c } from "react/compiler-runtime";
|
|
4
4
|
import { useSelector } from "@xstate/store-react";
|
|
5
5
|
|
|
6
6
|
//#region src/core/hooks/useIsEditable.ts
|
|
7
7
|
function useIsEditable(mode) {
|
|
8
8
|
const $ = c(1);
|
|
9
|
-
if ($[0] !== "
|
|
9
|
+
if ($[0] !== "baeaba7613c819c1f4460b64af1c246a057a26cf699e41daca4193d0ee512f1c") {
|
|
10
10
|
for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
11
|
-
$[0] = "
|
|
11
|
+
$[0] = "baeaba7613c819c1f4460b64af1c246a057a26cf699e41daca4193d0ee512f1c";
|
|
12
12
|
}
|
|
13
13
|
const isAuthenticated = useIsAuthenticated();
|
|
14
|
-
const isEditMode = useSelector(previewStore,
|
|
14
|
+
const isEditMode = useSelector(previewStore, selectIsEditMode);
|
|
15
15
|
return isAuthenticated && (mode === "site" || mode === "layout") && isEditMode;
|
|
16
16
|
}
|
|
17
|
-
function _temp(state) {
|
|
18
|
-
return state.context.isEditMode;
|
|
19
|
-
}
|
|
20
17
|
|
|
21
18
|
//#endregion
|
|
22
19
|
export { useIsEditable };
|