@alpaca-editor/core 1.0.0 → 1.0.3
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/build.css +3 -0
- package/components.json +21 -0
- package/dev.css +3 -0
- package/dist/client-components/api.d.ts +1 -0
- package/dist/client-components/api.js +4 -0
- package/dist/client-components/api.js.map +1 -0
- package/dist/client-components/index.d.ts +16 -0
- package/dist/client-components/index.js +17 -0
- package/dist/client-components/index.js.map +1 -0
- package/dist/components/ActionButton.d.ts +12 -0
- package/dist/components/ActionButton.js +6 -0
- package/dist/components/ActionButton.js.map +1 -0
- package/dist/components/Error.d.ts +9 -0
- package/dist/components/Error.js +24 -0
- package/dist/components/Error.js.map +1 -0
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/button.js +32 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/config/config.d.ts +6 -0
- package/dist/config/config.js +647 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/types.d.ts +223 -0
- package/dist/config/types.js +2 -0
- package/dist/config/types.js.map +1 -0
- package/dist/editor/ComponentInfo.d.ts +4 -0
- package/dist/editor/ComponentInfo.js +29 -0
- package/dist/editor/ComponentInfo.js.map +1 -0
- package/dist/editor/ConfirmationDialog.d.ts +19 -0
- package/dist/editor/ConfirmationDialog.js +31 -0
- package/dist/editor/ConfirmationDialog.js.map +1 -0
- package/dist/editor/ContentTree.d.ts +35 -0
- package/dist/editor/ContentTree.js +404 -0
- package/dist/editor/ContentTree.js.map +1 -0
- package/dist/editor/ContextMenu.d.ts +13 -0
- package/dist/editor/ContextMenu.js +114 -0
- package/dist/editor/ContextMenu.js.map +1 -0
- package/dist/editor/Editor.d.ts +11 -0
- package/dist/editor/Editor.js +50 -0
- package/dist/editor/Editor.js.map +1 -0
- package/dist/editor/EditorWarning.d.ts +5 -0
- package/dist/editor/EditorWarning.js +11 -0
- package/dist/editor/EditorWarning.js.map +1 -0
- package/dist/editor/EditorWarnings.d.ts +9 -0
- package/dist/editor/EditorWarnings.js +19 -0
- package/dist/editor/EditorWarnings.js.map +1 -0
- package/dist/editor/FieldEditorPopup.d.ts +10 -0
- package/dist/editor/FieldEditorPopup.js +22 -0
- package/dist/editor/FieldEditorPopup.js.map +1 -0
- package/dist/editor/FieldHistory.d.ts +6 -0
- package/dist/editor/FieldHistory.js +38 -0
- package/dist/editor/FieldHistory.js.map +1 -0
- package/dist/editor/FieldList.d.ts +16 -0
- package/dist/editor/FieldList.js +58 -0
- package/dist/editor/FieldList.js.map +1 -0
- package/dist/editor/FieldListField.d.ts +14 -0
- package/dist/editor/FieldListField.js +161 -0
- package/dist/editor/FieldListField.js.map +1 -0
- package/dist/editor/FieldListFieldWithFallbacks.d.ts +10 -0
- package/dist/editor/FieldListFieldWithFallbacks.js +109 -0
- package/dist/editor/FieldListFieldWithFallbacks.js.map +1 -0
- package/dist/editor/FloatingToolbar.d.ts +7 -0
- package/dist/editor/FloatingToolbar.js +90 -0
- package/dist/editor/FloatingToolbar.js.map +1 -0
- package/dist/editor/ImageEditor.d.ts +5 -0
- package/dist/editor/ImageEditor.js +53 -0
- package/dist/editor/ImageEditor.js.map +1 -0
- package/dist/editor/InsertMenu.d.ts +8 -0
- package/dist/editor/InsertMenu.js +158 -0
- package/dist/editor/InsertMenu.js.map +1 -0
- package/dist/editor/ItemInfo.d.ts +4 -0
- package/dist/editor/ItemInfo.js +28 -0
- package/dist/editor/ItemInfo.js.map +1 -0
- package/dist/editor/LinkEditorDialog.d.ts +15 -0
- package/dist/editor/LinkEditorDialog.js +84 -0
- package/dist/editor/LinkEditorDialog.js.map +1 -0
- package/dist/editor/MainLayout.d.ts +9 -0
- package/dist/editor/MainLayout.js +41 -0
- package/dist/editor/MainLayout.js.map +1 -0
- package/dist/editor/NewEditorClient.d.ts +5 -0
- package/dist/editor/NewEditorClient.js +7 -0
- package/dist/editor/NewEditorClient.js.map +1 -0
- package/dist/editor/PictureCropper.d.ts +6 -0
- package/dist/editor/PictureCropper.js +327 -0
- package/dist/editor/PictureCropper.js.map +1 -0
- package/dist/editor/PictureEditor.d.ts +8 -0
- package/dist/editor/PictureEditor.js +102 -0
- package/dist/editor/PictureEditor.js.map +1 -0
- package/dist/editor/PictureEditorDialog.d.ts +8 -0
- package/dist/editor/PictureEditorDialog.js +189 -0
- package/dist/editor/PictureEditorDialog.js.map +1 -0
- package/dist/editor/ScrollingContentTree.d.ts +6 -0
- package/dist/editor/ScrollingContentTree.js +25 -0
- package/dist/editor/ScrollingContentTree.js.map +1 -0
- package/dist/editor/Terminal.d.ts +14 -0
- package/dist/editor/Terminal.js +107 -0
- package/dist/editor/Terminal.js.map +1 -0
- package/dist/editor/Titlebar.d.ts +1 -0
- package/dist/editor/Titlebar.js +9 -0
- package/dist/editor/Titlebar.js.map +1 -0
- package/dist/editor/ai/AiPopup.d.ts +10 -0
- package/dist/editor/ai/AiPopup.js +23 -0
- package/dist/editor/ai/AiPopup.js.map +1 -0
- package/dist/editor/ai/AiResponseMessage.d.ts +8 -0
- package/dist/editor/ai/AiResponseMessage.js +22 -0
- package/dist/editor/ai/AiResponseMessage.js.map +1 -0
- package/dist/editor/ai/AiTerminal.d.ts +34 -0
- package/dist/editor/ai/AiTerminal.js +236 -0
- package/dist/editor/ai/AiTerminal.js.map +1 -0
- package/dist/editor/ai/AiToolCall.d.ts +9 -0
- package/dist/editor/ai/AiToolCall.js +16 -0
- package/dist/editor/ai/AiToolCall.js.map +1 -0
- package/dist/editor/ai/EditorAiTerminal.d.ts +5 -0
- package/dist/editor/ai/EditorAiTerminal.js +7 -0
- package/dist/editor/ai/EditorAiTerminal.js.map +1 -0
- package/dist/editor/ai/editorAiContext.d.ts +11 -0
- package/dist/editor/ai/editorAiContext.js +12 -0
- package/dist/editor/ai/editorAiContext.js.map +1 -0
- package/dist/editor/client/DialogContext.d.ts +12 -0
- package/dist/editor/client/DialogContext.js +25 -0
- package/dist/editor/client/DialogContext.js.map +1 -0
- package/dist/editor/client/EditorClient.d.ts +26 -0
- package/dist/editor/client/EditorClient.js +1298 -0
- package/dist/editor/client/EditorClient.js.map +1 -0
- package/dist/editor/client/GenericDialog.d.ts +10 -0
- package/dist/editor/client/GenericDialog.js +25 -0
- package/dist/editor/client/GenericDialog.js.map +1 -0
- package/dist/editor/client/editContext.d.ts +199 -0
- package/dist/editor/client/editContext.js +20 -0
- package/dist/editor/client/editContext.js.map +1 -0
- package/dist/editor/client/helpers.d.ts +12 -0
- package/dist/editor/client/helpers.js +29 -0
- package/dist/editor/client/helpers.js.map +1 -0
- package/dist/editor/client/itemsRepository.d.ts +24 -0
- package/dist/editor/client/itemsRepository.js +253 -0
- package/dist/editor/client/itemsRepository.js.map +1 -0
- package/dist/editor/client/operations.d.ts +57 -0
- package/dist/editor/client/operations.js +393 -0
- package/dist/editor/client/operations.js.map +1 -0
- package/dist/editor/client/pageModelBuilder.d.ts +6 -0
- package/dist/editor/client/pageModelBuilder.js +127 -0
- package/dist/editor/client/pageModelBuilder.js.map +1 -0
- package/dist/editor/commands/commands.d.ts +19 -0
- package/dist/editor/commands/commands.js +2 -0
- package/dist/editor/commands/commands.js.map +1 -0
- package/dist/editor/commands/componentCommands.d.ts +13 -0
- package/dist/editor/commands/componentCommands.js +271 -0
- package/dist/editor/commands/componentCommands.js.map +1 -0
- package/dist/editor/commands/createVersionCommand.d.ts +4 -0
- package/dist/editor/commands/createVersionCommand.js +24 -0
- package/dist/editor/commands/createVersionCommand.js.map +1 -0
- package/dist/editor/commands/deleteVersionCommand.d.ts +4 -0
- package/dist/editor/commands/deleteVersionCommand.js +53 -0
- package/dist/editor/commands/deleteVersionCommand.js.map +1 -0
- package/dist/editor/commands/itemCommands.d.ts +17 -0
- package/dist/editor/commands/itemCommands.js +132 -0
- package/dist/editor/commands/itemCommands.js.map +1 -0
- package/dist/editor/commands/localizeItem/LocalizeItemDialog.d.ts +8 -0
- package/dist/editor/commands/localizeItem/LocalizeItemDialog.js +89 -0
- package/dist/editor/commands/localizeItem/LocalizeItemDialog.js.map +1 -0
- package/dist/editor/commands/undo.d.ts +15 -0
- package/dist/editor/commands/undo.js +29 -0
- package/dist/editor/commands/undo.js.map +1 -0
- package/dist/editor/component-designer/ComponentDesigner.d.ts +1 -0
- package/dist/editor/component-designer/ComponentDesigner.js +56 -0
- package/dist/editor/component-designer/ComponentDesigner.js.map +1 -0
- package/dist/editor/component-designer/ComponentDesignerAiTerminal.d.ts +1 -0
- package/dist/editor/component-designer/ComponentDesignerAiTerminal.js +7 -0
- package/dist/editor/component-designer/ComponentDesignerAiTerminal.js.map +1 -0
- package/dist/editor/component-designer/ComponentDesignerMenu.d.ts +1 -0
- package/dist/editor/component-designer/ComponentDesignerMenu.js +65 -0
- package/dist/editor/component-designer/ComponentDesignerMenu.js.map +1 -0
- package/dist/editor/component-designer/ComponentEditor.d.ts +4 -0
- package/dist/editor/component-designer/ComponentEditor.js +57 -0
- package/dist/editor/component-designer/ComponentEditor.js.map +1 -0
- package/dist/editor/component-designer/ComponentRenderingCodeEditor.d.ts +5 -0
- package/dist/editor/component-designer/ComponentRenderingCodeEditor.js +11 -0
- package/dist/editor/component-designer/ComponentRenderingCodeEditor.js.map +1 -0
- package/dist/editor/component-designer/ComponentRenderingEditor.d.ts +1 -0
- package/dist/editor/component-designer/ComponentRenderingEditor.js +69 -0
- package/dist/editor/component-designer/ComponentRenderingEditor.js.map +1 -0
- package/dist/editor/component-designer/ComponentsDropdown.d.ts +4 -0
- package/dist/editor/component-designer/ComponentsDropdown.js +20 -0
- package/dist/editor/component-designer/ComponentsDropdown.js.map +1 -0
- package/dist/editor/component-designer/PlaceholdersEditor.d.ts +4 -0
- package/dist/editor/component-designer/PlaceholdersEditor.js +68 -0
- package/dist/editor/component-designer/PlaceholdersEditor.js.map +1 -0
- package/dist/editor/component-designer/RenderingsDropdown.d.ts +1 -0
- package/dist/editor/component-designer/RenderingsDropdown.js +23 -0
- package/dist/editor/component-designer/RenderingsDropdown.js.map +1 -0
- package/dist/editor/component-designer/TemplateEditor.d.ts +1 -0
- package/dist/editor/component-designer/TemplateEditor.js +142 -0
- package/dist/editor/component-designer/TemplateEditor.js.map +1 -0
- package/dist/editor/component-designer/aiContext.d.ts +5 -0
- package/dist/editor/component-designer/aiContext.js +16 -0
- package/dist/editor/component-designer/aiContext.js.map +1 -0
- package/dist/editor/componentTreeHelper.d.ts +16 -0
- package/dist/editor/componentTreeHelper.js +87 -0
- package/dist/editor/componentTreeHelper.js.map +1 -0
- package/dist/editor/control-center/ControlCenterMenu.d.ts +1 -0
- package/dist/editor/control-center/ControlCenterMenu.js +57 -0
- package/dist/editor/control-center/ControlCenterMenu.js.map +1 -0
- package/dist/editor/control-center/IndexOverview.d.ts +1 -0
- package/dist/editor/control-center/IndexOverview.js +25 -0
- package/dist/editor/control-center/IndexOverview.js.map +1 -0
- package/dist/editor/control-center/IndexSettings.d.ts +5 -0
- package/dist/editor/control-center/IndexSettings.js +104 -0
- package/dist/editor/control-center/IndexSettings.js.map +1 -0
- package/dist/editor/control-center/Status.d.ts +1 -0
- package/dist/editor/control-center/Status.js +5 -0
- package/dist/editor/control-center/Status.js.map +1 -0
- package/dist/editor/editor-warnings/ItemLocked.d.ts +2 -0
- package/dist/editor/editor-warnings/ItemLocked.js +38 -0
- package/dist/editor/editor-warnings/ItemLocked.js.map +1 -0
- package/dist/editor/editor-warnings/NoLanguageWriteAccess.d.ts +2 -0
- package/dist/editor/editor-warnings/NoLanguageWriteAccess.js +14 -0
- package/dist/editor/editor-warnings/NoLanguageWriteAccess.js.map +1 -0
- package/dist/editor/editor-warnings/NoWorkflowWriteAccess.d.ts +2 -0
- package/dist/editor/editor-warnings/NoWorkflowWriteAccess.js +14 -0
- package/dist/editor/editor-warnings/NoWorkflowWriteAccess.js.map +1 -0
- package/dist/editor/editor-warnings/NoWriteAccess.d.ts +2 -0
- package/dist/editor/editor-warnings/NoWriteAccess.js +12 -0
- package/dist/editor/editor-warnings/NoWriteAccess.js.map +1 -0
- package/dist/editor/editor-warnings/ValidationErrors.d.ts +2 -0
- package/dist/editor/editor-warnings/ValidationErrors.js +25 -0
- package/dist/editor/editor-warnings/ValidationErrors.js.map +1 -0
- package/dist/editor/field-types/AttachmentEditor.d.ts +4 -0
- package/dist/editor/field-types/AttachmentEditor.js +5 -0
- package/dist/editor/field-types/AttachmentEditor.js.map +1 -0
- package/dist/editor/field-types/CheckboxEditor.d.ts +5 -0
- package/dist/editor/field-types/CheckboxEditor.js +30 -0
- package/dist/editor/field-types/CheckboxEditor.js.map +1 -0
- package/dist/editor/field-types/DropLinkEditor.d.ts +5 -0
- package/dist/editor/field-types/DropLinkEditor.js +49 -0
- package/dist/editor/field-types/DropLinkEditor.js.map +1 -0
- package/dist/editor/field-types/DropListEditor.d.ts +5 -0
- package/dist/editor/field-types/DropListEditor.js +56 -0
- package/dist/editor/field-types/DropListEditor.js.map +1 -0
- package/dist/editor/field-types/ImageFieldEditor.d.ts +5 -0
- package/dist/editor/field-types/ImageFieldEditor.js +34 -0
- package/dist/editor/field-types/ImageFieldEditor.js.map +1 -0
- package/dist/editor/field-types/InternalLinkFieldEditor.d.ts +5 -0
- package/dist/editor/field-types/InternalLinkFieldEditor.js +59 -0
- package/dist/editor/field-types/InternalLinkFieldEditor.js.map +1 -0
- package/dist/editor/field-types/LinkFieldEditor.d.ts +5 -0
- package/dist/editor/field-types/LinkFieldEditor.js +56 -0
- package/dist/editor/field-types/LinkFieldEditor.js.map +1 -0
- package/dist/editor/field-types/MultiLineText.d.ts +6 -0
- package/dist/editor/field-types/MultiLineText.js +33 -0
- package/dist/editor/field-types/MultiLineText.js.map +1 -0
- package/dist/editor/field-types/PictureFieldEditor.d.ts +5 -0
- package/dist/editor/field-types/PictureFieldEditor.js +57 -0
- package/dist/editor/field-types/PictureFieldEditor.js.map +1 -0
- package/dist/editor/field-types/RawEditor.d.ts +5 -0
- package/dist/editor/field-types/RawEditor.js +31 -0
- package/dist/editor/field-types/RawEditor.js.map +1 -0
- package/dist/editor/field-types/ReactQuill.d.ts +125 -0
- package/dist/editor/field-types/ReactQuill.js +385 -0
- package/dist/editor/field-types/ReactQuill.js.map +1 -0
- package/dist/editor/field-types/RichTextEditor.d.ts +5 -0
- package/dist/editor/field-types/RichTextEditor.js +8 -0
- package/dist/editor/field-types/RichTextEditor.js.map +1 -0
- package/dist/editor/field-types/RichTextEditorComponent.d.ts +6 -0
- package/dist/editor/field-types/RichTextEditorComponent.js +70 -0
- package/dist/editor/field-types/RichTextEditorComponent.js.map +1 -0
- package/dist/editor/field-types/SingleLineText.d.ts +6 -0
- package/dist/editor/field-types/SingleLineText.js +90 -0
- package/dist/editor/field-types/SingleLineText.js.map +1 -0
- package/dist/editor/field-types/TreeListEditor.d.ts +5 -0
- package/dist/editor/field-types/TreeListEditor.js +132 -0
- package/dist/editor/field-types/TreeListEditor.js.map +1 -0
- package/dist/editor/fieldTypes.d.ts +117 -0
- package/dist/editor/fieldTypes.js +2 -0
- package/dist/editor/fieldTypes.js.map +1 -0
- package/dist/editor/media-selector/AiImageSearch.d.ts +4 -0
- package/dist/editor/media-selector/AiImageSearch.js +105 -0
- package/dist/editor/media-selector/AiImageSearch.js.map +1 -0
- package/dist/editor/media-selector/AiImageSearchPrompt.d.ts +3 -0
- package/dist/editor/media-selector/AiImageSearchPrompt.js +56 -0
- package/dist/editor/media-selector/AiImageSearchPrompt.js.map +1 -0
- package/dist/editor/media-selector/MediaSelector.d.ts +9 -0
- package/dist/editor/media-selector/MediaSelector.js +8 -0
- package/dist/editor/media-selector/MediaSelector.js.map +1 -0
- package/dist/editor/media-selector/Preview.d.ts +4 -0
- package/dist/editor/media-selector/Preview.js +7 -0
- package/dist/editor/media-selector/Preview.js.map +1 -0
- package/dist/editor/media-selector/Thumbnails.d.ts +13 -0
- package/dist/editor/media-selector/Thumbnails.js +9 -0
- package/dist/editor/media-selector/Thumbnails.js.map +1 -0
- package/dist/editor/media-selector/TreeSelector.d.ts +7 -0
- package/dist/editor/media-selector/TreeSelector.js +165 -0
- package/dist/editor/media-selector/TreeSelector.js.map +1 -0
- package/dist/editor/media-selector/UploadZone.d.ts +4 -0
- package/dist/editor/media-selector/UploadZone.js +78 -0
- package/dist/editor/media-selector/UploadZone.js.map +1 -0
- package/dist/editor/menubar/ActionsMenu.d.ts +1 -0
- package/dist/editor/menubar/ActionsMenu.js +31 -0
- package/dist/editor/menubar/ActionsMenu.js.map +1 -0
- package/dist/editor/menubar/ActiveUsers.d.ts +1 -0
- package/dist/editor/menubar/ActiveUsers.js +11 -0
- package/dist/editor/menubar/ActiveUsers.js.map +1 -0
- package/dist/editor/menubar/ApproveAndPublish.d.ts +1 -0
- package/dist/editor/menubar/ApproveAndPublish.js +11 -0
- package/dist/editor/menubar/ApproveAndPublish.js.map +1 -0
- package/dist/editor/menubar/BrowseHistory.d.ts +6 -0
- package/dist/editor/menubar/BrowseHistory.js +12 -0
- package/dist/editor/menubar/BrowseHistory.js.map +1 -0
- package/dist/editor/menubar/ItemLanguageVersion.d.ts +1 -0
- package/dist/editor/menubar/ItemLanguageVersion.js +34 -0
- package/dist/editor/menubar/ItemLanguageVersion.js.map +1 -0
- package/dist/editor/menubar/LanguageSelector.d.ts +9 -0
- package/dist/editor/menubar/LanguageSelector.js +31 -0
- package/dist/editor/menubar/LanguageSelector.js.map +1 -0
- package/dist/editor/menubar/Menu.d.ts +1 -0
- package/dist/editor/menubar/Menu.js +63 -0
- package/dist/editor/menubar/Menu.js.map +1 -0
- package/dist/editor/menubar/NavButtons.d.ts +1 -0
- package/dist/editor/menubar/NavButtons.js +41 -0
- package/dist/editor/menubar/NavButtons.js.map +1 -0
- package/dist/editor/menubar/PageSelector.d.ts +4 -0
- package/dist/editor/menubar/PageSelector.js +48 -0
- package/dist/editor/menubar/PageSelector.js.map +1 -0
- package/dist/editor/menubar/PageViewerControls.d.ts +1 -0
- package/dist/editor/menubar/PageViewerControls.js +35 -0
- package/dist/editor/menubar/PageViewerControls.js.map +1 -0
- package/dist/editor/menubar/Separator.d.ts +3 -0
- package/dist/editor/menubar/Separator.js +6 -0
- package/dist/editor/menubar/Separator.js.map +1 -0
- package/dist/editor/menubar/SiteInfo.d.ts +1 -0
- package/dist/editor/menubar/SiteInfo.js +24 -0
- package/dist/editor/menubar/SiteInfo.js.map +1 -0
- package/dist/editor/menubar/User.d.ts +4 -0
- package/dist/editor/menubar/User.js +16 -0
- package/dist/editor/menubar/User.js.map +1 -0
- package/dist/editor/menubar/VersionSelector.d.ts +9 -0
- package/dist/editor/menubar/VersionSelector.js +47 -0
- package/dist/editor/menubar/VersionSelector.js.map +1 -0
- package/dist/editor/page-editor-chrome/CommentHighlighting.d.ts +6 -0
- package/dist/editor/page-editor-chrome/CommentHighlighting.js +212 -0
- package/dist/editor/page-editor-chrome/CommentHighlighting.js.map +1 -0
- package/dist/editor/page-editor-chrome/CommentHighlightings.d.ts +4 -0
- package/dist/editor/page-editor-chrome/CommentHighlightings.js +15 -0
- package/dist/editor/page-editor-chrome/CommentHighlightings.js.map +1 -0
- package/dist/editor/page-editor-chrome/FieldActionIndicator.d.ts +4 -0
- package/dist/editor/page-editor-chrome/FieldActionIndicator.js +25 -0
- package/dist/editor/page-editor-chrome/FieldActionIndicator.js.map +1 -0
- package/dist/editor/page-editor-chrome/FieldActionIndicators.d.ts +1 -0
- package/dist/editor/page-editor-chrome/FieldActionIndicators.js +13 -0
- package/dist/editor/page-editor-chrome/FieldActionIndicators.js.map +1 -0
- package/dist/editor/page-editor-chrome/FieldEditedIndicator.d.ts +8 -0
- package/dist/editor/page-editor-chrome/FieldEditedIndicator.js +25 -0
- package/dist/editor/page-editor-chrome/FieldEditedIndicator.js.map +1 -0
- package/dist/editor/page-editor-chrome/FieldEditedIndicators.d.ts +6 -0
- package/dist/editor/page-editor-chrome/FieldEditedIndicators.js +13 -0
- package/dist/editor/page-editor-chrome/FieldEditedIndicators.js.map +1 -0
- package/dist/editor/page-editor-chrome/FrameMenu.d.ts +7 -0
- package/dist/editor/page-editor-chrome/FrameMenu.js +176 -0
- package/dist/editor/page-editor-chrome/FrameMenu.js.map +1 -0
- package/dist/editor/page-editor-chrome/FrameMenus.d.ts +5 -0
- package/dist/editor/page-editor-chrome/FrameMenus.js +22 -0
- package/dist/editor/page-editor-chrome/FrameMenus.js.map +1 -0
- package/dist/editor/page-editor-chrome/InlineEditor.d.ts +5 -0
- package/dist/editor/page-editor-chrome/InlineEditor.js +99 -0
- package/dist/editor/page-editor-chrome/InlineEditor.js.map +1 -0
- package/dist/editor/page-editor-chrome/LockedFieldIndicator.d.ts +1 -0
- package/dist/editor/page-editor-chrome/LockedFieldIndicator.js +33 -0
- package/dist/editor/page-editor-chrome/LockedFieldIndicator.js.map +1 -0
- package/dist/editor/page-editor-chrome/NoLayout.d.ts +1 -0
- package/dist/editor/page-editor-chrome/NoLayout.js +19 -0
- package/dist/editor/page-editor-chrome/NoLayout.js.map +1 -0
- package/dist/editor/page-editor-chrome/PageEditorChrome.d.ts +6 -0
- package/dist/editor/page-editor-chrome/PageEditorChrome.js +63 -0
- package/dist/editor/page-editor-chrome/PageEditorChrome.js.map +1 -0
- package/dist/editor/page-editor-chrome/PictureEditorOverlay.d.ts +1 -0
- package/dist/editor/page-editor-chrome/PictureEditorOverlay.js +107 -0
- package/dist/editor/page-editor-chrome/PictureEditorOverlay.js.map +1 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.d.ts +14 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +80 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js.map +1 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.d.ts +5 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js +145 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js.map +1 -0
- package/dist/editor/page-viewer/DeviceToolbar.d.ts +6 -0
- package/dist/editor/page-viewer/DeviceToolbar.js +19 -0
- package/dist/editor/page-viewer/DeviceToolbar.js.map +1 -0
- package/dist/editor/page-viewer/EditorForm.d.ts +5 -0
- package/dist/editor/page-viewer/EditorForm.js +128 -0
- package/dist/editor/page-viewer/EditorForm.js.map +1 -0
- package/dist/editor/page-viewer/MiniMap.d.ts +9 -0
- package/dist/editor/page-viewer/MiniMap.js +222 -0
- package/dist/editor/page-viewer/MiniMap.js.map +1 -0
- package/dist/editor/page-viewer/PageViewer.d.ts +8 -0
- package/dist/editor/page-viewer/PageViewer.js +62 -0
- package/dist/editor/page-viewer/PageViewer.js.map +1 -0
- package/dist/editor/page-viewer/PageViewerFrame.d.ts +11 -0
- package/dist/editor/page-viewer/PageViewerFrame.js +690 -0
- package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -0
- package/dist/editor/page-viewer/pageViewContext.d.ts +38 -0
- package/dist/editor/page-viewer/pageViewContext.js +115 -0
- package/dist/editor/page-viewer/pageViewContext.js.map +1 -0
- package/dist/editor/pageModel.d.ts +171 -0
- package/dist/editor/pageModel.js +2 -0
- package/dist/editor/pageModel.js.map +1 -0
- package/dist/editor/picture-shared.d.ts +16 -0
- package/dist/editor/picture-shared.js +25 -0
- package/dist/editor/picture-shared.js.map +1 -0
- package/dist/editor/reviews/Comment.d.ts +4 -0
- package/dist/editor/reviews/Comment.js +114 -0
- package/dist/editor/reviews/Comment.js.map +1 -0
- package/dist/editor/reviews/Comments.d.ts +1 -0
- package/dist/editor/reviews/Comments.js +22 -0
- package/dist/editor/reviews/Comments.js.map +1 -0
- package/dist/editor/reviews/PreviewInfo.d.ts +1 -0
- package/dist/editor/reviews/PreviewInfo.js +11 -0
- package/dist/editor/reviews/PreviewInfo.js.map +1 -0
- package/dist/editor/reviews/Reviews.d.ts +1 -0
- package/dist/editor/reviews/Reviews.js +160 -0
- package/dist/editor/reviews/Reviews.js.map +1 -0
- package/dist/editor/reviews/reviewCommands.d.ts +3 -0
- package/dist/editor/reviews/reviewCommands.js +42 -0
- package/dist/editor/reviews/reviewCommands.js.map +1 -0
- package/dist/editor/reviews/useReviews.d.ts +12 -0
- package/dist/editor/reviews/useReviews.js +43 -0
- package/dist/editor/reviews/useReviews.js.map +1 -0
- package/dist/editor/services/aiService.d.ts +34 -0
- package/dist/editor/services/aiService.js +95 -0
- package/dist/editor/services/aiService.js.map +1 -0
- package/dist/editor/services/componentDesignerService.d.ts +46 -0
- package/dist/editor/services/componentDesignerService.js +72 -0
- package/dist/editor/services/componentDesignerService.js.map +1 -0
- package/dist/editor/services/contentService.d.ts +34 -0
- package/dist/editor/services/contentService.js +92 -0
- package/dist/editor/services/contentService.js.map +1 -0
- package/dist/editor/services/editService.d.ts +34 -0
- package/dist/editor/services/editService.js +294 -0
- package/dist/editor/services/editService.js.map +1 -0
- package/dist/editor/services/indexService.d.ts +6 -0
- package/dist/editor/services/indexService.js +19 -0
- package/dist/editor/services/indexService.js.map +1 -0
- package/dist/editor/services/reviewsService.d.ts +12 -0
- package/dist/editor/services/reviewsService.js +32 -0
- package/dist/editor/services/reviewsService.js.map +1 -0
- package/dist/editor/services/serviceHelper.d.ts +9 -0
- package/dist/editor/services/serviceHelper.js +64 -0
- package/dist/editor/services/serviceHelper.js.map +1 -0
- package/dist/editor/services/systemService.d.ts +2 -0
- package/dist/editor/services/systemService.js +5 -0
- package/dist/editor/services/systemService.js.map +1 -0
- package/dist/editor/services/translationService.d.ts +11 -0
- package/dist/editor/services/translationService.js +11 -0
- package/dist/editor/services/translationService.js.map +1 -0
- package/dist/editor/services-server/api.d.ts +19 -0
- package/dist/editor/services-server/api.js +111 -0
- package/dist/editor/services-server/api.js.map +1 -0
- package/dist/editor/services-server/graphQL.d.ts +29 -0
- package/dist/editor/services-server/graphQL.js +53 -0
- package/dist/editor/services-server/graphQL.js.map +1 -0
- package/dist/editor/sidebar/ComponentPalette.d.ts +1 -0
- package/dist/editor/sidebar/ComponentPalette.js +53 -0
- package/dist/editor/sidebar/ComponentPalette.js.map +1 -0
- package/dist/editor/sidebar/ComponentTree.d.ts +1 -0
- package/dist/editor/sidebar/ComponentTree.js +360 -0
- package/dist/editor/sidebar/ComponentTree.js.map +1 -0
- package/dist/editor/sidebar/Debug.d.ts +1 -0
- package/dist/editor/sidebar/Debug.js +58 -0
- package/dist/editor/sidebar/Debug.js.map +1 -0
- package/dist/editor/sidebar/DictionaryEditor.d.ts +1 -0
- package/dist/editor/sidebar/DictionaryEditor.js +158 -0
- package/dist/editor/sidebar/DictionaryEditor.js.map +1 -0
- package/dist/editor/sidebar/EditHistory.d.ts +1 -0
- package/dist/editor/sidebar/EditHistory.js +72 -0
- package/dist/editor/sidebar/EditHistory.js.map +1 -0
- package/dist/editor/sidebar/GraphQL.d.ts +1 -0
- package/dist/editor/sidebar/GraphQL.js +113 -0
- package/dist/editor/sidebar/GraphQL.js.map +1 -0
- package/dist/editor/sidebar/Insert.d.ts +1 -0
- package/dist/editor/sidebar/Insert.js +22 -0
- package/dist/editor/sidebar/Insert.js.map +1 -0
- package/dist/editor/sidebar/MainContentTree.d.ts +4 -0
- package/dist/editor/sidebar/MainContentTree.js +49 -0
- package/dist/editor/sidebar/MainContentTree.js.map +1 -0
- package/dist/editor/sidebar/Performance.d.ts +1 -0
- package/dist/editor/sidebar/Performance.js +32 -0
- package/dist/editor/sidebar/Performance.js.map +1 -0
- package/dist/editor/sidebar/Sessions.d.ts +1 -0
- package/dist/editor/sidebar/Sessions.js +29 -0
- package/dist/editor/sidebar/Sessions.js.map +1 -0
- package/dist/editor/sidebar/Sidebar.d.ts +1 -0
- package/dist/editor/sidebar/Sidebar.js +13 -0
- package/dist/editor/sidebar/Sidebar.js.map +1 -0
- package/dist/editor/sidebar/SidebarView.d.ts +8 -0
- package/dist/editor/sidebar/SidebarView.js +74 -0
- package/dist/editor/sidebar/SidebarView.js.map +1 -0
- package/dist/editor/sidebar/Translations.d.ts +1 -0
- package/dist/editor/sidebar/Translations.js +158 -0
- package/dist/editor/sidebar/Translations.js.map +1 -0
- package/dist/editor/sidebar/Validation.d.ts +1 -0
- package/dist/editor/sidebar/Validation.js +50 -0
- package/dist/editor/sidebar/Validation.js.map +1 -0
- package/dist/editor/sidebar/ViewSelector.d.ts +1 -0
- package/dist/editor/sidebar/ViewSelector.js +13 -0
- package/dist/editor/sidebar/ViewSelector.js.map +1 -0
- package/dist/editor/sidebar/Workbox.d.ts +1 -0
- package/dist/editor/sidebar/Workbox.js +78 -0
- package/dist/editor/sidebar/Workbox.js.map +1 -0
- package/dist/editor/ui/CenteredMessage.d.ts +3 -0
- package/dist/editor/ui/CenteredMessage.js +5 -0
- package/dist/editor/ui/CenteredMessage.js.map +1 -0
- package/dist/editor/ui/CopyToClipboardButton.d.ts +3 -0
- package/dist/editor/ui/CopyToClipboardButton.js +15 -0
- package/dist/editor/ui/CopyToClipboardButton.js.map +1 -0
- package/dist/editor/ui/DialogButtons.d.ts +3 -0
- package/dist/editor/ui/DialogButtons.js +5 -0
- package/dist/editor/ui/DialogButtons.js.map +1 -0
- package/dist/editor/ui/Icons.d.ts +38 -0
- package/dist/editor/ui/Icons.js +56 -0
- package/dist/editor/ui/Icons.js.map +1 -0
- package/dist/editor/ui/ItemNameDialog.d.ts +11 -0
- package/dist/editor/ui/ItemNameDialog.js +40 -0
- package/dist/editor/ui/ItemNameDialog.js.map +1 -0
- package/dist/editor/ui/ItemNameDialogNew.d.ts +10 -0
- package/dist/editor/ui/ItemNameDialogNew.js +56 -0
- package/dist/editor/ui/ItemNameDialogNew.js.map +1 -0
- package/dist/editor/ui/ItemSearch.d.ts +23 -0
- package/dist/editor/ui/ItemSearch.js +90 -0
- package/dist/editor/ui/ItemSearch.js.map +1 -0
- package/dist/editor/ui/PerfectTree.d.ts +60 -0
- package/dist/editor/ui/PerfectTree.js +187 -0
- package/dist/editor/ui/PerfectTree.js.map +1 -0
- package/dist/editor/ui/Section.d.ts +4 -0
- package/dist/editor/ui/Section.js +10 -0
- package/dist/editor/ui/Section.js.map +1 -0
- package/dist/editor/ui/SimpleIconButton.d.ts +11 -0
- package/dist/editor/ui/SimpleIconButton.js +9 -0
- package/dist/editor/ui/SimpleIconButton.js.map +1 -0
- package/dist/editor/ui/SimpleMenu.d.ts +13 -0
- package/dist/editor/ui/SimpleMenu.js +7 -0
- package/dist/editor/ui/SimpleMenu.js.map +1 -0
- package/dist/editor/ui/SimpleTable.d.ts +14 -0
- package/dist/editor/ui/SimpleTable.js +9 -0
- package/dist/editor/ui/SimpleTable.js.map +1 -0
- package/dist/editor/ui/SimpleTabs.d.ts +12 -0
- package/dist/editor/ui/SimpleTabs.js +19 -0
- package/dist/editor/ui/SimpleTabs.js.map +1 -0
- package/dist/editor/ui/SimpleToolbar.d.ts +3 -0
- package/dist/editor/ui/SimpleToolbar.js +5 -0
- package/dist/editor/ui/SimpleToolbar.js.map +1 -0
- package/dist/editor/ui/Spinner.d.ts +3 -0
- package/dist/editor/ui/Spinner.js +5 -0
- package/dist/editor/ui/Spinner.js.map +1 -0
- package/dist/editor/ui/Splitter.d.ts +15 -0
- package/dist/editor/ui/Splitter.js +151 -0
- package/dist/editor/ui/Splitter.js.map +1 -0
- package/dist/editor/ui/StackedPanels.d.ts +5 -0
- package/dist/editor/ui/StackedPanels.js +67 -0
- package/dist/editor/ui/StackedPanels.js.map +1 -0
- package/dist/editor/ui/Toolbar.d.ts +3 -0
- package/dist/editor/ui/Toolbar.js +5 -0
- package/dist/editor/ui/Toolbar.js.map +1 -0
- package/dist/editor/utils/id-helper.d.ts +1 -0
- package/dist/editor/utils/id-helper.js +5 -0
- package/dist/editor/utils/id-helper.js.map +1 -0
- package/dist/editor/utils/insertOptions.d.ts +3 -0
- package/dist/editor/utils/insertOptions.js +43 -0
- package/dist/editor/utils/insertOptions.js.map +1 -0
- package/dist/editor/utils/itemutils.d.ts +3 -0
- package/dist/editor/utils/itemutils.js +22 -0
- package/dist/editor/utils/itemutils.js.map +1 -0
- package/dist/editor/utils/useMemoDebug.d.ts +1 -0
- package/dist/editor/utils/useMemoDebug.js +18 -0
- package/dist/editor/utils/useMemoDebug.js.map +1 -0
- package/dist/editor/utils.d.ts +44 -0
- package/dist/editor/utils.js +309 -0
- package/dist/editor/utils.js.map +1 -0
- package/dist/editor/views/CompareView.d.ts +1 -0
- package/dist/editor/views/CompareView.js +145 -0
- package/dist/editor/views/CompareView.js.map +1 -0
- package/dist/editor/views/EditView.d.ts +1 -0
- package/dist/editor/views/EditView.js +15 -0
- package/dist/editor/views/EditView.js.map +1 -0
- package/dist/editor/views/ItemEditor.d.ts +7 -0
- package/dist/editor/views/ItemEditor.js +22 -0
- package/dist/editor/views/ItemEditor.js.map +1 -0
- package/dist/editor/views/SingleEditView.d.ts +8 -0
- package/dist/editor/views/SingleEditView.js +23 -0
- package/dist/editor/views/SingleEditView.js.map +1 -0
- package/dist/images/bg-shape-black.webp +0 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +6 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/page-wizard/PageWizard.d.ts +70 -0
- package/dist/page-wizard/PageWizard.js +60 -0
- package/dist/page-wizard/PageWizard.js.map +1 -0
- package/dist/page-wizard/SelectWizard.d.ts +7 -0
- package/dist/page-wizard/SelectWizard.js +41 -0
- package/dist/page-wizard/SelectWizard.js.map +1 -0
- package/dist/page-wizard/WizardSteps.d.ts +8 -0
- package/dist/page-wizard/WizardSteps.js +69 -0
- package/dist/page-wizard/WizardSteps.js.map +1 -0
- package/dist/page-wizard/service.d.ts +15 -0
- package/dist/page-wizard/service.js +22 -0
- package/dist/page-wizard/service.js.map +1 -0
- package/dist/page-wizard/startPageWizardCommand.d.ts +13 -0
- package/dist/page-wizard/startPageWizardCommand.js +21 -0
- package/dist/page-wizard/startPageWizardCommand.js.map +1 -0
- package/dist/page-wizard/steps/BuildPageStep.d.ts +2 -0
- package/dist/page-wizard/steps/BuildPageStep.js +133 -0
- package/dist/page-wizard/steps/BuildPageStep.js.map +1 -0
- package/dist/page-wizard/steps/CollectStep.d.ts +2 -0
- package/dist/page-wizard/steps/CollectStep.js +119 -0
- package/dist/page-wizard/steps/CollectStep.js.map +1 -0
- package/dist/page-wizard/steps/ComponentTypesSelector.d.ts +11 -0
- package/dist/page-wizard/steps/ComponentTypesSelector.js +209 -0
- package/dist/page-wizard/steps/ComponentTypesSelector.js.map +1 -0
- package/dist/page-wizard/steps/Components.d.ts +9 -0
- package/dist/page-wizard/steps/Components.js +89 -0
- package/dist/page-wizard/steps/Components.js.map +1 -0
- package/dist/page-wizard/steps/CreatePage.d.ts +12 -0
- package/dist/page-wizard/steps/CreatePage.js +140 -0
- package/dist/page-wizard/steps/CreatePage.js.map +1 -0
- package/dist/page-wizard/steps/CreatePageAndLayoutStep.d.ts +2 -0
- package/dist/page-wizard/steps/CreatePageAndLayoutStep.js +228 -0
- package/dist/page-wizard/steps/CreatePageAndLayoutStep.js.map +1 -0
- package/dist/page-wizard/steps/EditButton.d.ts +8 -0
- package/dist/page-wizard/steps/EditButton.js +5 -0
- package/dist/page-wizard/steps/EditButton.js.map +1 -0
- package/dist/page-wizard/steps/FieldEditor.d.ts +5 -0
- package/dist/page-wizard/steps/FieldEditor.js +28 -0
- package/dist/page-wizard/steps/FieldEditor.js.map +1 -0
- package/dist/page-wizard/steps/Generate.d.ts +5 -0
- package/dist/page-wizard/steps/Generate.js +10 -0
- package/dist/page-wizard/steps/Generate.js.map +1 -0
- package/dist/page-wizard/steps/ImagesStep.d.ts +2 -0
- package/dist/page-wizard/steps/ImagesStep.js +156 -0
- package/dist/page-wizard/steps/ImagesStep.js.map +1 -0
- package/dist/page-wizard/steps/LayoutStep.d.ts +2 -0
- package/dist/page-wizard/steps/LayoutStep.js +118 -0
- package/dist/page-wizard/steps/LayoutStep.js.map +1 -0
- package/dist/page-wizard/steps/SelectStep.d.ts +2 -0
- package/dist/page-wizard/steps/SelectStep.js +145 -0
- package/dist/page-wizard/steps/SelectStep.js.map +1 -0
- package/dist/page-wizard/steps/schema.d.ts +13 -0
- package/dist/page-wizard/steps/schema.js +137 -0
- package/dist/page-wizard/steps/schema.js.map +1 -0
- package/dist/page-wizard/steps/usePageCreator.d.ts +6 -0
- package/dist/page-wizard/steps/usePageCreator.js +192 -0
- package/dist/page-wizard/steps/usePageCreator.js.map +1 -0
- package/dist/splash-screen/NewPage.d.ts +3 -0
- package/dist/splash-screen/NewPage.js +129 -0
- package/dist/splash-screen/NewPage.js.map +1 -0
- package/dist/splash-screen/SectionHeadline.d.ts +4 -0
- package/dist/splash-screen/SectionHeadline.js +7 -0
- package/dist/splash-screen/SectionHeadline.js.map +1 -0
- package/dist/splash-screen/SplashScreen.d.ts +1 -0
- package/dist/splash-screen/SplashScreen.js +79 -0
- package/dist/splash-screen/SplashScreen.js.map +1 -0
- package/dist/styles.css +2739 -0
- package/dist/tour/Tour.d.ts +3 -0
- package/dist/tour/Tour.js +319 -0
- package/dist/tour/Tour.js.map +1 -0
- package/dist/tour/default-tour.d.ts +9 -0
- package/dist/tour/default-tour.js +229 -0
- package/dist/tour/default-tour.js.map +1 -0
- package/dist/tour/preview-tour.d.ts +2 -0
- package/dist/tour/preview-tour.js +91 -0
- package/dist/tour/preview-tour.js.map +1 -0
- package/dist/types.d.ts +259 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +12 -5
- package/src/components/ui/button.tsx +62 -0
- package/src/editor/Titlebar.tsx +2 -2
- package/src/editor/client/EditorClient.tsx +8 -9
- package/src/editor/menubar/ActionsMenu.tsx +1 -1
- package/src/editor/menubar/Menu.tsx +3 -3
- package/src/editor/menubar/VersionSelector.tsx +9 -10
- package/src/editor/page-editor-chrome/CommentHighlighting.tsx +8 -9
- package/src/editor/page-viewer/MiniMap.tsx +11 -11
- package/src/editor/reviews/Comment.tsx +38 -33
- package/src/editor/sidebar/ComponentTree.tsx +512 -512
- package/src/editor/sidebar/Insert.tsx +2 -2
- package/src/editor/sidebar/MainContentTree.tsx +1 -0
- package/src/editor/sidebar/Translations.tsx +12 -12
- package/src/editor/sidebar/ViewSelector.tsx +6 -7
- package/src/editor/ui/PerfectTree.tsx +2 -2
- package/src/editor/ui/SimpleTable.tsx +3 -6
- package/src/editor/utils.ts +32 -29
- package/src/index.ts +2 -0
- package/src/lib/utils.ts +6 -0
- package/src/splash-screen/SplashScreen.tsx +2 -2
- package/styles.css +124 -2
- package/tsconfig.build.json +23 -13
- package/tsconfig.json +3 -0
|
@@ -0,0 +1,690 @@
|
|
|
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);
|
|
22
|
+
if (!editContext || !pageViewContext)
|
|
23
|
+
return null;
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
pageViewContextRef.current = pageViewContext;
|
|
26
|
+
}, [pageViewContext]);
|
|
27
|
+
const editContextRef = useEditContextRef();
|
|
28
|
+
const iframeRef = pageViewContext.editorIframeRef;
|
|
29
|
+
const [showSpinner, setShowSpinner] = useState(false);
|
|
30
|
+
const [scroll, setScroll] = useState(0);
|
|
31
|
+
const [showMiniMap, setShowMiniMap] = useState(false);
|
|
32
|
+
const zoom = pageViewContext.zoom;
|
|
33
|
+
const blockBlurEventRef = useRef(0);
|
|
34
|
+
const [currentItemDescriptor, setCurrentItemDescriptor] = useState(undefined);
|
|
35
|
+
const pageItemDescriptor = pageViewContext.pageItemDescriptor;
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
//Workaround for iframeref updates not propagating to usePageViewContext
|
|
38
|
+
pageViewContext.setWorkaround((x) => !x);
|
|
39
|
+
}, [iframeRef.current]);
|
|
40
|
+
const updateMiniMapVisibility = useDebouncedCallback(() => {
|
|
41
|
+
if (!iframeRef.current)
|
|
42
|
+
return;
|
|
43
|
+
const iframe = iframeRef.current;
|
|
44
|
+
const doc = iframe.contentDocument;
|
|
45
|
+
if (!doc?.documentElement)
|
|
46
|
+
return;
|
|
47
|
+
const scrollContainer = doc.scrollingElement || doc.body;
|
|
48
|
+
if (!scrollContainer)
|
|
49
|
+
return;
|
|
50
|
+
const contentHeight = scrollContainer.scrollHeight;
|
|
51
|
+
const clientHeight = iframe.clientHeight;
|
|
52
|
+
const upperThreshold = clientHeight + 100; // show minimap if content exceeds this height
|
|
53
|
+
const lowerThreshold = clientHeight; // hide minimap if content falls below this
|
|
54
|
+
if (showMiniMap) {
|
|
55
|
+
if (contentHeight <= lowerThreshold) {
|
|
56
|
+
setShowMiniMap(false);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
if (contentHeight > upperThreshold) {
|
|
61
|
+
setShowMiniMap(true);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}, 100);
|
|
65
|
+
updateMiniMapVisibility();
|
|
66
|
+
function buildPageModel(iframeDocument) {
|
|
67
|
+
if (!iframeDocument ||
|
|
68
|
+
!editContextRef.current ||
|
|
69
|
+
!pageViewContextRef.current)
|
|
70
|
+
return;
|
|
71
|
+
const pageItemDescriptor = pageViewContextRef.current?.pageItemDescriptor;
|
|
72
|
+
if (!pageItemDescriptor)
|
|
73
|
+
return;
|
|
74
|
+
const pageItem = {
|
|
75
|
+
...pageItemDescriptor,
|
|
76
|
+
renderedFieldIds: [],
|
|
77
|
+
};
|
|
78
|
+
const start = performance.now();
|
|
79
|
+
const treeWalker = iframeDocument.createTreeWalker(iframeDocument.documentElement, // Root node to start traversal
|
|
80
|
+
NodeFilter.SHOW_ELEMENT, // Only show element nodes
|
|
81
|
+
null);
|
|
82
|
+
const root = {
|
|
83
|
+
placeholders: [],
|
|
84
|
+
id: "page",
|
|
85
|
+
type: "Page",
|
|
86
|
+
typeId: "",
|
|
87
|
+
name: "Page",
|
|
88
|
+
items: [pageItem],
|
|
89
|
+
datasourceItem: pageItem,
|
|
90
|
+
renderedDictionaryKeys: [],
|
|
91
|
+
editorFields: {},
|
|
92
|
+
};
|
|
93
|
+
let currentComponent = root;
|
|
94
|
+
let currentPlaceholder;
|
|
95
|
+
while (treeWalker.nextNode()) {
|
|
96
|
+
const node = treeWalker.currentNode;
|
|
97
|
+
if (node.nodeType !== Node.ELEMENT_NODE)
|
|
98
|
+
continue;
|
|
99
|
+
const element = node;
|
|
100
|
+
if (currentComponent && element.hasAttribute("data-fieldid")) {
|
|
101
|
+
const fieldId = element.getAttribute("data-fieldid");
|
|
102
|
+
const language = element.getAttribute("data-language") ||
|
|
103
|
+
currentComponent.datasourceItem?.language ||
|
|
104
|
+
pageItem.language;
|
|
105
|
+
const version = element.hasAttribute("data-version")
|
|
106
|
+
? parseInt(element.getAttribute("data-version"))
|
|
107
|
+
: currentComponent.datasourceItem?.version || pageItem.version;
|
|
108
|
+
const itemId = element.getAttribute("data-itemid") ||
|
|
109
|
+
currentComponent.datasourceItem?.id;
|
|
110
|
+
if (!itemId)
|
|
111
|
+
continue;
|
|
112
|
+
let renderedItem = currentComponent.items.find((x) => x.id === itemId && x.language === language && x.version === version);
|
|
113
|
+
if (!renderedItem) {
|
|
114
|
+
renderedItem = {
|
|
115
|
+
id: itemId,
|
|
116
|
+
language,
|
|
117
|
+
version,
|
|
118
|
+
renderedFieldIds: [],
|
|
119
|
+
};
|
|
120
|
+
currentComponent.items.push(renderedItem);
|
|
121
|
+
}
|
|
122
|
+
if (renderedItem.renderedFieldIds.indexOf(fieldId) === -1) {
|
|
123
|
+
renderedItem.renderedFieldIds.push(fieldId);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (element.tagName === "SCRIPT") {
|
|
127
|
+
const placeholderStartId = element.getAttribute("data-placeholder-start");
|
|
128
|
+
const placeholderEndId = element.getAttribute("data-placeholder-end");
|
|
129
|
+
const componentStartId = element.getAttribute("data-component-start");
|
|
130
|
+
const componentEndId = element.getAttribute("data-component-end");
|
|
131
|
+
const dictionaryKeyStart = element.getAttribute("data-dictionary-key-start");
|
|
132
|
+
const editorGroup = element.getAttribute("data-editor-group");
|
|
133
|
+
if (currentComponent && editorGroup) {
|
|
134
|
+
let group = currentComponent.editorFields[editorGroup];
|
|
135
|
+
if (!group) {
|
|
136
|
+
group = {
|
|
137
|
+
addFields: [],
|
|
138
|
+
removeFields: [],
|
|
139
|
+
};
|
|
140
|
+
currentComponent.editorFields[editorGroup] = group;
|
|
141
|
+
}
|
|
142
|
+
const addFields = element.getAttribute("data-add-fields")?.split(",");
|
|
143
|
+
const removeFields = element
|
|
144
|
+
.getAttribute("data-remove-fields")
|
|
145
|
+
?.split(",");
|
|
146
|
+
group.addFields = [...group.addFields, ...(addFields || [])];
|
|
147
|
+
group.removeFields = [...group.removeFields, ...(removeFields || [])];
|
|
148
|
+
}
|
|
149
|
+
if (dictionaryKeyStart) {
|
|
150
|
+
if (!currentComponent) {
|
|
151
|
+
console.error("Dictionary key without component:", dictionaryKeyStart);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
currentComponent.renderedDictionaryKeys.push(dictionaryKeyStart);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (placeholderStartId) {
|
|
158
|
+
if (!currentComponent) {
|
|
159
|
+
console.error("Placeholder start without component:", placeholderStartId, "Current placeholder", currentPlaceholder);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
currentPlaceholder = currentComponent.placeholders.find((x) => x.key === placeholderStartId);
|
|
163
|
+
if (!currentPlaceholder) {
|
|
164
|
+
currentPlaceholder = {
|
|
165
|
+
key: placeholderStartId,
|
|
166
|
+
name: placeholderStartId.indexOf(currentComponent.id + "_") === 0
|
|
167
|
+
? placeholderStartId.substring(currentComponent.id.length + 1)
|
|
168
|
+
: placeholderStartId,
|
|
169
|
+
description: "",
|
|
170
|
+
components: [],
|
|
171
|
+
parentComponent: currentComponent,
|
|
172
|
+
};
|
|
173
|
+
currentComponent.placeholders.push(currentPlaceholder);
|
|
174
|
+
}
|
|
175
|
+
currentComponent = undefined;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (placeholderEndId) {
|
|
179
|
+
currentComponent = currentPlaceholder?.parentComponent;
|
|
180
|
+
if (currentPlaceholder?.key !== placeholderEndId) {
|
|
181
|
+
console.error("Placeholder end does not match start", currentPlaceholder, placeholderEndId);
|
|
182
|
+
}
|
|
183
|
+
currentPlaceholder = undefined;
|
|
184
|
+
}
|
|
185
|
+
if (componentStartId) {
|
|
186
|
+
if (!currentPlaceholder) {
|
|
187
|
+
if (!currentComponent) {
|
|
188
|
+
console.error("Component start without parent component:", componentStartId);
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
currentPlaceholder = {
|
|
192
|
+
key: "implicit_" + componentStartId,
|
|
193
|
+
name: "no-placeholder",
|
|
194
|
+
description: "",
|
|
195
|
+
components: [],
|
|
196
|
+
parentComponent: currentComponent,
|
|
197
|
+
};
|
|
198
|
+
if (!currentComponent) {
|
|
199
|
+
console.error("Component start without placeholder or parent component");
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
currentComponent.placeholders.push(currentPlaceholder);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (currentPlaceholder) {
|
|
206
|
+
const language = element.getAttribute("data-language") || pageItem.language;
|
|
207
|
+
const version = element.hasAttribute("data-version")
|
|
208
|
+
? parseInt(element.getAttribute("data-version"))
|
|
209
|
+
: pageItem.version;
|
|
210
|
+
const itemId = element.getAttribute("data-itemid");
|
|
211
|
+
const datasourceItem = itemId
|
|
212
|
+
? {
|
|
213
|
+
id: itemId,
|
|
214
|
+
language,
|
|
215
|
+
version,
|
|
216
|
+
renderedFieldIds: [],
|
|
217
|
+
}
|
|
218
|
+
: undefined;
|
|
219
|
+
const layoutId = element.getAttribute("data-layoutid");
|
|
220
|
+
currentComponent = currentPlaceholder.components.find((x) => x.id === componentStartId);
|
|
221
|
+
if (!currentComponent) {
|
|
222
|
+
currentComponent = {
|
|
223
|
+
id: componentStartId,
|
|
224
|
+
name: "",
|
|
225
|
+
type: element.getAttribute("data-type") || "",
|
|
226
|
+
typeId: element.getAttribute("data-typeid") || "",
|
|
227
|
+
items: datasourceItem ? [datasourceItem] : [],
|
|
228
|
+
placeholders: [],
|
|
229
|
+
parentPlaceholder: currentPlaceholder,
|
|
230
|
+
renderedDictionaryKeys: [],
|
|
231
|
+
datasourceItem,
|
|
232
|
+
layoutId: layoutId || undefined,
|
|
233
|
+
editorFields: {},
|
|
234
|
+
};
|
|
235
|
+
currentPlaceholder.components.push(currentComponent);
|
|
236
|
+
}
|
|
237
|
+
currentPlaceholder = undefined;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if (componentEndId) {
|
|
241
|
+
if (!currentComponent || currentComponent.id !== componentEndId) {
|
|
242
|
+
console.error("Component end does not match start", currentComponent, componentEndId);
|
|
243
|
+
// Placeholder closed implicitly
|
|
244
|
+
if (currentPlaceholder?.parentComponent.id === componentEndId) {
|
|
245
|
+
currentComponent = currentPlaceholder.parentComponent;
|
|
246
|
+
currentPlaceholder = undefined;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
currentPlaceholder = currentComponent?.parentPlaceholder;
|
|
250
|
+
if (currentPlaceholder?.key.startsWith("implicit_")) {
|
|
251
|
+
currentComponent = currentPlaceholder.parentComponent;
|
|
252
|
+
}
|
|
253
|
+
else
|
|
254
|
+
currentComponent = undefined;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
const page = {
|
|
259
|
+
rootComponent: root,
|
|
260
|
+
item: pageItem,
|
|
261
|
+
editRevision: editContextRef.current?.revision ?? "",
|
|
262
|
+
};
|
|
263
|
+
const time = performance.now() - start;
|
|
264
|
+
console.log("PAGE MODEL SKELETON", page, time);
|
|
265
|
+
pageViewContextRef.current?.setPageSkeleton(page);
|
|
266
|
+
}
|
|
267
|
+
const buildPageModelThrottled = useThrottledCallback(buildPageModel, 1000);
|
|
268
|
+
const [iframeSrc, setIframeSrc] = useState();
|
|
269
|
+
useEffect(() => {
|
|
270
|
+
const isHeadless = pageViewContext.isHeadless;
|
|
271
|
+
if (!pageItemDescriptor || isHeadless === undefined)
|
|
272
|
+
return;
|
|
273
|
+
let renderUrl;
|
|
274
|
+
if (!isHeadless) {
|
|
275
|
+
// Sitecore MVC rendering
|
|
276
|
+
renderUrl = new URL(window.location.href);
|
|
277
|
+
renderUrl.pathname = "/";
|
|
278
|
+
renderUrl.searchParams.set("sc_itemid", pageItemDescriptor.id);
|
|
279
|
+
renderUrl.searchParams.set("sc_lang", pageItemDescriptor.language);
|
|
280
|
+
renderUrl.searchParams.set("sc_version", pageItemDescriptor.version.toString());
|
|
281
|
+
renderUrl.searchParams.set("sc_mode", editContext.previewMode ? "preview" : "edit");
|
|
282
|
+
renderUrl.searchParams.set("alpaca_editor", "1");
|
|
283
|
+
renderUrl.searchParams.set("sc_database", "master");
|
|
284
|
+
//renderUrl.searchParams.set(
|
|
285
|
+
// "sc_site",
|
|
286
|
+
// editContext.site?.name || "website"
|
|
287
|
+
// );
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
// Headless rendering
|
|
291
|
+
console.log("Headless rendering", pageItemDescriptor);
|
|
292
|
+
renderUrl = new URL(window.location.href);
|
|
293
|
+
if (editContext.configuration.services.renderService.path)
|
|
294
|
+
renderUrl.pathname =
|
|
295
|
+
editContext.configuration.services.renderService.path;
|
|
296
|
+
renderUrl.searchParams.set("itemid", pageItemDescriptor.id);
|
|
297
|
+
renderUrl.searchParams.set("lang", pageItemDescriptor.language);
|
|
298
|
+
renderUrl.searchParams.set("version", pageItemDescriptor.version.toString());
|
|
299
|
+
renderUrl.searchParams.set("site", editContext.pageView.site?.name || "website");
|
|
300
|
+
renderUrl.searchParams.set("mode", editContext.previewMode ? "preview" : "edit");
|
|
301
|
+
}
|
|
302
|
+
renderUrl.searchParams.set("edit_rev", editContext.revision ?? uuid());
|
|
303
|
+
if (iframeRef.current?.contentWindow?.requestRefresh) {
|
|
304
|
+
console.log("Integration - requesting refresh");
|
|
305
|
+
iframeRef.current?.contentWindow.requestRefresh(renderUrl.toString());
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
setShowSpinner(true);
|
|
309
|
+
console.log("No integration - reloading frame");
|
|
310
|
+
if (isHeadless) {
|
|
311
|
+
console.log("Setting iframe src", renderUrl.toString());
|
|
312
|
+
setIframeSrc(renderUrl.toString());
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
const initialLoad = currentItemDescriptor?.id !== pageItemDescriptor.id ||
|
|
316
|
+
currentItemDescriptor?.language !== pageItemDescriptor.language ||
|
|
317
|
+
currentItemDescriptor?.version !== pageItemDescriptor.version;
|
|
318
|
+
loadContent(renderUrl.toString(), initialLoad);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
setCurrentItemDescriptor(pageItemDescriptor);
|
|
322
|
+
}, [
|
|
323
|
+
pathname,
|
|
324
|
+
editContext.revision,
|
|
325
|
+
pageItemDescriptor,
|
|
326
|
+
pageViewContext.isHeadless,
|
|
327
|
+
editContext.previewMode,
|
|
328
|
+
]);
|
|
329
|
+
useEffect(() => {
|
|
330
|
+
if (editContext.focusedField) {
|
|
331
|
+
if (editContext.selection.length > 0 &&
|
|
332
|
+
editContext.focusedField.item.id !== editContext.selection[0])
|
|
333
|
+
return;
|
|
334
|
+
const fieldElement = findFieldElement(iframeRef.current, editContext.focusedField);
|
|
335
|
+
if (fieldElement) {
|
|
336
|
+
const rect = getAbsolutePosition(fieldElement, iframeRef.current);
|
|
337
|
+
const scrollTop = iframeRef.current?.contentWindow?.scrollY || 0;
|
|
338
|
+
const iframeHeight = iframeRef.current?.getBoundingClientRect().height;
|
|
339
|
+
const isInViewport = rect.y >= scrollTop && rect.y <= scrollTop + (iframeHeight || 0);
|
|
340
|
+
if (!isInViewport) {
|
|
341
|
+
iframeRef.current?.contentWindow?.scrollTo({
|
|
342
|
+
top: rect.y,
|
|
343
|
+
behavior: "smooth",
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
if (editContext.selection.length > 0) {
|
|
350
|
+
const lastSelectedComponent = getComponentById(editContext.selection[editContext.selection.length - 1], pageViewContextRef.current.page);
|
|
351
|
+
if (lastSelectedComponent) {
|
|
352
|
+
editContext.setScrollIntoView(lastSelectedComponent.id);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}, [editContext.focusedField, editContext.selection]);
|
|
357
|
+
const loadContent = async (href, initialLoad) => {
|
|
358
|
+
console.log("Loading content:", href);
|
|
359
|
+
const start = performance.now();
|
|
360
|
+
if (!href)
|
|
361
|
+
return;
|
|
362
|
+
const content = await fetch(href);
|
|
363
|
+
const text = await content.text();
|
|
364
|
+
console.log("Content loaded in " + (performance.now() - start) + " ms");
|
|
365
|
+
const doc = iframeRef.current?.contentDocument;
|
|
366
|
+
if (doc) {
|
|
367
|
+
if (initialLoad) {
|
|
368
|
+
doc.open();
|
|
369
|
+
doc.write(text);
|
|
370
|
+
doc.close();
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
const parser = new DOMParser();
|
|
374
|
+
const newDoc = parser.parseFromString(text, "text/html");
|
|
375
|
+
morphdom(doc.documentElement, newDoc.documentElement);
|
|
376
|
+
setShowSpinner(false);
|
|
377
|
+
}
|
|
378
|
+
if (mode === "edit" && !editContext.previewMode)
|
|
379
|
+
injectEditorCSS(doc);
|
|
380
|
+
buildPageModel(doc);
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
useEffect(() => {
|
|
384
|
+
if (!editContext.scrollIntoView ||
|
|
385
|
+
!iframeRef.current?.contentDocument?.documentElement)
|
|
386
|
+
return;
|
|
387
|
+
const rect = findComponentRect(iframeRef.current, editContext.scrollIntoView, true);
|
|
388
|
+
if (!rect)
|
|
389
|
+
return;
|
|
390
|
+
// Check if element is already in viewport
|
|
391
|
+
const iframeHeight = iframeRef.current.getBoundingClientRect().height;
|
|
392
|
+
const scrollTop = iframeRef.current?.contentWindow?.scrollY || 0;
|
|
393
|
+
const elementTop = rect.rect.y;
|
|
394
|
+
const isInViewport = elementTop >= scrollTop && elementTop <= scrollTop + iframeHeight;
|
|
395
|
+
// If already in viewport, no need to scroll
|
|
396
|
+
if (isInViewport) {
|
|
397
|
+
editContext.setScrollIntoView(undefined);
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
const scrollPosition = rect.rect.y - iframeHeight / 2 + rect.rect.height / 2;
|
|
401
|
+
iframeRef.current?.contentWindow?.scrollTo({
|
|
402
|
+
top: scrollPosition,
|
|
403
|
+
behavior: "smooth",
|
|
404
|
+
});
|
|
405
|
+
editContext.setScrollIntoView(undefined);
|
|
406
|
+
}, [editContext.scrollIntoView, pageViewContext.page]);
|
|
407
|
+
useEffect(() => {
|
|
408
|
+
const handleMessage = (message) => {
|
|
409
|
+
if (message.data.type === "editor-exitFullscreen") {
|
|
410
|
+
editContext.pageView.setFullscreen(false);
|
|
411
|
+
}
|
|
412
|
+
if (message.data.type === "editor-timings") {
|
|
413
|
+
editContext.setTimings(message.data.timings);
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
window.addEventListener("message", handleMessage);
|
|
417
|
+
return () => {
|
|
418
|
+
window.removeEventListener("message", handleMessage);
|
|
419
|
+
};
|
|
420
|
+
}, []);
|
|
421
|
+
const selecionChangeHandler = useThrottledCallback(() => {
|
|
422
|
+
const sel = iframeRef.current?.contentDocument?.getSelection();
|
|
423
|
+
if (sel && sel.rangeCount > 0) {
|
|
424
|
+
// Find the field element containing the selection
|
|
425
|
+
const fieldElement = findClosestFieldElement(sel.anchorNode);
|
|
426
|
+
if (!fieldElement)
|
|
427
|
+
return;
|
|
428
|
+
const fieldId = fieldElement.getAttribute("data-fieldid");
|
|
429
|
+
if (!fieldId)
|
|
430
|
+
return;
|
|
431
|
+
const range = sel.getRangeAt(0);
|
|
432
|
+
editContextRef.current?.setFocusedField({
|
|
433
|
+
fieldId: fieldId,
|
|
434
|
+
item: {
|
|
435
|
+
id: fieldElement.getAttribute("data-itemid") || "",
|
|
436
|
+
language: fieldElement.getAttribute("data-language") || "",
|
|
437
|
+
version: parseInt(fieldElement.getAttribute("data-version") || "0"),
|
|
438
|
+
},
|
|
439
|
+
}, true);
|
|
440
|
+
// Compute the global offsets relative to the field element.
|
|
441
|
+
const globalStartOffset = getGlobalTextOffset(fieldElement, range.startContainer, range.startOffset);
|
|
442
|
+
const globalEndOffset = getGlobalTextOffset(fieldElement, range.endContainer, range.endOffset);
|
|
443
|
+
editContextRef.current?.setSelectedRange({
|
|
444
|
+
fieldId: fieldId,
|
|
445
|
+
startOffset: globalStartOffset,
|
|
446
|
+
endOffset: globalEndOffset,
|
|
447
|
+
text: range.toString(),
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
}, 100);
|
|
451
|
+
useEffect(() => {
|
|
452
|
+
const iframe = iframeRef.current;
|
|
453
|
+
if (!iframe)
|
|
454
|
+
return;
|
|
455
|
+
const handleIframeMouseDown = async (event) => {
|
|
456
|
+
const target = event.target;
|
|
457
|
+
if (editContextRef.current?.isRefreshing)
|
|
458
|
+
return;
|
|
459
|
+
const componentId = findParentComponentId(target);
|
|
460
|
+
editContextRef.current?.setCurrentOverlay(undefined);
|
|
461
|
+
if (componentId) {
|
|
462
|
+
if (event.ctrlKey) {
|
|
463
|
+
const currentSelection = editContextRef.current?.selection || [];
|
|
464
|
+
if (currentSelection.indexOf(componentId) === -1)
|
|
465
|
+
editContextRef.current?.select([...currentSelection, componentId]);
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
editContextRef.current?.select([componentId]);
|
|
469
|
+
}
|
|
470
|
+
// if (mode !== "edit") {
|
|
471
|
+
//editContextRef.current?.setScrollIntoView(componentId);
|
|
472
|
+
//}
|
|
473
|
+
}
|
|
474
|
+
else
|
|
475
|
+
editContextRef.current?.select([]);
|
|
476
|
+
if (mode === "edit" &&
|
|
477
|
+
pageViewContextRef.current?.page?.item.canWriteItem) {
|
|
478
|
+
const fieldElement = findParentWithAttribute(target, "data-fieldid");
|
|
479
|
+
if (fieldElement?.hasAttribute("data-itemid")) {
|
|
480
|
+
const hasLock = await editContextRef.current?.setFocusedField(getFieldDescriptorFromElement(fieldElement), true);
|
|
481
|
+
blockBlurEventRef.current = Date.now() + 500;
|
|
482
|
+
if (hasLock) {
|
|
483
|
+
editContextRef.current?.setInlineEditingFieldElement(fieldElement);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
//Forward events so primereact overlays can close
|
|
488
|
+
const clickEvent = new MouseEvent("click", {
|
|
489
|
+
view: window,
|
|
490
|
+
bubbles: true,
|
|
491
|
+
cancelable: true,
|
|
492
|
+
clientX: event.clientX,
|
|
493
|
+
clientY: event.clientY,
|
|
494
|
+
});
|
|
495
|
+
document.dispatchEvent(clickEvent);
|
|
496
|
+
};
|
|
497
|
+
const handleIframeClick = async (event) => {
|
|
498
|
+
const target = event.target;
|
|
499
|
+
// Check if the click target is a link (anchor tag)
|
|
500
|
+
const anchor = target.tagName.toLowerCase() === "a" ? target : target.closest("a");
|
|
501
|
+
if (anchor) {
|
|
502
|
+
const href = anchor.href;
|
|
503
|
+
// Block only navigation links, allow anchor links and javascript links
|
|
504
|
+
if (href && !href.startsWith("#") && !href.startsWith("javascript:")) {
|
|
505
|
+
event.preventDefault();
|
|
506
|
+
console.log("Navigation link blocked:", href);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
const handleContextMenu = async (event) => {
|
|
511
|
+
if (editContextRef.current?.isRefreshing)
|
|
512
|
+
return;
|
|
513
|
+
const target = event.target;
|
|
514
|
+
if (!target)
|
|
515
|
+
return;
|
|
516
|
+
if (event.ctrlKey)
|
|
517
|
+
return;
|
|
518
|
+
event.preventDefault();
|
|
519
|
+
event.stopPropagation();
|
|
520
|
+
const componentId = findNearestComponentId(target);
|
|
521
|
+
if (componentId) {
|
|
522
|
+
if (!editContextRef.current?.selection.includes(componentId)) {
|
|
523
|
+
console.log("Selecting component CONTEXT MENU", componentId);
|
|
524
|
+
editContextRef.current.select([componentId]);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
const fieldElement = findParentWithAttribute(target, "data-fieldid");
|
|
528
|
+
const selectedComponents = editContextRef.current?.selection
|
|
529
|
+
.map((id) => getComponentById(id, pageViewContextRef.current.page))
|
|
530
|
+
.filter((x) => x);
|
|
531
|
+
const iframeRect = iframe.getBoundingClientRect();
|
|
532
|
+
const adjustedEvent = new MouseEvent("contextmenu", {
|
|
533
|
+
bubbles: true,
|
|
534
|
+
cancelable: true,
|
|
535
|
+
shiftKey: event.shiftKey,
|
|
536
|
+
altKey: event.altKey,
|
|
537
|
+
ctrlKey: event.ctrlKey,
|
|
538
|
+
view: window,
|
|
539
|
+
clientX: event.clientX + iframeRect.x,
|
|
540
|
+
clientY: event.clientY + iframeRect.y,
|
|
541
|
+
});
|
|
542
|
+
const field = fieldElement
|
|
543
|
+
? getFieldDescriptorFromElement(fieldElement)
|
|
544
|
+
: undefined;
|
|
545
|
+
const fieldButtons = field ? await loadFieldButtons(field) : [];
|
|
546
|
+
if (showComponentContextMenu(selectedComponents, editContextRef.current, field, fieldButtons)(adjustedEvent)) {
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
const handleLoad = () => {
|
|
550
|
+
setShowSpinner(false);
|
|
551
|
+
const iframeDocument = iframe.contentDocument || iframe.contentWindow?.document;
|
|
552
|
+
if (iframeDocument) {
|
|
553
|
+
iframeDocument.documentElement.addEventListener("mousedown", handleIframeMouseDown);
|
|
554
|
+
iframeDocument.documentElement.addEventListener("click", handleIframeClick);
|
|
555
|
+
iframe.contentWindow?.addEventListener("contextmenu", handleContextMenu, true);
|
|
556
|
+
const scrollContainer = iframe.contentWindow?.document.scrollingElement ||
|
|
557
|
+
iframe.contentWindow?.document.body;
|
|
558
|
+
scrollContainer?.addEventListener("scroll", () => {
|
|
559
|
+
const scrollTop = scrollContainer.scrollTop || 0;
|
|
560
|
+
scrollHandler(scrollTop);
|
|
561
|
+
});
|
|
562
|
+
iframe.contentWindow?.addEventListener("scroll", () => {
|
|
563
|
+
const scrollTop = scrollContainer?.scrollTop || 0;
|
|
564
|
+
scrollHandler(scrollTop);
|
|
565
|
+
});
|
|
566
|
+
iframeDocument.addEventListener("selectionchange", selecionChangeHandler);
|
|
567
|
+
iframeDocument.addEventListener("keydown", (event) => {
|
|
568
|
+
editContextRef.current?.handleKeyDown(event);
|
|
569
|
+
});
|
|
570
|
+
iframeDocument.documentElement?.addEventListener("blur", () => {
|
|
571
|
+
// Block blur event if it was triggered by clicking on a field
|
|
572
|
+
if (blockBlurEventRef.current < Date.now()) {
|
|
573
|
+
//editContext.setFocusedField(undefined, false);
|
|
574
|
+
editContext.setInlineEditingFieldElement(undefined);
|
|
575
|
+
}
|
|
576
|
+
else {
|
|
577
|
+
blockBlurEventRef.current = 0;
|
|
578
|
+
}
|
|
579
|
+
}, true);
|
|
580
|
+
const observer = new MutationObserver((records) => {
|
|
581
|
+
// Ignore all text field edits
|
|
582
|
+
if (records.some((x) => !(x &&
|
|
583
|
+
"getAttribute" in x.target &&
|
|
584
|
+
x.target.getAttribute("data-fieldid") &&
|
|
585
|
+
x.target.getAttribute("data-itemid")))) {
|
|
586
|
+
buildPageModelThrottled(iframeDocument);
|
|
587
|
+
}
|
|
588
|
+
});
|
|
589
|
+
observer.observe(iframeDocument, {
|
|
590
|
+
childList: true, // observe direct children changes
|
|
591
|
+
subtree: true, // observe all descendants changes
|
|
592
|
+
characterData: false, // observe text changes
|
|
593
|
+
//attributes: true, // observe attribute changes (like style or class)
|
|
594
|
+
});
|
|
595
|
+
buildPageModel(iframeDocument);
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
if (iframe) {
|
|
599
|
+
iframe.addEventListener("load", handleLoad);
|
|
600
|
+
}
|
|
601
|
+
// Cleanup function
|
|
602
|
+
return () => {
|
|
603
|
+
if (iframe) {
|
|
604
|
+
iframe.removeEventListener("load", handleLoad);
|
|
605
|
+
const iframeDocument = iframe.contentDocument || iframe.contentWindow?.document;
|
|
606
|
+
if (iframeDocument) {
|
|
607
|
+
iframeDocument.documentElement.removeEventListener("click", handleIframeMouseDown);
|
|
608
|
+
iframeDocument.documentElement.removeEventListener("contextmenu", handleContextMenu);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
}, [iframeRef.current]);
|
|
613
|
+
useEffect(() => {
|
|
614
|
+
iframeRef.current?.contentWindow?.postMessage({ type: "componentsSelected", componentIds: editContext.selection }, "*");
|
|
615
|
+
}, [editContext.selection]);
|
|
616
|
+
const updateScrollPosition = (e) => {
|
|
617
|
+
setScroll(e);
|
|
618
|
+
if (mode === "edit")
|
|
619
|
+
pageViewContextRef.current?.setScroll(e);
|
|
620
|
+
};
|
|
621
|
+
useEffect(() => {
|
|
622
|
+
if (!iframeRef.current)
|
|
623
|
+
return;
|
|
624
|
+
const body = iframeRef.current.contentWindow?.document.documentElement;
|
|
625
|
+
if (!body)
|
|
626
|
+
return;
|
|
627
|
+
body.style.transform = `scale(${zoom})`;
|
|
628
|
+
body.style.transformOrigin = "top center";
|
|
629
|
+
body.style.overflow = "auto";
|
|
630
|
+
//body.style.height = `${body.scrollHeight / zoom}px`;
|
|
631
|
+
}, [zoom]);
|
|
632
|
+
const scrollHandler = useThrottledCallback(updateScrollPosition, 100);
|
|
633
|
+
if (pageViewContext.page?.item && !pageViewContext.page?.item.hasLayout) {
|
|
634
|
+
return _jsx(NoLayout, {});
|
|
635
|
+
}
|
|
636
|
+
const deviceHeight = pageViewContext.device === "desktop" || !pageViewContext.deviceHeight
|
|
637
|
+
? "100%"
|
|
638
|
+
: pageViewContext.deviceHeight || 640;
|
|
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: {
|
|
640
|
+
width: pageViewContext.device === "desktop" ||
|
|
641
|
+
pageViewContext.device === "Responsive"
|
|
642
|
+
? "100%"
|
|
643
|
+
: (pageViewContext.deviceWidth || 640) +
|
|
644
|
+
editContext.configuration.outline.width +
|
|
645
|
+
"px",
|
|
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"
|
|
647
|
+
? undefined
|
|
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, {}) })] }))] })] }));
|
|
649
|
+
}
|
|
650
|
+
export function injectEditorCSS(iframeDocument) {
|
|
651
|
+
if (!iframeDocument)
|
|
652
|
+
return;
|
|
653
|
+
const style = iframeDocument.createElement("style");
|
|
654
|
+
style.textContent = `[contentEditable]:empty:before {
|
|
655
|
+
content: attr(placeholder);
|
|
656
|
+
opacity: 0.6;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
[contenteditable] {
|
|
660
|
+
outline: 0px solid transparent;
|
|
661
|
+
}
|
|
662
|
+
`;
|
|
663
|
+
if (iframeDocument && iframeDocument.head) {
|
|
664
|
+
iframeDocument.head.appendChild(style);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Calculates the global offset of a given target node and its local offset,
|
|
669
|
+
* relative to the container's complete text content.
|
|
670
|
+
*
|
|
671
|
+
* @param container - The container element that holds the text nodes.
|
|
672
|
+
* @param targetNode - The text node where the selection starts or ends.
|
|
673
|
+
* @param localOffset - The offset within the target text node.
|
|
674
|
+
* @returns The computed global offset.
|
|
675
|
+
*/
|
|
676
|
+
function getGlobalTextOffset(container, targetNode, localOffset) {
|
|
677
|
+
let globalOffset = 0;
|
|
678
|
+
const walker = document.createTreeWalker(container, NodeFilter.SHOW_TEXT, null);
|
|
679
|
+
while (walker.nextNode()) {
|
|
680
|
+
const currentNode = walker.currentNode;
|
|
681
|
+
// If we've reached the target node, add the local offset and return.
|
|
682
|
+
if (currentNode === targetNode) {
|
|
683
|
+
return globalOffset + localOffset;
|
|
684
|
+
}
|
|
685
|
+
// Otherwise, add the length of this text node.
|
|
686
|
+
globalOffset += (currentNode.textContent || "").length;
|
|
687
|
+
}
|
|
688
|
+
return globalOffset;
|
|
689
|
+
}
|
|
690
|
+
//# sourceMappingURL=PageViewerFrame.js.map
|