@alpaca-editor/core 1.0.4134 → 1.0.4140
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/config/config.js +7 -0
- package/dist/config/config.js.map +1 -1
- package/dist/editor/FieldListField.js +3 -4
- package/dist/editor/FieldListField.js.map +1 -1
- package/dist/editor/Terminal.js +1 -1
- package/dist/editor/Terminal.js.map +1 -1
- package/dist/editor/Titlebar.js +0 -1
- package/dist/editor/Titlebar.js.map +1 -1
- package/dist/editor/ai/AgentCostDisplay.d.ts +3 -1
- package/dist/editor/ai/AgentCostDisplay.js +26 -2
- package/dist/editor/ai/AgentCostDisplay.js.map +1 -1
- package/dist/editor/ai/AgentStatusBadge.d.ts +26 -0
- package/dist/editor/ai/AgentStatusBadge.js +110 -0
- package/dist/editor/ai/AgentStatusBadge.js.map +1 -0
- package/dist/editor/ai/AgentTerminal.js +289 -198
- package/dist/editor/ai/AgentTerminal.js.map +1 -1
- package/dist/editor/ai/Agents.d.ts +2 -2
- package/dist/editor/ai/Agents.js +115 -19
- package/dist/editor/ai/Agents.js.map +1 -1
- package/dist/editor/ai/AiResponseMessage.js +259 -45
- package/dist/editor/ai/AiResponseMessage.js.map +1 -1
- package/dist/editor/ai/ContextInfoBar.js +124 -113
- package/dist/editor/ai/ContextInfoBar.js.map +1 -1
- package/dist/editor/ai/ToolCallDisplay.d.ts +1 -0
- package/dist/editor/ai/ToolCallDisplay.js +70 -58
- package/dist/editor/ai/ToolCallDisplay.js.map +1 -1
- package/dist/editor/ai/useAgentStatus.d.ts +13 -0
- package/dist/editor/ai/useAgentStatus.js +101 -0
- package/dist/editor/ai/useAgentStatus.js.map +1 -0
- package/dist/editor/client/EditorShell.js +23 -8
- package/dist/editor/client/EditorShell.js.map +1 -1
- package/dist/editor/client/itemsRepository.js.map +1 -1
- package/dist/editor/commands/localizeItem/LocalizeItemDialog.js +5 -5
- package/dist/editor/commands/localizeItem/LocalizeItemDialog.js.map +1 -1
- package/dist/editor/control-center/About.js +1 -1
- package/dist/editor/control-center/About.js.map +1 -1
- package/dist/editor/control-center/AllAgentsPanel.d.ts +5 -0
- package/dist/editor/control-center/AllAgentsPanel.js +126 -0
- package/dist/editor/control-center/AllAgentsPanel.js.map +1 -0
- package/dist/editor/control-center/WebSocketMessages.js +1 -0
- package/dist/editor/control-center/WebSocketMessages.js.map +1 -1
- package/dist/editor/control-center/setup-steps/AiSetupStep/tools/GenerateToolsSection.js +42 -7
- package/dist/editor/control-center/setup-steps/AiSetupStep/tools/GenerateToolsSection.js.map +1 -1
- package/dist/editor/media-selector/AiImageSearch.d.ts +1 -1
- package/dist/editor/media-selector/AiImageSearch.js +162 -103
- package/dist/editor/media-selector/AiImageSearch.js.map +1 -1
- package/dist/editor/media-selector/TreeSelector.js +20 -4
- package/dist/editor/media-selector/TreeSelector.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/UtilityControls.js +5 -2
- package/dist/editor/menubar/toolbar-sections/UtilityControls.js.map +1 -1
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.d.ts +1 -1
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +7 -5
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js.map +1 -1
- package/dist/editor/page-viewer/DeviceToolbar.js +2 -2
- package/dist/editor/page-viewer/DeviceToolbar.js.map +1 -1
- package/dist/editor/page-viewer/PageViewerFrame.js +18 -11
- package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -1
- package/dist/editor/services/agentService.d.ts +53 -48
- package/dist/editor/services/agentService.js +137 -79
- package/dist/editor/services/agentService.js.map +1 -1
- package/dist/editor/services/aiService.d.ts +1 -1
- package/dist/editor/services/editService.js +1 -0
- package/dist/editor/services/editService.js.map +1 -1
- package/dist/editor/sidebar/GraphQL.js +20 -7
- package/dist/editor/sidebar/GraphQL.js.map +1 -1
- package/dist/editor/sidebar/SEOInfo.js +1 -2
- package/dist/editor/sidebar/SEOInfo.js.map +1 -1
- package/dist/editor/sidebar/Translations.js +10 -7
- package/dist/editor/sidebar/Translations.js.map +1 -1
- package/dist/editor/ui/ItemNameDialogNew.js +1 -1
- package/dist/editor/ui/ItemSearch.js +10 -4
- package/dist/editor/ui/ItemSearch.js.map +1 -1
- package/dist/page-wizard/steps/CollectStep.js +2 -2
- package/dist/page-wizard/steps/CollectStep.js.map +1 -1
- package/dist/page-wizard/steps/FieldEditor.js +2 -2
- package/dist/page-wizard/steps/FieldEditor.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/dist/splash-screen/NewPage.js +2 -2
- package/dist/splash-screen/NewPage.js.map +1 -1
- package/dist/splash-screen/RecentPages.js +1 -1
- package/dist/splash-screen/RecentPages.js.map +1 -1
- package/dist/styles.css +167 -22
- package/dist/tour/Tour.js +15 -11
- package/dist/tour/Tour.js.map +1 -1
- package/package.json +1 -1
- package/src/config/config.tsx +7 -0
- package/src/editor/FieldListField.tsx +13 -13
- package/src/editor/Terminal.tsx +1 -1
- package/src/editor/Titlebar.tsx +0 -1
- package/src/editor/ai/AgentCostDisplay.tsx +57 -1
- package/src/editor/ai/AgentStatusBadge.tsx +144 -0
- package/src/editor/ai/AgentTerminal.tsx +345 -219
- package/src/editor/ai/Agents.tsx +179 -30
- package/src/editor/ai/AiResponseMessage.tsx +411 -114
- package/src/editor/ai/ContextInfoBar.tsx +134 -131
- package/src/editor/ai/ToolCallDisplay.tsx +217 -176
- package/src/editor/ai/useAgentStatus.ts +123 -0
- package/src/editor/client/EditorShell.tsx +34 -8
- package/src/editor/client/itemsRepository.ts +1 -2
- package/src/editor/commands/localizeItem/LocalizeItemDialog.tsx +5 -5
- package/src/editor/control-center/About.tsx +0 -14
- package/src/editor/control-center/AllAgentsPanel.tsx +300 -0
- package/src/editor/control-center/WebSocketMessages.tsx +1 -0
- package/src/editor/control-center/setup-steps/AiSetupStep/tools/GenerateToolsSection.tsx +49 -8
- package/src/editor/media-selector/AiImageSearch.tsx +162 -172
- package/src/editor/media-selector/TreeSelector.tsx +137 -116
- package/src/editor/menubar/toolbar-sections/UtilityControls.tsx +9 -1
- package/src/editor/page-editor-chrome/PlaceholderDropZone.tsx +7 -4
- package/src/editor/page-viewer/DeviceToolbar.tsx +15 -11
- package/src/editor/page-viewer/PageViewerFrame.tsx +20 -14
- package/src/editor/services/agentService.ts +217 -129
- package/src/editor/services/aiService.ts +2 -2
- package/src/editor/services/editService.ts +1 -0
- package/src/editor/sidebar/GraphQL.tsx +143 -117
- package/src/editor/sidebar/SEOInfo.tsx +1 -2
- package/src/editor/sidebar/Translations.tsx +14 -12
- package/src/editor/ui/ItemNameDialogNew.tsx +1 -1
- package/src/editor/ui/ItemSearch.tsx +11 -4
- package/src/editor/ui/SimpleTabs.tsx +1 -1
- package/src/page-wizard/steps/CollectStep.tsx +2 -2
- package/src/page-wizard/steps/FieldEditor.tsx +13 -15
- package/src/revision.ts +2 -2
- package/src/splash-screen/NewPage.tsx +2 -2
- package/src/splash-screen/RecentPages.tsx +1 -1
- package/src/tour/Tour.tsx +61 -48
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import ContentTree from "../ContentTree";
|
|
4
|
-
import { Splitter
|
|
4
|
+
import { Splitter } from "../ui/Splitter";
|
|
5
5
|
import { useEffect, useState } from "react";
|
|
6
6
|
import { ItemTreeNodeData, getChildren } from "../services/contentService";
|
|
7
7
|
import { useEditContext } from "../client/editContext";
|
|
@@ -189,126 +189,147 @@ export const TreeSelector = ({
|
|
|
189
189
|
|
|
190
190
|
return (
|
|
191
191
|
<>
|
|
192
|
-
<Splitter
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
onMouseDown={(e) => {
|
|
233
|
-
e.preventDefault();
|
|
234
|
-
e.stopPropagation();
|
|
235
|
-
setSelectedFolderId(x.id);
|
|
236
|
-
setExpandedIdPath(x.idPath);
|
|
237
|
-
// Close the popover after selection
|
|
238
|
-
setIsPopoverOpen(false);
|
|
239
|
-
}}
|
|
192
|
+
<Splitter
|
|
193
|
+
className="flex-1"
|
|
194
|
+
direction="horizontal"
|
|
195
|
+
panels={[
|
|
196
|
+
{
|
|
197
|
+
name: "tree",
|
|
198
|
+
defaultSize: 300,
|
|
199
|
+
content: (
|
|
200
|
+
<div className="relative flex h-full flex-col">
|
|
201
|
+
{history.length > 0 && (
|
|
202
|
+
<div className="absolute top-2 right-2 z-50">
|
|
203
|
+
<Popover
|
|
204
|
+
open={isPopoverOpen}
|
|
205
|
+
onOpenChange={setIsPopoverOpen}
|
|
206
|
+
>
|
|
207
|
+
<Tooltip>
|
|
208
|
+
<TooltipTrigger asChild>
|
|
209
|
+
<PopoverTrigger asChild>
|
|
210
|
+
<Button
|
|
211
|
+
variant="ghost"
|
|
212
|
+
size="sm"
|
|
213
|
+
className="h-8 w-8 p-0"
|
|
214
|
+
>
|
|
215
|
+
<ClockIcon className="h-4 w-4" />
|
|
216
|
+
</Button>
|
|
217
|
+
</PopoverTrigger>
|
|
218
|
+
</TooltipTrigger>
|
|
219
|
+
<TooltipContent>Recent Locations</TooltipContent>
|
|
220
|
+
</Tooltip>
|
|
221
|
+
<PopoverContent
|
|
222
|
+
className="pointer-events-auto w-64 p-2"
|
|
223
|
+
onPointerDown={(e) => e.stopPropagation()}
|
|
224
|
+
onPointerMove={(e) => e.stopPropagation()}
|
|
225
|
+
onPointerEnter={(e) => e.stopPropagation()}
|
|
226
|
+
onPointerLeave={(e) => e.stopPropagation()}
|
|
227
|
+
onClick={(e) => e.stopPropagation()}
|
|
228
|
+
onMouseDown={(e) => e.stopPropagation()}
|
|
229
|
+
onMouseMove={(e) => e.stopPropagation()}
|
|
230
|
+
onMouseEnter={(e) => e.stopPropagation()}
|
|
231
|
+
onMouseLeave={(e) => e.stopPropagation()}
|
|
240
232
|
>
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
233
|
+
<div className="mb-2 flex items-center gap-1 text-xs font-medium text-gray-700">
|
|
234
|
+
<ClockIcon className="h-3 w-3" />
|
|
235
|
+
Recent Locations
|
|
236
|
+
</div>
|
|
237
|
+
{history.map((x) => (
|
|
238
|
+
<div
|
|
239
|
+
key={x.idPath}
|
|
240
|
+
className="cursor-pointer rounded px-2 py-1 text-xs hover:bg-gray-100"
|
|
241
|
+
onMouseDown={(e) => {
|
|
242
|
+
e.preventDefault();
|
|
243
|
+
e.stopPropagation();
|
|
244
|
+
setSelectedFolderId(x.id);
|
|
245
|
+
setExpandedIdPath(x.idPath);
|
|
246
|
+
// Close the popover after selection
|
|
247
|
+
setIsPopoverOpen(false);
|
|
248
|
+
}}
|
|
249
|
+
>
|
|
250
|
+
{x.name}
|
|
251
|
+
</div>
|
|
252
|
+
))}
|
|
253
|
+
</PopoverContent>
|
|
254
|
+
</Popover>
|
|
255
|
+
</div>
|
|
256
|
+
)}
|
|
257
|
+
<div
|
|
258
|
+
data-testid="media-selector-tree"
|
|
259
|
+
className={`absolute inset-0 overflow-auto p-2 ${isPopoverOpen ? "pointer-events-none" : ""}`}
|
|
260
|
+
>
|
|
261
|
+
<ContentTree
|
|
262
|
+
rootItemIds={["3D6658D8-A0BF-4E75-B3E2-D050FABCF4E1"]}
|
|
263
|
+
selectionMode="single"
|
|
264
|
+
selectedItemIds={selection}
|
|
265
|
+
templateIds={["FE5DD826-48C6-436D-B87A-7C4210C7413B"]}
|
|
266
|
+
onItemInserted={(item) => {
|
|
267
|
+
setSelectedFolderId(item.id);
|
|
268
|
+
}}
|
|
269
|
+
expandIdPath={
|
|
270
|
+
expandedIdPath ?? "3D6658D8-A0BF-4E75-B3E2-D050FABCF4E1"
|
|
271
|
+
}
|
|
272
|
+
onSelectionChange={(selection) => {
|
|
273
|
+
const selectedNode = selection[0] as ItemTreeNodeData;
|
|
274
|
+
if (selectedNode) setSelectedFolderId(selectedNode.id);
|
|
275
|
+
else setSelectedFolderId(undefined);
|
|
276
|
+
}}
|
|
277
|
+
language={language}
|
|
278
|
+
/>
|
|
279
|
+
</div>
|
|
246
280
|
</div>
|
|
247
|
-
)
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
selectedItemIds={selection}
|
|
256
|
-
templateIds={["FE5DD826-48C6-436D-B87A-7C4210C7413B"]}
|
|
257
|
-
onItemInserted={(item) => {
|
|
258
|
-
setSelectedFolderId(item.id);
|
|
259
|
-
}}
|
|
260
|
-
expandIdPath={
|
|
261
|
-
expandedIdPath ?? "3D6658D8-A0BF-4E75-B3E2-D050FABCF4E1"
|
|
262
|
-
}
|
|
263
|
-
onSelectionChange={(selection) => {
|
|
264
|
-
const selectedNode = selection[0] as ItemTreeNodeData;
|
|
265
|
-
if (selectedNode) setSelectedFolderId(selectedNode.id);
|
|
266
|
-
else setSelectedFolderId(undefined);
|
|
267
|
-
}}
|
|
268
|
-
language={language}
|
|
269
|
-
/>
|
|
270
|
-
</div>
|
|
271
|
-
</div>
|
|
272
|
-
</SplitterPanel>
|
|
273
|
-
<SplitterPanel className="relative">
|
|
274
|
-
<div className="flex h-full w-full flex-col gap-2">
|
|
275
|
-
<AiImageSearchPrompt onSearchPromptChange={searchDebounced} />
|
|
281
|
+
),
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
name: "thumbnails",
|
|
285
|
+
defaultSize: "auto",
|
|
286
|
+
content: (
|
|
287
|
+
<div className="relative flex h-full w-full flex-col gap-2">
|
|
288
|
+
<AiImageSearchPrompt onSearchPromptChange={searchDebounced} />
|
|
276
289
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
290
|
+
<div className="relative flex-1">
|
|
291
|
+
{loadingThumbnails && (
|
|
292
|
+
<div className="flex h-full items-center">
|
|
293
|
+
<Loader2 className="h-6 w-6 animate-spin" />
|
|
294
|
+
</div>
|
|
295
|
+
)}
|
|
296
|
+
{!loadingThumbnails && (
|
|
297
|
+
<Thumbnails
|
|
298
|
+
images={images ?? []}
|
|
299
|
+
selectedImage={selectedImage}
|
|
300
|
+
setSelectedImage={setSelectedImage}
|
|
301
|
+
onMediaSelected={() => {
|
|
302
|
+
updateHistory();
|
|
303
|
+
onMediaSelected(selectedImage!.id);
|
|
304
|
+
}}
|
|
305
|
+
onHide={onHide}
|
|
306
|
+
/>
|
|
307
|
+
)}
|
|
281
308
|
</div>
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
loadThumbnailsAndSelectImage();
|
|
302
|
-
}}
|
|
303
|
-
/>
|
|
309
|
+
{selectedFolderId && (
|
|
310
|
+
<div className="border-gray-3 border-t">
|
|
311
|
+
<UploadZone
|
|
312
|
+
selectedFolderId={selectedFolderId}
|
|
313
|
+
uploadCompleted={() => {
|
|
314
|
+
loadThumbnailsAndSelectImage();
|
|
315
|
+
}}
|
|
316
|
+
/>
|
|
317
|
+
</div>
|
|
318
|
+
)}
|
|
319
|
+
</div>
|
|
320
|
+
),
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
name: "preview",
|
|
324
|
+
defaultSize: 250,
|
|
325
|
+
content: (
|
|
326
|
+
<div className="relative h-full">
|
|
327
|
+
<Preview selectedImage={selectedImage} />
|
|
304
328
|
</div>
|
|
305
|
-
)
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
<Preview selectedImage={selectedImage} />
|
|
310
|
-
</SplitterPanel>
|
|
311
|
-
</Splitter>
|
|
329
|
+
),
|
|
330
|
+
},
|
|
331
|
+
]}
|
|
332
|
+
/>
|
|
312
333
|
<DialogButtons>
|
|
313
334
|
<Button variant="ghost" onClick={() => onHide()}>
|
|
314
335
|
Cancel
|
|
@@ -4,9 +4,12 @@ import { Layers } from "lucide-react";
|
|
|
4
4
|
import { SecretAgentIcon } from "../../ui/Icons";
|
|
5
5
|
import { EnterFullScreenIcon } from "@radix-ui/react-icons";
|
|
6
6
|
import { CompareIcon } from "../../ui/Icons";
|
|
7
|
+
import { useAgentStatus } from "../../ai/useAgentStatus";
|
|
8
|
+
import { AgentStatusBadge } from "../../ai/AgentStatusBadge";
|
|
7
9
|
|
|
8
10
|
export function UtilityControls() {
|
|
9
11
|
const editContext = useEditContext();
|
|
12
|
+
const agentStatus = useAgentStatus();
|
|
10
13
|
|
|
11
14
|
if (!editContext) return null;
|
|
12
15
|
|
|
@@ -38,7 +41,12 @@ export function UtilityControls() {
|
|
|
38
41
|
/>
|
|
39
42
|
)}
|
|
40
43
|
<SimpleIconButton
|
|
41
|
-
icon={
|
|
44
|
+
icon={
|
|
45
|
+
<div className="relative">
|
|
46
|
+
<SecretAgentIcon />
|
|
47
|
+
<AgentStatusBadge status={agentStatus} />
|
|
48
|
+
</div>
|
|
49
|
+
}
|
|
42
50
|
label="Agents"
|
|
43
51
|
size="large"
|
|
44
52
|
data-testid="agents-panel-button"
|
|
@@ -45,9 +45,9 @@ export function PlaceholderDropZone({
|
|
|
45
45
|
const [isHovering, setIsHovering] = useState(false);
|
|
46
46
|
|
|
47
47
|
const editContext = useEditContext();
|
|
48
|
-
if (!editContext) return;
|
|
49
48
|
|
|
50
49
|
function dragOver(ev: any) {
|
|
50
|
+
console.log("dragOver", editContext?.mode, editContext?.readonly);
|
|
51
51
|
if (editContext?.mode !== "edit" || editContext?.readonly) {
|
|
52
52
|
ev.dataTransfer.dropEffect = "none";
|
|
53
53
|
return;
|
|
@@ -85,7 +85,7 @@ export function PlaceholderDropZone({
|
|
|
85
85
|
if (size === "small") overlayStyle.transform = "scale(0.5)";
|
|
86
86
|
|
|
87
87
|
useEffect(() => {
|
|
88
|
-
if (isHovering) {
|
|
88
|
+
if (isHovering && editContext) {
|
|
89
89
|
editContext.setStatusMessage(
|
|
90
90
|
<div>
|
|
91
91
|
Drop into placeholder <span className="font-bold">{parentName}</span>{" "}
|
|
@@ -93,10 +93,13 @@ export function PlaceholderDropZone({
|
|
|
93
93
|
at position <span className="font-bold">{index + 1}</span>
|
|
94
94
|
</div>,
|
|
95
95
|
);
|
|
96
|
-
} else {
|
|
96
|
+
} else if (editContext) {
|
|
97
97
|
editContext.setStatusMessage("");
|
|
98
98
|
}
|
|
99
|
-
}, [isHovering]);
|
|
99
|
+
}, [isHovering, editContext]);
|
|
100
|
+
|
|
101
|
+
// Return null after all hooks have been called to avoid breaking React's Rules of Hooks
|
|
102
|
+
if (!editContext || editContext.readonly) return null;
|
|
100
103
|
|
|
101
104
|
const ctrlTypeOption = typeIdOnCtrlClick
|
|
102
105
|
? placeholder.insertOptions?.find((x) => x.typeId === typeIdOnCtrlClick)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Select } from "../../components/ui/select";
|
|
2
|
-
import {
|
|
2
|
+
import { Input } from "../../components/ui/input";
|
|
3
3
|
import { SimpleIconButton } from "../ui/SimpleIconButton";
|
|
4
4
|
import { RotateDeviceIcon } from "../ui/Icons";
|
|
5
5
|
import { useDebouncedCallback } from "use-debounce";
|
|
@@ -39,20 +39,24 @@ export function DeviceToolbar({
|
|
|
39
39
|
onValueChange={(value) => pageViewContext.setDevice(value)}
|
|
40
40
|
placeholder="Select device"
|
|
41
41
|
/>
|
|
42
|
-
<
|
|
43
|
-
|
|
42
|
+
<Input
|
|
43
|
+
type="number"
|
|
44
44
|
max={10000}
|
|
45
|
-
className="text-sm"
|
|
46
|
-
value={pageViewContext.deviceWidth}
|
|
47
|
-
onChange={(e) =>
|
|
45
|
+
className="w-16 text-sm"
|
|
46
|
+
value={pageViewContext.deviceWidth || ""}
|
|
47
|
+
onChange={(e) =>
|
|
48
|
+
debouncedSetDeviceWidth(Number(e.target.value) || undefined)
|
|
49
|
+
}
|
|
48
50
|
/>
|
|
49
51
|
x
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
+
<Input
|
|
53
|
+
type="number"
|
|
52
54
|
max={10000}
|
|
53
|
-
className="text-sm"
|
|
54
|
-
value={pageViewContext.deviceHeight}
|
|
55
|
-
onChange={(e) =>
|
|
55
|
+
className="w-16 text-sm"
|
|
56
|
+
value={pageViewContext.deviceHeight || ""}
|
|
57
|
+
onChange={(e) =>
|
|
58
|
+
debouncedSetDeviceHeight(Number(e.target.value) || undefined)
|
|
59
|
+
}
|
|
56
60
|
/>
|
|
57
61
|
<SimpleIconButton
|
|
58
62
|
icon={
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
|
|
25
25
|
import { getComponentById } from "../componentTreeHelper";
|
|
26
26
|
import { buildComponentContextMenuItems } from "../ContextMenu";
|
|
27
|
-
import { loadFieldButtons } from "../services/editService";
|
|
27
|
+
import { loadFieldButtons, releaseFieldLocks } from "../services/editService";
|
|
28
28
|
import { usePathname } from "next/navigation";
|
|
29
29
|
import { EditorWarnings } from "../EditorWarnings";
|
|
30
30
|
import {
|
|
@@ -188,7 +188,7 @@ export function PageViewerFrame({
|
|
|
188
188
|
: pageViewContext.editUrl;
|
|
189
189
|
|
|
190
190
|
const renderUrl = new URL(urlPath, window.location.origin);
|
|
191
|
-
renderUrl.searchParams.set("edit_rev",
|
|
191
|
+
renderUrl.searchParams.set("edit_rev", uuid());
|
|
192
192
|
|
|
193
193
|
if (iframeRef.current?.contentWindow?.requestRefresh) {
|
|
194
194
|
console.log("Integration - requesting refresh");
|
|
@@ -441,17 +441,17 @@ export function PageViewerFrame({
|
|
|
441
441
|
if (owner?.layoutId) return;
|
|
442
442
|
}
|
|
443
443
|
|
|
444
|
-
fieldsContextRef.current?.setFocusedField(
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
);
|
|
444
|
+
// fieldsContextRef.current?.setFocusedField(
|
|
445
|
+
// {
|
|
446
|
+
// fieldId: fieldId,
|
|
447
|
+
// item: {
|
|
448
|
+
// id: fieldElement.getAttribute("data-itemid") || "",
|
|
449
|
+
// language: fieldElement.getAttribute("data-language") || "",
|
|
450
|
+
// version: parseInt(fieldElement.getAttribute("data-version") || "0"),
|
|
451
|
+
// },
|
|
452
|
+
// },
|
|
453
|
+
// editContext.mode === "edit",
|
|
454
|
+
// );
|
|
455
455
|
|
|
456
456
|
// Compute the global offsets relative to the field element.
|
|
457
457
|
const globalStartOffset = getGlobalTextOffset(
|
|
@@ -572,6 +572,8 @@ export function PageViewerFrame({
|
|
|
572
572
|
//}
|
|
573
573
|
} else editContextRef.current?.select([]);
|
|
574
574
|
|
|
575
|
+
console.log("componentId", componentId);
|
|
576
|
+
|
|
575
577
|
if (
|
|
576
578
|
(editContextRef.current?.mode === "edit" &&
|
|
577
579
|
pageViewContextRef.current?.page?.item.canWriteItem) ||
|
|
@@ -616,9 +618,13 @@ export function PageViewerFrame({
|
|
|
616
618
|
// Clicked inside iframe but not on a field: clear focused field
|
|
617
619
|
fieldsContextRef.current?.setFocusedField(undefined, false);
|
|
618
620
|
fieldsContextRef.current?.setInlineEditingFieldElement(undefined);
|
|
621
|
+
// Release field locks when unfocusing field
|
|
622
|
+
if (editContextRef.current?.sessionId) {
|
|
623
|
+
releaseFieldLocks(editContextRef.current.sessionId);
|
|
624
|
+
}
|
|
619
625
|
}
|
|
620
626
|
}
|
|
621
|
-
|
|
627
|
+
|
|
622
628
|
const clickEvent = new MouseEvent("click", {
|
|
623
629
|
view: window,
|
|
624
630
|
bubbles: true,
|