camox 0.71.0 → 0.74.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 +4 -103
- package/dist/core/createApp.js +3 -24
- package/dist/core/createBlock.d.ts +2 -2
- package/dist/core/createBlock.js +41 -185
- package/dist/core/createLayout.d.ts +6 -77
- package/dist/core/createLayout.js +12 -50
- package/dist/core/editing/createEditableBlock.d.ts +9 -75
- package/dist/core/editing/createEditableBlock.js +258 -640
- package/dist/core/hooks/useIsEditable.js +2 -2
- package/dist/core/lib/artifactData.js +8 -3
- package/dist/core/lib/contentType.d.ts +23 -38
- package/dist/core/lib/contentType.js +34 -62
- package/dist/core/lib/iconTypes.d.ts +0 -3
- package/dist/core/lib/icons.js +63 -51
- package/dist/core/lib/recordScope.js +1 -1
- package/dist/features/canvas/CanvasOverlays.js +94 -176
- package/dist/features/canvas/CanvasPageFrame.js +62 -68
- package/dist/features/canvas/CanvasPreviewPageSlot.js +1 -3
- package/dist/features/canvas/canvasOverlayGeometry.js +1 -7
- package/dist/features/canvas/sidebar/CuratedPageInspector.js +3 -21
- package/dist/features/canvas/sidebar/LayoutPageBlocks.js +1 -2
- package/dist/features/canvas/useCanvasCamera.js +1 -1
- package/dist/features/canvas/useCanvasFrame.js +1 -1
- package/dist/features/content/ContentCollection.js +2 -2
- package/dist/features/content/collection-form.js +6 -7
- package/dist/features/page/CuratedPageContent.js +15 -24
- package/dist/features/page/UnplacedBlockContent.js +1 -6
- package/dist/features/preview/CamoxPreview.js +30 -33
- package/dist/features/preview/EditablePageContent.js +131 -151
- package/dist/features/preview/components/BlockActionsPopover.js +43 -152
- package/dist/features/preview/components/CanvasPreview.js +2 -2
- package/dist/features/preview/components/Frame.js +3 -3
- package/dist/features/preview/components/IconFieldEditor.js +1 -1
- package/dist/features/preview/components/ItemFieldsEditor.js +1 -3
- package/dist/features/preview/components/Overlays.js +18 -84
- package/dist/features/preview/components/PageInfo.js +121 -98
- package/dist/features/preview/components/PageTree.js +57 -103
- package/dist/features/preview/components/PreviewPanel.js +8 -11
- package/dist/features/preview/components/RecordCombobox.js +65 -78
- package/dist/features/preview/components/ReferenceFieldEditor.js +1 -19
- package/dist/features/preview/components/ReferenceListFieldEditor.js +1 -19
- package/dist/features/preview/components/RemovedBlockPlaceholder.js +2 -2
- package/dist/features/preview/components/SelectionEditor.js +6 -5
- package/dist/features/preview/components/useRepeatableItemActions.js +18 -24
- package/dist/features/preview/components/useUpdateBlockPosition.js +1 -1
- package/dist/features/preview/overlayMessages.js +1 -4
- package/dist/features/preview/previewStore.js +3 -23
- package/dist/features/renderer/RendererApp.js +17 -141
- package/dist/features/renderer/definitionAnswers.js +1 -8
- package/dist/features/renderer/rendererHost.js +1 -31
- package/dist/features/renderer/studioConnection.js +1 -25
- package/dist/features/routes/pageRuntime.js +15 -4
- package/dist/features/runtime/ClaimCard.js +192 -0
- package/dist/features/runtime/pageApp.js +5 -4
- package/dist/features/runtime/runtime.js +29 -8
- package/dist/features/runtime/worker.js +2 -2
- package/dist/features/runtime/workerRequest.d.ts +6 -0
- package/dist/features/runtime/workerRequest.js +13 -1
- package/dist/features/runtime/workerRuntime.d.ts +2 -2
- package/dist/features/runtime/workerRuntime.js +2 -2
- package/dist/features/studio/components/AgentSidebar.js +7 -7
- package/dist/features/studio/components/ChatWidget.js +142 -106
- package/dist/features/studio/components/ContentFindings.js +127 -230
- package/dist/features/studio/components/DeleteDraftDialog.js +112 -0
- package/dist/features/studio/components/DraftBar.js +98 -53
- package/dist/features/studio/components/DraftsControl.js +203 -190
- package/dist/features/studio/components/ReviewDraftDialog.js +670 -0
- package/dist/features/studio/components/{Patrol.js → Specialists.js} +291 -330
- package/dist/features/studio/components/Squareling.js +5 -5
- package/dist/features/studio/components/ThreadComposer.js +106 -127
- package/dist/features/studio/components/ThreadMessages.js +137 -45
- package/dist/features/studio/findingSentence.js +14 -12
- package/dist/features/studio/fixMessage.js +23 -0
- package/dist/features/studio/reportSentence.js +1 -1
- package/dist/features/studio/{patrollerBio.js → specialistBio.js} +8 -5
- package/dist/features/studio/studioStore.js +29 -15
- package/dist/features/studio/workingSentence.js +1 -1
- package/dist/features/vite/blockBoilerplate.js +1 -1
- package/dist/features/vite/definitionsSync.js +1 -8
- package/dist/lib/api-client.js +5 -1
- package/dist/lib/queries.js +5 -6
- package/dist/lib/studio-definitions.js +0 -2
- package/dist/lib/studio-reads.d.ts +1 -1
- package/dist/lib/studio-reads.js +5 -10
- package/dist/lib/use-thread.js +196 -138
- package/dist/package.js +1 -1
- package/dist/studio-overlays.css +0 -29
- package/dist/studio.css +1 -1
- package/package.json +4 -4
- package/skills/camox/SKILL.md +1 -1
- package/skills/camox/references/artifacts.md +4 -4
- package/skills/camox/references/block-definitions.md +21 -25
- package/skills/camox/references/dom-integrations.md +1 -1
- package/skills/camox/references/layout-definitions.md +3 -12
- package/skills/camox/references/routed-layouts.md +2 -2
- package/skills/camox-expand/SKILL.md +5 -5
- package/skills/camoxify/SKILL.md +4 -4
- package/dist/features/canvas/canvasInsertionSeams.js +0 -44
- package/dist/features/preview/components/AddBlockSheet.js +0 -314
- package/dist/features/preview/components/BlockPeek.js +0 -66
- package/dist/features/preview/components/BlockThumbnail.js +0 -281
- package/dist/features/preview/components/blockGridNavigation.js +0 -15
- package/dist/features/preview/referencePickerFocus.js +0 -29
- package/dist/features/studio/components/ReviewDraftSheet.js +0 -1587
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { artifactFrameProps, artifactPlaceholderProps, artifactStandInProps, isArtifactSource } from "../lib/artifact.js";
|
|
2
2
|
import { artifactData } from "../lib/artifactData.js";
|
|
3
|
-
import { resolveBlockFields, resolveToMarkdown, resolveToStructuredData, resolveToTitle } from "../lib/contentType.js";
|
|
3
|
+
import { placeholderImage, resolveBlockFields, resolveToMarkdown, resolveToStructuredData, resolveToTitle } from "../lib/contentType.js";
|
|
4
4
|
import { useLocation, useNavigate } from "../../features/navigation/navigation.js";
|
|
5
5
|
import { useOptionalCamoxApp } from "../../features/provider/components/CamoxAppContext.js";
|
|
6
6
|
import { useProjectUuid } from "../../lib/auth.js";
|
|
@@ -12,7 +12,6 @@ import { renderImagePlaceholder } from "../lib/imagePlaceholder.js";
|
|
|
12
12
|
import { buildImageSrcSet, getDefaultImageSizes, getDefaultImageWidth, transformImageUrl } from "../lib/imageTransform.js";
|
|
13
13
|
import { markdownToReactNodes } from "../lib/lexicalReact.js";
|
|
14
14
|
import { resolveReference, resolveReferenceList } from "../lib/reference.js";
|
|
15
|
-
import { referencePickerFocus } from "../../features/preview/referencePickerFocus.js";
|
|
16
15
|
import { selectionBlockId } from "../../features/preview/previewStore.js";
|
|
17
16
|
import { overlayFieldId, recordPlacementId } from "../../features/preview/overlayMessages.js";
|
|
18
17
|
import { useIsEditable } from "../hooks/useIsEditable.js";
|
|
@@ -29,9 +28,8 @@ import { useOverlayMessage } from "../hooks/useOverlayMessage.js";
|
|
|
29
28
|
import { useOverlayState } from "../hooks/useOverlayState.js";
|
|
30
29
|
import { c } from "react/compiler-runtime";
|
|
31
30
|
import * as React from "react";
|
|
32
|
-
import { isQueryBacked } from "@camox/api-contract";
|
|
31
|
+
import { emptyFieldValues, isQueryBacked } from "@camox/api-contract";
|
|
33
32
|
import { Type } from "@sinclair/typebox";
|
|
34
|
-
import { generateKeyBetween } from "fractional-indexing";
|
|
35
33
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
36
34
|
|
|
37
35
|
//#region src/core/editing/createEditableBlock.tsx
|
|
@@ -67,97 +65,6 @@ const resolveLinkHref = (link, pages, currentPathname) => {
|
|
|
67
65
|
if (!link.href || link.href.startsWith("#")) return `${currentPathname}${link.href ?? ""}`;
|
|
68
66
|
return link.href;
|
|
69
67
|
};
|
|
70
|
-
/**
|
|
71
|
-
* Recursively walks schema properties to generate RepeatableItemSeed objects.
|
|
72
|
-
* Sets `_itemId` placeholder markers on `content` for each repeatable field,
|
|
73
|
-
* and pushes seed objects into `allSeeds`.
|
|
74
|
-
*/
|
|
75
|
-
function buildInitialSeeds(properties, parentTempId, content, allSeeds, counter) {
|
|
76
|
-
for (const [fieldName, fieldSchema] of Object.entries(properties)) {
|
|
77
|
-
if (fieldSchema.type !== "array" || !fieldSchema.items?.properties) continue;
|
|
78
|
-
const ft = fieldSchema.fieldType;
|
|
79
|
-
if (ft === "ImageList" || ft === "FileList") continue;
|
|
80
|
-
const defaultCount = fieldSchema.defaultItems ?? fieldSchema.minItems ?? 0;
|
|
81
|
-
if (defaultCount <= 0) continue;
|
|
82
|
-
const itemProperties = fieldSchema.items.properties;
|
|
83
|
-
const itemContent = {};
|
|
84
|
-
for (const [propName, propSchema] of Object.entries(itemProperties)) {
|
|
85
|
-
if (propSchema.type === "array" && propSchema.items?.properties) continue;
|
|
86
|
-
if ("default" in propSchema) itemContent[propName] = propSchema.default;
|
|
87
|
-
}
|
|
88
|
-
const itemSettingsDefaults = fieldSchema.defaultItemSettings;
|
|
89
|
-
const markers = [];
|
|
90
|
-
let prevPosition = null;
|
|
91
|
-
for (let i = 0; i < defaultCount; i++) {
|
|
92
|
-
const tempId = `seed_${++counter.value}`;
|
|
93
|
-
const position = generateKeyBetween(prevPosition, null);
|
|
94
|
-
prevPosition = position;
|
|
95
|
-
allSeeds.push({
|
|
96
|
-
tempId,
|
|
97
|
-
parentTempId,
|
|
98
|
-
fieldName,
|
|
99
|
-
content: { ...itemContent },
|
|
100
|
-
settings: itemSettingsDefaults ? { ...itemSettingsDefaults } : void 0,
|
|
101
|
-
position
|
|
102
|
-
});
|
|
103
|
-
markers.push({ _itemId: tempId });
|
|
104
|
-
buildInitialSeeds(itemProperties, tempId, {}, allSeeds, counter);
|
|
105
|
-
}
|
|
106
|
-
content[fieldName] = markers;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Recursively walks schema properties to generate fake repeatable items for peek mode.
|
|
111
|
-
* Sets `_itemId` markers on `content` for each repeatable field,
|
|
112
|
-
* and pushes the corresponding fake items into `allItems`.
|
|
113
|
-
*/
|
|
114
|
-
function buildPeekItems(properties, blockId, parentItemId, content, allItems, counter) {
|
|
115
|
-
for (const [fieldName, fieldSchema] of Object.entries(properties)) {
|
|
116
|
-
if (fieldSchema.type !== "array" || !fieldSchema.items?.properties) continue;
|
|
117
|
-
if (fieldSchema.fieldType === "ImageList" || fieldSchema.fieldType === "FileList") continue;
|
|
118
|
-
const defaultCount = fieldSchema.defaultItems ?? fieldSchema.minItems ?? 0;
|
|
119
|
-
if (defaultCount <= 0) continue;
|
|
120
|
-
const itemProperties = fieldSchema.items.properties;
|
|
121
|
-
const itemContent = {};
|
|
122
|
-
for (const [propName, propSchema] of Object.entries(itemProperties)) {
|
|
123
|
-
if (propSchema.type === "array" && propSchema.items?.properties) continue;
|
|
124
|
-
if ("default" in propSchema) itemContent[propName] = propSchema.default;
|
|
125
|
-
}
|
|
126
|
-
const itemSettingsDefaults = fieldSchema.defaultItemSettings;
|
|
127
|
-
const markers = [];
|
|
128
|
-
let prevPosition = null;
|
|
129
|
-
for (let i = 0; i < defaultCount; i++) {
|
|
130
|
-
const itemId = `peek_${++counter.value}`;
|
|
131
|
-
const position = generateKeyBetween(prevPosition, null);
|
|
132
|
-
prevPosition = position;
|
|
133
|
-
allItems.push({
|
|
134
|
-
id: itemId,
|
|
135
|
-
blockId,
|
|
136
|
-
parentItemId,
|
|
137
|
-
fieldName,
|
|
138
|
-
content: { ...itemContent },
|
|
139
|
-
settings: itemSettingsDefaults ? { ...itemSettingsDefaults } : null,
|
|
140
|
-
summary: "",
|
|
141
|
-
title: "",
|
|
142
|
-
position,
|
|
143
|
-
createdAt: 0,
|
|
144
|
-
updatedAt: 0,
|
|
145
|
-
projectId: null,
|
|
146
|
-
sharedContentType: null,
|
|
147
|
-
references: {}
|
|
148
|
-
});
|
|
149
|
-
markers.push({ _itemId: itemId });
|
|
150
|
-
const nestedContent = {};
|
|
151
|
-
buildPeekItems(itemProperties, blockId, itemId, nestedContent, allItems, counter);
|
|
152
|
-
const item = allItems.find((it) => it.id === itemId);
|
|
153
|
-
item.content = {
|
|
154
|
-
...item.content,
|
|
155
|
-
...nestedContent
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
content[fieldName] = markers;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
68
|
function createEditableBlock(options) {
|
|
162
69
|
const fields = resolveBlockFields(options);
|
|
163
70
|
const typeboxSchema = Type.Object(fields.content);
|
|
@@ -177,29 +84,8 @@ function createEditableBlock(options) {
|
|
|
177
84
|
properties: settingsTypeboxSchema.properties,
|
|
178
85
|
required: Object.keys(fields.settings)
|
|
179
86
|
} : void 0;
|
|
180
|
-
const
|
|
181
|
-
const
|
|
182
|
-
for (const [key, prop] of Object.entries(typeboxSchema.properties)) if ("default" in prop) {
|
|
183
|
-
contentDefaults[key] = prop.default;
|
|
184
|
-
const ft = prop.fieldType;
|
|
185
|
-
if (ft === "Image" || ft === "File" || ft === "ImageList" || ft === "FileList" || ft === "Repeater") continue;
|
|
186
|
-
contentDefaultsForStorage[key] = prop.default;
|
|
187
|
-
}
|
|
188
|
-
const repeatableItemDefaults = {};
|
|
189
|
-
const repeatableItemSettingsDefaults = {};
|
|
190
|
-
for (const [key, prop] of Object.entries(typeboxSchema.properties)) {
|
|
191
|
-
const p = prop;
|
|
192
|
-
if (p.type === "array" && p.items?.properties) {
|
|
193
|
-
const itemDefaults = {};
|
|
194
|
-
for (const [itemKey, itemProp] of Object.entries(p.items.properties)) if (itemProp && typeof itemProp === "object" && "default" in itemProp) itemDefaults[itemKey] = itemProp.default;
|
|
195
|
-
if (Object.keys(itemDefaults).length > 0) repeatableItemDefaults[key] = itemDefaults;
|
|
196
|
-
if (p.defaultItemSettings && typeof p.defaultItemSettings === "object") repeatableItemSettingsDefaults[key] = p.defaultItemSettings;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
const settingsDefaults = {};
|
|
200
|
-
if (settingsTypeboxSchema) {
|
|
201
|
-
for (const [key, prop] of Object.entries(settingsTypeboxSchema.properties)) if ("default" in prop) settingsDefaults[key] = prop.default;
|
|
202
|
-
}
|
|
87
|
+
const emptyContent = emptyFieldValues(typeboxSchema);
|
|
88
|
+
const emptySettings = emptyFieldValues(settingsTypeboxSchema);
|
|
203
89
|
const ToReact = options.toReact;
|
|
204
90
|
const Context = React.createContext(null);
|
|
205
91
|
const RepeatableItemContext = React.createContext(null);
|
|
@@ -212,8 +98,8 @@ function createEditableBlock(options) {
|
|
|
212
98
|
const selectTarget = usePreviewSelection();
|
|
213
99
|
const blockContext = React.use(Context);
|
|
214
100
|
if (!blockContext) throw new Error("Field must be used within a Block Component");
|
|
215
|
-
const { blockId, content
|
|
216
|
-
const isContentEditable = useIsEditable(
|
|
101
|
+
const { blockId, content } = blockContext;
|
|
102
|
+
const isContentEditable = useIsEditable();
|
|
217
103
|
const elementRef = React.useRef(null);
|
|
218
104
|
const { window: iframeWindow } = useFrame();
|
|
219
105
|
const pages = useEditorLinkPages();
|
|
@@ -414,7 +300,7 @@ function createEditableBlock(options) {
|
|
|
414
300
|
const item = React.use(RepeatableItemContext);
|
|
415
301
|
const selectTarget = usePreviewSelection();
|
|
416
302
|
if (!block) throw new Error("Icon must be used within a Block Component");
|
|
417
|
-
const editable = useIsEditable(
|
|
303
|
+
const editable = useIsEditable();
|
|
418
304
|
const fieldName = String(name);
|
|
419
305
|
const value = item ? item.itemContent[name] : block.content[name];
|
|
420
306
|
const t1 = item?.itemId;
|
|
@@ -521,8 +407,8 @@ function createEditableBlock(options) {
|
|
|
521
407
|
const selectTarget = usePreviewSelection();
|
|
522
408
|
const blockContext = React.use(Context);
|
|
523
409
|
if (!blockContext) throw new Error("Embed must be used within a Block Component");
|
|
524
|
-
const { blockId, content
|
|
525
|
-
const isContentEditable = useIsEditable(
|
|
410
|
+
const { blockId, content } = blockContext;
|
|
411
|
+
const isContentEditable = useIsEditable();
|
|
526
412
|
const { window: iframeWindow } = useFrame();
|
|
527
413
|
const repeaterContext = React.use(RepeatableItemContext);
|
|
528
414
|
const fieldValue = repeaterContext ? repeaterContext.itemContent[name] : content[name];
|
|
@@ -690,8 +576,8 @@ function createEditableBlock(options) {
|
|
|
690
576
|
const selectTarget = usePreviewSelection();
|
|
691
577
|
const blockContext = React.use(Context);
|
|
692
578
|
if (!blockContext) throw new Error("Artifact must be used within a Block Component");
|
|
693
|
-
const { blockId, content
|
|
694
|
-
const isContentEditable = useIsEditable(
|
|
579
|
+
const { blockId, content } = blockContext;
|
|
580
|
+
const isContentEditable = useIsEditable();
|
|
695
581
|
const { window: iframeWindow } = useFrame();
|
|
696
582
|
const repeaterContext = React.use(RepeatableItemContext);
|
|
697
583
|
const value = repeaterContext ? repeaterContext.itemContent[name] : content[name];
|
|
@@ -901,8 +787,8 @@ function createEditableBlock(options) {
|
|
|
901
787
|
const selectTarget = usePreviewSelection();
|
|
902
788
|
const blockContext = React.use(Context);
|
|
903
789
|
if (!blockContext) throw new Error("Link must be used within a Block Component");
|
|
904
|
-
const { blockId, content
|
|
905
|
-
const isContentEditable = useIsEditable(
|
|
790
|
+
const { blockId, content } = blockContext;
|
|
791
|
+
const isContentEditable = useIsEditable();
|
|
906
792
|
const elementRef = React.useRef(null);
|
|
907
793
|
const { window: iframeWindow } = useFrame();
|
|
908
794
|
const repeaterContext = React.use(RepeatableItemContext);
|
|
@@ -1074,15 +960,15 @@ function createEditableBlock(options) {
|
|
|
1074
960
|
const selectTarget = usePreviewSelection();
|
|
1075
961
|
const blockContext = React.use(Context);
|
|
1076
962
|
if (!blockContext) throw new Error("Image must be used within a Block Component");
|
|
1077
|
-
const { blockId, content
|
|
1078
|
-
const isContentEditable = useIsEditable(
|
|
963
|
+
const { blockId, content } = blockContext;
|
|
964
|
+
const isContentEditable = useIsEditable();
|
|
1079
965
|
const { window: iframeWindow } = useFrame();
|
|
1080
966
|
const repeaterContext = React.use(RepeatableItemContext);
|
|
1081
967
|
const { filesMap } = useNormalizedData();
|
|
1082
968
|
const rawSource = repeaterContext ? repeaterContext.itemContent[name] : content[name];
|
|
1083
969
|
const rawValue = resolveAssetValue(rawSource, filesMap);
|
|
1084
|
-
const
|
|
1085
|
-
const fieldValue = rawValue
|
|
970
|
+
const fieldSchema = repeaterContext ? repeaterContext.itemSchema?.[name] : (blockContext.sourceSchema ?? typeboxSchema.properties)[name];
|
|
971
|
+
const fieldValue = rawValue?.url ? rawValue : placeholderImage(fieldSchema?.title);
|
|
1086
972
|
const isInlineArrayItem = repeaterContext != null && repeaterContext.itemId == null;
|
|
1087
973
|
const overlayFieldName = isInlineArrayItem ? repeaterContext.arrayFieldName : String(name);
|
|
1088
974
|
const overlayItemId = isInlineArrayItem ? repeaterContext.containerItemId : repeaterContext?.itemId;
|
|
@@ -1213,16 +1099,14 @@ function createEditableBlock(options) {
|
|
|
1213
1099
|
const { name, children } = t0;
|
|
1214
1100
|
const blockContext = React.use(Context);
|
|
1215
1101
|
if (!blockContext) throw new Error("File must be used within a Block Component");
|
|
1216
|
-
const { blockId, content
|
|
1217
|
-
const isContentEditable = useIsEditable(
|
|
1102
|
+
const { blockId, content } = blockContext;
|
|
1103
|
+
const isContentEditable = useIsEditable();
|
|
1218
1104
|
const { window: iframeWindow } = useFrame();
|
|
1219
1105
|
const repeaterContext = React.use(RepeatableItemContext);
|
|
1220
1106
|
const reference = React.use(ReferenceContext);
|
|
1221
1107
|
const { filesMap } = useNormalizedData();
|
|
1222
1108
|
const rawSource = repeaterContext ? repeaterContext.itemContent[name] : content[name];
|
|
1223
|
-
const
|
|
1224
|
-
const defaultValue = repeaterContext ? repeatableItemDefaults[repeaterContext.arrayFieldName]?.[String(name)] : contentDefaults[String(name)];
|
|
1225
|
-
const fieldValue = rawValue ?? defaultValue;
|
|
1109
|
+
const fieldValue = resolveAssetValue(rawSource, filesMap);
|
|
1226
1110
|
const isInlineArrayItem = repeaterContext != null && repeaterContext.itemId == null;
|
|
1227
1111
|
const overlayFieldName = isInlineArrayItem ? repeaterContext.arrayFieldName : String(name);
|
|
1228
1112
|
const fieldId = getOverlayFieldId(blockId, overlayFieldName, { reference });
|
|
@@ -1236,6 +1120,7 @@ function createEditableBlock(options) {
|
|
|
1236
1120
|
setPrevSidebarHover(isHoveredFromSidebar);
|
|
1237
1121
|
setIsHovered(isHoveredFromSidebar);
|
|
1238
1122
|
}
|
|
1123
|
+
if (!fieldValue?.url) return null;
|
|
1239
1124
|
const linkProps = {
|
|
1240
1125
|
href: fieldValue.url,
|
|
1241
1126
|
download: fieldValue.filename
|
|
@@ -1269,17 +1154,10 @@ function createEditableBlock(options) {
|
|
|
1269
1154
|
const parentRepeaterContext = React.use(RepeatableItemContext);
|
|
1270
1155
|
const { filesMap } = useNormalizedData();
|
|
1271
1156
|
const fieldName = String(name);
|
|
1272
|
-
const
|
|
1273
|
-
const ft = fieldSchema?.fieldType;
|
|
1157
|
+
const ft = (parentRepeaterContext ? typeboxSchema.properties[parentRepeaterContext.arrayFieldName]?.items?.properties?.[fieldName] : (blockContext.sourceSchema ?? typeboxSchema.properties)[fieldName])?.fieldType;
|
|
1274
1158
|
if (ft !== "ImageList" && ft !== "FileList") throw new Error(`"${fieldName}" is not an imageList or fileList field`);
|
|
1275
1159
|
const source = parentRepeaterContext ? parentRepeaterContext.itemContent[fieldName] : blockContext.content[fieldName];
|
|
1276
|
-
|
|
1277
|
-
if (arr.length === 0) {
|
|
1278
|
-
const defaultCount = fieldSchema.defaultItems ?? 0;
|
|
1279
|
-
const itemDefault = fieldSchema.items?.default;
|
|
1280
|
-
if (defaultCount > 0 && itemDefault) arr = Array.from({ length: defaultCount }, () => itemDefault);
|
|
1281
|
-
}
|
|
1282
|
-
const resolved = arr.map((v) => resolveAssetValue(v, filesMap)).filter((v) => v != null && typeof v === "object" && "url" in v);
|
|
1160
|
+
const resolved = (Array.isArray(source) ? source : []).map((v) => resolveAssetValue(v, filesMap)).filter((v) => v != null && typeof v === "object" && "url" in v);
|
|
1283
1161
|
const Single = ft === "ImageList" ? Image : File;
|
|
1284
1162
|
return /* @__PURE__ */ jsx(RepeaterHoverProvider, {
|
|
1285
1163
|
blockId: blockContext.blockId,
|
|
@@ -1304,8 +1182,8 @@ function createEditableBlock(options) {
|
|
|
1304
1182
|
const FileList = _AssetList;
|
|
1305
1183
|
const RepeatableItemWrapper = (t0) => {
|
|
1306
1184
|
const $ = c(21);
|
|
1307
|
-
const { itemId, blockId, nesting,
|
|
1308
|
-
const isContentEditable = useIsEditable(
|
|
1185
|
+
const { itemId, blockId, nesting, children } = t0;
|
|
1186
|
+
const isContentEditable = useIsEditable();
|
|
1309
1187
|
const { window: iframeWindow } = useFrame();
|
|
1310
1188
|
const fragmentRef = React.useRef(null);
|
|
1311
1189
|
const registrationRef = React.useRef(null);
|
|
@@ -1429,7 +1307,7 @@ function createEditableBlock(options) {
|
|
|
1429
1307
|
const RepeaterHoverProvider = (t0) => {
|
|
1430
1308
|
const $ = c(6);
|
|
1431
1309
|
const { blockId, fieldName, children } = t0;
|
|
1432
|
-
const isContentEditable = useIsEditable(
|
|
1310
|
+
const isContentEditable = useIsEditable();
|
|
1433
1311
|
const { window: iframeWindow } = useFrame();
|
|
1434
1312
|
const hoverGroup = React.useId();
|
|
1435
1313
|
const t1 = String(blockId);
|
|
@@ -1457,11 +1335,11 @@ function createEditableBlock(options) {
|
|
|
1457
1335
|
return t4;
|
|
1458
1336
|
};
|
|
1459
1337
|
const RepeaterImpl = (t0) => {
|
|
1460
|
-
const $ = c(
|
|
1338
|
+
const $ = c(19);
|
|
1461
1339
|
const { name, children } = t0;
|
|
1462
1340
|
const blockContext = React.use(Context);
|
|
1463
1341
|
if (!blockContext) throw new Error("Repeater must be used within a Block Component");
|
|
1464
|
-
const { blockId, content
|
|
1342
|
+
const { blockId, content } = blockContext;
|
|
1465
1343
|
const parentRepeaterContext = React.use(RepeatableItemContext);
|
|
1466
1344
|
const fieldName = String(name);
|
|
1467
1345
|
const source = parentRepeaterContext ? parentRepeaterContext.itemContent[fieldName] : content[fieldName];
|
|
@@ -1478,120 +1356,107 @@ function createEditableBlock(options) {
|
|
|
1478
1356
|
let t2;
|
|
1479
1357
|
let t3;
|
|
1480
1358
|
let t4;
|
|
1481
|
-
if ($[2] !== blockId || $[3] !== children || $[4] !== fieldName || $[5] !== itemsMap || $[6] !==
|
|
1359
|
+
if ($[2] !== blockId || $[3] !== children || $[4] !== fieldName || $[5] !== itemsMap || $[6] !== parentRepeaterContext || $[7] !== storedValue) {
|
|
1482
1360
|
let t5;
|
|
1483
|
-
if ($[
|
|
1361
|
+
if ($[12] !== itemsMap) {
|
|
1484
1362
|
t5 = (item) => {
|
|
1485
1363
|
if (isItemMarker(item)) return itemsMap.get(item._itemId) ?? null;
|
|
1486
1364
|
return item;
|
|
1487
1365
|
};
|
|
1488
|
-
$[
|
|
1489
|
-
$[
|
|
1490
|
-
} else t5 = $[
|
|
1366
|
+
$[12] = itemsMap;
|
|
1367
|
+
$[13] = t5;
|
|
1368
|
+
} else t5 = $[13];
|
|
1491
1369
|
const arrayValue = storedValue.map(t5).filter(Boolean);
|
|
1492
|
-
const
|
|
1493
|
-
const itemSchema =
|
|
1370
|
+
const fieldSchema = parentRepeaterContext ? parentRepeaterContext.itemSchema?.[fieldName] : typeboxSchema.properties[fieldName];
|
|
1371
|
+
const itemSchema = fieldSchema?.items?.properties;
|
|
1372
|
+
const emptyItem = emptyFieldValues(fieldSchema?.items);
|
|
1373
|
+
const emptyItemSettings = emptyFieldValues(fieldSchema?.itemSettingsSchema);
|
|
1494
1374
|
const nesting = parentRepeaterContext ? (parentRepeaterContext.nesting ?? 0) + 1 : 0;
|
|
1495
1375
|
T0 = RepeaterHoverProvider;
|
|
1496
1376
|
t2 = blockId;
|
|
1497
1377
|
t3 = fieldName;
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
ReferenceList: ReferenceListImpl,
|
|
1525
|
-
useSetting: useItemSetting
|
|
1526
|
-
};
|
|
1527
|
-
return /* @__PURE__ */ jsx(RepeatableItemContext.Provider, {
|
|
1528
|
-
value: {
|
|
1529
|
-
arrayFieldName: fieldName,
|
|
1530
|
-
itemIndex: index,
|
|
1531
|
-
itemContent,
|
|
1532
|
-
itemSettings,
|
|
1533
|
-
itemId,
|
|
1534
|
-
containerItemId: itemId ?? parentRepeaterContext?.containerItemId,
|
|
1535
|
-
itemSchema,
|
|
1536
|
-
nesting
|
|
1537
|
-
},
|
|
1538
|
-
children: /* @__PURE__ */ jsx(RepeatableItemWrapper, {
|
|
1539
|
-
itemId,
|
|
1540
|
-
blockId,
|
|
1541
|
-
nesting,
|
|
1542
|
-
mode,
|
|
1543
|
-
children: children(itemApi, index)
|
|
1544
|
-
})
|
|
1545
|
-
}, itemId ?? index);
|
|
1378
|
+
t4 = arrayValue.map((item_0, index) => {
|
|
1379
|
+
const isDbItem = item_0.content !== void 0 && item_0.id != null;
|
|
1380
|
+
const itemContent = {
|
|
1381
|
+
...emptyItem,
|
|
1382
|
+
...isDbItem ? item_0.content : item_0
|
|
1383
|
+
};
|
|
1384
|
+
const itemSettings = {
|
|
1385
|
+
...emptyItemSettings,
|
|
1386
|
+
...isDbItem ? item_0.settings : null
|
|
1387
|
+
};
|
|
1388
|
+
const itemId = isDbItem ? item_0.id : void 0;
|
|
1389
|
+
const useItemSetting = (settingName) => itemSettings[settingName];
|
|
1390
|
+
const itemApi = {
|
|
1391
|
+
Field,
|
|
1392
|
+
Link,
|
|
1393
|
+
Icon,
|
|
1394
|
+
Embed,
|
|
1395
|
+
Artifact,
|
|
1396
|
+
Image,
|
|
1397
|
+
File,
|
|
1398
|
+
ImageList: _AssetList,
|
|
1399
|
+
FileList: _AssetList,
|
|
1400
|
+
Repeater: RepeaterImpl,
|
|
1401
|
+
Reference: ReferenceImpl,
|
|
1402
|
+
ReferenceList: ReferenceListImpl,
|
|
1403
|
+
useSetting: useItemSetting
|
|
1546
1404
|
};
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1405
|
+
return /* @__PURE__ */ jsx(RepeatableItemContext.Provider, {
|
|
1406
|
+
value: {
|
|
1407
|
+
arrayFieldName: fieldName,
|
|
1408
|
+
itemIndex: index,
|
|
1409
|
+
itemContent,
|
|
1410
|
+
itemSettings,
|
|
1411
|
+
itemId,
|
|
1412
|
+
containerItemId: itemId ?? parentRepeaterContext?.containerItemId,
|
|
1413
|
+
itemSchema,
|
|
1414
|
+
nesting
|
|
1415
|
+
},
|
|
1416
|
+
children: /* @__PURE__ */ jsx(RepeatableItemWrapper, {
|
|
1417
|
+
itemId,
|
|
1418
|
+
blockId,
|
|
1419
|
+
nesting,
|
|
1420
|
+
children: children(itemApi, index)
|
|
1421
|
+
})
|
|
1422
|
+
}, itemId ?? index);
|
|
1423
|
+
});
|
|
1558
1424
|
$[2] = blockId;
|
|
1559
1425
|
$[3] = children;
|
|
1560
1426
|
$[4] = fieldName;
|
|
1561
1427
|
$[5] = itemsMap;
|
|
1562
|
-
$[6] =
|
|
1563
|
-
$[7] =
|
|
1564
|
-
$[8] =
|
|
1565
|
-
$[9] =
|
|
1566
|
-
$[10] =
|
|
1567
|
-
$[11] =
|
|
1568
|
-
$[12] = t4;
|
|
1428
|
+
$[6] = parentRepeaterContext;
|
|
1429
|
+
$[7] = storedValue;
|
|
1430
|
+
$[8] = T0;
|
|
1431
|
+
$[9] = t2;
|
|
1432
|
+
$[10] = t3;
|
|
1433
|
+
$[11] = t4;
|
|
1569
1434
|
} else {
|
|
1570
|
-
T0 = $[
|
|
1571
|
-
t2 = $[
|
|
1572
|
-
t3 = $[
|
|
1573
|
-
t4 = $[
|
|
1435
|
+
T0 = $[8];
|
|
1436
|
+
t2 = $[9];
|
|
1437
|
+
t3 = $[10];
|
|
1438
|
+
t4 = $[11];
|
|
1574
1439
|
}
|
|
1575
1440
|
let t5;
|
|
1576
|
-
if ($[
|
|
1441
|
+
if ($[14] !== T0 || $[15] !== t2 || $[16] !== t3 || $[17] !== t4) {
|
|
1577
1442
|
t5 = /* @__PURE__ */ jsx(T0, {
|
|
1578
1443
|
blockId: t2,
|
|
1579
1444
|
fieldName: t3,
|
|
1580
1445
|
children: t4
|
|
1581
1446
|
});
|
|
1582
|
-
$[
|
|
1583
|
-
$[
|
|
1584
|
-
$[
|
|
1585
|
-
$[
|
|
1586
|
-
$[
|
|
1587
|
-
} else t5 = $[
|
|
1447
|
+
$[14] = T0;
|
|
1448
|
+
$[15] = t2;
|
|
1449
|
+
$[16] = t3;
|
|
1450
|
+
$[17] = t4;
|
|
1451
|
+
$[18] = t5;
|
|
1452
|
+
} else t5 = $[18];
|
|
1588
1453
|
return t5;
|
|
1589
1454
|
};
|
|
1590
1455
|
const Repeater = RepeaterImpl;
|
|
1591
1456
|
const BlockComponent = (t0) => {
|
|
1592
|
-
const $ = c(
|
|
1593
|
-
const { blockData
|
|
1594
|
-
const isContentEditable = useIsEditable(
|
|
1457
|
+
const $ = c(48);
|
|
1458
|
+
const { blockData } = t0;
|
|
1459
|
+
const isContentEditable = useIsEditable();
|
|
1595
1460
|
const { window: iframeWindow } = useFrame();
|
|
1596
1461
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
1597
1462
|
const selection = usePreviewTargetSelection();
|
|
@@ -1663,7 +1528,7 @@ function createEditableBlock(options) {
|
|
|
1663
1528
|
let t6;
|
|
1664
1529
|
if ($[11] !== blockData.settings) {
|
|
1665
1530
|
t6 = {
|
|
1666
|
-
...
|
|
1531
|
+
...emptySettings,
|
|
1667
1532
|
...blockData.settings
|
|
1668
1533
|
};
|
|
1669
1534
|
$[11] = blockData.settings;
|
|
@@ -1672,7 +1537,10 @@ function createEditableBlock(options) {
|
|
|
1672
1537
|
const blockSettings = t6;
|
|
1673
1538
|
let result;
|
|
1674
1539
|
if ($[13] !== blockData.content) {
|
|
1675
|
-
result = {
|
|
1540
|
+
result = {
|
|
1541
|
+
...emptyContent,
|
|
1542
|
+
...blockData.content
|
|
1543
|
+
};
|
|
1676
1544
|
for (const key in result) {
|
|
1677
1545
|
const value = result[key];
|
|
1678
1546
|
if (Array.isArray(value) && value.length > 0 && value[0]?.content !== void 0) result[key] = value.map(_temp7);
|
|
@@ -1720,136 +1588,92 @@ function createEditableBlock(options) {
|
|
|
1720
1588
|
} else t9 = $[22];
|
|
1721
1589
|
const handleMouseLeave = t9;
|
|
1722
1590
|
const shouldShowOverlay = isContentEditable && (overlayState["data-camox-hovered"] || overlayState["data-camox-focused"]);
|
|
1723
|
-
|
|
1724
|
-
let t11;
|
|
1591
|
+
let t10;
|
|
1725
1592
|
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1726
|
-
|
|
1593
|
+
t10 = {
|
|
1727
1594
|
position: "relative",
|
|
1728
1595
|
scrollMargin: "5rem"
|
|
1729
1596
|
};
|
|
1730
|
-
$[23] =
|
|
1731
|
-
} else
|
|
1732
|
-
const
|
|
1597
|
+
$[23] = t10;
|
|
1598
|
+
} else t10 = $[23];
|
|
1599
|
+
const t11 = isContentEditable ? blockData._id : void 0;
|
|
1600
|
+
let t12;
|
|
1601
|
+
if ($[24] !== overlayState || $[25] !== shouldShowOverlay) {
|
|
1602
|
+
t12 = shouldShowOverlay ? overlayState : {};
|
|
1603
|
+
$[24] = overlayState;
|
|
1604
|
+
$[25] = shouldShowOverlay;
|
|
1605
|
+
$[26] = t12;
|
|
1606
|
+
} else t12 = $[26];
|
|
1733
1607
|
let t13;
|
|
1734
|
-
if ($[
|
|
1735
|
-
t13 =
|
|
1736
|
-
|
|
1737
|
-
before: showAddBlockTop ?? (mode !== "layout" && !isFirstBlock),
|
|
1738
|
-
after: showAddBlockBottom ?? mode !== "layout",
|
|
1739
|
-
...addBlockAfterPosition !== void 0 ? { afterPosition: addBlockAfterPosition } : {}
|
|
1740
|
-
}) : void 0;
|
|
1741
|
-
$[24] = addBlockAfterPosition;
|
|
1742
|
-
$[25] = blockData.position;
|
|
1743
|
-
$[26] = isContentEditable;
|
|
1744
|
-
$[27] = isFirstBlock;
|
|
1745
|
-
$[28] = mode;
|
|
1746
|
-
$[29] = showAddBlockBottom;
|
|
1747
|
-
$[30] = showAddBlockTop;
|
|
1748
|
-
$[31] = t13;
|
|
1749
|
-
} else t13 = $[31];
|
|
1750
|
-
let t14;
|
|
1751
|
-
if ($[32] !== overlayState || $[33] !== shouldShowOverlay) {
|
|
1752
|
-
t14 = shouldShowOverlay ? overlayState : {};
|
|
1753
|
-
$[32] = overlayState;
|
|
1754
|
-
$[33] = shouldShowOverlay;
|
|
1755
|
-
$[34] = t14;
|
|
1756
|
-
} else t14 = $[34];
|
|
1757
|
-
const t15 = blockData._id;
|
|
1758
|
-
let t16;
|
|
1759
|
-
if ($[35] !== blockData.content) {
|
|
1760
|
-
t16 = {
|
|
1761
|
-
...contentDefaults,
|
|
1608
|
+
if ($[27] !== blockData.content) {
|
|
1609
|
+
t13 = {
|
|
1610
|
+
...emptyContent,
|
|
1762
1611
|
...blockData.content
|
|
1763
1612
|
};
|
|
1764
|
-
$[
|
|
1765
|
-
$[
|
|
1766
|
-
} else
|
|
1767
|
-
const
|
|
1768
|
-
let
|
|
1769
|
-
if ($[
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
if (val && typeof val === "object" && "url" in val && !val.url && contentDefaults[key_0]) overrides[key_0] = contentDefaults[key_0];
|
|
1774
|
-
}
|
|
1775
|
-
$[37] = merged;
|
|
1776
|
-
$[38] = overrides;
|
|
1777
|
-
} else overrides = $[38];
|
|
1778
|
-
let t17;
|
|
1779
|
-
if ($[39] !== merged || $[40] !== overrides) {
|
|
1780
|
-
t17 = {
|
|
1781
|
-
...merged,
|
|
1782
|
-
...overrides
|
|
1783
|
-
};
|
|
1784
|
-
$[39] = merged;
|
|
1785
|
-
$[40] = overrides;
|
|
1786
|
-
$[41] = t17;
|
|
1787
|
-
} else t17 = $[41];
|
|
1788
|
-
const t18 = t17;
|
|
1789
|
-
let t19;
|
|
1790
|
-
if ($[42] !== blockData || $[43] !== blockSettings || $[44] !== isHovered || $[45] !== mode || $[46] !== t18) {
|
|
1791
|
-
t19 = {
|
|
1792
|
-
blockId: t15,
|
|
1793
|
-
content: t18,
|
|
1613
|
+
$[27] = blockData.content;
|
|
1614
|
+
$[28] = t13;
|
|
1615
|
+
} else t13 = $[28];
|
|
1616
|
+
const t14 = t13;
|
|
1617
|
+
let t15;
|
|
1618
|
+
if ($[29] !== blockData._id || $[30] !== blockSettings || $[31] !== isHovered || $[32] !== t14) {
|
|
1619
|
+
t15 = {
|
|
1620
|
+
blockId: blockData._id,
|
|
1621
|
+
content: t14,
|
|
1794
1622
|
settings: blockSettings,
|
|
1795
|
-
mode,
|
|
1796
1623
|
isHovered,
|
|
1797
1624
|
setIsHovered
|
|
1798
1625
|
};
|
|
1799
|
-
$[
|
|
1800
|
-
$[
|
|
1801
|
-
$[
|
|
1802
|
-
$[
|
|
1803
|
-
$[
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
t20 = /* @__PURE__ */ jsx(ToReact, {
|
|
1626
|
+
$[29] = blockData._id;
|
|
1627
|
+
$[30] = blockSettings;
|
|
1628
|
+
$[31] = isHovered;
|
|
1629
|
+
$[32] = t14;
|
|
1630
|
+
$[33] = t15;
|
|
1631
|
+
} else t15 = $[33];
|
|
1632
|
+
let t16;
|
|
1633
|
+
if ($[34] !== blockSettings || $[35] !== normalizedContent) {
|
|
1634
|
+
t16 = /* @__PURE__ */ jsx(ToReact, {
|
|
1809
1635
|
content: normalizedContent,
|
|
1810
1636
|
settings: blockSettings
|
|
1811
1637
|
});
|
|
1812
|
-
$[
|
|
1813
|
-
$[
|
|
1814
|
-
$[
|
|
1815
|
-
} else
|
|
1816
|
-
let
|
|
1817
|
-
if ($[
|
|
1818
|
-
|
|
1819
|
-
value:
|
|
1820
|
-
children:
|
|
1638
|
+
$[34] = blockSettings;
|
|
1639
|
+
$[35] = normalizedContent;
|
|
1640
|
+
$[36] = t16;
|
|
1641
|
+
} else t16 = $[36];
|
|
1642
|
+
let t17;
|
|
1643
|
+
if ($[37] !== t15 || $[38] !== t16) {
|
|
1644
|
+
t17 = /* @__PURE__ */ jsx(Context.Provider, {
|
|
1645
|
+
value: t15,
|
|
1646
|
+
children: t16
|
|
1821
1647
|
});
|
|
1822
|
-
$[
|
|
1823
|
-
$[
|
|
1824
|
-
$[
|
|
1825
|
-
} else
|
|
1826
|
-
let
|
|
1827
|
-
if ($[
|
|
1828
|
-
|
|
1648
|
+
$[37] = t15;
|
|
1649
|
+
$[38] = t16;
|
|
1650
|
+
$[39] = t17;
|
|
1651
|
+
} else t17 = $[39];
|
|
1652
|
+
let t18;
|
|
1653
|
+
if ($[40] !== blockData._id || $[41] !== handleClick || $[42] !== handleMouseEnter || $[43] !== handleMouseLeave || $[44] !== t11 || $[45] !== t12 || $[46] !== t17) {
|
|
1654
|
+
t18 = /* @__PURE__ */ jsx("div", {
|
|
1829
1655
|
className: "group visual-editing-block",
|
|
1830
|
-
"data-camox-viewport-block":
|
|
1656
|
+
"data-camox-viewport-block": blockData._id,
|
|
1831
1657
|
ref,
|
|
1832
|
-
style:
|
|
1833
|
-
"data-camox-block-id":
|
|
1834
|
-
|
|
1835
|
-
...t14,
|
|
1658
|
+
style: t10,
|
|
1659
|
+
"data-camox-block-id": t11,
|
|
1660
|
+
...t12,
|
|
1836
1661
|
"data-camox-overlay-mode": options.synced ? "synced" : void 0,
|
|
1837
1662
|
onClickCapture: handleClick,
|
|
1838
1663
|
onMouseEnter: handleMouseEnter,
|
|
1839
1664
|
onMouseLeave: handleMouseLeave,
|
|
1840
|
-
children:
|
|
1665
|
+
children: t17
|
|
1841
1666
|
});
|
|
1842
|
-
$[
|
|
1843
|
-
$[
|
|
1844
|
-
$[
|
|
1845
|
-
$[
|
|
1846
|
-
$[
|
|
1847
|
-
$[
|
|
1848
|
-
$[
|
|
1849
|
-
$[
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
return t22;
|
|
1667
|
+
$[40] = blockData._id;
|
|
1668
|
+
$[41] = handleClick;
|
|
1669
|
+
$[42] = handleMouseEnter;
|
|
1670
|
+
$[43] = handleMouseLeave;
|
|
1671
|
+
$[44] = t11;
|
|
1672
|
+
$[45] = t12;
|
|
1673
|
+
$[46] = t17;
|
|
1674
|
+
$[47] = t18;
|
|
1675
|
+
} else t18 = $[47];
|
|
1676
|
+
return t18;
|
|
1853
1677
|
};
|
|
1854
1678
|
const useSetting = (name) => {
|
|
1855
1679
|
const ctx = React.use(Context);
|
|
@@ -1970,7 +1794,7 @@ function createEditableBlock(options) {
|
|
|
1970
1794
|
const applyEdit = useApplyContentEdit();
|
|
1971
1795
|
const [error, setError] = React.useState(null);
|
|
1972
1796
|
const [pointerHovered, setPointerHovered] = React.useState(false);
|
|
1973
|
-
const editable = useIsEditable(
|
|
1797
|
+
const editable = useIsEditable();
|
|
1974
1798
|
let t0;
|
|
1975
1799
|
if ($[0] !== block || $[1] !== fieldName || $[2] !== owner || $[3] !== record) {
|
|
1976
1800
|
t0 = record ? placementOf(block, owner, fieldName, record.id) : null;
|
|
@@ -2170,19 +1994,6 @@ function createEditableBlock(options) {
|
|
|
2170
1994
|
} else t5 = $[15];
|
|
2171
1995
|
return t5;
|
|
2172
1996
|
};
|
|
2173
|
-
const useCollectionTitle = (fieldName, field) => {
|
|
2174
|
-
const $ = c(4);
|
|
2175
|
-
const camoxApp = useOptionalCamoxApp();
|
|
2176
|
-
let t0;
|
|
2177
|
-
if ($[0] !== camoxApp || $[1] !== field || $[2] !== fieldName) {
|
|
2178
|
-
t0 = camoxApp?.getCollectionById(field.collectionId)?._internal.title ?? field.title ?? fieldName;
|
|
2179
|
-
$[0] = camoxApp;
|
|
2180
|
-
$[1] = field;
|
|
2181
|
-
$[2] = fieldName;
|
|
2182
|
-
$[3] = t0;
|
|
2183
|
-
} else t0 = $[3];
|
|
2184
|
-
return t0;
|
|
2185
|
-
};
|
|
2186
1997
|
const useReferenceField = (block, fieldName) => {
|
|
2187
1998
|
const item = React.use(RepeatableItemContext);
|
|
2188
1999
|
const outer = React.use(ReferenceContext)?.placement ?? null;
|
|
@@ -2193,129 +2004,57 @@ function createEditableBlock(options) {
|
|
|
2193
2004
|
const fieldType = "Reference";
|
|
2194
2005
|
const recordFieldSelected = useRecordSelection(outer, fieldName);
|
|
2195
2006
|
const blockFieldSelected = useFieldSelection(block.blockId, fieldName, fieldType, owner.itemId);
|
|
2196
|
-
const fieldSelection = outer ? {
|
|
2197
|
-
type: "record-field",
|
|
2198
|
-
...outer,
|
|
2199
|
-
recordFieldName: fieldName,
|
|
2200
|
-
recordFieldType: fieldType
|
|
2201
|
-
} : owner.itemId == null ? {
|
|
2202
|
-
type: "block-field",
|
|
2203
|
-
blockId: block.blockId,
|
|
2204
|
-
fieldName,
|
|
2205
|
-
fieldType
|
|
2206
|
-
} : {
|
|
2207
|
-
type: "item-field",
|
|
2208
|
-
blockId: block.blockId,
|
|
2209
|
-
itemId: owner.itemId,
|
|
2210
|
-
fieldName,
|
|
2211
|
-
fieldType
|
|
2212
|
-
};
|
|
2213
2007
|
return {
|
|
2214
2008
|
owner,
|
|
2215
2009
|
field: item ? item.itemSchema?.[fieldName] : (block.sourceSchema ?? typeboxSchema.properties)[fieldName],
|
|
2216
2010
|
stored: item ? item.itemContent[fieldName] : block.content[fieldName],
|
|
2217
2011
|
fieldId: outer ? overlayFieldId(block.blockId, fieldName, { placement: outer }) : overlayFieldId(block.blockId, fieldName, { itemId: owner.itemId }),
|
|
2218
|
-
fieldSelection,
|
|
2219
2012
|
fieldSelected: outer ? recordFieldSelected : blockFieldSelected
|
|
2220
2013
|
};
|
|
2221
2014
|
};
|
|
2222
|
-
const ReferencePlaceholder = (t0) => {
|
|
2223
|
-
const $ = c(13);
|
|
2224
|
-
let children;
|
|
2225
|
-
let fieldId;
|
|
2226
|
-
let fieldSelection;
|
|
2227
|
-
let props;
|
|
2228
|
-
if ($[0] !== t0) {
|
|
2229
|
-
({fieldId, fieldSelection, children, ...props} = t0);
|
|
2230
|
-
$[0] = t0;
|
|
2231
|
-
$[1] = children;
|
|
2232
|
-
$[2] = fieldId;
|
|
2233
|
-
$[3] = fieldSelection;
|
|
2234
|
-
$[4] = props;
|
|
2235
|
-
} else {
|
|
2236
|
-
children = $[1];
|
|
2237
|
-
fieldId = $[2];
|
|
2238
|
-
fieldSelection = $[3];
|
|
2239
|
-
props = $[4];
|
|
2240
|
-
}
|
|
2241
|
-
const selectTarget = usePreviewSelection();
|
|
2242
|
-
let t1;
|
|
2243
|
-
if ($[5] !== fieldId || $[6] !== fieldSelection || $[7] !== selectTarget) {
|
|
2244
|
-
t1 = () => {
|
|
2245
|
-
selectTarget(fieldSelection);
|
|
2246
|
-
referencePickerFocus.send({
|
|
2247
|
-
type: "request",
|
|
2248
|
-
fieldId
|
|
2249
|
-
});
|
|
2250
|
-
};
|
|
2251
|
-
$[5] = fieldId;
|
|
2252
|
-
$[6] = fieldSelection;
|
|
2253
|
-
$[7] = selectTarget;
|
|
2254
|
-
$[8] = t1;
|
|
2255
|
-
} else t1 = $[8];
|
|
2256
|
-
let t2;
|
|
2257
|
-
if ($[9] !== children || $[10] !== props || $[11] !== t1) {
|
|
2258
|
-
t2 = /* @__PURE__ */ jsx("button", {
|
|
2259
|
-
type: "button",
|
|
2260
|
-
"data-camox-reference-placeholder": "",
|
|
2261
|
-
className: "camox-reference-placeholder",
|
|
2262
|
-
...props,
|
|
2263
|
-
onClick: t1,
|
|
2264
|
-
children
|
|
2265
|
-
});
|
|
2266
|
-
$[9] = children;
|
|
2267
|
-
$[10] = props;
|
|
2268
|
-
$[11] = t1;
|
|
2269
|
-
$[12] = t2;
|
|
2270
|
-
} else t2 = $[12];
|
|
2271
|
-
return t2;
|
|
2272
|
-
};
|
|
2273
2015
|
const PlacedRecordWrapper = (t0) => {
|
|
2274
2016
|
const $ = c(10);
|
|
2275
2017
|
const { fieldId, record, placedRecord, overlay, children } = t0;
|
|
2276
|
-
|
|
2277
|
-
const t2 = record?.title;
|
|
2278
|
-
let t3;
|
|
2018
|
+
let t1;
|
|
2279
2019
|
if ($[0] !== placedRecord.error) {
|
|
2280
|
-
|
|
2020
|
+
t1 = placedRecord.error && /* @__PURE__ */ jsxs("p", {
|
|
2281
2021
|
role: "alert",
|
|
2282
2022
|
children: ["Could not save item. ", placedRecord.error]
|
|
2283
2023
|
});
|
|
2284
2024
|
$[0] = placedRecord.error;
|
|
2285
|
-
$[1] =
|
|
2286
|
-
} else
|
|
2287
|
-
let
|
|
2288
|
-
if ($[2] !== children || $[3] !== fieldId || $[4] !== overlay || $[5] !== placedRecord.wrapperProps || $[6] !==
|
|
2289
|
-
|
|
2025
|
+
$[1] = t1;
|
|
2026
|
+
} else t1 = $[1];
|
|
2027
|
+
let t2;
|
|
2028
|
+
if ($[2] !== children || $[3] !== fieldId || $[4] !== overlay || $[5] !== placedRecord.wrapperProps || $[6] !== record.id || $[7] !== record.title || $[8] !== t1) {
|
|
2029
|
+
t2 = /* @__PURE__ */ jsxs("div", {
|
|
2290
2030
|
"data-camox-field-id": fieldId,
|
|
2291
|
-
"data-camox-collection-record-id":
|
|
2292
|
-
"data-camox-reference-label":
|
|
2031
|
+
"data-camox-collection-record-id": record.id,
|
|
2032
|
+
"data-camox-reference-label": record.title,
|
|
2293
2033
|
"data-camox-overlay-mode": "reference",
|
|
2294
2034
|
...overlay,
|
|
2295
2035
|
...placedRecord.wrapperProps,
|
|
2296
|
-
children: [children,
|
|
2036
|
+
children: [children, t1]
|
|
2297
2037
|
});
|
|
2298
2038
|
$[2] = children;
|
|
2299
2039
|
$[3] = fieldId;
|
|
2300
2040
|
$[4] = overlay;
|
|
2301
2041
|
$[5] = placedRecord.wrapperProps;
|
|
2302
|
-
$[6] =
|
|
2303
|
-
$[7] =
|
|
2304
|
-
$[8] =
|
|
2305
|
-
$[9] =
|
|
2306
|
-
} else
|
|
2307
|
-
return
|
|
2042
|
+
$[6] = record.id;
|
|
2043
|
+
$[7] = record.title;
|
|
2044
|
+
$[8] = t1;
|
|
2045
|
+
$[9] = t2;
|
|
2046
|
+
} else t2 = $[9];
|
|
2047
|
+
return t2;
|
|
2308
2048
|
};
|
|
2309
2049
|
const ReferenceImpl = (t0) => {
|
|
2310
|
-
const $ = c(
|
|
2050
|
+
const $ = c(18);
|
|
2311
2051
|
const { name, children } = t0;
|
|
2312
2052
|
const block = React.use(Context);
|
|
2313
2053
|
const { recordsMap } = useNormalizedData();
|
|
2314
2054
|
const { window: iframeWindow } = useFrame();
|
|
2315
2055
|
if (!block) throw new Error("Reference must be used within a Block Component");
|
|
2316
2056
|
const fieldName = String(name);
|
|
2317
|
-
const { owner, field, stored, fieldId,
|
|
2318
|
-
const collectionTitle = useCollectionTitle(fieldName, field);
|
|
2057
|
+
const { owner, field, stored, fieldId, fieldSelected } = useReferenceField(block, fieldName);
|
|
2319
2058
|
let t1;
|
|
2320
2059
|
if ($[0] !== field.collectionId || $[1] !== recordsMap || $[2] !== stored) {
|
|
2321
2060
|
t1 = resolveReference(stored, field.collectionId, recordsMap);
|
|
@@ -2335,34 +2074,27 @@ function createEditableBlock(options) {
|
|
|
2335
2074
|
} else t2 = $[5];
|
|
2336
2075
|
const fieldHovered = useOverlayMessage(iframeWindow, editable, "CAMOX_HOVER_FIELD", "CAMOX_HOVER_FIELD_END", t2);
|
|
2337
2076
|
const overlay = useOverlayState(placedRecord.hovered || fieldHovered, fieldSelected || placedRecord.selected);
|
|
2338
|
-
if (!record
|
|
2077
|
+
if (!record || !placedRecord.reference) return null;
|
|
2339
2078
|
let t3;
|
|
2340
|
-
if ($[6] !== block || $[7] !== children || $[8] !==
|
|
2341
|
-
t3 =
|
|
2079
|
+
if ($[6] !== block || $[7] !== children || $[8] !== field || $[9] !== placedRecord.reference || $[10] !== record) {
|
|
2080
|
+
t3 = /* @__PURE__ */ jsx(RecordScope, {
|
|
2342
2081
|
block,
|
|
2343
2082
|
field,
|
|
2344
2083
|
record,
|
|
2345
2084
|
reference: placedRecord.reference,
|
|
2346
2085
|
children
|
|
2347
|
-
}) : /* @__PURE__ */ jsxs(ReferencePlaceholder, {
|
|
2348
|
-
fieldId,
|
|
2349
|
-
fieldSelection,
|
|
2350
|
-
children: ["Select ", collectionTitle]
|
|
2351
2086
|
});
|
|
2352
2087
|
$[6] = block;
|
|
2353
2088
|
$[7] = children;
|
|
2354
|
-
$[8] =
|
|
2355
|
-
$[9] =
|
|
2356
|
-
$[10] =
|
|
2357
|
-
$[11] =
|
|
2358
|
-
|
|
2359
|
-
$[13] = record;
|
|
2360
|
-
$[14] = t3;
|
|
2361
|
-
} else t3 = $[14];
|
|
2089
|
+
$[8] = field;
|
|
2090
|
+
$[9] = placedRecord.reference;
|
|
2091
|
+
$[10] = record;
|
|
2092
|
+
$[11] = t3;
|
|
2093
|
+
} else t3 = $[11];
|
|
2362
2094
|
const rendered = t3;
|
|
2363
2095
|
if (!editable) return rendered;
|
|
2364
2096
|
let t4;
|
|
2365
|
-
if ($[
|
|
2097
|
+
if ($[12] !== fieldId || $[13] !== overlay || $[14] !== placedRecord || $[15] !== record || $[16] !== rendered) {
|
|
2366
2098
|
t4 = /* @__PURE__ */ jsx(PlacedRecordWrapper, {
|
|
2367
2099
|
fieldId,
|
|
2368
2100
|
record,
|
|
@@ -2370,13 +2102,13 @@ function createEditableBlock(options) {
|
|
|
2370
2102
|
overlay,
|
|
2371
2103
|
children: rendered
|
|
2372
2104
|
});
|
|
2373
|
-
$[
|
|
2374
|
-
$[
|
|
2375
|
-
$[
|
|
2376
|
-
$[
|
|
2377
|
-
$[
|
|
2378
|
-
$[
|
|
2379
|
-
} else t4 = $[
|
|
2105
|
+
$[12] = fieldId;
|
|
2106
|
+
$[13] = overlay;
|
|
2107
|
+
$[14] = placedRecord;
|
|
2108
|
+
$[15] = record;
|
|
2109
|
+
$[16] = rendered;
|
|
2110
|
+
$[17] = t4;
|
|
2111
|
+
} else t4 = $[17];
|
|
2380
2112
|
return t4;
|
|
2381
2113
|
};
|
|
2382
2114
|
const Reference = ReferenceImpl;
|
|
@@ -2445,8 +2177,7 @@ function createEditableBlock(options) {
|
|
|
2445
2177
|
sourceSchema: properties,
|
|
2446
2178
|
settings: t2,
|
|
2447
2179
|
isHovered: false,
|
|
2448
|
-
setIsHovered: _temp8
|
|
2449
|
-
mode: "layout"
|
|
2180
|
+
setIsHovered: _temp8
|
|
2450
2181
|
};
|
|
2451
2182
|
$[1] = properties;
|
|
2452
2183
|
$[2] = t1;
|
|
@@ -2560,17 +2291,16 @@ function createEditableBlock(options) {
|
|
|
2560
2291
|
return t3;
|
|
2561
2292
|
};
|
|
2562
2293
|
const ReferenceListImpl = (t0) => {
|
|
2563
|
-
const $ = c(
|
|
2294
|
+
const $ = c(25);
|
|
2564
2295
|
const { name, children } = t0;
|
|
2565
2296
|
const block = React.use(Context);
|
|
2566
2297
|
const normalizedData = useNormalizedData();
|
|
2567
2298
|
const { recordsMap } = normalizedData;
|
|
2568
2299
|
const { window: iframeWindow } = useFrame();
|
|
2569
2300
|
if (!block) throw new Error("ReferenceList must be used within a Block Component");
|
|
2570
|
-
const editable = useIsEditable(
|
|
2301
|
+
const editable = useIsEditable();
|
|
2571
2302
|
const fieldName = String(name);
|
|
2572
|
-
const { owner, field, stored, fieldId
|
|
2573
|
-
const collectionTitle = useCollectionTitle(fieldName, field);
|
|
2303
|
+
const { owner, field, stored, fieldId } = useReferenceField(block, fieldName);
|
|
2574
2304
|
let t1;
|
|
2575
2305
|
if ($[0] !== fieldId) {
|
|
2576
2306
|
t1 = { fieldId };
|
|
@@ -2578,119 +2308,55 @@ function createEditableBlock(options) {
|
|
|
2578
2308
|
$[1] = t1;
|
|
2579
2309
|
} else t1 = $[1];
|
|
2580
2310
|
const listHovered = useOverlayMessage(iframeWindow, editable, "CAMOX_HOVER_FIELD", "CAMOX_HOVER_FIELD_END", t1);
|
|
2581
|
-
const placeholderOverlay = useOverlayState(listHovered);
|
|
2582
2311
|
let t2;
|
|
2583
|
-
if ($[2] !== field) {
|
|
2584
|
-
t2 = isQueryBacked(field)
|
|
2585
|
-
$[2] = field;
|
|
2586
|
-
$[3] = t2;
|
|
2587
|
-
} else t2 = $[3];
|
|
2588
|
-
const queryBacked = t2;
|
|
2589
|
-
let t3;
|
|
2590
|
-
if ($[4] !== block.blockId || $[5] !== fieldName || $[6] !== normalizedData || $[7] !== owner || $[8] !== queryBacked || $[9] !== stored) {
|
|
2591
|
-
t3 = queryBacked ? queryResultIds(normalizedData, {
|
|
2312
|
+
if ($[2] !== block || $[3] !== field || $[4] !== fieldName || $[5] !== normalizedData || $[6] !== owner || $[7] !== stored) {
|
|
2313
|
+
t2 = isQueryBacked(field) ? queryResultIds(normalizedData, {
|
|
2592
2314
|
blockId: block.blockId,
|
|
2593
2315
|
itemId: owner.itemId
|
|
2594
2316
|
}, fieldName) : stored;
|
|
2595
|
-
$[
|
|
2596
|
-
$[
|
|
2597
|
-
$[
|
|
2598
|
-
$[
|
|
2599
|
-
$[
|
|
2600
|
-
$[
|
|
2601
|
-
$[
|
|
2602
|
-
} else
|
|
2603
|
-
const ids =
|
|
2604
|
-
let
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
"data-camox-overlay-mode": "reference",
|
|
2639
|
-
...placeholderOverlay,
|
|
2640
|
-
children: ["Add ", collectionTitle]
|
|
2641
|
-
});
|
|
2642
|
-
$[32] = collectionTitle;
|
|
2643
|
-
$[33] = fieldId;
|
|
2644
|
-
$[34] = placeholderOverlay;
|
|
2645
|
-
$[35] = t8;
|
|
2646
|
-
$[36] = t9;
|
|
2647
|
-
} else t9 = $[36];
|
|
2648
|
-
t5 = t9;
|
|
2649
|
-
break bb0;
|
|
2650
|
-
}
|
|
2651
|
-
let t6;
|
|
2652
|
-
if ($[37] !== block || $[38] !== children || $[39] !== field || $[40] !== fieldName || $[41] !== listHovered || $[42] !== owner) {
|
|
2653
|
-
t6 = (record) => /* @__PURE__ */ jsx(ListedRecord, {
|
|
2654
|
-
block,
|
|
2655
|
-
owner,
|
|
2656
|
-
field,
|
|
2657
|
-
fieldName,
|
|
2658
|
-
record,
|
|
2659
|
-
listHovered,
|
|
2660
|
-
children
|
|
2661
|
-
}, record.id);
|
|
2662
|
-
$[37] = block;
|
|
2663
|
-
$[38] = children;
|
|
2664
|
-
$[39] = field;
|
|
2665
|
-
$[40] = fieldName;
|
|
2666
|
-
$[41] = listHovered;
|
|
2667
|
-
$[42] = owner;
|
|
2668
|
-
$[43] = t6;
|
|
2669
|
-
} else t6 = $[43];
|
|
2670
|
-
t4 = records.map(t6);
|
|
2671
|
-
}
|
|
2672
|
-
$[11] = block;
|
|
2673
|
-
$[12] = children;
|
|
2674
|
-
$[13] = collectionTitle;
|
|
2675
|
-
$[14] = editable;
|
|
2676
|
-
$[15] = field;
|
|
2677
|
-
$[16] = fieldId;
|
|
2678
|
-
$[17] = fieldName;
|
|
2679
|
-
$[18] = fieldSelection;
|
|
2680
|
-
$[19] = ids;
|
|
2681
|
-
$[20] = listHovered;
|
|
2682
|
-
$[21] = owner;
|
|
2683
|
-
$[22] = placeholderOverlay;
|
|
2684
|
-
$[23] = queryBacked;
|
|
2685
|
-
$[24] = recordsMap;
|
|
2686
|
-
$[25] = t4;
|
|
2687
|
-
$[26] = t5;
|
|
2688
|
-
} else {
|
|
2689
|
-
t4 = $[25];
|
|
2690
|
-
t5 = $[26];
|
|
2691
|
-
}
|
|
2692
|
-
if (t5 !== Symbol.for("react.early_return_sentinel")) return t5;
|
|
2693
|
-
return t4;
|
|
2317
|
+
$[2] = block;
|
|
2318
|
+
$[3] = field;
|
|
2319
|
+
$[4] = fieldName;
|
|
2320
|
+
$[5] = normalizedData;
|
|
2321
|
+
$[6] = owner;
|
|
2322
|
+
$[7] = stored;
|
|
2323
|
+
$[8] = t2;
|
|
2324
|
+
} else t2 = $[8];
|
|
2325
|
+
const ids = t2;
|
|
2326
|
+
let t3;
|
|
2327
|
+
if ($[9] !== block || $[10] !== children || $[11] !== field || $[12] !== fieldName || $[13] !== ids || $[14] !== listHovered || $[15] !== owner || $[16] !== recordsMap) {
|
|
2328
|
+
const records = resolveReferenceList(ids, field.collectionId, recordsMap);
|
|
2329
|
+
let t4;
|
|
2330
|
+
if ($[18] !== block || $[19] !== children || $[20] !== field || $[21] !== fieldName || $[22] !== listHovered || $[23] !== owner) {
|
|
2331
|
+
t4 = (record) => /* @__PURE__ */ jsx(ListedRecord, {
|
|
2332
|
+
block,
|
|
2333
|
+
owner,
|
|
2334
|
+
field,
|
|
2335
|
+
fieldName,
|
|
2336
|
+
record,
|
|
2337
|
+
listHovered,
|
|
2338
|
+
children
|
|
2339
|
+
}, record.id);
|
|
2340
|
+
$[18] = block;
|
|
2341
|
+
$[19] = children;
|
|
2342
|
+
$[20] = field;
|
|
2343
|
+
$[21] = fieldName;
|
|
2344
|
+
$[22] = listHovered;
|
|
2345
|
+
$[23] = owner;
|
|
2346
|
+
$[24] = t4;
|
|
2347
|
+
} else t4 = $[24];
|
|
2348
|
+
t3 = records.map(t4);
|
|
2349
|
+
$[9] = block;
|
|
2350
|
+
$[10] = children;
|
|
2351
|
+
$[11] = field;
|
|
2352
|
+
$[12] = fieldName;
|
|
2353
|
+
$[13] = ids;
|
|
2354
|
+
$[14] = listHovered;
|
|
2355
|
+
$[15] = owner;
|
|
2356
|
+
$[16] = recordsMap;
|
|
2357
|
+
$[17] = t3;
|
|
2358
|
+
} else t3 = $[17];
|
|
2359
|
+
return t3;
|
|
2694
2360
|
};
|
|
2695
2361
|
const ReferenceList = ReferenceListImpl;
|
|
2696
2362
|
const Detached = (t0) => {
|
|
@@ -2698,8 +2364,8 @@ function createEditableBlock(options) {
|
|
|
2698
2364
|
const { children } = t0;
|
|
2699
2365
|
const ctx = React.use(Context);
|
|
2700
2366
|
if (!ctx) throw new Error("Detached must be used within a Block Component");
|
|
2701
|
-
const { blockId,
|
|
2702
|
-
const isContentEditable = useIsEditable(
|
|
2367
|
+
const { blockId, isHovered, setIsHovered } = ctx;
|
|
2368
|
+
const isContentEditable = useIsEditable();
|
|
2703
2369
|
const { window: iframeWindow } = useFrame();
|
|
2704
2370
|
const selection = usePreviewTargetSelection();
|
|
2705
2371
|
const selectTarget = usePreviewSelection();
|
|
@@ -2831,55 +2497,7 @@ function createEditableBlock(options) {
|
|
|
2831
2497
|
contentSchema,
|
|
2832
2498
|
settingsSchema,
|
|
2833
2499
|
layoutOnly: options.layoutOnly ?? false,
|
|
2834
|
-
synced: options.synced ?? false
|
|
2835
|
-
getInitialBundle: () => {
|
|
2836
|
-
const counter = { value: 0 };
|
|
2837
|
-
const allSeeds = [];
|
|
2838
|
-
const content = { ...contentDefaults };
|
|
2839
|
-
buildInitialSeeds(typeboxSchema.properties, null, content, allSeeds, counter);
|
|
2840
|
-
const storageContent = {};
|
|
2841
|
-
for (const [key, prop] of Object.entries(typeboxSchema.properties)) {
|
|
2842
|
-
const ft = prop.fieldType;
|
|
2843
|
-
if (ft === "Image" || ft === "File" || ft === "ImageList" || ft === "FileList" || ft === "Repeater") continue;
|
|
2844
|
-
if ("default" in prop) storageContent[key] = prop.default;
|
|
2845
|
-
}
|
|
2846
|
-
return {
|
|
2847
|
-
content: storageContent,
|
|
2848
|
-
settings: { ...settingsDefaults },
|
|
2849
|
-
repeatableItems: allSeeds
|
|
2850
|
-
};
|
|
2851
|
-
},
|
|
2852
|
-
getInitialContent: () => {
|
|
2853
|
-
return { ...contentDefaultsForStorage };
|
|
2854
|
-
},
|
|
2855
|
-
getInitialSettings: () => {
|
|
2856
|
-
return { ...settingsDefaults };
|
|
2857
|
-
},
|
|
2858
|
-
getPeekBundle: () => {
|
|
2859
|
-
const PEEK_BLOCK_ID = "peek";
|
|
2860
|
-
const counter = { value: 0 };
|
|
2861
|
-
const allItems = [];
|
|
2862
|
-
const content = { ...contentDefaults };
|
|
2863
|
-
buildPeekItems(typeboxSchema.properties, PEEK_BLOCK_ID, null, content, allItems, counter);
|
|
2864
|
-
return {
|
|
2865
|
-
block: {
|
|
2866
|
-
id: PEEK_BLOCK_ID,
|
|
2867
|
-
pageId: null,
|
|
2868
|
-
layoutId: null,
|
|
2869
|
-
type: options.id,
|
|
2870
|
-
content,
|
|
2871
|
-
settings: settingsDefaults,
|
|
2872
|
-
slot: null,
|
|
2873
|
-
summary: "",
|
|
2874
|
-
title: "",
|
|
2875
|
-
position: "",
|
|
2876
|
-
createdAt: 0,
|
|
2877
|
-
updatedAt: 0
|
|
2878
|
-
},
|
|
2879
|
-
repeatableItems: allItems,
|
|
2880
|
-
files: []
|
|
2881
|
-
};
|
|
2882
|
-
}
|
|
2500
|
+
synced: options.synced ?? false
|
|
2883
2501
|
}
|
|
2884
2502
|
};
|
|
2885
2503
|
}
|