@parhelia/core 0.1.11069 → 0.1.11141
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/README.md +34 -34
- package/dist/components/ui/dialog.js +2 -2
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/editor/ai/AgentTerminal.js +165 -43
- package/dist/editor/ai/AgentTerminal.js.map +1 -1
- package/dist/editor/ai/Agents.js +3 -3
- package/dist/editor/ai/Agents.js.map +1 -1
- package/dist/editor/ai/ContextInfoBar.js +175 -37
- package/dist/editor/ai/ContextInfoBar.js.map +1 -1
- package/dist/editor/ai/EditOperationsPanel.d.ts +5 -0
- package/dist/editor/ai/EditOperationsPanel.js +64 -0
- package/dist/editor/ai/EditOperationsPanel.js.map +1 -0
- package/dist/editor/client/EditorShell.js +109 -35
- package/dist/editor/client/EditorShell.js.map +1 -1
- package/dist/editor/client/editContext.d.ts +4 -0
- package/dist/editor/client/editContext.js.map +1 -1
- package/dist/editor/client/operations.d.ts +3 -1
- package/dist/editor/client/operations.js +154 -52
- package/dist/editor/client/operations.js.map +1 -1
- package/dist/editor/commands/componentCommands.js +2 -2
- package/dist/editor/commands/componentCommands.js.map +1 -1
- package/dist/editor/commands/itemCommands.js +25 -25
- package/dist/editor/commands/itemCommands.js.map +1 -1
- package/dist/editor/commands/undo.d.ts +2 -2
- package/dist/editor/commands/undo.js +4 -2
- package/dist/editor/commands/undo.js.map +1 -1
- package/dist/editor/field-types/NameValueListEditor.js +14 -2
- package/dist/editor/field-types/NameValueListEditor.js.map +1 -1
- package/dist/editor/field-types/RichTextEditorComponent.js +15 -3
- package/dist/editor/field-types/RichTextEditorComponent.js.map +1 -1
- package/dist/editor/field-types/richtext/components/ReactSlate.js +65 -2
- package/dist/editor/field-types/richtext/components/ReactSlate.js.map +1 -1
- package/dist/editor/menubar/ApproveAndPublish.js +1 -1
- package/dist/editor/menubar/WorkflowButton.js +1 -1
- package/dist/editor/page-editor-chrome/FrameMenu.js +50 -13
- package/dist/editor/page-editor-chrome/FrameMenu.js.map +1 -1
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +18 -4
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js.map +1 -1
- package/dist/editor/page-editor-chrome/useInlineAICompletion.js +18 -39
- package/dist/editor/page-editor-chrome/useInlineAICompletion.js.map +1 -1
- package/dist/editor/page-viewer/PageViewerFrame.js +34 -131
- package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -1
- package/dist/editor/services/agentService.d.ts +17 -0
- package/dist/editor/services/agentService.js +8 -0
- package/dist/editor/services/agentService.js.map +1 -1
- package/dist/editor/services/contextService.js +8 -27
- package/dist/editor/services/contextService.js.map +1 -1
- package/dist/editor/services/editService.d.ts +5 -2
- package/dist/editor/services/editService.js +19 -5
- package/dist/editor/services/editService.js.map +1 -1
- package/dist/editor/sidebar/ComponentPalette.js +4 -1
- package/dist/editor/sidebar/ComponentPalette.js.map +1 -1
- package/dist/editor/sidebar/EditHistory.js +30 -55
- package/dist/editor/sidebar/EditHistory.js.map +1 -1
- package/dist/editor/sidebar/OperationItem.d.ts +10 -0
- package/dist/editor/sidebar/OperationItem.js +102 -0
- package/dist/editor/sidebar/OperationItem.js.map +1 -0
- package/dist/editor/ui/DragPreview.d.ts +5 -0
- package/dist/editor/ui/DragPreview.js +41 -3
- package/dist/editor/ui/DragPreview.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/dist/styles.css +38 -9
- package/dist/types.d.ts +24 -2
- package/package.json +1 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect, useCallback } from "react";
|
|
3
|
+
import { ChevronDown, ChevronUp, History } from "lucide-react";
|
|
4
|
+
import { getAgentHistory } from "../services/editService";
|
|
5
|
+
import { OperationItem, filterUndone } from "../sidebar/OperationItem";
|
|
6
|
+
import { useEditContext } from "../client/editContext";
|
|
7
|
+
export function AgentEditOperationsPanel({ agentId, }) {
|
|
8
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
9
|
+
const [agentOperations, setAgentOperations] = useState([]);
|
|
10
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
11
|
+
const editContext = useEditContext();
|
|
12
|
+
// Fetch edit operations from backend by agentId
|
|
13
|
+
const fetchOperations = useCallback(async () => {
|
|
14
|
+
if (!agentId) {
|
|
15
|
+
setAgentOperations([]);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
setIsLoading(true);
|
|
19
|
+
try {
|
|
20
|
+
const result = await getAgentHistory(agentId, 1000);
|
|
21
|
+
if (result.type === "success" && result.data) {
|
|
22
|
+
// Filter undone operations
|
|
23
|
+
const filtered = filterUndone(result.data);
|
|
24
|
+
setAgentOperations(filtered);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.error("Failed to fetch agent operations:", error);
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
setIsLoading(false);
|
|
32
|
+
}
|
|
33
|
+
}, [agentId]);
|
|
34
|
+
// Initial load
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
fetchOperations();
|
|
37
|
+
}, [fetchOperations]);
|
|
38
|
+
// Listen to WebSocket messages for edit operations from this agent
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (!agentId || !editContext?.addSocketMessageListener) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const handleMessage = (message) => {
|
|
44
|
+
// Check if this is an edit-operation message from our agent
|
|
45
|
+
if (message.type === "edit-operation") {
|
|
46
|
+
const op = message.payload;
|
|
47
|
+
// Check both op.agentId and op.user?.agentId
|
|
48
|
+
const operationAgentId = op.agentId || op.user?.agentId;
|
|
49
|
+
if (operationAgentId === agentId) {
|
|
50
|
+
// Reload operations when this agent performs an operation
|
|
51
|
+
fetchOperations();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const unsubscribe = editContext.addSocketMessageListener(handleMessage);
|
|
56
|
+
return () => {
|
|
57
|
+
unsubscribe();
|
|
58
|
+
};
|
|
59
|
+
}, [agentId, editContext, fetchOperations]);
|
|
60
|
+
if (agentOperations.length === 0 && !isLoading)
|
|
61
|
+
return null;
|
|
62
|
+
return (_jsxs("div", { className: "border-t border-gray-200 bg-gray-50", children: [_jsxs("button", { onClick: () => setIsExpanded(!isExpanded), className: "flex w-full cursor-pointer items-center justify-between px-4 py-2 text-left transition-colors hover:bg-gray-100", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(History, { className: "h-4 w-4 text-gray-500", strokeWidth: 1 }), _jsx("span", { className: "text-xs font-medium text-gray-700", children: "Edit History" }), _jsxs("span", { className: "text-xs text-gray-500", children: ["(", agentOperations.length, ")"] })] }), isExpanded ? (_jsx(ChevronUp, { className: "h-4 w-4 text-gray-500", strokeWidth: 1 })) : (_jsx(ChevronDown, { className: "h-4 w-4 text-gray-500", strokeWidth: 1 }))] }), isExpanded && (_jsx("div", { className: "max-h-64 overflow-y-auto", children: agentOperations.map((op, i) => (_jsx(OperationItem, { operation: op, index: i, showUserName: false }, op.id))) }))] }));
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=EditOperationsPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditOperationsPanel.js","sourceRoot":"","sources":["../../../src/editor/ai/EditOperationsPanel.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAu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WAAW,EAAE,CAAC,GAAI,CAChE,CAAC,CAAC,CAAC,CACF,KAAC,WAAW,IAAC,SAAS,EAAC,uBAAuB,EAAC,WAAW,EAAE,CAAC,GAAI,CAClE,IACM,EACR,UAAU,IAAI,CACb,cAAK,SAAS,EAAC,0BAA0B,YACtC,eAAe,CAAC,GAAG,CAAC,CAAC,EAAiB,EAAE,CAAS,EAAE,EAAE,CAAC,CACrD,KAAC,aAAa,IAEZ,SAAS,EAAE,EAAE,EACb,KAAK,EAAE,CAAC,EACR,YAAY,EAAE,KAAK,IAHd,EAAE,CAAC,EAAE,CAIV,CACH,CAAC,GACE,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -8,7 +8,7 @@ import { useRouter, useSearchParams, usePathname } from "next/navigation";
|
|
|
8
8
|
import { findComponent, getComponentById } from "../componentTreeHelper";
|
|
9
9
|
import { getOperationsContext } from "./operations";
|
|
10
10
|
import { handleErrorResult } from "./helpers";
|
|
11
|
-
import { executeFieldAction as executeFieldServerAction, connectSocket, getEditHistory, releaseFieldLocks, validateItems, } from "../services/editService";
|
|
11
|
+
import { executeFieldAction as executeFieldServerAction, connectSocket, getEditHistory, getSessionHistory, getAllHistory, releaseFieldLocks, validateItems, } from "../services/editService";
|
|
12
12
|
import { useEditorWebSocket } from "./hooks/useEditorWebSocket";
|
|
13
13
|
import { useSocketMessageHandler } from "./hooks/useSocketMessageHandler";
|
|
14
14
|
import "react-json-view-lite/dist/index.css";
|
|
@@ -75,6 +75,7 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
|
|
|
75
75
|
const fieldEditorPopupRef = React.useRef(null);
|
|
76
76
|
const [validationResult, setValidationResult] = useState();
|
|
77
77
|
const [editHistory, setEditHistory] = useState([]);
|
|
78
|
+
const [historyMode, setHistoryMode] = useState("global");
|
|
78
79
|
const [recentEdits, setRecentEdits] = useState([]);
|
|
79
80
|
const addRecentEdit = useCallback((edit) => {
|
|
80
81
|
setRecentEdits((prevEditedFields) => {
|
|
@@ -683,18 +684,70 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
|
|
|
683
684
|
setInserting(undefined);
|
|
684
685
|
}, [page, viewName, revision]);
|
|
685
686
|
// moved below to ensure requestRefresh is declared first
|
|
686
|
-
const loadHistory = useDebouncedCallback(async (
|
|
687
|
-
|
|
688
|
-
if (handleErrorResult(result, ui, state))
|
|
687
|
+
const loadHistory = useDebouncedCallback(async () => {
|
|
688
|
+
if (!sessionId)
|
|
689
689
|
return;
|
|
690
|
-
|
|
691
|
-
}, 200);
|
|
692
|
-
const refreshHistory = useCallback(async (item) => {
|
|
693
|
-
const result = await getEditHistory(item);
|
|
690
|
+
const result = await getSessionHistory(sessionId);
|
|
694
691
|
if (handleErrorResult(result, ui, state))
|
|
695
692
|
return;
|
|
696
693
|
setEditHistory(result.data || []);
|
|
697
|
-
},
|
|
694
|
+
}, 200);
|
|
695
|
+
const refreshHistory = useCallback(async (mode, filterBySession = true) => {
|
|
696
|
+
const currentMode = mode || historyMode;
|
|
697
|
+
if (currentMode === "global") {
|
|
698
|
+
if (!filterBySession) {
|
|
699
|
+
// Show all operations globally (across all sessions) with limit of 500
|
|
700
|
+
console.log("[EditorShell] Loading all operations globally (all sessions)");
|
|
701
|
+
const result = await getAllHistory(500);
|
|
702
|
+
if (handleErrorResult(result, ui, state)) {
|
|
703
|
+
console.error("[EditorShell] Failed to load all history:", result);
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
console.log("[EditorShell] Loaded", result.data?.length || 0, "operations (all sessions)");
|
|
707
|
+
setEditHistory(result.data || []);
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
// Filter by session
|
|
711
|
+
if (!sessionId) {
|
|
712
|
+
console.warn("[EditorShell] Cannot load history: sessionId is not available");
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
715
|
+
console.log("[EditorShell] Loading session history for sessionId:", sessionId);
|
|
716
|
+
const result = await getSessionHistory(sessionId);
|
|
717
|
+
if (handleErrorResult(result, ui, state)) {
|
|
718
|
+
console.error("[EditorShell] Failed to load session history:", result);
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
console.log("[EditorShell] Loaded", result.data?.length || 0, "operations");
|
|
722
|
+
setEditHistory(result.data || []);
|
|
723
|
+
}
|
|
724
|
+
else {
|
|
725
|
+
// Page-centric or current-version mode - need current item
|
|
726
|
+
const currentItem = contentEditorItem?.descriptor;
|
|
727
|
+
if (!currentItem) {
|
|
728
|
+
console.warn("[EditorShell] Cannot load page-centric history: no item loaded");
|
|
729
|
+
setEditHistory([]);
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
console.log("[EditorShell] Loading item history for:", currentItem.id, "mode:", currentMode, "filterBySession:", filterBySession);
|
|
733
|
+
const result = await getEditHistory(currentItem);
|
|
734
|
+
if (handleErrorResult(result, ui, state)) {
|
|
735
|
+
console.error("[EditorShell] Failed to load item history:", result);
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
let operations = result.data || [];
|
|
739
|
+
// Filter by session if requested
|
|
740
|
+
if (filterBySession) {
|
|
741
|
+
operations = operations.filter((op) => op.sessionId === sessionId);
|
|
742
|
+
}
|
|
743
|
+
// Filter by version if current-version mode
|
|
744
|
+
if (currentMode === "current-version") {
|
|
745
|
+
operations = operations.filter((op) => op.mainItem?.version === currentItem.version);
|
|
746
|
+
}
|
|
747
|
+
console.log("[EditorShell] Loaded", operations.length, "operations");
|
|
748
|
+
setEditHistory(operations);
|
|
749
|
+
}
|
|
750
|
+
}, [sessionId, historyMode, contentEditorItem]);
|
|
698
751
|
// defined below after loadItem/loadItemVersions/requestRefresh
|
|
699
752
|
const requestRefresh = useCallback((mode) => {
|
|
700
753
|
const refreshTimer = globalThis.editorRefreshTimer;
|
|
@@ -722,6 +775,27 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
|
|
|
722
775
|
loadComments();
|
|
723
776
|
loadSuggestedEdits();
|
|
724
777
|
}, [currentItemDescriptor]);
|
|
778
|
+
// Load history on initialization or when mode/item changes
|
|
779
|
+
useEffect(() => {
|
|
780
|
+
if (historyMode === "global" && sessionId) {
|
|
781
|
+
// Use refreshHistory for immediate load on initialization
|
|
782
|
+
refreshHistory("global");
|
|
783
|
+
}
|
|
784
|
+
else if (historyMode !== "global" && currentItemDescriptor) {
|
|
785
|
+
refreshHistory(historyMode);
|
|
786
|
+
}
|
|
787
|
+
else if (historyMode !== "global" && !currentItemDescriptor) {
|
|
788
|
+
// Clear history if no item loaded in page-centric modes
|
|
789
|
+
setEditHistory([]);
|
|
790
|
+
}
|
|
791
|
+
}, [
|
|
792
|
+
sessionId,
|
|
793
|
+
historyMode,
|
|
794
|
+
currentItemDescriptor?.id,
|
|
795
|
+
currentItemDescriptor?.language,
|
|
796
|
+
currentItemDescriptor?.version,
|
|
797
|
+
refreshHistory,
|
|
798
|
+
]);
|
|
725
799
|
// Load available comment tags once per current item descriptor
|
|
726
800
|
useEffect(() => {
|
|
727
801
|
let cancelled = false;
|
|
@@ -796,10 +870,16 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
|
|
|
796
870
|
}
|
|
797
871
|
else {
|
|
798
872
|
// Remove item-related parameters when no item is selected
|
|
799
|
-
|
|
800
|
-
current.
|
|
801
|
-
|
|
802
|
-
|
|
873
|
+
// BUT preserve them if reviewId is present (review links may not have loaded item yet)
|
|
874
|
+
const reviewId = current.get("reviewId");
|
|
875
|
+
if (!reviewId) {
|
|
876
|
+
// Only delete item params if we're not in a review context
|
|
877
|
+
current.delete("itemid");
|
|
878
|
+
current.delete("lang");
|
|
879
|
+
current.delete("language");
|
|
880
|
+
current.delete("version");
|
|
881
|
+
}
|
|
882
|
+
// If reviewId exists, preserve itemid/lang/version from URL for review links
|
|
803
883
|
}
|
|
804
884
|
// Always sync view-related parameters regardless of item selection
|
|
805
885
|
if (current.get("view") !== viewName) {
|
|
@@ -829,6 +909,12 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
|
|
|
829
909
|
else {
|
|
830
910
|
current.delete("wizardid");
|
|
831
911
|
}
|
|
912
|
+
// Preserve reviewId parameter if it exists (for review links)
|
|
913
|
+
// This ensures review links don't lose the reviewId when URL is synced
|
|
914
|
+
const reviewId = current.get("reviewId");
|
|
915
|
+
if (reviewId) {
|
|
916
|
+
current.set("reviewId", reviewId); // Explicitly preserve it
|
|
917
|
+
}
|
|
832
918
|
// Use the actual browser pathname (including any basePath like /parhelia)
|
|
833
919
|
// so we don't accidentally drop the base segment when updating the URL
|
|
834
920
|
const browserPathname = typeof window !== "undefined" ? window.location.pathname : pathname;
|
|
@@ -949,8 +1035,8 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
|
|
|
949
1035
|
setCurrentItemDescriptor(itemToLoad);
|
|
950
1036
|
setContentEditorItem(item);
|
|
951
1037
|
setSelection([]);
|
|
952
|
-
// Load history and add to browse history
|
|
953
|
-
loadHistory(
|
|
1038
|
+
// Load history (session-based) and add to browse history
|
|
1039
|
+
loadHistory();
|
|
954
1040
|
if (options?.addToBrowseHistory ||
|
|
955
1041
|
options?.addToBrowseHistory === undefined) {
|
|
956
1042
|
addToBrowseHistory(item);
|
|
@@ -1061,7 +1147,9 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
|
|
|
1061
1147
|
contentEditorItem?.version === op.mainItem?.version) {
|
|
1062
1148
|
setInsertMode(false);
|
|
1063
1149
|
}
|
|
1064
|
-
|
|
1150
|
+
// Refresh history from server to ensure consistency
|
|
1151
|
+
refreshHistory();
|
|
1152
|
+
}, [contentEditorItem, setEditHistory, setInsertMode, refreshHistory]);
|
|
1065
1153
|
const ui = {
|
|
1066
1154
|
showErrorToast,
|
|
1067
1155
|
confirmationDialogRef,
|
|
@@ -1193,19 +1281,6 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
|
|
|
1193
1281
|
}, [operationsContext.cleanup]);
|
|
1194
1282
|
// Shared focused field setter with lock handling (used in both contexts)
|
|
1195
1283
|
const setFocusedFieldWithLock = useCallback(async (field, requestLock) => {
|
|
1196
|
-
console.log("[setFocusedFieldWithLock] Called with:", {
|
|
1197
|
-
field: field
|
|
1198
|
-
? {
|
|
1199
|
-
fieldId: field.fieldId,
|
|
1200
|
-
itemId: field.item?.id,
|
|
1201
|
-
language: field.item?.language,
|
|
1202
|
-
version: field.item?.version,
|
|
1203
|
-
}
|
|
1204
|
-
: undefined,
|
|
1205
|
-
requestLock,
|
|
1206
|
-
ignoreBlur,
|
|
1207
|
-
timestamp: new Date().toISOString(),
|
|
1208
|
-
});
|
|
1209
1284
|
if (field) {
|
|
1210
1285
|
setIgnoreBlur(true);
|
|
1211
1286
|
setTimeout(() => {
|
|
@@ -1213,17 +1288,13 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
|
|
|
1213
1288
|
}, 20);
|
|
1214
1289
|
setFocusedField({ ...field });
|
|
1215
1290
|
if (requestLock) {
|
|
1216
|
-
console.log("[setFocusedFieldWithLock] Calling operations.ensureLock for field:", field.fieldId);
|
|
1217
1291
|
const lockResult = (await operations.ensureLock(field)) || false;
|
|
1218
|
-
console.log("[setFocusedFieldWithLock] ensureLock result:", lockResult);
|
|
1219
1292
|
return lockResult;
|
|
1220
1293
|
}
|
|
1221
1294
|
}
|
|
1222
1295
|
else {
|
|
1223
|
-
console.log("[setFocusedFieldWithLock] Clearing focused field, ignoreBlur:", ignoreBlur);
|
|
1224
1296
|
if (!ignoreBlur) {
|
|
1225
1297
|
setFocusedField(undefined);
|
|
1226
|
-
console.log("[setFocusedFieldWithLock] Clearing lockedField state");
|
|
1227
1298
|
setLockedField(undefined); // Clear client-side lock state
|
|
1228
1299
|
releaseFieldLocks(sessionId);
|
|
1229
1300
|
}
|
|
@@ -1735,7 +1806,7 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
|
|
|
1735
1806
|
date: new Date().toISOString(),
|
|
1736
1807
|
id: uuid(),
|
|
1737
1808
|
linkedComponentItem: dragObject.items[0],
|
|
1738
|
-
|
|
1809
|
+
title: "Link component",
|
|
1739
1810
|
};
|
|
1740
1811
|
console.log("op", op);
|
|
1741
1812
|
}
|
|
@@ -1756,7 +1827,7 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
|
|
|
1756
1827
|
componentIds,
|
|
1757
1828
|
date: new Date().toISOString(),
|
|
1758
1829
|
id: uuid(),
|
|
1759
|
-
|
|
1830
|
+
title: "Move component",
|
|
1760
1831
|
};
|
|
1761
1832
|
}
|
|
1762
1833
|
}
|
|
@@ -1878,6 +1949,9 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
|
|
|
1878
1949
|
contentEditorItem,
|
|
1879
1950
|
loadItem,
|
|
1880
1951
|
editHistory,
|
|
1952
|
+
historyMode,
|
|
1953
|
+
setHistoryMode,
|
|
1954
|
+
refreshHistory,
|
|
1881
1955
|
isRefreshing,
|
|
1882
1956
|
activeSessions,
|
|
1883
1957
|
unlockField: async () => {
|