@alpaca-editor/core 1.0.3767 → 1.0.3769
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client-components/api.d.ts +1 -0
- package/dist/client-components/api.js +1 -4
- package/dist/client-components/index.d.ts +16 -0
- package/dist/client-components/index.js +16 -36
- package/dist/components/ActionButton.d.ts +12 -0
- package/dist/components/ActionButton.js +4 -8
- package/dist/components/Error.d.ts +9 -0
- package/dist/components/Error.js +8 -13
- package/dist/config/config.d.ts +6 -0
- package/dist/config/config.js +145 -153
- package/dist/config/types.d.ts +223 -0
- package/dist/config/types.js +1 -2
- package/dist/editor/ComponentInfo.d.ts +4 -0
- package/dist/editor/ComponentInfo.js +12 -15
- package/dist/editor/ConfirmationDialog.d.ts +19 -0
- package/dist/editor/ConfirmationDialog.js +11 -13
- package/dist/editor/ContentTree.d.ts +35 -0
- package/dist/editor/ContentTree.js +56 -59
- package/dist/editor/ContextMenu.d.ts +13 -0
- package/dist/editor/ContextMenu.js +9 -13
- package/dist/editor/Editor.d.ts +11 -0
- package/dist/editor/Editor.js +21 -27
- package/dist/editor/EditorWarning.d.ts +5 -0
- package/dist/editor/EditorWarning.js +4 -7
- package/dist/editor/EditorWarnings.d.ts +9 -0
- package/dist/editor/EditorWarnings.js +6 -12
- package/dist/editor/FieldEditorPopup.d.ts +10 -0
- package/dist/editor/FieldEditorPopup.js +10 -13
- package/dist/editor/FieldHistory.d.ts +6 -0
- package/dist/editor/FieldHistory.js +17 -20
- package/dist/editor/FieldList.d.ts +16 -0
- package/dist/editor/FieldList.js +17 -23
- package/dist/editor/FieldListField.d.ts +14 -0
- package/dist/editor/FieldListField.js +44 -48
- package/dist/editor/FieldListFieldWithFallbacks.d.ts +10 -0
- package/dist/editor/FieldListFieldWithFallbacks.js +21 -27
- package/dist/editor/FloatingToolbar.d.ts +7 -0
- package/dist/editor/FloatingToolbar.js +20 -23
- package/dist/editor/ImageEditor.d.ts +5 -0
- package/dist/editor/ImageEditor.js +11 -14
- package/dist/editor/InsertMenu.d.ts +8 -0
- package/dist/editor/InsertMenu.js +37 -44
- package/dist/editor/ItemInfo.d.ts +4 -0
- package/dist/editor/ItemInfo.js +11 -14
- package/dist/editor/LinkEditorDialog.d.ts +15 -0
- package/dist/editor/LinkEditorDialog.js +27 -33
- package/dist/editor/MainLayout.d.ts +9 -0
- package/dist/editor/MainLayout.js +16 -22
- package/dist/editor/NewEditorClient.d.ts +5 -0
- package/dist/editor/NewEditorClient.js +3 -6
- package/dist/editor/PictureCropper.d.ts +6 -0
- package/dist/editor/PictureCropper.js +31 -37
- package/dist/editor/PictureEditor.d.ts +8 -0
- package/dist/editor/PictureEditor.js +15 -18
- package/dist/editor/PictureEditorDialog.d.ts +8 -0
- package/dist/editor/PictureEditorDialog.js +28 -34
- package/dist/editor/ScrollingContentTree.d.ts +6 -0
- package/dist/editor/ScrollingContentTree.js +10 -16
- package/dist/editor/Terminal.d.ts +14 -0
- package/dist/editor/Terminal.js +20 -23
- package/dist/editor/Titlebar.d.ts +1 -0
- package/dist/editor/Titlebar.js +5 -8
- package/dist/editor/ai/AiPopup.d.ts +10 -0
- package/dist/editor/ai/AiPopup.js +10 -13
- package/dist/editor/ai/AiResponseMessage.d.ts +8 -0
- package/dist/editor/ai/AiResponseMessage.js +12 -15
- package/dist/editor/ai/AiTerminal.d.ts +34 -0
- package/dist/editor/ai/AiTerminal.js +41 -47
- package/dist/editor/ai/AiToolCall.d.ts +9 -0
- package/dist/editor/ai/AiToolCall.js +8 -11
- package/dist/editor/ai/EditorAiTerminal.d.ts +5 -0
- package/dist/editor/ai/EditorAiTerminal.js +5 -8
- package/dist/editor/ai/editorAiContext.d.ts +11 -0
- package/dist/editor/ai/editorAiContext.js +1 -4
- package/dist/editor/client/DialogContext.d.ts +12 -0
- package/dist/editor/client/DialogContext.js +9 -14
- package/dist/editor/client/EditorClient.d.ts +26 -0
- package/dist/editor/client/EditorClient.js +177 -216
- package/dist/editor/client/GenericDialog.d.ts +10 -0
- package/dist/editor/client/GenericDialog.js +11 -14
- package/dist/editor/client/editContext.d.ts +199 -0
- package/dist/editor/client/editContext.js +14 -54
- package/dist/editor/client/helpers.d.ts +12 -0
- package/dist/editor/client/helpers.js +1 -4
- package/dist/editor/client/itemsRepository.d.ts +24 -0
- package/dist/editor/client/itemsRepository.js +22 -25
- package/dist/editor/client/operations.d.ts +57 -0
- package/dist/editor/client/operations.js +47 -53
- package/dist/editor/client/pageModelBuilder.d.ts +6 -0
- package/dist/editor/client/pageModelBuilder.js +10 -13
- package/dist/editor/commands/commands.d.ts +19 -0
- package/dist/editor/commands/commands.js +1 -2
- package/dist/editor/commands/componentCommands.d.ts +13 -0
- package/dist/editor/commands/componentCommands.js +7 -14
- package/dist/editor/commands/createVersionCommand.d.ts +4 -0
- package/dist/editor/commands/createVersionCommand.js +5 -8
- package/dist/editor/commands/deleteVersionCommand.d.ts +4 -0
- package/dist/editor/commands/deleteVersionCommand.js +5 -8
- package/dist/editor/commands/itemCommands.d.ts +17 -0
- package/dist/editor/commands/itemCommands.js +9 -12
- package/dist/editor/commands/localizeItem/LocalizeItemDialog.d.ts +8 -0
- package/dist/editor/commands/localizeItem/LocalizeItemDialog.js +23 -29
- package/dist/editor/commands/undo.d.ts +15 -0
- package/dist/editor/commands/undo.js +2 -6
- package/dist/editor/component-designer/ComponentDesigner.d.ts +1 -0
- package/dist/editor/component-designer/ComponentDesigner.js +21 -24
- package/dist/editor/component-designer/ComponentDesignerAiTerminal.d.ts +1 -0
- package/dist/editor/component-designer/ComponentDesignerAiTerminal.js +5 -8
- package/dist/editor/component-designer/ComponentDesignerMenu.d.ts +1 -0
- package/dist/editor/component-designer/ComponentDesignerMenu.js +14 -17
- package/dist/editor/component-designer/ComponentEditor.d.ts +4 -0
- package/dist/editor/component-designer/ComponentEditor.js +19 -22
- package/dist/editor/component-designer/ComponentRenderingCodeEditor.d.ts +5 -0
- package/dist/editor/component-designer/ComponentRenderingCodeEditor.js +5 -11
- package/dist/editor/component-designer/ComponentRenderingEditor.d.ts +1 -0
- package/dist/editor/component-designer/ComponentRenderingEditor.js +18 -21
- package/dist/editor/component-designer/ComponentsDropdown.d.ts +4 -0
- package/dist/editor/component-designer/ComponentsDropdown.js +8 -11
- package/dist/editor/component-designer/PlaceholdersEditor.d.ts +4 -0
- package/dist/editor/component-designer/PlaceholdersEditor.js +17 -20
- package/dist/editor/component-designer/RenderingsDropdown.d.ts +1 -0
- package/dist/editor/component-designer/RenderingsDropdown.js +6 -9
- package/dist/editor/component-designer/TemplateEditor.d.ts +1 -0
- package/dist/editor/component-designer/TemplateEditor.js +21 -24
- package/dist/editor/component-designer/aiContext.d.ts +5 -0
- package/dist/editor/component-designer/aiContext.js +3 -6
- package/dist/editor/componentTreeHelper.d.ts +16 -0
- package/dist/editor/componentTreeHelper.js +8 -19
- package/dist/editor/control-center/ControlCenterMenu.d.ts +1 -0
- package/dist/editor/control-center/ControlCenterMenu.js +15 -18
- package/dist/editor/control-center/IndexOverview.d.ts +1 -0
- package/dist/editor/control-center/IndexOverview.js +12 -15
- package/dist/editor/control-center/IndexSettings.d.ts +5 -0
- package/dist/editor/control-center/IndexSettings.js +29 -32
- package/dist/editor/control-center/Status.d.ts +1 -0
- package/dist/editor/control-center/Status.js +3 -6
- package/dist/editor/editor-warnings/ItemLocked.d.ts +2 -0
- package/dist/editor/editor-warnings/ItemLocked.js +7 -10
- package/dist/editor/editor-warnings/NoLanguageWriteAccess.d.ts +2 -0
- package/dist/editor/editor-warnings/NoLanguageWriteAccess.js +6 -9
- package/dist/editor/editor-warnings/NoWorkflowWriteAccess.d.ts +2 -0
- package/dist/editor/editor-warnings/NoWorkflowWriteAccess.js +6 -9
- package/dist/editor/editor-warnings/NoWriteAccess.d.ts +2 -0
- package/dist/editor/editor-warnings/NoWriteAccess.js +6 -9
- package/dist/editor/editor-warnings/ValidationErrors.d.ts +2 -0
- package/dist/editor/editor-warnings/ValidationErrors.js +5 -8
- package/dist/editor/field-types/AttachmentEditor.d.ts +4 -0
- package/dist/editor/field-types/AttachmentEditor.js +3 -6
- package/dist/editor/field-types/CheckboxEditor.d.ts +5 -0
- package/dist/editor/field-types/CheckboxEditor.js +11 -14
- package/dist/editor/field-types/DropLinkEditor.d.ts +5 -0
- package/dist/editor/field-types/DropLinkEditor.js +14 -17
- package/dist/editor/field-types/DropListEditor.d.ts +5 -0
- package/dist/editor/field-types/DropListEditor.js +12 -15
- package/dist/editor/field-types/ImageFieldEditor.d.ts +5 -0
- package/dist/editor/field-types/ImageFieldEditor.js +10 -13
- package/dist/editor/field-types/InternalLinkFieldEditor.d.ts +5 -0
- package/dist/editor/field-types/InternalLinkFieldEditor.js +20 -26
- package/dist/editor/field-types/LinkFieldEditor.d.ts +5 -0
- package/dist/editor/field-types/LinkFieldEditor.js +12 -15
- package/dist/editor/field-types/MultiLineText.d.ts +6 -0
- package/dist/editor/field-types/MultiLineText.js +11 -14
- package/dist/editor/field-types/PictureFieldEditor.d.ts +5 -0
- package/dist/editor/field-types/PictureFieldEditor.js +13 -16
- package/dist/editor/field-types/RawEditor.d.ts +5 -0
- package/dist/editor/field-types/RawEditor.js +12 -15
- package/dist/editor/field-types/ReactQuill.d.ts +125 -0
- package/dist/editor/field-types/ReactQuill.js +100 -82
- package/dist/editor/field-types/RichTextEditor.d.ts +5 -0
- package/dist/editor/field-types/RichTextEditor.js +5 -44
- package/dist/editor/field-types/RichTextEditorComponent.d.ts +6 -0
- package/dist/editor/field-types/RichTextEditorComponent.js +16 -19
- package/dist/editor/field-types/SingleLineText.d.ts +6 -0
- package/dist/editor/field-types/SingleLineText.js +13 -16
- package/dist/editor/field-types/TreeListEditor.d.ts +5 -0
- package/dist/editor/field-types/TreeListEditor.js +33 -39
- package/dist/editor/fieldTypes.d.ts +117 -0
- package/dist/editor/fieldTypes.js +1 -2
- package/dist/editor/media-selector/AiImageSearch.d.ts +4 -0
- package/dist/editor/media-selector/AiImageSearch.js +30 -36
- package/dist/editor/media-selector/AiImageSearchPrompt.d.ts +3 -0
- package/dist/editor/media-selector/AiImageSearchPrompt.js +18 -21
- package/dist/editor/media-selector/MediaSelector.d.ts +9 -0
- package/dist/editor/media-selector/MediaSelector.js +5 -9
- package/dist/editor/media-selector/Preview.d.ts +4 -0
- package/dist/editor/media-selector/Preview.js +3 -6
- package/dist/editor/media-selector/Thumbnails.d.ts +13 -0
- package/dist/editor/media-selector/Thumbnails.js +5 -8
- package/dist/editor/media-selector/TreeSelector.d.ts +7 -0
- package/dist/editor/media-selector/TreeSelector.js +39 -46
- package/dist/editor/media-selector/UploadZone.d.ts +4 -0
- package/dist/editor/media-selector/UploadZone.js +17 -20
- package/dist/editor/menubar/ActionsMenu.d.ts +1 -0
- package/dist/editor/menubar/ActionsMenu.js +10 -13
- package/dist/editor/menubar/ActiveUsers.d.ts +1 -0
- package/dist/editor/menubar/ActiveUsers.js +7 -10
- package/dist/editor/menubar/ApproveAndPublish.d.ts +1 -0
- package/dist/editor/menubar/ApproveAndPublish.js +5 -8
- package/dist/editor/menubar/BrowseHistory.d.ts +6 -0
- package/dist/editor/menubar/BrowseHistory.js +6 -9
- package/dist/editor/menubar/ItemLanguageVersion.d.ts +1 -0
- package/dist/editor/menubar/ItemLanguageVersion.js +16 -19
- package/dist/editor/menubar/LanguageSelector.d.ts +9 -0
- package/dist/editor/menubar/LanguageSelector.js +12 -15
- package/dist/editor/menubar/Menu.d.ts +1 -0
- package/dist/editor/menubar/Menu.js +12 -15
- package/dist/editor/menubar/NavButtons.d.ts +1 -0
- package/dist/editor/menubar/NavButtons.js +8 -11
- package/dist/editor/menubar/PageSelector.d.ts +4 -0
- package/dist/editor/menubar/PageSelector.js +16 -19
- package/dist/editor/menubar/PageViewerControls.d.ts +1 -0
- package/dist/editor/menubar/PageViewerControls.js +13 -16
- package/dist/editor/menubar/Separator.d.ts +3 -0
- package/dist/editor/menubar/Separator.js +4 -7
- package/dist/editor/menubar/SiteInfo.d.ts +1 -0
- package/dist/editor/menubar/SiteInfo.js +13 -16
- package/dist/editor/menubar/User.d.ts +4 -0
- package/dist/editor/menubar/User.js +5 -8
- package/dist/editor/menubar/VersionSelector.d.ts +9 -0
- package/dist/editor/menubar/VersionSelector.js +18 -21
- package/dist/editor/page-editor-chrome/CommentHighlighting.d.ts +6 -0
- package/dist/editor/page-editor-chrome/CommentHighlighting.js +16 -19
- package/dist/editor/page-editor-chrome/CommentHighlightings.d.ts +4 -0
- package/dist/editor/page-editor-chrome/CommentHighlightings.js +10 -13
- package/dist/editor/page-editor-chrome/FieldActionIndicator.d.ts +4 -0
- package/dist/editor/page-editor-chrome/FieldActionIndicator.js +6 -9
- package/dist/editor/page-editor-chrome/FieldActionIndicators.d.ts +1 -0
- package/dist/editor/page-editor-chrome/FieldActionIndicators.js +7 -10
- package/dist/editor/page-editor-chrome/FieldEditedIndicator.d.ts +8 -0
- package/dist/editor/page-editor-chrome/FieldEditedIndicator.js +7 -10
- package/dist/editor/page-editor-chrome/FieldEditedIndicators.d.ts +6 -0
- package/dist/editor/page-editor-chrome/FieldEditedIndicators.js +7 -10
- package/dist/editor/page-editor-chrome/FrameMenu.d.ts +7 -0
- package/dist/editor/page-editor-chrome/FrameMenu.js +18 -21
- package/dist/editor/page-editor-chrome/FrameMenus.d.ts +5 -0
- package/dist/editor/page-editor-chrome/FrameMenus.js +11 -14
- package/dist/editor/page-editor-chrome/InlineEditor.d.ts +5 -0
- package/dist/editor/page-editor-chrome/InlineEditor.js +13 -16
- package/dist/editor/page-editor-chrome/LockedFieldIndicator.d.ts +1 -0
- package/dist/editor/page-editor-chrome/LockedFieldIndicator.js +9 -12
- package/dist/editor/page-editor-chrome/NoLayout.d.ts +1 -0
- package/dist/editor/page-editor-chrome/NoLayout.js +8 -11
- package/dist/editor/page-editor-chrome/PageEditorChrome.d.ts +6 -0
- package/dist/editor/page-editor-chrome/PageEditorChrome.js +16 -19
- package/dist/editor/page-editor-chrome/PictureEditorOverlay.d.ts +1 -0
- package/dist/editor/page-editor-chrome/PictureEditorOverlay.js +18 -21
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.d.ts +14 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +15 -18
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.d.ts +5 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js +13 -16
- package/dist/editor/page-viewer/DeviceToolbar.d.ts +6 -0
- package/dist/editor/page-viewer/DeviceToolbar.js +11 -14
- package/dist/editor/page-viewer/EditorForm.d.ts +5 -0
- package/dist/editor/page-viewer/EditorForm.js +22 -25
- package/dist/editor/page-viewer/MiniMap.d.ts +9 -0
- package/dist/editor/page-viewer/MiniMap.js +27 -63
- package/dist/editor/page-viewer/PageViewer.d.ts +8 -0
- package/dist/editor/page-viewer/PageViewer.js +21 -24
- package/dist/editor/page-viewer/PageViewerFrame.d.ts +11 -0
- package/dist/editor/page-viewer/PageViewerFrame.js +62 -69
- package/dist/editor/page-viewer/pageViewContext.d.ts +38 -0
- package/dist/editor/page-viewer/pageViewContext.js +26 -29
- package/dist/editor/pageModel.d.ts +171 -0
- package/dist/editor/pageModel.js +1 -2
- package/dist/editor/picture-shared.d.ts +16 -0
- package/dist/editor/picture-shared.js +2 -6
- package/dist/editor/reviews/Comment.d.ts +4 -0
- package/dist/editor/reviews/Comment.js +32 -35
- package/dist/editor/reviews/Comments.d.ts +1 -0
- package/dist/editor/reviews/Comments.js +14 -17
- package/dist/editor/reviews/PreviewInfo.d.ts +1 -0
- package/dist/editor/reviews/PreviewInfo.js +6 -9
- package/dist/editor/reviews/Reviews.d.ts +1 -0
- package/dist/editor/reviews/Reviews.js +36 -42
- package/dist/editor/reviews/reviewCommands.d.ts +3 -0
- package/dist/editor/reviews/reviewCommands.js +8 -11
- package/dist/editor/reviews/useReviews.d.ts +12 -0
- package/dist/editor/reviews/useReviews.js +11 -17
- package/dist/editor/services/aiService.d.ts +34 -0
- package/dist/editor/services/aiService.js +5 -10
- package/dist/editor/services/componentDesignerService.d.ts +46 -0
- package/dist/editor/services/componentDesignerService.js +14 -22
- package/dist/editor/services/contentService.d.ts +34 -0
- package/dist/editor/services/contentService.js +18 -31
- package/dist/editor/services/editService.d.ts +34 -0
- package/dist/editor/services/editService.js +48 -77
- package/dist/editor/services/indexService.d.ts +6 -0
- package/dist/editor/services/indexService.js +11 -18
- package/dist/editor/services/reviewsService.d.ts +12 -0
- package/dist/editor/services/reviewsService.js +30 -42
- package/dist/editor/services/serviceHelper.d.ts +9 -0
- package/dist/editor/services/serviceHelper.js +2 -6
- package/dist/editor/services/systemService.d.ts +2 -0
- package/dist/editor/services/systemService.js +3 -6
- package/dist/editor/services/translationService.d.ts +11 -0
- package/dist/editor/services/translationService.js +7 -12
- package/dist/editor/services-server/api.d.ts +19 -0
- package/dist/editor/services-server/api.js +10 -19
- package/dist/editor/services-server/graphQL.d.ts +29 -0
- package/dist/editor/services-server/graphQL.js +5 -9
- package/dist/editor/sidebar/ComponentPalette.d.ts +1 -0
- package/dist/editor/sidebar/ComponentPalette.js +19 -22
- package/dist/editor/sidebar/ComponentTree.d.ts +1 -0
- package/dist/editor/sidebar/ComponentTree.js +26 -29
- package/dist/editor/sidebar/Debug.d.ts +1 -0
- package/dist/editor/sidebar/Debug.js +20 -23
- package/dist/editor/sidebar/DictionaryEditor.d.ts +1 -0
- package/dist/editor/sidebar/DictionaryEditor.js +45 -48
- package/dist/editor/sidebar/EditHistory.d.ts +1 -0
- package/dist/editor/sidebar/EditHistory.js +22 -25
- package/dist/editor/sidebar/GraphQL.d.ts +1 -0
- package/dist/editor/sidebar/GraphQL.js +17 -20
- package/dist/editor/sidebar/Insert.d.ts +1 -0
- package/dist/editor/sidebar/Insert.js +10 -13
- package/dist/editor/sidebar/MainContentTree.d.ts +4 -0
- package/dist/editor/sidebar/MainContentTree.js +16 -22
- package/dist/editor/sidebar/Performance.d.ts +1 -0
- package/dist/editor/sidebar/Performance.js +7 -10
- package/dist/editor/sidebar/Sessions.d.ts +1 -0
- package/dist/editor/sidebar/Sessions.js +7 -10
- package/dist/editor/sidebar/Sidebar.d.ts +1 -0
- package/dist/editor/sidebar/Sidebar.js +6 -9
- package/dist/editor/sidebar/SidebarView.d.ts +8 -0
- package/dist/editor/sidebar/SidebarView.js +18 -21
- package/dist/editor/sidebar/Translations.d.ts +1 -0
- package/dist/editor/sidebar/Translations.js +31 -34
- package/dist/editor/sidebar/Validation.d.ts +1 -0
- package/dist/editor/sidebar/Validation.js +11 -14
- package/dist/editor/sidebar/ViewSelector.d.ts +1 -0
- package/dist/editor/sidebar/ViewSelector.js +8 -11
- package/dist/editor/sidebar/Workbox.d.ts +1 -0
- package/dist/editor/sidebar/Workbox.js +20 -23
- package/dist/editor/ui/CenteredMessage.d.ts +3 -0
- package/dist/editor/ui/CenteredMessage.js +3 -6
- package/dist/editor/ui/CopyToClipboardButton.d.ts +3 -0
- package/dist/editor/ui/CopyToClipboardButton.js +5 -8
- package/dist/editor/ui/DialogButtons.d.ts +3 -0
- package/dist/editor/ui/DialogButtons.js +3 -6
- package/dist/editor/ui/Icons.d.ts +38 -0
- package/dist/editor/ui/Icons.js +54 -74
- package/dist/editor/ui/ItemNameDialog.d.ts +11 -0
- package/dist/editor/ui/ItemNameDialog.js +16 -22
- package/dist/editor/ui/ItemNameDialogNew.d.ts +10 -0
- package/dist/editor/ui/ItemNameDialogNew.js +22 -28
- package/dist/editor/ui/ItemSearch.d.ts +23 -0
- package/dist/editor/ui/ItemSearch.js +24 -28
- package/dist/editor/ui/PerfectTree.d.ts +60 -0
- package/dist/editor/ui/PerfectTree.js +39 -76
- package/dist/editor/ui/Section.d.ts +4 -0
- package/dist/editor/ui/Section.js +7 -10
- package/dist/editor/ui/SimpleIconButton.d.ts +11 -0
- package/dist/editor/ui/SimpleIconButton.js +4 -7
- package/dist/editor/ui/SimpleMenu.d.ts +13 -0
- package/dist/editor/ui/SimpleMenu.js +4 -7
- package/dist/editor/ui/SimpleTable.d.ts +14 -0
- package/dist/editor/ui/SimpleTable.js +5 -8
- package/dist/editor/ui/SimpleTabs.d.ts +12 -0
- package/dist/editor/ui/SimpleTabs.js +4 -7
- package/dist/editor/ui/SimpleToolbar.d.ts +3 -0
- package/dist/editor/ui/SimpleToolbar.js +3 -6
- package/dist/editor/ui/Spinner.d.ts +3 -0
- package/dist/editor/ui/Spinner.js +3 -6
- package/dist/editor/ui/Splitter.d.ts +15 -0
- package/dist/editor/ui/Splitter.js +16 -53
- package/dist/editor/ui/StackedPanels.d.ts +5 -0
- package/dist/editor/ui/StackedPanels.js +18 -21
- package/dist/editor/ui/Toolbar.d.ts +3 -0
- package/dist/editor/ui/Toolbar.js +3 -6
- package/dist/editor/utils/id-helper.d.ts +1 -0
- package/dist/editor/utils/id-helper.js +1 -4
- package/dist/editor/utils/insertOptions.d.ts +3 -0
- package/dist/editor/utils/insertOptions.js +3 -6
- package/dist/editor/utils/itemutils.d.ts +3 -0
- package/dist/editor/utils/itemutils.js +3 -7
- package/dist/editor/utils/useMemoDebug.d.ts +1 -0
- package/dist/editor/utils/useMemoDebug.js +4 -7
- package/dist/editor/utils.d.ts +44 -0
- package/dist/editor/utils.js +27 -48
- package/dist/editor/views/CompareView.d.ts +1 -0
- package/dist/editor/views/CompareView.js +31 -34
- package/dist/editor/views/EditView.d.ts +1 -0
- package/dist/editor/views/EditView.js +9 -12
- package/dist/editor/views/ItemEditor.d.ts +7 -0
- package/dist/editor/views/ItemEditor.js +9 -12
- package/dist/editor/views/SingleEditView.d.ts +8 -0
- package/dist/editor/views/SingleEditView.js +12 -15
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -22
- package/dist/page-wizard/PageWizard.d.ts +70 -0
- package/dist/page-wizard/PageWizard.js +16 -19
- package/dist/page-wizard/SelectWizard.d.ts +7 -0
- package/dist/page-wizard/SelectWizard.js +16 -19
- package/dist/page-wizard/WizardSteps.d.ts +8 -0
- package/dist/page-wizard/WizardSteps.js +20 -23
- package/dist/page-wizard/service.d.ts +15 -0
- package/dist/page-wizard/service.js +6 -11
- package/dist/page-wizard/startPageWizardCommand.d.ts +13 -0
- package/dist/page-wizard/startPageWizardCommand.js +1 -4
- package/dist/page-wizard/steps/BuildPageStep.d.ts +2 -0
- package/dist/page-wizard/steps/BuildPageStep.js +27 -33
- package/dist/page-wizard/steps/CollectStep.d.ts +2 -0
- package/dist/page-wizard/steps/CollectStep.js +21 -27
- package/dist/page-wizard/steps/ComponentTypesSelector.d.ts +11 -0
- package/dist/page-wizard/steps/ComponentTypesSelector.js +21 -24
- package/dist/page-wizard/steps/Components.d.ts +9 -0
- package/dist/page-wizard/steps/Components.js +16 -22
- package/dist/page-wizard/steps/CreatePage.d.ts +12 -0
- package/dist/page-wizard/steps/CreatePage.js +25 -28
- package/dist/page-wizard/steps/CreatePageAndLayoutStep.d.ts +2 -0
- package/dist/page-wizard/steps/CreatePageAndLayoutStep.js +38 -41
- package/dist/page-wizard/steps/EditButton.d.ts +8 -0
- package/dist/page-wizard/steps/EditButton.js +3 -6
- package/dist/page-wizard/steps/FieldEditor.d.ts +5 -0
- package/dist/page-wizard/steps/FieldEditor.js +9 -12
- package/dist/page-wizard/steps/Generate.d.ts +5 -0
- package/dist/page-wizard/steps/Generate.js +6 -8
- package/dist/page-wizard/steps/ImagesStep.d.ts +2 -0
- package/dist/page-wizard/steps/ImagesStep.js +32 -36
- package/dist/page-wizard/steps/LayoutStep.d.ts +2 -0
- package/dist/page-wizard/steps/LayoutStep.js +27 -30
- package/dist/page-wizard/steps/SelectStep.d.ts +2 -0
- package/dist/page-wizard/steps/SelectStep.js +29 -35
- package/dist/page-wizard/steps/schema.d.ts +13 -0
- package/dist/page-wizard/steps/schema.js +2 -6
- package/dist/page-wizard/steps/usePageCreator.d.ts +6 -0
- package/dist/page-wizard/steps/usePageCreator.js +13 -16
- package/dist/splash-screen/NewPage.d.ts +3 -0
- package/dist/splash-screen/NewPage.js +39 -42
- package/dist/splash-screen/SectionHeadline.d.ts +4 -0
- package/dist/splash-screen/SectionHeadline.js +5 -8
- package/dist/splash-screen/SplashScreen.d.ts +1 -0
- package/dist/splash-screen/SplashScreen.js +23 -26
- package/dist/tour/Tour.d.ts +3 -0
- package/dist/tour/Tour.js +17 -20
- package/dist/tour/default-tour.d.ts +9 -0
- package/dist/tour/default-tour.js +10 -13
- package/dist/tour/preview-tour.d.ts +2 -0
- package/dist/tour/preview-tour.js +12 -15
- package/dist/types.d.ts +259 -0
- package/dist/types.js +1 -2
- package/package.json +1 -1
- package/tsconfig.build.json +16 -12
- package/dist/tsconfig.build.tsbuildinfo +0 -1
|
@@ -1,50 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const NoLayout_1 = require("../page-editor-chrome/NoLayout");
|
|
23
|
-
const Spinner_1 = require("../ui/Spinner");
|
|
24
|
-
const DeviceToolbar_1 = require("./DeviceToolbar");
|
|
25
|
-
function PageViewerFrame({ mode, pageViewContext, }) {
|
|
26
|
-
const editContext = (0, editContext_1.useEditContext)();
|
|
27
|
-
const pathname = (0, navigation_1.usePathname)();
|
|
28
|
-
const pageViewContextRef = (0, react_1.useRef)(undefined);
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { MiniMap } from "./MiniMap";
|
|
4
|
+
import { useEditContext, useEditContextRef } from "../client/editContext";
|
|
5
|
+
import { useDebouncedCallback, useThrottledCallback } from "use-debounce";
|
|
6
|
+
import { PageEditorChrome } from "../page-editor-chrome/PageEditorChrome";
|
|
7
|
+
import morphdom from "morphdom";
|
|
8
|
+
import uuid from "react-uuid";
|
|
9
|
+
import { findComponentRect, findFieldElement, findNearestComponentId, findParentComponentId, findParentWithAttribute, getAbsolutePosition, getFieldDescriptorFromElement, findClosestFieldElement, } from "../utils";
|
|
10
|
+
import { getComponentById } from "../componentTreeHelper";
|
|
11
|
+
import { showComponentContextMenu } from "../ContextMenu";
|
|
12
|
+
import { loadFieldButtons } from "../services/editService";
|
|
13
|
+
import { usePathname } from "next/navigation";
|
|
14
|
+
import { EditorWarnings } from "../EditorWarnings";
|
|
15
|
+
import { NoLayout } from "../page-editor-chrome/NoLayout";
|
|
16
|
+
import { Spinner } from "../ui/Spinner";
|
|
17
|
+
import { DeviceToolbar } from "./DeviceToolbar";
|
|
18
|
+
export function PageViewerFrame({ mode, pageViewContext, }) {
|
|
19
|
+
const editContext = useEditContext();
|
|
20
|
+
const pathname = usePathname();
|
|
21
|
+
const pageViewContextRef = useRef(undefined);
|
|
29
22
|
if (!editContext || !pageViewContext)
|
|
30
23
|
return null;
|
|
31
|
-
|
|
24
|
+
useEffect(() => {
|
|
32
25
|
pageViewContextRef.current = pageViewContext;
|
|
33
26
|
}, [pageViewContext]);
|
|
34
|
-
const editContextRef =
|
|
27
|
+
const editContextRef = useEditContextRef();
|
|
35
28
|
const iframeRef = pageViewContext.editorIframeRef;
|
|
36
|
-
const [showSpinner, setShowSpinner] =
|
|
37
|
-
const [scroll, setScroll] =
|
|
38
|
-
const [showMiniMap, setShowMiniMap] =
|
|
29
|
+
const [showSpinner, setShowSpinner] = useState(false);
|
|
30
|
+
const [scroll, setScroll] = useState(0);
|
|
31
|
+
const [showMiniMap, setShowMiniMap] = useState(false);
|
|
39
32
|
const zoom = pageViewContext.zoom;
|
|
40
|
-
const blockBlurEventRef =
|
|
41
|
-
const [currentItemDescriptor, setCurrentItemDescriptor] =
|
|
33
|
+
const blockBlurEventRef = useRef(0);
|
|
34
|
+
const [currentItemDescriptor, setCurrentItemDescriptor] = useState(undefined);
|
|
42
35
|
const pageItemDescriptor = pageViewContext.pageItemDescriptor;
|
|
43
|
-
|
|
36
|
+
useEffect(() => {
|
|
44
37
|
//Workaround for iframeref updates not propagating to usePageViewContext
|
|
45
38
|
pageViewContext.setWorkaround((x) => !x);
|
|
46
39
|
}, [iframeRef.current]);
|
|
47
|
-
const updateMiniMapVisibility =
|
|
40
|
+
const updateMiniMapVisibility = useDebouncedCallback(() => {
|
|
48
41
|
if (!iframeRef.current)
|
|
49
42
|
return;
|
|
50
43
|
const iframe = iframeRef.current;
|
|
@@ -271,9 +264,9 @@ function PageViewerFrame({ mode, pageViewContext, }) {
|
|
|
271
264
|
console.log("PAGE MODEL SKELETON", page, time);
|
|
272
265
|
pageViewContextRef.current?.setPageSkeleton(page);
|
|
273
266
|
}
|
|
274
|
-
const buildPageModelThrottled =
|
|
275
|
-
const [iframeSrc, setIframeSrc] =
|
|
276
|
-
|
|
267
|
+
const buildPageModelThrottled = useThrottledCallback(buildPageModel, 1000);
|
|
268
|
+
const [iframeSrc, setIframeSrc] = useState();
|
|
269
|
+
useEffect(() => {
|
|
277
270
|
const isHeadless = pageViewContext.isHeadless;
|
|
278
271
|
if (!pageItemDescriptor || isHeadless === undefined)
|
|
279
272
|
return;
|
|
@@ -306,7 +299,7 @@ function PageViewerFrame({ mode, pageViewContext, }) {
|
|
|
306
299
|
renderUrl.searchParams.set("site", editContext.pageView.site?.name || "website");
|
|
307
300
|
renderUrl.searchParams.set("mode", editContext.previewMode ? "preview" : "edit");
|
|
308
301
|
}
|
|
309
|
-
renderUrl.searchParams.set("edit_rev", editContext.revision ?? (
|
|
302
|
+
renderUrl.searchParams.set("edit_rev", editContext.revision ?? uuid());
|
|
310
303
|
if (iframeRef.current?.contentWindow?.requestRefresh) {
|
|
311
304
|
console.log("Integration - requesting refresh");
|
|
312
305
|
iframeRef.current?.contentWindow.requestRefresh(renderUrl.toString());
|
|
@@ -333,14 +326,14 @@ function PageViewerFrame({ mode, pageViewContext, }) {
|
|
|
333
326
|
pageViewContext.isHeadless,
|
|
334
327
|
editContext.previewMode,
|
|
335
328
|
]);
|
|
336
|
-
|
|
329
|
+
useEffect(() => {
|
|
337
330
|
if (editContext.focusedField) {
|
|
338
331
|
if (editContext.selection.length > 0 &&
|
|
339
332
|
editContext.focusedField.item.id !== editContext.selection[0])
|
|
340
333
|
return;
|
|
341
|
-
const fieldElement =
|
|
334
|
+
const fieldElement = findFieldElement(iframeRef.current, editContext.focusedField);
|
|
342
335
|
if (fieldElement) {
|
|
343
|
-
const rect =
|
|
336
|
+
const rect = getAbsolutePosition(fieldElement, iframeRef.current);
|
|
344
337
|
const scrollTop = iframeRef.current?.contentWindow?.scrollY || 0;
|
|
345
338
|
const iframeHeight = iframeRef.current?.getBoundingClientRect().height;
|
|
346
339
|
const isInViewport = rect.y >= scrollTop && rect.y <= scrollTop + (iframeHeight || 0);
|
|
@@ -354,7 +347,7 @@ function PageViewerFrame({ mode, pageViewContext, }) {
|
|
|
354
347
|
}
|
|
355
348
|
else {
|
|
356
349
|
if (editContext.selection.length > 0) {
|
|
357
|
-
const lastSelectedComponent =
|
|
350
|
+
const lastSelectedComponent = getComponentById(editContext.selection[editContext.selection.length - 1], pageViewContextRef.current.page);
|
|
358
351
|
if (lastSelectedComponent) {
|
|
359
352
|
editContext.setScrollIntoView(lastSelectedComponent.id);
|
|
360
353
|
}
|
|
@@ -379,7 +372,7 @@ function PageViewerFrame({ mode, pageViewContext, }) {
|
|
|
379
372
|
else {
|
|
380
373
|
const parser = new DOMParser();
|
|
381
374
|
const newDoc = parser.parseFromString(text, "text/html");
|
|
382
|
-
(
|
|
375
|
+
morphdom(doc.documentElement, newDoc.documentElement);
|
|
383
376
|
setShowSpinner(false);
|
|
384
377
|
}
|
|
385
378
|
if (mode === "edit" && !editContext.previewMode)
|
|
@@ -387,11 +380,11 @@ function PageViewerFrame({ mode, pageViewContext, }) {
|
|
|
387
380
|
buildPageModel(doc);
|
|
388
381
|
}
|
|
389
382
|
};
|
|
390
|
-
|
|
383
|
+
useEffect(() => {
|
|
391
384
|
if (!editContext.scrollIntoView ||
|
|
392
385
|
!iframeRef.current?.contentDocument?.documentElement)
|
|
393
386
|
return;
|
|
394
|
-
const rect =
|
|
387
|
+
const rect = findComponentRect(iframeRef.current, editContext.scrollIntoView, true);
|
|
395
388
|
if (!rect)
|
|
396
389
|
return;
|
|
397
390
|
// Check if element is already in viewport
|
|
@@ -411,7 +404,7 @@ function PageViewerFrame({ mode, pageViewContext, }) {
|
|
|
411
404
|
});
|
|
412
405
|
editContext.setScrollIntoView(undefined);
|
|
413
406
|
}, [editContext.scrollIntoView, pageViewContext.page]);
|
|
414
|
-
|
|
407
|
+
useEffect(() => {
|
|
415
408
|
const handleMessage = (message) => {
|
|
416
409
|
if (message.data.type === "editor-exitFullscreen") {
|
|
417
410
|
editContext.pageView.setFullscreen(false);
|
|
@@ -425,11 +418,11 @@ function PageViewerFrame({ mode, pageViewContext, }) {
|
|
|
425
418
|
window.removeEventListener("message", handleMessage);
|
|
426
419
|
};
|
|
427
420
|
}, []);
|
|
428
|
-
const selecionChangeHandler =
|
|
421
|
+
const selecionChangeHandler = useThrottledCallback(() => {
|
|
429
422
|
const sel = iframeRef.current?.contentDocument?.getSelection();
|
|
430
423
|
if (sel && sel.rangeCount > 0) {
|
|
431
424
|
// Find the field element containing the selection
|
|
432
|
-
const fieldElement =
|
|
425
|
+
const fieldElement = findClosestFieldElement(sel.anchorNode);
|
|
433
426
|
if (!fieldElement)
|
|
434
427
|
return;
|
|
435
428
|
const fieldId = fieldElement.getAttribute("data-fieldid");
|
|
@@ -455,7 +448,7 @@ function PageViewerFrame({ mode, pageViewContext, }) {
|
|
|
455
448
|
});
|
|
456
449
|
}
|
|
457
450
|
}, 100);
|
|
458
|
-
|
|
451
|
+
useEffect(() => {
|
|
459
452
|
const iframe = iframeRef.current;
|
|
460
453
|
if (!iframe)
|
|
461
454
|
return;
|
|
@@ -463,7 +456,7 @@ function PageViewerFrame({ mode, pageViewContext, }) {
|
|
|
463
456
|
const target = event.target;
|
|
464
457
|
if (editContextRef.current?.isRefreshing)
|
|
465
458
|
return;
|
|
466
|
-
const componentId =
|
|
459
|
+
const componentId = findParentComponentId(target);
|
|
467
460
|
editContextRef.current?.setCurrentOverlay(undefined);
|
|
468
461
|
if (componentId) {
|
|
469
462
|
if (event.ctrlKey) {
|
|
@@ -482,9 +475,9 @@ function PageViewerFrame({ mode, pageViewContext, }) {
|
|
|
482
475
|
editContextRef.current?.select([]);
|
|
483
476
|
if (mode === "edit" &&
|
|
484
477
|
pageViewContextRef.current?.page?.item.canWriteItem) {
|
|
485
|
-
const fieldElement =
|
|
478
|
+
const fieldElement = findParentWithAttribute(target, "data-fieldid");
|
|
486
479
|
if (fieldElement?.hasAttribute("data-itemid")) {
|
|
487
|
-
const hasLock = await editContextRef.current?.setFocusedField(
|
|
480
|
+
const hasLock = await editContextRef.current?.setFocusedField(getFieldDescriptorFromElement(fieldElement), true);
|
|
488
481
|
blockBlurEventRef.current = Date.now() + 500;
|
|
489
482
|
if (hasLock) {
|
|
490
483
|
editContextRef.current?.setInlineEditingFieldElement(fieldElement);
|
|
@@ -524,16 +517,16 @@ function PageViewerFrame({ mode, pageViewContext, }) {
|
|
|
524
517
|
return;
|
|
525
518
|
event.preventDefault();
|
|
526
519
|
event.stopPropagation();
|
|
527
|
-
const componentId =
|
|
520
|
+
const componentId = findNearestComponentId(target);
|
|
528
521
|
if (componentId) {
|
|
529
522
|
if (!editContextRef.current?.selection.includes(componentId)) {
|
|
530
523
|
console.log("Selecting component CONTEXT MENU", componentId);
|
|
531
524
|
editContextRef.current.select([componentId]);
|
|
532
525
|
}
|
|
533
526
|
}
|
|
534
|
-
const fieldElement =
|
|
527
|
+
const fieldElement = findParentWithAttribute(target, "data-fieldid");
|
|
535
528
|
const selectedComponents = editContextRef.current?.selection
|
|
536
|
-
.map((id) =>
|
|
529
|
+
.map((id) => getComponentById(id, pageViewContextRef.current.page))
|
|
537
530
|
.filter((x) => x);
|
|
538
531
|
const iframeRect = iframe.getBoundingClientRect();
|
|
539
532
|
const adjustedEvent = new MouseEvent("contextmenu", {
|
|
@@ -547,10 +540,10 @@ function PageViewerFrame({ mode, pageViewContext, }) {
|
|
|
547
540
|
clientY: event.clientY + iframeRect.y,
|
|
548
541
|
});
|
|
549
542
|
const field = fieldElement
|
|
550
|
-
?
|
|
543
|
+
? getFieldDescriptorFromElement(fieldElement)
|
|
551
544
|
: undefined;
|
|
552
|
-
const fieldButtons = field ? await
|
|
553
|
-
if (
|
|
545
|
+
const fieldButtons = field ? await loadFieldButtons(field) : [];
|
|
546
|
+
if (showComponentContextMenu(selectedComponents, editContextRef.current, field, fieldButtons)(adjustedEvent)) {
|
|
554
547
|
}
|
|
555
548
|
};
|
|
556
549
|
const handleLoad = () => {
|
|
@@ -617,7 +610,7 @@ function PageViewerFrame({ mode, pageViewContext, }) {
|
|
|
617
610
|
}
|
|
618
611
|
};
|
|
619
612
|
}, [iframeRef.current]);
|
|
620
|
-
|
|
613
|
+
useEffect(() => {
|
|
621
614
|
iframeRef.current?.contentWindow?.postMessage({ type: "componentsSelected", componentIds: editContext.selection }, "*");
|
|
622
615
|
}, [editContext.selection]);
|
|
623
616
|
const updateScrollPosition = (e) => {
|
|
@@ -625,7 +618,7 @@ function PageViewerFrame({ mode, pageViewContext, }) {
|
|
|
625
618
|
if (mode === "edit")
|
|
626
619
|
pageViewContextRef.current?.setScroll(e);
|
|
627
620
|
};
|
|
628
|
-
|
|
621
|
+
useEffect(() => {
|
|
629
622
|
if (!iframeRef.current)
|
|
630
623
|
return;
|
|
631
624
|
const body = iframeRef.current.contentWindow?.document.documentElement;
|
|
@@ -636,25 +629,25 @@ function PageViewerFrame({ mode, pageViewContext, }) {
|
|
|
636
629
|
body.style.overflow = "auto";
|
|
637
630
|
//body.style.height = `${body.scrollHeight / zoom}px`;
|
|
638
631
|
}, [zoom]);
|
|
639
|
-
const scrollHandler =
|
|
632
|
+
const scrollHandler = useThrottledCallback(updateScrollPosition, 100);
|
|
640
633
|
if (pageViewContext.page?.item && !pageViewContext.page?.item.hasLayout) {
|
|
641
|
-
return (
|
|
634
|
+
return _jsx(NoLayout, {});
|
|
642
635
|
}
|
|
643
636
|
const deviceHeight = pageViewContext.device === "desktop" || !pageViewContext.deviceHeight
|
|
644
637
|
? "100%"
|
|
645
638
|
: pageViewContext.deviceHeight || 640;
|
|
646
|
-
return ((
|
|
639
|
+
return (_jsxs("div", { className: "relative flex h-full w-full flex-col items-center bg-slate-100 select-none", children: [!editContext.pageView.fullscreen && (_jsx(EditorWarnings, { item: pageViewContext.page?.item })), pageViewContext.device !== "desktop" && (_jsx(DeviceToolbar, { pageViewContext: pageViewContext, configuration: editContext.configuration })), _jsxs("div", { className: "relative flex flex-1 select-none", style: {
|
|
647
640
|
width: pageViewContext.device === "desktop" ||
|
|
648
641
|
pageViewContext.device === "Responsive"
|
|
649
642
|
? "100%"
|
|
650
643
|
: (pageViewContext.deviceWidth || 640) +
|
|
651
644
|
editContext.configuration.outline.width +
|
|
652
645
|
"px",
|
|
653
|
-
}, children: [(
|
|
646
|
+
}, children: [_jsxs("div", { className: "relative h-full w-full", children: [_jsx("iframe", { ref: iframeRef, className: "page-iframe h-full w-full bg-white", style: { height: deviceHeight }, src: iframeSrc, "data-testid": "pageEditoriframe" }), iframeRef.current && (_jsx(PageEditorChrome, { iframe: iframeRef.current, mode: mode || "edit", pageViewContext: pageViewContext })), pageViewContext.deviceHeight && pageViewContext.device && (_jsx("div", { className: "relative z-40 h-full w-full bg-slate-100" }))] }), !editContext.pageView.fullscreen && showMiniMap && (_jsx(MiniMap, { mode: mode, scroll: scroll, mainViewIframeRef: iframeRef, pageViewContext: pageViewContext, deviceHeight: pageViewContext.device === "Desktop"
|
|
654
647
|
? undefined
|
|
655
|
-
: pageViewContext.deviceHeight })), showSpinner && ((
|
|
648
|
+
: pageViewContext.deviceHeight })), showSpinner && (_jsxs(_Fragment, { children: [_jsx("div", { className: "absolute top-0 left-0 h-full w-full bg-slate-100/50" }), _jsx("div", { className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 transform", children: _jsx(Spinner, {}) })] }))] })] }));
|
|
656
649
|
}
|
|
657
|
-
function injectEditorCSS(iframeDocument) {
|
|
650
|
+
export function injectEditorCSS(iframeDocument) {
|
|
658
651
|
if (!iframeDocument)
|
|
659
652
|
return;
|
|
660
653
|
const style = iframeDocument.createElement("style");
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ItemDescriptor, Page, PageSkeleton } from "../pageModel";
|
|
2
|
+
import { ItemsRepository } from "../client/itemsRepository";
|
|
3
|
+
import { EditorConfiguration } from "../../config/types";
|
|
4
|
+
import { Site } from "../../types";
|
|
5
|
+
export type PageViewContext = {
|
|
6
|
+
device: string;
|
|
7
|
+
setDevice: React.Dispatch<React.SetStateAction<string>>;
|
|
8
|
+
zoom: number;
|
|
9
|
+
setZoom: React.Dispatch<React.SetStateAction<number>>;
|
|
10
|
+
scroll: number;
|
|
11
|
+
setScroll: React.Dispatch<React.SetStateAction<number>>;
|
|
12
|
+
fullscreen: boolean;
|
|
13
|
+
setFullscreen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
14
|
+
editorIframeRef: React.RefObject<HTMLIFrameElement | null>;
|
|
15
|
+
deviceWidth?: number;
|
|
16
|
+
deviceHeight?: number;
|
|
17
|
+
setDeviceWidth: React.Dispatch<React.SetStateAction<number | undefined>>;
|
|
18
|
+
setDeviceHeight: React.Dispatch<React.SetStateAction<number | undefined>>;
|
|
19
|
+
lockHeight: boolean;
|
|
20
|
+
setLockHeight: React.Dispatch<React.SetStateAction<boolean>>;
|
|
21
|
+
rotate: boolean;
|
|
22
|
+
setRotate: React.Dispatch<React.SetStateAction<boolean>>;
|
|
23
|
+
page?: Page;
|
|
24
|
+
pageItemDescriptor?: ItemDescriptor;
|
|
25
|
+
setPageSkeleton: React.Dispatch<React.SetStateAction<PageSkeleton | undefined>>;
|
|
26
|
+
viewport: {
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
};
|
|
30
|
+
setWorkaround: React.Dispatch<React.SetStateAction<boolean>>;
|
|
31
|
+
isHeadless: boolean;
|
|
32
|
+
site?: Site;
|
|
33
|
+
};
|
|
34
|
+
export declare function usePageViewContext({ pageItemDescriptor, itemsRepository, configuration, }: {
|
|
35
|
+
pageItemDescriptor?: ItemDescriptor;
|
|
36
|
+
itemsRepository?: ItemsRepository;
|
|
37
|
+
configuration?: EditorConfiguration;
|
|
38
|
+
}): PageViewContext;
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const [
|
|
10
|
-
const
|
|
11
|
-
const [
|
|
12
|
-
const [
|
|
13
|
-
const
|
|
14
|
-
const [
|
|
15
|
-
const [
|
|
16
|
-
const [
|
|
17
|
-
const [
|
|
18
|
-
const [
|
|
19
|
-
const [
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
const [isHeadless, setIsHeadless] = (0, react_1.useState)(false);
|
|
23
|
-
const { page, setPageSkeleton } = (0, pageModelBuilder_1.usePageModel)(itemsRepository, pageItemDescriptor);
|
|
24
|
-
(0, react_1.useEffect)(() => {
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { usePageModel } from "../client/pageModelBuilder";
|
|
3
|
+
import { useDebouncedCallback } from "use-debounce";
|
|
4
|
+
import { resolvePageAndSite } from "../services/contentService";
|
|
5
|
+
export function usePageViewContext({ pageItemDescriptor, itemsRepository, configuration, }) {
|
|
6
|
+
const [device, setDevice] = useState("desktop");
|
|
7
|
+
const [zoom, setZoom] = useState(1);
|
|
8
|
+
const [scroll, setScroll] = useState(0);
|
|
9
|
+
const [fullscreen, setFullscreen] = useState(false);
|
|
10
|
+
const editorIframeRef = useRef(null);
|
|
11
|
+
const [deviceWidth, setDeviceWidth] = useState();
|
|
12
|
+
const [deviceHeight, setDeviceHeight] = useState();
|
|
13
|
+
const [lockHeight, setLockHeight] = useState(true);
|
|
14
|
+
const [rotate, setRotate] = useState(false);
|
|
15
|
+
const [viewportRect, setViewportRect] = useState({ width: 0, height: 0 });
|
|
16
|
+
const [workaround, setWorkaround] = useState(false);
|
|
17
|
+
const [site, setSite] = useState();
|
|
18
|
+
const [resolvedPageItemDescriptor, setResolvedPageItemDescriptor] = useState();
|
|
19
|
+
const [isHeadless, setIsHeadless] = useState(false);
|
|
20
|
+
const { page, setPageSkeleton } = usePageModel(itemsRepository, pageItemDescriptor);
|
|
21
|
+
useEffect(() => {
|
|
25
22
|
var deviceConfig = configuration?.devices.find((x) => x.name === device);
|
|
26
23
|
let width = deviceConfig?.width;
|
|
27
24
|
let height = deviceConfig?.height;
|
|
@@ -33,13 +30,13 @@ function usePageViewContext({ pageItemDescriptor, itemsRepository, configuration
|
|
|
33
30
|
setDeviceHeight(lockHeight ? height : undefined);
|
|
34
31
|
}
|
|
35
32
|
}, [rotate, device, lockHeight, configuration]);
|
|
36
|
-
|
|
33
|
+
useEffect(() => {
|
|
37
34
|
updateViewportRect();
|
|
38
35
|
}, [fullscreen, device, deviceHeight, deviceWidth]);
|
|
39
|
-
const updateViewportRectDebounced =
|
|
36
|
+
const updateViewportRectDebounced = useDebouncedCallback(() => {
|
|
40
37
|
updateViewportRect();
|
|
41
38
|
}, 100);
|
|
42
|
-
|
|
39
|
+
useEffect(() => {
|
|
43
40
|
const resizeObserver = new ResizeObserver(() => {
|
|
44
41
|
updateViewportRectDebounced();
|
|
45
42
|
});
|
|
@@ -53,7 +50,7 @@ function usePageViewContext({ pageItemDescriptor, itemsRepository, configuration
|
|
|
53
50
|
}
|
|
54
51
|
};
|
|
55
52
|
}, [editorIframeRef.current, workaround]);
|
|
56
|
-
|
|
53
|
+
useEffect(() => {
|
|
57
54
|
if (!pageItemDescriptor)
|
|
58
55
|
return;
|
|
59
56
|
async function resolvePage() {
|
|
@@ -73,7 +70,7 @@ function usePageViewContext({ pageItemDescriptor, itemsRepository, configuration
|
|
|
73
70
|
return;
|
|
74
71
|
}
|
|
75
72
|
console.log("resolve page", pageItemDescriptor.id, pageItemDescriptor.language, pageItemDescriptor.version);
|
|
76
|
-
const result = await
|
|
73
|
+
const result = await resolvePageAndSite(pageItemDescriptor.id, pageItemDescriptor.language, pageItemDescriptor.version);
|
|
77
74
|
if (result) {
|
|
78
75
|
setIsHeadless(result.isHeadless);
|
|
79
76
|
setSite(result.site);
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { InsertOption } from "../types";
|
|
2
|
+
export type PageSkeleton = {
|
|
3
|
+
editRevision: string;
|
|
4
|
+
item: ItemDescriptor;
|
|
5
|
+
rootComponent: ComponentSkeleton;
|
|
6
|
+
};
|
|
7
|
+
export type PlaceholderSkeleton = {
|
|
8
|
+
name: string;
|
|
9
|
+
key: string;
|
|
10
|
+
description: string;
|
|
11
|
+
components: ComponentSkeleton[];
|
|
12
|
+
parentComponent: ComponentSkeleton;
|
|
13
|
+
};
|
|
14
|
+
export type ComponentSkeleton = {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
type: string;
|
|
18
|
+
typeId: string;
|
|
19
|
+
items: RenderedItemSkeleton[];
|
|
20
|
+
placeholders: PlaceholderSkeleton[];
|
|
21
|
+
datasourceItem?: RenderedItemSkeleton;
|
|
22
|
+
isRemovedFromMasterLanguage?: boolean;
|
|
23
|
+
isInheritedFromMasterLanguage?: boolean;
|
|
24
|
+
visible?: boolean;
|
|
25
|
+
parentPlaceholder?: PlaceholderSkeleton;
|
|
26
|
+
renderedDictionaryKeys: string[];
|
|
27
|
+
layoutId?: string;
|
|
28
|
+
editorFields: EditorFields;
|
|
29
|
+
};
|
|
30
|
+
export type RenderedItemSkeleton = ItemDescriptor & {
|
|
31
|
+
renderedFieldIds: string[];
|
|
32
|
+
};
|
|
33
|
+
export type ItemDescriptor = {
|
|
34
|
+
id: string;
|
|
35
|
+
language: string;
|
|
36
|
+
version: number;
|
|
37
|
+
name?: string;
|
|
38
|
+
};
|
|
39
|
+
export type Field = {
|
|
40
|
+
id: string;
|
|
41
|
+
value: unknown;
|
|
42
|
+
rawValue?: string | null;
|
|
43
|
+
name?: string;
|
|
44
|
+
type: string;
|
|
45
|
+
descriptor: FieldDescriptor;
|
|
46
|
+
displayName?: string;
|
|
47
|
+
sortOrder?: number;
|
|
48
|
+
sectionSortOrder?: number;
|
|
49
|
+
customProperties?: any;
|
|
50
|
+
canWrite?: boolean;
|
|
51
|
+
hasLock?: boolean;
|
|
52
|
+
canLock?: boolean;
|
|
53
|
+
lockedBy?: LockSession;
|
|
54
|
+
section?: string;
|
|
55
|
+
isFallback?: boolean;
|
|
56
|
+
isStandardValue?: boolean;
|
|
57
|
+
isShared?: boolean;
|
|
58
|
+
sourceItems: ItemRef[];
|
|
59
|
+
buttons?: FieldButton[];
|
|
60
|
+
fallbackChain?: FieldDescriptor[];
|
|
61
|
+
isHistoric?: boolean;
|
|
62
|
+
};
|
|
63
|
+
export type ItemRef = {
|
|
64
|
+
id: string;
|
|
65
|
+
name?: string;
|
|
66
|
+
};
|
|
67
|
+
export type FieldButton = {
|
|
68
|
+
id: string;
|
|
69
|
+
label: string;
|
|
70
|
+
description: string;
|
|
71
|
+
action?: string;
|
|
72
|
+
icon?: string;
|
|
73
|
+
isGenerator: boolean;
|
|
74
|
+
};
|
|
75
|
+
export type LockSession = {
|
|
76
|
+
sessionId: string;
|
|
77
|
+
name: string;
|
|
78
|
+
};
|
|
79
|
+
export type FieldDescriptor = {
|
|
80
|
+
item: ItemDescriptor;
|
|
81
|
+
fieldId: string;
|
|
82
|
+
};
|
|
83
|
+
export type Language = {
|
|
84
|
+
name: string;
|
|
85
|
+
versions: number;
|
|
86
|
+
icon: string;
|
|
87
|
+
languageCode: string;
|
|
88
|
+
};
|
|
89
|
+
export type Version = {
|
|
90
|
+
version: number;
|
|
91
|
+
updated: Date;
|
|
92
|
+
updatedBy: string;
|
|
93
|
+
};
|
|
94
|
+
export type Timings = {
|
|
95
|
+
[key: string]: number;
|
|
96
|
+
};
|
|
97
|
+
export type FullItem = ItemDescriptor & {
|
|
98
|
+
descriptor: ItemDescriptor;
|
|
99
|
+
name: string;
|
|
100
|
+
templateId: string;
|
|
101
|
+
templateName: string;
|
|
102
|
+
icon: string;
|
|
103
|
+
largeIcon: string;
|
|
104
|
+
thumbnail: string;
|
|
105
|
+
path: string;
|
|
106
|
+
masterLanguages?: string[];
|
|
107
|
+
translations?: string[];
|
|
108
|
+
fields: Field[];
|
|
109
|
+
canWriteItem: boolean;
|
|
110
|
+
canWriteLanguage: boolean;
|
|
111
|
+
canWriteWorkflow: boolean;
|
|
112
|
+
workflowState: string;
|
|
113
|
+
hasLock: boolean;
|
|
114
|
+
hasLayout: boolean;
|
|
115
|
+
idPath: string;
|
|
116
|
+
canLock: boolean;
|
|
117
|
+
lockedBy: string;
|
|
118
|
+
isInheritedFromMasterLanguage: boolean;
|
|
119
|
+
mainItemId?: string;
|
|
120
|
+
hasChildren: boolean;
|
|
121
|
+
parentId: string;
|
|
122
|
+
versions: number;
|
|
123
|
+
};
|
|
124
|
+
export type Page = {
|
|
125
|
+
editRevision: string;
|
|
126
|
+
item: FullItem;
|
|
127
|
+
rootComponent: Component;
|
|
128
|
+
};
|
|
129
|
+
export type RenderedItem = RenderedItemSkeleton & FullItem;
|
|
130
|
+
type EditorFields = {
|
|
131
|
+
[group: string]: {
|
|
132
|
+
addFields: string[];
|
|
133
|
+
removeFields: string[];
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
export type Component = {
|
|
137
|
+
id: string;
|
|
138
|
+
name: string;
|
|
139
|
+
type: string;
|
|
140
|
+
typeId: string;
|
|
141
|
+
items: RenderedItem[];
|
|
142
|
+
placeholders: Placeholder[];
|
|
143
|
+
datasourceItem?: RenderedItem;
|
|
144
|
+
isRemovedFromMasterLanguage?: boolean;
|
|
145
|
+
isInheritedFromMasterLanguage?: boolean;
|
|
146
|
+
visible?: boolean;
|
|
147
|
+
parentPlaceholder?: Placeholder;
|
|
148
|
+
renderedDictionaryKeys: string[];
|
|
149
|
+
isShared: boolean;
|
|
150
|
+
rendering?: RenderingReference;
|
|
151
|
+
layoutId?: string;
|
|
152
|
+
editorFields: EditorFields;
|
|
153
|
+
};
|
|
154
|
+
export type Placeholder = {
|
|
155
|
+
key: string;
|
|
156
|
+
name: string;
|
|
157
|
+
description: string;
|
|
158
|
+
components: Component[];
|
|
159
|
+
parentComponent: Component;
|
|
160
|
+
canSynchronize: boolean;
|
|
161
|
+
insertOptions: InsertOption[];
|
|
162
|
+
};
|
|
163
|
+
export interface RenderingReference {
|
|
164
|
+
id: string;
|
|
165
|
+
revision: string;
|
|
166
|
+
}
|
|
167
|
+
export type ItemIdAndName = {
|
|
168
|
+
name: string;
|
|
169
|
+
id: string;
|
|
170
|
+
};
|
|
171
|
+
export {};
|
package/dist/editor/pageModel.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PictureVariant } from "./fieldTypes";
|
|
2
|
+
export type PictureParams = {
|
|
3
|
+
variant?: string;
|
|
4
|
+
aspectRatio?: number;
|
|
5
|
+
scales?: number[];
|
|
6
|
+
maxWidth?: number;
|
|
7
|
+
custom?: {
|
|
8
|
+
[paramName: string]: string | number | boolean | undefined;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export type MediaPictureParams = {
|
|
12
|
+
default: PictureParams;
|
|
13
|
+
[mediaQuery: string]: PictureParams;
|
|
14
|
+
};
|
|
15
|
+
export declare function getRenderedPictureVariant(params: PictureParams, variants: PictureVariant[]): PictureVariant;
|
|
16
|
+
export declare function getBestMatchingVariant(variants: PictureVariant[], aspectRatio: number | undefined): PictureVariant;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRenderedPictureVariant = getRenderedPictureVariant;
|
|
4
|
-
exports.getBestMatchingVariant = getBestMatchingVariant;
|
|
5
|
-
function getRenderedPictureVariant(params, variants) {
|
|
1
|
+
export function getRenderedPictureVariant(params, variants) {
|
|
6
2
|
const variantName = params.variant ?? "auto";
|
|
7
3
|
const variant = variantName.toLocaleLowerCase() === "auto" && params.aspectRatio
|
|
8
4
|
? getBestMatchingVariant(variants, params.aspectRatio)
|
|
9
5
|
: variants.find((v) => v.name.toLowerCase() == variantName.toLowerCase()) ?? variants[0];
|
|
10
6
|
return variant;
|
|
11
7
|
}
|
|
12
|
-
function getBestMatchingVariant(variants, aspectRatio) {
|
|
8
|
+
export function getBestMatchingVariant(variants, aspectRatio) {
|
|
13
9
|
if (!aspectRatio)
|
|
14
10
|
return (variants.find((v) => v.name.toLowerCase() == "default") ?? variants[0]);
|
|
15
11
|
let minDistance = 1000000;
|