@parhelia/core 0.1.12556 → 0.1.12560
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.d.ts +6 -4
- package/dist/agents-view/AgentCard.js +143 -24
- package/dist/agents-view/AgentCard.js.map +1 -1
- package/dist/agents-view/AgentsInbox.d.ts +1 -1
- package/dist/agents-view/AgentsInbox.js +7 -92
- package/dist/agents-view/AgentsInbox.js.map +1 -1
- package/dist/agents-view/AgentsTitlebar.js +3 -2
- package/dist/agents-view/AgentsTitlebar.js.map +1 -1
- package/dist/agents-view/AgentsView.d.ts +6 -7
- package/dist/agents-view/AgentsView.js +187 -98
- package/dist/agents-view/AgentsView.js.map +1 -1
- package/dist/agents-view/AgentsWorkspaceView.d.ts +2 -6
- package/dist/agents-view/AgentsWorkspaceView.js +266 -113
- package/dist/agents-view/AgentsWorkspaceView.js.map +1 -1
- package/dist/agents-view/ProfileAgentsGroup.d.ts +2 -1
- package/dist/agents-view/ProfileAgentsGroup.js +4 -3
- package/dist/agents-view/ProfileAgentsGroup.js.map +1 -1
- package/dist/components/ActionButton.d.ts +1 -1
- package/dist/components/ActionButton.js.map +1 -1
- package/dist/components/FilterInput.d.ts +1 -1
- package/dist/components/FilterInput.js +1 -1
- package/dist/components/FilterInput.js.map +1 -1
- package/dist/components/ui/LanguageSelector.js +2 -4
- package/dist/components/ui/LanguageSelector.js.map +1 -1
- package/dist/components/ui/PlaceholderInput.js +3 -3
- package/dist/components/ui/PlaceholderInput.js.map +1 -1
- package/dist/components/ui/PlaceholderInputTypes.js +1 -1
- package/dist/components/ui/PlaceholderInputTypes.js.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts +1 -1
- package/dist/components/ui/alert-dialog.js +6 -10
- package/dist/components/ui/alert-dialog.js.map +1 -1
- package/dist/components/ui/button.d.ts +4 -4
- package/dist/components/ui/button.js +4 -1
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/context-menu.d.ts +1 -1
- package/dist/components/ui/context-menu.js +12 -4
- package/dist/components/ui/context-menu.js.map +1 -1
- package/dist/components/ui/copy-button.d.ts +2 -1
- package/dist/components/ui/copy-button.js +2 -2
- package/dist/components/ui/copy-button.js.map +1 -1
- package/dist/components/ui/dialog.d.ts +1 -1
- package/dist/components/ui/dialog.js +21 -126
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/input.d.ts +1 -1
- package/dist/components/ui/input.js +5 -3
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/paste-button.d.ts +2 -1
- package/dist/components/ui/paste-button.js +2 -2
- package/dist/components/ui/paste-button.js.map +1 -1
- package/dist/components/ui/popover.js +1 -9
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/styled-dialog-title.js +1 -1
- package/dist/components/ui/styled-dialog-title.js.map +1 -1
- package/dist/components/ui/tabs.d.ts +1 -1
- package/dist/components/ui/tabs.js +4 -11
- package/dist/components/ui/tabs.js.map +1 -1
- package/dist/config/config.d.ts +4 -2
- package/dist/config/config.js +250 -70
- package/dist/config/config.js.map +1 -1
- package/dist/config/notificationRoutes.js +14 -0
- package/dist/config/notificationRoutes.js.map +1 -1
- package/dist/config/types/workspace.d.ts +6 -0
- package/dist/config/types.d.ts +63 -12
- package/dist/config/types.js.map +1 -1
- package/dist/editor/ConfirmationDialog.js +20 -4
- package/dist/editor/ConfirmationDialog.js.map +1 -1
- package/dist/editor/ContentTree.d.ts +2 -1
- package/dist/editor/ContentTree.js +93 -32
- package/dist/editor/ContentTree.js.map +1 -1
- package/dist/editor/Editor.js +87 -22
- package/dist/editor/Editor.js.map +1 -1
- package/dist/editor/FieldHistory.js +84 -36
- package/dist/editor/FieldHistory.js.map +1 -1
- package/dist/editor/FieldListField.js +21 -9
- package/dist/editor/FieldListField.js.map +1 -1
- package/dist/editor/FieldListFieldWithFallbacks.js +23 -2
- package/dist/editor/FieldListFieldWithFallbacks.js.map +1 -1
- package/dist/editor/GlobalMenuBar.js +29 -2
- package/dist/editor/GlobalMenuBar.js.map +1 -1
- package/dist/editor/ImageEditor.js +5 -2
- package/dist/editor/ImageEditor.js.map +1 -1
- package/dist/editor/ItemInfo.js +36 -1
- package/dist/editor/ItemInfo.js.map +1 -1
- package/dist/editor/LinkEditorDialog.js +3 -0
- package/dist/editor/LinkEditorDialog.js.map +1 -1
- package/dist/editor/MainLayout.d.ts +0 -2
- package/dist/editor/MainLayout.js +65 -8
- package/dist/editor/MainLayout.js.map +1 -1
- package/dist/editor/MigrationsView.js +29 -5
- package/dist/editor/MigrationsView.js.map +1 -1
- package/dist/editor/MobileLayout.js +37 -12
- package/dist/editor/MobileLayout.js.map +1 -1
- package/dist/editor/PictureCropper.js +54 -45
- package/dist/editor/PictureCropper.js.map +1 -1
- package/dist/editor/PictureEditor.js +17 -15
- package/dist/editor/PictureEditor.js.map +1 -1
- package/dist/editor/QuickItemSwitcher.js +21 -21
- package/dist/editor/QuickItemSwitcher.js.map +1 -1
- package/dist/editor/SetupWizard.js +52 -12
- package/dist/editor/SetupWizard.js.map +1 -1
- package/dist/editor/Titlebar.js +7 -2
- package/dist/editor/Titlebar.js.map +1 -1
- package/dist/editor/ai/AgentCostDisplay.d.ts +1 -0
- package/dist/editor/ai/AgentCostDisplay.js +1 -1
- package/dist/editor/ai/AgentCostDisplay.js.map +1 -1
- package/dist/editor/ai/AgentDocumentList.js +32 -14
- package/dist/editor/ai/AgentDocumentList.js.map +1 -1
- package/dist/editor/ai/AgentGreeting.js +3 -2
- package/dist/editor/ai/AgentGreeting.js.map +1 -1
- package/dist/editor/ai/AgentProfileSelector.js +2 -1
- package/dist/editor/ai/AgentProfileSelector.js.map +1 -1
- package/dist/editor/ai/AgentStatusBadge.d.ts +0 -5
- package/dist/editor/ai/AgentStatusBadge.js +67 -65
- package/dist/editor/ai/AgentStatusBadge.js.map +1 -1
- package/dist/editor/ai/AgentTerminal.d.ts +14 -2
- package/dist/editor/ai/AgentTerminal.js +2377 -483
- package/dist/editor/ai/AgentTerminal.js.map +1 -1
- package/dist/editor/ai/AgentTerminalStatusBar.d.ts +8 -3
- package/dist/editor/ai/AgentTerminalStatusBar.js +460 -56
- package/dist/editor/ai/AgentTerminalStatusBar.js.map +1 -1
- package/dist/editor/ai/Agents.js +150 -113
- package/dist/editor/ai/Agents.js.map +1 -1
- package/dist/editor/ai/AiResponseMessage.d.ts +10 -1
- package/dist/editor/ai/AiResponseMessage.js +238 -23
- package/dist/editor/ai/AiResponseMessage.js.map +1 -1
- package/dist/editor/ai/ContextInfoBar.d.ts +2 -3
- package/dist/editor/ai/ContextInfoBar.js +64 -7
- package/dist/editor/ai/ContextInfoBar.js.map +1 -1
- package/dist/editor/ai/GuidanceOverlay.js +17 -11
- package/dist/editor/ai/GuidanceOverlay.js.map +1 -1
- package/dist/editor/ai/InlineAiDialog.d.ts +1 -1
- package/dist/editor/ai/InlineAiDialog.js +514 -192
- package/dist/editor/ai/InlineAiDialog.js.map +1 -1
- package/dist/editor/ai/InlineAiTrigger.js +115 -12
- package/dist/editor/ai/InlineAiTrigger.js.map +1 -1
- package/dist/editor/ai/MediaImage.js +40 -8
- package/dist/editor/ai/MediaImage.js.map +1 -1
- package/dist/editor/ai/SpawnedAgentsPanel.js +10 -12
- package/dist/editor/ai/SpawnedAgentsPanel.js.map +1 -1
- package/dist/editor/ai/ToolCallDisplay.d.ts +22 -2
- package/dist/editor/ai/ToolCallDisplay.js +518 -147
- package/dist/editor/ai/ToolCallDisplay.js.map +1 -1
- package/dist/editor/ai/dialogs/AgentDialogHandler.d.ts +1 -8
- package/dist/editor/ai/dialogs/AgentDialogHandler.js +379 -42
- package/dist/editor/ai/dialogs/AgentDialogHandler.js.map +1 -1
- package/dist/editor/ai/dialogs/QuestionnaireInline.d.ts +5 -1
- package/dist/editor/ai/dialogs/QuestionnaireInline.js +628 -60
- package/dist/editor/ai/dialogs/QuestionnaireInline.js.map +1 -1
- package/dist/editor/ai/dialogs/agentDialogTypes.d.ts +115 -0
- package/dist/editor/ai/dialogs/agentDialogTypes.js +2 -0
- package/dist/editor/ai/dialogs/agentDialogTypes.js.map +1 -1
- package/dist/editor/ai/types.d.ts +3 -1
- package/dist/editor/ai/useAgentStatus.d.ts +2 -1
- package/dist/editor/ai/useAgentStatus.js +86 -99
- package/dist/editor/ai/useAgentStatus.js.map +1 -1
- package/dist/editor/ai/useInlineAiPosition.js +45 -5
- package/dist/editor/ai/useInlineAiPosition.js.map +1 -1
- package/dist/editor/client/AboutDialog.js +4 -2
- package/dist/editor/client/AboutDialog.js.map +1 -1
- package/dist/editor/client/EditorShell.d.ts +4 -1
- package/dist/editor/client/EditorShell.js +770 -237
- package/dist/editor/client/EditorShell.js.map +1 -1
- package/dist/editor/client/editContext.d.ts +33 -19
- package/dist/editor/client/editContext.js.map +1 -1
- package/dist/editor/client/helpers.js +6 -0
- package/dist/editor/client/helpers.js.map +1 -1
- package/dist/editor/client/hooks/useEditorUrlSync.js +1 -2
- package/dist/editor/client/hooks/useEditorUrlSync.js.map +1 -1
- package/dist/editor/client/hooks/useEditorWebSocket.d.ts +10 -0
- package/dist/editor/client/hooks/useEditorWebSocket.js +209 -14
- package/dist/editor/client/hooks/useEditorWebSocket.js.map +1 -1
- package/dist/editor/client/hooks/useQuota.d.ts +8 -0
- package/dist/editor/client/hooks/useQuota.js.map +1 -1
- package/dist/editor/client/hooks/useSocketMessageHandler.js +68 -7
- package/dist/editor/client/hooks/useSocketMessageHandler.js.map +1 -1
- package/dist/editor/client/itemsRepository.js +10 -6
- package/dist/editor/client/itemsRepository.js.map +1 -1
- package/dist/editor/client/navigation.js +35 -3
- package/dist/editor/client/navigation.js.map +1 -1
- package/dist/editor/client/operations.d.ts +6 -3
- package/dist/editor/client/operations.js +208 -30
- package/dist/editor/client/operations.js.map +1 -1
- package/dist/editor/client/pageModelBuilder.js +4 -31
- package/dist/editor/client/pageModelBuilder.js.map +1 -1
- package/dist/editor/client/ui/DevModeIndicator.js +2 -2
- package/dist/editor/client/ui/DevModeIndicator.js.map +1 -1
- package/dist/editor/client/ui/EditorChrome.d.ts +0 -6
- package/dist/editor/client/ui/EditorChrome.js +55 -72
- package/dist/editor/client/ui/EditorChrome.js.map +1 -1
- package/dist/editor/client/ui/FullscreenControls.js +5 -3
- package/dist/editor/client/ui/FullscreenControls.js.map +1 -1
- package/dist/editor/commands/commands.d.ts +11 -1
- package/dist/editor/commands/commands.js +12 -1
- package/dist/editor/commands/commands.js.map +1 -1
- package/dist/editor/commands/componentCommands.js +109 -55
- package/dist/editor/commands/componentCommands.js.map +1 -1
- package/dist/editor/commands/customCommandConverter.d.ts +8 -1
- package/dist/editor/commands/customCommandConverter.js +35 -5
- package/dist/editor/commands/customCommandConverter.js.map +1 -1
- package/dist/editor/commands/handlers/agentHandler.js +2 -1
- package/dist/editor/commands/handlers/agentHandler.js.map +1 -1
- package/dist/editor/commands/itemCommands.d.ts +3 -0
- package/dist/editor/commands/itemCommands.js +93 -10
- package/dist/editor/commands/itemCommands.js.map +1 -1
- package/dist/editor/commands/undo.d.ts +9 -15
- package/dist/editor/commands/undo.js +24 -0
- package/dist/editor/commands/undo.js.map +1 -1
- package/dist/editor/context-menu/InsertMenu.js +83 -39
- package/dist/editor/context-menu/InsertMenu.js.map +1 -1
- package/dist/editor/field-types/MultiLineText.js +1 -1
- package/dist/editor/field-types/MultiLineText.js.map +1 -1
- package/dist/editor/field-types/RawEditor.js +1 -1
- package/dist/editor/field-types/RichTextEditor.js +13 -5
- package/dist/editor/field-types/RichTextEditor.js.map +1 -1
- package/dist/editor/field-types/RichTextEditorComponent.js +37 -3
- package/dist/editor/field-types/RichTextEditorComponent.js.map +1 -1
- package/dist/editor/field-types/SingleLineText.js +1 -1
- package/dist/editor/field-types/TreeListEditor.js +3 -2
- package/dist/editor/field-types/TreeListEditor.js.map +1 -1
- package/dist/editor/field-types/richtext/components/ReactSlate.css +23 -5
- package/dist/editor/field-types/richtext/components/ReactSlate.d.ts +2 -0
- package/dist/editor/field-types/richtext/components/ReactSlate.js +28 -4
- package/dist/editor/field-types/richtext/components/ReactSlate.js.map +1 -1
- package/dist/editor/field-types/richtext/components/ToolbarButton.js +4 -2
- package/dist/editor/field-types/richtext/components/ToolbarButton.js.map +1 -1
- package/dist/editor/field-types/richtext/contextMenuFactory.d.ts +13 -0
- package/dist/editor/field-types/richtext/contextMenuFactory.js +181 -24
- package/dist/editor/field-types/richtext/contextMenuFactory.js.map +1 -1
- package/dist/editor/field-types/richtext/types.d.ts +2 -0
- package/dist/editor/field-types/richtext/types.js.map +1 -1
- package/dist/editor/field-types/richtext/utils/plugins.js +4 -0
- package/dist/editor/field-types/richtext/utils/plugins.js.map +1 -1
- package/dist/editor/field-types/textContextMenuFactory.js +3 -2
- package/dist/editor/field-types/textContextMenuFactory.js.map +1 -1
- package/dist/editor/media-selector/AiImageSearchPrompt.js +4 -2
- package/dist/editor/media-selector/AiImageSearchPrompt.js.map +1 -1
- package/dist/editor/media-selector/MediaFolderBrowser.js +1 -1
- package/dist/editor/media-selector/MediaFolderBrowser.js.map +1 -1
- package/dist/editor/media-selector/MediaSelector.js +7 -1
- package/dist/editor/media-selector/MediaSelector.js.map +1 -1
- package/dist/editor/media-selector/TreeSelector.js +40 -35
- package/dist/editor/media-selector/TreeSelector.js.map +1 -1
- package/dist/editor/menubar/ActiveUsers.js +1 -1
- package/dist/editor/menubar/ActiveUsers.js.map +1 -1
- package/dist/editor/menubar/GenericToolbar.js +4 -2
- package/dist/editor/menubar/GenericToolbar.js.map +1 -1
- package/dist/editor/menubar/ItemLanguageVersion.js +2 -2
- package/dist/editor/menubar/ItemLanguageVersion.js.map +1 -1
- package/dist/editor/menubar/PageSelector.js +26 -147
- package/dist/editor/menubar/PageSelector.js.map +1 -1
- package/dist/editor/menubar/Separator.js +1 -1
- package/dist/editor/menubar/VersionSelector.js +2 -4
- package/dist/editor/menubar/VersionSelector.js.map +1 -1
- package/dist/editor/menubar/WorkflowButton.js +39 -12
- package/dist/editor/menubar/WorkflowButton.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/CustomCommandsToolbar.js +16 -38
- package/dist/editor/menubar/toolbar-sections/CustomCommandsToolbar.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/EditControls.js +3 -3
- package/dist/editor/menubar/toolbar-sections/EditControls.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/HelpButton.js +1 -0
- package/dist/editor/menubar/toolbar-sections/HelpButton.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/ManualBrowser.d.ts +6 -10
- package/dist/editor/menubar/toolbar-sections/ManualBrowser.js +597 -220
- package/dist/editor/menubar/toolbar-sections/ManualBrowser.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/UtilityControls.js +13 -2
- package/dist/editor/menubar/toolbar-sections/UtilityControls.js.map +1 -1
- package/dist/editor/page-editor-chrome/CommentHighlighting.js +42 -1
- package/dist/editor/page-editor-chrome/CommentHighlighting.js.map +1 -1
- package/dist/editor/page-editor-chrome/FrameMenu.js +1 -1
- package/dist/editor/page-editor-chrome/FrameMenu.js.map +1 -1
- package/dist/editor/page-editor-chrome/InlineEditor.js +97 -48
- package/dist/editor/page-editor-chrome/InlineEditor.js.map +1 -1
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +38 -17
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js.map +1 -1
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js +17 -11
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js.map +1 -1
- package/dist/editor/page-editor-chrome/useInlineAICompletion.js +301 -301
- package/dist/editor/page-editor-chrome/useInlineAICompletion.js.map +1 -1
- package/dist/editor/page-viewer/DeviceToolbar.js +1 -1
- package/dist/editor/page-viewer/DeviceToolbar.js.map +1 -1
- package/dist/editor/page-viewer/EditorForm.js +69 -11
- package/dist/editor/page-viewer/EditorForm.js.map +1 -1
- package/dist/editor/page-viewer/MiniMap.d.ts +2 -4
- package/dist/editor/page-viewer/MiniMap.js +91 -28
- package/dist/editor/page-viewer/MiniMap.js.map +1 -1
- package/dist/editor/page-viewer/PageViewer.d.ts +3 -1
- package/dist/editor/page-viewer/PageViewer.js +92 -19
- package/dist/editor/page-viewer/PageViewer.js.map +1 -1
- package/dist/editor/page-viewer/PageViewerFrame.d.ts +2 -1
- package/dist/editor/page-viewer/PageViewerFrame.js +348 -115
- package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -1
- package/dist/editor/page-viewer/pageModelSkeletonBuilder.js +114 -49
- package/dist/editor/page-viewer/pageModelSkeletonBuilder.js.map +1 -1
- package/dist/editor/page-viewer/pageViewContext.d.ts +1 -0
- package/dist/editor/page-viewer/pageViewContext.js +51 -14
- package/dist/editor/page-viewer/pageViewContext.js.map +1 -1
- package/dist/editor/pageModel.d.ts +14 -1
- package/dist/editor/reviews/Comment.js +26 -12
- package/dist/editor/reviews/Comment.js.map +1 -1
- package/dist/editor/reviews/CommentDisplayPopover.js +7 -5
- package/dist/editor/reviews/CommentDisplayPopover.js.map +1 -1
- package/dist/editor/reviews/CommentView.js +19 -4
- package/dist/editor/reviews/CommentView.js.map +1 -1
- package/dist/editor/reviews/Comments.js +89 -72
- package/dist/editor/reviews/Comments.js.map +1 -1
- package/dist/editor/reviews/CreateReviewDialog.js +281 -177
- package/dist/editor/reviews/CreateReviewDialog.js.map +1 -1
- package/dist/editor/reviews/DecisionsMatrix.js +96 -25
- package/dist/editor/reviews/DecisionsMatrix.js.map +1 -1
- package/dist/editor/reviews/DiffView.js +7 -14
- package/dist/editor/reviews/DiffView.js.map +1 -1
- package/dist/editor/reviews/EditReviewSettingsDialog.js +6 -4
- package/dist/editor/reviews/EditReviewSettingsDialog.js.map +1 -1
- package/dist/editor/reviews/MultiReviewManager.js +25 -3
- package/dist/editor/reviews/MultiReviewManager.js.map +1 -1
- package/dist/editor/reviews/PagesPanel.js +31 -15
- package/dist/editor/reviews/PagesPanel.js.map +1 -1
- package/dist/editor/reviews/PreviewInfo.js +1 -4
- package/dist/editor/reviews/PreviewInfo.js.map +1 -1
- package/dist/editor/reviews/ReviewCard.js +13 -7
- package/dist/editor/reviews/ReviewCard.js.map +1 -1
- package/dist/editor/reviews/ReviewDetail.js +3 -2
- package/dist/editor/reviews/ReviewDetail.js.map +1 -1
- package/dist/editor/reviews/ReviewsList.js +7 -3
- package/dist/editor/reviews/ReviewsList.js.map +1 -1
- package/dist/editor/reviews/SuggestedEdit.js +34 -3
- package/dist/editor/reviews/SuggestedEdit.js.map +1 -1
- package/dist/editor/reviews/SuggestionDisplayPopover.js +31 -5
- package/dist/editor/reviews/SuggestionDisplayPopover.js.map +1 -1
- package/dist/editor/reviews/commentAi.js +25 -6
- package/dist/editor/reviews/commentAi.js.map +1 -1
- package/dist/editor/reviews/reviewCommands.js +4 -1
- package/dist/editor/reviews/reviewCommands.js.map +1 -1
- package/dist/editor/reviews/useMultiReview.js +2 -2
- package/dist/editor/reviews/useMultiReview.js.map +1 -1
- package/dist/editor/reviews/useReviews.d.ts +2 -2
- package/dist/editor/reviews/useReviews.js +12 -30
- package/dist/editor/reviews/useReviews.js.map +1 -1
- package/dist/editor/services/agentService.d.ts +229 -5
- package/dist/editor/services/agentService.js +292 -39
- package/dist/editor/services/agentService.js.map +1 -1
- package/dist/editor/services/aiService.d.ts +57 -1
- package/dist/editor/services/aiService.js +79 -6
- package/dist/editor/services/aiService.js.map +1 -1
- package/dist/editor/services/contentService.d.ts +6 -3
- package/dist/editor/services/contentService.js +13 -12
- package/dist/editor/services/contentService.js.map +1 -1
- package/dist/editor/services/editService.d.ts +52 -1
- package/dist/editor/services/editService.js +94 -2
- package/dist/editor/services/editService.js.map +1 -1
- package/dist/editor/services/indexService.js +1 -1
- package/dist/editor/services/indexService.js.map +1 -1
- package/dist/editor/services/reviewsService.d.ts +3 -6
- package/dist/editor/services/reviewsService.js +2 -11
- package/dist/editor/services/reviewsService.js.map +1 -1
- package/dist/editor/services/serviceHelper.d.ts +2 -1
- package/dist/editor/services/serviceHelper.js +112 -20
- package/dist/editor/services/serviceHelper.js.map +1 -1
- package/dist/editor/services/systemService.d.ts +2 -1
- package/dist/editor/services/systemService.js +3 -0
- package/dist/editor/services/systemService.js.map +1 -1
- package/dist/editor/services-server/api.d.ts +1 -2
- package/dist/editor/services-server/api.js +11 -6
- package/dist/editor/services-server/api.js.map +1 -1
- package/dist/editor/settings/About.js +317 -3
- package/dist/editor/settings/About.js.map +1 -1
- package/dist/editor/settings/QuotaInfo.js +210 -4
- package/dist/editor/settings/QuotaInfo.js.map +1 -1
- package/dist/editor/settings/SettingsView.js +25 -23
- package/dist/editor/settings/SettingsView.js.map +1 -1
- package/dist/editor/settings/Status.js +7 -6
- package/dist/editor/settings/Status.js.map +1 -1
- package/dist/editor/settings/index/useIndexStatus.js +20 -22
- package/dist/editor/settings/index/useIndexStatus.js.map +1 -1
- package/dist/editor/settings/panels/AgentsPanel.d.ts +0 -4
- package/dist/editor/settings/panels/AgentsPanel.js +95 -121
- package/dist/editor/settings/panels/AgentsPanel.js.map +1 -1
- package/dist/editor/settings/panels/ModelsPanel.js +329 -108
- package/dist/editor/settings/panels/ModelsPanel.js.map +1 -1
- package/dist/editor/settings/panels/ProvidersPanel.d.ts +1 -1
- package/dist/editor/settings/panels/ProvidersPanel.js +86 -59
- package/dist/editor/settings/panels/ProvidersPanel.js.map +1 -1
- package/dist/editor/settings/panels/SearchConfigPanel.js +4 -4
- package/dist/editor/settings/panels/SearchConfigPanel.js.map +1 -1
- package/dist/editor/settings/panels/index.d.ts +3 -2
- package/dist/editor/settings/panels/index.js +3 -2
- package/dist/editor/settings/panels/index.js.map +1 -1
- package/dist/editor/settings/status/coreStatusChecks.js +124 -19
- package/dist/editor/settings/status/coreStatusChecks.js.map +1 -1
- package/dist/editor/settings/status/useStartupChecks.d.ts +3 -1
- package/dist/editor/settings/status/useStartupChecks.js +9 -5
- package/dist/editor/settings/status/useStartupChecks.js.map +1 -1
- package/dist/editor/setup-wizard/steps/CompleteStep.d.ts +2 -1
- package/dist/editor/setup-wizard/steps/CompleteStep.js +2 -1
- package/dist/editor/setup-wizard/steps/CompleteStep.js.map +1 -1
- package/dist/editor/sidebar/ComponentPalette.js +2 -1
- package/dist/editor/sidebar/ComponentPalette.js.map +1 -1
- package/dist/editor/sidebar/ComponentTree.d.ts +8 -1
- package/dist/editor/sidebar/ComponentTree.js +216 -69
- package/dist/editor/sidebar/ComponentTree.js.map +1 -1
- package/dist/editor/sidebar/EditHistory.js +22 -46
- package/dist/editor/sidebar/EditHistory.js.map +1 -1
- package/dist/editor/sidebar/Favorites.js +4 -8
- package/dist/editor/sidebar/Favorites.js.map +1 -1
- package/dist/editor/sidebar/MainContentTree.js +4 -3
- package/dist/editor/sidebar/MainContentTree.js.map +1 -1
- package/dist/editor/sidebar/OperationItem.js +21 -7
- package/dist/editor/sidebar/OperationItem.js.map +1 -1
- package/dist/editor/sidebar/SidebarPanel.d.ts +3 -1
- package/dist/editor/sidebar/SidebarPanel.js +44 -12
- package/dist/editor/sidebar/SidebarPanel.js.map +1 -1
- package/dist/editor/sidebar/SidebarStack.d.ts +2 -1
- package/dist/editor/sidebar/SidebarStack.js +4 -3
- package/dist/editor/sidebar/SidebarStack.js.map +1 -1
- package/dist/editor/sidebar/Validation.js +22 -12
- package/dist/editor/sidebar/Validation.js.map +1 -1
- package/dist/editor/sidebar/Workbox.js +53 -3
- package/dist/editor/sidebar/Workbox.js.map +1 -1
- package/dist/editor/sidebar/WorkspaceRail.d.ts +0 -1
- package/dist/editor/sidebar/WorkspaceRail.js +56 -167
- package/dist/editor/sidebar/WorkspaceRail.js.map +1 -1
- package/dist/editor/tree-indicators/GutterColumns.d.ts +3 -1
- package/dist/editor/tree-indicators/GutterColumns.js +26 -5
- package/dist/editor/tree-indicators/GutterColumns.js.map +1 -1
- package/dist/editor/tree-indicators/GutterContext.d.ts +4 -0
- package/dist/editor/tree-indicators/GutterContext.js +23 -0
- package/dist/editor/tree-indicators/GutterContext.js.map +1 -1
- package/dist/editor/tree-indicators/index.d.ts +0 -1
- package/dist/editor/tree-indicators/index.js +0 -1
- package/dist/editor/tree-indicators/index.js.map +1 -1
- package/dist/editor/tree-indicators/types.d.ts +12 -1
- package/dist/editor/ui/CopyMoveTargetSelectorDialog.js +1 -1
- package/dist/editor/ui/CopyMoveTargetSelectorDialog.js.map +1 -1
- package/dist/editor/ui/Icons.js +1 -1
- package/dist/editor/ui/Icons.js.map +1 -1
- package/dist/editor/ui/ItemNameDialogNew.d.ts +2 -0
- package/dist/editor/ui/ItemNameDialogNew.js +33 -17
- package/dist/editor/ui/ItemNameDialogNew.js.map +1 -1
- package/dist/editor/ui/ItemSearch.js +7 -11
- package/dist/editor/ui/ItemSearch.js.map +1 -1
- package/dist/editor/ui/SimpleIconButton.js +1 -1
- package/dist/editor/ui/SimpleIconButton.js.map +1 -1
- package/dist/editor/ui/SimpleTabs.d.ts +1 -0
- package/dist/editor/ui/SimpleTabs.js +45 -25
- package/dist/editor/ui/SimpleTabs.js.map +1 -1
- package/dist/editor/ui/Splitter.d.ts +1 -0
- package/dist/editor/ui/Splitter.js +102 -86
- package/dist/editor/ui/Splitter.js.map +1 -1
- package/dist/editor/ui/TemplateSelectorDialog.js +4 -4
- package/dist/editor/ui/TemplateSelectorDialog.js.map +1 -1
- package/dist/editor/ui/TreeListSelector.d.ts +6 -1
- package/dist/editor/ui/TreeListSelector.js +2 -2
- package/dist/editor/ui/TreeListSelector.js.map +1 -1
- package/dist/editor/utils/keyboardNavigation.d.ts +6 -20
- package/dist/editor/utils/keyboardNavigation.js +48 -140
- package/dist/editor/utils/keyboardNavigation.js.map +1 -1
- package/dist/editor/utils.js +19 -9
- package/dist/editor/utils.js.map +1 -1
- package/dist/editor/views/CompareView.d.ts +3 -1
- package/dist/editor/views/CompareView.js +7 -5
- package/dist/editor/views/CompareView.js.map +1 -1
- package/dist/editor/views/EditView.js +1 -1
- package/dist/editor/views/EditView.js.map +1 -1
- package/dist/editor/views/EditorSlot.js +27 -34
- package/dist/editor/views/EditorSlot.js.map +1 -1
- package/dist/editor/views/ItemEditor.js +7 -3
- package/dist/editor/views/ItemEditor.js.map +1 -1
- package/dist/editor/views/MediaFolderEditView.js +1 -1
- package/dist/editor/views/MediaFolderEditView.js.map +1 -1
- package/dist/editor/views/ParheliaView.js +5 -6
- package/dist/editor/views/ParheliaView.js.map +1 -1
- package/dist/editor/views/SingleEditView.d.ts +2 -1
- package/dist/editor/views/SingleEditView.js +10 -8
- package/dist/editor/views/SingleEditView.js.map +1 -1
- package/dist/editor/views/editorSlotContext.js +35 -6
- package/dist/editor/views/editorSlotContext.js.map +1 -1
- package/dist/index.d.ts +16 -2
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/dist/setup/services/setupWizardService.d.ts +40 -13
- package/dist/setup/services/setupWizardService.js +32 -17
- package/dist/setup/services/setupWizardService.js.map +1 -1
- package/dist/setup/wizard/steps/AddModelDialog.js +12 -3
- package/dist/setup/wizard/steps/AddModelDialog.js.map +1 -1
- package/dist/setup/wizard/steps/ImportModelDialog.js +39 -22
- package/dist/setup/wizard/steps/ImportModelDialog.js.map +1 -1
- package/dist/splash-screen/ModernSplashScreen.js +112 -32
- package/dist/splash-screen/ModernSplashScreen.js.map +1 -1
- package/dist/splash-screen/NewPage.js +33 -50
- package/dist/splash-screen/NewPage.js.map +1 -1
- package/dist/splash-screen/OpenPage.js +2 -6
- package/dist/splash-screen/OpenPage.js.map +1 -1
- package/dist/splash-screen/ParheliaAssistantChat.js +12 -29
- package/dist/splash-screen/ParheliaAssistantChat.js.map +1 -1
- package/dist/splash-screen/ParheliaLogo.js +87 -37
- package/dist/splash-screen/ParheliaLogo.js.map +1 -1
- package/dist/splash-screen/RecentPages.js +3 -3
- package/dist/splash-screen/RecentPages.js.map +1 -1
- package/dist/tour/Tour.d.ts +2 -1
- package/dist/tour/Tour.js +256 -75
- package/dist/tour/Tour.js.map +1 -1
- package/dist/tour/default-tour.js +222 -96
- package/dist/tour/default-tour.js.map +1 -1
- package/dist/types.d.ts +63 -29
- package/package.json +19 -15
- package/styles.css +14 -10
- package/dist/editor/ComponentInfo.d.ts +0 -4
- package/dist/editor/ComponentInfo.js +0 -41
- package/dist/editor/ComponentInfo.js.map +0 -1
- package/dist/editor/ai/HelpTerminal.d.ts +0 -5
- package/dist/editor/ai/HelpTerminal.js +0 -166
- package/dist/editor/ai/HelpTerminal.js.map +0 -1
- package/dist/editor/field-types/ReactQuill.d.ts +0 -125
- package/dist/editor/field-types/ReactQuill.js +0 -385
- package/dist/editor/field-types/ReactQuill.js.map +0 -1
- package/dist/editor/services-server/graphQL.d.ts +0 -29
- package/dist/editor/services-server/graphQL.js +0 -53
- package/dist/editor/services-server/graphQL.js.map +0 -1
- package/dist/editor/settings/AllAgentsPanel.d.ts +0 -5
- package/dist/editor/settings/AllAgentsPanel.js +0 -139
- package/dist/editor/settings/AllAgentsPanel.js.map +0 -1
- package/dist/editor/settings/LatestFeedback.d.ts +0 -1
- package/dist/editor/settings/LatestFeedback.js +0 -136
- package/dist/editor/settings/LatestFeedback.js.map +0 -1
- package/dist/editor/settings/Setup.d.ts +0 -1
- package/dist/editor/settings/Setup.js +0 -211
- package/dist/editor/settings/Setup.js.map +0 -1
- package/dist/editor/settings/panels/DatabasePanel.d.ts +0 -6
- package/dist/editor/settings/panels/DatabasePanel.js +0 -50
- package/dist/editor/settings/panels/DatabasePanel.js.map +0 -1
- package/dist/editor/settings/setup-steps/AiSetupStep/EmbeddingsModelSection.d.ts +0 -2
- package/dist/editor/settings/setup-steps/AiSetupStep/EmbeddingsModelSection.js +0 -195
- package/dist/editor/settings/setup-steps/AiSetupStep/EmbeddingsModelSection.js.map +0 -1
- package/dist/editor/settings/setup-steps/AiSetupStep/index.d.ts +0 -2
- package/dist/editor/settings/setup-steps/AiSetupStep/index.js +0 -21
- package/dist/editor/settings/setup-steps/AiSetupStep/index.js.map +0 -1
- package/dist/editor/settings/setup-steps/AiSetupStep/provider/ProviderSection.d.ts +0 -1
- package/dist/editor/settings/setup-steps/AiSetupStep/provider/ProviderSection.js +0 -233
- package/dist/editor/settings/setup-steps/AiSetupStep/provider/ProviderSection.js.map +0 -1
- package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersList.d.ts +0 -15
- package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersList.js +0 -14
- package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersList.js.map +0 -1
- package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersSection.d.ts +0 -1
- package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersSection.js +0 -94
- package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersSection.js.map +0 -1
- package/dist/editor/settings/setup-steps/AiSetupStep/types.d.ts +0 -1
- package/dist/editor/settings/setup-steps/AiSetupStep/types.js +0 -2
- package/dist/editor/settings/setup-steps/AiSetupStep/types.js.map +0 -1
- package/dist/editor/settings/setup-steps/AiSetupStep/utils.d.ts +0 -5
- package/dist/editor/settings/setup-steps/AiSetupStep/utils.js +0 -44
- package/dist/editor/settings/setup-steps/AiSetupStep/utils.js.map +0 -1
- package/dist/editor/settings/setup-steps/IndexSetupStep.d.ts +0 -2
- package/dist/editor/settings/setup-steps/IndexSetupStep.js +0 -36
- package/dist/editor/settings/setup-steps/IndexSetupStep.js.map +0 -1
- package/dist/editor/settings/setup-steps/SettingsSetupStep.d.ts +0 -2
- package/dist/editor/settings/setup-steps/SettingsSetupStep.js +0 -111
- package/dist/editor/settings/setup-steps/SettingsSetupStep.js.map +0 -1
- package/dist/editor/settings/setup-steps/SetupOverview.d.ts +0 -14
- package/dist/editor/settings/setup-steps/SetupOverview.js +0 -38
- package/dist/editor/settings/setup-steps/SetupOverview.js.map +0 -1
- package/dist/editor/sidebar/Debug.d.ts +0 -1
- package/dist/editor/sidebar/Debug.js +0 -70
- package/dist/editor/sidebar/Debug.js.map +0 -1
- package/dist/editor/sidebar/GraphQL.d.ts +0 -2
- package/dist/editor/sidebar/GraphQL.js +0 -234
- package/dist/editor/sidebar/GraphQL.js.map +0 -1
- package/dist/editor/sidebar/LeftToolbar.d.ts +0 -1
- package/dist/editor/sidebar/LeftToolbar.js +0 -12
- package/dist/editor/sidebar/LeftToolbar.js.map +0 -1
- package/dist/editor/sidebar/NavigationSidebar.d.ts +0 -4
- package/dist/editor/sidebar/NavigationSidebar.js +0 -254
- package/dist/editor/sidebar/NavigationSidebar.js.map +0 -1
- package/dist/editor/tree-indicators/GutterSelector.d.ts +0 -5
- package/dist/editor/tree-indicators/GutterSelector.js +0 -91
- package/dist/editor/tree-indicators/GutterSelector.js.map +0 -1
|
@@ -4,15 +4,17 @@ import { MiniMap } from "./MiniMap";
|
|
|
4
4
|
import { useEditContext, useEditContextRef, useFieldsEditContext, useFieldsEditContextRef, } from "../client/editContext";
|
|
5
5
|
import { useDebouncedCallback, useThrottledCallback } from "use-debounce";
|
|
6
6
|
import { PageEditorChrome } from "../page-editor-chrome/PageEditorChrome";
|
|
7
|
+
import { useViewportChangeSignal } from "./pageViewContext";
|
|
7
8
|
import morphdom from "morphdom";
|
|
8
9
|
import uuid from "react-uuid";
|
|
9
10
|
import { cn } from "../../lib/utils";
|
|
10
|
-
import { findComponentRect, findFieldElement, findNearestEditableComponentId, findParentWithAttribute, getAbsolutePosition, getFieldDescriptorFromElement, findClosestFieldElement, } from "../utils";
|
|
11
|
+
import { findComponentRect, findFieldElement, findNearestEditableComponentId, findParentWithAttribute, getAbsolutePosition, getFieldDescriptorFromElement, findClosestFieldElement, extractItemIdFromItemUri, } from "../utils";
|
|
11
12
|
import { extractDOMSelectionContext } from "../utils/selectionContext";
|
|
13
|
+
import { cleanId } from "../utils/id-helper";
|
|
12
14
|
import { getAllComponentInstances, getComponentById, } from "../componentTreeHelper";
|
|
13
15
|
import { buildComponentContextMenuItems } from "../ContextMenu";
|
|
14
16
|
import { loadFieldButtons } from "../services/editService";
|
|
15
|
-
import { usePathname } from "
|
|
17
|
+
import { usePathname } from "../client/navigation";
|
|
16
18
|
import { EditorWarnings } from "../EditorWarnings";
|
|
17
19
|
import { FieldActionsOverlay, } from "../FieldActionsOverlay";
|
|
18
20
|
import { NoLayout } from "../page-editor-chrome/NoLayout";
|
|
@@ -20,9 +22,10 @@ import { Spinner } from "../ui/Spinner";
|
|
|
20
22
|
import { DeviceToolbar } from "./DeviceToolbar";
|
|
21
23
|
import { buildPageModelSkeleton } from "./pageModelSkeletonBuilder";
|
|
22
24
|
const EDITOR_CSS_STYLE_ID = "parhelia-editor-css";
|
|
23
|
-
export function PageViewerFrame({ compareView, pageViewContext, className, }) {
|
|
25
|
+
export function PageViewerFrame({ compareView, pageViewContext, className, slotCloseButton, }) {
|
|
24
26
|
const editContext = useEditContext();
|
|
25
27
|
const fieldsContext = useFieldsEditContext();
|
|
28
|
+
useViewportChangeSignal();
|
|
26
29
|
const pathname = usePathname();
|
|
27
30
|
const pageViewContextRef = useRef(undefined);
|
|
28
31
|
if (!editContext || !pageViewContext)
|
|
@@ -35,6 +38,7 @@ export function PageViewerFrame({ compareView, pageViewContext, className, }) {
|
|
|
35
38
|
const iframeRef = useRef(null);
|
|
36
39
|
const currentLoadRef = useRef(null);
|
|
37
40
|
const rebindIframeInteractionsRef = useRef(null);
|
|
41
|
+
const prevModeRef = useRef(editContext.mode);
|
|
38
42
|
const [showSpinner, setShowSpinner] = useState(false);
|
|
39
43
|
const [scroll, setScroll] = useState(0);
|
|
40
44
|
const [showMiniMap, setShowMiniMap] = useState(false);
|
|
@@ -104,6 +108,11 @@ export function PageViewerFrame({ compareView, pageViewContext, className, }) {
|
|
|
104
108
|
leading: true,
|
|
105
109
|
trailing: true,
|
|
106
110
|
});
|
|
111
|
+
const requestPageModelBuild = (doc) => {
|
|
112
|
+
if (!doc)
|
|
113
|
+
return;
|
|
114
|
+
buildPageModelThrottled(doc, editContextRef, pageViewContextRef);
|
|
115
|
+
};
|
|
107
116
|
const [iframeSrc, setIframeSrc] = useState();
|
|
108
117
|
const editorCssGuardRef = useRef({ doc: null, observer: null, editMode: true });
|
|
109
118
|
const ensureEditorCssGuard = (doc, editMode) => {
|
|
@@ -170,11 +179,16 @@ export function PageViewerFrame({ compareView, pageViewContext, className, }) {
|
|
|
170
179
|
editorCssGuardRef.current.doc = null;
|
|
171
180
|
};
|
|
172
181
|
}, []);
|
|
173
|
-
// If the editor mode flips (edit/preview), re-apply CSS in the
|
|
182
|
+
// If the editor mode flips (edit/preview), re-apply CSS and disable inline editing in the iframe.
|
|
174
183
|
useEffect(() => {
|
|
175
184
|
const doc = iframeRef.current?.contentDocument;
|
|
185
|
+
const isPreview = editContext.mode === "preview";
|
|
176
186
|
if (doc)
|
|
177
|
-
ensureEditorCssGuard(doc,
|
|
187
|
+
ensureEditorCssGuard(doc, !isPreview);
|
|
188
|
+
if (isPreview) {
|
|
189
|
+
editContextRef.current?.setSelectedRange(undefined);
|
|
190
|
+
fieldsContextRef.current?.setInlineEditingFieldElement(undefined);
|
|
191
|
+
}
|
|
178
192
|
}, [editContext.mode]);
|
|
179
193
|
useEffect(() => {
|
|
180
194
|
if (!pageItemDescriptor ||
|
|
@@ -184,6 +198,12 @@ export function PageViewerFrame({ compareView, pageViewContext, className, }) {
|
|
|
184
198
|
const urlPath = editContext.mode === "preview"
|
|
185
199
|
? pageViewContext.previewUrl
|
|
186
200
|
: pageViewContext.editUrl;
|
|
201
|
+
const prevMode = prevModeRef.current;
|
|
202
|
+
prevModeRef.current = editContext.mode;
|
|
203
|
+
const modeOnlyChange = prevMode !== editContext.mode &&
|
|
204
|
+
prevMode !== "preview" &&
|
|
205
|
+
editContext.mode !== "preview";
|
|
206
|
+
const savedScrollY = iframeRef.current?.contentWindow?.scrollY ?? 0;
|
|
187
207
|
const renderUrl = new URL(urlPath, window.location.origin);
|
|
188
208
|
const editRev = uuid();
|
|
189
209
|
renderUrl.searchParams.set("edit_rev", editRev);
|
|
@@ -204,6 +224,10 @@ export function PageViewerFrame({ compareView, pageViewContext, className, }) {
|
|
|
204
224
|
const runIntegrationRefresh = (refreshFn, message) => {
|
|
205
225
|
console.log(message);
|
|
206
226
|
refreshFn(renderUrl.toString());
|
|
227
|
+
const doc = iframeRef.current?.contentDocument;
|
|
228
|
+
if (doc) {
|
|
229
|
+
requestPageModelBuild(doc);
|
|
230
|
+
}
|
|
207
231
|
// The integration refresh path may replace/normalize <head> during hydration,
|
|
208
232
|
// which can remove our injected style. Re-ensure a few times post-refresh.
|
|
209
233
|
const ensureLater = (delay) => {
|
|
@@ -218,6 +242,21 @@ export function PageViewerFrame({ compareView, pageViewContext, className, }) {
|
|
|
218
242
|
ensureLater(100);
|
|
219
243
|
ensureLater(500);
|
|
220
244
|
ensureLater(1200);
|
|
245
|
+
if (modeOnlyChange && savedScrollY > 0) {
|
|
246
|
+
const restoreScroll = (delay) => {
|
|
247
|
+
setTimeout(() => {
|
|
248
|
+
const win = iframeRef.current?.contentWindow;
|
|
249
|
+
if (win && win.scrollY === 0) {
|
|
250
|
+
win.scrollTo(0, savedScrollY);
|
|
251
|
+
}
|
|
252
|
+
}, delay);
|
|
253
|
+
};
|
|
254
|
+
restoreScroll(50);
|
|
255
|
+
restoreScroll(200);
|
|
256
|
+
restoreScroll(500);
|
|
257
|
+
restoreScroll(1000);
|
|
258
|
+
restoreScroll(2000);
|
|
259
|
+
}
|
|
221
260
|
};
|
|
222
261
|
const runFallbackRefresh = () => {
|
|
223
262
|
setShowSpinner(true);
|
|
@@ -375,7 +414,7 @@ export function PageViewerFrame({ compareView, pageViewContext, className, }) {
|
|
|
375
414
|
injectSXAScripts(iframeRef.current);
|
|
376
415
|
}, 1000);
|
|
377
416
|
try {
|
|
378
|
-
|
|
417
|
+
requestPageModelBuild(doc);
|
|
379
418
|
}
|
|
380
419
|
catch (buildErr) { }
|
|
381
420
|
}
|
|
@@ -431,95 +470,110 @@ export function PageViewerFrame({ compareView, pageViewContext, className, }) {
|
|
|
431
470
|
}, []);
|
|
432
471
|
const selecionChangeHandler = useDebouncedCallback(() => {
|
|
433
472
|
const sel = iframeRef.current?.contentDocument?.getSelection();
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
if (!
|
|
442
|
-
|
|
443
|
-
const fieldId = fieldElement.getAttribute("data-fieldid");
|
|
444
|
-
if (!fieldId)
|
|
445
|
-
return;
|
|
446
|
-
const range = sel.getRangeAt(0);
|
|
447
|
-
// Guard: if layout components are hidden, do not set focus for fields of layout components
|
|
448
|
-
if (editContextRef.current?.showLayoutComponents === false &&
|
|
449
|
-
pageViewContextRef.current?.page) {
|
|
450
|
-
const ownerId = fieldElement.getAttribute("data-itemid") || "";
|
|
451
|
-
const owner = getComponentById(ownerId, pageViewContextRef.current.page);
|
|
452
|
-
if (owner?.layoutId)
|
|
453
|
-
return;
|
|
473
|
+
const isInlineAiUiFocused = () => {
|
|
474
|
+
const activeEl = document.activeElement;
|
|
475
|
+
return !!(activeEl?.closest(".agent-inline-dialog") ||
|
|
476
|
+
activeEl?.closest(".agent-inline-trigger") ||
|
|
477
|
+
activeEl?.closest('[role="dialog"]'));
|
|
478
|
+
};
|
|
479
|
+
if (!sel || sel.rangeCount === 0) {
|
|
480
|
+
if (!isInlineAiUiFocused()) {
|
|
481
|
+
editContextRef.current?.setSelectedRange(undefined);
|
|
454
482
|
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
// Preserve the last non-collapsed selection while the inline AI UI takes focus.
|
|
486
|
+
// This avoids losing context when users click the trigger or dialog.
|
|
487
|
+
if (sel.isCollapsed && isInlineAiUiFocused()) {
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
// Find the field element containing the selection/caret
|
|
491
|
+
const fieldElement = findClosestFieldElement(sel.anchorNode);
|
|
492
|
+
if (!fieldElement) {
|
|
493
|
+
if (!isInlineAiUiFocused()) {
|
|
494
|
+
editContextRef.current?.setSelectedRange(undefined);
|
|
495
|
+
}
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
const fieldId = fieldElement.getAttribute("data-fieldid");
|
|
499
|
+
if (!fieldId)
|
|
500
|
+
return;
|
|
501
|
+
const range = sel.getRangeAt(0);
|
|
502
|
+
// Guard: if layout components are hidden, do not set focus for fields of layout components
|
|
503
|
+
if (editContextRef.current?.showLayoutComponents === false &&
|
|
504
|
+
pageViewContextRef.current?.page) {
|
|
505
|
+
const ownerId = fieldElement.getAttribute("data-itemid") || "";
|
|
506
|
+
const owner = getComponentById(ownerId, pageViewContextRef.current.page);
|
|
507
|
+
if (owner?.layoutId)
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
// Compute the global offsets relative to the field element.
|
|
511
|
+
const globalStartOffset = getGlobalTextOffset(fieldElement, range.startContainer, range.startOffset);
|
|
512
|
+
const globalEndOffset = getGlobalTextOffset(fieldElement, range.endContainer, range.endOffset);
|
|
513
|
+
const selectedText = range.toString();
|
|
514
|
+
// Extract plain text context from the DOM
|
|
515
|
+
const { contextBefore, contextAfter } = extractDOMSelectionContext(fieldElement, globalStartOffset, globalEndOffset);
|
|
516
|
+
// Clone the range for the replaceText callback (ranges can become invalid after DOM changes)
|
|
517
|
+
const rangeClone = range.cloneRange();
|
|
518
|
+
const itemId = fieldElement.getAttribute("data-itemid") || "";
|
|
519
|
+
const language = fieldElement.getAttribute("data-language") || "";
|
|
520
|
+
const versionStr = fieldElement.getAttribute("data-version");
|
|
521
|
+
const version = versionStr ? parseInt(versionStr, 10) : 0;
|
|
522
|
+
editContextRef.current?.setSelectedRange({
|
|
523
|
+
itemId,
|
|
524
|
+
fieldId: fieldId,
|
|
525
|
+
language,
|
|
526
|
+
version,
|
|
527
|
+
startOffset: globalStartOffset,
|
|
528
|
+
endOffset: globalEndOffset,
|
|
529
|
+
text: selectedText,
|
|
530
|
+
contextBefore,
|
|
531
|
+
contextAfter,
|
|
532
|
+
// Create a callback that uses DOM Range API to replace text in contenteditable
|
|
533
|
+
replaceText: (newText) => {
|
|
534
|
+
try {
|
|
535
|
+
// Delete the selected content (no-op for collapsed ranges)
|
|
536
|
+
rangeClone.deleteContents();
|
|
537
|
+
// Insert the new text - use the correct document from the range containers
|
|
538
|
+
const doc = rangeClone.startContainer.ownerDocument || document;
|
|
539
|
+
const textNode = doc.createTextNode(newText);
|
|
540
|
+
rangeClone.insertNode(textNode);
|
|
541
|
+
// Collapse the range to the end of the inserted text
|
|
542
|
+
rangeClone.setStartAfter(textNode);
|
|
543
|
+
rangeClone.collapse(true);
|
|
544
|
+
// Update the selection
|
|
545
|
+
const iframeSel = iframeRef.current?.contentDocument?.getSelection();
|
|
546
|
+
if (iframeSel) {
|
|
547
|
+
iframeSel.removeAllRanges();
|
|
548
|
+
iframeSel.addRange(rangeClone);
|
|
516
549
|
}
|
|
517
|
-
|
|
518
|
-
|
|
550
|
+
// Explicitly save the field value since the MutationObserver may not be active
|
|
551
|
+
// when text is selected without entering inline edit mode
|
|
552
|
+
const isRichText = fieldElement?.getAttribute("data-is-richtext") === "true";
|
|
553
|
+
const valueToSave = isRichText
|
|
554
|
+
? fieldElement?.innerHTML
|
|
555
|
+
: fieldElement?.innerText;
|
|
556
|
+
if (fieldId &&
|
|
557
|
+
itemId &&
|
|
558
|
+
language &&
|
|
559
|
+
version &&
|
|
560
|
+
editContextRef.current) {
|
|
561
|
+
editContextRef.current.operations.editField({
|
|
562
|
+
field: {
|
|
563
|
+
fieldId,
|
|
564
|
+
fieldName: fieldElement?.getAttribute("data-fieldname") || undefined,
|
|
565
|
+
item: { id: itemId, language, version },
|
|
566
|
+
},
|
|
567
|
+
refresh: "none",
|
|
568
|
+
value: valueToSave,
|
|
569
|
+
});
|
|
519
570
|
}
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
|
|
571
|
+
}
|
|
572
|
+
catch (error) {
|
|
573
|
+
console.error("[PageViewerFrame] Failed to replace text:", error);
|
|
574
|
+
}
|
|
575
|
+
},
|
|
576
|
+
});
|
|
523
577
|
}, 300);
|
|
524
578
|
useEffect(() => {
|
|
525
579
|
const iframe = iframeRef.current;
|
|
@@ -531,6 +585,7 @@ export function PageViewerFrame({ compareView, pageViewContext, className, }) {
|
|
|
531
585
|
let mutationObserver = null;
|
|
532
586
|
const handleIframeMouseDown = async (event) => {
|
|
533
587
|
const target = event.target;
|
|
588
|
+
const targetElement = target;
|
|
534
589
|
if (editContextRef.current?.isRefreshing && showSpinner)
|
|
535
590
|
return;
|
|
536
591
|
// Activate the editor slot this iframe belongs to
|
|
@@ -542,10 +597,21 @@ export function PageViewerFrame({ compareView, pageViewContext, className, }) {
|
|
|
542
597
|
// Skip selection changes on right-click (button 2) - let context menu handler deal with it
|
|
543
598
|
if (event.button === 2)
|
|
544
599
|
return;
|
|
545
|
-
|
|
600
|
+
const fieldElement = targetElement
|
|
601
|
+
? findParentWithAttribute(targetElement, "data-fieldid")
|
|
602
|
+
: null;
|
|
546
603
|
const pageForSelection = pageViewContextRef.current?.page;
|
|
547
|
-
|
|
548
|
-
|
|
604
|
+
const fieldDescriptor = fieldElement?.hasAttribute("data-itemid")
|
|
605
|
+
? getFieldDescriptorFromElement(fieldElement)
|
|
606
|
+
: undefined;
|
|
607
|
+
const componentIdFromField = fieldDescriptor && targetElement && pageForSelection
|
|
608
|
+
? resolveComponentIdForFieldTarget(fieldDescriptor, targetElement, pageForSelection)
|
|
609
|
+
: undefined;
|
|
610
|
+
const rawComponentId = componentIdFromField ??
|
|
611
|
+
(targetElement ? findNearestEditableComponentId(targetElement) : undefined);
|
|
612
|
+
let componentId = rawComponentId;
|
|
613
|
+
if (!componentIdFromField && componentId && pageForSelection) {
|
|
614
|
+
componentId = resolveComponentIdForTarget(componentId, targetElement, pageForSelection);
|
|
549
615
|
}
|
|
550
616
|
// Layout components can still be selected even when showLayoutComponents is false
|
|
551
617
|
// They will be displayed in read-only mode
|
|
@@ -628,7 +694,6 @@ export function PageViewerFrame({ compareView, pageViewContext, className, }) {
|
|
|
628
694
|
((editContextRef.current?.mode === "edit" &&
|
|
629
695
|
pageViewContextRef.current?.page?.item.canWriteItem) ||
|
|
630
696
|
editContextRef.current?.mode === "suggestions")) {
|
|
631
|
-
const fieldElement = findParentWithAttribute(target, "data-fieldid");
|
|
632
697
|
if (fieldElement?.hasAttribute("data-itemid")) {
|
|
633
698
|
// Guard: if layout components are hidden, do not allow editing fields of layout components
|
|
634
699
|
if (editContextRef.current?.showLayoutComponents === false &&
|
|
@@ -641,7 +706,7 @@ export function PageViewerFrame({ compareView, pageViewContext, className, }) {
|
|
|
641
706
|
}
|
|
642
707
|
blockBlurEventRef.current = Date.now() + 500;
|
|
643
708
|
const shouldRequestLock = editContextRef.current?.mode !== "suggestions";
|
|
644
|
-
const hasLock = (await fieldsContextRef.current?.setFocusedField(
|
|
709
|
+
const hasLock = (await fieldsContextRef.current?.setFocusedField(fieldDescriptor, shouldRequestLock)) ?? false;
|
|
645
710
|
if (hasLock &&
|
|
646
711
|
fieldsContextRef.current?.inlineEditingFieldElement !== fieldElement) {
|
|
647
712
|
fieldsContextRef.current?.setInlineEditingFieldElement(fieldElement);
|
|
@@ -707,12 +772,16 @@ export function PageViewerFrame({ compareView, pageViewContext, className, }) {
|
|
|
707
772
|
const isDialog = activeEl?.closest(".agent-inline-dialog") ||
|
|
708
773
|
activeEl?.closest('[role="dialog"]');
|
|
709
774
|
const isTrigger = activeEl?.closest(".agent-inline-trigger");
|
|
710
|
-
// If focus moved to dialog
|
|
711
|
-
if (!isDialog &&
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
fieldsContextRef.current?.setInlineEditingFieldElement(undefined);
|
|
775
|
+
// If focus moved to dialog/trigger (e.g. inline AI), don't force a blur boundary yet.
|
|
776
|
+
if (!isDialog && !isTrigger) {
|
|
777
|
+
// Always mark a field blur operation boundary so consecutive edits do not
|
|
778
|
+
// collapse into a single undo step when a selection range is still present.
|
|
715
779
|
editContextRef.current?.operations.onFieldBlur?.();
|
|
780
|
+
// Keep selection-related state intact, but clear inline editing element
|
|
781
|
+
// when there is no active selectedRange.
|
|
782
|
+
if (!editContextRef.current?.selectedRange) {
|
|
783
|
+
fieldsContextRef.current?.setInlineEditingFieldElement(undefined);
|
|
784
|
+
}
|
|
716
785
|
}
|
|
717
786
|
}, 100);
|
|
718
787
|
}
|
|
@@ -768,7 +837,7 @@ export function PageViewerFrame({ compareView, pageViewContext, className, }) {
|
|
|
768
837
|
"getAttribute" in x.target &&
|
|
769
838
|
x.target.getAttribute("data-fieldid") &&
|
|
770
839
|
x.target.getAttribute("data-itemid")))) {
|
|
771
|
-
|
|
840
|
+
requestPageModelBuild(iframeDocument);
|
|
772
841
|
}
|
|
773
842
|
});
|
|
774
843
|
mutationObserver.observe(iframeDocument, {
|
|
@@ -777,19 +846,126 @@ export function PageViewerFrame({ compareView, pageViewContext, className, }) {
|
|
|
777
846
|
characterData: false, // observe text changes
|
|
778
847
|
//attributes: true, // observe attribute changes (like style or class)
|
|
779
848
|
});
|
|
780
|
-
|
|
849
|
+
requestPageModelBuild(iframeDocument);
|
|
850
|
+
};
|
|
851
|
+
const parsePositiveInt = (value) => {
|
|
852
|
+
if (!value)
|
|
853
|
+
return undefined;
|
|
854
|
+
const parsed = parseInt(value, 10);
|
|
855
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
856
|
+
};
|
|
857
|
+
const resolveLinkedItemDescriptor = (anchor, clickedElement) => {
|
|
858
|
+
const href = anchor.getAttribute("href") || anchor.href;
|
|
859
|
+
let hrefUrl;
|
|
860
|
+
try {
|
|
861
|
+
hrefUrl = new URL(anchor.href, iframe.contentWindow?.location?.href || window.location.href);
|
|
862
|
+
}
|
|
863
|
+
catch {
|
|
864
|
+
return undefined;
|
|
865
|
+
}
|
|
866
|
+
const attributeContainer = clickedElement?.closest("[data-itemid],[data-language],[data-version],[sc_item],[sc_itemid],[sc_lang]") || anchor;
|
|
867
|
+
// Parse Sitecore RTE format first: ~/link.aspx?_id=GUID&_z=z (target item, not the containing component)
|
|
868
|
+
let itemIdRaw;
|
|
869
|
+
if (href.includes("~/link.aspx?_id=") ||
|
|
870
|
+
href.includes("link.aspx?_id=")) {
|
|
871
|
+
const idFromUrl = hrefUrl.searchParams.get("_id");
|
|
872
|
+
if (idFromUrl) {
|
|
873
|
+
// Convert compact GUID (AD973E51E8454BD2B333859375FBBA24) to standard format with dashes
|
|
874
|
+
itemIdRaw = idFromUrl
|
|
875
|
+
.replace(/^(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})$/i, "$1-$2-$3-$4-$5")
|
|
876
|
+
.toLowerCase();
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
if (!itemIdRaw) {
|
|
880
|
+
itemIdRaw =
|
|
881
|
+
hrefUrl.searchParams.get("sc_itemid") ??
|
|
882
|
+
hrefUrl.searchParams.get("itemid") ??
|
|
883
|
+
anchor.getAttribute("data-itemid") ??
|
|
884
|
+
anchor.getAttribute("sc_itemid") ??
|
|
885
|
+
attributeContainer?.getAttribute("data-itemid") ??
|
|
886
|
+
attributeContainer?.getAttribute("sc_itemid") ??
|
|
887
|
+
(anchor.getAttribute("sc_item")
|
|
888
|
+
? extractItemIdFromItemUri(anchor.getAttribute("sc_item"))
|
|
889
|
+
: undefined) ??
|
|
890
|
+
(attributeContainer?.getAttribute("sc_item")
|
|
891
|
+
? extractItemIdFromItemUri(attributeContainer.getAttribute("sc_item"))
|
|
892
|
+
: undefined);
|
|
893
|
+
}
|
|
894
|
+
const itemId = cleanId(itemIdRaw);
|
|
895
|
+
if (!itemId)
|
|
896
|
+
return undefined;
|
|
897
|
+
const language = hrefUrl.searchParams.get("sc_lang") ??
|
|
898
|
+
hrefUrl.searchParams.get("lang") ??
|
|
899
|
+
hrefUrl.searchParams.get("language") ??
|
|
900
|
+
anchor.getAttribute("data-language") ??
|
|
901
|
+
anchor.getAttribute("sc_lang") ??
|
|
902
|
+
attributeContainer?.getAttribute("data-language") ??
|
|
903
|
+
attributeContainer?.getAttribute("sc_lang") ??
|
|
904
|
+
editContextRef.current?.currentItemDescriptor?.language ??
|
|
905
|
+
editContextRef.current?.item?.language;
|
|
906
|
+
if (!language)
|
|
907
|
+
return undefined;
|
|
908
|
+
const version = parsePositiveInt(hrefUrl.searchParams.get("sc_version")) ??
|
|
909
|
+
parsePositiveInt(hrefUrl.searchParams.get("version")) ??
|
|
910
|
+
parsePositiveInt(anchor.getAttribute("data-version")) ??
|
|
911
|
+
parsePositiveInt(attributeContainer?.getAttribute("data-version")) ??
|
|
912
|
+
editContextRef.current?.currentItemDescriptor?.version ??
|
|
913
|
+
editContextRef.current?.item?.version ??
|
|
914
|
+
0;
|
|
915
|
+
return {
|
|
916
|
+
id: itemId,
|
|
917
|
+
language,
|
|
918
|
+
version,
|
|
919
|
+
};
|
|
781
920
|
};
|
|
782
921
|
const handleIframeClick = async (event) => {
|
|
783
922
|
const target = event.target;
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
923
|
+
if (!target)
|
|
924
|
+
return;
|
|
925
|
+
const anchor = target.tagName.toLowerCase() === "a"
|
|
926
|
+
? target
|
|
927
|
+
: target.closest("a");
|
|
928
|
+
if (!anchor)
|
|
929
|
+
return;
|
|
930
|
+
const href = anchor.getAttribute("href") || anchor.href;
|
|
931
|
+
if (!href || href.startsWith("#") || href.startsWith("javascript:")) {
|
|
932
|
+
return;
|
|
933
|
+
}
|
|
934
|
+
const mode = editContextRef.current?.mode;
|
|
935
|
+
const isPreviewOrSuggestions = mode === "preview" || mode === "suggestions";
|
|
936
|
+
if (isPreviewOrSuggestions) {
|
|
937
|
+
let hrefUrl;
|
|
938
|
+
try {
|
|
939
|
+
hrefUrl = new URL(anchor.href, iframe.contentWindow?.location?.href || window.location.href);
|
|
940
|
+
}
|
|
941
|
+
catch {
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
const iframeOrigin = iframe.contentWindow?.location?.origin;
|
|
945
|
+
const isInternalLink = hrefUrl.origin === window.location.origin ||
|
|
946
|
+
(iframeOrigin ? hrefUrl.origin === iframeOrigin : false);
|
|
947
|
+
if (!isInternalLink) {
|
|
790
948
|
event.preventDefault();
|
|
949
|
+
event.stopPropagation();
|
|
950
|
+
window.open(hrefUrl.toString(), "_blank", "noopener,noreferrer");
|
|
951
|
+
return;
|
|
791
952
|
}
|
|
953
|
+
if (isInternalLink) {
|
|
954
|
+
const linkedItem = resolveLinkedItemDescriptor(anchor, target);
|
|
955
|
+
if (linkedItem) {
|
|
956
|
+
event.preventDefault();
|
|
957
|
+
event.stopPropagation();
|
|
958
|
+
await editContextRef.current?.loadItem(linkedItem, {
|
|
959
|
+
openInNewSlot: event.altKey,
|
|
960
|
+
});
|
|
961
|
+
return;
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
// If this link cannot be resolved to an item, allow browser behavior.
|
|
965
|
+
return;
|
|
792
966
|
}
|
|
967
|
+
// In edit mode, keep navigation inside iframe disabled.
|
|
968
|
+
event.preventDefault();
|
|
793
969
|
};
|
|
794
970
|
const handleContextMenu = async (event) => {
|
|
795
971
|
if (editContextRef.current?.isRefreshing && showSpinner)
|
|
@@ -982,9 +1158,7 @@ export function PageViewerFrame({ compareView, pageViewContext, className, }) {
|
|
|
982
1158
|
const deviceHeight = pageViewContext.device === "desktop" || !pageViewContext.deviceHeight
|
|
983
1159
|
? "100%"
|
|
984
1160
|
: pageViewContext.deviceHeight || 640;
|
|
985
|
-
return (_jsxs("div", { className: cn("relative flex h-full w-full flex-col items-center select-none", className, (editContext.
|
|
986
|
-
(editContext.showAgentsPanel && !editContext.currentWizardId)) &&
|
|
987
|
-
"pr-0"), children: [!pageViewContext.fullscreen && (_jsx(EditorWarnings, { item: pageViewContext.page?.item })), pageViewContext.device !== "desktop" && (_jsx(DeviceToolbar, { pageViewContext: pageViewContext, configuration: editContext.configuration })), _jsxs("div", { className: "relative flex flex-1 select-none", "data-testid": "page-viewer-viewport", style: {
|
|
1161
|
+
return (_jsxs("div", { className: cn("relative flex h-full w-full flex-col items-center select-none", className, editContext.showAgentsPanel && !editContext.currentWizardId && "pr-0"), children: [!pageViewContext.fullscreen && (_jsx(EditorWarnings, { item: pageViewContext.page?.item })), slotCloseButton && (_jsx("div", { className: "absolute top-3 right-3 z-50", children: slotCloseButton })), pageViewContext.device !== "desktop" && (_jsx(DeviceToolbar, { pageViewContext: pageViewContext, configuration: editContext.configuration })), _jsxs("div", { className: "relative flex flex-1 select-none", "data-testid": "page-viewer-viewport", style: {
|
|
988
1162
|
width: pageViewContext.device === "desktop" ||
|
|
989
1163
|
pageViewContext.device === "Responsive"
|
|
990
1164
|
? "100%"
|
|
@@ -1000,15 +1174,32 @@ export function PageViewerFrame({ compareView, pageViewContext, className, }) {
|
|
|
1000
1174
|
setTimeout(() => {
|
|
1001
1175
|
injectSXAScripts(iframeRef.current);
|
|
1002
1176
|
}, 1000);
|
|
1003
|
-
|
|
1177
|
+
requestPageModelBuild(doc);
|
|
1004
1178
|
}
|
|
1005
1179
|
} }), iframeRef.current && (_jsx(PageEditorChrome, { iframe: iframeRef.current, compareView: compareView, pageViewContext: pageViewContext })), pageViewContext.deviceHeight && pageViewContext.device && (_jsx("div", { className: "bg-gray-4 relative z-40 h-full w-full" }))] }), !pageViewContext.fullscreen &&
|
|
1006
1180
|
showMiniMap &&
|
|
1007
1181
|
editContext.showMinimap &&
|
|
1008
|
-
editContext.
|
|
1182
|
+
!editContext.isMobile &&
|
|
1183
|
+
editContext.parheliaSettings?.showMinimap !== false && (_jsx(MiniMap, { scroll: scroll, mainViewIframeRef: iframeRef, pageViewContext: pageViewContext, deviceHeight: pageViewContext.device === "Desktop"
|
|
1009
1184
|
? undefined
|
|
1010
1185
|
: pageViewContext.deviceHeight })), showSpinner && (_jsxs(_Fragment, { children: [_jsx("div", { className: "bg-gray-4/50 absolute top-0 left-0 h-full w-full" }), _jsx("div", { className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 transform", children: _jsx(Spinner, {}) })] }))] }), _jsx(FieldActionsOverlay, { ref: fieldActionsOverlay, generatorButtons: contextMenuFieldButtons, onActionClick: handleActionClick, onParameterizedActionExecute: handleParameterizedActionExecute, currentOverlay: editContext?.currentOverlay, fieldId: contextMenuField?.fieldId || "", setCurrentOverlay: editContext?.setCurrentOverlay || (() => { }), preSelectedAction: preSelectedAction, iframe: iframeRef.current })] }));
|
|
1011
1186
|
}
|
|
1187
|
+
/**
|
|
1188
|
+
* In preview mode, disable editing in the iframe: set contentEditable=false on all
|
|
1189
|
+
* editable elements and blur the active element so the caret is removed and typing does nothing.
|
|
1190
|
+
*/
|
|
1191
|
+
function disableEditingInIframeDocument(doc) {
|
|
1192
|
+
if (!doc || !doc.body)
|
|
1193
|
+
return;
|
|
1194
|
+
const editable = doc.querySelectorAll("[contenteditable='true'], [contenteditable='']");
|
|
1195
|
+
editable.forEach((el) => {
|
|
1196
|
+
el.contentEditable = "false";
|
|
1197
|
+
});
|
|
1198
|
+
const active = doc.activeElement;
|
|
1199
|
+
if (active?.isContentEditable) {
|
|
1200
|
+
active.blur();
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1012
1203
|
function injectEditorCSS(iframeDocument, editMode) {
|
|
1013
1204
|
if (!iframeDocument)
|
|
1014
1205
|
return;
|
|
@@ -1045,6 +1236,9 @@ function injectEditorCSS(iframeDocument, editMode) {
|
|
|
1045
1236
|
if (iframeDocument && iframeDocument.head) {
|
|
1046
1237
|
iframeDocument.head.appendChild(style);
|
|
1047
1238
|
}
|
|
1239
|
+
if (!editMode) {
|
|
1240
|
+
disableEditingInIframeDocument(iframeDocument);
|
|
1241
|
+
}
|
|
1048
1242
|
}
|
|
1049
1243
|
function resolveComponentIdForTarget(rawId, target, page) {
|
|
1050
1244
|
const direct = getComponentById(rawId, page);
|
|
@@ -1061,6 +1255,45 @@ function resolveComponentIdForTarget(rawId, target, page) {
|
|
|
1061
1255
|
getElementDepth(a.firstDOMElement || null));
|
|
1062
1256
|
return containing[0].id;
|
|
1063
1257
|
}
|
|
1258
|
+
function resolveComponentIdForFieldTarget(field, target, page) {
|
|
1259
|
+
const matches = findComponentsRenderingField(field, page);
|
|
1260
|
+
const containingMatches = matches.filter((component) => isTargetInsideComponent(target, component));
|
|
1261
|
+
const rankedMatches = (containingMatches.length > 0
|
|
1262
|
+
? containingMatches
|
|
1263
|
+
: matches).sort((a, b) => getElementDepth(b.firstDOMElement || null) -
|
|
1264
|
+
getElementDepth(a.firstDOMElement || null));
|
|
1265
|
+
return rankedMatches[0]?.id;
|
|
1266
|
+
}
|
|
1267
|
+
function findComponentsRenderingField(field, page) {
|
|
1268
|
+
if (!page?.rootComponent)
|
|
1269
|
+
return [];
|
|
1270
|
+
const matches = [];
|
|
1271
|
+
const visit = (component) => {
|
|
1272
|
+
if (componentRendersField(component, field)) {
|
|
1273
|
+
matches.push(component);
|
|
1274
|
+
}
|
|
1275
|
+
for (const placeholder of component.placeholders || []) {
|
|
1276
|
+
for (const child of placeholder.components || []) {
|
|
1277
|
+
visit(child);
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
};
|
|
1281
|
+
visit(page.rootComponent);
|
|
1282
|
+
return matches;
|
|
1283
|
+
}
|
|
1284
|
+
function componentRendersField(component, field) {
|
|
1285
|
+
const renderedItems = [
|
|
1286
|
+
component.datasourceItem,
|
|
1287
|
+
...component.items.filter((item) => !component.datasourceItem ||
|
|
1288
|
+
!(item.id === component.datasourceItem.id &&
|
|
1289
|
+
item.language === component.datasourceItem.language &&
|
|
1290
|
+
item.version === component.datasourceItem.version)),
|
|
1291
|
+
].filter(Boolean);
|
|
1292
|
+
return renderedItems.some((item) => item.id === field.item.id &&
|
|
1293
|
+
item.language === field.item.language &&
|
|
1294
|
+
item.version === field.item.version &&
|
|
1295
|
+
item.renderedFieldIds.includes(field.fieldId));
|
|
1296
|
+
}
|
|
1064
1297
|
function isTargetInsideComponent(target, component) {
|
|
1065
1298
|
const start = component.firstDOMElement;
|
|
1066
1299
|
const end = component.lastDOMElement || component.firstDOMElement;
|