@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,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommentHighlighting = CommentHighlighting;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const editContext_1 = require("../client/editContext");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const react_2 = require("react");
|
|
9
|
+
const utils_2 = require("primereact/utils");
|
|
10
|
+
const Icons_1 = require("../ui/Icons");
|
|
11
|
+
function CommentHighlighting({ comment, scale, iframe, }) {
|
|
12
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
13
|
+
const modifiedFields = (0, editContext_1.useModifiedFieldsContext)();
|
|
14
|
+
const [range, setRange] = (0, react_1.useState)([
|
|
15
|
+
comment.rangeStart || 0,
|
|
16
|
+
comment.rangeEnd || 0,
|
|
17
|
+
]);
|
|
18
|
+
(0, react_2.useEffect)(() => {
|
|
19
|
+
const findRange = async () => {
|
|
20
|
+
if (!editContext)
|
|
21
|
+
return;
|
|
22
|
+
if (comment.fieldValue &&
|
|
23
|
+
comment.fieldId &&
|
|
24
|
+
comment.rangeStart !== undefined &&
|
|
25
|
+
comment.rangeEnd !== undefined) {
|
|
26
|
+
const field = await editContext.itemsRepository.getField({
|
|
27
|
+
item: {
|
|
28
|
+
id: comment.itemId,
|
|
29
|
+
language: comment.language,
|
|
30
|
+
version: comment.version,
|
|
31
|
+
},
|
|
32
|
+
fieldId: comment.fieldId,
|
|
33
|
+
});
|
|
34
|
+
const modifiedField = modifiedFields?.modifiedFields.find((x) => x.fieldId === field?.id &&
|
|
35
|
+
x.item.id === comment.itemId &&
|
|
36
|
+
x.item.language === comment.language &&
|
|
37
|
+
x.item.version === comment.version);
|
|
38
|
+
const mapping = computeMapping(modifiedField?.value || field?.rawValue || "", comment.fieldValue);
|
|
39
|
+
const mappedRange = [
|
|
40
|
+
mapping[comment.rangeStart],
|
|
41
|
+
mapping[comment.rangeEnd],
|
|
42
|
+
];
|
|
43
|
+
if (mappedRange[0] !== undefined && mappedRange[1] !== undefined) {
|
|
44
|
+
setRange(mappedRange);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
findRange();
|
|
49
|
+
}, [comment.fieldValue, modifiedFields?.modifiedFields]);
|
|
50
|
+
if (!editContext)
|
|
51
|
+
return null;
|
|
52
|
+
if (!comment.fieldId)
|
|
53
|
+
return null;
|
|
54
|
+
const fieldElement = (0, utils_1.findFieldElement)(iframe, {
|
|
55
|
+
item: {
|
|
56
|
+
id: comment.itemId,
|
|
57
|
+
language: comment.language,
|
|
58
|
+
version: comment.version,
|
|
59
|
+
},
|
|
60
|
+
fieldId: comment.fieldId,
|
|
61
|
+
});
|
|
62
|
+
if (!fieldElement)
|
|
63
|
+
return null;
|
|
64
|
+
let rects = null;
|
|
65
|
+
if (range[0] !== undefined && range[1] !== undefined) {
|
|
66
|
+
const startData = getTextNodeAtOffset(fieldElement, range[0]);
|
|
67
|
+
const endData = getTextNodeAtOffset(fieldElement, range[1]);
|
|
68
|
+
if (startData && endData) {
|
|
69
|
+
const textRange = document.createRange();
|
|
70
|
+
textRange.setStart(startData.node, startData.offset);
|
|
71
|
+
textRange.setEnd(endData.node, endData.offset);
|
|
72
|
+
rects = textRange.getClientRects();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (!rects || rects.length === 0) {
|
|
76
|
+
const fallbackRect = fieldElement.getBoundingClientRect();
|
|
77
|
+
rects = {
|
|
78
|
+
length: 1,
|
|
79
|
+
0: fallbackRect,
|
|
80
|
+
item: (index) => (index === 0 ? fallbackRect : null),
|
|
81
|
+
[Symbol.iterator]: function* () {
|
|
82
|
+
yield fallbackRect;
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
const iframeRect = iframe.getBoundingClientRect();
|
|
87
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: Array.from(rects).map((rect, index) => ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
88
|
+
position: "absolute",
|
|
89
|
+
top: rect.top * scale,
|
|
90
|
+
left: rect.left * scale,
|
|
91
|
+
width: rect.width * scale,
|
|
92
|
+
height: rect.height * scale,
|
|
93
|
+
pointerEvents: "none",
|
|
94
|
+
}, children: [index === 0 && ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_2.classNames)("absolute w-5 h-5 cursor-pointer pointer-events-auto ", rect.top * scale < 18 ? "top-0" : "top-[-18px]", (rect.left + rect.width) * scale > iframeRect.width - 18
|
|
95
|
+
? "right-0"
|
|
96
|
+
: "right-[-18px]"), onClick: () => {
|
|
97
|
+
editContext.switchView("reviews");
|
|
98
|
+
editContext?.select([comment.itemId]);
|
|
99
|
+
editContext?.setSelectedComment(comment);
|
|
100
|
+
}, children: (0, jsx_runtime_1.jsx)(Icons_1.CommentIcon, { className: "text-blue-500 hover:text-blue-600 " }) })), (0, jsx_runtime_1.jsx)("div", { className: "opacity-45", style: {
|
|
101
|
+
width: "100%",
|
|
102
|
+
height: "100%",
|
|
103
|
+
backgroundColor: comment.isResolved
|
|
104
|
+
? "rgba(0, 255, 0, 0.45)"
|
|
105
|
+
: "rgba(255, 0, 0, 0.45)",
|
|
106
|
+
} })] }, index))) }));
|
|
107
|
+
}
|
|
108
|
+
function getTextNodeAtOffset(root, offset) {
|
|
109
|
+
const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, null);
|
|
110
|
+
let currentNode;
|
|
111
|
+
while ((currentNode = walker.nextNode())) {
|
|
112
|
+
const nodeLength = currentNode.textContent?.length || 0;
|
|
113
|
+
if (offset <= nodeLength) {
|
|
114
|
+
return { node: currentNode, offset };
|
|
115
|
+
}
|
|
116
|
+
offset -= nodeLength;
|
|
117
|
+
}
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Erzeugt ein Mapping von Positionen im modifizierten String s2 auf die entsprechenden Positionen in s1,
|
|
122
|
+
* basierend auf einer minimalen Edit-Sequenz (Levenshtein-Distance).
|
|
123
|
+
*
|
|
124
|
+
* @param s1 Originalstring
|
|
125
|
+
* @param s2 Modifizierter String
|
|
126
|
+
* @returns Ein Array, in dem mapping[j] die Position in s1 angibt, die erreicht wird, nachdem das j-te Zeichen in s2 erzeugt wurde.
|
|
127
|
+
*/
|
|
128
|
+
function computeMapping(s1, s2) {
|
|
129
|
+
const n = s1.length;
|
|
130
|
+
const m = s2.length;
|
|
131
|
+
// 1. Aufbau der DP-Matrix und Backpointer-Matrix
|
|
132
|
+
// dp[i][j] enthält die minimale Anzahl von Operationen, um s1[0..i-1] in s2[0..j-1] zu überführen.
|
|
133
|
+
const dp = Array.from({ length: n + 1 }, () => new Array(m + 1).fill(0));
|
|
134
|
+
const back = Array.from({ length: n + 1 }, () => new Array(m + 1).fill(""));
|
|
135
|
+
// Initialisierung: leere Präfixe
|
|
136
|
+
for (let i = 0; i <= n; i++) {
|
|
137
|
+
dp[i][0] = i;
|
|
138
|
+
if (i > 0) {
|
|
139
|
+
back[i][0] = "D"; // "Deletion": Zeichen aus s1 wird gelöscht.
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
for (let j = 0; j <= m; j++) {
|
|
143
|
+
dp[0][j] = j;
|
|
144
|
+
if (j > 0) {
|
|
145
|
+
back[0][j] = "I"; // "Insertion": Zeichen in s2 wurde eingefügt.
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// Füllen der DP-Matrix (Wagner–Fischer-Algorithmus)
|
|
149
|
+
for (let i = 1; i <= n; i++) {
|
|
150
|
+
for (let j = 1; j <= m; j++) {
|
|
151
|
+
const cost = s1[i - 1] === s2[j - 1] ? 0 : 1;
|
|
152
|
+
// Drei Möglichkeiten:
|
|
153
|
+
const deletion = dp[i - 1][j] + 1;
|
|
154
|
+
const insertion = dp[i][j - 1] + 1;
|
|
155
|
+
const substitution = dp[i - 1][j - 1] + cost; // "M" (Match) wenn cost==0, sonst "S" (Substitution)
|
|
156
|
+
// Feste Tie-Breaking Reihenfolge: zuerst Deletion, dann Insertion, dann Substitution.
|
|
157
|
+
let bestVal = deletion;
|
|
158
|
+
let op = "D";
|
|
159
|
+
if (insertion < bestVal) {
|
|
160
|
+
bestVal = insertion;
|
|
161
|
+
op = "I";
|
|
162
|
+
}
|
|
163
|
+
if (substitution < bestVal) {
|
|
164
|
+
bestVal = substitution;
|
|
165
|
+
op = cost === 0 ? "M" : "S";
|
|
166
|
+
}
|
|
167
|
+
dp[i][j] = bestVal;
|
|
168
|
+
back[i][j] = op;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// 2. Rekonstruktion des Edit-Skripts per Backtracking
|
|
172
|
+
const ops = [];
|
|
173
|
+
let i = n;
|
|
174
|
+
let j = m;
|
|
175
|
+
while (i > 0 || j > 0) {
|
|
176
|
+
const op = back[i][j];
|
|
177
|
+
ops.push(op);
|
|
178
|
+
if (op === "M" || op === "S") {
|
|
179
|
+
i--;
|
|
180
|
+
j--;
|
|
181
|
+
}
|
|
182
|
+
else if (op === "D") {
|
|
183
|
+
i--;
|
|
184
|
+
}
|
|
185
|
+
else if (op === "I") {
|
|
186
|
+
j--;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
ops.reverse(); // Jetzt liegen die Operationen in der Vorwärtsreihenfolge vor.
|
|
190
|
+
// 3. Simulation der Transformation von s1 zu s2 und Aufbau des Mappings.
|
|
191
|
+
// mapping[j] soll die Position in s1 angeben, nachdem das j-te Zeichen in s2 erzeugt wurde.
|
|
192
|
+
const mapping = new Array(m + 1);
|
|
193
|
+
let iPos = 0; // Aktuelle Position in s1
|
|
194
|
+
let jPos = 0; // Aktuelle Position in s2
|
|
195
|
+
mapping[jPos] = iPos; // Vor jeglicher Transformation
|
|
196
|
+
for (const op of ops) {
|
|
197
|
+
if (op === "M" || op === "S") {
|
|
198
|
+
// Bei Match oder Substitution wird in beiden Strings ein Zeichen verarbeitet.
|
|
199
|
+
iPos++;
|
|
200
|
+
jPos++;
|
|
201
|
+
mapping[jPos] = iPos;
|
|
202
|
+
}
|
|
203
|
+
else if (op === "I") {
|
|
204
|
+
// Bei Insertion wird in s2 ein Zeichen eingefügt, s1 bleibt unverändert.
|
|
205
|
+
jPos++;
|
|
206
|
+
mapping[jPos] = iPos;
|
|
207
|
+
}
|
|
208
|
+
else if (op === "D") {
|
|
209
|
+
// Bei Deletion wird in s1 ein Zeichen übersprungen.
|
|
210
|
+
iPos++;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return mapping;
|
|
214
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommentHighlightings = CommentHighlightings;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const editContext_1 = require("../client/editContext");
|
|
7
|
+
const CommentHighlighting_1 = require("./CommentHighlighting");
|
|
8
|
+
function CommentHighlightings({ scale, iframe, }) {
|
|
9
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
10
|
+
const [comments, setComments] = (0, react_1.useState)([]);
|
|
11
|
+
(0, react_1.useEffect)(() => {
|
|
12
|
+
setComments(editContext?.comments || []);
|
|
13
|
+
}, [editContext?.comments]);
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: comments
|
|
15
|
+
.filter((x) => !x.isResolved)
|
|
16
|
+
.map((comment) => ((0, jsx_runtime_1.jsx)(CommentHighlighting_1.CommentHighlighting, { iframe: iframe, scale: scale, comment: comment }, comment.id))) }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FieldActionIndicator = FieldActionIndicator;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const editContext_1 = require("../client/editContext");
|
|
6
|
+
function FieldActionIndicator({ action }) {
|
|
7
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
8
|
+
if (!editContext)
|
|
9
|
+
return null;
|
|
10
|
+
const pageViewContext = editContext.pageView;
|
|
11
|
+
const field = action.field;
|
|
12
|
+
const fieldElements = pageViewContext.editorIframeRef.current?.contentWindow?.document.querySelectorAll(`[data-fieldid="${field.fieldId}"][data-itemid="${field.item.id}"][data-language="${field.item.language}"]`);
|
|
13
|
+
if (!fieldElements)
|
|
14
|
+
return null;
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: [...fieldElements].map((element, index) => ((0, jsx_runtime_1.jsx)(SingleIndicator, { element: element }, action.field.fieldId + action.field + index))) }));
|
|
16
|
+
}
|
|
17
|
+
function SingleIndicator({ element }) {
|
|
18
|
+
const rect = element.getBoundingClientRect();
|
|
19
|
+
const indicatorRect = rect;
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: `pointer-events-none absolute focus-shadow executing-action`, style: {
|
|
21
|
+
left: indicatorRect.x,
|
|
22
|
+
top: indicatorRect.y,
|
|
23
|
+
width: indicatorRect.width,
|
|
24
|
+
height: indicatorRect.height,
|
|
25
|
+
zIndex: 800,
|
|
26
|
+
} }));
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FieldActionsIndicators = FieldActionsIndicators;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const FieldActionIndicator_1 = require("./FieldActionIndicator");
|
|
6
|
+
const editContext_1 = require("../client/editContext");
|
|
7
|
+
function FieldActionsIndicators() {
|
|
8
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
9
|
+
if (!editContext)
|
|
10
|
+
return null;
|
|
11
|
+
const actions = editContext.activeFieldActions;
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: actions
|
|
13
|
+
.filter((x) => x.state === "running")
|
|
14
|
+
.map((action) => ((0, jsx_runtime_1.jsx)(FieldActionIndicator_1.FieldActionIndicator, { action: action }, action.field.fieldId + action.field.item.id))) }));
|
|
15
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FieldEditedIndicator = FieldEditedIndicator;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const editContext_1 = require("../client/editContext");
|
|
6
|
+
function FieldEditedIndicator({ field, scale, pageViewContext, scroll, }) {
|
|
7
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
8
|
+
if (!editContext)
|
|
9
|
+
return null;
|
|
10
|
+
const fieldElements = pageViewContext.editorIframeRef.current?.contentWindow?.document.querySelectorAll(`[data-fieldid="${field.fieldId}"][data-itemid="${field.item.id}"][data-language="${field.item.language}"][data-version="${field.item.version}"]`);
|
|
11
|
+
if (!fieldElements)
|
|
12
|
+
return null;
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: [...fieldElements]
|
|
14
|
+
.filter((x) => x != editContext.inlineEditingFieldElement)
|
|
15
|
+
.map((element) => ((0, jsx_runtime_1.jsx)(SingleFieldEditedIndicator, { element: element, scale: scale, scroll: scroll }, field.fieldId + field.item.id))) }));
|
|
16
|
+
}
|
|
17
|
+
function SingleFieldEditedIndicator({ element, scale, scroll, }) {
|
|
18
|
+
const rect = element.getBoundingClientRect();
|
|
19
|
+
const indicatorRect = rect;
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: `pointer-events-none absolute focus-shadow edited-field`, style: {
|
|
21
|
+
left: indicatorRect.x * (scale || 1),
|
|
22
|
+
top: (indicatorRect.y + (scroll || 0)) * (scale || 1),
|
|
23
|
+
width: indicatorRect.width * (scale || 1),
|
|
24
|
+
height: indicatorRect.height * (scale || 1),
|
|
25
|
+
zIndex: 800,
|
|
26
|
+
} }));
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FieldEditedIndicators = FieldEditedIndicators;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const editContext_1 = require("../client/editContext");
|
|
6
|
+
const FieldEditedIndicator_1 = require("./FieldEditedIndicator");
|
|
7
|
+
function FieldEditedIndicators({ scale, pageViewContext, scroll, }) {
|
|
8
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
9
|
+
if (!editContext)
|
|
10
|
+
return null;
|
|
11
|
+
const fields = editContext.lastEditedFields;
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: fields
|
|
13
|
+
.filter((x) => x.timestamp > Date.now() - 10000 && x.user.ai)
|
|
14
|
+
.map((field) => ((0, jsx_runtime_1.jsx)(FieldEditedIndicator_1.FieldEditedIndicator, { field: field, scale: scale, pageViewContext: pageViewContext, scroll: scroll }, field.fieldId + field.item.id + field.timestamp))) }));
|
|
15
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FrameMenu = FrameMenu;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const editContext_1 = require("../client/editContext");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
const use_debounce_1 = require("use-debounce");
|
|
9
|
+
function FrameMenu({ component, mode, pageViewContext, }) {
|
|
10
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
11
|
+
const resizeObserverRef = (0, react_1.useRef)(null);
|
|
12
|
+
const mutationObserverRef = (0, react_1.useRef)(null);
|
|
13
|
+
const [componentRect, setComponentRect] = (0, react_1.useState)();
|
|
14
|
+
const updatePosition = () => {
|
|
15
|
+
if (!component || !editContext || !pageViewContext)
|
|
16
|
+
return;
|
|
17
|
+
const iframe = pageViewContext.editorIframeRef.current;
|
|
18
|
+
if (!iframe)
|
|
19
|
+
return;
|
|
20
|
+
const resetSelection = () => {
|
|
21
|
+
setComponentRect(undefined);
|
|
22
|
+
};
|
|
23
|
+
const componentRect = (0, utils_1.findComponentRect)(iframe, component.id)?.rect;
|
|
24
|
+
if (!componentRect) {
|
|
25
|
+
resetSelection();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
setComponentRect(componentRect);
|
|
29
|
+
};
|
|
30
|
+
const updatePositionThrottled = (0, use_debounce_1.useThrottledCallback)(updatePosition, 30);
|
|
31
|
+
// Effect to handle changes in the observed element
|
|
32
|
+
(0, react_1.useEffect)(() => {
|
|
33
|
+
if (component) {
|
|
34
|
+
const iframe = pageViewContext.editorIframeRef.current;
|
|
35
|
+
if (!iframe)
|
|
36
|
+
return;
|
|
37
|
+
mutationObserverRef.current = new MutationObserver(() => {
|
|
38
|
+
updatePosition();
|
|
39
|
+
});
|
|
40
|
+
if (!iframe.contentDocument)
|
|
41
|
+
return;
|
|
42
|
+
mutationObserverRef.current.observe(iframe.contentDocument, {
|
|
43
|
+
childList: true, // observe direct children changes
|
|
44
|
+
subtree: true, // observe all descendants changes
|
|
45
|
+
characterData: true, // observe text changes
|
|
46
|
+
//attributes: true, // observe attribute changes (like style or class)
|
|
47
|
+
});
|
|
48
|
+
// Create a new ResizeObserver instance
|
|
49
|
+
resizeObserverRef.current = new ResizeObserver(() => {
|
|
50
|
+
updatePosition();
|
|
51
|
+
});
|
|
52
|
+
const scrollContainer = iframe.contentWindow?.document.scrollingElement ||
|
|
53
|
+
iframe.contentWindow?.document.body;
|
|
54
|
+
scrollContainer?.addEventListener("scroll", updatePositionThrottled);
|
|
55
|
+
iframe.contentWindow?.addEventListener("scroll", updatePositionThrottled);
|
|
56
|
+
const componentRect = (0, utils_1.findComponentRect)(iframe, component.id);
|
|
57
|
+
if (!componentRect) {
|
|
58
|
+
updatePosition();
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
componentRect.elements.forEach((componentElement) => {
|
|
62
|
+
resizeObserverRef.current.observe(componentElement);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return () => {
|
|
66
|
+
if (mutationObserverRef.current) {
|
|
67
|
+
mutationObserverRef.current.disconnect();
|
|
68
|
+
mutationObserverRef.current = null;
|
|
69
|
+
}
|
|
70
|
+
if (resizeObserverRef.current) {
|
|
71
|
+
resizeObserverRef.current.disconnect();
|
|
72
|
+
resizeObserverRef.current = null;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}, [component]);
|
|
76
|
+
(0, react_1.useEffect)(() => {
|
|
77
|
+
setTimeout(() => {
|
|
78
|
+
updatePosition();
|
|
79
|
+
}, 100);
|
|
80
|
+
}, [
|
|
81
|
+
pageViewContext?.scroll,
|
|
82
|
+
pageViewContext?.viewport,
|
|
83
|
+
pageViewContext?.device,
|
|
84
|
+
pageViewContext?.fullscreen,
|
|
85
|
+
pageViewContext?.zoom,
|
|
86
|
+
]);
|
|
87
|
+
if (!component || !editContext)
|
|
88
|
+
return null;
|
|
89
|
+
const commands = editContext.getComponentCommands([component]);
|
|
90
|
+
const isDraggable = mode === "edit" &&
|
|
91
|
+
!component.layoutId &&
|
|
92
|
+
pageViewContext.page?.item.canWriteItem;
|
|
93
|
+
false;
|
|
94
|
+
const commandButtons = commands
|
|
95
|
+
.filter((x) => !editContext.isCommandDisabled({ command: x }) &&
|
|
96
|
+
x.visibilityScopes.indexOf("editFrame") >= 0)
|
|
97
|
+
.map((x) => ({
|
|
98
|
+
id: x.id + "_button",
|
|
99
|
+
icon: x.icon,
|
|
100
|
+
label: x.label,
|
|
101
|
+
onClick: (ev) => {
|
|
102
|
+
ev.stopPropagation();
|
|
103
|
+
ev.preventDefault();
|
|
104
|
+
editContext.executeCommand({
|
|
105
|
+
command: x,
|
|
106
|
+
event: ev,
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
}));
|
|
110
|
+
const customButtons = []; // TODO
|
|
111
|
+
let buttons = [...customButtons];
|
|
112
|
+
buttons = [...buttons, ...commandButtons];
|
|
113
|
+
function handleDragStart(event) {
|
|
114
|
+
if (!component?.datasourceItem)
|
|
115
|
+
return;
|
|
116
|
+
event.dataTransfer.setData("componentId", component.id);
|
|
117
|
+
setTimeout(() => {
|
|
118
|
+
if (!component?.datasourceItem)
|
|
119
|
+
return;
|
|
120
|
+
editContext.dragStart({
|
|
121
|
+
type: "component",
|
|
122
|
+
typeId: component.typeId,
|
|
123
|
+
templateId: component.datasourceItem?.templateId,
|
|
124
|
+
name: component.name,
|
|
125
|
+
component: {
|
|
126
|
+
id: component.id,
|
|
127
|
+
language: pageViewContext.page.item.language,
|
|
128
|
+
version: pageViewContext.page.item.version,
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
}, 50);
|
|
132
|
+
event.stopPropagation();
|
|
133
|
+
}
|
|
134
|
+
function handleDragEnd() {
|
|
135
|
+
editContext.dragEnd();
|
|
136
|
+
}
|
|
137
|
+
const isShared = component.datasourceItem?.id !== component.id;
|
|
138
|
+
const isReadonly = mode === "compare" || mode === "view";
|
|
139
|
+
const isLayout = component.layoutId;
|
|
140
|
+
const color = isReadonly
|
|
141
|
+
? "readonly"
|
|
142
|
+
: isShared
|
|
143
|
+
? "shared"
|
|
144
|
+
: isLayout
|
|
145
|
+
? "layout"
|
|
146
|
+
: "default";
|
|
147
|
+
const colorVariants = {
|
|
148
|
+
shared: "border-orange-400",
|
|
149
|
+
readonly: "border-purple-400",
|
|
150
|
+
layout: "border-purple-400",
|
|
151
|
+
default: "border-sky-400",
|
|
152
|
+
};
|
|
153
|
+
const bgColorVariants = {
|
|
154
|
+
shared: "bg-orange-400",
|
|
155
|
+
readonly: "bg-purple-400",
|
|
156
|
+
layout: "bg-purple-400",
|
|
157
|
+
default: "bg-sky-400",
|
|
158
|
+
};
|
|
159
|
+
if (!componentRect)
|
|
160
|
+
return null;
|
|
161
|
+
const isMultiSelected = editContext.selection.length > 1;
|
|
162
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("div", { className: `pointer-events-none absolute inset-0 border-2 ${colorVariants[color]} tour-frame-menu opacity-50 hover:opacity-100`, style: {
|
|
163
|
+
left: componentRect.x,
|
|
164
|
+
top: componentRect.y,
|
|
165
|
+
width: componentRect.width,
|
|
166
|
+
height: componentRect.height,
|
|
167
|
+
zIndex: 8,
|
|
168
|
+
}, "data-testid": "frame-menu", children: !isMultiSelected && ((0, jsx_runtime_1.jsxs)("div", { className: `editframe-menu pointer-events-auto absolute z-1000 flex items-center pr-4 text-base text-white ${bgColorVariants[color]} ` +
|
|
169
|
+
(componentRect.y - 36 < 0 ? "rounded-bl-lg" : "rounded-t-lg"), style: {
|
|
170
|
+
right: "-2px",
|
|
171
|
+
top: componentRect.y - 36 < 0 ? "0" : undefined,
|
|
172
|
+
bottom: componentRect.y - 36 >= 0
|
|
173
|
+
? componentRect.height - 2
|
|
174
|
+
: undefined,
|
|
175
|
+
zIndex: 800,
|
|
176
|
+
height: "36px",
|
|
177
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { draggable: isDraggable, onDragStart: handleDragStart, onDragEnd: handleDragEnd, className: `px-4 ${isDraggable ? "cursor-move" : "cursor-default"} `, children: component.name }), mode === "edit" && ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2", children: buttons.map((b, i) => ((0, jsx_runtime_1.jsx)("div", { className: "cursor-pointer p-1", children: typeof b.icon === "string" ? ((0, jsx_runtime_1.jsx)("i", { className: b.icon + " cursor-pointer", onClick: b.onClick, title: b.label })) : (b.icon) }, i))) }))] })) }) }));
|
|
178
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FrameMenus = FrameMenus;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const componentTreeHelper_1 = require("../componentTreeHelper");
|
|
7
|
+
const editContext_1 = require("../client/editContext");
|
|
8
|
+
const FrameMenu_1 = require("./FrameMenu");
|
|
9
|
+
function FrameMenus({ mode, pageViewContext, }) {
|
|
10
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
11
|
+
const selection = editContext?.selection;
|
|
12
|
+
const [components, setComponents] = (0, react_1.useState)([]);
|
|
13
|
+
(0, react_1.useEffect)(() => {
|
|
14
|
+
if (!pageViewContext.page)
|
|
15
|
+
return;
|
|
16
|
+
const comps = selection
|
|
17
|
+
? selection
|
|
18
|
+
.map((id) => (0, componentTreeHelper_1.findComponent)(id, pageViewContext.page?.rootComponent.placeholders || []))
|
|
19
|
+
.filter((c) => c !== undefined)
|
|
20
|
+
: [];
|
|
21
|
+
setComponents(comps);
|
|
22
|
+
}, [selection, pageViewContext.page]);
|
|
23
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [components.map((c) => ((0, jsx_runtime_1.jsx)(FrameMenu_1.FrameMenu, { component: c, mode: mode, pageViewContext: pageViewContext }, c.id))), " "] }));
|
|
24
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InlineEditor = InlineEditor;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const editContext_1 = require("../client/editContext");
|
|
6
|
+
const use_debounce_1 = require("use-debounce");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
function InlineEditor({ pageViewContext, mode, }) {
|
|
9
|
+
const context = (0, editContext_1.useEditContext)();
|
|
10
|
+
const modifiedFieldsContext = (0, editContext_1.useModifiedFieldsContext)();
|
|
11
|
+
if (!context)
|
|
12
|
+
return;
|
|
13
|
+
const mutationObserverRef = (0, react_1.useRef)(null);
|
|
14
|
+
const debouncedSetFieldvalue = (0, use_debounce_1.useThrottledCallback)((value, fieldId, fieldName, itemId, language, version) => {
|
|
15
|
+
var modifiedFieldValue = modifiedFieldsContext?.modifiedFields.find((x) => x.fieldId === fieldId &&
|
|
16
|
+
x.item.id === itemId &&
|
|
17
|
+
x.item.language === language &&
|
|
18
|
+
x.item.version === version)?.value;
|
|
19
|
+
if (modifiedFieldValue === value)
|
|
20
|
+
return;
|
|
21
|
+
context.operations.editField({
|
|
22
|
+
field: {
|
|
23
|
+
fieldId,
|
|
24
|
+
fieldName: fieldName ?? undefined,
|
|
25
|
+
item: {
|
|
26
|
+
id: itemId,
|
|
27
|
+
language,
|
|
28
|
+
version,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
refresh: "none",
|
|
32
|
+
value: value,
|
|
33
|
+
});
|
|
34
|
+
}, context.configuration.debounceFieldEditsInterval);
|
|
35
|
+
(0, react_1.useEffect)(() => {
|
|
36
|
+
if (!context || mode === "view")
|
|
37
|
+
return;
|
|
38
|
+
const element = context.inlineEditingFieldElement;
|
|
39
|
+
const editableElements = pageViewContext.editorIframeRef.current?.contentWindow?.document.querySelectorAll('[contenteditable="true"]');
|
|
40
|
+
editableElements?.forEach((element) => {
|
|
41
|
+
if (element !== context.inlineEditingFieldElement)
|
|
42
|
+
element.setAttribute("contenteditable", "false");
|
|
43
|
+
});
|
|
44
|
+
if (element) {
|
|
45
|
+
const fieldId = element.getAttribute("data-fieldid");
|
|
46
|
+
const fieldName = element.getAttribute("data-fieldname");
|
|
47
|
+
const itemId = element.getAttribute("data-itemid");
|
|
48
|
+
const language = element.getAttribute("data-language");
|
|
49
|
+
const versionText = element.getAttribute("data-version");
|
|
50
|
+
const version = versionText ? parseInt(versionText) : undefined;
|
|
51
|
+
const isRichText = element.getAttribute("data-is-richtext") === "true";
|
|
52
|
+
if (!fieldId || !itemId || !language || !version)
|
|
53
|
+
return;
|
|
54
|
+
const fieldDescriptor = (0, utils_1.getFieldDescriptorFromElement)(element);
|
|
55
|
+
const hasFielLock = (0, utils_1.hasFieldLock)(fieldDescriptor, context);
|
|
56
|
+
if (!hasFielLock)
|
|
57
|
+
return;
|
|
58
|
+
element.setAttribute("contenteditable", "true");
|
|
59
|
+
mutationObserverRef.current = new MutationObserver(() => {
|
|
60
|
+
debouncedSetFieldvalue(isRichText ? element.innerHTML : element.innerText, fieldId, fieldName, itemId, language, version);
|
|
61
|
+
});
|
|
62
|
+
element.focus();
|
|
63
|
+
mutationObserverRef.current.observe(element, {
|
|
64
|
+
childList: true, // observe direct children changes
|
|
65
|
+
subtree: true, // observe all descendants changes
|
|
66
|
+
characterData: true, // observe text changes
|
|
67
|
+
//attributes: true, // observe attribute changes (like style or class)
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return () => {
|
|
71
|
+
if (mutationObserverRef.current) {
|
|
72
|
+
mutationObserverRef.current.disconnect();
|
|
73
|
+
mutationObserverRef.current = null;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}, [context?.inlineEditingFieldElement]);
|
|
77
|
+
(0, react_1.useEffect)(() => {
|
|
78
|
+
const updateFields = async () => {
|
|
79
|
+
modifiedFieldsContext?.modifiedFields.forEach((field) => {
|
|
80
|
+
const elements = pageViewContext.editorIframeRef.current.contentWindow?.document.querySelectorAll(`[data-fieldid="${field.fieldId}"][data-itemid="${field.item.id}"][data-language="${field.item.language}"][data-version="${field.item.version}"`);
|
|
81
|
+
elements?.forEach(async (element) => {
|
|
82
|
+
if (element && element !== context?.inlineEditingFieldElement) {
|
|
83
|
+
const realField = await context.itemsRepository.getField(field);
|
|
84
|
+
const fieldType = realField?.type;
|
|
85
|
+
if (fieldType === "rich text" ||
|
|
86
|
+
fieldType === "single-line text" ||
|
|
87
|
+
fieldType === "multi-line text") {
|
|
88
|
+
element.innerHTML = field?.value ? field.value : "";
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
updateFields();
|
|
95
|
+
}, [
|
|
96
|
+
modifiedFieldsContext?.modifiedFields,
|
|
97
|
+
context?.itemsRepository.revision,
|
|
98
|
+
context?.inlineEditingFieldElement,
|
|
99
|
+
]);
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LockedFieldIndicator = LockedFieldIndicator;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const editContext_1 = require("../client/editContext");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
|
+
function LockedFieldIndicator() {
|
|
8
|
+
const editContext = (0, editContext_1.useEditContext)();
|
|
9
|
+
if (!editContext)
|
|
10
|
+
return;
|
|
11
|
+
const sessionsWithFieldLock = editContext.activeSessions.filter((x) => x.fieldLock && x.sessionId !== editContext.sessionId);
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: sessionsWithFieldLock.map((session) => {
|
|
13
|
+
if (!session.fieldLock)
|
|
14
|
+
return;
|
|
15
|
+
const iframe = editContext.pageView.editorIframeRef.current;
|
|
16
|
+
if (!iframe)
|
|
17
|
+
return;
|
|
18
|
+
const element = (0, utils_1.findFieldElement)(iframe, session.fieldLock);
|
|
19
|
+
if (!element)
|
|
20
|
+
return;
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)(FieldLock, { element: element, iframe: iframe, session: session }, session.sessionId));
|
|
22
|
+
}) }));
|
|
23
|
+
}
|
|
24
|
+
function FieldLock({ element, iframe, session, }) {
|
|
25
|
+
const rect = element.getBoundingClientRect();
|
|
26
|
+
const editorRect = iframe.getBoundingClientRect();
|
|
27
|
+
if (rect && editorRect) {
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "absolute text-xs text-white p-0.5 rounded hover:opacity-100 opacity-90", style: {
|
|
29
|
+
left: rect.left + "px",
|
|
30
|
+
top: rect.top + "px",
|
|
31
|
+
background: session.color,
|
|
32
|
+
}, children: session.user.name }));
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|