@alpaca-editor/core 1.0.3939 → 1.0.3942
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/components/ActionButton.d.ts +1 -0
- package/dist/components/ActionButton.js +2 -2
- package/dist/components/ActionButton.js.map +1 -1
- package/dist/editor/FieldActionsOverlay.d.ts +1 -0
- package/dist/editor/FieldActionsOverlay.js +2 -11
- package/dist/editor/FieldActionsOverlay.js.map +1 -1
- package/dist/editor/PictureCropper.js +65 -23
- package/dist/editor/PictureCropper.js.map +1 -1
- package/dist/editor/PictureEditor.js +16 -2
- package/dist/editor/PictureEditor.js.map +1 -1
- package/dist/editor/Titlebar.js +1 -1
- package/dist/editor/Titlebar.js.map +1 -1
- package/dist/editor/ai/GhostWriter.js +21 -2
- package/dist/editor/ai/GhostWriter.js.map +1 -1
- package/dist/editor/commands/componentCommands.js +7 -3
- package/dist/editor/commands/componentCommands.js.map +1 -1
- package/dist/editor/media-selector/MediaFolderBrowser.d.ts +5 -0
- package/dist/editor/media-selector/MediaFolderBrowser.js +77 -0
- package/dist/editor/media-selector/MediaFolderBrowser.js.map +1 -0
- package/dist/editor/media-selector/MediaSelector.js +1 -1
- package/dist/editor/media-selector/MediaSelector.js.map +1 -1
- package/dist/editor/media-selector/Thumbnails.js +2 -2
- package/dist/editor/media-selector/index.d.ts +8 -0
- package/dist/editor/media-selector/index.js +9 -0
- package/dist/editor/media-selector/index.js.map +1 -0
- package/dist/editor/menubar/BrowseHistory.js +1 -1
- package/dist/editor/menubar/PageSelector.js +39 -15
- package/dist/editor/menubar/PageSelector.js.map +1 -1
- package/dist/editor/page-editor-chrome/useInlineAICompletion.js +37 -11
- package/dist/editor/page-editor-chrome/useInlineAICompletion.js.map +1 -1
- package/dist/editor/reviews/Comment.js +1 -1
- package/dist/editor/reviews/Comment.js.map +1 -1
- package/dist/editor/services/aiService.js +0 -1
- package/dist/editor/services/aiService.js.map +1 -1
- package/dist/editor/sidebar/ComponentTree.js +3 -4
- package/dist/editor/sidebar/ComponentTree.js.map +1 -1
- package/dist/editor/ui/SimpleTabs.d.ts +1 -0
- package/dist/editor/ui/SimpleTabs.js +3 -3
- package/dist/editor/ui/SimpleTabs.js.map +1 -1
- package/dist/editor/ui/Splitter.js +61 -6
- package/dist/editor/ui/Splitter.js.map +1 -1
- package/dist/editor/views/MediaFolderEditView.d.ts +4 -0
- package/dist/editor/views/MediaFolderEditView.js +40 -0
- package/dist/editor/views/MediaFolderEditView.js.map +1 -0
- package/dist/editor/views/SingleEditView.js +9 -1
- package/dist/editor/views/SingleEditView.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/dist/styles.css +61 -5
- package/package.json +8 -2
- package/.prettierrc +0 -3
- package/build.css +0 -3
- package/components.json +0 -21
- package/eslint.config.mjs +0 -4
- package/images/bg-shape-black.webp +0 -0
- package/images/wizard-bg.png +0 -0
- package/images/wizard-tour.png +0 -0
- package/images/wizard.png +0 -0
- package/src/client-components/api.ts +0 -6
- package/src/client-components/index.ts +0 -19
- package/src/components/ActionButton.tsx +0 -41
- package/src/components/Error.tsx +0 -57
- package/src/components/ui/CardConnector.tsx +0 -56
- package/src/components/ui/button.tsx +0 -62
- package/src/components/ui/card.tsx +0 -372
- package/src/components/ui/context-menu.tsx +0 -250
- package/src/config/config.tsx +0 -917
- package/src/config/types.ts +0 -286
- package/src/editor/ComponentInfo.tsx +0 -90
- package/src/editor/ConfirmationDialog.tsx +0 -103
- package/src/editor/ContentTree.tsx +0 -730
- package/src/editor/ContextMenu.tsx +0 -230
- package/src/editor/Editor.tsx +0 -90
- package/src/editor/EditorWarning.tsx +0 -34
- package/src/editor/EditorWarnings.tsx +0 -33
- package/src/editor/FieldActionsOverlay.tsx +0 -307
- package/src/editor/FieldEditorPopup.tsx +0 -65
- package/src/editor/FieldHistory.tsx +0 -75
- package/src/editor/FieldList.tsx +0 -190
- package/src/editor/FieldListField.tsx +0 -391
- package/src/editor/FieldListFieldWithFallbacks.tsx +0 -217
- package/src/editor/FloatingToolbar.tsx +0 -163
- package/src/editor/ImageEditor.tsx +0 -128
- package/src/editor/ItemInfo.tsx +0 -90
- package/src/editor/LinkEditorDialog.tsx +0 -196
- package/src/editor/MainLayout.tsx +0 -95
- package/src/editor/MobileLayout.tsx +0 -68
- package/src/editor/NewEditorClient.tsx +0 -11
- package/src/editor/PictureCropper.tsx +0 -503
- package/src/editor/PictureEditor.tsx +0 -277
- package/src/editor/PictureEditorDialog.tsx +0 -381
- package/src/editor/PublishDialog.ignore +0 -74
- package/src/editor/ScrollingContentTree.tsx +0 -67
- package/src/editor/Terminal.tsx +0 -227
- package/src/editor/Titlebar.tsx +0 -104
- package/src/editor/ai/AiPopup.tsx +0 -59
- package/src/editor/ai/AiResponseMessage.tsx +0 -106
- package/src/editor/ai/AiTerminal.tsx +0 -503
- package/src/editor/ai/AiToolCall.tsx +0 -61
- package/src/editor/ai/EditorAiTerminal.tsx +0 -20
- package/src/editor/ai/GhostWriter.tsx +0 -432
- package/src/editor/ai/aiPageModel.ts +0 -108
- package/src/editor/ai/editorAiContext.ts +0 -18
- package/src/editor/client/AboutDialog.tsx +0 -44
- package/src/editor/client/EditorClient.tsx +0 -2241
- package/src/editor/client/GenericDialog.tsx +0 -50
- package/src/editor/client/editContext.ts +0 -416
- package/src/editor/client/helpers.ts +0 -44
- package/src/editor/client/itemsRepository.ts +0 -574
- package/src/editor/client/operations.ts +0 -768
- package/src/editor/client/pageModelBuilder.ts +0 -219
- package/src/editor/commands/commands.ts +0 -22
- package/src/editor/commands/componentCommands.tsx +0 -424
- package/src/editor/commands/createVersionCommand.ts +0 -33
- package/src/editor/commands/deleteVersionCommand.ts +0 -71
- package/src/editor/commands/itemCommands.tsx +0 -351
- package/src/editor/commands/localizeItem/LocalizeItemDialog.tsx +0 -201
- package/src/editor/commands/localizeItem/LocalizeItemUtils.ts +0 -27
- package/src/editor/commands/undo.ts +0 -39
- package/src/editor/component-designer/ComponentDesigner.tsx +0 -70
- package/src/editor/component-designer/ComponentDesignerAiTerminal.tsx +0 -11
- package/src/editor/component-designer/ComponentDesignerMenu.tsx +0 -91
- package/src/editor/component-designer/ComponentEditor.tsx +0 -97
- package/src/editor/component-designer/ComponentRenderingCodeEditor.tsx +0 -31
- package/src/editor/component-designer/ComponentRenderingEditor.tsx +0 -104
- package/src/editor/component-designer/ComponentsDropdown.tsx +0 -39
- package/src/editor/component-designer/PlaceholdersEditor.tsx +0 -179
- package/src/editor/component-designer/RenderingsDropdown.tsx +0 -36
- package/src/editor/component-designer/TemplateEditor.tsx +0 -236
- package/src/editor/component-designer/aiContext.ts +0 -23
- package/src/editor/componentTreeHelper.tsx +0 -116
- package/src/editor/context-menu/CopyMoveMenu.tsx +0 -103
- package/src/editor/context-menu/InsertMenu.tsx +0 -347
- package/src/editor/control-center/About.tsx +0 -342
- package/src/editor/control-center/ControlCenterMenu.tsx +0 -76
- package/src/editor/control-center/IndexOverview.tsx +0 -50
- package/src/editor/control-center/IndexSettings.tsx +0 -266
- package/src/editor/control-center/Info.tsx +0 -104
- package/src/editor/control-center/QuotaInfo.tsx +0 -301
- package/src/editor/control-center/Status.tsx +0 -113
- package/src/editor/control-center/WebSocketMessages.tsx +0 -155
- package/src/editor/editor-warnings/ItemLocked.tsx +0 -63
- package/src/editor/editor-warnings/NoLanguageWriteAccess.tsx +0 -22
- package/src/editor/editor-warnings/NoWorkflowWriteAccess.tsx +0 -23
- package/src/editor/editor-warnings/NoWriteAccess.tsx +0 -16
- package/src/editor/editor-warnings/ValidationErrors.tsx +0 -54
- package/src/editor/field-types/AttachmentEditor.tsx +0 -9
- package/src/editor/field-types/CheckboxEditor.tsx +0 -47
- package/src/editor/field-types/DropLinkEditor.tsx +0 -80
- package/src/editor/field-types/DropListEditor.tsx +0 -84
- package/src/editor/field-types/ImageFieldEditor.tsx +0 -65
- package/src/editor/field-types/InternalLinkFieldEditor.tsx +0 -117
- package/src/editor/field-types/LinkFieldEditor.tsx +0 -85
- package/src/editor/field-types/MultiLineText.tsx +0 -82
- package/src/editor/field-types/PictureFieldEditor.tsx +0 -121
- package/src/editor/field-types/RawEditor.tsx +0 -53
- package/src/editor/field-types/ReactQuill.tsx +0 -580
- package/src/editor/field-types/RichTextEditor.tsx +0 -22
- package/src/editor/field-types/RichTextEditorComponent.tsx +0 -127
- package/src/editor/field-types/SingleLineText.tsx +0 -174
- package/src/editor/field-types/TreeListEditor.tsx +0 -261
- package/src/editor/fieldTypes.ts +0 -140
- package/src/editor/media-selector/AiImageSearch.tsx +0 -185
- package/src/editor/media-selector/AiImageSearchPrompt.tsx +0 -94
- package/src/editor/media-selector/MediaSelector.tsx +0 -42
- package/src/editor/media-selector/Preview.tsx +0 -14
- package/src/editor/media-selector/Thumbnails.tsx +0 -48
- package/src/editor/media-selector/TreeSelector.tsx +0 -292
- package/src/editor/media-selector/UploadZone.tsx +0 -137
- package/src/editor/menubar/ActionsMenu.tsx +0 -94
- package/src/editor/menubar/ActiveUsers.tsx +0 -17
- package/src/editor/menubar/ApproveAndPublish.tsx +0 -18
- package/src/editor/menubar/BrowseHistory.tsx +0 -28
- package/src/editor/menubar/ItemLanguageVersion.tsx +0 -76
- package/src/editor/menubar/LanguageSelector.tsx +0 -226
- package/src/editor/menubar/Menu.tsx +0 -83
- package/src/editor/menubar/NavButtons.tsx +0 -74
- package/src/editor/menubar/PageSelector.tsx +0 -166
- package/src/editor/menubar/PageViewerControls.tsx +0 -120
- package/src/editor/menubar/PreviewSecondaryControls.tsx +0 -18
- package/src/editor/menubar/SecondaryControls.tsx +0 -45
- package/src/editor/menubar/Separator.tsx +0 -12
- package/src/editor/menubar/SiteInfo.tsx +0 -53
- package/src/editor/menubar/User.tsx +0 -27
- package/src/editor/menubar/VersionSelector.tsx +0 -142
- package/src/editor/page-editor-chrome/CommentHighlighting.tsx +0 -307
- package/src/editor/page-editor-chrome/CommentHighlightings.tsx +0 -35
- package/src/editor/page-editor-chrome/FieldActionIndicator.tsx +0 -59
- package/src/editor/page-editor-chrome/FieldActionIndicators.tsx +0 -23
- package/src/editor/page-editor-chrome/FieldEditedIndicator.tsx +0 -64
- package/src/editor/page-editor-chrome/FieldEditedIndicators.tsx +0 -35
- package/src/editor/page-editor-chrome/FrameMenu.tsx +0 -338
- package/src/editor/page-editor-chrome/FrameMenus.tsx +0 -48
- package/src/editor/page-editor-chrome/InlineEditor.tsx +0 -765
- package/src/editor/page-editor-chrome/LockedFieldIndicator.tsx +0 -61
- package/src/editor/page-editor-chrome/NoLayout.tsx +0 -36
- package/src/editor/page-editor-chrome/PageEditorChrome.tsx +0 -122
- package/src/editor/page-editor-chrome/PictureEditorOverlay.tsx +0 -161
- package/src/editor/page-editor-chrome/PlaceholderDropZone.tsx +0 -169
- package/src/editor/page-editor-chrome/PlaceholderDropZones.tsx +0 -315
- package/src/editor/page-editor-chrome/SuggestionHighlighting.tsx +0 -300
- package/src/editor/page-editor-chrome/SuggestionHighlightings.tsx +0 -40
- package/src/editor/page-editor-chrome/useInlineAICompletion.tsx +0 -791
- package/src/editor/page-viewer/DeviceToolbar.tsx +0 -70
- package/src/editor/page-viewer/EditorForm.tsx +0 -258
- package/src/editor/page-viewer/MiniMap.tsx +0 -362
- package/src/editor/page-viewer/PageViewer.tsx +0 -169
- package/src/editor/page-viewer/PageViewerFrame.tsx +0 -1022
- package/src/editor/page-viewer/pageModelSkeletonBuilder.ts +0 -412
- package/src/editor/page-viewer/pageViewContext.ts +0 -186
- package/src/editor/pageModel.ts +0 -220
- package/src/editor/picture-shared.tsx +0 -53
- package/src/editor/reviews/Comment.tsx +0 -307
- package/src/editor/reviews/Comments.tsx +0 -125
- package/src/editor/reviews/DiffView.tsx +0 -109
- package/src/editor/reviews/PreviewInfo.tsx +0 -35
- package/src/editor/reviews/Reviews.tsx +0 -280
- package/src/editor/reviews/SuggestedEdit.tsx +0 -316
- package/src/editor/reviews/reviewCommands.tsx +0 -47
- package/src/editor/reviews/useReviews.tsx +0 -70
- package/src/editor/services/aiService.ts +0 -174
- package/src/editor/services/componentDesignerService.ts +0 -151
- package/src/editor/services/contentService.ts +0 -180
- package/src/editor/services/editService.ts +0 -488
- package/src/editor/services/indexService.ts +0 -24
- package/src/editor/services/reviewsService.ts +0 -53
- package/src/editor/services/serviceHelper.ts +0 -95
- package/src/editor/services/suggestedEditsService.ts +0 -39
- package/src/editor/services/systemService.ts +0 -5
- package/src/editor/services/translationService.ts +0 -21
- package/src/editor/services-server/api.ts +0 -150
- package/src/editor/services-server/graphQL.ts +0 -106
- package/src/editor/sidebar/ComponentPalette.tsx +0 -161
- package/src/editor/sidebar/ComponentTree.tsx +0 -548
- package/src/editor/sidebar/ComponentTree2.tsxx +0 -490
- package/src/editor/sidebar/Debug.tsx +0 -111
- package/src/editor/sidebar/DictionaryEditor.tsx +0 -261
- package/src/editor/sidebar/EditHistory.tsx +0 -134
- package/src/editor/sidebar/GraphQL.tsx +0 -164
- package/src/editor/sidebar/Insert.tsx +0 -35
- package/src/editor/sidebar/MainContentTree.tsx +0 -102
- package/src/editor/sidebar/Performance.tsx +0 -53
- package/src/editor/sidebar/Sessions.tsx +0 -35
- package/src/editor/sidebar/Sidebar.tsx +0 -20
- package/src/editor/sidebar/SidebarView.tsx +0 -152
- package/src/editor/sidebar/Translations.tsx +0 -295
- package/src/editor/sidebar/Validation.tsx +0 -102
- package/src/editor/sidebar/ViewSelector.tsx +0 -60
- package/src/editor/sidebar/Workbox.tsx +0 -209
- package/src/editor/ui/CenteredMessage.tsx +0 -7
- package/src/editor/ui/CopyMoveTargetSelectorDialog.tsx +0 -81
- package/src/editor/ui/CopyToClipboardButton.tsx +0 -24
- package/src/editor/ui/DialogButtons.tsx +0 -11
- package/src/editor/ui/Icons.tsx +0 -709
- package/src/editor/ui/ItemList.tsx +0 -76
- package/src/editor/ui/ItemNameDialogNew.tsx +0 -118
- package/src/editor/ui/ItemSearch.tsx +0 -153
- package/src/editor/ui/PerfectTree.tsx +0 -571
- package/src/editor/ui/Section.tsx +0 -35
- package/src/editor/ui/SimpleIconButton.tsx +0 -54
- package/src/editor/ui/SimpleMenu.tsx +0 -40
- package/src/editor/ui/SimpleTable.tsx +0 -60
- package/src/editor/ui/SimpleTabs.tsx +0 -55
- package/src/editor/ui/SimpleToolbar.tsx +0 -7
- package/src/editor/ui/Spinner.tsx +0 -9
- package/src/editor/ui/Splitter.tsx +0 -314
- package/src/editor/ui/StackedPanels.tsx +0 -134
- package/src/editor/ui/Toolbar.tsx +0 -7
- package/src/editor/utils/id-helper.ts +0 -3
- package/src/editor/utils/insertOptions.ts +0 -69
- package/src/editor/utils/itemutils.ts +0 -29
- package/src/editor/utils/useMemoDebug.ts +0 -28
- package/src/editor/utils.ts +0 -486
- package/src/editor/views/CompareView.tsx +0 -245
- package/src/editor/views/EditView.tsx +0 -27
- package/src/editor/views/ItemEditor.tsx +0 -58
- package/src/editor/views/SingleEditView.tsx +0 -46
- package/src/fonts/Geist-Black.woff2 +0 -0
- package/src/fonts/Geist-Bold.woff2 +0 -0
- package/src/fonts/Geist-ExtraBold.woff2 +0 -0
- package/src/fonts/Geist-ExtraLight.woff2 +0 -0
- package/src/fonts/Geist-Light.woff2 +0 -0
- package/src/fonts/Geist-Medium.woff2 +0 -0
- package/src/fonts/Geist-Regular.woff2 +0 -0
- package/src/fonts/Geist-SemiBold.woff2 +0 -0
- package/src/fonts/Geist-Thin.woff2 +0 -0
- package/src/fonts/Geist[wght].woff2 +0 -0
- package/src/fonts/index.ts +0 -10
- package/src/index.ts +0 -23
- package/src/lib/safelist.tsx +0 -16
- package/src/lib/utils.ts +0 -6
- package/src/page-wizard/PageWizard.tsx +0 -139
- package/src/page-wizard/WizardBox.tsx +0 -4
- package/src/page-wizard/WizardBoxConnector.tsx +0 -56
- package/src/page-wizard/WizardSteps.tsx +0 -458
- package/src/page-wizard/service.ts +0 -35
- package/src/page-wizard/startPageWizardCommand.ts +0 -26
- package/src/page-wizard/steps/BuildPageStep.tsx +0 -259
- package/src/page-wizard/steps/CollectStep.tsx +0 -296
- package/src/page-wizard/steps/ComponentTypesSelector.tsx +0 -454
- package/src/page-wizard/steps/Components.tsx +0 -193
- package/src/page-wizard/steps/ContentStep.tsx +0 -890
- package/src/page-wizard/steps/EditButton.tsx +0 -34
- package/src/page-wizard/steps/FieldEditor.tsx +0 -102
- package/src/page-wizard/steps/Generate.tsx +0 -60
- package/src/page-wizard/steps/ImagesStep.tsx +0 -382
- package/src/page-wizard/steps/LayoutStep.tsx +0 -227
- package/src/page-wizard/steps/MetaDataStep.tsx +0 -173
- package/src/page-wizard/steps/SelectStep.tsx +0 -281
- package/src/page-wizard/steps/schema.ts +0 -180
- package/src/page-wizard/steps/usePageCreator.ts +0 -325
- package/src/page-wizard/usePageWizard.ts +0 -79
- package/src/revision.ts +0 -2
- package/src/splash-screen/NewPage.tsx +0 -294
- package/src/splash-screen/OpenPage.tsx +0 -113
- package/src/splash-screen/RecentPages.tsx +0 -123
- package/src/splash-screen/SectionHeadline.tsx +0 -21
- package/src/splash-screen/SplashScreen.tsx +0 -195
- package/src/tour/Tour.tsx +0 -566
- package/src/tour/default-tour.tsx +0 -301
- package/src/tour/preview-tour.tsx +0 -128
- package/src/types.ts +0 -335
- package/styles.css +0 -765
- package/tsconfig.build.json +0 -31
- package/tsconfig.json +0 -14
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { Dialog } from "primereact/dialog";
|
|
2
|
-
|
|
3
|
-
import { forwardRef, useImperativeHandle, useState } from "react";
|
|
4
|
-
|
|
5
|
-
export interface GenericDialogHandle {
|
|
6
|
-
show: (props: {
|
|
7
|
-
title: string;
|
|
8
|
-
content: React.ReactNode;
|
|
9
|
-
width?: string;
|
|
10
|
-
height?: string;
|
|
11
|
-
}) => void;
|
|
12
|
-
hide: () => void;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const GenericDialog = forwardRef<GenericDialogHandle>((_, ref) => {
|
|
16
|
-
const [content, setContent] = useState<React.ReactNode>(null);
|
|
17
|
-
const [title, setTitle] = useState<string>("");
|
|
18
|
-
const [width, setWidth] = useState<string>("50vw");
|
|
19
|
-
const [height, setHeight] = useState<string>("50vh");
|
|
20
|
-
const [visible, setVisible] = useState<boolean>(false);
|
|
21
|
-
|
|
22
|
-
const show = (props: {
|
|
23
|
-
title: string;
|
|
24
|
-
content: React.ReactNode;
|
|
25
|
-
width?: string;
|
|
26
|
-
height?: string;
|
|
27
|
-
}) => {
|
|
28
|
-
setTitle(props.title);
|
|
29
|
-
setContent(props.content);
|
|
30
|
-
if (props.width) setWidth(props.width);
|
|
31
|
-
if (props.height) setHeight(props.height);
|
|
32
|
-
setVisible(true);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
useImperativeHandle(ref, () => ({
|
|
36
|
-
show,
|
|
37
|
-
hide: () => setVisible(false),
|
|
38
|
-
}));
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<Dialog
|
|
42
|
-
onHide={() => setVisible(false)}
|
|
43
|
-
visible={visible}
|
|
44
|
-
header={title}
|
|
45
|
-
style={{ width, height }}
|
|
46
|
-
>
|
|
47
|
-
{content}
|
|
48
|
-
</Dialog>
|
|
49
|
-
);
|
|
50
|
-
});
|
|
@@ -1,416 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import React, {
|
|
4
|
-
MouseEvent,
|
|
5
|
-
ReactNode,
|
|
6
|
-
useContext,
|
|
7
|
-
useEffect,
|
|
8
|
-
useRef,
|
|
9
|
-
} from "react";
|
|
10
|
-
import { ToastMessage } from "primereact/toast";
|
|
11
|
-
|
|
12
|
-
import { EditorConfiguration, EditorView } from "../../config/types";
|
|
13
|
-
import {
|
|
14
|
-
FieldAction,
|
|
15
|
-
InsertingState,
|
|
16
|
-
QuotaInfo,
|
|
17
|
-
WebSocketMessage,
|
|
18
|
-
} from "./EditorClient";
|
|
19
|
-
import { MenuItem } from "primereact/menuitem";
|
|
20
|
-
import { Command, CommandData } from "../commands/commands";
|
|
21
|
-
import { ComponentDetails } from "../services/componentDesignerService";
|
|
22
|
-
import { PageViewContext } from "../page-viewer/pageViewContext";
|
|
23
|
-
import {
|
|
24
|
-
EditOperation,
|
|
25
|
-
EditSession,
|
|
26
|
-
FieldDescriptor,
|
|
27
|
-
HistoryEntry,
|
|
28
|
-
InsertOption,
|
|
29
|
-
LanguageVersions,
|
|
30
|
-
User,
|
|
31
|
-
ValidationResult,
|
|
32
|
-
Comment,
|
|
33
|
-
WorkboxItem,
|
|
34
|
-
Review,
|
|
35
|
-
AddComponentOperation,
|
|
36
|
-
SuggestedEdit,
|
|
37
|
-
UserInfo,
|
|
38
|
-
} from "../../types";
|
|
39
|
-
|
|
40
|
-
import { ConfirmationProps } from "../ConfirmationDialog";
|
|
41
|
-
import {
|
|
42
|
-
Component,
|
|
43
|
-
FieldButton,
|
|
44
|
-
ItemDescriptor,
|
|
45
|
-
Page,
|
|
46
|
-
Timings,
|
|
47
|
-
FullItem,
|
|
48
|
-
Version,
|
|
49
|
-
Field,
|
|
50
|
-
} from "../pageModel";
|
|
51
|
-
import { ItemsRepository } from "./itemsRepository";
|
|
52
|
-
import { MediaSelectorMode } from "../media-selector/MediaSelector";
|
|
53
|
-
import { ComponentCommand } from "../commands/componentCommands";
|
|
54
|
-
import { AiTerminalOptions } from "../ai/AiTerminal";
|
|
55
|
-
import {
|
|
56
|
-
Wizard,
|
|
57
|
-
WizardData,
|
|
58
|
-
WizardPageModel,
|
|
59
|
-
} from "../../page-wizard/PageWizard";
|
|
60
|
-
export type DragObject = {
|
|
61
|
-
type: "template" | "component" | "link-component" | "items";
|
|
62
|
-
typeId: string;
|
|
63
|
-
templateId?: string;
|
|
64
|
-
name?: string;
|
|
65
|
-
component?: ItemDescriptor;
|
|
66
|
-
items?: ItemDescriptor[];
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export type SelectionRange = {
|
|
70
|
-
itemId: string;
|
|
71
|
-
fieldId: string;
|
|
72
|
-
startOffset: number;
|
|
73
|
-
endOffset: number;
|
|
74
|
-
text: string;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export type DialogProps<T> = {
|
|
78
|
-
onClose: (result: T | null) => void;
|
|
79
|
-
};
|
|
80
|
-
export type OpenDialog = <T, P>(
|
|
81
|
-
Component: React.ComponentType<P & DialogProps<T>>,
|
|
82
|
-
props: P,
|
|
83
|
-
) => Promise<T | null>;
|
|
84
|
-
|
|
85
|
-
export type EditorMode = "edit" | "preview" | "suggestions";
|
|
86
|
-
|
|
87
|
-
export type EditContextType = {
|
|
88
|
-
operations: {
|
|
89
|
-
moveItems: (
|
|
90
|
-
items: ItemDescriptor[],
|
|
91
|
-
target: ItemDescriptor,
|
|
92
|
-
index: number,
|
|
93
|
-
) => Promise<void>;
|
|
94
|
-
copyItems: (
|
|
95
|
-
items: ItemDescriptor[],
|
|
96
|
-
target: ItemDescriptor,
|
|
97
|
-
index: number,
|
|
98
|
-
) => Promise<ItemDescriptor[]>;
|
|
99
|
-
duplicateItem: (
|
|
100
|
-
item: ItemDescriptor,
|
|
101
|
-
target: ItemDescriptor,
|
|
102
|
-
name: string,
|
|
103
|
-
) => Promise<ItemDescriptor | undefined>;
|
|
104
|
-
addComponent: (
|
|
105
|
-
componentTypeId: string,
|
|
106
|
-
placeholderKey: string,
|
|
107
|
-
index: number,
|
|
108
|
-
pageItem: ItemDescriptor,
|
|
109
|
-
) => Promise<AddComponentOperation | undefined>;
|
|
110
|
-
|
|
111
|
-
duplicateComponents: ({ componentIds }: { componentIds: string[] }) => void;
|
|
112
|
-
|
|
113
|
-
ensureLock: (field: FieldDescriptor) => Promise<boolean>;
|
|
114
|
-
lockItems: (item: ItemDescriptor[]) => void;
|
|
115
|
-
unlockItems: (item: ItemDescriptor[]) => void;
|
|
116
|
-
editField: (props: {
|
|
117
|
-
field: FieldDescriptor;
|
|
118
|
-
value?: any;
|
|
119
|
-
rawValue?: string | null;
|
|
120
|
-
refresh?: "none" | "immediate" | "delayed" | "waitForQuietPeriod";
|
|
121
|
-
}) => Promise<void>;
|
|
122
|
-
undo: (numOperations?: number) => Promise<boolean>;
|
|
123
|
-
redo: () => Promise<boolean>;
|
|
124
|
-
executeEditOperation: (operation: EditOperation) => void;
|
|
125
|
-
executeWorkflowCommand: (
|
|
126
|
-
item: ItemDescriptor,
|
|
127
|
-
commandId: string,
|
|
128
|
-
) => Promise<void>;
|
|
129
|
-
renameItem: (item: ItemDescriptor, newName: string) => Promise<void>;
|
|
130
|
-
deleteItems: (items: ItemDescriptor[]) => Promise<void>;
|
|
131
|
-
createItem: (
|
|
132
|
-
parent: ItemDescriptor,
|
|
133
|
-
templateId: string,
|
|
134
|
-
name: string,
|
|
135
|
-
) => Promise<ItemDescriptor | undefined>;
|
|
136
|
-
createVersion: (item: ItemDescriptor) => Promise<void>;
|
|
137
|
-
undoing: boolean;
|
|
138
|
-
};
|
|
139
|
-
comments: Comment[];
|
|
140
|
-
suggestedEdits: SuggestedEdit[];
|
|
141
|
-
loadComments: () => void;
|
|
142
|
-
setComments: React.Dispatch<React.SetStateAction<Comment[]>>;
|
|
143
|
-
selectedComment: Comment | undefined;
|
|
144
|
-
setSelectedComment: React.Dispatch<React.SetStateAction<Comment | undefined>>;
|
|
145
|
-
showComments: boolean;
|
|
146
|
-
setShowComments: React.Dispatch<React.SetStateAction<boolean>>;
|
|
147
|
-
addComment: () => void;
|
|
148
|
-
item?: FullItem;
|
|
149
|
-
|
|
150
|
-
workboxItems: WorkboxItem[];
|
|
151
|
-
|
|
152
|
-
itemLanguages: LanguageVersions[];
|
|
153
|
-
itemVersions: Version[];
|
|
154
|
-
view?: EditorView;
|
|
155
|
-
|
|
156
|
-
viewName: string;
|
|
157
|
-
switchView: (
|
|
158
|
-
viewName: string,
|
|
159
|
-
options?: { skipConfirmation?: boolean },
|
|
160
|
-
) => void;
|
|
161
|
-
compareMode: boolean;
|
|
162
|
-
setCompareMode: (compareMode: boolean) => void;
|
|
163
|
-
|
|
164
|
-
mode: EditorMode;
|
|
165
|
-
setMode: React.Dispatch<React.SetStateAction<EditorMode>>;
|
|
166
|
-
|
|
167
|
-
showSuggestedEdits: boolean;
|
|
168
|
-
setShowSuggestedEdits: React.Dispatch<React.SetStateAction<boolean>>;
|
|
169
|
-
showSuggestedEditsDiff: boolean;
|
|
170
|
-
setShowSuggestedEditsDiff: React.Dispatch<React.SetStateAction<boolean>>;
|
|
171
|
-
setCenterPanelView: (view: ReactNode) => void;
|
|
172
|
-
configuration: EditorConfiguration;
|
|
173
|
-
showToast: (message: ToastMessage | ToastMessage[]) => void;
|
|
174
|
-
sessionId: string;
|
|
175
|
-
openSplashScreen: () => void;
|
|
176
|
-
getComponentCommands: (component: Component[]) => Promise<ComponentCommand[]>;
|
|
177
|
-
selectMedia: ({
|
|
178
|
-
selectedIdPath,
|
|
179
|
-
mode,
|
|
180
|
-
}: {
|
|
181
|
-
selectedIdPath: string;
|
|
182
|
-
mode: MediaSelectorMode;
|
|
183
|
-
}) => Promise<string | null>;
|
|
184
|
-
|
|
185
|
-
updateUrl: (params: Record<string, string>) => void;
|
|
186
|
-
|
|
187
|
-
selection: string[];
|
|
188
|
-
select: (ids: string[]) => void;
|
|
189
|
-
selectedForInsertion: string;
|
|
190
|
-
selectedRange?: SelectionRange;
|
|
191
|
-
setSelectedRange: React.Dispatch<
|
|
192
|
-
React.SetStateAction<SelectionRange | undefined>
|
|
193
|
-
>;
|
|
194
|
-
|
|
195
|
-
setSelectedForInsertion: React.Dispatch<React.SetStateAction<string>>;
|
|
196
|
-
insertMode: boolean;
|
|
197
|
-
setInsertMode: React.Dispatch<React.SetStateAction<boolean>>;
|
|
198
|
-
inserting: InsertingState | undefined;
|
|
199
|
-
|
|
200
|
-
dragStart: (dragObject: DragObject) => void;
|
|
201
|
-
dragEnd: () => void;
|
|
202
|
-
dragObject?: DragObject;
|
|
203
|
-
refreshCompletedFlag: boolean;
|
|
204
|
-
isRefreshing: boolean;
|
|
205
|
-
openCreatePageDialog: () => void;
|
|
206
|
-
|
|
207
|
-
reviews: {
|
|
208
|
-
reviews: Review[];
|
|
209
|
-
loadReviews: () => void;
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
droppedInPlaceholder: (
|
|
213
|
-
placeholderKey: string,
|
|
214
|
-
index: number,
|
|
215
|
-
spotPositionElement?: Element,
|
|
216
|
-
spotPositionAnchor?: "left" | "right" | "top" | "bottom",
|
|
217
|
-
insertOption?: InsertOption,
|
|
218
|
-
) => void;
|
|
219
|
-
|
|
220
|
-
lockedField: FieldDescriptor | undefined;
|
|
221
|
-
requestRefresh: (
|
|
222
|
-
mode?: "immediate" | "delayed" | "waitForQuietPeriod",
|
|
223
|
-
) => void;
|
|
224
|
-
page?: Page;
|
|
225
|
-
|
|
226
|
-
currentItemDescriptor?: ItemDescriptor;
|
|
227
|
-
|
|
228
|
-
setScrollIntoView: React.Dispatch<React.SetStateAction<string | undefined>>;
|
|
229
|
-
scrollIntoView?: string;
|
|
230
|
-
focusedField?: FieldDescriptor;
|
|
231
|
-
setFocusedField: (
|
|
232
|
-
field: FieldDescriptor | undefined,
|
|
233
|
-
requestLock: boolean,
|
|
234
|
-
) => Promise<boolean>;
|
|
235
|
-
unlockField: (field: FieldDescriptor) => void;
|
|
236
|
-
|
|
237
|
-
readonly: boolean;
|
|
238
|
-
triggerFieldAction: (
|
|
239
|
-
field: FieldDescriptor,
|
|
240
|
-
action: FieldButton,
|
|
241
|
-
parameters?: Record<string, string>,
|
|
242
|
-
) => void;
|
|
243
|
-
activeFieldActions: FieldAction[];
|
|
244
|
-
showContextMenu(e: any, menuItems: MenuItem[]): void;
|
|
245
|
-
setCurrentOverlay: React.Dispatch<React.SetStateAction<any>>;
|
|
246
|
-
currentOverlay?: any;
|
|
247
|
-
|
|
248
|
-
showAiPopup: (
|
|
249
|
-
event: MouseEvent<HTMLElement>,
|
|
250
|
-
aiTerminalOptions?: AiTerminalOptions,
|
|
251
|
-
) => void;
|
|
252
|
-
showFieldEditorPopup: (fields: Field[], sections: string[], ev: any) => void;
|
|
253
|
-
validationResult: ValidationResult[] | undefined;
|
|
254
|
-
contentEditorItem: FullItem | undefined;
|
|
255
|
-
|
|
256
|
-
loadItem: (
|
|
257
|
-
itemToLoad: ItemDescriptor | string,
|
|
258
|
-
options?: { addToBrowseHistory?: boolean },
|
|
259
|
-
) => Promise<FullItem | undefined>;
|
|
260
|
-
editHistory: EditOperation[];
|
|
261
|
-
activeSessions: EditSession[];
|
|
262
|
-
validating: boolean;
|
|
263
|
-
isCommandDisabled: <T extends CommandData>({
|
|
264
|
-
command,
|
|
265
|
-
data,
|
|
266
|
-
}: {
|
|
267
|
-
command: Command<T>;
|
|
268
|
-
data?: T;
|
|
269
|
-
}) => boolean;
|
|
270
|
-
|
|
271
|
-
executeCommand: <T extends CommandData>({
|
|
272
|
-
command,
|
|
273
|
-
data,
|
|
274
|
-
event,
|
|
275
|
-
}: {
|
|
276
|
-
command: Command<T>;
|
|
277
|
-
data?: T;
|
|
278
|
-
event?: React.SyntheticEvent;
|
|
279
|
-
}) => Promise<any>;
|
|
280
|
-
|
|
281
|
-
componentDesignerComponent: ComponentDetails | undefined;
|
|
282
|
-
setComponentDesignerComponent: React.Dispatch<
|
|
283
|
-
React.SetStateAction<ComponentDetails | undefined>
|
|
284
|
-
>;
|
|
285
|
-
componentDesignerRendering: FullItem | undefined;
|
|
286
|
-
setComponentDesignerRendering: React.Dispatch<
|
|
287
|
-
React.SetStateAction<FullItem | undefined>
|
|
288
|
-
>;
|
|
289
|
-
inlineEditingFieldElement?: HTMLElement;
|
|
290
|
-
setInlineEditingFieldElement: React.Dispatch<
|
|
291
|
-
React.SetStateAction<HTMLElement | undefined>
|
|
292
|
-
>;
|
|
293
|
-
timings: Timings;
|
|
294
|
-
setTimings: React.Dispatch<React.SetStateAction<Timings>>;
|
|
295
|
-
pageView: PageViewContext;
|
|
296
|
-
|
|
297
|
-
confirm: (props: ConfirmationProps) => void;
|
|
298
|
-
showMessageDialog: (props: { header: string; message: string }) => void;
|
|
299
|
-
|
|
300
|
-
itemsRepository: ItemsRepository;
|
|
301
|
-
browseHistory: HistoryEntry[];
|
|
302
|
-
handleKeyDown: (event: KeyboardEvent) => void;
|
|
303
|
-
startTour: () => void;
|
|
304
|
-
|
|
305
|
-
addSocketMessageListener: (
|
|
306
|
-
callback: (message: { type: string; payload: any }) => void,
|
|
307
|
-
) => () => void;
|
|
308
|
-
compareTo?: ItemDescriptor;
|
|
309
|
-
setCompareTo: React.Dispatch<
|
|
310
|
-
React.SetStateAction<ItemDescriptor | undefined>
|
|
311
|
-
>;
|
|
312
|
-
lastEditedFields: EditedField[];
|
|
313
|
-
revision?: string;
|
|
314
|
-
user?: User;
|
|
315
|
-
statusMessage: React.ReactNode;
|
|
316
|
-
setStatusMessage: React.Dispatch<React.SetStateAction<React.ReactNode>>;
|
|
317
|
-
|
|
318
|
-
enableCompletions: boolean;
|
|
319
|
-
setEnableCompletions: React.Dispatch<React.SetStateAction<boolean>>;
|
|
320
|
-
quotaInfo: QuotaInfo | null;
|
|
321
|
-
isQuotaExceeded: boolean;
|
|
322
|
-
getQuotaWarningMessage: () => string | null;
|
|
323
|
-
isMobile: boolean;
|
|
324
|
-
|
|
325
|
-
openDialog: OpenDialog;
|
|
326
|
-
|
|
327
|
-
pageWizard: {
|
|
328
|
-
wizard: Wizard | undefined;
|
|
329
|
-
setWizard: React.Dispatch<React.SetStateAction<Wizard | undefined>>;
|
|
330
|
-
parentItem: ItemDescriptor | undefined;
|
|
331
|
-
setParentItem: React.Dispatch<
|
|
332
|
-
React.SetStateAction<ItemDescriptor | undefined>
|
|
333
|
-
>;
|
|
334
|
-
// Wizard step state
|
|
335
|
-
currentStepIndex: number;
|
|
336
|
-
setCurrentStepIndex: React.Dispatch<React.SetStateAction<number>>;
|
|
337
|
-
data: WizardData;
|
|
338
|
-
setData: React.Dispatch<React.SetStateAction<WizardData>>;
|
|
339
|
-
pageModel: WizardPageModel;
|
|
340
|
-
setPageModel: React.Dispatch<React.SetStateAction<WizardPageModel>>;
|
|
341
|
-
internalState: any;
|
|
342
|
-
setInternalState: React.Dispatch<React.SetStateAction<any>>;
|
|
343
|
-
stepCompleted: number;
|
|
344
|
-
setStepCompleted: React.Dispatch<React.SetStateAction<number>>;
|
|
345
|
-
pageItem: ItemDescriptor | undefined;
|
|
346
|
-
setPageItem: React.Dispatch<
|
|
347
|
-
React.SetStateAction<ItemDescriptor | undefined>
|
|
348
|
-
>;
|
|
349
|
-
beforeNextCallbackRef: React.MutableRefObject<
|
|
350
|
-
(() => Promise<boolean>) | null
|
|
351
|
-
>;
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
webSocketMessages: WebSocketMessage[];
|
|
355
|
-
clearWebSocketMessages: () => void;
|
|
356
|
-
userInfo: UserInfo;
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
const EditContext = React.createContext<EditContextType | undefined>(undefined);
|
|
360
|
-
export const EditContextProvider = EditContext.Provider;
|
|
361
|
-
|
|
362
|
-
export const useEditContext = () => useContext(EditContext);
|
|
363
|
-
|
|
364
|
-
export function useEditContextRef() {
|
|
365
|
-
const contextValue = useEditContext();
|
|
366
|
-
const contextRef = useRef(contextValue);
|
|
367
|
-
|
|
368
|
-
useEffect(() => {
|
|
369
|
-
contextRef.current = contextValue;
|
|
370
|
-
}, [contextValue]);
|
|
371
|
-
|
|
372
|
-
return contextRef;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
export type EditButton = {
|
|
376
|
-
id: string;
|
|
377
|
-
icon: React.ReactNode;
|
|
378
|
-
onClick: (ev: MouseEvent) => void;
|
|
379
|
-
label: string;
|
|
380
|
-
};
|
|
381
|
-
|
|
382
|
-
export type ModifiedField = FieldDescriptor & {
|
|
383
|
-
value: string | null;
|
|
384
|
-
isDirty: boolean;
|
|
385
|
-
modifiedBy: User;
|
|
386
|
-
timestamp: number;
|
|
387
|
-
};
|
|
388
|
-
|
|
389
|
-
export type ModifiedFieldsContextType = {
|
|
390
|
-
modifiedFields: ModifiedField[];
|
|
391
|
-
clear: () => void;
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
export type EditedField = FieldDescriptor & {
|
|
395
|
-
timestamp: number;
|
|
396
|
-
user: User;
|
|
397
|
-
};
|
|
398
|
-
|
|
399
|
-
const ModifiedFieldsContext = React.createContext<
|
|
400
|
-
ModifiedFieldsContextType | undefined
|
|
401
|
-
>(undefined);
|
|
402
|
-
|
|
403
|
-
export const useModifiedFieldsContext = () => useContext(ModifiedFieldsContext);
|
|
404
|
-
export const ModifiedFieldsContextProvider = ModifiedFieldsContext.Provider;
|
|
405
|
-
|
|
406
|
-
export type OperationsContextType = {
|
|
407
|
-
executingEditOperations: EditOperation[];
|
|
408
|
-
editOperationExecuted: EditOperation | undefined;
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
const OperationsContext = React.createContext<
|
|
412
|
-
OperationsContextType | undefined
|
|
413
|
-
>(undefined);
|
|
414
|
-
|
|
415
|
-
export const useOperationsContext = () => useContext(OperationsContext);
|
|
416
|
-
export const OperationsContextProvider = OperationsContext.Provider;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { EditorConfiguration } from "../../config/types";
|
|
2
|
-
import { ConfirmationDialogHandle } from "../ConfirmationDialog";
|
|
3
|
-
import { ExecutionResult } from "../services/editService";
|
|
4
|
-
|
|
5
|
-
export function handleErrorResult(
|
|
6
|
-
result: ExecutionResult<unknown>,
|
|
7
|
-
ui: {
|
|
8
|
-
showErrorToast: (error: { summary: string; details: string }) => void;
|
|
9
|
-
confirmationDialogRef: React.RefObject<ConfirmationDialogHandle | null>;
|
|
10
|
-
},
|
|
11
|
-
state: {
|
|
12
|
-
configuration: EditorConfiguration;
|
|
13
|
-
}
|
|
14
|
-
) {
|
|
15
|
-
if (result.type === "error") {
|
|
16
|
-
console.log("show error toast", result);
|
|
17
|
-
|
|
18
|
-
ui.showErrorToast({
|
|
19
|
-
summary: result.summary || "Error",
|
|
20
|
-
details: result.details || "An error occurred",
|
|
21
|
-
});
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (result.type === "unauthorized") {
|
|
26
|
-
if (state.configuration.events.onUnauthorized) {
|
|
27
|
-
state.configuration.events.onUnauthorized();
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
ui.confirmationDialogRef.current?.confirm({
|
|
32
|
-
header: "Not logged in",
|
|
33
|
-
message: "You are not logged in anymore. Proceed to login page?",
|
|
34
|
-
accept: () => {
|
|
35
|
-
window.location.href = "/sitecore/login";
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
ui.showErrorToast({
|
|
39
|
-
summary: result.summary || "Error",
|
|
40
|
-
details: result.details || "An error occurred",
|
|
41
|
-
});
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
}
|