@parhelia/core 0.4.12784 → 0.4.12800
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/agents-view/AgentCard.js +1 -1
- package/dist/agents-view/AgentCard.js.map +1 -1
- package/dist/agents-view/AgentsView.js +4 -2
- package/dist/agents-view/AgentsView.js.map +1 -1
- package/dist/agents-view/DateAgentsGroup.js +1 -1
- package/dist/agents-view/DateAgentsGroup.js.map +1 -1
- package/dist/config/config.js +38 -7
- package/dist/config/config.js.map +1 -1
- package/dist/config/types/sidebar.d.ts +8 -0
- package/dist/config/types/workspace.d.ts +8 -0
- package/dist/config/types.d.ts +2 -0
- package/dist/config/types.js.map +1 -1
- package/dist/editor/FieldListField.js +8 -4
- package/dist/editor/FieldListField.js.map +1 -1
- package/dist/editor/GlobalMenuBar.js +8 -6
- package/dist/editor/GlobalMenuBar.js.map +1 -1
- package/dist/editor/LinkEditorDialog.d.ts +2 -0
- package/dist/editor/LinkEditorDialog.js +6 -1
- package/dist/editor/LinkEditorDialog.js.map +1 -1
- package/dist/editor/ai/Agents.js +19 -8
- package/dist/editor/ai/Agents.js.map +1 -1
- package/dist/editor/ai/terminal/components/AgentCostDisplay.d.ts +2 -3
- package/dist/editor/ai/terminal/components/AgentCostDisplay.js +4 -5
- package/dist/editor/ai/terminal/components/AgentCostDisplay.js.map +1 -1
- package/dist/editor/ai/terminal/components/AgentGreeting.js +4 -1
- package/dist/editor/ai/terminal/components/AgentGreeting.js.map +1 -1
- package/dist/editor/ai/terminal/components/AgentProfileSwitcher.js +1 -1
- package/dist/editor/ai/terminal/components/AgentProfileSwitcher.js.map +1 -1
- package/dist/editor/ai/terminal/components/AgentPromptActionButtons.js +1 -1
- package/dist/editor/ai/terminal/components/AgentPromptActionButtons.js.map +1 -1
- package/dist/editor/ai/terminal/components/AgentPromptInputArea.js +1 -1
- package/dist/editor/ai/terminal/components/AgentPromptInputArea.js.map +1 -1
- package/dist/editor/ai/terminal/components/AgentTerminalFullUpperContent.js +11 -4
- package/dist/editor/ai/terminal/components/AgentTerminalFullUpperContent.js.map +1 -1
- package/dist/editor/ai/terminal/components/AgentTerminalStatusBar.js +3 -3
- package/dist/editor/ai/terminal/components/AgentTerminalStatusBar.js.map +1 -1
- package/dist/editor/ai/terminal/components/AgentThinkingIndicator.d.ts +14 -1
- package/dist/editor/ai/terminal/components/AgentThinkingIndicator.js +10 -3
- package/dist/editor/ai/terminal/components/AgentThinkingIndicator.js.map +1 -1
- package/dist/editor/ai/terminal/components/AiResponseMessage.js +28 -20
- package/dist/editor/ai/terminal/components/AiResponseMessage.js.map +1 -1
- package/dist/editor/ai/terminal/components/ApprovalCard.js +67 -4
- package/dist/editor/ai/terminal/components/ApprovalCard.js.map +1 -1
- package/dist/editor/ai/terminal/components/InitialThinkingSplash.js +2 -2
- package/dist/editor/ai/terminal/components/InitialThinkingSplash.js.map +1 -1
- package/dist/editor/ai/terminal/components/ToolCallDisplay.d.ts +3 -1
- package/dist/editor/ai/terminal/components/ToolCallDisplay.js +5 -3
- package/dist/editor/ai/terminal/components/ToolCallDisplay.js.map +1 -1
- package/dist/editor/ai/terminal/components/agentThinkingStyles.d.ts +21 -0
- package/dist/editor/ai/terminal/components/agentThinkingStyles.js +21 -0
- package/dist/editor/ai/terminal/components/agentThinkingStyles.js.map +1 -1
- package/dist/editor/ai/terminal/components/approvalActions.d.ts +1 -0
- package/dist/editor/ai/terminal/components/approvalActions.js +5 -2
- package/dist/editor/ai/terminal/components/approvalActions.js.map +1 -1
- package/dist/editor/ai/terminal/components/useApprovalActions.d.ts +4 -4
- package/dist/editor/ai/terminal/components/useApprovalActions.js +5 -2
- package/dist/editor/ai/terminal/components/useApprovalActions.js.map +1 -1
- package/dist/editor/ai/terminal/useAgentSubmitHandlers.d.ts +1 -0
- package/dist/editor/ai/terminal/useAgentSubmitHandlers.js +6 -1
- package/dist/editor/ai/terminal/useAgentSubmitHandlers.js.map +1 -1
- package/dist/editor/ai/terminal/useAgentTerminalController.js +1 -0
- package/dist/editor/ai/terminal/useAgentTerminalController.js.map +1 -1
- package/dist/editor/client/EditorShell.js +706 -692
- package/dist/editor/client/EditorShell.js.map +1 -1
- package/dist/editor/client/ui/DevModeIndicator.js +3 -3
- package/dist/editor/client/ui/DevModeIndicator.js.map +1 -1
- package/dist/editor/commands/componentCommands.js +1 -2
- package/dist/editor/commands/componentCommands.js.map +1 -1
- package/dist/editor/commands/mediaCommands.d.ts +5 -0
- package/dist/editor/commands/mediaCommands.js +59 -0
- package/dist/editor/commands/mediaCommands.js.map +1 -0
- package/dist/editor/field-types/FieldHistoryBoundary.d.ts +7 -0
- package/dist/editor/field-types/FieldHistoryBoundary.js +19 -0
- package/dist/editor/field-types/FieldHistoryBoundary.js.map +1 -0
- package/dist/editor/field-types/LinkFieldEditor.js +15 -4
- package/dist/editor/field-types/LinkFieldEditor.js.map +1 -1
- package/dist/editor/field-types/MultiLineText.js +6 -1
- package/dist/editor/field-types/MultiLineText.js.map +1 -1
- package/dist/editor/field-types/RichTextEditor.js +5 -5
- package/dist/editor/field-types/RichTextEditor.js.map +1 -1
- package/dist/editor/field-types/SingleLineText.js +6 -1
- package/dist/editor/field-types/SingleLineText.js.map +1 -1
- package/dist/editor/field-types/TreeListEditor.js +3 -3
- package/dist/editor/field-types/TreeListEditor.js.map +1 -1
- package/dist/editor/fieldTypes.d.ts +2 -0
- package/dist/editor/itemContextMenuGroups.d.ts +16 -0
- package/dist/editor/itemContextMenuGroups.js +48 -0
- package/dist/editor/itemContextMenuGroups.js.map +1 -0
- package/dist/editor/media-selector/UploadMediaFileDialog.d.ts +5 -0
- package/dist/editor/media-selector/UploadMediaFileDialog.js +14 -0
- package/dist/editor/media-selector/UploadMediaFileDialog.js.map +1 -0
- package/dist/editor/page-editor-chrome/PageEditorChrome.js +4 -0
- package/dist/editor/page-editor-chrome/PageEditorChrome.js.map +1 -1
- package/dist/editor/reviews/CreateReviewDialog.js +21 -4
- package/dist/editor/reviews/CreateReviewDialog.js.map +1 -1
- package/dist/editor/reviews/CreateReviewReviewersStep.d.ts +6 -1
- package/dist/editor/reviews/CreateReviewReviewersStep.js +29 -27
- package/dist/editor/reviews/CreateReviewReviewersStep.js.map +1 -1
- package/dist/editor/reviews/CreateReviewSuccessStep.d.ts +8 -1
- package/dist/editor/reviews/CreateReviewSuccessStep.js +4 -3
- package/dist/editor/reviews/CreateReviewSuccessStep.js.map +1 -1
- package/dist/editor/reviews/ReviewersPanel.js +4 -1
- package/dist/editor/reviews/ReviewersPanel.js.map +1 -1
- package/dist/editor/services/aiService.d.ts +2 -0
- package/dist/editor/services/aiService.js.map +1 -1
- package/dist/editor/services/reviewsService.d.ts +2 -2
- package/dist/editor/services/reviewsService.js +3 -1
- package/dist/editor/services/reviewsService.js.map +1 -1
- package/dist/editor/settings/About.js +4 -3
- package/dist/editor/settings/About.js.map +1 -1
- package/dist/editor/settings/SettingsView.js +1 -1
- package/dist/editor/settings/SettingsView.js.map +1 -1
- package/dist/editor/settings/panels/AgentProfileConfigPanel.js +1 -0
- package/dist/editor/settings/panels/AgentProfileConfigPanel.js.map +1 -1
- package/dist/editor/settings/panels/JavaScriptToolConfigPanel.js +11 -0
- package/dist/editor/settings/panels/JavaScriptToolConfigPanel.js.map +1 -1
- package/dist/editor/settings/panels/PublicSiteEntryDialog.js +1 -1
- package/dist/editor/settings/panels/PublicSiteEntryDialog.js.map +1 -1
- package/dist/editor/sidebar/ComponentPalette.js +1 -1
- package/dist/editor/sidebar/ComponentPalette.js.map +1 -1
- package/dist/editor/sidebar/OperationDetailsContent.d.ts +14 -0
- package/dist/editor/sidebar/OperationDetailsContent.js +521 -0
- package/dist/editor/sidebar/OperationDetailsContent.js.map +1 -0
- package/dist/editor/sidebar/OperationItem.js +9 -77
- package/dist/editor/sidebar/OperationItem.js.map +1 -1
- package/dist/editor/ui/PerfectTree.js +4 -1
- package/dist/editor/ui/PerfectTree.js.map +1 -1
- package/dist/editor/ui/PublishDialog.d.ts +4 -2
- package/dist/editor/ui/PublishDialog.js +30 -13
- package/dist/editor/ui/PublishDialog.js.map +1 -1
- package/dist/editor/ui/publishReadiness.d.ts +21 -1
- package/dist/editor/ui/publishReadiness.js +40 -0
- package/dist/editor/ui/publishReadiness.js.map +1 -1
- package/dist/editor/utils/keyboardNavigation.js +20 -0
- package/dist/editor/utils/keyboardNavigation.js.map +1 -1
- package/dist/editor/utils/linkDisplay.d.ts +12 -0
- package/dist/editor/utils/linkDisplay.js +23 -0
- package/dist/editor/utils/linkDisplay.js.map +1 -0
- package/dist/editor/views/ItemEditor.js +30 -5
- package/dist/editor/views/ItemEditor.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/dist/task-board/components/GoalDataView.js +120 -27
- package/dist/task-board/components/GoalDataView.js.map +1 -1
- package/dist/tour/Tour.js +3 -2
- package/dist/tour/Tour.js.map +1 -1
- package/dist/tour/TourInputBoundary.d.ts +6 -0
- package/dist/tour/TourInputBoundary.js +82 -0
- package/dist/tour/TourInputBoundary.js.map +1 -0
- package/dist/tour/default-tour.js +4 -4
- package/dist/tour/default-tour.js.map +1 -1
- package/dist/tour/preview-tour.js +1 -1
- package/dist/tour/preview-tour.js.map +1 -1
- package/dist/tour/sandbox-tour.js +2 -1
- package/dist/tour/sandbox-tour.js.map +1 -1
- package/dist/types.d.ts +18 -0
- package/package.json +1 -1
- package/styles.css +6 -1
|
@@ -4855,733 +4855,747 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
|
|
|
4855
4855
|
};
|
|
4856
4856
|
}
|
|
4857
4857
|
const factoriesRef = globalThis.__editorContextFactoriesRef;
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
},
|
|
4972
|
-
dragEnd: () => {
|
|
4973
|
-
dragObjectRef.current = undefined;
|
|
4974
|
-
setDragObject(undefined);
|
|
4975
|
-
},
|
|
4976
|
-
droppedInPlaceholder: async (placeholderKey, index, spotPositionElement, spotPositionAnchor, insertOption, spotPosition, color) => {
|
|
4977
|
-
const droppedDragObject = dragObjectRef.current;
|
|
4978
|
-
if ((!droppedDragObject && !insertOption) || !page) {
|
|
4979
|
-
return { committed: false };
|
|
4980
|
-
}
|
|
4981
|
-
dragObjectRef.current = undefined;
|
|
4982
|
-
setDragObject(undefined);
|
|
4983
|
-
const placeholderKeyComponents = placeholderKey.split("_");
|
|
4984
|
-
const parentId = placeholderKeyComponents.length === 1
|
|
4985
|
-
? undefined
|
|
4986
|
-
: placeholderKeyComponents[1];
|
|
4987
|
-
// Selection is left alone at drop. The server response's focus id
|
|
4988
|
-
// selects the moved/added component (executeEditOperation); selecting
|
|
4989
|
-
// the drop target's parent here made the single-selection frame
|
|
4990
|
-
// FLIP-animate component -> parent -> component around every drop.
|
|
4991
|
-
let op;
|
|
4992
|
-
// A placeholder is rendered from this page model, so its insertion
|
|
4993
|
-
// must target the same item. The shell-level descriptor can briefly
|
|
4994
|
-
// lag while slots or a newly created page settle; using it here could
|
|
4995
|
-
// either discard a valid click or write the component to another page.
|
|
4996
|
-
const dropTargetDescriptor = page.item.descriptor;
|
|
4997
|
-
let insertionSequence;
|
|
4998
|
-
if ((spotPosition || spotPositionElement) && spotPositionAnchor) {
|
|
4999
|
-
insertionSequence = ++insertingSequenceRef.current;
|
|
5000
|
-
setInserting({
|
|
5001
|
-
position: spotPosition,
|
|
5002
|
-
positionElement: spotPositionElement,
|
|
5003
|
-
positionAnchor: spotPositionAnchor,
|
|
5004
|
-
color,
|
|
5005
|
-
});
|
|
5006
|
-
}
|
|
5007
|
-
let operationPromise;
|
|
5008
|
-
if (insertOption) {
|
|
5009
|
-
// Clear any selected component type for insertion once the component
|
|
5010
|
-
// has been dropped into a placeholder. This ensures that insert mode
|
|
5011
|
-
// can exit cleanly and the editor header updates from "Add Component"
|
|
5012
|
-
// to the actual component name after the operation completes.
|
|
5013
|
-
setSelectedForInsertion("");
|
|
5014
|
-
operationPromise = operations.addComponent(insertOption.typeId, placeholderKey, index, dropTargetDescriptor, { showIndicator: false });
|
|
5015
|
-
}
|
|
5016
|
-
else if (droppedDragObject?.type == "template") {
|
|
5017
|
-
operationPromise = operations.addComponent(droppedDragObject.typeId, placeholderKey, index, dropTargetDescriptor, { showIndicator: false });
|
|
5018
|
-
}
|
|
5019
|
-
else if (droppedDragObject?.type == "component" ||
|
|
5020
|
-
(droppedDragObject?.type == "items" && droppedDragObject.items)) {
|
|
5021
|
-
const parentComponent = parentId && page ? getComponentById(parentId, page) : null;
|
|
5022
|
-
if (droppedDragObject.type == "items" && droppedDragObject.items) {
|
|
5023
|
-
op = {
|
|
5024
|
-
type: "link-component",
|
|
5025
|
-
mainItem: page.item.descriptor,
|
|
5026
|
-
parent: parentId && {
|
|
5027
|
-
id: parentId,
|
|
5028
|
-
language: page.item.descriptor.language,
|
|
5029
|
-
version: page.item.descriptor.version,
|
|
5030
|
-
name: parentComponent?.name,
|
|
5031
|
-
},
|
|
5032
|
-
placeholderKey,
|
|
5033
|
-
placeholderIndex: index,
|
|
5034
|
-
date: new Date().toISOString(),
|
|
5035
|
-
id: uuid(),
|
|
5036
|
-
linkedComponentItem: droppedDragObject.items[0],
|
|
5037
|
-
title: "Link component",
|
|
5038
|
-
};
|
|
4858
|
+
/**
|
|
4859
|
+
* Workspaces shown in the rail: not hidden, allowed by the server's workspace list (when provided) and,
|
|
4860
|
+
* for workspaces with a dynamic `visible` callback, visible for the given (complete) context.
|
|
4861
|
+
*/
|
|
4862
|
+
const filterVisibleWorkspaces = (context) => (context.configuration.editor.workspaces ?? [])
|
|
4863
|
+
.filter((w) => {
|
|
4864
|
+
if (w.hidden)
|
|
4865
|
+
return false;
|
|
4866
|
+
if (w.visible && !w.visible(context))
|
|
4867
|
+
return false;
|
|
4868
|
+
// Filter by workspace settings from Sitecore (if provided)
|
|
4869
|
+
const serverWorkspaces = context.userInfo?.workspaces;
|
|
4870
|
+
if (serverWorkspaces && serverWorkspaces.length > 0) {
|
|
4871
|
+
return serverWorkspaces.some((ws) => ws.id === w.id);
|
|
4872
|
+
}
|
|
4873
|
+
return true;
|
|
4874
|
+
})
|
|
4875
|
+
.sort((a, b) => (a.sortOrder ?? 100) - (b.sortOrder ?? 100));
|
|
4876
|
+
const editContext = useMemo(() => {
|
|
4877
|
+
// Typed as the context (for contextual parameter types) plus the runtime-only extras the literal carries.
|
|
4878
|
+
const editContextValue = {
|
|
4879
|
+
operations: operationsContext.ops,
|
|
4880
|
+
itemsRepository,
|
|
4881
|
+
configuration,
|
|
4882
|
+
updateUrl,
|
|
4883
|
+
openSplashScreen: () => {
|
|
4884
|
+
const currentParams = new URLSearchParams(window.location.search);
|
|
4885
|
+
const isAlreadyOnHome = workspaceId === "home" &&
|
|
4886
|
+
(!currentParams.get("workspace") ||
|
|
4887
|
+
currentParams.get("workspace") === "home");
|
|
4888
|
+
if (isAlreadyOnHome) {
|
|
4889
|
+
// Already on home workspace, no need to navigate - this prevents reloading the tour
|
|
4890
|
+
return;
|
|
4891
|
+
}
|
|
4892
|
+
// Ensure we actually land on the home workspace (not just change the URL).
|
|
4893
|
+
// This is especially important when called from the tour, where the current workspace
|
|
4894
|
+
// might be the editor and URL-only navigation would get "corrected" back.
|
|
4895
|
+
try {
|
|
4896
|
+
switchWorkspace("home", {
|
|
4897
|
+
skipConfirmation: true,
|
|
4898
|
+
skipNavigationHistory: true,
|
|
4899
|
+
});
|
|
4900
|
+
}
|
|
4901
|
+
catch { }
|
|
4902
|
+
const preservedParams = new URLSearchParams();
|
|
4903
|
+
if (currentParams.get("fullscreen") === "true") {
|
|
4904
|
+
preservedParams.set("fullscreen", "true");
|
|
4905
|
+
}
|
|
4906
|
+
// Preserve tour state so the tour survives navigation
|
|
4907
|
+
const currentTour = currentParams.get("tour");
|
|
4908
|
+
if (currentTour) {
|
|
4909
|
+
preservedParams.set("tour", currentTour);
|
|
4910
|
+
}
|
|
4911
|
+
const queryString = preservedParams.toString();
|
|
4912
|
+
// Use the current Next.js pathname so this works correctly with or without
|
|
4913
|
+
// a configured basePath (e.g. basePath="/parhelia" in the static export).
|
|
4914
|
+
// Avoid hard-coding "/parhelia" here because Next will automatically
|
|
4915
|
+
// prepend the basePath when navigating.
|
|
4916
|
+
const basePath = pathname || "/";
|
|
4917
|
+
const newUrl = queryString ? `${basePath}?${queryString}` : basePath;
|
|
4918
|
+
router.push(newUrl, { scroll: false });
|
|
4919
|
+
},
|
|
4920
|
+
item: item || page?.item,
|
|
4921
|
+
itemLanguages,
|
|
4922
|
+
itemVersions,
|
|
4923
|
+
isLoadingVersions,
|
|
4924
|
+
loadItemVersions,
|
|
4925
|
+
sessionId: sessionId,
|
|
4926
|
+
readonly: isReadOnly,
|
|
4927
|
+
getSelection: () => selectionRef.current,
|
|
4928
|
+
select: (ids) => {
|
|
4929
|
+
// Re-selecting the same components is a no-op: without this bail a
|
|
4930
|
+
// fresh array identity re-renders every selection consumer.
|
|
4931
|
+
const current = selectionRef.current;
|
|
4932
|
+
if (ids.length === current.length &&
|
|
4933
|
+
ids.every((id, index) => id === current[index])) {
|
|
4934
|
+
perfTraceStep("shell:setSelection-bailed (unchanged)", { ids });
|
|
4935
|
+
return;
|
|
4936
|
+
}
|
|
4937
|
+
perfTraceStep("shell:setSelection-state-update", { ids });
|
|
4938
|
+
setSelection(ids);
|
|
4939
|
+
},
|
|
4940
|
+
selectWithoutAutoScroll,
|
|
4941
|
+
consumeNextSelectionAutoScrollSuppression,
|
|
4942
|
+
consumeNextFocusedFieldAutoScrollSuppression,
|
|
4943
|
+
contentTreeSelection,
|
|
4944
|
+
setContentTreeSelection,
|
|
4945
|
+
selectedForInsertion,
|
|
4946
|
+
setSelectedForInsertion,
|
|
4947
|
+
dragObject,
|
|
4948
|
+
getDragObject: () => dragObjectRef.current,
|
|
4949
|
+
clipboard,
|
|
4950
|
+
setClipboard,
|
|
4951
|
+
workboxItems,
|
|
4952
|
+
isWorkboxLoading,
|
|
4953
|
+
refreshWorkbox,
|
|
4954
|
+
requestRefresh,
|
|
4955
|
+
refreshCompletedFlag,
|
|
4956
|
+
openCreatePageDialog: () => {
|
|
4957
|
+
const current = new URLSearchParams(searchParams.toString());
|
|
4958
|
+
current.delete("version");
|
|
4959
|
+
current.delete("itemid");
|
|
4960
|
+
current.delete("workspace"); // Clear workspace
|
|
4961
|
+
current.set("create", "1");
|
|
4962
|
+
const newUrl = `${pathname}?${current.toString()}`;
|
|
4963
|
+
const oldUrl = `${pathname}?${searchParams.toString()}`;
|
|
4964
|
+
router.push(newUrl, { scroll: false });
|
|
4965
|
+
},
|
|
4966
|
+
selectMedia: media.selectMedia,
|
|
4967
|
+
showToast: (message) => {
|
|
4968
|
+
// Ensure only strings are passed to toast to prevent accidental JSON display
|
|
4969
|
+
if (typeof message === "string") {
|
|
4970
|
+
toast(message);
|
|
5039
4971
|
}
|
|
5040
4972
|
else {
|
|
5041
|
-
|
|
5042
|
-
|
|
4973
|
+
console.warn("showToast called with non-string value:", message);
|
|
4974
|
+
toast("An operation occurred");
|
|
4975
|
+
}
|
|
4976
|
+
},
|
|
4977
|
+
scrollIntoView,
|
|
4978
|
+
setScrollIntoView,
|
|
4979
|
+
focusedField,
|
|
4980
|
+
setFocusedField: setFocusedFieldWithLock,
|
|
4981
|
+
getComponentCommands: async (components, providerContext) => {
|
|
4982
|
+
return await getComponentCommands(components, editContext, providerContext);
|
|
4983
|
+
},
|
|
4984
|
+
dragStart: (nextDragObject) => {
|
|
4985
|
+
// A drag supersedes any unresolved scroll request (e.g. a comment
|
|
4986
|
+
// target still waiting for geometry). Left pending, it would replay
|
|
4987
|
+
// against the post-drop refresh and yank the canvas to a stale spot.
|
|
4988
|
+
setScrollIntoView(undefined);
|
|
4989
|
+
dragObjectRef.current = nextDragObject;
|
|
4990
|
+
setDragObject(nextDragObject);
|
|
4991
|
+
},
|
|
4992
|
+
dragEnd: () => {
|
|
4993
|
+
dragObjectRef.current = undefined;
|
|
4994
|
+
setDragObject(undefined);
|
|
4995
|
+
},
|
|
4996
|
+
droppedInPlaceholder: async (placeholderKey, index, spotPositionElement, spotPositionAnchor, insertOption, spotPosition, color) => {
|
|
4997
|
+
const droppedDragObject = dragObjectRef.current;
|
|
4998
|
+
if ((!droppedDragObject && !insertOption) || !page) {
|
|
4999
|
+
return { committed: false };
|
|
5000
|
+
}
|
|
5001
|
+
dragObjectRef.current = undefined;
|
|
5002
|
+
setDragObject(undefined);
|
|
5003
|
+
const placeholderKeyComponents = placeholderKey.split("_");
|
|
5004
|
+
const parentId = placeholderKeyComponents.length === 1
|
|
5005
|
+
? undefined
|
|
5006
|
+
: placeholderKeyComponents[1];
|
|
5007
|
+
// Selection is left alone at drop. The server response's focus id
|
|
5008
|
+
// selects the moved/added component (executeEditOperation); selecting
|
|
5009
|
+
// the drop target's parent here made the single-selection frame
|
|
5010
|
+
// FLIP-animate component -> parent -> component around every drop.
|
|
5011
|
+
let op;
|
|
5012
|
+
// A placeholder is rendered from this page model, so its insertion
|
|
5013
|
+
// must target the same item. The shell-level descriptor can briefly
|
|
5014
|
+
// lag while slots or a newly created page settle; using it here could
|
|
5015
|
+
// either discard a valid click or write the component to another page.
|
|
5016
|
+
const dropTargetDescriptor = page.item.descriptor;
|
|
5017
|
+
let insertionSequence;
|
|
5018
|
+
if ((spotPosition || spotPositionElement) && spotPositionAnchor) {
|
|
5019
|
+
insertionSequence = ++insertingSequenceRef.current;
|
|
5020
|
+
setInserting({
|
|
5021
|
+
position: spotPosition,
|
|
5022
|
+
positionElement: spotPositionElement,
|
|
5023
|
+
positionAnchor: spotPositionAnchor,
|
|
5024
|
+
color,
|
|
5025
|
+
});
|
|
5026
|
+
}
|
|
5027
|
+
let operationPromise;
|
|
5028
|
+
if (insertOption) {
|
|
5029
|
+
// Clear any selected component type for insertion once the component
|
|
5030
|
+
// has been dropped into a placeholder. This ensures that insert mode
|
|
5031
|
+
// can exit cleanly and the editor header updates from "Add Component"
|
|
5032
|
+
// to the actual component name after the operation completes.
|
|
5033
|
+
setSelectedForInsertion("");
|
|
5034
|
+
operationPromise = operations.addComponent(insertOption.typeId, placeholderKey, index, dropTargetDescriptor, { showIndicator: false });
|
|
5035
|
+
}
|
|
5036
|
+
else if (droppedDragObject?.type == "template") {
|
|
5037
|
+
operationPromise = operations.addComponent(droppedDragObject.typeId, placeholderKey, index, dropTargetDescriptor, { showIndicator: false });
|
|
5038
|
+
}
|
|
5039
|
+
else if (droppedDragObject?.type == "component" ||
|
|
5040
|
+
(droppedDragObject?.type == "items" && droppedDragObject.items)) {
|
|
5041
|
+
const parentComponent = parentId && page ? getComponentById(parentId, page) : null;
|
|
5042
|
+
if (droppedDragObject.type == "items" && droppedDragObject.items) {
|
|
5043
5043
|
op = {
|
|
5044
|
-
type: "
|
|
5044
|
+
type: "link-component",
|
|
5045
5045
|
mainItem: page.item.descriptor,
|
|
5046
5046
|
parent: parentId && {
|
|
5047
5047
|
id: parentId,
|
|
5048
5048
|
language: page.item.descriptor.language,
|
|
5049
5049
|
version: page.item.descriptor.version,
|
|
5050
|
+
name: parentComponent?.name,
|
|
5050
5051
|
},
|
|
5051
5052
|
placeholderKey,
|
|
5052
5053
|
placeholderIndex: index,
|
|
5053
|
-
componentIds,
|
|
5054
5054
|
date: new Date().toISOString(),
|
|
5055
5055
|
id: uuid(),
|
|
5056
|
-
|
|
5056
|
+
linkedComponentItem: droppedDragObject.items[0],
|
|
5057
|
+
title: "Link component",
|
|
5057
5058
|
};
|
|
5058
5059
|
}
|
|
5060
|
+
else {
|
|
5061
|
+
const componentIds = droppedDragObject.components?.map((c) => c.id) ?? [];
|
|
5062
|
+
if (componentIds.length > 0) {
|
|
5063
|
+
op = {
|
|
5064
|
+
type: "move-component",
|
|
5065
|
+
mainItem: page.item.descriptor,
|
|
5066
|
+
parent: parentId && {
|
|
5067
|
+
id: parentId,
|
|
5068
|
+
language: page.item.descriptor.language,
|
|
5069
|
+
version: page.item.descriptor.version,
|
|
5070
|
+
},
|
|
5071
|
+
placeholderKey,
|
|
5072
|
+
placeholderIndex: index,
|
|
5073
|
+
componentIds,
|
|
5074
|
+
date: new Date().toISOString(),
|
|
5075
|
+
id: uuid(),
|
|
5076
|
+
title: "Move component",
|
|
5077
|
+
};
|
|
5078
|
+
}
|
|
5079
|
+
}
|
|
5059
5080
|
}
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
insertingSequenceRef.current === insertionSequence) {
|
|
5066
|
-
setInserting(undefined);
|
|
5067
|
-
}
|
|
5068
|
-
return { committed: false };
|
|
5069
|
-
}
|
|
5070
|
-
let operationFailed = false;
|
|
5071
|
-
try {
|
|
5072
|
-
// executeOp resolves (instead of throwing) with a failed status when
|
|
5073
|
-
// the server rejects the operation — no refresh follows then.
|
|
5074
|
-
const result = (await operationPromise);
|
|
5075
|
-
operationFailed = result?.executionStatus === "failed";
|
|
5076
|
-
}
|
|
5077
|
-
catch (err) {
|
|
5078
|
-
operationFailed = true;
|
|
5079
|
-
console.error("Failed to drop component in placeholder", err);
|
|
5080
|
-
}
|
|
5081
|
-
finally {
|
|
5082
|
-
if (insertionSequence !== undefined &&
|
|
5083
|
-
insertingSequenceRef.current === insertionSequence) {
|
|
5084
|
-
if (operationFailed) {
|
|
5081
|
+
if (op)
|
|
5082
|
+
operationPromise = operations.executeEditOperation(op);
|
|
5083
|
+
if (!operationPromise) {
|
|
5084
|
+
if (insertionSequence !== undefined &&
|
|
5085
|
+
insertingSequenceRef.current === insertionSequence) {
|
|
5085
5086
|
setInserting(undefined);
|
|
5086
5087
|
}
|
|
5087
|
-
|
|
5088
|
-
// The server accepted the drop; the canvas has not repainted
|
|
5089
|
-
// yet. Hold the indicator until the refresh lands so it stops
|
|
5090
|
-
// when the component actually appears, not seconds earlier.
|
|
5091
|
-
holdInsertingUntilCanvasRefresh(insertionSequence);
|
|
5092
|
-
}
|
|
5088
|
+
return { committed: false };
|
|
5093
5089
|
}
|
|
5094
|
-
|
|
5095
|
-
return { committed: !operationFailed };
|
|
5096
|
-
},
|
|
5097
|
-
page,
|
|
5098
|
-
triggerFieldAction: async (fieldDescriptor, actionButton, parameters, event) => {
|
|
5099
|
-
const field = await itemsRepository.getField(fieldDescriptor);
|
|
5100
|
-
if (!field)
|
|
5101
|
-
return;
|
|
5102
|
-
const op = {
|
|
5103
|
-
field: fieldDescriptor,
|
|
5104
|
-
// actionButton,
|
|
5105
|
-
label: actionButton.label,
|
|
5106
|
-
state: "running",
|
|
5107
|
-
};
|
|
5108
|
-
const fieldItem = fieldDescriptor.item;
|
|
5109
|
-
if ("clientAction" in actionButton) {
|
|
5110
|
-
await actionButton.clientAction({
|
|
5111
|
-
field,
|
|
5112
|
-
editContext,
|
|
5113
|
-
event,
|
|
5114
|
-
//dialogContext,
|
|
5115
|
-
});
|
|
5116
|
-
}
|
|
5117
|
-
if (actionButton.action) {
|
|
5118
|
-
setActiveFieldActions((prevFieldActions) => {
|
|
5119
|
-
const isSameField = (x) => x.field.fieldId == fieldDescriptor.fieldId &&
|
|
5120
|
-
x.field.item.id == fieldItem.id &&
|
|
5121
|
-
x.field.item.language == fieldItem.language &&
|
|
5122
|
-
x.field.item.version == fieldItem.version;
|
|
5123
|
-
const existing = prevFieldActions.find(isSameField);
|
|
5124
|
-
// Preserve any existing state/message (e.g., an early websocket error)
|
|
5125
|
-
// to avoid overwriting it with a stale "running" state
|
|
5126
|
-
const mergedOp = existing
|
|
5127
|
-
? {
|
|
5128
|
-
...op,
|
|
5129
|
-
state: existing.state,
|
|
5130
|
-
message: existing.message,
|
|
5131
|
-
label: existing.label ?? op.label,
|
|
5132
|
-
}
|
|
5133
|
-
: op;
|
|
5134
|
-
return [
|
|
5135
|
-
...prevFieldActions.filter((x) => !isSameField(x)),
|
|
5136
|
-
mergedOp,
|
|
5137
|
-
];
|
|
5138
|
-
});
|
|
5090
|
+
let operationFailed = false;
|
|
5139
5091
|
try {
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5092
|
+
// executeOp resolves (instead of throwing) with a failed status when
|
|
5093
|
+
// the server rejects the operation — no refresh follows then.
|
|
5094
|
+
const result = (await operationPromise);
|
|
5095
|
+
operationFailed = result?.executionStatus === "failed";
|
|
5096
|
+
}
|
|
5097
|
+
catch (err) {
|
|
5098
|
+
operationFailed = true;
|
|
5099
|
+
console.error("Failed to drop component in placeholder", err);
|
|
5100
|
+
}
|
|
5101
|
+
finally {
|
|
5102
|
+
if (insertionSequence !== undefined &&
|
|
5103
|
+
insertingSequenceRef.current === insertionSequence) {
|
|
5104
|
+
if (operationFailed) {
|
|
5105
|
+
setInserting(undefined);
|
|
5147
5106
|
}
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
...prevFieldActions,
|
|
5154
|
-
]);
|
|
5107
|
+
else {
|
|
5108
|
+
// The server accepted the drop; the canvas has not repainted
|
|
5109
|
+
// yet. Hold the indicator until the refresh lands so it stops
|
|
5110
|
+
// when the component actually appears, not seconds earlier.
|
|
5111
|
+
holdInsertingUntilCanvasRefresh(insertionSequence);
|
|
5155
5112
|
}
|
|
5113
|
+
}
|
|
5114
|
+
}
|
|
5115
|
+
return { committed: !operationFailed };
|
|
5116
|
+
},
|
|
5117
|
+
page,
|
|
5118
|
+
triggerFieldAction: async (fieldDescriptor, actionButton, parameters, event) => {
|
|
5119
|
+
const field = await itemsRepository.getField(fieldDescriptor);
|
|
5120
|
+
if (!field)
|
|
5121
|
+
return;
|
|
5122
|
+
const op = {
|
|
5123
|
+
field: fieldDescriptor,
|
|
5124
|
+
// actionButton,
|
|
5125
|
+
label: actionButton.label,
|
|
5126
|
+
state: "running",
|
|
5127
|
+
};
|
|
5128
|
+
const fieldItem = fieldDescriptor.item;
|
|
5129
|
+
if ("clientAction" in actionButton) {
|
|
5130
|
+
await actionButton.clientAction({
|
|
5131
|
+
field,
|
|
5132
|
+
editContext,
|
|
5133
|
+
event,
|
|
5134
|
+
//dialogContext,
|
|
5156
5135
|
});
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5136
|
+
}
|
|
5137
|
+
if (actionButton.action) {
|
|
5138
|
+
setActiveFieldActions((prevFieldActions) => {
|
|
5139
|
+
const isSameField = (x) => x.field.fieldId == fieldDescriptor.fieldId &&
|
|
5140
|
+
x.field.item.id == fieldItem.id &&
|
|
5141
|
+
x.field.item.language == fieldItem.language &&
|
|
5142
|
+
x.field.item.version == fieldItem.version;
|
|
5143
|
+
const existing = prevFieldActions.find(isSameField);
|
|
5144
|
+
// Preserve any existing state/message (e.g., an early websocket error)
|
|
5145
|
+
// to avoid overwriting it with a stale "running" state
|
|
5146
|
+
const mergedOp = existing
|
|
5147
|
+
? {
|
|
5148
|
+
...op,
|
|
5149
|
+
state: existing.state,
|
|
5150
|
+
message: existing.message,
|
|
5151
|
+
label: existing.label ?? op.label,
|
|
5152
|
+
}
|
|
5153
|
+
: op;
|
|
5154
|
+
return [
|
|
5155
|
+
...prevFieldActions.filter((x) => !isSameField(x)),
|
|
5156
|
+
mergedOp,
|
|
5157
|
+
];
|
|
5158
|
+
});
|
|
5159
|
+
try {
|
|
5160
|
+
await executeFieldServerAction(fieldDescriptor.item, fieldDescriptor.fieldId, item.descriptor, actionButton.action, editContext.sessionId, selectedRange?.text || "", parameters || {}, (data) => {
|
|
5161
|
+
// Update progress message if available
|
|
5162
|
+
if (data?.responseText) {
|
|
5163
|
+
op.message = data.responseText;
|
|
5164
|
+
setActiveFieldActions((prevFieldActions) => [
|
|
5165
|
+
...prevFieldActions,
|
|
5166
|
+
]);
|
|
5167
|
+
}
|
|
5168
|
+
// Handle error state from the server response
|
|
5169
|
+
if (data?.state === "Error" || data?.state === "failed") {
|
|
5170
|
+
op.state = "error";
|
|
5171
|
+
op.message = data.errorMessage || "Field action failed";
|
|
5172
|
+
setActiveFieldActions((prevFieldActions) => [
|
|
5173
|
+
...prevFieldActions,
|
|
5174
|
+
]);
|
|
5175
|
+
}
|
|
5176
|
+
});
|
|
5177
|
+
itemsRepository.refreshItems([fieldDescriptor.item]);
|
|
5178
|
+
// Only mark as success if no websocket error has been reported
|
|
5179
|
+
if (op.state === "running") {
|
|
5180
|
+
op.state = "success";
|
|
5181
|
+
// Auto-dismiss successful actions after a brief delay
|
|
5182
|
+
setTimeout(() => {
|
|
5183
|
+
setActiveFieldActions((prevFieldActions) => prevFieldActions.filter((x) => !(x.field.fieldId === fieldDescriptor.fieldId &&
|
|
5184
|
+
x.field.item.id === fieldDescriptor.item.id &&
|
|
5185
|
+
x.field.item.language ===
|
|
5186
|
+
fieldDescriptor.item.language &&
|
|
5187
|
+
x.field.item.version === fieldDescriptor.item.version &&
|
|
5188
|
+
x.state === "success")));
|
|
5189
|
+
}, 500);
|
|
5190
|
+
}
|
|
5191
|
+
else if (op.state === "error") {
|
|
5192
|
+
// Auto-dismiss error after a longer delay (matching the catch block)
|
|
5193
|
+
setTimeout(() => {
|
|
5194
|
+
setActiveFieldActions((prevFieldActions) => prevFieldActions.filter((x) => !(x.field.fieldId === fieldDescriptor.fieldId &&
|
|
5195
|
+
x.field.item.id === fieldDescriptor.item.id &&
|
|
5196
|
+
x.field.item.language ===
|
|
5197
|
+
fieldDescriptor.item.language &&
|
|
5198
|
+
x.field.item.version === fieldDescriptor.item.version)));
|
|
5199
|
+
}, 3000);
|
|
5200
|
+
}
|
|
5201
|
+
requestRefresh("immediate");
|
|
5170
5202
|
}
|
|
5171
|
-
|
|
5172
|
-
|
|
5203
|
+
catch (error) {
|
|
5204
|
+
console.error("Field action failed", error);
|
|
5205
|
+
// Mark as failed and show error message
|
|
5206
|
+
op.state = "error";
|
|
5207
|
+
op.message =
|
|
5208
|
+
error instanceof Error ? error.message : "Field action failed";
|
|
5209
|
+
// Update the field action state to show error
|
|
5210
|
+
setActiveFieldActions((prevFieldActions) => {
|
|
5211
|
+
const isSameField = (x) => x.field.fieldId == fieldDescriptor.fieldId &&
|
|
5212
|
+
x.field.item.id == fieldItem.id &&
|
|
5213
|
+
x.field.item.language == fieldItem.language &&
|
|
5214
|
+
x.field.item.version == fieldItem.version;
|
|
5215
|
+
return [...prevFieldActions.filter((x) => !isSameField(x)), op];
|
|
5216
|
+
});
|
|
5217
|
+
// Auto-dismiss error after a longer delay
|
|
5173
5218
|
setTimeout(() => {
|
|
5174
5219
|
setActiveFieldActions((prevFieldActions) => prevFieldActions.filter((x) => !(x.field.fieldId === fieldDescriptor.fieldId &&
|
|
5175
5220
|
x.field.item.id === fieldDescriptor.item.id &&
|
|
5176
|
-
x.field.item.language ===
|
|
5177
|
-
fieldDescriptor.item.language &&
|
|
5221
|
+
x.field.item.language === fieldDescriptor.item.language &&
|
|
5178
5222
|
x.field.item.version === fieldDescriptor.item.version)));
|
|
5179
5223
|
}, 3000);
|
|
5180
5224
|
}
|
|
5181
|
-
requestRefresh("immediate");
|
|
5182
5225
|
}
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5226
|
+
},
|
|
5227
|
+
dismissFieldAction: (fieldDescriptor) => {
|
|
5228
|
+
setActiveFieldActions((prevFieldActions) => prevFieldActions.filter((x) => !(x.field.fieldId === fieldDescriptor.fieldId &&
|
|
5229
|
+
x.field.item.id === fieldDescriptor.item.id &&
|
|
5230
|
+
x.field.item.language === fieldDescriptor.item.language &&
|
|
5231
|
+
x.field.item.version === fieldDescriptor.item.version)));
|
|
5232
|
+
},
|
|
5233
|
+
addFieldAction: (action) => {
|
|
5234
|
+
setActiveFieldActions((prev) => {
|
|
5235
|
+
const isSameField = (x) => x.field.fieldId === action.field.fieldId &&
|
|
5236
|
+
x.field.item.id === action.field.item.id &&
|
|
5237
|
+
x.field.item.language === action.field.item.language &&
|
|
5238
|
+
x.field.item.version === action.field.item.version;
|
|
5239
|
+
return [...prev.filter((x) => !isSameField(x)), action];
|
|
5240
|
+
});
|
|
5241
|
+
},
|
|
5242
|
+
updateFieldAction: (fieldDescriptor, updates) => {
|
|
5243
|
+
setActiveFieldActions((prev) => prev.map((x) => x.field.fieldId === fieldDescriptor.fieldId &&
|
|
5244
|
+
x.field.item.id === fieldDescriptor.item.id &&
|
|
5245
|
+
x.field.item.language === fieldDescriptor.item.language &&
|
|
5246
|
+
x.field.item.version === fieldDescriptor.item.version
|
|
5247
|
+
? { ...x, ...updates }
|
|
5248
|
+
: x));
|
|
5249
|
+
},
|
|
5250
|
+
activeFieldActions,
|
|
5251
|
+
showContextMenu: (event, items, options) => {
|
|
5252
|
+
contextMenuRef.current?.show(event, items);
|
|
5253
|
+
setContextMenuSource(options?.source);
|
|
5254
|
+
setCurrentOverlay("context-menu");
|
|
5255
|
+
},
|
|
5256
|
+
updateContextMenu: (items) => {
|
|
5257
|
+
contextMenuRef.current?.update(items);
|
|
5258
|
+
},
|
|
5259
|
+
showFieldEditorPopup: (fields, sections, ev) => {
|
|
5260
|
+
setCurrentOverlay("fields");
|
|
5261
|
+
fieldEditorPopupRef.current?.show(fields, sections, ev);
|
|
5262
|
+
},
|
|
5263
|
+
inserting,
|
|
5264
|
+
removingComponentIds,
|
|
5265
|
+
validating,
|
|
5266
|
+
validationResult,
|
|
5267
|
+
loadItem,
|
|
5268
|
+
editHistory: editHistory,
|
|
5269
|
+
historyMode,
|
|
5270
|
+
setHistoryMode,
|
|
5271
|
+
showOnlyMyChanges,
|
|
5272
|
+
setShowOnlyMyChanges,
|
|
5273
|
+
filterByCurrentLanguage,
|
|
5274
|
+
setFilterByCurrentLanguage,
|
|
5275
|
+
historySearchQuery,
|
|
5276
|
+
setHistorySearchQuery,
|
|
5277
|
+
refreshHistory,
|
|
5278
|
+
isRefreshing,
|
|
5279
|
+
isHistoryLoading,
|
|
5280
|
+
canLoadMoreHistory,
|
|
5281
|
+
isHistoryLoadingMore,
|
|
5282
|
+
loadMoreHistory,
|
|
5283
|
+
activeSessions,
|
|
5284
|
+
remoteCarets,
|
|
5285
|
+
unlockField: async () => {
|
|
5286
|
+
setLockedField(undefined); // Clear client-side lock state
|
|
5287
|
+
await releaseFieldLocks(sessionId);
|
|
5288
|
+
},
|
|
5289
|
+
isCommandDisabled: ({ command, data, }) => {
|
|
5290
|
+
const props = {
|
|
5291
|
+
editContext,
|
|
5292
|
+
pathname,
|
|
5293
|
+
router,
|
|
5294
|
+
searchParams,
|
|
5295
|
+
data,
|
|
5296
|
+
openDialog,
|
|
5297
|
+
};
|
|
5298
|
+
return command.disabled(props);
|
|
5299
|
+
},
|
|
5300
|
+
executeCommand,
|
|
5301
|
+
// Workspace state
|
|
5302
|
+
workspace: currentWorkspace,
|
|
5303
|
+
// Filled in below: a workspace's dynamic `visible` callback receives the finished context object.
|
|
5304
|
+
// Evaluating it inside this literal would read `editContext` before its initialization.
|
|
5305
|
+
visibleWorkspaces: [],
|
|
5306
|
+
workspaceId,
|
|
5307
|
+
previousWorkspaceId,
|
|
5308
|
+
switchWorkspace,
|
|
5309
|
+
// Sidebar state
|
|
5310
|
+
availableSidebars: getSidebarsForWorkspace(workspaceId),
|
|
5311
|
+
openSidebars,
|
|
5312
|
+
pinnedSidebars,
|
|
5313
|
+
lockedSidebars,
|
|
5314
|
+
sidebarStacks,
|
|
5315
|
+
toggleSidebar,
|
|
5316
|
+
openSidebar,
|
|
5317
|
+
toggleSidebarPin,
|
|
5318
|
+
toggleSidebarLock,
|
|
5319
|
+
stackSidebar,
|
|
5320
|
+
moveSidebarToColumn,
|
|
5321
|
+
unstackSidebar,
|
|
5322
|
+
reorderSidebarInStack,
|
|
5323
|
+
reorderPinnedSidebars,
|
|
5324
|
+
reorderOpenSidebars,
|
|
5325
|
+
getResolvedSidebar,
|
|
5326
|
+
compareMode,
|
|
5327
|
+
setCompareMode,
|
|
5328
|
+
fullscreen,
|
|
5329
|
+
setFullscreen,
|
|
5330
|
+
componentDesignerComponent,
|
|
5331
|
+
setComponentDesignerComponent,
|
|
5332
|
+
componentDesignerRendering,
|
|
5333
|
+
setComponentDesignerRendering,
|
|
5334
|
+
insertMode,
|
|
5335
|
+
setInsertMode,
|
|
5336
|
+
currentOverlay,
|
|
5337
|
+
contextMenuSource,
|
|
5338
|
+
setCurrentOverlay,
|
|
5339
|
+
lockedField,
|
|
5340
|
+
timings,
|
|
5341
|
+
setTimings,
|
|
5342
|
+
selectedRange,
|
|
5343
|
+
setSelectedRange,
|
|
5344
|
+
replaceSelectedText,
|
|
5345
|
+
insertTextAtCursor,
|
|
5346
|
+
confirm: (props) => {
|
|
5347
|
+
confirmationDialogRef.current?.confirm(props);
|
|
5348
|
+
},
|
|
5349
|
+
showMessageDialog: (props) => {
|
|
5350
|
+
confirmationDialogRef.current?.confirm({
|
|
5351
|
+
header: props.header,
|
|
5352
|
+
message: props.message,
|
|
5353
|
+
accept: () => { },
|
|
5354
|
+
acceptLabel: "Ok",
|
|
5355
|
+
});
|
|
5356
|
+
},
|
|
5357
|
+
showInfoToast,
|
|
5358
|
+
showErrorToast,
|
|
5359
|
+
browseHistory,
|
|
5360
|
+
setCenterPanelView,
|
|
5361
|
+
handleKeyDown,
|
|
5362
|
+
startTour,
|
|
5363
|
+
addSocketMessageListener,
|
|
5364
|
+
sendSocketMessage,
|
|
5365
|
+
socketConnectionVersion,
|
|
5366
|
+
socketDiagnostics,
|
|
5367
|
+
currentItemDescriptor,
|
|
5368
|
+
editorSlots,
|
|
5369
|
+
activeSlotId,
|
|
5370
|
+
slotContexts,
|
|
5371
|
+
registerSlotContext,
|
|
5372
|
+
unregisterSlotContext,
|
|
5373
|
+
getActiveSlotContext,
|
|
5374
|
+
getActiveSlotId,
|
|
5375
|
+
getFieldModificationStoreForSlot,
|
|
5376
|
+
closeEditorSlot,
|
|
5377
|
+
setActiveSlot,
|
|
5378
|
+
revision,
|
|
5379
|
+
fullReloadToken,
|
|
5380
|
+
notifyPageModelReady,
|
|
5381
|
+
pageModelReadyToken,
|
|
5382
|
+
selectedComment,
|
|
5383
|
+
setSelectedComment,
|
|
5384
|
+
selectedSuggestedEdit,
|
|
5385
|
+
setSelectedSuggestedEdit,
|
|
5386
|
+
comments,
|
|
5387
|
+
commentsLoaded,
|
|
5388
|
+
availableCommentTags,
|
|
5389
|
+
loadComments,
|
|
5390
|
+
loadSuggestedEdits,
|
|
5391
|
+
setComments,
|
|
5392
|
+
showComments,
|
|
5393
|
+
setShowComments,
|
|
5394
|
+
showResolvedComments,
|
|
5395
|
+
setShowResolvedComments,
|
|
5396
|
+
addComment: async (options) => {
|
|
5397
|
+
const descriptor = item?.descriptor;
|
|
5398
|
+
if (!descriptor)
|
|
5399
|
+
return;
|
|
5400
|
+
// Only keep a single empty draft comment at a time. Clicking
|
|
5401
|
+
// "add comment" again while an unsaved draft already exists should
|
|
5402
|
+
// focus that draft instead of stacking up more empty inputs.
|
|
5403
|
+
const existingDraft = comments.find((c) => c.isNew);
|
|
5404
|
+
if (existingDraft) {
|
|
5405
|
+
await activateCommentsModeForWriting("comment-add");
|
|
5406
|
+
setSelectedComment(existingDraft);
|
|
5407
|
+
setSelectedSuggestedEdit(undefined);
|
|
5408
|
+
return;
|
|
5204
5409
|
}
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
const
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
updateContextMenu: (items) => {
|
|
5237
|
-
contextMenuRef.current?.update(items);
|
|
5238
|
-
},
|
|
5239
|
-
showFieldEditorPopup: (fields, sections, ev) => {
|
|
5240
|
-
setCurrentOverlay("fields");
|
|
5241
|
-
fieldEditorPopupRef.current?.show(fields, sections, ev);
|
|
5242
|
-
},
|
|
5243
|
-
inserting,
|
|
5244
|
-
removingComponentIds,
|
|
5245
|
-
validating,
|
|
5246
|
-
validationResult,
|
|
5247
|
-
loadItem,
|
|
5248
|
-
editHistory: editHistory,
|
|
5249
|
-
historyMode,
|
|
5250
|
-
setHistoryMode,
|
|
5251
|
-
showOnlyMyChanges,
|
|
5252
|
-
setShowOnlyMyChanges,
|
|
5253
|
-
filterByCurrentLanguage,
|
|
5254
|
-
setFilterByCurrentLanguage,
|
|
5255
|
-
historySearchQuery,
|
|
5256
|
-
setHistorySearchQuery,
|
|
5257
|
-
refreshHistory,
|
|
5258
|
-
isRefreshing,
|
|
5259
|
-
isHistoryLoading,
|
|
5260
|
-
canLoadMoreHistory,
|
|
5261
|
-
isHistoryLoadingMore,
|
|
5262
|
-
loadMoreHistory,
|
|
5263
|
-
activeSessions,
|
|
5264
|
-
remoteCarets,
|
|
5265
|
-
unlockField: async () => {
|
|
5266
|
-
setLockedField(undefined); // Clear client-side lock state
|
|
5267
|
-
await releaseFieldLocks(sessionId);
|
|
5268
|
-
},
|
|
5269
|
-
isCommandDisabled: ({ command, data, }) => {
|
|
5270
|
-
const props = {
|
|
5271
|
-
editContext,
|
|
5272
|
-
pathname,
|
|
5273
|
-
router,
|
|
5274
|
-
searchParams,
|
|
5275
|
-
data,
|
|
5276
|
-
openDialog,
|
|
5277
|
-
};
|
|
5278
|
-
return command.disabled(props);
|
|
5279
|
-
},
|
|
5280
|
-
executeCommand,
|
|
5281
|
-
// Workspace state
|
|
5282
|
-
workspace: currentWorkspace,
|
|
5283
|
-
visibleWorkspaces: (configuration.editor.workspaces ?? [])
|
|
5284
|
-
.filter((w) => {
|
|
5285
|
-
if (w.hidden)
|
|
5286
|
-
return false;
|
|
5287
|
-
if (w.visible && !w.visible(editContext))
|
|
5288
|
-
return false;
|
|
5289
|
-
// Filter by workspace settings from Sitecore (if provided)
|
|
5290
|
-
if (userInfo.workspaces && userInfo.workspaces.length > 0) {
|
|
5291
|
-
return userInfo.workspaces.some((ws) => ws.id === w.id);
|
|
5292
|
-
}
|
|
5293
|
-
return true;
|
|
5294
|
-
})
|
|
5295
|
-
.sort((a, b) => (a.sortOrder ?? 100) - (b.sortOrder ?? 100)),
|
|
5296
|
-
workspaceId,
|
|
5297
|
-
previousWorkspaceId,
|
|
5298
|
-
switchWorkspace,
|
|
5299
|
-
// Sidebar state
|
|
5300
|
-
availableSidebars: getSidebarsForWorkspace(workspaceId),
|
|
5301
|
-
openSidebars,
|
|
5302
|
-
pinnedSidebars,
|
|
5303
|
-
lockedSidebars,
|
|
5304
|
-
sidebarStacks,
|
|
5305
|
-
toggleSidebar,
|
|
5306
|
-
openSidebar,
|
|
5307
|
-
toggleSidebarPin,
|
|
5308
|
-
toggleSidebarLock,
|
|
5309
|
-
stackSidebar,
|
|
5310
|
-
moveSidebarToColumn,
|
|
5311
|
-
unstackSidebar,
|
|
5312
|
-
reorderSidebarInStack,
|
|
5313
|
-
reorderPinnedSidebars,
|
|
5314
|
-
reorderOpenSidebars,
|
|
5315
|
-
getResolvedSidebar,
|
|
5316
|
-
compareMode,
|
|
5317
|
-
setCompareMode,
|
|
5318
|
-
fullscreen,
|
|
5319
|
-
setFullscreen,
|
|
5320
|
-
componentDesignerComponent,
|
|
5321
|
-
setComponentDesignerComponent,
|
|
5322
|
-
componentDesignerRendering,
|
|
5323
|
-
setComponentDesignerRendering,
|
|
5324
|
-
insertMode,
|
|
5325
|
-
setInsertMode,
|
|
5326
|
-
currentOverlay,
|
|
5327
|
-
contextMenuSource,
|
|
5328
|
-
setCurrentOverlay,
|
|
5329
|
-
lockedField,
|
|
5330
|
-
timings,
|
|
5331
|
-
setTimings,
|
|
5332
|
-
selectedRange,
|
|
5333
|
-
setSelectedRange,
|
|
5334
|
-
replaceSelectedText,
|
|
5335
|
-
insertTextAtCursor,
|
|
5336
|
-
confirm: (props) => {
|
|
5337
|
-
confirmationDialogRef.current?.confirm(props);
|
|
5338
|
-
},
|
|
5339
|
-
showMessageDialog: (props) => {
|
|
5340
|
-
confirmationDialogRef.current?.confirm({
|
|
5341
|
-
header: props.header,
|
|
5342
|
-
message: props.message,
|
|
5343
|
-
accept: () => { },
|
|
5344
|
-
acceptLabel: "Ok",
|
|
5345
|
-
});
|
|
5346
|
-
},
|
|
5347
|
-
showInfoToast,
|
|
5348
|
-
showErrorToast,
|
|
5349
|
-
browseHistory,
|
|
5350
|
-
setCenterPanelView,
|
|
5351
|
-
handleKeyDown,
|
|
5352
|
-
startTour,
|
|
5353
|
-
addSocketMessageListener,
|
|
5354
|
-
sendSocketMessage,
|
|
5355
|
-
socketConnectionVersion,
|
|
5356
|
-
socketDiagnostics,
|
|
5357
|
-
currentItemDescriptor,
|
|
5358
|
-
editorSlots,
|
|
5359
|
-
activeSlotId,
|
|
5360
|
-
slotContexts,
|
|
5361
|
-
registerSlotContext,
|
|
5362
|
-
unregisterSlotContext,
|
|
5363
|
-
getActiveSlotContext,
|
|
5364
|
-
getActiveSlotId,
|
|
5365
|
-
getFieldModificationStoreForSlot,
|
|
5366
|
-
closeEditorSlot,
|
|
5367
|
-
setActiveSlot,
|
|
5368
|
-
revision,
|
|
5369
|
-
fullReloadToken,
|
|
5370
|
-
notifyPageModelReady,
|
|
5371
|
-
pageModelReadyToken,
|
|
5372
|
-
selectedComment,
|
|
5373
|
-
setSelectedComment,
|
|
5374
|
-
selectedSuggestedEdit,
|
|
5375
|
-
setSelectedSuggestedEdit,
|
|
5376
|
-
comments,
|
|
5377
|
-
commentsLoaded,
|
|
5378
|
-
availableCommentTags,
|
|
5379
|
-
loadComments,
|
|
5380
|
-
loadSuggestedEdits,
|
|
5381
|
-
setComments,
|
|
5382
|
-
showComments,
|
|
5383
|
-
setShowComments,
|
|
5384
|
-
showResolvedComments,
|
|
5385
|
-
setShowResolvedComments,
|
|
5386
|
-
addComment: async (options) => {
|
|
5387
|
-
const descriptor = item?.descriptor;
|
|
5388
|
-
if (!descriptor)
|
|
5389
|
-
return;
|
|
5390
|
-
// Only keep a single empty draft comment at a time. Clicking
|
|
5391
|
-
// "add comment" again while an unsaved draft already exists should
|
|
5392
|
-
// focus that draft instead of stacking up more empty inputs.
|
|
5393
|
-
const existingDraft = comments.find((c) => c.isNew);
|
|
5394
|
-
if (existingDraft) {
|
|
5410
|
+
// Snapshot selection context up-front so switching views doesn't change what we comment on.
|
|
5411
|
+
const hintedFieldSnapshot = options?.field;
|
|
5412
|
+
const focusedFieldSnapshot = focusedFieldRef.current;
|
|
5413
|
+
const selectedRangeCandidate = isUsableTextSelectionRange(selectedRange)
|
|
5414
|
+
? selectedRange
|
|
5415
|
+
: lastTextSelectionRangeRef.current;
|
|
5416
|
+
const selectedRangeSnapshot = !hintedFieldSnapshot ||
|
|
5417
|
+
selectionRangeMatchesField(selectedRangeCandidate, hintedFieldSnapshot)
|
|
5418
|
+
? selectedRangeCandidate
|
|
5419
|
+
: undefined;
|
|
5420
|
+
const selectedRangeFieldSnapshot = isUsableTextSelectionRange(selectedRangeSnapshot)
|
|
5421
|
+
? {
|
|
5422
|
+
fieldId: selectedRangeSnapshot.fieldId,
|
|
5423
|
+
item: {
|
|
5424
|
+
id: selectedRangeSnapshot.itemId,
|
|
5425
|
+
language: selectedRangeSnapshot.language || descriptor.language,
|
|
5426
|
+
version: typeof selectedRangeSnapshot.version === "number"
|
|
5427
|
+
? selectedRangeSnapshot.version
|
|
5428
|
+
: descriptor.version,
|
|
5429
|
+
},
|
|
5430
|
+
}
|
|
5431
|
+
: undefined;
|
|
5432
|
+
const commentFieldSnapshot = selectedRangeFieldSnapshot ??
|
|
5433
|
+
hintedFieldSnapshot ??
|
|
5434
|
+
focusedFieldSnapshot;
|
|
5435
|
+
const itemId = commentFieldSnapshot?.item.id ||
|
|
5436
|
+
(selection.length > 0 ? selection[0] : undefined) ||
|
|
5437
|
+
descriptor.id;
|
|
5438
|
+
if (!itemId)
|
|
5439
|
+
return;
|
|
5440
|
+
// Ensure the promoted comments surface is active when adding a comment.
|
|
5395
5441
|
await activateCommentsModeForWriting("comment-add");
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
const commentFieldSnapshot = selectedRangeFieldSnapshot ??
|
|
5423
|
-
hintedFieldSnapshot ??
|
|
5424
|
-
focusedFieldSnapshot;
|
|
5425
|
-
const itemId = commentFieldSnapshot?.item.id ||
|
|
5426
|
-
(selection.length > 0 ? selection[0] : undefined) ||
|
|
5427
|
-
descriptor.id;
|
|
5428
|
-
if (!itemId)
|
|
5429
|
-
return;
|
|
5430
|
-
// Ensure the promoted comments surface is active when adding a comment.
|
|
5431
|
-
await activateCommentsModeForWriting("comment-add");
|
|
5432
|
-
const language = commentFieldSnapshot?.item.language || descriptor.language;
|
|
5433
|
-
const version = typeof commentFieldSnapshot?.item.version === "number"
|
|
5434
|
-
? commentFieldSnapshot.item.version
|
|
5435
|
-
: descriptor.version;
|
|
5436
|
-
const getFieldName = async () => {
|
|
5437
|
-
if (!commentFieldSnapshot)
|
|
5438
|
-
return "";
|
|
5439
|
-
const field = await itemsRepository.getField(commentFieldSnapshot);
|
|
5440
|
-
return field?.name;
|
|
5441
|
-
};
|
|
5442
|
-
const getItemName = async () => {
|
|
5443
|
-
const item = await itemsRepository.getItem({
|
|
5444
|
-
id: itemId,
|
|
5442
|
+
const language = commentFieldSnapshot?.item.language || descriptor.language;
|
|
5443
|
+
const version = typeof commentFieldSnapshot?.item.version === "number"
|
|
5444
|
+
? commentFieldSnapshot.item.version
|
|
5445
|
+
: descriptor.version;
|
|
5446
|
+
const getFieldName = async () => {
|
|
5447
|
+
if (!commentFieldSnapshot)
|
|
5448
|
+
return "";
|
|
5449
|
+
const field = await itemsRepository.getField(commentFieldSnapshot);
|
|
5450
|
+
return field?.name;
|
|
5451
|
+
};
|
|
5452
|
+
const getItemName = async () => {
|
|
5453
|
+
const item = await itemsRepository.getItem({
|
|
5454
|
+
id: itemId,
|
|
5455
|
+
language,
|
|
5456
|
+
version,
|
|
5457
|
+
});
|
|
5458
|
+
return item?.name;
|
|
5459
|
+
};
|
|
5460
|
+
const newComment = {
|
|
5461
|
+
id: uuid(),
|
|
5462
|
+
isNew: true,
|
|
5463
|
+
itemId,
|
|
5464
|
+
itemName: await getItemName(),
|
|
5465
|
+
fieldId: commentFieldSnapshot?.fieldId,
|
|
5466
|
+
fieldName: await getFieldName(),
|
|
5467
|
+
mainItemId: descriptor.id,
|
|
5445
5468
|
language,
|
|
5446
5469
|
version,
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
}
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
getContextFactory: (name) => {
|
|
5577
|
-
try {
|
|
5578
|
-
return factoriesRef.map.get(name);
|
|
5579
|
-
}
|
|
5580
|
-
catch {
|
|
5581
|
-
return undefined;
|
|
5582
|
-
}
|
|
5583
|
-
},
|
|
5584
|
-
}), [
|
|
5470
|
+
position: 0,
|
|
5471
|
+
rangeStart: isUsableTextSelectionRange(selectedRangeSnapshot)
|
|
5472
|
+
? selectedRangeSnapshot.startOffset
|
|
5473
|
+
: 0,
|
|
5474
|
+
rangeEnd: isUsableTextSelectionRange(selectedRangeSnapshot)
|
|
5475
|
+
? selectedRangeSnapshot.endOffset
|
|
5476
|
+
: 0,
|
|
5477
|
+
author: user?.name,
|
|
5478
|
+
authorDisplayName: user?.fullName,
|
|
5479
|
+
created: new Date().toISOString(),
|
|
5480
|
+
};
|
|
5481
|
+
if (selectedRangeSnapshot?.clientRect) {
|
|
5482
|
+
newComment[COMMENT_TRANSIENT_SELECTION_RECT] =
|
|
5483
|
+
selectedRangeSnapshot.clientRect;
|
|
5484
|
+
}
|
|
5485
|
+
if (selectedRangeSnapshot?.elementKey) {
|
|
5486
|
+
newComment[COMMENT_TRANSIENT_ELEMENT_KEY] =
|
|
5487
|
+
selectedRangeSnapshot.elementKey;
|
|
5488
|
+
}
|
|
5489
|
+
setComments([newComment, ...comments]);
|
|
5490
|
+
setSelectedComment(newComment);
|
|
5491
|
+
setSelectedSuggestedEdit(undefined);
|
|
5492
|
+
lastTextSelectionRangeRef.current = undefined;
|
|
5493
|
+
},
|
|
5494
|
+
mode,
|
|
5495
|
+
changeMode,
|
|
5496
|
+
setMode,
|
|
5497
|
+
registerModeChangeParticipant,
|
|
5498
|
+
modeTransitionRevision,
|
|
5499
|
+
previewDate,
|
|
5500
|
+
setPreviewDate,
|
|
5501
|
+
layoutMode,
|
|
5502
|
+
setLayoutMode,
|
|
5503
|
+
user,
|
|
5504
|
+
reviews,
|
|
5505
|
+
statusMessage,
|
|
5506
|
+
setStatusMessage,
|
|
5507
|
+
suggestedEdits,
|
|
5508
|
+
setSuggestedEdits,
|
|
5509
|
+
getCurrentSuggestedEdits,
|
|
5510
|
+
suggestionVariantSelection,
|
|
5511
|
+
setSuggestionVariantSelection,
|
|
5512
|
+
showSuggestedEdits,
|
|
5513
|
+
setShowSuggestedEdits,
|
|
5514
|
+
showSuggestedEditsDiff,
|
|
5515
|
+
setShowSuggestedEditsDiff,
|
|
5516
|
+
showVersionDiffHighlighting,
|
|
5517
|
+
setShowVersionDiffHighlighting,
|
|
5518
|
+
enableCompletions,
|
|
5519
|
+
setEnableCompletions,
|
|
5520
|
+
showComponentNavigator,
|
|
5521
|
+
setShowComponentNavigator: handleSetShowComponentNavigator,
|
|
5522
|
+
isComponentNavigatorOpenForSlot,
|
|
5523
|
+
setComponentNavigatorOpenForSlot,
|
|
5524
|
+
showAgentsPanel,
|
|
5525
|
+
setShowAgentsPanel: handleSetShowAgentsPanel,
|
|
5526
|
+
waitForSurfaceSettled: settleRegistry.waitForSurfaceSettled,
|
|
5527
|
+
notifySurfaceSettled: settleRegistry.notifySettled,
|
|
5528
|
+
isEditorFormHiddenForSlot,
|
|
5529
|
+
setEditorFormHiddenForSlot,
|
|
5530
|
+
editorFormHintSeen,
|
|
5531
|
+
markEditorFormHintSeen,
|
|
5532
|
+
editorFormHintVisible,
|
|
5533
|
+
showEditorFormHint,
|
|
5534
|
+
dismissEditorFormHint,
|
|
5535
|
+
editorFormToggleButtonRef,
|
|
5536
|
+
showMinimap: effectiveShowMinimap,
|
|
5537
|
+
setShowMinimap: handleSetShowMinimap,
|
|
5538
|
+
showHelpTerminal,
|
|
5539
|
+
setShowHelpTerminal: handleSetShowHelpTerminal,
|
|
5540
|
+
toggleHelpTerminal,
|
|
5541
|
+
helpTerminalInitialPrompt,
|
|
5542
|
+
helpTerminalProfileName,
|
|
5543
|
+
helpTerminalActiveTab,
|
|
5544
|
+
setHelpTerminalActiveTab,
|
|
5545
|
+
selectedHelpSectionId,
|
|
5546
|
+
setSelectedHelpSectionId,
|
|
5547
|
+
showAgentsWorkspaceEditor,
|
|
5548
|
+
setShowAgentsWorkspaceEditor: handleSetShowAgentsWorkspaceEditor,
|
|
5549
|
+
selectedAgentsWorkspaceAgentId,
|
|
5550
|
+
setSelectedAgentsWorkspaceAgentId,
|
|
5551
|
+
activeEditorTab,
|
|
5552
|
+
setActiveEditorTab,
|
|
5553
|
+
showLayoutComponents,
|
|
5554
|
+
setShowLayoutComponents: handleSetShowLayoutComponents,
|
|
5555
|
+
quotaInfo,
|
|
5556
|
+
isQuotaExceeded: isQuotaExceeded(),
|
|
5557
|
+
getQuotaWarningMessage,
|
|
5558
|
+
isMobile,
|
|
5559
|
+
mobileEditorPanelOpen,
|
|
5560
|
+
setMobileEditorPanelOpen: handleSetMobileEditorPanelOpen,
|
|
5561
|
+
openDialog,
|
|
5562
|
+
webSocketMessages,
|
|
5563
|
+
clearWebSocketMessages: () => setWebSocketMessages([]),
|
|
5564
|
+
userInfo: userInfo,
|
|
5565
|
+
parheliaSettings: effectiveParheliaSettings,
|
|
5566
|
+
setUserPreferences,
|
|
5567
|
+
currentWizardId,
|
|
5568
|
+
setCurrentWizardId,
|
|
5569
|
+
favorites,
|
|
5570
|
+
loadFavorites,
|
|
5571
|
+
refreshFavorites,
|
|
5572
|
+
isQuickSwitcherVisible: quickSwitcherVisible,
|
|
5573
|
+
// Context factory registry methods
|
|
5574
|
+
registerContextFactory: (name, factory) => {
|
|
5575
|
+
try {
|
|
5576
|
+
factoriesRef.map.set(name, factory);
|
|
5577
|
+
}
|
|
5578
|
+
catch { }
|
|
5579
|
+
},
|
|
5580
|
+
unregisterContextFactory: (name) => {
|
|
5581
|
+
try {
|
|
5582
|
+
factoriesRef.map.delete(name);
|
|
5583
|
+
}
|
|
5584
|
+
catch { }
|
|
5585
|
+
},
|
|
5586
|
+
getContextFactory: (name) => {
|
|
5587
|
+
try {
|
|
5588
|
+
return factoriesRef.map.get(name);
|
|
5589
|
+
}
|
|
5590
|
+
catch {
|
|
5591
|
+
return undefined;
|
|
5592
|
+
}
|
|
5593
|
+
},
|
|
5594
|
+
};
|
|
5595
|
+
editContextValue.visibleWorkspaces =
|
|
5596
|
+
filterVisibleWorkspaces(editContextValue);
|
|
5597
|
+
return editContextValue;
|
|
5598
|
+
}, [
|
|
5585
5599
|
operationsContext.ops,
|
|
5586
5600
|
itemsRepository,
|
|
5587
5601
|
configuration,
|