camox 0.41.1 → 0.42.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/dist/core/components/lexical/SidebarLexicalEditor.js +42 -39
- package/dist/core/createApp.d.ts +18 -4
- package/dist/core/createLayout.d.ts +1 -1
- package/dist/core/editing/createEditableBlock.d.ts +8 -1
- package/dist/core/editing/createEditableBlock.js +636 -459
- package/dist/core/hooks/useOverlayState.js +11 -0
- package/dist/core/lib/fieldTypes.js +5 -5
- package/dist/core/lib/lexicalState.js +17 -1
- package/dist/features/preview/CamoxPreview.js +80 -73
- package/dist/features/preview/commentsEnabled.js +8 -0
- package/dist/features/preview/components/AddBlockSidebar.js +79 -89
- package/dist/features/preview/components/AssetLightbox.js +4 -11
- package/dist/features/preview/components/AttachedComments.js +194 -0
- package/dist/features/preview/components/BlockActionsPopover.js +13 -64
- package/dist/features/preview/components/CommentHeader.js +122 -0
- package/dist/features/preview/components/CommentSidebar.js +29 -0
- package/dist/features/preview/components/CommentTargetQuote.js +166 -0
- package/dist/features/preview/components/CreatePageModal.js +2 -8
- package/dist/features/preview/components/ItemFieldsEditor.js +275 -204
- package/dist/features/preview/components/LeftSidebar.js +18 -18
- package/dist/features/preview/components/OverlayTracker.js +14 -20
- package/dist/features/preview/components/Overlays.js +26 -35
- package/dist/features/preview/components/PageEditorSidebar.js +89 -90
- package/dist/features/preview/components/PageInfoSidebar.js +126 -157
- package/dist/features/preview/components/PagePicker.js +13 -8
- package/dist/features/preview/components/PageTree.js +158 -156
- package/dist/features/preview/components/PreviewComments.js +56 -0
- package/dist/features/preview/components/PreviewPanel.js +122 -78
- package/dist/features/preview/components/PreviewToolbar.js +280 -231
- package/dist/features/preview/components/PublicationRow.js +4 -11
- package/dist/features/preview/components/RightSidebar.js +14 -11
- package/dist/features/preview/components/SidebarSection.js +121 -0
- package/dist/features/preview/previewCommentsStore.js +115 -0
- package/dist/features/preview/previewSelection.js +75 -0
- package/dist/features/preview/previewStore.js +19 -39
- package/dist/features/provider/AuthenticatedCamoxProvider.js +46 -34
- package/dist/features/provider/components/CommandPalette.js +142 -58
- package/dist/features/provider/useAdminShortcuts.js +19 -8
- package/dist/features/routes/pageRuntime.js +0 -6
- package/dist/features/runtime/RuntimeChrome.js +40 -37
- package/dist/features/studio/CamoxStudio.js +30 -50
- package/dist/features/vite/runtimeDev.js +4 -1
- package/dist/features/vite/vite.d.ts +3 -2
- package/dist/features/vite/vite.js +9 -5
- package/dist/hooks/use-file-upload.js +0 -2
- package/dist/studio.css +1 -1
- package/package.json +5 -7
- package/dist/lib/telemetry-client.js +0 -66
- package/dist/lib/telemetry.js +0 -26
|
@@ -5,8 +5,8 @@ import { Type as Type$1, resolveToMarkdown } from "../lib/contentType.js";
|
|
|
5
5
|
import { buildImageSrcSet, getDefaultImageSizes, getDefaultImageWidth, transformImageUrl } from "../lib/imageTransform.js";
|
|
6
6
|
import { markdownToReactNodes } from "../lib/lexicalReact.js";
|
|
7
7
|
import { blockMutations, pageQueries, projectQueries, repeatableItemMutations } from "../../lib/queries.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { previewStore, selectIsCommentMode } from "../../features/preview/previewStore.js";
|
|
9
|
+
import { usePreviewSelection } from "../../features/preview/previewSelection.js";
|
|
10
10
|
import { postOverlayMessage } from "../../features/preview/overlayMessages.js";
|
|
11
11
|
import { useFrame } from "../../features/preview/components/Frame.js";
|
|
12
12
|
import { AddBlockControlBar } from "../components/AddBlockControlBar.js";
|
|
@@ -14,6 +14,7 @@ import { InlineLexicalEditor } from "../components/lexical/InlineLexicalEditor.j
|
|
|
14
14
|
import { useFieldSelection } from "../hooks/useFieldSelection.js";
|
|
15
15
|
import { useIsEditable } from "../hooks/useIsEditable.js";
|
|
16
16
|
import { useOverlayMessage } from "../hooks/useOverlayMessage.js";
|
|
17
|
+
import { useOverlayState } from "../hooks/useOverlayState.js";
|
|
17
18
|
import { c } from "react/compiler-runtime";
|
|
18
19
|
import { Type } from "@sinclair/typebox";
|
|
19
20
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
@@ -182,7 +183,15 @@ function createEditableBlock(options) {
|
|
|
182
183
|
if (repeaterContext?.itemId != null) return `${blockId}__${repeaterContext.itemId}__${fieldName}`;
|
|
183
184
|
return `${blockId}__${fieldName}`;
|
|
184
185
|
};
|
|
185
|
-
const Field = (
|
|
186
|
+
const Field = (t0) => {
|
|
187
|
+
const $ = c(34);
|
|
188
|
+
if ($[0] !== "9390cfa3e0bf4e772e82a3d1352a7d56d8ae67f112d215b6d45231db17c01883") {
|
|
189
|
+
for (let $i = 0; $i < 34; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
190
|
+
$[0] = "9390cfa3e0bf4e772e82a3d1352a7d56d8ae67f112d215b6d45231db17c01883";
|
|
191
|
+
}
|
|
192
|
+
const { name, textStyle, linkStyle, children } = t0;
|
|
193
|
+
const selectTarget = usePreviewSelection();
|
|
194
|
+
const isCommentMode = useSelector(previewStore, selectIsCommentMode);
|
|
186
195
|
const blockContext = React.use(Context);
|
|
187
196
|
if (!blockContext) throw new Error("Field must be used within a Block Component");
|
|
188
197
|
const { blockId, content, mode } = blockContext;
|
|
@@ -190,77 +199,154 @@ function createEditableBlock(options) {
|
|
|
190
199
|
const elementRef = React.useRef(null);
|
|
191
200
|
const { window: iframeWindow } = useFrame();
|
|
192
201
|
const projectSlug = useProjectSlug();
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
202
|
+
let t1;
|
|
203
|
+
if ($[1] !== projectSlug) {
|
|
204
|
+
t1 = projectQueries.getBySlug(projectSlug);
|
|
205
|
+
$[1] = projectSlug;
|
|
206
|
+
$[2] = t1;
|
|
207
|
+
} else t1 = $[2];
|
|
208
|
+
const { data: project } = useQuery(t1);
|
|
209
|
+
let t2;
|
|
210
|
+
if ($[3] !== project?.id) {
|
|
211
|
+
t2 = pageQueries.list(project?.id ?? 0);
|
|
212
|
+
$[3] = project?.id;
|
|
213
|
+
$[4] = t2;
|
|
214
|
+
} else t2 = $[4];
|
|
215
|
+
const t3 = !!project;
|
|
216
|
+
let t4;
|
|
217
|
+
if ($[5] !== t2 || $[6] !== t3) {
|
|
218
|
+
t4 = {
|
|
219
|
+
...t2,
|
|
220
|
+
enabled: t3
|
|
221
|
+
};
|
|
222
|
+
$[5] = t2;
|
|
223
|
+
$[6] = t3;
|
|
224
|
+
$[7] = t4;
|
|
225
|
+
} else t4 = $[7];
|
|
226
|
+
const { data: pages } = useQuery(t4);
|
|
227
|
+
let t5;
|
|
228
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
229
|
+
t5 = { select: _temp };
|
|
230
|
+
$[8] = t5;
|
|
231
|
+
} else t5 = $[8];
|
|
232
|
+
const currentPathname = useLocation(t5);
|
|
199
233
|
const repeaterContext = React.use(RepeaterItemContext);
|
|
200
234
|
const fieldId = getOverlayFieldId(blockId, repeaterContext, String(name));
|
|
201
235
|
const fieldValue = repeaterContext ? repeaterContext.itemContent[name] : content[name];
|
|
202
236
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
203
237
|
const [isEditorFocused, setIsEditorFocused] = React.useState(false);
|
|
204
238
|
const isSelectedFromSelection = useFieldSelection(blockId, String(name), "String", repeaterContext?.itemId);
|
|
205
|
-
const
|
|
239
|
+
const overlayState = useOverlayState(isHovered, isEditorFocused || isSelectedFromSelection);
|
|
206
240
|
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_FIELD", "CAMOX_HOVER_FIELD_END", { fieldId });
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
241
|
+
let t6;
|
|
242
|
+
let t7;
|
|
243
|
+
if ($[9] !== isHoveredFromSidebar) {
|
|
244
|
+
t6 = () => {
|
|
245
|
+
setIsHovered(isHoveredFromSidebar);
|
|
246
|
+
};
|
|
247
|
+
t7 = [isHoveredFromSidebar];
|
|
248
|
+
$[9] = isHoveredFromSidebar;
|
|
249
|
+
$[10] = t6;
|
|
250
|
+
$[11] = t7;
|
|
251
|
+
} else {
|
|
252
|
+
t6 = $[10];
|
|
253
|
+
t7 = $[11];
|
|
254
|
+
}
|
|
255
|
+
React.useEffect(t6, t7);
|
|
256
|
+
let t8;
|
|
257
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
258
|
+
t8 = blockMutations.updateContent();
|
|
259
|
+
$[12] = t8;
|
|
260
|
+
} else t8 = $[12];
|
|
261
|
+
const updateBlockContent = useMutation(t8);
|
|
262
|
+
let t9;
|
|
263
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
264
|
+
t9 = repeatableItemMutations.updateContent();
|
|
265
|
+
$[13] = t9;
|
|
266
|
+
} else t9 = $[13];
|
|
267
|
+
const updateRepeatableContent = useMutation(t9);
|
|
268
|
+
let t10;
|
|
269
|
+
if ($[14] !== blockId || $[15] !== name || $[16] !== repeaterContext || $[17] !== updateBlockContent || $[18] !== updateRepeatableContent) {
|
|
270
|
+
t10 = (newValue) => {
|
|
271
|
+
if (repeaterContext) {
|
|
272
|
+
const { itemId } = repeaterContext;
|
|
273
|
+
if (itemId != null) updateRepeatableContent.mutate({
|
|
274
|
+
id: itemId,
|
|
275
|
+
content: { [name]: newValue }
|
|
276
|
+
});
|
|
277
|
+
} else updateBlockContent.mutate({
|
|
278
|
+
id: blockId,
|
|
217
279
|
content: { [name]: newValue }
|
|
218
280
|
});
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
])
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
]
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
};
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
|
|
281
|
+
};
|
|
282
|
+
$[14] = blockId;
|
|
283
|
+
$[15] = name;
|
|
284
|
+
$[16] = repeaterContext;
|
|
285
|
+
$[17] = updateBlockContent;
|
|
286
|
+
$[18] = updateRepeatableContent;
|
|
287
|
+
$[19] = t10;
|
|
288
|
+
} else t10 = $[19];
|
|
289
|
+
const handleChange = t10;
|
|
290
|
+
let t11;
|
|
291
|
+
if ($[20] !== blockId || $[21] !== name || $[22] !== repeaterContext || $[23] !== selectTarget) {
|
|
292
|
+
t11 = (event) => {
|
|
293
|
+
selectTarget(repeaterContext?.itemId != null ? {
|
|
294
|
+
type: "item-field",
|
|
295
|
+
blockId,
|
|
296
|
+
itemId: repeaterContext.itemId,
|
|
297
|
+
fieldName: String(name),
|
|
298
|
+
fieldType: "String"
|
|
299
|
+
} : {
|
|
300
|
+
type: "block-field",
|
|
301
|
+
blockId,
|
|
302
|
+
fieldName: String(name),
|
|
303
|
+
fieldType: "String"
|
|
304
|
+
}, event);
|
|
305
|
+
};
|
|
306
|
+
$[20] = blockId;
|
|
307
|
+
$[21] = name;
|
|
308
|
+
$[22] = repeaterContext;
|
|
309
|
+
$[23] = selectTarget;
|
|
310
|
+
$[24] = t11;
|
|
311
|
+
} else t11 = $[24];
|
|
312
|
+
const selectField = t11;
|
|
313
|
+
let t12;
|
|
314
|
+
if ($[25] !== selectField) {
|
|
315
|
+
t12 = () => {
|
|
316
|
+
if (selectIsCommentMode(previewStore.getSnapshot())) return;
|
|
317
|
+
setIsEditorFocused(true);
|
|
318
|
+
selectField();
|
|
319
|
+
};
|
|
320
|
+
$[25] = selectField;
|
|
321
|
+
$[26] = t12;
|
|
322
|
+
} else t12 = $[26];
|
|
323
|
+
const handleFocus = t12;
|
|
324
|
+
let t13;
|
|
325
|
+
if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
|
|
326
|
+
t13 = () => {
|
|
327
|
+
setIsEditorFocused(false);
|
|
328
|
+
};
|
|
329
|
+
$[27] = t13;
|
|
330
|
+
} else t13 = $[27];
|
|
331
|
+
const handleBlur = t13;
|
|
332
|
+
let t14;
|
|
333
|
+
if ($[28] !== isContentEditable) {
|
|
334
|
+
t14 = () => {
|
|
335
|
+
if (isContentEditable) setIsHovered(true);
|
|
336
|
+
};
|
|
337
|
+
$[28] = isContentEditable;
|
|
338
|
+
$[29] = t14;
|
|
339
|
+
} else t14 = $[29];
|
|
340
|
+
const handleMouseEnter = t14;
|
|
341
|
+
let t15;
|
|
342
|
+
if ($[30] !== isContentEditable) {
|
|
343
|
+
t15 = () => {
|
|
344
|
+
if (isContentEditable) setIsHovered(false);
|
|
345
|
+
};
|
|
346
|
+
$[30] = isContentEditable;
|
|
347
|
+
$[31] = t15;
|
|
348
|
+
} else t15 = $[31];
|
|
349
|
+
const handleMouseLeave = t15;
|
|
264
350
|
const fieldData = { text: fieldValue };
|
|
265
351
|
if (!isContentEditable) return /* @__PURE__ */ jsx(Fragment, { children: children({ children: markdownToReactNodes(fieldValue, {
|
|
266
352
|
pages,
|
|
@@ -268,15 +354,20 @@ function createEditableBlock(options) {
|
|
|
268
354
|
textStyle,
|
|
269
355
|
linkStyle
|
|
270
356
|
}) }, fieldData) });
|
|
271
|
-
|
|
357
|
+
const t16 = children({
|
|
272
358
|
ref: elementRef,
|
|
273
359
|
"data-camox-field-id": fieldId,
|
|
274
|
-
|
|
275
|
-
"data-camox-focused": isFocused || void 0,
|
|
360
|
+
...overlayState,
|
|
276
361
|
"data-camox-overlay-mode": options.synced ? "synced" : void 0,
|
|
277
362
|
onMouseEnter: handleMouseEnter,
|
|
278
363
|
onMouseLeave: handleMouseLeave,
|
|
279
|
-
|
|
364
|
+
onClickCapture: selectField,
|
|
365
|
+
children: isCommentMode ? markdownToReactNodes(fieldValue, {
|
|
366
|
+
pages,
|
|
367
|
+
fallbackHref: currentPathname,
|
|
368
|
+
textStyle,
|
|
369
|
+
linkStyle
|
|
370
|
+
}) : /* @__PURE__ */ jsx(InlineLexicalEditor, {
|
|
280
371
|
textStyle,
|
|
281
372
|
linkStyle,
|
|
282
373
|
pages,
|
|
@@ -287,15 +378,23 @@ function createEditableBlock(options) {
|
|
|
287
378
|
onFocus: handleFocus,
|
|
288
379
|
onBlur: handleBlur
|
|
289
380
|
})
|
|
290
|
-
}, fieldData)
|
|
381
|
+
}, fieldData);
|
|
382
|
+
let t17;
|
|
383
|
+
if ($[32] !== t16) {
|
|
384
|
+
t17 = /* @__PURE__ */ jsx(Fragment, { children: t16 });
|
|
385
|
+
$[32] = t16;
|
|
386
|
+
$[33] = t17;
|
|
387
|
+
} else t17 = $[33];
|
|
388
|
+
return t17;
|
|
291
389
|
};
|
|
292
390
|
const Embed = (t0) => {
|
|
293
|
-
const $ = c(
|
|
294
|
-
if ($[0] !== "
|
|
295
|
-
for (let $i = 0; $i <
|
|
296
|
-
$[0] = "
|
|
391
|
+
const $ = c(39);
|
|
392
|
+
if ($[0] !== "9390cfa3e0bf4e772e82a3d1352a7d56d8ae67f112d215b6d45231db17c01883") {
|
|
393
|
+
for (let $i = 0; $i < 39; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
394
|
+
$[0] = "9390cfa3e0bf4e772e82a3d1352a7d56d8ae67f112d215b6d45231db17c01883";
|
|
297
395
|
}
|
|
298
396
|
const { name, children } = t0;
|
|
397
|
+
const selectTarget = usePreviewSelection();
|
|
299
398
|
const blockContext = React.use(Context);
|
|
300
399
|
if (!blockContext) throw new Error("Embed must be used within a Block Component");
|
|
301
400
|
const { blockId, content, mode } = blockContext;
|
|
@@ -314,39 +413,37 @@ function createEditableBlock(options) {
|
|
|
314
413
|
} else t2 = $[4];
|
|
315
414
|
const fieldId = t2;
|
|
316
415
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
416
|
+
const overlayState = useOverlayState(isHovered);
|
|
317
417
|
const embedRef = React.useRef(null);
|
|
318
418
|
const itemId = repeaterContext?.itemId;
|
|
319
419
|
let t3;
|
|
320
|
-
if ($[5] !== blockId || $[6] !== isContentEditable || $[7] !== itemId || $[8] !== name) {
|
|
321
|
-
t3 = () => {
|
|
420
|
+
if ($[5] !== blockId || $[6] !== isContentEditable || $[7] !== itemId || $[8] !== name || $[9] !== selectTarget) {
|
|
421
|
+
t3 = (event) => {
|
|
322
422
|
if (!isContentEditable) return;
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
type: "selectItemField",
|
|
326
|
-
blockId,
|
|
327
|
-
itemId,
|
|
328
|
-
fieldName: String(name),
|
|
329
|
-
fieldType: "Embed"
|
|
330
|
-
});
|
|
331
|
-
return;
|
|
332
|
-
}
|
|
333
|
-
previewStore.send({
|
|
334
|
-
type: "selectBlockField",
|
|
423
|
+
selectTarget(itemId != null ? {
|
|
424
|
+
type: "item-field",
|
|
335
425
|
blockId,
|
|
426
|
+
itemId,
|
|
336
427
|
fieldName: String(name),
|
|
337
428
|
fieldType: "Embed"
|
|
338
|
-
}
|
|
429
|
+
} : {
|
|
430
|
+
type: "block-field",
|
|
431
|
+
blockId,
|
|
432
|
+
fieldName: String(name),
|
|
433
|
+
fieldType: "Embed"
|
|
434
|
+
}, event);
|
|
339
435
|
};
|
|
340
436
|
$[5] = blockId;
|
|
341
437
|
$[6] = isContentEditable;
|
|
342
438
|
$[7] = itemId;
|
|
343
439
|
$[8] = name;
|
|
344
|
-
$[9] =
|
|
345
|
-
|
|
440
|
+
$[9] = selectTarget;
|
|
441
|
+
$[10] = t3;
|
|
442
|
+
} else t3 = $[10];
|
|
346
443
|
const selectField = t3;
|
|
347
444
|
let t4;
|
|
348
445
|
let t5;
|
|
349
|
-
if ($[
|
|
446
|
+
if ($[11] !== iframeWindow || $[12] !== isContentEditable || $[13] !== selectField) {
|
|
350
447
|
t4 = () => {
|
|
351
448
|
if (!isContentEditable || !iframeWindow) return;
|
|
352
449
|
let timer;
|
|
@@ -355,7 +452,12 @@ function createEditableBlock(options) {
|
|
|
355
452
|
timer = iframeWindow.setTimeout(() => {
|
|
356
453
|
const activeElement = iframeWindow.document.activeElement;
|
|
357
454
|
if (activeElement?.tagName !== "IFRAME") return;
|
|
358
|
-
if (embedRef.current?.contains(activeElement))
|
|
455
|
+
if (!embedRef.current?.contains(activeElement)) return;
|
|
456
|
+
selectField({
|
|
457
|
+
currentTarget: embedRef.current,
|
|
458
|
+
preventDefault() {},
|
|
459
|
+
stopPropagation() {}
|
|
460
|
+
});
|
|
359
461
|
}, 0);
|
|
360
462
|
};
|
|
361
463
|
iframeWindow.addEventListener("blur", handleBlur);
|
|
@@ -369,91 +471,99 @@ function createEditableBlock(options) {
|
|
|
369
471
|
iframeWindow,
|
|
370
472
|
selectField
|
|
371
473
|
];
|
|
372
|
-
$[
|
|
373
|
-
$[
|
|
374
|
-
$[
|
|
375
|
-
$[
|
|
376
|
-
$[
|
|
474
|
+
$[11] = iframeWindow;
|
|
475
|
+
$[12] = isContentEditable;
|
|
476
|
+
$[13] = selectField;
|
|
477
|
+
$[14] = t4;
|
|
478
|
+
$[15] = t5;
|
|
377
479
|
} else {
|
|
378
|
-
t4 = $[
|
|
379
|
-
t5 = $[
|
|
480
|
+
t4 = $[14];
|
|
481
|
+
t5 = $[15];
|
|
380
482
|
}
|
|
381
483
|
React.useEffect(t4, t5);
|
|
382
484
|
let t6;
|
|
383
|
-
if ($[
|
|
485
|
+
if ($[16] !== fieldId) {
|
|
384
486
|
t6 = { fieldId };
|
|
385
|
-
$[
|
|
386
|
-
$[
|
|
387
|
-
} else t6 = $[
|
|
487
|
+
$[16] = fieldId;
|
|
488
|
+
$[17] = t6;
|
|
489
|
+
} else t6 = $[17];
|
|
388
490
|
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_FIELD", "CAMOX_HOVER_FIELD_END", t6);
|
|
389
491
|
let t7;
|
|
390
492
|
let t8;
|
|
391
|
-
if ($[
|
|
493
|
+
if ($[18] !== isHoveredFromSidebar) {
|
|
392
494
|
t7 = () => {
|
|
393
495
|
setIsHovered(isHoveredFromSidebar);
|
|
394
496
|
};
|
|
395
497
|
t8 = [isHoveredFromSidebar];
|
|
396
|
-
$[
|
|
397
|
-
$[
|
|
398
|
-
$[
|
|
498
|
+
$[18] = isHoveredFromSidebar;
|
|
499
|
+
$[19] = t7;
|
|
500
|
+
$[20] = t8;
|
|
399
501
|
} else {
|
|
400
|
-
t7 = $[
|
|
401
|
-
t8 = $[
|
|
502
|
+
t7 = $[19];
|
|
503
|
+
t8 = $[20];
|
|
402
504
|
}
|
|
403
505
|
React.useEffect(t7, t8);
|
|
404
506
|
const t9 = isContentEditable ? fieldId : void 0;
|
|
405
507
|
const t10 = isContentEditable ? "embed" : void 0;
|
|
406
|
-
|
|
508
|
+
let t11;
|
|
509
|
+
if ($[21] !== isContentEditable || $[22] !== overlayState) {
|
|
510
|
+
t11 = isContentEditable ? overlayState : {};
|
|
511
|
+
$[21] = isContentEditable;
|
|
512
|
+
$[22] = overlayState;
|
|
513
|
+
$[23] = t11;
|
|
514
|
+
} else t11 = $[23];
|
|
407
515
|
let t12;
|
|
408
|
-
if ($[
|
|
516
|
+
if ($[24] !== isContentEditable) {
|
|
409
517
|
t12 = isContentEditable ? () => setIsHovered(true) : void 0;
|
|
410
|
-
$[
|
|
411
|
-
$[
|
|
412
|
-
} else t12 = $[
|
|
518
|
+
$[24] = isContentEditable;
|
|
519
|
+
$[25] = t12;
|
|
520
|
+
} else t12 = $[25];
|
|
413
521
|
let t13;
|
|
414
|
-
if ($[
|
|
522
|
+
if ($[26] !== isContentEditable) {
|
|
415
523
|
t13 = isContentEditable ? () => setIsHovered(false) : void 0;
|
|
416
|
-
$[
|
|
417
|
-
$[
|
|
418
|
-
} else t13 = $[
|
|
524
|
+
$[26] = isContentEditable;
|
|
525
|
+
$[27] = t13;
|
|
526
|
+
} else t13 = $[27];
|
|
419
527
|
let t14;
|
|
420
|
-
if ($[
|
|
528
|
+
if ($[28] !== children || $[29] !== fieldValue) {
|
|
421
529
|
t14 = children({ src: fieldValue }, { url: fieldValue });
|
|
422
|
-
$[
|
|
423
|
-
$[
|
|
424
|
-
$[
|
|
425
|
-
} else t14 = $[
|
|
530
|
+
$[28] = children;
|
|
531
|
+
$[29] = fieldValue;
|
|
532
|
+
$[30] = t14;
|
|
533
|
+
} else t14 = $[30];
|
|
426
534
|
let t15;
|
|
427
|
-
if ($[
|
|
535
|
+
if ($[31] !== selectField || $[32] !== t10 || $[33] !== t11 || $[34] !== t12 || $[35] !== t13 || $[36] !== t14 || $[37] !== t9) {
|
|
428
536
|
t15 = /* @__PURE__ */ jsx("div", {
|
|
429
537
|
ref: embedRef,
|
|
430
538
|
onClickCapture: selectField,
|
|
431
539
|
"data-camox-field-id": t9,
|
|
432
540
|
"data-camox-field-type": t10,
|
|
433
|
-
|
|
541
|
+
...t11,
|
|
434
542
|
"data-camox-overlay-mode": options.synced ? "synced" : void 0,
|
|
435
543
|
onMouseEnter: t12,
|
|
436
544
|
onMouseLeave: t13,
|
|
437
545
|
children: t14
|
|
438
546
|
});
|
|
439
|
-
$[
|
|
440
|
-
$[
|
|
441
|
-
$[
|
|
442
|
-
$[
|
|
443
|
-
$[
|
|
444
|
-
$[
|
|
445
|
-
$[
|
|
446
|
-
$[
|
|
447
|
-
} else t15 = $[
|
|
547
|
+
$[31] = selectField;
|
|
548
|
+
$[32] = t10;
|
|
549
|
+
$[33] = t11;
|
|
550
|
+
$[34] = t12;
|
|
551
|
+
$[35] = t13;
|
|
552
|
+
$[36] = t14;
|
|
553
|
+
$[37] = t9;
|
|
554
|
+
$[38] = t15;
|
|
555
|
+
} else t15 = $[38];
|
|
448
556
|
return t15;
|
|
449
557
|
};
|
|
450
558
|
const Link = (t0) => {
|
|
451
|
-
const $ = c(
|
|
452
|
-
if ($[0] !== "
|
|
453
|
-
for (let $i = 0; $i <
|
|
454
|
-
$[0] = "
|
|
559
|
+
const $ = c(32);
|
|
560
|
+
if ($[0] !== "9390cfa3e0bf4e772e82a3d1352a7d56d8ae67f112d215b6d45231db17c01883") {
|
|
561
|
+
for (let $i = 0; $i < 32; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
562
|
+
$[0] = "9390cfa3e0bf4e772e82a3d1352a7d56d8ae67f112d215b6d45231db17c01883";
|
|
455
563
|
}
|
|
456
564
|
const { name, children } = t0;
|
|
565
|
+
const selectTarget = usePreviewSelection();
|
|
566
|
+
const isCommentMode = useSelector(previewStore, selectIsCommentMode);
|
|
457
567
|
const blockContext = React.use(Context);
|
|
458
568
|
if (!blockContext) throw new Error("Link must be used within a Block Component");
|
|
459
569
|
const { blockId, content, mode } = blockContext;
|
|
@@ -502,7 +612,7 @@ function createEditableBlock(options) {
|
|
|
502
612
|
const { data: pages } = useQuery(t6);
|
|
503
613
|
let t7;
|
|
504
614
|
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
505
|
-
t7 = { select:
|
|
615
|
+
t7 = { select: _temp2 };
|
|
506
616
|
$[10] = t7;
|
|
507
617
|
} else t7 = $[10];
|
|
508
618
|
const resolvedHref = resolveLinkHref(fieldValue, pages, useLocation(t7));
|
|
@@ -512,7 +622,7 @@ function createEditableBlock(options) {
|
|
|
512
622
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
513
623
|
const [isEditorFocused, setIsEditorFocused] = React.useState(false);
|
|
514
624
|
const isSelectedFromSelection = useFieldSelection(blockId, String(name), "Link", repeaterContext?.itemId);
|
|
515
|
-
const
|
|
625
|
+
const overlayState = useOverlayState(isHovered, isEditorFocused || isSelectedFromSelection);
|
|
516
626
|
React.useEffect(() => {
|
|
517
627
|
if (!isEditing) setDisplayText(fieldValue.text);
|
|
518
628
|
}, [fieldValue.text, isEditing]);
|
|
@@ -560,39 +670,49 @@ function createEditableBlock(options) {
|
|
|
560
670
|
});
|
|
561
671
|
};
|
|
562
672
|
let t11;
|
|
563
|
-
if ($[20] !== blockId || $[21] !== name || $[22] !== repeaterContext) {
|
|
564
|
-
t11 = () => {
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
if (repeaterContext?.itemId != null) previewStore.send({
|
|
568
|
-
type: "selectItemField",
|
|
673
|
+
if ($[20] !== blockId || $[21] !== name || $[22] !== repeaterContext || $[23] !== selectTarget) {
|
|
674
|
+
t11 = (event) => {
|
|
675
|
+
selectTarget(repeaterContext?.itemId != null ? {
|
|
676
|
+
type: "item-field",
|
|
569
677
|
blockId,
|
|
570
678
|
itemId: repeaterContext.itemId,
|
|
571
679
|
fieldName: String(name),
|
|
572
680
|
fieldType: "Link"
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
type: "selectBlockField",
|
|
681
|
+
} : {
|
|
682
|
+
type: "block-field",
|
|
576
683
|
blockId,
|
|
577
684
|
fieldName: String(name),
|
|
578
685
|
fieldType: "Link"
|
|
579
|
-
});
|
|
686
|
+
}, event);
|
|
580
687
|
};
|
|
581
688
|
$[20] = blockId;
|
|
582
689
|
$[21] = name;
|
|
583
690
|
$[22] = repeaterContext;
|
|
584
|
-
$[23] =
|
|
585
|
-
|
|
586
|
-
|
|
691
|
+
$[23] = selectTarget;
|
|
692
|
+
$[24] = t11;
|
|
693
|
+
} else t11 = $[24];
|
|
694
|
+
const selectField = t11;
|
|
587
695
|
let t12;
|
|
588
|
-
if ($[
|
|
696
|
+
if ($[25] !== selectField) {
|
|
589
697
|
t12 = () => {
|
|
698
|
+
if (selectIsCommentMode(previewStore.getSnapshot())) return;
|
|
699
|
+
setIsEditing(true);
|
|
700
|
+
setIsEditorFocused(true);
|
|
701
|
+
selectField();
|
|
702
|
+
};
|
|
703
|
+
$[25] = selectField;
|
|
704
|
+
$[26] = t12;
|
|
705
|
+
} else t12 = $[26];
|
|
706
|
+
const handleFocus = t12;
|
|
707
|
+
let t13;
|
|
708
|
+
if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
|
|
709
|
+
t13 = () => {
|
|
590
710
|
setIsEditing(false);
|
|
591
711
|
setIsEditorFocused(false);
|
|
592
712
|
};
|
|
593
|
-
$[
|
|
594
|
-
} else
|
|
595
|
-
const handleBlur =
|
|
713
|
+
$[27] = t13;
|
|
714
|
+
} else t13 = $[27];
|
|
715
|
+
const handleBlur = t13;
|
|
596
716
|
const linkData = {
|
|
597
717
|
text: displayText,
|
|
598
718
|
href: resolvedHref,
|
|
@@ -604,53 +724,54 @@ function createEditableBlock(options) {
|
|
|
604
724
|
rel: fieldValue.newTab ? "noreferrer" : void 0,
|
|
605
725
|
children: fieldValue.text
|
|
606
726
|
}, linkData) });
|
|
607
|
-
let t13;
|
|
608
727
|
let t14;
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
t14 = () => setIsHovered(
|
|
612
|
-
|
|
613
|
-
$[
|
|
728
|
+
let t15;
|
|
729
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
730
|
+
t14 = () => setIsHovered(true);
|
|
731
|
+
t15 = () => setIsHovered(false);
|
|
732
|
+
$[28] = t14;
|
|
733
|
+
$[29] = t15;
|
|
614
734
|
} else {
|
|
615
|
-
|
|
616
|
-
|
|
735
|
+
t14 = $[28];
|
|
736
|
+
t15 = $[29];
|
|
617
737
|
}
|
|
618
|
-
const
|
|
738
|
+
const t16 = children({
|
|
619
739
|
ref: elementRef,
|
|
620
740
|
to: resolvedHref,
|
|
621
741
|
target: fieldValue.newTab ? "_blank" : void 0,
|
|
622
742
|
rel: fieldValue.newTab ? "noreferrer" : void 0,
|
|
623
743
|
children: displayText,
|
|
624
744
|
"data-camox-field-id": fieldId,
|
|
625
|
-
|
|
626
|
-
"data-camox-focused": isFocused || void 0,
|
|
745
|
+
...overlayState,
|
|
627
746
|
"data-camox-overlay-mode": options.synced ? "synced" : void 0,
|
|
628
|
-
contentEditable:
|
|
629
|
-
|
|
747
|
+
contentEditable: !isCommentMode,
|
|
748
|
+
onClickCapture: selectField,
|
|
749
|
+
onClick: _temp3,
|
|
630
750
|
onInput: handleInput,
|
|
631
751
|
onFocus: handleFocus,
|
|
632
752
|
onBlur: handleBlur,
|
|
633
|
-
onMouseEnter:
|
|
634
|
-
onMouseLeave:
|
|
635
|
-
onKeyDown:
|
|
753
|
+
onMouseEnter: t14,
|
|
754
|
+
onMouseLeave: t15,
|
|
755
|
+
onKeyDown: _temp4,
|
|
636
756
|
spellCheck: false,
|
|
637
757
|
suppressContentEditableWarning: true
|
|
638
758
|
}, linkData);
|
|
639
|
-
let
|
|
640
|
-
if ($[
|
|
641
|
-
|
|
642
|
-
$[
|
|
643
|
-
$[
|
|
644
|
-
} else
|
|
645
|
-
return
|
|
759
|
+
let t17;
|
|
760
|
+
if ($[30] !== t16) {
|
|
761
|
+
t17 = /* @__PURE__ */ jsx(Fragment, { children: t16 });
|
|
762
|
+
$[30] = t16;
|
|
763
|
+
$[31] = t17;
|
|
764
|
+
} else t17 = $[31];
|
|
765
|
+
return t17;
|
|
646
766
|
};
|
|
647
767
|
const Image = (t0) => {
|
|
648
768
|
const $ = c(22);
|
|
649
|
-
if ($[0] !== "
|
|
769
|
+
if ($[0] !== "9390cfa3e0bf4e772e82a3d1352a7d56d8ae67f112d215b6d45231db17c01883") {
|
|
650
770
|
for (let $i = 0; $i < 22; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
651
|
-
$[0] = "
|
|
771
|
+
$[0] = "9390cfa3e0bf4e772e82a3d1352a7d56d8ae67f112d215b6d45231db17c01883";
|
|
652
772
|
}
|
|
653
773
|
const { name, children } = t0;
|
|
774
|
+
const selectTarget = usePreviewSelection();
|
|
654
775
|
const blockContext = React.use(Context);
|
|
655
776
|
if (!blockContext) throw new Error("Image must be used within a Block Component");
|
|
656
777
|
const { blockId, content, mode } = blockContext;
|
|
@@ -667,7 +788,7 @@ function createEditableBlock(options) {
|
|
|
667
788
|
const overlayItemId = isInlineArrayItem ? repeaterContext.containerItemId : repeaterContext?.itemId;
|
|
668
789
|
const fieldId = overlayItemId != null ? `${blockId}__${overlayItemId}__${overlayFieldName}` : `${blockId}__${overlayFieldName}`;
|
|
669
790
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
670
|
-
const
|
|
791
|
+
const overlayState = useOverlayState(isHovered, useFieldSelection(blockId, overlayFieldName, "Image", overlayItemId));
|
|
671
792
|
let t1;
|
|
672
793
|
if ($[1] !== fieldId) {
|
|
673
794
|
t1 = { fieldId };
|
|
@@ -691,30 +812,29 @@ function createEditableBlock(options) {
|
|
|
691
812
|
}
|
|
692
813
|
React.useEffect(t2, t3);
|
|
693
814
|
let t4;
|
|
694
|
-
if ($[6] !== blockId || $[7] !== isContentEditable || $[8] !== overlayFieldName || $[9] !== overlayItemId) {
|
|
695
|
-
t4 = () => {
|
|
815
|
+
if ($[6] !== blockId || $[7] !== isContentEditable || $[8] !== overlayFieldName || $[9] !== overlayItemId || $[10] !== selectTarget) {
|
|
816
|
+
t4 = (event) => {
|
|
696
817
|
if (!isContentEditable) return;
|
|
697
|
-
|
|
698
|
-
type: "
|
|
818
|
+
selectTarget(overlayItemId != null ? {
|
|
819
|
+
type: "item-field",
|
|
699
820
|
blockId,
|
|
700
821
|
itemId: overlayItemId,
|
|
701
822
|
fieldName: overlayFieldName,
|
|
702
823
|
fieldType: "Image"
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
type: "selectBlockField",
|
|
824
|
+
} : {
|
|
825
|
+
type: "block-field",
|
|
706
826
|
blockId,
|
|
707
827
|
fieldName: overlayFieldName,
|
|
708
828
|
fieldType: "Image"
|
|
709
|
-
});
|
|
710
|
-
previewStore.send({ type: "toggleContentSheet" });
|
|
829
|
+
}, event);
|
|
711
830
|
};
|
|
712
831
|
$[6] = blockId;
|
|
713
832
|
$[7] = isContentEditable;
|
|
714
833
|
$[8] = overlayFieldName;
|
|
715
834
|
$[9] = overlayItemId;
|
|
716
|
-
$[10] =
|
|
717
|
-
|
|
835
|
+
$[10] = selectTarget;
|
|
836
|
+
$[11] = t4;
|
|
837
|
+
} else t4 = $[11];
|
|
718
838
|
const handleClick = t4;
|
|
719
839
|
const imageProps = {
|
|
720
840
|
src: transformImageUrl(fieldValue.url, {
|
|
@@ -728,51 +848,47 @@ function createEditableBlock(options) {
|
|
|
728
848
|
};
|
|
729
849
|
if (!isContentEditable) return /* @__PURE__ */ jsx(Fragment, { children: children(imageProps, fieldValue) });
|
|
730
850
|
const t5 = "image";
|
|
731
|
-
const t6 =
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
$[11] = t10;
|
|
740
|
-
$[12] = t9;
|
|
851
|
+
const t6 = options.synced ? "synced" : void 0;
|
|
852
|
+
let t7;
|
|
853
|
+
let t8;
|
|
854
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
855
|
+
t7 = () => setIsHovered(true);
|
|
856
|
+
t8 = () => setIsHovered(false);
|
|
857
|
+
$[12] = t7;
|
|
858
|
+
$[13] = t8;
|
|
741
859
|
} else {
|
|
742
|
-
|
|
743
|
-
|
|
860
|
+
t7 = $[12];
|
|
861
|
+
t8 = $[13];
|
|
744
862
|
}
|
|
745
|
-
const
|
|
746
|
-
let
|
|
747
|
-
if ($[
|
|
748
|
-
|
|
863
|
+
const t9 = children(imageProps, fieldValue);
|
|
864
|
+
let t10;
|
|
865
|
+
if ($[14] !== fieldId || $[15] !== handleClick || $[16] !== overlayState || $[17] !== t6 || $[18] !== t7 || $[19] !== t8 || $[20] !== t9) {
|
|
866
|
+
t10 = /* @__PURE__ */ jsx("div", {
|
|
749
867
|
"data-camox-field-id": fieldId,
|
|
750
868
|
"data-camox-field-type": t5,
|
|
751
|
-
|
|
752
|
-
"data-camox-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
children: t11
|
|
869
|
+
...overlayState,
|
|
870
|
+
"data-camox-overlay-mode": t6,
|
|
871
|
+
onMouseEnter: t7,
|
|
872
|
+
onMouseLeave: t8,
|
|
873
|
+
onClickCapture: handleClick,
|
|
874
|
+
children: t9
|
|
758
875
|
});
|
|
759
|
-
$[
|
|
760
|
-
$[
|
|
761
|
-
$[
|
|
762
|
-
$[16] = t11;
|
|
876
|
+
$[14] = fieldId;
|
|
877
|
+
$[15] = handleClick;
|
|
878
|
+
$[16] = overlayState;
|
|
763
879
|
$[17] = t6;
|
|
764
880
|
$[18] = t7;
|
|
765
881
|
$[19] = t8;
|
|
766
882
|
$[20] = t9;
|
|
767
|
-
$[21] =
|
|
768
|
-
} else
|
|
769
|
-
return
|
|
883
|
+
$[21] = t10;
|
|
884
|
+
} else t10 = $[21];
|
|
885
|
+
return t10;
|
|
770
886
|
};
|
|
771
887
|
const File = (t0) => {
|
|
772
888
|
const $ = c(9);
|
|
773
|
-
if ($[0] !== "
|
|
889
|
+
if ($[0] !== "9390cfa3e0bf4e772e82a3d1352a7d56d8ae67f112d215b6d45231db17c01883") {
|
|
774
890
|
for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
775
|
-
$[0] = "
|
|
891
|
+
$[0] = "9390cfa3e0bf4e772e82a3d1352a7d56d8ae67f112d215b6d45231db17c01883";
|
|
776
892
|
}
|
|
777
893
|
const { name, children } = t0;
|
|
778
894
|
const blockContext = React.use(Context);
|
|
@@ -846,14 +962,17 @@ function createEditableBlock(options) {
|
|
|
846
962
|
const ImageList = _AssetList;
|
|
847
963
|
const FileList = _AssetList;
|
|
848
964
|
const RepeaterItemWrapper = (t0) => {
|
|
849
|
-
const $ = c(
|
|
850
|
-
if ($[0] !== "
|
|
851
|
-
for (let $i = 0; $i <
|
|
852
|
-
$[0] = "
|
|
965
|
+
const $ = c(20);
|
|
966
|
+
if ($[0] !== "9390cfa3e0bf4e772e82a3d1352a7d56d8ae67f112d215b6d45231db17c01883") {
|
|
967
|
+
for (let $i = 0; $i < 20; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
968
|
+
$[0] = "9390cfa3e0bf4e772e82a3d1352a7d56d8ae67f112d215b6d45231db17c01883";
|
|
853
969
|
}
|
|
854
970
|
const { itemId, blockId, mode, children } = t0;
|
|
855
971
|
const isContentEditable = useIsEditable(mode);
|
|
856
972
|
const { window: iframeWindow } = useFrame();
|
|
973
|
+
const selectTarget = usePreviewSelection();
|
|
974
|
+
const isCommentMode = useSelector(previewStore, selectIsCommentMode);
|
|
975
|
+
const [isLocallyHovered, setIsLocallyHovered] = React.useState(false);
|
|
857
976
|
const isRepeaterHovered = React.useContext(RepeaterHoverContext);
|
|
858
977
|
const t1 = String(blockId);
|
|
859
978
|
const t2 = String(itemId);
|
|
@@ -867,30 +986,71 @@ function createEditableBlock(options) {
|
|
|
867
986
|
$[2] = t2;
|
|
868
987
|
$[3] = t3;
|
|
869
988
|
} else t3 = $[3];
|
|
870
|
-
const
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
989
|
+
const overlayState = useOverlayState(useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_REPEATER_ITEM", "CAMOX_HOVER_REPEATER_ITEM_END", t3) || isRepeaterHovered || isCommentMode && isLocallyHovered);
|
|
990
|
+
let t4;
|
|
991
|
+
if ($[4] !== blockId || $[5] !== isCommentMode || $[6] !== isContentEditable || $[7] !== itemId || $[8] !== selectTarget) {
|
|
992
|
+
t4 = (event) => {
|
|
993
|
+
if (!isContentEditable || !isCommentMode || itemId == null) return;
|
|
994
|
+
const target = event.target;
|
|
995
|
+
if (target.closest("[data-camox-field-id]")) return;
|
|
996
|
+
if (target.closest("[data-camox-repeater-item-id], [data-camox-block-id], [data-camox-comment-block-id]") !== event.currentTarget) return;
|
|
997
|
+
selectTarget({
|
|
998
|
+
type: "item",
|
|
999
|
+
blockId,
|
|
1000
|
+
itemId
|
|
1001
|
+
}, event);
|
|
1002
|
+
};
|
|
1003
|
+
$[4] = blockId;
|
|
1004
|
+
$[5] = isCommentMode;
|
|
1005
|
+
$[6] = isContentEditable;
|
|
1006
|
+
$[7] = itemId;
|
|
1007
|
+
$[8] = selectTarget;
|
|
1008
|
+
$[9] = t4;
|
|
1009
|
+
} else t4 = $[9];
|
|
1010
|
+
const handleClick = t4;
|
|
1011
|
+
const t5 = isContentEditable ? itemId : void 0;
|
|
874
1012
|
let t6;
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
1013
|
+
let t7;
|
|
1014
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1015
|
+
t6 = () => setIsLocallyHovered(true);
|
|
1016
|
+
t7 = () => setIsLocallyHovered(false);
|
|
1017
|
+
$[10] = t6;
|
|
1018
|
+
$[11] = t7;
|
|
1019
|
+
} else {
|
|
1020
|
+
t6 = $[10];
|
|
1021
|
+
t7 = $[11];
|
|
1022
|
+
}
|
|
1023
|
+
let t8;
|
|
1024
|
+
if ($[12] !== isContentEditable || $[13] !== overlayState) {
|
|
1025
|
+
t8 = isContentEditable ? overlayState : {};
|
|
1026
|
+
$[12] = isContentEditable;
|
|
1027
|
+
$[13] = overlayState;
|
|
1028
|
+
$[14] = t8;
|
|
1029
|
+
} else t8 = $[14];
|
|
1030
|
+
let t9;
|
|
1031
|
+
if ($[15] !== children || $[16] !== handleClick || $[17] !== t5 || $[18] !== t8) {
|
|
1032
|
+
t9 = /* @__PURE__ */ jsx("div", {
|
|
1033
|
+
"data-camox-repeater-item-id": t5,
|
|
1034
|
+
onClickCapture: handleClick,
|
|
1035
|
+
onMouseEnter: t6,
|
|
1036
|
+
onMouseLeave: t7,
|
|
1037
|
+
...t8,
|
|
879
1038
|
"data-camox-overlay-mode": options.synced ? "synced" : void 0,
|
|
880
1039
|
children
|
|
881
1040
|
});
|
|
882
|
-
$[
|
|
883
|
-
$[
|
|
884
|
-
$[
|
|
885
|
-
$[
|
|
886
|
-
|
|
887
|
-
|
|
1041
|
+
$[15] = children;
|
|
1042
|
+
$[16] = handleClick;
|
|
1043
|
+
$[17] = t5;
|
|
1044
|
+
$[18] = t8;
|
|
1045
|
+
$[19] = t9;
|
|
1046
|
+
} else t9 = $[19];
|
|
1047
|
+
return t9;
|
|
888
1048
|
};
|
|
889
1049
|
const RepeaterHoverProvider = (t0) => {
|
|
890
1050
|
const $ = c(7);
|
|
891
|
-
if ($[0] !== "
|
|
1051
|
+
if ($[0] !== "9390cfa3e0bf4e772e82a3d1352a7d56d8ae67f112d215b6d45231db17c01883") {
|
|
892
1052
|
for (let $i = 0; $i < 7; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
893
|
-
$[0] = "
|
|
1053
|
+
$[0] = "9390cfa3e0bf4e772e82a3d1352a7d56d8ae67f112d215b6d45231db17c01883";
|
|
894
1054
|
}
|
|
895
1055
|
const { blockId, fieldName, children } = t0;
|
|
896
1056
|
const isContentEditable = useIsEditable("site");
|
|
@@ -921,9 +1081,9 @@ function createEditableBlock(options) {
|
|
|
921
1081
|
};
|
|
922
1082
|
const Repeater = (t0) => {
|
|
923
1083
|
const $ = c(27);
|
|
924
|
-
if ($[0] !== "
|
|
1084
|
+
if ($[0] !== "9390cfa3e0bf4e772e82a3d1352a7d56d8ae67f112d215b6d45231db17c01883") {
|
|
925
1085
|
for (let $i = 0; $i < 27; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
926
|
-
$[0] = "
|
|
1086
|
+
$[0] = "9390cfa3e0bf4e772e82a3d1352a7d56d8ae67f112d215b6d45231db17c01883";
|
|
927
1087
|
}
|
|
928
1088
|
const { name, children } = t0;
|
|
929
1089
|
const blockContext = React.use(Context);
|
|
@@ -1047,19 +1207,21 @@ function createEditableBlock(options) {
|
|
|
1047
1207
|
return t4;
|
|
1048
1208
|
};
|
|
1049
1209
|
const BlockComponent = (t0) => {
|
|
1050
|
-
const $ = c(
|
|
1051
|
-
if ($[0] !== "
|
|
1052
|
-
for (let $i = 0; $i <
|
|
1053
|
-
$[0] = "
|
|
1210
|
+
const $ = c(74);
|
|
1211
|
+
if ($[0] !== "9390cfa3e0bf4e772e82a3d1352a7d56d8ae67f112d215b6d45231db17c01883") {
|
|
1212
|
+
for (let $i = 0; $i < 74; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1213
|
+
$[0] = "9390cfa3e0bf4e772e82a3d1352a7d56d8ae67f112d215b6d45231db17c01883";
|
|
1054
1214
|
}
|
|
1055
1215
|
const { blockData, mode, isFirstBlock, showAddBlockTop, showAddBlockBottom, addBlockAfterPosition } = t0;
|
|
1056
1216
|
const isContentEditable = useIsEditable(mode);
|
|
1057
1217
|
const { window: iframeWindow } = useFrame();
|
|
1058
1218
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
1059
|
-
const
|
|
1060
|
-
const
|
|
1219
|
+
const isCommentMode = useSelector(previewStore, selectIsCommentMode);
|
|
1220
|
+
const selection = useSelector(previewStore, _temp5);
|
|
1061
1221
|
const isAddBlockSidebarOpen = useSelector(previewStore, _temp6);
|
|
1222
|
+
const selectTarget = usePreviewSelection();
|
|
1062
1223
|
const isBlockSelected = selection?.blockId === blockData._id;
|
|
1224
|
+
const overlayState = useOverlayState(isHovered && !isBlockSelected, isBlockSelected);
|
|
1063
1225
|
const ref = React.useRef(null);
|
|
1064
1226
|
const [isFirstRender, setIsFirstRender] = React.useState(true);
|
|
1065
1227
|
let t1;
|
|
@@ -1091,89 +1253,92 @@ function createEditableBlock(options) {
|
|
|
1091
1253
|
$[6] = t3;
|
|
1092
1254
|
} else t3 = $[6];
|
|
1093
1255
|
let t4;
|
|
1094
|
-
if ($[7] !== blockData._id || $[8] !== isBlockSelected || $[9] !== isFirstRender
|
|
1256
|
+
if ($[7] !== blockData._id || $[8] !== isBlockSelected || $[9] !== isFirstRender) {
|
|
1095
1257
|
t4 = [
|
|
1096
1258
|
blockData._id,
|
|
1097
1259
|
isBlockSelected,
|
|
1098
|
-
isFirstRender
|
|
1099
|
-
isPageEditorSidebarOpen
|
|
1260
|
+
isFirstRender
|
|
1100
1261
|
];
|
|
1101
1262
|
$[7] = blockData._id;
|
|
1102
1263
|
$[8] = isBlockSelected;
|
|
1103
1264
|
$[9] = isFirstRender;
|
|
1104
|
-
$[10] =
|
|
1105
|
-
|
|
1106
|
-
} else t4 = $[11];
|
|
1265
|
+
$[10] = t4;
|
|
1266
|
+
} else t4 = $[10];
|
|
1107
1267
|
React.useEffect(t3, t4);
|
|
1108
1268
|
const t5 = String(blockData._id);
|
|
1109
1269
|
let t6;
|
|
1110
|
-
if ($[
|
|
1270
|
+
if ($[11] !== t5) {
|
|
1111
1271
|
t6 = { blockId: t5 };
|
|
1112
|
-
$[
|
|
1113
|
-
$[
|
|
1114
|
-
} else t6 = $[
|
|
1272
|
+
$[11] = t5;
|
|
1273
|
+
$[12] = t6;
|
|
1274
|
+
} else t6 = $[12];
|
|
1115
1275
|
const isHoveredFromSidebar = useOverlayMessage(iframeWindow, isContentEditable, "CAMOX_HOVER_BLOCK", "CAMOX_HOVER_BLOCK_END", t6);
|
|
1116
1276
|
let t7;
|
|
1117
1277
|
let t8;
|
|
1118
|
-
if ($[
|
|
1278
|
+
if ($[13] !== isHoveredFromSidebar) {
|
|
1119
1279
|
t7 = () => {
|
|
1120
1280
|
setIsHovered(isHoveredFromSidebar);
|
|
1121
1281
|
};
|
|
1122
1282
|
t8 = [isHoveredFromSidebar];
|
|
1123
|
-
$[
|
|
1124
|
-
$[
|
|
1125
|
-
$[
|
|
1283
|
+
$[13] = isHoveredFromSidebar;
|
|
1284
|
+
$[14] = t7;
|
|
1285
|
+
$[15] = t8;
|
|
1126
1286
|
} else {
|
|
1127
|
-
t7 = $[
|
|
1128
|
-
t8 = $[
|
|
1287
|
+
t7 = $[14];
|
|
1288
|
+
t8 = $[15];
|
|
1129
1289
|
}
|
|
1130
1290
|
React.useEffect(t7, t8);
|
|
1131
1291
|
let result;
|
|
1132
|
-
if ($[
|
|
1292
|
+
if ($[16] !== blockData.content) {
|
|
1133
1293
|
result = { ...blockData.content };
|
|
1134
1294
|
for (const key in result) {
|
|
1135
1295
|
const value = result[key];
|
|
1136
1296
|
if (Array.isArray(value) && value.length > 0 && value[0]?.content !== void 0) result[key] = value.map(_temp7);
|
|
1137
1297
|
}
|
|
1138
|
-
$[
|
|
1139
|
-
$[
|
|
1140
|
-
} else result = $[
|
|
1298
|
+
$[16] = blockData.content;
|
|
1299
|
+
$[17] = result;
|
|
1300
|
+
} else result = $[17];
|
|
1141
1301
|
const normalizedContent = result;
|
|
1142
1302
|
let t9;
|
|
1143
|
-
if ($[
|
|
1303
|
+
if ($[18] !== blockData._id || $[19] !== isCommentMode || $[20] !== isContentEditable || $[21] !== selectTarget) {
|
|
1144
1304
|
t9 = (e) => {
|
|
1145
1305
|
if (!isContentEditable) return;
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1306
|
+
const target = e.target;
|
|
1307
|
+
if (target.closest("[data-camox-field-id]")) return;
|
|
1308
|
+
if (isCommentMode && target.closest("[data-camox-repeater-item-id]")) return;
|
|
1309
|
+
if (target.closest("[data-camox-block-id], [data-camox-comment-block-id]") !== e.currentTarget) return;
|
|
1310
|
+
selectTarget({
|
|
1311
|
+
type: "block",
|
|
1149
1312
|
blockId: blockData._id
|
|
1150
|
-
});
|
|
1313
|
+
}, e);
|
|
1151
1314
|
};
|
|
1152
|
-
$[
|
|
1315
|
+
$[18] = blockData._id;
|
|
1316
|
+
$[19] = isCommentMode;
|
|
1153
1317
|
$[20] = isContentEditable;
|
|
1154
|
-
$[21] =
|
|
1155
|
-
|
|
1318
|
+
$[21] = selectTarget;
|
|
1319
|
+
$[22] = t9;
|
|
1320
|
+
} else t9 = $[22];
|
|
1156
1321
|
const handleClick = t9;
|
|
1157
1322
|
let t10;
|
|
1158
|
-
if ($[
|
|
1323
|
+
if ($[23] !== isContentEditable) {
|
|
1159
1324
|
t10 = () => {
|
|
1160
1325
|
if (isContentEditable) setIsHovered(true);
|
|
1161
1326
|
};
|
|
1162
|
-
$[
|
|
1163
|
-
$[
|
|
1164
|
-
} else t10 = $[
|
|
1327
|
+
$[23] = isContentEditable;
|
|
1328
|
+
$[24] = t10;
|
|
1329
|
+
} else t10 = $[24];
|
|
1165
1330
|
const handleMouseEnter = t10;
|
|
1166
1331
|
let t11;
|
|
1167
|
-
if ($[
|
|
1332
|
+
if ($[25] !== isContentEditable) {
|
|
1168
1333
|
t11 = () => {
|
|
1169
1334
|
if (isContentEditable) setIsHovered(false);
|
|
1170
1335
|
};
|
|
1171
|
-
$[
|
|
1172
|
-
$[
|
|
1173
|
-
} else t11 = $[
|
|
1336
|
+
$[25] = isContentEditable;
|
|
1337
|
+
$[26] = t11;
|
|
1338
|
+
} else t11 = $[26];
|
|
1174
1339
|
const handleMouseLeave = t11;
|
|
1175
1340
|
let t12;
|
|
1176
|
-
if ($[
|
|
1341
|
+
if ($[27] !== addBlockAfterPosition || $[28] !== blockData.position) {
|
|
1177
1342
|
t12 = (insertPosition) => {
|
|
1178
1343
|
postOverlayMessage({
|
|
1179
1344
|
type: "CAMOX_ADD_BLOCK_REQUEST",
|
|
@@ -1182,113 +1347,118 @@ function createEditableBlock(options) {
|
|
|
1182
1347
|
...addBlockAfterPosition !== void 0 && { afterPosition: addBlockAfterPosition }
|
|
1183
1348
|
});
|
|
1184
1349
|
};
|
|
1185
|
-
$[
|
|
1186
|
-
$[
|
|
1187
|
-
$[
|
|
1188
|
-
} else t12 = $[
|
|
1350
|
+
$[27] = addBlockAfterPosition;
|
|
1351
|
+
$[28] = blockData.position;
|
|
1352
|
+
$[29] = t12;
|
|
1353
|
+
} else t12 = $[29];
|
|
1189
1354
|
const handleAddBlockClick = t12;
|
|
1190
|
-
const shouldShowOverlay = isContentEditable && (
|
|
1355
|
+
const shouldShowOverlay = isContentEditable && (overlayState["data-camox-hovered"] || overlayState["data-camox-focused"]) && !isAddBlockSidebarOpen;
|
|
1191
1356
|
const shouldShowAddBlockOverlay = isAddBlockSidebarOpen && mode !== "peek";
|
|
1192
1357
|
let t13;
|
|
1193
|
-
if ($[
|
|
1358
|
+
if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1194
1359
|
t13 = {
|
|
1195
1360
|
position: "relative",
|
|
1196
1361
|
scrollMargin: "5rem",
|
|
1197
1362
|
background: "var(--background)"
|
|
1198
1363
|
};
|
|
1199
|
-
$[
|
|
1200
|
-
} else t13 = $[
|
|
1364
|
+
$[30] = t13;
|
|
1365
|
+
} else t13 = $[30];
|
|
1201
1366
|
const t14 = isContentEditable ? blockData._id : void 0;
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1367
|
+
let t15;
|
|
1368
|
+
if ($[31] !== overlayState || $[32] !== shouldShowOverlay) {
|
|
1369
|
+
t15 = shouldShowOverlay ? overlayState : {};
|
|
1370
|
+
$[31] = overlayState;
|
|
1371
|
+
$[32] = shouldShowOverlay;
|
|
1372
|
+
$[33] = t15;
|
|
1373
|
+
} else t15 = $[33];
|
|
1374
|
+
const t16 = blockData._id;
|
|
1375
|
+
let t17;
|
|
1376
|
+
if ($[34] !== blockData.content) {
|
|
1377
|
+
t17 = {
|
|
1208
1378
|
...contentDefaults,
|
|
1209
1379
|
...blockData.content
|
|
1210
1380
|
};
|
|
1211
|
-
$[
|
|
1212
|
-
$[
|
|
1213
|
-
} else
|
|
1214
|
-
const merged =
|
|
1381
|
+
$[34] = blockData.content;
|
|
1382
|
+
$[35] = t17;
|
|
1383
|
+
} else t17 = $[35];
|
|
1384
|
+
const merged = t17;
|
|
1215
1385
|
let overrides;
|
|
1216
|
-
if ($[
|
|
1386
|
+
if ($[36] !== merged) {
|
|
1217
1387
|
overrides = {};
|
|
1218
1388
|
for (const key_0 in merged) {
|
|
1219
1389
|
const val = merged[key_0];
|
|
1220
1390
|
if (val && typeof val === "object" && "url" in val && !val.url && contentDefaults[key_0]) overrides[key_0] = contentDefaults[key_0];
|
|
1221
1391
|
}
|
|
1222
|
-
$[
|
|
1223
|
-
$[
|
|
1224
|
-
} else overrides = $[
|
|
1225
|
-
let
|
|
1226
|
-
if ($[
|
|
1227
|
-
|
|
1392
|
+
$[36] = merged;
|
|
1393
|
+
$[37] = overrides;
|
|
1394
|
+
} else overrides = $[37];
|
|
1395
|
+
let t18;
|
|
1396
|
+
if ($[38] !== merged || $[39] !== overrides) {
|
|
1397
|
+
t18 = {
|
|
1228
1398
|
...merged,
|
|
1229
1399
|
...overrides
|
|
1230
1400
|
};
|
|
1231
|
-
$[
|
|
1232
|
-
$[
|
|
1233
|
-
$[
|
|
1234
|
-
} else
|
|
1235
|
-
const
|
|
1236
|
-
let
|
|
1237
|
-
if ($[
|
|
1238
|
-
|
|
1401
|
+
$[38] = merged;
|
|
1402
|
+
$[39] = overrides;
|
|
1403
|
+
$[40] = t18;
|
|
1404
|
+
} else t18 = $[40];
|
|
1405
|
+
const t19 = t18;
|
|
1406
|
+
let t20;
|
|
1407
|
+
if ($[41] !== blockData.settings) {
|
|
1408
|
+
t20 = {
|
|
1239
1409
|
...settingsDefaults,
|
|
1240
1410
|
...blockData.settings
|
|
1241
1411
|
};
|
|
1242
|
-
$[
|
|
1243
|
-
$[
|
|
1244
|
-
} else
|
|
1245
|
-
const
|
|
1246
|
-
let
|
|
1247
|
-
if ($[
|
|
1248
|
-
|
|
1249
|
-
blockId:
|
|
1250
|
-
content:
|
|
1251
|
-
settings:
|
|
1412
|
+
$[41] = blockData.settings;
|
|
1413
|
+
$[42] = t20;
|
|
1414
|
+
} else t20 = $[42];
|
|
1415
|
+
const t21 = t20;
|
|
1416
|
+
let t22;
|
|
1417
|
+
if ($[43] !== blockData._id || $[44] !== isHovered || $[45] !== mode || $[46] !== t19 || $[47] !== t21) {
|
|
1418
|
+
t22 = {
|
|
1419
|
+
blockId: t16,
|
|
1420
|
+
content: t19,
|
|
1421
|
+
settings: t21,
|
|
1252
1422
|
mode,
|
|
1253
1423
|
isHovered,
|
|
1254
1424
|
setIsHovered
|
|
1255
1425
|
};
|
|
1256
|
-
$[
|
|
1257
|
-
$[
|
|
1258
|
-
$[
|
|
1259
|
-
$[
|
|
1260
|
-
$[
|
|
1261
|
-
$[
|
|
1262
|
-
} else
|
|
1426
|
+
$[43] = blockData._id;
|
|
1427
|
+
$[44] = isHovered;
|
|
1428
|
+
$[45] = mode;
|
|
1429
|
+
$[46] = t19;
|
|
1430
|
+
$[47] = t21;
|
|
1431
|
+
$[48] = t22;
|
|
1432
|
+
} else t22 = $[48];
|
|
1433
|
+
let t23;
|
|
1434
|
+
if ($[49] !== normalizedContent) {
|
|
1435
|
+
t23 = /* @__PURE__ */ jsx(options.component, { content: normalizedContent });
|
|
1436
|
+
$[49] = normalizedContent;
|
|
1437
|
+
$[50] = t23;
|
|
1438
|
+
} else t23 = $[50];
|
|
1263
1439
|
let t24;
|
|
1264
|
-
if ($[
|
|
1265
|
-
t24 = /* @__PURE__ */ jsx(
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
} else t24 = $[46];
|
|
1269
|
-
let t25;
|
|
1270
|
-
if ($[47] !== t23 || $[48] !== t24) {
|
|
1271
|
-
t25 = /* @__PURE__ */ jsx(Context.Provider, {
|
|
1272
|
-
value: t23,
|
|
1273
|
-
children: t24
|
|
1440
|
+
if ($[51] !== t22 || $[52] !== t23) {
|
|
1441
|
+
t24 = /* @__PURE__ */ jsx(Context.Provider, {
|
|
1442
|
+
value: t22,
|
|
1443
|
+
children: t23
|
|
1274
1444
|
});
|
|
1275
|
-
$[
|
|
1276
|
-
$[
|
|
1277
|
-
$[
|
|
1278
|
-
} else
|
|
1279
|
-
const
|
|
1280
|
-
let
|
|
1281
|
-
if ($[
|
|
1282
|
-
|
|
1445
|
+
$[51] = t22;
|
|
1446
|
+
$[52] = t23;
|
|
1447
|
+
$[53] = t24;
|
|
1448
|
+
} else t24 = $[53];
|
|
1449
|
+
const t25 = shouldShowAddBlockOverlay || void 0;
|
|
1450
|
+
let t26;
|
|
1451
|
+
if ($[54] !== t25) {
|
|
1452
|
+
t26 = /* @__PURE__ */ jsx("div", {
|
|
1283
1453
|
className: "camox-sheet-overlay",
|
|
1284
|
-
"data-camox-visible":
|
|
1454
|
+
"data-camox-visible": t25
|
|
1285
1455
|
});
|
|
1286
|
-
$[
|
|
1287
|
-
$[
|
|
1288
|
-
} else
|
|
1289
|
-
let
|
|
1290
|
-
if ($[
|
|
1291
|
-
|
|
1456
|
+
$[54] = t25;
|
|
1457
|
+
$[55] = t26;
|
|
1458
|
+
} else t26 = $[55];
|
|
1459
|
+
let t27;
|
|
1460
|
+
if ($[56] !== handleAddBlockClick || $[57] !== isAddBlockSidebarOpen || $[58] !== isCommentMode || $[59] !== isFirstBlock || $[60] !== mode || $[61] !== shouldShowOverlay || $[62] !== showAddBlockBottom || $[63] !== showAddBlockTop) {
|
|
1461
|
+
t27 = shouldShowOverlay && !isCommentMode && /* @__PURE__ */ jsxs(Fragment, { children: [(showAddBlockTop ?? (mode !== "layout" && !isFirstBlock)) && /* @__PURE__ */ jsx(AddBlockControlBar, {
|
|
1292
1462
|
position: "top",
|
|
1293
1463
|
hidden: isAddBlockSidebarOpen,
|
|
1294
1464
|
onMouseLeave: () => setIsHovered(false),
|
|
@@ -1299,46 +1469,45 @@ function createEditableBlock(options) {
|
|
|
1299
1469
|
onMouseLeave: () => setIsHovered(false),
|
|
1300
1470
|
onClick: () => handleAddBlockClick("after")
|
|
1301
1471
|
})] });
|
|
1302
|
-
$[
|
|
1303
|
-
$[
|
|
1304
|
-
$[
|
|
1305
|
-
$[
|
|
1306
|
-
$[
|
|
1307
|
-
$[
|
|
1308
|
-
$[
|
|
1309
|
-
$[
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1472
|
+
$[56] = handleAddBlockClick;
|
|
1473
|
+
$[57] = isAddBlockSidebarOpen;
|
|
1474
|
+
$[58] = isCommentMode;
|
|
1475
|
+
$[59] = isFirstBlock;
|
|
1476
|
+
$[60] = mode;
|
|
1477
|
+
$[61] = shouldShowOverlay;
|
|
1478
|
+
$[62] = showAddBlockBottom;
|
|
1479
|
+
$[63] = showAddBlockTop;
|
|
1480
|
+
$[64] = t27;
|
|
1481
|
+
} else t27 = $[64];
|
|
1482
|
+
let t28;
|
|
1483
|
+
if ($[65] !== handleClick || $[66] !== handleMouseEnter || $[67] !== handleMouseLeave || $[68] !== t14 || $[69] !== t15 || $[70] !== t24 || $[71] !== t26 || $[72] !== t27) {
|
|
1484
|
+
t28 = /* @__PURE__ */ jsxs("div", {
|
|
1314
1485
|
className: "group visual-editing-block",
|
|
1315
1486
|
ref,
|
|
1316
1487
|
style: t13,
|
|
1317
1488
|
"data-camox-block-id": t14,
|
|
1318
|
-
|
|
1319
|
-
"data-camox-focused": t16,
|
|
1489
|
+
...t15,
|
|
1320
1490
|
"data-camox-overlay-mode": options.synced ? "synced" : void 0,
|
|
1321
|
-
|
|
1491
|
+
onClickCapture: handleClick,
|
|
1322
1492
|
onMouseEnter: handleMouseEnter,
|
|
1323
1493
|
onMouseLeave: handleMouseLeave,
|
|
1324
1494
|
children: [
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1495
|
+
t24,
|
|
1496
|
+
t26,
|
|
1497
|
+
t27
|
|
1328
1498
|
]
|
|
1329
1499
|
});
|
|
1330
|
-
$[
|
|
1331
|
-
$[
|
|
1332
|
-
$[
|
|
1333
|
-
$[
|
|
1334
|
-
$[
|
|
1335
|
-
$[
|
|
1336
|
-
$[
|
|
1337
|
-
$[
|
|
1338
|
-
$[
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
return t29;
|
|
1500
|
+
$[65] = handleClick;
|
|
1501
|
+
$[66] = handleMouseEnter;
|
|
1502
|
+
$[67] = handleMouseLeave;
|
|
1503
|
+
$[68] = t14;
|
|
1504
|
+
$[69] = t15;
|
|
1505
|
+
$[70] = t24;
|
|
1506
|
+
$[71] = t26;
|
|
1507
|
+
$[72] = t27;
|
|
1508
|
+
$[73] = t28;
|
|
1509
|
+
} else t28 = $[73];
|
|
1510
|
+
return t28;
|
|
1342
1511
|
};
|
|
1343
1512
|
const useSetting = (name) => {
|
|
1344
1513
|
const ctx = React.use(Context);
|
|
@@ -1350,10 +1519,10 @@ function createEditableBlock(options) {
|
|
|
1350
1519
|
* Provides the same hover, selection, and sheet overlays as the main BlockComponent.
|
|
1351
1520
|
*/
|
|
1352
1521
|
const Detached = (t0) => {
|
|
1353
|
-
const $ = c(
|
|
1354
|
-
if ($[0] !== "
|
|
1355
|
-
for (let $i = 0; $i <
|
|
1356
|
-
$[0] = "
|
|
1522
|
+
const $ = c(32);
|
|
1523
|
+
if ($[0] !== "9390cfa3e0bf4e772e82a3d1352a7d56d8ae67f112d215b6d45231db17c01883") {
|
|
1524
|
+
for (let $i = 0; $i < 32; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
1525
|
+
$[0] = "9390cfa3e0bf4e772e82a3d1352a7d56d8ae67f112d215b6d45231db17c01883";
|
|
1357
1526
|
}
|
|
1358
1527
|
const { children } = t0;
|
|
1359
1528
|
const ctx = React.use(Context);
|
|
@@ -1363,7 +1532,9 @@ function createEditableBlock(options) {
|
|
|
1363
1532
|
const { window: iframeWindow } = useFrame();
|
|
1364
1533
|
const selection = useSelector(previewStore, _temp8);
|
|
1365
1534
|
const isAddBlockSidebarOpen = useSelector(previewStore, _temp9);
|
|
1535
|
+
const selectTarget = usePreviewSelection();
|
|
1366
1536
|
const isBlockSelected = selection?.blockId === blockId;
|
|
1537
|
+
const overlayState = useOverlayState(isHovered && !isBlockSelected, isBlockSelected);
|
|
1367
1538
|
const t1 = String(blockId);
|
|
1368
1539
|
let t2;
|
|
1369
1540
|
if ($[1] !== t1) {
|
|
@@ -1388,68 +1559,74 @@ function createEditableBlock(options) {
|
|
|
1388
1559
|
t4 = $[6];
|
|
1389
1560
|
}
|
|
1390
1561
|
React.useEffect(t3, t4);
|
|
1391
|
-
const shouldShowOverlay = isContentEditable && (
|
|
1562
|
+
const shouldShowOverlay = isContentEditable && (overlayState["data-camox-hovered"] || overlayState["data-camox-focused"]) && !isAddBlockSidebarOpen;
|
|
1392
1563
|
const shouldHideForAddBlockSidebar = isAddBlockSidebarOpen && mode !== "peek";
|
|
1393
1564
|
let t5;
|
|
1394
|
-
if ($[7] !== blockId || $[8] !== isContentEditable) {
|
|
1565
|
+
if ($[7] !== blockId || $[8] !== isContentEditable || $[9] !== selectTarget) {
|
|
1395
1566
|
t5 = (e) => {
|
|
1396
1567
|
if (!isContentEditable) return;
|
|
1397
|
-
e.
|
|
1398
|
-
|
|
1399
|
-
|
|
1568
|
+
const target = e.target;
|
|
1569
|
+
if (target.closest("[data-camox-field-id]")) return;
|
|
1570
|
+
if (selectIsCommentMode(previewStore.getSnapshot()) && target.closest("[data-camox-repeater-item-id]")) return;
|
|
1571
|
+
if (target.closest("[data-camox-block-id], [data-camox-comment-block-id]") !== e.currentTarget) return;
|
|
1572
|
+
selectTarget({
|
|
1573
|
+
type: "block",
|
|
1400
1574
|
blockId
|
|
1401
|
-
});
|
|
1575
|
+
}, e);
|
|
1402
1576
|
};
|
|
1403
1577
|
$[7] = blockId;
|
|
1404
1578
|
$[8] = isContentEditable;
|
|
1405
|
-
$[9] =
|
|
1406
|
-
|
|
1579
|
+
$[9] = selectTarget;
|
|
1580
|
+
$[10] = t5;
|
|
1581
|
+
} else t5 = $[10];
|
|
1407
1582
|
const handleClick = t5;
|
|
1408
1583
|
let t6;
|
|
1409
|
-
if ($[
|
|
1584
|
+
if ($[11] !== isContentEditable || $[12] !== setIsHovered) {
|
|
1410
1585
|
t6 = () => {
|
|
1411
1586
|
if (isContentEditable) setIsHovered(true);
|
|
1412
1587
|
};
|
|
1413
|
-
$[
|
|
1414
|
-
$[
|
|
1415
|
-
$[
|
|
1416
|
-
} else t6 = $[
|
|
1588
|
+
$[11] = isContentEditable;
|
|
1589
|
+
$[12] = setIsHovered;
|
|
1590
|
+
$[13] = t6;
|
|
1591
|
+
} else t6 = $[13];
|
|
1417
1592
|
const handleMouseEnter = t6;
|
|
1418
1593
|
let t7;
|
|
1419
|
-
if ($[
|
|
1594
|
+
if ($[14] !== isContentEditable || $[15] !== setIsHovered) {
|
|
1420
1595
|
t7 = () => {
|
|
1421
1596
|
if (isContentEditable) setIsHovered(false);
|
|
1422
1597
|
};
|
|
1423
|
-
$[
|
|
1424
|
-
$[
|
|
1425
|
-
$[
|
|
1426
|
-
} else t7 = $[
|
|
1598
|
+
$[14] = isContentEditable;
|
|
1599
|
+
$[15] = setIsHovered;
|
|
1600
|
+
$[16] = t7;
|
|
1601
|
+
} else t7 = $[16];
|
|
1427
1602
|
const handleMouseLeave = t7;
|
|
1428
1603
|
const [container, setContainer] = React.useState(null);
|
|
1429
|
-
const t8 =
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1604
|
+
const t8 = isContentEditable ? blockId : void 0;
|
|
1605
|
+
const t9 = shouldHideForAddBlockSidebar ? 0 : 1;
|
|
1606
|
+
let t10;
|
|
1607
|
+
if ($[17] !== children || $[18] !== handleClick || $[19] !== handleMouseEnter || $[20] !== handleMouseLeave || $[21] !== t8 || $[22] !== t9) {
|
|
1608
|
+
t10 = children({
|
|
1609
|
+
"data-camox-comment-block-id": t8,
|
|
1433
1610
|
ref: setContainer,
|
|
1434
|
-
style: { opacity:
|
|
1435
|
-
|
|
1611
|
+
style: { opacity: t9 },
|
|
1612
|
+
onClickCapture: handleClick,
|
|
1436
1613
|
onMouseEnter: handleMouseEnter,
|
|
1437
1614
|
onMouseLeave: handleMouseLeave
|
|
1438
1615
|
});
|
|
1439
|
-
$[
|
|
1440
|
-
$[
|
|
1441
|
-
$[
|
|
1442
|
-
$[
|
|
1443
|
-
$[
|
|
1444
|
-
$[
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1616
|
+
$[17] = children;
|
|
1617
|
+
$[18] = handleClick;
|
|
1618
|
+
$[19] = handleMouseEnter;
|
|
1619
|
+
$[20] = handleMouseLeave;
|
|
1620
|
+
$[21] = t8;
|
|
1621
|
+
$[22] = t9;
|
|
1622
|
+
$[23] = t10;
|
|
1623
|
+
} else t10 = $[23];
|
|
1624
|
+
let t11;
|
|
1625
|
+
if ($[24] !== blockId || $[25] !== container || $[26] !== overlayState || $[27] !== shouldShowOverlay) {
|
|
1626
|
+
t11 = container && createPortal(/* @__PURE__ */ jsx(Fragment, { children: shouldShowOverlay && /* @__PURE__ */ jsx("div", {
|
|
1449
1627
|
"data-camox-block-id": blockId,
|
|
1450
1628
|
"data-camox-detached": true,
|
|
1451
|
-
|
|
1452
|
-
"data-camox-focused": isBlockSelected || void 0,
|
|
1629
|
+
...overlayState,
|
|
1453
1630
|
"data-camox-overlay-mode": options.synced ? "synced" : void 0,
|
|
1454
1631
|
style: {
|
|
1455
1632
|
position: "absolute",
|
|
@@ -1457,20 +1634,20 @@ function createEditableBlock(options) {
|
|
|
1457
1634
|
zIndex: 10
|
|
1458
1635
|
}
|
|
1459
1636
|
}) }), container);
|
|
1460
|
-
$[
|
|
1461
|
-
$[
|
|
1462
|
-
$[
|
|
1463
|
-
$[
|
|
1464
|
-
$[
|
|
1465
|
-
} else
|
|
1466
|
-
let
|
|
1467
|
-
if ($[
|
|
1468
|
-
|
|
1469
|
-
$[
|
|
1470
|
-
$[
|
|
1471
|
-
$[
|
|
1472
|
-
} else
|
|
1473
|
-
return
|
|
1637
|
+
$[24] = blockId;
|
|
1638
|
+
$[25] = container;
|
|
1639
|
+
$[26] = overlayState;
|
|
1640
|
+
$[27] = shouldShowOverlay;
|
|
1641
|
+
$[28] = t11;
|
|
1642
|
+
} else t11 = $[28];
|
|
1643
|
+
let t12;
|
|
1644
|
+
if ($[29] !== t10 || $[30] !== t11) {
|
|
1645
|
+
t12 = /* @__PURE__ */ jsxs(Fragment, { children: [t10, t11] });
|
|
1646
|
+
$[29] = t10;
|
|
1647
|
+
$[30] = t11;
|
|
1648
|
+
$[31] = t12;
|
|
1649
|
+
} else t12 = $[31];
|
|
1650
|
+
return t12;
|
|
1474
1651
|
};
|
|
1475
1652
|
return {
|
|
1476
1653
|
Detached,
|
|
@@ -1550,20 +1727,20 @@ function createEditableBlock(options) {
|
|
|
1550
1727
|
function _temp(l) {
|
|
1551
1728
|
return l.pathname;
|
|
1552
1729
|
}
|
|
1553
|
-
function _temp2(
|
|
1730
|
+
function _temp2(l) {
|
|
1731
|
+
return l.pathname;
|
|
1732
|
+
}
|
|
1733
|
+
function _temp3(e_0) {
|
|
1554
1734
|
return e_0.preventDefault();
|
|
1555
1735
|
}
|
|
1556
|
-
function
|
|
1736
|
+
function _temp4(e_1) {
|
|
1557
1737
|
if (e_1.key === "Escape") e_1.target.blur();
|
|
1558
1738
|
}
|
|
1559
|
-
function
|
|
1739
|
+
function _temp5(state) {
|
|
1560
1740
|
return state.context.selection;
|
|
1561
1741
|
}
|
|
1562
|
-
function
|
|
1563
|
-
return state_0.context.
|
|
1564
|
-
}
|
|
1565
|
-
function _temp6(state_1) {
|
|
1566
|
-
return state_1.context.isAddBlockSidebarOpen;
|
|
1742
|
+
function _temp6(state_0) {
|
|
1743
|
+
return state_0.context.isAddBlockSidebarOpen;
|
|
1567
1744
|
}
|
|
1568
1745
|
function _temp7(item) {
|
|
1569
1746
|
return item.content;
|