@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,277 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getSelectedComponentCommands = getSelectedComponentCommands;
|
|
7
|
+
exports.getComponentCommands = getComponentCommands;
|
|
8
|
+
const react_uuid_1 = __importDefault(require("react-uuid"));
|
|
9
|
+
const componentTreeHelper_1 = require("../componentTreeHelper");
|
|
10
|
+
const isPlaceholder = (x) => x.components !== undefined;
|
|
11
|
+
function getSelectedComponentCommands(editContext) {
|
|
12
|
+
const selection = editContext.selection;
|
|
13
|
+
const selectedComponents = selection
|
|
14
|
+
.map((x) => (0, componentTreeHelper_1.getComponentById)(x, editContext.page))
|
|
15
|
+
.filter((x) => x);
|
|
16
|
+
const componentCommands = getComponentCommands(selectedComponents, editContext);
|
|
17
|
+
const componentCommandMenuItems = componentCommands.filter((x) => x.visibilityScopes.indexOf("menu") >= 0);
|
|
18
|
+
return componentCommandMenuItems;
|
|
19
|
+
}
|
|
20
|
+
function getComponentCommands(entities, editContext) {
|
|
21
|
+
const components = entities.filter((x) => x && !isPlaceholder(x));
|
|
22
|
+
const commands = [
|
|
23
|
+
getCreateCommentCommand(),
|
|
24
|
+
getInsertCommand(components, editContext),
|
|
25
|
+
getDeleteCommand(components, editContext),
|
|
26
|
+
getDuplicateCommand(components, editContext),
|
|
27
|
+
getSyncCommand(entities, editContext),
|
|
28
|
+
getAiCommand(editContext),
|
|
29
|
+
getDesignCommand(components, editContext),
|
|
30
|
+
getLinkToMasterCommand(components, editContext),
|
|
31
|
+
getInheritChildrenFromMasterCommand(components, editContext),
|
|
32
|
+
];
|
|
33
|
+
return commands.filter((x) => x !== null);
|
|
34
|
+
}
|
|
35
|
+
function getInsertCommand(components, editContext) {
|
|
36
|
+
if (components.length !== 1 || isPlaceholder(components[0]))
|
|
37
|
+
return null;
|
|
38
|
+
const item = components[0];
|
|
39
|
+
if (!item)
|
|
40
|
+
return null;
|
|
41
|
+
if (!item.placeholders || item.placeholders.length === 0)
|
|
42
|
+
return null;
|
|
43
|
+
return {
|
|
44
|
+
id: "insert",
|
|
45
|
+
icon: "pi pi-plus",
|
|
46
|
+
label: "Insert component",
|
|
47
|
+
disabled: (context) => !context.editContext.page?.item.canWriteItem,
|
|
48
|
+
visibilityScopes: ["editFrame", "contextMenu"],
|
|
49
|
+
execute: async () => {
|
|
50
|
+
editContext.setSelectedForInsertion(item.id);
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function getDuplicateCommand(components, editContext) {
|
|
55
|
+
if (components.length !== 1)
|
|
56
|
+
return null;
|
|
57
|
+
return {
|
|
58
|
+
id: "duplicate",
|
|
59
|
+
icon: "pi pi-copy",
|
|
60
|
+
label: "Duplicate",
|
|
61
|
+
visibilityScopes: ["contextMenu", "menu"],
|
|
62
|
+
disabled: (c) => !(c.editContext.page?.item.canWriteItem || false),
|
|
63
|
+
execute: async (context) => {
|
|
64
|
+
// if (!components[0].parentPlaceholder?.parentComponent.datasourceItem)
|
|
65
|
+
// return;
|
|
66
|
+
editContext.operations.duplicateComponents({
|
|
67
|
+
componentIds: components.map((x) => x.id),
|
|
68
|
+
});
|
|
69
|
+
context.event?.stopPropagation();
|
|
70
|
+
context.event?.preventDefault();
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function getAiCommand(editContext) {
|
|
75
|
+
return {
|
|
76
|
+
id: "ai",
|
|
77
|
+
icon: "pi pi-sparkles",
|
|
78
|
+
label: "AI",
|
|
79
|
+
disabled: () => false,
|
|
80
|
+
execute: async (context) => {
|
|
81
|
+
const event = context.event;
|
|
82
|
+
editContext.showAiPopup(event);
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
event.stopPropagation();
|
|
85
|
+
},
|
|
86
|
+
visibilityScopes: ["editFrame", "contextMenu"],
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function getDesignCommand(components, editContext) {
|
|
90
|
+
if (components.length !== 1 || isPlaceholder(components[0]))
|
|
91
|
+
return null;
|
|
92
|
+
const item = components[0];
|
|
93
|
+
if (!item)
|
|
94
|
+
return null;
|
|
95
|
+
if (!item.datasourceItem?.fields)
|
|
96
|
+
return null;
|
|
97
|
+
if (!Object.values(item.datasourceItem.fields).find((x) => x.section === "Design"))
|
|
98
|
+
return null;
|
|
99
|
+
return {
|
|
100
|
+
id: "design",
|
|
101
|
+
icon: "pi pi-palette",
|
|
102
|
+
label: "Design",
|
|
103
|
+
disabled: () => false,
|
|
104
|
+
execute: async (context) => {
|
|
105
|
+
editContext.showFieldEditorPopup(item.datasourceItem?.fields || [], ["Design", "Rendering"], context.event);
|
|
106
|
+
},
|
|
107
|
+
visibilityScopes: ["editFrame", "contextMenu"],
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function getLinkToMasterCommand(components, editContext) {
|
|
111
|
+
if (!components.length)
|
|
112
|
+
return null;
|
|
113
|
+
if (editContext.page?.item?.masterLanguages?.length === 0)
|
|
114
|
+
return null;
|
|
115
|
+
return getCheckboxCommand(components, editContext, "componentLinkedToMasterLanguage", "Linked To Master Language");
|
|
116
|
+
}
|
|
117
|
+
function getCheckboxCommand(components, editContext, fieldName, label) {
|
|
118
|
+
const someLinked = components.find((x) => x.datasourceItem?.fields.find((x) => x.name === fieldName)?.rawValue ===
|
|
119
|
+
"1");
|
|
120
|
+
const allLinked = !components.find((x) => x.datasourceItem?.fields.find((x) => x.name === fieldName)?.rawValue !==
|
|
121
|
+
"1");
|
|
122
|
+
return {
|
|
123
|
+
id: fieldName,
|
|
124
|
+
icon: "pi pi-" +
|
|
125
|
+
(allLinked ? "check-square" : someLinked ? "stop-circle" : "stop"),
|
|
126
|
+
label,
|
|
127
|
+
disabled: () => false,
|
|
128
|
+
execute: async () => {
|
|
129
|
+
components.forEach((c) => {
|
|
130
|
+
const field = c.datasourceItem?.fields.find((x) => x.name === fieldName);
|
|
131
|
+
if (!field)
|
|
132
|
+
return;
|
|
133
|
+
editContext.operations.editField({
|
|
134
|
+
field: field.descriptor,
|
|
135
|
+
rawValue: allLinked ? "" : "1",
|
|
136
|
+
refresh: "immediate",
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
},
|
|
140
|
+
visibilityScopes: ["menu", "contextMenu"],
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function getInheritChildrenFromMasterCommand(components, editContext) {
|
|
144
|
+
if (!components.length)
|
|
145
|
+
return null;
|
|
146
|
+
if (editContext.page?.item?.masterLanguages?.length === 0)
|
|
147
|
+
return null;
|
|
148
|
+
if (components.find((x) => !x.placeholders || x.placeholders.length === 0))
|
|
149
|
+
return null;
|
|
150
|
+
return getCheckboxCommand(components, editContext, "inheritChildrenFromMasterLanguage", "Inherit Children From Master");
|
|
151
|
+
}
|
|
152
|
+
function isLocked(c, editContext) {
|
|
153
|
+
if (editContext.activeSessions.find((x) => x.fieldLock?.item.id === c.id &&
|
|
154
|
+
x.fieldLock.item.language == c.datasourceItem?.language &&
|
|
155
|
+
x.fieldLock.item.version === c.datasourceItem?.version &&
|
|
156
|
+
x.sessionId !== editContext.sessionId) !== undefined) {
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
else
|
|
160
|
+
return (c.placeholders?.find((x) => x.components.find((child) => isLocked(child, editContext)) !==
|
|
161
|
+
undefined) !== undefined);
|
|
162
|
+
}
|
|
163
|
+
function getDeleteCommand(components, editContext) {
|
|
164
|
+
const applicableComponents = components.filter((c) => ((!isPlaceholder(c) && !c.layoutId) ||
|
|
165
|
+
c.layoutId === editContext.page?.item.id) &&
|
|
166
|
+
!isLocked(c, editContext) &&
|
|
167
|
+
editContext.page?.item.canWriteItem);
|
|
168
|
+
if (applicableComponents.length === 0)
|
|
169
|
+
return null;
|
|
170
|
+
return {
|
|
171
|
+
id: "delete",
|
|
172
|
+
label: "Delete",
|
|
173
|
+
icon: "pi pi-fw pi-trash",
|
|
174
|
+
execute: async (context) => deleteComponents(applicableComponents, context.editContext),
|
|
175
|
+
disabled: () => applicableComponents.length === 0 ||
|
|
176
|
+
applicableComponents.length !== components.length,
|
|
177
|
+
visibilityScopes: ["editFrame", "menu", "contextMenu"],
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function canSynchronize(placeholderData) {
|
|
181
|
+
if (placeholderData.canSynchronize)
|
|
182
|
+
return true;
|
|
183
|
+
placeholderData.components.forEach((c) => {
|
|
184
|
+
if (c.placeholders?.find((x) => canSynchronize(x)))
|
|
185
|
+
return true;
|
|
186
|
+
});
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
function getSyncCommand(components, editContext) {
|
|
190
|
+
const placeholders = [];
|
|
191
|
+
for (const component of components) {
|
|
192
|
+
if (isPlaceholder(component) && canSynchronize(component)) {
|
|
193
|
+
placeholders.push({
|
|
194
|
+
item: component.parentComponent
|
|
195
|
+
? getItemDescriptor(component.parentComponent, editContext)
|
|
196
|
+
: undefined,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
if (component.placeholders?.find((x) => canSynchronize(x))) {
|
|
201
|
+
placeholders.push({
|
|
202
|
+
item: getItemDescriptor(component, editContext),
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const canSync = placeholders.length > 0 ||
|
|
208
|
+
(components.length === 0 &&
|
|
209
|
+
editContext.page?.rootComponent.placeholders.find((x) => canSynchronize(x)));
|
|
210
|
+
return {
|
|
211
|
+
id: "synchronize",
|
|
212
|
+
label: "Synchronize",
|
|
213
|
+
icon: "pi pi-fw pi-sync",
|
|
214
|
+
disabled: () => !canSync,
|
|
215
|
+
visibilityScopes: ["menu", "editFrame", "contextMenu"],
|
|
216
|
+
execute: async () => {
|
|
217
|
+
const op = {
|
|
218
|
+
mainItem: editContext.page.item.descriptor,
|
|
219
|
+
type: "synchronize-components",
|
|
220
|
+
date: new Date().toISOString(),
|
|
221
|
+
delete: false,
|
|
222
|
+
id: (0, react_uuid_1.default)(),
|
|
223
|
+
placeholders: placeholders,
|
|
224
|
+
description: "Synchronize components",
|
|
225
|
+
};
|
|
226
|
+
editContext.operations.executeEditOperation(op);
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function deleteComponents(components, editContext) {
|
|
231
|
+
if (!components.length)
|
|
232
|
+
return;
|
|
233
|
+
editContext.confirm({
|
|
234
|
+
showCancel: true,
|
|
235
|
+
message: (components.length > 1
|
|
236
|
+
? "Are you sure you want to remove these components? "
|
|
237
|
+
: "Are you sure you want to remove this component? ") +
|
|
238
|
+
components.map((x) => x.name).join(", "),
|
|
239
|
+
header: components.length > 1 ? "Remove components" : "Remove component",
|
|
240
|
+
icon: "pi pi-exclamation-triangle",
|
|
241
|
+
accept: () => {
|
|
242
|
+
if (!editContext.page?.item.descriptor)
|
|
243
|
+
return;
|
|
244
|
+
console.log("Remove components", components);
|
|
245
|
+
const op = {
|
|
246
|
+
type: "remove-component",
|
|
247
|
+
date: new Date().toISOString(),
|
|
248
|
+
id: (0, react_uuid_1.default)(),
|
|
249
|
+
componentIds: components.map((x) => x.id),
|
|
250
|
+
mainItem: editContext.page.item.descriptor,
|
|
251
|
+
description: "Remove components: " + components.map((x) => x.name).join(", "),
|
|
252
|
+
};
|
|
253
|
+
editContext.operations.executeEditOperation(op);
|
|
254
|
+
},
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
function getCreateCommentCommand() {
|
|
258
|
+
// if (components.length !== 1 || isPlaceholder(components[0])) return null;
|
|
259
|
+
return {
|
|
260
|
+
id: "addComment",
|
|
261
|
+
label: "Add Comment",
|
|
262
|
+
icon: "pi pi-comment",
|
|
263
|
+
disabled: () => false,
|
|
264
|
+
visibilityScopes: ["contextMenu"],
|
|
265
|
+
execute: async (context) => {
|
|
266
|
+
context.editContext.addComment();
|
|
267
|
+
context.editContext.switchView("reviews");
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
function getItemDescriptor(component, editContext) {
|
|
272
|
+
return {
|
|
273
|
+
id: component.id,
|
|
274
|
+
language: component.datasourceItem?.language || editContext.page.item.language,
|
|
275
|
+
version: component.datasourceItem?.version || editContext.page.item.version,
|
|
276
|
+
};
|
|
277
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCreateAndSwitchToNewVersionCommand = getCreateAndSwitchToNewVersionCommand;
|
|
4
|
+
const editService_1 = require("../services/editService");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
function getCreateAndSwitchToNewVersionCommand({ language, }) {
|
|
7
|
+
return {
|
|
8
|
+
id: "createAndSwitchToNewVersion",
|
|
9
|
+
execute: (context) => execute(context, language),
|
|
10
|
+
label: "Add Version",
|
|
11
|
+
icon: "pi pi-fw pi-plus",
|
|
12
|
+
disabled: (context) => !context.editContext.item?.canLock,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
async function execute(context, language) {
|
|
16
|
+
if (!context.editContext.item)
|
|
17
|
+
return;
|
|
18
|
+
const descriptor = (0, utils_1.getItemDescriptor)(context.editContext.item);
|
|
19
|
+
if (language)
|
|
20
|
+
descriptor.language = language;
|
|
21
|
+
await (0, editService_1.createVersion)(descriptor, context.editContext.sessionId);
|
|
22
|
+
context.editContext.loadItem({
|
|
23
|
+
...descriptor,
|
|
24
|
+
version: 0,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDeleteVersionCommand = getDeleteVersionCommand;
|
|
4
|
+
const editService_1 = require("../services/editService");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
function getDeleteVersionCommand({}) {
|
|
7
|
+
return {
|
|
8
|
+
id: "deleteVersion",
|
|
9
|
+
execute: (context) => execute(context),
|
|
10
|
+
label: "Delete Version",
|
|
11
|
+
icon: "pi pi-fw pi-times",
|
|
12
|
+
disabled: (context) => !context.editContext.item?.canLock ||
|
|
13
|
+
context.editContext.item.version === 0 ||
|
|
14
|
+
context.editContext.itemVersions.length === 0,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
async function execute(context) {
|
|
18
|
+
if (!context.editContext.item)
|
|
19
|
+
return;
|
|
20
|
+
const descriptor = (0, utils_1.getItemDescriptor)(context.editContext.item);
|
|
21
|
+
let message = "Are you sure you want to delete version " +
|
|
22
|
+
context.editContext.item.version +
|
|
23
|
+
"?";
|
|
24
|
+
const sessions = context.editContext.activeSessions.filter((x) => ((x.item?.id === descriptor.id &&
|
|
25
|
+
x.item?.language === descriptor.language &&
|
|
26
|
+
x.item?.version === descriptor.version) ||
|
|
27
|
+
(x.page?.id === descriptor.id &&
|
|
28
|
+
x.page?.language === descriptor.language &&
|
|
29
|
+
x.page?.version === descriptor.version)) &&
|
|
30
|
+
x.sessionId !== context.editContext.sessionId);
|
|
31
|
+
if (sessions.length > 0) {
|
|
32
|
+
context.editContext.showMessageDialog({
|
|
33
|
+
header: "Delete Version",
|
|
34
|
+
message: "This version is currently locked by " +
|
|
35
|
+
sessions.map((x) => x.user.name).join(", ") +
|
|
36
|
+
". You cannot delete it.",
|
|
37
|
+
});
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (context.editContext.itemVersions[context.editContext.itemVersions.length - 1]?.version === context.editContext.item.version) {
|
|
41
|
+
message += " This is the latest version!";
|
|
42
|
+
}
|
|
43
|
+
context.editContext.confirm?.({
|
|
44
|
+
header: "Delete Version",
|
|
45
|
+
message,
|
|
46
|
+
showCancel: true,
|
|
47
|
+
accept: async () => {
|
|
48
|
+
await (0, editService_1.deleteVersion)(descriptor, context.editContext.sessionId);
|
|
49
|
+
context.editContext.loadItem({
|
|
50
|
+
...descriptor,
|
|
51
|
+
version: 0,
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.publishItemCommand = exports.insertItemCommand = exports.renameItemCommand = exports.deleteItemCommand = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const ItemNameDialogNew_1 = require("../ui/ItemNameDialogNew");
|
|
6
|
+
exports.deleteItemCommand = {
|
|
7
|
+
id: "deleteItem",
|
|
8
|
+
label: "Delete",
|
|
9
|
+
icon: "pi pi-times",
|
|
10
|
+
disabled: (context) => !context.data?.items || !context.data?.items[0]?.canLock || false,
|
|
11
|
+
execute: async (context) => {
|
|
12
|
+
const items = context.data?.items;
|
|
13
|
+
if (!items || items.length === 0)
|
|
14
|
+
return;
|
|
15
|
+
const confirmed = await new Promise((resolve) => {
|
|
16
|
+
context.editContext.confirm({
|
|
17
|
+
message: ((0, jsx_runtime_1.jsxs)("div", { children: ["Are you sure you want to delete", " ", (0, jsx_runtime_1.jsx)("em", { children: items.map((x) => x.name).join(", ") }), "? This cannot be undone."] })),
|
|
18
|
+
header: "Confirmation",
|
|
19
|
+
icon: "pi pi-exclamation-triangle",
|
|
20
|
+
accept: () => resolve(true),
|
|
21
|
+
reject: () => resolve(false),
|
|
22
|
+
showCancel: true,
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
if (confirmed) {
|
|
26
|
+
if (items.some((x) => context.editContext.contentEditorItem?.descriptor.id === x.id)) {
|
|
27
|
+
const firstItem = items[0];
|
|
28
|
+
if (firstItem) {
|
|
29
|
+
context.editContext.loadItem({
|
|
30
|
+
id: firstItem.parentId,
|
|
31
|
+
language: context.editContext.contentEditorItem.language,
|
|
32
|
+
version: 0,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
await context.editContext.operations.deleteItems(items.map((x) => x.descriptor));
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
exports.renameItemCommand = {
|
|
43
|
+
id: "renameItem",
|
|
44
|
+
label: "Rename",
|
|
45
|
+
icon: "pi pi-pencil",
|
|
46
|
+
keyBinding: "F2",
|
|
47
|
+
disabled: (context) => !context.data?.items ||
|
|
48
|
+
context.data.items.length !== 1 ||
|
|
49
|
+
!context.data.items[0]?.canLock ||
|
|
50
|
+
false,
|
|
51
|
+
execute: async (context) => {
|
|
52
|
+
const item = context.data?.items[0];
|
|
53
|
+
if (!item)
|
|
54
|
+
return;
|
|
55
|
+
const newName = await context.openDialog(ItemNameDialogNew_1.ItemNameDialog, {
|
|
56
|
+
name: item.name,
|
|
57
|
+
title: "Rename Item",
|
|
58
|
+
message: "Enter a new name for the item:",
|
|
59
|
+
parentItem: { ...item.descriptor, id: item.parentId },
|
|
60
|
+
itemId: item.id,
|
|
61
|
+
});
|
|
62
|
+
if (newName) {
|
|
63
|
+
await context.editContext.operations.renameItem(item.descriptor, newName);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
exports.insertItemCommand = {
|
|
68
|
+
id: "insertItem",
|
|
69
|
+
label: "Insert Item",
|
|
70
|
+
icon: "pi pi-plus",
|
|
71
|
+
disabled: (context) => !context.data?.items || context.data.items.length !== 1 || false,
|
|
72
|
+
execute: async (context) => {
|
|
73
|
+
const parentItem = context.data?.items[0];
|
|
74
|
+
const templateId = context.data?.templateId;
|
|
75
|
+
if (!parentItem || !templateId)
|
|
76
|
+
return;
|
|
77
|
+
const templateItem = await context.editContext.itemsRepository.getItem({
|
|
78
|
+
id: templateId,
|
|
79
|
+
language: "en",
|
|
80
|
+
version: 0,
|
|
81
|
+
});
|
|
82
|
+
const templateName = templateItem?.name;
|
|
83
|
+
const name = await context.openDialog(ItemNameDialogNew_1.ItemNameDialog, {
|
|
84
|
+
title: "Create Item",
|
|
85
|
+
message: "Enter a name for the new item:",
|
|
86
|
+
name: templateName,
|
|
87
|
+
parentItem: parentItem.descriptor,
|
|
88
|
+
});
|
|
89
|
+
if (name) {
|
|
90
|
+
const result = await context.editContext.operations.createItem(parentItem.descriptor, templateId, name);
|
|
91
|
+
if (result) {
|
|
92
|
+
context.editContext.loadItem(result);
|
|
93
|
+
}
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
// export const localizeItemCommand: ItemCommand = {
|
|
99
|
+
// id: "localizeItem",
|
|
100
|
+
// label: "Localize",
|
|
101
|
+
// icon: "pi pi-globe",
|
|
102
|
+
// disabled: (context: ItemCommandContext) =>
|
|
103
|
+
// !context.data?.items || context.data.items.length === 0 || false,
|
|
104
|
+
// execute: async (context: ItemCommandContext) => {
|
|
105
|
+
// const items = context.data?.items;
|
|
106
|
+
// if (!items?.length) return;
|
|
107
|
+
// await context.openDialog<string, LocalizeItemDialogProps>(
|
|
108
|
+
// LocalizeItemDialog,
|
|
109
|
+
// {
|
|
110
|
+
// items,
|
|
111
|
+
// editContext: context.editContext,
|
|
112
|
+
// }
|
|
113
|
+
// );
|
|
114
|
+
// if (context.editContext.contentEditorItem?.descriptor)
|
|
115
|
+
// context.editContext.loadItem(
|
|
116
|
+
// context.editContext.contentEditorItem.descriptor
|
|
117
|
+
// );
|
|
118
|
+
// },
|
|
119
|
+
// };
|
|
120
|
+
exports.publishItemCommand = {
|
|
121
|
+
id: "publishItem",
|
|
122
|
+
label: "Publish",
|
|
123
|
+
icon: "pi pi-cloud-upload",
|
|
124
|
+
disabled: (context) => !context.data?.items ||
|
|
125
|
+
context.data.items.length !== 1 ||
|
|
126
|
+
!context.data.items[0]?.canLock ||
|
|
127
|
+
false,
|
|
128
|
+
execute: async (context) => {
|
|
129
|
+
const item = context.data?.items[0];
|
|
130
|
+
if (!item)
|
|
131
|
+
return;
|
|
132
|
+
await context.editContext.switchView("publish");
|
|
133
|
+
},
|
|
134
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LocalizeItemDialog = LocalizeItemDialog;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const button_1 = require("primereact/button");
|
|
9
|
+
const dialog_1 = require("primereact/dialog");
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const DialogButtons_1 = __importDefault(require("../../ui/DialogButtons"));
|
|
12
|
+
const contentService_1 = require("../../services/contentService");
|
|
13
|
+
const checkbox_1 = require("primereact/checkbox");
|
|
14
|
+
const Spinner_1 = require("../../ui/Spinner");
|
|
15
|
+
function LocalizeItemDialog(props) {
|
|
16
|
+
const [languageSelection, setLanguageSelection] = (0, react_1.useState)({});
|
|
17
|
+
const [languageData, setLanguageData] = (0, react_1.useState)();
|
|
18
|
+
const [isExecuting, setIsExecuting] = (0, react_1.useState)(false);
|
|
19
|
+
const [currentTask, setCurrentTask] = (0, react_1.useState)();
|
|
20
|
+
const [completedTasks, setCompletedTasks] = (0, react_1.useState)([]);
|
|
21
|
+
const [finished, setFinished] = (0, react_1.useState)(false);
|
|
22
|
+
(0, react_1.useEffect)(() => {
|
|
23
|
+
const itemDescriptors = props.items.map((x) => x.descriptor);
|
|
24
|
+
const loadLanguages = async () => {
|
|
25
|
+
const itemLanguages = await Promise.all(itemDescriptors.map(async (item) => {
|
|
26
|
+
const result = await (0, contentService_1.getLanguagesAndVersions)(item);
|
|
27
|
+
return result.data?.languages || [];
|
|
28
|
+
}));
|
|
29
|
+
const languageMap = new Map();
|
|
30
|
+
itemLanguages.forEach((languages, index) => {
|
|
31
|
+
languages.forEach((language) => {
|
|
32
|
+
const languageData = languageMap.get(language.name) || {
|
|
33
|
+
name: language.name,
|
|
34
|
+
items: [],
|
|
35
|
+
};
|
|
36
|
+
if (language.versions > 0)
|
|
37
|
+
languageData.items.push(itemDescriptors[index]);
|
|
38
|
+
languageMap.set(language.languageCode, languageData);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
setLanguageData(languageMap);
|
|
42
|
+
};
|
|
43
|
+
loadLanguages();
|
|
44
|
+
}, [props]);
|
|
45
|
+
async function startLocalization() {
|
|
46
|
+
setIsExecuting(true);
|
|
47
|
+
const completedTasks = [];
|
|
48
|
+
for (const item of props.items) {
|
|
49
|
+
for (const language of Object.keys(languageSelection)) {
|
|
50
|
+
if (!languageSelection[language])
|
|
51
|
+
continue;
|
|
52
|
+
if (languageData
|
|
53
|
+
?.get(language)
|
|
54
|
+
?.items.find((x) => x.id === item.descriptor.id))
|
|
55
|
+
continue;
|
|
56
|
+
setCurrentTask(`${item.name} - ${language}`);
|
|
57
|
+
await props.editContext.operations.createVersion({
|
|
58
|
+
id: item.descriptor.id,
|
|
59
|
+
language: language,
|
|
60
|
+
version: 0,
|
|
61
|
+
});
|
|
62
|
+
completedTasks.push(`${item.name} - ${language}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
setFinished(true);
|
|
66
|
+
setCompletedTasks(completedTasks);
|
|
67
|
+
}
|
|
68
|
+
const allLanguages = Array.from(languageData?.keys() || []).map((x) => ({
|
|
69
|
+
code: x,
|
|
70
|
+
name: languageData?.get(x)?.name || "",
|
|
71
|
+
}));
|
|
72
|
+
allLanguages.sort((a, b) => a.name.localeCompare(b.name));
|
|
73
|
+
const dialogContent = getContent();
|
|
74
|
+
function getContent() {
|
|
75
|
+
if (finished)
|
|
76
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex gap-1 flex-col justify h-full", children: [completedTasks.length > 0 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-lg font-bold pt-3 px-3", children: "Finished. Versions created:" }), (0, jsx_runtime_1.jsx)("div", { className: "flex-1 relative", children: (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-3 flex flex-col gap-3 overflow-y-auto", children: completedTasks.map((x, index) => ((0, jsx_runtime_1.jsx)("div", { children: x }, index))) }) })] })), completedTasks.length === 0 && ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center h-full", children: "All items are already localized." })), (0, jsx_runtime_1.jsx)(DialogButtons_1.default, { children: (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: () => props.onClose?.(null), label: "Close" }) })] }));
|
|
77
|
+
if (isExecuting)
|
|
78
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center gap-3 h-full", children: [(0, jsx_runtime_1.jsx)(Spinner_1.Spinner, {}), " Creating version ", currentTask] }));
|
|
79
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex gap-1 flex-col justify h-full text-sm ", children: [(0, jsx_runtime_1.jsxs)("div", { className: "p-3 flex flex-col gap-2 h-full", children: [(0, jsx_runtime_1.jsxs)("div", { className: "my-2", children: ["Select languages to localize", " ", props.items.map((x) => x.name).join(", "), ":"] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 my-1", children: [(0, jsx_runtime_1.jsx)(checkbox_1.Checkbox, { checked: allLanguages.every((language) => languageSelection[language.code]), onChange: (e) => {
|
|
80
|
+
setLanguageSelection(Object.fromEntries(Array.from(languageData?.keys() || []).map((language) => [
|
|
81
|
+
language,
|
|
82
|
+
e.checked || false,
|
|
83
|
+
])));
|
|
84
|
+
} }), " ", "All"] }), (0, jsx_runtime_1.jsx)("div", { className: "relative flex-1", children: (0, jsx_runtime_1.jsx)("div", { className: "absolute top-0 left-0 w-full h-full overflow-y-auto", children: allLanguages.map((language) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 my-2", children: [(0, jsx_runtime_1.jsx)(checkbox_1.Checkbox, { checked: languageSelection[language.code] || false, onChange: (e) => {
|
|
85
|
+
setLanguageSelection((prev) => ({
|
|
86
|
+
...prev,
|
|
87
|
+
[language.code]: e.checked || false,
|
|
88
|
+
}));
|
|
89
|
+
} }), (0, jsx_runtime_1.jsx)("div", { children: language.name })] }, language.code))) }) })] }), (0, jsx_runtime_1.jsxs)(DialogButtons_1.default, { children: [(0, jsx_runtime_1.jsx)(button_1.Button, { onClick: startLocalization, label: "Start" }), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: () => props.onClose?.(null), label: "Cancel" })] })] }));
|
|
90
|
+
}
|
|
91
|
+
return ((0, jsx_runtime_1.jsx)(dialog_1.Dialog, { visible: true, onHide: () => {
|
|
92
|
+
props.onClose?.(null);
|
|
93
|
+
}, style: { width: "75vw", height: "75vh" }, header: "Localize", children: dialogContent }));
|
|
94
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getUndoCommand = getUndoCommand;
|
|
4
|
+
exports.getRedoCommand = getRedoCommand;
|
|
5
|
+
function getUndoCommand() {
|
|
6
|
+
return {
|
|
7
|
+
id: "undo",
|
|
8
|
+
label: "Undo",
|
|
9
|
+
icon: "pi pi-undo",
|
|
10
|
+
execute: async (context) => {
|
|
11
|
+
context.editContext.operations.undo();
|
|
12
|
+
},
|
|
13
|
+
disabled: (context) => {
|
|
14
|
+
return (context.editContext.editHistory.length === 0 ||
|
|
15
|
+
!context.editContext.editHistory.find((x) => x.sessionId === context.editContext.sessionId && x.canUndo));
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function getRedoCommand() {
|
|
20
|
+
return {
|
|
21
|
+
id: "redo",
|
|
22
|
+
label: "Redo",
|
|
23
|
+
icon: "pi pi-refresh",
|
|
24
|
+
execute: async (context) => {
|
|
25
|
+
context.editContext.operations.redo();
|
|
26
|
+
},
|
|
27
|
+
disabled: (context) => {
|
|
28
|
+
return (context.editContext.editHistory.length === 0 ||
|
|
29
|
+
!context.editContext.editHistory.find((x) => x.sessionId === context.editContext.sessionId && x.canRedo));
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ComponentDesigner = ComponentDesigner;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const ComponentRenderingEditor_1 = require("./ComponentRenderingEditor");
|
|
6
|
+
const splitter_1 = require("primereact/splitter");
|
|
7
|
+
const StackedPanels_1 = require("../ui/StackedPanels");
|
|
8
|
+
const PlaceholdersEditor_1 = require("./PlaceholdersEditor");
|
|
9
|
+
const Icons_1 = require("../ui/Icons");
|
|
10
|
+
const ComponentEditor_1 = require("./ComponentEditor");
|
|
11
|
+
const react_1 = require("react");
|
|
12
|
+
const editContext_1 = require("../client/editContext");
|
|
13
|
+
const componentDesignerService_1 = require("../services/componentDesignerService");
|
|
14
|
+
const PageViewerFrame_1 = require("../page-viewer/PageViewerFrame");
|
|
15
|
+
function ComponentDesigner() {
|
|
16
|
+
const [allComponents, setAllComponents] = (0, react_1.useState)([]);
|
|
17
|
+
const context = (0, editContext_1.useEditContext)();
|
|
18
|
+
if (!context?.page)
|
|
19
|
+
return null;
|
|
20
|
+
(0, react_1.useEffect)(() => {
|
|
21
|
+
async function loadComponents() {
|
|
22
|
+
if (context?.page) {
|
|
23
|
+
const components = await (0, componentDesignerService_1.getAllComponents)(context.page.item.id);
|
|
24
|
+
setAllComponents(components);
|
|
25
|
+
}
|
|
26
|
+
else
|
|
27
|
+
setAllComponents([]);
|
|
28
|
+
}
|
|
29
|
+
loadComponents();
|
|
30
|
+
}, [context.page]);
|
|
31
|
+
const mainPanels = [
|
|
32
|
+
{
|
|
33
|
+
name: "template",
|
|
34
|
+
title: "Component",
|
|
35
|
+
initialSize: 30,
|
|
36
|
+
icon: (0, jsx_runtime_1.jsx)(Icons_1.PuzzleIcon, {}),
|
|
37
|
+
noOverflow: true,
|
|
38
|
+
content: (0, jsx_runtime_1.jsx)(ComponentEditor_1.ComponentEditor, { allComponents: allComponents }),
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "placeholders",
|
|
42
|
+
title: "Placeholders",
|
|
43
|
+
icon: "pi pi-th-large",
|
|
44
|
+
initialSize: 30,
|
|
45
|
+
noOverflow: true,
|
|
46
|
+
content: (0, jsx_runtime_1.jsx)(PlaceholdersEditor_1.PlaceholdersEditor, { allComponents: allComponents }),
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "rendering",
|
|
50
|
+
title: "Rendering",
|
|
51
|
+
icon: "pi pi-palette",
|
|
52
|
+
initialSize: 40,
|
|
53
|
+
content: (0, jsx_runtime_1.jsx)(ComponentRenderingEditor_1.ComponentRenderingEditor, {}),
|
|
54
|
+
noOverflow: true,
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
return ((0, jsx_runtime_1.jsxs)(splitter_1.Splitter, { className: "h-full", children: [(0, jsx_runtime_1.jsx)(splitter_1.SplitterPanel, { children: (0, jsx_runtime_1.jsx)(StackedPanels_1.StackedPanels, { panels: mainPanels }) }), (0, jsx_runtime_1.jsx)(splitter_1.SplitterPanel, { children: (0, jsx_runtime_1.jsx)(PageViewerFrame_1.PageViewerFrame, { mode: "view" }) })] }));
|
|
58
|
+
}
|