@alpaca-editor/core 1.0.3762-mono
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/.prettierrc +3 -0
- package/dist/client-components/api.js +6 -0
- package/dist/client-components/index.js +36 -0
- package/dist/components/ActionButton.js +9 -0
- package/dist/components/Error.js +28 -0
- package/dist/config/config.js +654 -0
- package/dist/config/types.js +2 -0
- package/dist/editor/ComponentInfo.js +31 -0
- package/dist/editor/ConfirmationDialog.js +32 -0
- package/dist/editor/ContentTree.js +406 -0
- package/dist/editor/ContextMenu.js +117 -0
- package/dist/editor/Editor.js +55 -0
- package/dist/editor/EditorWarning.js +13 -0
- package/dist/editor/EditorWarnings.js +24 -0
- package/dist/editor/FieldEditorPopup.js +24 -0
- package/dist/editor/FieldHistory.js +40 -0
- package/dist/editor/FieldList.js +63 -0
- package/dist/editor/FieldListField.js +164 -0
- package/dist/editor/FieldListFieldWithFallbacks.js +114 -0
- package/dist/editor/FloatingToolbar.js +92 -0
- package/dist/editor/ImageEditor.js +55 -0
- package/dist/editor/InsertMenu.js +164 -0
- package/dist/editor/ItemInfo.js +30 -0
- package/dist/editor/LinkEditorDialog.js +89 -0
- package/dist/editor/MainLayout.js +46 -0
- package/dist/editor/NewEditorClient.js +9 -0
- package/dist/editor/PictureCropper.js +332 -0
- package/dist/editor/PictureEditor.js +104 -0
- package/dist/editor/PictureEditorDialog.js +194 -0
- package/dist/editor/ScrollingContentTree.js +30 -0
- package/dist/editor/Terminal.js +109 -0
- package/dist/editor/Titlebar.js +11 -0
- package/dist/editor/ai/AiPopup.js +25 -0
- package/dist/editor/ai/AiResponseMessage.js +24 -0
- package/dist/editor/ai/AiTerminal.js +241 -0
- package/dist/editor/ai/AiToolCall.js +18 -0
- package/dist/editor/ai/EditorAiTerminal.js +9 -0
- package/dist/editor/ai/editorAiContext.js +14 -0
- package/dist/editor/client/DialogContext.js +29 -0
- package/dist/editor/client/EditorClient.js +1336 -0
- package/dist/editor/client/GenericDialog.js +27 -0
- package/dist/editor/client/editContext.js +59 -0
- package/dist/editor/client/helpers.js +31 -0
- package/dist/editor/client/itemsRepository.js +255 -0
- package/dist/editor/client/operations.js +398 -0
- package/dist/editor/client/pageModelBuilder.js +129 -0
- package/dist/editor/commands/commands.js +2 -0
- package/dist/editor/commands/componentCommands.js +277 -0
- package/dist/editor/commands/createVersionCommand.js +26 -0
- package/dist/editor/commands/deleteVersionCommand.js +55 -0
- package/dist/editor/commands/itemCommands.js +134 -0
- package/dist/editor/commands/localizeItem/LocalizeItemDialog.js +94 -0
- package/dist/editor/commands/undo.js +32 -0
- package/dist/editor/component-designer/ComponentDesigner.js +58 -0
- package/dist/editor/component-designer/ComponentDesignerAiTerminal.js +9 -0
- package/dist/editor/component-designer/ComponentDesignerMenu.js +67 -0
- package/dist/editor/component-designer/ComponentEditor.js +59 -0
- package/dist/editor/component-designer/ComponentRenderingCodeEditor.js +16 -0
- package/dist/editor/component-designer/ComponentRenderingEditor.js +71 -0
- package/dist/editor/component-designer/ComponentsDropdown.js +22 -0
- package/dist/editor/component-designer/PlaceholdersEditor.js +70 -0
- package/dist/editor/component-designer/RenderingsDropdown.js +25 -0
- package/dist/editor/component-designer/TemplateEditor.js +144 -0
- package/dist/editor/component-designer/aiContext.js +18 -0
- package/dist/editor/componentTreeHelper.js +97 -0
- package/dist/editor/control-center/ControlCenterMenu.js +59 -0
- package/dist/editor/control-center/IndexOverview.js +27 -0
- package/dist/editor/control-center/IndexSettings.js +106 -0
- package/dist/editor/control-center/Status.js +7 -0
- package/dist/editor/editor-warnings/ItemLocked.js +40 -0
- package/dist/editor/editor-warnings/NoLanguageWriteAccess.js +16 -0
- package/dist/editor/editor-warnings/NoWorkflowWriteAccess.js +16 -0
- package/dist/editor/editor-warnings/NoWriteAccess.js +14 -0
- package/dist/editor/editor-warnings/ValidationErrors.js +27 -0
- package/dist/editor/field-types/AttachmentEditor.js +7 -0
- package/dist/editor/field-types/CheckboxEditor.js +32 -0
- package/dist/editor/field-types/DropLinkEditor.js +51 -0
- package/dist/editor/field-types/DropListEditor.js +58 -0
- package/dist/editor/field-types/ImageFieldEditor.js +36 -0
- package/dist/editor/field-types/InternalLinkFieldEditor.js +64 -0
- package/dist/editor/field-types/LinkFieldEditor.js +58 -0
- package/dist/editor/field-types/MultiLineText.js +35 -0
- package/dist/editor/field-types/PictureFieldEditor.js +59 -0
- package/dist/editor/field-types/RawEditor.js +33 -0
- package/dist/editor/field-types/ReactQuill.js +366 -0
- package/dist/editor/field-types/RichTextEditor.js +46 -0
- package/dist/editor/field-types/RichTextEditorComponent.js +72 -0
- package/dist/editor/field-types/SingleLineText.js +92 -0
- package/dist/editor/field-types/TreeListEditor.js +137 -0
- package/dist/editor/fieldTypes.js +2 -0
- package/dist/editor/media-selector/AiImageSearch.js +110 -0
- package/dist/editor/media-selector/AiImageSearchPrompt.js +58 -0
- package/dist/editor/media-selector/MediaSelector.js +11 -0
- package/dist/editor/media-selector/Preview.js +9 -0
- package/dist/editor/media-selector/Thumbnails.js +11 -0
- package/dist/editor/media-selector/TreeSelector.js +171 -0
- package/dist/editor/media-selector/UploadZone.js +80 -0
- package/dist/editor/menubar/ActionsMenu.js +33 -0
- package/dist/editor/menubar/ActiveUsers.js +13 -0
- package/dist/editor/menubar/ApproveAndPublish.js +13 -0
- package/dist/editor/menubar/BrowseHistory.js +14 -0
- package/dist/editor/menubar/ItemLanguageVersion.js +36 -0
- package/dist/editor/menubar/LanguageSelector.js +33 -0
- package/dist/editor/menubar/Menu.js +65 -0
- package/dist/editor/menubar/NavButtons.js +43 -0
- package/dist/editor/menubar/PageSelector.js +50 -0
- package/dist/editor/menubar/PageViewerControls.js +37 -0
- package/dist/editor/menubar/Separator.js +8 -0
- package/dist/editor/menubar/SiteInfo.js +26 -0
- package/dist/editor/menubar/User.js +18 -0
- package/dist/editor/menubar/VersionSelector.js +49 -0
- package/dist/editor/page-editor-chrome/CommentHighlighting.js +214 -0
- package/dist/editor/page-editor-chrome/CommentHighlightings.js +17 -0
- package/dist/editor/page-editor-chrome/FieldActionIndicator.js +27 -0
- package/dist/editor/page-editor-chrome/FieldActionIndicators.js +15 -0
- package/dist/editor/page-editor-chrome/FieldEditedIndicator.js +27 -0
- package/dist/editor/page-editor-chrome/FieldEditedIndicators.js +15 -0
- package/dist/editor/page-editor-chrome/FrameMenu.js +178 -0
- package/dist/editor/page-editor-chrome/FrameMenus.js +24 -0
- package/dist/editor/page-editor-chrome/InlineEditor.js +101 -0
- package/dist/editor/page-editor-chrome/LockedFieldIndicator.js +35 -0
- package/dist/editor/page-editor-chrome/NoLayout.js +21 -0
- package/dist/editor/page-editor-chrome/PageEditorChrome.js +65 -0
- package/dist/editor/page-editor-chrome/PictureEditorOverlay.js +109 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +82 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js +147 -0
- package/dist/editor/page-viewer/DeviceToolbar.js +21 -0
- package/dist/editor/page-viewer/EditorForm.js +130 -0
- package/dist/editor/page-viewer/MiniMap.js +257 -0
- package/dist/editor/page-viewer/PageViewer.js +64 -0
- package/dist/editor/page-viewer/PageViewerFrame.js +696 -0
- package/dist/editor/page-viewer/pageViewContext.js +117 -0
- package/dist/editor/pageModel.js +2 -0
- package/dist/editor/picture-shared.js +28 -0
- package/dist/editor/reviews/Comment.js +112 -0
- package/dist/editor/reviews/Comments.js +24 -0
- package/dist/editor/reviews/PreviewInfo.js +13 -0
- package/dist/editor/reviews/Reviews.js +165 -0
- package/dist/editor/reviews/reviewCommands.js +44 -0
- package/dist/editor/reviews/useReviews.js +48 -0
- package/dist/editor/services/aiService.js +99 -0
- package/dist/editor/services/componentDesignerService.js +79 -0
- package/dist/editor/services/contentService.js +104 -0
- package/dist/editor/services/editService.js +322 -0
- package/dist/editor/services/indexService.js +25 -0
- package/dist/editor/services/reviewsService.js +43 -0
- package/dist/editor/services/serviceHelper.js +67 -0
- package/dist/editor/services/systemService.js +7 -0
- package/dist/editor/services/translationService.js +15 -0
- package/dist/editor/services-server/api.js +119 -0
- package/dist/editor/services-server/graphQL.js +56 -0
- package/dist/editor/sidebar/ComponentPalette.js +55 -0
- package/dist/editor/sidebar/ComponentTree.js +362 -0
- package/dist/editor/sidebar/Debug.js +60 -0
- package/dist/editor/sidebar/DictionaryEditor.js +160 -0
- package/dist/editor/sidebar/EditHistory.js +74 -0
- package/dist/editor/sidebar/GraphQL.js +115 -0
- package/dist/editor/sidebar/Insert.js +24 -0
- package/dist/editor/sidebar/MainContentTree.js +52 -0
- package/dist/editor/sidebar/Performance.js +34 -0
- package/dist/editor/sidebar/Sessions.js +31 -0
- package/dist/editor/sidebar/Sidebar.js +15 -0
- package/dist/editor/sidebar/SidebarView.js +76 -0
- package/dist/editor/sidebar/Translations.js +160 -0
- package/dist/editor/sidebar/Validation.js +52 -0
- package/dist/editor/sidebar/ViewSelector.js +15 -0
- package/dist/editor/sidebar/Workbox.js +80 -0
- package/dist/editor/ui/CenteredMessage.js +7 -0
- package/dist/editor/ui/CopyToClipboardButton.js +17 -0
- package/dist/editor/ui/DialogButtons.js +7 -0
- package/dist/editor/ui/Icons.js +75 -0
- package/dist/editor/ui/ItemNameDialog.js +45 -0
- package/dist/editor/ui/ItemNameDialogNew.js +61 -0
- package/dist/editor/ui/ItemSearch.js +93 -0
- package/dist/editor/ui/PerfectTree.js +223 -0
- package/dist/editor/ui/Section.js +12 -0
- package/dist/editor/ui/SimpleIconButton.js +11 -0
- package/dist/editor/ui/SimpleMenu.js +9 -0
- package/dist/editor/ui/SimpleTable.js +11 -0
- package/dist/editor/ui/SimpleTabs.js +21 -0
- package/dist/editor/ui/SimpleToolbar.js +7 -0
- package/dist/editor/ui/Spinner.js +7 -0
- package/dist/editor/ui/Splitter.js +187 -0
- package/dist/editor/ui/StackedPanels.js +69 -0
- package/dist/editor/ui/Toolbar.js +7 -0
- package/dist/editor/utils/id-helper.js +7 -0
- package/dist/editor/utils/insertOptions.js +45 -0
- package/dist/editor/utils/itemutils.js +25 -0
- package/dist/editor/utils/useMemoDebug.js +20 -0
- package/dist/editor/utils.js +328 -0
- package/dist/editor/views/CompareView.js +147 -0
- package/dist/editor/views/EditView.js +17 -0
- package/dist/editor/views/ItemEditor.js +24 -0
- package/dist/editor/views/SingleEditView.js +25 -0
- package/dist/index.js +22 -0
- package/dist/page-wizard/PageWizard.js +62 -0
- package/dist/page-wizard/SelectWizard.js +43 -0
- package/dist/page-wizard/WizardSteps.js +71 -0
- package/dist/page-wizard/service.js +26 -0
- package/dist/page-wizard/startPageWizardCommand.js +23 -0
- package/dist/page-wizard/steps/BuildPageStep.js +138 -0
- package/dist/page-wizard/steps/CollectStep.js +124 -0
- package/dist/page-wizard/steps/ComponentTypesSelector.js +211 -0
- package/dist/page-wizard/steps/Components.js +94 -0
- package/dist/page-wizard/steps/CreatePage.js +142 -0
- package/dist/page-wizard/steps/CreatePageAndLayoutStep.js +230 -0
- package/dist/page-wizard/steps/EditButton.js +7 -0
- package/dist/page-wizard/steps/FieldEditor.js +30 -0
- package/dist/page-wizard/steps/Generate.js +11 -0
- package/dist/page-wizard/steps/ImagesStep.js +159 -0
- package/dist/page-wizard/steps/LayoutStep.js +120 -0
- package/dist/page-wizard/steps/SelectStep.js +150 -0
- package/dist/page-wizard/steps/schema.js +140 -0
- package/dist/page-wizard/steps/usePageCreator.js +194 -0
- package/dist/splash-screen/NewPage.js +131 -0
- package/dist/splash-screen/SectionHeadline.js +9 -0
- package/dist/splash-screen/SplashScreen.js +81 -0
- package/dist/tour/Tour.js +321 -0
- package/dist/tour/default-tour.js +231 -0
- package/dist/tour/preview-tour.js +93 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/types.js +2 -0
- package/eslint.config.mjs +4 -0
- package/images/bg-shape-black.webp +0 -0
- package/package.json +52 -0
- package/src/client-components/api.ts +6 -0
- package/src/client-components/index.ts +19 -0
- package/src/components/ActionButton.tsx +43 -0
- package/src/components/Error.tsx +57 -0
- package/src/config/config.tsx +737 -0
- package/src/config/types.ts +263 -0
- package/src/editor/ComponentInfo.tsx +77 -0
- package/src/editor/ConfirmationDialog.tsx +103 -0
- package/src/editor/ContentTree.tsx +654 -0
- package/src/editor/ContextMenu.tsx +155 -0
- package/src/editor/Editor.tsx +91 -0
- package/src/editor/EditorWarning.tsx +34 -0
- package/src/editor/EditorWarnings.tsx +33 -0
- package/src/editor/FieldEditorPopup.tsx +65 -0
- package/src/editor/FieldHistory.tsx +74 -0
- package/src/editor/FieldList.tsx +190 -0
- package/src/editor/FieldListField.tsx +387 -0
- package/src/editor/FieldListFieldWithFallbacks.tsx +211 -0
- package/src/editor/FloatingToolbar.tsx +163 -0
- package/src/editor/ImageEditor.tsx +129 -0
- package/src/editor/InsertMenu.tsx +332 -0
- package/src/editor/ItemInfo.tsx +90 -0
- package/src/editor/LinkEditorDialog.tsx +192 -0
- package/src/editor/MainLayout.tsx +94 -0
- package/src/editor/NewEditorClient.tsx +11 -0
- package/src/editor/PictureCropper.tsx +505 -0
- package/src/editor/PictureEditor.tsx +206 -0
- package/src/editor/PictureEditorDialog.tsx +381 -0
- package/src/editor/PublishDialog.ignore +74 -0
- package/src/editor/ScrollingContentTree.tsx +47 -0
- package/src/editor/Terminal.tsx +215 -0
- package/src/editor/Titlebar.tsx +23 -0
- package/src/editor/ai/AiPopup.tsx +59 -0
- package/src/editor/ai/AiResponseMessage.tsx +82 -0
- package/src/editor/ai/AiTerminal.tsx +450 -0
- package/src/editor/ai/AiToolCall.tsx +46 -0
- package/src/editor/ai/EditorAiTerminal.tsx +20 -0
- package/src/editor/ai/editorAiContext.ts +18 -0
- package/src/editor/client/DialogContext.tsx +49 -0
- package/src/editor/client/EditorClient.tsx +1831 -0
- package/src/editor/client/GenericDialog.tsx +50 -0
- package/src/editor/client/editContext.ts +330 -0
- package/src/editor/client/helpers.ts +44 -0
- package/src/editor/client/itemsRepository.ts +391 -0
- package/src/editor/client/operations.ts +610 -0
- package/src/editor/client/pageModelBuilder.ts +182 -0
- package/src/editor/commands/commands.ts +23 -0
- package/src/editor/commands/componentCommands.tsx +408 -0
- package/src/editor/commands/createVersionCommand.ts +33 -0
- package/src/editor/commands/deleteVersionCommand.ts +71 -0
- package/src/editor/commands/itemCommands.tsx +186 -0
- package/src/editor/commands/localizeItem/LocalizeItemDialog.tsx +201 -0
- package/src/editor/commands/undo.ts +39 -0
- package/src/editor/component-designer/ComponentDesigner.tsx +70 -0
- package/src/editor/component-designer/ComponentDesignerAiTerminal.tsx +11 -0
- package/src/editor/component-designer/ComponentDesignerMenu.tsx +91 -0
- package/src/editor/component-designer/ComponentEditor.tsx +97 -0
- package/src/editor/component-designer/ComponentRenderingCodeEditor.tsx +31 -0
- package/src/editor/component-designer/ComponentRenderingEditor.tsx +104 -0
- package/src/editor/component-designer/ComponentsDropdown.tsx +39 -0
- package/src/editor/component-designer/PlaceholdersEditor.tsx +183 -0
- package/src/editor/component-designer/RenderingsDropdown.tsx +36 -0
- package/src/editor/component-designer/TemplateEditor.tsx +236 -0
- package/src/editor/component-designer/aiContext.ts +23 -0
- package/src/editor/componentTreeHelper.tsx +114 -0
- package/src/editor/control-center/ControlCenterMenu.tsx +71 -0
- package/src/editor/control-center/IndexOverview.tsx +50 -0
- package/src/editor/control-center/IndexSettings.tsx +266 -0
- package/src/editor/control-center/Status.tsx +7 -0
- package/src/editor/editor-warnings/ItemLocked.tsx +63 -0
- package/src/editor/editor-warnings/NoLanguageWriteAccess.tsx +22 -0
- package/src/editor/editor-warnings/NoWorkflowWriteAccess.tsx +23 -0
- package/src/editor/editor-warnings/NoWriteAccess.tsx +15 -0
- package/src/editor/editor-warnings/ValidationErrors.tsx +54 -0
- package/src/editor/field-types/AttachmentEditor.tsx +9 -0
- package/src/editor/field-types/CheckboxEditor.tsx +47 -0
- package/src/editor/field-types/DropLinkEditor.tsx +75 -0
- package/src/editor/field-types/DropListEditor.tsx +84 -0
- package/src/editor/field-types/ImageFieldEditor.tsx +65 -0
- package/src/editor/field-types/InternalLinkFieldEditor.tsx +112 -0
- package/src/editor/field-types/LinkFieldEditor.tsx +85 -0
- package/src/editor/field-types/MultiLineText.tsx +63 -0
- package/src/editor/field-types/PictureFieldEditor.tsx +121 -0
- package/src/editor/field-types/RawEditor.tsx +53 -0
- package/src/editor/field-types/ReactQuill.tsx +580 -0
- package/src/editor/field-types/RichTextEditor.tsx +22 -0
- package/src/editor/field-types/RichTextEditorComponent.tsx +108 -0
- package/src/editor/field-types/SingleLineText.tsx +150 -0
- package/src/editor/field-types/TreeListEditor.tsx +261 -0
- package/src/editor/fieldTypes.ts +140 -0
- package/src/editor/media-selector/AiImageSearch.tsx +186 -0
- package/src/editor/media-selector/AiImageSearchPrompt.tsx +95 -0
- package/src/editor/media-selector/MediaSelector.tsx +42 -0
- package/src/editor/media-selector/Preview.tsx +14 -0
- package/src/editor/media-selector/Thumbnails.tsx +48 -0
- package/src/editor/media-selector/TreeSelector.tsx +292 -0
- package/src/editor/media-selector/UploadZone.tsx +137 -0
- package/src/editor/menubar/ActionsMenu.tsx +47 -0
- package/src/editor/menubar/ActiveUsers.tsx +17 -0
- package/src/editor/menubar/ApproveAndPublish.tsx +18 -0
- package/src/editor/menubar/BrowseHistory.tsx +37 -0
- package/src/editor/menubar/ItemLanguageVersion.tsx +52 -0
- package/src/editor/menubar/LanguageSelector.tsx +152 -0
- package/src/editor/menubar/Menu.tsx +83 -0
- package/src/editor/menubar/NavButtons.tsx +74 -0
- package/src/editor/menubar/PageSelector.tsx +139 -0
- package/src/editor/menubar/PageViewerControls.tsx +99 -0
- package/src/editor/menubar/Separator.tsx +12 -0
- package/src/editor/menubar/SiteInfo.tsx +53 -0
- package/src/editor/menubar/User.tsx +27 -0
- package/src/editor/menubar/VersionSelector.tsx +143 -0
- package/src/editor/page-editor-chrome/CommentHighlighting.tsx +287 -0
- package/src/editor/page-editor-chrome/CommentHighlightings.tsx +35 -0
- package/src/editor/page-editor-chrome/FieldActionIndicator.tsx +44 -0
- package/src/editor/page-editor-chrome/FieldActionIndicators.tsx +23 -0
- package/src/editor/page-editor-chrome/FieldEditedIndicator.tsx +64 -0
- package/src/editor/page-editor-chrome/FieldEditedIndicators.tsx +35 -0
- package/src/editor/page-editor-chrome/FrameMenu.tsx +263 -0
- package/src/editor/page-editor-chrome/FrameMenus.tsx +48 -0
- package/src/editor/page-editor-chrome/InlineEditor.tsx +147 -0
- package/src/editor/page-editor-chrome/LockedFieldIndicator.tsx +61 -0
- package/src/editor/page-editor-chrome/NoLayout.tsx +36 -0
- package/src/editor/page-editor-chrome/PageEditorChrome.tsx +119 -0
- package/src/editor/page-editor-chrome/PictureEditorOverlay.tsx +154 -0
- package/src/editor/page-editor-chrome/PlaceholderDropZone.tsx +171 -0
- package/src/editor/page-editor-chrome/PlaceholderDropZones.tsx +233 -0
- package/src/editor/page-viewer/DeviceToolbar.tsx +70 -0
- package/src/editor/page-viewer/EditorForm.tsx +247 -0
- package/src/editor/page-viewer/MiniMap.tsx +351 -0
- package/src/editor/page-viewer/PageViewer.tsx +127 -0
- package/src/editor/page-viewer/PageViewerFrame.tsx +1030 -0
- package/src/editor/page-viewer/pageViewContext.ts +186 -0
- package/src/editor/pageModel.ts +191 -0
- package/src/editor/picture-shared.tsx +53 -0
- package/src/editor/reviews/Comment.tsx +265 -0
- package/src/editor/reviews/Comments.tsx +50 -0
- package/src/editor/reviews/PreviewInfo.tsx +35 -0
- package/src/editor/reviews/Reviews.tsx +280 -0
- package/src/editor/reviews/reviewCommands.tsx +47 -0
- package/src/editor/reviews/useReviews.tsx +70 -0
- package/src/editor/services/aiService.ts +155 -0
- package/src/editor/services/componentDesignerService.ts +151 -0
- package/src/editor/services/contentService.ts +159 -0
- package/src/editor/services/editService.ts +462 -0
- package/src/editor/services/indexService.ts +24 -0
- package/src/editor/services/reviewsService.ts +45 -0
- package/src/editor/services/serviceHelper.ts +95 -0
- package/src/editor/services/systemService.ts +5 -0
- package/src/editor/services/translationService.ts +21 -0
- package/src/editor/services-server/api.ts +150 -0
- package/src/editor/services-server/graphQL.ts +106 -0
- package/src/editor/sidebar/ComponentPalette.tsx +146 -0
- package/src/editor/sidebar/ComponentTree.tsx +512 -0
- package/src/editor/sidebar/ComponentTree2.tsxx +490 -0
- package/src/editor/sidebar/Debug.tsx +105 -0
- package/src/editor/sidebar/DictionaryEditor.tsx +261 -0
- package/src/editor/sidebar/EditHistory.tsx +134 -0
- package/src/editor/sidebar/GraphQL.tsx +164 -0
- package/src/editor/sidebar/Insert.tsx +35 -0
- package/src/editor/sidebar/MainContentTree.tsx +95 -0
- package/src/editor/sidebar/Performance.tsx +53 -0
- package/src/editor/sidebar/Sessions.tsx +35 -0
- package/src/editor/sidebar/Sidebar.tsx +20 -0
- package/src/editor/sidebar/SidebarView.tsx +150 -0
- package/src/editor/sidebar/Translations.tsx +276 -0
- package/src/editor/sidebar/Validation.tsx +102 -0
- package/src/editor/sidebar/ViewSelector.tsx +49 -0
- package/src/editor/sidebar/Workbox.tsx +209 -0
- package/src/editor/ui/CenteredMessage.tsx +7 -0
- package/src/editor/ui/CopyToClipboardButton.tsx +23 -0
- package/src/editor/ui/DialogButtons.tsx +11 -0
- package/src/editor/ui/Icons.tsx +585 -0
- package/src/editor/ui/ItemNameDialog.tsx +94 -0
- package/src/editor/ui/ItemNameDialogNew.tsx +118 -0
- package/src/editor/ui/ItemSearch.tsx +173 -0
- package/src/editor/ui/PerfectTree.tsx +550 -0
- package/src/editor/ui/Section.tsx +35 -0
- package/src/editor/ui/SimpleIconButton.tsx +43 -0
- package/src/editor/ui/SimpleMenu.tsx +48 -0
- package/src/editor/ui/SimpleTable.tsx +63 -0
- package/src/editor/ui/SimpleTabs.tsx +55 -0
- package/src/editor/ui/SimpleToolbar.tsx +7 -0
- package/src/editor/ui/Spinner.tsx +7 -0
- package/src/editor/ui/Splitter.tsx +247 -0
- package/src/editor/ui/StackedPanels.tsx +134 -0
- package/src/editor/ui/Toolbar.tsx +7 -0
- package/src/editor/utils/id-helper.ts +3 -0
- package/src/editor/utils/insertOptions.ts +69 -0
- package/src/editor/utils/itemutils.ts +29 -0
- package/src/editor/utils/useMemoDebug.ts +28 -0
- package/src/editor/utils.ts +435 -0
- package/src/editor/views/CompareView.tsx +256 -0
- package/src/editor/views/EditView.tsx +27 -0
- package/src/editor/views/ItemEditor.tsx +58 -0
- package/src/editor/views/SingleEditView.tsx +44 -0
- package/src/fonts/Geist-Black.woff2 +0 -0
- package/src/fonts/Geist-Bold.woff2 +0 -0
- package/src/fonts/Geist-ExtraBold.woff2 +0 -0
- package/src/fonts/Geist-ExtraLight.woff2 +0 -0
- package/src/fonts/Geist-Light.woff2 +0 -0
- package/src/fonts/Geist-Medium.woff2 +0 -0
- package/src/fonts/Geist-Regular.woff2 +0 -0
- package/src/fonts/Geist-SemiBold.woff2 +0 -0
- package/src/fonts/Geist-Thin.woff2 +0 -0
- package/src/fonts/Geist[wght].woff2 +0 -0
- package/src/index.ts +7 -0
- package/src/page-wizard/PageWizard.tsx +163 -0
- package/src/page-wizard/SelectWizard.tsx +109 -0
- package/src/page-wizard/WizardSteps.tsx +207 -0
- package/src/page-wizard/service.ts +35 -0
- package/src/page-wizard/startPageWizardCommand.ts +27 -0
- package/src/page-wizard/steps/BuildPageStep.tsx +266 -0
- package/src/page-wizard/steps/CollectStep.tsx +233 -0
- package/src/page-wizard/steps/ComponentTypesSelector.tsx +443 -0
- package/src/page-wizard/steps/Components.tsx +193 -0
- package/src/page-wizard/steps/CreatePage.tsx +285 -0
- package/src/page-wizard/steps/CreatePageAndLayoutStep.tsx +384 -0
- package/src/page-wizard/steps/EditButton.tsx +34 -0
- package/src/page-wizard/steps/FieldEditor.tsx +102 -0
- package/src/page-wizard/steps/Generate.tsx +32 -0
- package/src/page-wizard/steps/ImagesStep.tsx +318 -0
- package/src/page-wizard/steps/LayoutStep.tsx +228 -0
- package/src/page-wizard/steps/SelectStep.tsx +256 -0
- package/src/page-wizard/steps/schema.ts +180 -0
- package/src/page-wizard/steps/usePageCreator.ts +279 -0
- package/src/splash-screen/NewPage.tsx +232 -0
- package/src/splash-screen/SectionHeadline.tsx +21 -0
- package/src/splash-screen/SplashScreen.tsx +156 -0
- package/src/tour/Tour.tsx +558 -0
- package/src/tour/default-tour.tsx +300 -0
- package/src/tour/preview-tour.tsx +127 -0
- package/src/types.ts +302 -0
- package/styles.css +476 -0
- package/tsconfig.build.json +21 -0
- package/tsconfig.json +11 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ControlCenterMenu = ControlCenterMenu;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const navigation_1 = require("next/navigation");
|
|
6
|
+
const navigation_2 = require("next/navigation");
|
|
7
|
+
const editContext_1 = require("../client/editContext");
|
|
8
|
+
const SimpleMenu_1 = require("../ui/SimpleMenu");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
function ControlCenterMenu() {
|
|
11
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
12
|
+
const config = editContext?.configuration;
|
|
13
|
+
const searchParams = (0, navigation_2.useSearchParams)();
|
|
14
|
+
const urlActiveItemKey = searchParams.get("ccpanel");
|
|
15
|
+
const [activeItemKey, setActiveItemKey] = (0, react_1.useState)(urlActiveItemKey);
|
|
16
|
+
const router = (0, navigation_1.useRouter)();
|
|
17
|
+
const pathname = (0, navigation_2.usePathname)();
|
|
18
|
+
const updateUrl = (key) => {
|
|
19
|
+
if (urlActiveItemKey === key)
|
|
20
|
+
return;
|
|
21
|
+
const current = new URLSearchParams(Array.from(searchParams.entries()));
|
|
22
|
+
if (key) {
|
|
23
|
+
current.set("ccpanel", key);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
current.delete("ccpanel");
|
|
27
|
+
}
|
|
28
|
+
router.push(`${pathname}?${current.toString()}`, { scroll: false });
|
|
29
|
+
};
|
|
30
|
+
(0, react_1.useEffect)(() => {
|
|
31
|
+
updateUrl(activeItemKey);
|
|
32
|
+
}, [activeItemKey]);
|
|
33
|
+
const items = config?.controlCenter.groups.map((group) => {
|
|
34
|
+
return {
|
|
35
|
+
key: group.title,
|
|
36
|
+
label: group.title,
|
|
37
|
+
icon: group.icon,
|
|
38
|
+
items: group.panels.map((panel) => ({
|
|
39
|
+
key: panel.id,
|
|
40
|
+
label: panel.title,
|
|
41
|
+
})) || [],
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
(0, react_1.useEffect)(() => {
|
|
45
|
+
const groups = config?.controlCenter.groups;
|
|
46
|
+
const item = groups
|
|
47
|
+
?.flatMap((x) => x.panels)
|
|
48
|
+
?.find((item) => item.id === activeItemKey);
|
|
49
|
+
if (item) {
|
|
50
|
+
editContext?.setCenterPanelView(item.content);
|
|
51
|
+
}
|
|
52
|
+
}, [activeItemKey]);
|
|
53
|
+
if (!items) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)(SimpleMenu_1.SimpleMenu, { items: items, activeItemKey: activeItemKey, onItemClick: (item) => {
|
|
57
|
+
setActiveItemKey(item.key);
|
|
58
|
+
} }));
|
|
59
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IndexOverview = IndexOverview;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_2 = require("react");
|
|
7
|
+
const indexService_1 = require("../services/indexService");
|
|
8
|
+
const IndexSettings_1 = require("./IndexSettings");
|
|
9
|
+
const utils_1 = require("primereact/utils");
|
|
10
|
+
function IndexOverview() {
|
|
11
|
+
const [indexes, setIndexes] = (0, react_2.useState)(undefined);
|
|
12
|
+
const [selectedIndex, setSelectedIndex] = (0, react_2.useState)(undefined);
|
|
13
|
+
(0, react_1.useEffect)(() => {
|
|
14
|
+
async function loadIndexes() {
|
|
15
|
+
const indexes = await (0, indexService_1.getIndexes)();
|
|
16
|
+
if (indexes.indexOf("master") === -1) {
|
|
17
|
+
indexes.push("master");
|
|
18
|
+
}
|
|
19
|
+
if (indexes.indexOf("media") === -1) {
|
|
20
|
+
indexes.push("media");
|
|
21
|
+
}
|
|
22
|
+
setIndexes(indexes);
|
|
23
|
+
}
|
|
24
|
+
loadIndexes();
|
|
25
|
+
}, []);
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-stretch h-full", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-2 border-r border-gray-200", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center p-2 min-w-40 border-b border-gray-200", children: "Index" }), indexes?.map((index) => ((0, jsx_runtime_1.jsx)("div", { onClick: () => setSelectedIndex(index), className: (0, utils_1.classNames)("cursor-pointer p-2 px-6 hover:bg-gray-100 text-sm", selectedIndex === index && "bg-gray-100"), children: index }, index)))] }), (0, jsx_runtime_1.jsx)("div", { className: "flex-1 p-2", children: selectedIndex && (0, jsx_runtime_1.jsx)(IndexSettings_1.IndexSettings, { index: { name: selectedIndex } }) })] }));
|
|
27
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IndexSettings = IndexSettings;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const indexService_1 = require("../services/indexService");
|
|
7
|
+
const button_1 = require("primereact/button");
|
|
8
|
+
const Spinner_1 = require("../ui/Spinner");
|
|
9
|
+
const editContext_1 = require("../client/editContext");
|
|
10
|
+
const progressspinner_1 = require("primereact/progressspinner");
|
|
11
|
+
function IndexSettings({ index }) {
|
|
12
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
13
|
+
const [indexStatus, setIndexStatus] = (0, react_1.useState)(undefined);
|
|
14
|
+
const [settingsItem, setSettingsItem] = (0, react_1.useState)(undefined);
|
|
15
|
+
const [rebuildJobItem, setRebuildJobItem] = (0, react_1.useState)(undefined);
|
|
16
|
+
const fetchStatus = (0, react_1.useCallback)(() => {
|
|
17
|
+
(0, indexService_1.getIndexStatus)(index.name).then(async (result) => {
|
|
18
|
+
setIndexStatus(result);
|
|
19
|
+
if (result?.settingsItemId) {
|
|
20
|
+
const settingsItem = await editContext?.itemsRepository.getItem({
|
|
21
|
+
id: result.settingsItemId,
|
|
22
|
+
language: "en",
|
|
23
|
+
version: 0,
|
|
24
|
+
});
|
|
25
|
+
setSettingsItem(settingsItem);
|
|
26
|
+
if (result.rebuildJobItemId) {
|
|
27
|
+
const rebuildJobItem = await editContext?.itemsRepository.getItem({
|
|
28
|
+
id: result.rebuildJobItemId,
|
|
29
|
+
language: "en",
|
|
30
|
+
version: 0,
|
|
31
|
+
});
|
|
32
|
+
setRebuildJobItem(rebuildJobItem);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
setRebuildJobItem(undefined);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
setSettingsItem(undefined);
|
|
40
|
+
setRebuildJobItem(undefined);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}, [index]);
|
|
44
|
+
(0, react_1.useEffect)(() => {
|
|
45
|
+
let interval;
|
|
46
|
+
if (indexStatus?.isRunning) {
|
|
47
|
+
interval = setInterval(() => {
|
|
48
|
+
fetchStatus();
|
|
49
|
+
}, 1000);
|
|
50
|
+
}
|
|
51
|
+
return () => {
|
|
52
|
+
if (interval) {
|
|
53
|
+
clearInterval(interval);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}, [indexStatus?.isRunning, fetchStatus]);
|
|
57
|
+
(0, react_1.useEffect)(() => {
|
|
58
|
+
fetchStatus();
|
|
59
|
+
}, [fetchStatus]);
|
|
60
|
+
(0, react_1.useEffect)(() => {
|
|
61
|
+
setIndexStatus(undefined);
|
|
62
|
+
}, [index]);
|
|
63
|
+
if (!indexStatus) {
|
|
64
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col h-full justify-center items-center gap-2 text-gray-500", children: [(0, jsx_runtime_1.jsx)(Spinner_1.Spinner, {}), "Loading..."] }));
|
|
65
|
+
}
|
|
66
|
+
async function setupIndexAndRefresh(index) {
|
|
67
|
+
await (0, indexService_1.setupIndex)(index);
|
|
68
|
+
setIndexStatus(undefined);
|
|
69
|
+
fetchStatus();
|
|
70
|
+
}
|
|
71
|
+
async function setupRebuildJobAndRefresh(index) {
|
|
72
|
+
await (0, indexService_1.setupRebuildJob)(index);
|
|
73
|
+
setIndexStatus(undefined);
|
|
74
|
+
fetchStatus();
|
|
75
|
+
}
|
|
76
|
+
async function rebuildIndexAndRefresh(index) {
|
|
77
|
+
await (0, indexService_1.rebuildIndex)(index);
|
|
78
|
+
setTimeout(() => {
|
|
79
|
+
fetchStatus();
|
|
80
|
+
}, 1000);
|
|
81
|
+
}
|
|
82
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col px-2 py-1 h-full", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex flex-row items-center border-b p-1 mb-3", children: (0, jsx_runtime_1.jsx)("div", { className: "", children: index.name }) }), (0, jsx_runtime_1.jsxs)("div", { className: "ml-2", children: [settingsItem && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(IndexProp, { headline: "Settings", children: (0, jsx_runtime_1.jsx)("a", { className: "cursor-pointer underline", onClick: () => {
|
|
83
|
+
if (indexStatus.settingsItemId) {
|
|
84
|
+
editContext?.loadItem(indexStatus.settingsItemId);
|
|
85
|
+
editContext?.switchView("content-editor");
|
|
86
|
+
}
|
|
87
|
+
}, children: settingsItem.path }) }), (0, jsx_runtime_1.jsx)(IndexProp, { headline: "Service", children: indexStatus.serviceUrl }), (0, jsx_runtime_1.jsx)(IndexProp, { headline: "Name", children: indexStatus.name }), (0, jsx_runtime_1.jsxs)(IndexProp, { headline: "Rebuild Job", children: [rebuildJobItem && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("a", { className: "cursor-pointer underline", onClick: () => {
|
|
88
|
+
if (indexStatus.rebuildJobItemId) {
|
|
89
|
+
editContext?.loadItem(indexStatus.rebuildJobItemId);
|
|
90
|
+
editContext?.switchView("content-editor");
|
|
91
|
+
}
|
|
92
|
+
}, children: rebuildJobItem.path }), indexStatus.canRebuild && !indexStatus.isRunning && ((0, jsx_runtime_1.jsx)("div", { className: "my-2", children: (0, jsx_runtime_1.jsx)(button_1.Button, { label: "Rebuild Index", onClick: () => {
|
|
93
|
+
rebuildIndexAndRefresh(index.name);
|
|
94
|
+
} }) })), indexStatus.isRunning && ((0, jsx_runtime_1.jsxs)("div", { className: "my-2 flex flex-row items-center justify-start", children: [(0, jsx_runtime_1.jsxs)("div", { className: "mr-2", style: { width: "20px" }, children: [(0, jsx_runtime_1.jsx)(progressspinner_1.ProgressSpinner, { style: { width: "20px", height: "20px" } }), " "] }), "Rebuilding... ", indexStatus.rebuildCount.toLocaleString(), " ", "items, ", indexStatus.rebuildTokensCount.toLocaleString(), " ", "tokens"] }))] })), !rebuildJobItem && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-sm text-gray-500 mb-2", children: "No rebuild job found for this index" }), (0, jsx_runtime_1.jsx)(button_1.Button, { label: "Setup Rebuild Job", onClick: () => {
|
|
95
|
+
setupRebuildJobAndRefresh(index.name);
|
|
96
|
+
} })] }))] }), (0, jsx_runtime_1.jsx)(IndexProp, { headline: "Last Rebuild", children: indexStatus.lastRebuildStartDateTime
|
|
97
|
+
? new Date(indexStatus.lastRebuildStartDateTime).toLocaleString()
|
|
98
|
+
: "Never" }), indexStatus.exists && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(IndexProp, { headline: "Index Status", children: Object.entries(indexStatus.languages).map(([language, { numberOfItems, lastUpdated, status }]) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [(0, jsx_runtime_1.jsxs)("div", { className: "font-bold", children: [language, ":"] }), (0, jsx_runtime_1.jsx)("span", { className: `text-gray-500 ml-2 ${status === "Available"
|
|
99
|
+
? "text-green-500"
|
|
100
|
+
: "text-yellow-500"}`, children: status }), (0, jsx_runtime_1.jsxs)("span", { className: "text-gray-500", children: ["Items: ", numberOfItems.toLocaleString(), " "] }), (0, jsx_runtime_1.jsxs)("span", { className: "text-gray-500", children: ["Last updated: ", new Date(lastUpdated).toLocaleString()] })] }, language))) }) })), indexStatus.errors?.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { children: "Errors:" }), indexStatus.errors.map((error, index) => ((0, jsx_runtime_1.jsxs)("div", { className: "mt-2 p-2 bg-red-100 rounded-md text-red-800 border border-red-300 ", children: [(0, jsx_runtime_1.jsx)("div", { className: "font-bold", children: error.message }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm", children: error.details })] }, index)))] }))] })), !indexStatus?.exists && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-sm text-gray-500 mb-2", children: "Index does not exist" }), (0, jsx_runtime_1.jsx)(button_1.Button, { label: "Setup index", onClick: () => {
|
|
101
|
+
setupIndexAndRefresh(index.name);
|
|
102
|
+
} })] })), " "] })] }));
|
|
103
|
+
}
|
|
104
|
+
function IndexProp({ headline, children, }) {
|
|
105
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "mb-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "font-bold text-sm", children: headline }), (0, jsx_runtime_1.jsx)("div", { className: "text-sm", children: children })] }));
|
|
106
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Status = Status;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
function Status() {
|
|
6
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "flex flex-col justify-center items-center h-full", children: "Status" }));
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ItemLocked = ItemLocked;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const EditorWarning_1 = require("../EditorWarning");
|
|
6
|
+
const editContext_1 = require("../client/editContext");
|
|
7
|
+
function ItemLocked({ item }) {
|
|
8
|
+
if (!item.canLock)
|
|
9
|
+
return;
|
|
10
|
+
var editContext = (0, editContext_1.useEditContext)();
|
|
11
|
+
if (!editContext)
|
|
12
|
+
return;
|
|
13
|
+
if (item.hasLock) {
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)(EditorWarning_1.EditorWarning, { title: "Item locked", severity: "warning", children: (0, jsx_runtime_1.jsx)("button", { onClick: () => {
|
|
15
|
+
const items = [item];
|
|
16
|
+
editContext.operations.unlockItems(items);
|
|
17
|
+
}, children: "Release lock" }) }));
|
|
18
|
+
}
|
|
19
|
+
if (item.lockedBy == null) {
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(EditorWarning_1.EditorWarning, { title: "Item is locked", severity: "warning", children: (0, jsx_runtime_1.jsxs)("div", { children: ["Locked by ", item.lockedBy] }) }));
|
|
21
|
+
}
|
|
22
|
+
// else {
|
|
23
|
+
// return (
|
|
24
|
+
// <EditorWarning title="Item not locked" severity="warning">
|
|
25
|
+
// {item.canLock && (
|
|
26
|
+
// <button
|
|
27
|
+
// onClick={() => {
|
|
28
|
+
// const items: ItemDescriptor[] = [item];
|
|
29
|
+
// if ((item as ComponentData).linkedComponentItem)
|
|
30
|
+
// items.push((item as ComponentData).linkedComponentItem);
|
|
31
|
+
// editContext!.lockItems(items);
|
|
32
|
+
// }}
|
|
33
|
+
// >
|
|
34
|
+
// Lock item
|
|
35
|
+
// </button>
|
|
36
|
+
// )}
|
|
37
|
+
// </EditorWarning>
|
|
38
|
+
// );
|
|
39
|
+
// }
|
|
40
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoWriteLanguageAccess = NoWriteLanguageAccess;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const EditorWarning_1 = require("../EditorWarning");
|
|
6
|
+
const editContext_1 = require("../client/editContext");
|
|
7
|
+
function NoWriteLanguageAccess({ item }) {
|
|
8
|
+
var editContext = (0, editContext_1.useEditContext)();
|
|
9
|
+
if (!editContext)
|
|
10
|
+
return;
|
|
11
|
+
if (!item.canWriteItem)
|
|
12
|
+
return;
|
|
13
|
+
if (!item.canWriteLanguage) {
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)(EditorWarning_1.EditorWarning, { title: "You dont have language write access.", severity: "warning", children: (0, jsx_runtime_1.jsxs)("p", { children: ["You can't edit this item because you don't have write access for language ", editContext.page?.item.language, "."] }) }));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoWorkflowWriteAccess = NoWorkflowWriteAccess;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const EditorWarning_1 = require("../EditorWarning");
|
|
6
|
+
const editContext_1 = require("../client/editContext");
|
|
7
|
+
function NoWorkflowWriteAccess({ item }) {
|
|
8
|
+
var editContext = (0, editContext_1.useEditContext)();
|
|
9
|
+
if (!editContext)
|
|
10
|
+
return;
|
|
11
|
+
if (!item.canWriteItem || !item.canWriteLanguage)
|
|
12
|
+
return;
|
|
13
|
+
if (!item.canWriteWorkflow) {
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)(EditorWarning_1.EditorWarning, { title: "You dont have write access in the current workflow state.", severity: "warning", children: (0, jsx_runtime_1.jsxs)("p", { children: ["The item is in the workflow state", " ", (0, jsx_runtime_1.jsx)("span", { className: "font-bold", children: item.workflowState }), " which prevents you from editing."] }) }));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoWriteAccess = NoWriteAccess;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const EditorWarning_1 = require("../EditorWarning");
|
|
6
|
+
const editContext_1 = require("../client/editContext");
|
|
7
|
+
function NoWriteAccess({ item }) {
|
|
8
|
+
var editContext = (0, editContext_1.useEditContext)();
|
|
9
|
+
if (!editContext)
|
|
10
|
+
return;
|
|
11
|
+
if (!item.canWriteItem) {
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(EditorWarning_1.EditorWarning, { title: "You dont have write access.", severity: "warning", children: (0, jsx_runtime_1.jsx)("p", { children: "You can't edit this item because you don't have write access." }) }));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidationErrors = ValidationErrors;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const EditorWarning_1 = require("../EditorWarning");
|
|
6
|
+
function ValidationErrors({ item, editContext }) {
|
|
7
|
+
let validationResult = editContext.validationResult
|
|
8
|
+
?.find((x) => x.item.id === item.id &&
|
|
9
|
+
x.item.language === item.language &&
|
|
10
|
+
x.item.version === item.version)
|
|
11
|
+
?.results.filter((x) => x.itemId === item.id);
|
|
12
|
+
if (!validationResult) {
|
|
13
|
+
const pageResult = editContext.validationResult?.find((x) => x.item.id === editContext?.page?.item.id);
|
|
14
|
+
if (pageResult)
|
|
15
|
+
validationResult = pageResult.results.filter((x) => x.itemId === item.id);
|
|
16
|
+
}
|
|
17
|
+
if (!validationResult?.length)
|
|
18
|
+
return null;
|
|
19
|
+
const fields = validationResult?.filter((x) => x.fieldId);
|
|
20
|
+
return ((0, jsx_runtime_1.jsxs)(EditorWarning_1.EditorWarning, { title: "Validation", severity: "warning", children: [validationResult
|
|
21
|
+
?.filter((x) => !x.fieldId)
|
|
22
|
+
.map((x) => ((0, jsx_runtime_1.jsx)("div", { children: x.message }, x.validator))), fields?.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { children: ["The following fields have validation messages:", " ", fields.map((x) => ((0, jsx_runtime_1.jsx)("span", { className: "cursor-pointer font-bold", onClick: () => {
|
|
23
|
+
const field = Object.values(item.fields).find((f) => f.id === x.fieldId);
|
|
24
|
+
if (field)
|
|
25
|
+
editContext.setFocusedField(field.descriptor, false);
|
|
26
|
+
}, children: x.fieldName }, x.validator + x.fieldId)))] }))] }));
|
|
27
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AttachmentEditor = AttachmentEditor;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
function AttachmentEditor({ field }) {
|
|
6
|
+
return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("img", { src: field.value.src }) }));
|
|
7
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CheckboxEditor = CheckboxEditor;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const editContext_1 = require("../client/editContext");
|
|
7
|
+
const checkbox_1 = require("primereact/checkbox");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const progressspinner_1 = require("primereact/progressspinner");
|
|
10
|
+
function CheckboxEditor({ field, readOnly, }) {
|
|
11
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
12
|
+
const [isUpdating, setIsUpdating] = (0, react_1.useState)(false);
|
|
13
|
+
(0, react_1.useEffect)(() => {
|
|
14
|
+
setIsUpdating(false);
|
|
15
|
+
}, [field]);
|
|
16
|
+
if (!editContext)
|
|
17
|
+
return;
|
|
18
|
+
const fieldItem = field.descriptor.item;
|
|
19
|
+
if (!fieldItem)
|
|
20
|
+
return;
|
|
21
|
+
if (isUpdating) {
|
|
22
|
+
return (0, jsx_runtime_1.jsx)(progressspinner_1.ProgressSpinner, { style: { width: "18px", height: "18px" } });
|
|
23
|
+
}
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(checkbox_1.Checkbox, { checked: field.value, disabled: readOnly, onClick: () => {
|
|
25
|
+
setIsUpdating(true);
|
|
26
|
+
editContext.operations.editField({
|
|
27
|
+
field: field.descriptor,
|
|
28
|
+
rawValue: field.value ? "0" : "1",
|
|
29
|
+
refresh: "immediate",
|
|
30
|
+
});
|
|
31
|
+
} }, fieldItem.id + field.id + fieldItem.language + fieldItem.version));
|
|
32
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.DropLinkEditor = DropLinkEditor;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const dropdown_1 = require("primereact/dropdown");
|
|
7
|
+
const editContext_1 = require("../client/editContext");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const editService_1 = require("../services/editService");
|
|
10
|
+
const utils_1 = require("../utils");
|
|
11
|
+
function DropLinkEditor({ field, readOnly, }) {
|
|
12
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
13
|
+
const [lazyItems, setLazyItems] = (0, react_1.useState)([]);
|
|
14
|
+
const [lazyLoading, setLazyLoading] = (0, react_1.useState)(true);
|
|
15
|
+
if (!field)
|
|
16
|
+
return;
|
|
17
|
+
if (!editContext)
|
|
18
|
+
return;
|
|
19
|
+
(0, react_1.useEffect)(() => {
|
|
20
|
+
onLazyLoad();
|
|
21
|
+
}, [field.descriptor]);
|
|
22
|
+
const onLazyLoad = async () => {
|
|
23
|
+
setLazyLoading(true);
|
|
24
|
+
const options = await (0, editService_1.getLookupSources)(field, editContext.sessionId);
|
|
25
|
+
setLazyItems(options);
|
|
26
|
+
setLazyLoading(false);
|
|
27
|
+
};
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)(dropdown_1.Dropdown, { value: field.value?.targetItemId, disabled: readOnly, onChange: (e) => {
|
|
29
|
+
editContext?.operations.editField({
|
|
30
|
+
field: field.descriptor,
|
|
31
|
+
rawValue: (0, utils_1.normalizeGuid)(e.value), // typeof e.value === "string" ? e.value : e.value.id, // This has changed in primereact
|
|
32
|
+
});
|
|
33
|
+
}, options: lazyItems, optionLabel: "name", optionValue: "id", placeholder: "Select", className: "w-full md:w-14rem", virtualScrollerOptions: {
|
|
34
|
+
lazy: true,
|
|
35
|
+
onLazyLoad: onLazyLoad,
|
|
36
|
+
itemSize: 38,
|
|
37
|
+
// showLoader: true,
|
|
38
|
+
loading: lazyLoading,
|
|
39
|
+
//delay: 250,
|
|
40
|
+
// loadingTemplate: (options) => {
|
|
41
|
+
// return (
|
|
42
|
+
// <div
|
|
43
|
+
// className="flex align-items-center p-2"
|
|
44
|
+
// style={{ height: "38px" }}
|
|
45
|
+
// >
|
|
46
|
+
// <Skeleton width={options.even ? "60%" : "50%"} height="1rem" />
|
|
47
|
+
// </div>
|
|
48
|
+
// );
|
|
49
|
+
// },
|
|
50
|
+
} }));
|
|
51
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.DropListEditor = DropListEditor;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const dropdown_1 = require("primereact/dropdown");
|
|
7
|
+
const editContext_1 = require("../client/editContext");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const editService_1 = require("../services/editService");
|
|
10
|
+
function DropListEditor({ field, readOnly, }) {
|
|
11
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
12
|
+
const [lazyItems, setLazyItems] = (0, react_1.useState)([]);
|
|
13
|
+
const [lazyLoading, setLazyLoading] = (0, react_1.useState)(true);
|
|
14
|
+
if (!field)
|
|
15
|
+
return;
|
|
16
|
+
if (!editContext)
|
|
17
|
+
return;
|
|
18
|
+
(0, react_1.useEffect)(() => {
|
|
19
|
+
onLazyLoad();
|
|
20
|
+
}, [field.descriptor]);
|
|
21
|
+
const onLazyLoad = async () => {
|
|
22
|
+
setLazyLoading(true);
|
|
23
|
+
const options = await (0, editService_1.getLookupSources)(field, editContext.sessionId);
|
|
24
|
+
if (field.value && !options.find((o) => o.name === field.value)) {
|
|
25
|
+
console.log("Adding unknown option", field.value);
|
|
26
|
+
options.unshift({
|
|
27
|
+
id: "unknown",
|
|
28
|
+
name: `[Unknown: ${field.value}]`,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
setLazyItems(options);
|
|
32
|
+
setLazyLoading(false);
|
|
33
|
+
};
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(dropdown_1.Dropdown, { value: lazyItems.find((o) => o.name === field.value)?.name ||
|
|
35
|
+
"[Unknown: " + field.value + "]", disabled: readOnly, onChange: (e) => {
|
|
36
|
+
editContext?.operations.editField({
|
|
37
|
+
field: field.descriptor,
|
|
38
|
+
rawValue: e.value,
|
|
39
|
+
});
|
|
40
|
+
}, options: lazyItems, optionLabel: "name", optionValue: "name", placeholder: "Select", className: "w-full md:w-14rem", virtualScrollerOptions: {
|
|
41
|
+
lazy: true,
|
|
42
|
+
onLazyLoad: onLazyLoad,
|
|
43
|
+
itemSize: 38,
|
|
44
|
+
// showLoader: true,
|
|
45
|
+
loading: lazyLoading,
|
|
46
|
+
//delay: 250,
|
|
47
|
+
// loadingTemplate: (options) => {
|
|
48
|
+
// return (
|
|
49
|
+
// <div
|
|
50
|
+
// className="flex align-items-center p-2"
|
|
51
|
+
// style={{ height: "38px" }}
|
|
52
|
+
// >
|
|
53
|
+
// <Skeleton width={options.even ? "60%" : "50%"} height="1rem" />
|
|
54
|
+
// </div>
|
|
55
|
+
// );
|
|
56
|
+
// },
|
|
57
|
+
} }));
|
|
58
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ImageFieldEditor = ImageFieldEditor;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const editContext_1 = require("../client/editContext");
|
|
7
|
+
const inputtext_1 = require("primereact/inputtext");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const ImageEditor_1 = require("../ImageEditor");
|
|
10
|
+
function ImageFieldEditor({ field, readOnly, }) {
|
|
11
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
12
|
+
const [altText, setAltText] = (0, react_1.useState)("");
|
|
13
|
+
if (!field || !editContext)
|
|
14
|
+
return null;
|
|
15
|
+
function updateAltText(rawValue, newAltText) {
|
|
16
|
+
const parser = new DOMParser();
|
|
17
|
+
const xmlDoc = parser.parseFromString(rawValue, 'text/xml');
|
|
18
|
+
const imageElement = xmlDoc.documentElement;
|
|
19
|
+
imageElement.setAttribute('alt', newAltText);
|
|
20
|
+
return new XMLSerializer().serializeToString(xmlDoc);
|
|
21
|
+
}
|
|
22
|
+
var item = field.descriptor.item;
|
|
23
|
+
(0, react_1.useEffect)(() => {
|
|
24
|
+
setAltText(field.value?.alt || "");
|
|
25
|
+
}, [field.value?.alt]);
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "flex gap-2 h-full focus-shadow flex-wrap", children: (0, jsx_runtime_1.jsx)("div", { className: "h-48 w-48 border border-gray-300 relative cursor-pointer flex justify-center items-center", children: !readOnly && (0, jsx_runtime_1.jsx)(ImageEditor_1.ImageEditor, { field: field }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "mb-1", children: "Alt Text" }), (0, jsx_runtime_1.jsx)(inputtext_1.InputText, { value: altText, disabled: readOnly, className: "p-2 focus-shadow text-sm", style: { width: "100%" }, onChange: (e) => {
|
|
27
|
+
setAltText(e.target.value);
|
|
28
|
+
if (field.value)
|
|
29
|
+
field.value.alt = e.target.value;
|
|
30
|
+
editContext.operations.editField({
|
|
31
|
+
field: field.descriptor,
|
|
32
|
+
rawValue: updateAltText(field.rawValue || "", e.target.value),
|
|
33
|
+
refresh: "waitForQuietPeriod",
|
|
34
|
+
});
|
|
35
|
+
} }, item.id + field.id + item.language + item.version)] })] }));
|
|
36
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.InternalLinkFieldEditor = InternalLinkFieldEditor;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const editContext_1 = require("../client/editContext");
|
|
11
|
+
const ContentTree_1 = __importDefault(require("../ContentTree"));
|
|
12
|
+
const overlaypanel_1 = require("primereact/overlaypanel");
|
|
13
|
+
const editService_1 = require("../services/editService");
|
|
14
|
+
const utils_1 = require("primereact/utils");
|
|
15
|
+
function InternalLinkFieldEditor({ field, readOnly, }) {
|
|
16
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
17
|
+
const [link, setLink] = (0, react_1.useState)();
|
|
18
|
+
const [showTree, setShowTree] = (0, react_1.useState)(false);
|
|
19
|
+
const [rootItemIds, setRootItemIds] = (0, react_1.useState)([]);
|
|
20
|
+
(0, react_1.useEffect)(() => {
|
|
21
|
+
setLink({
|
|
22
|
+
url: field.value.url,
|
|
23
|
+
target: field.value.target,
|
|
24
|
+
targetItemName: field.value.targetItemName,
|
|
25
|
+
targetItemLongId: field.value.targetItemLongId,
|
|
26
|
+
type: field.value.type,
|
|
27
|
+
itemId: field.value.targetItemLongId?.split("/").pop(),
|
|
28
|
+
queryString: field.value.queryString,
|
|
29
|
+
});
|
|
30
|
+
}, [field]);
|
|
31
|
+
const overlayPanelRef = (0, react_1.useRef)(null);
|
|
32
|
+
const dropdownRef = (0, react_1.useRef)(null);
|
|
33
|
+
const texboxRef = (0, react_1.useRef)(null);
|
|
34
|
+
if (!editContext)
|
|
35
|
+
return;
|
|
36
|
+
const selection = [];
|
|
37
|
+
if (link?.itemId)
|
|
38
|
+
selection.push(link.itemId);
|
|
39
|
+
(0, react_1.useEffect)(() => {
|
|
40
|
+
const loadLookupSources = async () => {
|
|
41
|
+
const datasources = await (0, editService_1.getLookupSources)(field, editContext.sessionId);
|
|
42
|
+
if (datasources.length > 0) {
|
|
43
|
+
setRootItemIds(datasources.map((x) => x.id));
|
|
44
|
+
}
|
|
45
|
+
else
|
|
46
|
+
setRootItemIds(["11111111-1111-1111-1111-111111111111"]);
|
|
47
|
+
};
|
|
48
|
+
loadLookupSources();
|
|
49
|
+
}, [field.descriptor]);
|
|
50
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { ref: texboxRef, className: (0, utils_1.classNames)("p-1.5 border flex justify-between text-sm cursor-pointer justiy-between focus-shadow", readOnly ? "bg-gray-50" : " bg-white"), onClick: (e) => {
|
|
51
|
+
if (readOnly)
|
|
52
|
+
return;
|
|
53
|
+
overlayPanelRef.current?.toggle(null, texboxRef.current);
|
|
54
|
+
setShowTree((show) => !show);
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
}, children: [link?.targetItemName ? ((0, jsx_runtime_1.jsx)("span", { children: link.targetItemName })) : ((0, jsx_runtime_1.jsx)("span", { children: "\u00A0" })), !readOnly && ((0, jsx_runtime_1.jsx)("i", { className: `pi ${showTree ? "pi-angle-up" : "pi-angle-down"} ` }))] }), (0, jsx_runtime_1.jsx)("div", { ref: dropdownRef, className: "w-0" })] }), (0, jsx_runtime_1.jsx)(overlaypanel_1.OverlayPanel, { ref: overlayPanelRef, children: (0, jsx_runtime_1.jsx)("div", { className: "h-64 overflow-auto resize border-b border-x p-2", style: { width: `${texboxRef.current?.offsetWidth || 100}px` }, children: (0, jsx_runtime_1.jsx)(ContentTree_1.default, { language: editContext.contentEditorItem.language, expandIdPath: link?.targetItemLongId, rootItemIds: rootItemIds, selectionMode: "single", selectedItemIds: selection, onNodeClick: (node) => {
|
|
57
|
+
setShowTree(false);
|
|
58
|
+
overlayPanelRef.current?.hide();
|
|
59
|
+
editContext?.operations.editField({
|
|
60
|
+
field: field.descriptor,
|
|
61
|
+
rawValue: node.id,
|
|
62
|
+
});
|
|
63
|
+
} }) }) })] }));
|
|
64
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.LinkFieldEditor = LinkFieldEditor;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const LinkEditorDialog_1 = require("../LinkEditorDialog");
|
|
8
|
+
const editContext_1 = require("../client/editContext");
|
|
9
|
+
const utils_1 = require("primereact/utils");
|
|
10
|
+
function LinkFieldEditor({ field, readOnly, }) {
|
|
11
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
12
|
+
const [showDialog, setShowDialog] = (0, react_1.useState)(false);
|
|
13
|
+
const [link, setLink] = (0, react_1.useState)();
|
|
14
|
+
(0, react_1.useEffect)(() => {
|
|
15
|
+
if (!field.value)
|
|
16
|
+
return;
|
|
17
|
+
setLink({
|
|
18
|
+
url: field.value.url,
|
|
19
|
+
target: field.value.target,
|
|
20
|
+
targetItemLongId: field.value.targetItemLongId,
|
|
21
|
+
type: field.value.type,
|
|
22
|
+
itemId: field.value.targetItemLongId?.split("/").pop(),
|
|
23
|
+
queryString: field.value.queryString,
|
|
24
|
+
});
|
|
25
|
+
}, [field]);
|
|
26
|
+
if (!field.value)
|
|
27
|
+
return;
|
|
28
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.classNames)("focus-shadow flex justify-between border border-gray-300 p-2", readOnly ? "bg-gray-100" : "cursor-pointer bg-white"), onClick: (e) => {
|
|
29
|
+
if (readOnly)
|
|
30
|
+
return;
|
|
31
|
+
setShowDialog(true);
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { children: field.value.url }), (0, jsx_runtime_1.jsx)("i", { className: "pi pi-link" })] }), showDialog && ((0, jsx_runtime_1.jsx)(LinkEditorDialog_1.LinkEditorDialog, { linkValue: link || { type: "internal" }, onOk: (link) => {
|
|
34
|
+
const xml = link.type == "internal"
|
|
35
|
+
? '<link linktype="internal" querystring="' +
|
|
36
|
+
(link.queryString ?? "") +
|
|
37
|
+
'" id="' +
|
|
38
|
+
link.itemId +
|
|
39
|
+
'" target="' +
|
|
40
|
+
link.target +
|
|
41
|
+
'" />'
|
|
42
|
+
: '<link linktype="external" querystring="' +
|
|
43
|
+
(link.queryString ?? "") +
|
|
44
|
+
'" url="' +
|
|
45
|
+
link.url +
|
|
46
|
+
'" target="' +
|
|
47
|
+
link.target +
|
|
48
|
+
'" />';
|
|
49
|
+
editContext?.operations.editField({
|
|
50
|
+
field: field.descriptor,
|
|
51
|
+
rawValue: xml,
|
|
52
|
+
refresh: "immediate",
|
|
53
|
+
});
|
|
54
|
+
setShowDialog(false);
|
|
55
|
+
}, onCancel: () => {
|
|
56
|
+
setShowDialog(false);
|
|
57
|
+
} }))] }));
|
|
58
|
+
}
|